From f58f07875461b7cc8205978cf4f0fac86564df72 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 20 十二月 2023 17:49:01 +0800
Subject: [PATCH] 新增调试下载环信码功能

---
 src/views/fytz/user/UserInfo.vue |  141 +++++++++++++++++++++++++++-------------------
 1 files changed, 82 insertions(+), 59 deletions(-)

diff --git a/src/views/fytz/user/UserInfo.vue b/src/views/fytz/user/UserInfo.vue
index 2d9bcd2..3269798 100644
--- a/src/views/fytz/user/UserInfo.vue
+++ b/src/views/fytz/user/UserInfo.vue
@@ -3,10 +3,14 @@
     <template #options>
       <FYOptionLocation
         :allOption="true"
-        :level="4"
+        :level="5"
         v-model:value="formSearch._locations"
       ></FYOptionLocation>
-      <FYOptionText label="鍏抽敭瀛�" placeholder="杈撳叆鍚嶇О鍏抽敭瀛�" v-model:value="formSearch.searchText"></FYOptionText>
+      <FYOptionText
+        label="鍏抽敭瀛�"
+        placeholder="杈撳叆鍚嶇О鍏抽敭瀛�"
+        v-model:value="formSearch.searchText"
+      ></FYOptionText>
       <FYOptionScene
         :allOption="true"
         :type="1"
@@ -19,13 +23,7 @@
     </template>
 
     <template #table-column>
-      <el-table-column
-        type="index"
-        fixed="left"
-        prop="userInfo.realname"
-        label="鍚嶇О"
-        width="400"
-      >
+      <el-table-column type="index" fixed="left" prop="userInfo.realname" label="鍚嶇О" width="400">
         <template #default="scope">
           <el-tooltip
             effect="dark"
@@ -38,45 +36,57 @@
         </template>
       </el-table-column>
       <el-table-column prop="userInfo.acountname" label="璐﹀彿" width="110" />
-      <el-table-column prop="sceneTypeName" label="绫诲瀷" width="130" />
-      <el-table-column prop="biProvinceName" label="鐪�" width="90" />
-      <el-table-column prop="biCityName" label="甯�" width="90" />
+      <el-table-column prop="sceneTypeName" label="绫诲瀷" width="100" />
+      <el-table-column prop="biProvinceName" label="鐪�" width="80" />
+      <el-table-column prop="biCityName" label="甯�" width="80" />
       <!-- <el-table-column prop="districtname" label="鍖哄幙" width="90" /> -->
-      <el-table-column prop="userInfo.extension1" label="鍖哄幙" width="90" />
+      <el-table-column prop="userInfo.extension1" label="鍖哄幙" width="80" />
       <el-table-column prop="biTownName" label="琛楅亾" width="110" />
       <el-table-column prop="biArea" label="闆嗕腑鍖�" width="110" />
-      <el-table-column prop="biManagementCompany" label="鐗╀笟" min-width="110"/>
+      <el-table-column prop="biManagementCompany" label="鐗╀笟" min-width="110" />
       <el-table-column prop="userInfo.isenable" label="鐘舵��" width="90">
-        <template #default="scope">
-          {{ scope.row.userInfo.isenable ? '涓婄嚎涓�' : '宸蹭笅绾�' }}
+        <template #default="{ row }">
+          {{ row.userInfo.isenable ? '涓婄嚎涓�' : '宸蹭笅绾�' }}
         </template>
       </el-table-column>
       <el-table-column prop="userInfo.usertype" label="鐢ㄦ埛绫诲瀷" width="90" />
-      <el-table-column fixed="right" align="right" label="鎿嶄綔" width="160">
+      <el-table-column fixed="right" align="right" label="鎿嶄綔" width="190">
         <template #header>
-          <el-button
-            icon="DocumentAdd"
-            size="default"
-            type="success"
-            @click="drawer = true"
+          <el-button icon="DocumentAdd" size="default" type="success" @click="drawer = true"
             >鏂板鐢ㄦ埛</el-button
           >
         </template>
