wente
2023-12-05 bb9bf60cbd34d0638f1df89c69358533b2cc220c
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
<template>
  <zt-dialog ref="dialog" @confirm="formSubmit" append-to-body>
    <el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px">
      <el-form-item prop="hasSystemTree" label="展示组织结构树">
        <el-checkbox v-model="dataForm.hasSystemTree"></el-checkbox>
      </el-form-item>
      <el-form-item v-if="dataForm.hasSystemTree" prop="hasSystemTree" label="显示级别">
        <zt-dict v-model="dataForm.showLevel" dict="node_type" placeholder="组织结构节点级别"></zt-dict>
      </el-form-item>
      <el-col :span="6">
        <el-form-item v-if="dataForm.hasSystemTree" prop="hasSystemTree" label="型号">
          <el-checkbox v-model="dataForm.hasOne"></el-checkbox>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item v-if="dataForm.hasSystemTree" prop="hasSystemTree" :label="$store.state.word.xian+'号'">
          <el-checkbox v-model="dataForm.hasTwo"></el-checkbox>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item v-if="dataForm.hasSystemTree" prop="hasSystemTree" label="系统">
          <el-checkbox v-model="dataForm.hasThree"></el-checkbox>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item v-if="dataForm.hasSystemTree" prop="hasSystemTree" label="设备">
          <el-checkbox v-model="dataForm.hasFour"></el-checkbox>
        </el-form-item>
      </el-col>
    </el-form>
  </zt-dialog>
</template>
 
<script>
  export default {
    data() {
      return {
        word: {},
        dataForm: {
          menuId: '',
          hasSystemTree: false,
          showLevel: 'L1',
          hasOne: false,
          hasTwo: false,
          hasThree: false,
          hasFour: false
        }
      }
    },
    mounted() {
      // this.kwReplacement()
    },
    methods: {
      // async kwReplacement() {
      //   let res = await this.$http.get(`/sys/keyword/replacement`)
      //   if (res.data != null) {
      //     this.word = res.data
      //   }
      // },
      init(id) {
        this.dataForm.menuId = id
      },
      // 获取信息
      async getInfo() {
        let res = await this.$http.get(`/sys/menuConfig/${this.dataForm.menuId}`)
        if (res.success && res.data.hasSystemTree) {
          this.dataForm = {
            ...this.dataForm,
            ...res.data
          }
        }
      },
      // 表单提交
      async formSubmit() {
        let res = await this.$http['post']('/sys/menuConfig', this.dataForm)
        if (res.success) {
          this.$refs.dialog.close()
          await this.$tip.success()
          this.$emit('refreshDataList')
        }
      }
    }
  }
</script>