¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-spin :spinning="confirmLoading"> |
| | | <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-row> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="åå
·ç¼å·"> |
| | | <a-input v-model="model.cutterCode" placeholder="请è¾å
¥åå
·ç¼å·" :readOnly="disableSubmit"/> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="åå
·åç§°" prop="cutterName"> |
| | | <a-input v-model="model.cutterName" placeholder="请è¾å
¥åå
·åç§°" :readOnly="disableSubmit"/> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | |
| | | <a-row> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="åå
·ç®ç§°" prop="cutterType"> |
| | | <a-input v-model="model.cutterType" placeholder="请è¾å
¥åå
·ç®ç§°" :readOnly="disableSubmit"/> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="é¢å®å¯¿å½"> |
| | | <a-input-number v-model="model.lifetime" :min="0" placeholder="请è¾å
¥é¢å®å¯¿å½" style="width: 100%" |
| | | :disabled="disableSubmit"/> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | |
| | | <a-row> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="åä½" prop="cutterSpacing"> |
| | | <a-input v-model="model.cutterSpacing" placeholder="请è¾å
¥åä½" :readOnly="disableSubmit"/> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="åå
·æ°é"> |
| | | <a-input-number v-model="model.quantity" placeholder="请è¾å
¥åå
·æ°é" :min="1" style="width: 100%" |
| | | :disabled="disableSubmit"/> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | |
| | | <a-row> |
| | | <a-col :span="24"> |
| | | <a-form-model-item label="æè¿°" :labelCol="labelColLong" :wrapperCol="wrapperColLong"> |
| | | <a-textarea v-model="model.description" placeholder="请è¾å
¥æè¿°" :readOnly="disableSubmit"/> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | </a-form-model> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script> |
| | | import { httpAction } from '@/api/manage' |
| | | |
| | | export default { |
| | | name: 'CutterModalForm', |
| | | components: {}, |
| | | props: { |
| | | disableSubmit: { |
| | | type: Boolean |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | model: { |
| | | quantity: 1 |
| | | }, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 8 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 14 } |
| | | }, |
| | | labelColLong: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 4 } |
| | | }, |
| | | wrapperColLong: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 19 } |
| | | }, |
| | | confirmLoading: false, |
| | | validatorRules: { |
| | | cutterType: [ |
| | | { required: true, message: '请è¾å
¥åå
·ç®ç§°!' } |
| | | ], |
| | | cutterName: [ |
| | | { required: true, message: '请è¾å
¥åå
·åç§°!' } |
| | | ], |
| | | cutterSpacing: [ |
| | | { required: true, message: '请è¾å
¥åä½!' } |
| | | ] |
| | | }, |
| | | url: { |
| | | add: '/nc/cutter/add', |
| | | edit: '/nc/cutter/edit' |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | //å¤ä»½modelåå§å¼ |
| | | this.modelDefault = JSON.parse(JSON.stringify(this.model)) |
| | | }, |
| | | methods: { |
| | | add(params) { |
| | | this.edit({ ...this.modelDefault, ...params }) |
| | | }, |
| | | edit(record) { |
| | | this.model = Object.assign({}, record) |
| | | console.log('model', this.model) |
| | | }, |
| | | submitForm() { |
| | | const that = this |
| | | // 触å表åéªè¯ |
| | | this.$refs.form.validate(valid => { |
| | | if (valid) { |
| | | that.confirmLoading = true |
| | | let httpUrl, method |
| | | if (!this.model.id) { |
| | | httpUrl = this.url.add |
| | | method = 'post' |
| | | } else { |
| | | httpUrl = this.url.edit |
| | | method = 'put' |
| | | } |
| | | httpAction(httpUrl, this.model, method).then((res) => { |
| | | if (res.success) { |
| | | that.$notification.success({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | that.$emit('ok') |
| | | } else { |
| | | that.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }).finally(() => { |
| | | that.confirmLoading = false |
| | | }) |
| | | } |
| | | |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |