zhangherong
2025-03-06 c6a9b4379bb5d3c682267838737c46aabeb56207
src/views/eam/modules/projectMaintenanceOrder/ProjectMaintenanceOrderForm.vue
@@ -18,7 +18,8 @@
            >
              <a-input
                v-model='model.num'
                placeholder='请输入计划单编号'
                placeholder='自动生成'
                :disabled="true"
              ></a-input>
            </a-form-model-item>
          </a-col>
@@ -97,10 +98,7 @@
              :wrapperCol='wrapperCol'
              prop='annex'
            >
              <j-image-upload
                :isMultiple="false"
                v-model="model.annex"
              ></j-image-upload>
            <j-upload :returnUrl= "false" :isMultiple="false"  v-model="model.file" ></j-upload>
            </a-form-model-item>
          </a-col>
          <a-col :span='12'>
@@ -215,10 +213,10 @@
import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
import { JVXETypes } from '@comp/jeecg/JVxeTable'
import { getRefPromise, VALIDATE_FAILED } from '@/components/jeecg/JVxeTable/utils/vxeUtils.js'
import JFormContainer from '@/components/jeecg/JFormContainer'
import { getAction } from '@api/manage'
import { VALIDATE_FAILED, getRefPromise, validateFormAndTables,validateFormModelAndTables} from '@/components/jeecg/JVxeTable/utils/vxeUtils.js'
export default {
  name: 'ProjectMaintenanceOrderForm',
@@ -250,10 +248,10 @@
      addDefaultRowNum: 0,
      model: {},
      validatorRules: {
        num: [
          { required: true, message: '请输入计划编号!' },
          { validator: (rule, value, callback) => validateDuplicateValue('mom_eam_project_maintenance_order', 'num', value, this.model.id, callback) }
        ],
        // num: [
        //   { required: true, message: '请输入计划编号!' },
        //   { validator: (rule, value, callback) => validateDuplicateValue('mom_eam_project_maintenance_order', 'num', value, this.model.id, callback) }
        // ],
        remark: [
          { required: false, message: '请输入备注!' }
        ]
@@ -310,7 +308,7 @@
              }]
          },
          {
            title: '设备编码',
            title: '统一编码',
            key: 'equipmentNum',
            type: JVXETypes.normal,
            width: '140px',
@@ -318,16 +316,7 @@
            fixed: 'left'
          },
          {
            title: '资产编码',
            key: 'assetNumber',
            type: JVXETypes.normal,
            width: '140px',
            align: "center",
            fixed: 'left',
            defaultValue: ''
          },
          {
            title: '委外单位',
            title: '外委单位',
            key: 'supplierId',
            type: JVXETypes.slot,
            disabled: true,
@@ -337,7 +326,7 @@
            defaultValue: ''
          },
          {
            title: '委外单位',
            title: '外委单位',
            key: 'supplierId',
            type: JVXETypes.hidden
          },
@@ -543,6 +532,32 @@
  },
  methods: {
    handleOk() {
      this.model['annex'] = this.model.file[0].filePath;
      /** 触发表单验证 */
      this.getAllTable().then(tables => {
        /** 一次性验证主表和所有的次表 */
        return validateFormModelAndTables(this.$refs.form,this.model, tables)
      }).then(allValues => {
        /** 一次性验证一对一的所有子表 */
        return this.validateSubForm(allValues)
      }).then(allValues => {
        if (typeof this.classifyIntoFormData !== 'function') {
          throw this.throwNotFunction('classifyIntoFormData')
        }
        let formData = this.classifyIntoFormData(allValues)
        // 发起请求
        return this.request(formData)
      }).catch(e => {
        if (e.error === VALIDATE_FAILED) {
          // 如果有未通过表单验证的子表,就自动跳转到它所在的tab
          this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
        } else {
          console.error(e)
        }
      })
    },
    getSuppler() {
      getAction(this.url.supplierVoList).then((res) => {
        if (res.success) {
@@ -661,6 +676,7 @@
    /** 调用完edit()方法之后会自动调用此方法 */
    editAfter() {
      this.$nextTick(() => {
        this.model.file = this.model.annex;
      })
      // 加载子表数据
      if (this.model.id) {