From 356f54467f525f437f41271fb62f6be66f2ab1e5 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 18 十二月 2023 17:36:11 +0800
Subject: [PATCH] 1. 调整飞羽环境用户信息的编辑

---
 src/views/fytz/user/UserInfo.vue |   73 +++++++++++++++++-------------------
 1 files changed, 34 insertions(+), 39 deletions(-)

diff --git a/src/views/fytz/user/UserInfo.vue b/src/views/fytz/user/UserInfo.vue
index 27d814e..ac17524 100644
--- a/src/views/fytz/user/UserInfo.vue
+++ b/src/views/fytz/user/UserInfo.vue
@@ -6,7 +6,11 @@
         :level="4"
         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"
@@ -45,20 +43,16 @@
       <el-table-column prop="userInfo.extension1" label="鍖哄幙" width="90" />
       <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>
       </el-table-column>
       <el-table-column prop="userInfo.usertype" label="鐢ㄦ埛绫诲瀷" width="90" />
-      <el-table-column fixed="right" align="right" label="鎿嶄綔" width="140">
+      <el-table-column fixed="right" align="right" label="鎿嶄綔" width="160">
         <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>
@@ -70,13 +64,13 @@
             @click="editRow(scope)"
             >鏌ョ湅</el-button
           >
-          <!-- <el-button
+          <el-button
             :loading="scope.row.loading2"
-            :type="scope.row.extension1 != '0' ? 'danger' : 'primary'"
+            :type="scope.row.userInfo.isenable != '0' ? 'danger' : 'primary'"
             size="small"
             @click="itemActive(scope)"
-            >{{ scope.row.extension1 != '0' ? '涓嬬嚎' : '涓婄嚎' }}</el-button
-          > -->
+            >{{ scope.row.userInfo.isenable != '0' ? '涓嬬嚎' : '涓婄嚎' }}</el-button
+          >
         </template>
       </el-table-column>
     </template>
@@ -93,7 +87,7 @@
 
 export default {
   components: {
-    CompUserInfoAddDrawer,
+    CompUserInfoAddDrawer
   },
   data() {
     return {
@@ -101,26 +95,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,43 +134,44 @@
         if (res) {
           func({
             data: res.data,
-            total: res.head.totalCount,
+            total: res.head.totalCount
           });
         }
       });
     },
     editRow(scope) {
       scope.row.loading1 = true;
-      this.loadingStore.loadingStatus.push(() => (scope.row.loading1 = false));
-      this.$router.push(`userEdit/${scope.row.biGuid}`);
+      this.loadingStore.pushLoading(() => (scope.row.loading1 = false));
+      this.$router.push(`userEdit/${scope.row.userInfo.guid}`);
     },
     itemActive(scope) {
-      const rb = {};
-      rb.guid = scope.row.guid;
-      rb.extension1 = scope.row.extension1 != '0' ? '0' : '1';
-      const msg = scope.row.extension1 != '0' ? '涓嬬嚎' : '涓婄嚎';
+      const param = {
+        guid: scope.row.userInfo.guid,
+        isenable: !scope.row.userInfo.isenable
+      };
+      const msg = scope.row.userInfo.isenable ? '涓嬬嚎' : '涓婄嚎';
       useMessageBoxTip({
         confirmMsg: `纭${msg}璇ュ満鏅紵`,
         confirmTitle: msg,
-        onConfirm: () => {
+        onConfirm: async () => {
           scope.row.loading2 = true;
           return userApi
-            .updateScene(rb)
+            .updateUserInfo(param)
             .then((res) => {
-              if (res == 1) {
-                scope.row.extension1 = rb.extension1;
+              if (res.success) {
+                scope.row.userInfo.isenable = param.isenable;
               }
             })
             .finally(() => {
               scope.row.loading2 = false;
             });
-        },
+        }
       });
     },
     tableRowClassName({ row }) {
       return row.userInfo.isenable ? 'online-row' : 'offline-row';
-    },
-  },
+    }
+  }
 };
 </script>
 <style></style>

--
Gitblit v1.9.3