index.vue 8.4 KB

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