fix:知识库类型重复bug

This commit is contained in:
guoyue 2022-12-01 17:26:08 +08:00
parent 1a300b0ce7
commit 8bbeadbdc8
1 changed files with 15 additions and 22 deletions

View File

@ -28,14 +28,14 @@
<el-button @click="reset">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" :key="Math.random()"
style="width: 100%" height="650px">
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle"
:key="Math.random()" style="width: 100%" height="650px">
<el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column>
<af-table-column :show-overflow-tooltip="true" width="280" prop="name" label="名称"
header-align="center" align="center"></af-table-column>
<af-table-column :show-overflow-tooltip="true" prop="description" label="描述"
header-align="center" align="center"></af-table-column>
<af-table-column :show-overflow-tooltip="true" width="280" prop="name" label="名称" header-align="center"
align="center"></af-table-column>
<af-table-column :show-overflow-tooltip="true" prop="description" label="描述" header-align="center"
align="center"></af-table-column>
<template v-if="dataList[0] && dataList[0].infoList2">
<af-table-column :show-overflow-tooltip="true" width="280" v-for="(item, index) in dataList[0].infoList2"
:key="index" :label="item.attrType" header-align="center" align="center">
@ -45,8 +45,7 @@
</af-table-column>
</template>
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center"
width="150">
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
<template slot-scope="scope">
<el-button v-if="$hasPermission('ability:knowledgeBase:update')" type="text" size="small"
@click="UpdateData(scope.row)">{{ $t('update') }}</el-button>
@ -392,26 +391,21 @@ export default {
this.submitFrom.infoList = this.submitFrom.infoList.sort(
(a, b) => arr.indexOf(a.attrType) - arr.indexOf(b.attrType)
)
this.submitFrom.infoList.forEach(v => {
if (v.attrType == '知识库类型') {
v.attrValue = v.attrValue || this.radio
//
const newArr = this.submitFrom.infoList.filter(
(element, index, self) => {
return (
self.findIndex((x) => x.attrType === element.attrType) === index
)
}
})
)
this.submitFrom.infoList = newArr
console.log('this.submitFrom-----表单提交------->', this.submitFrom.infoList);
this.notFilled = []
if (!this.submitFrom.name) {
this.notFilled.push('标准名称')
this.notFilled.push('模型名称')
}
// if (this.radio === '' && !this.submitFrom.apiMethodType) {
// if ((this.submitFrom.infoList.filter(val => val.attrType === '使')[0].attrValue === '')) {
// this.notFilled.push('')
// }
// }
// if (this.radio === '' && (!this.submitFrom.infoList.filter(val => val.attrType === '')[0] || !this.submitFrom.infoList.filter(val => val.attrType === '')[0].attrValue)) {
// this.notFilled.push('')
// }
// console.log(this.submitFrom, this.notFilled, '')
if (this.notFilled.length > 0) {
this.$message({
message: '请填写必填字段!',
@ -426,7 +420,6 @@ export default {
}
})
console.log('编辑===============>', this.submitFrom)
console.log(this.submitFrom.infoList, '===============abc')
//
const newArr = this.submitFrom.infoList.filter(
(element, index, self) => {