Pārlūkot izejas kodu

fix:对接团队接口

wuguojie 1 gadu atpakaļ
vecāks
revīzija
08c2fe1f21

+ 1 - 1
src/api/modules/operation.ts

@@ -90,7 +90,7 @@ const operationApi = (axiosInstance: ApiInstance) => ({
     leaderId: string,
     getAll: number
   }) => axiosInstance.post('/userInfo/batchLeader', data), // 设置负责人
-  getUser: (data: string) => axiosInstance.post('/userInfo/getUser', { deptId: data }), // 获取管理人/推荐人
+  getUser: () => axiosInstance.post('/userInfo/getUser', { typeAttr: 2 }), // 获取管理人/推荐人
   addBankCard: (data: AddBankCard) => axiosInstance.post('/userInfo/addBankCard', data), // 添加银行卡
   salesmanAuthSuccess: (data: { userInfoId: string }) => axiosInstance.post('/userInfo/salesmanAuthSuccess', data), // 审核通过
   salesmanAuthFailed: (data: {

+ 29 - 1
src/api/modules/team.ts

@@ -9,10 +9,38 @@ export interface AddTeamProps {
   describeInformation?: string
 }
 
+interface SearchTeamProps {
+  attribute: number, // 1 团队 2 渠道 3 电销
+  param?: string,
+}
+
+export interface EditTeamProps extends AddTeamProps {
+  id:string
+}
+
+interface GetTeamUserProps {
+  id: string,
+  [key: string]: any
+}
+interface DeleteAssociatedUsers {
+  id: string,
+  userIds: string[]
+}
+
+interface SetResponsiblePersonProps {
+  id: string,
+  managerId: string
+}
+
 const teamApi = (axiosInstance: ApiInstance) => ({
-  teamList: (data: any) => axiosInstance.post('/sysOrganization/leftList', data), // 查询(不分页)
+  teamList: (data: SearchTeamProps) => axiosInstance.post('/sysOrganization/leftList', data), // 查询(不分页)
   addTeam: (data: AddTeamProps) => axiosInstance.post('/sysOrganization/save', data), // 新增
   queryPageList: (data: any) => axiosInstance.post('/sysOrganization/queryPageList', data), // 查询(分页)
+  deleteById: (data: string) => axiosInstance.get(`/sysOrganization/deleteById?id=${data}`, ), // 删除团队
+  updateTeam: (data: EditTeamProps) => axiosInstance.post('/sysOrganization/update', data), // 编辑团队
+  getTeamUser: (data: GetTeamUserProps) => axiosInstance.post('/sysOrganization/getTeamUserPage', data), // 获取团队成员
+  deleteAssociatedUsers: (data: DeleteAssociatedUsers) => axiosInstance.post('/sysOrganization/deleteAssociatedUsers', data), // 删除人员
+  setResponsiblePerson: (data: SetResponsiblePersonProps) => axiosInstance.post('/sysOrganization/setResponsiblePerson', data), // 设置负责人
 })
 
 export default teamApi

+ 1 - 2
src/router/modules/operation.ts

@@ -18,8 +18,7 @@ const routes: RouteRecordRaw = {
       component: () => import('@/views/operationManagement/operationDetail.vue'),
       meta: {
         title: '业务员详情',
-        sidebar: false,
-        menu:false,
+        menu: false,
       },
     },
     {

+ 223 - 42
src/views/operationManagement/channel.vue

@@ -3,8 +3,8 @@
     <el-row :gutter="20" style="width: 100%; overflow:hidden;">
       <el-col :span="4">
         <div class="teamTree">
-          <el-input class="search-input" v-model="treeValue" placeholder="渠道名称查找" prefix-icon="Search"></el-input>
-          <div class="custom-tree-node" v-for="item in teamData" :key="item.id">
+          <el-input class="search-input" v-model="treeValue" placeholder="团队名称查找" prefix-icon="Search" @keyup.enter="initTeam"></el-input>
+          <div class="custom-tree-node" v-for="item in teamData" :key="item.id" @click.stop="initList(item)">
             <span class="custom-tree-node-label">{{ item.name }}</span>
             <el-dropdown class="custom-tree-node-more" @command="treeNodeCommend(item, $event)">
               <el-icon><MoreFilled /></el-icon>
@@ -17,21 +17,21 @@
             </el-dropdown>
           </div>
         </div>
-        <el-button class="add-btn" icon="plus" @click="addTeamShow = true">添加渠道</el-button>
+        <el-button class="add-btn" icon="plus" @click="addTeamShow = true">添加团队</el-button>
       </el-col>
       <el-col :span="20">
         <el-row :gutter="20">
           <el-col :span="22" class="info">
-            <h3>渠道名称</h3>
-            <p>所属机构: 机构名称</p>
-            <p>管理人: 管理人姓名-管理人工号</p>
-            <p>描述:</p>
+            <h3>{{ teamInfo.name }}</h3>
+            <p>所属机构: {{ teamInfo?.deptName }}</p>
+            <p>管理人: {{ teamInfo?.managerName?`${teamInfo?.managerName}-`:'' }}{{ teamInfo?.managerId }}</p>
+            <p>描述:{{ teamInfo?.describeInformation }}</p>
           </el-col>
           <el-col :span="2" class="btn">
             <el-button plain @click="setPeople">设置负责人</el-button>
           </el-col>
         </el-row>
-        <el-input style="width: 300px; margin: 10px 0" v-model="searchValue" prefix-icon="Search" placeholder="输入姓名,手机号,工号查找" ></el-input>
+        <el-input style="width: 300px; margin: 10px 0" v-model="searchValue" prefix-icon="Search" placeholder="输入姓名,手机号,工号查找" clearable @keyup.enter="initList(teamInfo)"></el-input>
         <el-table
           :data="tableData"
           ref="operationListRef"
@@ -39,18 +39,30 @@
           @selection-change="handleSelectionChange"
         >
           <el-table-column type="selection" width="55"></el-table-column>
-          <el-table-column label="姓名" prop="name" width="80"></el-table-column>
+          <el-table-column label="姓名" prop="name" width="80">
+            <template #default="scope">
+              <div class="nameInfo">{{ scope.row.name }}<span v-show="scope.row.manager === '1'">负责人</span></div>
+            </template>
+          </el-table-column>
           <el-table-column label="手机号" prop="mobile" width="150"></el-table-column>
           <el-table-column label="工号" prop="userId" width="200"></el-table-column>
-          <el-table-column label="类型" prop="typeAttr" width="100"></el-table-column>
+          <el-table-column label="类型" prop="typeAttr" width="100">
+            <template #default="scope">
+              {{ scope.row.typeAttr == '0'?'个代':scope.row.typeAttr == '1'?'渠道':scope.row.typeAttr == '2'?'团队':scope.row.typeAttr == '3'?'电销组': '' }}
+            </template>
+          </el-table-column>
           <el-table-column label="归属" prop="deptName" width="200"></el-table-column>
           <el-table-column label="所属机构" prop="deptName" width="200"></el-table-column>
           <el-table-column label="人员状态" prop="status" width="150">
             <template #default="scope">
-              {{ scope.row.status == '1'?'前线人员':scope.row.status == '2'?'后线人员':scope.row.status == '3'?'合伙人':scope.row.status == '4'?'工作室管理员':scope.row.status == '5'?'团队长':scope.row.status == '6'?'个代':scope.row.status == '7'?'电销':scope.row.status == '8'?'渠道': '--' }}
+              {{ scope.row.status == '0'?'待认证':scope.row.status == '1'?'已认证':scope.row.status == '2'?'待提交资料':scope.row.status == '3'?'已入职':'' }}
+            </template>
+          </el-table-column>
+          <el-table-column label="账号状态" prop="isEnable" width="150">
+            <template #default="scope">
+              {{ scope.row.isEnable == '1'?'禁用':scope.row.isEnable == '0'?'启用': '--' }}
             </template>
           </el-table-column>
-          <el-table-column label="账号状态" prop="isEnable" width="150"></el-table-column>
           <el-table-column label="管理人" prop="leaderName" width="150"></el-table-column>
           <el-table-column label="管理人工号" prop="leaderId" width="200"></el-table-column>
           <el-table-column label="推荐人" prop="referrerName" width="150"></el-table-column>
@@ -93,21 +105,40 @@
       :title="title"
       width="1000"
     >
-      <addOperation @closeDialog="closeAddOperation" :options="options"></addOperation>
+      <addOperation ref="AddOperationRef" @closeDialog="closeAddOperation"></addOperation>
     </el-dialog>
     <el-dialog
       v-model="addTeamShow"
       title="添加"
       width="800"
     >
-      <addTeam @closeDialog="closeAddTeamDialog" :editData="editItemData"></addTeam>
+      <addTeam ref="AddTeamRef" @closeDialog="closeAddTeamDialog"></addTeam>
     </el-dialog>
     <el-dialog
       v-model="allocationShow"
       title="分配管理人"
       width="800"
     >
-      <allocation></allocation>
+      <allocation ref="AllocationRef" @closeDialog="closeAllocation"></allocation>
+    </el-dialog>
+    <el-dialog
+      v-model="peopleShow"
+      title="设置负责人"
+      width="800"
+    >
+      <el-radio-group v-if="tableData?.length>0" v-model="radioValue" class="allocation-radio">
+        <el-radio v-for="item in tableData" :value="item.id" size="large">
+          <template #default>
+            <div>{{ item.name }}</div>
+            <div>{{ item.id }}</div>
+          </template>
+        </el-radio>
+      </el-radio-group>
+      <el-empty v-else description="暂无数据" />
+      <template #footer>
+        <el-button @click="onCancel">取消</el-button>
+        <el-button type="primary" @click="onConfirm">确定</el-button>
+      </template>
     </el-dialog>
   </div>
 </template>
@@ -125,6 +156,9 @@ import {initial} from "lodash-es";
 import team from "@/api/modules/team.ts";
 
 let myRouter = useRouter()
+const AddTeamRef = ref(null)
+const AddOperationRef = ref(null)
+const AllocationRef = ref(null)
 
 // 机构数据
 let options = ref([])
@@ -142,15 +176,58 @@ const institutionList = () => {
   })
 }
 
-// 渠道
+// 团队
 let treeValue = ref('')
 let teamData = ref([])
 let addTeamShow = ref(false)
-let editItemData = ref(null)
 const initTeam = () => {
-  api.teamApi.teamList({}).then(res => {
+  api.teamApi.teamList({
+    param: treeValue.value,
+    attribute: 2
+  }).then(res => {
     if(res.code == 200) {
       teamData.value = res.data
+      if(teamData.value) {
+        initList(teamData.value[0])
+      }
+    } else {
+      ElMessage({
+        message: res.msg,
+        type: 'warning'
+      })
+    }
+  })
+}
+
+// 分页
+let currentPage = ref(1)
+let pageSize = ref(10)
+let total = ref(0)
+const handleSizeChange = (size) => {
+  pageSize.value = size
+}
+const handleCurrentChange = (page) => {
+  currentPage.value = page
+}
+// 初始化列表
+let teamInfo = ref({
+  name: '',
+  deptName: '',
+  managerName: '',
+  managerId: '',
+  describeInformation: ''
+})
+const initList = (item) => {
+  teamInfo.value = item
+  api.teamApi.getTeamUser({
+    id: item.id,
+    name: searchValue.value,
+    pages: currentPage.value,
+    size: pageSize.value
+  }).then(res => {
+    if(res.code == 200) {
+      tableData.value = res.data.records
+      total.value = res.data.total
     } else {
       ElMessage({
         message: res.msg,
@@ -163,19 +240,34 @@ const treeNodeCommend = (item, e) => {
   switch (e) {
     case '编辑':
       addTeamShow.value = true
-      editItemData.value = item
+      nextTick(() => {
+        AddTeamRef.value.initEdit(item, true)
+      })
       break;
     case '删除':
       ElMessageBox({
-        title: '删除渠道',
-        message: '确定要删除该渠道吗?',
+        title: '删除团队',
+        message: '确定要删除该团队吗?',
         type: 'warning',
         showCancelButton: true,
         confirmButtonText: '确定',
         cancelButtonText: '取消',
       }).then(( action ) => {
         if(action === 'confirm') {
-
+          api.teamApi.deleteById(item.id).then(res => {
+            if(res.code == 200) {
+              ElMessage({
+                message: res.msg,
+                type: 'success'
+              })
+              initTeam()
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: 'warning'
+              })
+            }
+          })
         }
       }).catch(( action ) => {
 
@@ -185,25 +277,13 @@ const treeNodeCommend = (item, e) => {
 }
 const closeAddTeamDialog = (type) => {
   addTeamShow.value = false
-}
-
-// 分页
-let currentPage = ref(1)
-let pageSize = ref(10)
-let total = ref(0)
-const handleSizeChange = (size) => {
-
-}
-const handleCurrentChange = (page) => {
-
+  initTeam()
 }
 
 // 搜索字段
 let searchValue = ref('')
 // 列表数据
-let tableData = ref([
-  {name: 1}
-])
+let tableData = ref([])
 // 编辑弹框
 let dialogShow = ref(false)
 // 编辑弹框标题
@@ -217,7 +297,7 @@ const showDetail = (scope) => {
   myRouter.push({
     path: '/operationDetail',
     query: {
-      id: scope.row.id
+      id: scope.row.userId
     }
   })
 }
@@ -226,14 +306,56 @@ const showDetail = (scope) => {
 let allocationShow = ref(false)
 
 // 设置负责人
+let peopleShow = ref(false)
+let radioValue = ref('')
 const setPeople = () => {
-  allocationShow.value = true
+  peopleShow.value = true
+  pageSize.value = 99999
+  initList(teamInfo.value)
+}
+const onCancel = () => {
+  peopleShow.value = false
+  radioValue.value = ''
+}
+const onConfirm = () => {
+  if(!radioValue.value) {
+    ElMessage({
+      message: '请选择负责人',
+      type: 'warning'
+    })
+    return
+  }
+  api.teamApi.setResponsiblePerson({
+    id: teamInfo.value.id,
+    managerId: radioValue.value
+  }).then(res => {
+    if(res.code == 200) {
+      ElMessage({
+        message: res.msg,
+        type: 'success'
+      })
+      initList(teamInfo.value)
+    } else {
+      ElMessage({
+        message: res.msg,
+        type: 'warning'
+      })
+    }
+    peopleShow.value = false
+  })
+}
+// 关闭设置负责人
+const closeAllocation = (type: boolean) => {
+  allocationShow.value = type
 }
 // 更多
 const tableDataCommand = (scope, e) => {
   switch (e) {
     case '编辑':
       dialogShow.value = true
+      nextTick(() => {
+        AddOperationRef.value.initEditData(scope.row.userId)
+      })
       title.value = '编辑'
       break;
     case '删除':
@@ -246,8 +368,23 @@ const tableDataCommand = (scope, e) => {
         cancelButtonText: '取消',
       }).then(( action ) => {
         if(action === 'confirm') {
-          let ids = [scope.row.id]
-
+          api.teamApi.deleteAssociatedUsers({
+            id: teamInfo.value.id,
+            userIds: [scope.row.id]
+          }).then(res => {
+            if(res?.code == 200) {
+              ElMessage({
+                message: res.msg,
+                type: 'success'
+              })
+              initList(teamInfo.value)
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: 'warning'
+              })
+            }
+          })
         }
       }).catch(( action ) => {
 
@@ -265,8 +402,23 @@ const tableDataCommand = (scope, e) => {
         if(action === 'confirm') {
           let data = {
             id: [scope.row.id],
-            isEnable: 0
+            isEnable: 1,
+            getAll: 0
           }
+          api.operationApi.operationIsEnable(data).then(res => {
+            if(res?.code == 200) {
+              ElMessage({
+                message: res.msg,
+                type: 'success'
+              })
+              initList(teamInfo.value)
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: 'warning'
+              })
+            }
+          })
         }
       }).catch(( action ) => {
 
@@ -284,8 +436,23 @@ const tableDataCommand = (scope, e) => {
         if(action === 'confirm'){
           let data = {
             id: [scope.row.id],
-            isEnable: 1
+            isEnable: 0,
+            getAll: 0
           }
+          api.operationApi.operationIsEnable(data).then(res => {
+            if(res?.code == 200) {
+              ElMessage({
+                message: res.msg,
+                type: 'success'
+              })
+              initList(teamInfo.value)
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: 'warning'
+              })
+            }
+          })
         }
       }).catch(( action ) => {
 
@@ -293,6 +460,9 @@ const tableDataCommand = (scope, e) => {
       break;
     case '分配管理人':
       allocationShow.value = true
+      nextTick(() => {
+        AllocationRef.value.initCheckedKeys(scope.row.deptId, selectType.value, [scope.row.id])
+      })
       break;
   }
 }
@@ -326,6 +496,7 @@ onMounted(() => {
       align-items: center;
       padding: 5px 10px;
       margin: 5px auto;
+      cursor: pointer;
       &:hover{
         background: rgba(0,0,0,.1);
       }
@@ -356,5 +527,15 @@ onMounted(() => {
     justify-content: flex-end;
     align-items: flex-end;
   }
+  .nameInfo{
+    display: flex;
+    justify-content: center;
+    align-content: center;
+    span{
+      background: #f0f0f0;
+      padding: 2px 4px;
+      border-radius: 2px;
+    }
+  }
 }
 </style>

+ 50 - 19
src/views/operationManagement/modules/addTeam.vue

@@ -15,14 +15,14 @@
           @change="deptIdChange"
         ></el-cascader>
       </el-form-item>
-<!--      <el-form-item label="管理人" prop="managerId">
+      <el-form-item label="管理人" prop="managerId">
         <el-select v-model="teamForm.managerId" placeholder="选择管理人">
           <el-option v-for="item in userList" :key="item.id" :value="item.id" :label="item.name"></el-option>
         </el-select>
       </el-form-item>
       <el-form-item label="管理人工号" prop="managerId">
         <el-input disabled v-model="teamForm.managerId"></el-input>
-      </el-form-item>-->
+      </el-form-item>
       <el-form-item label="描述" prop="describeInformation">
         <el-input type="textarea" maxlength="500" placeholder="请输入" v-model="teamForm.describeInformation"></el-input>
       </el-form-item>
@@ -70,8 +70,14 @@ let teamRules = ref<FormRules>({
   // ]
 })
 
-const initEdit = (data) => {
-
+// 编辑初始化数据
+let isEdit = ref(false)
+const initEdit = (data, bool) => {
+  isEdit.value = bool
+  teamForm.value = data
+  console.log(1111111, teamForm.value.deptId)
+  institutionList()
+  getUser(data.deptId)
 }
 
 // 机构
@@ -118,6 +124,7 @@ const getUser = (id) => {
 const onSubmit = async (AddTeamRef: FormInstance, type) => {
   if(!AddTeamRef) {
     emits('closeDialog', '取消')
+    isEdit.value = false
     AddTeamRef.resetFields()
     return
   }
@@ -125,23 +132,46 @@ const onSubmit = async (AddTeamRef: FormInstance, type) => {
     await AddTeamRef.validate((valid) => {
       if(valid) {
         let formData = {...teamForm.value}
+        if(typeof teamForm.value.deptId == 'string') {
+          teamForm.value.deptId = [teamForm.value.deptId]
+        }
         formData.deptId = teamForm.value.deptId[teamForm.value.deptId.length - 1]
         formData.systemCode = localStorage.getItem('login_system')
-        api.teamApi.addTeam(formData).then(res => {
-          if(res.code == 200) {
-            ElMessage({
-              message: res.msg,
-              type: 'success'
-            })
-          } else {
-            ElMessage({
-              message: res.msg,
-              type: 'warning'
-            })
-          }
-          emits('closeDialog', '确认')
-          AddTeamRef.resetFields()
-        })
+        if(isEdit.value) {
+          api.teamApi.updateTeam(formData).then(res => {
+            if(res.code == 200) {
+              ElMessage({
+                message: res.data.msg,
+                type: 'success'
+              })
+            } else {
+              ElMessage({
+                message: res.data.msg,
+                type: 'warning'
+              })
+            }
+            emits('closeDialog', '确认')
+            isEdit.value = false
+            AddTeamRef.resetFields()
+          })
+        } else {
+          api.teamApi.addTeam(formData).then(res => {
+            if(res.code == 200) {
+              ElMessage({
+                message: res.msg,
+                type: 'success'
+              })
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: 'warning'
+              })
+            }
+            emits('closeDialog', '确认')
+            isEdit.value = false
+            AddTeamRef.resetFields()
+          })
+        }
       } else {
         ElMessage({
           message: '请正确填写相关信息!',
@@ -151,6 +181,7 @@ const onSubmit = async (AddTeamRef: FormInstance, type) => {
     })
   } else {
     emits('closeDialog', '取消')
+    isEdit.value = false
     AddTeamRef.resetFields()
   }
 }

+ 8 - 2
src/views/operationManagement/modules/allocation.vue

@@ -68,9 +68,15 @@ const initUser = (id) => {
 // 初始化默认选中的数据
 let checkedKeys = ref([])
 let selectedIds = ref([])
+let selectType = ref('')
 const initCheckedKeys = (id, type, ids) => {
   checkedKeys.value = [id]
-  selectedIds.value = [...ids]
+  if(type == 'all') {
+    selectedIds.value = []
+  } else {
+    selectedIds.value = [...ids]
+  }
+  selectType.value = type
   initUser(id)
   radioValue.value = ''
 }
@@ -132,7 +138,7 @@ const onSubmit = (type) => {
     api.operationApi.setLeader({
       ids: selectedIds.value,
       leaderId: radioValue.value,
-      getAll: 0
+      getAll: selectType.value == 'all'?1:0
     }).then(res => {
       if(res.code == 200) {
         ElMessage({

+ 4 - 3
src/views/operationManagement/operation.vue

@@ -219,7 +219,7 @@ const organizationChange = (e) => {
 let form = ref<OperationSearch>({
   salesman: '',
   deptId: '',
-  typeAttr: '',
+  typeAttr: '1',
   deptName: '',
   status: '',
   isEnable: '',
@@ -495,7 +495,8 @@ const showDetail = (scope) => {
   myRouter.push({
     path: '/operationDetail',
     query: {
-      id: scope.row.id
+      id: scope.row.userId,
+      ids: scope.row.id
     }
   })
 }
@@ -513,7 +514,7 @@ const tableDataCommand = (scope, e) => {
     case '编辑':
       dialogShow.value = true
       nextTick(() => {
-        AddOperationRef.value.initEditData(scope.row.id)
+        AddOperationRef.value.initEditData(scope.row.userId)
       })
       title.value = '编辑'
       break;

+ 54 - 12
src/views/operationManagement/operationDetail.vue

@@ -19,8 +19,8 @@
               <span class="allName">{{ dataDetail?.name }}</span>
             </el-col>
             <el-col :span="12" style="display: flex; justify-content: flex-end">
-              <el-button plain @click="checkPass">审核通过</el-button>
-              <el-button plain @click="checkNotPass">审核不通过</el-button>
+              <el-button plain @click="checkPass" v-if="dataDetail?.status == 0 ||dataDetail?.status == 1 ||dataDetail?.status == 2 ||dataDetail?.status == 3 ">审核通过</el-button>
+              <el-button plain @click="checkNotPass" v-if="dataDetail?.status != 5&&dataDetail?.status != 6&&dataDetail?.status != 7&&dataDetail?.status != 8">审核不通过</el-button>
               <el-button plain @click="editDetail">编辑</el-button>&nbsp;
               <el-dropdown trigger="click" @command="handleCommand">
                 <el-button plain>更多</el-button>
@@ -81,7 +81,7 @@
                     </el-table-column>
                     <el-table-column prop="" label="身份证件照">
                       <template #default="scope">
-                        <img class="cardImage" :src="dataDetail?.fileList?.[0].fileUrl">
+                        <img class="cardImage" :src="dataDetail?.fileList.length>0?dataDetail?.fileList?.[0].fileUrl:''">
                       </template>
                     </el-table-column>
                     <el-table-column prop="cardFile" label="银行卡照">
@@ -109,22 +109,22 @@
                   <div class="fileItem">
                     <span class="label">身份证(人像面)</span>
                     <div class="fileName">
-                      <span class="file-name">文件名文件名文件名文件名文件名文件名文件名文件名文件名文件名文件名文件名文件名文件名文件名文件名文件名文件名文件名文件名文件名</span>
-                      <el-icon class="file-icon"><View /></el-icon>
+                      <span class="file-name">{{ imageChangeName('sfz1') }}</span>
+                      <el-icon class="file-icon" @click="imageView('sfz1')"><View /></el-icon>
                     </div>
                   </div>
                   <div class="fileItem">
                     <span class="label">身份证(国徽面)</span>
                     <div class="fileName">
-                      <span class="file-name">文件名</span>
-                      <el-icon class="file-icon"><View /></el-icon>
+                      <span class="file-name">{{ imageChangeName('sfz2') }}</span>
+                      <el-icon class="file-icon" @click="imageView('sfz1')"><View /></el-icon>
                     </div>
                   </div>
                   <div class="fileItem">
                     <span class="label">展业资格证</span>
                     <div class="fileName">
-                      <span class="file-name">文件名</span>
-                      <el-icon class="file-icon"><View /></el-icon>
+                      <span class="file-name">{{ imageChangeName('sfz1') }}</span>
+                      <el-icon class="file-icon" @click="imageView('sfz1')"><View /></el-icon>
                     </div>
                   </div>
                 </template>
@@ -155,6 +155,15 @@
     >
       <allocation ref="AllocationRef" @closeDialog="closeAllocation"></allocation>
     </el-dialog>
+    <el-dialog
+      v-model="imageShow"
+      title="预览"
+      width="500"
+    >
+      <div class="image-box">
+        <img class="image-view" :src="imageUrl" />
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -208,7 +217,7 @@ const handleCommand = (e) => {
       }).then(( action ) => {
         if(action === 'confirm') {
           let data = {
-            ids: [myRoute.query.id],
+            ids: [myRoute.query.ids],
             isEnable: 1,
             getAll: 0
           }
@@ -229,7 +238,7 @@ const handleCommand = (e) => {
       }).then(( action ) => {
         if(action === 'confirm'){
           let data = {
-            ids: [myRoute.query.id],
+            ids: [myRoute.query.ids],
             isEnable: 0,
             getAll: 0
           }
@@ -344,6 +353,7 @@ const checkPass = () => {
         message: res.msg,
         type: 'success',
       })
+      initDetail()
     } else {
       ElMessage({
         message: res.msg,
@@ -373,6 +383,7 @@ const checkNotPass = () => {
             message: res.msg,
             type: 'success',
           })
+          initDetail()
         } else {
           ElMessage({
             message: res.msg,
@@ -391,7 +402,7 @@ let dialogShow = ref(false)
 const editDetail = () => {
   dialogShow.value = true
   nextTick(() => {
-    AddOperationRef.value.initEditData(dataDetail.value.id)
+    AddOperationRef.value.initEditData(dataDetail.value.userId)
   })
 }
 const closeAddOperation = (text: string) => {
@@ -401,6 +412,28 @@ const closeAddOperation = (text: string) => {
   dialogShow.value = false
 }
 
+// 附件转换
+const imageChangeName = (type) => {
+  if(dataDetail.value&&dataDetail.value.fileList.length>0) {
+    let obj = dataDetail.value.fileList.find(item => item.fileType === type)
+    return obj.fileName
+  }
+}
+const imageChangeUrl = (type) => {
+  if(dataDetail.value.fileList.length>0) {
+    let obj = dataDetail.value.fileList.find(item => item.fileType == 'sfz1')
+    return obj.fileUrl
+  }
+}
+
+// 预览
+let imageUrl = ref('')
+let imageShow = ref(false)
+const imageView = (type) => {
+  imageUrl.value = imageChangeUrl(type)
+  imageShow.value = true
+}
+
 // 详情
 let dataDetail = ref(null)
 const initDetail = () => {
@@ -552,5 +585,14 @@ onMounted(() => {
       }
     }
   }
+  .image-box{
+    display: flex;
+    align-content: center;
+    justify-content: center;
+    .image-view{
+      width: 300px;
+      height: 200px;
+    }
+  }
 }
 </style>

+ 217 - 36
src/views/operationManagement/team.vue

@@ -3,8 +3,8 @@
     <el-row :gutter="20" style="width: 100%; overflow:hidden;">
       <el-col :span="4">
         <div class="teamTree">
-          <el-input class="search-input" v-model="treeValue" placeholder="团队名称查找" prefix-icon="Search"></el-input>
-          <div class="custom-tree-node" v-for="item in teamData" :key="item.id">
+          <el-input class="search-input" v-model="treeValue" placeholder="团队名称查找" prefix-icon="Search" @keyup.enter="initTeam"></el-input>
+          <div class="custom-tree-node" v-for="item in teamData" :key="item.id" @click.stop="initList(item)">
             <span class="custom-tree-node-label">{{ item.name }}</span>
             <el-dropdown class="custom-tree-node-more" @command="treeNodeCommend(item, $event)">
               <el-icon><MoreFilled /></el-icon>
@@ -22,16 +22,16 @@
       <el-col :span="20">
         <el-row :gutter="20">
           <el-col :span="22" class="info">
-            <h3>团队名称</h3>
-            <p>所属机构: 机构名称</p>
-            <p>管理人: 管理人姓名-管理人工号</p>
-            <p>描述:</p>
+            <h3>{{ teamInfo.name }}</h3>
+            <p>所属机构: {{ teamInfo?.deptName }}</p>
+            <p>管理人: {{ teamInfo?.managerName?`${teamInfo?.managerName}-`:'' }}{{ teamInfo?.managerId }}</p>
+            <p>描述:{{ teamInfo?.describeInformation }}</p>
           </el-col>
           <el-col :span="2" class="btn">
             <el-button plain @click="setPeople">设置负责人</el-button>
           </el-col>
         </el-row>
-        <el-input style="width: 300px; margin: 10px 0" v-model="searchValue" prefix-icon="Search" placeholder="输入姓名,手机号,工号查找" ></el-input>
+        <el-input style="width: 300px; margin: 10px 0" v-model="searchValue" prefix-icon="Search" placeholder="输入姓名,手机号,工号查找" clearable @keyup.enter="initList(teamInfo)"></el-input>
         <el-table
           :data="tableData"
           ref="operationListRef"
@@ -39,18 +39,30 @@
           @selection-change="handleSelectionChange"
         >
           <el-table-column type="selection" width="55"></el-table-column>
-          <el-table-column label="姓名" prop="name" width="80"></el-table-column>
+          <el-table-column label="姓名" prop="name" width="80">
+            <template #default="scope">
+              <div class="nameInfo">{{ scope.row.name }}<span v-show="scope.row.manager === '1'">负责人</span></div>
+            </template>
+          </el-table-column>
           <el-table-column label="手机号" prop="mobile" width="150"></el-table-column>
           <el-table-column label="工号" prop="userId" width="200"></el-table-column>
-          <el-table-column label="类型" prop="typeAttr" width="100"></el-table-column>
+          <el-table-column label="类型" prop="typeAttr" width="100">
+            <template #default="scope">
+              {{ scope.row.typeAttr == '0'?'个代':scope.row.typeAttr == '1'?'渠道':scope.row.typeAttr == '2'?'团队':scope.row.typeAttr == '3'?'电销组': '' }}
+            </template>
+          </el-table-column>
           <el-table-column label="归属" prop="deptName" width="200"></el-table-column>
           <el-table-column label="所属机构" prop="deptName" width="200"></el-table-column>
           <el-table-column label="人员状态" prop="status" width="150">
             <template #default="scope">
-              {{ scope.row.status == '1'?'前线人员':scope.row.status == '2'?'后线人员':scope.row.status == '3'?'合伙人':scope.row.status == '4'?'工作室管理员':scope.row.status == '5'?'团队长':scope.row.status == '6'?'个代':scope.row.status == '7'?'电销':scope.row.status == '8'?'渠道': '--' }}
+              {{ scope.row.status == '0'?'待认证':scope.row.status == '1'?'已认证':scope.row.status == '2'?'待提交资料':scope.row.status == '3'?'已入职':'' }}
+            </template>
+          </el-table-column>
+          <el-table-column label="账号状态" prop="isEnable" width="150">
+            <template #default="scope">
+              {{ scope.row.isEnable == '1'?'禁用':scope.row.isEnable == '0'?'启用': '--' }}
             </template>
           </el-table-column>
-          <el-table-column label="账号状态" prop="isEnable" width="150"></el-table-column>
           <el-table-column label="管理人" prop="leaderName" width="150"></el-table-column>
           <el-table-column label="管理人工号" prop="leaderId" width="200"></el-table-column>
           <el-table-column label="推荐人" prop="referrerName" width="150"></el-table-column>
@@ -93,7 +105,7 @@
       :title="title"
       width="1000"
     >
-      <addOperation @closeDialog="closeAddOperation" :options="options"></addOperation>
+      <addOperation ref="AddOperationRef" @closeDialog="closeAddOperation"></addOperation>
     </el-dialog>
     <el-dialog
       v-model="addTeamShow"
@@ -107,7 +119,26 @@
       title="分配管理人"
       width="800"
     >
-      <allocation></allocation>
+      <allocation ref="AllocationRef" @closeDialog="closeAllocation"></allocation>
+    </el-dialog>
+    <el-dialog
+      v-model="peopleShow"
+      title="设置负责人"
+      width="800"
+    >
+      <el-radio-group v-if="tableData?.length>0" v-model="radioValue" class="allocation-radio">
+        <el-radio v-for="item in tableData" :value="item.id" size="large">
+          <template #default>
+            <div>{{ item.name }}</div>
+            <div>{{ item.id }}</div>
+          </template>
+        </el-radio>
+      </el-radio-group>
+      <el-empty v-else description="暂无数据" />
+      <template #footer>
+        <el-button @click="onCancel">取消</el-button>
+        <el-button type="primary" @click="onConfirm">确定</el-button>
+      </template>
     </el-dialog>
   </div>
 </template>
@@ -126,6 +157,8 @@ import team from "@/api/modules/team.ts";
 
 let myRouter = useRouter()
 const AddTeamRef = ref(null)
+const AddOperationRef = ref(null)
+const AllocationRef = ref(null)
 
 // 机构数据
 let options = ref([])
@@ -148,9 +181,53 @@ let treeValue = ref('')
 let teamData = ref([])
 let addTeamShow = ref(false)
 const initTeam = () => {
-  api.teamApi.teamList({}).then(res => {
+  api.teamApi.teamList({
+    param: treeValue.value,
+    attribute: 1
+  }).then(res => {
     if(res.code == 200) {
       teamData.value = res.data
+      if(teamData.value) {
+        initList(teamData.value[0])
+      }
+    } else {
+      ElMessage({
+        message: res.msg,
+        type: 'warning'
+      })
+    }
+  })
+}
+
+// 分页
+let currentPage = ref(1)
+let pageSize = ref(10)
+let total = ref(0)
+const handleSizeChange = (size) => {
+  pageSize.value = size
+}
+const handleCurrentChange = (page) => {
+  currentPage.value = page
+}
+// 初始化列表
+let teamInfo = ref({
+  name: '',
+  deptName: '',
+  managerName: '',
+  managerId: '',
+  describeInformation: ''
+})
+const initList = (item) => {
+  teamInfo.value = item
+  api.teamApi.getTeamUser({
+    id: item.id,
+    name: searchValue.value,
+    pages: currentPage.value,
+    size: pageSize.value
+  }).then(res => {
+    if(res.code == 200) {
+      tableData.value = res.data.records
+      total.value = res.data.total
     } else {
       ElMessage({
         message: res.msg,
@@ -163,7 +240,9 @@ const treeNodeCommend = (item, e) => {
   switch (e) {
     case '编辑':
       addTeamShow.value = true
-      AddTeamRef.value.initEdit(item)
+      nextTick(() => {
+        AddTeamRef.value.initEdit(item, true)
+      })
       break;
     case '删除':
       ElMessageBox({
@@ -175,7 +254,20 @@ const treeNodeCommend = (item, e) => {
         cancelButtonText: '取消',
       }).then(( action ) => {
         if(action === 'confirm') {
-
+          api.teamApi.deleteById(item.id).then(res => {
+            if(res.code == 200) {
+              ElMessage({
+                message: res.msg,
+                type: 'success'
+              })
+              initTeam()
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: 'warning'
+              })
+            }
+          })
         }
       }).catch(( action ) => {
 
@@ -185,25 +277,13 @@ const treeNodeCommend = (item, e) => {
 }
 const closeAddTeamDialog = (type) => {
   addTeamShow.value = false
-}
-
-// 分页
-let currentPage = ref(1)
-let pageSize = ref(10)
-let total = ref(0)
-const handleSizeChange = (size) => {
-
-}
-const handleCurrentChange = (page) => {
-
+  initTeam()
 }
 
 // 搜索字段
 let searchValue = ref('')
 // 列表数据
-let tableData = ref([
-  {name: 1}
-])
+let tableData = ref([])
 // 编辑弹框
 let dialogShow = ref(false)
 // 编辑弹框标题
@@ -217,7 +297,7 @@ const showDetail = (scope) => {
   myRouter.push({
     path: '/operationDetail',
     query: {
-      id: scope.row.id
+      id: scope.row.userId
     }
   })
 }
@@ -226,14 +306,56 @@ const showDetail = (scope) => {
 let allocationShow = ref(false)
 
 // 设置负责人
+let peopleShow = ref(false)
+let radioValue = ref('')
 const setPeople = () => {
-  allocationShow.value = true
+  peopleShow.value = true
+  pageSize.value = 99999
+  initList(teamInfo.value)
+}
+const onCancel = () => {
+  peopleShow.value = false
+  radioValue.value = ''
+}
+const onConfirm = () => {
+  if(!radioValue.value) {
+    ElMessage({
+      message: '请选择负责人',
+      type: 'warning'
+    })
+    return
+  }
+  api.teamApi.setResponsiblePerson({
+    id: teamInfo.value.id,
+    managerId: radioValue.value
+  }).then(res => {
+    if(res.code == 200) {
+      ElMessage({
+        message: res.msg,
+        type: 'success'
+      })
+      initList(teamInfo.value)
+    } else {
+      ElMessage({
+        message: res.msg,
+        type: 'warning'
+      })
+    }
+    peopleShow.value = false
+  })
+}
+// 关闭设置负责人
+const closeAllocation = (type: boolean) => {
+  allocationShow.value = type
 }
 // 更多
 const tableDataCommand = (scope, e) => {
   switch (e) {
     case '编辑':
       dialogShow.value = true
+      nextTick(() => {
+        AddOperationRef.value.initEditData(scope.row.userId)
+      })
       title.value = '编辑'
       break;
     case '删除':
@@ -246,8 +368,23 @@ const tableDataCommand = (scope, e) => {
         cancelButtonText: '取消',
       }).then(( action ) => {
         if(action === 'confirm') {
-          let ids = [scope.row.id]
-
+          api.teamApi.deleteAssociatedUsers({
+            id: teamInfo.value.id,
+            userIds: [scope.row.id]
+          }).then(res => {
+            if(res?.code == 200) {
+              ElMessage({
+                message: res.msg,
+                type: 'success'
+              })
+              initList(teamInfo.value)
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: 'warning'
+              })
+            }
+          })
         }
       }).catch(( action ) => {
 
@@ -265,8 +402,23 @@ const tableDataCommand = (scope, e) => {
         if(action === 'confirm') {
           let data = {
             id: [scope.row.id],
-            isEnable: 0
+            isEnable: 1,
+            getAll: 0
           }
+          api.operationApi.operationIsEnable(data).then(res => {
+            if(res?.code == 200) {
+              ElMessage({
+                message: res.msg,
+                type: 'success'
+              })
+              initList(teamInfo.value)
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: 'warning'
+              })
+            }
+          })
         }
       }).catch(( action ) => {
 
@@ -284,8 +436,23 @@ const tableDataCommand = (scope, e) => {
         if(action === 'confirm'){
           let data = {
             id: [scope.row.id],
-            isEnable: 1
+            isEnable: 0,
+            getAll: 0
           }
+          api.operationApi.operationIsEnable(data).then(res => {
+            if(res?.code == 200) {
+              ElMessage({
+                message: res.msg,
+                type: 'success'
+              })
+              initList(teamInfo.value)
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: 'warning'
+              })
+            }
+          })
         }
       }).catch(( action ) => {
 
@@ -293,6 +460,9 @@ const tableDataCommand = (scope, e) => {
       break;
     case '分配管理人':
       allocationShow.value = true
+      nextTick(() => {
+        AllocationRef.value.initCheckedKeys(scope.row.deptId, selectType.value, [scope.row.id])
+      })
       break;
   }
 }
@@ -326,6 +496,7 @@ onMounted(() => {
       align-items: center;
       padding: 5px 10px;
       margin: 5px auto;
+      cursor: pointer;
       &:hover{
         background: rgba(0,0,0,.1);
       }
@@ -356,5 +527,15 @@ onMounted(() => {
     justify-content: flex-end;
     align-items: flex-end;
   }
+  .nameInfo{
+    display: flex;
+    justify-content: center;
+    align-content: center;
+    span{
+      background: #f0f0f0;
+      padding: 2px 4px;
+      border-radius: 2px;
+    }
+  }
 }
 </style>

+ 223 - 42
src/views/operationManagement/telemarketing.vue

@@ -3,8 +3,8 @@
     <el-row :gutter="20" style="width: 100%; overflow:hidden;">
       <el-col :span="4">
         <div class="teamTree">
-          <el-input class="search-input" v-model="treeValue" placeholder="电销组名称查找" prefix-icon="Search"></el-input>
-          <div class="custom-tree-node" v-for="item in teamData" :key="item.id">
+          <el-input class="search-input" v-model="treeValue" placeholder="团队名称查找" prefix-icon="Search" @keyup.enter="initTeam"></el-input>
+          <div class="custom-tree-node" v-for="item in teamData" :key="item.id" @click.stop="initList(item)">
             <span class="custom-tree-node-label">{{ item.name }}</span>
             <el-dropdown class="custom-tree-node-more" @command="treeNodeCommend(item, $event)">
               <el-icon><MoreFilled /></el-icon>
@@ -17,21 +17,21 @@
             </el-dropdown>
           </div>
         </div>
-        <el-button class="add-btn" icon="plus" @click="addTeamShow = true">添加电销组</el-button>
+        <el-button class="add-btn" icon="plus" @click="addTeamShow = true">添加团队</el-button>
       </el-col>
       <el-col :span="20">
         <el-row :gutter="20">
           <el-col :span="22" class="info">
-            <h3>电销组名称</h3>
-            <p>所属机构: 机构名称</p>
-            <p>管理人: 管理人姓名-管理人工号</p>
-            <p>描述:</p>
+            <h3>{{ teamInfo.name }}</h3>
+            <p>所属机构: {{ teamInfo?.deptName }}</p>
+            <p>管理人: {{ teamInfo?.managerName?`${teamInfo?.managerName}-`:'' }}{{ teamInfo?.managerId }}</p>
+            <p>描述:{{ teamInfo?.describeInformation }}</p>
           </el-col>
           <el-col :span="2" class="btn">
             <el-button plain @click="setPeople">设置负责人</el-button>
           </el-col>
         </el-row>
-        <el-input style="width: 300px; margin: 10px 0" v-model="searchValue" prefix-icon="Search" placeholder="输入姓名,手机号,工号查找" ></el-input>
+        <el-input style="width: 300px; margin: 10px 0" v-model="searchValue" prefix-icon="Search" placeholder="输入姓名,手机号,工号查找" clearable @keyup.enter="initList(teamInfo)"></el-input>
         <el-table
           :data="tableData"
           ref="operationListRef"
@@ -39,18 +39,30 @@
           @selection-change="handleSelectionChange"
         >
           <el-table-column type="selection" width="55"></el-table-column>
-          <el-table-column label="姓名" prop="name" width="80"></el-table-column>
+          <el-table-column label="姓名" prop="name" width="80">
+            <template #default="scope">
+              <div class="nameInfo">{{ scope.row.name }}<span v-show="scope.row.manager === '1'">负责人</span></div>
+            </template>
+          </el-table-column>
           <el-table-column label="手机号" prop="mobile" width="150"></el-table-column>
           <el-table-column label="工号" prop="userId" width="200"></el-table-column>
-          <el-table-column label="类型" prop="typeAttr" width="100"></el-table-column>
+          <el-table-column label="类型" prop="typeAttr" width="100">
+            <template #default="scope">
+              {{ scope.row.typeAttr == '0'?'个代':scope.row.typeAttr == '1'?'渠道':scope.row.typeAttr == '2'?'团队':scope.row.typeAttr == '3'?'电销组': '' }}
+            </template>
+          </el-table-column>
           <el-table-column label="归属" prop="deptName" width="200"></el-table-column>
           <el-table-column label="所属机构" prop="deptName" width="200"></el-table-column>
           <el-table-column label="人员状态" prop="status" width="150">
             <template #default="scope">
-              {{ scope.row.status == '1'?'前线人员':scope.row.status == '2'?'后线人员':scope.row.status == '3'?'合伙人':scope.row.status == '4'?'工作室管理员':scope.row.status == '5'?'团队长':scope.row.status == '6'?'个代':scope.row.status == '7'?'电销':scope.row.status == '8'?'渠道': '--' }}
+              {{ scope.row.status == '0'?'待认证':scope.row.status == '1'?'已认证':scope.row.status == '2'?'待提交资料':scope.row.status == '3'?'已入职':'' }}
+            </template>
+          </el-table-column>
+          <el-table-column label="账号状态" prop="isEnable" width="150">
+            <template #default="scope">
+              {{ scope.row.isEnable == '1'?'禁用':scope.row.isEnable == '0'?'启用': '--' }}
             </template>
           </el-table-column>
-          <el-table-column label="账号状态" prop="isEnable" width="150"></el-table-column>
           <el-table-column label="管理人" prop="leaderName" width="150"></el-table-column>
           <el-table-column label="管理人工号" prop="leaderId" width="200"></el-table-column>
           <el-table-column label="推荐人" prop="referrerName" width="150"></el-table-column>
@@ -93,21 +105,40 @@
       :title="title"
       width="1000"
     >
-      <addOperation @closeDialog="closeAddOperation" :options="options"></addOperation>
+      <addOperation ref="AddOperationRef" @closeDialog="closeAddOperation"></addOperation>
     </el-dialog>
     <el-dialog
       v-model="addTeamShow"
       title="添加"
       width="800"
     >
-      <addTeam @closeDialog="closeAddTeamDialog" :editData="editItemData"></addTeam>
+      <addTeam ref="AddTeamRef" @closeDialog="closeAddTeamDialog"></addTeam>
     </el-dialog>
     <el-dialog
       v-model="allocationShow"
       title="分配管理人"
       width="800"
     >
-      <allocation></allocation>
+      <allocation ref="AllocationRef" @closeDialog="closeAllocation"></allocation>
+    </el-dialog>
+    <el-dialog
+      v-model="peopleShow"
+      title="设置负责人"
+      width="800"
+    >
+      <el-radio-group v-if="tableData?.length>0" v-model="radioValue" class="allocation-radio">
+        <el-radio v-for="item in tableData" :value="item.id" size="large">
+          <template #default>
+            <div>{{ item.name }}</div>
+            <div>{{ item.id }}</div>
+          </template>
+        </el-radio>
+      </el-radio-group>
+      <el-empty v-else description="暂无数据" />
+      <template #footer>
+        <el-button @click="onCancel">取消</el-button>
+        <el-button type="primary" @click="onConfirm">确定</el-button>
+      </template>
     </el-dialog>
   </div>
 </template>
@@ -125,6 +156,9 @@ import {initial} from "lodash-es";
 import team from "@/api/modules/team.ts";
 
 let myRouter = useRouter()
+const AddTeamRef = ref(null)
+const AddOperationRef = ref(null)
+const AllocationRef = ref(null)
 
 // 机构数据
 let options = ref([])
@@ -142,15 +176,58 @@ const institutionList = () => {
   })
 }
 
-// 电销组
+// 团队
 let treeValue = ref('')
 let teamData = ref([])
 let addTeamShow = ref(false)
-let editItemData = ref(null)
 const initTeam = () => {
-  api.teamApi.teamList({}).then(res => {
+  api.teamApi.teamList({
+    param: treeValue.value,
+    attribute: 3
+  }).then(res => {
     if(res.code == 200) {
       teamData.value = res.data
+      if(teamData.value) {
+        initList(teamData.value[0])
+      }
+    } else {
+      ElMessage({
+        message: res.msg,
+        type: 'warning'
+      })
+    }
+  })
+}
+
+// 分页
+let currentPage = ref(1)
+let pageSize = ref(10)
+let total = ref(0)
+const handleSizeChange = (size) => {
+  pageSize.value = size
+}
+const handleCurrentChange = (page) => {
+  currentPage.value = page
+}
+// 初始化列表
+let teamInfo = ref({
+  name: '',
+  deptName: '',
+  managerName: '',
+  managerId: '',
+  describeInformation: ''
+})
+const initList = (item) => {
+  teamInfo.value = item
+  api.teamApi.getTeamUser({
+    id: item.id,
+    name: searchValue.value,
+    pages: currentPage.value,
+    size: pageSize.value
+  }).then(res => {
+    if(res.code == 200) {
+      tableData.value = res.data.records
+      total.value = res.data.total
     } else {
       ElMessage({
         message: res.msg,
@@ -163,19 +240,34 @@ const treeNodeCommend = (item, e) => {
   switch (e) {
     case '编辑':
       addTeamShow.value = true
-      editItemData.value = item
+      nextTick(() => {
+        AddTeamRef.value.initEdit(item, true)
+      })
       break;
     case '删除':
       ElMessageBox({
-        title: '删除电销组',
-        message: '确定要删除该电销组吗?',
+        title: '删除团队',
+        message: '确定要删除该团队吗?',
         type: 'warning',
         showCancelButton: true,
         confirmButtonText: '确定',
         cancelButtonText: '取消',
       }).then(( action ) => {
         if(action === 'confirm') {
-
+          api.teamApi.deleteById(item.id).then(res => {
+            if(res.code == 200) {
+              ElMessage({
+                message: res.msg,
+                type: 'success'
+              })
+              initTeam()
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: 'warning'
+              })
+            }
+          })
         }
       }).catch(( action ) => {
 
@@ -185,25 +277,13 @@ const treeNodeCommend = (item, e) => {
 }
 const closeAddTeamDialog = (type) => {
   addTeamShow.value = false
-}
-
-// 分页
-let currentPage = ref(1)
-let pageSize = ref(10)
-let total = ref(0)
-const handleSizeChange = (size) => {
-
-}
-const handleCurrentChange = (page) => {
-
+  initTeam()
 }
 
 // 搜索字段
 let searchValue = ref('')
 // 列表数据
-let tableData = ref([
-  {name: 1}
-])
+let tableData = ref([])
 // 编辑弹框
 let dialogShow = ref(false)
 // 编辑弹框标题
@@ -217,7 +297,7 @@ const showDetail = (scope) => {
   myRouter.push({
     path: '/operationDetail',
     query: {
-      id: scope.row.id
+      id: scope.row.userId
     }
   })
 }
@@ -226,14 +306,56 @@ const showDetail = (scope) => {
 let allocationShow = ref(false)
 
 // 设置负责人
+let peopleShow = ref(false)
+let radioValue = ref('')
 const setPeople = () => {
-  allocationShow.value = true
+  peopleShow.value = true
+  pageSize.value = 99999
+  initList(teamInfo.value)
+}
+const onCancel = () => {
+  peopleShow.value = false
+  radioValue.value = ''
+}
+const onConfirm = () => {
+  if(!radioValue.value) {
+    ElMessage({
+      message: '请选择负责人',
+      type: 'warning'
+    })
+    return
+  }
+  api.teamApi.setResponsiblePerson({
+    id: teamInfo.value.id,
+    managerId: radioValue.value
+  }).then(res => {
+    if(res.code == 200) {
+      ElMessage({
+        message: res.msg,
+        type: 'success'
+      })
+      initList(teamInfo.value)
+    } else {
+      ElMessage({
+        message: res.msg,
+        type: 'warning'
+      })
+    }
+    peopleShow.value = false
+  })
+}
+// 关闭设置负责人
+const closeAllocation = (type: boolean) => {
+  allocationShow.value = type
 }
 // 更多
 const tableDataCommand = (scope, e) => {
   switch (e) {
     case '编辑':
       dialogShow.value = true
+      nextTick(() => {
+        AddOperationRef.value.initEditData(scope.row.userId)
+      })
       title.value = '编辑'
       break;
     case '删除':
@@ -246,8 +368,23 @@ const tableDataCommand = (scope, e) => {
         cancelButtonText: '取消',
       }).then(( action ) => {
         if(action === 'confirm') {
-          let ids = [scope.row.id]
-
+          api.teamApi.deleteAssociatedUsers({
+            id: teamInfo.value.id,
+            userIds: [scope.row.id]
+          }).then(res => {
+            if(res?.code == 200) {
+              ElMessage({
+                message: res.msg,
+                type: 'success'
+              })
+              initList(teamInfo.value)
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: 'warning'
+              })
+            }
+          })
         }
       }).catch(( action ) => {
 
@@ -265,8 +402,23 @@ const tableDataCommand = (scope, e) => {
         if(action === 'confirm') {
           let data = {
             id: [scope.row.id],
-            isEnable: 0
+            isEnable: 1,
+            getAll: 0
           }
+          api.operationApi.operationIsEnable(data).then(res => {
+            if(res?.code == 200) {
+              ElMessage({
+                message: res.msg,
+                type: 'success'
+              })
+              initList(teamInfo.value)
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: 'warning'
+              })
+            }
+          })
         }
       }).catch(( action ) => {
 
@@ -284,8 +436,23 @@ const tableDataCommand = (scope, e) => {
         if(action === 'confirm'){
           let data = {
             id: [scope.row.id],
-            isEnable: 1
+            isEnable: 0,
+            getAll: 0
           }
+          api.operationApi.operationIsEnable(data).then(res => {
+            if(res?.code == 200) {
+              ElMessage({
+                message: res.msg,
+                type: 'success'
+              })
+              initList(teamInfo.value)
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: 'warning'
+              })
+            }
+          })
         }
       }).catch(( action ) => {
 
@@ -293,6 +460,9 @@ const tableDataCommand = (scope, e) => {
       break;
     case '分配管理人':
       allocationShow.value = true
+      nextTick(() => {
+        AllocationRef.value.initCheckedKeys(scope.row.deptId, selectType.value, [scope.row.id])
+      })
       break;
   }
 }
@@ -326,6 +496,7 @@ onMounted(() => {
       align-items: center;
       padding: 5px 10px;
       margin: 5px auto;
+      cursor: pointer;
       &:hover{
         background: rgba(0,0,0,.1);
       }
@@ -356,5 +527,15 @@ onMounted(() => {
     justify-content: flex-end;
     align-items: flex-end;
   }
+  .nameInfo{
+    display: flex;
+    justify-content: center;
+    align-content: center;
+    span{
+      background: #f0f0f0;
+      padding: 2px 4px;
+      border-radius: 2px;
+    }
+  }
 }
 </style>