From b195c95d3a37995f6ff2aaa8038173660ec49d76 Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期五, 05 一月 2024 18:43:05 +0800 Subject: [PATCH] 接口联调 --- src/views/unifiedManage/userManage/index.vue | 107 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 90 insertions(+), 17 deletions(-) diff --git a/src/views/unifiedManage/userManage/index.vue b/src/views/unifiedManage/userManage/index.vue index 64ad55d..13dbccd 100644 --- a/src/views/unifiedManage/userManage/index.vue +++ b/src/views/unifiedManage/userManage/index.vue @@ -21,7 +21,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> @@ -44,6 +60,8 @@ 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: {}, @@ -56,12 +74,12 @@ tableColumn: [ { label: "鐢ㄦ埛鍚�", prop: "username", default: true }, { label: "鎵嬫満鍙�", prop: "phone" }, - { label: "鍏徃鍚嶇О", prop: "company" }, - { label: "鑱旂郴浜哄鍚�", prop: "contact" }, - { label: "閭", prop: "email" }, + { label: "鍏徃鍚嶇О", prop: "companyName" }, + { label: "鑱旂郴浜哄鍚�", prop: "nickName" }, + { label: "閭", prop: "companyEmail" }, { label: "琛屼笟", prop: "industry" }, { label: "鍦板尯", prop: "region" }, - { label: "鐘舵��", prop: "status" } + { label: "鐘舵��", prop: "status", isCallMethod: true, getCallMethod: this.getStatus } ], showCol: ["鐢ㄦ埛鍚�", "鎵嬫満鍙�", "鍏徃鍚嶇О", "鑱旂郴浜哄鍚�", "閭", "琛屼笟", "鍦板尯", "鐘舵��"], editConfig: { @@ -72,37 +90,84 @@ 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) + this.tableList.tableInfomation = res.data.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.editConfig.visible = true this.editConfig.title = "鏌ョ湅" - this.editConfig.tableInfomation = { ...row } + this.editConfig.form = row }, // 瀹℃牳 approveClick(row) { console.log(row) this.reviewConfig.visible = true this.reviewConfig.title = "鐢ㄦ埛瀹℃牳" - this.reviewConfig.tableInfomation = { ...row } + this.reviewConfig.infomation = { ...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.editConfig.visible = true this.editConfig.title = "缂栬緫" - this.editConfig.tableInfomation = { ...row } + this.editConfig.form = { ...row } }, // 鍒楄〃鍒濆鍖� setTable() { @@ -110,7 +175,7 @@ selectIndex: true, tableInfomation: [ { - usename: "娴嬭瘯", + username: "娴嬭瘯", status: 1 } ], @@ -119,12 +184,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) => { @@ -137,6 +196,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 + ? "宸叉嫆缁�" + : "" } } } @@ -163,7 +236,7 @@ .body-card { background-color: #fff; border-radius: 12px; - height: 100%; + height: calc(100% - 10px); overflow: hidden; } .list-view { -- Gitblit v1.8.0