Forráskód Böngészése

feature(管理员转移):管理员转移客户、项目、渠道

ZZH-wl 2 éve
szülő
commit
6819b72efe

+ 4 - 0
src/api/base/distr.js

@@ -93,4 +93,8 @@ export default {
   delProxyIndex(query) {
     return micro_request.postRequest(basePath, 'DistributorTarget', 'Delete', query)
   },
+  // 系统管理员转移经销商代理商
+  sysAdminTransferDistributor(query) {
+    return micro_request.postRequest(basePath, 'Distributor', 'SysAdminTransferDistributor', query)
+  },
 }

+ 4 - 0
src/api/customer/index.js

@@ -74,6 +74,10 @@ export default {
   updateBytransfer(query) {
     return micro_request.postRequest(basePath, 'Customer', 'TransCustomer', query)
   },
+  // 管理员转移客户
+  sysAdminTransCustomer(query) {
+    return micro_request.postRequest(basePath, 'Customer', 'SysAdminTransCustomer', query)
+  },
   // 省份
   getProvinceInfo(query) {
     return micro_request.postRequest(basePath, 'District', 'GetProvinceList', query)

+ 4 - 0
src/api/proj/business.js

@@ -33,6 +33,10 @@ export default {
   businessTransfer(query) {
     return micro_request.postRequest(basePath, 'Business', 'BusinessTransfer', query)
   },
+  // 系统管理员项目转移
+  sysAdminBusinessTransfer(query) {
+    return micro_request.postRequest(basePath, 'Business', 'SysAdminBusinessTransfer', query)
+  },
   // 转为储备项目
   businessConvertToReserve(query) {
     return micro_request.postRequest(basePath, 'Business', 'ConvertToReserve', query)

+ 15 - 7
src/components/select/SelectBusinessContact.vue

@@ -36,6 +36,9 @@
           <span v-else-if="item.prop === 'cuctGender'">
             {{ selectDictLabel(sexOptions, row.cuctGender) }}
           </span>
+          <span v-else-if="item.prop === 'contactType'">
+            {{ row.contactType === '10' ? '客户' : '渠道' }}
+          </span>
           <span v-else>{{ row[item.prop] }}</span>
         </template>
       </el-table-column>
@@ -103,6 +106,11 @@
             // sortable: true,
             disableCheck: true,
           },
+          {
+            label: '类型',
+            width: '50px',
+            prop: 'contactType',
+          },
           {
             label: '客户名称',
             width: 'auto',
@@ -110,32 +118,32 @@
           },
           {
             label: '手机号码',
-            width: 'auto',
+            width: '110px',
             prop: 'telephone',
           },
           {
             label: '微信',
-            width: 'auto',
+            width: '110px',
             prop: 'wechat',
           },
           {
             label: '邮箱',
-            width: 'auto',
+            width: '110px',
             prop: 'email',
           },
           {
             label: '职务',
-            width: 'auto',
+            width: '80px',
             prop: 'postion',
           },
           {
-            label: '关键决策',
-            width: 'auto',
+            label: '关键决策',
+            width: '80px',
             prop: 'isDecision',
           },
           {
             label: '性别',
-            width: 'auto',
+            width: '60px',
             prop: 'cuctGender',
             // sortable: true,
           },

+ 20 - 1
src/views/base/agent/index.vue

@@ -61,6 +61,13 @@
           <el-button v-permissions="['base:agent:add']" icon="el-icon-plus" type="primary" @click="handleEdit($event)">
             新建
           </el-button>
+          <el-button
+            v-permissions="['base:distributor:sysadmin_transfer']"
+            icon="el-icon-refresh"
+            type="primary"
+            @click="handleSysAdminTransfer">
+            管理员转移
+          </el-button>
         </vab-query-form-left-panel>
         <vab-query-form-right-panel>
           <table-tool :columns="columns" :show-columns.sync="showColumns" table-type="agentTable" />
@@ -73,6 +80,8 @@
           :data="list"
           :height="$baseTableHeight(2)"
           @selection-change="setSelectRows">
+          <el-table-column align="center" show-overflow-tooltip type="selection" />
+
           <el-table-column
             v-for="(item, index) in showColumns"
             :key="index"
@@ -137,6 +146,8 @@
     </div>
     <edit ref="edit" @fetch-data="fetchData" />
     <change-agent ref="changeAgent" @fetch-data="fetchData" />
+    <!-- 转移 -->
+    <transfer ref="transfer" @fetch-data="fetchData" />
   </div>
 </template>
 
@@ -148,10 +159,11 @@
   import Edit from './components/AgentEdit'
   import TableTool from '@/components/table/TableTool'
   import ChangeAgent from '@/views/base/distributor/components/ChangeAgent'
+  import Transfer from '@/views/base/distributor/components/Transfer.vue'
 
   export default {
     name: 'Distributor',
-    components: { Edit, TableTool, ChangeAgent },
+    components: { Transfer, Edit, TableTool, ChangeAgent },
     data() {
       return {
         tableKey: 0,
@@ -395,6 +407,13 @@
           },
         })
       },
+      handleSysAdminTransfer() {
+        if (this.selectRows.length === 0) {
+          this.$baseMessage('请选择代理商', 'warning')
+          return
+        }
+        this.$refs['transfer'].sysAdminOpen(this.selectRows)
+      },
     },
   }
 </script>

