From 0a03169b9b9758a926dec35735e989f52e4d217f Mon Sep 17 00:00:00 2001 From: zhuzhuanzhuan Date: 星期一, 25 九月 2023 17:46:46 +0800 Subject: [PATCH] 维修休班管理页面按照新需求优化功能 1、编辑机床维修时间的日期选择器选择时间时取消秒针选择以及将分钟选择步距调整为5分钟 2、点击左侧树组件中的具体设备名称后点击新增按钮时可将树组件选择的设备反填到设备组选项中(个人优化将已选择的设备组反选在选择设备弹窗中的多选框中) 3、编辑机床维修时间的日期选择器的可选时间修改为最早可以选到当日前一天,目前为最早选到当日 --- src/views/mdc/base/modules/deviceRepair/DeviceRepairList.vue | 11 src/views/mdc/base/modules/deviceRepair/DeviceRepairModel.vue | 345 ++++++++++++++++--------- src/views/mdc/base/modules/deviceRepair/DeviceRepairListModel.vue | 31 ++ src/views/mdc/common/BaseTree.vue | 3 src/views/mdc/base/modules/deviceRepair/DeviceRepairModelEdit.vue | 349 +++++++++++++++----------- 5 files changed, 451 insertions(+), 288 deletions(-) diff --git a/src/views/mdc/base/modules/deviceRepair/DeviceRepairList.vue b/src/views/mdc/base/modules/deviceRepair/DeviceRepairList.vue index 528dff2..dae28a4 100644 --- a/src/views/mdc/base/modules/deviceRepair/DeviceRepairList.vue +++ b/src/views/mdc/base/modules/deviceRepair/DeviceRepairList.vue @@ -64,7 +64,7 @@ </a-table> </div> <!-- table鍖哄煙-end --> - <device-repair-model ref="modalForm" @ok="modalFormOk"></device-repair-model> + <device-repair-model ref="modalForm" :equipmentId="queryParams.equipmentId" @ok="modalFormOk"></device-repair-model> <!--<device-repair-model-add ref="modalFormadd" @ok="modalFormOk"></device-repair-model-add>--> <device-repair-model-edit ref="modalFormedit" @ok="modalFormOk"></device-repair-model-edit> <!--<repair-model ref="repairModelFrom" @ok="modalFormOk">0</repair-model>--> @@ -182,10 +182,13 @@ this.queryParamEquip.equipmentId = val.equipmentId } else { this.queryParamEquip.parentId = val.key - this.queryParams.equipmentId = '' + this.queryParams.equipmentId ='' } - this.searchQuery() + }else{ + this.queryParams.equipmentId='' + this.queryParamEquip.parentId = "" } + this.searchQuery() }, nodePeople(val){ if (JSON.stringify(val) != '{}') { @@ -386,10 +389,8 @@ if(this.queryParams.typeTree == "1"){ this.queryParams.parentId = this.queryParamEquip.parentId // this.queryParams.equipmentId = this.queryParamEquip.equipmentId - }else{ this.queryParams.parentId = this.queryParamPeople.parentId - // this.queryParams.equipmentId = "" } this.dataSource = []; diff --git a/src/views/mdc/base/modules/deviceRepair/DeviceRepairListModel.vue b/src/views/mdc/base/modules/deviceRepair/DeviceRepairListModel.vue index 86d898c..672f956 100644 --- a/src/views/mdc/base/modules/deviceRepair/DeviceRepairListModel.vue +++ b/src/views/mdc/base/modules/deviceRepair/DeviceRepairListModel.vue @@ -66,7 +66,7 @@ <div> <a-table ref="table" size="middle" bordered rowKey="id" :scroll="{聽 y: 400聽}" :columns="columns" :dataSource="dataSource" :pagination="ipagination" :loading="loading" - :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,getCheckboxProps:getCheckboxProps,selections: true,}" @change="handleTableChange"> </a-table> </div> @@ -110,6 +110,9 @@ status: { type: Number, default: 1 + }, + selectedEquipmentIds:{ + type:String } }, data() { @@ -199,6 +202,9 @@ this.selectionRows = selectionRows // this.SelectedList =[...this.SelectedList,...selectionRows]; // console.log(this.SelectedList); + console.log('selectedRowKeys',selectedRowKeys) + console.log('selectionRows',selectionRows) + }, handleTableChange(pagination, filters, sorter) { // this.onClearSelected() @@ -305,8 +311,6 @@ } }) }, - - initGroupOptions() { getAction(this.url.loadProductionOptions).then(res => { if (res.success) { @@ -319,6 +323,27 @@ }); } }) + }, + /** + * 姣忔鍔犺浇鍒楄〃鏃跺垽鏂凡閫変腑璁惧缂栧彿鏁扮粍鏄惁鍖呭惈琛ㄦ牸鏁版嵁涓殑璁惧缂栧彿锛屽鏋滃寘鍚垯閫変腑 + * @param record + * @returns {{props: {defaultChecked: boolean}}} + */ + getCheckboxProps(record){ + if(this.selectedEquipmentIds){ + let selectedEquipmentIdsArr=this.selectedEquipmentIds.split(',') + return { + props:{ + defaultChecked: selectedEquipmentIdsArr.includes(record.equipmentId) + } + } + }else{ + return { + props:{ + defaultChecked:false + } + } + } } }, } diff --git a/src/views/mdc/base/modules/deviceRepair/DeviceRepairModel.vue b/src/views/mdc/base/modules/deviceRepair/DeviceRepairModel.vue index 0557b03..765e195 100644 --- a/src/views/mdc/base/modules/deviceRepair/DeviceRepairModel.vue +++ b/src/views/mdc/base/modules/deviceRepair/DeviceRepairModel.vue @@ -6,16 +6,16 @@ <a-row :gutter="24"> <a-col :span="24"> <!--<a-form-item label="璁惧缂栧彿" :labelCol="labelCol" :wrapperCol="wrapperCol">--> - <!--<a-input-search :readOnly="true" v-decorator="['equipmentId', validatorRules.equipmentId]"--> - <!--@search="deviceSearch" enter-button/>--> - <!--<!–<a-input :disabled="disableSubmit" :readOnly="disableSubmit" allow-clear placeholder="璇疯緭鍏ヨ澶囩紪鍙�"–>--> - <!--<!–v-decorator="['equipmentId',validatorRules.equipmentId]"/>–>--> + <!--<a-input-search :readOnly="true" v-decorator="['equipmentId', validatorRules.equipmentId]"--> + <!--@search="deviceSearch" enter-button/>--> + <!--<!–<a-input :disabled="disableSubmit" :readOnly="disableSubmit" allow-clear placeholder="璇疯緭鍏ヨ澶囩紪鍙�"–>--> + <!--<!–v-decorator="['equipmentId',validatorRules.equipmentId]"/>–>--> <!--</a-form-item>--> - <!--</a-col>--> - <!--<a-col :span="12">--> + <!--</a-col>--> + <!--<a-col :span="12">--> <!--<a-form-item label="璁惧鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol">--> - <!--<a-input :disabled="disableSubmit" :readOnly="readOnly" allow-clear placeholder="璇疯緭鍏ヨ澶囧悕绉�"--> - <!--v-decorator="['equipmentName',validatorRules.equipmentName]"/>--> + <!--<a-input :disabled="disableSubmit" :readOnly="readOnly" allow-clear placeholder="璇疯緭鍏ヨ澶囧悕绉�"--> + <!--v-decorator="['equipmentName',validatorRules.equipmentName]"/>--> <!--</a-form-item>--> <a-form-item label="璁惧缁�" :labelCol="labelColLong" :wrapperCol="wrapperColLong"> <a-input-search :readOnly="true" v-decorator="['equipmentIds', validatorRules.equipmentIds]" @@ -26,7 +26,7 @@ </a-col> </a-row> - <a-row :gutter="24" > + <a-row :gutter="24"> <a-col :span="24"> <a-form-item label="缁翠慨绫诲瀷" :labelCol="labelColLong" :wrapperCol="wrapperColLong"> <a-radio-group v-decorator="['mdcRepairType', validatorRules.mdcRepairType]"> @@ -34,7 +34,7 @@ 缁翠慨 </a-radio> <a-radio :value="2"> - 浼戠彮 + 浼戠彮 </a-radio> </a-radio-group> </a-form-item> @@ -44,29 +44,37 @@ <a-row :gutter="24"> <a-col :span="12"> <a-form-item label="寮�濮嬫椂闂�" :labelCol="labelCol" :wrapperCol="wrapperCol"> - <j-date :show-time="{defaultValue:moment('08:00:00','HH:mm:ss')}" date-format="YYYY-MM-DD HH:mm:ss" placeholder="璇烽�夋嫨寮�濮嬫椂闂�" - :disabledDate="disabledDate" class="query-group-cust" v-decorator="['startTime', validatorRules.startTime]"></j-date> + <j-date :show-time="{defaultValue:moment('08:00:00','HH:mm:ss'),minuteStep:5,hideDisabledOptions:true}" + date-format="YYYY-MM-DD HH:mm:ss" + placeholder="璇烽�夋嫨寮�濮嬫椂闂�" + :disabledDate="disabledDate" class="query-group-cust" + v-decorator="['startTime', validatorRules.startTime]" :disabledTime="disabledDateTime"></j-date> </a-form-item> </a-col> <a-col :span="12"> <a-form-item label="缁撴潫鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol"> - <j-date :show-time="{defaultValue:moment('08:00:00','HH:mm:ss')}" date-format="YYYY-MM-DD HH:mm:ss" placeholder="璇烽�夋嫨缁撴潫鏃堕棿" - :disabledDate="disabledDate" class="query-group-cust" v-decorator="['endTime', validatorRules.endTime]"></j-date> + <j-date :show-time="{defaultValue:moment('08:00:00','HH:mm:ss'),minuteStep:5,hideDisabledOptions:true}" + date-format="YYYY-MM-DD HH:mm:ss" + placeholder="璇烽�夋嫨缁撴潫鏃堕棿" + :disabledDate="disabledDate" class="query-group-cust" + v-decorator="['endTime', validatorRules.endTime]" :disabledTime="disabledDateTime"></j-date> </a-form-item> </a-col> </a-row> <!--<a-row :gutter="24">--> - <!--<a-col :span="12">--> - <!--<a-form-item v-show="this.mesag == 1" label="缁翠慨绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol">--> - <!--<a-input :disabled="disableSubmit" :readOnly="readOnly" placeholder="璇烽�夋嫨璁惧绫诲瀷"--> - <!--:triggerChange="true"--> - <!--v-decorator="['mdcRepairType', validatorRules.mdcRepairType]"/>--> - <!--</a-form-item>--> - <!--</a-col>--> + <!--<a-col :span="12">--> + <!--<a-form-item v-show="this.mesag == 1" label="缁翠慨绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol">--> + <!--<a-input :disabled="disableSubmit" :readOnly="readOnly" placeholder="璇烽�夋嫨璁惧绫诲瀷"--> + <!--:triggerChange="true"--> + <!--v-decorator="['mdcRepairType', validatorRules.mdcRepairType]"/>--> + <!--</a-form-item>--> + <!--</a-col>--> <!--</a-row>--> </a-form> </a-spin> - <device-repair-list-model ref="deviceRepairListModel" @sendSelectionRows="getDeviceRows"></device-repair-list-model> + <device-repair-list-model ref="deviceRepairListModel" @sendSelectionRows="getDeviceRows" + :selectedEquipmentIds="selectedEquipmentIds" + ></device-repair-list-model> </a-modal> </template> @@ -85,22 +93,28 @@ duplicateCheck } from '@/api/api' import AFormItem from 'ant-design-vue/es/form/FormItem' + import Vue from 'vue' export default { name: 'DeviceRepairModel', - components: { AFormItem, DeviceRepairListModel,JDate}, - props: {}, + components: { AFormItem, DeviceRepairListModel, JDate }, + props: { + equipmentId: { + type: String + } + }, + data() { return { - mesag:21, - readOnly:true, + mesag: 21, + readOnly: true, title: '', visible: false, show: false, model: {}, checked: false, - startData:"", - endData:"", + startData: '', + endData: '', labelCol: { xs: { span: 24 @@ -136,47 +150,48 @@ confirmLoading: false, form: this.$form.createForm(this), validatorRules: { - equipmentIds:{ - rules:[ + equipmentIds: { + rules: [ { - required:true, - message: "璇烽�夋嫨璁惧" - }, + required: true, + message: '璇烽�夋嫨璁惧' + } ], + initialValue: '' }, - equipmentName:{ - rules:[ + equipmentName: { + rules: [ { - required:true, - message: "" - }, - ], + required: true, + message: '' + } + ] }, - mdcRepairType:{ - rules:[ + mdcRepairType: { + rules: [ { - required:true, - message: "" - }, + required: true, + message: '' + } ], initialValue: 1 }, - startTime:{ - rules:[ + startTime: { + rules: [ { - required:true, - message: "璇烽�夋嫨寮�濮嬫椂闂�" - }, - ], + required: true, + message: '璇烽�夋嫨寮�濮嬫椂闂�' + } + ] }, - endTime:{ - rules:[ + endTime: { + rules: [ { - required:true, - message: "璇烽�夋嫨缁撴潫鏃堕棿" - }, - ], - }, + required: true, + message: '璇烽�夋嫨缁撴潫鏃堕棿' + } + ] + } }, url: { @@ -187,17 +202,31 @@ disableSubmit: true, partCategoryCascade: [], cascadeDefaultValue: [], + selectedEquipmentIds: '' } }, created() { }, - + watch: { + // 鐩戞帶璁惧缂栧彿锛屽綋鏀瑰彉鏍戜腑閫夐」鏃跺皢鍊艰祴鍊肩粰鏂板寮圭獥鐨勮澶囩粍閫夐」 + equipmentId: function(val) { + this.validatorRules.equipmentIds.initialValue = val + }, + // 鐩戞帶寮圭獥鏄剧ず锛屽鏋滃叧闂垯娓呯┖宸查�夋嫨鐨勫閫夛紝濡傛灉寮�鍚垯灏嗘爲涓凡閫夋嫨椤硅祴鍊肩粰宸查�夋嫨澶氶�� + visible: function(val) { + if (!val) { + this.selectedEquipmentIds = '' + } else { + this.selectedEquipmentIds = this.validatorRules.equipmentIds.initialValue + } + } + }, methods: { - disabledDate(current){ + disabledDate(current) { //Can not slect days before today and today // return current && current < moment().endOf("day"); - return current < moment().subtract(+1, 'day')//浠婂ぉ涔嬪墠鐨勫勾鏈堟棩涓嶅彲閫夛紝涓嶅寘鎷粖澶� + return current < moment().subtract(+2, 'day')//鍓嶄竴澶╀箣鍓嶇殑骞存湀鏃ヤ笉鍙�夛紝涓嶅寘鎷墠涓�澶� }, moment, // onChange(dates) { @@ -209,31 +238,42 @@ // // this.endData = dateStrings[1]; // // console.log(this.startData,this.endData); // }, - onChangeEnd(dates, dateStrings){ - this.endTime = dateStrings[0]; + onChangeEnd(dates, dateStrings) { + this.endTime = dateStrings[0] }, getDeviceRows(val) { - var equipmentIds; - for(var i = 0;i<val.length;i++){ + // var equipmentIds + // for (var i = 0; i < val.length; i++) { + // if (i == 0) { + // equipmentIds = val[i].equipmentId + // } else { + // equipmentIds = equipmentIds + ',' + val[i].equipmentId + // } + // } + // // console.log("========",equipmentIds); + // this.form.setFieldsValue({ + // equipmentIds: equipmentIds + // }) + for (var i = 0; i < val.length; i++) { if (i == 0) { - equipmentIds = val[i].equipmentId; + this.selectedEquipmentIds = val[i].equipmentId } else { - equipmentIds = equipmentIds + "," + val[i].equipmentId; + this.selectedEquipmentIds = this.selectedEquipmentIds + ',' + val[i].equipmentId } } // console.log("========",equipmentIds); this.form.setFieldsValue({ - equipmentIds: equipmentIds, + equipmentIds: this.selectedEquipmentIds }) - // this.form.setFieldsValue({ - // equipmentId: val.equipmentId, - // equipmentName: val.equipmentName, - // equipmentModel: val.equipmentModel, - // equipmentIp: val.equipmentIp, - // dataPort: val.dataPort, - // driveType: val.driveType - // }) - }, + // this.form.setFieldsValue({ + // equipmentId: val.equipmentId, + // equipmentName: val.equipmentName, + // equipmentModel: val.equipmentModel, + // equipmentIp: val.equipmentIp, + // dataPort: val.dataPort, + // driveType: val.driveType + // }) + }, deviceSearch() { this.$refs.deviceRepairListModel.openPage() this.$refs.deviceRepairListModel.title = '閫夋嫨璁惧' @@ -270,8 +310,8 @@ this.model = Object.assign({}, record) this.visible = true this.$nextTick(() => { - this.form.setFieldsValue(pick(this.model, 'equipmentIds', 'equipmentName', 'mdcRepairType', 'startTime', 'endTime', - )) + this.form.setFieldsValue(pick(this.model, 'equipmentIds', 'equipmentName', 'mdcRepairType', 'startTime', 'endTime' + )) }) }, close() { @@ -286,62 +326,100 @@ if (!err) { that.confirmLoading = true let formData = Object.assign(this.model, values) - let start = moment(formData.startTime).format('YYYY-MM-DD HH:mm:ss'); - let end = moment(formData.endTime).format('YYYY-MM-DD HH:mm:ss'); - let startOne = start.replace(/:/g,''); - let endOne = end.replace(/:/g,''); - var data = new Date(); - let stertDate = moment(data).format("YYYY-MM-DD HH:mm:ss"); - let dataStart = stertDate.replace(/:/g,''); - if(startOne < dataStart){ - // that.$message.warning("寮�濮嬫椂闂翠笉鑳藉皬浜庡綋鍓嶆椂闂�") + let start = moment(formData.startTime).format('YYYY-MM-DD HH:mm:ss') + let end = moment(formData.endTime).format('YYYY-MM-DD HH:mm:ss') + let startOne = start.replace(/:/g, '') + let endOne = end.replace(/:/g, '') + var data = new Date() + let stertDate = moment(data).format('YYYY-MM-DD HH:mm:ss') + let dataStart = stertDate.replace(/:/g, '') + // if (startOne < dataStart) { + // // that.$message.warning("寮�濮嬫椂闂翠笉鑳藉皬浜庡綋鍓嶆椂闂�") + // that.$notification.warning({ + // message: '娑堟伅', + // description: '寮�濮嬫椂闂翠笉鑳藉皬浜庡綋鍓嶆椂闂�' + // }) + // that.confirmLoading = false + // } else { + // if (startOne >= endOne) { + // // that.$message.warning("缁撴潫鏃堕棿涓嶈兘灏忎簬寮�濮嬫椂闂�"); + // that.$notification.warning({ + // message: '娑堟伅', + // description: '缁撴潫鏃堕棿涓嶈兘灏忎簬寮�濮嬫椂闂�' + // }) + // // console.log(this.model) + // // this.endTime = '' + // that.confirmLoading = false + // } else { + // 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.$message.success(res.message) + // that.$emit('ok', res.result) + // } else { + // // that.$message.warning(res.message) + // that.$notification.warning({ + // message: '娑堟伅', + // description: res.message + // }) + // } + // }).finally(() => { + // that.confirmLoading = false + // that.close() + // }) + // } + // } + if (startOne >= endOne) { + // that.$message.warning("缁撴潫鏃堕棿涓嶈兘灏忎簬寮�濮嬫椂闂�"); that.$notification.warning({ - message:'娑堟伅', - description:"寮�濮嬫椂闂翠笉鑳藉皬浜庡綋鍓嶆椂闂�" - }); + message: '娑堟伅', + description: '缁撴潫鏃堕棿涓嶈兘灏忎簬寮�濮嬫椂闂�' + }) + // console.log(this.model) + // this.endTime = '' that.confirmLoading = false - }else{ - if(startOne>=endOne){ - // that.$message.warning("缁撴潫鏃堕棿涓嶈兘灏忎簬寮�濮嬫椂闂�"); - that.$notification.warning({ - message:'娑堟伅', - description:"缁撴潫鏃堕棿涓嶈兘灏忎簬寮�濮嬫椂闂�" - }); - // console.log(this.model) - // this.endTime = '' - that.confirmLoading = false - }else{ - 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.$message.success(res.message) - 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 { + 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.$message.success(res.message) + that.$emit('ok', res.result) + } else { + // that.$message.warning(res.message) + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + that.confirmLoading = false + that.close() + }) } - } }) }, @@ -382,6 +460,15 @@ checkboxChange(e) { this.checked = e.target.checked }, + /** + * 绂佺敤鏃ユ湡閫夋嫨鍣ㄤ腑鐨勬椂闂撮�夋嫨 + * @returns {{disabledSeconds: (function(): number[])}} + */ + disabledDateTime() { + return { + disabledSeconds: () => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59] + } + } } } </script> diff --git a/src/views/mdc/base/modules/deviceRepair/DeviceRepairModelEdit.vue b/src/views/mdc/base/modules/deviceRepair/DeviceRepairModelEdit.vue index f2c0d43..1fc6049 100644 --- a/src/views/mdc/base/modules/deviceRepair/DeviceRepairModelEdit.vue +++ b/src/views/mdc/base/modules/deviceRepair/DeviceRepairModelEdit.vue @@ -6,8 +6,10 @@ <a-row :gutter="24"> <a-col :span="12"> <a-form-item label="寮�濮嬫椂闂�" :labelCol="labelCol" :wrapperCol="wrapperCol"> - <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="璇烽�夋嫨寮�濮嬫椂闂�" :disabledDate="disabledDate" - class="query-group-cust" v-decorator="['startTime', validatorRules.startTime]"></j-date> + <j-date :show-time="{minuteStep:5,hideDisabledOptions:true}" date-format="YYYY-MM-DD HH:mm:ss" + placeholder="璇烽�夋嫨寮�濮嬫椂闂�" :disabledDate="disabledDate" + class="query-group-cust" v-decorator="['startTime', validatorRules.startTime]" + :disabledTime="disabledDateTime"></j-date> </a-form-item> </a-col> @@ -21,8 +23,11 @@ <a-row :gutter="24"> <a-col :span="12"> <a-form-item label="缁撴潫鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol"> - <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="璇烽�夋嫨缁撴潫鏃堕棿" :disabledDate="disabledDate" - class="query-group-cust" v-decorator="['endTime', validatorRules.endTime]"></j-date> + <j-date :show-time="{minuteStep:5,hideDisabledOptions:true}" date-format="YYYY-MM-DD HH:mm:ss" + placeholder="璇烽�夋嫨缁撴潫鏃堕棿" + :disabledDate="disabledDate" + class="query-group-cust" v-decorator="['endTime', validatorRules.endTime]" + :disabledTime="disabledDateTime"></j-date> </a-form-item> </a-col> <a-col :span="12"> @@ -36,7 +41,8 @@ </a-form> </a-spin> <!--<device-repair-list-model ref="deviceRepairListModel" @sendSelectionRows="getDeviceRows"></device-repair-list-model>--> - <device-repair-edit-list-model ref="deviceRepairListModel" @sendSelectionRows="getDeviceRows"></device-repair-edit-list-model> + <device-repair-edit-list-model ref="deviceRepairListModel" + @sendSelectionRows="getDeviceRows"></device-repair-edit-list-model> </a-modal> </template> @@ -57,18 +63,18 @@ export default { name: 'DeviceRepairModelEdit', - components: {DeviceRepairListModel,JDate,DeviceRepairEditListModel}, + components: { DeviceRepairListModel, JDate, DeviceRepairEditListModel }, props: {}, data() { return { - readOnly:true, + readOnly: true, title: '', visible: false, show: false, model: {}, checked: false, - startData:"", - endData:"", + startData: '', + endData: '', labelCol: { xs: { span: 24 @@ -104,38 +110,38 @@ confirmLoading: false, form: this.$form.createForm(this), validatorRules: { - equipmentId:{ - rules:[ + equipmentId: { + rules: [ { - required:true, - message: "" - }, - ], + required: true, + message: '' + } + ] }, - equipmentName:{ - rules:[ + equipmentName: { + rules: [ { - required:true, - message: "" - }, - ], + required: true, + message: '' + } + ] }, - startTime:{ - rules:[ + startTime: { + rules: [ { - required:true, - message: "璇烽�夋嫨寮�濮嬫椂闂�" - }, - ], + required: true, + message: '璇烽�夋嫨寮�濮嬫椂闂�' + } + ] }, - endTime:{ - rules:[ + endTime: { + rules: [ { - required:true, - message: "璇烽�夋嫨缁撴潫鏃堕棿" - }, - ], - }, + required: true, + message: '璇烽�夋嫨缁撴潫鏃堕棿' + } + ] + } // mdcRepairType:{ // rules:[ // { @@ -155,17 +161,17 @@ disableSubmit: true, partCategoryCascade: [], cascadeDefaultValue: [], - editStart:'' + editStart: '' } }, created() { }, methods: { - disabledDate(current){ + disabledDate(current) { //Can not slect days before today and today // return current && current < moment().endOf("day"); - return current < moment().subtract(+1, 'day')//浠婂ぉ涔嬪墠鐨勫勾鏈堟棩涓嶅彲閫夛紝涓嶅寘鎷粖澶� + return current < moment().subtract(+2, 'day')//鍓嶄竴澶╀箣鍓嶇殑骞存湀鏃ヤ笉鍙�夛紝涓嶅寘鎷墠涓�澶� }, moment, // onChange(dates) { @@ -177,17 +183,17 @@ // // this.endData = dateStrings[1]; // // console.log(this.startData,this.endData); // }, - onChangeEnd(dates, dateStrings){ - this.endTime = dateStrings[0]; + onChangeEnd(dates, dateStrings) { + this.endTime = dateStrings[0] }, getDeviceRows(val) { this.form.setFieldsValue({ equipmentId: val.equipmentId, - equipmentName: val.equipmentName, - // // equipmentModel: val.equipmentModel, - // // equipmentIp: val.equipmentIp, - // // dataPort: val.dataPort, - // // driveType: val.driveType + equipmentName: val.equipmentName + // // equipmentModel: val.equipmentModel, + // // equipmentIp: val.equipmentIp, + // // dataPort: val.dataPort, + // // driveType: val.driveType }) // var equipmentIds; // for(var i = 0;i<val.length;i++){ @@ -236,10 +242,10 @@ edit(record) { this.form.resetFields() this.model = Object.assign({}, record) - this.editStart = (this.model.startTime).replace(/:/g,''); + this.editStart = (this.model.startTime).replace(/:/g, '') this.visible = true this.$nextTick(() => { - this.form.setFieldsValue(pick(this.model, 'tierType', 'parentName', 'equipmentId', 'equipmentName','startTime', 'endTime', + this.form.setFieldsValue(pick(this.model, 'tierType', 'parentName', 'equipmentId', 'equipmentName', 'startTime', 'endTime' )) }) }, @@ -255,112 +261,148 @@ if (!err) { that.confirmLoading = true let formData = Object.assign(this.model, values) - let start = moment(formData.startTime).format('YYYY-MM-DD HH:mm:ss'); - let end = moment(formData.endTime).format('YYYY-MM-DD HH:mm:ss'); - let startOne = start.replace(/:/g,''); - let endOne = end.replace(/:/g,''); - var data = new Date(); - let stertDate = moment(data).format("YYYY-MM-DD HH:mm:ss"); - let dataStart = stertDate.replace(/:/g,''); - if(this.editStart != startOne){ - if(startOne < dataStart) { - // that.$message.warning("寮�濮嬫椂闂翠笉鑳藉皬浜庡綋鍓嶆椂闂�") - that.$notification.warning({ - message:'娑堟伅', - description:"寮�濮嬫椂闂翠笉鑳藉皬浜庡綋鍓嶆椂闂�" - }); - that.confirmLoading = false - }else{ - if(startOne>=endOne){ - // that.$message.warning("缁撴潫鏃堕棿涓嶈兘灏忎簬寮�濮嬫椂闂�"); - that.$notification.warning({ - message:'娑堟伅', - description:"缁撴潫鏃堕棿涓嶈兘灏忎簬褰撳墠鏃堕棿" - }); - // console.log(this.model) - // this.endTime = '' - that.confirmLoading = false - - }else{ - - let obj - if (!this.model.id) { - obj = postAction(this.url.add, formData) - } else { - - obj = requestPut(this.url.edit, formData, { - id: this.model.id - }) - let shijian = startOne - } - obj.then((res) => { - if (res.success) { - // that.$message.success("淇敼鎴愬姛") - // that.$message.success(res.message) - that.$notification.success({ - message:'娑堟伅', - description:res.message - }); - 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{ - if(startOne>=endOne){ - // that.$message.warning("缁撴潫鏃堕棿涓嶈兘灏忎簬寮�濮嬫椂闂�"); - that.$notification.warning({ - message:'娑堟伅', - description:"缁撴潫鏃堕棿涓嶈兘灏忎簬寮�濮嬫椂闂�" - }); - // console.log(this.model) - // this.endTime = '' - that.confirmLoading = false - - }else{ - let obj - if (!this.model.id) { - obj = postAction(this.url.add, formData) - } else { - - obj = requestPut(this.url.edit, formData, { - id: this.model.id - }) - let shijian = startOne - } - obj.then((res) => { - if (res.success) { - // that.$message.success("淇敼鎴愬姛") - // that.$message.success(res.message) - that.$notification.success({ - message:'娑堟伅', - description:res.message - }); - that.$emit('ok', res.result) - } else { - // that.$message.warning(res.message) - that.$notification.warning({ - message:'娑堟伅', - description:res.message - }); - } - }).finally(() => { - that.confirmLoading = false - that.close() + let start = moment(formData.startTime).format('YYYY-MM-DD HH:mm:ss') + let end = moment(formData.endTime).format('YYYY-MM-DD HH:mm:ss') + let startOne = start.replace(/:/g, '') + let endOne = end.replace(/:/g, '') + var data = new Date() + let stertDate = moment(data).format('YYYY-MM-DD HH:mm:ss') + let dataStart = stertDate.replace(/:/g, '') + // if (this.editStart != startOne) { + // if (startOne < dataStart) { + // // that.$message.warning("寮�濮嬫椂闂翠笉鑳藉皬浜庡綋鍓嶆椂闂�") + // that.$notification.warning({ + // message: '娑堟伅', + // description: '寮�濮嬫椂闂翠笉鑳藉皬浜庡綋鍓嶆椂闂�' + // }) + // that.confirmLoading = false + // } else { + // if (startOne >= endOne) { + // // that.$message.warning("缁撴潫鏃堕棿涓嶈兘灏忎簬寮�濮嬫椂闂�"); + // that.$notification.warning({ + // message: '娑堟伅', + // description: '缁撴潫鏃堕棿涓嶈兘灏忎簬褰撳墠鏃堕棿' + // }) + // // console.log(this.model) + // // this.endTime = '' + // that.confirmLoading = false + // + // } else { + // let obj + // if (!this.model.id) { + // obj = postAction(this.url.add, formData) + // } else { + // + // obj = requestPut(this.url.edit, formData, { + // id: this.model.id + // }) + // let shijian = startOne + // } + // obj.then((res) => { + // if (res.success) { + // // that.$message.success("淇敼鎴愬姛") + // // that.$message.success(res.message) + // that.$notification.success({ + // message: '娑堟伅', + // description: res.message + // }) + // 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 { + // if (startOne >= endOne) { + // // that.$message.warning("缁撴潫鏃堕棿涓嶈兘灏忎簬寮�濮嬫椂闂�"); + // that.$notification.warning({ + // message: '娑堟伅', + // description: '缁撴潫鏃堕棿涓嶈兘灏忎簬寮�濮嬫椂闂�' + // }) + // // console.log(this.model) + // // this.endTime = '' + // that.confirmLoading = false + // + // } else { + // let obj + // if (!this.model.id) { + // obj = postAction(this.url.add, formData) + // } else { + // + // obj = requestPut(this.url.edit, formData, { + // id: this.model.id + // }) + // let shijian = startOne + // } + // obj.then((res) => { + // if (res.success) { + // // that.$message.success("淇敼鎴愬姛") + // // that.$message.success(res.message) + // that.$notification.success({ + // message: '娑堟伅', + // description: res.message + // }) + // that.$emit('ok', res.result) + // } else { + // // that.$message.warning(res.message) + // that.$notification.warning({ + // message: '娑堟伅', + // description: res.message + // }) + // } + // }).finally(() => { + // that.confirmLoading = false + // that.close() + // }) + // } + // } + if (startOne >= endOne) { + // that.$message.warning("缁撴潫鏃堕棿涓嶈兘灏忎簬寮�濮嬫椂闂�"); + that.$notification.warning({ + message: '娑堟伅', + description: '缁撴潫鏃堕棿涓嶈兘灏忎簬寮�濮嬫椂闂�' + }) + // console.log(this.model) + // this.endTime = '' + that.confirmLoading = false + } else { + 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.$message.success(res.message) + that.$emit('ok', res.result) + } else { + // that.$message.warning(res.message) + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + that.confirmLoading = false + that.close() + }) } - - } }) }, @@ -400,6 +442,15 @@ }, checkboxChange(e) { this.checked = e.target.checked + }, + /** + * 绂佺敤鏃ユ湡閫夋嫨鍣ㄤ腑鐨勬椂闂撮�夋嫨 + * @returns {{disabledSeconds: (function(): number[])}} + */ + disabledDateTime() { + return { + disabledSeconds: () => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59] + } } } } diff --git a/src/views/mdc/common/BaseTree.vue b/src/views/mdc/common/BaseTree.vue index 809f02f..ed5229a 100644 --- a/src/views/mdc/common/BaseTree.vue +++ b/src/views/mdc/common/BaseTree.vue @@ -120,7 +120,7 @@ this.hiding = true this.currSelected = {} this.selectedKeys = [] - console.log('鍙戦��') + // console.log('鍙戦��') // this.$bus.$emit('treeClearSelected','閲嶇疆鍒楄〃') this.$emit('sendSelectBaseTree', '') }, @@ -129,7 +129,6 @@ let record = e.node.dataRef this.currSelected = Object.assign({}, record) this.selectedKeys = [record.key] - console.log('閫変腑鏍戜腑椤�',this.selectedKeys) this.$emit('sendSelectBaseTree', this.selectedKeys) }, handleEdit(entity) { -- Gitblit v1.9.3