src/views/dnc/base/modules/ProductStructure/Process/ProcessModalForm.vue
@@ -61,22 +61,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,14 +101,9 @@
          ]
        },
        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() {
@@ -119,13 +111,12 @@
      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
@@ -134,11 +125,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 +152,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')
      }
    }
  }