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

View File

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