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/userLevel/index.vue | 140 ++++++++++++++++++++++++++++++---------------- 1 files changed, 90 insertions(+), 50 deletions(-) diff --git a/src/views/unifiedManage/userLevel/index.vue b/src/views/unifiedManage/userLevel/index.vue index 3dc93de..94d452e 100644 --- a/src/views/unifiedManage/userLevel/index.vue +++ b/src/views/unifiedManage/userLevel/index.vue @@ -59,28 +59,19 @@ </div> </div> </div> - <!-- 鏂板缓/缂栬緫 --> - <AddUserLevel v-if="editConfig.visible" :edit-common-config="editConfig" /> + <div class="overSpread" v-show="isopen"></div> + <!-- 娣诲姞/缂栬緫 --> + <AddUserLevel :isopen="isopen" @shutdown="shutdown" :editRow="editRow" /> </div> </template> <script> import pageMixin from "@/components/makepager/pager/mixin/pageMixin" import AddUserLevel from "@/views/unifiedManage/userLevel/components/AddUserLevel" +import { getListRole, getUserList, roleChange, deleteRole } from "@/api/unifiedManage/userLevel" export default { name: "UserLevel", - props: { - isDetail: { - type: Boolean, - default: false - }, - addConfig: { - type: Object, - default: () => { - return {} - } - } - }, + props: {}, mixins: [pageMixin], components: { AddUserLevel }, computed: {}, @@ -123,6 +114,7 @@ ], showBottomCol: ["鐢ㄦ埛鍚�", "濮撳悕", "鎵嬫満鍙�", "宀椾綅鑱屽姟", "鐘舵��"], isopen: false, + editRow: {}, editConfig: { visible: false, title: "鏂板缓", @@ -138,13 +130,58 @@ }, created() { this.setTable() + this.getData() }, methods: { + // 瑙掕壊鍒楄〃 + async getData(val) { + this.data.page = this.pagerOptions.currPage + this.data.pageSize = this.pagerOptions.pageSize + const res = await getListRole(this.data) + console.log(res) + this.tableList.tableInfomation = res.data.list + this.pagerOptions.totalCount = res.data.total + + if (this.pagerOptions.totalCount > 0) { + let row = this.tableList.tableInfomation[0] + this.selectRow = this.tableList.tableInfomation.length > 0 ? this.tableList.tableInfomation[0] : {} + this.getUserList(row.id) + } + if (val !== "search") { + // this.overview(); + } + }, + // 鐢ㄦ埛鍒楄〃 + async getUserList(id) { + let params = { + page: 0, + pageSize: 0, + id: id + } + const res = await getUserList(params) + if (res.data.list && res.data.list.length > 0) { + const list = res.data.list.map((item) => { + let dutyList = [] + item.dutyIDs.forEach((val) => { + dutyList.push(val.dutyName) + }) + return { + ...item, + dutyNames: dutyList.join(", ") + } + }) + this.bottomTableList.tableInfomation = list || [] + } else { + this.bottomTableList.tableInfomation = [] + } + }, // 鏂板缓 addBtnClick() { - this.editConfig.title = "鏂板缓" - this.editConfig.infomation = { ...this.addConfig, currency: "浜烘皯甯�" } - this.editConfig.visible = true + // this.editConfig.title = "鏂板缓" + // this.editConfig.visible = true + // this.editConfig.infomation = {} + this.isopen = true + this.editRow = {} }, // 鎼滅储 searchClick(val) { @@ -167,25 +204,28 @@ // 鍚敤 鍋滅敤璇锋眰 async getRoleChange(row) { console.log(row) - // await roleChange({ - // id: row.id, - // status: !row.status, - // }).then((reply) => { - // if (reply && reply.code == 200) { - // let tips = row.status ? "鍋滅敤鎴愬姛" : "鍚敤鎴愬姛"; - // this.getData(); - // this.$message({ - // type: "success", - // message: tips, - // }); - // } - // }); + await roleChange({ + id: row.id, + status: !row.status + }).then((reply) => { + if (reply && reply.code == 200) { + let tips = row.status ? "鍋滅敤鎴愬姛" : "鍚敤鎴愬姛" + this.getData() + this.$message({ + type: "success", + message: tips + }) + } + }) }, // 缂栬緫 handleClick(val) { - this.editConfig.title = "缂栬緫" - this.editConfig.infomation = { ...val } - this.editConfig.visible = true + console.log(val) + // this.editConfig.title = "缂栬緫" + // this.editConfig.infomation = { ...val } + // this.editConfig.visible = true + this.editRow = val + this.isopen = true }, // 鍒犻櫎绛夌骇 delClick(row) { @@ -196,17 +236,23 @@ type: "warning" }) .then(() => { - // deleteRole(row.id).then((reply) => { - // if (reply && reply.code == 200) { - // this.getData(); - // this.$message({ - // type: "success", - // message: "鍒犻櫎鎴愬姛", - // }); - // } - // }); + deleteRole(row.id).then((reply) => { + if (reply && reply.code == 200) { + this.getData() + this.$message({ + type: "success", + message: "鍒犻櫎鎴愬姛" + }) + } + }) }) .catch(() => {}) + }, + shutdown() { + this.isopen = false + setTimeout(() => { + this.getData() + }, 200) }, // 琛岀偣鍑� tableRowClick(row) { @@ -245,15 +291,9 @@ // bottom this.setBottomList() }, - // 绛夌骇鍒楄〃 + // 鍒楄〃 setTableList(tableList) { tableList.allcol = tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label) - this.searchOptions = [] - for (let i = 0; i < tableList.tableColumn.length; i++) { - const label = tableList.tableColumn[i].label - const value = tableList.tableColumn[i].prop - this.searchOptions.push({ value: value, label: label }) - } }, // bom 鍒楄〃 setBottomList() { @@ -351,7 +391,7 @@ background-color: #fff; border-radius: 12px; min-height: 70px; - height: calc(52% - 60px); + height: calc(52% - 50px); margin-top: 10px; // padding: 10px 20px; .list-view { -- Gitblit v1.8.0