田源
2024-12-16 dc861690e468ed4c7123673dca6415581ce2cbb0
日志管理模块页面按钮权限
已修改2个文件
120 ■■■■■ 文件已修改
Source/plt-web/plt-web-ui/src/views/system/log/basicConf.vue 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/system/log/index.vue 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>
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 = [];
        }
      );
    },
  }