|
|
@@ -62,12 +62,16 @@
|
|
62
|
62
|
</view>
|
|
63
|
63
|
<view class="problem-content">
|
|
64
|
64
|
<view class="problem-person">
|
|
65
|
|
- <view class="problem-label">问题人<text style="color: red;margin-left: 10rpx;">请确定问题人</text></view>
|
|
66
|
|
-
|
|
67
|
|
- <fuzzy-select v-model="problem.checkUserList.userId" :options="userOptions"
|
|
68
|
|
- :placeholder="'请输入问题' + (index + 1) + '的责任人'" data-value="userId"
|
|
69
|
|
- data-text="nickName" @change="handleUserSelect"
|
|
70
|
|
- :disabled="formDisabled" />
|
|
|
65
|
+ <view class="problem-label"><text v-if="isResponsiblePerson"
|
|
|
66
|
+ style="color: red;">*</text>问题人<text
|
|
|
67
|
+ style="color: red;margin-left: 10rpx;">请确定问题人</text></view>
|
|
|
68
|
+
|
|
|
69
|
+ <fuzzy-select :value="getCheckUserListValue(problem.checkUserList)"
|
|
|
70
|
+ :options="userOptions" :placeholder="'请输入问题' + (index + 1) + '的责任人'"
|
|
|
71
|
+ data-value="userId" data-text="nickName"
|
|
|
72
|
+ @input="handleUserInput(index, $event)"
|
|
|
73
|
+ @change="handleUserSelect($event, index)"
|
|
|
74
|
+ @delete="handleUserDelete(index)" :disabled="formDisabled" />
|
|
71
|
75
|
</view>
|
|
72
|
76
|
<view class="problem-description">
|
|
73
|
77
|
<text class="problem-label">问题描述</text>
|
|
|
@@ -209,7 +213,7 @@ import { listAllUser } from "@/api/system/user.js"
|
|
209
|
213
|
import { getProblemRectDetail, approvalAgree, approvalReject } from '@/api/problemRect/problemRect.js'
|
|
210
|
214
|
import { getApprovelHistory } from '@/api/approve/approve.js'
|
|
211
|
215
|
import { getDeptManager, getDeptDetail } from "@/api/system/dept/dept.js"
|
|
212
|
|
-import { buildTeamOptions, buildDepartmentOptions,buildBrigadeOptions } from "@/utils/common.js"
|
|
|
216
|
+import { buildTeamOptions, buildDepartmentOptions, buildBrigadeOptions } from "@/utils/common.js"
|
|
213
|
217
|
export default {
|
|
214
|
218
|
components: { HomeContainer, RejectModal },
|
|
215
|
219
|
mixins: [useDictMixin],
|
|
|
@@ -315,7 +319,7 @@ export default {
|
|
315
|
319
|
selectTeamName: '', // 整改班组名称
|
|
316
|
320
|
selectTeamLeaderId: '', // 班组长ID
|
|
317
|
321
|
selectTeamLeaderName: '', // 班组长姓名
|
|
318
|
|
-
|
|
|
322
|
+
|
|
319
|
323
|
// 被检查对象相关字段
|
|
320
|
324
|
checkedBrigadeId: '', // 被检查大队ID
|
|
321
|
325
|
checkedBrigadeName: '', // 被检查大队名称
|
|
|
@@ -364,10 +368,39 @@ export default {
|
|
364
|
368
|
console.log(this.$store.state.user)
|
|
365
|
369
|
},
|
|
366
|
370
|
methods: {
|
|
367
|
|
- handlecheckedDepartmentIdChange(e) {
|
|
|
371
|
+ handleUserSelect(e, index) {
|
|
|
372
|
+ const person = this.userOptions.find(item => item.userId == e)
|
|
|
373
|
+ if (this.formData.checkProjectItemList && this.formData.checkProjectItemList[index]) {
|
|
|
374
|
+ this.formData.checkProjectItemList[index].checkUserList = person;
|
|
|
375
|
+ }
|
|
|
376
|
+ },
|
|
368
|
377
|
|
|
|
378
|
+ // 获取checkUserList的值,处理null情况
|
|
|
379
|
+ getCheckUserListValue(checkUserList) {
|
|
|
380
|
+ return checkUserList && checkUserList.userId ? checkUserList.userId : '';
|
|
|
381
|
+ },
|
|
|
382
|
+
|
|
|
383
|
+ // 处理用户输入
|
|
|
384
|
+ handleUserInput(index, value) {
|
|
|
385
|
+ if (this.formData.checkProjectItemList && this.formData.checkProjectItemList[index]) {
|
|
|
386
|
+ if (!this.formData.checkProjectItemList[index].checkUserList) {
|
|
|
387
|
+ this.formData.checkProjectItemList[index].checkUserList = {};
|
|
|
388
|
+ }
|
|
|
389
|
+ this.formData.checkProjectItemList[index].checkUserList.userId = value;
|
|
|
390
|
+ }
|
|
|
391
|
+ },
|
|
|
392
|
+
|
|
|
393
|
+ // 处理用户删除
|
|
|
394
|
+ handleUserDelete(index) {
|
|
|
395
|
+ // 将problem.checkUserList置为null
|
|
|
396
|
+ if (this.formData.checkProjectItemList && this.formData.checkProjectItemList[index]) {
|
|
|
397
|
+ this.formData.checkProjectItemList[index].checkUserList = null;
|
|
|
398
|
+ // 强制更新视图以确保fuzzy-select组件重新渲染
|
|
|
399
|
+ this.$nextTick(() => {
|
|
|
400
|
+ this.$forceUpdate();
|
|
|
401
|
+ });
|
|
|
402
|
+ }
|
|
369
|
403
|
},
|
|
370
|
|
-
|
|
371
|
404
|
// 被检查大队选择
|
|
372
|
405
|
handlecheckedBrigadeIdChange(e) {
|
|
373
|
406
|
const { text, value } = e.detail.value[0];
|
|
|
@@ -422,7 +455,7 @@ export default {
|
|
422
|
455
|
|
|
423
|
456
|
// 填充表单数据
|
|
424
|
457
|
async fillFormData(data) {
|
|
425
|
|
- console.log(data,"data")
|
|
|
458
|
+ console.log(data, "data")
|
|
426
|
459
|
// debugger
|
|
427
|
460
|
let checedProjectArr = [];
|
|
428
|
461
|
if (data.checkProjectItemList && data.checkProjectItemList?.length > 0) {
|
|
|
@@ -476,7 +509,7 @@ export default {
|
|
476
|
509
|
|
|
477
|
510
|
}
|
|
478
|
511
|
console.log(checedProjectArr, "checedProjectArr")
|
|
479
|
|
- // debugger
|
|
|
512
|
+ // debugger
|
|
480
|
513
|
|
|
481
|
514
|
this.formData = {
|
|
482
|
515
|
...this.formData,
|
|
|
@@ -555,7 +588,7 @@ export default {
|
|
555
|
588
|
|
|
556
|
589
|
// 还原checkProjectItemList结构到后端原始格式
|
|
557
|
590
|
const restoredCheckProjectItemList = this.restoreOriginalCheckProjectItemList();
|
|
558
|
|
-
|
|
|
591
|
+
|
|
559
|
592
|
const payload = {
|
|
560
|
593
|
...this.formData,
|
|
561
|
594
|
checkProjectItemList: restoredCheckProjectItemList,
|
|
|
@@ -580,22 +613,23 @@ export default {
|
|
580
|
613
|
|
|
581
|
614
|
// 提交表单
|
|
582
|
615
|
submitForm() {
|
|
|
616
|
+ debugger
|
|
583
|
617
|
// 如果当前用户是责任人,校验问题人字段必填
|
|
584
|
618
|
if (this.isResponsiblePerson) {
|
|
585
|
|
- const hasEmptyProblemUser = this.formData.checkProjectItemList?.some(problem =>
|
|
|
619
|
+ const hasEmptyProblemUser = this.formData.checkProjectItemList?.some(problem =>
|
|
586
|
620
|
!problem.checkUserList || !problem.checkUserList.userId
|
|
587
|
621
|
);
|
|
588
|
|
-
|
|
|
622
|
+
|
|
589
|
623
|
if (hasEmptyProblemUser) {
|
|
590
|
|
- uni.showToast({
|
|
591
|
|
- title: '请填写所有问题的责任人',
|
|
|
624
|
+ uni.showToast({
|
|
|
625
|
+ title: '请填写所有问题的问题人',
|
|
592
|
626
|
icon: 'none',
|
|
593
|
627
|
duration: 3000
|
|
594
|
628
|
});
|
|
595
|
629
|
return;
|
|
596
|
630
|
}
|
|
597
|
631
|
}
|
|
598
|
|
-
|
|
|
632
|
+
|
|
599
|
633
|
this.$refs.form.validate().then(res => {
|
|
600
|
634
|
uni.showLoading({ title: '提交中...', mask: true });
|
|
601
|
635
|
|