From ba77fdc6a30c9ad0941e40319f8c4f6fe6fdf9f1 Mon Sep 17 00:00:00 2001 From: cuilei <ray_tsu1@163.com> Date: 星期四, 07 八月 2025 10:30:42 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/mdc/base/modules/shift/ShiftInfoModel.vue | 400 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 400 insertions(+), 0 deletions(-) diff --git a/src/views/mdc/base/modules/shift/ShiftInfoModel.vue b/src/views/mdc/base/modules/shift/ShiftInfoModel.vue new file mode 100644 index 0000000..f91c642 --- /dev/null +++ b/src/views/mdc/base/modules/shift/ShiftInfoModel.vue @@ -0,0 +1,400 @@ +<template> + <a-modal :title="title" :width="800" :visible="visible" :confirmLoading="confirmLoading" + @ok="handleOk" @cancel="handleCancel" cancelText="鍏抽棴"> + <a-spin :spinning="confirmLoading"> + <a-form :form="form"> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item label="鐝埗鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input :disabled="true" :readOnly="true" allow-clear placeholder="璇疯緭鍏ョ彮鍒跺悕绉�" + v-decorator="['shiftName',validatorRules.shiftName]"/> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item label="鐝鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input allow-clear placeholder="璇疯緭鍏ョ彮娆″悕绉�" v-decorator="['shiftSubName',validatorRules.shiftSubName]"/> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item label="寮�濮嬫椂闂�" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-time-picker :disabled="disableSubmit" :readOnly="disableSubmit" allow-clear + v-decorator="['startDate',validatorRules.startDate]"/> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item label="缁撴潫鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-time-picker :disabled="disableSubmit" :readOnly="disableSubmit" + v-decorator="['endDate',validatorRules.endDate]"/> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item label="寮�濮嬩紤鎭椂闂�" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-time-picker :disabled="disableSubmit" :readOnly="disableSubmit" allow-clear + v-decorator="['sleepStartDate',validatorRules.sleepStartDate]"/> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item label="缁撴潫浼戞伅鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-time-picker :disabled="disableSubmit" :readOnly="disableSubmit" allow-clear + v-decorator="['sleepEndDate',validatorRules.sleepEndDate]"/> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item label="鏄惁璺ㄥぉ" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-switch v-model="isDaySpan" checked-children="鏄�" un-checked-children="鍚�"/> + </a-form-item> + </a-col> + </a-row> + + </a-form> + </a-spin> + </a-modal> +</template> + +<script> + import moment from 'moment' + import pick from 'lodash.pick' + import { + getAction, + postAction, + requestPut + } from '@/api/manage' + import { + duplicateCheck + } from '@/api/api' + import { + JeecgListMixin + } from '@/mixins/JeecgListMixin' + + export default { + name: 'ShiftInfoModel', + mixins: [JeecgListMixin], + components: {}, + props: {}, + data() { + return { + title: '', + isDaySpan: false, + visible: false, + show: false, + model: {}, + checked: false, + labelCol: { + xs: { + span: 24 + }, + sm: { + span: 6 + } + }, + wrapperCol: { + xs: { + span: 24 + }, + sm: { + span: 18 + } + }, + confirmLoading: false, + form: this.$form.createForm(this), + validatorRules: { + shiftSubName: { + rules: [ + { + required: true, + message: '璇疯緭鍏ョ彮娆″悕绉�' + } + ] + }, + startDate: { + rules: [ + { + required: true, + message: '璇烽�夋嫨寮�濮嬫椂闂�' + } + ] + }, + endDate: { + rules: [ + { + required: true, + message: '璇烽�夋嫨缁撴潫鏃堕棿' + } + ] + } + }, + url: { + add: '/mdc/mdcShiftSub/addShiftSub', + edit: '/mdc/mdcShiftSub/editMdcShiftSub', + list: '/mdc/mdcMdcShift/queryPageList' + }, + disableSubmit: true + } + }, + created() { + // this.checkshiftSuName(); + }, + + methods: { + //鑷畾涔夋牎楠屽嚱鏁帮紝瑕佹眰鍚嶅瓧涓嶈兘閲嶅 value鏄〃鍗曠殑鍊硷紝callback鏄洖璋冨嚱鏁� 蹇呴』璋冪敤鎵嶅彲楠岃瘉 + checkshiftSuName(rule, value, callback) { + if (!value) { + alert('涓嶈兘涓虹┖锛�') + return + } + // debugger + // let NameSelf = value; + this.loadData() + // console.log(dataSource); + callback() + }, + loadData() { + if (!this.url.list) { + this.$message.error('璇疯缃畊rl.list灞炴��!') + return + } + //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭 + // if (arg === 1) { + // this.ipagination.current = 1; + // } + var params = this.getQueryParams()//鏌ヨ鏉′欢 + // + // if(!params){ + // return false; + // } + + // this.loading = true; + getAction(this.url.list, params).then((res) => { + if (res.success) { + // console.log(res) + //update-begin---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ + this.dataSource = res.result.records || res.result + // if(res.result.total) + // { + // this.ipagination.total = res.result.total; + // }else{ + // this.ipagination.total = 0; + // } + //update-end---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ + } else { + // this.$message.warning(res.message) + this.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + this.loading = false + }) + }, + add(record) { + let _this = this + this.visible = true + this.form.resetFields() + this.model = { shiftId: record.id, shiftName: record.shiftName } + this.$nextTick(() => { + this.form.setFieldsValue(pick(this.model, 'shiftName')) + this.isDaySpan = false + }) + }, + edit(record) { + this.form.resetFields() + this.model = Object.assign({}, record) + this.visible = true + this.$nextTick(() => { + this.form.setFieldsValue(pick(this.model, 'shiftName', 'shiftSubName', 'startDate', 'endDate', 'sleepStartDate', 'sleepEndDate')) + this.form.setFieldsValue({ + startDate: moment(this.model.startDate, 'HH:mm:ss'), + endDate: moment(this.model.endDate, 'HH:mm:ss') + }) + if (this.model.sleepStartDate) { + this.form.setFieldsValue({ + sleepStartDate: moment(this.model.sleepStartDate, 'HH:mm:ss') + }) + } + if (this.model.sleepStartDate) { + this.form.setFieldsValue({ + sleepEndDate: moment(this.model.sleepEndDate, 'HH:mm:ss') + }) + } + if (record.isDaySpan == 'true') { + this.isDaySpan = true + } else { + this.isDaySpan = false + } + }) + }, + close() { + this.$emit('close') + this.visible = false + this.show = false + }, + handleOk() { + const that = this + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.form.validateFields((err, values) => { + if (!err) { + // debugger + that.confirmLoading = true + let formData = Object.assign(this.model, values) + formData.isDaySpan = that.isDaySpan + console.log(formData.isDaySpan) + formData.startDate = moment(formData.startDate).format('HH:mm:ss') + formData.endDate = moment(formData.endDate).format('HH:mm:ss') + if (formData.sleepStartDate) formData.sleepStartDate = moment(formData.sleepStartDate).format('HH:mm:ss') + if (formData.sleepEndDate) formData.sleepEndDate = moment(formData.sleepEndDate).format('HH:mm:ss') + if (formData.isDaySpan == false) { + let startTimeOne = formData.startDate.replace(/:/g, '') + let endTimeOne = formData.endDate.replace(/:/g, '') + if (startTimeOne > endTimeOne) { + // that.$message.warning("闈炶法澶╃彮娆$粨鏉熸椂闂翠笉鑳藉皬浜庣瓑浜庡紑濮嬫椂闂达紒") + that.$notification.warning({ + message: '娑堟伅', + description: '闈炶法澶╃彮娆$粨鏉熸椂闂翠笉鑳藉皬浜庣瓑浜庡紑濮嬫椂闂达紒' + }) + that.confirmLoading = false + that.close() + } else { + formData.shiftSubStatus = 1 + let obj + if (!this.model.id) { + obj = postAction(this.url.add, formData) + } else { + obj = requestPut(this.url.edit, formData, { + id: this.model.id + }) + } + obj.then((res) => { + if (res.success) { + // that.$message.success("淇濆瓨鎴愬姛") + that.$notification.success({ + message: '娑堟伅', + description: '淇濆瓨鎴愬姛' + }) + that.$emit('ok', res.result) + } else { + // that.$message.warning(res.message) + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + that.confirmLoading = false + that.close() + }) + } + } else { + formData.shiftSubStatus = 1 + let obj + if (!this.model.id) { + obj = postAction(this.url.add, formData) + } else { + obj = requestPut(this.url.edit, formData, { + id: this.model.id + }) + } + obj.then((res) => { + if (res.success) { + // that.$message.success + that.$notification.success({ + message: '娑堟伅', + description: '淇濆瓨鎴愬姛' + }) + that.$emit('ok', res.result) + } else { + // that.$message.warning(res.message) + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + that.confirmLoading = false + that.close() + }) + } + + } + }) + }, + handleCancel() { + this.close() + }, + loadCascade() { + getAction(this.url.loadCascadeData).then((res) => { + if (res.success) { + this.partCategoryCascade = res.result + } + }) + }, + //楠岃瘉 缂栫爜 + validateNum(rule, value, callback) { + var params = { + tableName: 'lxmes_base_part', + fieldName: 'num', + fieldVal: value, + dataId: this.model.id, + //鏁版嵁搴撲腑瀛樺湪瀛楁del_flag骞朵娇鐢ㄨ瀛楁浣滀负鏈垹闄ょ瓥鐣ワ紝鐪熷垹闄わ細false 鍋囧垹闄わ細true + delFlag: 'true' + } + duplicateCheck(params).then((res) => { + if (res.success) { + callback() + } else { + callback('瀛樿揣缂栫爜宸插瓨鍦�!') + } + }) + }, + checkboxChange(e) { + this.checked = e.target.checked + } + //楠岃瘉 鍚嶇О + // validateName(rule, value, callback) { + // var params = { + // tableName: 'mes_base_part', + // fieldName: 'name', + // fieldVal: value, + // dataId: this.model.id, + // //鏁版嵁搴撲腑瀛樺湪瀛楁del_flag骞朵娇鐢ㄨ瀛楁浣滀负鏈垹闄ょ瓥鐣ワ紝鐪熷垹闄わ細false 鍋囧垹闄わ細true + // delFlag: 'true', + // }; + // duplicateCheck(params).then((res) => { + // if (res.success) { + // callback(); + // } else { + // callback("浜у搧鍚嶇О宸插瓨鍦�!"); + // } + // }) + // }, + + } + } +</script> + +<style scoped> + .ant-btn { + padding: 0 10px; + margin-left: 3px; + } + + .ant-form-item-control { + line-height: 0px; + } + + /** 涓昏〃鍗曡闂磋窛 */ + .ant-form .ant-form-item { + margin-bottom: 10px; + } + + /** Tab椤甸潰琛岄棿璺� */ + .ant-tabs-content .ant-form-item { + margin-bottom: 0px; + } +</style> \ No newline at end of file -- Gitblit v1.9.3