Ver código fonte

feature(项目):项目管理模块联系人信息优化

ZZH-wl 2 anos atrás
pai
commit
7654275148

+ 1 - 1
src/components/select/SelectCustomerContact.vue

@@ -82,7 +82,7 @@
   import CustomerContact from '@/views/customer/components/Contact'
 
   export default {
-    name: 'SelectContact',
+    name: 'SelectCustomerContact',
     components: {
       TableTool,
       CustomerContact,

+ 2 - 2
src/components/select/SelectDistributorContact.vue

@@ -3,7 +3,7 @@
     <el-row>
       <el-col :span="24">
         <el-input
-          v-model="queryForm.cuctName"
+          v-model="queryForm.name"
           clearable
           placeholder="联系人"
           style="width: 30%; margin-right: 10px"
@@ -64,7 +64,7 @@
   import AddDistributorContact from '@/views/base/distributor/components/EditContact'
 
   export default {
-    name: 'SelectContact',
+    name: 'SelectDistributorContact',
     components: {
       AddDistributorContact,
       TableTool,

+ 60 - 12
src/views/proj/business/components/DetailsContact.vue

@@ -13,7 +13,12 @@
         <el-button v-permissions="['proj:business:customerContact:add']" icon="el-icon-plus" @click="handleAddContact">
           新建客户联系人
         </el-button>
-        <el-button v-permissions="['proj:business:contact:associate']" @click="handleSelectContact">关联</el-button>
+        <el-button v-permissions="['proj:business:contact:associate']" @click="handleSelectCustomerContact">
+          关联客户联系人
+        </el-button>
+        <el-button v-permissions="['proj:business:contact:associate']" @click="handleSelectDealerContact">
+          关联渠道联系人
+        </el-button>
         <el-button v-permissions="['proj:business:contact:disassociate']" type="danger" @click="handleDisassociation">
           解除关联
         </el-button>
@@ -27,6 +32,11 @@
       @selection-change="setSelectRows">
       <el-table-column align="center" type="selection" />
       <el-table-column align="center" label="姓名" prop="cuctName" show-overflow-tooltip />
+      <el-table-column align="center" label="类型" prop="contactType" show-overflow-tooltip>
+        <template slot-scope="scope">
+          <span>{{ scope.row.contactType === '10' ? '客户' : '渠道' }}</span>
+        </template>
+      </el-table-column>
       <el-table-column align="center" label="岗位" prop="postion" show-overflow-tooltip />
       <el-table-column align="center" label="电话" prop="telephone" show-overflow-tooltip />
       <el-table-column align="center" label="微信" prop="wechat" show-overflow-tooltip />
@@ -38,7 +48,7 @@
       <!--        </template>-->
       <!--      </el-table-column>-->
       <el-table-column align="center" label="操作" show-overflow-tooltip>
-        <template slot-scope="scope">
+        <template v-if="scope.row.contactType === '10'" slot-scope="scope">
           <el-button
             v-if="scope.row.contactId !== primacyContactId"
             v-permissions="['proj:business:contact:primary']"
@@ -52,26 +62,34 @@
     </el-table>
 
     <!-- 选择客户联系人弹窗 -->
-    <select-contact
-      ref="selectContact"
+    <select-customer-contact
+      ref="selectCustomerContact"
       :default-customer="customerInfo"
       :query-params="queryContact"
-      @save="selectContact" />
+      @save="selectCustomerContact" />
     <!-- 新建联系人弹窗 -->
-    <customer-contact ref="contact" @contactSave="handleSelectContact" />
+    <customer-contact ref="contact" @contactSave="handleSelectCustomerContact" />
+
+    <!-- 选择渠道经销商联系人弹窗 -->
+    <select-distributor-contact
+      ref="selectDealerContact"
+      :default-dist="distributorInfo"
+      :query-params="queryDistContact"
+      @save="selectDealerContact" />
   </div>
 </template>
 
 <script>
   import businessApi from '@/api/proj/business'
   import businessContactApi from '@/api/proj/businessContact'
-  import SelectContact from '@/components/select/SelectCustomerContact'
+  import SelectCustomerContact from '@/components/select/SelectCustomerContact'
+  import SelectDistributorContact from '@/components/select/SelectDistributorContact'
   import CustomerContact from '@/views/customer/components/Contact'
   import { getUUID } from '@/utils'
 
   export default {
     name: 'Records',
-    components: { SelectContact, CustomerContact },
+    components: { CustomerContact, SelectCustomerContact, SelectDistributorContact },
     props: {
       // 项目Id
       busId: {
@@ -90,6 +108,13 @@
           return {}
         },
       },
+      // 渠道经销商信息{ distId: this.form.distributorId, distName: this.form.distributorName }
+      distributorInfo: {
+        type: Object,
+        default() {
+          return {}
+        },
+      },
     },
     data() {
       return {
@@ -103,6 +128,7 @@
         selectRows: [],
         contactList: [],
         queryContact: {},
+        queryDistContact: {},
       }
     },
     mounted() {
@@ -114,19 +140,41 @@
         this.$refs.contact.contactForm.custName = this.customerInfo.custName
         this.$refs.contact.contactVisible = true
       },
-      handleSelectContact() {
+      handleSelectCustomerContact() {
         this.queryContact.custId = this.customerInfo.custId
         if (!this.queryContact.custId) {
           this.$message.warning('请先选择客户')
           return
         }
-        this.$refs.selectContact.open()
+        this.$refs.selectCustomerContact.open()
+      },
+      async selectCustomerContact(val) {
+        if (val && val.length > 0) {
+          let form = {
+            busId: this.busId,
+            contactIds: val.map((item) => item.id),
+            contactType: '10',
+          }
+          const { msg } = await businessContactApi.doAdd(form)
+          this.$baseMessage(msg, 'success')
+          await this.fetchData()
+          this.$emit('fetch-data')
+        }
+      },
+      handleSelectDealerContact() {
+        this.queryDistContact.distId = this.distributorInfo.distId
+        if (!this.queryDistContact.distId) {
+          this.$message.warning('请先选择渠道经销商')
+          return
+        }
+        this.$refs.selectDealerContact.open()
       },
-      async selectContact(val) {
+      async selectDealerContact(val) {
         if (val && val.length > 0) {
           let form = {
             busId: this.busId,
             contactIds: val.map((item) => item.id),
+            contactType: '20',
           }
           const { msg } = await businessContactApi.doAdd(form)
           this.$baseMessage(msg, 'success')
@@ -138,7 +186,7 @@
         if (this.selectRows.length > 0) {
           const ids = this.selectRows.map((item) => item.id)
           this.$baseConfirm('你确定要解除关联选中项吗', null, async () => {
-            const { msg } = await businessContactApi.doDelete({ ids })
+            const { msg } = await businessContactApi.doDelete({ busId: this.busId, contactIds: ids })
             this.$baseMessage(msg, 'success')
             await this.fetchData()
             this.$emit('fetch-data')

+ 26 - 27
src/views/proj/business/detail.vue

@@ -9,7 +9,7 @@
             <span>
               <el-button @click="handleFollow">添加跟进</el-button>
               <!--升级、降级-->
-              <business-gradation :bus-id="id" :business-info="details" @fetch-data="init"/>
+              <business-gradation :bus-id="id" :business-info="details" @fetch-data="init" />
               <el-button
                 v-permissions="['proj:business:transfer']"
                 :disabled="details.approStatus === '20'"
@@ -124,7 +124,7 @@
                 {{ details.customerIntentionFactory }}
               </el-descriptions-item>
             </el-descriptions>
-            <h3  style="margin: 10px 0">其他信息</h3>
+            <h3 style="margin: 10px 0">其他信息</h3>
             <el-descriptions
               border
               :column="2"
@@ -159,6 +159,7 @@
               ref="contact"
               :bus-id="id"
               :customer-info="{ custId: details.custId, custName: details.custName }"
+              :distributor-info="{ distId: details.distributorId, distName: details.distributorName }"
               :primacy-contact-id="details.contactId"
               @fetch-data="getRecord" />
           </el-tab-pane>
@@ -173,16 +174,16 @@
           </el-tab-pane>
           <el-tab-pane label="归属记录" name="belong">
             <el-table v-loading="belongLoading" border :data="belongs" height="calc(100% - 42px)">
-              <el-table-column align="center" label="归属销售" prop="opnContent.saleName" show-overflow-tooltip/>
-              <el-table-column align="center" label="原来归属" prop="opnContent.origSaleName" show-overflow-tooltip/>
+              <el-table-column align="center" label="归属销售" prop="opnContent.saleName" show-overflow-tooltip />
+              <el-table-column align="center" label="原来归属" prop="opnContent.origSaleName" show-overflow-tooltip />
               <el-table-column align="center" label="操作方式" prop="opnType">
                 <template slot-scope="scope">
                   <el-tag v-if="scope.row.opnType == 30">转移</el-tag>
                 </template>
               </el-table-column>
-              <el-table-column align="center" label="操作人" prop="createdName" show-overflow-tooltip/>
-              <el-table-column align="center" label="操作时间" prop="opnDate" show-overflow-tooltip/>
-              <el-table-column align="center" label="备注" prop="remark" show-overflow-tooltip/>
+              <el-table-column align="center" label="操作人" prop="createdName" show-overflow-tooltip />
+              <el-table-column align="center" label="操作时间" prop="opnDate" show-overflow-tooltip />
+              <el-table-column align="center" label="备注" prop="remark" show-overflow-tooltip />
             </el-table>
           </el-tab-pane>
         </el-tabs>
@@ -193,21 +194,21 @@
           <!--          <el-button @click="handleDelete">删除</el-button>-->
           <el-button @click="back">返回</el-button>
         </div>
-        <details-records :dynamics-list="dynamicsList"/>
+        <details-records :dynamics-list="dynamicsList" />
       </div>
     </div>
     <!-- 编辑 -->
-    <edit ref="edit" @fetch-data="init"/>
+    <edit ref="edit" @fetch-data="init" />
     <!-- 添加跟进记录 -->
-    <follow-add ref="follow-add" @fetch-data="init"/>
+    <follow-add ref="follow-add" @fetch-data="init" />
     <!-- 转移 -->
-    <transfer ref="transfer" @fetch-data="init"/>
+    <transfer ref="transfer" @fetch-data="init" />
     <!-- 转储备项目 -->
-    <to-reserve ref="toReserve" @fetch-data="init"/>
+    <to-reserve ref="toReserve" @fetch-data="init" />
     <!-- 创建工单 -->
-    <work-order-edit ref="work-order-edit" :business-info="details"/>
+    <work-order-edit ref="work-order-edit" :business-info="details" />
     <!-- 合同 -->
-    <contract-edit ref="contract" :business-data="[details]"/>
+    <contract-edit ref="contract" :business-data="[details]" />
   </div>
 </template>
 
@@ -253,7 +254,7 @@
     data() {
       return {
         id: undefined,
-        details: {nboType: ''},
+        details: { nboType: '' },
         productData: [],
         abstract: {},
         activeName: 'details',
@@ -288,12 +289,11 @@
       this.id = parseInt(this.$route.query.id)
       this.init()
     },
-    mounted() {
-    },
+    mounted() {},
     methods: {
       init() {
         Promise.all([
-          businessApi.getEntityById({id: this.id}),
+          businessApi.getEntityById({ id: this.id }),
           this.getDicts('proj_nbo_type'),
           this.getDicts('proj_nbo_source'),
           this.getDicts('proj_sales_model'),
@@ -315,7 +315,7 @@
         })
       },
       async getRecord() {
-        const [err, res] = await to(businessApi.getBusinessDynamics({busId: this.id}))
+        const [err, res] = await to(businessApi.getBusinessDynamics({ busId: this.id }))
         if (err) return
         if (res.data.list) {
           let obj = res.data.list
@@ -327,7 +327,7 @@
 
           this.dynamicsList = records
           // console.log(this.dynamicsList)
-          await this.handleClick({name: this.activeName})
+          await this.handleClick({ name: this.activeName })
         }
       },
       async handleClick(tab) {
@@ -347,8 +347,8 @@
           // 获取项目转移记录
           this.belongLoading = true
           const {
-            data: {list, total},
-          } = await businessApi.getBusinessDynamicsList({busId: this.id, opnType: '30'})
+            data: { list, total },
+          } = await businessApi.getBusinessDynamicsList({ busId: this.id, opnType: '30' })
           this.belongs = list ? list : []
           this.belongTotal = total
           this.belongLoading = false
@@ -359,7 +359,7 @@
         }
       },
       async getProductData(busId) {
-        const {data} = await businessApi.getProductByBusinessId({id: busId})
+        const { data } = await businessApi.getProductByBusinessId({ id: busId })
         if (data) {
           this.productData = data
         }
@@ -393,7 +393,7 @@
       // 删除
       handleDelete() {
         this.$baseConfirm('你确定要删除当前项目吗', null, async () => {
-          const {msg} = await businessApi.doDelete({ids: [this.id]})
+          const { msg } = await businessApi.doDelete({ ids: [this.id] })
           this.$baseMessage(msg, 'success')
           this.back()
         })
@@ -729,7 +729,7 @@
             display: flex;
             justify-content: space-between;
 
-              span:first-child {
+            span:first-child {
               font-weight: bold;
               color: #333;
             }
@@ -765,8 +765,7 @@
     height: 190px;
   }
 
-  .height-enter, .height-leave-to /* .fade-leave-active below version 2.1.8 */
-  {
+  .height-enter, .height-leave-to /* .fade-leave-active below version 2.1.8 */ {
     height: 0;
   }