guarantee-lsq 2 年之前
父節點
當前提交
cf6e63d97d

+ 1 - 2
src/views/repair/application-form/modules/DetailRepair.vue

@@ -1111,8 +1111,7 @@ export default {
     handleOutStroe () {
       this.visible = false
       const modal = this.$refs.outStroeForm
-      const pick = this.model.sbPositionName + this.model.sbCph
-      modal.base({}, pick, this.model.id)
+      modal.base({}, this.model)
     },
     handleOk () {
       this.loading = true

+ 54 - 11
src/views/store/outstoreform/modules/BaseFormYY.vue

@@ -101,9 +101,15 @@
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
+            <a-cascader
+              :options="sbPositionList"
+              :load-data="loadData"
+              placeholder="请选择"
+              change-on-select
+              v-decorator="['sbPosition', {rules: [{required: true, message: '生产装置不能为空'}]}]"
+            />
             <a-input
-              disabled
-              v-model="pickStr" />
+              v-decorator="['sbCph']" />
           </a-form-item>
         </a-col>
         <a-col :lg="12" :md="24" :sm="24">
@@ -186,7 +192,7 @@ import BaseFormForModify from '@/views/store/outstoredetail/modules/BaseFormForM
 import BaseTool from '@/utils/tool'
 import { queryUsersByParentDeptNatureAll } from '@/api/upms/user'
 import { fetchStoreTree } from '@/api/store/store'
-
+import { getSbPositions } from '@/api/repair/application-form'
 export default {
   name: 'BaseOutStoreFormYY',
   components: {
@@ -205,8 +211,9 @@ export default {
       visible: false,
       maskClosable: false,
       outFlag: 1,
-      pickStr: '',
-      pickId: '',
+      model: {},
+      sbPositionList: [],
+
       storeId: null,
       // 下拉框map
       typeMap: {},
@@ -290,13 +297,15 @@ export default {
   },
   created () {
     // 下拉框map
+    this.getSbPositions()
+
     // this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.OUT_STORE_FORM_TYPE)
   },
   methods: {
-    base (record, pickStr, pickId) {
+    base (record, model) {
       this.visible = true
-      this.pickStr = pickStr
-      this.pickId = pickId
+      this.model = model
+      console.log(model)
       this.outFlag = record.outFlag
       if (record.outFlag === 1) {
         this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.OUT_STORE_FORM_TYPE)
@@ -320,7 +329,12 @@ export default {
         this.$nextTick(() => {
           setFieldsValue(Object.assign(pick(record, [
             'outFlag'
-          ])))
+          ]), pick(model, [
+            'sbCph'
+          ]), {
+            'sbPosition': model.sbPosition.split('->')
+
+          }))
         })
         return
       }
@@ -359,7 +373,7 @@ export default {
         }
         values.outFlag = this.outFlag
         values.detailList = this.data
-        values.pickId = this.pickId
+        values.pickId = this.model.id
         values.userTime = BaseTool.Date.formatter(values.userTime, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
         // 日期处理
         if (this.BaseTool.String.isBlank(values.id)) {
@@ -379,7 +393,36 @@ export default {
         }
       })
     },
-
+    loadData (selectedOptions) {
+      console.log(selectedOptions)
+      const targetOption = selectedOptions[selectedOptions.length - 1]
+      targetOption.loading = true
+      getSbPositions({ parentId: targetOption.id }).then(res => {
+        targetOption.loading = false
+        targetOption.children = res.data.map(item => {
+          item = {
+            label: item.name,
+            value: item.name
+          }
+          return item
+        })
+        this.sbPositionList = [...this.sbPositionList]
+      })
+    },
+    getSbPositions (parentId) {
+      getSbPositions({ parentId }).then(res => {
+        console.log(res)
+        this.sbPositionList = res.data.map(item => {
+          item = {
+            label: item.name,
+            value: item.name,
+            id: item.id,
+            isLeaf: false
+          }
+          return item
+        })
+      })
+    },
     handleCancel (values) {
       this.visible = false
       this.confirmLoading = false