table.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. exports function getTableTemplete(e) {
  2. return `
  3. <template>
  4. <!-- ${e.title} -->
  5. <div class="${e.code}">
  6. <Filter @search="updateColumn" />
  7. <a-table :columns="columns"
  8. class="srcollYTable"
  9. :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }"
  10. :pagination="false"
  11. :expandedRowKeys="expandedRowKeys"
  12. :customRow="Rowclick"
  13. rowKey="key"
  14. :data-source="tableList">
  15. </a-table>
  16. <ControlModal :selectedRow="selectedRow"
  17. @refresh="getData" />
  18. <component :is="componentId"></component>
  19. </div>
  20. </template>
  21. <script lang="ts">
  22. import { defineComponent, initData, getTableColumns, getTableEvent, contextMenu, BtnList, _getBtnList, queryTableList } from '@/common/export/table';
  23. export default defineComponent({
  24. name: '${e.code}',
  25. components: { Filter, contextMenu, BtnList, ControlModal },
  26. setup() {
  27. // 表头数据
  28. const { columns, registerColumn, updateColumn } = getTableColumns();
  29. // 表格操作按钮列表
  30. const [firstBtn] = _getBtnList('platinum_pick_query_tab', true).value;
  31. const btnList = ref<BtnListType[]>([]);
  32. const event: TableEventCB = {
  33. contextmenuCB: (record: QhjTradeGoodsPickup) => {
  34. btnList.value = handleTableList(firstBtn, record);
  35. },
  36. };
  37. // 表格事件
  38. const { expandedRowKeys, selectedRow, Rowclick, btnClick } = getTableEvent<QhjTradeGoodsPickup>(event);
  39. // 表格列表数据
  40. const { loading, tableList, queryTable } = queryTableList<QhjTradeGoodsPickup>();
  41. function getData() {
  42. // 获取列表数据
  43. queryTable(queryTradeGoodsPickup).then((res) => {
  44. tableList.value = res.map((el) => {
  45. return { ...el, key: String(el.takeorderid) };
  46. });
  47. });
  48. }
  49. // 1:备货中 完成备货
  50. // 2:待取货(自提) 确认取货
  51. // 4:待收货(邮寄) 上传物流信息、确认收货
  52. initData(() => {
  53. // 获取列表数据
  54. getData();
  55. // 注册表头信息 过滤
  56. registerColumn('table_pcweb_qhj_pickup_query', ['reqtime', 'pickupgoodsname', 'takeorderstatus', 'goodsname']);
  57. });
  58. return {
  59. btnList,
  60. columns,
  61. getData,
  62. updateColumn,
  63. expandedRowKeys,
  64. selectedRow,
  65. Rowclick,
  66. firstBtn,
  67. loading,
  68. tableList,
  69. queryTable,
  70. btnClick,
  71. getPickUpStateName,
  72. getTakeStateName,
  73. handleTableList,
  74. };
  75. },
  76. });
  77. </script >
  78. `;
  79. }