From 4d28f1972e3a0e4bae363d4d2c816624d6013217 Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期二, 08 十月 2024 22:03:03 +0800
Subject: [PATCH] 颜色

---
 src/views/console/base/Add.vue         |    9 +++++++--
 src/views/console/base/CalenderTab.vue |   28 +++++++++++++++++++---------
 2 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/src/views/console/base/Add.vue b/src/views/console/base/Add.vue
index 7140003..eb1458e 100644
--- a/src/views/console/base/Add.vue
+++ b/src/views/console/base/Add.vue
@@ -1,7 +1,7 @@
 <!--
  * @Date: 2024-05-04 16:37:48
  * @LastEditors: gaoshp
- * @LastEditTime: 2024-10-07 18:01:39
+ * @LastEditTime: 2024-10-08 22:02:06
  * @FilePath: /cps-web/src/views/console/base/Add.vue
 -->
 <template>
@@ -365,7 +365,12 @@
                     this.months[i].attributes.push({
                         dates: dates.map(v => v.calendarDate),
                         ...ext,
-                        highlight: color.stringToColor(ext.modelId),
+                        // highlight: color.stringToColor(ext.modelId),
+                        highlight: {
+                            style: {
+                                'background-color': ban.colour
+                            }
+                        },
                         popover: {
                             label: `${ban?.code}-${ban?.name}`
                         },
diff --git a/src/views/console/base/CalenderTab.vue b/src/views/console/base/CalenderTab.vue
index c6a0ebc..422f0ca 100644
--- a/src/views/console/base/CalenderTab.vue
+++ b/src/views/console/base/CalenderTab.vue
@@ -1,7 +1,7 @@
 <!--
  * @Date: 2024-04-04 22:45:43
  * @LastEditors: gaoshp
- * @LastEditTime: 2024-10-02 20:52:59
+ * @LastEditTime: 2024-10-08 22:01:18
  * @FilePath: /cps-web/src/views/console/base/CalenderTab.vue
 -->
 <template>
@@ -30,7 +30,11 @@
             </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>
@@ -119,7 +123,6 @@
                 if (res.code === 200) {
                     this.raworkVisible = true
                     this.workStations = this.formatData(res.data)
-                    console.log(this.workStations)
                 }
             })
 
@@ -176,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)
@@ -193,7 +196,7 @@
             })
         },
         dayclick(day) {
-            console.log(day)
+            // console.log(day)
         },
         init() {
             this.$HTTP.post('/api/blade-cps/shift/list', { statusList: [1] }).then(res => {
@@ -207,9 +210,9 @@
             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)
+                    // 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))
@@ -283,8 +286,15 @@
                         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),
@@ -308,7 +318,7 @@
                             ]
                         })
                     }
-                    console.log(this.months, '------------')
+
                 }
             })
 

--
Gitblit v1.9.3