Form.vue
12.1 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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
<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="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="wtbj">
<el-input v-model="dataForm.wtbj" 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="gzlx">
<el-input v-model="dataForm.gzlx" placeholder="请输入故障类型(APP端对客户不显示)" clearable :style='{"width":"100%"}' />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="服务人员" prop="fwry">
<el-select v-model="fwryValue" placeholder="请从设备维护人员中选择" clearable filterable :style='{"width":"100%"}' @change="handleFwryChange">
<el-option v-for="item in sbwhryOptions" :key="item.id" :label="item.xm + (item.dh ? ' - ' + item.dh : '')" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="联系电话" prop="shdh">
<el-input v-model="dataForm.shdh" placeholder="选择服务人员后自动带出" clearable :style='{"width":"100%"}' />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="联系邮箱" prop="shyx">
<el-input v-model="dataForm.shyx" placeholder="选择服务人员后自动带出" clearable :style='{"width":"100%"}' />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="处理结果" prop="cljg">
<el-select v-model="dataForm.cljg" placeholder="请选择处理结果" :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-col :span="24">
<el-form-item label="处理人员" prop="clr">
<el-select v-model="clrValue" placeholder="请从设备维护人员中选择" clearable filterable :style='{"width":"100%"}' @change="handleClrChange">
<el-option v-for="item in sbwhryOptions" :key="item.id" :label="item.xm + (item.dh ? ' - ' + item.dh : '')" :value="item.id" />
</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="sbmc">
<el-select v-model="sbmcValue" placeholder="请选择设备名称" clearable filterable :style='{"width":"100%"}' @change="handleSbmcChange">
<el-option v-for="item in zlglOptions" :key="item.id" :label="item.zlm + ' (' + item.sbbh + ')'" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="售后人员" prop="shry">
<el-select v-model="shryValue" placeholder="请从设备维护人员中选择" clearable filterable :style='{"width":"100%"}' @change="handleShryChange">
<el-option v-for="item in sbwhryOptions" :key="item.id" :label="item.xm + (item.dh ? ' - ' + item.dh : '')" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="是否已读" prop="sfyd">
<el-select v-model="dataForm.sfyd" placeholder="请选择" :style='{"width":"100%"}' >
<el-option label="未读" value="未读" />
<el-option label="已读" value="已读" />
</el-select>
</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" >
</NCC-UploadImg>
</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="点击上传" >
</NCC-UploadFz>
</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'
import { previewDataInterface } from '@/api/systemData/dataInterface'
export default {
components: {},
props: [],
data() {
return {
loading: false,
visible: false,
isDetail: false,
dataForm: {
id: '',
title: undefined,
nr: undefined,
wtbj: undefined,
gzlx: undefined,
sbmc: undefined,
fwry: undefined,
shdh: undefined,
shyx: undefined,
cljg: '未处理',
sfyd: '未读',
fkjg: undefined,
clr: undefined,
fbr: undefined,
fbsj: undefined,
shry: undefined,
fj2: [],
fj1: [],
},
rules: {},
zlglOptions: [],
sbmcValue: '',
sbwhryOptions: [],
fwryValue: '', // 服务人员选中的 id
clrValue: '', // 处理人员选中的 id
shryValue: '', // 售后人员选中的 id
}
},
computed: {},
watch: {},
created() {
this.getZlglOptions();
this.getSbwhryOptions();
},
mounted() {
},
methods: {
getZlglOptions() {
return request({
url: '/api/Extend/Zlgl',
method: 'GET',
data: { currentPage: 1, pageSize: 1000 }
}).then(res => {
this.zlglOptions = res.data.list || []
return Promise.resolve()
}).catch(err => {
console.error('获取资料管理列表失败:', err)
this.zlglOptions = []
return Promise.reject(err)
})
},
getSbwhryOptions() {
return request({
url: '/api/Extend/Sbwhry',
method: 'GET',
data: { currentPage: 1, pageSize: 1000 }
}).then(res => {
this.sbwhryOptions = (res.data.list || []).filter(item => item && item.id && item.xm);
}).catch(() => { this.sbwhryOptions = []; });
},
handleFwryChange(val) {
if (val) {
const p = this.sbwhryOptions.find(item => item.id === val);
if (p) {
this.dataForm.fwry = p.xm;
this.dataForm.shdh = p.dh || '';
this.dataForm.shyx = p.yx || '';
}
} else {
this.dataForm.fwry = '';
this.dataForm.shdh = '';
this.dataForm.shyx = '';
}
},
handleClrChange(val) {
if (val) {
const p = this.sbwhryOptions.find(item => item.id === val);
if (p) this.dataForm.clr = p.xm;
} else {
this.dataForm.clr = '';
}
},
handleShryChange(val) {
if (val) {
const p = this.sbwhryOptions.find(item => item.id === val);
if (p) this.dataForm.shry = p.xm;
} else {
this.dataForm.shry = '';
}
},
handleSbmcChange(val) {
if (val) {
const device = this.zlglOptions.find(item => item.id === val);
if (device) this.dataForm.sbmc = device.zlm || '';
} else {
this.dataForm.sbmc = '';
}
},
goBack() {
this.$emit('refresh')
},
init(id, isDetail) {
this.dataForm.id = id || 0;
this.visible = true;
this.isDetail = isDetail || false;
this.sbmcValue = '';
this.fwryValue = '';
this.clrValue = '';
this.shryValue = '';
this.$nextTick(() => {
this.$refs['elForm'].resetFields();
if (this.dataForm.id) {
request({
url: '/api/Extend/Sbwtfk/' + 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 = [];
if (this.dataForm.cljg === undefined || this.dataForm.cljg === null) this.dataForm.cljg = '未处理';
if (this.dataForm.sfyd === undefined || this.dataForm.sfyd === null) this.dataForm.sfyd = '未读';
const setSelectValues = () => {
if (this.dataForm.sbmc && this.zlglOptions.length) {
const device = this.zlglOptions.find(item => item.zlm === this.dataForm.sbmc);
if (device) this.sbmcValue = device.id;
}
if (this.sbwhryOptions.length) {
if (this.dataForm.fwry) {
const p = this.sbwhryOptions.find(item => item.xm === this.dataForm.fwry);
if (p) this.fwryValue = p.id;
}
if (this.dataForm.clr) {
const p = this.sbwhryOptions.find(item => item.xm === this.dataForm.clr);
if (p) this.clrValue = p.id;
}
if (this.dataForm.shry) {
const p = this.sbwhryOptions.find(item => item.xm === this.dataForm.shry);
if (p) this.shryValue = p.id;
}
}
};
if (this.zlglOptions.length && this.sbwhryOptions.length) {
setSelectValues();
} else {
Promise.all([
this.zlglOptions.length ? Promise.resolve() : this.getZlglOptions(),
this.sbwhryOptions.length ? Promise.resolve() : this.getSbwhryOptions()
]).then(setSelectValues);
}
});
} else {
this.dataForm.cljg = '未处理';
this.dataForm.sfyd = '未读';
this.dataForm.sbmc = '';
}
});
},
dataFormSubmit() {
this.$refs['elForm'].validate((valid) => {
if (valid) {
if (!this.dataForm.id) {
request({
url: `/api/Extend/Sbwtfk`,
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/Sbwtfk/' + 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>