Form.vue
7.99 KB
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<template>
<el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'" :close-on-click-modal="false" :visible.sync="visible" class="NCC-dialog NCC-dialog_center" lock-scroll width="600px">
<el-row :gutter="15" class="" >
<el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" :disabled="!!isDetail" :rules="rules">
<el-col :span="24">
<el-form-item label="(问题)分类" prop="qxgn">
<el-select v-model="dataForm.qxgn" placeholder="请选择(问题)分类" clearable :style='{"width":"100%"}' >
<el-option v-for="item in qxgnOptions" :key="item.id" :label="item.fullName" :value="item.fullName" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="反馈标题" prop="title">
<el-input v-model="dataForm.title" placeholder="请输入" clearable :style='{"width":"100%"}' />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="问题描述" prop="nr">
<el-input v-model="dataForm.nr" placeholder="请输入" show-word-limit :style='{"width":"100%"}' type="textarea" :autosize="{minRows:4,maxRows:4}" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="筛选" prop="filterYlzd1">
<el-select v-model="filterYlzd1" placeholder="按岗位/职责筛选对接人员" clearable :style='{"width":"100%"}' @change="filterSbwhryOptions">
<el-option label="销售人员" value="销售人员" />
<el-option label="技术人员" value="技术人员" />
<el-option label="服务人员" value="服务人员" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="对接人员" prop="clr">
<el-select v-model="dataForm.clr" placeholder="请选择对接人员(需在设备维护人员中设置处理范围为“系统问题”)" clearable filterable :style='{"width":"100%"}' :loading="sbwhryLoading">
<el-option v-for="item in clrOptions" :key="item.id" :label="(item.xm || '') + (item.gh ? ' (' + item.gh + ')' : '')" :value="item.xm" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="反馈用户" prop="fbr">
<el-input v-model="dataForm.fbr" placeholder="系统自动生成" readonly />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="反馈时间" prop="fbsj">
<el-input v-model="dataForm.fbsj" placeholder="系统自动生成" readonly />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="缺陷截图" prop="fj2">
<NCC-UploadImg v-model="dataForm.fj2" :fileSize="1" sizeUnit="GB" :limit="9" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="缺陷视频" prop="fj1">
<NCC-UploadFz v-model="dataForm.fj1" :fileSize="1" sizeUnit="GB" :limit="9" buttonText="点击上传" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="处理结果" prop="cljg">
<el-select v-model="dataForm.cljg" placeholder="请选择处理结果" clearable :style='{"width":"100%"}' >
<el-option label="已处理" value="已处理" />
<el-option label="进行中" value="进行中" />
<el-option label="未处理" value="未处理" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="反馈结果" prop="fkjg">
<el-input v-model="dataForm.fkjg" placeholder="请输入" show-word-limit :style='{"width":"100%"}' type="textarea" :autosize="{minRows:4,maxRows:4}" />
</el-form-item>
</el-col>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取 消</el-button>
<el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail">确 定</el-button>
</span>
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
export default {
components: {},
props: [],
data() {
return {
loading: false,
visible: false,
isDetail: false,
filterYlzd1: '',
sbwhryOptionsAll: [],
sbwhryLoading: false,
qxgnOptions: [],
// 问题分类字典类型ID(与 migrations 中一致)
QXGN_DICT_TYPE_ID: '626798200000000001',
dataForm: {
id:'',
title:undefined,
nr:undefined,
fj2:[],
fj1:[],
clr:undefined,
fkjg:undefined,
fbr:undefined,
fbsj:undefined,
qxgn:undefined,
cljg:undefined,
},
rules: {},
}
},
computed: {
clrOptions() {
if (!this.filterYlzd1) return this.sbwhryOptionsAll
return this.sbwhryOptionsAll.filter(item => item.ylzd1 === this.filterYlzd1)
}
},
watch: {},
created() {
this.getSbwhryOptions()
this.getQxgnOptions()
},
mounted() {},
methods: {
async getQxgnOptions() {
try {
const res = await getDictionaryDataSelector(this.QXGN_DICT_TYPE_ID)
this.qxgnOptions = (res.list || []).filter(d => d && d.fullName)
} catch (e) {
this.qxgnOptions = []
}
},
getSbwhryOptions() {
this.sbwhryLoading = true
request({
url: '/api/Extend/Sbwhry',
method: 'GET',
data: { currentPage: 1, pageSize: 1000, clfw: '系统问题' }
}).then(res => {
this.sbwhryOptionsAll = (res.data.list || []).filter(item => item && (item.id || item.xm))
this.sbwhryLoading = false
}).catch(() => {
this.sbwhryOptionsAll = []
this.sbwhryLoading = false
})
},
filterSbwhryOptions() {
// 筛选变更时仅影响下拉选项,无需额外逻辑
},
goBack() {
this.$emit('refresh')
},
init(id, isDetail) {
this.dataForm.id = id || 0
this.visible = true
this.isDetail = isDetail || false
this.filterYlzd1 = ''
this.$nextTick(() => {
this.$refs['elForm'].resetFields()
if (this.dataForm.id) {
request({
url: '/api/Extend/Xtwtfk/' + this.dataForm.id,
method: 'get'
}).then(res => {
this.dataForm = res.data
if (!this.dataForm.fj2) this.dataForm.fj2 = []
if (!this.dataForm.fj1) this.dataForm.fj1 = []
})
} else {
this.dataForm.qxgn = ''
}
})
},
dataFormSubmit() {
this.$refs['elForm'].validate((valid) => {
if (valid) {
if (!this.dataForm.id) {
request({
url: `/api/Extend/Xtwtfk`,
method: 'post',
data: this.dataForm,
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.visible = false,
this.$emit('refresh', true)
}
})
})
} else {
request({
url: '/api/Extend/Xtwtfk/' + this.dataForm.id,
method: 'PUT',
data: this.dataForm
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.visible = false
this.$emit('refresh', true)
}
})
})
}
}
})
},
}
}
</script>