-        <template #default="scope">
-          <el-button
-            :loading="scope.row.loading1"
-            type="primary"
-            size="small"
-            @click="editRow(scope)"
-            >鏌ョ湅</el-button
-          >
-          <el-button
-            :loading="scope.row.loading2"
-            :type="scope.row.userInfo.isenable != '0' ? 'danger' : 'primary'"
-            size="small"
-            @click="itemActive(scope)"
-            >{{ scope.row.userInfo.isenable != '0' ? '涓嬬嚎' : '涓婄嚎' }}</el-button
-          >
+        <template #default="{ row }">
+          <el-space>
+            <!-- <el-button :loading="row.loading1" type="primary" size="small" @click="editRow(row)"
+              >鏌ョ湅</el-button
+            > -->
+            <el-button
+              :loading="row.loading2"
+              :type="row.userInfo.isenable != '0' ? 'danger' : 'primary'"
+              size="small"
+              @click="itemActive(row)"
+              >{{ row.userInfo.isenable != '0' ? '涓嬬嚎' : '涓婄嚎' }}</el-button
+            >
+            <el-dropdown
+              split-button
+              :loading="row.loading1"
+              size="small"
+              type="primary"
+              @click="editRow(row)"
+              @command="handleCommand"
+              trigger="click"
+            >
+              鏌ョ湅
+              <template #dropdown>
+                <el-dropdown-menu>
+                  <el-dropdown-item icon="Download" :command="{ c: 1, p: row }"
+                    >涓嬭浇鐜俊鐮�</el-dropdown-item
+                  >
+                </el-dropdown-menu>
+              </template>
+            </el-dropdown>
+          </el-space>
         </template>
       </el-table-column>
     </template>
@@ -86,6 +96,7 @@
 
 <script>
 import userApi from '@/api/fytz/userApi';
+import creditApi from '@/api/fytz/creditApi';
 import { useLoadingStore } from '@/stores/loadingStore';
 import { mapStores } from 'pinia';
 import { useMessageBoxTip } from '@/composables/messageBox';
@@ -93,7 +104,7 @@
 
 export default {
   components: {
-    CompUserInfoAddDrawer,
+    CompUserInfoAddDrawer
   },
   data() {
     return {
@@ -101,26 +112,26 @@
         _locations: {},
         searchText: '',
         scensetype: {},
-        online: {},
+        online: {}
       },
-      drawer: false,
+      drawer: false
     };
   },
   computed: {
-    ...mapStores(useLoadingStore),
+    ...mapStores(useLoadingStore)
   },
   methods: {
     onSearch(page, func) {
       const f = this.formSearch;
       const area = {};
       // 琛屾斂鍖哄垝
-      area.provinceCode = f._locations.pCode ? f._locations.pCode + '0000' : undefined
+      area.provinceCode = f._locations.pCode;
       area.provinceName = f._locations.pName;
       if (area.provinceCode == null) {
         area.provinceCode = null;
         area.provinceName = null;
       }
-      area.cityCode = f._locations.cCode ? f._locations.cCode.substring(0, 3) + '100' : undefined
+      area.cityCode = f._locations.cCode;
       area.cityName = f._locations.cName;
       area.districtCode = f._locations.dCode;
       area.districtName = f._locations.dName;
@@ -140,44 +151,56 @@
         if (res) {
           func({
             data: res.data,
-            total: res.head.totalCount,
+            total: res.head.totalCount
           });
         }
       });
     },
-    editRow(scope) {
-      scope.row.loading1 = true;
-      this.loadingStore.pushLoading(() => (scope.row.loading1 = false));
-      this.$router.push(`userEdit/${scope.row.userInfo.guid}`);
+    editRow(row) {
+      row.loading1 = true;
+      this.loadingStore.pushLoading(() => (row.loading1 = false));
+      this.$router.push(`userEdit/${row.userInfo.guid}`);
     },
-    itemActive(scope) {
+    itemActive(row) {
       const param = {
-        guid: scope.row.userInfo.guid,
-        isenable: !scope.row.userInfo.isenable
-      }
-      const msg = scope.row.userInfo.isenable ? '涓嬬嚎' : '涓婄嚎';
+        guid: row.userInfo.guid,
+        isenable: !row.userInfo.isenable
+      };
+      const msg = row.userInfo.isenable ? '涓嬬嚎' : '涓婄嚎';
       useMessageBoxTip({
         confirmMsg: `纭${msg}璇ュ満鏅紵`,
         confirmTitle: msg,
-        onConfirm: () => {
-          scope.row.loading2 = true;
+        onConfirm: async () => {
+          row.loading2 = true;
           return userApi
             .updateUserInfo(param)
             .then((res) => {
               if (res.success) {
-                scope.row.userInfo.isenable = param.isenable;
+                row.userInfo.isenable = param.isenable;
               }
             })
             .finally(() => {
-              scope.row.loading2 = false;
+              row.loading2 = false;
             });
-        },
+        }
       });
     },
     tableRowClassName({ row }) {
       return row.userInfo.isenable ? 'online-row' : 'offline-row';
     },
-  },
+    handleCommand(e){
+      const userId = e.p.userInfo.guid
+      switch (e.c) {
+        // 涓嬭浇鐜俊鐮�
+        case 1:
+          creditApi.downloadCode(userId)
+          break;
+      
+        default:
+          break;
+      }
+    }
+  }
 };
 </script>
 <style></style>

--
Gitblit v1.9.3