¶Ô±ÈÐÂÎļþ |
| | |
| | | <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('请设置url.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> |