完成导航配置接口对接

This commit is contained in:
yanran200730
2021-12-16 15:35:52 +08:00
parent f6ec0d0d96
commit 3ce4c2f542

View File

@@ -19,19 +19,21 @@
<ai-card title="全部功能"> <ai-card title="全部功能">
<template #right> <template #right>
<el-button size="small" type="primary" @click="isShowAdd = true">新增应用</el-button> <el-button size="small" type="primary" @click="isShowAdd = true">新增应用</el-button>
<el-button size="small" type="danger" @click="isRemove = !isRemove">{{ isRemove ? '取消删除' : '删除应用' }}</el-button> <el-button size="small" type="danger" @click="isEdit = false, isRemove = !isRemove">{{ isRemove ? '取消删除' : '删除应用' }}</el-button>
</template> </template>
<div class="all" slot="content"> <div class="all" slot="content">
<div class="item-row" v-for="(group, index) in list" :key="index"> <div class="item-row" v-for="(group, index) in list" :key="index">
<h2>{{ group.name }}</h2> <h2>{{ group.name }}</h2>
<div class="item-wrapper"> <div class="item-wrapper" v-if="isRest">
<div class="item" v-for="(item, i) in group.list" :key="i"> <div class="item" v-for="(item, i) in group.list" :key="i">
<img :src="item.pictureUrl"> <img :src="item.pictureUrl">
<i class="el-icon-error icon" @click="removeApp(item.id)" v-if="isRemove && item.type !== '0' && item.picked !== '1'"></i> <i class="el-icon-error icon" @click="removeApp(item.id)" v-if="isRemove && item.type !== '0' && item.picked !== '1'"></i>
<i class="el-icon-circle-plus icon" @click="addApp(item)" v-if="isCanAdd(item)"></i>
<h2>{{ item.name }}</h2> <h2>{{ item.name }}</h2>
</div> </div>
</div> </div>
</div> </div>
<ai-empty style="width: 100%" v-if="!list.length"></ai-empty>
</div> </div>
</ai-card> </ai-card>
<ai-dialog <ai-dialog
@@ -93,6 +95,7 @@
id: '', id: '',
isEdit: false, isEdit: false,
isRemove: false, isRemove: false,
isRest: true,
form: { form: {
type: '', type: '',
pictureUrl: [], pictureUrl: [],
@@ -133,10 +136,23 @@
}) })
}, },
isCanAdd (item) {
const isHas = this.picked.map(v => v.id).indexOf(item.id) > -1
return this.isEdit && item.type !== '0' && item.picked !== '1' && !isHas
},
addApp (e) {
this.isRemove = false
this.picked.push(e)
},
eidt () { eidt () {
if (this.isEdit) { if (this.isEdit) {
this.$confirm('确定退出编辑?').then(() => { this.$confirm('确定退出编辑?').then(() => {
this.isEdit = false this.isEdit = false
this.getList()
}) })
return false return false
@@ -146,12 +162,20 @@
removeChoose (index) { removeChoose (index) {
this.picked.splice(index, 1) this.picked.splice(index, 1)
this.isRest = false
this.$nextTick(() => {
this.isRest = true
})
}, },
save () { save () {
this.instance.post(`/app/appminihomeconfig/updatePick?ids=${this.picked.map(v => v.id).join(',')}`).then(res => { this.instance.post(`/app/appminihomeconfig/updatePick?ids=${this.picked.map(v => v.id).join(',')}`).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$message.success('保存成功') this.$message.success('保存成功')
this.isEdit = false
this.isRemove = false
this.getList() this.getList()
} }