fix: bug#16316、#16314

This commit is contained in:
haodd 2023-07-13 15:36:59 +08:00
parent aba42ad1aa
commit afdbd3a3b4
2 changed files with 23 additions and 5 deletions

View File

@ -30,9 +30,21 @@
</j-space> </j-space>
<div style="margin-top: 20px" v-if="importLoading"> <div style="margin-top: 20px" v-if="importLoading">
<j-badge v-if="flag" status="processing" text="进行中" /> <j-badge v-if="flag" status="processing" text="进行中" />
<j-badge v-else status="success" text="已完成" /> <div v-else>
<span>总数量{{ count }}</span> <div>
<p style="color: red">{{ errMessage }}</p> <j-space size="large">
<j-badge status="success" text="已完成" />
<span>总数量{{ count }}</span>
</j-space>
</div>
<div>
<j-space size="large">
<j-badge status="error" text="失败&emsp;" />
<span>总数量{{ failCount }}</span>
<a :href="detailFile" v-if="failCount">下载</a>
</j-space>
</div>
</div>
</div> </div>
</template> </template>
@ -85,7 +97,9 @@ const props = defineProps({
const importLoading = ref<boolean>(false); const importLoading = ref<boolean>(false);
const flag = ref<boolean>(false); const flag = ref<boolean>(false);
const count = ref<number>(0); const count = ref<number>(0);
const failCount = ref(0);
const errMessage = ref<string>(''); const errMessage = ref<string>('');
const detailFile = ref('');
const downFile = async (type: string) => { const downFile = async (type: string) => {
const res: any = await templateDownload(props.product, type); const res: any = await templateDownload(props.product, type);
@ -112,6 +126,7 @@ const beforeUpload = (_file: any) => {
const submitData = async (fileUrl: string) => { const submitData = async (fileUrl: string) => {
if (!!fileUrl) { if (!!fileUrl) {
count.value = 0; count.value = 0;
failCount.value = 0;
errMessage.value = ''; errMessage.value = '';
flag.value = true; flag.value = true;
const autoDeploy = !!props?.file?.autoDeploy || false; const autoDeploy = !!props?.file?.autoDeploy || false;
@ -126,8 +141,11 @@ const submitData = async (fileUrl: string) => {
const temp = res.result.total; const temp = res.result.total;
dt += temp; dt += temp;
count.value = dt; count.value = dt;
} else { } else if(!res.success && !res.detailFile) {
failCount.value++;
errMessage.value = res.message || '失败'; errMessage.value = res.message || '失败';
} else if(res.detailFile) {
detailFile.value = res.detailFile;
} }
}; };
source.onerror = (e: { status: number }) => { source.onerror = (e: { status: number }) => {

View File

@ -323,7 +323,7 @@ const handleAdd = () => {
); );
tab.onTabSaveSuccess = async (value: any) => { tab.onTabSaveSuccess = async (value: any) => {
await getGatewayList(); await getGatewayList();
handleClick(value?.result); handleClick(gatewayList.value?.[0]);
}; };
}; };
</script> </script>