From 9ff66017debadfc89bc0c1b796684a4d1dbe2bc3 Mon Sep 17 00:00:00 2001 From: fangyuan <527392886@qq.com> Date: 星期五, 16 十二月 2022 10:00:02 +0800 Subject: [PATCH] 已上报到市批量操作按钮隐藏 --- src/views/systemSetting/baseSetting/role/index.vue | 180 ++++++++++++++++++++++-------------------------------------- 1 files changed, 66 insertions(+), 114 deletions(-) diff --git a/src/views/systemSetting/baseSetting/role/index.vue b/src/views/systemSetting/baseSetting/role/index.vue index ea851d2..0f25179 100644 --- a/src/views/systemSetting/baseSetting/role/index.vue +++ b/src/views/systemSetting/baseSetting/role/index.vue @@ -12,8 +12,8 @@ <div class="addUser"> <el-button class="addBtn" type="primary" @click="dialogCreate = true">鏂板缓瑙掕壊</el-button> <el-dialog :visible.sync="dialogCreate" title="鏂板瑙掕壊" width="45%" v-if="dialogCreate" - :before-close="handleClose"> - <createUser :refresh="context==='' ? getUserList : search" /> + :before-close="handleClose2"> + <createUser :refresh="context==='' ? getRoleList : search" /> </el-dialog> </div> </div> @@ -27,59 +27,51 @@ @selection-change="tableChange"> <el-table-column type="selection" min-width="5"> </el-table-column> - <!-- <el-table-column label="鐢ㄦ埛ID" min-width="5"> - <template slot-scope="scope">{{ scope.row.id }}</template> - </el-table-column> --> <el-table-column prop="name" label="瑙掕壊鍚嶇О" min-width="10"> </el-table-column> - <el-table-column prop="sort" label="瑙掕壊绫诲瀷" min-width="10"> - </el-table-column> - <el-table-column prop="adminCount" label="榛樿瑙掕壊" min-width="10"> + <el-table-column prop="typeText" label="瑙掕壊绫诲瀷" min-width="10"> </el-table-column> <el-table-column prop="description" label="澶囨敞" min-width="10"> </el-table-column> <el-table-column prop="status" label="鍚敤" min-width="5"> <template slot-scope="scope"> - <el-switch class="switchStyle" v-model="scope.row.status" active-text="寮�" inactive-text="鍏�" - active-color="#3fef9a" inactive-color="#000212" @change="handleChangeStatus(scope.row)"> + <el-switch class="switchStyle" v-model="scope.row.status" + active-color="#3fef9a" inactive-color="#000212" disabled> </el-switch> </template> </el-table-column> <el-table-column prop="operation" label="鎿嶄綔" min-width="15"> <template slot-scope="scope"> <div class="operation"> - <!-- <span @click="handleChangeRole(scope.row)">淇敼瑙掕壊</span> --> <span @click="handleFind(scope.row)">鏌ョ湅</span> <span class="line">|</span> - <!-- <span>淇敼瀵嗙爜</span> --> - <!-- <span>鍒犻櫎</span> --> <span @click="handleUpdate(scope.row)">鏉冮檺璁剧疆</span> <span class="line">|</span> - <span @click="handleStop(scope.row)">鍋滅敤</span> + <span @click="handleChangeStatus(scope.row)">{{scope.row.status === true ?'鍋滅敤':'鍚敤' }}</span> <span class="line">|</span> <span @click="handleDelete([scope.row.id])">鍒犻櫎</span> </div> </template> </el-table-column> - </el-table> + </el-table> <!-- 淇敼椤甸潰 --> <el-dialog :visible.sync="dialogUpdate" width="45%" :title="updateFlag ? '鏉冮檺璁剧疆' :'鏌ョ湅瑙掕壊淇℃伅'" v-if="dialogUpdate" :before-close="handleClose"> <updateUser :updateFlag="updateFlag" :userInfo=userInfo - :getUserList=" context ? getUserList : getUserList" @changeDialog="changeDialog" /> + :getRoleList=" context ? getRoleList : getRoleList" @changeDialog="changeDialog" /> </el-dialog> <!-- 鏌ョ湅椤甸潰 --> - <el-dialog :visible.sync="dialogView" width="45%" title="鏌ョ湅瑙掕壊淇℃伅" - v-if="dialogView" :before-close="handleClose"> + <el-dialog :visible.sync="dialogView" width="45%" title="鏌ョ湅瑙掕壊淇℃伅" v-if="dialogView" + :before-close="handleClose"> <MyView :userInfo=userInfo @changeDialog="changeDialog" /> </el-dialog> <!-- tools --> <div class="tools"> <div class="funs"> - <div class="funsItem"> + <div class="funsItem funs-sp"> <el-checkbox v-model="all" @change="selectAll()">鍏ㄩ��</el-checkbox> </div> - <div class="funsItem"> + <div class="funsItem funs-sp"> <el-checkbox v-model="unsame" @change="disSame(tableData)">鍙嶉��</el-checkbox> </div> <div class="funsItem"> @@ -88,7 +80,7 @@ :value="item.value" :disabled="item.disabled"> </el-option> </el-select> - </div> + </div> </div> <div class="pagination"> <el-pagination background :current-page="currentPage" layout="prev, pager, next" @@ -106,9 +98,10 @@ import updateUser from "./updateUser" import helper from "@/utils/mydate.js" import MyView from './viewRole' +import MyTable from '@/components/Table' export default { components: { - createUser, updateUser,MyView + createUser, updateUser, MyView, MyTable }, data() { return { @@ -116,7 +109,7 @@ context: "", dialogCreate: false, dialogUpdate: false, - dialogView:false, + dialogView: false, updateFlag: false, userInfo: '', totalNum: null, @@ -145,11 +138,11 @@ label: '鎵归噺鍒犻櫎', } ], - tempList: [] + tempList: [], } }, created() { - this.getUserList(); + this.getRoleList(); }, methods: { async selectChange(list) { @@ -185,14 +178,13 @@ type: 'success', message: '鏇存敼鐢ㄦ埛鐘舵�佹垚鍔�', }) - this.getUserList(); + this.getRoleList(); } else { this.$message({ type: 'error', message: res.message }) } - console.log(res); }) }) .catch(err => { console.log(err) }) @@ -232,13 +224,12 @@ .then(res => { this.myIdx = 0; this.preMyIdx = 0; - console.log(res); this.$message({ type: 'success', message: res.message }) - this.getUserList(); + this.getRoleList(); }) }) .catch(_ => { }); @@ -252,23 +243,15 @@ // 淇敼鐢ㄦ埛鐘舵�� handleChangeStatus(obj) { let { id, status } = obj; - status == true ? status = 1 : status = 0; - console.log(id, status); + status == true ? status = 0 : status = 1; this.$axios.post(`/sccg/role/updateStatus/` + id + '?status=' + status).then(res => { - console.log(res); + if (res.code === 200) { + this.search(); + } }) }, - handleStop(obj) { - // let { id, status } = obj; - // status == true ? status = 1 : status = 0; - // console.log(id, status); - // this.$axios.post(`/sccg/role/updateStatus/` + id + '?status=' + status).then(res => { - // this.getUserList(); - // }) - }, // 鑾峰彇鐢ㄦ埛鍒楄〃 - getUserList() { - const that = this; + getRoleList() { this.dialogCreate = false; // 鑾峰彇鎵�鏈夌敤鎴蜂俊鎭� this.$axios.get('sccg/role/listAll').then(res => { @@ -284,7 +267,6 @@ if (context == '') { this.$axios.get('sccg/role/list?keyword=' + '&pageNum=' + currentPage + '&pageSize=' + pageSize).then(res => { if (res.code === 200) { - console.log(res); res.data.list.forEach(item => { // item.createTime = helper(item.createTime); item.status == 1 ? item.status = true : item.status = false; @@ -343,16 +325,28 @@ this.currentPage = page; this.search(); }, - changeDialog({flag}) { + changeDialog({ flag }) { this.dialogUpdate = flag; this.dialogCreate = flag; this.dialogView = flag; }, handleClose(done) { + if (this.updateFlag) { + this.$confirm('纭鍏抽棴锛�') + .then(_ => { + this.dialogUpdate = false; + this.dialogCreate = false; + this.updateFlag = false; + done(); + }) + .catch(_ => { }); + } else { + done(); + } + }, + handleClose2(done) { this.$confirm('纭鍏抽棴锛�') .then(_ => { - this.dialogUpdate = false; - this.dialogCreate = false; done(); }) .catch(_ => { }); @@ -434,7 +428,9 @@ justify-content: space-between; align-items: center; padding: 0 20px; - + .funs-sp{ + border: 1px solid #17324c; + } .funs { display: flex; @@ -442,7 +438,6 @@ line-height: 28px; display: flex; align-items: center; - border: 1px solid #17324c; border-radius: 4px; font-size: 12px; margin-left: 10px; @@ -499,14 +494,6 @@ color: #4b9bb7; font-size: 10px; - &::v-deep .el-table__empty-block { - background-color: #09152f; - } - - &::v-deep .el-table__empty-block { - color: #4b9bb7; - } - .operation { display: flex; @@ -520,69 +507,34 @@ } } - .el-table::v-deep .warning-row { - background: #06122c; - } + // &::v-deep .switchStyle .el-switch__label { + // position: absolute; + // display: none; + // color: #fff; + // } - .el-table::v-deep .success-row { - background: #071f39; - } + // &::v-deep .el-switch__core { + // background-color: rgba(166, 166, 166, 1); + // } - &::v-deep .switchStyle .el-switch__label { - position: absolute; - display: none; - color: #fff; - } + // &::v-deep .switchStyle .el-switch__label--left { + // z-index: 9; + // left: 20px; + // } - &::v-deep .el-switch__core { - background-color: rgba(166, 166, 166, 1); - } + // &::v-deep .switchStyle .el-switch__label--right { + // z-index: 9; + // left: 4px; + // } - &::v-deep .switchStyle .el-switch__label--left { - z-index: 9; - left: 20px; - } + // &::v-deep .switchStyle .el-switch__label.is-active { + // display: block; + // } - &::v-deep .switchStyle .el-switch__label--right { - z-index: 9; - left: 4px; - } - - &::v-deep .switchStyle .el-switch__label.is-active { - display: block; - } - - &::v-deep .switchStyle.el-switch .el-switch__core, - &::v-deep .el-switch .el-switch__label { - width: 50px !important; - } - } - - &::v-deep .el-dialog__header, - &::v-deep .el-dialog__body { - background-color: #06122c; - } - - &::v-deep .el-dialog__header { - display: flex; - align-items: center; - background-color: #fff; - padding: 20px; - line-height: 60px; - } - - &::v-deep .el-dialog__title { - color: #4b9bb7; - } - - &::v-deep .el-dialog__close { - width: 20px; - height: 20px; - // color: #fff; - } - - &::v-deep .el-dialog__body { - padding: 0; + // &::v-deep .switchStyle.el-switch .el-switch__core, + // &::v-deep .el-switch .el-switch__label { + // width: 50px !important; + // } } } </style> \ No newline at end of file -- Gitblit v1.8.0