li.shaoyi 4 年之前
父节点
当前提交
a123f47c85
共有 2 个文件被更改,包括 60 次插入38 次删除
  1. 41 28
      src/views/information/custom/index.vue
  2. 19 10
      src/views/information/spot-contract/list/purchase/index.vue

+ 41 - 28
src/views/information/custom/index.vue

@@ -1,32 +1,31 @@
 <template>
-    <!-- 客户资料 -->
-    <div class="plan_uncommitted" :loading="loading">
-        <Filter @search="updateColumn">
-            <mtp-table-button class="btn-list-sticky" :buttons="addButton" @click="openComponent" />
-        </Filter>
-        <a-table :columns="getColumns(columns)" class="srcollYTable" :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }" :pagination="false" :loading="loading" :expandedRowKeys="expandedRowKeys" :customRow="Rowclick" rowKey="key" :data-source="tableList">
-            <!-- 额外的展开行 -->
-            <template #expandedRowRender="{ record }">
-                <mtp-table-button class="btn-list-sticky" :buttons="buttons" :record="record" @click="openComponent" />
-            </template>
-            <template #status="{ text }">
-                <a>{{ getStatusName(text) }}</a>
-            </template>
-            <template #userinfotype="{ text }">
-                <a>{{ getUserInfoTypeName(text) }}</a>
-            </template>
-            <template #attachment1="{ text, record }">
-                <a>{{ text }}</a
-                ><a>{{ record.attachment2 }}</a>
-            </template>
-            <template #cardtype="{ text }">
-                <a>{{ getCardTypeEnumItemName(text) }}</a>
-            </template>
-        </a-table>
-        <!-- 右键 -->
-        <contextMenu :contextMenu="contextMenu" @cancel="closeContext" :list="buttons"> </contextMenu>
-        <component :is="componentId" v-if="componentId" :selectedRow="selectedRow" @cancel="closeComponent"> </component>
-    </div>
+  <!-- 客户资料 -->
+  <div class="plan_uncommitted" :loading="loading">
+    <Filter @search="updateColumn">
+      <mtp-table-button class="btn-list-sticky" :buttons="addButton" @click="openComponent" />
+    </Filter>
+    <a-table :columns="getColumns(columns)" class="srcollYTable" :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }" :pagination="false" :loading="loading" :expandedRowKeys="expandedRowKeys" :customRow="Rowclick" rowKey="key" :data-source="tableList">
+      <!-- 额外的展开行 -->
+      <template #expandedRowRender="{ record }">
+        <mtp-table-button class="btn-list-sticky" :buttons="handleBtnList(buttons,record)" :record="record" @click="openComponent" />
+      </template>
+      <template #status="{ text }">
+        <a>{{ getStatusName(text) }}</a>
+      </template>
+      <template #userinfotype="{ text }">
+        <a>{{ getUserInfoTypeName(text) }}</a>
+      </template>
+      <template #attachment1="{ text, record }">
+        <a>{{ text }}</a><a>{{ record.attachment2 }}</a>
+      </template>
+      <template #cardtype="{ text }">
+        <a>{{ getCardTypeEnumItemName(text) }}</a>
+      </template>
+    </a-table>
+    <!-- 右键 -->
+    <contextMenu :contextMenu="contextMenu" @cancel="closeContext" :list="buttons"> </contextMenu>
+    <component :is="componentId" v-if="componentId" :selectedRow="selectedRow" @cancel="closeComponent"> </component>
+  </div>
 </template>
 
 <script lang="ts">
@@ -41,6 +40,7 @@ import Filter from './compoments/filterTable/index.vue';
 import { pingan_custom_column } from './setup';
 import { ColumnType } from '@/common/methods/table';
 import { getTableColumns } from '@/common/setup/table';
+import { BtnListType } from '@/common/components/btnList/interface';
 
 export default defineComponent({
     name: EnumRouterName.plan_audit,
@@ -80,6 +80,18 @@ export default defineComponent({
             }
         };
 
+        // 处理根据状态显示对应按钮
+        const handleBtnList = (btnList: BtnListType[], item: QueryCustomInfoType) => {
+            switch (item.status) {
+                case 2: // 待审核
+                    return btnList.filter((e) => e.code !== 'modify');
+                case 5: // 拒绝审核
+                    return btnList.filter((e) => e.code !== 'check');
+                default:
+                    return btnList;
+            }
+        };
+
         // 表头
         const getColumns = (columns: ColumnType[]) => {
             if (isPingAnOem()) {
@@ -115,6 +127,7 @@ export default defineComponent({
             getUserInfoTypeName,
             getCardTypeEnumItemName,
             getColumns,
+            handleBtnList,
         };
     },
 });

+ 19 - 10
src/views/information/spot-contract/list/purchase/index.vue

@@ -8,7 +8,7 @@
       <!-- 额外的展开行 -->
       <!-- 额外的展开行 -->
       <template #expandedRowRender="{ record }">
-        <mtp-table-button class="btn-list-sticky" :buttons="secondBtn" :record="record" @click="openComponent" />
+        <mtp-table-button class="btn-list-sticky" :buttons="handleBtnList(secondBtn,record)" :record="record" @click="openComponent" />
       </template>
       <template #biztype="{ text }">
         <a>{{ getBizTypeName(text) }}</a>
@@ -63,6 +63,7 @@ import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
 import { QuerySpotContract } from '@/services/go/ermcp/spot-contract';
 import { EnumRouterName } from '@/common/constants/enumRouterName';
 import { getTableButton } from '@/common/setup/table/button';
+import { BtnListType } from '@/common/components/btnList/interface';
 import { useRoute } from 'vue-router';
 
 export default defineComponent({
@@ -73,7 +74,8 @@ export default defineComponent({
         detail: defineAsyncComponent(() => import('../../components/detail/index.vue')),
         add: defineAsyncComponent(() => import('../../components/add/index.vue')),
         resubmit: defineAsyncComponent(() => import('../../components/modify/index.vue')),
-        cancel: defineAsyncComponent(() => import('../../components/delete/index.vue')),
+        cancel: defineAsyncComponent(() => import('../../components/cancel/index.vue')),
+        delete: defineAsyncComponent(() => import('../../components/delete/index.vue')),
         MtpTableButton,
     },
     setup() {
@@ -100,14 +102,20 @@ export default defineComponent({
             queryBusinessManager();
         };
 
-        // function handleButton(item: Ermcp3ContractRsp) {
-        //     const { contracctstatus } = item;
-        //     if (['']) {
-        //         return btnList;
-        //     } else {
-        //         return btnList.filter((e) => e.code === 'detail');
-        //     }
-        // }
+        // 处理根据状态显示对应按钮
+        const handleBtnList = (btnList: BtnListType[], item: Ermcp3ContractRsp) => {
+            switch (item.contracctstatus) {
+                case 1: // 待审核
+                case 2: // 执行中
+                case 3: // 正常完结
+                case 5: // 异常完结
+                    return btnList.filter((e) => e.code !== 'delete');
+                case 6: // 已撤回
+                    return btnList.filter((e) => e.code !== 'cancel');
+                default:
+                    return btnList;
+            }
+        };
 
         // 表格通用逻辑
         const param: ComposeTableParam = {
@@ -133,6 +141,7 @@ export default defineComponent({
             handleEnumdic,
             firstBtn,
             secondBtn,
+            handleBtnList,
         };
     },
 });