| | |
| | | </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 }, |
| | |
| | | ] |
| | | }, |
| | | 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 |
| | | }, |
| | | 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') |
| | | } |
| | | } |
| | | } |