lilei il y a 2 ans
Parent
commit
87b2dc53c8

+ 9 - 6
src/views/allocationManagement/transferOut/basicInfoModal.vue

@@ -7,7 +7,7 @@
     :title="isEdit?'编辑':'新增'"
     v-model="isShow"
     @cancel="isShow = false"
-    :width="800">
+    :width="900">
     <a-spin :spinning="spinning" tip="Loading...">
       <a-form-model
         id="allocateBill-basicInfo-form"
@@ -26,7 +26,7 @@
             </a-form-model-item>
           </a-col>
           <a-col :md="12" :sm="24" v-if="!isEdit">
-            <a-form-model-item label="调往对象名称" :prop="isDealer ? 'targetSn' : 'targetName'">
+            <a-form-model-item label="调往对象名称" :prop="isDealer||isDepartment ? 'targetSn' : 'targetName'">
               <a-select
                 v-if="isDealer"
                 show-search
@@ -41,7 +41,8 @@
                 <a-spin v-if="fetching" slot="notFoundContent" size="small" />
                 <a-select-option v-for="item in dealerData" :key="item.dealerSn" :value="item.dealerSn">{{ item.dealerName }}</a-select-option>
               </a-select>
-              <department v-if="!isDealer" style="width: 100%;" placeholder="请选择部门" @change="departementChange" v-model="form.targetSn"></department>
+              <department v-else-if="isDepartment" style="width: 100%;" placeholder="请选择部门" @change="departementChange" v-model="form.targetSn"></department>
+              <a-input v-else v-model="form.targetName" placeholder="请输入调往对象名称(最多30个字符)" :maxLength="30"></a-input>
             </a-form-model-item>
           </a-col>
           <a-col :md="12" :sm="24">
@@ -170,6 +171,9 @@ export default {
     // 当前所选调往对象是否为经销商
     isDealer () {
       return this.form.targetType == 'DEALER'
+    },
+    isDepartment () {
+      return this.form.targetType == 'DEPARTMENT'
     }
   },
   methods: {
@@ -254,12 +258,11 @@ export default {
               _this.$message.success(res.message)
               _this.isShow = false
               _this.$emit('ok', res.data)
-            } else {
-              _this.spinning = false
             }
+            _this.spinning = false
           })
         } else {
-          console.log('error submit!!')
+          _this.spinning = false
           return false
         }
       })

+ 11 - 2
src/views/allocationManagement/transferReturn/basicInfoModal.vue

@@ -42,7 +42,8 @@
             <a-spin v-if="fetching" slot="notFoundContent" size="small" />
             <a-select-option v-for="item in dealerData" :key="item.dealerSn" :value="item.dealerSn">{{ item.dealerName }}</a-select-option>
           </a-select>
-          <a-input v-if="!isDealer" v-model.trim="form.targetName" placeholder="请输入调拨退货对象名称(最多30个字符)" allowClear :maxLength="30" />
+          <department v-else-if="isDepartment" style="width: 100%;" placeholder="请选择部门" @change="departementChange" v-model="form.targetSn"></department>
+          <a-input v-else v-model.trim="form.targetName" placeholder="请输入调拨退货对象名称(最多30个字符)" allowClear :maxLength="30" />
         </a-form-model-item>
         <a-form-model-item label="费用/调拨退货类型" prop="costTypeSn">
           <AllocateType id="allocateBill-basicInfo-allocateTypeSn" v-model="allocateTypeVal" placeholder="请选择费用/调拨退货类型" @change="allocateTypeChange"></AllocateType>
@@ -74,11 +75,12 @@ import { commonMixin } from '@/utils/mixin'
 import debounce from 'lodash/debounce'
 import { VSelect } from '@/components'
 import { allocateReturnSave, allocateReturnQueryBySn } from '@/api/allocateReturn'
+import department from '@/views/expenseManagement/expenseReimbursement/department.js'
 import { dealerSubareaScopeList } from '@/api/dealer'
 import AllocateType from '@/views/common/allocateType.js'
 export default {
   name: 'TransferOutBasicInfoModal',
-  components: { VSelect, AllocateType },
+  components: { VSelect, AllocateType, department },
   mixins: [commonMixin],
   props: {
     openModal: {
@@ -122,6 +124,9 @@ export default {
     // 当前所选调往对象是否为经销商
     isDealer () {
       return this.form.targetType == 'DEALER'
+    },
+    isDepartment () {
+      return this.form.targetType == 'DEPARTMENT'
     }
   },
   methods: {
@@ -144,6 +149,10 @@ export default {
       const ind = this.dealerData.findIndex(item => item.dealerSn == value)
       this.form.targetName = this.dealerData[ind].dealerName
     },
+    departementChange (v, row) {
+       console.log(v,row)
+       this.form.targetName = row.name
+    },
     // 调拨类别 change
     allocateTypeChange (val, opt) {
       console.log(val, opt, '------------')