| | |
| | | |
| | | </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-form-item label="加工数量" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-input-number :disabled="disableSubmit" placeholder="请输入加工数量" :min="0" v-decorator="['processQuantity', validatorRules.processQuantity]"></a-input-number> |
| | | </a-form-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="12"> |
| | | <a-form-item label="加工数量" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-input-number :disabled="disableSubmit" placeholder="请输入加工数量" :min="0" v-decorator="['processQuantity', validatorRules.processQuantity]"></a-input-number> |
| | | <a-form-item label="设备名称" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-input :disabled="disableSubmit" :readOnly="readOnly" allow-clear placeholder="请输入设备名称" |
| | | v-decorator="['equipmentName',validatorRules.equipmentName]"/> |
| | | </a-form-item> |
| | | </a-col> |
| | | |
| | | <a-col :span="12"> |
| | | <a-form-item label="不合格数量" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-input-number :disabled="disableSubmit" placeholder="请输入不合格数量" :min="0" v-decorator="['unqualifiedQuantity', validatorRules.unqualifiedQuantity]"></a-input-number> |
| | |
| | | </a-row> |
| | | <a-row :gutter="24"> |
| | | <a-form-item label="备注" :labelCol="labelColLong" :wrapperCol="wrapperColLong"> |
| | | <a-textarea :disabled="disableSubmit" v-decorator="['remark', validatorRules.remark]" placeholder="请输入备注" ></a-textarea> |
| | | <a-textarea :maxLength="20" :disabled="disableSubmit" v-decorator="['remark', validatorRules.remark]" placeholder="请输入备注" ></a-textarea> |
| | | </a-form-item> |
| | | </a-row> |
| | | </a-form> |
| | |
| | | { |
| | | required:true, |
| | | message: "" |
| | | }, |
| | | ], |
| | | }, |
| | | processQuantity:{ |
| | | rules:[ |
| | | { |
| | | required:true, |
| | | message: "请输入加工数量" |
| | | }, |
| | | ], |
| | | }, |
| | | unqualifiedQuantity:{ |
| | | rules:[ |
| | | { |
| | | required:true, |
| | | message: "请输入不合格数量" |
| | | }, |
| | | ], |
| | | }, |
| | |
| | | if (!err) { |
| | | that.confirmLoading = true |
| | | let formData = Object.assign(this.model, values) |
| | | let obj |
| | | if (!this.model.id) { |
| | | obj = postAction(this.url.add, formData) |
| | | } else { |
| | | obj = requestPut(this.url.edit, formData, { |
| | | id: this.model.id |
| | | let stat = formData.processQuantity |
| | | let end = formData.unqualifiedQuantity |
| | | if(end>stat){ |
| | | // that.$message.warning("不合格数量必须小于等于加工数量"); |
| | | that.$notification.warning({ |
| | | message:'消息', |
| | | description:"不合格数量必须小于等于加工数量" |
| | | }); |
| | | 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() |
| | | }) |
| | | } |
| | | obj.then((res) => { |
| | | if (res.success) { |
| | | that.$message.success("修改成功") |
| | | // that.$message.success(res.message) |
| | | that.$emit('ok', res.result) |
| | | } else { |
| | | that.$message.warning(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(startOne < dataStart){ |
| | | // that.$message.warning("开始时间不能小于当前时间") |
| | | // that.confirmLoading = false |
| | | // }else{ |
| | | // if(startOne>=endOne){ |
| | | // that.$message.warning("结束时间不能小于开始时间"); |
| | | // // console.log(this.model) |
| | | // // this.endTime = '' |
| | | // that.confirmLoading = false |
| | | // }else{ |
| | | |
| | | } |
| | | // } |
| | | |
| | | // } |
| | | }) |
| | | }, |
| | | handleCancel() { |