Bläddra i källkod

现货合同: 已完成-

huangbin 4 år sedan
förälder
incheckning
f4e22a21ac
1 ändrade filer med 86 tillägg och 99 borttagningar
  1. 86 99
      src/views/information/spot-contract/list/finished/index.vue

+ 86 - 99
src/views/information/spot-contract/list/finished/index.vue

@@ -3,133 +3,121 @@
   <div class="spot-contract-done">
     <filterCustomTable @search="updateColumn"
                        :loading="loading">
-      <BtnList :btnList="commonBtn" />
+      <BtnList :btnList="firstBtn"
+               @click="openComponent" />
     </filterCustomTable>
-    <contextMenu :contextMenuList="forDataBtn">
-      <a-table :columns="columns"
-               class="topTable"
-               :pagination="false"
-               :expandedRowKeys="expandedRowKeys"
-               :customRow="Rowclick"
-               rowKey="key"
-               :data-source="tableList"
-               :scroll="{ x: 'calc(100% - 180px)', y: 'calc(100vh - 163px)' }">
-        <!-- 额外的展开行 -->
-        <template #expandedRowRender="{  }">
-          <BtnList :btnList="forDataBtn" />
-        </template>
-        <!-- <template #userinfotype="{ text }">
-                  <a>{{ text === '2' ? '企业' : '个人'}}</a>
-                </template> -->
-        <template #biztype="{ text }">
-          <a>{{ getBizTypeName(text) }}</a>
-        </template>
+    <a-table :columns="columns"
+             class="topTable"
+             :pagination="false"
+             :expandedRowKeys="expandedRowKeys"
+             :customRow="Rowclick"
+             rowKey="key"
+             :data-source="tableList"
+             :scroll="{ x: 'calc(100% - 180px)', y: 'calc(100vh - 163px)' }">
+      <!-- 额外的展开行 -->
+      <template #expandedRowRender="{ record }">
+        <BtnList :btnList="secondBtn"
+                 :record="record"
+                 @click="openComponent" />
+      </template>
+      <template #biztype="{ text }">
+        <a>{{ getBizTypeName(text) }}</a>
+      </template>
 
-        <template #pricetype="{ text }">
-          <a>{{ getPriceTypeName(text) }}</a>
-        </template>
+      <template #pricetype="{ text }">
+        <a>{{ getPriceTypeName(text) }}</a>
+      </template>
 
-        <template #contracctstatus="{ text }">
-          <a>{{ getContractStatusName(text) }}</a>
-        </template>
+      <template #contracctstatus="{ text }">
+        <a>{{ getContractStatusName(text) }}</a>
+      </template>
 
