index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <div class="log">
  3. <PageMain class="vh100">
  4. <div class='btn-box'>
  5. <el-button type="primary" plain class='query-btn'
  6. @click='dialogShow'>{{selectedKeys.length?`已选${selectedKeys.length}项`:'筛选条件'}}</el-button>
  7. <div class='query-btn'>
  8. <DowButton @endAnim='downloadFile'></DowButton>
  9. </div>
  10. </div>
  11. <QueryForm :option="listOption" @query='query' @delSelect='delSelect' ref='queryFormRef'></QueryForm>
  12. <!-- 表格 -->
  13. <ComplexTable :tableData="tableData" :showSelect='false' :columns="listOption.columns" :showIndex="false"
  14. :columnwidth="120" :pageInfo="pageInfo" @getList="getList">
  15. <template v-slot:operation="scope">
  16. <el-button type="primary" link @click='agreementEdit(scope.operationData)'>明细</el-button>
  17. </template>
  18. <template v-slot:search="scope">
  19. <Sort :scope="scope.slotData" :globalSortKey="globalSortKey" :globalSortOrder="globalSortOrder"
  20. @update:sort="handleSortUpdate"></Sort>
  21. </template>
  22. <template #customSlot="{ bodyCell: { scope, column } }">
  23. <template v-if="column.prop == 'quoteOrderNum'">
  24. {{ scope.row.quoteOrderNum }} 笔
  25. </template>
  26. <template v-if="column.prop == 'proxyCustomerOrderNum'">
  27. {{ scope.row.proxyCustomerOrderNum }} 笔
  28. </template>
  29. <template v-if="column.prop == 'pcOrderNum'">
  30. {{ scope.row.pcOrderNum }} 笔
  31. </template>
  32. <template v-if="column.prop == 'appOrderNum'">
  33. {{ scope.row.appOrderNum }} 笔
  34. </template>
  35. <template v-if="column.prop == 'payPendingOrderNum'">
  36. {{ scope.row.payPendingOrderNum }} 笔
  37. </template>
  38. <template v-if="column.prop == 'underwritRejectNum'">
  39. {{ scope.row.underwritRejectNum }} 笔
  40. </template>
  41. <template v-if="column.prop == 'underwritPassRate'">
  42. {{ scope.row.underwritPassRate }} %
  43. </template>
  44. <template v-if="column.prop == 'underwriteRate'">
  45. {{ scope.row.underwriteRate }} %
  46. </template>
  47. <template v-if="column.prop == 'additionalRecordingOrderNum'">
  48. {{ scope.row.additionalRecordingOrderNum }} 笔
  49. </template>
  50. <template v-if="column.prop == 'additionalRecordingPendingApprovalOrderNum'">
  51. {{ scope.row.additionalRecordingPendingApprovalOrderNum }} 笔
  52. </template>
  53. <template v-if="column.prop == 'additionalRecordingApprovalOrderNum'">
  54. {{ scope.row.additionalRecordingApprovalOrderNum }} 笔
  55. </template>
  56. </template>
  57. </ComplexTable>
  58. <FilterDialog :show='isShow' @close='isShow=false' @sure='filterSure' ref='filterDialogRef' @selectedKeys='selected'
  59. routerKey='routerKey'>
  60. </FilterDialog>
  61. </PageMain>
  62. </div>
  63. </template>
  64. <script setup lang="ts">
  65. import { useRouter } from "vue-router";
  66. import api from "@/api";
  67. import QueryForm from "../../components/queryForm.vue";
  68. import FilterDialog from "../../components/filterDialog.vue";
  69. import DowButton from "../../components/button.vue";
  70. import Sort from "../../components/sort.vue";
  71. import useUserStore from "@/store/modules/message";
  72. import PageInfo from "@/api/types/agreementTypes";
  73. import { ElMessage } from "element-plus";
  74. const router = useRouter();
  75. const userStore = useUserStore();
  76. const isShow = ref(false);
  77. const isSort = ref();
  78. const pageInfo = ref({
  79. pageNum: 1,
  80. pageSize: 10,
  81. sizes: [10, 20, 30, 40, 50],
  82. total: 0,
  83. });
  84. const listOption = reactive({
  85. rowKey: "salesmanId",
  86. //查询
  87. queryFormFields: [],
  88. // 表格列
  89. columns: [
  90. {
  91. prop: "salesmanName",
  92. label: "姓名",
  93. width: "100",
  94. },
  95. {
  96. prop: "salesmanPhone",
  97. label: "手机号",
  98. width: "120",
  99. },
  100. {
  101. prop: "deptName",
  102. label: "所属机构",
  103. width: "300",
  104. },
  105. {
  106. prop: "quoteOrderNum",
  107. label: "报价订单",
  108. width: "180",
  109. align: "right",
  110. sortable: true,
  111. component: "customSlot",
  112. },
  113. {
  114. prop: "proxyCustomerOrderNum",
  115. label: "代客录单",
  116. width: "180",
  117. align: "right",
  118. sortable: true,
  119. align: "right",
  120. sortable: true,
  121. component: "customSlot",
  122. },
  123. {
  124. prop: "pcOrderNum",
  125. label: "PC报价中",
  126. width: "180",
  127. align: "right",
  128. sortable: true,
  129. component: "customSlot",
  130. },
  131. {
  132. prop: "appOrderNum",
  133. label: "APP报价中",
  134. width: "180",
  135. align: "right",
  136. sortable: true,
  137. component: "customSlot",
  138. },
  139. {
  140. prop: "payPendingOrderNum",
  141. label: "待缴费",
  142. width: "180",
  143. align: "right",
  144. sortable: true,
  145. component: "customSlot",
  146. },
  147. {
  148. prop: "underwritRejectNum",
  149. label: "核保失败",
  150. width: "180",
  151. align: "right",
  152. sortable: true,
  153. component: "customSlot",
  154. },
  155. {
  156. prop: "underwritPassRate",
  157. label: "核保通过率",
  158. width: "180",
  159. align: "right",
  160. sortable: true,
  161. component: "customSlot",
  162. },
  163. {
  164. prop: "underwriteRate",
  165. label: "承保率",
  166. width: "180",
  167. align: "right",
  168. sortable: true,
  169. component: "customSlot",
  170. },
  171. {
  172. prop: "additionalRecordingOrderNum",
  173. label: "补录订单",
  174. width: "180",
  175. align: "right",
  176. sortable: true,
  177. component: "customSlot",
  178. },
  179. {
  180. prop: "additionalRecordingPendingApprovalOrderNum",
  181. label: "补录待审核",
  182. width: "180",
  183. align: "right",
  184. sortable: true,
  185. component: "customSlot",
  186. },
  187. {
  188. prop: "additionalRecordingApprovalOrderNum",
  189. label: "补录审核通过",
  190. width: "180",
  191. align: "right",
  192. sortable: true,
  193. component: "customSlot",
  194. },
  195. {
  196. prop: "manegerName",
  197. label: "管理人",
  198. width: "180",
  199. },
  200. ],
  201. });
  202. const selectedKeys = ref([]);
  203. const selected = function (val) {
  204. selectedKeys.value = val;
  205. };
  206. //查询数据
  207. const phone = JSON.parse(localStorage.getItem("userInfo")).username;
  208. //获取默认选择数据
  209. const queryFormRes = ref();
  210. const routerKey = ref("salesmanData");
  211. const defaultList = ref();
  212. const pageHiddenList = ref([]); //页面不显示的数据
  213. const initDefaultList = async () => {
  214. const { data } = await api.manageApi.getSearchDefaultList({
  215. routerKey: routerKey.value,
  216. userId: phone,
  217. });
  218. listOption.queryFormFields = data.filter((e) => e.showFlag);
  219. pageHiddenList.value = data.filter((e) => !e.showFlag);
  220. defaultList.value = data.map((e) => e.id);
  221. selectedKeys.value = defaultList.value;
  222. queryFormRes.value = queryFormRef.value?.initDefaultSaveForm();
  223. queryList();
  224. };
  225. //删除
  226. const filterDialogRef = ref();
  227. const delSelect = (id) => {
  228. listOption.queryFormFields = listOption.queryFormFields.filter(
  229. (item) => item.id != id
  230. );
  231. filterDialogRef.value.initList(
  232. [...listOption.queryFormFields, ...pageHiddenList.value],
  233. defaultList.value
  234. );
  235. };
  236. //打开dialogShow
  237. const dialogShow = function () {
  238. isShow.value = true;
  239. filterDialogRef.value.initList(
  240. [...listOption.queryFormFields, ...pageHiddenList.value],
  241. defaultList.value
  242. );
  243. };
  244. //确定
  245. const queryFormRef = ref();
  246. const filterSure = (item, index) => {
  247. isShow.value = false;
  248. const secondGroupIds = item.list.map((item) => item.id);
  249. const oldList = listOption.queryFormFields.filter((item) =>
  250. secondGroupIds.includes(item.id)
  251. );
  252. const firstGroupIds = listOption.queryFormFields.map((item) => item.id);
  253. let newList = item.list.filter((item) => !firstGroupIds.includes(item.id));
  254. //过滤掉默认不显示的数据
  255. const hiddenList = new Set(pageHiddenList.value.map((item) => item.id));
  256. const filterList = newList.filter((item) => !hiddenList.has(item.id));
  257. listOption.queryFormFields = [...oldList, ...filterList];
  258. queryFormRef.value?.initDefaultSaveForm();
  259. selectedKeys.value = item.list.filter((item) => item.id);
  260. };
  261. const globalSortKey = ref("");
  262. const globalSortOrder = ref<"asc" | "desc">("asc");
  263. // 处理子组件传递的排序更新
  264. const handleSortUpdate = (sortInfo: {
  265. key: string;
  266. order: string;
  267. name: string;
  268. }) => {
  269. globalSortKey.value = sortInfo.key;
  270. globalSortOrder.value = sortInfo.order;
  271. queryList();
  272. };
  273. //查询
  274. const query = (item) => {
  275. queryFormRes.value = item;
  276. queryList();
  277. };
  278. //数据查询
  279. const tableData = ref([]);
  280. const queryList = async () => {
  281. let query = { ...queryFormRes.value };
  282. const { data } = await api.manageApi.salesmanDataPageList({
  283. pageNo: pageInfo.value.pageNum,
  284. pageSize: pageInfo.value.pageSize,
  285. routerKey: routerKey.value,
  286. userId: phone,
  287. systemCode: localStorage.getItem('login_system'),
  288. orderType: globalSortKey.value
  289. ? globalSortKey.value + " " + globalSortOrder.value
  290. : "",
  291. ...query,
  292. });
  293. tableData.value = data.records;
  294. pageInfo.value.pageNum = data.current;
  295. pageInfo.value.pageSize = data.size;
  296. pageInfo.value.total = data.total;
  297. };
  298. //分页事件
  299. function getList(item: PageInfo) {
  300. pageInfo.value.pageNum = item.pageNum;
  301. pageInfo.value.pageSize = item.pageSize;
  302. queryList();
  303. }
  304. //导出
  305. const downloadFile = async () => {
  306. let query = { ...queryFormRes.value };
  307. const { data, msg } = await api.manageApi.salesmanDataToTask({
  308. pageNo: pageInfo.value.pageNum,
  309. pageSize: pageInfo.value.pageSize,
  310. routerKey: routerKey.value,
  311. systemCode: localStorage.getItem('login_system'),
  312. userId: phone,
  313. orderType: globalSortKey.value
  314. ? globalSortKey.value + " " + globalSortOrder.value
  315. : "",
  316. ...query,
  317. });
  318. ElMessage({
  319. message: msg,
  320. type: "success",
  321. });
  322. userStore.count++;
  323. };
  324. const agreementEdit = (item) => {
  325. queryFormRes.value = queryFormRef.value?.querySelect();
  326. let query = {
  327. ...queryFormRes.value,
  328. companyId: item.companyId,
  329. partnerCompanyIds: item.partnerCompanyId,
  330. };
  331. router.push({
  332. name: "salesmanDataDetail",
  333. query: {
  334. id: id,
  335. },
  336. });
  337. };
  338. onMounted(() => {
  339. initDefaultList();
  340. });
  341. </script>
  342. <style scoped lang="scss">
  343. .log {
  344. .query-btn {
  345. margin-left: 20px;
  346. }
  347. .btn-box {
  348. padding-bottom: 15px;
  349. margin-bottom: 24px;
  350. border-bottom: 1px solid #eeeeee;
  351. display: flex;
  352. justify-content: flex-end;
  353. }
  354. }
  355. :deep(.caret-wrapper) {
  356. display: none !important;
  357. }
  358. </style>