gaoshp
2024-11-03 3931e2728f618d0090f129b2665bc1285c4440c3
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 = []
@@ -219,12 +254,10 @@
                this.shiftDetailDTOList = shiftDetailDTOList
            }
            console.log(this.shiftDetailDTOList, '>>>?????s')
            return this
        },
        //表单提交方法
        submit() {
            console.log(this.form, this.shiftDetailDTOList)
            this.$refs.dialogForm.validate(async (valid) => {
                if (valid) {
                    this.isSaveing = true;
@@ -262,11 +295,11 @@
                    let res
                    try {
                        if (this.form.id) {
                            res = await this.$HTTP.put('/api/blade-cps/shift', data).catch(() => {
                            res = await this.$HTTP.put('/api/smis/shift', data).catch(() => {
                                throw new Error()
                            })
                        } else {
                            res = await this.$HTTP.post('/api/blade-cps/shift', data).catch(() => {
                            res = await this.$HTTP.post('/api/smis/shift', data).catch(() => {
                                throw new Error()
                            })
                        }
@@ -280,7 +313,7 @@
                        this.visible = false;
                        this.$message.success("操作成功")
                    } else {
                        this.$alert(res.message, "提示", { type: 'error' })
                        this.$alert(res.msg, "提示", { type: 'error' })
                    }
                } else {
                    return false;