소스 검색

现货合同: 待审核-

huangbin 4 년 전
부모
커밋
34bba9064d

+ 3 - 1
src/common/setup/table/button.ts

@@ -79,7 +79,9 @@ export function _handleBtnList_(list: OperationTabMenu | undefined, hasDetail: b
             if (!Array.isArray(result.value[index])) {
                 result.value[index] = []
             }
-            if (type === 2 && isshow) { // 按钮类型 并且显示
+            if (type === 2 && isshow && code !== 'none_btn') {
+                // 按钮类型 并且显示
+                // 当code为 none_btn, 是空按钮,(返回按钮确保数据结构统一)
                 const item = { lable: title, code, className: getClassName(code) }
                 result.value[index].push(item)
             }

+ 3 - 5
src/views/information/spot-contract/components/cancel/index.vue

@@ -23,15 +23,14 @@
 
 <script lang="ts">
 import { defineComponent, PropType, ref } from 'vue';
-import { closeModal } from '@/common/setup/modal/index';
 import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
 import { Modal } from 'ant-design-vue';
-import { orderContractOperateControl } from '@/views/information/spot-contract/components/setup';
 import { SpotContractOperateReq } from '@/services/proto/spotcontract/interface';
 import InfoDetail from '../infoDetail/index.vue';
 import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { orderContract } from '@/services/proto/spotcontract';
 import { ErmcpLoginUserEx } from '@/services/go/ermcp/account/interface';
+import { _closeModal } from '@/common/setup/modal/modal';
 
 export default defineComponent({
     name: 'spot-contract-detail',
@@ -47,7 +46,7 @@ export default defineComponent({
         },
     },
     setup(props, context) {
-        const { visible, cancel } = closeModal('spot_contract_btn_cancel');
+        const { visible, cancel } = _closeModal(context);
         const loading = ref<boolean>(false);
         const maskClosableFlag = ref<boolean>(false);
         function submit() {
@@ -64,8 +63,7 @@ export default defineComponent({
                     // Fixme 6/4 代码修改
                     // 撤销  操作类型-1:保存草稿2:提交申请3:删除4:审核通过5:审核拒绝6:撤销
                     requestResultLoadingAndInfo(orderContract, reqParam, loading, ['撤销成功', '撤销失败:']).then(() => {
-                        context.emit('refresh');
-                        cancel();
+                        cancel(true);
                     });
                 },
                 onCancel() {},

+ 18 - 26
src/views/information/spot-contract/components/check/index.vue

@@ -111,25 +111,23 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, PropType, ref, toRaw, watchEffect } from 'vue';
-import { closeModal } from '@/common/setup/modal/index';
+import { defineComponent, PropType, ref, toRaw } from 'vue';
 import { getBizTypeName, getContractStatusName, getContractTypeName, getPriceTypeName } from '@/common/constants/enumsName';
 import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
 import { formatTime, formatValue } from '@/common/methods';
-import { orderContractControl, orderContractOperateControl } from '@/views/information/spot-contract/components/setup';
 import { Modal } from 'ant-design-vue';
 import { handleForm } from './setup';
-import { GldErmcpSpotContractOperateReq, SpotContractOperateReq } from '@/services/proto/spotcontract/interface';
+import { GldErmcpSpotContractOperateReq } from '@/services/proto/spotcontract/interface';
 import { validateAction } from '@/common/setup/form';
 import { FormState } from './interface';
 import { ErmcpLoginUser } from '@/services/go/ermcp/account/interface';
 import { handlerManagerList } from '@/common/setup/user';
 import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
-import { hedgePlanReq } from '@/services/proto/hedgeplan';
-import { orderContract, spotContractStatus } from '@/services/proto/spotcontract';
+import { orderContract } from '@/services/proto/spotcontract';
 import { getUserId } from '@/services/bus/account';
 import { handlePreviewImg } from '@/common/setup/upload';
 import Detail from '../common-detail/index.vue';
+import { _closeModal } from '@/common/setup/modal/modal';
 
 export default defineComponent({
     name: 'spot-contract-detail',
@@ -142,7 +140,7 @@ export default defineComponent({
     },
     setup(props, context) {
         const loading = ref<boolean>(false);
-        const { visible, cancel } = closeModal('spot_contract_btn_check');
+        const { visible, cancel } = _closeModal(context);
         // 获取 业务账户
         const { queryTable: queryBusinessManager, getBusinesserOrMerchandiser } = handlerManagerList(loading, 1);
         const { tableList: traderList, queryTable: queryTradeManager } = handlerManagerList(loading, 2, true);
@@ -195,8 +193,7 @@ export default defineComponent({
                         // Fixme 6/9 代码修改
                         // 审核通过 GldErmcpSpotContractOperateReq 操作类型-1:保存草稿2:提交申请3:审核通过4:审核拒绝5:撤回6:正常完结7:异常终止
                         requestResultLoadingAndInfo(orderContract, reqParam, loading, ['审核通过成功', '审核失败:']).then(() => {
-                            context.emit('refresh');
-                            cancel();
+                            cancel(true);
                         });
                     },
                     onCancel() {},
@@ -218,30 +215,25 @@ export default defineComponent({
                     // Fixme 6/4 代码修改
                     // 审核拒绝  操作类型-1:保存草稿2:提交申请3:删除4:审核通过5:审核拒绝6:撤销
                     requestResultLoadingAndInfo(orderContract, reqParam, loading, ['审核拒绝成功', '审核失败:']).then(() => {
-                        context.emit('refresh');
-                        cancel();
+                        cancel(true);
                     });
                 },
                 onCancel() {},
             });
         }
-        function queryAccountList() {}
-        watchEffect(() => {
-            if (visible.value) {
-                queryBusinessManager().then(() => {
-                    businesserList.value = getBusinesserOrMerchandiser('22');
-                    merchandiserList.value = getBusinesserOrMerchandiser('23');
-                });
-                queryTradeManager();
-                const { saleuserid, tradeuserid, meruserid, remark } = props.selectedRow;
-
-                saleuserid && (formState.SaleUserID = saleuserid);
-                tradeuserid && (formState.TradeUserID = tradeuserid);
-                meruserid && (formState.MerUserID = meruserid);
 
-                formState.Remark = remark;
-            }
+        queryBusinessManager().then(() => {
+            businesserList.value = getBusinesserOrMerchandiser('22');
+            merchandiserList.value = getBusinesserOrMerchandiser('23');
         });
+        queryTradeManager();
+        const { saleuserid, tradeuserid, meruserid, remark } = props.selectedRow;
+
+        saleuserid && (formState.SaleUserID = saleuserid);
+        tradeuserid && (formState.TradeUserID = tradeuserid);
+        meruserid && (formState.MerUserID = meruserid);
+
+        formState.Remark = remark;
         return {
             visible,
             cancel,

+ 91 - 108
src/views/information/spot-contract/list/checkpending/index.vue

@@ -3,141 +3,125 @@
   <div class="spot-contract-peddding"
        :loading="loading">
     <filterCustomTable @search="updateColumn">
-      <BtnList :btnList="commonBtn" />
+      <BtnList :btnList="firstBtn"
+               @click="openComponent" />
     </filterCustomTable>
-    <contextMenu :contextMenuList="forDataBtn">
-      <a-table :columns="columns"
-               class="topTable"
-               :pagination="false"
-               rowKey="key"
-               :expandedRowKeys="expandedRowKeys"
-               :customRow="Rowclick"
-               :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> -->
+    <a-table :columns="columns"
+             class="topTable"
+             :pagination="false"
+             rowKey="key"
+             :expandedRowKeys="expandedRowKeys"
+             :customRow="Rowclick"
+             :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 #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 #saleuserid="{ record }">
-          <a>{{ findManagerName(record.saleuserid) }}</a>
-        </template>
+      </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" />
-    <!-- 现货合同: 审核 -->
-    <Check :selectedRow="selectedRow"
-           @refresh="queryTable" />
-    <!-- 现货合同: 撤销 -->
-    <Cancel :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 { AddSpotContract, SpotContractDeatil, Check, Cancel, filterCustomTable } from '../../components';
-import { queryTableList, Ermcp3ContractRsp } from '../index';
+import { filterCustomTable } from '../../components';
 import { getBizTypeName, getContractStatusName, getContractTypeName, getPriceTypeName } from '@/common/constants/enumsName';
-import { Column, ColumnType } from '@/common/setup/table';
+import { queryTableList } from '@/common/setup/table';
 import { formatTime, formatValue } from '@/common/methods';
-import { handlerManagerList } from '@/common/setup/user';
+import { queryBusinessManager, findManagerName, tableFilterCB } from '../setup';
+import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
+import { QuerySpotContract } from '@/services/go/ermcp/spot-contract';
+
+import BtnList from '@/common/components/btnList/index.vue';
+import contextMenu from '@/common/components/contextMenu/temp.vue';
+import { defineAsyncComponent, defineComponent } from 'vue';
+import { ModalEnum } from '@/common/constants/modalNameEnum';
+import { ComposeTableParam, handleComposeTable } from '@/common/setup/table/compose';
+
+const Detail = defineAsyncComponent(() => import('../../components/detail/index.vue'));
+const Check = defineAsyncComponent(() => import('../../components/check/index.vue'));
+const Cancel = defineAsyncComponent(() => import('../../components/cancel/index.vue'));
 
 export default defineComponent({
     name: 'spot-contract-peddding',
     components: {
         filterCustomTable,
         contextMenu,
-        AddSpotContract,
-        SpotContractDeatil,
-        Check,
-        Cancel,
+        [ModalEnum.detail]: Detail,
+        [ModalEnum.spot_contract_btn_check]: Check,
+        [ModalEnum.spot_contract_btn_cancel]: Cancel,
         BtnList,
     },
     setup() {
-        // 表头数据
-        const { columns, registerColumn, updateColumn } = getTableColumns();
-        // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3ContractRsp>({});
-        // 表格操作按钮列表
-        const { commonBtn, forDataBtn } = getBtnList('spot_contract_checkpending', true);
         // 表格列表数据
-        const { loading, tableList, queryTable } = queryTableList(2);
-        // 获取 业务账户
-        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: 2 });
+            // 获取 业务账户
             queryBusinessManager();
-        });
-        return {
-            columns,
+        };
+        // 表格通用逻辑
+        const param: ComposeTableParam = {
+            queryFn: queryTableAction,
+            menuType: 'spot_contract_checkpending',
+            tableName: 'table_pcweb_delivery',
+            tableFilterKey: ['contracttype', 'pricetype', 'contractno'],
+            tableFilterCB,
+            isDetail: true,
+        };
 
-            expandedRowKeys,
-            selectedRow,
-            Rowclick,
-            commonBtn,
-            forDataBtn,
+        return {
+            ...handleComposeTable<Ermcp3ContractRsp>(param),
             loading,
             tableList,
-            updateColumn,
             queryTable,
             getBizTypeName,
             getPriceTypeName,
@@ -146,7 +130,6 @@ export default defineComponent({
             formatTime,
             formatValue,
             findManagerName,
-            businessManager,
         };
     },
 });

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

@@ -1,3 +1,4 @@
+import { Column, ColumnType } from '@/common/setup/table';
 import { handlerManagerList } from '@/common/setup/user';
 import { QuerySpotContract } from '@/services/go/ermcp/spot-contract/index';
 import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
@@ -36,6 +37,23 @@ export function queryTableList(type: EnumType) {
 
 // 获取 业务账户
 const { tableList, queryTable, findManagerName } = handlerManagerList(ref<boolean>(false), 1);
-
 export { tableList as businessManager, queryTable as queryBusinessManager, findManagerName };
 
+// 表格过滤回调函数,处理特殊字段
+export const tableFilterCB = (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;
+    }
+};
+
+
+

+ 2 - 18
src/views/information/spot-contract/list/unsubmitted/index.vue

@@ -71,12 +71,11 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, _getBtnList } from '@/common/export/table';
+import { defineComponent, queryTableList, _getBtnList } from '@/common/export/table';
 import { filterCustomTable } from '../../components';
 
-import { Column, ColumnType, queryTableList } from '@/common/setup/table';
 import { formatTime, formatValue } from '@/common/methods';
-import { queryBusinessManager, findManagerName } from '../setup';
+import { queryBusinessManager, findManagerName, tableFilterCB } from '../setup';
 import { getPriceTypeName, getBizTypeName, getContractStatusName, getContractTypeName } from '@/common/constants/enumsName';
 import BtnList from '@/common/components/btnList/index.vue';
 import contextMenu from '@/common/components/contextMenu/temp.vue';
@@ -111,21 +110,6 @@ export default defineComponent({
             // 获取 业务账户
             queryBusinessManager();
         };
-        // 表格过滤回调函数,处理特殊字段
-        const tableFilterCB = (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 param: ComposeTableParam = {
             queryFn: queryTableAction,