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 | 410 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 365 insertions(+), 45 deletions(-)
diff --git a/src/views/unifiedManage/userLevel/index.vue b/src/views/unifiedManage/userLevel/index.vue
index e2cffce..94d452e 100644
--- a/src/views/unifiedManage/userLevel/index.vue
+++ b/src/views/unifiedManage/userLevel/index.vue
@@ -1,92 +1,412 @@
<template>
<div class="user-level">
- 鐢ㄦ埛绛夌骇
- <!-- <div v-if="isDetail" class="detail-top">
- <DetailListCommonBtn :query-class-options="queryClassOptions" />
- </div>
-
- <div v-else class="filter">
- <div class="filter-card">
- <CommonSearch :show-add="false" :amount-view="false" placeholder="璇疯緭鍏ュ崟鎹紪鍙�" @searchClick="onFilterSearch">
- <template slot="leftButton">
- <el-button size="small" type="primary" @click="addBtnClick">鏂板缓</el-button>
- </template>
- </CommonSearch>
- </div>
+ <div class="top-card">
+ <CommonSearch
+ :add-title="'鏂板绛夌骇'"
+ :total-object="totalObject"
+ :other-options="otherOptions"
+ :placeholder="'璇疯緭鍏ョ瓑绾у悕绉�'"
+ @addCommonClick="addBtnClick"
+ @searchClick="searchClick"
+ ></CommonSearch>
</div>
<div class="body">
- <div class="body-card">
+ <div class="content-top">
<div class="list-view">
<TableCommonView
ref="tableListRef"
:table-list="tableList"
- :show-summary="showSummary"
- @selClientClick="selClientClick"
- @selMasterClick="selMasterClick"
- @selCommonClick="selCommonClick"
- @getSelectArray="getSelectArray"
@selTableCol="selTableCol"
+ @tableRowClick="tableRowClick"
+ :selectClassRow="selectRow"
>
<template slot="tableButton">
- <el-table-column label="鎿嶄綔" width="90">
+ <el-table-column label="鎿嶄綔" width="120">
<template slot-scope="scope">
- <el-button @click="handleClick(scope.row)" type="text" size="small">缂栬緫</el-button>
- <el-button @click="deleteItem(scope.row.id)" type="text" size="small">鍒犻櫎</el-button>
+ <el-button v-if="scope.row.status" type="text" size="small" @click.stop="changeStatusClick(scope.row)"
+ >鍋滅敤</el-button
+ >
+ <el-button v-else @click.stop="getRoleChange(scope.row)" type="text" size="small">鍚敤</el-button>
+ <el-button @click.stop="handleClick(scope.row)" type="text" size="small">缂栬緫</el-button>
+ <el-button @click.stop="delClick(scope.row)" type="text" size="small">鍒犻櫎</el-button>
</template>
</el-table-column>
</template>
</TableCommonView>
</div>
+
<div class="btn-pager">
<PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
</div>
- </div> -->
- <!-- </div> -->
- <!-- 鏂板缓/缂栬緫 -->
- <!-- <AddSubOrderDialog v-if="editConfig.visible" :edit-common-config="editConfig" /> -->
+ </div>
+ <div class="content-bottom">
+ <div class="bottom-tabs bgcGrey">
+ <div
+ class="tab-pane"
+ @click="getTab(0)"
+ :style="{
+ background: TabsIndex == 0 ? '#2a78fb' : '#F1F3F8',
+ color: TabsIndex == 0 ? '#fff' : '#666'
+ }"
+ >
+ 绠$悊鍛�
+ </div>
+ </div>
+ <div class="list-view">
+ <TableCommonView :loading="loading" :table-list="bottomTableList" @selTableCol="selBottomTableCol">
+ </TableCommonView>
+ </div>
+ </div>
+ </div>
+ <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: {},
+ components: { AddUserLevel },
computed: {},
data() {
return {
- tableList: {}
+ totalObject: {
+ value: 0,
+ label: "鍏ㄩ儴"
+ },
+ otherOptions: [
+ {
+ value: 0,
+ label: "鍚敤",
+ status: "success"
+ },
+ {
+ value: 0,
+ label: "鍋滅敤",
+ status: "error"
+ }
+ ],
+ tableList: {},
+ tableColumn: [
+ { label: "绛夌骇鍚嶇О", prop: "name", default: true },
+ { label: "绛夌骇鎻忚堪", prop: "comment", default: true },
+ { label: "鍛樺伐鏁�", prop: "count" },
+ { label: "鐘舵��", prop: "status", isCallMethod: true, getCallMethod: this.getRoleStatus }
+ ],
+ showCol: ["绛夌骇鍚嶇О", "绛夌骇鎻忚堪", "鍛樺伐鏁�", "鐘舵��"],
+ selectRow: {},
+ TabsIndex: 0,
+ bottomTableList: {},
+ loading: false,
+ tableBottomColumn: [
+ { label: "鐢ㄦ埛鍚�", prop: "username", default: true },
+ { label: "濮撳悕", prop: "nickName", default: true },
+ { label: "鎵嬫満鍙�", prop: "phone" },
+ { label: "宀椾綅鑱屽姟", prop: "dutyNames" },
+ { label: "鐘舵��", prop: "status", isCallMethod: true, getCallMethod: this.getUserStatus }
+ ],
+ showBottomCol: ["鐢ㄦ埛鍚�", "濮撳悕", "鎵嬫満鍙�", "宀椾綅鑱屽姟", "鐘舵��"],
+ isopen: false,
+ editRow: {},
+ editConfig: {
+ visible: false,
+ title: "鏂板缓",
+ infomation: {}
+ },
+ data: {
+ keyword: "",
+ page: 1,
+ pageSize: 15,
+ useType: 1
+ }
}
},
created() {
this.setTable()
+ this.getData()
},
methods: {
- setTable() {}
+ // 瑙掕壊鍒楄〃
+ 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.visible = true
+ // this.editConfig.infomation = {}
+ this.isopen = true
+ this.editRow = {}
+ },
+ // 鎼滅储
+ searchClick(val) {
+ this.data.keyword = val
+ this.pagerOptions.currPage = 1
+ // this.getData();
+ },
+ // 鍋滅敤
+ changeStatusClick(row) {
+ this.$confirm("鏄惁鍋滅敤姝ょ瓑绾�?", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ })
+ .then(() => {
+ this.getRoleChange(row)
+ })
+ .catch(() => {})
+ },
+ // 鍚敤 鍋滅敤璇锋眰
+ 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
+ })
+ }
+ })
+ },
+ // 缂栬緫
+ handleClick(val) {
+ console.log(val)
+ // this.editConfig.title = "缂栬緫"
+ // this.editConfig.infomation = { ...val }
+ // this.editConfig.visible = true
+ this.editRow = val
+ this.isopen = true
+ },
+ // 鍒犻櫎绛夌骇
+ delClick(row) {
+ console.log(row)
+ this.$confirm("鍒犻櫎鍚庢暟鎹笉鑳芥仮澶嶏紝纭畾鏄惁鍒犻櫎?", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ })
+ .then(() => {
+ 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) {
+ console.log(row)
+ this.selectRow = row
+ // this.getUserList(row.id);
+ },
+ // 绛夌骇鐘舵��
+ getRoleStatus(val) {
+ return val ? "鍚敤" : "鍋滅敤"
+ },
+ //鑾峰彇褰撳墠閫変腑绛夌骇鐨刬d
+ getTab(tab) {
+ this.TabsIndex = tab
+ if (this.TabsIndex == 0) {
+ // 浜у搧淇℃伅鍒楄〃
+ this.showBottomCol = this.showProductCol
+ this.setBottomList()
+ this.getProductInventoryInfo(this.selectRow)
+ }
+ },
+ // 鐢ㄦ埛鐘舵��
+ getUserStatus(val) {
+ return val === 0 ? "绂佺敤" : val === 1 ? "姝e父" : "瀹℃牳涓�"
+ },
+ // 鍒濆鍖栧垪琛�
+ setTable() {
+ this.tableList = {
+ selectIndex: true,
+ tableInfomation: [],
+ allcol: [],
+ showcol: this.showCol,
+ tableColumn: this.setColumnVisible(this.showCol, this.tableColumn)
+ }
+ this.setTableList(this.tableList)
+ // bottom
+ this.setBottomList()
+ },
+ // 鍒楄〃
+ setTableList(tableList) {
+ tableList.allcol = tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
+ },
+ // bom 鍒楄〃
+ setBottomList() {
+ this.bottomTableList = {
+ selectIndex: true,
+ tableInfomation: [],
+ allcol: [],
+ showcol: this.showBottomCol,
+ tableColumn: this.setColumnVisible(this.showBottomCol, this.tableBottomColumn)
+ }
+ this.setTableList(this.bottomTableList)
+ },
+ // 绛夌骇
+ selTableCol(val) {
+ this.showcol = val
+ this.tableList.tableColumn = this.setColumnVisible(val)
+ },
+ // bottom
+ selBottomTableCol(val) {
+ this.showcol = val
+ this.bottomTableList.tableColumn = this.setColumnVisible(val, this.tableBottomColumn)
+ },
+ setColumnVisible(showCol, tableColumn) {
+ return tableColumn.map((ele) => {
+ return {
+ ...ele,
+ isShowColumn: showCol.includes(ele.label)
+ }
+ })
+ }
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
-::v-deep {
-}
-
.user-level {
+ height: 100%;
+ .top-card {
+ height: 80px;
+ display: flex;
+ align-items: center;
+ margin: 12px 20px 0 20px;
+ border-radius: 12px;
+ background-color: #fff;
+ padding-left: 20px;
+ }
+ .body {
+ box-sizing: border-box;
+ padding: 10px 20px;
+ border-radius: 12px;
+ height: calc(100% - 92px);
+ .body-card {
+ background-color: #fff;
+ border-radius: 12px;
+ height: 100%;
+ overflow: hidden;
+ }
+ .content-top {
+ background-color: #fff;
+ border-radius: 12px;
+ min-height: 70px;
+ height: 48%;
+ position: relative;
+ .list-view {
+ height: calc(100% - 60px);
+ }
+ }
+ .content-bottom {
+ .bottom-tabs {
+ height: 40px;
+ line-height: 40px;
+ background: #e6ecf2;
+ display: flex;
+ .tab-pane {
+ width: 100px;
+ margin-right: 20px;
+ font-size: 14px !important;
+ text-align: center;
+ cursor: pointer;
+ background: #2a78fb;
+ border-top-left-radius: 20px;
+ border-top-right-radius: 20px;
+ }
+ }
+ .lable-view {
+ background: #e6ecf2;
+ height: 40px;
+ line-height: 40px;
+ .name {
+ border-left: 4px solid #2a78fb;
+ padding-left: 10px;
+ }
+ }
+ background-color: #fff;
+ border-radius: 12px;
+ min-height: 70px;
+ height: calc(52% - 50px);
+ margin-top: 10px;
+ // padding: 10px 20px;
+ .list-view {
+ height: calc(100% - 10px);
+ }
+ }
+ .btn-pager {
+ display: flex;
+ margin-top: 10px;
+ .page {
+ margin-left: auto;
+ }
+ }
+ }
+}
+::v-deep {
}
</style>
--
Gitblit v1.8.0