田源
2025-01-07 daa3d9edea915514e28c568b7288e6415f02fef4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
 <template>
  <el-container>
    <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",
  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>
 
<style lang="scss" scoped>
::v-deep {
  .el-scrollbar__wrap {
    overflow: auto !important;
  }
}
</style>