From 8eda199da3781f4c8e0d95f47a092db342c85ed7 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期三, 09 十月 2024 11:40:51 +0800
Subject: [PATCH] 1
---
src/views/console/base/CalenderTab.vue | 92 +++++++++++++++++++++++++++++++++++----------
1 files changed, 71 insertions(+), 21 deletions(-)
diff --git a/src/views/console/base/CalenderTab.vue b/src/views/console/base/CalenderTab.vue
index b3ab3b5..422f0ca 100644
--- a/src/views/console/base/CalenderTab.vue
+++ b/src/views/console/base/CalenderTab.vue
@@ -1,8 +1,8 @@
<!--
* @Date: 2024-04-04 22:45:43
- * @LastEditors: gaosp
- * @LastEditTime: 2024-09-07 15:15:29
- * @FilePath: /mdc/Users/mache/Documents/demo/cps-web/src/views/console/base/CalenderTab.vue
+ * @LastEditors: gaoshp
+ * @LastEditTime: 2024-10-08 22:01:18
+ * @FilePath: /cps-web/src/views/console/base/CalenderTab.vue
-->
<template>
<el-container>
@@ -21,7 +21,7 @@
<el-header>
<span>鏃ュ巻銆恵{ selectInfo.code }}銆憑{ selectInfo.name }}</span>
<el-button type="primary" style="margin-left: auto;" size="small" @click="relationWork">鍏宠仈宸ヤ綅</el-button>
- <!-- <el-button type="primary" size="small">缂栬緫鏃ュ巻</el-button> -->
+ <el-button type="primary" size="small" @click="edit">缂栬緫鏃ュ巻</el-button>
<el-popconfirm title="纭畾鍒犻櫎鍚楋紵" @confirm="table_del">
<template #reference>
<el-button type="primary" size="small">鍒犻櫎</el-button>
@@ -29,18 +29,33 @@
</el-popconfirm>
</el-header>
<el-main>
+ <el-row :gutter="12" v-show="shiftListName.length > 0">
+ <el-button v-for="item in shiftListName"
+ :style="{ backgroundColor: item.colour || '#2563eb', color: '#fff' }">{{
+ item.code +
+ '-' +
+ item.name
+ }}</el-button>
+ </el-row>
<el-row>
<el-col :span="6" style="padding: 10px;" v-for="item in months" :key="item.month">
<Calendar :initial-page="{ month: item.month + 1, year: item.year }" :rows="1"
- disable-page-swipe :nav-visibility="''" :attributes='item.attributes' />
+ disable-page-swipe :nav-visibility="''" :attributes='item.attributes'>
+ <!-- <template #day-popover="row">
+ <div class="text-xs text-gray-700 dark:text-gray-300">
+ 123123{{ row }}
+ </div>
+ </template> -->
+ </Calendar>
</el-col>
</el-row>
<!-- :initial-page="{ month: item.month + 1, year: item.year }" -->
</el-main>
</el-container>
- <el-drawer v-model="drawer" size="80%" title="鐢熶骇鏃ュ巻" :direction="direction" :before-close="handleClose">
- <Add :shiftList="shiftList" @success="success"></Add>
+ <el-drawer v-if="drawer" v-model="drawer" size="80%" title="鐢熶骇鏃ュ巻" :direction="direction"
+ :before-close="handleClose">
+ <Add v-if="drawer" :shiftList="shiftList" :drawerInfo="drawerInfo" @success="success"></Add>
</el-drawer>
<el-drawer v-model="raworkVisible" size="80%" title="鐢熶骇鏃ュ巻" :direction="direction" :before-close="handleClose">
<el-container v-if="raworkVisible">
@@ -62,6 +77,7 @@
import 'v-calendar/style.css';
import Add from './Add.vue'
import moment from 'moment';
+import color from '@/utils/color'
export default {
components: {
Calendar,
@@ -71,6 +87,7 @@
data() {
return {
shiftList: [],
+ shiftListName: [],
selectInfo: {},
drawer: false,
months: [],
@@ -87,6 +104,9 @@
label: 'title',
children: 'children',
},
+ drawerInfo: {},
+ color
+
}
},
created() {
@@ -94,12 +114,15 @@
this.init()
},
methods: {
+ edit() {
+ this.drawer = true
+ this.drawerInfo = this.selectInfo
+ },
relationWork() {
this.$HTTP.post('/api/blade-cps/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)
}
})
@@ -156,7 +179,7 @@
} 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)
@@ -173,7 +196,7 @@
})
},
dayclick(day) {
- console.log(day)
+ // console.log(day)
},
init() {
this.$HTTP.post('/api/blade-cps/shift/list', { statusList: [1] }).then(res => {
@@ -183,14 +206,24 @@
})
},
select(row) {
- this.selectInfo = {
- ...row
- }
+
this.months = []
this.$HTTP.get(`/api/blade-cps/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)
+ 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))
+ } else {
+ this.shiftListName = []
+ }
+
+ }
+ this.selectInfo = {
+ ...row,
+ calendarDayVOList: res.data.calendarDayVOList
}
})
},
@@ -204,6 +237,7 @@
},
add() {
this.drawer = true
+ this.drawerInfo = {}
},
load(flag) {
if (flag) this.current = 0;
@@ -248,6 +282,27 @@
})
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: 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),
+ popover: {
+ label: `${ban?.code}-${ban?.name}`
+ },
+ }
+ })
this.months.push({
year: year,
month: i,
@@ -259,16 +314,11 @@
return moment(item).month() === i
})
},
- {
- highlight: true,
- dates: data.calendarDayVOList.filter(item => {
- console.log(moment(item).month(), '>>>123')
- return moment(item.calendarDate).month() === i
- }).map(v => v.calendarDate),
- }
+ ...ext
]
})
}
+
}
})
--
Gitblit v1.9.3