+ 2 - 2
src/views/base/components/EditContact.vue

@@ -126,7 +126,7 @@
       async contactSave() {
         this.$refs.contactForm.validate(async (valid) => {
           if (valid) {
-            if (!this.contactForm.wechat && !this.contactForm.telephone) {
+            if (!this.contactForm.wechat && !this.contactForm.phone) {
               this.$message.warning('电话和微信二者必须填写其一。')
               return
             }
@@ -146,7 +146,7 @@
       async contactEdit() {
         this.$refs.contactForm.validate(async (valid) => {
           if (valid) {
-            if (!this.contactForm.wechat && !this.contactForm.telephone) {
+            if (!this.contactForm.wechat && !this.contactForm.phone) {
               this.$message.warning('电话和微信二者必须填写其一。')
               return
             }

+ 2 - 3
src/views/base/distributor/components/EditContact.vue

@@ -123,13 +123,12 @@
         this.contactVisible = true
         console.log(this.contactForm, 'this.contactForm--------------------')
         console.log(this.distId, 'this.distId--------------------')
-
       },
       // 联系人新建
       async contactSave() {
         this.$refs.contactForm.validate(async (valid) => {
           if (valid) {
-            if (!this.contactForm.wechat && !this.contactForm.telephone) {
+            if (!this.contactForm.wechat && !this.contactForm.phone) {
               this.$message.warning('电话和微信二者必须填写其一。')
               return
             }
@@ -149,7 +148,7 @@
       async contactEdit() {
         this.$refs.contactForm.validate(async (valid) => {
           if (valid) {
-            if (!this.contactForm.wechat && !this.contactForm.telephone) {
+            if (!this.contactForm.wechat && !this.contactForm.phone) {
               this.$message.warning('电话和微信二者必须填写其一。')
               return
             }

+ 107 - 0
src/views/base/distributor/components/Transfer.vue

@@ -0,0 +1,107 @@
+<template>
+  <el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
+    <el-form ref="form" label-width="80px" :model="form" :rules="rules">
+      <el-form-item label="接收对象" prop="userName">
+        <el-input
+          v-model="form.userName"
+          placeholder="选择人员"
+          readonly
+          suffix-icon="el-icon-search"
+          @focus="handleSelectUser" />
+      </el-form-item>
+      <el-form-item label="转移原因" prop="remark">
+        <el-input
+          v-model="form.remark"
+          maxlength="300"
+          placeholder="请输入转移原因"
+          rows="5"
+          show-word-limit
+          type="textarea" />
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <el-button @click="close">取 消</el-button>
+      <el-button :loading="loading" type="primary" @click="save">确 定</el-button>
+    </template>
+    <!-- 选择负责人弹窗 -->
+    <select-user
+      ref="selectUser"
+      :query-params="{ roles: ['SalesEngineer', 'ProductLineManager'] }"
+      @save="selectUser" />
+  </el-dialog>
+</template>
+
+<script>
+  import to from 'await-to-js'
+  import distrApi from '@/api/base/distr'
+  import SelectUser from '@/components/select/SelectUser'
+
+  export default {
+    name: 'Transfer',
+    components: { SelectUser },
+    data() {
+      return {
+        title: '转移项目',
+        dialogFormVisible: false,
+        loading: false,
+        sysAdminFlag: false,
+        form: {
+          id: undefined,
+          ids: undefined,
+          userId: undefined,
+          userName: undefined,
+          remark: undefined,
+        },
+        rules: {
+          userName: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
+          remark: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
+        },
+      }
+    },
+    methods: {
+      handleSelectUser() {
+        this.$refs.selectUser.open()
+      },
+      selectUser(val) {
+        if (val && val.length > 0) {
+          this.form.userId = val[0].id
+        }
+        this.form.userName = val.map((item) => item.nickName).join()
+      },
+      open(row) {
+        this.form.id = row.id
+        this.dialogFormVisible = true
+        this.loading = false
+        this.sysAdminFlag = false
+      },
+      sysAdminOpen(rows) {
+        this.form.ids = rows.map((item) => parseInt(item.id))
+        this.dialogFormVisible = true
+        this.loading = false
+        this.sysAdminFlag = true
+      },
+      close() {
+        this.$refs['form'].resetFields()
+        this.form = this.$options.data().form
+        this.dialogFormVisible = false
+        this.loading = false
+      },
+      save() {
+        this.$refs['form'].validate(async (valid) => {
+          if (valid) {
+            this.loading = true
+            let [err, res] = await to(distrApi.sysAdminTransferDistributor(this.form))
+            if (err) {
+              this.$baseMessage(res.msg, 'error')
+            } else {
+              this.$baseMessage(res.msg, 'success')
+            }
+            this.loading = false
+            this.$emit('fetch-data')
+            this.close()
+          }
+        })
+      },
+    },
+  }
+</script>

+ 20 - 1
src/views/base/distributor/index.vue

@@ -65,6 +65,13 @@
             @click="handleEdit($event)">
             新建
           </el-button>
+          <el-button
+            v-permissions="['base:distributor:sysadmin_transfer']"
+            icon="el-icon-refresh"
+            type="primary"
+            @click="handleSysAdminTransfer">
+            管理员转移
+          </el-button>
         </vab-query-form-left-panel>
         <vab-query-form-right-panel>
           <table-tool :columns="columns" :show-columns.sync="showColumns" table-type="distributorTable" />
@@ -77,6 +84,8 @@
           :data="list"
           :height="$baseTableHeight(2)"
           @selection-change="setSelectRows">
+          <el-table-column align="center" show-overflow-tooltip type="selection" />
+
           <el-table-column
             v-for="(item, index) in showColumns"
             :key="index"
@@ -137,6 +146,8 @@
     </div>
     <edit ref="edit" @fetch-data="fetchData" />
     <change-agent ref="changeAgent" @fetch-data="fetchData" />
+    <!-- 转移 -->
+    <transfer ref="transfer" @fetch-data="fetchData" />
   </div>
 </template>
 
@@ -148,10 +159,11 @@
 
   import Edit from './components/DistrEdit'
   import TableTool from '@/components/table/TableTool'
+  import Transfer from './components/Transfer'
 
   export default {
     name: 'Distributor',
-    components: { Edit, TableTool, ChangeAgent },
+    components: { Transfer, Edit, TableTool, ChangeAgent },
     data() {
       return {
         tableKey: 0,
@@ -371,6 +383,13 @@
           },
         })
       },
+      handleSysAdminTransfer() {
+        if (this.selectRows.length === 0) {
+          this.$baseMessage('请选择经销商', 'warning')
+          return
+        }
+        this.$refs['transfer'].sysAdminOpen(this.selectRows)
+      },
     },
   }
 </script>

+ 19 - 1
src/views/customer/components/Shift.vue

@@ -54,6 +54,7 @@
           remark: [{ required: true, message: '请选择转移原因', trigger: 'change' }],
         },
         userList: [],
+        sysAdminFlag: false,
       }
     },
     methods: {
@@ -69,11 +70,28 @@
         this.userList = userList
         this.form.salesName = userList[0].nickName
       },
+      open(rows) {
+        this.form.Ids = rows.map((item) => parseInt(item.id))
+        this.visible = true
+        this.sysAdminFlag = false
+      },
+      sysAdminOpen(rows) {
+        this.form.ids = rows.map((item) => parseInt(item.id))
+        this.visible = true
+        this.sysAdminFlag = true
+      },
       async handleSubmit() {
         if (!this.userList.length) return this.$message.warning('请选择销售代表')
         let params = { ...this.form }
         params.SalesId = this.userList[0].id
-        const [err, res] = await to(api.updateBytransfer(params))
+
+        let [err, res] = []
+        if (this.sysAdminFlag) {
+          ;[err, res] = await to(api.sysAdminTransCustomer(params))
+        } else {
+          ;[err, res] = await to(api.updateBytransfer(params))
+        }
+
         if (err) return
         this.$message.success(res.msg)
         this.visible = false

+ 15 - 2
src/views/customer/list.vue

@@ -108,6 +108,13 @@
           @click="handleMerge">
           合并客户
         </el-button>
+        <el-button
+          v-permissions="['cust:list:sysadmin_transfer']"
+          icon="el-icon-refresh"
+          type="primary"
+          @click="handleSysAdminTransfer">
+          管理员转移客户
+        </el-button>
       </vab-query-form-left-panel>
       <vab-query-form-right-panel :span="12">
         <!--        <el-button icon="el-icon-download" @click="exportData" />-->
@@ -458,8 +465,7 @@
       // 转移客户
       handleShift() {
         if (!this.selectRows.length) return this.$message.warning('请选择需要转移的客户')
-        this.$refs.shift.form.Ids = this.selectRows.map((item) => item.id)
-        this.$refs.shift.visible = true
+        this.$refs['shift'].open(this.selectRows)
       },
       // 移入公海
       handleToOpen() {
@@ -474,6 +480,13 @@
         if (err) return
         this.$refs.merge.init(res, ids)
       },
+      handleSysAdminTransfer() {
+        if (this.selectRows.length === 0) {
+          this.$baseMessage('请选择客户', 'warning')
+          return
+        }
+        this.$refs['shift'].sysAdminOpen(this.selectRows)
+      },
     },
   }
 </script>

+ 15 - 1
src/views/proj/business/components/Transfer.vue

@@ -44,8 +44,10 @@
         title: '转移项目',
         dialogFormVisible: false,
         loading: false,
+        sysAdminFlag: false,
         form: {
           id: undefined,
+          ids: undefined,
           userId: undefined,
           userName: undefined,
           remark: undefined,
@@ -70,6 +72,13 @@
         this.form.id = row.id
         this.dialogFormVisible = true
         this.loading = false
+        this.sysAdminFlag = false
+      },
+      sysAdminOpen(rows) {
+        this.form.ids = rows.map((item) => parseInt(item.id))
+        this.dialogFormVisible = true
+        this.loading = false
+        this.sysAdminFlag = true
       },
       close() {
         this.$refs['form'].resetFields()
@@ -81,7 +90,12 @@
         this.$refs['form'].validate(async (valid) => {
           if (valid) {
             this.loading = true
-            const [err, res] = await to(businessApi.businessTransfer(this.form))
+            let [err, res] = []
+            if (this.sysAdminFlag) {
+              ;[err, res] = await to(businessApi.sysAdminBusinessTransfer(this.form))
+            } else {
+              ;[err, res] = await to(businessApi.businessTransfer(this.form))
+            }
             if (err) {
               this.$baseMessage(res.msg, 'error')
             } else {

+ 14 - 0
src/views/proj/business/index.vue

@@ -81,6 +81,13 @@
               @click="handleTransfer">
               转移项目
             </el-button>
+            <el-button
+              v-permissions="['proj:business:sysadmin_transfer']"
+              icon="el-icon-refresh"
+              type="primary"
+              @click="handleSysAdminTransfer">
+              管理员转移项目
+            </el-button>
           </el-form-item>
         </el-form>
       </vab-query-form-top-panel>
@@ -525,6 +532,13 @@
         }
         this.$refs['transfer'].open(this.selectRows[0])
       },
+      handleSysAdminTransfer() {
+        if (this.selectRows.length === 0) {
+          this.$baseMessage('请选择项目', 'warning')
+          return
+        }
+        this.$refs['transfer'].sysAdminOpen(this.selectRows)
+      },
       // 跳转详情
       handleDetail(row) {
         this.queryForm.activeName = this.activeName