Jelajahi Sumber

属性值 主体名称 和公司名称 调换

GHH 5 hari lalu
induk
melakukan
e4423056d7

+ 3 - 2
src/api/qw/externalContactTransferAudit.js

@@ -8,10 +8,11 @@ export function listExternalContactTransferAudit(query) {
   })
 }
 
-export function detail(auditId) {
+export function detail(auditId, params) {
   return request({
     url: '/qw/externalContactTransferCompanyAudit/detail/' + auditId,
     method: 'get',
+    params: params
   })
 }
 
@@ -21,4 +22,4 @@ export function audit(data) {
     method: 'post',
     data: data
   })
-}
+}

+ 104 - 23
src/views/qw/externalContactTransferAudit/index.vue

@@ -1,6 +1,16 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="主体名称" prop="corpId">
+        <el-select v-model="queryParams.corpId" placeholder="请选择主体名称" clearable filterable>
+          <el-option
+            v-for="item in corpOptions"
+            :key="item.CorpId"
+            :label="item.corpName"
+            :value="item.CorpId">
+          </el-option>
+        </el-select>
+      </el-form-item>
       <el-form-item label="公司名称" prop="companyName">
         <el-input
           v-model="queryParams.companyName"
@@ -10,15 +20,6 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="主体名称" prop="corpName">
-        <el-input
-          v-model="queryParams.corpName"
-          placeholder="请输入企微主体名称"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
       <el-form-item label="销售名称" prop="companyUserName">
         <el-input
           v-model="queryParams.companyUserName"
@@ -46,8 +47,13 @@
     </el-form>
 
     <el-table v-loading="loading" :data="list" border>
-      <el-table-column label="主体名称" align="center" prop="corpName" />
+      <el-table-column label="ID" align="center" prop="id" />
       <el-table-column label="接替公司名称" align="center" prop="companyName" />
+      <el-table-column label="主体名称" align="center">
+        <template slot-scope="scope">
+          {{ getCorpNameByCorpId(scope.row.corpId) || scope.row.corpName }}
+        </template>
+      </el-table-column>
       <el-table-column label="接替销售名称" align="center" prop="companyUserName" />
       <el-table-column label="接替企微用户名称" align="center" prop="qwUserName" />
       <el-table-column label="审核状态" align="center" prop="status">
@@ -109,6 +115,7 @@
 
     <el-drawer title="详情" size="75%" :visible.sync="dialogViewVisible" append-to-body>
       <el-table v-loading="detailLoading" :data="userList" border>
+        <el-table-column label="ID" align="center" prop="id" />
         <el-table-column label="客户名称" align="center" prop="externalUserName" />
         <el-table-column label="原公司名称" align="center" prop="companyName" />
         <el-table-column label="原销售名称" align="center" prop="companyUserName" />
@@ -120,12 +127,20 @@
           </template>
         </el-table-column>
       </el-table>
+      <pagination
+        v-show="detailTotal>0"
+        :total="detailTotal"
+        :page.sync="detailQueryParams.pageNum"
+        :limit.sync="detailQueryParams.pageSize"
+        @pagination="handleDetailPagination"
+      />
     </el-drawer>
   </div>
 </template>
 
 <script>
 import { audit, detail, listExternalContactTransferAudit } from '@/api/qw/externalContactTransferAudit'
