From dc861690e468ed4c7123673dca6415581ce2cbb0 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期一, 16 十二月 2024 16:39:15 +0800 Subject: [PATCH] 日志管理模块页面按钮权限 --- Source/plt-web/plt-web-ui/src/views/system/log/index.vue | 38 ++++++++++++++++--- Source/plt-web/plt-web-ui/src/views/system/log/basicConf.vue | 82 ++++++++++++++++++++++++---------------- 2 files changed, 81 insertions(+), 39 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/views/system/log/basicConf.vue b/Source/plt-web/plt-web-ui/src/views/system/log/basicConf.vue index c2c724d..7507f5f 100644 --- a/Source/plt-web/plt-web-ui/src/views/system/log/basicConf.vue +++ b/Source/plt-web/plt-web-ui/src/views/system/log/basicConf.vue @@ -4,8 +4,12 @@ <el-main> <basic-container> <div style="margin: 0 0 10px 20px"> - <el-button v-if="form.delType==0" icon="el-icon-check" size="small" type="primary" @click="saveHandler">淇濆瓨</el-button> - <el-button v-else icon="el-icon-delete" size="small" type="danger" @click="delHandler">鍒犻櫎</el-button> + <el-button v-if="form.delType == 0 && permissionList.saveBtn" icon="el-icon-check" size="small" type="primary" + @click="saveHandler">淇濆瓨 + </el-button> + <el-button v-if="form.delType != 0 && permissionList.delBtn" icon="el-icon-delete" size="small" type="danger" + @click="delHandler">鍒犻櫎 + </el-button> </div> <avue-form ref="form" v-model="form" :option="formOption"></avue-form> <div class="tip"> @@ -21,38 +25,40 @@ </template> <script> -import {getPeroid,savePeriod,deleteLog} from "@/api/system/log/logBasic"; +import {getPeroid, savePeriod, deleteLog} from "@/api/system/log/logBasic"; +import {mapGetters} from "vuex"; + export default { name: "basicConf", data: function () { return { - form:{ - period:'', + form: { + period: '', }, - periodData:[], - formOption:{ + periodData: [], + formOption: { submitBtn: false, emptyBtn: false, column: [{ label: '鏃ュ織鍒犻櫎', prop: 'delType', span: 24, - labelWidth:120, + labelWidth: 120, type: 'radio', value: 0, dicData: [ - { label: '鑷姩鍒犻櫎', value: 0 }, - { label: '鎵嬪姩鍒犻櫎', value: 1 }, + {label: '鑷姩鍒犻櫎', value: 0}, + {label: '鎵嬪姩鍒犻櫎', value: 1}, ] }, { label: '淇濆瓨鏃ユ湡', prop: 'period', type: 'select', - labelWidth:120, + labelWidth: 120, dicData: this.periodData, - props:{ - label:'value', - value:'code' + props: { + label: 'value', + value: 'code' }, rules: [{ required: true, @@ -63,8 +69,8 @@ label: '璇烽�夋嫨鏃ユ湡', prop: 'deleteDate', type: 'date', - valueFormat:'yyyy-MM-dd', - labelWidth:120, + valueFormat: 'yyyy-MM-dd', + labelWidth: 120, display: false, rules: [{ required: true, @@ -75,44 +81,53 @@ }, } }, + computed: { + ...mapGetters(["permission"]), + permissionList() { + return { + saveBtn: this.vaildData(this.permission[this.$route.query.id].save, false), + delBtn: this.vaildData(this.permission[this.$route.query.id].DELETE, false), + }; + }, + }, created() { this.getPeroid(); }, watch: { 'form.delType': { handler(newval) { - if (newval ==0) { - this.formOption.column[1].display=true; - this.formOption.column[2].display=false; - }else { - this.formOption.column[1].display=false; - this.formOption.column[2].display=true; + if (newval == 0) { + this.formOption.column[1].display = true; + this.formOption.column[2].display = false; + } else { + this.formOption.column[1].display = false; + this.formOption.column[2].display = true; } } }, }, - methods:{ - getPeroid:function (){ + methods: { + getPeroid: function () { getPeroid().then(res => { this.$refs.form.updateDic('period', res.data.data); - this.periodData=res.data.data; - this.form.period=res.data.data.filter(item=>{ + this.periodData = res.data.data; + this.form.period = res.data.data.filter(item => { return item.choose })[0].code }).catch(error => { }) }, - saveHandler:function (){ - savePeriod({'period':this.form.period}).then(res => { + saveHandler: function () { + savePeriod({'period': this.form.period}).then(res => { if (res.data.success) { this.$message.success('淇濆瓨鎴愬姛') } }); }, delHandler() { - this.$refs.form.validate((valid,done) => { - if(valid){ - deleteLog({'deleteDate':this.form.deleteDate}).then(res => { + this.$refs.form.validate((valid, done) => { + if (valid) { + deleteLog({'deleteDate': this.form.deleteDate}).then(res => { if (res.data.success) { this.$message.success('鍒犻櫎鎴愬姛') } @@ -126,13 +141,14 @@ </script> <style scoped> -.tip{ +.tip { font-size: 12px; line-height: 24px; color: #909399; margin: 0 0 10px 20px; } -.tip div{ + +.tip div { margin-left: 30px; } </style> diff --git a/Source/plt-web/plt-web-ui/src/views/system/log/index.vue b/Source/plt-web/plt-web-ui/src/views/system/log/index.vue index cf0cfe1..6172a24 100644 --- a/Source/plt-web/plt-web-ui/src/views/system/log/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/system/log/index.vue @@ -15,7 +15,9 @@ @current-change="currentChange" > <template slot="menuLeft" slot-scope="scope"> - <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭</el-button> + <el-button v-if="permissionList.exportBtn" icon="el-icon-download" plain size="small" type="primary" + @click="exportClickHandler">瀵煎嚭 + </el-button> </template> </avue-crud> </basic-container> @@ -23,8 +25,9 @@ <script> import basicOption from "@/util/basic-option"; -import {getLogListByContion,getOperatingUsers,exportLog} from "@/api/system/log/logBasic"; +import {getLogListByContion, getOperatingUsers, exportLog} from "@/api/system/log/logBasic"; import func from "@/util/func"; +import {mapGetters} from "vuex"; export default { name: "index", @@ -111,11 +114,25 @@ this.getTableList(); } }, + computed: { + ...mapGetters(["permission"]), + permissionList() { + return { + exportBtn: this.vaildData(this.permission[this.$route.query.id].EXPORT, false), + }; + }, + }, + created() { + console.log(this.$route.query.id) + }, methods: { // 琛ㄦ牸璇锋眰 getTableList() { this.tableLoading = true; - getLogListByContion(this.page.currentPage, this.page.pageSize, {'logType': this.$route.query.logType,'roleType':this.$route.query.roleType, ...this.searchParams}).then(res => { + getLogListByContion(this.page.currentPage, this.page.pageSize, { + 'logType': this.$route.query.logType, + 'roleType': this.$route.query.roleType, ...this.searchParams + }).then(res => { this.tableData = res.data.data; this.page.total = res.data.total; this.tableLoading = false; @@ -157,7 +174,12 @@ // 瀵煎嚭 exportClickHandler() { const loading = this.$loading({}); - exportLog({'pageNo':1,'pageSize':-1,'logType': this.$route.query.logType,'roleType':this.$route.query.roleType, ...this.searchParams}).then(res => { + exportLog({ + 'pageNo': 1, + 'pageSize': -1, + 'logType': this.$route.query.logType, + 'roleType': this.$route.query.roleType, ...this.searchParams + }).then(res => { func.downloadFileByBlobHandler(res); this.createdLoading = false this.$message.success('瀵煎嚭鎴愬姛'); @@ -170,8 +192,12 @@ row, this.$refs.logCrud, this.lastIndex, - (newIndex) => { this.lastIndex = newIndex; }, - () => { this.selectList = []; } + (newIndex) => { + this.lastIndex = newIndex; + }, + () => { + this.selectList = []; + } ); }, } -- Gitblit v1.9.3