| | |
| | | <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> |
| | | <a-row> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="订单号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orderCode"> |
| | | <a-input v-model="model.orderCode"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="物料编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialNumber"> |
| | | <a-input v-model="model.materialNumber" placeholder="请输入物料编码" ></a-input> |
| | | <a-input v-model="model.materialNumber"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="物料名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialName"> |
| | | <a-input v-model="model.materialName" placeholder="请输入物料名称" ></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="产线ID(SAP工作中心)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="factoryId"> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="24"> |
| | | <a-form-item |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | label="" |
| | | > |
| | | <j-select-factory |
| | | :disabled="disabled" |
| | | v-model="model.factoryId" |
| | | :multi="true" |
| | | @back="backFactoryInfo" |
| | | :backProduction="true" |
| | | :treeProductOpera="true" |
| | | ></j-select-factory> |
| | | </a-form-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-input v-model="model.materialName"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="工序号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="processCode"> |
| | | <a-input v-model="model.processCode" placeholder="请输入工序号" ></a-input> |
| | | <a-input v-model="model.processCode"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="工序名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="processName"> |
| | | <a-input v-model="model.processName" placeholder="请输入工序名称" ></a-input> |
| | | <a-input v-model="model.processName"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="控制码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="controlCode"> |
| | | <a-input v-model="model.controlCode" placeholder="请输入控制码" ></a-input> |
| | | <a-input v-model="model.controlCode"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | |
| | | |
| | | <script> |
| | | |
| | | import { httpAction, getAction } from '@/api/manage' |
| | | import { validateDuplicateValue } from '@/utils/util' |
| | | import JSelectFactory from '@comp/jeecgbiz/JSelectFactory.vue' |
| | | import JTreeDict from '@/components/jeecg/JTreeDict'//分类字典树形下拉组件 |
| | | |
| | | export default { |
| | | name: 'PmsMaterialProcessForm', |
| | | components: { |
| | | JSelectFactory, |
| | | JTreeDict |
| | | }, |
| | | props: { |
| | | //表单禁用 |
| | | disabled: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false |
| | | } |
| | | }, |
| | | data () { |
| | | return { |
| | | model:{ |
| | | }, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 }, |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 }, |
| | | }, |
| | | confirmLoading: false, |
| | | validatorRules: { |
| | | factoryId: [ |
| | | { required: true, message: '产线是必选项', trigger: 'change' } |
| | | ], |
| | | materialNumber: [ |
| | | { required: true, message: '物料编码是必选项', trigger: 'change' } |
| | | ], |
| | | materialName: [ |
| | | { required: true, message: '物料名称是必选项', trigger: 'change' } |
| | | ], |
| | | processCode: [ |
| | | { required: true, message: '工序号是必选项', trigger: 'change' } |
| | | ], |
| | | processName: [ |
| | | { required: true, message: '工序名称是必选项', trigger: 'change' } |
| | | ], |
| | | }, |
| | | url: { |
| | | add: "/pms/pmsMaterialProcess/add", |
| | | edit: "/pms/pmsMaterialProcess/edit", |
| | | queryById: "/pms/pmsMaterialProcess/queryById" |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | | formDisabled(){ |
| | | return this.disabled |
| | | export default { |
| | | name: 'PmsMaterialProcessForm', |
| | | components: {}, |
| | | props: { |
| | | //表单禁用 |
| | | disabled: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | model: {}, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 } |
| | | }, |
| | | confirmLoading: false, |
| | | validatorRules: {}, |
| | | url: {} |
| | | } |
| | | }, |
| | | computed: { |
| | | formDisabled() { |
| | | return this.disabled |
| | | } |
| | | }, |
| | | created() { |
| | | //备份model原始值 |
| | | this.modelDefault = JSON.parse(JSON.stringify(this.model)) |
| | | }, |
| | | methods: { |
| | | add() { |
| | | this.edit(this.modelDefault) |
| | | }, |
| | | created () { |
| | | //备份model原始值 |
| | | this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
| | | }, |
| | | methods: { |
| | | backFactoryInfo(info) { |
| | | this.model.factoryIds = this.model.factoryId |
| | | this.nextFactoryOptions = info.map((item, index, arr) => { |
| | | let c = { label: item.text, value: item.value + '' } |
| | | return c |
| | | }) |
| | | }, |
| | | add () { |
| | | this.edit(this.modelDefault); |
| | | }, |
| | | edit (record) { |
| | | this.model = Object.assign({}, record); |
| | | this.visible = true; |
| | | }, |
| | | submitForm () { |
| | | const that = this; |
| | | // 触发表单验证 |
| | | this.$refs.form.validate(valid => { |
| | | if (valid) { |
| | | that.confirmLoading = true; |
| | | let httpurl = ''; |
| | | let 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.$message.success(res.message); |
| | | that.$emit('ok'); |
| | | }else{ |
| | | that.$message.warning(res.message); |
| | | } |
| | | }).finally(() => { |
| | | that.confirmLoading = false; |
| | | }) |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | edit(record) { |
| | | this.model = Object.assign({}, record) |
| | | this.visible = true |
| | | } |
| | | } |
| | | } |
| | | </script> |