| | |
| | | <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> --> |
| | | </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> |
| | | <!-- 新建/编辑 --> |
| | | <!-- <AddSubOrderDialog v-if="editConfig.visible" :edit-common-config="editConfig" /> --> |
| | | <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" |
| | | export default { |
| | | name: "UserLevel", |
| | | 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, |
| | | editConfig: { |
| | | visible: false, |
| | | title: "新建", |
| | | infomation: {} |
| | | }, |
| | | data: { |
| | | keyword: "", |
| | | page: 1, |
| | | pageSize: 15, |
| | | useType: 1 |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | this.setTable() |
| | | }, |
| | | methods: { |
| | | setTable() {} |
| | | // 新建 |
| | | addBtnClick() { |
| | | this.editConfig.title = "新建" |
| | | this.editConfig.infomation = { ...this.addConfig, currency: "人民币" } |
| | | this.editConfig.visible = true |
| | | }, |
| | | // 搜索 |
| | | 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) { |
| | | 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(() => {}) |
| | | }, |
| | | // 行点击 |
| | | tableRowClick(row) { |
| | | console.log(row) |
| | | this.selectRow = row |
| | | // this.getUserList(row.id); |
| | | }, |
| | | // 等级状态 |
| | | getRoleStatus(val) { |
| | | return val ? "启用" : "停用" |
| | | }, |
| | | //获取当前选中等级的id |
| | | 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 ? "正常" : "审核中" |
| | | }, |
| | | // 初始化列表 |
| | | 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) |
| | | 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() { |
| | | 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% - 60px); |
| | | 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> |