|
@@ -1,28 +1,35 @@
|
|
|
<template>
|
|
|
- <t-upload
|
|
|
- ref="uploadRef3"
|
|
|
- v-model="files"
|
|
|
- :theme="theme"
|
|
|
- :tips="`最多只能上传 ${config.length || 3} 张图片`"
|
|
|
- accept="image/*"
|
|
|
- :abridge-name="[6, 6]"
|
|
|
- :auto-upload="true"
|
|
|
- :upload-all-files-in-one-request="false"
|
|
|
- multiple
|
|
|
- :max="config.length || 3"
|
|
|
- :disabled="!config.writable"
|
|
|
- :before-upload="handleBeforeUpload"
|
|
|
- :request-method="upload"
|
|
|
- @fail="handleFail"
|
|
|
- @change="handleChange"
|
|
|
- >
|
|
|
- </t-upload>
|
|
|
+ <div>
|
|
|
+ <t-upload
|
|
|
+ ref="uploadRef3"
|
|
|
+ v-model="files"
|
|
|
+ :theme="theme"
|
|
|
+ :tips="`最多只能上传 ${config.length || 3} 张图片`"
|
|
|
+ accept="image/*"
|
|
|
+ :abridge-name="[6, 6]"
|
|
|
+ :auto-upload="true"
|
|
|
+ :upload-all-files-in-one-request="false"
|
|
|
+ multiple
|
|
|
+ :max="config.length || 3"
|
|
|
+ :disabled="!config.writable"
|
|
|
+ :before-upload="handleBeforeUpload"
|
|
|
+ :request-method="upload"
|
|
|
+ @fail="handleFail"
|
|
|
+ @change="handleChange"
|
|
|
+ :show-image-file-name="true"
|
|
|
+ >
|
|
|
+ </t-upload>
|
|
|
+ <div class="m-t-5px" v-if="isYSBG">
|
|
|
+ <t-link theme="primary" @click="downloadAll">下载验收报告单</t-link>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script setup name="UploadImage">
|
|
|
-import { ref, watch, onMounted } from 'vue';
|
|
|
+import { ref, watch, onMounted, computed } from 'vue';
|
|
|
import { MessagePlugin } from 'tdesign-vue-next';
|
|
|
import { uploadFiles } from '@/api/common';
|
|
|
import { getFileMD5 } from '@/utils/crypto';
|
|
|
+import { downloadByCrossUrl } from '@/utils/tool';
|
|
|
|
|
|
const props = defineProps({
|
|
|
theme: {
|
|
@@ -42,6 +49,14 @@ const props = defineProps({
|
|
|
type: Object,
|
|
|
},
|
|
|
modelValue: { type: Array },
|
|
|
+ sop: { type: Object },
|
|
|
+});
|
|
|
+const isYSBG = computed(() => {
|
|
|
+ return (
|
|
|
+ props.config?.formName?.startsWith('upload_check_report_photos') &&
|
|
|
+ !props.config.writable &&
|
|
|
+ files.value.length
|
|
|
+ );
|
|
|
});
|
|
|
const emit = defineEmits(['update:modelValue', 'change']);
|
|
|
|
|
@@ -97,6 +112,17 @@ const handleChange = () => {
|
|
|
onMounted(() => {
|
|
|
files.value = props.config.value || [];
|
|
|
});
|
|
|
+const downloadAll = () => {
|
|
|
+ console.log('sop', props.sop);
|
|
|
+ files.value.forEach((item, index) => {
|
|
|
+ let number = index == 0 ? '' : index + 1 + '';
|
|
|
+ downloadByCrossUrl(
|
|
|
+ item.previewUrl,
|
|
|
+ // 'https://cet-test.markingtool.cn/file/slice/1/1/10102/1/013/1/101021221201302-1.jpg',
|
|
|
+ props.sop?.customName ? props.sop.customName + number : ''
|
|
|
+ );
|
|
|
+ });
|
|
|
+};
|
|
|
// watch(
|
|
|
// () => props.modelValue,
|
|
|
// (val, oldval) => {
|