Blame view

src/components/staff/Audit.vue 2.09 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
    <el-dialog 
      :title="$t('audit.title')" 
      :visible.sync="visible" 
      width="50%"
      @close="handleClose">
      <el-form :model="auditInfo" label-width="120px">
        <el-form-item :label="$t('audit.state')" prop="state">
          <el-select v-model="auditInfo.state" class="w-full" @change="handleStateChange">
            <el-option :label="$t('audit.selectState')" value="" disabled></el-option>
            <el-option :label="$t('audit.agree')" value="1100"></el-option>
            <el-option :label="$t('audit.reject')" value="1200"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('audit.remark')" prop="remark">
          <el-input
            type="textarea"
            :rows="4"
            :placeholder="$t('audit.remarkPlaceholder')"
            v-model="auditInfo.remark">
          </el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="visible = false">{{ $t('common.cancel') }}</el-button>
        <el-button type="primary" @click="handleSubmit">{{ $t('common.submit') }}</el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
  export default {
    name: 'Audit',
    data() {
      return {
        visible: false,
        auditInfo: {
          state: '',
          remark: ''
        }
      }
    },
    methods: {
      open() {
        this.visible = true
      },
      handleClose() {
        this.auditInfo = {
          state: '',
          remark: ''
        }
      },
      handleStateChange(val) {
        if (val === '1100') {
          this.auditInfo.remark = this.$t('audit.agree')
        } else {
          this.auditInfo.remark = ''
        }
      },
      handleSubmit() {
        if (!this.auditInfo.state) {
          this.$message.warning(this.$t('audit.stateRequired'))
          return
        }
        if (!this.auditInfo.remark) {
          this.$message.warning(this.$t('audit.remarkRequired'))
          return
        }
        if (this.auditInfo.state === '1200') {
          this.auditInfo.remark = `${this.$t('audit.reject')}: ${this.auditInfo.remark}`
        }
        this.$emit('auditMessage', this.auditInfo)
        this.visible = false
      }
    }
  }
  </script>