index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <!-- 现货查询: 购销计划-->
  3. <div class="search-plan" :loading="loading">
  4. <filterCustomTable @search="updateColumn"></filterCustomTable>
  5. <a-table :columns="columns" class="srcollYTable" :pagination="false" rowKey="key" :expandedRowKeys="expandedRowKeys" :customRow="Rowclick" :data-source="tableList" :scroll="{ x: 'calc(100% - 160px)', y: 'calc(100vh - 163px)' }">
  6. <template #index="{ index }">
  7. <span>{{ index + 1 }}</span>
  8. </template>
  9. </a-table>
  10. <component :is="componentId" v-if="componentId" :selectedRow="selectedRow" @cancel="closeComponent"></component>
  11. </div>
  12. </template>
  13. <script lang="ts">
  14. import { queryTableList, MtpTableButton, defineComponent, handleComposeTable, ComposeTableParam } from '@/common/export/commonTable';
  15. import filterCustomTable from './components/filter/index.vue';
  16. import { formatTime, formatValue } from '@/common/methods';
  17. import { columns } from './setup';
  18. import { Ermcp3HedgePlan } from '@/services/go/ermcp/plan/interface';
  19. import { QueryHedgePlan } from '@/services/go/ermcp/plan';
  20. import { EnumRouterName } from '@/common/constants/enumRouterName';
  21. import moment from 'moment';
  22. export default defineComponent({
  23. name: 'search-plan',
  24. components: {
  25. filterCustomTable,
  26. MtpTableButton,
  27. },
  28. setup() {
  29. // 表格列表数据
  30. const { loading, tableList, queryTable } = queryTableList<Ermcp3HedgePlan>();
  31. // 获取列表数据
  32. const queryTableAction = () => queryTable(QueryHedgePlan, '2,3').then((res) => {
  33. // 执行中在上面, 完结的排在下面, 执行中的, 按照单号或者时间,进行倒序排列
  34. tableList.value = []
  35. tableList.value = res.sort((a, b) => {
  36. if (a.hedgeplanstatus !== b.hedgeplanstatus) {
  37. return a.hedgeplanstatus - b.hedgeplanstatus
  38. }
  39. return moment(b.createtime).valueOf() - moment(a.createtime).valueOf()
  40. })
  41. });
  42. // 表格通用逻辑
  43. const param: ComposeTableParam = {
  44. queryFn: queryTableAction,
  45. menuType: EnumRouterName.spot_contract_checkpending,
  46. tableName: 'table_pcweb_hedging_plan',
  47. tableFilterKey: ['contracttype', 'hedgeplanno', 'deliverygoodsname'],
  48. isDetail: true,
  49. };
  50. return {
  51. ...handleComposeTable<Ermcp3HedgePlan>(param),
  52. loading,
  53. tableList,
  54. queryTable,
  55. formatTime,
  56. formatValue,
  57. columns,
  58. };
  59. },
  60. });
  61. </script>