田源
2024-12-17 1b84a05dd84e535284ac6e2d2b360d76a4b8e7ac
Source/plt-web/plt-web-ui/src/views/authority/secure/classification/index.vue
@@ -1,50 +1,81 @@
<template>
 <template>
  <el-container>
    <el-aside>
      <basic-container>
        <div ref="TreeBox" style="height: calc(100vh - 144px);!important;">
          <div class="headerCon">
            <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">创建
            </el-button>
            <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editClickHandler">修改
            </el-button>
            <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delClickHandler">删除
            </el-button>
            <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">导出
            </el-button>
            <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadClickHandler">导入
            </el-button>
            <el-button class="smallBtn" plain size="small" type="primary"
                       @click="checkViewClickHandler">查看使用范围
            </el-button>
          </div>
          <!-- 左侧树         -->
          <div style="height:  calc(100vh - 280px);">
            <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick">
          <span slot-scope="{ node, data }" class="el-tree-node__label">
           <span style="font-size: 15px">
              <i class="el-icon-s-promotion"></i>
                {{ (node || {}).label }}
            </span>
          </span>
            </avue-tree>
          </div>
        </div>
      </basic-container>
    </el-aside>
    <el-main>
      <basic-container>
      </basic-container>
    </el-main>
    <basic-container style="height: calc(100vh - 118px);width: 100%;">
      <avue-form ref="form" v-model="form" :option="formOption" @submit="saveHandler"></avue-form>
    </basic-container>
  </el-container>
</template>
<script>
import {getSecretGradeConfig, saveSecretGrade} from "@/api/authority/secure/classification";
import {mapGetters} from "vuex";
export default {
  name: "index"
  name: "index",
  data: function () {
    return {
      form:{
        type:[],
      },
    }
  },
  computed: {
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        saveBtn: this.vaildData(this.permission[this.$route.query.id].save, false),
      };
    },
    formOption() {
      return {
        submitBtn: this.permissionList.saveBtn,
        submitText:"保存",
        emptyBtn: false,
        menuPosition:'left',
        column: [{
          label: '用户\\机器密级停启用配置',
          labelWidth:185,
          prop: 'type',
          span: 24,
          type: 'checkbox',
          dicData: [
            { label: '用户密级', value: 0 },
            { label: '机器密级', value: 1 },
          ]
        }]
      }
    }
  },
  created() {
    this.getSecretGradeConfig()
  },
  methods:{
    getSecretGradeConfig:function (){
      getSecretGradeConfig().then(res => {
        if(res.data.obj.userSecuritySwith){
          this.form.type=[0]
        }
        if(res.data.obj.ipSecuritySwith){
          this.form.type.push(1)
        }
      }).catch(error => {
      })
    },
    saveHandler:function (form,done){
      const params={
        userSecuritySwith:this.form.type.includes(0),
        ipSecuritySwith:this.form.type.includes(1)
      }
      saveSecretGrade(params).then(res => {
        if (res.data.success) {
          this.$message.success('保存成功')
        }
        done()
      }).catch(error=>{
        done()
      });
    },
  }
}
</script>
@@ -53,40 +84,5 @@
  .el-scrollbar__wrap {
    overflow: auto !important;
  }
  .headerCon{
    .el-button{
      width: 82px;
    }
  }
}
.headerCon {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 5px;
  .el-button + .el-button {
    margin-left: 5px;
  }
  .el-button {
    margin-top: 5px;
  }
}
.headerCon > .el-button:nth-child(4) {
  margin-left: 0;
}
.headerCon > .el-button:nth-child(7) {
  margin-left: 0;
}
.smallBtn {
  width: 82px;
  text-align: center;
  padding-left: 4.5px;
}
</style>