| | |
| | | <!-- |
| | | * @Date: 2024-04-04 22:45:43 |
| | | * @LastEditors: gaoshp |
| | | * @LastEditTime: 2024-10-02 20:52:59 |
| | | * @LastEditTime: 2024-10-09 22:59:25 |
| | | * @FilePath: /cps-web/src/views/console/base/CalenderTab.vue |
| | | --> |
| | | <template> |
| | |
| | | </el-header> |
| | | <el-main> |
| | | <el-row :gutter="12" v-show="shiftListName.length > 0"> |
| | | <el-button v-for="item in shiftListName">{{ item.code + '-' + item.name |
| | | <el-button v-for="item in shiftListName" |
| | | :style="{ backgroundColor: item.colour || '#2563eb', color: '#fff' }">{{ |
| | | item.code + |
| | | '-' + |
| | | item.name |
| | | }}</el-button> |
| | | </el-row> |
| | | <el-row> |
| | |
| | | this.drawerInfo = this.selectInfo |
| | | }, |
| | | relationWork() { |
| | | this.$HTTP.post('/api/blade-cps/group/groupWorkstation', { groupCategory: 1, groupType: 'group_workstation' }).then(res => { |
| | | this.$HTTP.post('/api/smis/group/groupWorkstation', { groupCategory: 1, groupType: 'group_workstation' }).then(res => { |
| | | if (res.code === 200) { |
| | | this.raworkVisible = true |
| | | this.workStations = this.formatData(res.data) |
| | | console.log(this.workStations) |
| | | } |
| | | }) |
| | | |
| | |
| | | } else { |
| | | this.save(workstation.map(v => v.id)) |
| | | } |
| | | console.log(this.$refs.workstations.getCheckedNodes().filter(v => v.isWorkstation)) |
| | | // console.log(this.$refs.workstations.getCheckedNodes().filter(v => v.isWorkstation)) |
| | | }, |
| | | save(workstationIdList) { |
| | | console.log(workstationIdList, this.selectInfo) |
| | | this.$HTTP.post('/api/blade-cps/calendar/associate-workstation', { |
| | | this.$HTTP.post('/api/smis/calendar/associate-workstation', { |
| | | calendarCode: this.selectInfo.code, |
| | | workstationIdList |
| | | }).then(res => { |
| | |
| | | }) |
| | | }, |
| | | dayclick(day) { |
| | | console.log(day) |
| | | // console.log(day) |
| | | }, |
| | | init() { |
| | | this.$HTTP.post('/api/blade-cps/shift/list', { statusList: [1] }).then(res => { |
| | | this.$HTTP.post('/api/smis/shift/list', { statusList: [1] }).then(res => { |
| | | if (res.code === 200) { |
| | | this.shiftList = res.data |
| | | } |
| | |
| | | select(row) { |
| | | |
| | | this.months = [] |
| | | this.$HTTP.get(`/api/blade-cps/calendar/${row.id}`).then(res => { |
| | | this.$HTTP.get(`/api/smis/calendar/${row.id}`).then(res => { |
| | | if (res.code === 200) { |
| | | console.log(res.data) |
| | | // console.log(res.data) |
| | | this.setDay(res.data) |
| | | console.log('////', this.shiftList, res.data.calendarDayVOList[0].id) |
| | | // console.log('////', this.shiftList, res.data.calendarDayVOList[0].id) |
| | | let modelIds = [...new Set(res.data.calendarDayVOList.map(v => v.modelId))] |
| | | if (modelIds.length > 0) { |
| | | this.shiftListName = this.shiftList.filter(v => modelIds.includes(v.id)) |
| | |
| | | }) |
| | | }, |
| | | table_del() { |
| | | this.$HTTP.delete(`/api/blade-cps/calendar/${this.selectInfo.id}`).then(res => { |
| | | this.$HTTP.delete(`/api/smis/calendar/${this.selectInfo.id}`).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success("操作成功"); |
| | | this.load(true) |
| | |
| | | }, |
| | | setDay(data) { |
| | | let year = data.year |
| | | this.$HTTP.post('/api/blade-cps/shift-off-day/list', { |
| | | this.$HTTP.post('/api/smis/shift-off-day/list', { |
| | | year: year, |
| | | startOffDay: `${year}-01-01`, |
| | | endOffDay: `${year}-12-31` |
| | |
| | | }) |
| | | |
| | | for (let i = 0; i < 12; i++) { |
| | | data.calendarDayVOList.map(v => v.modelId) |
| | | |
| | | let modelIds = [...new Set(data.calendarDayVOList.map(v => v.modelId))] |
| | | let ext = modelIds.map(v => { |
| | | let ban = this.shiftListName.find(item => item.id === v) |
| | | console.log(ban.colour) |
| | | return { |
| | | highlight: color.stringToColor(v), |
| | | highlight: { |
| | | // color: ban.colour || color.stringToColor(v), |
| | | // fillMode: 'light', |
| | | style: { |
| | | 'background-color': ban.colour |
| | | } |
| | | }, |
| | | dates: data.calendarDayVOList.filter(item => { |
| | | return moment(item.calendarDate).month() === i && item.modelId === v |
| | | }).map(v => v.calendarDate), |
| | |
| | | }, |
| | | } |
| | | }) |
| | | console.log('---------youxian') |
| | | |
| | | this.months.push({ |
| | | year: year, |
| | | month: i, |
| | |
| | | return moment(item).month() === i |
| | | }) |
| | | }, |
| | | ...ext |
| | | ...ext, |
| | | // 优先 |
| | | { |
| | | dates: data.calendarDayVOList.filter(item => { |
| | | return moment(item.calendarDate).month() === i |
| | | }).filter(item => item.isHighPriority).map(item => item.calendarDate), |
| | | bar: { |
| | | style: { |
| | | backgroundColor: 'red', |
| | | } |
| | | }, |
| | | } |
| | | ] |
| | | }) |
| | | } |
| | | console.log(this.months, '------------') |
| | | |
| | | } |
| | | }) |
| | | |