Kaynağa Gözat

修改客户资料

huangbin 4 yıl önce
ebeveyn
işleme
df6fe3b15d

+ 52 - 0
src/common/setup/buttonPermission/index.ts

@@ -0,0 +1,52 @@
+// 按钮权限
+import { MenuItem } from '@/common/components/contextMenu/interface';
+import { openModal } from '@/common/setup/modal/index';
+import { ModalName } from '@/common/setup/modal/interface';
+import { OperationTabMenu } from '@/services/go/commonService/interface';
+import { inject, Ref } from 'vue';
+import { BtnType, MenuType } from './interface';
+
+/**
+ * 详情 按钮
+ * @param modalName 相对应的弹窗组件名
+ * @param contextMenuList 右键列表
+ */
+export function detailButton(modalName: keyof ModalName, contextMenuList: Ref<MenuItem[]>) {
+    const { openAction } = openModal(modalName);
+    contextMenuList.value.push({ lable: '详情', callback: openAction });
+}
+
+/**
+ * 权限 按钮
+ * @param modalName 相对应的弹窗组件名
+ * @param lable 按钮名
+ * @param contextMenuList 右键列表
+ */
+export function permissionButton(modalName: keyof ModalName, lable: string, contextMenuList: Ref<MenuItem[]>) {
+    const { openAction } = openModal(modalName);
+    function action() {
+        contextMenuList.value.push({ lable, callback: openAction });
+    }
+    return { action };
+}
+
+/**
+ * 判断某个按钮是否有权限
+ * @param menuType 
+ * @returns 
+ */
+export function handlePermission(menuType: keyof MenuType) {
+    const permissionData = inject('thirdMenuList') as Ref<OperationTabMenu[]>;
+    // 判断按钮是否有权限
+    function hasPermission(type: keyof BtnType): boolean {
+        let result = false;
+        if (permissionData) {
+            const btnList = permissionData.value.find((e) => e.code === menuType);
+            if (btnList && btnList.children) {
+                result = btnList.children.find((e) => e.code === type && e.type === 2) ? true : false;
+            }
+        }
+        return result;
+    }
+    return { hasPermission };
+}

+ 12 - 0
src/common/setup/buttonPermission/interface.ts

@@ -0,0 +1,12 @@
+export interface MenuType {
+    custom_info_normal: string; // 客户资料 正常
+    custom_info_disabled: string; // 客户资料 停用
+}
+
+export interface BtnType {
+    custom_info_btn_add: string; // 客户资料 添加
+    custom_info_btn_modify: string; // 客户资料 修改
+    custom_info_btn_disable: string; // 客户资料 停用
+    custom_info_btn_recover: string; // 客户资料 恢复
+    custom_info_btn_delete: string; // 客户资料 删除
+}

+ 4 - 0
src/common/setup/modal/interface.ts

@@ -12,4 +12,8 @@ export interface ModalName {
     customDetail: string; // 客户资料详情
 
     addSpotContract: string; // 新增现货合同
+    resubmitSpotContract: string; // 重新提交现货合同
+    modifySpotContract: string; // 修改现货合同
+    deleteSpotContract: string; // 删除现货合同
+    spotContractDetail: string; // 现货合同详情
 }

+ 8 - 29
src/views/information/custom/list/normal-use/index.vue

@@ -5,7 +5,7 @@
     <filterCustomTable @search="search">
       <a-button class="operBtn"
                 v-if="hasPermission('custom_info_btn_add')"
-                @click="openAction">新增</a-button>
+                @click="addAction">新增</a-button>
     </filterCustomTable>
     <contextMenu :contextMenuList="contextMenuList"
                  :tableList="customList">
@@ -43,29 +43,8 @@ import CustomDetail from '@/views/information/custom/compoments/customDetail/ind
 import ModifyCustom from '@/views/information/custom/compoments/modifyCustom/index.vue';
 import DisableCustom from '@/views/information/custom/compoments/disableCustom/index.vue';
 import AddCustom from '@/views/information/custom/compoments/addCustom/index.vue';
+import { detailButton, permissionButton, handlePermission } from '@/common/setup/buttonPermission/index';
 
