知识库上架编辑

This commit is contained in:
guoyue 2022-12-01 17:35:15 +08:00
parent 421524edaa
commit 3277a350f4
1 changed files with 24 additions and 46 deletions

View File

@ -34,10 +34,10 @@
</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"
<af-table-column :show-overflow-tooltip="true" width="500" 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"
<af-table-column :show-overflow-tooltip="true" v-for="(item, index) in dataList[0].infoList2"
:key="index" :label="item.attrType" header-align="center" align="center">
<template slot-scope="scope">
{{ findValue(scope.row.infoList2, item.attrType) }}
@ -391,6 +391,14 @@ export default {
this.submitFrom.infoList = this.submitFrom.infoList.sort(
(a, b) => arr.indexOf(a.attrType) - arr.indexOf(b.attrType)
)
if (this.submitFrom.id) {
//
this.submitFrom.infoList.map((val) => {
if (val.attrType === '知识库类型') {
val.attrValue = this.radio
}
})
}
//
const newArr = this.submitFrom.infoList.filter(
(element, index, self) => {
@ -400,7 +408,6 @@ export default {
}
)
this.submitFrom.infoList = newArr
console.log('this.submitFrom-----表单提交------->', this.submitFrom.infoList);
this.notFilled = []
if (!this.submitFrom.name) {
this.notFilled.push('标准名称')
@ -412,50 +419,21 @@ export default {
type: 'warning'
})
} else {
if (this.submitFrom.id) {
//
this.submitFrom.infoList.map((val) => {
if (val.attrType === '知识库类型') {
val.attrValue = this.radio
//
console.log('this.submitFrom.infoList----表单提交-------->', this.submitFrom);
let _url = this.submitFrom.id ? '/resource/update' : '/resource/insert?source= b';
let _method = this.submitFrom.id ? 'put' : 'post';
let _msg = this.submitFrom.id ? '修改' : '上架';
this.$http[_method](_url, this.submitFrom)
.then(({ data: res }) => {
if (res.code !== 0) {
this.$message.error(_msg + '失败!')
} else {
this.$message.success(_msg + '成功!')
this.clear()
}
})
console.log('编辑===============>', this.submitFrom)
//
const newArr = this.submitFrom.infoList.filter(
(element, index, self) => {
return (
self.findIndex((x) => x.attrType === element.attrType) === index
)
}
)
this.submitFrom.infoList = newArr
//
this.submitFrom.infoList = this.submitFrom.infoList.filter(item => item.attrValue)
this.$http
.put('/resource/update', this.submitFrom)
.then(({ data: res }) => {
if (res.code !== 0) {
this.$message.error('修改失败!')
} else {
this.$message.success('修改成功!')
this.clear()
}
})
.catch(() => { })
} else {
console.log('提交11111111111===============>', this.putOnTheShelfList, this.submitFrom)
this.$http
.post('/resource/insert?source= b', this.submitFrom)
.then(({ data: res }) => {
if (res.code !== 0) {
this.$message.error('上架失败!')
} else {
this.$message.success('上架成功!')
this.clear()
}
})
.catch(() => { })
}
.catch(() => { })
}
},
//
@ -536,7 +514,7 @@ export default {
},
//
deleteHandle2 (id) {
deleteHandle2(id) {
if (id == undefined && this.dataListSelections.length < 1) {
this.$message({
type: 'info',