duhuizhe
2023-10-16 3aa55dd3f62cee2c1c4c0aa74e1570acf83f8927
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
<template>
  <win-sm :title="setting.title" @close="close">
    <el-form ref="ruleForm" :model="formData" :rules="rules" class="demo-ruleForm" label-width="100px">
      <el-form-item label="审核结果" prop="auditStatus">
        <el-radio-group v-model="formData.auditStatus">
          <el-radio :label="2" border>通过</el-radio>
          <el-radio :label="1" border>不通过</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="备注" prop="auditReason">
        <el-input
          v-model="formData.auditReason"
          type="textarea"
          :rows="3"
          maxlength="200"
          show-word-limit
        />
      </el-form-item>
    </el-form>
    <div slot="footer" align="center" class="dialog-footer">
      <my-button name="取消" site="form" @click="close"/>
      <my-button name="提交" site="form" @click="save"/>
    </div>
  </win-sm>
</template>
 
<script>
import winSm from '@/components/win/win-sm'
import myButton from '@/components/myButton/myButton'
import * as audit from '@/api/projectManage/audit'
export default {
  name: 'edit',
  components: { winSm, myButton },
  props: {
    setting: {
      type: Object,
      default: () => {
      }
    }
  },
  data() {
    return {
      formData: {
        id: null,
        sourceStatus: null,
        auditStatus: 2,
        auditReason: '',
      },
      rules: {
        auditStatus: [
          {required: true, message: '请选择审核结果', trigger: 'change'}
        ],
      }
    }
  },
  created() {
    this.formData.id = this.setting.id
    this.formData.sourceStatus = this.setting.sourceStatus
  },
  methods: {
    close() {
      this.$emit('close')
    },
    save() {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = this.formData
          audit.auditUpd(params).then(res=>{
            this.$message.success('提交成功')
            this.close()
            this.$emit('search')
          })
        } else {
          this.$message.error('校验未通过,请检查。')
        }
      })
    }
  }
}
</script>