Przeglądaj źródła

修改业务采购

huangbin 4 lat temu
rodzic
commit
c6816f8f42

+ 10 - 0
src/views/business/purchase/components/index.ts

@@ -0,0 +1,10 @@
+import Detail from './detail/index.vue';
+import filterCustomTable from './filterTable/index.vue';
+import Funds from './funds/index.vue';
+import Invoice from './invoice/index.vue';
+import Settlement from './settlement/index.vue';
+import SomePrice from './someprice/index.vue';
+import Storage from './storage/index.vue';
+
+export { Detail, SomePrice, filterCustomTable, Settlement, Funds, Invoice, Storage };
+

+ 27 - 24
src/views/business/purchase/list/all/index.vue

@@ -41,20 +41,9 @@
 </template>
 
 <script lang="ts">
-import { defineComponent } from 'vue';
-import { initData } from '@/common/methods';
-import filterCustomTable from '../../components/filterTable/index.vue';
-import { getTableList } from '../setup';
-import { getBtnList } from '@/common/setup/contextMenu/index';
-import contextMenu from '@/common/components/contextMenu/index.vue';
-import Detail from '../../components/detail/index.vue';
-import Settlement from '../../components/settlement/index.vue';
-import Funds from '../../components/funds/index.vue';
-import Invoice from '../../components/invoice/index.vue';
-import Storage from '../../components/storage/index.vue';
-import SomePrice from '../../components/someprice/index.vue';
-import BtnList from '@/common/components/buttonList/index.vue';
-import { handleTableEvent } from '@/common/setup/event/index';
+import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+import { getFilterTableCB, queryTableList, Ermcp3ContractRsp } from '../index';
+import { Detail, filterCustomTable, Settlement, Funds, Invoice, Storage, SomePrice } from '../../components';
 
 export default defineComponent({
     name: 'purchase-all',
@@ -70,23 +59,37 @@ export default defineComponent({
         BtnList,
     },
     setup() {
-        const { tableList, actionQuery, columns, filteredInfo, getColumns, search, loading } = getTableList('table_pcweb_purchase_all');
+        // 表头数据
+        const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
+        // 表格事件
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3ContractRsp>({});
+        // 表格操作按钮列表
         const { commonBtn, forDataBtn } = getBtnList('purchase_all', true);
-
+        // 表格列表数据
+        const { loading, tableList, queryTable } = queryTableList(1);
+        // 查询
+        function search(value: any) {
+            filteredInfo.value = value;
+            // 更新表信息
+            updateColumn();
+        }
         initData(() => {
-            actionQuery(1);
-            getColumns();
+            // 获取列表数据
+            queryTable();
+            // 注册表头信息 过滤
+            registerColumn('table_pcweb_purchase_all', getFilterTableCB);
         });
-
         return {
-            tableList,
-            filteredInfo,
             columns,
-            search,
-            loading,
+            filteredInfo,
+            expandedRowKeys,
+            selectedRow,
+            Rowclick,
             commonBtn,
             forDataBtn,
-            ...handleTableEvent(),
+            loading,
+            tableList,
+            search,
         };
     },
 });

+ 5 - 0
src/views/business/purchase/list/index.ts

@@ -0,0 +1,5 @@
+import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
+import { getFilterTableCB, queryTableList } from './setup';
+
+export { queryTableList, getFilterTableCB };
+export type { Ermcp3ContractRsp };

+ 27 - 20
src/views/business/purchase/list/pending/index.vue

@@ -33,16 +33,9 @@
 </template>
 
 <script lang="ts">
-import { defineComponent } from 'vue';
-import { initData } from '@/common/methods';
-import filterCustomTable from '../../components/filterTable/index.vue';
-import { getTableList } from '../setup';
-import { getBtnList } from '@/common/setup/contextMenu/index';
-import contextMenu from '@/common/components/contextMenu/index.vue';
-import Detail from '../../components/detail/index.vue';
-import SomePrice from '../../components/someprice/index.vue';
-import BtnList from '@/common/components/buttonList/index.vue';
-import { handleTableEvent } from '@/common/setup/event/index';
+import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+import { getFilterTableCB, queryTableList, Ermcp3ContractRsp } from '../index';
+import { Detail, SomePrice, filterCustomTable } from '../../components';
 
 export default defineComponent({
     name: 'purchase-peddding',
@@ -54,23 +47,37 @@ export default defineComponent({
         BtnList,
     },
     setup() {
-        const { tableList, actionQuery, columns, filteredInfo, getColumns, search, loading } = getTableList('table_pcweb_purchase_pointprice');
+        // 表头数据
+        const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
+        // 表格事件
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3ContractRsp>({});
+        // 表格操作按钮列表
         const { commonBtn, forDataBtn } = getBtnList('purchase_pending', true);
-
+        // 表格列表数据
+        const { loading, tableList, queryTable } = queryTableList(2);
+        // 查询
+        function search(value: any) {
+            filteredInfo.value = value;
+            // 更新表信息
+            updateColumn();
+        }
         initData(() => {
-            actionQuery(2);
-            getColumns();
+            // 获取列表数据
+            queryTable();
+            // 注册表头信息 过滤
+            registerColumn('table_pcweb_purchase_pointprice', getFilterTableCB);
         });
-
         return {
-            tableList,
-            filteredInfo,
             columns,
-            search,
-            loading,
+            filteredInfo,
+            expandedRowKeys,
+            selectedRow,
+            Rowclick,
             commonBtn,
             forDataBtn,
-            ...handleTableEvent(),
+            loading,
+            tableList,
+            search,
         };
     },
 });

+ 27 - 23
src/views/business/purchase/list/performance/index.vue

@@ -39,19 +39,9 @@
 </template>
 
 <script lang="ts">
-import { defineComponent } from 'vue';
-import { initData } from '@/common/methods';
-import filterCustomTable from '../../components/filterTable/index.vue';
-import { getTableList } from '../setup';
-import { getBtnList } from '@/common/setup/contextMenu/index';
-import contextMenu from '@/common/components/contextMenu/index.vue';
-import Detail from '../../components/detail/index.vue';
-import Settlement from '../../components/settlement/index.vue';
-import Funds from '../../components/funds/index.vue';
-import Invoice from '../../components/invoice/index.vue';
-import Storage from '../../components/storage/index.vue';
-import BtnList from '@/common/components/buttonList/index.vue';
-import { handleTableEvent } from '@/common/setup/event/index';
+import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+import { getFilterTableCB, queryTableList, Ermcp3ContractRsp } from '../index';
+import { Detail, filterCustomTable, Settlement, Funds, Invoice, Storage } from '../../components';
 
 export default defineComponent({
     name: 'purchase-performance',
@@ -66,23 +56,37 @@ export default defineComponent({
         BtnList,
     },
     setup() {
-        const { tableList, actionQuery, columns, filteredInfo, getColumns, search, loading } = getTableList('table_pcweb_purchase_settle');
+        // 表头数据
+        const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
+        // 表格事件
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3ContractRsp>({});
+        // 表格操作按钮列表
         const { commonBtn, forDataBtn } = getBtnList('purchase_performance', true);
-
+        // 表格列表数据
+        const { loading, tableList, queryTable } = queryTableList(3);
+        // 查询
+        function search(value: any) {
+            filteredInfo.value = value;
+            // 更新表信息
+            updateColumn();
+        }
         initData(() => {
-            actionQuery(3);
-            getColumns();
+            // 获取列表数据
+            queryTable();
+            // 注册表头信息 过滤
+            registerColumn('table_pcweb_purchase_settle', getFilterTableCB);
         });
-
         return {
-            tableList,
-            filteredInfo,
             columns,
-            search,
-            loading,
+            filteredInfo,
+            expandedRowKeys,
+            selectedRow,
+            Rowclick,
             commonBtn,
             forDataBtn,
-            ...handleTableEvent(),
+            loading,
+            tableList,
+            search,
         };
     },
 });

+ 42 - 58
src/views/business/purchase/list/setup.ts

@@ -1,61 +1,21 @@
-import { ColumnType, getTableHead } from '@/common/methods/table';
-import { TableKey } from '@/common/methods/table/interface';
+import { Column, ColumnType } from '@/common/setup/table/index';
 import { QueryPurchase } from '@/services/go/ermcp/purchase/index';
 import { Ermcp3SellBuyContract, Querytype } from '@/services/go/ermcp/purchase/interface';
 import { message } from 'ant-design-vue';
 import { ref } from 'vue';
 
-// 列表
-export function getTableList(tableKey: keyof TableKey) {
+/**
+ * 获取表格列表数据
+ * @param type 
+ * @returns 
+ */
+export function queryTableList(type: Querytype) {
+    // 加载状态
+    const loading = ref<boolean>(false);
     // 表格数据
     const tableList = ref<Ermcp3SellBuyContract[]>([]);
-    // 表头数据
-    const columns = ref<ColumnType[]>([]);
-    // 过滤项
-    const filteredInfo = ref();
-    const loading = ref<boolean>(false);
-    // 获取表头
-    function getColumns() {
-        const list = getTableHead(tableKey);
-        const filtered = filteredInfo.value || {};
-        columns.value.length = 0;
-        list.forEach((e, i) => {
-            const { columnfield, columntitle, aligntype } = e;
-            const item: ColumnType = {
-                key: String(i),
-                dataIndex: columnfield, // 表格数据对应的key
-                title: columntitle,
-                align: aligntype === 1 ? 'center' : aligntype === 2 ? 'left' : 'right',
-                slots: { customRender: columnfield },
-            };
-            // // 以下添加过滤数据对应的方法
-            if (e.columnfield === 'accountname') {
-                item.onFilter = (value: string, record: Ermcp3SellBuyContract) => record.accountname.includes(value);
-                item.filteredValue = filtered.accountname || null;
-            }
-            if (e.columnfield === 'contractno') {
-                item.onFilter = (value: string, record: Ermcp3SellBuyContract) => record.contractno.includes(value);
-                item.filteredValue = filtered.contractno || null;
-            }
-            if (e.columnfield === 'deliverygoodsname') {
-                item.onFilter = (value: string, record: Ermcp3SellBuyContract) => record.deliverygoodsname.includes(value);
-                item.filteredValue = filtered.deliverygoodsname || null;
-            }
-            if (e.columnfield === 'convertfactor') {
-                item.onFilter = (value: string, record: Ermcp3SellBuyContract) => String(record.convertfactor).includes(value);
-                item.filteredValue = filtered.convertfactor || null;
-            }
-            if (e.columnfield === 'goodsname') {
-                item.onFilter = (value: string, record: Ermcp3SellBuyContract) => record.goodsname.includes(value);
-                item.filteredValue = filtered.goodsname || null;
-            }
-            columns.value.push(item);
-        });
-    }
-    // 查询列表
-    function actionQuery(querytype: Querytype) {
-        loading.value = true;
-        QueryPurchase({ querytype })
+    function queryTable() {
+        QueryPurchase({ querytype: type })
             .then((res) => {
                 tableList.value = res.map((e, i) => {
                     return { ...e, key: String(i) };
@@ -68,11 +28,35 @@ export function getTableList(tableKey: keyof TableKey) {
                 loading.value = false;
             });
     }
-    // 查询
-    function search(value: any) {
-        filteredInfo.value = value;
-        getColumns();
-    }
+    return { loading, tableList, queryTable }
+}
 
-    return { tableList, actionQuery, columns, filteredInfo, getColumns, search, loading, };
-}
+/**
+ * 过滤表格的回调函数
+ * @param e 
+ * @param item 
+ * @param filtered 
+ */
+export function getFilterTableCB(e: Column, item: ColumnType, filtered: any) {
+    // // 以下添加过滤数据对应的方法
+    if (e.columnfield === 'accountname') {
+        item.onFilter = (value: string, record: Ermcp3SellBuyContract) => record.accountname.includes(value);
+        item.filteredValue = filtered.accountname || null;
+    }
+    if (e.columnfield === 'contractno') {
+        item.onFilter = (value: string, record: Ermcp3SellBuyContract) => record.contractno.includes(value);
+        item.filteredValue = filtered.contractno || null;
+    }
+    if (e.columnfield === 'deliverygoodsname') {
+        item.onFilter = (value: string, record: Ermcp3SellBuyContract) => record.deliverygoodsname.includes(value);
+        item.filteredValue = filtered.deliverygoodsname || null;
+    }
+    if (e.columnfield === 'convertfactor') {
+        item.onFilter = (value: string, record: Ermcp3SellBuyContract) => String(record.convertfactor).includes(value);
+        item.filteredValue = filtered.convertfactor || null;
+    }
+    if (e.columnfield === 'goodsname') {
+        item.onFilter = (value: string, record: Ermcp3SellBuyContract) => record.goodsname.includes(value);
+        item.filteredValue = filtered.goodsname || null;
+    }
+}

+ 0 - 1
src/views/information/spot-contract/list/checkpending/index.vue

@@ -58,7 +58,6 @@ export default defineComponent({
         const { loading, tableList, queryTable } = queryTableList(2);
         // 查询
         function search(value: any) {
-            debugger;
             filteredInfo.value = value;
             // 更新表信息
             updateColumn();

+ 0 - 1
src/views/information/spot-contract/list/finished/index.vue

@@ -55,7 +55,6 @@ export default defineComponent({
         const { loading, tableList, queryTable } = queryTableList(4);
         // 查询
         function search(value: any) {
-            debugger;
             filteredInfo.value = value;
             // 更新表信息
             updateColumn();

+ 0 - 1
src/views/information/spot-contract/list/performance/index.vue

@@ -56,7 +56,6 @@ export default defineComponent({
         const { loading, tableList, queryTable } = queryTableList(3);
         // 查询
         function search(value: any) {
-            debugger;
             filteredInfo.value = value;
             // 更新表信息
             updateColumn();

+ 0 - 1
src/views/information/spot-contract/list/setup.ts

@@ -1,4 +1,3 @@
-// import { ColumnType, getTableHead } from '@/common/methods/table';
 import { Column, ColumnType } from '@/common/setup/table/index';
 import { QuerySpotContract } from '@/services/go/ermcp/spot-contract/index';
 import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';

+ 0 - 1
src/views/information/spot-contract/list/unsubmitted/index.vue

@@ -64,7 +64,6 @@ export default defineComponent({
         const { loading, tableList, queryTable } = queryTableList(1);
         // 查询
         function search(value: any) {
-            debugger;
             filteredInfo.value = value;
             // 更新表信息
             updateColumn();