| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 新建/编辑 --> |
| | | <!-- 添加/编辑 --> |
| | | <AddUserLevel v-if="editConfig.visible" :edit-common-config="editConfig" /> |
| | | </div> |
| | | </template> |
| | |
| | | <script> |
| | | import pageMixin from "@/components/makepager/pager/mixin/pageMixin" |
| | | import AddUserLevel from "@/views/unifiedManage/userLevel/components/AddUserLevel" |
| | | import { getListRole, getUserList, roleChange, deleteRole, getTotal } from "@/api/unifiedManage/userLevel" |
| | | export default { |
| | | name: "UserLevel", |
| | | props: { |
| | |
| | | }, |
| | | created() { |
| | | this.setTable() |
| | | this.getData() |
| | | }, |
| | | methods: { |
| | | // 数量统计 |
| | | overview() { |
| | | getTotal({ |
| | | useType: 1 |
| | | }).then((reply) => { |
| | | console.log(reply) |
| | | if (reply.code == 200) { |
| | | this.totalObject.value = reply.data.total |
| | | this.otherOptions.map((item) => { |
| | | if (item.label === "启用") { |
| | | item.value = reply.data.use |
| | | } else if (item.label === "停用") { |
| | | item.value = reply.data.ban |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | // 角色列表 |
| | | 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.infomation = {} |
| | | }, |
| | | // 搜索 |
| | | searchClick(val) { |
| | | this.data.keyword = val |
| | | this.pagerOptions.currPage = 1 |
| | | // this.getData(); |
| | | this.getData("search") |
| | | }, |
| | | // 停用 |
| | | changeStatusClick(row) { |
| | |
| | | // 启用 停用请求 |
| | | 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) { |
| | | console.log(val) |
| | | this.editConfig.title = "编辑" |
| | | this.editConfig.infomation = { ...val } |
| | | this.editConfig.visible = true |
| | |
| | | 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(() => {}) |
| | | }, |
| | |
| | | tableRowClick(row) { |
| | | console.log(row) |
| | | this.selectRow = row |
| | | // this.getUserList(row.id); |
| | | this.getUserList(row.id) |
| | | }, |
| | | // 等级状态 |
| | | getRoleStatus(val) { |
| | |
| | | // 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() { |
| | |
| | | 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 { |