wuguojie пре 1 година
родитељ
комит
a1228e94c7

+ 17 - 4
src/api/modules/operation.ts

@@ -67,8 +67,9 @@ export interface AddBankCard {
 }
 // 启用/禁用
 export interface OperationIsEnable {
-  id: string[],
-  isEnable: number
+  ids: string[],
+  isEnable: number,
+  getAll: number
 }
 export interface OperationEdit extends AddOperation {
   id: string
@@ -78,12 +79,24 @@ const operationApi = (axiosInstance: ApiInstance) => ({
   addOperation: (data: AddOperation) => axiosInstance.post('/userInfo/add', data), // 新赠
   updateOperation: (data: any) => axiosInstance.post('/userInfo/update', data), //编辑
   operationList: (data: OperationSearch) => axiosInstance.post('/userInfo/getUserInfoList', data), // 列表
-  operationDelete: (data: string[]) => axiosInstance.post('/userInfo/delete', data), // 删除
+  operationDelete: (data: {
+    ids: string[],
+    getAll: number
+  }) => axiosInstance.post('/userInfo/delete', data), // 删除
   operationIsEnable: (data: OperationIsEnable) => axiosInstance.post('/userInfo/isEnable', data), // 启用/禁用
   operationDetail: (data: string | null | LocationQueryValue[] | undefined) => axiosInstance.get(`/userInfo/getUserInfo?id=${data}`), // 详情
-  operationEdit: (data: OperationEdit) => axiosInstance.post('/userInfo/update', data), // 编辑
+  setLeader: (data: {
+    ids: string[],
+    leaderId: string,
+    getAll: number
+  }) => axiosInstance.post('/userInfo/batchLeader', data), // 设置负责人
   getUser: (data: string) => axiosInstance.post('/userInfo/getUser', { deptId: data }), // 获取管理人/推荐人
   addBankCard: (data: AddBankCard) => axiosInstance.post('/userInfo/addBankCard', data), // 添加银行卡
+  salesmanAuthSuccess: (data: { userInfoId: string }) => axiosInstance.post('/userInfo/salesmanAuthSuccess', data), // 审核通过
+  salesmanAuthFailed: (data: {
+    userInfoId: string,
+    approvalOpinion: string
+  }) => axiosInstance.post('/userInfo/salesmanAuthFailed', data), // 审核不通过
 })
 
 export default operationApi

+ 19 - 1
src/views/operationManagement/modules/addOperation.vue

@@ -350,7 +350,9 @@
               </el-col>
               <el-col :span="10">
                 <el-form-item prop="bankName" label="开户行">
-                  <el-input v-model="operationForm.bankName" placeholder="请填写开户行"></el-input>
+                  <el-select v-model="operationForm.bankName" placeholder="请选择开户行">
+                    <el-option v-for="item in bankOption" :key="item.id" :value="item.id" :label="item.label"></el-option>
+                  </el-select>
                 </el-form-item>
               </el-col>
             </el-row>
@@ -959,10 +961,26 @@ const deptChange = (e) => {
   getUser(obj.deptId)
 }
 
+// 初始化银行数据
+let bankOption = ref([])
+const initBankCard = () => {
+  api.commonApi.personInfo('bank_info').then(res => {
+    if(res.code == 200) {
+      bankOption.value = res.data
+    } else {
+      ElMessage({
+        message: res.msg,
+        type: 'warning'
+      })
+    }
+  })
+}
+
 onMounted(() => {
   initInfo()
   getArea()
   getTeamList()
+  initBankCard()
 })
 
 defineExpose({

+ 105 - 72
src/views/operationManagement/modules/allocation.vue

@@ -1,108 +1,141 @@
 <template>
   <div class="allocation">
-    <el-input v-model="searchValue" style="width: 240px" placeholder="输入姓名、手机号、工号查找">
+    <el-input v-model="searchValue" style="width: 240px" placeholder="输入姓名、手机号、工号查找" clearable>
       <template #prefix>
         <el-icon class="el-input__icon" @click="handleSearch"><Search /></el-icon>
       </template>
     </el-input>
     <el-row :gutter="20" class="allocation-content">
-      <el-col :span="12" style="padding: 10px">
+      <el-col :span="12" style="padding: 10px; box-sizing: border-box;">
         <el-tree
-          :data="data"
+          :data="options"
+          :props="cascaderProps"
+          node-key="id"
+          :default-expanded-keys="expandedKeys"
+          :default-checked-keys="checkedKeys"
           @node-click="handleNodeClick"
         />
       </el-col>
-      <el-col :span="12" style="padding: 10px">
+      <el-col :span="12" style="padding: 10px; box-sizing: border-box;border-left: 1px solid #ccc;">
         <el-radio-group v-model="radioValue" class="allocation-radio">
-          <el-radio value="1" size="large">
+          <el-radio v-for="item in userList" :value="item.id" size="large">
             <template #default>
-              <div>姓名1</div>
-              <div>99140109M60D01001</div>
-            </template>
-          </el-radio>
-          <el-radio value="1" size="large">
-            <template #default>
-              <div>姓名2</div>
-              <div>99140109M60D01001</div>
+              <div>{{ item.name }}</div>
+              <div>{{ item.id }}</div>
             </template>
           </el-radio>
         </el-radio-group>
       </el-col>
     </el-row>
+    <div style="display: flex; justify-content: flex-end">
+      <el-button @click="onSubmit('取消')">取消</el-button>
+      <el-button type="primary" @click="onSubmit('确定')">确定</el-button>
+    </div>
   </div>
 </template>
 
 <script setup lang="ts">
-import { ref } from 'vue'
+import { ref, onMounted, defineEmits } from 'vue'
+import api from '@/api'
+import { ElMessage } from 'element-plus'
+
+const cascaderProps = {
+  value: 'id',
+  label: 'name',
+  children: 'children'
+}
+
+let emits = defineEmits(['closeDialog'])
+
+// 初始化负责人
+let userList = ref([])
+const initUser = (id) => {
+  api.operationApi.getUser(id).then(res => {
+    if(res.code == 200) {
+      userList.value = res.data
+    } else {
+      ElMessage({
+        message: res.msg,
+        type: 'warning'
+      })
+    }
+  })
+}
+
+// 初始化默认选中的数据
+let checkedKeys = ref([])
+let selectedIds = ref([])
+const initCheckedKeys = (id, type, ids) => {
+  checkedKeys.value = [id]
+  selectedIds.value = [...ids]
+  initUser(id)
+}
 
 let searchValue = ref('')
 const handleSearch = () => {
 
 }
-
-let data = [
-  {
-    label: 'Level one 1',
-    children: [
-      {
-        label: 'Level two 1-1',
-        children: [
-          {
-            label: 'Level three 1-1-1',
-          },
-        ],
-      },
-    ],
-  },
-  {
-    label: 'Level one 2',
-    children: [
-      {
-        label: 'Level two 2-1',
-        children: [
-          {
-            label: 'Level three 2-1-1',
-          },
-        ],
-      },
-      {
-        label: 'Level two 2-2',
-        children: [
-          {
-            label: 'Level three 2-2-1',
-          },
-        ],
-      },
-    ],
-  },
-  {
-    label: 'Level one 3',
-    children: [
-      {
-        label: 'Level two 3-1',
-        children: [
-          {
-            label: 'Level three 3-1-1',
-          },
-        ],
-      },
-      {
-        label: 'Level two 3-2',
-        children: [
-          {
-            label: 'Level three 3-2-1',
-          },
-        ],
-      },
-    ],
-  },
-]
+// 机构数据
+let options = ref([])
+// 默认展开
+let expandedKeys = ref([])
+// 获取机构数据
+const institutionList = () => {
+  api.institutionApi.institutionList({ name: '', system: '' }).then(res => {
+    if(res?.code == 200) {
+      options.value = res.data
+      if(options.value) {
+        let list = []
+        options.value.forEach(item => {
+          list.push(item.id)
+        })
+        expandedKeys.value = [...list]
+      }
+    } else {
+      ElMessage({
+        message: res.msg,
+        type: 'warning'
+      })
+    }
+  })
+}
 const handleNodeClick = (data) => {
   console.log(data)
 }
 
 let radioValue = ref('')
 
+const onSubmit = (type) => {
+  if(type == '确定') {
+    api.operationApi.setLeader({
+      ids: selectedIds.value,
+      leaderId: radioValue.value,
+      getAll: 0
+    }).then(res => {
+      if(res.code == 200) {
+        ElMessage({
+          message: res.msg,
+          type: 'success'
+        })
+      } else {
+        ElMessage({
+          message: res.msg,
+          type: 'warning'
+        })
+      }
+    })
+  }
+  emits('closeDialog', false)
+}
+
+onMounted(() => {
+  institutionList()
+})
+
+defineExpose({
+  initCheckedKeys
+})
+
 </script>
 
 <style scoped lang="scss">

+ 45 - 7
src/views/operationManagement/operation.vue

@@ -172,7 +172,7 @@
       title="分配管理人"
       width="800"
     >
-      <allocation></allocation>
+      <allocation ref="AllocationRef" @closeDialog="closeAllocation"></allocation>
     </el-dialog>
   </div>
 </template>
@@ -183,6 +183,7 @@ import { useRouter } from 'vue-router'
 import addOperation from './modules/addOperation.vue'
 import addCard from './modules/addCard.vue'
 import allocation from './modules/allocation.vue'
+import setDept from "@/components/DialogSetDeptLeader/index.vue"
 import type { OperationSearch, OperationIsEnable } from '@/api/modules/operation.ts'
 import api from "@/api";
 import { ElMessageBox, ElMessage, TableInstance } from 'element-plus'
@@ -193,6 +194,7 @@ let myRouter = useRouter()
 
 const operationListRef = ref<TableInstance>()
 const AddOperationRef = ref(null)
+const AllocationRef = ref(null)
 
 interface TableDataProps {
   name: string,
@@ -262,7 +264,10 @@ const init = () => {
 }
 // 删除
 const operationDel = (id: string[]) => {
-  api.operationApi.operationDelete({ id: id }).then(res => {
+  api.operationApi.operationDelete({
+    ids:id,
+    getAll: selectType.value == 'all'?1:0
+  }).then(res => {
     if(res?.code == 200) {
       ElMessage({
         message: res.msg,
@@ -374,6 +379,14 @@ const dropdownCommand = (e) => {
             selectedList.value.forEach(item => {
               ids.push(item.id)
             })
+          } else {
+            if(selectType == 'cur') {
+              ElMessage({
+                message: '请选择需要操作的数据',
+                type: 'warning'
+              })
+              return
+            }
           }
           operationDel(ids)
         }
@@ -396,10 +409,19 @@ const dropdownCommand = (e) => {
             selectedList.value.forEach(item => {
               ids.push(item.id)
             })
+          } else {
+            if(selectType == 'cur') {
+              ElMessage({
+                message: '请选择需要操作的数据',
+                type: 'warning'
+              })
+              return
+            }
           }
           let data = {
             ids: ids,
-            isEnable: 1
+            isEnable: 1,
+            getAll: selectType.value == 'all'?1:0
           }
           operationIsEnable(data)
         }
@@ -422,10 +444,19 @@ const dropdownCommand = (e) => {
             selectedList.value.forEach(item => {
               ids.push(item.id)
             })
+          } else {
+            if(selectType == 'cur') {
+              ElMessage({
+                message: '请选择需要操作的数据',
+                type: 'warning'
+              })
+              return
+            }
           }
           let data = {
             ids: ids,
-            isEnable: 0
+            isEnable: 0,
+            getAll: selectType.value == 'all'?1:0
           }
           operationIsEnable(data)
         }
@@ -515,7 +546,8 @@ const tableDataCommand = (scope, e) => {
         if(action === 'confirm') {
           let data = {
             ids: [scope.row.id],
-            isEnable: 1
+            isEnable: 1,
+            getAll: selectType.value == 'all'?1:0
           }
           operationIsEnable(data)
         }
@@ -551,7 +583,8 @@ const tableDataCommand = (scope, e) => {
         if(action === 'confirm'){
           let data = {
             ids: [scope.row.id],
-            isEnable: 0
+            isEnable: 0,
+            getAll: selectType.value == 'all'?1:0
           }
           operationIsEnable(data)
         }
@@ -564,11 +597,13 @@ const tableDataCommand = (scope, e) => {
         userJzgInfoId: scope.row.id,
         name: scope.row.name,
       }
-      console.log(456, addName.value)
       bankCardDialogShow.value = true
       break;
     case '分配管理人':
       allocationShow.value = true
+      nextTick(() => {
+        AllocationRef.value.initCheckedKeys(scope.row.deptId, selectType.value, [scope.row.id])
+      })
       break;
   }
 }
@@ -595,6 +630,9 @@ let title = ref('添加')
 
 // 分配管理人
 let allocationShow = ref(false)
+const closeAllocation = (type: boolean) => {
+  allocationShow.value = type
+}
 
 onMounted(() => {
   init()

+ 66 - 14
src/views/operationManagement/operationDetail.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="detail">
-    <div class="state" v-if="dataDetail?.status == 4">
+    <div class="state" v-if="dataDetail?.status == 5">
       <el-icon :size="20" style="color: red; margin: 3px 10px 0 0;">
         <CircleClose />
       </el-icon>
@@ -15,7 +15,7 @@
         <template #title>
           <el-row :gutter="20" flex justify="space-between">
             <el-col :span="12" style="display: flex; align-items: center;">
-              <span class="firstName">{{ dataDetail?.name }}</span>
+              <span class="firstName">{{ initName(dataDetail?.name) }}</span>
               <span class="allName">{{ dataDetail?.name }}</span>
             </el-col>
             <el-col :span="12" style="display: flex; justify-content: flex-end">
@@ -79,7 +79,11 @@
                         {{ scope.row.auditStatus == '0'?'未审核':scope.row.auditStatus == '1'?'审核通过':scope.row.auditStatus == '2'?'审核驳回':''}}
                       </template>
                     </el-table-column>
-                    <el-table-column prop="" label="身份证件照"></el-table-column>
+                    <el-table-column prop="" label="身份证件照">
+                      <template #default="scope">
+                        <img class="cardImage" :src="dataDetail?.fileList?.[0].fileUrl">
+                      </template>
+                    </el-table-column>
                     <el-table-column prop="cardFile" label="银行卡照">
                       <template #default="scope">
                         <img class="cardImage" :src="scope.row.cardFile">
@@ -142,7 +146,7 @@
       title="编辑"
       width="1000"
     >
-      <addOperation></addOperation>
+      <addOperation ref="AddOperationRef" @closeDialog="closeAddOperation"></addOperation>
     </el-dialog>
     <el-dialog
       v-model="allocationShow"
@@ -155,10 +159,11 @@
 </template>
 
 <script setup lang="ts">
-import { ref } from 'vue'
+import {nextTick, ref} from 'vue'
 import addOperation from './modules/addOperation.vue'
 import addCard from './modules/addCard.vue'
 import allocation from './modules/allocation.vue'
+import pinyin from "js-pinyin";
 import { ElMessage, ElMessageBox } from 'element-plus'
 import Allocation from "@/views/operationManagement/modules/allocation.vue";
 import { useRoute, useRouter } from 'vue-router'
@@ -166,6 +171,8 @@ import api from '@/api'
 import {OperationIsEnable} from "@/api/modules/operation.ts";
 import router from "@/router";
 
+let AddOperationRef = ref(null)
+
 let myRouter = useRouter()
 const myRoute = useRoute()
 
@@ -201,7 +208,8 @@ const handleCommand = (e) => {
         if(action === 'confirm') {
           let data = {
             ids: [myRoute.query.id],
-            isEnable: 1
+            isEnable: 1,
+            getAll: 0
           }
           operationIsEnable(data)
         }
@@ -221,7 +229,8 @@ const handleCommand = (e) => {
         if(action === 'confirm'){
           let data = {
             ids: [myRoute.query.id],
-            isEnable: 0
+            isEnable: 0,
+            getAll: 0
           }
           operationIsEnable(data)
         }
@@ -282,14 +291,17 @@ const closeAddBankCard = (type: string) => {
 
 // 删除
 const operationDel = (id: string[]) => {
-  api.operationApi.operationDelete({ id: id }).then(res => {
+  api.operationApi.operationDelete({
+    ids: id,
+    getAll: 0
+  }).then(res => {
     if(res?.code == 200) {
       ElMessage({
         message: res.msg,
         type: 'success'
       })
       myRouter.push({
-        path: '/operation',
+        path: 'operationManagement/operation',
       })
     } else {
       ElMessage({
@@ -319,9 +331,18 @@ const operationIsEnable = (data: OperationIsEnable) => {
 
 // 审核通过
 const checkPass = () => {
-  ElMessage({
-    message: '审核通过!',
-    type: 'success',
+  api.operationApi.salesmanAuthSuccess({ userInfoId: dataDetail.value.id }).then(res => {
+    if(res.code == 200) {
+      ElMessage({
+        message: res.msg,
+        type: 'success',
+      })
+    } else {
+      ElMessage({
+        message: res.msg,
+        type: 'warning',
+      })
+    }
   })
 }
 // 审核不通过
@@ -334,8 +355,25 @@ const checkNotPass = () => {
     showCancelButton: true,
     confirmButtonText: '确定',
     cancelButtonText: '取消',
-  }).then(( action ) => {
-
+  }).then(({ value, action } ) => {
+    if(action == 'confirm') {
+      api.operationApi.salesmanAuthFailed({
+        userInfoId: dataDetail.value.id,
+        approvalOpinion: value
+      }).then(res => {
+        if(res.code == 200) {
+          ElMessage({
+            message: res.msg,
+            type: 'success',
+          })
+        } else {
+          ElMessage({
+            message: res.msg,
+            type: 'warning',
+          })
+        }
+      })
+    }
   }).catch(( action ) => {
 
   })
@@ -345,6 +383,15 @@ const checkNotPass = () => {
 let dialogShow = ref(false)
 const editDetail = () => {
   dialogShow.value = true
+  nextTick(() => {
+    AddOperationRef.value.initEditData(dataDetail.value.id)
+  })
+}
+const closeAddOperation = (text: string) => {
+  if(text == '确定') {
+    initDetail()
+  }
+  dialogShow.value = false
 }
 
 // 详情
@@ -385,6 +432,11 @@ const bankCardChange = (list, code) => {
   }
 }
 
+// 名字转换首字母
+const initName = (name) => {
+  return name?pinyin.getFullChars(name).substring(0, 1):''
+}
+
 onMounted(() => {
   initDetail()
   initBankCard()