CN-1062 fix:列表页切换模式后,status切换没有请求接口;卡片模式下点select,选中某个卡片后边框改变了,然后切换到table模式,再切回卡片模式,之前选中的卡片边框仍然是选中状态;删除提示框中,name列挪到第一列,category和source列数据需要映射,不显示原始数据;新增修改页:import列名改为tip;itemList中tip的交互;itemList中编辑按钮盖住了tip列的文字;itemList中edit交互问题;

This commit is contained in:
hyx
2023-06-09 09:45:08 +08:00
parent 0d10a06522
commit a1267daa72
4 changed files with 48 additions and 21 deletions

View File

@@ -892,7 +892,7 @@
} }
} }
.imported-data-msg { .imported-data-msg {
width: 140px; width: 200px;
} }
.el-icon-close { .el-icon-close {

View File

@@ -44,7 +44,7 @@ export default {
tableData: { tableData: {
handler (n) { handler (n) {
if (this.tableData && this.tableData.length > 0) { if (this.tableData && this.tableData.length > 0) {
this.isInit = false //this.isInit = false
} }
} }
} }
@@ -52,8 +52,7 @@ export default {
data () { data () {
return { return {
operationWidth: '165', // 操作列宽 operationWidth: '165', // 操作列宽
show: true, show: true
isInit: true
} }
}, },
methods: { methods: {
@@ -109,11 +108,8 @@ export default {
}) })
} }
}, },
init () {
this.isInit = true
},
changeStatus (status, id) { changeStatus (status, id) {
if (!this.isInit) { if (id) {
patch(api.knowledgeBaseEnable, { list: [{ knowledgeId: id, status: status }] }).then(response => { patch(api.knowledgeBaseEnable, { list: [{ knowledgeId: id, status: status }] }).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })

View File

@@ -67,7 +67,7 @@
@selectionChange="selectionChange" @selectionChange="selectionChange"
@edit="edit" @edit="edit"
@orderBy="tableDataSort" @orderBy="tableDataSort"
@reload="getTableData" @reload="reloadRowList"
></knowledge-base-table-for-row> ></knowledge-base-table-for-row>
</div> </div>
</template> </template>
@@ -84,6 +84,7 @@
:all-count="18" :all-count="18"
@delete="toDelete" @delete="toDelete"
@checkboxStatusChange="checkboxStatusChange" @checkboxStatusChange="checkboxStatusChange"
@reload="reloadRowList"
></knowledge-base-table-for-card> ></knowledge-base-table-for-card>
</div> </div>
</template> </template>
@@ -118,9 +119,9 @@
width="50"> width="50">
</el-table-column> </el-table-column>
<el-table-column property="knowledgeId" label="ID" width="50"></el-table-column> <el-table-column property="knowledgeId" label="ID" width="50"></el-table-column>
<el-table-column property="category" label="Category" width="100"></el-table-column>
<el-table-column property="source" label="Source" width="110"></el-table-column>
<el-table-column property="name" label="Name"></el-table-column> <el-table-column property="name" label="Name"></el-table-column>
<el-table-column property="category" label="Category" width="100" :formatter = "categoryFormat"></el-table-column>
<el-table-column property="source" label="Source" width="110" :formatter = "sourceFormat"></el-table-column>
</el-table> </el-table>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
@@ -137,6 +138,7 @@ import KnowledgeBaseTableForCard from '@/components/table/setting/knowledgeBaseT
import KnowledgeBaseTableForRow from '@/components/table/setting/KnowledgeBaseTableForRow' import KnowledgeBaseTableForRow from '@/components/table/setting/KnowledgeBaseTableForRow'
import { api } from '@/utils/api' import { api } from '@/utils/api'
import { urlParamsHandler, overwriteUrl } from '@/utils/tools' import { urlParamsHandler, overwriteUrl } from '@/utils/tools'
import { knowledgeBaseCategory, knowledgeBaseSource } from '@/utils/constants'
import axios from 'axios' import axios from 'axios'
import KnowledgeFilter from '@/views/setting/KnowledgeFilter' import KnowledgeFilter from '@/views/setting/KnowledgeFilter'
@@ -173,6 +175,20 @@ export default {
this.search(params) this.search(params)
this.$refs.knowledgeFilter.reloadFilter() this.$refs.knowledgeFilter.reloadFilter()
}, },
reloadRowList () {
this.getTableData()
this.$refs.knowledgeFilter.reloadFilter()
},
categoryFormat (row, column) {
const category = row.category
const t = knowledgeBaseCategory.find(t => t.value === category)
return t ? t.name : category
},
sourceFormat (row, column) {
const source = row.source
const t = knowledgeBaseSource.find(t => t.value === source)
return t ? t.name : source
},
handleClose () { handleClose () {
this.showConfirmDialog = false this.showConfirmDialog = false
}, },
@@ -349,8 +365,9 @@ export default {
this.batchDeleteObjs = [] this.batchDeleteObjs = []
this.secondBatchDeleteObjs = [] this.secondBatchDeleteObjs = []
this.listMode = mode this.listMode = mode
// this.$refs.dataTable.init() if (this.$refs.dataTableCard) {
// this.$refs.dataTableCard.init() this.$refs.dataTableCard.clearSelect()
}
const { query } = this.$route const { query } = this.$route
const newUrl = urlParamsHandler(window.location.href, query, { listMode: mode }) const newUrl = urlParamsHandler(window.location.href, query, { listMode: mode })
overwriteUrl(newUrl) overwriteUrl(newUrl)

View File

@@ -99,15 +99,15 @@
<table class="imported-table" v-if="!importedDataNoData"> <table class="imported-table" v-if="!importedDataNoData">
<tr> <tr>
<th style="width: 230px">{{ importedTableFirstColumn }}</th> <th style="width: 230px">{{ importedTableFirstColumn }}</th>
<th style="width: 180px">Label</th> <th >Label</th>
<th >{{ $t('overall.import') }}</th> <th style="width: 200px">{{ $t('overall.tip') }}</th>
<th style="width: 16px"></th> <th style="width: 50px"></th>
</tr> </tr>
<tr v-for="(d, i) in showImportedData" :key="importedType + d.tagName + d.tagValue + i"> <tr v-for="(d, i) in showImportedData" :key="importedType + d.tagName + d.tagValue + i">
<td class="imported-data-item" :title="d.tagName"> <td class="imported-data-item" :title="d.tagName">
<el-form-item v-if="(editIndex === i) || (addEditFlag && d.tagName === '' && d.tagValue === '')" prop="tagName"> <el-form-item v-if="(editIndex === i) || (addEditFlag && d.tagName === '' && d.tagValue === '')" prop="tagName">
<span class="imported-data-item-edit__input"> <span class="imported-data-item-edit__input">
<el-input v-model="editTagForm.tagName" @blur="onBlurTagItem"></el-input> <el-input v-model="editTagForm.tagName" @blur="onBlurTagItem(i)"></el-input>
</span> </span>
</el-form-item> </el-form-item>
<span v-else>{{ d.tagName }}</span> <span v-else>{{ d.tagName }}</span>
@@ -115,7 +115,7 @@
<td class="imported-data-value" :title="d.tagValue"> <td class="imported-data-value" :title="d.tagValue">
<el-form-item v-if="editIndex === i || (addEditFlag && d.tagName === '' && d.tagValue === '')" prop="tagValue"> <el-form-item v-if="editIndex === i || (addEditFlag && d.tagName === '' && d.tagValue === '')" prop="tagValue">
<span class="imported-data-item-edit__input"> <span class="imported-data-item-edit__input">
<el-input v-model="editTagForm.tagValue" @blur="onBlurTagItem"></el-input> <el-input v-model="editTagForm.tagValue" @blur="onBlurTagItem(i)"></el-input>
</span> </span>
</el-form-item> </el-form-item>
<span v-else>{{ d.tagValue }}</span> <span v-else>{{ d.tagValue }}</span>
@@ -252,6 +252,9 @@ export default {
return validate return validate
} }
const nameAndLabelDuplicateValidator = (rule, value, callback) => { const nameAndLabelDuplicateValidator = (rule, value, callback) => {
if (this.backEditFlag) {
return true
}
let validate = true let validate = true
let index = -1 // 当前编辑的键值index let index = -1 // 当前编辑的键值index
// 查看是否重名前需要对名称进行校验分别是IP、domain、APP的校验 // 查看是否重名前需要对名称进行校验分别是IP、domain、APP的校验
@@ -273,6 +276,9 @@ export default {
return validate return validate
} }
const requiredItemValidator = (rule, value, callback) => { const requiredItemValidator = (rule, value, callback) => {
if (this.backEditFlag) {
return true
}
let validate = true let validate = true
const realValue = value.replace(/\s+/g, '')// 去掉空格 const realValue = value.replace(/\s+/g, '')// 去掉空格
if (realValue === '') { if (realValue === '') {
@@ -283,6 +289,9 @@ export default {
return validate return validate
} }
const requiredValueValidator = (rule, value, callback) => { const requiredValueValidator = (rule, value, callback) => {
if (this.backEditFlag) {
return true
}
value = this.editTagForm.tagValue value = this.editTagForm.tagValue
const index = this.editIndex const index = this.editIndex
let validate = true let validate = true
@@ -297,11 +306,12 @@ export default {
return validate return validate
} }
const nameFormatValidator = (rule, value, callback) => { const nameFormatValidator = (rule, value, callback) => {
if (this.backEditFlag) {
return true
}
value = this.editTagForm.tagName value = this.editTagForm.tagName
const index = this.editIndex const index = this.editIndex
let validate = true let validate = true
this.showImportedData[index].msg = 'success'
this.showImportedData[index].isValid = 1
const type = this.editObject.source// 当前选中的类型 const type = this.editObject.source// 当前选中的类型
if (type === knowledgeSourceValue.ipTag) { if (type === knowledgeSourceValue.ipTag) {
const formal = value.replace(/\s+/g, '')// 去掉空格 const formal = value.replace(/\s+/g, '')// 去掉空格
@@ -1009,10 +1019,14 @@ export default {
} }
}) })
}, },
onBlurTagItem () { onBlurTagItem (index) {
this.$refs.editForm.validate(valid => { this.$refs.editForm.validate(valid => {
if (valid) { if (valid) {
this.editTagErrorTip = '' this.editTagErrorTip = ''
this.showImportedData[index].isValid = 1
this.showImportedData[index].msg = 'success'
} else {
this.showImportedData[index].isValid = 0
} }
}) })
}, },