From aae53f420a50b06095d25989da1e59d2deaaab87 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 11 四月 2023 10:00:34 +0800
Subject: [PATCH] 1.设备管理模块动态列表完成
---
src/components/DatePicker/index.vue | 135 ++++++++++++++++++++++++++++++---------------
1 files changed, 90 insertions(+), 45 deletions(-)
diff --git a/src/components/DatePicker/index.vue b/src/components/DatePicker/index.vue
index 475fa71..ef96a55 100644
--- a/src/components/DatePicker/index.vue
+++ b/src/components/DatePicker/index.vue
@@ -42,11 +42,14 @@
:disabled="!isDblDate(visibleDays[(i-1)*7+(j-1)])"
>
+
<div class="pop_style">{{ callbackTxt(visibleDays[(i - 1) * 7 + (j - 1)]) }}</div>
+ <!-- <div class="pop_style">123</div>-->
<span
slot="reference"
:class="[{select:isSelect(visibleDays[(i-1)*7+(j-1)])},
{dblDateStyle:isDblDate(visibleDays[(i-1)*7+(j-1)])}]"
+ :style="{background: isSelect(visibleDays[(i-1)*7+(j-1)])?$store.state.settings.theme:''}"
>{{ visibleDays[(i - 1) * 7 + (j - 1)].getDate() }}</span>
</el-popover>
@@ -126,7 +129,9 @@
CapacityPlanningGivePlanSubmit,
CapacityPlanningOnclickSelect,
CapacityPlanningSetupSearch
-} from '@/api/scgl'
+} from '@/api/produceManager'
+import { handleDatetime } from '@/utils/global'
+
var time = null
export default {
directives: {
@@ -168,6 +173,7 @@
type: Function,
default: null
}
+
},
data() {
@@ -198,6 +204,7 @@
page: 1
},
projectDef: []
+
}
},
computed: {
@@ -218,7 +225,8 @@
return `${year}-${month + 1}-${day}`
}
},
- mounted() {},
+ mounted() {
+ },
methods: {
getDblTime() {
const { year, month, day } = funsdates.getYearMonthDay(this.dblDate)
@@ -240,11 +248,10 @@
}
}
for (const i in this.projectDef) {
- if (this.projectDef[i].CapSetupCode === code) {
- name = this.projectDef[i].CapSetupName
+ if (this.projectDef[i].code === code) {
+ name = this.projectDef[i].name
}
}
-
return name
},
getHeight() {
@@ -256,7 +263,7 @@
}
const e = event || window.event
- // console.log(e.clientY, 7)
+
const nowHeigth = e.clientY
if (nowHeigth >= 500) {
this.topStyle = true
@@ -297,9 +304,9 @@
focus() {
this.isVisible = true
- this.CapacityPlanningCalendar()
+ this.getCapacityPlanningCalendar()
this.getHeight()
- this.CapacityPlanningSetupSearch()
+ this.getCapacityPlanningSetupSearch()
this.CapacityPlanningSearch()
},
blur() {
@@ -327,7 +334,9 @@
clearTimeout(time) // 棣栧厛娓呴櫎璁℃椂鍣�
time = setTimeout(() => {
this.time = funsdates.getYearMonthDay(date)
- // const timeDate = ''
+ if (typeof this.value === 'string') {
+ this.value = this.value.split(',')
+ }
this.isDbl = false
// 鍙互鐐瑰嚮鐨勬棩鏈�
if (!this.isPastDue(date)) {
@@ -354,12 +363,57 @@
dblChooseDate(date) {
if (!this.isPastDue(date)) {
clearTimeout(time)
- this.dblDate = date
- this.isDbl = true
- this.changeTime = this.handleDatetime(date)
+ time = setTimeout(() => {
+ this.time = funsdates.getYearMonthDay(date)
+ if (typeof this.value === 'string') {
+ this.value = this.value.split(',')
+ }
+ // 鍙互鐐瑰嚮鐨勬棩鏈�
+ if (!this.isPastDue(date)) {
+ if ((this.value.indexOf(this.handleDatetime(date)) < 0 && this.value !== '') || this.value === '') { // 鏁扮粍娣诲姞
+ this.value.push(this.handleDatetime(date)) // 鏂板鍒癷nput閲�
+ const data = {
+ name: this.handleDatetime(date),
+ key: this.rowData.CaptPlanWorkShiftCode
+ }
+ this.defArr.push(data) // 鏂板鍒� 榛樿鏁扮粍閲�
+ this.dblDate = date
+ this.isDbl = true // 鍙充晶灞曞紑
- this.CapacityPlanningOnclickSelect({ CaptPlanWorkShiftCode: this.rowData.CaptPlanWorkShiftCode, captplanid: this.rowData.CaptPlanId, datetime: this.handleDatetime(date) })
- this.getDblTime()
+ this.changeTime = this.handleDatetime(date)
+
+ const DATA = {
+ CaptPlanWorkShiftCode: this.defArr.find(item => item.name === this.changeTime).key,
+ captplanid: this.rowData.CaptPlanId,
+ datetime: this.handleDatetime(date)
+ }
+ this.getCapacityPlanningOnclickSelect(DATA)
+ this.getDblTime()
+ } else if (this.value.indexOf(this.handleDatetime(date)) >= 0) {
+ this.dblDate = date
+ this.isDbl = true // 鍙充晶灞曞紑
+
+ this.changeTime = this.handleDatetime(date)
+
+ const DATA = {
+ CaptPlanWorkShiftCode: this.defArr.find(item => item.name === this.changeTime).key,
+ captplanid: this.rowData.CaptPlanId,
+ datetime: this.handleDatetime(date)
+ }
+ this.getCapacityPlanningOnclickSelect(DATA)
+ this.getDblTime()
+
+ // const indexV = this.value.indexOf(this.handleDatetime(date))
+ // this.value.splice(indexV, 1)
+ // for (const i in this.defArr) {
+ // if (this.defArr[i].name === this.handleDatetime(date)) {
+ // this.defArr.splice(i, 1)
+ // }
+ // }
+ }
+ }
+ this.$emit('input', this.value)
+ }, 300)
}
},
isDblDate(date) {
@@ -424,7 +478,7 @@
// }
// },
// 鍙屽嚮璇锋眰鏁版嵁
- CapacityPlanningOnclickSelect(data) {
+ getCapacityPlanningOnclickSelect(data) {
CapacityPlanningOnclickSelect(data).then((res) => {
this.projectList = res.data
@@ -443,19 +497,15 @@
// 宸ヤ綔鏃ュ巻鎻愪氦
CapacityPlanningGivePlanSubmit() {
const formData = new FormData()
- formData.append('CaptPlanId', this.rowData.CaptPlanId)// 浜ц兘璧勬簮id
- formData.append('WkshopCode', this.rowData.CaptPlanWorkShopid)// 杞﹂棿缂栫爜
- formData.append('CapUnitCode', this.rowData.CaptPlanDeviceTypeid)// 鐢熶骇鍗曞厓锛堜骇绾跨紪鐮侊級
- formData.append('CaptSetupCode', '')
- formData.append('CaptPlanType', this.rowData.CaptPlanType)// 浜ц兘绫诲瀷
- console.log(this.defArr, 555)
- formData.append('WorkList', JSON.stringify(this.defArr))
- console.log(formData, 666)
-
- for (const [a, b] of formData.entries()) {
- console.log(a, ':', b)
- }
-
+ formData.append('wkshopcode', this.rowData.CaptPlanWorkShopid)// 杞﹂棿缂栫爜
+ formData.append('capunitcode', this.rowData.CaptPlanDeviceTypeid)// 鐢熶骇鍗曞厓缂栫爜锛堜骇绾跨紪鐮侊級
+ formData.append('captplanid', this.rowData.CaptPlanId)// 浜ц兘璧勬簮id
+ formData.append('capsetupcode', this.rowData.CaptPlanWorkShiftCode) // 榛樿鏂规缂栫爜
+ formData.append('captplantype', this.rowData.CaptPlanType)// 璧勬簮绫诲瀷
+ formData.append('worklist', JSON.stringify(this.defArr))// 宸ヤ綔鏃ュ巻鏁版嵁闆�
+ // for (const [a, b] of formData.entries()) {
+ // console.log(a, ':', b)
+ // }
CapacityPlanningGivePlanSubmit(formData).then(res => {
if (res.code === '200') {
this.$message.success('淇濆瓨鎴愬姛锛�')
@@ -464,30 +514,25 @@
}
})
},
- CapacityPlanningCalendar() {
- // const temp = JSON.parse(this.rowData)
+ getCapacityPlanningCalendar() {
CapacityPlanningCalendar({ captplanid: this.rowData.CaptPlanId }).then((res) => {
- for (const i in res.List) {
- if (res.List[i].key === '') {
- res.List[i].key = this.rowData.CaptPlanWorkShiftCode
- }
- }
- this.defArr = res.List
+ const currentDate = handleDatetime(new Date())
+ this.defArr = res.data.filter(i => i.name >= currentDate)
})
},
closeCapacityPlanningCalendar() {
CapacityPlanningCalendar({ captplanid: this.rowData.CaptPlanId }).then((res) => {
const nameList = []
- for (const i in res.List) {
- nameList.push(res.List[i].name)
- if (res.List[i].key === '') {
- res.List[i].key = this.rowData.CaptPlanWorkShiftCode
+ for (const i in res.data) {
+ nameList.push(res.data[i].name)
+ if (res.data[i].key === '') {
+ res.data[i].key = this.rowData.CaptPlanWorkShiftCode
}
}
for (const i in this.defArr) {
- for (const j in res.List) {
- if (this.defArr[i].name === this.changeTime && res.List[j].name === this.changeTime) {
- this.defArr[i].key = res.List[j].key
+ for (const j in res.data) {
+ if (this.defArr[i].name === this.changeTime && res.data[j].name === this.changeTime) {
+ this.defArr[i].key = res.data[j].key
} else if (this.defArr[i].name === this.changeTime && nameList.indexOf(this.changeTime) === -1) {
this.defArr[i].key = this.rowData.CaptPlanWorkShiftCode
}
@@ -501,9 +546,9 @@
this.closeCapacityPlanningCalendar()
}, 300)
},
- CapacityPlanningSetupSearch() {
+ getCapacityPlanningSetupSearch() {
CapacityPlanningSetupSearch(this.form).then((res) => {
- this.projectDef = res.rows
+ this.projectDef = res.data
})
}
--
Gitblit v1.9.3