Browse Source

收货地址档案新增参照提交

黄梓星 2 years ago
parent
commit
3e46b087f6

+ 3 - 56
src/views/purchase/MaterialClassDivision/add.vue

@@ -251,11 +251,6 @@
 
     <Refers ref="refer" @doSubmit="selectionsRefer" :single="true"/>
 
-    <staff2
-      ref="staff2"
-      @doSubmit="acceptStaff2"
-      :single="true"
-    />
   </div>
 </template>
 
@@ -271,16 +266,13 @@ import popDialog from '@/components/PopDialog/index.vue'
 import Refers from '@/components/Refers/refers.vue'
 // 用于回显参照框数据
 import { getRefer } from '@/api/purchase/basic.js'
-import staff2 from '@/components/PopDialog/staff.vue'
-// 所属组织,订单员用于回显
-import { getOrgs, getStaff} from '@/api/requisition/basic'
+
 export default {
   name: 'addDivision',
   components: {
     fourClass,
     popDialog,
     Refers,
-    staff2
   },
   props: ['pageStu','row', 'disable'],
   model: {
@@ -369,9 +361,6 @@ export default {
           if (this.basicForm.org) { this.reBackRefer('ORG_PARAM', this.basicForm.org) }
           if (this.basicForm.orderPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.orderPersonal, '订单员') }
           if (this.basicForm.buyer) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.buyer, '采购员') }
-          // this.getOrgDetails(res.data.org)
-          // this.getStaffDetails(res.data.orderPersonal)
-          // this.getStaffDetails2(res.data.buyer)
         }
       })
     },
@@ -433,9 +422,9 @@ export default {
         this.basicForm.buyerName = selection[0].name
       }
     },
-    // 回显参照框
+    // 回显参照框 加title解决判断重复提交问题
     reBackRefer(type, id, title) {
-      getRefer({ type: type, id: id }).then(res => {
+      getRefer({ type: type, id: id, title: title }).then(res => {
         if (type == 'ORG_PARAM') {
           this.organizationsOptions = res.rows
         }
@@ -447,48 +436,6 @@ export default {
         }
       })
     },
-    // 选择订单员
-    // acceptStaff (selections) {
-    //   this.staffOptions = selections
-    //   this.basicForm.orderPersonal = selections[0].code
-    //   this.basicForm.orderPersonalName = selections[0].name
-    //   this.getStaffDetails(selections[0].id)
-    // },
-    // // 订单员显示列表
-    // chooseStaff () {
-    //   this.$refs.staffs.blur()
-    //   this.$refs.staff.init()
-    // },
-    // // 订单员回显
-    // getStaffDetails(id) {
-    //   getStaff({id:id}).then(res => {
-    //     console.log('订单员', res)
-    //     if (res.code === 200 ) {
-    //       this.staffOptions = res.data.tableBody
-    //     }
-    //   })
-    // },
-    // 选择采购员
-    acceptStaff2 (selections) {
-      this.staff2Options = selections
-      this.basicForm.buyer = selections[0].code
-      this.basicForm.buyerName = selections[0].name
-      this.getStaffDetails2(selections[0].id)
-    },
-    // 采购员显示列表
-    chooseStaff2 () {
-      this.$refs.staffs2.blur()
-      this.$refs.staff2.init()
-    },
-    // 采购员回显
-    getStaffDetails2(id) {
-      getStaff({id:id}).then(res => {
-        console.log('采购员', res)
-        if (res.code === 200 ) {
-          this.staff2Options = res.data.tableBody
-        }
-      })
-    },
   }
 }
 </script>

+ 38 - 11
src/views/purchase/deliveryAddress/add.vue

@@ -28,7 +28,7 @@
 
         <el-col :span="1.5">
             <el-form-item label="仓库档案名称">
-              <el-select size="small" v-model="basicForm.warehouseCode" :disabled="disable" @focus="chooseRefer('WAREHOUSE_PARAM', true, '仓库档案名称')" style="width: 200px">
+              <el-select size="small" v-model="basicForm.warehouse" :disabled="disable" @focus="chooseRefer('WAREHOUSE_PARAM', true, '仓库档案名称')" style="width: 200px">
                 <el-option v-for="item in houseOptions" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
             </el-form-item>
@@ -57,8 +57,8 @@
 
           <el-col :span="1.5">
             <el-form-item label="联系人">
