3328350766
6 天以前 761eb03d6b3bebd0b197179564c84d89d3d12a0d
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
89
90
91
92
93
94
95
96
97
98
99
100
<template>
  <el-dialog
    :append-to-body="true"
    :before-close="handleClose"
    :visible.sync="dialogFormVisible"
    class="bs-dialog-wrap bs-el-dialog"
    title="标签类型修改"
    width="500px"
  >
    <div style="margin: 20px;">
      <el-form
        ref="ruleForm"
        :model="dataForm"
        :rules="rules"
        label-position="left"
        label-width="90px"
        class="bs-el-form"
      >
        <el-form-item
          label="标签类型"
          prop="labelType"
        >
          <el-input
            v-model="dataForm.labelType"
            class="bs-el-input"
          />
        </el-form-item>
      </el-form>
    </div>
 
    <span
      slot="footer"
      class="dialog-footer"
    >
      <el-button
        class="bs-el-button-default"
        @click="cancel"
      >取消</el-button>
      <el-button
        type="primary"
        @click="submitForm('ruleForm')"
      >确定</el-button>
    </span>
  </el-dialog>
</template>
 
<script>
import { updateLabelType } from 'data-room-ui/js/utils/LabelConfigService'
 
export default {
  name: 'LabelTypeEdit',
  data () {
    return {
      dialogFormVisible: false,
      dataForm: {
        labelType: '',
        oldLabelType: ''
      },
      rules: {
        labelType: [
          { required: true, message: '标签类型不能为空', trigger: 'blur' }
        ]
      }
    }
  },
  methods: {
    init (labelType) {
      this.dataForm.labelType = labelType
      this.dataForm.oldLabelType = labelType
    },
    handleClose () {
      this.$parent.labelTypeEditVisible = false
    },
    cancel () {
      this.dialogFormVisible = false
      this.$nextTick(() => {
        this.handleClose()
      })
    },
    submitForm (formName) {
      this.$refs[formName].validate((valid) => {
        if (!valid) {
          return false
        }
        updateLabelType(this.dataForm).then(() => {
          this.$emit('afterEdit')
          this.cancel()
          this.$message.success('保存成功')
        })
      })
    }
  }
}
</script>
 
<style>
/* .dialogClass .el-dialog__body {
  min-height: auto;
} */
</style>