From bfb2c6cc4ddb03fa32dc2345cfbe3dc3d90c9a18 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期四, 22 二月 2024 10:14:07 +0800
Subject: [PATCH] 权限平台 联系人姓名相关bug修复

---
 src/views/unifiedManage/userManage/index.vue |  151 +++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 130 insertions(+), 21 deletions(-)

diff --git a/src/views/unifiedManage/userManage/index.vue b/src/views/unifiedManage/userManage/index.vue
index 8feb9ab..97c70f2 100644
--- a/src/views/unifiedManage/userManage/index.vue
+++ b/src/views/unifiedManage/userManage/index.vue
@@ -2,10 +2,11 @@
   <div class="user-manage">
     <div class="top-card">
       <CommonSearch
-        :show-add="false"
+        :add-title="'娣诲姞鐢ㄦ埛'"
         :amount-view="false"
         placeholder="璇疯緭鍏ョ敤鎴峰悕/鎵嬫満鍙�"
         @searchClick="onFilterSearch"
+        @addCommonClick="addBtnClick"
       >
         <!-- <template slot="leftButton">
           <el-button size="small" type="primary" @click="addBtnClick">鏂板缓</el-button>
@@ -21,7 +22,23 @@
               <el-table-column label="鎿嶄綔" width="120">
                 <template slot-scope="scope">
                   <el-button @click="viewClick(scope.row)" type="text" size="small">鏌ョ湅</el-button>
-                  <el-button @click="approveClick(scope.row)" type="text" size="small">瀹℃牳</el-button>
+                  <el-button
+                    v-if="scope.row.status == 0 || scope.row.status == 3"
+                    @click="changeStatusClick(scope.row, 1)"
+                    type="text"
+                    size="small"
+                    >鍚敤</el-button
+                  >
+                  <el-button
+                    v-else-if="scope.row.status == 1"
+                    @click="changeStatusClick(scope.row, 0)"
+                    type="text"
+                    size="small"
+                    >绂佺敤</el-button
+                  >
+                  <el-button v-else-if="scope.row.status == 2" @click="approveClick(scope.row)" type="text" size="small"
+                    >瀹℃牳</el-button
+                  >
                   <el-button @click="editClick(scope.row)" type="text" size="small">缂栬緫</el-button>
                 </template>
               </el-table-column>
@@ -33,55 +50,139 @@
         </div>
       </div>
     </div>
