index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <!-- 客户资料 -->
  3. <div class="plan_uncommitted"
  4. :loading="loading">
  5. <Filter @search="updateColumn">
  6. <mtp-table-button class="btn-list-sticky"
  7. :buttons="addButton"
  8. @click="openComponent" />
  9. </Filter>
  10. <a-table :columns="getColumns(columns)"
  11. class="srcollYTable"
  12. :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }"
  13. :pagination="false"
  14. :loading="loading"
  15. :expandedRowKeys="expandedRowKeys"
  16. :customRow="Rowclick"
  17. rowKey="key"
  18. :data-source="tableList">
  19. <!-- 额外的展开行 -->
  20. <template #expandedRowRender="{ record }">
  21. <mtp-table-button class="btn-list-sticky"
  22. :buttons="handleBtnList(buttons,record)"
  23. :record="record"
  24. @click="openComponent" />
  25. </template>
  26. <template #status="{ text }">
  27. <a>{{ getStatusName(text) }}</a>
  28. </template>
  29. <template #customername="{record}">
  30. {{record.username}}
  31. </template>
  32. <template #nickname="{record}">
  33. {{record.username}}
  34. </template>
  35. <template #userinfotype="{ text }">
  36. <a>{{ getUserInfoTypeName(text) }}</a>
  37. </template>
  38. <template #attachment1="{ text, record }">
  39. <a>{{ text }}</a><a>{{ record.attachment2 }}</a>
  40. </template>
  41. <template #cardtype="{ text }">
  42. <a>{{ getCardTypeEnumItemName(text) }}</a>
  43. </template>
  44. </a-table>
  45. <!-- 右键 -->
  46. <contextMenu :contextMenu="contextMenu"
  47. @cancel="closeContext"
  48. :list="buttons"> </contextMenu>
  49. <component :is="componentId"
  50. v-if="componentId"
  51. :selectedRow="selectedRow"
  52. @cancel="closeComponent"> </component>
  53. </div>
  54. </template>
  55. <script lang="ts">
  56. import { isPingAnOem, isQianHaiJin } from '@/common/config/projectName';
  57. import { EnumRouterName } from '@/common/constants/enumRouterName';
  58. import { ComposeTableParam, contextMenu, defineAsyncComponent, defineComponent, handleComposeTable, MtpTableButton, queryTableList, useRouteName } from '@/common/export/commonTable';
  59. import { getTableButton } from '@/common/setup/table/button';
  60. import { QueryCustomInfo } from '@/services/go/ermcp/customInfo';
  61. import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
  62. import { getUserInfoTypeName, getStatusName, getCardTypeEnumItemName } from '@/common/constants/enumsName';
  63. import Filter from './compoments/filterTable/index.vue';
  64. import { pingan_custom_column, qian_hai_jin_custom_column } from './setup';
  65. import { ColumnType } from '@/common/methods/table';
  66. import { getTableColumns } from '@/common/setup/table';
  67. import { BtnListType } from '@/common/components/btnList/interface';
  68. import { queryCustomerInfo } from '@/services/go/ermcp/qhj';
  69. import { getUserId } from '@/services/bus/user';
  70. import { QhjCustomer } from '@/services/go/ermcp/qhj/interface';
  71. export default defineComponent({
  72. name: EnumRouterName.plan_audit,
  73. components: {
  74. contextMenu,
  75. MtpTableButton,
  76. Filter,
  77. detail: defineAsyncComponent(() => import('./compoments/detail/index.vue')), // 详情
  78. add: defineAsyncComponent(() => import('./compoments/add/index.vue')), // 新增
  79. check: defineAsyncComponent(() => import('./compoments/check/index.vue')), // 审核
  80. delete: defineAsyncComponent(() => import('./compoments/delete/index.vue')), // 删除
  81. modify: defineAsyncComponent(() => import('./compoments/add/index.vue')), // 修改
  82. recover: defineAsyncComponent(() => import('./compoments/recover/index.vue')), // 恢复
  83. disable: defineAsyncComponent(() => import('./compoments/disable/index.vue')), // 停用
  84. cancel: defineAsyncComponent(() => import('./compoments/cancel/index.vue')), // 撤销
  85. },
  86. setup() {
  87. const { isRouterName } = useRouteName();
  88. // 新增权限按钮
  89. const addButton = getTableButton(['add']);
  90. // 表格权限按钮
  91. const buttons = getTableButton(['add'], true);
  92. // 表格列表数据
  93. const { loading, tableList, queryTable } = queryTableList<QhjCustomer>();
  94. // 获取列表数据
  95. const queryTableAction = () => {
  96. const userid = getUserId();
  97. if (isRouterName('custom_checkpending')) {
  98. // 待审核
  99. queryTable(queryCustomerInfo, { userid, querytype: 2 });
  100. } else if (isRouterName('custom_normal')) {
  101. // 正常
  102. queryTable(queryCustomerInfo, { userid, querytype: 3 });
  103. } else if (isRouterName('custom_disabled')) {
  104. // 停用
  105. queryTable(queryCustomerInfo, { userid, querytype: 4 });
  106. }
  107. };
  108. // 处理根据状态显示对应按钮
  109. const handleBtnList = (btnList: BtnListType[], item: QhjCustomer) => {
  110. switch (item.status) {
  111. case 2: // 待审核
  112. return btnList.filter((e) => e.code !== 'modify');
  113. case 5: // 拒绝审核
  114. return btnList.filter((e) => e.code !== 'check');
  115. default:
  116. return btnList;
  117. }
  118. };
  119. // 表头
  120. const getColumns = (columns: ColumnType[]) => {
  121. if (isPingAnOem()) {
  122. // 平安
  123. return pingan_custom_column();
  124. } else if (isQianHaiJin()) {
  125. // 千海金
  126. return qian_hai_jin_custom_column();
  127. } else {
  128. return columns;
  129. }
  130. };
  131. // 表格通用逻辑
  132. const param: ComposeTableParam = {
  133. queryFn: queryTableAction,
  134. menuType: EnumRouterName.plan_audit,
  135. tableName: 'table_pcweb_userinfo',
  136. tableFilterKey: ['userinfotype', 'nickname', 'customername', 'mobile'],
  137. isDetail: true,
  138. };
  139. return {
  140. ...handleComposeTable<QhjCustomer>(param),
  141. loading,
  142. tableList,
  143. getStatusName,
  144. buttons,
  145. addButton,
  146. getUserInfoTypeName,
  147. getCardTypeEnumItemName,
  148. getColumns,
  149. handleBtnList,
  150. };
  151. },
  152. });
  153. </script>