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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<template>
<div class="app-content" style="height:50vh;overflow:auto;">
<a-spin :spinning="loading" style="width: 100%;height: 100%;">
<a-form-model ref="form" :model="formData" :rules="rules" class="from-table">
<a-row type="flex">
<a-col :span="4" class="bg-gray">
<div class="special-middle">
<div class="required">年度</div>
</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="reportYear">
<a-input placeholder="年度" v-model="formData.reportYear" :maxLength="4" style="width: 250px;" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">审核单位</div>
</a-col>
<a-col :span="20">
<a-form-model-item ref="auditUnitId" prop="auditUnitId">
<unit-select v-model="formData.auditUnitId" :typeId="2" />
<span style="color: rgb(56, 188, 213);margin-left:5px">※ 请输入单位名称查找到单位</span>
</a-form-model-item>
</a-col>
</a-row>
<!-- <a-row>
<a-col :span="4" class="bg-gray">
<div class="required">审核人</div>
</a-col>
<a-col :span="20">
<a-form-model-item ref="personName" prop="personName">
<unit-select v-model="formData.personName" />
<span style="color: rgb(56, 188, 213);margin-left:5px">※ 请输入单位名称查找到单位</span>
</a-form-model-item>
</a-col>
</a-row> -->
<a-row type="flex">
<a-col :span="4" class="bg-gray">
<div class="special-middle">
<div class="required">审核类型</div>
</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="auditType">
<base-select v-model="formData.auditType" :type="13" :isAll="true" :width="250" />
</a-form-model-item>
</a-col>
</a-row>
<a-row type="flex">
<a-col :span="4" class="bg-gray">
<div class="special-middle">
<div class="required">审核方式</div>
</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="auditMethod">
<base-select v-model="formData.auditMethod" :type="14" :isAll="true" :width="250" />
</a-form-model-item>
</a-col>
</a-row>
<a-row type="flex">
<a-col :span="4" class="bg-gray">
<div class="special-middle">
<div>审核内容</div>
</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="auditContent">
<a-input placeholder="审核内容" v-model="formData.auditContent" :maxLength="10" style="width: 250px;" />
</a-form-model-item>
</a-col>
</a-row>
<a-row type="flex">
<a-col :span="4" class="bg-gray">
<div class="special-middle">
<div class="required">排序</div>
</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="showIndex">
<a-input placeholder="排序" v-model="formData.showIndex" :maxLength="10" style="width: 250px;" />
</a-form-model-item>
</a-col>
</a-row>
<a-row type="flex">
<a-col :span="4" class="bg-gray">
<div class="special-middle">
<div class="required">审核结果</div>
</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="auditResult">
<base-select v-model="formData.auditResult" :type="15" :isAll="true" :width="250" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="24" style="text-align:center;">
<a-button type="primary" style="margin-right:50px;" @click="submit">保存</a-button>
</a-col>
</a-row>
</a-form-model>
</a-spin>
</div>
</template>
<script>
import moment from 'moment'
import { isEmptyParams } from '@/views/utils/common'
import unitSelect from '@/views/components/common/unitSelect'
import baseSelect from '@/views/components/common/baseSelect'
export default {
name: 'recordEdit',
components: {
unitSelect, baseSelect
},
data () {
return {
formData: {
id: null,
auditObjectId: null,
reportYear: null,
auditUnitId: null,
auditType: null,
auditMethod: null,
auditContent: null,
showIndex: null,
auditResult: null
},
rules: {
reportYear: [{ required: true, message: '请输入审核年度', trigger: 'blur' }],
auditUnitId: [{ required: true, message: '请输入审核单位', trigger: 'change' }],
auditType: [{ required: true, message: '请选择审核类型', trigger: 'change' }],
auditMethod: [{ required: true, message: '请选择审核方式', trigger: 'change' }],
auditContent: [{ required: false, message: '请输入审核内容', trigger: 'blur' }],
showIndex: [{ required: true, message: '请输入排序', trigger: 'blur' }],
auditResult: [{ required: true, message: '请选择审核结果', trigger: 'change' }],
},
loading: false,
}
},
props: {
value: {
type: String,
default: () => {
return null
}
},
obj: {
type: Object,
default: () => {
return null
}
}
},
created () {
this.getObj()
},
methods: {
moment,
getObj () {
if (this.obj)
this.formData = this.obj
else
this.formData.auditObjectId = this.value
},
submit () {
this.$refs.form.validate(valid => {
if (valid) {
this.loading = true
let pars = isEmptyParams(this.formData)
let par = { ...pars }
this.$api.auditManager.save(par).then(({ data = {} }) => {
if (data) {
this.$message.success('成功!')
this.$emit('close', 'edit')
}
this.loading = false
}).catch(() => { this.loading = false })
} else {
this.$message.error('信息未填写完整!')
return false
}
})
}
}
}
</script>