知识库上架编辑
This commit is contained in:
parent
421524edaa
commit
3277a350f4
|
@ -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)
|
||||
// 去重
|
||||
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)
|
||||
// 表单提交
|
||||
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('修改失败!')
|
||||
this.$message.error(_msg + '失败!')
|
||||
} else {
|
||||
this.$message.success('修改成功!')
|
||||
this.$message.success(_msg + '成功!')
|
||||
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(() => { })
|
||||
}
|
||||
}
|
||||
},
|
||||
// 新修改
|
||||
|
@ -536,7 +514,7 @@ export default {
|
|||
},
|
||||
|
||||
// 新删除
|
||||
deleteHandle2 (id) {
|
||||
deleteHandle2(id) {
|
||||
if (id == undefined && this.dataListSelections.length < 1) {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
|
|
Loading…
Reference in New Issue