index.vue 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <!-- 套期交易:未关联采购合同-未关联购销计划 -->
  3. <mtp-table-scroll>
  4. <template #header>
  5. <Filter @search="updateColumn"></Filter>
  6. </template>
  7. <template #default="{ scroll }">
  8. <a-table :columns="columns" class="srcollYTable" :pagination="false" :loading="loading"
  9. :expandedRowKeys="expandedRowKeys" :customRow="Rowclick" :rowKey="(record, index) => index"
  10. :data-source="tableList" :scroll="scroll">
  11. <template #expandedRowRender="{ record }">
  12. <mtp-table-button class="btn-list-sticky" :buttons="auth" :record="record" @click="openComponent" />
  13. </template>
  14. <!-- 类型 -->
  15. <template #contracttype="{ text }">
  16. <a>{{ getPlanContractType(text) }}</a>
  17. </template>
  18. <!-- 状态 -->
  19. <template #hedgeplanstatus="{ text }">
  20. <a>{{ getPlanStatusName(text) }}</a>
  21. </template>
  22. </a-table>
  23. </template>
  24. </mtp-table-scroll>
  25. <!-- 右键 -->
  26. <contextMenu :contextMenu="contextMenu" @cancel="closeContext" :list="auth"> </contextMenu>
  27. <component :is="componentId" v-if="componentId" :selectedRow="selectedRow" @cancel="closeComponent"></component>
  28. </template>
  29. <script lang="ts">
  30. import { queryTableList, contextMenu, defineComponent, MtpTableButton, defineAsyncComponent, handleComposeTable } from '@/common/export/commonTable'
  31. import { UnLinkErmcpHedgePlanReq, UnLinkErmcpHedgePlanRsp } from '@/services/go/ermcp/hedgedItem/interface'
  32. import { queryUnLinkErmcpHedgePlan } from '@/services/go/ermcp/hedgedItem'
  33. import { getPlanStatusName } from '@/views/business/plan/setup'
  34. import { getPlanContractType } from '@/views/business/plan/setup'
  35. import { useMenu } from '@/@next/hooks/common'
  36. import { getAreaUserId } from '@/services/bus/user'
  37. import MtpTableScroll from '@/common/components/tableScroll/index.vue'
  38. import Filter from './components/filter/index.vue';
  39. export default defineComponent({
  40. components: {
  41. MtpTableScroll,
  42. Filter,
  43. MtpTableButton,
  44. contextMenu,
  45. detail: defineAsyncComponent(() => import('@/views/business/plan/components/detail/index.vue')), // 详情
  46. bind: defineAsyncComponent(() => import('./components/bind/index.vue')), // 关联项目
  47. },
  48. setup() {
  49. const { auth } = useMenu();
  50. const { loading, tableList, queryTable } = queryTableList<UnLinkErmcpHedgePlanRsp>(true, 2); // 表格列表数据
  51. const queryFn = () => {
  52. const param: UnLinkErmcpHedgePlanReq = {
  53. areauserid: getAreaUserId(),
  54. }
  55. queryTable(queryUnLinkErmcpHedgePlan, param);
  56. }
  57. // 表格通用逻辑
  58. const composeTable = handleComposeTable<UnLinkErmcpHedgePlanRsp>({
  59. queryFn,
  60. tableName: 'table_pcweb_hedgeditem_spot_plan',
  61. })
  62. return {
  63. ...composeTable,
  64. loading,
  65. tableList,
  66. auth,
  67. getPlanStatusName,
  68. getPlanContractType,
  69. }
  70. }
  71. })
  72. </script>