index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <!-- 仓单贸易 -->
  3. <section class="forward-section warehouse-trade">
  4. <firstMenu :list="list"
  5. :value="'value'"
  6. @selectMenu="selectMenu" />
  7. <quoteTable :columns="columns"
  8. :dataSource="data"
  9. :contextMenuList="contextMenuList" />
  10. <div class="warehouse-trade-order">
  11. 单据
  12. </div>
  13. </section>
  14. </template>
  15. <script lang="ts">
  16. import { defineComponent, computed, reactive, ref, toRefs, unref, onMounted, onUpdated, onUnmounted, provide, inject } from 'vue';
  17. import { initData } from '@/setup/methods/index';
  18. import firstMenu from '@/components/firstMenu/index.vue';
  19. import quoteTable from '@/components/quoteTable/index.vue';
  20. import { MenuItem } from '@/components/contextMenu/interface';
  21. import orderTable from '@/components/orderTable/index.vue';
  22. const columns = [
  23. { title: 'Full Name', width: 100, dataIndex: 'name', key: 'name', fixed: 'left', align: 'center' },
  24. { title: 'Age', width: 100, dataIndex: 'age', key: 'age', fixed: 'left', align: 'center' },
  25. { title: 'Column 1', dataIndex: 'address', key: '1', width: 156, align: 'center' },
  26. { title: 'Column 2', dataIndex: 'address', key: '2', width: 156, align: 'center' },
  27. { title: 'Column 3', dataIndex: 'address', key: '3', width: 156, align: 'center' },
  28. { title: 'Column 4', dataIndex: 'address', key: '4', width: 200, align: 'center' },
  29. { title: 'Column 5', dataIndex: 'address', key: '5', width: 200, align: 'center' },
  30. { title: 'Column 6', dataIndex: 'address', key: '6', width: 200, align: 'center' },
  31. { title: 'Column 7', dataIndex: 'address', key: '7', width: 200, align: 'center' },
  32. { title: 'Column 8', dataIndex: 'address', key: '8', width: 200, align: 'center' },
  33. { title: 'Column 8', dataIndex: 'address', key: '9', width: 200, align: 'center' },
  34. { title: 'Column 8', dataIndex: 'address', key: '10', width: 200, align: 'center' },
  35. // { title: 'Column 8', dataIndex: 'address', key: '11', width: 200 , align: 'center' },
  36. // { title: 'Column 8', dataIndex: 'address', key: '12', width: 200 , align: 'center' },
  37. // { title: 'Column 8', dataIndex: 'address', key: '13', width: 200 , align: 'center' },
  38. {
  39. title: 'Action',
  40. key: 'operation',
  41. fixed: 'right',
  42. align: 'center',
  43. width: 100,
  44. slots: { customRender: 'action' },
  45. },
  46. ];
  47. interface DataItem {
  48. key: number;
  49. name: string;
  50. age: number;
  51. address: string;
  52. }
  53. const data: DataItem[] = [];
  54. for (let i = 0; i < 100; i++) {
  55. data.push({
  56. key: i,
  57. name: `Edrward ${i}`,
  58. age: 32,
  59. address: `London Park no. ${i}`,
  60. });
  61. }
  62. function handleMenu() {
  63. const list = [
  64. { key: '1', value: 'one' },
  65. { key: '2', value: 'two' },
  66. { key: '3', value: 'three' },
  67. ];
  68. function selectMenu(item: any) {
  69. console.log(item);
  70. }
  71. return { list, selectMenu };
  72. }
  73. const orderCulums = [
  74. { title: 'Column 1', dataIndex: 'address', key: '1', width: 156, align: 'center' },
  75. { title: 'Column 2', dataIndex: 'address', key: '2', width: 156, align: 'center' },
  76. { title: 'Column 3', dataIndex: 'address', key: '3', width: 156, align: 'center' },
  77. { title: 'Column 4', dataIndex: 'address', key: '4', width: 200, align: 'center' },
  78. { title: 'Column 5', dataIndex: 'address', key: '5', width: 200, align: 'center' },
  79. { title: 'Column 6', dataIndex: 'address', key: '6', width: 200, align: 'center' },
  80. { title: 'Column 7', dataIndex: 'address', key: '7', width: 200, align: 'center' },
  81. { title: 'Column 8', dataIndex: 'address', key: '8', width: 200, align: 'center' },
  82. { title: 'Column 8', dataIndex: 'address', key: '9', width: 200, align: 'center' },
  83. { title: 'Column 8', dataIndex: 'address', key: '10', width: 200, align: 'center' },
  84. { title: 'Column 8', dataIndex: 'address', key: '11', width: 200, align: 'center' },
  85. { title: 'Column 8', dataIndex: 'address', key: '12', width: 200, align: 'center' },
  86. { title: 'Column 8', dataIndex: 'address', key: '13', width: 200, align: 'center' },
  87. { title: 'Column 9', dataIndex: 'address', key: '14', width: 200, align: 'center' },
  88. { title: 'Column 9', dataIndex: 'address', key: '15', width: 200, align: 'center' },
  89. { title: 'Column 10', dataIndex: 'address', key: '16', width: 200, align: 'center' },
  90. ];
  91. export default defineComponent({
  92. name: 'forward',
  93. components: {
  94. firstMenu,
  95. quoteTable,
  96. orderTable,
  97. },
  98. setup() {
  99. initData(() => {
  100. // 加载数据在这里
  101. });
  102. const { list, selectMenu } = handleMenu();
  103. const contextMenuList = ref<MenuItem[]>([
  104. {
  105. lable: '下单',
  106. callback: () => {
  107. console.log('kkk');
  108. },
  109. },
  110. ]);
  111. return {
  112. data,
  113. columns,
  114. list,
  115. selectMenu,
  116. contextMenuList,
  117. orderCulums,
  118. };
  119. },
  120. });
  121. </script>
  122. <style lang="less">
  123. .warehouse-trade {
  124. // height: 100%;
  125. position: relative;
  126. }
  127. </style>;