feat: #10000 暂存

This commit is contained in:
赵世界 2022-09-01 18:49:41 +08:00
parent 83afb5dcd0
commit cd6ec5d6a6
14 changed files with 2160 additions and 2279 deletions

View File

@ -1,15 +1,16 @@
<template> <template>
<div id="app"> <div id="app">
<keep-alive> <keep-alive>
<router-view v-if="$route.meta.keepAlive" /> <router-view v-if="$route.meta.keepAlive" />
</keep-alive> </keep-alive>
<router-view v-if="!$route.meta.keepAlive" /> <router-view v-if="!$route.meta.keepAlive" />
</div> </div>
</template> </template>
<script> <script>
export default { export default {
}; };
</script> </script>
<style lang="scss"></style> <style lang="scss">
</style>

View File

@ -19,7 +19,7 @@ const list = [
{ {
path: "GOODS_TYPE", path: "GOODS_TYPE",
name: "商品种类", name: "商品种类",
component: () => import("../views/home/home.vue"), component: () => import("../views/goodsType/goodsType.vue"),
}, },
{ {
path: "GOODS_BRAND", path: "GOODS_BRAND",

View File

@ -1,123 +1,123 @@
<template> <template>
<div class="backimg"> <div class="backimg">
<div class="sign"> <div class="sign">
<span class="title">Hi 欢迎使用</span> <span class="title">Hi 欢迎使用</span>
<p class="manage"> <p class="manage">
<img src="../css/img/养花人2_画板 1 副本 15.png" alt="" /><span>ERP管理系统</span> <img src="../css/img/养花人2_画板 1 副本 15.png" alt="" /><span>ERP管理系统</span>
</p> </p>
<p class="title-1">登录</p> <p class="title-1">登录</p>
<input type="text" placeholder="请输入用户名" v-model="form.name" /> <input type="text" placeholder="请输入用户名" v-model="form.name" />
<br /> <br />
<input type="password" placeholder="请输入密码" v-model="form.password" /> <input type="password" placeholder="请输入密码" v-model="form.password" />
<br /> <br />
<el-checkbox v-model="checked">记住密码</el-checkbox> <el-checkbox v-model="checked">记住密码</el-checkbox>
<br /> <br />
<el-button type="primary" @click="Login()">登录</el-button> <el-button type="primary" @click="Login()">登录</el-button>
</div>
</div> </div>
</div>
</template> </template>
<script> <script>
import axios from "axios"; import axios from "axios";
export default { export default {
data() { data() {
return { return {
checked: false, // checked: false, //
form: { form: {
// //
name: "", name: "",
password: "", password: "",
}, },
}; };
}, },
mounted() { mounted() {
this.getCookie(); this.getCookie();
}, },
methods: { methods: {
Login() { Login() {
// cookie // cookie
if (this.checked === true) { if (this.checked === true) {
this.setCookie(this.form.name, this.form.password, true, 7); this.setCookie(this.form.name, this.form.password, true, 7);
} else { } else {
this.clearCookie(); this.clearCookie();
}
//
if (this.form.name === "" || this.form.password === "") {
this.$message({
message: "账号或密码不能为空",
type: "error",
});
} else {
axios.post("/api/auth/login", this.form).then((res) => {
let data = res.data;
if (data.error) {
this.$message({
message: "账号或密码错误,请重新输入",
type: "error",
});
this.form.name = "";
this.form.password = "";
this.checked = false;
} }
//
if (this.form.name === "" || this.form.password === "") {
this.$message({
message: "账号或密码不能为空",
type: "error",
});
} else {
axios.post("/api/auth/login", this.form).then((res) => {
let data = res.data;
if (data.error) {
this.$message({
message: "账号或密码错误,请重新输入",
type: "error",
});
this.form.name = "";
this.form.password = "";
this.checked = false;
}
if (data.token) { if (data.token) {
this.form = {}; this.form = {};
localStorage.setItem("token", data.token); localStorage.setItem("token", data.token);
this.$message({ this.$message({
message: "成功登录,欢迎来到后台管理系统", message: "成功登录,欢迎来到后台管理系统",
type: "success", type: "success",
}); });
this.$router.push("/GOODS_LIST"); this.$router.push("/GOODS_LIST");
}
});
} }
}); },
} // cookie
}, setCookie(c_name, c_pwd, c_state, exdays) {
// cookie const exdate = new Date();
setCookie(c_name, c_pwd, c_state, exdays) { exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays); //
const exdate = new Date(); window.document.cookie =
exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays); // "name" + "=" + c_name + ";path=/;expires=" + exdate.toGMTString();
window.document.cookie = window.document.cookie =
"name" + "=" + c_name + ";path=/;expires=" + exdate.toGMTString(); "password" + "=" + c_pwd + ";path=/;expires=" + exdate.toGMTString();
window.document.cookie = window.document.cookie =
"password" + "=" + c_pwd + ";path=/;expires=" + exdate.toGMTString(); "state" + "=" + c_state + ";path=/;expires=" + exdate.toGMTString();
window.document.cookie = },
"state" + "=" + c_state + ";path=/;expires=" + exdate.toGMTString(); // cookie
}, getCookie() {
// cookie if (document.cookie.length > 0) {
getCookie() { const arr = document.cookie.split("; ");
if (document.cookie.length > 0) { for (let i = 0; i < arr.length; i++) {
const arr = document.cookie.split("; "); const arr2 = arr[i].split("=");
for (let i = 0; i < arr.length; i++) { if (arr2[0] === "name") {
const arr2 = arr[i].split("="); this.form.name = arr2[1];
if (arr2[0] === "name") { } else if (arr2[0] === "password") {
this.form.name = arr2[1]; this.form.password = arr2[1];
} else if (arr2[0] === "password") { } else if (arr2[0] === "state") {
this.form.password = arr2[1]; this.checked = Boolean(arr2[1]);
} else if (arr2[0] === "state") { }
this.checked = Boolean(arr2[1]); }
} }
} },
} // cookie
}, clearCookie: function () {
// cookie this.setCookie("", "", false, -1);
clearCookie: function () { },
this.setCookie("", "", false, -1);
},
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.backimg { .backimg {
width: 100%; width: 100%;
height: 1080px; height: 1080px;
background-image: url("./../css/img/组 32.png"); background-image: url("./../css/img/组 32.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100%; background-size: 100%;
position: relative; position: relative;
} }
.sign { .sign {
width: 400px; width: 400px;
height: 500px; height: 500px;
position: absolute; position: absolute;
@ -125,67 +125,67 @@
right: 300px; right: 300px;
input { input {
width: 400px; width: 400px;
height: 51px; height: 51px;
border: 2px solid #bcbcbc; border: 2px solid #bcbcbc;
opacity: 1; opacity: 1;
border-radius: 5px; border-radius: 5px;
margin-bottom: 25px; margin-bottom: 25px;
} }
.title { .title {
width: 125px; width: 125px;
height: 23px; height: 23px;
font-size: 22px; font-size: 22px;
font-family: "BigruixianBlackGBV1.0"; font-family: "BigruixianBlackGBV1.0";
font-weight: 400; font-weight: 400;
line-height: 23px; line-height: 23px;
color: #2b53ec; color: #2b53ec;
opacity: 1; opacity: 1;
} }
.manage { .manage {
margin-top: 19px; margin-top: 19px;
margin-bottom: 50px; margin-bottom: 50px;
img { img {
margin-right: 20px; margin-right: 20px;
} }
span { span {
width: 340px; width: 340px;
height: 57px; height: 57px;
font-size: 54px; font-size: 54px;
font-family: "BigruixianBlackGBV1.0"; font-family: "BigruixianBlackGBV1.0";
font-weight: 400; font-weight: 400;
line-height: 57px; line-height: 57px;
color: #2b53ec; color: #2b53ec;
opacity: 1; opacity: 1;
} }
} }
.title-1 { .title-1 {
width: 70px; width: 70px;
height: 35px; height: 35px;
font-size: 35px; font-size: 35px;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: 500; font-weight: 500;
line-height: 60px; line-height: 60px;
color: #393939; color: #393939;
opacity: 1; opacity: 1;
margin-bottom: 35px; margin-bottom: 35px;
} }
.el-button { .el-button {
width: 400px; width: 400px;
height: 58px; height: 58px;
background: rgba(43, 83, 236); background: rgba(43, 83, 236);
border-radius: 5px; border-radius: 5px;
margin-top: 40px; margin-top: 40px;
} }
.el-checkbox { .el-checkbox {
color: rgba(43, 83, 236); color: rgba(43, 83, 236);
} }
} }
</style> </style>

View File

@ -1,211 +1,185 @@
<template> <template>
<div class="conent"> <div class="conent">
<!-- 新增按钮 --> <!-- 新增按钮 -->
<div class="btn"> <el-button type="primary" @click="handAdd">新增</el-button>
<el-button type="primary" @click="handAdd">新增</el-button>
</div>
<!-- 列表 -->
<div class="table">
<el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column prop="name" label="商品品牌"> </el-table-column>
<el-table-column prop="" label="操作">
<template slot-scope="scope">
<el-button type="primary" @click="handEdit(scope.row.id, scope.row)">编辑</el-button>
<el-button type="danger" @click="handdel(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 新增品牌对话框 --> <!-- 列表 -->
<el-dialog title="新增品牌" :visible.sync="dialogFormVisible" :close-on-click-modal="false"> <div class="table">
<el-form :model="form"> <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%"
<el-form-item label="商品品牌" :label-width="formLabelWidth"> @selection-change="handleSelectionChange">
<el-input v-model="form.kindName"></el-input> <el-table-column prop="name" label="商品品牌"> </el-table-column>
</el-form-item> <el-table-column prop="" label="操作">
</el-form> <template slot-scope="scope">
<div slot="footer" class="dialog-footer"> <el-button type="primary" @click="handEdit(scope.row.id, scope.row)">编辑</el-button>
<el-button @click="dialogFormVisible = false"> </el-button> <el-button type="danger" @click="handdel(scope.row.id)">删除</el-button>
<el-button type="primary" @click="addSubmit"> </el-button> </template>
</div> </el-table-column>
</el-dialog> </el-table>
</div>
<!-- 编辑 --> <!-- 分页功能 -->
<el-dialog title="编辑" :visible.sync="dialogFormVisible1" :close-on-click-modal="false"> <div class="block">
<el-form :model="form1"> <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
<el-form-item label="编辑品牌" :label-width="formLabelWidth1"> :current-page="current_page" :page-sizes="[15, 50, 100]" :page-size="per_page"
<el-input v-model="form1.kindName1"></el-input> layout="total, sizes, prev, pager, next, jumper" :total="Paginationdata.total">
</el-form-item> </el-pagination>
</el-form> </div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible1 = false"> </el-button>
<el-button type="primary" @click="EditSubmit"> </el-button>
</div>
</el-dialog>
<!-- 分页功能 --> <!-- 新增品牌对话框 -->
<div class="block"> <el-dialog title="新增品牌" :visible.sync="dialogFormVisible" :close-on-click-modal="false">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="current_page" <el-form :model="form">
:page-sizes="[15, 50, 100]" :page-size="per_page" layout="total, sizes, prev, pager, next, jumper" <el-form-item label="商品品牌" :label-width="formLabelWidth">
:total="Paginationdata.total"> <el-input v-model="form.kindName"></el-input>
</el-pagination> </el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="addSubmit"> </el-button>
</div>
</el-dialog>
<!-- 编辑 -->
<el-dialog title="编辑" :visible.sync="dialogFormVisible1" :close-on-click-modal="false">
<el-form :model="form1">
<el-form-item label="编辑品牌" :label-width="formLabelWidth1">
<el-input v-model="form1.kindName1"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible1 = false"> </el-button>
<el-button type="primary" @click="EditSubmit"> </el-button>
</div>
</el-dialog>
</div> </div>
</div>
</template> </template>
<script> <script>
import { import {
Brand_goods_types, Brand_goods_types,
DelBrand_goods_types, DelBrand_goods_types,
AddBrandgoods_types, AddBrandgoods_types,
editBrand_types, editBrand_types,
} from "../../api/rankingData"; } from "../../api/rankingData";
export default { export default {
data() { data() {
return { return {
id: "", //id id: "", //id
tableData: [], tableData: [],
multipleSelection: [], multipleSelection: [],
dialogFormVisible: false, dialogFormVisible: false,
dialogFormVisible1: false, dialogFormVisible1: false,
form: { form: {
kindName: "", // kindName: "", //
}, },
form1: { form1: {
kindName1: "", // kindName1: "", //
}, },
formLabelWidth: "120px", formLabelWidth: "120px",
formLabelWidth1: "120px", formLabelWidth1: "120px",
newKind: [], newKind: [],
Paginationdata: {}, // Paginationdata: {}, //
current_page: 1, // current_page: 1, //
per_page: 15, // per_page: 15, //
}; };
}, },
created() { created() {
this.getGoods_types(); this.getGoods_types();
}, },
methods: { methods: {
// //
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val;
}, },
// //
handleSizeChange(val) { handleSizeChange(val) {
// //
this.per_page = val; this.per_page = val;
this.getGoods_types(); this.getGoods_types();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
// //
this.current_page = val; this.current_page = val;
this.getGoods_types(); this.getGoods_types();
}, },
// //
handAdd() { handAdd() {
this.form.kindName = ""; this.form.kindName = "";
this.dialogFormVisible = true; this.dialogFormVisible = true;
}, },
// //
addSubmit() { addSubmit() {
var string; var string;
string = this.form.kindName.replace(/\s/g, ",").split(","); string = this.form.kindName.replace(/\s/g, ",").split(",");
AddBrandgoods_types({ AddBrandgoods_types({
names: string, names: string,
}).then((res) => { }).then((res) => {
this.$message({ this.$message({
type: "success", type: "success",
message: "添加成功", message: "添加成功",
}); });
this.getGoods_types(); this.getGoods_types();
});
this.dialogFormVisible = false;
},
//
handEdit(id, item) {
this.id = id;
this.form1.kindName1 = item.name;
this.dialogFormVisible1 = true;
},
//
EditSubmit() {
editBrand_types(this.id, {
name: this.form1.kindName1,
}).then((res) => {
this.$message({
type: "success",
message: "编辑成功",
});
this.getGoods_types();
});
this.dialogFormVisible1 = false;
},
//
handdel(id) {
this.$confirm("确定删除此条商品品牌吗?", "确认删除", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
DelBrand_goods_types(id).then((res) => {
this.getGoods_types();
}); });
this.$message({ this.dialogFormVisible = false;
type: "success", },
message: "删除成功!", //
handEdit(id, item) {
this.id = id;
this.form1.kindName1 = item.name;
this.dialogFormVisible1 = true;
},
//
EditSubmit() {
editBrand_types(this.id, {
name: this.form1.kindName1,
}).then((res) => {
this.$message({
type: "success",
message: "编辑成功",
});
this.getGoods_types();
}); });
}) this.dialogFormVisible1 = false;
.catch(() => { },
this.$message({ //
type: "info", handdel(id) {
message: "已取消删除", this.$confirm("确定删除此条商品品牌吗?", "确认删除", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
DelBrand_goods_types(id).then((res) => {
this.getGoods_types();
});
this.$message({
type: "success",
message: "删除成功!",
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
},
//
getGoods_types() {
let page = {
page: this.current_page,
per_page: this.per_page,
};
Brand_goods_types(page).then((res) => {
this.tableData = res.data.data;
this.Paginationdata = res.data.meta;
}); });
}); },
},
//
getGoods_types() {
let page = {
page: this.current_page,
per_page: this.per_page,
};
Brand_goods_types(page).then((res) => {
this.tableData = res.data.data;
this.Paginationdata = res.data.meta;
});
},
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.conent { .block {
width: 100%;
min-height: calc(100vh - 200px);
position: relative;
}
.btn {
height: 104px;
border-radius: 5px;
display: flex;
align-items: center;
}
.el-button {
width: 114px;
height: 44px;
border-radius: 3px;
}
.table {
margin-top: 20px;
}
.block {
margin-top: 30px; margin-top: 30px;
} }
</style> </style>

View File

@ -1,435 +1,436 @@
<template> <template>
<div> <div>
<el-card class="box-card"> <el-card class="box-card">
<div class="goods" style="margin: 20px"> <div class="goods" style="margin: 20px">
<div class="add-item-info" style="margin-bottom: 10px; margin-left: 52px"> <div class="add-item-info" style="margin-bottom: 10px; margin-left: 52px">
<div> <div>
<div style="font-size: 14px">商品列表</div> <div style="font-size: 14px">商品列表</div>
<el-select v-model="lid" placeholder="选择商品" @change="onchange" filterable> <el-select v-model="lid" placeholder="选择商品" @change="onchange" filterable>
<el-option v-for="item in goodschoose" :key="item.id" :label="item.title" :value="item.id"> <el-option v-for="item in goodschoose" :key="item.id" :label="item.title" :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
<span style="font-size: 14px">商品图片 <span style="font-size: 14px">商品图片
<el-upload class="avatar-uploader" action="#" :limit="1" :auto-upload="false" :show-file-list="true" <el-upload class="avatar-uploader" action="#" :limit="1" :auto-upload="false"
list-type="picture-card" :on-change="handleAvatarSuccess"> :show-file-list="true" list-type="picture-card" :on-change="handleAvatarSuccess">
<img v-if="imageUrl" :src="imageUrl" class="avatar" /> <img v-if="imageUrl" :src="imageUrl" class="avatar" />
<i v-else class="el-icon-plus avatar-uploader-icon"></i> <i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload> </el-upload>
</span> </span>
</div> </div>
<!-- 编辑按钮进入显示 --> <!-- 编辑按钮进入显示 -->
<el-form ref="form" :inline="true" :model="form" v-if="goodsData != ''"> <el-form ref="form" :inline="true" :model="form" v-if="goodsData != ''">
<div> <div>
<el-form-item label="商品名称:"> <el-form-item label="商品名称:">
<el-input placeholder="商品名称" v-model="goodsData.goods.title"></el-input> <el-input placeholder="商品名称" v-model="goodsData.goods.title"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="商品编码:"> <el-form-item label="商品编码:">
<el-input placeholder="商品编码" v-model="goodsData.goods.goods_code"></el-input> <el-input placeholder="商品编码" v-model="goodsData.goods.goods_code"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="商品种类:"> <el-form-item label="商品种类:">
<el-select v-model="goodsData.goods.type_id" placeholder="商品种类" filterable> <el-select v-model="goodsData.goods.type_id" placeholder="商品种类" filterable>
<el-option v-for="item in cate" :key="item.id" :label="item.name" :value="item.id"> <el-option v-for="item in cate" :key="item.id" :label="item.name" :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="商品品牌:"> <el-form-item label="商品品牌:">
<el-select v-model="goodsData.goods.brand_id" placeholder="商品品牌" filterable> <el-select v-model="goodsData.goods.brand_id" placeholder="商品品牌" filterable>
<el-option v-for="item in brand" :key="item.id" :label="item.name" :value="item.id"> <el-option v-for="item in brand" :key="item.id" :label="item.name" :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</div> </div>
<div> <div>
<el-form-item label="商品规格:"> <el-form-item label="商品规格:">
<el-input placeholder="商品规格" v-model="goodsData.title"></el-input> <el-input placeholder="商品规格" v-model="goodsData.title"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="规格编码:"> <el-form-item label="规格编码:">
<el-input v-model="goodsData.sku_code" placeholder="商品编码"> <el-input v-model="goodsData.sku_code" placeholder="商品编码">
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="商品状态:"> <el-form-item label="商品状态:">
<el-select v-model="goodsData.status"> <el-select v-model="goodsData.status">
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id"> <el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<div> <div>
<el-form-item label="商品数量:"> <el-form-item label="商品数量:">
<el-input v-model="goodsData.num" placeholder="商品数量"> <el-input v-model="goodsData.num" placeholder="商品数量">
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="商品成本:"> <el-form-item label="商品成本:">
<el-input v-model="goodsData.cost" placeholder="商品成本"> <el-input v-model="goodsData.cost" placeholder="商品成本">
</el-input> </el-input>
</el-form-item> </el-form-item>
</div> </div>
</div> </div>
<div class="btn"> <div class="btn">
<el-form-item> <el-form-item>
<el-button type="primary" @click="Edititem()">保存</el-button> <el-button type="primary" @click="Edititem()">保存</el-button>
<el-button plain @click="cancel()">取消</el-button> <el-button plain @click="cancel()">取消</el-button>
</el-form-item> </el-form-item>
</div> </div>
</el-form> </el-form>
<!-- 新建商品进入显示 --> <!-- 新建商品进入显示 -->
<el-form ref="form" :inline="true" :model="form" v-if="goodsData == ''"> <el-form ref="form" :inline="true" :model="form" v-if="goodsData == ''">
<div> <div>
<el-form-item label="商品名称:"> <el-form-item label="商品名称:">
<el-input placeholder="商品名称" v-model="form.title" :disabled="true" v-if="isShow"></el-input> <el-input placeholder="商品名称" v-model="form.title" :disabled="true" v-if="isShow"></el-input>
<el-input placeholder="商品名称" v-model="form.title" v-else></el-input> <el-input placeholder="商品名称" v-model="form.title" v-else></el-input>
</el-form-item> </el-form-item>
<el-form-item label="商品编码:"> <el-form-item label="商品编码:">
<el-input placeholder="商品编码" v-model="form.goods_code" :disabled="true" v-if="isShow"></el-input> <el-input placeholder="商品编码" v-model="form.goods_code" :disabled="true" v-if="isShow">
<el-input placeholder="商品编码" v-model="form.goods_code" v-else></el-input> </el-input>
</el-form-item> <el-input placeholder="商品编码" v-model="form.goods_code" v-else></el-input>
<el-form-item label="商品种类:"> </el-form-item>
<el-select v-model="form.type_id" placeholder="商品种类" filterable> <el-form-item label="商品种类:">
<el-option v-for="item in cate" :key="item.id" :label="item.name" :value="item.id"> <el-select v-model="form.type_id" placeholder="商品种类" filterable>
</el-option> <el-option v-for="item in cate" :key="item.id" :label="item.name" :value="item.id">
</el-select> </el-option>
</el-form-item> </el-select>
<el-form-item label="商品品牌:"> </el-form-item>
<el-select v-model="form.brand_id" placeholder="商品品牌" filterable> <el-form-item label="商品品牌:">
<el-option v-for="item in brand" :key="item.id" :label="item.name" :value="item.id"> <el-select v-model="form.brand_id" placeholder="商品品牌" filterable>
</el-option> <el-option v-for="item in brand" :key="item.id" :label="item.name" :value="item.id">
</el-select> </el-option>
</el-form-item> </el-select>
</div> </el-form-item>
<div v-for="(item, i) in skus" :key="i"> </div>
<span style="margin-right: -15px">{{ i + 1 }}.</span> <div v-for="(item, i) in skus" :key="i">
<el-form-item label="商品规格:"> <span style="margin-right: -15px">{{ i + 1 }}.</span>
<el-input placeholder="商品规格" v-model="skus[i].title"></el-input> <el-form-item label="商品规格:">
</el-form-item> <el-input placeholder="商品规格" v-model="skus[i].title"></el-input>
<span class="addto" @click="handleAdd()">+</span> </el-form-item>
<el-form-item label="规格编码:"> <span class="addto" @click="handleAdd()">+</span>
<el-input v-model="skus[i].sku_code" placeholder="商品编码"> <el-form-item label="规格编码:">
</el-input> <el-input v-model="skus[i].sku_code" placeholder="商品编码">
</el-form-item> </el-input>
<el-form-item label="商品状态:"> </el-form-item>
<el-select v-model="skus[i].reserve" placeholder="下架(默认)"> <el-form-item label="商品状态:">
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id"> <el-select v-model="skus[i].reserve" placeholder="下架(默认)">
</el-option> <el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id">
</el-select> </el-option>
</el-form-item> </el-select>
<div> </el-form-item>
<el-form-item label="商品数量:"> <div>
<el-input v-model="skus[i].num" placeholder="商品数量"> <el-form-item label="商品数量:">
</el-input> <el-input v-model="skus[i].num" placeholder="商品数量">
</el-form-item> </el-input>
<el-form-item label="商品成本:"> </el-form-item>
<el-input v-model="skus[i].cost" placeholder="商品成本"> <el-form-item label="商品成本:">
</el-input> <el-input v-model="skus[i].cost" placeholder="商品成本">
</el-form-item> </el-input>
<el-button type="primary" @click="handleDelete(i)">删除</el-button> </el-form-item>
<el-button type="primary" @click="handleDelete(i)">删除</el-button>
</div>
</div>
<div class="btn">
<el-form-item>
<el-button type="primary" @click="handleSave()">保存</el-button>
<el-button plain @click="cancel()">取消</el-button>
</el-form-item>
</div>
</el-form>
</div> </div>
</div> </el-card>
<div class="btn"> </div>
<el-form-item>
<el-button type="primary" @click="handleSave()">保存</el-button>
<el-button plain @click="cancel()">取消</el-button>
</el-form-item>
</div>
</el-form>
</div>
</el-card>
</div>
</template> </template>
<script> <script>
import { import {
addGoods, addGoods,
checkGoods, checkGoods,
goodsList, goodsList,
updateGoods, updateGoods,
imgUpload, imgUpload,
} from "../../../api/goods.js"; } from "../../../api/goods.js";
import { goods_types, Brand_goods_types } from "../../../api/rankingData.js"; import { goods_types, Brand_goods_types } from "../../../api/rankingData.js";
export default { export default {
data() { data() {
return { return {
imgs: [], imgs: [],
gallery: "", gallery: "",
imageUrl: "", imageUrl: "",
lid: "", // id lid: "", // id
gid: "", // id gid: "", // id
brand: [], // brand: [], //
cate: [], // cate: [], //
goodschoose: [], // goodschoose: [], //
goodsID: "", //id goodsID: "", //id
goodsData: [], // goodsData: [], //
// //
skus: [ skus: [
{ {
title: "", title: "",
sku_code: "", sku_code: "",
status: "0", status: "0",
num: "0", num: "0",
cost: "0", cost: "0",
reserve: "0", reserve: "0",
}, },
], ],
// //
form: { form: {
goods_id: "", goods_id: "",
title: "", title: "",
img_url: "", img_url: "",
type_id: "", type_id: "",
brand_id: "", brand_id: "",
goods_code: "", goods_code: "",
}, },
// //
options: [ options: [
{ {
id: "0", id: "0",
label: "下架", label: "下架",
}, },
{ {
id: "1", id: "1",
label: "在售", label: "在售",
}, },
{ {
id: "2", id: "2",
label: "预警", label: "预警",
}, },
], ],
file: [], file: [],
isShow: false, isShow: false,
URL: "", URL: "",
}; };
}, },
watch: { watch: {
lid: { lid: {
handler(newVal, oldVal) { handler(newVal, oldVal) {
if (newVal) { if (newVal) {
this.goodschoose.forEach((item) => { this.goodschoose.forEach((item) => {
if (item.id == newVal) { if (item.id == newVal) {
this.form = { ...item }; this.form = { ...item };
} }
}); });
} }
},
deep: true, //
immediate: true, //
}, },
deep: true, //
immediate: true, //
},
}, },
methods: { methods: {
// //
handleAvatarSuccess(res, files) { handleAvatarSuccess(res, files) {
let formData = new FormData(); let formData = new FormData();
files.forEach((file) => { files.forEach((file) => {
formData.append("uploadFile", file.raw); // formData.append("uploadFile", file.raw); //
}); });
let requestConfig = { let requestConfig = {
headers: { headers: {
"Content-Type": "multipart/form-data", "Content-Type": "multipart/form-data",
}, },
}; };
imgUpload(formData, requestConfig).then((res) => { imgUpload(formData, requestConfig).then((res) => {
this.form.img_url = res.data.resource; this.form.img_url = res.data.resource;
if (this.goodsData.length !== 0) { if (this.goodsData.length !== 0) {
this.goodsData.goods.img_url = res.data.resource; this.goodsData.goods.img_url = res.data.resource;
}
});
},
//
handleUpdate() {
this.gid = this.$route.query;
if (this.gid.id) {
checkGoods(this.gid.id).then((res) => {
const data = res.data.data;
const sku = this.skus[0];
const list = {};
Object.keys(data).map((key) => {
Object.keys(sku).map((i) => {
if (key == i) {
list[i] = data[key];
} }
});
}); });
}); },
}
},
// //
handleList() { handleUpdate() {
goodsList().then((res) => { this.gid = this.$route.query;
this.goodschoose = res.data.data; if (this.gid.id) {
this.goodschoose = [ checkGoods(this.gid.id).then((res) => {
{ const data = res.data.data;
title: "", const sku = this.skus[0];
id: "", const list = {};
}, Object.keys(data).map((key) => {
...this.goodschoose, Object.keys(sku).map((i) => {
]; if (key == i) {
}); list[i] = data[key];
}, }
});
});
});
}
},
// //
handleSave() { handleList() {
const goods = this.form; goodsList().then((res) => {
const skus = this.skus; this.goodschoose = res.data.data;
const updata = { this.goodschoose = [
...goods, {
goods_id: this.lid, title: "",
skus: skus, id: "",
}; },
addGoods(updata).then((res) => { ...this.goodschoose,
if (res.statusText === "OK") { ];
this.$message({
message: "商品添加成功!",
type: "success",
}); });
this.updateForm(); },
//
handleSave() {
const goods = this.form;
const skus = this.skus;
const updata = {
...goods,
goods_id: this.lid,
skus: skus,
};
addGoods(updata).then((res) => {
if (res.statusText === "OK") {
this.$message({
message: "商品添加成功!",
type: "success",
});
this.updateForm();
this.$router.push("/GOODS_LIST");
}
});
},
//
updateForm() {
this.form = {
title: "",
img_url: "abc.jpg",
type_id: "",
brand_id: "",
goods_code: "",
};
this.skus = [
{
title: "",
sku_code: "",
status: "",
num: "",
cost: "",
},
];
},
//
handleAdd() {
this.skus.push({
title: "",
sku_code: "",
status: "0",
num: "",
cost: "",
});
},
//
handleDelete(index) {
this.skus.splice(index, 1);
},
//
getgoodsidData() {
let id = this.bigID;
checkGoods(id).then((res) => {
this.goodsData = res.data.data;
});
},
//
Edititem() {
let id = this.bigID;
let goods = {
title: this.goodsData.goods.title,
img_url: this.goodsData.goods.img_url,
type_id: this.goodsData.goods.type_id,
brand_id: this.goodsData.goods.brand_id,
goods_code: this.goodsData.goods.goods_code,
};
let sku = {
title: this.goodsData.title,
sku_code: this.goodsData.sku_code,
status: this.goodsData.status,
num: this.goodsData.num,
cost: this.goodsData.cost,
};
if (sku.status == "下架") {
sku.status = 0;
} else if (sku.status == "在售") {
sku.status = 1;
} else if (sku.status == "预警") {
sku.status = 2;
}
let updateData = {
goods_id: this.goodsData.goods_id,
goods,
sku,
};
updateGoods(id, updateData).then((res) => {
this.$router.push("/GOODS_LIST");
this.$message({
message: "商品编辑成功!",
type: "success",
});
});
},
//
cancel() {
this.$router.push("/GOODS_LIST"); this.$router.push("/GOODS_LIST");
} },
});
},
// onchange(value) {
updateForm() { if (value !== "") {
this.form = { this.isShow = true;
title: "", }
img_url: "abc.jpg", if (value === "") {
type_id: "", this.isShow = false;
brand_id: "", this.form = {};
goods_code: "", }
}; },
this.skus = [
{
title: "",
sku_code: "",
status: "",
num: "",
cost: "",
},
];
},
//
handleAdd() {
this.skus.push({
title: "",
sku_code: "",
status: "0",
num: "",
cost: "",
});
},
//
handleDelete(index) {
this.skus.splice(index, 1);
},
//
getgoodsidData() {
let id = this.bigID;
checkGoods(id).then((res) => {
this.goodsData = res.data.data;
});
},
//
Edititem() {
let id = this.bigID;
let goods = {
title: this.goodsData.goods.title,
img_url: this.goodsData.goods.img_url,
type_id: this.goodsData.goods.type_id,
brand_id: this.goodsData.goods.brand_id,
goods_code: this.goodsData.goods.goods_code,
};
let sku = {
title: this.goodsData.title,
sku_code: this.goodsData.sku_code,
status: this.goodsData.status,
num: this.goodsData.num,
cost: this.goodsData.cost,
};
if (sku.status == "下架") {
sku.status = 0;
} else if (sku.status == "在售") {
sku.status = 1;
} else if (sku.status == "预警") {
sku.status = 2;
}
let updateData = {
goods_id: this.goodsData.goods_id,
goods,
sku,
};
updateGoods(id, updateData).then((res) => {
this.$router.push("/GOODS_LIST");
this.$message({
message: "商品编辑成功!",
type: "success",
});
});
},
//
cancel() {
this.$router.push("/GOODS_LIST");
},
onchange(value) {
if (value !== "") {
this.isShow = true;
}
if (value === "") {
this.isShow = false;
this.form = {};
}
},
}, },
created() { created() {
this.goodsID = sessionStorage.getItem("商品ID"); this.goodsID = sessionStorage.getItem("商品ID");
this.bigID = sessionStorage.getItem("ID"); this.bigID = sessionStorage.getItem("ID");
}, },
mounted() { mounted() {
this.gid = this.$route.query; this.gid = this.$route.query;
// //
goods_types().then((res) => { goods_types().then((res) => {
this.cate = res.data.data; this.cate = res.data.data;
}); });
// //
Brand_goods_types().then((res) => { Brand_goods_types().then((res) => {
this.brand = res.data.data; this.brand = res.data.data;
}); });
this.handleList(); this.handleList();
this.handleUpdate(); this.handleUpdate();
this.getgoodsidData(); this.getgoodsidData();
}, },
beforeDestroy() { beforeDestroy() {
sessionStorage.removeItem("商品ID"); //ID sessionStorage.removeItem("商品ID"); //ID
sessionStorage.removeItem("ID"); //ID sessionStorage.removeItem("ID"); //ID
}, },
}; };
</script> </script>
<style scoped> <style scoped>
.el-upload--picture-card { .el-upload--picture-card {
width: 50px; width: 50px;
height: 50px; height: 50px;
} }
.el-form-item { .el-form-item {
margin-left: 60px; margin-left: 60px;
} }
.addto { .addto {
display: inline-block; display: inline-block;
width: 30px; width: 30px;
height: 30px; height: 30px;
@ -440,33 +441,33 @@
line-height: 30px; line-height: 30px;
border-radius: 5px; border-radius: 5px;
margin-top: 4px; margin-top: 4px;
} }
/* 分割 */ /* 分割 */
.avatar-uploader .el-upload { .avatar-uploader .el-upload {
border: 1px dashed #d9d9d9; border: 1px dashed #d9d9d9;
border-radius: 6px; border-radius: 6px;
cursor: pointer; cursor: pointer;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
.avatar-uploader .el-upload:hover { .avatar-uploader .el-upload:hover {
border-color: #409eff; border-color: #409eff;
} }
.avatar-uploader-icon { .avatar-uploader-icon {
font-size: 28px; font-size: 28px;
color: #8c939d; color: #8c939d;
width: 148px; width: 148px;
height: 148px; height: 148px;
line-height: 148px; line-height: 148px;
text-align: center; text-align: center;
} }
.avatar { .avatar {
width: 148px; width: 148px;
height: 148px; height: 148px;
display: block; display: block;
} }
</style> </style>

View File

@ -360,11 +360,7 @@
<script> <script>
import axios from "axios"; import axios from "axios";
import { goods_types, Brand_goods_types } from "../../api/rankingData.js"; import { goods_types, Brand_goods_types } from "../../api/rankingData.js";
import { import { goods, update, singleUpdate } from "../../api/goods";
goods,
update,
singleUpdate,
} from "../../api/goods";
export default { export default {
data() { data() {
return { return {

View File

@ -0,0 +1,186 @@
<template>
<div class="conent">
<!-- 新增按钮 -->
<el-button type="primary" @click="handAdd">新增</el-button>
<!-- 列表 -->
<div class="table">
<el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column prop="name" label="商品种类"> </el-table-column>
<el-table-column prop="" label="操作">
<template slot-scope="scope">
<el-button type="primary" @click="handEdit(scope.row.id, scope.row)">编辑</el-button>
<el-button type="danger" @click="handdel(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页功能 -->
<div class="block">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page="current_page" :page-sizes="[15, 50, 100]" :page-size="per_page"
layout="total, sizes, prev, pager, next, jumper" :total="Paginationdata.total">
</el-pagination>
</div>
<!-- 新增种类对话框 -->
<el-dialog title="新增" :visible.sync="dialogFormVisible" :close-on-click-modal="false">
<el-form :model="form">
<el-form-item label="商品种类" :label-width="formLabelWidth">
<el-input v-model="form.kindName" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="addSubmit"> </el-button>
</div>
</el-dialog>
<!-- 编辑 -->
<el-dialog title="编辑" :visible.sync="dialogFormVisible1" :close-on-click-modal="false">
<el-form :model="form1">
<el-form-item label="编辑种类" :label-width="formLabelWidth1">
<el-input v-model="form1.kindName1" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible1 = false"> </el-button>
<el-button type="primary" @click="EditSubmit"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
goods_types,
Delgoods_types,
Addgoods_types,
editGoods_types,
} from "../../api/rankingData";
export default {
data() {
return {
id: "", //id
tableData: [],
multipleSelection: [],
dialogFormVisible: false,
dialogFormVisible1: false,
form: {
kindName: "", //
},
form1: {
kindName1: "", //
},
formLabelWidth: "120px",
formLabelWidth1: "120px",
newKind: [],
Paginationdata: {}, //
current_page: 1, //
per_page: 15, //
};
},
mounted() {
this.getGoods_types();
},
methods: {
//
handleSelectionChange(val) {
this.multipleSelection = val;
},
//
handleSizeChange(val) {
//
this.per_page = val;
this.getGoods_types();
},
handleCurrentChange(val) {
//
this.current_page = val;
this.getGoods_types();
},
//
handAdd() {
this.form.kindName = "";
this.dialogFormVisible = true;
},
//
addSubmit() {
var string;
string = this.form.kindName.replace(/\s/g, ",").split(",");
Addgoods_types({
names: string,
}).then((res) => {
this.$message({
type: "success",
message: "添加成功",
});
this.getGoods_types();
});
this.dialogFormVisible = false;
},
//
handEdit(id, item) {
this.id = id;
this.form1.kindName1 = item.name;
this.dialogFormVisible1 = true;
},
//
EditSubmit() {
editGoods_types(this.id, {
name: this.form1.kindName1,
}).then((res) => {
this.$message({
type: "success",
message: "编辑成功",
});
this.getGoods_types();
});
this.dialogFormVisible1 = false;
},
//
handdel(id) {
this.$confirm("确定删除此条商品种类吗?", "确认删除", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
Delgoods_types(id).then((res) => {
this.getGoods_types();
});
this.$message({
type: "success",
message: "删除成功!",
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
},
//
getGoods_types() {
let page = {
page: this.current_page,
per_page: this.per_page,
};
goods_types(page).then((res) => {
this.tableData = res.data.data;
this.Paginationdata = res.data.meta;
});
},
},
};
</script>
<style lang="scss" scoped>
.block {
margin-top: 30px;
}
</style>

View File

@ -1,212 +0,0 @@
<template>
<div class="conent">
<!-- 新增按钮 -->
<div class="btn">
<el-button type="primary" @click="handAdd">新增</el-button>
</div>
<!-- 列表 -->
<div class="table">
<el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column prop="name" label="商品种类"> </el-table-column>
<el-table-column prop="" label="操作">
<template slot-scope="scope">
<el-button type="primary" @click="handEdit(scope.row.id, scope.row)">编辑</el-button>
<el-button type="danger" @click="handdel(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 新增种类对话框 -->
<el-dialog title="新增" :visible.sync="dialogFormVisible" :close-on-click-modal="false">
<el-form :model="form">
<el-form-item label="商品种类" :label-width="formLabelWidth">
<el-input v-model="form.kindName" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="addSubmit"> </el-button>
</div>
</el-dialog>
<!-- 编辑 -->
<el-dialog title="编辑" :visible.sync="dialogFormVisible1" :close-on-click-modal="false">
<el-form :model="form1">
<el-form-item label="编辑种类" :label-width="formLabelWidth1">
<el-input v-model="form1.kindName1" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible1 = false"> </el-button>
<el-button type="primary" @click="EditSubmit"> </el-button>
</div>
</el-dialog>
<!-- 分页功能 -->
<div class="block">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="current_page"
:page-sizes="[15, 50, 100]" :page-size="per_page" layout="total, sizes, prev, pager, next, jumper"
:total="Paginationdata.total">
</el-pagination>
</div>
</div>
</template>
<script>
import {
goods_types,
Delgoods_types,
Addgoods_types,
editGoods_types,
} from "../../api/rankingData";
export default {
data() {
return {
id: "", //id
tableData: [],
multipleSelection: [],
dialogFormVisible: false,
dialogFormVisible1: false,
form: {
kindName: "", //
},
form1: {
kindName1: "", //
},
formLabelWidth: "120px",
formLabelWidth1: "120px",
newKind: [],
Paginationdata: {}, //
current_page: 1, //
per_page: 15, //
};
},
mounted() {
this.getGoods_types();
},
methods: {
//
handleSelectionChange(val) {
this.multipleSelection = val;
},
//
handleSizeChange(val) {
//
this.per_page = val;
this.getGoods_types();
},
handleCurrentChange(val) {
//
this.current_page = val;
this.getGoods_types();
},
//
handAdd() {
this.form.kindName = "";
this.dialogFormVisible = true;
},
//
addSubmit() {
var string;
string = this.form.kindName.replace(/\s/g, ",").split(",");
Addgoods_types({
names: string,
}).then((res) => {
this.$message({
type: "success",
message: "添加成功",
});
this.getGoods_types();
});
this.dialogFormVisible = false;
},
//
handEdit(id, item) {
this.id = id;
this.form1.kindName1 = item.name;
this.dialogFormVisible1 = true;
},
//
EditSubmit() {
editGoods_types(this.id, {
name: this.form1.kindName1,
}).then((res) => {
this.$message({
type: "success",
message: "编辑成功",
});
this.getGoods_types();
});
this.dialogFormVisible1 = false;
},
//
handdel(id) {
this.$confirm("确定删除此条商品种类吗?", "确认删除", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
Delgoods_types(id).then((res) => {
this.getGoods_types();
});
this.$message({
type: "success",
message: "删除成功!",
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
},
//
getGoods_types() {
let page = {
page: this.current_page,
per_page: this.per_page,
};
goods_types(page).then((res) => {
this.tableData = res.data.data;
this.Paginationdata = res.data.meta;
});
},
},
};
</script>
<style lang="scss" scoped>
.conent {
width: 100%;
min-height: calc(100vh - 200px);
position: relative;
}
.btn {
height: 104px;
border-radius: 5px;
display: flex;
align-items: center;
}
.el-button {
width: 114px;
height: 44px;
border-radius: 3px;
}
.table {
margin-top: 20px;
}
.block {
margin-top: 30px;
}
</style>

View File

@ -1,365 +1,388 @@
<template> <template>
<div> <div>
<el-container> <el-container>
<el-container> <el-container>
<el-aside :class="show ? 'width' : 'width1'"> <el-aside :class="show ? 'width' : 'width1'">
<el-menu router background-color="#282c34" text-color="#fff" :default-active="$route.path" <el-menu router background-color="#282c34" text-color="#fff" :default-active="$route.path"
:default-openeds="openeds"> :default-openeds="openeds">
<div v-for="item in menu" :key="item.id"> <div v-for="item in menu" :key="item.id">
<el-menu-item :index="item.code" v-if="!item.children"> <el-menu-item :index="item.code" v-if="!item.children">
<span>{{ item.name }}</span> <span>{{ item.name }}</span>
</el-menu-item> </el-menu-item>
<el-submenu v-else :index="item.code"> <el-submenu v-else :index="item.code">
<template slot="title"> <template slot="title">
<span>{{ item.name }}</span> <span>{{ item.name }}</span>
</template> </template>
<el-menu-item :index="items.code" :key="items.id" v-for="items in item.children">{{ items.name }} <el-menu-item :index="items.code" :key="items.id" v-for="items in item.children">{{
</el-menu-item> items.name
</el-submenu> }}
</div> </el-menu-item>
</el-menu> </el-submenu>
</el-aside> </div>
</el-menu>
</el-aside>
<el-main> <el-main>
<div class="head"> <div class="head">
<ul> <ul>
<li> <li>
<div @click="add" class="add"> <div @click="add" class="add">
<i class="el-icon-s-unfold" v-if="show"></i> <i class="el-icon-s-unfold" v-if="show"></i>
<i class="el-icon-s-fold" v-else></i> <i class="el-icon-s-fold" v-else></i>
</div> </div>
<div class="right"> <div class="right">
<el-breadcrumb separator-class="el-icon-arrow-right"> <el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item v-for="(item, index) in titie" :key="index">{{ item.name }}</el-breadcrumb-item> <el-breadcrumb-item v-for="(item, index) in titie" :key="index">{{ item.name }}
</el-breadcrumb> </el-breadcrumb-item>
</div> </el-breadcrumb>
</li> </div>
<li> </li>
<div class="token" @click="hanleLogout">退出</div> <li>
</li> <div class="token" @click="hanleLogout">退出</div>
</ul> </li>
</div> </ul>
</div>
<div class="box-card"> <div class="box-card">
<router-view></router-view> <router-view></router-view>
</div> </div>
</el-main> </el-main>
</el-container> </el-container>
</el-container> </el-container>
</div> </div>
</template> </template>
<script> <script>
import { removeToken } from "@/util/auth"; import { removeToken } from "@/util/auth";
import { getMenu } from "../api/menu.js"; import { getMenu } from "../api/menu.js";
export default { export default {
mounted() { mounted() {
getMenu().then((res) => { getMenu().then((res) => {
this.menu = res.data.data; this.menu = res.data.data;
}); });
}, },
data() { data() {
return { return {
menu: [], // menu: [], //
show: true, // show: true, //
levelData: [], // table levelData: [], // table
titie: [], // 线 titie: [], // 线
head: "", // name head: "", // name
onindex: 0, // onindex: 0, //
openeds: ["GOODS_MANAGE"], openeds: ["GOODS_MANAGE"],
}; };
}, },
watch: { watch: {
// table // table
$route: { $route: {
handler: function (val) { handler: function (val) {
this.titie = val.matched; this.titie = val.matched;
this.head = val.name; this.head = val.name;
this.levelData.push({ name: val.name, path: val.path }); this.levelData.push({ name: val.name, path: val.path });
const newArr = []; const newArr = [];
const obj = {}; const obj = {};
for (var i = 0; i < this.levelData.length; i++) { for (var i = 0; i < this.levelData.length; i++) {
if (!obj[this.levelData[i].name]) { if (!obj[this.levelData[i].name]) {
newArr.push(this.levelData[i]); newArr.push(this.levelData[i]);
obj[this.levelData[i].name] = true; obj[this.levelData[i].name] = true;
} }
} }
this.levelData = newArr; this.levelData = newArr;
},
deep: true,
immediate: true,
}, },
deep: true,
immediate: true,
},
}, },
methods: { methods: {
/** /**
* @author: czw (725551805@qq.com) * @author: czw (725551805@qq.com)
* @description: 滚动条下一个 * @description: 滚动条下一个
* @param {*} * @param {*}
* @return {*} * @return {*}
* @Date: 2022-03-02 19:50:50 * @Date: 2022-03-02 19:50:50
*/ */
next() { next() {
this.hanletop(); this.hanletop();
}, },
/** /**
* @author: czw (725551805@qq.com) * @author: czw (725551805@qq.com)
* @description: 滚动最底部 * @description: 滚动最底部
* @param {*} * @param {*}
* @return {*} * @return {*}
* @Date: 2022-03-02 19:51:03 * @Date: 2022-03-02 19:51:03
*/ */
hanletop() { hanletop() {
document.getElementById("bottom").scrollIntoView({ behavior: "smooth" }); document.getElementById("bottom").scrollIntoView({ behavior: "smooth" });
}, },
/** /**
* @author: czw (725551805@qq.com) * @author: czw (725551805@qq.com)
* @description: 滚动最顶部 * @description: 滚动最顶部
* @param {*} * @param {*}
* @return {*} * @return {*}
* @Date: 2022-03-02 19:51:07 * @Date: 2022-03-02 19:51:07
*/ */
hanlebottom() { hanlebottom() {
document.getElementById("top").scrollIntoView({ behavior: "smooth" }); document.getElementById("top").scrollIntoView({ behavior: "smooth" });
}, },
/** /**
* @author: czw (725551805@qq.com) * @author: czw (725551805@qq.com)
* @description: 退出登录 * @description: 退出登录
* @param {*} * @param {*}
* @return {*} * @return {*}
* @Date: 2022-03-02 09:41:37 * @Date: 2022-03-02 09:41:37
*/ */
hanleLogout() { hanleLogout() {
removeToken(); removeToken();
this.$router.push({ path: "/Login" }); this.$router.push({ path: "/Login" });
}, },
/** /**
* @author: czw (725551805@qq.com) * @author: czw (725551805@qq.com)
* @description: table页跳转 * @description: table页跳转
* @param {*} * @param {*}
* @return {*} * @return {*}
* @Date: 2022-03-01 22:27:27 * @Date: 2022-03-01 22:27:27
*/ */
handlerclick(e) { handlerclick(e) {
if (this.$route.path !== e) { if (this.$route.path !== e) {
this.$router.push({ path: e }); this.$router.push({ path: e });
}
},
/**
* @author: czw (725551805@qq.com)
* @description: 导航栏折叠
* @param {*}
* @return {*}
* @Date: 2022-03-01 22:25:47
*/
add() {
this.show = !this.show;
},
/**
* @author: czw (725551805@qq.com)
* @description: 删除
* @param {*}
* @return {*}
* @Date: 2022-03-01 16:53:49
*/
hanblDelete(index, titie) {
var list = this.levelData[index].name;
this.onindex = index;
this.levelData.splice(this.onindex, 1);
if (titie === this.head) {
var item;
var name;
for (let i = 0; i < this.levelData.length; i++) {
item = this.levelData[i].path;
name = this.levelData[i].name;
}
if (this.levelData.length) {
if (name !== list) {
this.$router.push({ path: item });
} }
} },
} /**
}, * @author: czw (725551805@qq.com)
* @description: 导航栏折叠
* @param {*}
* @return {*}
* @Date: 2022-03-01 22:25:47
*/
add() {
this.show = !this.show;
},
/**
* @author: czw (725551805@qq.com)
* @description: 删除
* @param {*}
* @return {*}
* @Date: 2022-03-01 16:53:49
*/
hanblDelete(index, titie) {
var list = this.levelData[index].name;
this.onindex = index;
this.levelData.splice(this.onindex, 1);
if (titie === this.head) {
var item;
var name;
for (let i = 0; i < this.levelData.length; i++) {
item = this.levelData[i].path;
name = this.levelData[i].name;
}
if (this.levelData.length) {
if (name !== list) {
this.$router.push({ path: item });
}
}
}
},
}, },
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.table { .table {
background-color: #fff; background-color: #fff;
ul { ul {
li { li {
padding: 20px 10px; padding: 20px 10px;
.Navigation { .Navigation {
display: flex; display: flex;
span { span {
padding: 5px 30px; padding: 5px 30px;
border: 1px solid #dcdfe6; border: 1px solid #dcdfe6;
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
color: #303133; color: #303133;
border-radius: 4px; border-radius: 4px;
cursor: pointer; cursor: pointer;
margin-right: 10px; margin-right: 10px;
} }
.tab { .tab {
margin-right: 10px; margin-right: 10px;
flex-shrink: 0; flex-shrink: 0;
} }
.red { .red {
color: #5470c6; color: #5470c6;
border: 1px solid #5470c6; border: 1px solid #5470c6;
} }
.closure { .closure {
display: inline-block; display: inline-block;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
width: 15px; width: 15px;
height: 15px; height: 15px;
line-height: 15px; line-height: 15px;
background-color: #ddd; background-color: #ddd;
color: #000; color: #000;
border-radius: 50%; border-radius: 50%;
font-size: 12px; font-size: 12px;
} }
.red_1 { .red_1 {
background-color: #5470c6; background-color: #5470c6;
color: #fff; color: #fff;
} }
}
} }
}
li:nth-child(2) { li:nth-child(2) {
overflow-x: auto; overflow-x: auto;
} }
display: flex; display: flex;
} }
} }
.width { .width {
transition: all 0.3s; transition: all 0.3s;
opacity: 0; opacity: 0;
width: 0px !important; width: 0px !important;
} }
.width1 { .width1 {
transition: all 0.3s; transition: all 0.3s;
opacity: 1; opacity: 1;
width: 200px !important; width: 200px !important;
} }
.el-container { .el-container {
height: 100vh; height: 100vh;
} }
.el-header { .el-header {
background-color: #b3c0d1; background-color: #b3c0d1;
color: #333; color: #333;
text-align: center; text-align: center;
} }
.el-aside { .el-aside {
background-color: #d3dce6; background-color: #d3dce6;
color: #333; color: #333;
text-align: center; text-align: center;
overflow-x: hidden; overflow-x: hidden;
} }
.el-aside::-webkit-scrollbar { .el-aside::-webkit-scrollbar {
width: 8px; width: 8px;
/*对垂直流动条有效*/ /*对垂直流动条有效*/
} }
.el-aside::-webkit-scrollbar-thumb { .el-aside::-webkit-scrollbar-thumb {
background-color: rgba(144, 147, 153, 0.3); background-color: rgba(144, 147, 153, 0.3);
border-radius: 20px; border-radius: 20px;
} }
.el-main { .el-main {
background-color: #f0f2f5; background-color: #f0f2f5;
color: #333; color: #333;
padding: 0 0 !important; padding: 0 0 !important;
} }
.el-main::-webkit-scrollbar { .el-main::-webkit-scrollbar {
width: 10px; width: 10px;
/*对垂直流动条有效*/ /*对垂直流动条有效*/
} }
.el-main::-webkit-scrollbar-thumb { .el-main::-webkit-scrollbar-thumb {
background-color: rgba(144, 147, 153, 0.3); background-color: rgba(144, 147, 153, 0.3);
} }
.box-card { .box-card {
background-color: #fff; background-color: #fff;
min-height: calc(100vh - 200px); min-height: calc(100vh - 120px);
margin: 10px; margin: 10px;
padding: 20px; padding: 20px;
} }
.add { .conent {
width: 100%;
min-height: calc(100vh - 200px);
position: relative;
}
.add {
cursor: pointer; cursor: pointer;
font-size: 25px; font-size: 25px;
color: #606266; color: #606266;
} }
.head { .head {
padding: 10px; padding: 10px;
background-color: #fff; background-color: #fff;
border-bottom: 1px solid #f6f6f6; border-bottom: 1px solid #f6f6f6;
box-shadow: 0 1px 4px rgb(0 21 41 / 8%); box-shadow: 0 1px 4px rgb(0 21 41 / 8%);
ul { ul {
display: flex;
justify-content: space-between;
li {
display: flex; display: flex;
align-items: center; justify-content: space-between;
.right { li {
margin-left: 20px; display: flex;
} align-items: center;
.token { .right {
cursor: pointer; margin-left: 20px;
}
.token {
cursor: pointer;
}
} }
}
} }
} }
.el-aside { .el-aside {
background: #282c34; background: #282c34;
box-shadow: 2px 0 6px rgb(0 21 41 / 35%); box-shadow: 2px 0 6px rgb(0 21 41 / 35%);
} }
::v-deep .el-menu { ::v-deep .el-menu {
border: none; border: none;
} }
// .el-menu-item { // .el-menu-item {
// margin: 0 20px 10px; // margin: 0 20px 10px;
// } // }
.el-menu-item:hover { .el-menu-item:hover {
outline: 0 !important; outline: 0 !important;
background: #5470c6 !important; background: #5470c6 !important;
border-radius: 5px !important; border-radius: 5px !important;
} }
.el-menu-item.is-active { .el-menu-item.is-active {
color: #fff !important; color: #fff !important;
background: #5470c6 !important; background: #5470c6 !important;
border-radius: 5px !important; border-radius: 5px !important;
} }
.el-menu-item-group__title { .el-menu-item-group__title {
padding: 0 0 !important; padding: 0 0 !important;
} }
</style>
.table {
margin-top: 20px;
}
.block {
margin-top: 30px;
}
.from-btn {
display: flex;
justify-content: space-around;
align-content: center;
}
</style>

View File

@ -1,367 +1,370 @@
<template> <template>
<div> <div>
<!-- 筛选框 --> <!-- 筛选框 -->
<el-card class="box-card"> <el-card class="box-card" :body-style="{ padding: '20px 20px 0 20px' }">
<div class="goods" style="margin: 20px"> <el-form ref="form" :inline="true" :model="form">
<el-form ref="form" :inline="true" :model="form"> <el-form-item label="模块:" style="margin-right: 40px">
<el-form-item label="模块:" style="margin-right: 40px"> <el-select v-model="form.module" clearable>
<el-select v-model="form.module" clearable > <el-option v-for="item in mouduleOptions" :key="item.value" :label="item.label"
<el-option v-for="item in mouduleOptions" :key="item.value" :label="item.label" :value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="操作:" style="margin-right: 40px"> <el-form-item label="操作:" style="margin-right: 40px">
<el-select v-model="form.action" clearable> <el-select v-model="form.action" clearable>
<el-option v-for="item in actionOptions" :key="item.value" :label="item.label" :value="item.value"> <el-option v-for="item in actionOptions" :key="item.value" :label="item.label"
</el-option> :value="item.value">
</el-select> </el-option>
</el-form-item> </el-select>
<el-form-item label="目标类型:" style="margin-right: 40px"> </el-form-item>
<el-select v-model="form.target_type" clearable> <el-form-item label="目标类型:" style="margin-right: 40px">
<el-option v-for="item in target_ypeOptions" :key="item.value" :label="item.label" :value="item.value"> <el-select v-model="form.target_type" clearable>
</el-option> <el-option v-for="item in target_ypeOptions" :key="item.value" :label="item.label"
</el-select> :value="item.value">
</el-form-item> </el-option>
<el-form-item label="类别:" style="margin-right: 40px"> </el-select>
<el-select v-model="form.targetField" clearable> </el-form-item>
<el-option v-for="item in target_fieldOptions" :key="item.value" :label="item.label" :value="item.value"> <el-form-item label="类别:" style="margin-right: 40px">
</el-option> <el-select v-model="form.targetField" clearable>
</el-select> <el-option v-for="item in target_fieldOptions" :key="item.value" :label="item.label"
</el-form-item> :value="item.value">
<el-form-item label="操作人:" style="margin-right: 40px"> </el-option>
<el-select v-model="form.userId" placeholder="输入操作人" clearable> </el-select>
<el-option v-for="item in userOptions" :key="item.id" :label="item.name" :value="item.id"> </el-form-item>
</el-option> <el-form-item label="操作人:" style="margin-right: 40px">
</el-select> <el-select v-model="form.userId" placeholder="输入操作人" clearable>
</el-form-item> <el-option v-for="item in userOptions" :key="item.id" :label="item.name" :value="item.id">
<el-form-item label="时间:"> </el-option>
<el-date-picker v-model="value1" type="datetimerange" range-separator="-" start-placeholder="" </el-select>
end-placeholder="止" value-format="yyyy-MM-dd HH:mm:ss"> </el-form-item>
</el-date-picker> <el-form-item label="时间:">
</el-form-item> <el-date-picker v-model="value1" type="datetimerange" range-separator="-" start-placeholder=""
<el-form-item> end-placeholder="止" value-format="yyyy-MM-dd HH:mm:ss">
<el-button type="primary" @click="query()">查询</el-button> </el-date-picker>
</el-form-item> </el-form-item>
</el-form> <el-form-item>
</div> <el-button type="primary" @click="query()">查询</el-button>
</el-card> </el-form-item>
</el-form>
</el-card>
<!-- 表格 --> <!-- 表格 -->
<el-card style="margin-top: 30px" class="box-card"> <el-card style="margin-top: 30px" class="box-card">
<el-table :data="tableData" border style="width: 100%"> <el-table :data="tableData" border style="width: 100%">
<el-table-column prop="id" label="序号" width="75"> </el-table-column> <el-table-column prop="id" label="序号" width="75"> </el-table-column>
<el-table-column prop="module" label="模块" width="70"> </el-table-column> <el-table-column prop="module" label="模块" width="70"> </el-table-column>
<el-table-column prop="action" label="操作" width="70"> </el-table-column> <el-table-column prop="action" label="操作" width="70"> </el-table-column>
<el-table-column prop="target_type" label="目标类型" width="100"> </el-table-column> <el-table-column prop="target_type" label="目标类型" width="100"> </el-table-column>
<el-table-column prop="target_id" label="目标ID" width="70"> </el-table-column> <el-table-column prop="target_id" label="目标ID" width="70"> </el-table-column>
<el-table-column prop="target_field" label="类别" width="100"> </el-table-column> <el-table-column prop="target_field" label="类别" width="100"> </el-table-column>
<el-table-column label="操作前"> <el-table-column label="操作前">
<template slot-scope="scope"> <template slot-scope="scope">
<div style="height:45px"> <div style="height:45px">
{{scope.row.before_update}} {{ scope.row.before_update }}
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作后"> <el-table-column label="操作后">
<template slot-scope="scope"> <template slot-scope="scope">
<div style="height:45px"> <div style="height:45px">
{{scope.row.after_update}} {{ scope.row.after_update }}
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="信息" width="300"> <el-table-column label="信息" width="300">
<template slot-scope="scope"> <template slot-scope="scope">
<div style="overflow-x: hidden;white-space: nowrap;"> <div style="overflow-x: hidden;white-space: nowrap;">
{{scope.row.message}} {{ scope.row.message }}
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="user.name" label="操作人" width="120"></el-table-column> <el-table-column prop="user.name" label="操作人" width="120"></el-table-column>
<el-table-column label="操作时间" width="100"> <el-table-column label="操作时间" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<p>{{scope.row.created_at}}</p> <p>{{ scope.row.created_at }}</p>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-card> </el-card>
<!-- 分页功能 --> <!-- 分页功能 -->
<div class="block"> <div class="block">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="current_page" <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:page-sizes="[15, 50, 100]" :page-size="per_page" layout="total, sizes, prev, pager, next, jumper" :current-page="current_page" :page-sizes="[15, 50, 100]" :page-size="per_page"
:total="Paginationdata.total"> layout="total, sizes, prev, pager, next, jumper" :total="Paginationdata.total">
</el-pagination> </el-pagination>
</div>
</div> </div>
</div>
</template> </template>
<script> <script>
import { recordList } from "../../api/record"; import { recordList } from "../../api/record";
import { userList } from "../../api/user"; import { userList } from "../../api/user";
export default { export default {
data() { data() {
return { return {
target_fieldOptions: [ target_fieldOptions: [
{ {
value: "add", value: "add",
label: "创建", label: "创建",
}, },
{ {
value: "status", value: "status",
label: "状态", label: "状态",
}, },
{ {
value: "name", value: "name",
label: "名称", label: "名称",
}, },
{ {
value: "title", value: "title",
label: "标题", label: "标题",
}, },
{ {
value: "import", value: "import",
label: "导入", label: "导入",
}, },
{ {
value: "export", value: "export",
label: "导出", label: "导出",
}, },
{ {
value: "set", value: "set",
label: "设置", label: "设置",
}, },
{ {
value: "cost", value: "cost",
label: "成本", label: "成本",
}, },
{ {
value: "stock", value: "stock",
label: "库存", label: "库存",
}, },
{ {
value: "inventory", value: "inventory",
label: "库存盘点", label: "库存盘点",
}, },
{ {
value: "reserve", value: "reserve",
label: "预留量", label: "预留量",
}, },
{ {
value: "timingInventory", value: "timingInventory",
label: "7点盘点", label: "7点盘点",
}, },
{ {
value: "pdd.ktt.goods.query.list", value: "pdd.ktt.goods.query.list",
label: "快团团下载绑定商品", label: "快团团下载绑定商品",
}, },
{ {
value: "arrived_today_num", value: "arrived_today_num",
label: "今日到货", label: "今日到货",
}, },
{ {
value: "loss_num", value: "loss_num",
label: "损耗", label: "损耗",
}, },
{ {
value: "pdd.pop.auth.token.create", value: "pdd.pop.auth.token.create",
label: "快团团授权", label: "快团团授权",
}, },
{ {
value: "reference_price", value: "reference_price",
label: "参考价格", label: "参考价格",
}, },
{ {
value: "update", value: "update",
label: "更新", label: "更新",
}, },
{ {
value: "pdd.ktt.goods.incr.quantity", value: "pdd.ktt.goods.incr.quantity",
label: "快团团库存同步", label: "快团团库存同步",
}, },
{ {
value: "pdd.ktt.order.list", value: "pdd.ktt.order.list",
label: "快团团下载订单", label: "快团团下载订单",
}, },
{ {
value: "pdd.ktt.increment.order.query", value: "pdd.ktt.increment.order.query",
label: "快团团增量下载订单", label: "快团团增量下载订单",
}, },
], // ], //
mouduleOptions:[ mouduleOptions: [
{ {
value: "menu", value: "menu",
label: "菜单", label: "菜单",
}, },
{ {
value: "goods", value: "goods",
label: "商品", label: "商品",
}, },
{ {
value: "file", value: "file",
label: "文件", label: "文件",
}, },
{ {
value: "permission", value: "permission",
label: "权限", label: "权限",
}, },
{ {
value: "role", value: "role",
label: "角色", label: "角色",
}, },
{ {
value: "user", value: "user",
label: "用户", label: "用户",
}, },
{ {
value: "plat", value: "plat",
label: "平台", label: "平台",
}, },
],// ],//
actionOptions:[ actionOptions: [
{ {
value: "POST", value: "POST",
label: "新增", label: "新增",
}, },
{ {
value: "PATCH", value: "PATCH",
label: "更新", label: "更新",
}, },
{ {
value: "DELETE", value: "DELETE",
label: "删除", label: "删除",
}, },
{ {
value: "GET", value: "GET",
label: "查看", label: "查看",
}, },
],// ],//
target_ypeOptions:[ target_ypeOptions: [
{ {
value: "upload", value: "upload",
label: "上传", label: "上传",
}, },
{ {
value: "goods_sku", value: "goods_sku",
label: "商品规格", label: "商品规格",
}, },
{ {
value: "goods_brand", value: "goods_brand",
label: "商品品牌", label: "商品品牌",
}, },
{ {
value: "goods_type", value: "goods_type",
label: "种类", label: "种类",
}, },
{ {
value: "menu", value: "menu",
label: "菜单", label: "菜单",
}, },
{ {
value: "role", value: "role",
label: "角色", label: "角色",
}, },
{ {
value: "permission", value: "permission",
label: "权限", label: "权限",
}, },
{ {
value: "user", value: "user",
label: "用户", label: "用户",
}, },
{ {
value: "kuaituantuan", value: "kuaituantuan",
label: "快团团", label: "快团团",
}, },
{ {
value: "miaoxuan", value: "miaoxuan",
label: "秒选", label: "秒选",
}, },
{ {
value: "goods", value: "goods",
label: "商品", label: "商品",
}, },
],// ],//
userOptions: [], // userOptions: [], //
form: { form: {
module:'',// goods-(),'menu' => '',file-,permission-,role-,user-,plat- module: '',// goods-(),'menu' => '',file-,permission-,role-,user-,plat-
action:'',// POST-,PATCH-,DELETE-,'GET' => '', action: '',// POST-,PATCH-,DELETE-,'GET' => '',
target_type:'',// upload-,goods_sku,goods_brand-,goods_type-,menu-,permission-,role-,user-,kuaituantuan-,miaoxuan-,'goods' => '', target_type: '',// upload-,goods_sku,goods_brand-,goods_type-,menu-,permission-,role-,user-,kuaituantuan-,miaoxuan-,'goods' => '',
targetField: "",// targetField: "",//
userId: "",//id() userId: "",//id()
}, },
value1: "", // value1: "", //
tableData: [], // tableData: [], //
Paginationdata: {}, // Paginationdata: {}, //
current_page: 1, // current_page: 1, //
per_page: 15, // per_page: 15, //
}; };
}, },
methods: { methods: {
// //
getList() { getList() {
let page = { let page = {
page: this.current_page, page: this.current_page,
per_page: this.per_page, per_page: this.per_page,
}; };
recordList(page).then((res) => { recordList(page).then((res) => {
this.tableData = res.data.data; this.tableData = res.data.data;
this.Paginationdata = res.data.meta; this.Paginationdata = res.data.meta;
}); });
}, },
// //
getUser() { getUser() {
userList().then((res) => { userList().then((res) => {
this.userOptions = res.data.data; this.userOptions = res.data.data;
}); });
}, },
// //
query() { query() {
let queryData = { let queryData = {
page: this.current_page, page: this.current_page,
per_page: this.per_page, per_page: this.per_page,
module: this.form.module, module: this.form.module,
action:this.form.action, action: this.form.action,
target_type:this.form.target_type, target_type: this.form.target_type,
target_id: this.$route.query.id?this.$route.query.id:'', target_id: this.$route.query.id ? this.$route.query.id : '',
target_field: this.form.targetField?this.form.targetField:'', target_field: this.form.targetField ? this.form.targetField : '',
user_id: this.form.userId, user_id: this.form.userId,
start_time: this.value1[0]?this.value1[0]:'', start_time: this.value1[0] ? this.value1[0] : '',
end_time: this.value1[1]?this.value1[1]:'', end_time: this.value1[1] ? this.value1[1] : '',
}; };
recordList(queryData).then((res) => { recordList(queryData).then((res) => {
this.tableData = res.data.data; this.tableData = res.data.data;
this.Paginationdata = res.data.meta; this.Paginationdata = res.data.meta;
}); });
}, },
// //
handleSizeChange(val) { handleSizeChange(val) {
// //
this.per_page = val; this.per_page = val;
this.query(); this.query();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
// //
this.current_page = val; this.current_page = val;
this.query(); this.query();
}, },
}, },
mounted() { mounted() {
this.getList(); this.getList();
this.getUser(); this.getUser();
}, },
}; };
</script> </script>
<style scoped> <style lang="scss" scoped>
.block { .block {
margin-top: 30px; margin-top: 30px;
} }
::v-deep .el-card__body {
::v-deep .el-card__body {
padding: 0; padding: 0;
} }
</style> </style>

View File

@ -1,185 +1,177 @@
<template> <template>
<div> <div>
<!-- 筛选框 --> <!-- 筛选框 -->
<el-card class="box-card"> <el-card :body-style="{ padding: '20px 20px 0 20px' }">
<div class="goods" style="margin: 20px"> <el-form ref="form" :inline="true" :model="form">
<el-form ref="form" :inline="true" :model="form"> <el-form-item label="查询类别:">
<el-form-item label="查询类别:"> <el-select v-model="form.targetField" placeholder="全部">
<el-select v-model="form.targetField" placeholder="全部"> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-option> </el-select>
</el-select> </el-form-item>
</el-form-item> <el-form-item label="操作用户">
<el-form-item label="操作用户"> <el-select v-model="form.userId" placeholder="输入操作用户">
<el-select v-model="form.userId" placeholder="输入操作用户"> <el-option v-for="item in options1" :key="item.id" :label="item.name" :value="item.id">
<el-option v-for="item in options1" :key="item.id" :label="item.name" :value="item.id"> </el-option>
</el-option> </el-select>
</el-select> </el-form-item>
</el-form-item> <el-form-item label="操作时间:">
<el-form-item label="操作时间:"> <el-date-picker v-model="value1" type="datetimerange" range-separator="-" start-placeholder=""
<el-date-picker v-model="value1" type="datetimerange" range-separator="-" start-placeholder="" end-placeholder="止" value-format="yyyy-MM-dd HH:mm:ss">
end-placeholder="止" value-format="yyyy-MM-dd HH:mm:ss"> </el-date-picker>
</el-date-picker> </el-form-item>
</el-form-item> <el-form-item>
<el-form-item> <el-button type="primary" @click="query()">查询</el-button>
<el-button type="primary" @click="query()">查询</el-button> </el-form-item>
</el-form-item> </el-form>
</el-form> </el-card>
</div>
</el-card>
<!-- 表格 --> <!-- 表格 -->
<el-card style="margin-top: 30px" class="box-card"> <el-card style="margin-top: 30px">
<el-table :data="tableData" style="width: 100%" border> <el-table :data="tableData" style="width: 100%" border>
<el-table-column prop="id" label="序号" width="70"> </el-table-column> <el-table-column prop="id" label="序号" width="70"> </el-table-column>
<el-table-column prop="created_at" label="时间" width="200"> <el-table-column prop="created_at" label="时间" width="200">
</el-table-column> </el-table-column>
<el-table-column prop="target_field" label="类别" width="100"> <el-table-column prop="target_field" label="类别" width="100">
</el-table-column> </el-table-column>
<el-table-column prop="before_update" label="操作前" :resizable="ture"> <el-table-column prop="before_update" label="操作前" :resizable="ture">
</el-table-column> </el-table-column>
<el-table-column prop="after_update" label="操作后" :resizable="ture"> <el-table-column prop="after_update" label="操作后" :resizable="ture">
</el-table-column> </el-table-column>
<el-table-column prop="user.name" label="操作人" width="100"> <el-table-column prop="user.name" label="操作人" width="100">
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-card> </el-card>
<!-- 分页功能 --> <!-- 分页功能 -->
<div class="block"> <div class="block">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="current_page" <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:page-sizes="[15, 50, 100]" :page-size="per_page" layout="total, sizes, prev, pager, next, jumper" :current-page="current_page" :page-sizes="[15, 50, 100]" :page-size="per_page"
:total="Paginationdata.total"> layout="total, sizes, prev, pager, next, jumper" :total="Paginationdata.total">
</el-pagination> </el-pagination>
</div>
</div> </div>
</div>
</template> </template>
<script> <script>
import { userList } from "../../api/user"; import { userList } from "../../api/user";
import { recordList } from "../../api/record"; import { recordList } from "../../api/record";
export default { export default {
data() { data() {
return { return {
options: [ options: [
{ {
value: "cost", value: "cost",
label: "成本", label: "成本",
}, },
{ {
value: "stock", value: "stock",
label: "库存", label: "库存",
}, },
{ {
value: "inventory", value: "inventory",
label: "库存盘点", label: "库存盘点",
}, },
{ {
value: "status", value: "status",
label: "状态", label: "状态",
}, },
{ {
value: "set", value: "set",
label: "设置", label: "设置",
}, },
], // ], //
options1: [], // options1: [], //
form: { form: {
targetField: "", targetField: "",
userId: "", userId: "",
}, },
value1: "", // value1: "", //
tableData: [], // tableData: [], //
Paginationdata: {}, // Paginationdata: {}, //
current_page: 1, // current_page: 1, //
per_page: 15, // per_page: 15, //
moudule: "goods", moudule: "goods",
}; };
}, },
methods: { methods: {
// //
getList() { getList() {
let queryData = { let queryData = {
userId: this.form.userId, userId: this.form.userId,
target_field: this.form.targetField, target_field: this.form.targetField,
moudule: this.moudule, moudule: this.moudule,
target_id: this.$route.query.id, target_id: this.$route.query.id,
startTime: this.value1[0], startTime: this.value1[0],
endTime: this.value1[1], endTime: this.value1[1],
page: this.current_page, page: this.current_page,
per_page: this.per_page, per_page: this.per_page,
}; };
recordList(queryData).then((res) => { recordList(queryData).then((res) => {
this.tableData = res.data.data; this.tableData = res.data.data;
this.Paginationdata = res.data.meta; this.Paginationdata = res.data.meta;
}); });
}, },
// //
handleSizeChange(val) { handleSizeChange(val) {
// //
this.per_page = val; this.per_page = val;
this.query(); this.query();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
// //
this.current_page = val; this.current_page = val;
this.query(); this.query();
}, },
// //
getUser() { getUser() {
userList().then((res) => { userList().then((res) => {
this.options1 = res.data.data; this.options1 = res.data.data;
}); });
}, },
// //
query() { query() {
let queryData = { let queryData = {
userId: this.form.userId, userId: this.form.userId,
target_field: this.form.targetField, target_field: this.form.targetField,
page: this.current_page, page: this.current_page,
per_page: this.per_page, per_page: this.per_page,
moudule: this.moudule, moudule: this.moudule,
target_id: this.$route.query.id, target_id: this.$route.query.id,
startTime: this.value1[0], startTime: this.value1[0],
endTime: this.value1[1], endTime: this.value1[1],
}; };
// //
const newObj = filterParams(queryData); const newObj = filterParams(queryData);
function filterParams(obj) { function filterParams(obj) {
const _newPar = {}; const _newPar = {};
for (const key in obj) { for (const key in obj) {
// 0 // 0
if ( if (
(obj[key] === 0 || obj[key]) && (obj[key] === 0 || obj[key]) &&
obj[key].toString().replace(/(^\s*)|(\s*$)/g, "") !== "" obj[key].toString().replace(/(^\s*)|(\s*$)/g, "") !== ""
) { ) {
// //
_newPar[key] = obj[key]; _newPar[key] = obj[key];
}
}
//
return _newPar;
} }
}
//
return _newPar;
}
recordList(newObj).then((res) => { recordList(newObj).then((res) => {
this.tableData = res.data.data; this.tableData = res.data.data;
this.Paginationdata = res.data.meta; this.Paginationdata = res.data.meta;
}); });
}, },
}, },
mounted() { mounted() {
this.getList(); this.getList();
this.getUser(); this.getUser();
}, },
}; };
</script> </script>
<style>
.block {
margin-top: 30px;
}
</style>

View File

@ -1,188 +1,164 @@
<template> <template>
<div class="conent"> <div class="conent">
<!-- 新增按钮 --> <!-- 新增按钮 -->
<div class="btn"> <el-button type="primary" @click="handAdd">新增</el-button>
<el-button type="primary" @click="handAdd">新增</el-button>
</div>
<div class="table"> <div class="table">
<el-table :data="tableData" style="width: 100%"> <el-table :data="tableData" style="width: 100%">
<el-table-column prop="id" label="ID" width="180"> </el-table-column> <el-table-column prop="id" label="ID" width="180"> </el-table-column>
<el-table-column prop="name" label="店铺名称" width="180"> <el-table-column prop="name" label="店铺名称" width="180">
</el-table-column> </el-table-column>
<el-table-column prop="plat_id" label="所属平台"></el-table-column> <el-table-column prop="plat_id" label="所属平台"></el-table-column>
<el-table-column label="操作"> <el-table-column label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="danger" v-if="scope.row.status === '未授权'"><a :href="scope.row.authUrl" target="_blank" <el-button type="danger" v-if="scope.row.status === '未授权'"><a :href="scope.row.authUrl"
rel="noopener noreferrer">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></el-button> target="_blank"
<div v-if="scope.row.status === '已授权'"> rel="noopener noreferrer">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
<el-button type="success" :disabled="true">{{ </el-button>
scope.row.status <div v-if="scope.row.status === '已授权'">
}}</el-button> <el-button type="success" :disabled="true">{{
<el-button @click="download(scope.row)">下载商品</el-button> scope.row.status
}}</el-button>
<el-button @click="download(scope.row)">下载商品</el-button>
</div>
<div v-if="scope.row.status === '重新授权'">
<el-button type="danger" target="_blank"><a :href="scope.row.authUrl"
rel="noopener noreferrer">重新授权</a>
</el-button>
<el-button @click="download(scope.row)">下载商品</el-button>
</div>
<div v-if="scope.row.status === '无需授权'">
<el-button type="success" :disabled="true">{{
scope.row.status
}}</el-button>
<el-button @click="download(scope.row)">下载商品</el-button>
</div>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页功能 -->
<div class="block">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page="current_page" :page-sizes="[15, 50, 100]" :page-size="per_page"
layout="total, sizes, prev, pager, next, jumper" :total="Paginationdata.total">
</el-pagination>
</div>
<!-- 新增店铺 -->
<el-dialog title="新增店铺" :visible.sync="dialogFormVisible" :close-on-click-modal="false">
<el-form :model="form">
<el-form-item label="店铺名称">
<el-input v-model="form.name" placeholder="输入店铺名称"></el-input>
</el-form-item>
<el-form-item label="店铺平台">
<el-select v-model="form.plat_id" placeholder="输入店铺平台">
<el-option v-for="(item, index) in storeId" :key="index" :label="item" :value="index">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="addSubmit"> </el-button>
</div> </div>
<div v-if="scope.row.status === '重新授权'"> </el-dialog>
<el-button type="danger" target="_blank"><a :href="scope.row.authUrl" rel="noopener noreferrer">重新授权</a>
</el-button>
<el-button @click="download(scope.row)">下载商品</el-button>
</div>
<div v-if="scope.row.status === '无需授权'">
<el-button type="success" :disabled="true">{{
scope.row.status
}}</el-button>
<el-button @click="download(scope.row)">下载商品</el-button>
</div>
</template>
</el-table-column>
</el-table>
</div> </div>
<!-- 新增店铺 -->
<el-dialog title="新增店铺" :visible.sync="dialogFormVisible" :close-on-click-modal="false">
<el-form :model="form">
<el-form-item label="店铺名称">
<el-input v-model="form.name" placeholder="输入店铺名称"></el-input>
</el-form-item>
<el-form-item label="店铺平台">
<el-select v-model="form.plat_id" placeholder="输入店铺平台">
<el-option v-for="(item, index) in storeId" :key="index" :label="item" :value="index">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="addSubmit"> </el-button>
</div>
</el-dialog>
<!-- 分页功能 -->
<div class="block">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="current_page"
:page-sizes="[15, 50, 100]" :page-size="per_page" layout="total, sizes, prev, pager, next, jumper"
:total="Paginationdata.total">
</el-pagination>
</div>
</div>
</template> </template>
<script> <script>
import { shopListId, shopAdd, storeList, downloadGoods } from "../../api/shop"; import { shopListId, shopAdd, storeList, downloadGoods } from "../../api/shop";
export default { export default {
data() { data() {
return { return {
dialogFormVisible: false, dialogFormVisible: false,
form: { form: {
name: "", name: "",
plat_id: "", plat_id: "",
}, },
storeId: [], // id storeId: [], // id
tableData: [], tableData: [],
Paginationdata: {}, // Paginationdata: {}, //
current_page: 1, // current_page: 1, //
per_page: 15, // per_page: 15, //
}; };
}, },
mounted() { mounted() {
// //
this.getStoreList(); this.getStoreList();
}, },
methods: { methods: {
// //
handAdd() { handAdd() {
this.form.name = ""; this.form.name = "";
this.form.plat_id = ""; this.form.plat_id = "";
this.dialogFormVisible = true; this.dialogFormVisible = true;
this.getshop(); this.getshop();
}, },
// //
addSubmit() { addSubmit() {
const datas = this.form; const datas = this.form;
shopAdd(datas).then((res) => { shopAdd(datas).then((res) => {
if (res.status == 200) { if (res.status == 200) {
this.$message({ this.$message({
type: "success", type: "success",
message: "添加成功", message: "添加成功",
});
}
this.getStoreList();
}); });
} this.dialogFormVisible = false;
this.getStoreList(); },
});
this.dialogFormVisible = false;
},
// //
getStoreList() { getStoreList() {
let page = { let page = {
page: this.current_page, page: this.current_page,
per_page: this.per_page, per_page: this.per_page,
}; };
storeList(page).then((res) => { storeList(page).then((res) => {
this.tableData = res.data.data; this.tableData = res.data.data;
this.Paginationdata = res.data.meta; this.Paginationdata = res.data.meta;
}); });
}, },
// //
handleSizeChange(val) { handleSizeChange(val) {
// //
this.per_page = val; this.per_page = val;
this.getStoreList(); this.getStoreList();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
// //
this.current_page = val; this.current_page = val;
this.getStoreList(); this.getStoreList();
}, },
// //
getshop() { getshop() {
shopListId().then((res) => { shopListId().then((res) => {
this.storeId = res.data.data; this.storeId = res.data.data;
}); });
}, },
// //
download(row) { download(row) {
downloadGoods(row.id).then((res) => { downloadGoods(row.id).then((res) => {
}); });
}, },
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
a { a {
text-decoration: none; text-decoration: none;
color: white; color: white;
} }
.block {
.conent {
width: 100%;
min-height: calc(100vh - 200px);
position: relative;
}
.btn {
height: 104px;
border-radius: 5px;
display: flex;
align-items: center;
}
.el-button {
width: 114px;
height: 44px;
border-radius: 3px;
}
.table {
margin-top: 20px;
}
.block {
margin-top: 30px; margin-top: 30px;
} }
</style> </style>

View File

@ -1,189 +1,159 @@
<template> <template>
<div class="conent"> <div class="conent">
<!-- 新增按钮 --> <!-- 点击新增弹出表单 -->
<div class="btn"> <div class="from">
<el-button type="primary" @click="dialogVisible2 = true">新增</el-button> <el-dialog title="新增角色" :visible.sync="dialogVisible2" width="30%" :close-on-click-modal="false">
</div> <div>
<el-form label-width="80px">
<!-- 点击新增弹出表单 --> <el-form-item label="角色名称">
<div class="from"> <el-input v-model="newrole"></el-input>
<el-dialog title="新增角色" :visible.sync="dialogVisible2" width="30%" :close-on-click-modal="false"> </el-form-item>
<div> <div class="from-btn">
<el-form label-width="80px"> <el-button type="danger" @click="dialogVisible2 = false">取消</el-button>
<el-form-item label="角色名称"> <el-button @click="onSubmit">确认</el-button>
<el-input v-model="newrole"></el-input> </div>
</el-form-item> </el-form>
<div class="from-btn"> </div>
<el-button type="danger" @click="dialogVisible2 = false">取消</el-button> </el-dialog>
<el-button @click="onSubmit">确认</el-button>
</div>
</el-form>
</div> </div>
</el-dialog>
</div>
<!-- 角色表单 --> <!-- 新增按钮 -->
<div class="table"> <el-button type="primary" @click="dialogVisible2 = true">新增</el-button>
<el-table :data="tableList" style="width: 100%">
<el-table-column prop="id" label="ID"> </el-table-column>
<el-table-column prop="name" label="角色名称"> </el-table-column>
<el-table-column label="权限内容">
<template slot-scope="scope">
<span v-for="item in scope.row.permissions" :key="item.id">{{ item.name }}&nbsp;</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button @click="onEdit(scope.row)">编辑</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 点击编辑弹出权限框 --> <!-- 角色列表 -->
<el-dialog title="编辑权限" :visible.sync="dialogVisible" width="30%" :close-on-click-modal="false"> <div class="table">
<el-tree v-if="isShowtree" :data="Role_Permission" show-checkbox :default-expand-all="false" node-key="id" <el-table :data="tableList" style="width: 100%">
ref="tree" highlight-current :props="defaultProps" :default-checked-keys="chekedKeys" v-model="permissionIds"> <el-table-column prop="id" label="ID"> </el-table-column>
</el-tree> <el-table-column prop="name" label="角色名称"> </el-table-column>
<span slot="footer" class="dialog-footer"> <el-table-column label="权限内容">
<el-button @click="cancel()"> </el-button> <template slot-scope="scope">
<el-button type="primary" @click="getCheckedKeys()"> </el-button> <span v-for="item in scope.row.permissions" :key="item.id">{{ item.name }}&nbsp;</span>
</span> </template>
</el-dialog> </el-table-column>
</div> <el-table-column label="操作">
<template slot-scope="scope">
<el-button @click="onEdit(scope.row)">编辑</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 点击编辑弹出权限框 -->
<el-dialog title="编辑权限" :visible.sync="dialogVisible" width="30%" :close-on-click-modal="false">
<el-tree v-if="isShowtree" :data="Role_Permission" show-checkbox :default-expand-all="false" node-key="id"
ref="tree" highlight-current :props="defaultProps" :default-checked-keys="chekedKeys"
v-model="permissionIds">
</el-tree>
<span slot="footer" class="dialog-footer">
<el-button @click="cancel()"> </el-button>
<el-button type="primary" @click="getCheckedKeys()"> </el-button>
</span>
</el-dialog>
</div>
</template> </template>
<script> <script>
import { import {
roleList, roleList,
roleAdd, roleAdd,
jurisdiction, jurisdiction,
jurisdictionEdit, jurisdictionEdit,
} from "../../api/role.js"; } from "../../api/role.js";
export default { export default {
data() { data() {
return { return {
id: "", //id id: "", //id
tableList: [], // tableList: [], //
rolePermissions: [], rolePermissions: [],
newrole: "", //input newrole: "", //input
dialogVisible: false, // dialogVisible: false, //
dialogVisible2: false, // dialogVisible2: false, //
permissionIds: [], //ID permissionIds: [], //ID
allpermissionIds: {}, //id allpermissionIds: {}, //id
Role_Permission: [], // Role_Permission: [], //
defaultProps: { defaultProps: {
children: "children", children: "children",
label: "name", label: "name",
}, },
isShowtree: false, isShowtree: false,
chekedKeys: [], chekedKeys: [],
}; };
}, },
mounted() { mounted() {
this.getroleList(); this.getroleList();
this.getJurisdiction(); this.getJurisdiction();
}, },
methods: { methods: {
// //
getroleList() { getroleList() {
roleList().then((res) => { roleList().then((res) => {
this.tableList = res.data.data; this.tableList = res.data.data;
});
},
//
getJurisdiction() {
jurisdiction().then((res) => {
this.Role_Permission = res.data.data;
});
},
//
onSubmit() {
let roleName = {
name: this.newrole,
};
roleAdd(roleName).then((res) => {
this.dialogVisible2 = false;
this.getroleList();
if (res.status == 201) {
this.$message({
message: "角色添加成功!",
type: "success",
}); });
} },
});
},
// //
onEdit(row) { getJurisdiction() {
this.id = row.id; jurisdiction().then((res) => {
let arr = row.permissions.map((item) => { this.Role_Permission = res.data.data;
return item.id; });
}); },
this.chekedKeys = arr;
this.dialogVisible = true;
this.isShowtree = true;
},
// //
cancel() { onSubmit() {
this.dialogVisible = false; let roleName = {
this.isShowtree = false; name: this.newrole,
}, };
roleAdd(roleName).then((res) => {
this.dialogVisible2 = false;
this.getroleList();
if (res.status == 201) {
this.$message({
message: "角色添加成功!",
type: "success",
});
}
});
},
// //
getCheckedKeys() { onEdit(row) {
let id = this.id; //ID this.id = row.id;
this.permissionIds = this.$refs.tree.getCheckedKeys(); //ID let arr = row.permissions.map((item) => {
this.allpermissionIds = { return item.id;
permissionIds: this.permissionIds, });
}; this.chekedKeys = arr;
jurisdictionEdit(id, this.allpermissionIds).then((res) => { this.dialogVisible = true;
if (res.status === 200) { this.isShowtree = true;
},
//
cancel() {
this.dialogVisible = false; this.dialogVisible = false;
this.getroleList(); this.isShowtree = false;
this.$message({ },
message: "权限修改成功!",
type: "success", //
getCheckedKeys() {
let id = this.id; //ID
this.permissionIds = this.$refs.tree.getCheckedKeys(); //ID
this.allpermissionIds = {
permissionIds: this.permissionIds,
};
jurisdictionEdit(id, this.allpermissionIds).then((res) => {
if (res.status === 200) {
this.dialogVisible = false;
this.getroleList();
this.$message({
message: "权限修改成功!",
type: "success",
});
}
}); });
} },
});
},
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.conent { </style>
width: 100%;
min-height: calc(100vh - 200px);
}
.btn {
height: 104px;
border-radius: 5px;
display: flex;
align-items: center;
}
.el-button {
width: 114px;
height: 44px;
border-radius: 3px;
}
.table {
margin-top: 20px;
}
.from-btn {
display: flex;
justify-content: space-around;
align-content: center;
}
</style>

View File

@ -1,262 +1,233 @@
<template> <template>
<div class="conent"> <div class="conent">
<!-- 新增按钮 -->
<div class="btn">
<el-button type="primary" @click="dialogVisible = true">新增</el-button>
</div>
<!-- 点击新增弹出表单 --> <!-- 点击新增弹出表单 -->
<div class="from"> <div class="from">
<el-dialog title="新增用户" :visible.sync="dialogVisible" width="30%" :close-on-click-modal="false"> <el-dialog title="新增用户" :visible.sync="dialogVisible" width="30%" :close-on-click-modal="false">
<div> <div>
<el-form label-width="80px"> <el-form label-width="80px">
<el-form-item label="姓名"> <el-form-item label="姓名">
<el-input v-model="from.name"></el-input> <el-input v-model="from.name"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="密码"> <el-form-item label="密码">
<el-input v-model="from.password"></el-input> <el-input v-model="from.password"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="确认密码"> <el-form-item label="确认密码">
<el-input v-model="from.password_confirmation"></el-input> <el-input v-model="from.password_confirmation"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="角色"> <el-form-item label="角色">
<template> <template>
<el-select v-model="value" placeholder="请选择"> <el-select v-model="value" placeholder="请选择">
<el-option v-for="item in roleOptions" :key="item.value" :label="item.name" :value="item.name"> <el-option v-for="item in roleOptions" :key="item.value" :label="item.name"
</el-option> :value="item.name">
</el-select> </el-option>
</template> </el-select>
</el-form-item> </template>
<div class="from-btn"> </el-form-item>
<el-button type="danger" @click="dialogVisible = false">取消</el-button> <div class="from-btn">
<el-button @click="onSubmit">确认</el-button> <el-button type="danger" @click="dialogVisible = false">取消</el-button>
</div> <el-button @click="onSubmit">确认</el-button>
</el-form> </div>
</el-form>
</div>
</el-dialog>
</div> </div>
</el-dialog>
</div>
<!-- 点击编辑弹出表单信息 --> <!-- 点击编辑弹出表单信息 -->
<div class="edit_from"> <div class="edit_from">
<el-dialog title="编辑" :visible.sync="editVisible" width="30%" :close-on-click-modal="false"> <el-dialog title="编辑" :visible.sync="editVisible" width="30%" :close-on-click-modal="false">
<div> <div>
<el-form label-width="80px"> <el-form label-width="80px">
<el-form-item label="ID"> <el-form-item label="ID">
<el-input v-model="edit_from.id"></el-input> <el-input v-model="edit_from.id"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="姓名"> <el-form-item label="姓名">
<el-input v-model="edit_from.name"></el-input> <el-input v-model="edit_from.name"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="邮箱"> <el-form-item label="邮箱">
<el-input v-model="edit_from.email"></el-input> <el-input v-model="edit_from.email"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="角色"> <el-form-item label="角色">
<template> <template>
<el-select v-model="edit_from.role_name" placeholder="请选择"> <el-select v-model="edit_from.role_name" placeholder="请选择">
<el-option v-for="item in roleOptions" :key="item.value" :label="item.name" :value="item.name"> <el-option v-for="item in roleOptions" :key="item.value" :label="item.name"
</el-option> :value="item.name">
</el-select> </el-option>
</template> </el-select>
</el-form-item> </template>
<el-form-item label="密码"> </el-form-item>
<el-input v-model="edit_from.password"></el-input> <el-form-item label="密码">
</el-form-item> <el-input v-model="edit_from.password"></el-input>
<el-form-item label="密码确认"> </el-form-item>
<el-input v-model="edit_from.password_confirmation"></el-input> <el-form-item label="密码确认">
</el-form-item> <el-input v-model="edit_from.password_confirmation"></el-input>
<div class="from-btn"> </el-form-item>
<el-button type="danger" @click="editVisible = false">取消</el-button> <div class="from-btn">
<el-button @click="onEdit()">确认</el-button> <el-button type="danger" @click="editVisible = false">取消</el-button>
</div> <el-button @click="onEdit()">确认</el-button>
</el-form> </div>
</el-form>
</div>
</el-dialog>
</div> </div>
</el-dialog>
</div>
<!-- 用户列表 --> <!-- 新增按钮 -->
<div class="table"> <el-button type="primary" @click="dialogVisible = true">新增</el-button>
<template>
<el-table :data="tableList" style="width: 100%"> <!-- 用户列表 -->
<el-table-column prop="id" label="ID"></el-table-column> <div class="table">
<el-table-column prop="name" label="姓名"></el-table-column> <template>
<el-table-column label="角色"> <el-table :data="tableList" style="width: 100%">
<template slot-scope="scope">{{ <el-table-column prop="id" label="ID"></el-table-column>
scope.row.roles[0].name <el-table-column prop="name" label="姓名"></el-table-column>
}}</template> <el-table-column label="角色">
</el-table-column> <template slot-scope="scope">{{
<el-table-column label="操作"> scope.row.roles[0].name
<template slot-scope="scope"> }}</template>
<el-button @click="openEdit(scope.row)">编辑</el-button> </el-table-column>
<!-- <el-button type="danger">删除</el-button> --> <el-table-column label="操作">
<template slot-scope="scope">
<el-button @click="openEdit(scope.row)">编辑</el-button>
<!-- <el-button type="danger">删除</el-button> -->
</template>
</el-table-column>
</el-table>
</template> </template>
</el-table-column> </div>
</el-table>
</template>
</div>
<!-- 分页功能 --> <!-- 分页功能 -->
<div class="block"> <div class="block">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="current_page" <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:page-sizes="[15, 50, 100]" :page-size="per_page" layout="total, sizes, prev, pager, next, jumper" :current-page="current_page" :page-sizes="[15, 50, 100]" :page-size="per_page"
:total="Paginationdata.total"> layout="total, sizes, prev, pager, next, jumper" :total="Paginationdata.total">
</el-pagination> </el-pagination>
</div>
</div> </div>
</div>
</template> </template>
<script> <script>
import { import {
userList, userList,
userAdd, userAdd,
userEdit, userEdit,
userConfirm, userConfirm,
roleList, roleList,
} from "../../api/user"; } from "../../api/user";
export default { export default {
data() { data() {
return { return {
id: "", id: "",
dialogVisible: false, // dialogVisible: false, //
editVisible: false, // editVisible: false, //
tableList: [], // tableList: [], //
from: { from: {
// //
name: "", name: "",
password: "", password: "",
password_confirmation: "", password_confirmation: "",
role_name: "", role_name: "",
}, },
edit_from: { edit_from: {
// //
created_at: "", created_at: "",
deleted_at: null, deleted_at: null,
email: "", email: "",
id: "", id: "",
name: "", name: "",
password: "", password: "",
password_confirmation: "", password_confirmation: "",
role_name: "", role_name: "",
}, },
Paginationdata: {}, // Paginationdata: {}, //
current_page: 1, // current_page: 1, //
per_page: 15, // per_page: 15, //
roleOptions: [], // roleOptions: [], //
value: "", // value: "", //
}; };
}, },
mounted() { mounted() {
this.getList(); // this.getList(); //
this.getrole(); // this.getrole(); //
}, },
methods: { methods: {
// //
getrole() { getrole() {
roleList().then((res) => { roleList().then((res) => {
this.roleOptions = res.data.data; this.roleOptions = res.data.data;
}); });
}, },
// //
getList() { getList() {
let page = { let page = {
page: this.current_page, page: this.current_page,
per_page: this.per_page, per_page: this.per_page,
}; };
userList(page).then((res) => { userList(page).then((res) => {
this.tableList = res.data.data; this.tableList = res.data.data;
this.Paginationdata = res.data.meta; this.Paginationdata = res.data.meta;
}); });
}, },
// //
onSubmit() { onSubmit() {
this.from.role_name = this.value; this.from.role_name = this.value;
let from = this.from; let from = this.from;
userAdd(from).then((res) => { userAdd(from).then((res) => {
this.tableList = [...this.tableList, res.data.data]; this.tableList = [...this.tableList, res.data.data];
this.dialogVisible = false; this.dialogVisible = false;
this.getList(); this.getList();
this.from = {}; this.from = {};
this.$message({ this.$message({
message: "账号添加成功!", message: "账号添加成功!",
type: "success", type: "success",
}); });
}); });
}, },
// //
openEdit(e) { openEdit(e) {
this.editVisible = true; this.editVisible = true;
let id = e.id; let id = e.id;
this.id = e.id; this.id = e.id;
// id // id
userEdit(id).then((res) => { userEdit(id).then((res) => {
this.edit_from = res.data.data; this.edit_from = res.data.data;
}); });
}, },
// //
onEdit() { onEdit() {
userConfirm(this.id, this.edit_from).then((res) => { userConfirm(this.id, this.edit_from).then((res) => {
this.tableList = [...this.tableList, res.data.data]; this.tableList = [...this.tableList, res.data.data];
this.editVisible = false; this.editVisible = false;
this.getList(); this.getList();
this.$message({ this.$message({
message: "账号修改成功!", message: "账号修改成功!",
type: "success", type: "success",
}); });
}); });
this.editVisible = false; this.editVisible = false;
}, },
// //
handleSizeChange(val) { handleSizeChange(val) {
// //
this.per_page = val; this.per_page = val;
this.getList(); this.getList();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
// //
this.current_page = val; this.current_page = val;
this.getList(); this.getList();
}, },
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.conent { .block {
width: 100%;
min-height: calc(100vh - 200px);
position: relative;
}
.btn {
height: 104px;
border-radius: 5px;
display: flex;
align-items: center;
}
.el-button {
width: 114px;
height: 44px;
border-radius: 3px;
}
.table {
margin-top: 20px;
}
.from-btn {
display: flex;
justify-content: space-around;
align-content: center;
}
.block {
margin-top: 30px; margin-top: 30px;
} }
</style> </style>