| | |
| | | <template> |
| | | <a-spin :spinning="confirmLoading"> |
| | | <a-form-model ref="form" :model="model" :rules="validatorRules"> |
| | | <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-row> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="工序号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="processCode"> |
| | | <a-form-model-item label="工序号" prop="processCode"> |
| | | <a-input v-model="model.processCode" placeholder="请输入工序号"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="工序名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="processName"> |
| | | <a-form-model-item label="工序名称" prop="processName"> |
| | | <a-input v-model="model.processName" placeholder="请输入工序名称"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | |
| | | |
| | | <a-row> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="工艺编号" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-form-model-item label="工艺编号"> |
| | | <a-input v-model="model.craftNo" placeholder="请输入工艺编号"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="工艺规程版本" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-form-model-item label="工艺规程版本"> |
| | | <a-input v-model="model.craftVersion" placeholder="请输入工艺规程版本"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | |
| | | |
| | | <a-row> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="工序类型" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-form-model-item label="工序类型"> |
| | | <a-input v-model="model.processType" placeholder="请输入工序类型"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="工序描述" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-form-model-item label="工序描述"> |
| | | <a-input v-model="model.description" placeholder="请输入工序描述"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | |
| | | |
| | | <a-row> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="工装编号" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-form-model-item label="工装编号"> |
| | | <a-input v-model="model.assembleStep" placeholder="请输入工装编号"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="工装名称" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-form-model-item label="工装名称"> |
| | | <a-input v-model="model.assembleName" placeholder="请输入工装名称"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | </a-form-model> |
| | | |
| | | <select-device-drawer ref="selectDeviceDrawer" @selectFinished="selectOK" :title="'选择设备'"/> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script> |
| | | import { httpAction, getAction } from '@/api/manage' |
| | | import SelectDeviceDrawer from '@/views/system/modules/SelectDeviceDrawer' |
| | | |
| | | export default { |
| | | name: 'ProcessModalForm', |
| | | components: { SelectDeviceDrawer }, |
| | | components: {}, |
| | | data() { |
| | | return { |
| | | model: { |
| | | passCount: 0 |
| | | processType: 0 |
| | | }, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | }, |
| | | confirmLoading: false, |
| | | validatorRules: { |
| | | equipmentIds: [ |
| | | { required: true, message: '请选择设备!' } |
| | | processCode: [ |
| | | { required: true, message: '请输入工序号!' } |
| | | ], |
| | | partId: [ |
| | | { required: true, message: '请输入零件号!' } |
| | | ], |
| | | standardProcessLong: [ |
| | | { required: true, message: '请输入标准加工工时(min)!' } |
| | | ], |
| | | processCount: [ |
| | | { required: true, message: '请输入加工零件数量!' } |
| | | ], |
| | | passCount: [ |
| | | { required: true, message: '请输入合格零件数量!' } |
| | | ], |
| | | theDate: [ |
| | | { required: true, message: '请选择日期!' } |
| | | processName: [ |
| | | { required: true, message: '请输入工序名称!' } |
| | | ] |
| | | }, |
| | | url: { |
| | | add: '/mdc/mdcPartProcessInfo/add', |
| | | edit: '/mdc/mdcPartProcessInfo/edit' |
| | | add: '/nc/stream/process/add', |
| | | edit: '/nc/stream/process/edit' |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | | formDisabled() { |
| | | return this.disabled |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | this.modelDefault = JSON.parse(JSON.stringify(this.model)) |
| | | }, |
| | | methods: { |
| | | add() { |
| | | this.edit(this.modelDefault) |
| | | add(params) { |
| | | this.edit({ ...this.modelDefault, ...params }) |
| | | }, |
| | | edit(record) { |
| | | this.model = Object.assign({}, { equipmentIds: record.equipmentId }, record) |
| | | this.model = Object.assign({}, record) |
| | | console.log('model', this.model) |
| | | this.visible = true |
| | | }, |
| | | inputNumberChange() { |
| | | if (this.model.standardProcessLong && this.model.processCount) { |
| | | this.model.totalProcessLong = this.model.standardProcessLong * this.model.processCount |
| | | } |
| | | }, |
| | | submitForm() { |
| | | const that = this |
| | |
| | | if (valid) { |
| | | that.confirmLoading = true |
| | | let httpUrl = '' |
| | | let method = 'post' |
| | | let method = '' |
| | | if (!this.model.id) { |
| | | httpUrl += this.url.add |
| | | method = 'post' |
| | | } else { |
| | | httpUrl += this.url.edit |
| | | httpUrl += this.url.edit + `/${this.model.id}` |
| | | method = 'put' |
| | | } |
| | | httpAction(httpUrl, this.model, method).then((res) => { |
| | | if (res.success) { |
| | |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | deviceSearch() { |
| | | this.$refs.selectDeviceDrawer.visible = true |
| | | this.$refs.selectDeviceDrawer.selectedRowKeys = [] |
| | | this.$refs.selectDeviceDrawer.selectedRows = [] |
| | | this.$refs.selectDeviceDrawer.checkedKeys = this.model.equipmentIds ? this.model.equipmentIds.split(',') : [] |
| | | }, |
| | | /** |
| | | * 选择已有设备后点击确定时触发 |
| | | * @param data 已选择的设备 |
| | | */ |
| | | selectOK(data) { |
| | | this.$set(this.model, 'equipmentIds', data.join(',')) |
| | | if (this.model.equipmentIds) this.$refs.form.clearValidate('equipmentIds') |
| | | } |
| | | } |
| | | } |