src/views/dnc/base/modules/ProductStructure/Process/ProcessModalForm.vue
@@ -17,7 +17,20 @@
      <a-row>
        <a-col :span="24">
          <a-form-model-item label="加工设备编号" :labelCol="labelColLong" :wrapperCol="wrapperColLong">
            <a-select v-model="model.processingEquipmentCode" placeholder="请选择加工设备编号"></a-select>
            <j-dict-select-tag v-model="model.processingEquipmentCode" placeholder="请选择加工设备编号" dictCode="mdc_equipment,equipment_id,equipment_id"/>
          </a-form-model-item>
        </a-col>
      </a-row>
      <a-row>
        <a-col :span="12">
          <a-form-model-item label="加工设备型号">
            <a-input v-model="model.processingEquipmentModel" placeholder="请输入加工设备型号"></a-input>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="加工设备类型">
            <a-input v-model="model.processingEquipmentOs" placeholder="请输入加工设备类型"></a-input>
          </a-form-model-item>
        </a-col>
      </a-row>
@@ -61,22 +74,19 @@
        </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 },
@@ -104,28 +114,23 @@
          ]
        },
        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() {
      //备份model原始值
      this.modelDefault = JSON.parse(JSON.stringify(this.model))
      this.$bus.$on('sendAllDeviceList', deviceList => this.deviceList = deviceList)
    },
    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
@@ -134,11 +139,13 @@
          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) {
@@ -159,20 +166,6 @@
          }
        })
      },
      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')
      }
    }
  }