index.vue 5.3 KB

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