|
@@ -10,11 +10,11 @@
|
|
|
<i v-show="percentage === 100" class="el-icon-check"></i>
|
|
|
</span>
|
|
|
</el-progress>
|
|
|
- {{ size }} / {{ total }}
|
|
|
+ {{ index }} / {{ total }}
|
|
|
<div v-if="notExcel">
|
|
|
<div v-show="tips.length > 0">
|
|
|
<el-divider></el-divider>
|
|
|
- <el-alert :title="tips" type="error" @close="closeAlert"/>
|
|
|
+ <el-alert :title="tips" type="success" @close="closeAlert"/>
|
|
|
</div>
|
|
|
<el-divider></el-divider>
|
|
|
<ul style="overflow: auto" class="infinite-list" id="jdtRef">
|
|
@@ -24,11 +24,11 @@
|
|
|
</ul>
|
|
|
<el-divider></el-divider>
|
|
|
<div style="width: 100%; display: flex; justify-content: right">
|
|
|
- <el-button @click="closeModal" :disabled="percentage < 100" type="warning" icon="el-icon-close" size="small">
|
|
|
+ <el-button @click="closeModal" :disabled="!jdt.closeButton" type="warning" icon="el-icon-close" index="small">
|
|
|
关闭
|
|
|
</el-button>
|
|
|
- <el-button @click="exportExcel" :disabled="percentage < 100" type="primary" icon="el-icon-download"
|
|
|
- size="small"> 导出Excel
|
|
|
+ <el-button @click="exportExcel" :disabled="!jdt.closeButton" type="primary" icon="el-icon-download"
|
|
|
+ index="small"> 导出Excel
|
|
|
</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -43,6 +43,7 @@ import {setCallback} from '@/utils/websocket'
|
|
|
import {Export} from '@/utils/ExportExcel'
|
|
|
import {makePercentage} from "./progUtils";
|
|
|
import {stringNotBlank} from "../../utils/blank-utils";
|
|
|
+import {reactive, watch} from "vue";
|
|
|
|
|
|
export default {
|
|
|
setup() {
|
|
@@ -64,32 +65,31 @@ export default {
|
|
|
tips.value = ''
|
|
|
store.commit('app/closeJdt')
|
|
|
}
|
|
|
+
|
|
|
+ const cuoWuLeiXin = reactive({
|
|
|
+ success: 0,
|
|
|
+ danger: 0,
|
|
|
+ warning: 0,
|
|
|
+ info: 0,
|
|
|
+ })
|
|
|
+
|
|
|
+ // 提示语
|
|
|
const tips = ref('')
|
|
|
const notExcel = ref(true)
|
|
|
|
|
|
const total = ref(0)
|
|
|
- const size = ref(0)
|
|
|
+ const index = ref(0)
|
|
|
|
|
|
const excelTitle = ref({})
|
|
|
|
|
|
const socketCallback = (data) => {
|
|
|
- if (stringNotBlank(data.jdtType) && data.jdtType === 'pureProgress') {
|
|
|
- store.commit('app/setJdt', {
|
|
|
- title: data.jdtTitle,
|
|
|
- isOpen: true,
|
|
|
- abnormalClosing: true
|
|
|
- })
|
|
|
- total.value = data.total
|
|
|
- size.value = data.size
|
|
|
- percentage.value = makePercentage(data.size, data.total)
|
|
|
+ total.value = data.total
|
|
|
+ index.value = data.index
|
|
|
+ percentage.value = makePercentage(data.index, data.total)
|
|
|
+ if (stringNotBlank(data.jdtType) && data.jdtType === 'download') {
|
|
|
notExcel.value = false
|
|
|
- if (percentage.value === 100) {
|
|
|
- setTimeout(() => {
|
|
|
- store.commit('app/closeJdt')
|
|
|
- }, 500)
|
|
|
- }
|
|
|
- } else {
|
|
|
- percentage.value = data.percentage
|
|
|
+ store.commit('app/titleJdt', "下载中...")
|
|
|
+ } else if (stringNotBlank(data.jdtType) && data.jdtType === 'upload') {
|
|
|
for (let key in data) {
|
|
|
if (key.indexOf("#") > -1) {
|
|
|
let newKey = key.split("#")
|
|
@@ -102,9 +102,28 @@ export default {
|
|
|
delete data[key]
|
|
|
}
|
|
|
}
|
|
|
+ notExcel.value = true
|
|
|
jdtData.value.push(data)
|
|
|
const jdtRef = document.getElementById('jdtRef')
|
|
|
jdtRef.scrollTop = jdtRef.scrollHeight
|
|
|
+ if (percentage.value === 100) {
|
|
|
+ let success = 0
|
|
|
+ let danger = 0
|
|
|
+ let warning = 0
|
|
|
+ let info = 0
|
|
|
+ jdtData.value.forEach(item => {
|
|
|
+ if (item.type === 0) {
|
|
|
+ success++
|
|
|
+ } else if (item.type === 1) {
|
|
|
+ danger++
|
|
|
+ } else if (item.type === 2) {
|
|
|
+ warning++
|
|
|
+ } else {
|
|
|
+ info++
|
|
|
+ }
|
|
|
+ })
|
|
|
+ tips.value = `数据上传完成:成功:【${success}】、错误:【${danger}】、内部错误:【${warning}】、未知:【${info}】、总条数:【${jdtData.value.length}】`
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -160,9 +179,14 @@ export default {
|
|
|
tips.value = ''
|
|
|
}
|
|
|
|
|
|
+ watch(() => jdt.value.isOpen, () => {
|
|
|
+ if (!jdt.value.isOpen) {
|
|
|
+ closeModal()
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
setCallback(socketCallback)
|
|
|
-
|
|
|
})
|
|
|
|
|
|
return {
|
|
@@ -177,7 +201,8 @@ export default {
|
|
|
closeAlert,
|
|
|
notExcel,
|
|
|
total,
|
|
|
- size,
|
|
|
+ index,
|
|
|
+ cuoWuLeiXin,
|
|
|
}
|
|
|
},
|
|
|
}
|