CN-906 feat: 优化上传交互

This commit is contained in:
chenj
2023-03-05 13:50:22 +08:00
parent a9e5915113
commit e2f9eb7f59
2 changed files with 47 additions and 9 deletions

View File

@@ -44,7 +44,7 @@
<span>-</span>
</template>
</template>
<template v-else-if="item.prop === 'utime'">
<template v-else-if="item.prop === 'utime' || item.prop === 'ctime'">
<template v-if="scope.row[item.prop]">
{{dateFormatByAppearance(scope.row[item.prop])}}
</template>
@@ -52,6 +52,14 @@
<span>-</span>
</template>
</template>
<template v-else-if="item.prop === 'cbyObj' || item.prop === 'ubyObj'">
<template v-if="scope.row[item.prop]">
{{scope.row[item.prop].name || '-'}}
</template>
<template v-else>
<span>-</span>
</template>
</template>
<span v-else>{{scope.row[item.prop]}}</span>
</template>
</el-table-column>
@@ -64,7 +72,7 @@
</template>
<template #default="scope">
<div class="table-operation-items">
<button class="table-operation-item" @click="tableOperation(['edit', scope.row])"><i class="cn-icon cn-icon-edit"></i></button>
<!-- <button class="table-operation-item" @click="tableOperation(['edit', scope.row])"><i class="cn-icon cn-icon-edit"></i></button>-->
<el-dropdown size="medium" trigger="hover" @command="tableOperation">
<div class="table-operation-item table-operation-item--more">
<i class="cn-icon cn-icon-more-arrow-down"></i>
@@ -109,10 +117,26 @@ export default {
label: this.$t('overall.remark'),
prop: 'remark',
show: true
}, {
},
{
label: this.$t('overall.createdBy'),
prop: 'cbyObj',
show: true
},
{
label: this.$t('overall.createTime'),
prop: 'ctime',
show: false
},
{
label: this.$t('overall.updatedBy'),
prop: 'ubyObj',
show: false
},
{
label: this.$t('overall.updateTime'),
prop: 'utime',
show: true
show: false
}
]
}

View File

@@ -18,7 +18,7 @@
class="form-select"
placeholder=" "
popper-class="form-select-popper"
:disabled="!!editObject.id"
:disabled="!!editObject.id || typeSelectDisable"
size="mini"
>
<template v-for="type in knowledgeBaseType" :key="type.name">
@@ -40,6 +40,7 @@
:file-list="fileList"
:on-change="fileChange"
:on-success="uploadSuccess"
:on-remove="onRemove"
:class="uploadErrorTip ? 'el-upload--error' : ''"
drag
accept=".csv"
@@ -142,6 +143,7 @@ export default {
// 上传成功后去掉upload和preview的错误提示
this.uploadErrorTip = ''
this.previewErrorTip = ''
this.typeSelectDisable = true
this.importedType = this.editObject.tagType
const originalImportedData = response.data.data
@@ -155,6 +157,17 @@ export default {
this.handleShowImportedData()
}
},
onRemove (files, fileList) {
this.uploaded = false
this.typeSelectDisable = false
this.importedData = []
this.showImportedData = []
this.originalImportInfo = {
total: null,
succeeded: null,
failed: null
}
},
handleShowImportedData () {
const startIndex = (this.importedPageObj.pageNo - 1) * this.importedPageObj.pageSize
const endIndex = this.importedPageObj.pageNo * this.importedPageObj.pageSize
@@ -236,14 +249,14 @@ export default {
d.itemList = [...d.itemList]
})
axios.post(this.url, postData).then(response => {
if (response.code === 200) {
if (response.data.code === 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.$router.push({
path: this.url,
path: '/knowledgeBase',
t: +new Date()
})
} else {
this.$message.error(response.msg)
this.$message.error(response.data.message)
}
}).finally(() => {
this.blockOperation.save = false
@@ -379,7 +392,8 @@ export default {
url: api.knowledgeBase,
originalImportInfo,
uploadErrorTip,
previewErrorTip
previewErrorTip,
typeSelectDisable: ref(false)
}
}
}