-        <template #contracttype="{ text }">
-          <a>{{ getContractTypeName(text) }}</a>
-        </template>
-        <!-- 对手方 -->
-        <template #negative="{ record }">
-          <a>{{ record.contracttype === 1 ? record.sellusername : record.buyusername }}</a>
-        </template>
-        <template #startdate="{ record }">
-          <a>{{ formatValue(formatTime(record.startdate, "d") + '--' + formatTime(record.enddate, "d")) }}</a>
-        </template>
-        <!-- 交收期 -->
-        <template #deliverystartdate="{ record }">
-          <a>{{ formatValue(formatTime(record.deliverystartdate, "d") + '--' +
+      <template #contracttype="{ text }">
+        <a>{{ getContractTypeName(text) }}</a>
+      </template>
+      <!-- 对手方 -->
+      <template #negative="{ record }">
+        <a>{{ record.contracttype === 1 ? record.sellusername : record.buyusername }}</a>
+      </template>
+      <template #startdate="{ record }">
+        <a>{{ formatValue(formatTime(record.startdate, "d") + '--' + formatTime(record.enddate, "d")) }}</a>
+      </template>
+      <!-- 交收期 -->
+      <template #deliverystartdate="{ record }">
+        <a>{{ formatValue(formatTime(record.deliverystartdate, "d") + '--' +
                         formatTime(record.deliveryenddate, "d")) }}</a>
-        </template>
+      </template>
 
-        <!-- 业务员 -->
-        <template #saleuserid="{ record }">
-          <a>{{ findManagerName(record.saleuserid) }}</a>
-        </template>
+      <!-- 业务员 -->
+      <template #saleuserid="{ record }">
+        <a>{{ findManagerName(record.saleuserid) }}</a>
+      </template>
 
-        <!-- 跟单员 -->
-        <template #meruserid="{ record }">
-          <a>{{ findManagerName(record.meruserid) }}</a>
-        </template>
+      <!-- 跟单员 -->
+      <template #meruserid="{ record }">
+        <a>{{ findManagerName(record.meruserid) }}</a>
+      </template>
 
-      </a-table>
+    </a-table>
+    <!-- 右键 -->
+    <contextMenu :contextMenu="contextMenu"
+                 @cancel="closeContext"
+                 :list="secondBtn">
     </contextMenu>
-    <!-- 现货合同: 详情 -->
-    <SpotContractDeatil :selectedRow="selectedRow"
-                        :businessManager="businessManager"
-                        @refresh="queryTable" />
+    <component :is="componentId"
+               v-if="componentId"
+               :selectedRow="selectedRow"
+               @cancel="closeComponent"></component>
   </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
-import { SpotContractDeatil, filterCustomTable } from '../../components';
+import { defineComponent, queryTableList, _getBtnList } from '@/common/export/table';
+import { queryBusinessManager, findManagerName, tableFilterCB } from '../setup';
 
-import { queryTableList, Ermcp3ContractRsp } from '../index';
 import { getBizTypeName, getContractStatusName, getContractTypeName, getPriceTypeName } from '@/common/constants/enumsName';
-import { Column, ColumnType } from '@/common/setup/table';
 import { formatTime, formatValue } from '@/common/methods';
-import { handlerManagerList } from '@/common/setup/user';
+
+import BtnList from '@/common/components/btnList/index.vue';
+import contextMenu from '@/common/components/contextMenu/temp.vue';
+import { defineAsyncComponent } from 'vue';
+import { ModalEnum } from '@/common/constants/modalNameEnum';
+import { ComposeTableParam, handleComposeTable } from '@/common/setup/table/compose';
+import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
+import { QuerySpotContract } from '@/services/go/ermcp/spot-contract';
+
+const Detail = defineAsyncComponent(() => import('../../components/detail/index.vue'));
 
 export default defineComponent({
     name: 'spot-contract-done',
     components: {
-        filterCustomTable,
         contextMenu,
-        SpotContractDeatil,
         BtnList,
+        [ModalEnum.detail]: Detail,
     },
     setup() {
-        // 表头数据
-        const { columns, registerColumn, updateColumn } = getTableColumns();
-        // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3ContractRsp>({});
-        // 表格操作按钮列表
-        const { commonBtn, forDataBtn } = getBtnList('spot_contract_finished', true);
         // 表格列表数据
-        const { loading, tableList, queryTable } = queryTableList(4);
-
-        // 获取 业务账户
-        const { tableList: businessManager, queryTable: queryBusinessManager, findManagerName } = handlerManagerList(loading, 1);
-
-        initData(() => {
-            // 获取列表数据
-            queryTable();
-            // 注册表头信息 过滤
-            registerColumn('table_pcweb_delivery', ['contracttype', 'pricetype', 'contractno'], (e: Column, item: ColumnType, filtered: any) => {
-                if (e.columntitle === '对手方') {
-                    item.onFilter = (value: string, record: Ermcp3ContractRsp) => {
-                        if (record.contracttype === 1) {
-                            //采购方
-                            return record.sellusername.includes(value);
-                        } else {
-                            // 销售
-                            return record.buyusername.includes(value);
-                        }
-                    };
-                    item.filteredValue = filtered.negative || null;
-                }
-            });
+        const { loading, tableList, queryTable } = queryTableList<Ermcp3ContractRsp>();
+        // 获取列表数据
+        const queryTableAction = () => {
+            queryTable(QuerySpotContract, { querytype: 4 });
+            // 获取 业务账户
             queryBusinessManager();
-        });
-        return {
-            columns,
+        };
+        // 表格通用逻辑
+        const param: ComposeTableParam = {
+            queryFn: queryTableAction,
+            menuType: 'spot_contract_finished',
+            tableName: 'table_pcweb_delivery',
+            tableFilterKey: ['contracttype', 'pricetype', 'contractno'],
+            tableFilterCB,
+            isDetail: true,
+        };
 
-            expandedRowKeys,
-            selectedRow,
-            Rowclick,
-            commonBtn,
-            forDataBtn,
+        return {
+            ...handleComposeTable<Ermcp3ContractRsp>(param),
             loading,
             tableList,
-            updateColumn,
             getBizTypeName,
             getPriceTypeName,
             getContractStatusName,
@@ -137,7 +125,6 @@ export default defineComponent({
             formatTime,
             formatValue,
             findManagerName,
-            businessManager,
         };
     },
 });