+import { getMyQwCompanyList } from '@/api/qw/user'
 
 export default {
   name: "externalContactTransferAudit",
@@ -137,7 +152,7 @@ export default {
         pageNum: 1,
         pageSize: 10,
         companyName: null,
-        corpName: null,
+        corpId: null,
         companyUserName: null,
         status: 0,
       },
@@ -149,6 +164,12 @@ export default {
       dialogViewVisible: false,
       detailLoading: false,
       userList: [],
+      detailTotal: 0,
+      detailQueryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        auditId: null
+      },
       from: {
         id: null,
         type: null,
@@ -159,7 +180,8 @@ export default {
           { required: true, message: "请选择审核结果", trigger: "blur" }
         ]
       },
-      submitLoading: false
+      submitLoading: false,
+      corpOptions: [],
     }
   },
   created() {
@@ -169,6 +191,7 @@ export default {
     this.getDicts("sys_qw_transfer_status").then((response) => {
       this.replaceStatusOptions = response.data;
     });
+    this.getCorpOptions()
     this.handleQuery()
   },
   methods: {
@@ -181,12 +204,45 @@ export default {
         pageNum: 1,
         pageSize: 10,
         companyName: null,
-        corpName: null,
+        corpId: null,
         companyUserName: null,
         status: 0,
       };
-      this.resetForm("queryForm");
-      this.handleQuery();
+      this.$nextTick(() => {
+        this.resetForm("queryForm");
+        this.handleQuery();
+      });
+    },
+    getCorpOptions() {
+      // 调用接口获取主体名称下拉选项
+      getMyQwCompanyList().then(response => {
+        console.log('获取到的主体名称数据:', response.data);
+        if (response.data && Array.isArray(response.data)) {
+          // 确保CorpId和corpName字段正确处理
+          this.corpOptions = response.data.map(item => {
+            return {
+              CorpId: item.corpId ? item.corpId.toString() : '',  // 使用corpId而不是CorpId
+              corpName: item.corpName || ''
+            };
+          });
+          console.log('处理后的corpOptions:', this.corpOptions);
+        } else {
+          this.corpOptions = [];
+        }
+      }).catch(error => {
+        console.error('获取主体名称列表失败:', error);
+        this.corpOptions = [];
+      });
+    },
+    // 添加一个方法来根据CorpId获取corpName
+    getCorpNameByCorpId(corpId) {
+      if (!corpId || !this.corpOptions || this.corpOptions.length === 0) {
+        return '';
+      }
+      
+      // 查找匹配的corpName
+      const corp = this.corpOptions.find(item => item.CorpId === (corpId ? corpId.toString() : ''));
+      return corp ? corp.corpName : '';
     },
     getList() {
       this.loading = true
@@ -194,10 +250,19 @@ export default {
         ...this.queryParams,
         status: this.queryParams.status === 0 ? null : this.queryParams.status
       }
+      
+      // 如果选择了主体名称,则将其作为corpId传递,否则删除该参数
+      if (this.queryParams.corpId) {
+        params.corpId = this.queryParams.corpId;
+      } else {
+        delete params.corpId;
+      }
+      
       listExternalContactTransferAudit(params).then(response => {
         this.list = response.rows.map(item => {
           return {
             ...item,
+            corpId: item.corpId ? item.corpId.toString() : item.corpId, // 确保corpId也是字符串类型
             createTime: item.createTime ? item.createTime.replace("T", " ") : null,
             auditTime: item.auditTime ? item.auditTime.replace("T", " ") : null,
           }
@@ -222,11 +287,31 @@ export default {
     },
     handleView(row) {
       this.detailLoading = true
-      detail(row.id).then(response => {
-        this.userList = response.data
+      this.detailQueryParams.auditId = row.id
+      this.detailQueryParams.pageNum = 1
+      this.getDetailList()
+      this.dialogViewVisible = true
+    },
+    handleDetailPagination({ page, limit }) {
+      this.detailQueryParams.pageNum = page
+      this.detailQueryParams.pageSize = limit
+      this.getDetailList()
+    },
+    getDetailList() {
+      this.detailLoading = true
+      // 确保传递正确的分页参数
+      const params = {
+        pageNum: this.detailQueryParams.pageNum,
+        pageSize: this.detailQueryParams.pageSize
+      };
+      
+      detail(this.detailQueryParams.auditId, params).then(response => {
+        this.userList = response.rows
+        this.detailTotal = response.total
+        this.detailLoading = false
+      }).catch(() => {
         this.detailLoading = false
       })
-      this.dialogViewVisible = true
     },
     submitForm() {
       this.$refs["auditForm"].validate(valid => {
@@ -252,10 +337,6 @@ export default {
       this.dialogAuditVisible = false
       this.reset()
     },
-  },
+  }
 }
 </script>
-
-<style scoped>
-
-</style>