408249787 пре 2 година
родитељ
комит
644ca0b4e4
1 измењених фајлова са 49 додато и 1 уклоњено
  1. 49 1
      src/views/repair/application-form/modules/BaseForm.vue

+ 49 - 1
src/views/repair/application-form/modules/BaseForm.vue

@@ -17,6 +17,22 @@
 
       <row-list :col="2">
         <row-item>
+          <a-form-item
+            label="录入方式"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-radio-group v-decorator="['inputType', {initialValue: 2}]" button-style="solid" @change="inputTypeChange">
+              <a-radio-button :value="2">
+                选择录入
+              </a-radio-button>
+              <a-radio-button :value="1">
+                手动录入
+              </a-radio-button>
+            </a-radio-group>
+          </a-form-item>
+        </row-item>
+        <row-item v-if="inputType===2">
           <a-form-item
             label="设备名称"
             :labelCol="BaseTool.Constant.labelCol"
@@ -29,6 +45,26 @@
             <a-button style="width: 30%" type="primary" @click="handleSbSelect">选择</a-button>
           </a-form-item>
         </row-item>
+        <row-item v-else>
+          <a-form-item
+            label="设备名称"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['sbName', {rules: [{required: true, message: '设备名称不能为空'}]}]" />
+          </a-form-item>
+        </row-item>
+        <row-item v-if="inputType===1">
+          <a-form-item
+            label="设备位号"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['positionNo', {rules: [{required: true, message: '设备位号不能为空'}]}]" />
+          </a-form-item>
+        </row-item>
         <row-item>
           <a-form-item
             label="机电仪位号"
@@ -114,6 +150,7 @@
               :load-data="loadData"
               placeholder="请选择"
               change-on-select
+              @change="sbPositionChange"
               v-decorator="['sbPosition', {rules: [{required: true, message: '生产装置不能为空'}]}]"
             />
           </a-form-item>
@@ -448,6 +485,8 @@ export default {
       SHOW_PARENT,
       confirmLoading: false,
       modalTitle: null,
+      inputType: 2,
+      positionId: '',
       professorMap: {},
       repairTypeMap: {},
       sbPositionList: [],
@@ -608,7 +647,8 @@ export default {
         targetOption.children = res.data.map(item => {
           item = {
             label: item.name,
-            value: item.name
+            value: item.name,
+            id: item.id
           }
           return item
         })
@@ -644,6 +684,7 @@ export default {
         values.applicationFileList = this.applicationFileList
         values.reportFileList = this.reportFileList
         values.sbPosition = values.sbPosition.join('->')
+        values.positionId = this.positionId
         console.log(values)
         if (values.partId === undefined) {
           values.partId = ''
@@ -751,6 +792,13 @@ export default {
         this.$message.error('上传失败')
         return []
       }
+    },
+    inputTypeChange (e) {
+      this.inputType = e.target.value
+      this.form.resetFields()
+    },
+    sbPositionChange (e, val) {
+      this.positionId = val[val.length - 1].id
     }
   }
 }