This commit is contained in:
cookiemy 2024-06-29 17:35:42 +08:00
parent de1784480b
commit de78d556f9

View File

@ -10,30 +10,36 @@
<div v-for="(item, index) in tableData" :key="index" class="mb16"> <div v-for="(item, index) in tableData" :key="index" class="mb16">
<div class="common-form d-s-c"> <div class="common-form d-s-c">
<span>{{item.name}}</span> <span>{{ item.name }}</span>
</div> </div>
<div class="plus-list"> <div class="plus-list">
<div class="item" v-for="(child, num) in item.children" :key="num"> <div class="item" v-for="(child, num) in item.children" :key="num">
<div class="item-box pr"> <div class="item-box pr">
<a href="javascript:void(0);" class="close-btn" @click="deleteClick(child)"> <a
<el-icon :size="20"> href="javascript:void(0);"
class="close-btn"
@click="deleteClick(child)"
>
<el-icon :size="20">
<CloseBold /> <CloseBold />
</el-icon> </el-icon>
</a> </a>
<a> <a>
<span class="iconfont icon" :class="hasIcon(child.icon)"></span> <span class="iconfont icon" :class="hasIcon(child.icon)"></span>
<div class="ml10"> <div class="ml10">
<h3>{{child.name}}</h3> <h3>{{ child.name }}</h3>
<p>{{child.remark}}</p> <p>{{ child.remark }}</p>
</div> </div>
</a> </a>
</div> </div>
</div> </div>
<div class="item"> <div class="item">
<div class="d-s-c mt10"> <div class="d-s-c mt10">
<div class="add-item-box d-c-c" @click="addClick(item)"> <el-icon> <div class="add-item-box d-c-c" @click="addClick(item)">
<Plus /> <el-icon>
</el-icon></div> <Plus />
</el-icon>
</div>
<div class="ml10"> <div class="ml10">
<p class="f14 gray9">添加插件到此类别下</p> <p class="f14 gray9">添加插件到此类别下</p>
</div> </div>
@ -42,196 +48,199 @@
</div> </div>
</div> </div>
<!--添加--> <!--添加-->
<Add v-if="open_add" :open_add="open_add" :curModel="curModel" @closeDialog="closeDialogFunc($event, 'add')"></Add> <Add
</div> v-if="open_add"
:open_add="open_add"
:curModel="curModel"
@closeDialog="closeDialogFunc($event, 'add')"
></Add>
</div>
</template> </template>
<script> <script>
import PlusApi from '@/api/plus.js'; import PlusApi from "@/api/plus.js";
import Add from './dialog/Add.vue'; import Add from "./dialog/Add.vue";
import { import { deepClone } from "@/utils/base.js";
deepClone export default {
} from '@/utils/base.js'; components: {
export default { Add,
components: { },
Add data() {
return {
/*是否正在加载*/
loading: true,
/*表格数据*/
tableData: [],
/*是否打开添加弹窗*/
open_add: false,
/*当前编辑的对象*/
curModel: {},
};
},
created() {
/*获取列表*/
// this.getData();
},
methods: {
/*获取列表*/
getData() {
let self = this;
let Params = {};
PlusApi.pluslist(Params, true)
.then((res) => {
self.loading = false;
self.tableData = res.data;
})
.catch((error) => {
self.loading = false;
});
}, },
data() {
return { /*打开添加*/
/*是否正在加载*/ addClick(e) {
loading: true, this.curModel = e;
/*表格数据*/ this.open_add = true;
tableData: [],
/*是否打开添加弹窗*/
open_add: false,
/*当前编辑的对象*/
curModel: {}
};
}, },
created() {
/*获取列表*/
this.getData();
},
methods: {
/*获取列表*/
getData() {
let self = this;
let Params = {};
PlusApi.pluslist(Params, true)
.then(res => {
self.loading = false;
self.tableData = res.data;
})
.catch(error => {
self.loading = false;
});
},
closeDialogFunc(e, f) {
/*打开添加*/ if (f == "add") {
addClick(e) { this.open_add = e.openDialog;
this.curModel = e; if (e.type == "success") {
this.open_add = true; this.getData();
},
closeDialogFunc(e, f) {
if (f == 'add') {
this.open_add = e.openDialog;
if (e.type == 'success') {
this.getData();
}
}
},
/*删除插件*/
deleteClick(row) {
let self = this;
ElMessageBox.confirm('删除后不可恢复,确认删除该记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
self.loading = true;
PlusApi.deleteplus({
id: row.accessId
},
true
)
.then(data => {
if (data.code == 1) {
self.loading = false;
ElMessage({
message: data.msg,
type: 'success'
});
self.getData();
}
})
.catch(error => {
self.loading = false;
});
})
.catch(() => {});
},
//
hasIcon(e) {
if (e != null && e.length > 0) {
return e;
} else {
return 'icon-chajian1';
} }
} }
} },
}; /*删除插件*/
deleteClick(row) {
let self = this;
ElMessageBox.confirm("删除后不可恢复,确认删除该记录吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
self.loading = true;
PlusApi.deleteplus(
{
id: row.accessId,
},
true
)
.then((data) => {
if (data.code == 1) {
self.loading = false;
ElMessage({
message: data.msg,
type: "success",
});
self.getData();
}
})
.catch((error) => {
self.loading = false;
});
})
.catch(() => {});
},
//
hasIcon(e) {
if (e != null && e.length > 0) {
return e;
} else {
return "icon-chajian1";
}
},
},
};
</script> </script>
<style> <style>
.plus-container { .plus-container {
min-height: 400px; min-height: 400px;
} }
.plus-container .common-form .close-btn { .plus-container .common-form .close-btn {
color: #CCCCCC; color: #cccccc;
} }
.plus-list { .plus-list {
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
flex-wrap: wrap; flex-wrap: wrap;
} }
.plus-list .item { .plus-list .item {
width: 25%; width: 25%;
} }
.plus-list .item .item-box { .plus-list .item .item-box {
margin: 0 10px 20px; margin: 0 10px 20px;
border: 1px solid #FFFFFF; border: 1px solid #ffffff;
} }
.plus-list .item .item-box .close-btn { .plus-list .item .item-box .close-btn {
position: absolute; position: absolute;
padding-left: 0; padding-left: 0;
width: 20px; width: 20px;
height: 20px; height: 20px;
top: 20px; top: 20px;
right: 4px; right: 4px;
color: #ff0000; color: #ff0000;
display: none; display: none;
} }
.plus-list .item .item-box:hover { .plus-list .item .item-box:hover {
border-radius: 8px; border-radius: 8px;
border: 1px dashed #CCCCCC; border: 1px dashed #cccccc;
} }
.plus-list .item .item-box:hover .close-btn { .plus-list .item .item-box:hover .close-btn {
display: block; display: block;
} }
.plus-list .item .add-item-box { .plus-list .item .add-item-box {
width: 40px; width: 40px;
height: 40px; height: 40px;
margin-left: 20px; margin-left: 20px;
border-radius: 8px; border-radius: 8px;
border: 1px solid #186eeb; border: 1px solid #186eeb;
} }
.plus-list .item a { .plus-list .item a {
display: flex; display: flex;
height: 60px; height: 60px;
padding-left: 10px; padding-left: 10px;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
} }
.plus-list .item a h3 { .plus-list .item a h3 {
font-weight: normal; font-weight: normal;
color: #333333; color: #333333;
} }
.plus-list .item a:hover h3 { .plus-list .item a:hover h3 {
color: #3a8ee6; color: #3a8ee6;
} }
.plus-list .item a p { .plus-list .item a p {
font-size: 12px; font-size: 12px;
color: #999999; color: #999999;
} }
.plus-list .item .item-box .iconfont { .plus-list .item .item-box .iconfont {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 40px; width: 40px;
height: 40px; height: 40px;
border-radius: 8px; border-radius: 8px;
line-height: 40px; line-height: 40px;
background: #3a8ee6; background: #3a8ee6;
} }
.plus-list .item a .icon.iconfont { .plus-list .item a .icon.iconfont {
color: #ffffff; color: #ffffff;
font-size: 22px font-size: 22px;
} }
</style> </style>