From 2bf0ec71f0b8bffdc6f8f326cec0cbb705c18860 Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期二, 01 十月 2024 20:17:18 +0800
Subject: [PATCH] 优化排班和部分功能
---
src/views/console/base/Add.vue | 34 +++++++++++++++++++++++++++-------
src/views/console/base/CalenderTab.vue | 23 ++++++++++++++++++-----
2 files changed, 45 insertions(+), 12 deletions(-)
diff --git a/src/views/console/base/Add.vue b/src/views/console/base/Add.vue
index 6c89b54..d8636e0 100644
--- a/src/views/console/base/Add.vue
+++ b/src/views/console/base/Add.vue
@@ -1,8 +1,8 @@
<!--
* @Date: 2024-05-04 16:37:48
- * @LastEditors: Sneed
- * @LastEditTime: 2024-05-05 21:02:54
- * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/base/Add.vue
+ * @LastEditors: gaoshp
+ * @LastEditTime: 2024-10-01 20:03:40
+ * @FilePath: /cps-web/src/views/console/base/Add.vue
-->
<template>
<el-container>
@@ -23,7 +23,7 @@
</el-col>
<el-col :span="8">
<el-form-item label="搴旂敤骞翠唤" prop="year">
- <el-select v-model="form.year" placeholder="" size="" @change="change">
+ <el-select v-model="form.year" placeholder="" size="" @change="changeYear">
<el-option v-for="item in options" :key="item.value" :label="item.label"
:value="item.value" />
</el-select>
@@ -196,16 +196,31 @@
}
},
watch: {
+
holiday() {
this.setDay()
},
checkboxGroup1() {
this.setDay()
},
+ dateDTOList(val) {
+ this.months.forEach(month => {
+ if (val.length > 0) {
+ month.attributes[1].highlight = 'yellow'
+ } else {
+ month.attributes[1].highlight = true
+ }
+
+ })
+ },
'form.year'(val) {
this.months = []
let currentYear = moment(val, 'YYYY').format('YYYY') - 0
+ this.form.date = [`${currentYear}-01-01`, `${currentYear}-12-31`]
+ if (currentYear == moment().format('YYYY')) {
+ this.form.date[0] = moment().format('YYYY-MM-DD')
+ }
// console.log(this.months)
this.$HTTP.post('/api/blade-cps/shift-off-day/list', {
year: currentYear,
@@ -228,7 +243,7 @@
year: currentYear,
month: i,
id: `${currentYear}${i}`,
- min: new Date('2024-01-01'),
+ min: new Date(`${currentYear}-01-01`),
attributes: [
{
dot: 'yellow',
@@ -284,7 +299,7 @@
let currentYear = moment(this.form.year, 'YYYY').format('YYYY') - 0
this.months.forEach((item, i) => {
let start = moment(`${currentYear}-${i + 1}-01`)
- let end = moment(`${currentYear}-${i + 2}-01`)
+ let end = i == 11 ? moment(`${currentYear + 1}-${i + 1}-01`) : moment(`${currentYear}-${i + 2}-01`)
let dates = []
console.log(start.format('YYYY-MM-DD'), start.unix() >= moment(this.form.date[0]).unix() && start.unix() <= moment(this.form.date[1]).unix())
while (start.unix() < end.unix()) {
@@ -302,6 +317,7 @@
start.add(1, 'd')
}
this.months[i].attributes[1].dates = dates
+ console.log(this.months, 'jieguo')
})
},
pushDate(start) {
@@ -322,7 +338,11 @@
console.log(index, item.attributes[1].dates)
},
plan() {
+ if (!this.modelId) {
+ return this.$message.warning('璇烽�夋嫨鐝鏂规');
+ }
let dateDTOList = this.months.map(item => item.attributes[1].dates)
+ console.log(this.months, '>>>>>>>>>>', dateDTOList.flat(2))
let list = dateDTOList.flat(2).map(v => {
return {
modelId: this.modelId,
@@ -343,7 +363,7 @@
}
},
planCancel() {
-
+ this.dateDTOList = []
},
save() {
this.$refs.dialogForm.validate(async (valid) => {
diff --git a/src/views/console/base/CalenderTab.vue b/src/views/console/base/CalenderTab.vue
index b3ab3b5..6c7627d 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-01 20:16:51
+ * @FilePath: /cps-web/src/views/console/base/CalenderTab.vue
-->
<template>
<el-container>
@@ -29,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"
@@ -39,8 +42,9 @@
</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">
@@ -71,6 +75,7 @@
data() {
return {
shiftList: [],
+ shiftListName: '',
selectInfo: {},
drawer: false,
months: [],
@@ -191,6 +196,14 @@
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 = ''
+ }
+
}
})
},
--
Gitblit v1.9.3