Browse Source

修改协议管理

huangbin 4 years ago
parent
commit
1463b0ba05

+ 1 - 0
src/common/components/btnList/index.vue

@@ -27,6 +27,7 @@ export default defineComponent({
     },
     },
     setup(props, context) {
     setup(props, context) {
         function onClick(item: BtnList) {
         function onClick(item: BtnList) {
+            console.log(`${item.lable}:${item.code}`);
             context.emit('click', item, props.record);
             context.emit('click', item, props.record);
         }
         }
         return { onClick };
         return { onClick };

+ 3 - 4
src/common/components/contextMenu/temp.vue

@@ -35,12 +35,11 @@ export default defineComponent({
     },
     },
     setup(props, context) {
     setup(props, context) {
         function choose(item: BtnList) {
         function choose(item: BtnList) {
-            console.log(item);
-            context.emit('update', item);
-            // fn && fn(props.contextMenu.selectedData);
+            console.log(`${item.lable}:${item.code}`);
+            context.emit('cancel', item);
         }
         }
         function close() {
         function close() {
-            context.emit('cancel');
+            context.emit('cancel', null);
         }
         }
         const styleParam = reactive<{ left: string; top: string }>({ left: '0px', top: '0px' });
         const styleParam = reactive<{ left: string; top: string }>({ left: '0px', top: '0px' });
         watchEffect(() => {
         watchEffect(() => {

+ 2 - 2
src/common/setup/asyncComponent/index.ts

@@ -8,7 +8,7 @@ export function handleModalComponent<T>(callback: Function, selectedRow: Ref<T>)
      * 关闭组件
      * 关闭组件
      * @param isRefresh 是否刷更新数据
      * @param isRefresh 是否刷更新数据
      */
      */
-    function cancelComponent(isRefresh: boolean) {
+    function closeComponent(isRefresh: boolean) {
         componentId.value = '';
         componentId.value = '';
         if (isRefresh) {
         if (isRefresh) {
             callback()
             callback()
@@ -24,5 +24,5 @@ export function handleModalComponent<T>(callback: Function, selectedRow: Ref<T>)
         record && (selectedRow.value = record);
         record && (selectedRow.value = record);
         componentId.value = item.code;
         componentId.value = item.code;
     }
     }
-    return { componentId, cancelComponent, openComponent }
+    return { componentId, closeComponent, openComponent }
 }
 }

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

@@ -103,6 +103,9 @@ export function _handleBtnList_(list: OperationTabMenu | undefined, hasDetail: b
         }
         }
     }
     }
 
 
+    if (result.value.length === 0) {
+        result.value = [[], []]
+    }
 
 
     return result
     return result
 }
 }

+ 58 - 4
src/common/setup/table/event.ts

@@ -1,6 +1,12 @@
+import { BtnList } from '@/common/components/btnList/interface';
 import { ContextMenuTemp } from "@/common/components/contextMenu/interface";
 import { ContextMenuTemp } from "@/common/components/contextMenu/interface";
+import { handleContextMenu } from "@/common/components/contextMenu/setup";
+import { getTableColumns, initData } from "@/common/export/table";
+import { TableKey } from '@/common/methods/table/interface';
+import { handleModalComponent } from '@/common/setup/asyncComponent';
 import { ref } from "vue";
 import { ref } from "vue";
-import { TableEventCB } from './interface';
+import { getBtnList_ } from './button';
+import { ButtonListKey, TableEventCB } from './interface';
 
 
 /**
 /**
  * 表格事件
  * 表格事件
@@ -22,6 +28,7 @@ export function getTableEvent<T>(param: TableEventCB) {
             onClick: () => {  // 表格点击
             onClick: () => {  // 表格点击
                 selectedRow.value = record
                 selectedRow.value = record
                 const key = (record as any).key
                 const key = (record as any).key
+                // 控制表格折腾面板
                 const value = expandedRowKeys.value;
                 const value = expandedRowKeys.value;
                 if (value && value.length && value[0] === key) {
                 if (value && value.length && value[0] === key) {
                     expandedRowKeys.value = []
                     expandedRowKeys.value = []
@@ -34,13 +41,13 @@ export function getTableEvent<T>(param: TableEventCB) {
             //     console.log('onDblclick');
             //     console.log('onDblclick');
             // },
             // },
             onContextmenu: (event: MouseEvent) => {  // 表格右键
             onContextmenu: (event: MouseEvent) => {  // 表格右键
+                selectedRow.value = record
                 const { clientX, clientY } = event;
                 const { clientX, clientY } = event;
-                contextMenu.value = {
+                const value = {
                     position: { clientX, clientY },
                     position: { clientX, clientY },
                     show: true,
                     show: true,
                 }
                 }
-                selectedRow.value = record
-                param.contextmenuCB && param.contextmenuCB(record)
+                param.contextmenuCB && param.contextmenuCB(record, value)
             },
             },
         };
         };
     }
     }
@@ -54,4 +61,51 @@ export function getTableEvent<T>(param: TableEventCB) {
     }
     }
 
 
     return { expandedRowKeys, selectedRow, Rowclick, btnClick, contextMenu, closeContext }
     return { expandedRowKeys, selectedRow, Rowclick, btnClick, contextMenu, closeContext }
+}
+
+export interface ComposeTableParam {
+    queryFn: Function,  // 查询表格数据
+    menuType: keyof ButtonListKey,  // 操作按钮列表key
+    tableName: keyof TableKey, // 表头key
+    tableFilterKey: string[], // 表格过滤字段
+    isDetail: boolean,  // 是否需要详情
+}
+
+export function handleComposeTable<T>({ queryFn, menuType, isDetail, tableName, tableFilterKey }: ComposeTableParam) {
+    // 右键逻辑
+    const { contextMenu, openContext, closeContext: closeContextAction } = handleContextMenu();
+    // 表头数据
+    const { columns, registerColumn, updateColumn } = getTableColumns();
+    // 右键回调函数
+    const eventsCB: TableEventCB = {
+        contextmenuCB: (record: T, value: ContextMenuTemp) => {
+            // 控制打开右键
+            contextMenu.value = value
+        }
+    }
+    // 表格事件
+    const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<T>(eventsCB);
+    // 表格操作按钮列表
+    const [firstBtn, secondBtn] = getBtnList_(menuType, isDetail).value;
+    // 控制异步组件
+    const { componentId, closeComponent, openComponent } = handleModalComponent(queryFn, selectedRow);
+    // 关闭右键
+    function closeContext(value: BtnList | null) {
+        // 打开对应的弹窗组件
+        if (value) openComponent(value, selectedRow.value)
+        // 关闭右键
+        closeContextAction()
+    }
+    initData(() => {
+        // 获取列表数据
+        queryFn();
+        // 注册表头信息 过滤
+        registerColumn(tableName, tableFilterKey);
+    }); return {
+        contextMenu, openContext, closeContext, // 右键
+        columns, registerColumn, updateColumn,  // 表头
+        expandedRowKeys, selectedRow, Rowclick, // 表格折腾面板数据与单击、双击事件
+        componentId, closeComponent, openComponent,  // 控制异步组件
+        firstBtn, secondBtn, // 表格按钮
+    }
 }
 }

+ 19 - 52
src/views/platinum/platinum_agreement/compoments/delete/index.vue

@@ -8,10 +8,10 @@
            @cancel="cancel"
            @cancel="cancel"
            width="890px">
            width="890px">
     <template #footer>
     <template #footer>
-        <a-button key="submit"
-                  type="primary"
-                  :loading="loading"
-                  @click="submit">注销</a-button>
+      <a-button key="submit"
+                type="primary"
+                :loading="loading"
+                @click="submit">注销</a-button>
 
 
       <a-button key="submit"
       <a-button key="submit"
                 type="primary"
                 type="primary"
@@ -71,28 +71,11 @@ import { getAgreementTypeName } from '@/common/constants/enumsName';
 import { handleArgreementType } from '../../setup';
 import { handleArgreementType } from '../../setup';
 import { queryTableList } from '@/common/setup/table';
 import { queryTableList } from '@/common/setup/table';
 import { queryAgreementChangeLog } from '@/services/go/ermcp/qhj';
 import { queryAgreementChangeLog } from '@/services/go/ermcp/qhj';
-import {requestResultLoadingAndInfo} from "@/common/methods/request/resultInfo";
-import {agreementConfigOperate} from "@/services/proto/manager";
-import {QHJAgreementConfigOperateReq} from "@/services/proto/manager/interface";
-
-const columns = [
-    {
-        title: '时间',
-        dataIndex: 'updatetime',
-        key: 'updatetime',
-    },
-    {
-        title: '协议名称',
-        dataIndex: 'agreementname',
-        key: 'agreementname',
-    },
-    {
-        title: '内容',
-        dataIndex: 'agreementcontent',
-        key: 'agreementcontent',
-        slots: { customRender: 'agreementcontent' },
-    },
-];
+import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { agreementConfigOperate } from '@/services/proto/manager';
+import { QHJAgreementConfigOperateReq } from '@/services/proto/manager/interface';
+import { _closeModal } from '@/common/setup/modal/modal';
+import { handleAgreementLog } from '@/views/platinum/platinum_agreement/compoments/setup';
 
 
 export default defineComponent({
 export default defineComponent({
     name: 'custom-detail',
     name: 'custom-detail',
@@ -104,38 +87,22 @@ export default defineComponent({
         },
         },
     },
     },
     setup(props, context) {
     setup(props, context) {
-        const { visible, cancel } = closeModal('platinum_agreement_delete');
+        // 控制弹窗
+        const { visible, cancel } = _closeModal(context);
+        // 信息
         const { desList, getDesList } = handleDesList();
         const { desList, getDesList } = handleDesList();
-        const { getRateEnumName } = handleArgreementType();
+        const { columns, visibleContent, content, getContent, list } = handleAgreementLog(props.selectedRow);
         const { loading, tableList, queryTable } = queryTableList<QhjAgreementChangeLog>();
         const { loading, tableList, queryTable } = queryTableList<QhjAgreementChangeLog>();
-        // 协议内容
-        const visibleContent = ref<boolean>(false);
-        const content = ref<string>('');
-        function getContent(value: string) {
-            visibleContent.value = true;
-            content.value = value;
-        }
-        watchEffect(() => {
-            if (visible.value) {
-                const data = props.selectedRow;
-                queryTable(queryAgreementChangeLog, { agreementid: data.agreementid });
 
 
-                const list = [
-                    { label: '协议编号', value: formatValue(data.agreementno) },
-                    { label: '协议名称', value: formatValue(data.agreementname) },
-                    { label: '协议类型', value: getAgreementTypeName(data.agreementtype) },
-                    { label: '签署频率', value: getRateEnumName(data.agreementfrequency) },
-                    { label: '内容', value: '查看', className: 'blue' },
-                ];
-                getDesList(list);
-            }
-        });
+        queryTable(queryAgreementChangeLog, { agreementid: props.selectedRow.agreementid });
+
+        getDesList(list);
 
 
         function submit() {
         function submit() {
             const reqParam: QHJAgreementConfigOperateReq = {
             const reqParam: QHJAgreementConfigOperateReq = {
-                operatetype: 5 ,// uint32  操作类型-1:新增 2:修改 3:停用 4:恢复 5:注销
-                agreementid: props.selectedRow.agreementid // uint64 协议ID(操作类型为2,3,4,5时必填)
-            }
+                operatetype: 5, // uint32  操作类型-1:新增 2:修改 3:停用 4:恢复 5:注销
+                agreementid: props.selectedRow.agreementid, // uint64 协议ID(操作类型为2,3,4,5时必填)
+            };
             requestResultLoadingAndInfo(agreementConfigOperate, reqParam, loading, ['注销协议成功', '注销协议失败:']).then(() => {
             requestResultLoadingAndInfo(agreementConfigOperate, reqParam, loading, ['注销协议成功', '注销协议失败:']).then(() => {
                 context.emit('refresh');
                 context.emit('refresh');
             });
             });

+ 6 - 45
src/views/platinum/platinum_agreement/compoments/detail/index.vue

@@ -57,34 +57,13 @@
 </template>
 </template>
 
 
 <script lang="ts">
 <script lang="ts">
-import { defineComponent, PropType, ref, watchEffect } from 'vue';
+import { defineComponent, PropType } from 'vue';
 import { Des, handleDesList } from '@/common/components/commonDes';
 import { Des, handleDesList } from '@/common/components/commonDes';
 import { QhjAgreementChangeLog, QhjAgreementConfig } from '@/services/go/ermcp/qhj/interface';
 import { QhjAgreementChangeLog, QhjAgreementConfig } from '@/services/go/ermcp/qhj/interface';
-import { formatValue } from '@/common/methods';
-import { getAgreementTypeName } from '@/common/constants/enumsName';
-import { handleArgreementType } from '../../setup';
 import { queryTableList } from '@/common/setup/table';
 import { queryTableList } from '@/common/setup/table';
 import { queryAgreementChangeLog } from '@/services/go/ermcp/qhj';
 import { queryAgreementChangeLog } from '@/services/go/ermcp/qhj';
 import { _closeModal } from '@/common/setup/modal/modal';
 import { _closeModal } from '@/common/setup/modal/modal';
-
-const columns = [
-    {
-        title: '时间',
-        dataIndex: 'updatetime',
-        key: 'updatetime',
-    },
-    {
-        title: '协议名称',
-        dataIndex: 'agreementname',
-        key: 'agreementname',
-    },
-    {
-        title: '内容',
-        dataIndex: 'agreementcontent',
-        key: 'agreementcontent',
-        slots: { customRender: 'agreementcontent' },
-    },
-];
+import { handleAgreementLog } from '../setup';
 
 
 export default defineComponent({
 export default defineComponent({
     name: 'custom-detail',
     name: 'custom-detail',
@@ -98,30 +77,12 @@ export default defineComponent({
     setup(props, context) {
     setup(props, context) {
         const { visible, cancel } = _closeModal(context);
         const { visible, cancel } = _closeModal(context);
         const { desList, getDesList } = handleDesList();
         const { desList, getDesList } = handleDesList();
-        const { getRateEnumName } = handleArgreementType();
+        const { columns, visibleContent, content, getContent, list } = handleAgreementLog(props.selectedRow);
         const { loading, tableList, queryTable } = queryTableList<QhjAgreementChangeLog>();
         const { loading, tableList, queryTable } = queryTableList<QhjAgreementChangeLog>();
-        // 协议内容
-        const visibleContent = ref<boolean>(false);
-        const content = ref<string>('');
-        function getContent(value: string) {
-            visibleContent.value = true;
-            content.value = value;
-        }
-        watchEffect(() => {
-            if (visible.value) {
-                const data = props.selectedRow;
-                queryTable(queryAgreementChangeLog, { agreementid: data.agreementid });
 
 
-                const list = [
-                    { label: '协议编号', value: formatValue(data.agreementno) },
-                    { label: '协议名称', value: formatValue(data.agreementname) },
-                    { label: '协议类型', value: getAgreementTypeName(data.agreementtype) },
-                    { label: '签署频率', value: getRateEnumName(data.agreementfrequency) },
-                    { label: '内容', value: '查看', className: 'blue' },
-                ];
-                getDesList(list);
-            }
-        });
+        queryTable(queryAgreementChangeLog, { agreementid: props.selectedRow.agreementid });
+
+        getDesList(list);
 
 
         return {
         return {
             visibleContent,
             visibleContent,

+ 19 - 54
src/views/platinum/platinum_agreement/compoments/resume/index.vue

@@ -8,10 +8,10 @@
            @cancel="cancel"
            @cancel="cancel"
            width="890px">
            width="890px">
     <template #footer>
     <template #footer>
-        <a-button key="submit"
-                  type="primary"
-                  :loading="loading"
-                  @click="submit">恢复</a-button>
+      <a-button key="submit"
+                type="primary"
+                :loading="loading"
+                @click="submit">恢复</a-button>
       <a-button key="submit"
       <a-button key="submit"
                 type="primary"
                 type="primary"
                 :loading="loading"
                 :loading="loading"
@@ -61,8 +61,7 @@
 </template>
 </template>
 
 
 <script lang="ts">
 <script lang="ts">
-import { defineComponent, PropType, ref, watchEffect } from 'vue';
-import { closeModal } from '@/common/setup/modal/index';
+import { defineComponent, PropType, ref } from 'vue';
 import { Des, handleDesList } from '@/common/components/commonDes';
 import { Des, handleDesList } from '@/common/components/commonDes';
 import { QhjAgreementChangeLog, QhjAgreementConfig } from '@/services/go/ermcp/qhj/interface';
 import { QhjAgreementChangeLog, QhjAgreementConfig } from '@/services/go/ermcp/qhj/interface';
 import { formatValue } from '@/common/methods';
 import { formatValue } from '@/common/methods';
@@ -70,28 +69,11 @@ import { getAgreementTypeName } from '@/common/constants/enumsName';
 import { handleArgreementType } from '../../setup';
 import { handleArgreementType } from '../../setup';
 import { queryTableList } from '@/common/setup/table';
 import { queryTableList } from '@/common/setup/table';
 import { queryAgreementChangeLog } from '@/services/go/ermcp/qhj';
 import { queryAgreementChangeLog } from '@/services/go/ermcp/qhj';
-import {QHJAgreementConfigOperateReq} from "@/services/proto/manager/interface";
-import {requestResultLoadingAndInfo} from "@/common/methods/request/resultInfo";
-import {agreementConfigOperate} from "@/services/proto/manager";
-
-const columns = [
-    {
-        title: '时间',
-        dataIndex: 'updatetime',
-        key: 'updatetime',
-    },
-    {
-        title: '协议名称',
-        dataIndex: 'agreementname',
-        key: 'agreementname',
-    },
-    {
-        title: '内容',
-        dataIndex: 'agreementcontent',
-        key: 'agreementcontent',
-        slots: { customRender: 'agreementcontent' },
-    },
-];
+import { QHJAgreementConfigOperateReq } from '@/services/proto/manager/interface';
+import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { agreementConfigOperate } from '@/services/proto/manager';
+import { _closeModal } from '@/common/setup/modal/modal';
+import { handleAgreementLog } from '../setup';
 
 
 export default defineComponent({
 export default defineComponent({
     name: 'custom-detail',
     name: 'custom-detail',
@@ -103,38 +85,21 @@ export default defineComponent({
         },
         },
     },
     },
     setup(props, context) {
     setup(props, context) {
-        const { visible, cancel } = closeModal('platinum_agreement_resume');
+        const { visible, cancel } = _closeModal(context);
         const { desList, getDesList } = handleDesList();
         const { desList, getDesList } = handleDesList();
-        const { getRateEnumName } = handleArgreementType();
+        const { columns, visibleContent, content, getContent, list } = handleAgreementLog(props.selectedRow);
+
         const { loading, tableList, queryTable } = queryTableList<QhjAgreementChangeLog>();
         const { loading, tableList, queryTable } = queryTableList<QhjAgreementChangeLog>();
-        // 协议内容
-        const visibleContent = ref<boolean>(false);
-        const content = ref<string>('');
-        function getContent(value: string) {
-            visibleContent.value = true;
-            content.value = value;
-        }
-        watchEffect(() => {
-            if (visible.value) {
-                const data = props.selectedRow;
-                queryTable(queryAgreementChangeLog, { agreementid: data.agreementid });
 
 
-                const list = [
-                    { label: '协议编号', value: formatValue(data.agreementno) },
-                    { label: '协议名称', value: formatValue(data.agreementname) },
-                    { label: '协议类型', value: getAgreementTypeName(data.agreementtype) },
-                    { label: '签署频率', value: getRateEnumName(data.agreementfrequency) },
-                    { label: '内容', value: '查看', className: 'blue' },
-                ];
-                getDesList(list);
-            }
-        });
+        queryTable(queryAgreementChangeLog, { agreementid: props.selectedRow.agreementid });
+
+        getDesList(list);
 
 
         function submit() {
         function submit() {
             const reqParam: QHJAgreementConfigOperateReq = {
             const reqParam: QHJAgreementConfigOperateReq = {
-                operatetype: 4 ,// uint32  操作类型-1:新增 2:修改 3:停用 4:恢复 5:注销
-                agreementid: props.selectedRow.agreementid // uint64 协议ID(操作类型为2,3,4,5时必填)
-            }
+                operatetype: 4, // uint32  操作类型-1:新增 2:修改 3:停用 4:恢复 5:注销
+                agreementid: props.selectedRow.agreementid, // uint64 协议ID(操作类型为2,3,4,5时必填)
+            };
             requestResultLoadingAndInfo(agreementConfigOperate, reqParam, loading, ['注销协议成功', '注销协议失败:']).then(() => {
             requestResultLoadingAndInfo(agreementConfigOperate, reqParam, loading, ['注销协议成功', '注销协议失败:']).then(() => {
                 context.emit('refresh');
                 context.emit('refresh');
             });
             });

+ 43 - 0
src/views/platinum/platinum_agreement/compoments/setup.ts

@@ -0,0 +1,43 @@
+import { getAgreementTypeName } from "@/common/constants/enumsName";
+import { formatValue } from "@/common/methods";
+import { QhjAgreementConfig } from "@/services/go/ermcp/qhj/interface";
+import { ref } from "vue";
+import { handleArgreementType } from "../setup";
+
+
+export function handleAgreementLog(data: QhjAgreementConfig) {
+    const { getRateEnumName } = handleArgreementType();
+    const columns = [
+        {
+            title: '时间',
+            dataIndex: 'updatetime',
+            key: 'updatetime',
+        },
+        {
+            title: '协议名称',
+            dataIndex: 'agreementname',
+            key: 'agreementname',
+        },
+        {
+            title: '内容',
+            dataIndex: 'agreementcontent',
+            key: 'agreementcontent',
+            slots: { customRender: 'agreementcontent' },
+        },
+    ];
+    // 协议内容
+    const visibleContent = ref<boolean>(false);
+    const content = ref<string>('');
+    function getContent(value: string) {
+        visibleContent.value = true;
+        content.value = value;
+    }
+    const list = [
+        { label: '协议编号', value: formatValue(data.agreementno) },
+        { label: '协议名称', value: formatValue(data.agreementname) },
+        { label: '协议类型', value: getAgreementTypeName(data.agreementtype) },
+        { label: '签署频率', value: getRateEnumName(data.agreementfrequency) },
+        { label: '内容', value: '查看', className: 'blue' },
+    ];
+    return { columns, visibleContent, content, getContent, list }
+}

+ 19 - 55
src/views/platinum/platinum_agreement/compoments/stop/index.vue

@@ -8,10 +8,10 @@
            @cancel="cancel"
            @cancel="cancel"
            width="890px">
            width="890px">
     <template #footer>
     <template #footer>
-        <a-button key="submit"
-                  type="primary"
-                  :loading="loading"
-                  @click="submit">停用</a-button>
+      <a-button key="submit"
+                type="primary"
+                :loading="loading"
+                @click="submit">停用</a-button>
       <a-button key="submit"
       <a-button key="submit"
                 type="primary"
                 type="primary"
                 :loading="loading"
                 :loading="loading"
@@ -61,8 +61,7 @@
 </template>
 </template>
 
 
 <script lang="ts">
 <script lang="ts">
-import { defineComponent, PropType, ref, watchEffect } from 'vue';
-import { closeModal } from '@/common/setup/modal/index';
+import { defineComponent, PropType, ref } from 'vue';
 import { Des, handleDesList } from '@/common/components/commonDes';
 import { Des, handleDesList } from '@/common/components/commonDes';
 import { QhjAgreementChangeLog, QhjAgreementConfig } from '@/services/go/ermcp/qhj/interface';
 import { QhjAgreementChangeLog, QhjAgreementConfig } from '@/services/go/ermcp/qhj/interface';
 import { formatValue } from '@/common/methods';
 import { formatValue } from '@/common/methods';
@@ -70,28 +69,11 @@ import { getAgreementTypeName } from '@/common/constants/enumsName';
 import { handleArgreementType } from '../../setup';
 import { handleArgreementType } from '../../setup';
 import { queryTableList } from '@/common/setup/table';
 import { queryTableList } from '@/common/setup/table';
 import { queryAgreementChangeLog } from '@/services/go/ermcp/qhj';
 import { queryAgreementChangeLog } from '@/services/go/ermcp/qhj';
-import {QHJAgreementConfigOperateReq} from "@/services/proto/manager/interface";
-import {requestResultLoadingAndInfo} from "@/common/methods/request/resultInfo";
-import {agreementConfigOperate} from "@/services/proto/manager";
-
-const columns = [
-    {
-        title: '时间',
-        dataIndex: 'updatetime',
-        key: 'updatetime',
-    },
-    {
-        title: '协议名称',
-        dataIndex: 'agreementname',
-        key: 'agreementname',
-    },
-    {
-        title: '内容',
-        dataIndex: 'agreementcontent',
-        key: 'agreementcontent',
-        slots: { customRender: 'agreementcontent' },
-    },
-];
+import { QHJAgreementConfigOperateReq } from '@/services/proto/manager/interface';
+import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { agreementConfigOperate } from '@/services/proto/manager';
+import { _closeModal } from '@/common/setup/modal/modal';
+import { handleAgreementLog } from '../setup';
 
 
 export default defineComponent({
 export default defineComponent({
     name: 'custom-detail',
     name: 'custom-detail',
@@ -103,44 +85,26 @@ export default defineComponent({
         },
         },
     },
     },
     setup(props, context) {
     setup(props, context) {
-        const { visible, cancel } = closeModal('platinum_agreement_stop');
+        const { visible, cancel } = _closeModal(context);
         const { desList, getDesList } = handleDesList();
         const { desList, getDesList } = handleDesList();
-        const { getRateEnumName } = handleArgreementType();
+        const { columns, visibleContent, content, getContent, list } = handleAgreementLog(props.selectedRow);
+
         const { loading, tableList, queryTable } = queryTableList<QhjAgreementChangeLog>();
         const { loading, tableList, queryTable } = queryTableList<QhjAgreementChangeLog>();
-        // 协议内容
-        const visibleContent = ref<boolean>(false);
-        const content = ref<string>('');
-        function getContent(value: string) {
-            visibleContent.value = true;
-            content.value = value;
-        }
-        watchEffect(() => {
-            if (visible.value) {
-                const data = props.selectedRow;
-                queryTable(queryAgreementChangeLog, { agreementid: data.agreementid });
 
 
-                const list = [
-                    { label: '协议编号', value: formatValue(data.agreementno) },
-                    { label: '协议名称', value: formatValue(data.agreementname) },
-                    { label: '协议类型', value: getAgreementTypeName(data.agreementtype) },
-                    { label: '签署频率', value: getRateEnumName(data.agreementfrequency) },
-                    { label: '内容', value: '查看', className: 'blue' },
-                ];
-                getDesList(list);
-            }
-        });
+        queryTable(queryAgreementChangeLog, { agreementid: props.selectedRow.agreementid });
+
+        getDesList(list);
 
 
         function submit() {
         function submit() {
             const reqParam: QHJAgreementConfigOperateReq = {
             const reqParam: QHJAgreementConfigOperateReq = {
-                operatetype: 3 ,// uint32  操作类型-1:新增 2:修改 3:停用 4:恢复 5:注销
-                agreementid: props.selectedRow.agreementid // uint64 协议ID(操作类型为2,3,4,5时必填)
-            }
+                operatetype: 3, // uint32  操作类型-1:新增 2:修改 3:停用 4:恢复 5:注销
+                agreementid: props.selectedRow.agreementid, // uint64 协议ID(操作类型为2,3,4,5时必填)
+            };
             requestResultLoadingAndInfo(agreementConfigOperate, reqParam, loading, ['注销协议成功', '注销协议失败:']).then(() => {
             requestResultLoadingAndInfo(agreementConfigOperate, reqParam, loading, ['注销协议成功', '注销协议失败:']).then(() => {
                 context.emit('refresh');
                 context.emit('refresh');
             });
             });
         }
         }
 
 
-
         return {
         return {
             visibleContent,
             visibleContent,
             content,
             content,

+ 15 - 36
src/views/platinum/platinum_agreement/list/tab/index.vue

@@ -29,13 +29,12 @@
     </a-table>
     </a-table>
     <!-- 右键 -->
     <!-- 右键 -->
     <contextMenu :contextMenu="contextMenu"
     <contextMenu :contextMenu="contextMenu"
-                 @update="openComponent"
-                 @cancel="contextMenu.show = false"
+                 @cancel="closeContext"
                  :list="secondBtn">
                  :list="secondBtn">
     </contextMenu>
     </contextMenu>
     <component :is="componentId"
     <component :is="componentId"
                :selectedRow="selectedRow"
                :selectedRow="selectedRow"
-               @cancel="cancelComponent"></component>
+               @cancel="closeComponent"></component>
   </div>
   </div>
 </template>
 </template>
 
 
@@ -55,6 +54,7 @@ import contextMenu from '@/common/components/contextMenu/temp.vue';
 import { defineAsyncComponent } from 'vue';
 import { defineAsyncComponent } from 'vue';
 import { ModalEnum } from '@/common/constants/modalNameEnum';
 import { ModalEnum } from '@/common/constants/modalNameEnum';
 import { handleContextMenu } from '@/common/components/contextMenu/setup';
 import { handleContextMenu } from '@/common/components/contextMenu/setup';
+import { ComposeTableParam, handleComposeTable } from '@/common/setup/table/event';
 
 
 const Detail = defineAsyncComponent(() => import('../../compoments/detail/index.vue'));
 const Detail = defineAsyncComponent(() => import('../../compoments/detail/index.vue'));
 const Modify = defineAsyncComponent(() => import('../../compoments/modify/index.vue'));
 const Modify = defineAsyncComponent(() => import('../../compoments/modify/index.vue'));
@@ -77,47 +77,26 @@ export default defineComponent({
         [ModalEnum.platinum_agreement_stop]: Stop,
         [ModalEnum.platinum_agreement_stop]: Stop,
     },
     },
     setup() {
     setup() {
-        const { contextMenu, openContext, closeContext } = handleContextMenu();
-        // 表头数据
-        const { columns, registerColumn, updateColumn } = getTableColumns();
-        // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<QhjAgreementConfig>({ contextmenuCB: openContext });
-        // 表格操作按钮列表
-        const [firstBtn, secondBtn] = getBtnList_('platinum_agreement_tab', true).value;
         // 表格列表数据
         // 表格列表数据
         const { loading, tableList, queryTable } = queryTableList<QhjAgreementConfig>();
         const { loading, tableList, queryTable } = queryTableList<QhjAgreementConfig>();
-        function getData() {
-            // 获取列表数据
-            queryTable(queryAgreementConfig);
-        }
-        // 控制异步组件
-        const { componentId, cancelComponent, openComponent } = handleModalComponent(getData, selectedRow);
-        const { getRateEnumName } = handleArgreementType();
+        // 获取列表数据
+        const queryTableAction = () => queryTable(queryAgreementConfig);
+        // 表格通用逻辑
+        const param: ComposeTableParam = {
+            queryFn: queryTableAction,
+            menuType: 'platinum_agreement_tab',
+            tableName: 'table_pcweb_agreement',
+            tableFilterKey: ['agreementno', 'agreementtype'],
+            isDetail: true,
+        };
 
 
-        initData(() => {
-            // 获取列表数据
-            getData();
-            // 注册表头信息 过滤
-            registerColumn('table_pcweb_agreement', ['agreementno', 'agreementtype']);
-        });
+        const { getRateEnumName } = handleArgreementType();
 
 
         return {
         return {
-            getData,
-            openComponent,
-            cancelComponent,
-            contextMenu,
-            componentId,
-            columns,
-            secondBtn,
-            expandedRowKeys,
-            selectedRow,
-            Rowclick,
-            updateColumn,
+            ...handleComposeTable<QhjAgreementConfig>(param),
             getRateEnumName,
             getRateEnumName,
-            firstBtn,
             loading,
             loading,
             tableList,
             tableList,
-            queryTable,
             getAgreementTypeName,
             getAgreementTypeName,
         };
         };
     },
     },