-    <!-- 鏂板缓/缂栬緫 -->
-    <!-- <AddSubOrderDialog v-if="editConfig.visible" :edit-common-config="editConfig" /> -->
+    <!-- 鏌ョ湅/缂栬緫 -->
+    <EditUserInfo ref="editUserInfoRef" :edit-common-config="editConfig" />
+    <!-- 瀹℃牳 -->
+    <ReviewDialog v-if="reviewConfig.visible" :edit-common-config="reviewConfig" />
   </div>
 </template>
 
 <script>
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
+import EditUserInfo from "@/views/unifiedManage/userManage/components/EditUserInfo"
+import ReviewDialog from "@/views/unifiedManage/userManage/components/ReviewDialog"
+import { listUser, changeStatus } from "@/api/unifiedManage/userManage"
 
 export default {
   name: "UserManage",
   props: {},
   mixins: [pageMixin],
-  components: {},
+  components: { EditUserInfo, ReviewDialog },
   computed: {},
   data() {
     return {
       tableList: {},
       tableColumn: [
-        { label: "鐢ㄦ埛鍚�", prop: "username" },
+        { label: "鐢ㄦ埛鍚�", prop: "userName", default: true },
         { label: "鎵嬫満鍙�", prop: "phone" },
-        { label: "鍏徃鍚嶇О", prop: "company" },
-        { label: "鑱旂郴浜哄鍚�", prop: "contact" },
-        { label: "閭", prop: "mailbox" },
-        { label: "琛屼笟", prop: "industry" },
+        { label: "鍏徃鍚嶇О", prop: "companyName" },
+        { label: "鑱旂郴浜哄鍚�", prop: "companyContact" },
+        { label: "閭", prop: "companyEmail" },
+        { label: "琛屼笟", prop: "companyTrade" },
         { label: "鍦板尯", prop: "region" },
-        { label: "鐘舵��", prop: "status" }
+        { label: "鐘舵��", prop: "status", isCallMethod: true, getCallMethod: this.getStatus }
       ],
-      showCol: ["鐢ㄦ埛鍚�", "鎵嬫満鍙�", "鍏徃鍚嶇О", "鑱旂郴浜哄鍚�", "閭", "琛屼笟", "鍦板尯", "鐘舵��"]
+      showCol: ["鐢ㄦ埛鍚�", "鎵嬫満鍙�", "鍏徃鍚嶇О", "鑱旂郴浜哄鍚�", "閭", "琛屼笟", "鍦板尯", "鐘舵��"],
+      editConfig: {
+        visible: false,
+        title: "鏌ョ湅",
+        form: {}
+      },
+      reviewConfig: {
+        visible: false,
+        infomation: {}
+      },
+      obj: {
+        page: 1,
+        pageSize: 15,
+        keyword: "",
+        useType: 1
+      }
     }
   },
   created() {
     this.setTable()
+    this.getData()
   },
   methods: {
+    // 鑾峰彇鍒楄〃鍊�
+    getData() {
+      this.obj.pageSize = this.pagerOptions.pageSize
+      this.obj.page = this.pagerOptions.currPage
+      listUser(this.obj).then((res) => {
+        console.log(res)
+        let list = res.data.list.map((item) => {
+          return {
+            ...item,
+            userName: item.username
+          }
+        })
+        this.tableList.tableInfomation = list || []
+        this.pagerOptions.totalCount = res.data.total
+      })
+    },
     // 鎼滅储
     onFilterSearch(val) {
-      console.log(val)
+      this.obj.keyword = val
+      this.pagerOptions.currPage = 1
+      this.getData()
     },
     // 鏌ョ湅
     viewClick(row) {
       console.log(row)
+      this.$refs.editUserInfoRef.isvisible = true
+      this.editConfig.title = "鏌ョ湅"
+      this.editConfig.form = row
     },
     // 瀹℃牳
     approveClick(row) {
       console.log(row)
+      this.reviewConfig.visible = true
+      this.reviewConfig.title = "鐢ㄦ埛瀹℃牳"
+      this.reviewConfig.infomation = { result: 3, ...row }
+    },
+    // 鍋滅敤
+    changeStatusClick(row, status) {
+      if (status === 0) {
+        this.$confirm("鏄惁绂佺敤姝ょ敤鎴�?", "鎻愮ず", {
+          confirmButtonText: "纭畾",
+          cancelButtonText: "鍙栨秷",
+          type: "warning"
+        })
+          .then(() => {
+            this.changeStatus(row, status)
+          })
+          .catch(() => {})
+      } else {
+        this.changeStatus(row, status)
+      }
+    },
+    // 鍚敤/绂佺敤
+    changeStatus(row, status) {
+      changeStatus({
+        status: status,
+        userId: row.id
+      }).then((res) => {
+        console.log(res)
+        let messageStr = status === 0 ? "绂佺敤鎴愬姛" : "鍚敤鎴愬姛"
+        this.$message.success(messageStr)
+        this.getData()
+      })
     },
     // 缂栬緫
     editClick(row) {
       console.log(row)
+      this.$refs.editUserInfoRef.isvisible = true
+      this.editConfig.title = "缂栬緫"
+      this.editConfig.form = { ...row }
+    },
+    // 娣诲姞鐢ㄦ埛
+    addBtnClick() {
+      this.$refs.editUserInfoRef.isvisible = true
+      this.editConfig.title = "娣诲姞"
+      this.editConfig.form = {
+        roleIDs: []
+      }
     },
     // 鍒楄〃鍒濆鍖�
     setTable() {
@@ -89,7 +190,7 @@
         selectIndex: true,
         tableInfomation: [
           {
-            usename: "娴嬭瘯",
+            username: "娴嬭瘯",
             status: 1
           }
         ],
@@ -98,12 +199,6 @@
         tableColumn: this.setColumnVisible(this.showCol)
       }
       this.tableList.allcol = this.tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
-      this.searchOptions = []
-      for (let i = 0; i < this.tableList.tableColumn.length; i++) {
-        const label = this.tableList.tableColumn[i].label
-        const value = this.tableList.tableColumn[i].prop
-        this.searchOptions.push({ value: value, label: label })
-      }
     },
     setColumnVisible(showCol) {
       return this.tableColumn.map((ele) => {
@@ -116,6 +211,20 @@
     selTableCol(val) {
       this.showcol = val
       this.tableList.tableColumn = this.setColumnVisible(val)
+    },
+    // 鐘舵��
+    getStatus(val) {
+      return val === 0
+        ? "绂佺敤"
+        : val === 1
+        ? "鍚敤涓�"
+        : val === 2
+        ? "寰呭鏍�"
+        : val === 3
+        ? "寰呭惎鐢�"
+        : val === 4
+        ? "宸叉嫆缁�"
+        : ""
     }
   }
 }
@@ -142,7 +251,7 @@
     .body-card {
       background-color: #fff;
       border-radius: 12px;
-      height: 100%;
+      height: calc(100% - 10px);
       overflow: hidden;
     }
     .list-view {

--
Gitblit v1.8.0