<template>
|
<div class="ModelList">
|
<div class="header">产品管理</div>
|
<div class="buttonArea">
|
<div class="addButton" @click="addModel">
|
<span class="icon">+</span>
|
添加
|
</div>
|
</div>
|
<div class="content">
|
<div class="table-area">
|
<el-table
|
id="multipleTable"
|
ref="multipleTable"
|
:data="dataList"
|
tooltip-effect="dark"
|
:fit="true"
|
>
|
<el-table-column label="序号" width="68">
|
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
|
</el-table-column>
|
<el-table-column prop="modelName" label="模块名称"></el-table-column>
|
|
<el-table-column label="图片">
|
<template slot-scope="scope">
|
<ImageShow :src="scope.row.pic"></ImageShow>
|
</template>
|
</el-table-column>
|
|
<el-table-column label="模块类型" prop="name" sortable>
|
</el-table-column>
|
<el-table-column
|
prop="desc"
|
label="模块描述"
|
width="243px"
|
></el-table-column>
|
<el-table-column prop="sort" label="排序" sortable></el-table-column>
|
<el-table-column label="隐藏/显示">
|
<template slot-scope="scope">
|
<el-switch
|
v-model="scope.row.isShow"
|
active-color="#0064FF"
|
inactive-color="#C0C5CC"
|
@change="toggle($event, scope.row.id)"
|
>
|
</el-switch>
|
</template>
|
</el-table-column>
|
|
<el-table-column label="操作">
|
<template slot-scope="scope">
|
<span class="link" @click="checkDetail(scope.row)">
|
查看详情
|
</span>
|
<span class="link" @click="chooseEdit(scope.row.id)"> 编辑 </span>
|
<span class="del" @click="chooseDelete(scope.row.id)">
|
删除
|
</span>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</div>
|
|
<DelBox
|
v-if="showDelBox"
|
@close="showDelBox = false"
|
@confirm="deleteModel"
|
></DelBox>
|
</div>
|
</template>
|
|
<script>
|
import DelBox from "@/views/operateManage/productManage/DelBox";
|
import {
|
getIndexModelList,
|
setIndexIsShow,
|
deleteIndexModel,
|
} from "@/api/product";
|
|
export default {
|
components: {
|
DelBox,
|
},
|
created() {
|
this.getList();
|
},
|
data() {
|
return {
|
input: "",
|
time: "",
|
dataList: [],
|
showDelBox: false,
|
delId: null,
|
};
|
},
|
methods: {
|
async getList() {
|
const res = await getIndexModelList();
|
if (res && res.success) {
|
this.dataList = res.data.modelList;
|
}
|
},
|
checkDetail(row) {
|
this.$router.push({
|
path: "/Layout/ProductList",
|
query: {
|
id: row.id,
|
},
|
});
|
},
|
chooseEdit(id) {
|
this.$router.push({
|
path: "/Layout/AddModel",
|
query: {
|
id: id,
|
},
|
});
|
},
|
chooseDelete(id) {
|
this.delId = id;
|
this.showDelBox = true;
|
},
|
async deleteModel() {
|
this.showDelBox = false;
|
const res = await deleteIndexModel({
|
id: this.delId,
|
});
|
if (res && res.success) {
|
this.getList();
|
this.$notify({
|
type: "success",
|
message: "删除成功",
|
});
|
}
|
},
|
addModel() {
|
this.$router.push("/Layout/AddModel");
|
},
|
async toggle(val, id) {
|
await setIndexIsShow({
|
id: id,
|
isShow: val,
|
});
|
},
|
},
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.ModelList {
|
background-color: rgb(243, 245, 248);
|
.header {
|
padding: 0 24px;
|
height: 50px;
|
font-size: 16px;
|
color: #666666;
|
line-height: 50px;
|
font-weight: 700;
|
background: #ffffff;
|
}
|
|
.buttonArea {
|
display: flex;
|
justify-content: flex-end;
|
margin: 20px 20px 0 0;
|
.addButton {
|
width: 84px;
|
height: 32px;
|
border-radius: 3px;
|
background: #0064ff;
|
color: #fff;
|
font-size: 14px;
|
vertical-align: middle;
|
text-align: center;
|
line-height: 32px;
|
cursor: pointer;
|
|
.iconfont {
|
font-size: 16px;
|
font-weight: 700;
|
}
|
}
|
}
|
|
.content {
|
margin: 24px;
|
padding: 20px;
|
background-color: #fff;
|
|
.search {
|
display: flex;
|
align-items: center;
|
line-height: 23px;
|
|
.label {
|
margin-right: 20px;
|
height: 20px;
|
font-size: 14px;
|
color: #3d3d3d;
|
}
|
|
.el-input ::v-deep {
|
margin-right: 30px;
|
width: 300px;
|
height: 32px;
|
.el-input__inner {
|
width: 100%;
|
height: 32px;
|
line-height: 32px;
|
color: #3d3d3d;
|
border-radius: 0;
|
border-color: #c0c5cc;
|
&::-webkit-input-placeholder {
|
color: #999999;
|
}
|
|
&:focus {
|
border-color: #0065ff;
|
}
|
}
|
}
|
|
.el-date-editor ::v-deep {
|
box-sizing: border-box;
|
height: 32px;
|
|
.el-input__icon,
|
.el-input__suffix {
|
margin-top: -7px;
|
}
|
.el-range-separator {
|
line-height: 27px;
|
}
|
}
|
|
.button {
|
margin-left: 36px;
|
width: 60px;
|
height: 32px;
|
text-align: center;
|
border-radius: 3px;
|
background: #0064ff;
|
font-size: 14px;
|
line-height: 32px;
|
color: #ffffff;
|
cursor: pointer;
|
}
|
}
|
|
.link {
|
margin-right: 10px;
|
color: #0064ff;
|
cursor: pointer;
|
}
|
|
.del {
|
color: #ff4a32;
|
cursor: pointer;
|
}
|
|
img {
|
width: 136px;
|
height: 76px;
|
}
|
}
|
}
|
</style>
|