|
|
@@ -90,8 +90,8 @@
|
|
90
|
90
|
<view class="upload-section" v-if="!allItemsQualified">
|
|
91
|
91
|
<text class="upload-title">上传不合格图片</text>
|
|
92
|
92
|
<uni-file-picker v-model="formData.baseAttachmentList" limit="8" title="最多上传8张"
|
|
93
|
|
- :image-styles="imageStyles" fileMediatype="image" mode="grid" @select="onSelect"
|
|
94
|
|
- :disabled="formDisabled" />
|
|
|
93
|
+ style="height: 350rpx;" :image-styles="imageStyles" fileMediatype="image"
|
|
|
94
|
+ mode="grid" @select="onSelect" :disabled="formDisabled" :readonly="formDisabled"/>
|
|
95
|
95
|
</view>
|
|
96
|
96
|
</view>
|
|
97
|
97
|
</h-collapse-item>
|
|
|
@@ -142,7 +142,7 @@ import TextSwitch from "@/components/text-switch/text-switch.vue"
|
|
142
|
142
|
import { checkedLevelEnums } from "@/utils/enums.js"
|
|
143
|
143
|
import UnqualifiedPersonnel from "./components/unqualified.vue"
|
|
144
|
144
|
import { treeSelectByType } from "@/api/system/common"
|
|
145
|
|
-import { buildTeamOptions, uploadFile, buildDepartmentOptions, buildBrigadeOptions } from '@/utils/common'
|
|
|
145
|
+import { buildTeamOptions, buildDepartmentOptions, buildBrigadeOptions } from '@/utils/common'
|
|
146
|
146
|
import useDictMixin from '@/utils/dict'
|
|
147
|
147
|
import { getDeptRoleUser } from "@/api/check/checklist.js"
|
|
148
|
148
|
import { addDraftInspection, submitInspection, getInspectionListById } from '@/api/check/checkReward.js'
|
|
|
@@ -261,7 +261,7 @@ export default {
|
|
261
|
261
|
},
|
|
262
|
262
|
{
|
|
263
|
263
|
validateFunction: (rule, value, data, callback) => {
|
|
264
|
|
- console.log(value,"value")
|
|
|
264
|
+ console.log(value, "value")
|
|
265
|
265
|
if (!value) {
|
|
266
|
266
|
// 检查是否选择了完整的检查地点(终端、区域、通道)
|
|
267
|
267
|
callback('请选择完整的检查地点');
|
|
|
@@ -485,7 +485,7 @@ export default {
|
|
485
|
485
|
let newText = text.split('/')
|
|
486
|
486
|
this.$set(this.formData, 'checkedBrigadeName', newText[newText.length - 1].trim());
|
|
487
|
487
|
this.$set(this.formData, 'checkedDeptId', value);
|
|
488
|
|
-
|
|
|
488
|
+
|
|
489
|
489
|
this.$set(this.formData, 'checkedDeptName', newText[newText.length - 1].trim());
|
|
490
|
490
|
this.$set(this.formData, 'checkedDepartmentId', value);
|
|
491
|
491
|
this.$set(this.formData, 'checkedDepartmentName', newText[newText.length - 1].trim());
|
|
|
@@ -582,16 +582,39 @@ export default {
|
|
582
|
582
|
},
|
|
583
|
583
|
// 选择文件后手动上传
|
|
584
|
584
|
async onSelect(event) {
|
|
585
|
|
- const file = await uploadFile(event);
|
|
586
|
|
- console.log(file, "file", this.formData)
|
|
587
|
|
-
|
|
588
|
|
- this.formData.baseAttachmentList.push({
|
|
|
585
|
+ const files = await this.uploadFile(event);
|
|
|
586
|
+ console.log(files, "file", this.formData)
|
|
|
587
|
+ let fileArr = files.map(file => ({
|
|
589
|
588
|
url: file.url,
|
|
590
|
589
|
name: file.newFileName,
|
|
591
|
590
|
attachmentName: file.newFileName,
|
|
592
|
591
|
attachmentUrl: file.url,
|
|
593
|
592
|
extname: file.newFileName.split('.').pop()
|
|
594
|
|
- });
|
|
|
593
|
+ }))
|
|
|
594
|
+ // 直接替换而不是追加,因为限制只能上传1张
|
|
|
595
|
+ this.formData.baseAttachmentList = [
|
|
|
596
|
+ ...this.formData.baseAttachmentList,
|
|
|
597
|
+ ...fileArr
|
|
|
598
|
+ ];
|
|
|
599
|
+
|
|
|
600
|
+ },
|
|
|
601
|
+ // 封装上传
|
|
|
602
|
+ uploadFile(event) {
|
|
|
603
|
+ return Promise.all(event.tempFilePaths.map(filePath => {
|
|
|
604
|
+ return new Promise((resolve, reject) => {
|
|
|
605
|
+ uni.uploadFile({
|
|
|
606
|
+ url: `${config.baseUrl}/common/upload`,
|
|
|
607
|
+ filePath: filePath,
|
|
|
608
|
+ name: 'file',
|
|
|
609
|
+ header: { Authorization: 'Bearer ' + getToken() },
|
|
|
610
|
+ formData: {
|
|
|
611
|
+ // 可添加其他参数
|
|
|
612
|
+ },
|
|
|
613
|
+ success: (res) => resolve(JSON.parse(res.data)),
|
|
|
614
|
+ fail: reject
|
|
|
615
|
+ });
|
|
|
616
|
+ });
|
|
|
617
|
+ }));
|
|
595
|
618
|
},
|
|
596
|
619
|
// 填充表单数据
|
|
597
|
620
|
fillFormData(inspectionDetail) {
|
|
|
@@ -731,7 +754,7 @@ export default {
|
|
731
|
754
|
const payload = this.formateData();
|
|
732
|
755
|
|
|
733
|
756
|
|
|
734
|
|
- addDraftInspection({ ...payload, id: this.taskId })
|
|
|
757
|
+ addDraftInspection({ ...payload, ...(this.formData.checkRecordStatus == 'DRAFT' ? { id: this.taskId } : {}) })
|
|
735
|
758
|
.then(() => {
|
|
736
|
759
|
uni.showToast({ title: '草稿保存成功', icon: 'success' });
|
|
737
|
760
|
console.log('草稿保存成功:',);
|
|
|
@@ -751,7 +774,7 @@ export default {
|
|
751
|
774
|
// 提交表单
|
|
752
|
775
|
submitForm() {
|
|
753
|
776
|
this.$refs.form.validate().then(res => {
|
|
754
|
|
-
|
|
|
777
|
+
|
|
755
|
778
|
// 检查所有不合格项是否都填写了相关人员
|
|
756
|
779
|
let hasError = false;
|
|
757
|
780
|
let errorMessage = '';
|