【issues/846】上传多个列表只显示一个

pull/867/head
zhangdaiscott 2023-11-19 22:03:44 +08:00
parent f4b902011e
commit 5eeab9c448
1 changed files with 17 additions and 9 deletions

View File

@ -31,7 +31,7 @@
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, PropType, ref, reactive, watchEffect, computed, unref, watch, onMounted } from 'vue'; import { defineComponent, PropType, ref, reactive, watchEffect, computed, unref, watch, onMounted, nextTick } from 'vue';
import { LoadingOutlined, UploadOutlined } from '@ant-design/icons-vue'; import { LoadingOutlined, UploadOutlined } from '@ant-design/icons-vue';
import { useRuleFormItem } from '/@/hooks/component/useFormItem'; import { useRuleFormItem } from '/@/hooks/component/useFormItem';
import { propTypes } from '/@/utils/propTypes'; import { propTypes } from '/@/utils/propTypes';
@ -175,28 +175,36 @@
*/ */
function handleChange({ file, fileList, event }) { function handleChange({ file, fileList, event }) {
initTag.value = false; initTag.value = false;
uploadFileList.value = fileList; // update-begin--author:liaozhiyang---date:20231116---forissues/846
// uploadFileList.value = fileList;
if (file.status === 'error') { if (file.status === 'error') {
createMessage.error(`${file.name} 上传失败.`); createMessage.error(`${file.name} 上传失败.`);
} }
let fileUrls = []; let fileUrls = [];
// let noUploadingFileCount = 0;
if (file.status != 'uploading') { if (file.status != 'uploading') {
fileList.forEach((file) => { fileList.forEach((file) => {
if (file.status === 'done') { if (file.status === 'done') {
//update-begin---author:wangshuai ---date:20221121 for[issues/248]使,------------
initTag.value = true;
//update-end---author:wangshuai ---date:20221121 for[issues/248]使,------------
fileUrls.push(file.response.message); fileUrls.push(file.response.message);
} }
if (file.status != 'uploading') {
noUploadingFileCount++;
}
}); });
if (file.status === 'removed') { if (file.status === 'removed') {
handleDelete(file); handleDelete(file);
} }
if (noUploadingFileCount == fileList.length) {
state.value = fileUrls.join(',');
emit('update:value', fileUrls.join(','));
// update-begin---author:wangshuai ---date:20221121 for[issues/248]使,------------
nextTick(() => {
initTag.value = true;
});
// update-end---author:wangshuai ---date:20221121 for[issues/248]使,------------
}
} }
// emitData.value = fileUrls.join(','); // update-end--author:liaozhiyang---date:20231116---forissues/846
state.value = fileUrls.join(',');
emit('update:value', fileUrls.join(','));
} }
/** /**