From a958e950dc675c7a3e9cbbbc66e6656669d3a34b Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期一, 09 九月 2024 11:20:22 +0800
Subject: [PATCH] Merge branch 'master' of http://122.9.151.159:9090/r/smart-web

---
 src/views/mdc/realtime-status/index.vue     |    8 +-
 src/views/login/components/passwordForm.vue |   12 ++--
 src/views/console/base/Dialog.vue           |   37 ++++++++++++
 src/views/console/base/CalenderTab.vue      |  112 +++++++++++++++++++++++++++++++++++--
 4 files changed, 152 insertions(+), 17 deletions(-)

diff --git a/src/views/console/base/CalenderTab.vue b/src/views/console/base/CalenderTab.vue
index 99a48ce..b3ab3b5 100644
--- a/src/views/console/base/CalenderTab.vue
+++ b/src/views/console/base/CalenderTab.vue
@@ -1,15 +1,16 @@
 <!--
  * @Date: 2024-04-04 22:45:43
- * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-06-11 15:26:41
- * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/base/CalenderTab.vue
+ * @LastEditors: gaosp
+ * @LastEditTime: 2024-09-07 15:15:29
+ * @FilePath: /mdc/Users/mache/Documents/demo/cps-web/src/views/console/base/CalenderTab.vue
 -->
 <template>
     <el-container>
         <el-aside width="220px">
             <el-button type="primary" icon="el-icon-plus" @click="add">鏂板缓鏃ュ巻</el-button>
             <div v-infinite-scroll="load">
-                <el-card shadow="never" class="card" v-for="item in caleList" :key="item.id" @click="select(item)">
+                <el-card shadow="never" class="card" :class="selectInfo.id === item.id ? 'active' : ''"
+                    v-for="item in caleList" :key="item.id" @click="select(item)">
                     <h3>{{ item.code }}</h3>
                     <p>鏃ュ巻鍚嶇О: {{ item.name }}</p>
                     <p>搴旂敤骞翠唤: {{ item.year }}</p>
@@ -19,7 +20,7 @@
         <el-container>
             <el-header>
                 <span>鏃ュ巻銆恵{ selectInfo.code }}銆憑{ selectInfo.name }}</span>
-                <el-button type="primary" style="margin-left: auto;" size="small">鍏宠仈宸ヤ綅</el-button>
+                <el-button type="primary" style="margin-left: auto;" size="small" @click="relationWork">鍏宠仈宸ヤ綅</el-button>
                 <!-- <el-button type="primary" size="small">缂栬緫鏃ュ巻</el-button> -->
                 <el-popconfirm title="纭畾鍒犻櫎鍚楋紵" @confirm="table_del">
                     <template #reference>
@@ -40,6 +41,18 @@
         </el-container>
         <el-drawer v-model="drawer" size="80%" title="鐢熶骇鏃ュ巻" :direction="direction" :before-close="handleClose">
             <Add :shiftList="shiftList" @success="success"></Add>
+        </el-drawer>
+        <el-drawer v-model="raworkVisible" size="80%" title="鐢熶骇鏃ュ巻" :direction="direction" :before-close="handleClose">
+            <el-container v-if="raworkVisible">
+                <el-main>
+                    <el-tree ref="workstations" default-expand-all :data="workStations" show-checkbox node-key="id"
+                        :props="defaultProps" :render-content="renderContent" />
+                </el-main>
+                <el-footer style="text-align: right">
+                    <el-button type="primary" @click="saveBefore">淇濆瓨</el-button>
+                </el-footer>
+            </el-container>
+
         </el-drawer>
     </el-container>
 </template>
@@ -68,7 +81,12 @@
             total: 1,
             caleList: [],
             minDate: '',
