From fee1948081e9cecc1de29ee5029f737aef2dcb38 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期二, 01 十月 2024 20:43:43 +0800
Subject: [PATCH] Merge branch 'release' of http://122.9.151.159:9090/r/smart-web into release
---
src/views/console/base/CalenderTab.vue | 137 ++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 126 insertions(+), 11 deletions(-)
diff --git a/src/views/console/base/CalenderTab.vue b/src/views/console/base/CalenderTab.vue
index 2d940fd..6c7627d 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: Sneed
- * @LastEditTime: 2024-05-05 21:14:09
- * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/base/CalenderTab.vue
+ * @LastEditors: gaoshp
+ * @LastEditTime: 2024-10-01 20:16:51
+ * @FilePath: /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>
@@ -28,6 +29,9 @@
</el-popconfirm>
</el-header>
<el-main>
+ <el-row :gutter="12" v-show="shiftListName">
+ {{ shiftListName }}
+ </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"
@@ -38,8 +42,21 @@
</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" @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>
@@ -58,6 +75,7 @@
data() {
return {
shiftList: [],
+ shiftListName: '',
selectInfo: {},
drawer: false,
months: [],
@@ -68,7 +86,12 @@
total: 1,
caleList: [],
minDate: '',
- maxDate: ''
+ maxDate: '',
+ raworkVisible: false,
+ defaultProps: {
+ label: 'title',
+ children: 'children',
+ },
}
},
created() {
@@ -76,6 +99,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)
},
@@ -90,10 +191,19 @@
this.selectInfo = {
...row
}
+ this.months = []
this.$HTTP.get(`/api/blade-cps/calendar/${row.id}`).then(res => {
if (res.code === 200) {
console.log(res.data)
this.setDay(res.data)
+ let current = this.shiftList.find(v => v.id == res.data.calendarDayVOList[0].modelId)
+ console.log('////', this.shiftList, res.data.calendarDayVOList[0].id)
+ if (current) {
+ this.shiftListName = `${current.code}-${current.name}`
+ } else {
+ this.shiftListName = ''
+ }
+
}
})
},
@@ -149,6 +259,7 @@
arr.push(day.format('YYYY-MM-DD'))
}
})
+
for (let i = 0; i < 12; i++) {
this.months.push({
year: year,
@@ -164,8 +275,9 @@
{
highlight: true,
dates: data.calendarDayVOList.filter(item => {
- return moment(item).month() === i
- }),
+ console.log(moment(item).month(), '>>>123')
+ return moment(item.calendarDate).month() === i
+ }).map(v => v.calendarDate),
}
]
})
@@ -205,8 +317,11 @@
margin: 12px 12px 12px 0;
}
+.card.active {
+ border: 1px solid var(--el-color-primary);
+}
+
.vc-arrow {
display: none !important;
- ;
}
</style>
\ No newline at end of file
--
Gitblit v1.9.3