-// 处理详情
-function handleDetail(contextMenuList: Ref<MenuItem[]>) {
-    const { openAction } = openModal('customDetail');
-    contextMenuList.value.push({ lable: '详情', callback: openAction });
-}
-// 处理修改
-function handleModify(contextMenuList: Ref<MenuItem[]>) {
-    const { openAction } = openModal('modifyCustomInfo');
-    function modifyAction() {
-        contextMenuList.value.push({ lable: '修改', callback: openAction });
-    }
-    return { modifyAction };
-}
-
-// 处理停用
-function handleDisable(contextMenuList: Ref<MenuItem[]>) {
-    const { openAction } = openModal('disableCustomInfo');
-    function disableAction() {
-        contextMenuList.value.push({ lable: '停用', callback: openAction });
-    }
-    return { disableAction };
-}
 export default defineComponent({
     name: 'custom-normal',
     components: {
@@ -77,15 +56,15 @@ export default defineComponent({
         AddCustom,
     },
     setup() {
-        const { customList, actionQuery, columns, getColumns, search, loading, handlePermission } = getCustomList();
+        const { customList, actionQuery, columns, getColumns, search, loading } = getCustomList();
         const { hasPermission } = handlePermission('custom_info_normal');
         const contextMenuList = ref<MenuItem[]>([]);
 
-        const { openAction } = openModal('addCustomInfo');
+        const { openAction: addAction } = openModal('addCustomInfo');
 
-        handleDetail(contextMenuList);
-        const { modifyAction } = handleModify(contextMenuList);
-        const { disableAction } = handleDisable(contextMenuList);
+        detailButton('customDetail', contextMenuList);
+        const { action: modifyAction } = permissionButton('modifyCustomInfo', '修改', contextMenuList);
+        const { action: disableAction } = permissionButton('disableCustomInfo', '停用', contextMenuList);
 
         const stop = watchEffect(() => {
             hasPermission('custom_info_btn_modify') && modifyAction();
@@ -98,7 +77,7 @@ export default defineComponent({
             actionQuery(3);
             getColumns();
         });
-        return { customList, columns, search, loading, contextMenuList, hasPermission, openAction };
+        return { customList, columns, search, loading, contextMenuList, hasPermission, addAction };
     },
 });
 </script>

+ 3 - 24
src/views/information/custom/list/setup.ts

@@ -1,10 +1,9 @@
-import { OperationTabMenu } from '@/services/go/commonService/interface';
+import { ColumnType, getTableHead } from '@/services/bus/table';
 import { QueryCustomInfo } from '@/services/go/ermcp/customInfo';
 import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
 import { QueryCustomInfoEnum } from '@/services/go/ermcp/customInfo/type';
-import { ColumnType, getTableHead } from '@/services/bus/table';
 import { message } from 'ant-design-vue';
-import { inject, Ref, ref } from 'vue';
+import { ref } from 'vue';
 
 // 客户资料列表
 export function getCustomList() {
@@ -15,7 +14,6 @@ export function getCustomList() {
     // 过滤项
     const filteredInfo = ref();
     const loading = ref<boolean>(false);
-    const permissionData = inject('thirdMenuList') as Ref<OperationTabMenu[]>;
     // 获取表头
     function getColumns() {
         const list = getTableHead('table_pcweb_userinfo');
@@ -72,24 +70,5 @@ export function getCustomList() {
         getColumns();
     }
 
-    // 处理按钮是否有权限
-    type customType = 'custom_info_normal' | 'custom_info_disabled'; // 正常 | 停用
-    function handlePermission(menuType: customType) {
-        // 添加 | 修改 | 停用 | "恢复" | "删除"
-        type codeType = 'custom_info_btn_add' | 'custom_info_btn_modify' | 'custom_info_btn_disable' | 'custom_info_btn_recover' | 'custom_info_btn_delete';
-
-        // 判断按钮是否有权限
-        function hasPermission(type: codeType): boolean {
-            let result = false;
-            if (permissionData) {
-                const btnList = permissionData.value.find((e) => e.code === menuType);
-                if (btnList && btnList.children) {
-                    result = btnList.children.find((e) => e.code === type && e.type === 2) ? true : false;
-                }
-            }
-            return result;
-        }
-        return { hasPermission };
-    }
-    return { customList, actionQuery, columns, filteredInfo, getColumns, search, loading, handlePermission };
+    return { customList, actionQuery, columns, filteredInfo, getColumns, search, loading, };
 }

+ 76 - 84
src/views/information/custom/list/stop-use/index.vue

@@ -1,97 +1,89 @@
 <template>
-    <!-- 客户信息: 停用 -->
-    <div class="custom-normal" :loading="loading">
-        <filterCustomTable @search="search">
-            <a-button class="operBtn" v-if="hasPermission('custom_info_btn_add')" @click="openAction">新增</a-button>
-        </filterCustomTable>
-        <contextMenu :contextMenuList="contextMenuList" :tableList="customList">
-            <a-table :columns="columns" class="topTable" :pagination="false" rowKey="key" :data-source="customList">
-                <template #userinfotype="{ text }">
-                    <a>{{ text === '2' ? '企业' : '个人' }}</a>
-                </template>
-            </a-table>
-        </contextMenu>
-        <!-- 详情 -->
-        <CustomDetail />
-        <!-- 删除 -->
-        <DeleteCustom />
-        <!-- 恢复客户资料 -->@/common/methods
-        <RecoverCustom />
-    </div>
+  <!-- 客户信息: 停用 -->
+  <div class="custom-normal"
+       :loading="loading">
+    <filterCustomTable @search="search">
+      <a-button class="operBtn"
+                v-if="hasPermission('custom_info_btn_add')"
+                @click="addAction">新增</a-button>
+    </filterCustomTable>
+    <contextMenu :contextMenuList="contextMenuList"
+                 :tableList="customList">
+      <a-table :columns="columns"
+               class="topTable"
+               :pagination="false"
+               rowKey="key"
+               :data-source="customList">
+        <template #userinfotype="{ text }">
+          <a>{{ text === '2' ? '企业' : '个人' }}</a>
+        </template>
+      </a-table>
+    </contextMenu>
+    <!-- 新增 -->
+    <AddCustom />
+    <!-- 详情 -->
+    <CustomDetail />
+    <!-- 删除 -->
+    <DeleteCustom />
+    <!-- 恢复客户资料 -->@/common/methods
+    <RecoverCustom />
+  </div>
 </template>
 
 <script lang="ts">
-    import { defineComponent, onUnmounted, Ref, ref, watchEffect } from 'vue';
+import { defineComponent, onUnmounted, Ref, ref, watchEffect } from 'vue';
 
-    import { initData } from '@/common/methods/index';
-    import filterCustomTable from '@/views/information/custom/compoments/filterTable/index.vue';
-    import { MenuItem } from '@/common/components/contextMenu/interface';
-    import contextMenu from '@/common/components/contextMenu/index.vue';
-    import { getCustomList } from '../setup';
-    import { openModal } from '@/common/setup/modal/index';
-    import CustomDetail from '@/views/information/custom/compoments/customDetail/index.vue';
-    import DeleteCustom from '@/views/information/custom/compoments/deleteCustom/index.vue';
-    import RecoverCustom from '@/views/information/custom/compoments/recover/index.vue';
+import { initData } from '@/common/methods/index';
+import filterCustomTable from '@/views/information/custom/compoments/filterTable/index.vue';
+import { MenuItem } from '@/common/components/contextMenu/interface';
+import contextMenu from '@/common/components/contextMenu/index.vue';
+import { getCustomList } from '../setup';
+import { openModal } from '@/common/setup/modal/index';
+import CustomDetail from '@/views/information/custom/compoments/customDetail/index.vue';
+import DeleteCustom from '@/views/information/custom/compoments/deleteCustom/index.vue';
+import RecoverCustom from '@/views/information/custom/compoments/recover/index.vue';
+import AddCustom from '@/views/information/custom/compoments/addCustom/index.vue';
+import { detailButton, permissionButton, handlePermission } from '@/common/setup/buttonPermission/index';
 
-    // 处理详情
-    function handleDetail(contextMenuList: Ref<MenuItem[]>) {
-        const { openAction } = openModal('customDetail');
-        contextMenuList.value.push({ lable: '详情', callback: openAction });
-    }
-    // 处理删除
-    function handleDelete(contextMenuList: Ref<MenuItem[]>) {
-        const { openAction } = openModal('deleteCustomInfo');
-        function deleteAction() {
-            contextMenuList.value.push({ lable: '删除', callback: openAction });
-        }
-        return { deleteAction };
-    }
-    // 处理恢复
-    function handleRecover(contextMenuList: Ref<MenuItem[]>) {
-        const { openAction } = openModal('recoverCustomInfo');
-        function recoverAction() {
-            contextMenuList.value.push({ lable: '删除', callback: openAction });
-        }
-        return { recoverAction };
-    }
+export default defineComponent({
+    name: 'custom-normal',
+    components: {
+        filterCustomTable,
+        contextMenu,
+        CustomDetail,
+        DeleteCustom,
+        RecoverCustom,
+        AddCustom,
+    },
+    setup() {
+        const { customList, actionQuery, columns, getColumns, search, loading } = getCustomList();
+        const { hasPermission } = handlePermission('custom_info_normal');
+        const contextMenuList = ref<MenuItem[]>([]);
 
-    export default defineComponent({
-        name: 'custom-normal',
-        components: {
-            filterCustomTable,
-            contextMenu,
-            CustomDetail,
-            DeleteCustom,
-            RecoverCustom,
-        },
-        setup() {
-            const { customList, actionQuery, columns, getColumns, search, loading, handlePermission } = getCustomList();
-            const { hasPermission } = handlePermission('custom_info_normal');
-            const contextMenuList = ref<MenuItem[]>([]);
+        const { openAction: addAction } = openModal('addCustomInfo');
 
-            const { openAction } = openModal('addCustomInfo');
+        detailButton('customDetail', contextMenuList);
+        const { action: deleteAction } = permissionButton('deleteCustomInfo', '删除', contextMenuList);
+        const { action: recoverAction } = permissionButton('recoverCustomInfo', '恢复', contextMenuList);
 
-            handleDetail(contextMenuList);
-            const { deleteAction } = handleDelete(contextMenuList);
-            const { recoverAction } = handleRecover(contextMenuList);
-
-            const stop = watchEffect(() => {
-                hasPermission('custom_info_btn_recover') && recoverAction();
-                hasPermission('custom_info_btn_delete') && deleteAction();
-            });
-            onUnmounted(() => {
-                stop();
-            });
-            initData(() => {
-                actionQuery(4);
-                getColumns();
-            });
-            return { customList, columns, search, loading, contextMenuList, hasPermission, openAction };
-        },
-    });
+        const stop = watchEffect(() => {
+            hasPermission('custom_info_btn_recover') && recoverAction();
+            hasPermission('custom_info_btn_delete') && deleteAction();
+        });
+        onUnmounted(() => {
+            stop();
+        });
+        initData(() => {
+            actionQuery(4);
+            getColumns();
+        });
+        return { customList, columns, search, loading, contextMenuList, hasPermission, addAction };
+    },
+});
 </script>
 
 <style lang="less">
-    .custom-normal {
-    }</style
+.custom-normal {
+}
+</style
 >;

+ 71 - 42
src/views/information/spot-contract/list/not-commit/index.vue

@@ -1,53 +1,82 @@
 <template>
-    <!-- 现货合同: 未提交-->
-    <div class="spot-contract-not-commit">
-        <filterCustomTable @search="search">
-            <a-button class="operBtn" v-if="hasPermission('spot_contract_btn_add')" @click="openAction">新增</a-button>
-        </filterCustomTable>
-        <contextMenu :contextMenuList="contextMenuList" :tableList="spotContractList">
-            <a-table :columns="columns" class="topTable" :pagination="false" rowKey="key" :data-source="spotContractList">
-                <!-- <template #userinfotype="{ text }">
+  <!-- 现货合同: 未提交-->
+  <div class="spot-contract-not-commit">
+    <filterCustomTable @search="search">
+      <a-button class="operBtn"
+                v-if="hasPermission('spot_contract_btn_add')"
+                @click="openAction">新增</a-button>
+    </filterCustomTable>
+    <contextMenu :contextMenuList="contextMenuList"
+                 :tableList="spotContractList">
+      <a-table :columns="columns"
+               class="topTable"
+               :pagination="false"
+               rowKey="key"
+               :data-source="spotContractList">
+        <!-- <template #userinfotype="{ text }">
           <a>{{ text === '2' ? '企业' : '个人'}}</a>
         </template> -->
-            </a-table>
-        </contextMenu>
-        <!-- 新增现货合同 -->
-        <AddSpotContract />
-    </div>
+      </a-table>
+    </contextMenu>
+    <!-- 新增现货合同 -->
+    <AddSpotContract />
+  </div>
 </template>
 
 <script lang="ts">
-    import { defineComponent, ref } from 'vue';
-    import { initData } from '@/common/methods';
-    import filterCustomTable from '@/views/information/spot-contract/components/filterTable/index.vue';
-    import { getCustomList } from '../setup';
-    import { openModal } from '@/common/setup/modal/index';
-    import contextMenu from '@/common/components/contextMenu/index.vue';
-    import { MenuItem } from '@/common/components/contextMenu/interface';
-    import AddSpotContract from '@/views/information/spot-contract/components/add/index.vue';
+import { defineComponent, Ref, ref } from 'vue';
+import { initData } from '@/common/methods';
+import filterCustomTable from '@/views/information/spot-contract/components/filterTable/index.vue';
+import { getCustomList } from '../setup';
+import { openModal } from '@/common/setup/modal/index';
+import contextMenu from '@/common/components/contextMenu/index.vue';
+import { MenuItem } from '@/common/components/contextMenu/interface';
+import AddSpotContract from '@/views/information/spot-contract/components/add/index.vue';
 
-    export default defineComponent({
-        name: 'spot-contract-not-commit',
-        components: {
-            filterCustomTable,
-            contextMenu,
-            AddSpotContract,
-        },
-        setup() {
-            const { spotContractList, actionQuery, columns, getColumns, search, loading, handlePermission } = getCustomList();
-            const { hasPermission } = handlePermission('spot_contract_unsubmitted');
-            const { openAction } = openModal('addSpotContract');
-            const contextMenuList = ref<MenuItem[]>([]);
-            initData(() => {
-                actionQuery(2);
-                getColumns();
-            });
-            return { spotContractList, columns, search, contextMenuList, openAction, loading, hasPermission };
-        },
-    });
+// 处理现货合同详情
+function handleDetail(contextMenuList: Ref<MenuItem[]>) {
+    const { openAction } = openModal('spotContractDetail');
+    contextMenuList.value.push({ lable: '详情', callback: openAction });
+}
+// 重新提交现货合同
+function handleResubmit(contextMenuList: Ref<MenuItem[]>) {
+    const { openAction } = openModal('resubmitSpotContract');
+    contextMenuList.value.push({ lable: '重新提交', callback: openAction });
+}
+// 删除现货合同
+function handleDelete(contextMenuList: Ref<MenuItem[]>) {
+    const { openAction } = openModal('deleteSpotContract');
+    contextMenuList.value.push({ lable: '删除', callback: openAction });
+}
+// 修改现货合同
+function handleModify(contextMenuList: Ref<MenuItem[]>) {
+    const { openAction } = openModal('modifySpotContract');
+    contextMenuList.value.push({ lable: '修改', callback: openAction });
+}
+
+export default defineComponent({
+    name: 'spot-contract-not-commit',
+    components: {
+        filterCustomTable,
+        contextMenu,
+        AddSpotContract,
+    },
+    setup() {
+        const { spotContractList, actionQuery, columns, getColumns, search, loading, handlePermission } = getCustomList();
+        const { hasPermission } = handlePermission('spot_contract_unsubmitted');
+        const { openAction } = openModal('addSpotContract');
+        const contextMenuList = ref<MenuItem[]>([]);
+        initData(() => {
+            actionQuery(2);
+            getColumns();
+        });
+        return { spotContractList, columns, search, contextMenuList, openAction, loading, hasPermission };
+    },
+});
 </script>
 
 <style lang="less">
-    .spot-contract-not-commit {
-    }</style
+.spot-contract-not-commit {
+}
+</style
 >;