member.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. <template>
  2. <PageMain class="vh100">
  3. <el-tabs v-model="activeName" class="h-full" @tab-click="handleClick">
  4. <el-tab-pane :label="'待审核' + '(' + countObj?.noAuditCount + ')'" name="hold" class="h-full">
  5. <el-form label-position="left" label-width="auto">
  6. <el-row :gutter="24">
  7. <el-col :span="6">
  8. <el-form-item label="成员信息">
  9. <el-input v-model="formAccessibility.firstName" placeholder="输入成员信息查找" :prefix-icon="Search" />
  10. </el-form-item>
  11. </el-col>
  12. <el-col :span="6">
  13. <el-form-item label="归属机构">
  14. <el-cascader clearable style="width: 100%" v-model="info.deptId" :options="institutionList"
  15. :props="tableProps" />
  16. </el-form-item>
  17. </el-col>
  18. <el-col :span="6">
  19. <el-form-item label="状态">
  20. <el-select clearable style="width: 100%" v-model="info.status">
  21. <el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" />
  22. </el-select>
  23. </el-form-item>
  24. </el-col>
  25. <el-col :span="4">
  26. <el-form-item label="">
  27. <el-button type="primary" @click="salesmanAuth">查询</el-button>
  28. <el-button type="primary" plain @click="reset">重置</el-button>
  29. </el-form-item>
  30. </el-col>
  31. </el-row>
  32. </el-form>
  33. <Table height="calc(100% - 56px)" :tableData="tableData" :columns="columns" :showIndex="false"
  34. :showSelect="true" :pageInfo="pageInfo" @getList="getList"
  35. :treeProps="{ children: 'children', hasChildren: 'hasChildren' }" @select-all-change="selectAllChange"
  36. @select-change="selectChange">
  37. <template v-slot:table-title-btn>
  38. <div>
  39. <!-- <el-button type="primary" @click="add(ruleFormRef)">
  40. <el-icon><Plus /></el-icon>添加机构</el-button
  41. > -->
  42. <el-dropdown placement="bottom-start">
  43. <el-button>
  44. 批量操作<el-icon class="el-icon--right">
  45. <arrow-down />
  46. </el-icon>
  47. </el-button>
  48. <template #dropdown>
  49. <el-dropdown-menu>
  50. <el-dropdown-item>审核</el-dropdown-item>
  51. <!-- <el-dropdown-item v-on:click="manySetDeptUser()">设置负责人</el-dropdown-item> -->
  52. </el-dropdown-menu>
  53. </template>
  54. </el-dropdown>
  55. </div>
  56. </template>
  57. <template v-slot:operation="scope">
  58. <el-button type="primary" link @click="toExamine(scope.operationData.row, 'success')">
  59. 审核通过
  60. </el-button>
  61. <el-button type="primary" link @click="toExamine(scope.operationData.row, 'error')">
  62. 审核不通过
  63. </el-button>
  64. <el-button type="primary" link @click="editor(scope.operationData.row)">
  65. 详情
  66. </el-button>
  67. </template>
  68. <template v-slot:search="scope">
  69. {{ scope.slotData.label }}
  70. </template>
  71. </Table>
  72. </el-tab-pane>
  73. <el-tab-pane :label="'审核不通过' + '(' + countObj?.failAuditCount + ')'" name="pass" class="h-full">
  74. <el-form label-position="left" label-width="auto">
  75. <el-row :gutter="24">
  76. <el-col :span="6">
  77. <el-form-item label="成员信息">
  78. <el-input v-model="formAccessibility.firstName" placeholder="输入成员信息查找" :prefix-icon="Search" />
  79. </el-form-item>
  80. </el-col>
  81. <el-col :span="6">
  82. <el-form-item label="归属机构">
  83. <el-cascader clearable style="width: 100%" v-model="info.deptId" :options="institutionList"
  84. :props="tableProps" />
  85. </el-form-item>
  86. </el-col>
  87. <el-col :span="6">
  88. <el-form-item label="状态">
  89. <el-select clearable style="width: 100%" v-model="info.status">
  90. <el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" />
  91. </el-select>
  92. </el-form-item>
  93. </el-col>
  94. <el-col :span="4">
  95. <el-form-item label="">
  96. <el-button type="primary" @click="salesmanAuth">查询</el-button>
  97. <el-button type="primary" plain @click="reset">重置</el-button>
  98. </el-form-item>
  99. </el-col>
  100. </el-row>
  101. </el-form>
  102. <Table height="calc(100% - 56px)" :tableData="tableData" :columns="columns" :showIndex="false"
  103. :showSelect="true" :pageInfo="pageInfo" @getList="getList"
  104. :treeProps="{ children: 'children', hasChildren: 'hasChildren' }" @select-all-change="selectAllChange"
  105. @select-change="selectChange">
  106. <template v-slot:table-title-btn>
  107. <div>
  108. <!-- <el-button type="primary" @click="add(ruleFormRef)">
  109. <el-icon><Plus /></el-icon>添加机构</el-button
  110. > -->
  111. <el-dropdown placement="bottom-start">
  112. <el-button>
  113. 批量操作<el-icon class="el-icon--right">
  114. <arrow-down />
  115. </el-icon>
  116. </el-button>
  117. <template #dropdown>
  118. <el-dropdown-menu>
  119. <el-dropdown-item>审核</el-dropdown-item>
  120. <!-- <el-dropdown-item v-on:click="manySetDeptUser()">设置负责人</el-dropdown-item> -->
  121. </el-dropdown-menu>
  122. </template>
  123. </el-dropdown>
  124. </div>
  125. </template>
  126. <template v-slot:operation="scope">
  127. <el-button type="primary" link @click="editor(scope.operationData.row)">
  128. 详情
  129. </el-button>
  130. </template>
  131. <template v-slot:search="scope">
  132. {{ scope.slotData.label }}
  133. </template>
  134. </Table>
  135. </el-tab-pane>
  136. </el-tabs>
  137. <el-dialog v-model="dialogVisible" title="审核不通过" width="500" draggable>
  138. <el-input type="textarea" placeholder="请输入审核不通过原因" v-model="textValue" />
  139. <template #footer>
  140. <div class="dialog-footer">
  141. <el-button class="border-[#0083FF] color-[#0083FF]" plain @click="cancel()">取 消</el-button>
  142. <el-button type="primary" @click="confirm()"> 保 存 </el-button>
  143. </div>
  144. </template>
  145. </el-dialog>
  146. </PageMain>
  147. </template>
  148. <script setup lang="ts">
  149. import { ref, reactive, watch, onMounted } from "vue";
  150. import type {
  151. ComponentSize,
  152. FormInstance,
  153. FormRules,
  154. TabsPaneContext,
  155. } from "element-plus";
  156. import { Plus, Search } from "@element-plus/icons-vue";
  157. import { useRouter } from "vue-router";
  158. import type Node from "element-plus/es/components/tree/src/model/node";
  159. // import universalTable from "../"
  160. import { ElMessage, ElMessageBox, ElPopconfirm, ElTree } from "element-plus";
  161. import api from "@/api";
  162. import { h } from "vue";
  163. import setDept from "@/components/DialogSetDeptLeader/index.vue";
  164. interface Tree {
  165. [key: string]: any;
  166. }
  167. const filterText = ref("");
  168. const treeRef = ref<InstanceType<typeof ElTree>>();
  169. const activeName = ref("hold");
  170. const defaultProps = {
  171. children: "children",
  172. label: "label",
  173. };
  174. //批量设置负责人
  175. watch(filterText, (val) => {
  176. treeRef.value!.filter(val);
  177. });
  178. const formAccessibility = reactive({
  179. fullName: "",
  180. firstName: "",
  181. lastName: "",
  182. phone: "",
  183. });
  184. interface PageInfo {
  185. pageNum: number;
  186. pageSize: number;
  187. sizes: number[];
  188. total: number;
  189. show: boolean;
  190. }
  191. const dialogVisible = ref(false);
  192. // import Select from "@/components/select/selectMain.vue";
  193. // import TestTable from "@/components/Table/index.vue";
  194. //业务员列表
  195. type tableType = {
  196. id: string;
  197. name: string;
  198. };
  199. const tableData = ref<tableType[]>([]);
  200. const tableProps = ref({
  201. value: "id",
  202. label: "name",
  203. children: "children",
  204. checkStrictly: true,
  205. });
  206. const columns = [
  207. { prop: "name", label: "姓名" },
  208. { prop: "mobile", label: "手机号" },
  209. // { prop: "id", label: "工号" },
  210. { prop: "deptName", label: "归属机构" },
  211. {
  212. prop: "username",
  213. label: "角色",
  214. },
  215. {
  216. prop: "status", label: "状态",
  217. formatter: (row: any) => {
  218. return () => h("div", {}, row.status == '4' ? "入司审核" : row.status == '7' ? "离职审核" : '');
  219. }
  220. },
  221. { prop: "createTime", label: "创建时间" },
  222. { prop: "createBy", label: "创建人" },
  223. ];
  224. const pageInfo = {
  225. pageNum: 1,
  226. pageSize: 10,
  227. sizes: [10, 20, 30, 40, 50],
  228. total: 0,
  229. show: true,
  230. };
  231. //分页列表功能
  232. const getList = (item: PageInfo) => {
  233. pageInfo.pageNum = item.pageNum;
  234. pageInfo.pageSize = item.pageSize;
  235. salesmanAuth();
  236. };
  237. const checkTableIdList = ref([]);
  238. //表格选择事件
  239. function selectAllChange(list: any) {
  240. checkTableIdList.value = list;
  241. }
  242. function selectChange(list: any) {
  243. checkTableIdList.value = list;
  244. }
  245. //审核
  246. const userInfoId = ref("");
  247. const toExamine = (item: any, type: string) => {
  248. if (type == "success") {
  249. ElMessageBox.confirm(`确定审核通过${item.name}账号吗?`, "审核通过", {
  250. confirmButtonText: "确认",
  251. cancelButtonText: "取消",
  252. type: "warning",
  253. center: true,
  254. })
  255. .then(() => {
  256. api.representativeApi
  257. .salesmanAuthSuccess({
  258. userInfoId: item.id,
  259. })
  260. .then((res: any) => {
  261. if (res.code == 200) {
  262. ElMessage.success("操作成功");
  263. salesmanAuth(); //业务员列表
  264. } else {
  265. ElMessage.error(res.msg);
  266. // salesmanAuth(); //业务员列表
  267. }
  268. });
  269. })
  270. .catch(() => {
  271. ElMessage.warning("用户取消操作");
  272. });
  273. } else {
  274. dialogVisible.value = true;
  275. userInfoId.value = item.id;
  276. // ElMessageBox.confirm(`<textarea placeholder='请输入审核不通过原因' oninput='handleText()' style="width:300px"></textarea>`, "审核不通过", {
  277. // confirmButtonText: "确认",
  278. // cancelButtonText: "取消",
  279. // dangerouslyUseHTMLString: true ,
  280. // type: "warning",
  281. // center: true,
  282. // })
  283. // .then(() => {
  284. // api.representativeApi.salesmanAuthFailed({}).then((res: any) => {
  285. // if (res.code == 200) {
  286. // ElMessage.success("操作成功");
  287. // salesmanAuth(); //业务员列表
  288. // } else {
  289. // ElMessage.error(res.msg);
  290. // // salesmanAuth(); //业务员列表
  291. // }
  292. // });
  293. // })
  294. // .catch(() => {
  295. // ElMessage.warning("用户取消操作");
  296. // });
  297. }
  298. };
  299. function cancel() {
  300. ElMessage.warning("用户取消操作");
  301. dialogVisible.value = false;
  302. }
  303. const textValue = ref("");
  304. //审核不通过
  305. function confirm() {
  306. api.representativeApi
  307. .salesmanAuthFailed({
  308. userInfoId: userInfoId.value,
  309. approvalOpinion: textValue.value,
  310. })
  311. .then((res: any) => {
  312. if (res.code == 200) {
  313. ElMessage.success("操作成功");
  314. salesmanAuth(); //业务员列表
  315. dialogVisible.value = false;
  316. }
  317. });
  318. }
  319. interface institutionData {
  320. typeAttr: string;
  321. deptId: string;
  322. status: string;
  323. }
  324. const info = ref<institutionData>({
  325. typeAttr: "2",
  326. deptId: "",
  327. status: '0',
  328. });
  329. const router = useRouter();
  330. //详情
  331. const editor = (item: any) => {
  332. console.log(item);
  333. router.push({
  334. path: "/representative/member/memberMessage",
  335. query: {
  336. id: item.userId,
  337. },
  338. });
  339. // pageInfo.pageNum=item.pageNum
  340. // pageInfo.pageSize=item.pageSize
  341. };
  342. //获取机构类型字典值
  343. type comType = {
  344. value: string;
  345. label: string;
  346. };
  347. const handleClick = (tab: TabsPaneContext, event: Event) => {
  348. // console.log(tab.props.name);
  349. if (tab.props.name == "pass") {
  350. info.value.status = 5;
  351. salesmanAuth();
  352. } else {
  353. info.value.status = 4;
  354. salesmanAuth();
  355. }
  356. };
  357. //获取成员员列表
  358. const salesmanAuth = () => {
  359. api.representativeApi
  360. .getUserInfoList({
  361. ...info.value,
  362. pages: pageInfo.pageNum,
  363. size: pageInfo.pageSize,
  364. })
  365. .then((res) => {
  366. tableData.value = res.data.records;
  367. pageInfo.total = res.data.total;
  368. });
  369. };
  370. //成员列表
  371. const countObj = ref({
  372. noAuditCount: '',
  373. failAuditCount: "",
  374. })
  375. const institutionList = ref([]);
  376. const getAllMemberList = () => {
  377. api.institutionApi.institutionList({}).then((res: any) => {
  378. if (res.code === 200) institutionList.value = res.data;
  379. });
  380. api.representativeApi.getAuditCount({
  381. typeAttr: '2'
  382. }).then((res: any) => {
  383. // console.log(res)
  384. if (res.code === 200) {
  385. countObj.value = res.data
  386. }
  387. })
  388. // pageInfo.pageSize=item.pageSize
  389. };
  390. let statusList = ref([
  391. {
  392. value: '0',
  393. label: '全部'
  394. },
  395. {
  396. value: '4',
  397. label: '入司审核'
  398. },
  399. {
  400. value: '7',
  401. label: '离职审核'
  402. },
  403. ])
  404. const reset = (item: any) => {
  405. // ElMessage({})
  406. };
  407. onMounted(() => {
  408. // 对 asyncRoutes 进行预处理并转换为树形结构
  409. salesmanAuth(); //业务员列表
  410. // getAreaList(); //省市区级联数据
  411. // getSystemList(); //机构类型字典
  412. // getExhibitionScopeSystemList(); //展业范围字段
  413. getAllMemberList(); //成员列表
  414. });
  415. </script>
  416. <style lang="scss" scoped>
  417. :deep(.table-title-btn) {
  418. display: flex;
  419. align-items: center;
  420. justify-content: space-between;
  421. >div {
  422. display: flex;
  423. }
  424. }
  425. :deep(.el-dropdown-link) {
  426. cursor: pointer;
  427. color: var(--el-color-primary);
  428. display: flex;
  429. align-items: center;
  430. margin-left: 15px;
  431. }
  432. .custom-tree-node {
  433. flex: 1;
  434. display: flex;
  435. align-items: center;
  436. justify-content: space-between;
  437. font-size: 14px;
  438. padding-right: 8px;
  439. }
  440. :deep(.el-message-box__container) {
  441. width: 100% !important;
  442. .el-message-box__message {
  443. width: 100% !important;
  444. }
  445. }
  446. </style>