| | |
| | | <template> |
| | | <a-modal :title="title" :width="800" :visible="visible" :confirmLoading="confirmLoading" |
| | | @ok="handleOk" @cancel="handleCancel" cancelText="关闭"> |
| | | @ok="handleOk" @cancel="handleCancel" cancelText="关闭"> |
| | | <a-spin :spinning="confirmLoading"> |
| | | <a-form :form="form"> |
| | | <a-row :gutter="24"> |
| | |
| | | </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-input allow-clear placeholder="请输入班次名称" v-decorator="['shiftSubName',validatorRules.shiftSubName]"/> |
| | | </a-form-item> |
| | | </a-col> |
| | | </a-row> |
| | |
| | | JeecgListMixin |
| | | } from '@/mixins/JeecgListMixin' |
| | | |
| | | |
| | | export default { |
| | | name: 'ShiftInfoModel', |
| | | mixins: [JeecgListMixin], |
| | |
| | | confirmLoading: false, |
| | | form: this.$form.createForm(this), |
| | | validatorRules: { |
| | | shiftSubName:[ |
| | | { |
| | | required:true, |
| | | message:'请输入字段长度', |
| | | },{ |
| | | validator:this.checkshiftSuName, |
| | | trigger:'blur' |
| | | } |
| | | ] |
| | | 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', |
| | | list: '/mdc/mdcMdcShift/queryPageList' |
| | | }, |
| | | disableSubmit: true |
| | | } |
| | |
| | | |
| | | methods: { |
| | | //自定义校验函数,要求名字不能重复 value是表单的值,callback是回调函数 必须调用才可验证 |
| | | checkshiftSuName(rule,value,callback){ |
| | | if(!value){ |
| | | alert("不能为空!") |
| | | checkshiftSuName(rule, value, callback) { |
| | | if (!value) { |
| | | alert('不能为空!') |
| | | return |
| | | } |
| | | // debugger |
| | | // let NameSelf = value; |
| | | this.loadData() |
| | | this.loadData() |
| | | // console.log(dataSource); |
| | | callback(); |
| | | callback() |
| | | }, |
| | | loadData() { |
| | | if(!this.url.list){ |
| | | this.$message.error("请设置url.list属性!") |
| | | if (!this.url.list) { |
| | | this.$message.error('请设置url.list属性!') |
| | | return |
| | | } |
| | | //加载数据 若传入参数1则加载第一页的内容 |
| | | // if (arg === 1) { |
| | | // this.ipagination.current = 1; |
| | | // } |
| | | var params = this.getQueryParams();//查询条件 |
| | | var params = this.getQueryParams()//查询条件 |
| | | // |
| | | // if(!params){ |
| | | // return false; |
| | |
| | | if (res.success) { |
| | | // console.log(res) |
| | | //update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------ |
| | | this.dataSource = res.result.records||res.result; |
| | | this.dataSource = res.result.records || res.result |
| | | // if(res.result.total) |
| | | // { |
| | | // this.ipagination.total = res.result.total; |
| | |
| | | // this.ipagination.total = 0; |
| | | // } |
| | | //update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------ |
| | | }else{ |
| | | } else { |
| | | // this.$message.warning(res.message) |
| | | this.$notification.warning({ |
| | | message:'消息', |
| | | description:res.message |
| | | }); |
| | | message: '消息', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }).finally(() => { |
| | | this.loading = false |
| | |
| | | that.confirmLoading = true |
| | | let formData = Object.assign(this.model, values) |
| | | formData.isDaySpan = that.isDaySpan |
| | | console.log(formData.isDaySpan); |
| | | if(formData.isDaySpan == false){ |
| | | formData.startDate = moment(formData.startDate).format('HH:mm:ss'); |
| | | formData.endDate = moment(formData.endDate).format('HH:mm:ss'); |
| | | formData.sleepStartDate = moment(formData.sleepStartDate).format('HH:mm:ss'); |
| | | formData.sleepEndDate = moment(formData.sleepEndDate).format('HH:mm:ss'); |
| | | let startTimeOne = formData.startDate.replace(/:/g,''); |
| | | let endTimeOne = formData.endDate.replace(/:/g,''); |
| | | if(startTimeOne > endTimeOne){ |
| | | 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.$message.success("保存失败") |
| | | that.$notification.error({ |
| | | message:'消息', |
| | | description:"保存失败!" |
| | | }); |
| | | message: '消息', |
| | | description: '非跨天班次结束时间不能小于等于开始时间!' |
| | | }) |
| | | that.confirmLoading = false |
| | | that.close() |
| | | }else{ |
| | | } else { |
| | | formData.shiftSubStatus = 1 |
| | | let obj |
| | | if (!this.model.id) { |
| | |
| | | if (res.success) { |
| | | // that.$message.success("保存成功") |
| | | that.$notification.success({ |
| | | message:'消息', |
| | | description:"保存成功" |
| | | }); |
| | | message: '消息', |
| | | description: '保存成功' |
| | | }) |
| | | that.$emit('ok', res.result) |
| | | } else { |
| | | // that.$message.warning(res.message) |
| | | that.$notification.warning({ |
| | | message:'消息', |
| | | description:res.message |
| | | }); |
| | | message: '消息', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }).finally(() => { |
| | | that.confirmLoading = false |
| | | that.close() |
| | | }) |
| | | } |
| | | }else{ |
| | | } else { |
| | | formData.shiftSubStatus = 1 |
| | | let obj |
| | | if (!this.model.id) { |
| | |
| | | if (res.success) { |
| | | // that.$message.success |
| | | that.$notification.success({ |
| | | message:'消息', |
| | | description:"保存成功" |
| | | }); |
| | | message: '消息', |
| | | description: '保存成功' |
| | | }) |
| | | that.$emit('ok', res.result) |
| | | } else { |
| | | // that.$message.warning(res.message) |
| | | that.$notification.warning({ |
| | | message:'消息', |
| | | description:res.message |
| | | }); |
| | | message: '消息', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }).finally(() => { |
| | | that.confirmLoading = false |