-              <el-select size="small" v-model="basicForm.contactsName" :disabled="disable" @focus="chooseRefer('CONTACTS_PARAM', true, '联系人')" style="width: 200px">
-                <el-option v-for="item in contactsOptions" :key="item.id" :label="item.name" :value="item.id" />
+              <el-select size="small" v-model="basicForm.contacts" :disabled="disable" @focus="chooseRefer('CONTACTS_PARAM', true, '联系人')" style="width: 200px">
+                <el-option v-for="item in contactsOptions" :key="item.id" :label="item.name" :value="item.code" />
               </el-select>
             </el-form-item>
          </el-col>
@@ -105,9 +105,9 @@
 
          <el-col :span="1.5">
             <el-form-item label="同步状态">
-              <el-select v-model="basicForm.sendStatus" size="small" style="width: 200px" clearable :disabled="disable">
+              <el-select disabled v-model="basicForm.sendStatus" size="small" style="width: 200px">
                 <el-option
-                  v-for="item in options"
+                  v-for="item in options2"
                   :key="item.value"
                   :label="item.label"
                   :value="item.value">
@@ -153,6 +153,8 @@
 import Refers from '@/components/Refers/refers.vue'
 import TreeRefers from '@/components/Refers/treeRefer.vue'
 import {addAddress, getAddressDetail, editAddress} from '@/api/purchase/deliveryAddress.js'
+// 用于回显参照框数据
+import { getRefer } from '@/api/purchase/basic.js'
 export default {
   name: 'addAddress',
   dicts: ['sys_warehouse_attribute'],
@@ -171,7 +173,7 @@ export default {
         code: '',
         name: '',
         warehouse: '',
-        warehouseCode: '',
+        warehouseName: '',
         warehouseProperty: '',
         address: '',
         contacts: '',
@@ -180,7 +182,7 @@ export default {
         materialClassify: '',
         materialClassifyName: '',
         status: '',
-        sendStatus: '',
+        sendStatus: '2',
         remark: '',
       },
       referCondition: {
@@ -189,9 +191,14 @@ export default {
         title: ''
       },
       options: [{
-        value: '1', label: '是',
+        value: '0', label: '启用',
+      }, {
+        value: '2', label: '停用'
+      }],
+      options2: [{
+        value: '0', label: '已同步',
       }, {
-        value: '0', label: '否'
+        value: '2', label: '未同步'
       }],
       houseOptions: [],
       contactsOptions: [],
@@ -239,6 +246,9 @@ export default {
       getAddressDetail(row.id).then(res => {
         if (res.code === 200) {
           this.basicForm = res.data
+          if (this.basicForm.warehouse) { this.reBackRefer('WAREHOUSE_PARAM', this.basicForm.warehouse) }
+          if (this.basicForm.contacts) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.contacts) }
+          if (this.basicForm.materialClassify) { this.reBackRefer('MATERIALCLASSIFY_PARAM', this.basicForm.materialClassify) }
         }
       })
     },
@@ -251,11 +261,13 @@ export default {
     selectionsToInput(selection) {
       if (this.referCondition.type == 'WAREHOUSE_PARAM') {
         this.houseOptions = selection
-        this.basicForm.warehouseCode = selection[0].id
+        this.basicForm.warehouseName = selection[0].name
+        this.basicForm.warehouse = selection[0].id
       }
       if (this.referCondition.type == 'CONTACTS_PARAM') {
         this.contactsOptions = selection
-        this.basicForm.contactsName = selection[0].id
+        this.basicForm.contactsName = selection[0].name
+        this.basicForm.contacts = selection[0].code
       }
     },
     chooseTreeRefer(type, isPage, title) {
@@ -267,6 +279,21 @@ export default {
     selectionsToInput2(selection) {
       this.classOptions.push(selection)
       this.basicForm.materialClassify = selection.id
+      this.basicForm.materialClassifyName = selection.name
+    },
+    // 回显参照框 加title解决判断重复提交问题
+    reBackRefer(type, id, title) {
+      getRefer({ type: type, id: id, title: title }).then(res => {
+        if (type == 'WAREHOUSE_PARAM') {
+          this.houseOptions = res.rows
+        }
+        if (type == 'CONTACTS_PARAM') {
+          this.contactsOptions = res.rows
+        }
+        if (type == 'MATERIALCLASSIFY_PARAM') {
+          this.classOptions = res.rows
+        }
+      })
     },
   }
 }