能力挂接 组件服务 置顶功能

This commit is contained in:
a0049873 2022-11-08 17:16:19 +08:00
parent a5be25cec4
commit 7ba6767cda
2 changed files with 198 additions and 148 deletions

View File

@ -52,6 +52,7 @@ export default {
// 获取数据列表 // 获取数据列表
query () { query () {
this.dataListLoading = true this.dataListLoading = true
if (this.mixinViewModuleOptions.getDataListURL !== '/resource/pageWithAttrs') {
this.$http.get( this.$http.get(
this.mixinViewModuleOptions.getDataListURL + '?' + qs.stringify({ this.mixinViewModuleOptions.getDataListURL + '?' + qs.stringify({
// order: this.order, // order: this.order,
@ -124,6 +125,38 @@ export default {
}).catch(() => { }).catch(() => {
this.dataListLoading = false this.dataListLoading = false
}) })
} else {
this.$http.post(
this.mixinViewModuleOptions.getDataListURL, {
pageNum: this.mixinViewModuleOptions.getDataListIsPage ? this.page : null,
pageSize: this.mixinViewModuleOptions.getDataListIsPage ? this.limit : null,
...this.dataForm
}
).then(({ data: res }) => {
if (res.code !== 0) {
this.dataList = []
this.total = 0
return this.$message.error(res.msg)
}
this.dataList = this.mixinViewModuleOptions.getDataListIsPage ? res.data.records : res.data
this.total = this.mixinViewModuleOptions.getDataListIsPage ? res.data.total : 0
if (this.dataList[0].type === '组件服务') {
this.dataList.map(val => {
val.infoList2 = val.infoList.filter(item => item.attrType === '应用领域' || item.attrType === '组件类型')
})
} else if (this.dataList[0].type === '应用资源') {
this.dataList.map(val => {
val.infoList2 = val.infoList.filter(item => item.attrType === '应用领域')
})
}
if (this.mixinViewModuleOptions.requestCallback) {
this.mixinViewModuleOptions.requestCallback(res.data)
}
this.dataListLoading = false
}).catch(() => {
this.dataListLoading = false
})
}
}, },
// 多选 // 多选
dataListSelectionChangeHandle (val) { dataListSelectionChangeHandle (val) {
@ -381,7 +414,7 @@ export default {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '删除成功!' message: '删除成功!'
}); })
this.getDataList() this.getDataList()
}) })
}).catch(() => { }).catch(() => {
@ -389,7 +422,7 @@ export default {
// type: 'info', // type: 'info',
// message: '已取消删除' // message: '已取消删除'
// }); // });
}); })
} }
}, },
// 导出 // 导出

View File

@ -130,7 +130,14 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
v-if="scope.row.infoList.filter(val=>val.attrType=='组件类型')[0].attrValue == '智能算法'" v-if="scope.row.infoList.filter(val=>val.attrType=='组件类型')[0].attrValue == '智能算法' && scope.row.pinTop == 1"
type="text"
size="small"
@click="noToppingCapacity(scope.row)"
>取消置顶</el-button
>
<el-button
v-if="scope.row.infoList.filter(val=>val.attrType=='组件类型')[0].attrValue == '智能算法' &&scope.row.pinTop != 1"
type="text" type="text"
size="small" size="small"
@click="toppingCapacity(scope.row)" @click="toppingCapacity(scope.row)"
@ -268,7 +275,7 @@ export default {
] ]
}, },
mixinViewModuleOptions: { mixinViewModuleOptions: {
getDataListURL: '/resource/page', getDataListURL: '/resource/pageWithAttrs',
getDataListIsPage: true, getDataListIsPage: true,
exportURL: '/ability/bsabilityai/export', exportURL: '/ability/bsabilityai/export',
deleteURL: '/resource/delete', deleteURL: '/resource/delete',
@ -279,11 +286,12 @@ export default {
fieldArr: dictionaries.fieldArr, fieldArr: dictionaries.fieldArr,
shareFormArr: dictionaries.shareFormArr, shareFormArr: dictionaries.shareFormArr,
dataForm: { dataForm: {
name: '', orderField: 'pin_top',
creator: '', orderType: 'DESC',
infoList: [],
delFlag: 0, delFlag: 0,
selectType: 0, type: '组件服务',
type: '组件服务' name: ''
}, },
// qp: false, // qp: false,
// //
@ -323,31 +331,45 @@ export default {
message: '置顶成功', message: '置顶成功',
type: 'success' type: 'success'
}) })
this.reset()
} else { } else {
this.$message({ this.$message({
message: '置顶失败', message: '置顶失败',
type: 'warning' type: 'warning'
}) })
this.reset()
}
})
},
noToppingCapacity (item) {
this.$http.put('/resource/cancel_pin_top/' + item.id).then(res => {
if (res.data.code == 0) {
this.$message({
message: '取消置顶成功',
type: 'success'
})
this.reset()
} else {
this.$message({
message: '取消置顶失败',
type: 'warning'
})
this.reset()
} }
}) })
}, },
reset () { reset () {
this.$http this.$http
.get( .post(
this.mixinViewModuleOptions.getDataListURL + this.mixinViewModuleOptions.getDataListURL, {
'?' + pageNum: 1,
qs.stringify({ pageSize: 10,
// order: this.order, orderType: 'DESC',
// orderField: this.orderField, infoList: [],
// type: '',
page: 1,
limit: 10,
creator: '',
selectType: 0,
delFlag: 0, delFlag: 0,
type: '组件服务', type: '组件服务',
name: '' name: ''
}) }
) )
.then(({ data: res }) => { .then(({ data: res }) => {
this.dataForm.name = '' this.dataForm.name = ''
@ -357,7 +379,7 @@ export default {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
this.dataList = this.mixinViewModuleOptions.getDataListIsPage this.dataList = this.mixinViewModuleOptions.getDataListIsPage
? res.data.list ? res.data.records
: res.data : res.data
this.dataList.map((item, index) => { this.dataList.map((item, index) => {
const dataListSinforList = [] const dataListSinforList = []
@ -492,21 +514,16 @@ export default {
getDataList2 (names) { getDataList2 (names) {
if (names != null) { if (names != null) {
this.$http this.$http
.get( .post(
this.mixinViewModuleOptions.getDataListURL + this.mixinViewModuleOptions.getDataListURL, {
'?' +
qs.stringify({
// order: this.order,
// orderField: this.orderField,
// type: '',
pageNum: 1, pageNum: 1,
pageSize: this.limit, pageSize: 10,
type: '组件服务', orderType: 'DESC',
creator: '', infoList: [],
selectType: 0,
delFlag: 0, delFlag: 0,
type: '组件服务',
name: names name: names
}) }
) )
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
@ -514,8 +531,8 @@ export default {
this.total = 0 this.total = 0
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
if (res.data.list.length >= 0) { if (res.data.records.length >= 0) {
this.dataList = res.data.list this.dataList = res.data.records
this.total = this.mixinViewModuleOptions.getDataListIsPage this.total = this.mixinViewModuleOptions.getDataListIsPage
? res.data.total ? res.data.total
: 0 : 0