-            maxDate: ''
+            maxDate: '',
+            raworkVisible: false,
+            defaultProps: {
+                label: 'title',
+                children: 'children',
+            },
         }
     },
     created() {
@@ -76,6 +94,84 @@
         this.init()
     },
     methods: {
+        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)
+                }
+            })
+
+        },
+        formatData(data, current) {
+            let newData = []
+            if (!current) {
+                newData = data.filter(item => item.parentId == 0).map(v => {
+                    v.children = this.formatData(data, v).sort((a, b) => {
+                        return b.sort - a.sort
+                    })
+                    return v
+                })
+            } else {
+                let res = data.filter(v => v.parentId == current.id)
+                res = res.map(item => {
+                    item.children = this.formatData(data, item).sort((a, b) => {
+                        return b.sort - a.sort
+                    })
+                    return item
+                })
+                return res
+            }
+            return newData
+        },
+        renderContent(h, { data }) {
+            if (data.isWorkstation) {
+                return h('div', {}, [
+                    h('span', {}, data.title),
+                    data.calendarCode ? h('span', {
+                        style: {
+                            marginLeft: '10px',
+                            color: 'var(--el-color-primary)'
+                        }
+                    }, `宸插叧鑱�(${data.calendarCode})`) : ''
+                ])
+            } else {
+                return data.title
+            }
+        },
+        saveBefore() {
+            let workstation = this.$refs.workstations.getCheckedNodes().filter(v => v.isWorkstation) || []
+            if (workstation.length == 0) {
+                return this.$message.warning("璇烽�夋嫨");
+            }
+            if (workstation.some(v => v.calendarCode).length > 0) {
+                this.$confirm(`鎵�閫夊伐浣嶅凡鏈夋帓鐝紝纭瑕侀噸鏂板叧鑱旂敓浜ф棩鍘嗗悧锛焋, '鎻愮ず', {
+                    type: 'warning',
+                }).then(() => {
+                    this.save(workstation.map(v => v.id))
+                }).catch(() => {
+                    return false
+                })
+            } else {
+                this.save(workstation.map(v => v.id))
+            }
+            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', {
+                calendarCode: this.selectInfo.code,
+                workstationIdList
+            }).then(res => {
+                if (res.code === 200) {
+                    this.$message.success("鎿嶄綔鎴愬姛");
+                    this.raworkVisible = false
+                } else {
+                    this.$message.error(res.msg);
+                }
+            })
+        },
         dayclick(day) {
             console.log(day)
         },
@@ -208,6 +304,10 @@
     margin: 12px 12px 12px 0;
 }
 
+.card.active {
+    border: 1px solid var(--el-color-primary);
+}
+
 .vc-arrow {
     display: none !important;
 }
diff --git a/src/views/console/base/Dialog.vue b/src/views/console/base/Dialog.vue
index 7fa484c..0e4953c 100644
--- a/src/views/console/base/Dialog.vue
+++ b/src/views/console/base/Dialog.vue
@@ -154,8 +154,9 @@
                 shiftNumber: params?.shiftNumber || this?.detail?.paramValue - 0,
                 number: params?.number || 1
             }
-
+            console.log(this?.detail?.paramValue, '?????????????//')
             if (params?.shiftDetailVOList?.length > 0) {
+
                 this.shiftDetailDTOList = params?.shiftDetailVOList?.map((item, index) => {
                     let shiftRestTimeDTOList = item?.shiftRestTimeVOList.map(item => {
                         return {
@@ -181,6 +182,40 @@
                     }
 
                 })
+                if (params?.shiftDetailVOList?.length < this?.detail?.paramValue) {
+                    for (let i = 0; i < this?.detail?.paramValue - params?.shiftDetailVOList?.length; i++) {
+                        this.shiftDetailDTOList.push({
+                            range: [0, 0],
+                            shiftStartTime: 0,
+                            shiftEndTime: 0,
+                            shiftIndex: i + 1,
+                            indexName: '',
+                            restNumber: i + 1,
+                            shiftRestTimeDTOList: [
+                                {
+                                    range: [0, 0],
+                                    restStartTime: 0,
+                                    restEndTime: 0,
+                                },
+                                {
+                                    range: [0, 0],
+                                    restStartTime: 0,
+                                    restEndTime: 0,
+                                },
+                                {
+                                    range: [0, 0],
+                                    restStartTime: 0,
+                                    restEndTime: 0,
+                                },
+                                {
+                                    range: [0, 0],
+                                    restStartTime: 0,
+                                    restEndTime: 0,
+                                }
+                            ]
+                        })
+                    }
+                }
             } else {
                 let len = this?.detail?.paramValue - 0 || 1
                 let shiftDetailDTOList = []
diff --git a/src/views/login/components/passwordForm.vue b/src/views/login/components/passwordForm.vue
index 0f39872..905acac 100644
--- a/src/views/login/components/passwordForm.vue
+++ b/src/views/login/components/passwordForm.vue
@@ -22,11 +22,11 @@
 export default {
 	data() {
 		return {
-			socket: null,  
+			socket: null,
 			userType: 'admin',
 			form: {
-				user: "admin",
-				password: "123456",
+				user: "",
+				password: "",
 				autologin: false
 			},
 			rules: {
@@ -54,7 +54,7 @@
 	mounted() {
 		//this.$HTTP.get('/api/blade-sync/outer-app-config/appStatus')
 	},
-	methods: {  
+	methods: {
 		async login() {
 			var validate = await this.$refs.loginForm.validate().catch(() => { })
 			if (!validate) { return false }
@@ -89,7 +89,7 @@
 					});
 				}
 			})
-			if(!isToken) return;
+			if (!isToken) return;
 			//鑾峰彇鑿滃崟
 			await this.$HTTP.get("/api/blade-system/menu/routes?" + this.$TOOL.qsStringify({ "appCode": "CPS" })).then(res => {
 				if (res.data.length == 0) {
@@ -144,7 +144,7 @@
 							permissions: ["list.add", "list.edit", "list.delete", "user.add", "user.edit", "user.delete"]
 						}
 						this.$TOOL.data.set("MENU", obj.menu);
-						console.log(obj.menu,'menu')
+						console.log(obj.menu, 'menu')
 						this.$TOOL.data.set("PERMISSIONS", obj.permissions)
 						this.$TOOL.data.set("DASHBOARDGRID", obj.dashboardGrid)
 
diff --git a/src/views/mdc/realtime-status/index.vue b/src/views/mdc/realtime-status/index.vue
index 0acd826..4110859 100644
--- a/src/views/mdc/realtime-status/index.vue
+++ b/src/views/mdc/realtime-status/index.vue
@@ -1,7 +1,7 @@
 <!--
  * @Date: 2024-04-09 22:11:21
- * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-09-06 14:13:16
+ * @LastEditors: gaosp
+ * @LastEditTime: 2024-09-07 14:16:10
  * @FilePath: /mdc/Users/mache/Documents/demo/cps-web/src/views/mdc/realtime-status/index.vue
  瀹炴椂鐪嬫澘
 -->
@@ -278,7 +278,7 @@
 				workStationGroupIdList: this.workStationGroupIdList
 			}
 			this.timestatus = [];
-			this.$HTTP.post(`/api/blade-cps/workstation/real-time-status?current=${this.current || 0}&size=${this.size || 0}`, obj).then(res => {
+			this.$HTTP.post(`/api/blade-cps/workstation/real-time-status?current=${this.current || 0}&size=${this.size || 6}`, obj).then(res => {
 				if (res.code == 200) {
 					var ids = [];
 					console.log(this.allwcs, res.data)
@@ -412,7 +412,7 @@
 								item.color = item1.color;
 							}
 						})
-						if(this.$route.query.currentTag == item.status) {
+						if (this.$route.query.currentTag == item.status) {
 							item.active = true;
 						}
 					})

--
Gitblit v1.9.3