Merge pull request '提交测试1' (#8) from 王兆华 into main

王佳龙
pk6txuy2w 4 months ago
commit e3f14e0369

@ -1,38 +1,57 @@
<template>
<!-- 根容器 -->
<div>
<!-- 面包屑导航使用 "/" 作为分隔符 -->
<el-breadcrumb separator="/">
<!-- 面包屑的首页项 -->
<el-breadcrumb-item>首页</el-breadcrumb-item>
</el-breadcrumb><br />
</el-breadcrumb>
<!-- 换行 -->
<br />
<!-- 具有 id home_bg div 容器用于展示欢迎信息和背景图片 -->
<div id="home_bg">
<h1 style="color: white;font-size: 28px;text-align: center;width: 1024px;">欢迎访问超市管理系统</h1>
<!-- 一级标题设置文本颜色为白色字体大小为 28px文本居中对齐宽度为 1024px -->
<h1 style="color: white;font-size: 28px;text-align: center;width: 1024px;">欢迎访问电商管理系统</h1>
</div>
</div>
</template>
<script>
// Vue
export default {
//
data() {
return {
//
};
},
//
methods: {
//
},
//
mounted() {
//
},
};
</script>
<style>
/* 选择 id 为 home_bg 的元素进行样式设置 */
#home_bg {
/* 元素顶部与父元素顶部对齐 */
top: 0;
/* 元素左侧与父元素左侧对齐 */
left: 0;
/* 当内容超过容器高度时,显示垂直滚动条 */
overflow-y: auto;
/* 设置容器高度为视口高度的 80% */
height: 80vh;
/* 设置背景图片为指定路径下的 55.png 文件 */
background-image: url("../assets/55.png");
/* 背景图片不重复显示 */
background-repeat: no-repeat;
/* 文本居中对齐 */
text-align: center;
}
</style>

@ -1,24 +1,36 @@
<template>
<!-- 页面的根容器类名为 container -->
<div class="container">
<!-- 用于登录表单的容器宽度占比 25%使用 flex 布局背景颜色为半透明白色 -->
<div style="width: 25%; display: flex;background-color: rgba(255,255,255,0.9);">
<!-- 内部容器flex 占比为 1宽度 50%内边距 40px使用 flex 列布局内容垂直居中 -->
<div style="flex: 1;width: 50%;padding: 40px;display: flex;flex-direction: column;justify-content: center;" >
<div style="text-align: center; font-size: 28px; margin-bottom: 20px; color: #0481de;font-weight: bold;"> </div>
<!-- 显示系统名称的文本居中对齐字体大小 28px颜色为 #0481de加粗 -->
<div style="text-align: center; font-size: 28px; margin-bottom: 20px; color: #0481de;font-weight: bold;"> </div>
<!-- 换行 -->
<br>
<!-- 表单组件绑定数据到 loginForm引用为 loginForm类名为 demo-ruleForm -->
<el-form :model="loginForm" ref="loginForm" class="demo-ruleForm">
<!-- 账号表单项 -->
<el-form-item prop="username">
<!-- 行布局 -->
<el-row>
<!-- 左侧列 2 列宽度文本右对齐 -->
<el-col :span="2" style="text-align: right">
<!-- 显示用户图标字体大小 26px颜色为灰色 -->
<i
class="iconfont icon-r-user1"
style="font-size: 26px;color: grey;"
>
</i>
</el-col>
<!-- 右侧列 22 列宽度文本左对齐左侧内边距 10px -->
<el-col
:span="22"
style="text-align: left; padding-left: 10px"
>
<!-- 输入框双向绑定到 loginForm username 属性用于输入账号 -->
<el-input
v-model="loginForm.username"
placeholder="账号"
@ -27,19 +39,25 @@
</el-row>
</el-form-item>
<!-- 密码表单项 -->
<el-form-item prop="password">
<!-- 行布局 -->
<el-row>
<!-- 左侧列 2 列宽度文本右对齐 -->
<el-col :span="2" style="text-align: right">
<!-- 显示锁图标字体大小 26px颜色为灰色 -->
<i
class="iconfont icon-r-lock"
style="font-size: 26px;color: grey;"
>
</i>
</el-col>
<!-- 右侧列 22 列宽度文本左对齐左侧内边距 10px -->
<el-col
:span="22"
style="text-align: left; padding-left: 10px"
>
<!-- 密码输入框双向绑定到 loginForm password 属性用于输入密码 -->
<el-input
type="password"
v-model="loginForm.password"
@ -48,15 +66,18 @@
</el-col>
</el-row>
</el-form-item>
<!-- 换行 -->
<br>
<!-- 提交按钮表单项 -->
<el-form-item>
<!-- 提交按钮字体大小 18px宽度 100%类型为 primary点击触发 submitForm 方法 -->
<el-button
style="font-size: 18px;width: 100%"
type="primary"
@click="submitForm('loginForm')"
>
登录</el-button
>
登录
</el-button>
</el-form-item>
</el-form>
</div>
@ -68,12 +89,10 @@
</div>
</template>
<style>
/* 根容器样式,高度为视口高度 100vh隐藏溢出内容设置背景图片使用 flex 布局,内容垂直水平居中,文本颜色为 #666 */
.container {
height: 100vh;
overflow: hidden;
/*background-color: #005aff;*/
background-image: url("../assets/bg1.png");
background-size: 100% 100%;
display: flex;
@ -81,6 +100,7 @@
justify-content: center;
color: #666;
}
/* 具有 id 为 login 的元素样式,固定定位,覆盖整个页面,隐藏垂直溢出内容,设置背景图片 */
#login {
position: fixed;
top: 0;
@ -91,6 +111,7 @@
background: url("../assets/img/01.jpg") center top / cover no-repeat;
}
/* 登录表单样式,白色背景,宽度 400px高度 280px居中显示文本居中上内边距 10px边框样式、颜色和圆角设置透明度 0.9 */
.loginForm {
background-color: white;
width: 400px;
@ -104,29 +125,37 @@
opacity: 0.9;
}
/* 登录表单内输入框样式,宽度 260px */
.loginForm input {
width: 260px;
}
/* h3 标签样式,上下外边距 10px */
h3 {
margin: 10px 0;
}
/* 登录表单内按钮样式,右侧外边距 40px */
.loginForm button {
margin-right: 40px;
}
</style>
<script>
// ajaxPost
import { ajaxPost, popup } from "@/assets/js/common";
// Cookies
import Cookies from "js-cookie";
export default {
//
data() {
return {
//
loginForm: {
username: "",
password: "",
},
// 5 8
rules: {
username: [
{
@ -151,13 +180,16 @@ export default {
},
};
},
//
methods: {
//
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
ajaxPost("/login", this.loginForm).then((res) => {
res = res.data;
if (res.code == 200) {
// token employee cookie 1/48
Cookies.set("token", res.data.token, {
expires: 1 / 48,
});
@ -166,17 +198,21 @@ export default {
JSON.stringify(res.data.employee),
{ expires: 1 / 48 }
);
//
popup("登录成功,请稍等...");
this.$router.push("/index");
} else {
//
popup(res.msg, "warning");
}
});
} else {
//
popup("账号或密码格式不正确!", "error");
}
});
},
// resetFields
resetForm(formName) {
this.$refs[formName].resetFields();
},

@ -1,25 +1,34 @@
<template>
<!-- 使用 el-container 布局容器 -->
<el-container>
<!-- 页面头部区域设置高度为 80px -->
<el-header style="height: 80px">
<!-- 行布局 -->
<el-row>
<!-- 左侧列 12 列宽度设置顶部外边距为 20px -->
<el-col :span="12" style="margin-top: 20px">
<!-- 显示系统图标和名称 -->
<i
style="color: white; font-size: 32px"
class="iconfont icon-r-building"
>
<b style="font-size: 26px"> 超市管理系统</b></i
<b style="font-size: 26px"> 电商管理系统</b></i
>
</el-col>
<!-- 右侧列 12 列宽度文本右对齐设置顶部外边距为 15px鼠标指针为手型 -->
<el-col
:span="12"
style="text-align: right; margin-top: 15px; cursor: pointer"
>
<!-- 下拉菜单组件 -->
<el-dropdown>
<!-- 头像组件设置大小为 50形状为方形头像图片来源 -->
<el-avatar
:size="50"
shape="square"
:src="BaseApi + circleUrl"
></el-avatar>
<!-- 显示用户类型管理员或用户和用户名 -->
<b
style="
font-size: 24px;
@ -31,17 +40,22 @@
{{ loginName }}</b
>
<!-- 下拉菜单内容 -->
<el-dropdown-menu slot="dropdown">
<!-- 个人资料完善菜单项点击触发 informationBtn 方法 -->
<el-dropdown-item @click.native="informationBtn">个人资料完善</el-dropdown-item>
<!-- 退出菜单项点击触发 empExit 方法 -->
<el-dropdown-item @click.native="empExit">退出</el-dropdown-item>
<!-- 注销菜单项点击将 logoutVisable 设置为 true显示注销账户对话框 -->
<el-dropdown-item @click.native="logoutVisable = true">注销</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-col>
</el-row>
</el-header>
<!--注销账户-->
<!-- 注销账户对话框标题为注销账户双向绑定显示状态到 logoutVisable宽度为 70% -->
<el-dialog title="注销账户" :visible.sync="logoutVisable" width="70%">
<!-- 表单组件绑定数据到 logoutform设置验证规则引用为 logoutform -->
<el-form
:model="logoutform"
:rules="rules"
@ -49,18 +63,22 @@
label-width="100px"
class="demo-ruleForm"
>
<!-- 内容表单项输入框双向绑定到 logoutform content 属性 -->
<el-form-item label="内容" prop="content">
<el-input
v-model="logoutform.content"
placeholder="请填写“本人确定注销”"
placeholder="请填写‘本人确定注销’"
></el-input>
</el-form-item>
<!-- 确定和取消按钮表单项 -->
<el-form-item>
<!-- 确定按钮点击触发 logoutSubmit 方法传递表单引用 -->
<el-button
type="primary"
@click="logoutSubmit('logoutform')"
> </el-button
>
<!-- 取消按钮点击触发 logoutCel 方法传递表单引用 -->
<el-button @click="logoutCel('logoutform')"
> </el-button
>
@ -68,8 +86,11 @@
</el-form>
</el-dialog>
<!-- 另一个 el-container 布局容器 -->
<el-container>
<!-- 侧边栏宽度为 200px设置最小高度为 900px隐藏垂直滚动条 -->
<el-aside width="200px" style="overflow-y: hidden;min-height: 900px;">
<!-- 菜单组件设置背景颜色文本颜色激活文本颜色启用路由唯一打开 -->
<el-menu
background-color="#6495ED"
text-color="white"
@ -77,12 +98,15 @@
:unique-opened="true"
active-text-color="#FFDEAD"
>
<!-- 遍历 menu_catalogs 数组生成子菜单 -->
<el-submenu
v-for="item in menu_catalogs"
:key="item.id"
:index="item.id + ''"
>
<!-- 子菜单标题模板 -->
<template slot="title">
<!-- 显示菜单图标和标签 -->
<i
:class="item.icon"
style="font-size: 26px; color: white"
@ -90,12 +114,15 @@
<b style="font-size: 18px"> {{ item.label }}</b>
</i>
</template>
<!-- 菜单项组 -->
<el-menu-item-group>
<!-- 遍历子菜单的子项生成菜单项 -->
<el-menu-item
v-for="c in item.children"
:key="c.id"
:index="c.purl"
>
<!-- 显示菜单项图标和标签 -->
<i :class="c.icon" style="font-size: 24px"> </i>
<b style="font-size: 16px"> {{ c.label }}</b>
</el-menu-item>
@ -103,6 +130,7 @@
</el-submenu>
</el-menu>
</el-aside>
<!-- 主要内容区域显示路由视图 -->
<el-main>
<router-view />
</el-main>
@ -110,20 +138,32 @@
</el-container>
</template>
<script>
// cookie
import { clearCookie, loginEmp } from "@/assets/js/auth";
// ajaxGetajaxPost
import { ajaxGet, ajaxPost, popup } from "@/assets/js/common";
// Cookies
import Cookies from "js-cookie";
export default {
//
data() {
return {
// API Vuex store
BaseApi: this.$store.state.BaseApi,
//
logoutVisable: false,
//
loginName: "",
//
isAdmin: "",
//
logoutform: {},
// loginEmp
circleUrl: loginEmp().headImg,
//
menu_catalogs: [],
// content
rules: {
content: [
{
@ -135,23 +175,27 @@ export default {
},
};
},
//
methods: {
//
init() {
this.isAdmin = loginEmp().isAdmin;
this.loginName = loginEmp().nickName;
// GET
ajaxGet("/empMenu", {}).then((res) => {
res = res.data;
if (res.code == 200) {
//
this.menu_catalogs = res.data;
}
});
},
/*个人资料*/
/*个人资料完善方法,跳转到个人资料页面并弹出提示*/
informationBtn() {
this.$router.push("/personal/information");
popup("请完善个人的资料");
},
/*账户退出*/
/*账户退出方法,弹出确认对话框,确认后发送请求退出系统并清除 cookie跳转到首页*/
empExit() {
this.$confirm("确定要退出系统?", "警示", {
confirmButtonText: "确定",
@ -178,12 +222,13 @@ export default {
});
});
},
/*注销账户*/
/*注销账户取消方法,重置表单字段,清空表单数据,关闭对话框*/
logoutCel(formName) {
this.$refs[formName].resetFields();
this.logoutform = {};
this.logoutVisable = false;
},
/*注销账户提交方法,验证表单数据,通过后发送请求注销账户,成功后清除 cookie关闭对话框跳转到首页*/
logoutSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
@ -205,18 +250,21 @@ export default {
});
},
},
// init
mounted() {
this.init();
},
};
</script>
<style>
/* 头像样式,内联块显示,宽度 200px浮动到右侧 */
.avatar {
display: inline-block;
width: 200px;
float: right;
}
/* 个人资料下拉菜单样式白色背景绝对定位z 轴层级为 999999顶部距离 58px右侧距离 20px宽度 151px */
.personalFul {
background-color: #ffffff;
position: absolute;
@ -226,22 +274,16 @@ export default {
width: 151px;
}
/* .personalFul ul > li {
margin: 1px auto;
padding: 0px;
height: 20px;
color: #ffffff;
background-color: #6495ED;
list-style-type: none;
} */
/* 个人资料下拉菜单列表项鼠标悬停样式,背景颜色为 #fc4316 */
.personalFul ul > li:hover {
background-color: #fc4316;
}
/* 菜单项图标颜色为白色 */
.el-menu-item i {
color: white;
}
/* 子菜单标题图标颜色为白色 */
.el-submenu__title i {
color: white;
}

@ -1,27 +1,44 @@
<template>
<!-- 定义组件的根元素设置唯一的 ID -->
<div id="detail_store_goods_in">
<!-- 使用 Element UI 的面包屑导航组件 -->
<el-breadcrumb separator="/">
<!-- 面包屑导航的第一个项目显示首页 -->
<el-breadcrumb-item>首页</el-breadcrumb-item>
<!-- 面包屑导航的第二个项目显示库存管理 -->
<el-breadcrumb-item>库存管理 </el-breadcrumb-item>
<el-breadcrumb-item>入库明细</el-breadcrumb-item> </el-breadcrumb
><br />
<!-- 面包屑导航的第三个项目显示入库明细 -->
<el-breadcrumb-item>入库明细</el-breadcrumb-item>
</el-breadcrumb>
<!-- 换行 -->
<br />
<!-- 使用 Element UI 的行布局组件 -->
<el-row>
<!-- 列布局组件 3 份宽度设置左对齐和右侧内边距 -->
<el-col :span="3" style="text-align: left;padding-right: 10px;">
<!-- 输入框组件用于输入入库编号使用 v-model 双向绑定 searchForm.cn -->
<el-input placeholder="入库编号" v-model="searchForm.cn"/>
</el-col>
<!-- 列布局组件 3 份宽度 -->
<el-col :span="3">
<!-- 输入框组件用于输入商品名称使用 v-model 双向绑定 searchForm.goodsName -->
<el-input placeholder="商品名称" v-model="searchForm.goodsName"/>
</el-col>
<!-- 列布局组件 16 份宽度 -->
<el-col :span="16">
<!-- 显示入库时间文本 -->
<span>入库时间</span>
<!-- 日期选择器组件用于选择起始时间设置日期格式使用 v-model 双向绑定 searchForm.startCreateTime -->
<el-date-picker
value-format="yyyy-MM-dd"
v-model="searchForm.startCreateTime"
type="date"
placeholder="起始时间">
</el-date-picker>
<!-- 显示分隔符- -->
-
<!-- 日期选择器组件用于选择结束时间设置日期格式使用 v-model 双向绑定 searchForm.endCreateTime -->
<el-date-picker
v-model="searchForm.endCreateTime"
value-format="yyyy-MM-dd"
@ -29,135 +46,192 @@
placeholder="结束时间">
</el-date-picker>
</el-col>
<!-- 列布局组件 2 份宽度 -->
<el-col :span="2">
<!-- 下拉选择框组件用于选择状态使用 v-model 双向绑定 searchForm.state1选择变化时强制更新视图 -->
<el-select
v-model="searchForm.state1"
@change="$forceUpdate()"
placeholder="请选择状态" clearable>
<!-- 下拉选项标签为正常值为0 -->
<el-option label="正常" value="0"></el-option>
<!-- 下拉选项标签为删除值为1 -->
<el-option label="删除" value="1"></el-option>
</el-select>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 使用 Element UI 的行布局组件 -->
<el-row>
<!-- 列布局组件 24 份宽度设置左对齐 -->
<el-col :span="24" style="text-align: left">
<!-- 按钮组件类型为主要按钮点击时调用 submitSearchForm 方法设置字体大小 -->
<el-button
type="primary"
@click="submitSearchForm"
style="font-size: 18px"
>
<i class="iconfont icon-r-find" style="font-size: 18px">
</i>
<!-- 图标元素设置图标样式和大小 -->
<i class="iconfont icon-r-find" style="font-size: 18px"> </i>
搜索</el-button
>
<!-- 警告类型的按钮点击时调用 goodsInBtn 方法设置字体大小 -->
<el-button
type="warning"
@click="goodsInBtn"
style="font-size: 18px"
>
<!-- 图标元素设置图标样式和大小 -->
<i class="iconfont icon-r-right" style="font-size: 18px"> </i>
<!-- 按钮文本显示商品入库 -->
商品入库
</el-button>
</el-col>
</el-row>
<br />
<!-- 定义一个类名为 table div 元素用于包裹表格组件 -->
<div class="table">
<!-- 使用 Element UI 的表格组件数据绑定到 tableData设置表格宽度和大小 -->
<el-table
:data="tableData"
style="width: 100%;"
size="medium">
size="medium"
>
<!-- 表格列组件展示编号数据绑定到 cn 属性设置列宽度 -->
<el-table-column
prop="cn"
width="200"
label="编号">
label="编号"
>
</el-table-column>
<!-- 表格列组件展示商品名数据绑定到 goodsName 属性设置超出显示 tooltip -->
<el-table-column
prop="goodsName"
:show-overflow-tooltip="true"
label="商品名">
label="商品名"
>
</el-table-column>
<!-- 表格列组件展示单价数据绑定到 goodsPrice 属性 -->
<el-table-column
prop="goodsPrice"
label="单价">
label="单价"
>
</el-table-column>
<!-- 表格列组件展示入库数量数据绑定到 goodsNum 属性 -->
<el-table-column
prop="goodsNum"
label="入库数量">
label="入库数量"
>
</el-table-column>
<!-- 表格列组件展示过期日期数据绑定到 expiryTime 属性设置超出显示 tooltip -->
<el-table-column
prop="expiryTime"
:show-overflow-tooltip="true"
label="过期日期">
label="过期日期"
>
</el-table-column>
<!-- 表格列组件展示是否过期数据绑定到 expiryTime 属性设置超出显示 tooltip -->
<el-table-column
prop="expiryTime"
:show-overflow-tooltip="true"
label="是否过期">
label="是否过期"
>
<!-- 自定义列内容的模板 -->
<template v-slot="scope">
<!-- 如果当前日期大于过期日期显示过期标签标签类型为危险 -->
<el-tag type="danger" v-if="new Date()>Date.parse(scope.row.expiryTime)"></el-tag>
<!-- 否则显示未过期标签标签类型为成功 -->
<el-tag type="success" v-else></el-tag>
</template>
</el-table-column>
<!-- 表格列组件展示入库时间数据绑定到 createTime 属性设置超出显示 tooltip -->
<el-table-column
prop="createTime"
:show-overflow-tooltip="true"
label="入库时间">
label="入库时间"
>
</el-table-column>
<!-- 表格列组件展示存储仓库数据绑定到 storeName 属性设置超出显示 tooltip -->
<el-table-column
prop="storeName"
:show-overflow-tooltip="true"
label="存储仓库">
label="存储仓库"
>
</el-table-column>
<!-- 表格列组件展示供货商数据绑定到 supplierName 属性设置超出显示 tooltip -->
<el-table-column
prop="supplierName"
:show-overflow-tooltip="true"
label="供货商">
label="供货商"
>
</el-table-column>
<!-- 表格列组件展示录入者数据绑定到 createby 属性设置超出显示 tooltip -->
<el-table-column
prop="createby"
:show-overflow-tooltip="true"
label="录入者">
label="录入者"
>
</el-table-column>
<!-- 表格列组件展示类型数据绑定到 state 属性 -->
<el-table-column
prop="state"
label="类型">
label="类型"
>
<!-- 自定义列内容的模板 -->
<template v-slot="scope">
<!-- 如果 state '0'显示入库标签标签类型为成功 -->
<el-tag type="success" v-if="scope.row.state=='0'"></el-tag>
<!-- 如果 state '1'显示过期标签标签类型为危险 -->
<el-tag type="danger" v-if="scope.row.state=='1'"></el-tag>
<!-- 如果 state '2'显示下架标签标签类型为危险 -->
<el-tag type="danger" v-if="scope.row.state=='2'"></el-tag>
</template>
</el-table-column>
<!-- 表格列组件展示状态数据绑定到 state1 属性 -->
<el-table-column
prop="state1"
label="状态">
label="状态"
>
<!-- 自定义列内容的模板 -->
<template v-slot="scope">
<!-- 如果 state1 '0'显示正常标签标签类型为成功 -->
<el-tag type="success" v-if="scope.row.state1=='0'"></el-tag>
<!-- 如果 state1 '2'显示未处理标签标签类型为危险 -->
<el-tag type="danger" v-else-if="scope.row.state1=='2'">未处理</el-tag>
<!-- 否则显示删除标签标签类型为危险 -->
<el-tag type="danger" v-else></el-tag>
</template>
</el-table-column>
<!-- 表格列组件展示备注数据绑定到 info 属性设置超出显示 tooltip -->
<el-table-column
prop="info"
:show-overflow-tooltip="true"
label="备注">
label="备注"
>
</el-table-column>
<!-- 表格列组件展示操作设置列宽度并固定在右侧 -->
<el-table-column
width="140"
fixed="right"
label="操作">
label="操作"
>
<!-- 自定义列内容的模板 -->
<template v-slot="scope">
<!-- 如果 state1 '0'显示删除按钮按钮类型为危险点击时调用 del 方法并传入当前行的 cn 设置字体大小 -->
<el-button type="danger" v-if="scope.row.state1=='0'"
@click="del(scope.row.cn)" style="font-size: 18px;">
<!-- 图标元素设置图标样式和大小 -->
<i class="iconfont icon-r-delete" style="font-size: 18px;"></i>
<!-- 按钮文本显示删除 -->
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 定义一个 div 元素设置外边距用于包裹分页组件 -->
<div style="margin: 10px 0 15px 0;">
<!-- 使用 Element UI 的分页组件绑定相关事件和属性 -->
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@ -165,23 +239,30 @@
:page-sizes="[5, 10, 20, 50]"
:page-size="searchForm.pageSize"
layout="total,sizes, prev, pager, next,jumper"
:total="searchForm.total">
:total="searchForm.total"
>
</el-pagination>
</div>
</div>
<!--商品入库表单-->
<!-- 商品入库表单的注释 -->
<!-- 使用 Element UI 的对话框组件标题为商品入库双向绑定 visible 属性控制显示隐藏设置宽度为 50% -->
<el-dialog
title="商品入库"
:visible.sync="goodsInVisable"
width="50%">
<!-- selectGoodsVisable true 时显示的表单绑定数据模型为 selectGoods设置验证规则添加引用设置标签宽度和类名 -->
<el-form v-if="selectGoodsVisable" :model="selectGoods" :rules="rules" ref="selectGoods" label-width="100px"
class="demo-ruleForm">
<!-- 商品选择的表单项设置标签和绑定属性 -->
<el-form-item label="商品:" prop="goodsId">
<!-- 下拉选择框双向绑定 selectGoods.goodsId设置提示信息可过滤值变化时强制更新视图可清除 -->
<el-select v-model="selectGoods.goodsId"
placeholder="请选择商品"
filterable
@change="$forceUpdate()"
clearable>
<!-- 循环遍历 options_goods 数组生成下拉选项设置键标签和值 -->
<el-option
v-for="item in options_goods"
:key="item.id"
@ -190,12 +271,15 @@
</el-option>
</el-select>
</el-form-item>
<!-- 仓库选择的表单项设置标签和绑定属性 -->
<el-form-item label="仓库:" prop="storeId">
<!-- 下拉选择框双向绑定 selectGoods.storeId设置提示信息可过滤值变化时强制更新视图可清除 -->
<el-select v-model="selectGoods.storeId"
placeholder="请选择存储仓库"
filterable
@change="$forceUpdate()"
clearable>
<!-- 循环遍历 options_store 数组生成下拉选项设置键标签和值 -->
<el-option
v-for="item in options_store"
:key="item.id"
@ -204,37 +288,52 @@
</el-option>
</el-select>
</el-form-item>
<!-- 操作按钮的表单项 -->
<el-form-item>
<!-- 成功类型的按钮点击时调用 selectedGoods 方法并传入表单引用设置字体大小和图标 -->
<el-button type="success" @click="selectedGoods('selectGoods')" style="font-size: 18px;">
<i class="iconfont icon-r-yes" style="font-size: 18px;"></i>
确定</el-button>
<!-- 按钮点击时调用 closeSelectedGoods 方法并传入表单引用设置字体大小 -->
<el-button @click="closeSelectedGoods('selectGoods')" style="font-size: 18px;">
关闭</el-button>
</el-form-item>
</el-form>
<!-- newVisable true 时显示的表单绑定数据模型为 newForm设置验证规则添加引用设置标签宽度和类名 -->
<el-form v-if="newVisable" :model="newForm" :rules="rules" ref="newForm" label-width="100px"
class="demo-ruleForm">
<!-- 使用 Element UI 的行布局组件 -->
<el-row>
<!-- 列布局组件 12 份宽度 -->
<el-col :span="12">
<!-- 商品名称的表单项设置标签 -->
<el-form-item label="商品名称:">
<!-- 禁用的输入框双向绑定 newForm.goodsName设置提示信息 -->
<el-input disabled v-model="newForm.goodsName" placeholder="如:农夫山泉"></el-input>
</el-form-item>
</el-col>
<!-- 列布局组件 12 份宽度 -->
<el-col :span="12">
<!-- 商品数量的表单项设置标签和绑定属性 -->
<el-form-item label="商品数量:" prop="goodsNum">
<!-- 输入框双向绑定 newForm.goodsNum设置提示信息 -->
<el-input v-model="newForm.goodsNum" placeholder="如1"></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 使用 Element UI 的行布局组件 -->
<el-row>
<!-- 列布局组件 12 份宽度 -->
<el-col :span="12">
<!-- 供货商选择的表单项设置标签和绑定属性 -->
<el-form-item label="供货商:" prop="supplierId">
<!-- 下拉选择框双向绑定 newForm.supplierId设置提示信息可过滤值变化时强制更新视图可清除 -->
<el-select v-model="newForm.supplierId"
placeholder="请选择供货商"
filterable
@change="$forceUpdate()"
clearable>
<!-- 循环遍历 options_suppliers 数组生成下拉选项设置键标签和值 -->
<el-option
v-for="item in options_suppliers"
:key="item.id"
@ -244,15 +343,22 @@
</el-select>
</el-form-item>
</el-col>
<!-- 列布局组件 12 份宽度 -->
<el-col :span="12">
<!-- 商品价格的表单项设置标签和绑定属性 -->
<el-form-item label="商品价格:" prop="goodsPrice">
<!-- 输入框双向绑定 newForm.goodsPrice设置提示信息 -->
<el-input v-model="newForm.goodsPrice" placeholder="如1.0"></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 使用 Element UI 的行布局组件 -->
<el-row>
<!-- 列布局组件 12 份宽度 -->
<el-col :span="12">
<!-- 生产日期的表单项设置标签和绑定属性 -->
<el-form-item label="生产日期:" prop="birthTime">
<!-- 小尺寸的日期选择器设置宽度日期格式双向绑定 newForm.birthTime设置类型和提示信息 -->
<el-date-picker
size="mini"
style="width: 140px"
@ -263,8 +369,11 @@
</el-date-picker>
</el-form-item>
</el-col>
<!-- 列布局组件 12 份宽度 -->
<el-col :span="12">
<!-- 过期日期的表单项设置标签和绑定属性 -->
<el-form-item label="过期日期:" prop="expiryTime">
<!-- 小尺寸的日期选择器设置宽度日期格式双向绑定 newForm.expiryTime设置类型和提示信息 -->
<el-date-picker
size="mini"
style="width: 140px"
@ -276,18 +385,24 @@
</el-form-item>
</el-col>
</el-row>
<!-- 使用 Element UI 的行布局组件 -->
<el-row>
<!-- 列布局组件 24 份宽度 -->
<el-col :span="24">
<!-- 备注的表单项设置标签 -->
<el-form-item label="备注:">
<!-- 文本域输入框双向绑定 newForm.info设置提示信息 -->
<el-input type="textarea" v-model="newForm.info" placeholder="如:农夫山泉入库"></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 表单操作按钮的表单项 -->
<el-form-item>
<!-- 警告类型的按钮点击时调用 submitNewForm 方法并传入表单引用设置字体大小和图标 -->
<el-button type="warning" @click="submitNewForm('newForm')" style="font-size: 18px;">
<i class="iconfont icon-r-right" style="font-size: 18px;"></i>
入库</el-button>
<!-- 按钮点击时调用 saveCancel 方法并传入表单引用设置字体大小 -->
<el-button @click="saveCancel('newForm')" style="font-size: 18px;">
取消</el-button>
</el-form-item>
@ -296,30 +411,49 @@
</div>
</template>
<script>
// API
// queryGoodsById ID
// selected_goodsAll
import {
queryGoodsById,
selected_goodsAll,
} from "@/api/goods_management/goods/goodsApi";
//
import { popup } from "@/assets/js/common";
// API
// delIn
// queryOptionsSuppliers
// queryPageByQoIn
// saveIn
import {
delIn,
queryOptionsSuppliers,
queryPageByQoIn,
saveIn,
} from "@/api/inventory_management/detail_store_goods/detail_store_goodsApi";
// API storeList
import { storeList } from "@/api/inventory_management/store/storeApi";
// Vue
export default {
//
data() {
return {
// false
newVisable: false,
// false
goodsInVisable: false,
// true
selectGoodsVisable: true,
//
options_suppliers: [],
//
searchForm: {
pageSize: 5
},
//
tableData: [],
//
newForm: {
cn: "",
goodsId: "",
@ -332,8 +466,11 @@ export default {
birthTime: "",
storeId: "",
},
//
options_goods: [],
//
options_store: [],
//
rules: {
supplierId: [
{
@ -342,97 +479,78 @@ export default {
trigger: "blur",
},
],
goodsId: [
{
required: true,
message: "商品编号不能为空",
trigger: "blur",
},
],
storeId: [
{
required: true,
message: "仓库编号不能为空",
trigger: "blur",
},
],
goodsNum: [
{
required: true,
message: "商品数量不能为空",
trigger: "blur",
},
],
goodsPrice: [
{
required: true,
message: "商品价格不能为空",
trigger: "blur",
},
],
expiryTime: [
{
required: true,
message: "过期时间不能为空",
trigger: "blur",
},
],
birthTime: [
{
required: true,
message: "生产时间不能为空",
trigger: "blur",
},
],
//
},
//
selectGoods: {},
};
},
//
methods: {
//
init() {
this.newVisable = false;
this.selectGoodsVisable = true;
//
if (
this.searchForm.startCreateTime > this.searchForm.endCreateTime
) {
popup("结束时间不能小于开始时间", "warning");
return;
}
//
queryPageByQoIn(this.searchForm).then((res) => {
res = res.data;
// 200
if (res.code == 200) {
this.tableData = res.data.records;
this.searchForm.total = res.data.total;
this.searchForm.pageSize = res.data.size;
this.searchForm.currentPage = res.data.current;
} else {
//
popup(res.msg, "error");
}
});
},
//
closeSelectedGoods(formName) {
//
this.$refs[formName].resetFields();
//
this.goodsInVisable = false;
//
this.newVisable = false;
//
this.selectGoodsVisable = true;
},
/*分页*/
//
handleSizeChange(val) {
//
this.searchForm.pageSize = val;
//
this.init();
console.log(`每页 ${val}`);
},
//
handleCurrentChange(val) {
//
this.searchForm.currentPage = val;
//
this.init();
console.log(`当前页: ${val}`);
},
//
submitSearchForm() {
this.init();
},
//
goodsInBtn() {
//
this.selectGoods = {};
//
this.goodsInVisable = true;
//
this.newForm = {
cn: "",
goodsId: "",
@ -446,29 +564,37 @@ export default {
storeId: "",
};
},
//
detailStoreGoodsIn_goodsAll() {
selected_goodsAll().then((res) => {
res = res.data;
// 200
if (res.code == 200) {
this.options_goods = res.data;
} else {
//
popup(res.msg, "error");
}
});
},
//
detailStoreGoodsIn_suppliers() {
queryOptionsSuppliers().then((res) => {
res = res.data;
// 200
if (res.code == 200) {
this.options_suppliers = res.data;
} else {
//
popup(res.msg, "error");
}
});
},
//
detailStoreGoodsIn_storeAll() {
storeList({ state: "0" }).then((res) => {
res = res.data;
// 200
if (res.code == 200) {
for (var item of res.data) {
this.options_store.push({
@ -477,16 +603,21 @@ export default {
});
}
} else {
//
popup(res.msg, "error");
}
});
},
//
selectedGoods(formName) {
//
this.$refs[formName].validate((valid) => {
if (valid) {
// ID
queryGoodsById({ id: this.selectGoods.goodsId }).then(
(res) => {
res = res.data;
// 200
if (res.code == 200) {
this.selectGoodsVisable = false;
this.newVisable = true;
@ -500,6 +631,7 @@ export default {
this.newForm.goodsPrice =
res.data.purchashPrice;
} else {
//
popup(res.msg, "error");
}
}
@ -507,51 +639,67 @@ export default {
}
});
},
//
submitNewForm(formName) {
//
this.$refs[formName].validate((valid) => {
if (valid) {
//
if (this.newForm.birthTime >= this.newForm.expiryTime) {
popup("生成日期不能大于或等于过期日期", "warning");
this.newForm.birthTime = "";
this.newForm.expiryTime = "";
return;
}
//
saveIn(this.newForm).then((res) => {
res = res.data;
// 200
if (res.code == 200) {
popup("入库成功");
this.init();
} else {
//
popup(res.msg, "error");
}
});
}
});
},
//
saveCancel(formName) {
//
this.$refs[formName].resetFields();
//
this.newVisable = false;
//
this.selectGoodsVisable = true;
},
//
del(cn) {
//
this.$confirm("确定删除这条记录?", "警示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
//
delIn({ cn: cn }).then((res) => {
res = res.data;
// 200
if (res.code == 200) {
popup("操作成功");
this.searchForm.state1 = "0";
this.init();
} else {
//
popup(res.msg, "error");
}
});
})
.catch(() => {
//
this.$message({
type: "info",
message: "已取消操作",
@ -559,24 +707,33 @@ export default {
});
},
},
// DOM
mounted() {
// 0
this.searchForm.state1 = "0";
//
this.detailStoreGoodsIn_goodsAll();
//
this.detailStoreGoodsIn_storeAll();
//
this.detailStoreGoodsIn_suppliers();
//
this.init();
},
};
</script>
<style>
// .searchForm
.searchForm {
height: 134px;
}
// .table
.table {
height: 320px;
}
// .pageUtils
.pageUtils {
position: absolute;
width: 84%;
@ -584,6 +741,7 @@ export default {
height: 43px;
}
// .searchForm
.searchForm {
display: inline-block;
margin: 0 auto;
@ -591,6 +749,7 @@ export default {
line-height: 51px;
}
// .searchForm.column
.searchForm .column {
display: inline-block;
margin: 0 auto;

@ -1,53 +1,73 @@
<template>
<!-- 组件模板的根元素 -->
<div>
<!-- 搜索表单的容器 -->
<div class="searchForm">
<!-- 商品名输入框的列 -->
<div class="column">
<!-- 商品名标签 -->
<span>商品名</span>
<!-- 输入框用于输入商品名绑定到 searchForm.name -->
<el-input style="height: 21px;width: 300px" placeholder="请输入商品名" v-model="searchForm.name"/>
</div>
<!-- 搜索按钮的列 -->
<div class="column">
<!-- 成功类型的按钮点击触发 submitSearchForm 方法 -->
<el-button type="success" @click="submitSearchForm"></el-button>
</div>
</div>
<!-- 表格的容器 -->
<div class="table">
<!-- Element UI 表格组件数据绑定到 tableData -->
<el-table
:data="tableData"
style="width: 100%;"
size="medium">
<!-- 序号列使用 type="index" 自动生成序号 -->
<el-table-column
width="200"
type="index"
label="序号">
</el-table-column>
<!-- 封面列展示商品封面图片 -->
<el-table-column
prop="coverUrl"
label="封面">
<!-- 自定义列内容的模板 -->
<template v-slot="scope">
<!-- 图片标签高度固定为 60px图片地址绑定到当前行的 coverUrl -->
<img height="60px" :src="scope.row.coverUrl">
</template>
</el-table-column>
<!-- 商品名列展示商品名称 -->
<el-table-column
prop="name"
label="商品名">
</el-table-column>
<!-- 进货单价列展示商品进货单价 -->
<el-table-column
prop="purchashPrice"
label="进货单价">
</el-table-column>
<!-- 入库数量列展示商品入库数量 -->
<el-table-column
prop="goodsNum"
label="入库数量">
</el-table-column>
<!-- 操作列包含入库按钮 -->
<el-table-column>
<!-- 自定义列内容的模板 -->
<template v-slot="scope">
<!-- 成功类型的按钮点击触发 goodsInBtn 方法传入当前行数据 -->
<el-button type="success"
@click="goodsInBtn(scope.row)" plain>入库
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件的容器 -->
<div style="margin: 10px 0 15px 0;">
<!-- Element UI 分页组件 -->
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@ -60,19 +80,23 @@
</div>
</div>
<!--商品入库表单-->
<!-- 商品入库表单对话框 -->
<el-dialog
title="商品入库"
:visible.sync="goodsInVisable"
width="50%">
<!-- 选择商品和仓库表单 selectGoodsVisable true 时显示 -->
<el-form v-if="selectGoodsVisable" :model="selectGoods" :rules="rules" ref="selectGoods" label-width="100px"
class="demo-ruleForm">
<!-- 商品选择表单项 -->
<el-form-item style="width:40%" label="商品:" prop="goodsId">
<!-- 禁用的下拉选择框绑定到 selectGoods.goodsId -->
<el-select disabled v-model="selectGoods.goodsId"
placeholder="请选择商品"
filterable
@change="$forceUpdate()"
clearable>
<!-- 循环渲染商品选项 -->
<el-option
v-for="item in options_goods"
:key="item.id"
@ -81,12 +105,15 @@
</el-option>
</el-select>
</el-form-item>
<!-- 仓库选择表单项 -->
<el-form-item style="width:40%" label="仓库:" prop="storeId">
<!-- 下拉选择框绑定到 selectGoods.storeId -->
<el-select v-model="selectGoods.storeId"
placeholder="请选择存储仓库"
filterable
@change="$forceUpdate()"
clearable>
<!-- 循环渲染仓库选项 -->
<el-option
v-for="item in options_store"
:key="item.id"
@ -95,33 +122,49 @@
</el-option>
</el-select>
</el-form-item>
<!-- 操作按钮表单项 -->
<el-form-item style="width:40%">
<!-- 成功类型的按钮点击触发 selectedGoods 方法 -->
<el-button type="success" @click="selectedGoods('selectGoods')" plain>确定</el-button>
<!-- 警告类型的按钮点击触发 closeSelectedGoods 方法 -->
<el-button type="warning" @click="closeSelectedGoods('selectGoods')" plain>关闭</el-button>
</el-form-item>
</el-form>
<!-- 详细入库信息表单 newVisable true 时显示 -->
<el-form size="mini" v-if="newVisable" :model="newForm" :rules="rules" ref="newForm" label-width="100px"
class="demo-ruleForm">
<!-- 表单布局行 -->
<el-row>
<!-- 左半部分列 -->
<el-col :span="12">
<!-- 商品名表单项 -->
<el-form-item style="width: 60%" label="商品名:">
<!-- 只读输入框绑定到 newForm.goodsName -->
<el-input readonly v-model="newForm.goodsName" placeholder="如:农夫山泉"></el-input>
</el-form-item>
</el-col>
<!-- 右半部分列 -->
<el-col :span="12">
<!-- 商品数量表单项 -->
<el-form-item style="width: 60%" label="商品数量:" prop="goodsNum">
<!-- 输入框绑定到 newForm.goodsNum -->
<el-input v-model="newForm.goodsNum" :placeholder="'如:'+newGoodsNum"></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 表单布局行 -->
<el-row>
<!-- 左半部分列 -->
<el-col :span="12">
<!-- 供货商选择表单项 -->
<el-form-item style="width: 60%" label="供货商:" prop="supplierId">
<!-- 下拉选择框绑定到 newForm.supplierId -->
<el-select v-model="newForm.supplierId"
placeholder="请选择供货商"
filterable
@change="$forceUpdate()"
clearable>
<!-- 循环渲染供货商选项 -->
<el-option
v-for="item in options_suppliers"
:key="item.id"
@ -131,15 +174,22 @@
</el-select>
</el-form-item>
</el-col>
<!-- 右半部分列 -->
<el-col :span="12">
<!-- 商品价格表单项 -->
<el-form-item style="width: 60%" label="商品价格:" prop="goodsPrice">
<!-- 输入框绑定到 newForm.goodsPrice -->
<el-input v-model="newForm.goodsPrice" placeholder="如1.0"></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 表单布局行 -->
<el-row>
<!-- 左半部分列 -->
<el-col :span="12">
<!-- 生产日期表单项 -->
<el-form-item style="width: 60%" label="生产日期:" prop="birthTime">
<!-- 日期选择器绑定到 newForm.birthTime -->
<el-date-picker
size="mini"
style="width: 140px"
@ -150,8 +200,11 @@
</el-date-picker>
</el-form-item>
</el-col>
<!-- 右半部分列 -->
<el-col :span="12">
<!-- 过期日期表单项 -->
<el-form-item style="width: 60%" label="过期日期:" prop="expiryTime">
<!-- 日期选择器绑定到 newForm.expiryTime -->
<el-date-picker
size="mini"
style="width: 140px"
@ -163,16 +216,23 @@
</el-form-item>
</el-col>
</el-row>
<!-- 表单布局行 -->
<el-row>
<!-- 整行列 -->
<el-col :span="24">
<!-- 备注表单项 -->
<el-form-item style="width: 82%" label="备注:">
<!-- 文本输入框绑定到 newForm.info -->
<el-input type="textarea" v-model="newForm.info" placeholder="如:农夫山泉入库"></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 操作按钮表单项 -->
<el-form-item>
<!-- 主要类型的按钮点击触发 submitNewForm 方法 -->
<el-button type="primary" @click="submitNewForm('newForm')"></el-button>
<!-- 按钮点击触发 saveCancel 方法 -->
<el-button @click="saveCancel('newForm')"></el-button>
</el-form-item>
</el-form>
@ -181,230 +241,276 @@
</div>
</template>
<script>
// popup
import {popup} from "@/assets/js/common";
// API
// queryGoodsStoreById ID
// queryPageByQo
// updateInventory
import {
queryGoodsStoreById,
queryPageByQo,
updateInventory
} from "@/api/goods_management/goods_store/goodsStoreApi";
// API queryPageNoticeIn
import {queryPageNoticeIn} from "@/api/inventory_management/notice/noticeApi";
// API
// queryGoodsById ID
// selected_goodsAll
import {queryGoodsById, selected_goodsAll} from "@/api/goods_management/goods/goodsApi";
// API
// queryOptionsSuppliers
// saveIn
import {queryOptionsSuppliers, saveIn} from "@/api/inventory_management/detail_store_goods/detail_store_goodsApi";
// API storeList
import {storeList} from "@/api/inventory_management/store/storeApi";
// Vue
export default {
//
data() {
return {
// false
newVisable: false,
// false
goodsInVisable: false,
// true
selectGoodsVisable: true,
//
newGoodsNum:'',
//
newForm: {
cn: '',
goodsId: '',
goodsNum: '',
goodsName: '',
goodsPrice: '',
info: '',
expiryTime: '',
birthTime: '',
storeId: ''
cn: '', //
goodsId: '', // ID
goodsNum: '', //
goodsName: '', //
goodsPrice: '', //
info: '', //
expiryTime: '', //
birthTime: '', //
storeId: '' // ID
},
/*表格*/
/*表格相关数据*/
//
tableData: [],
//
searchForm: {
total: 0,
currentPage: 1,
pageSize: 10,
state: '0'
total: 0, // 0
currentPage: 1, // 1
pageSize: 10, // 10
state: '0' // '0'
},
//
options_goods: [],
//
options_store: [],
//
options_suppliers:[],
//
selectGoods: {},
//
rules: {
supplierId:[
{required: true, message: '供应商不能为空', trigger: 'blur'},
{required: true, message: '供应商不能为空', trigger: 'blur'}, // ID
],
goodsId: [
{required: true, message: '商品编号不能为空', trigger: 'blur'},
{required: true, message: '商品编号不能为空', trigger: 'blur'}, // ID
],
storeId: [
{required: true, message: '仓库编号不能为空', trigger: 'blur'},
{required: true, message: '仓库编号不能为空', trigger: 'blur'}, // ID
],
goodsNum: [
{required: true, message: '商品数量不能为空', trigger: 'blur'},
{required: true, message: '商品数量不能为空', trigger: 'blur'}, //
],
goodsPrice: [
{required: true, message: '商品价格不能为空', trigger: 'blur'},
{required: true, message: '商品价格不能为空', trigger: 'blur'}, //
],
expiryTime: [
{required: true, message: '过期时间不能为空', trigger: 'blur'},
{required: true, message: '过期时间不能为空', trigger: 'blur'}, //
],
birthTime: [
{required: true, message: '生产时间不能为空', trigger: 'blur'},
{required: true, message: '生产时间不能为空', trigger: 'blur'}, //
],
},
}
},
//
methods: {
//
init() {
// queryPageNoticeIn searchForm
queryPageNoticeIn(this.searchForm).then(res => {
res = res.data
if (res.code == 200) {
console.log(res.data)
this.tableData = res.data.records
this.searchForm.total = res.data.total
this.searchForm.pageSize = res.data.size
this.searchForm.currentPage = res.data.current
} else {
popup(res.msg, "error")
res = res.data //
if (res.code == 200) { // 200
console.log(res.data) //
this.tableData = res.data.records //
this.searchForm.total = res.data.total //
this.searchForm.pageSize = res.data.size //
this.searchForm.currentPage = res.data.current //
} else { // 200
popup(res.msg, "error") //
}
})
},
/*分页*/
/*分页相关方法*/
//
handleSizeChange(val) {
this.searchForm.pageSize = val
this.init()
console.log(`每页 ${val}`);
this.searchForm.pageSize = val //
this.init() // init
console.log(`每页 ${val}`); //
},
//
handleCurrentChange(val) {
this.searchForm.currentPage = val
this.init()
console.log(`当前页: ${val}`);
this.searchForm.currentPage = val //
this.init() // init
console.log(`当前页: ${val}`); //
},
//
submitSearchForm() {
this.init()
this.init() // init
},
//
detailStoreGoodsIn_goodsAll() {
selected_goodsAll().then(res => {
res = res.data
if (res.code == 200) {
this.options_goods = res.data
} else {
popup(res.msg, 'error')
selected_goodsAll().then(res => { // selected_goodsAll
res = res.data //
if (res.code == 200) { // 200
this.options_goods = res.data //
} else { // 200
popup(res.msg, 'error') //
}
})
},
//
detailStoreGoodsIn_suppliers(){
queryOptionsSuppliers().then(res=>{
res=res.data
if (res.code==200){
this.options_suppliers=res.data
}else {
popup(res.msg,"error")
queryOptionsSuppliers().then(res=>{ // queryOptionsSuppliers
res=res.data //
if (res.code==200){ // 200
this.options_suppliers=res.data //
}else { // 200
popup(res.msg,"error") //
}
}
)
},
//
detailStoreGoodsIn_storeAll() {
storeList({state: '0'}).then(res => {
res = res.data
if (res.code == 200) {
for (var item of res.data) {
this.options_store.push({id: item.id, name: item.name})
storeList({state: '0'}).then(res => { // storeList '0'
res = res.data //
if (res.code == 200) { // 200
for (var item of res.data) { //
this.options_store.push({id: item.id, name: item.name}) //
}
} else {
popup(res.msg, "error")
} else { // 200
popup(res.msg, "error") //
}
})
},
//
selectedGoods(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
queryGoodsById({id: this.selectGoods.goodsId}).then(res => {
res = res.data
if (res.code == 200) {
this.selectGoodsVisable = false
this.newVisable = true
this.newForm.storeId = this.selectGoods.storeId
this.newForm.goodsId = res.data.id
this.newForm.goodsName = res.data.name
this.newForm.goodsPrice = res.data.purchashPrice
} else {
popup(res.msg, "error")
this.$refs[formName].validate((valid) => { //
if (valid) { //
queryGoodsById({id: this.selectGoods.goodsId}).then(res => { // ID
res = res.data //
if (res.code == 200) { // 200
this.selectGoodsVisable = false //
this.newVisable = true //
this.newForm.storeId = this.selectGoods.storeId // ID
this.newForm.goodsId = res.data.id // ID
this.newForm.goodsName = res.data.name //
this.newForm.goodsPrice = res.data.purchashPrice //
} else { // 200
popup(res.msg, "error") //
}
})
}
})
},
//
closeSelectedGoods(formName){
this.$refs[formName].resetFields()
this.goodsInVisable=false
this.newVisable = false
this.selectGoodsVisable = true
this.selectGoods={}
this.$refs[formName].resetFields() //
this.goodsInVisable=false //
this.newVisable = false //
this.selectGoodsVisable = true //
this.selectGoods={} //
},
//
submitNewForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
saveIn(this.newForm).then(res => {
res = res.data
if (res.code == 200) {
popup("入库成功")
this.goodsInVisable=false
this.selectGoodsVisable = true
this.newVisable = false
this.init()
} else {
popup(res.msg, "error")
this.$refs[formName].validate((valid) => { //
if (valid) { //
saveIn(this.newForm).then(res => { // saveIn
res = res.data //
if (res.code == 200) { // 200
popup("入库成功") //
this.goodsInVisable=false //
this.selectGoodsVisable = true //
this.newVisable = false //
this.init() // init
} else { // 200
popup(res.msg, "error") //
}
})
}
})
},
//
saveCancel(formName) {
this.$refs[formName].resetFields()
this.newVisable = false
this.selectGoodsVisable = true
this.$refs[formName].resetFields() //
this.newVisable = false //
this.selectGoodsVisable = true //
},
//
goodsInBtn(row) {
this.selectGoods.goodsId=row.id
this.newGoodsNum=row.goodsNum
this.goodsInVisable = true
this.selectGoods.goodsId=row.id // ID ID
this.newGoodsNum=row.goodsNum //
this.goodsInVisable = true //
},
},
// DOM
mounted() {
this.searchForm.state1 = '0'
this.detailStoreGoodsIn_goodsAll()
this.detailStoreGoodsIn_storeAll()
this.detailStoreGoodsIn_suppliers()
this.init()
this.searchForm.state1 = '0' // '0'
this.detailStoreGoodsIn_goodsAll() //
this.detailStoreGoodsIn_storeAll() //
this.detailStoreGoodsIn_suppliers() //
this.init() //
}
}
</script>
<style>
/* 选择器.searchForm用于选择类名为 searchForm 的元素 */
.searchForm {
height: 134px;
height: 134px; /* 设置元素的高度为 134 像素 */
}
/* 选择器.table用于选择类名为 table 的元素 */
.table {
height: 320px;
height: 320px; /* 设置元素的高度为 320 像素 */
}
/* 选择器.pageUtils用于选择类名为 pageUtils 的元素 */
.pageUtils {
position: absolute;
width: 84%;
margin: 2px auto;
height: 43px;
position: absolute; /* 设置元素的定位方式为绝对定位 */
width: 84%; /* 设置元素的宽度为父元素宽度的 84% */
margin: 2px auto; /* 上下外边距为 2 像素,左右自动居中 */
height: 43px; /* 设置元素的高度为 43 像素 */
}
/* 再次选择类名为 searchForm 的元素,这里重复定义了样式,后定义的样式会覆盖前面的 */
.searchForm {
display: inline-block;
margin: 0 auto;
height: 51px;
line-height: 51px;
display: inline-block; /* 设置元素的显示方式为行内块元素 */
margin: 0 auto; /* 上下外边距为 0左右自动居中 */
height: 51px; /* 设置元素的高度为 51 像素 */
line-height: 51px; /* 设置元素的行高为 51 像素,通常用于使单行文本垂直居中 */
}
/* 选择器.searchForm.column用于选择类名为 searchForm 的元素内部类名为 column 的元素 */
.searchForm .column {
display: inline-block;
margin: 0 auto;
margin-right: 2px;
line-height: 48px;
height: 51px;
display: inline-block; /* 设置元素的显示方式为行内块元素 */
margin: 0 auto; /* 上下外边距为 0左右自动居中 */
margin-right: 2px; /* 设置元素的右外边距为 2 像素 */
line-height: 48px; /* 设置元素的行高为 48 像素 */
height: 51px; /* 设置元素的高度为 51 像素 */
}
</style>

@ -1,27 +1,41 @@
<template>
<!-- 组件的根元素设置了 id "detail_store_goods_out" -->
<div id="detail_store_goods_out">
<!-- 面包屑导航组件用于显示当前页面在导航层次结构中的位置 -->
<el-breadcrumb separator="/">
<!-- 面包屑导航的首页项 -->
<el-breadcrumb-item>首页</el-breadcrumb-item>
<!-- 面包屑导航的库存管理项 -->
<el-breadcrumb-item>库存管理 </el-breadcrumb-item>
<el-breadcrumb-item>出库明细</el-breadcrumb-item> </el-breadcrumb
><br />
<!-- 面包屑导航的出库明细项 -->
<el-breadcrumb-item>出库明细</el-breadcrumb-item>
</el-breadcrumb>
<!-- 换行 -->
<br />
<!-- 栅格布局容器 -->
<el-row>
<!-- 栅格布局列 4 设置了右侧内边距为 10px -->
<el-col :span="4" style="padding-right: 10px;">
<!-- 输入框组件用于输入出库编号双向绑定到 searchForm.cn -->
<el-input
placeholder="出库编号"
v-model="searchForm.cn"
/>
</el-col>
<!-- 栅格布局列 4 -->
<el-col :span="4">
<!-- 输入框组件用于输入商品名称双向绑定到 searchForm.goodsName -->
<el-input
placeholder="商品名称"
v-model="searchForm.goodsName"
/>
</el-col>
<!-- 栅格布局列 16 -->
<el-col :span="16">
<!-- 显示文本 "出库时间:" -->
<span>出库时间</span>
<!-- 日期选择器组件用于选择起始时间双向绑定到 searchForm.startCreateTime -->
<el-date-picker
value-format="yyyy-MM-dd"
v-model="searchForm.startCreateTime"
@ -29,7 +43,9 @@
placeholder="起始时间"
>
</el-date-picker>
<!-- 显示连接符 "-" -->
-
<!-- 日期选择器组件用于选择结束时间双向绑定到 searchForm.endCreateTime -->
<el-date-picker
v-model="searchForm.endCreateTime"
value-format="yyyy-MM-dd"
@ -39,128 +55,172 @@
</el-date-picker>
</el-col>
</el-row>
<!-- 换行 -->
<br>
<!-- 栅格布局容器 -->
<el-row>
<!-- 栅格布局列 4 设置了右侧内边距为 10px -->
<el-col :span="4" style="padding-right: 10px;">
<!-- 下拉选择框组件用于选择类型双向绑定到 searchForm.state值变化时强制更新视图 -->
<el-select
v-model="searchForm.state"
@change="$forceUpdate()"
placeholder="类型"
clearable
>
<!-- 下拉选项标签为 "出库"值为 "0" -->
<el-option label="出库" value="0"></el-option>
<!-- 下拉选项标签为 "过期"值为 "1" -->
<el-option label="过期" value="1"></el-option>
<!-- 下拉选项标签为 "下架"值为 "2" -->
<el-option label="下架" value="2"></el-option>
</el-select>
</el-col>
<!-- 栅格布局列 4 -->
<el-col :span="4">
<!-- 下拉选择框组件用于选择状态双向绑定到 searchForm.state1值变化时强制更新视图 -->
<el-select
v-model="searchForm.state1"
@change="$forceUpdate()"
placeholder="请选择状态"
clearable
>
<!-- 下拉选项标签为 "正常"值为 "0" -->
<el-option label="正常" value="0"></el-option>
<!-- 下拉选项标签为 "删除"值为 "1" -->
<el-option label="删除" value="1"></el-option>
</el-select>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 栅格布局容器 -->
<el-row>
<!-- 栅格布局列 24 文本左对齐 -->
<el-col :span="24" style="text-align: left">
<!-- 主要按钮组件点击时调用 submitSearchForm 方法设置了字体大小 -->
<el-button
type="primary"
@click="submitSearchForm"
style="font-size: 18px"
>
<!-- 图标字体 -->
<i class="iconfont icon-r-find" style="font-size: 18px">
</i>
搜索</el-button
>
<!-- 按钮文本 "搜索" -->
搜索</el-button>
<!-- 警告按钮组件点击时调用 goodsOutBtn 方法设置了字体大小 -->
<el-button
type="warning"
@click="goodsOutBtn"
style="font-size: 18px"
>
<!-- 图标字体 -->
<i class="iconfont icon-r-left" style="font-size: 18px"> </i>
<!-- 按钮文本 "商品出库" -->
商品出库
</el-button>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 表格容器添加了 class "table" -->
<div class="table">
<!-- 表格组件数据绑定到 tableData设置了宽度为 100%尺寸为 medium -->
<el-table :data="tableData" style="width: 100%" size="medium">
<!-- 表格列显示编号宽度为 200绑定到数据的 cn 字段 -->
<el-table-column prop="cn" width="200" label="编号">
</el-table-column>
<!-- 表格列显示商品名当内容溢出时显示 tooltip绑定到数据的 goodsName 字段 -->
<el-table-column
prop="goodsName"
:show-overflow-tooltip="true"
label="商品名"
>
</el-table-column>
<!-- 表格列显示仓库当内容溢出时显示 tooltip绑定到数据的 storeName 字段 -->
<el-table-column
prop="storeName"
:show-overflow-tooltip="true"
label="仓库"
>
</el-table-column>
<!-- 表格列显示商品数量绑定到数据的 goodsNum 字段 -->
<el-table-column prop="goodsNum" label="商品数量">
</el-table-column>
<!-- 表格列显示类型根据数据的 state 字段值显示不同标签 -->
<el-table-column prop="state" label="类型">
<!-- 自定义列内容的插槽 -->
<template v-slot="scope">
<!-- state "2" 显示 "下架" 标签类型为 danger -->
<el-tag
type="danger"
v-if="scope.row.state == '2'"
>下架</el-tag
>
<!-- state "1" 显示 "过期" 标签类型为 danger -->
<el-tag
type="danger"
v-else-if="scope.row.state == '1'"
>过期</el-tag
>
<!-- state 不为 "1" "2" 显示 "出库" 标签类型为 warning -->
<el-tag type="warning" v-else
>出库</el-tag
>
</template>
</el-table-column>
<!-- 表格列显示状态根据数据的 state1 字段值显示不同标签 -->
<el-table-column prop="state1" label="状态">
<!-- 自定义列内容的插槽 -->
<template v-slot="scope">
<!-- state1 "0" 显示 "正常" 标签类型为 success -->
<el-tag
type="success"
v-if="scope.row.state1 == '0'"
>正常</el-tag
>
<!-- state1 不为 "0" 显示 "删除" 标签类型为 danger -->
<el-tag type="danger" v-else></el-tag>
</template>
</el-table-column>
<!-- 表格列显示出库者绑定到数据的 createby 字段 -->
<el-table-column prop="createby" label="出库者">
</el-table-column>
<!-- 表格列显示出库时间当内容溢出时显示 tooltip绑定到数据的 createTime 字段 -->
<el-table-column
prop="createTime"
:show-overflow-tooltip="true"
label="出库时间"
>
</el-table-column>
<!-- 表格列显示备注当内容溢出时显示 tooltip绑定到数据的 info 字段 -->
<el-table-column
prop="info"
:show-overflow-tooltip="true"
label="备注"
>
</el-table-column>
<!-- 表格列显示操作按钮固定在右侧宽度为 140 -->
<el-table-column width="140" label="操作" fixed="right">
<!-- 自定义列内容的插槽 -->
<template v-slot="scope">
<!-- 危险按钮组件点击时调用 del 方法并传入当前行的 cn 设置了字体大小和图标 -->
<el-button
type="danger"
@click="del(scope.row.cn)"
style="font-size: 18px"
>
<i class="iconfont icon-r-delete" style="font-size: 18px;"></i>
<!-- 按钮文本 "删除" -->
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件容器设置了外边距 -->
<div style="margin: 10px 0 15px 0">
<!-- 分页组件处理分页相关操作 -->
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@ -173,8 +233,9 @@
</el-pagination>
</div>
</div>
<!--商品出库-->
<!-- 商品出库对话框标题为 "商品出库"根据 goodsOutVisable 的值显示或隐藏宽度为 50% -->
<el-dialog title="商品出库" :visible.sync="goodsOutVisable" width="50%">
<!-- 表单组件 selectGoodsVisable true 时显示绑定数据验证规则和引用 -->
<el-form
v-if="selectGoodsVisable"
:model="selectGoods"
@ -183,7 +244,9 @@
label-width="100px"
class="demo-ruleForm"
>
<!-- 表单字段项标签为 "商品:"绑定到数据的 goodsId 字段 -->
<el-form-item label="商品:" prop="goodsId">
<!-- 下拉选择框组件值变化时调用 changeGoods 方法双向绑定到 selectGoods.goodsId -->
<el-select
@change="changeGoods"
v-model="selectGoods.goodsId"
@ -191,6 +254,7 @@
filterable
clearable
>
<!-- 循环生成下拉选项根据 options_goods 数组数据 -->
<el-option
v-for="item in options_goods"
:key="item.id"
@ -200,7 +264,9 @@
</el-option>
</el-select>
</el-form-item>
<!-- 表单字段项标签为 "仓库:"绑定到数据的 storeId 字段 -->
<el-form-item label="仓库:" prop="storeId">
<!-- 下拉选择框组件值变化时调用 changeStore 方法双向绑定到 selectGoods.storeId -->
<el-select
v-model="selectGoods.storeId"
@change="changeStore"
@ -208,6 +274,7 @@
filterable
clearable
>
<!-- 循环生成下拉选项根据 options_store 数组数据 -->
<el-option
v-for="item in options_store"
:key="item.id"
@ -217,7 +284,9 @@
</el-option>
</el-select>
</el-form-item>
<!-- 表单字段项标签为 "类型:"绑定到数据的 state 字段 -->
<el-form-item label="类型:" prop="state">
<!-- 下拉选择框组件双向绑定到 selectGoods.state值变化时强制更新视图 -->
<el-select
v-model="selectGoods.state"
@change="$forceUpdate()"
@ -225,29 +294,37 @@
placeholder="请选择类型"
clearable
>
<!-- 下拉选项标签为 "出库"值为 "0" -->
<el-option label="出库" value="0"></el-option>
<!-- 下拉选项标签为 "过期"值为 "1" -->
<el-option label="过期" value="1"></el-option>
</el-select>
</el-form-item>
<!-- 表单字段项包含确定和关闭按钮 -->
<el-form-item>
<!-- 成功按钮组件点击时调用 selectedGoods 方法设置了字体大小和图标 -->
<el-button
type="success"
@click="selectedGoods('selectGoods')"
style="font-size: 18px;"
>
<i class="iconfont icon-r-yes" style="font-size: 18px;"></i>
<!-- 按钮文本 "确定" -->
确定
</el-button
>
<!-- 警告按钮组件点击时调用 closeSelectedGoods 方法设置了字体大小 -->
<el-button
type="warning"
@click="closeSelectedGoods('selectGoods')"
style="font-size: 18px;"
>
<!-- 按钮文本 "关闭" -->
关闭</el-button
>
</el-form-item>
</el-form>
<!-- 表单组件 newVisable true 时显示绑定数据验证规则和引用 -->
<el-form
v-if="newVisable"
:model="newForm"
@ -256,9 +333,13 @@
label-width="100px"
class="demo-ruleForm"
>
<!-- 表单行组件 -->
<el-row>
<!-- 表单列组件 12 -->
<el-col :span="12">
<!-- 表单字段项标签为 "商品名:" -->
<el-form-item label="商品名:">
<!-- 只读输入框双向绑定到 newForm.goodsName -->
<el-input
readonly
v-model="newForm.goodsName"
@ -266,11 +347,14 @@
></el-input>
</el-form-item>
</el-col>
<!-- 表单列组件 12 -->
<el-col :span="12">
<!-- 表单字段项标签为 "类型:"绑定到数据的 state 字段 -->
<el-form-item
label="类型:"
prop="state"
>
<!-- 禁用的下拉选择框双向绑定到 newForm.state值变化时强制更新视图 -->
<el-select
disabled
v-model="newForm.state"
@ -279,18 +363,24 @@
placeholder="请选择类型"
clearable
>
<!-- 下拉选项标签为 "出库"值为 "0" -->
<el-option label="出库" value="0"></el-option>
<!-- 下拉选项标签为 "过期"值为 "1" -->
<el-option label="过期" value="1"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<!-- 表单行组件 -->
<el-row>
<!-- 表单列组件 12 -->
<el-col :span="12">
<!-- 表单字段项标签为 "商品数量:"绑定到数据的 goodsNum 字段 -->
<el-form-item
label="商品数量:"
prop="goodsNum"
>
<!-- 数字输入框值变化时进行数量范围
<el-input
type="number"
@change="
@ -314,11 +404,14 @@
></el-input>
</el-form-item>
</el-col>
<!-- 表单列组件 12 -->
<el-col :span="12">
<!-- 表单字段项标签为 "仓库:"绑定到数据的 storeId 字段 -->
<el-form-item
label="仓库:"
prop="storeId"
>
<!-- 禁用的下拉选择框双向绑定到 newForm.storeId值变化时调用 changeStore 方法 -->
<el-select
disabled
v-model="newForm.storeId"
@ -327,6 +420,7 @@
filterable
clearable
>
<!-- 循环生成下拉选项根据 options_store 数组数据 -->
<el-option
v-for="item in options_store"
:key="item.id"
@ -338,12 +432,16 @@
</el-form-item>
</el-col>
</el-row>
<!-- 表单行组件 -->
<el-row>
<!-- 表单列组件 12 -->
<el-col :span="12">
<!-- 表单字段项标签为 "出库日期:"绑定到数据的 createTime 字段 -->
<el-form-item
label="出库日期:"
prop="createTime"
>
<!-- 日期选择器组件设置尺寸为 mini宽度为 140px绑定到 newForm.createTime -->
<el-date-picker
size="mini"
style="width: 140px"
@ -355,8 +453,11 @@
</el-date-picker>
</el-form-item>
</el-col>
<!-- 表单列组件 12 -->
<el-col :span="12">
<!-- 表单字段项标签为 "备注:" -->
<el-form-item label="备注:">
<!-- 文本域输入框双向绑定到 newForm.info -->
<el-input
type="textarea"
v-model="newForm.info"
@ -365,12 +466,16 @@
</el-form-item>
</el-col>
</el-row>
<!-- 表单字段项包含出库和取消按钮 -->
<el-form-item>
<!-- 警告按钮组件点击时调用 submitNewForm 方法设置了字体大小和图标 -->
<el-button type="warning" @click="submitNewForm('newForm')" style="font-size: 18px;"
>
<i class="iconfont icon-r-left" style="font-size: 18px;"></i>
<!-- 按钮文本 "出库" -->
出库</el-button
>
<!-- 按钮组件点击时调用 saveCancel 方法设置了字体大小 -->
<el-button @click="saveCancel('newForm')" style="font-size: 18px;">取消</el-button>
</el-form-item>
</el-form>
@ -378,6 +483,7 @@
</div>
</template>
<script>
// API
import {
changeOutGoods,
changeOutStore,
@ -390,25 +496,38 @@ import {
saveIn,
saveOut,
} from "@/api/inventory_management/detail_store_goods/detail_store_goodsApi";
//
import { popup } from "@/assets/js/common";
// API
import {
queryGoodsById,
selected_goodsAll,
} from "@/api/goods_management/goods/goodsApi";
// API
import { storeList } from "@/api/inventory_management/store/storeApi";
// Vue
export default {
//
data() {
return {
//
goodsOutVisable: false,
//
selectGoodsVisable: true,
//
newVisable: false,
// 5
searchForm: {
pageSize: 5
},
//
tableData: [],
//
options_store: [],
//
goodsNum_max: "",
//
newForm: {
goodsId: "",
goodsNum: "",
@ -418,6 +537,7 @@ export default {
storeId: "",
state: "",
},
//
rules: {
goodsId: [
{
@ -455,105 +575,150 @@ export default {
},
],
},
//
options_goods: [],
//
selectGoods: {},
};
},
//
methods: {
//
changeGoods() {
//
this.$forceUpdate();
// API ID
changeOutGoods({ gid: this.selectGoods.goodsId }).then((res) => {
res = res.data;
if (res.code == 200) {
//
this.options_store = res.data;
}
});
},
//
changeStore() {
//
this.$forceUpdate();
// API ID
changeOutStore({ storeId: this.selectGoods.storeId }).then(
(res) => {
res = res.data;
if (res.code == 200) {
//
this.options_goods = res.data;
}
}
);
},
//
initOptions() {
// API
initOutOptions().then((res) => {
res = res.data;
if (res.code == 200) {
//
this.options_goods = res.data.goods;
//
this.options_store = res.data.stores;
} else {
//
popup(res.msg, "error");
}
});
},
//
init() {
//
if (
this.searchForm.startCreateTime > this.searchForm.endCreateTime
) {
popup("结束时间不能小于开始时间", "warning");
return;
}
// API
queryPageByQoOut(this.searchForm).then((res) => {
res = res.data;
if (res.code == 200) {
//
this.tableData = res.data.records;
//
this.searchForm.total = res.data.total;
//
this.searchForm.pageSize = res.data.size;
//
this.searchForm.currentPage = res.data.current;
} else {
//
popup(res.msg, "error");
}
});
},
//
del(cn) {
//
this.$confirm("确定删除这条记录?", "警示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
// API
delOut({ cn: cn }).then((res) => {
res = res.data;
if (res.code == 200) {
//
popup("操作成功");
// 0
this.searchForm.state1 = "0";
//
this.init();
} else {
//
popup(res.msg, "error");
}
});
})
.catch(() => {
//
this.$message({
type: "info",
message: "已取消操作",
});
});
},
/*分页*/
//
handleSizeChange(val) {
//
this.searchForm.pageSize = val;
//
this.init();
console.log(`每页 ${val}`);
},
//
handleCurrentChange(val) {
//
this.searchForm.currentPage = val;
//
this.init();
console.log(`当前页: ${val}`);
},
//
submitSearchForm() {
//
this.init();
},
//
goodsOutBtn() {
// 0
this.selectGoods.state = "0";
//
this.goodsOutVisable = true;
//
this.selectGoodsVisable = true;
//
this.newVisable = false;
//
this.newForm = {
goodsId: "",
goodsNum: "",
@ -564,74 +729,112 @@ export default {
state: "",
};
},
//
selectedGoods(formName) {
//
this.$refs[formName].validate((valid) => {
if (valid) {
// API
queryOutGoods(this.selectGoods).then((res) => {
res = res.data;
if (res.code == 200) {
//
this.selectGoodsVisable = false;
//
this.newVisable = true;
//
this.newForm.goodsNum = res.data.goodsNum;
//
this.goodsNum_max = res.data.goodsNum;
//
this.newForm.goodsName = res.data.goodsName;
//
this.newForm.state = this.selectGoods.state;
// ID
this.newForm.storeId = this.selectGoods.storeId;
// ID
this.newForm.goodsId = this.selectGoods.goodsId;
//
this.selectGoods = {};
} else {
//
popup(res.msg, "error");
}
});
}
});
},
//
closeSelectedGoods(formName) {
//
this.$refs[formName].resetFields();
//
this.selectGoods = {};
//
this.goodsOutVisable = false;
},
//
submitNewForm(formName) {
//
this.$refs[formName].validate((valid) => {
if (valid) {
// API
saveOut(this.newForm).then((res) => {
res = res.data;
if (res.code == 200) {
//
popup("出库成功");
// 0
this.searchForm.state1 = "0";
//
this.goodsOutVisable = false;
//
this.newVisable = false;
//
this.selectGoodsVisable = true;
//
this.init();
} else {
//
popup(res.msg, "error");
}
});
}
});
},
//
saveCancel(formName) {
//
this.$refs[formName].resetFields();
//
this.newVisable = false;
//
this.selectGoodsVisable = true;
},
},
//
mounted() {
// 0
this.searchForm.state1 = "0";
//
this.initOptions();
//
this.init();
},
};
</script>
<style>
/* 设置 searchForm 类元素的高度 */
.searchForm {
height: 134px;
}
/* 设置 table 类元素的高度 */
.table {
height: 320px;
}
/* 设置 pageUtils 类元素的定位、宽度、外边距和高度 */
.pageUtils {
position: absolute;
width: 84%;
@ -639,6 +842,7 @@ export default {
height: 43px;
}
/* 再次设置 searchForm 类元素的显示方式、外边距、高度和行高,后定义的样式会覆盖前面的 */
.searchForm {
display: inline-block;
margin: 0 auto;
@ -646,6 +850,7 @@ export default {
line-height: 51px;
}
/* 设置 searchForm 类下的 column 类元素的显示方式、外边距、行高和高度 */
.searchForm.column {
display: inline-block;
margin: 0 auto;

@ -1,67 +1,89 @@
<template>
<!-- 组件的根元素设置唯一的 ID -->
<div id="detail_store_goods_in">
<!-- 包含标题和按钮的区域 -->
<div class="noticeOut">
<!-- 显示查看出库商品面板的标题 -->
<h1>查看出库商品面板</h1>
<!-- 包含两个按钮的区域 -->
<div class="btns">
<!-- 点击后调用 outGoodsBtn 方法显示出库货架商品的对话框 -->
<el-button @click="outGoodsBtn" style="width: 200px;height: 100px;background-color: #c09dff">出库货架商品
</el-button>
<!-- 点击后调用 outUntreated 方法显示过期/下架商品的对话框 -->
<el-button @click="outUntreated" style="width: 200px;height: 100px;background-color: #c09dff">过期/下架商品
</el-button>
</div>
</div>
<!--商品上货架-->
<!-- 商品上货架的对话框全屏显示 -->
<el-dialog
:fullscreen="true"
:visible.sync="visable1">
<!-- 搜索表单区域 -->
<div class="searchForm">
<!-- 搜索表单的列包含商品名输入框 -->
<div class="column">
<!-- 显示商品名标签 -->
<span>商品名</span>
<!-- 输入框用于输入商品名双向绑定到 searchForm.name -->
<el-input style="height: 21px;width: 300px" placeholder="请输入商品名" v-model="searchForm.name"/>
</div>
<!-- 搜索表单的列包含搜索和关闭按钮 -->
<div class="column">
<!-- 点击后调用 submitSearchForm 方法进行搜索 -->
<el-button type="success" @click="submitSearchForm"></el-button>
<!-- 点击后隐藏对话框 -->
<el-button type="primary" @click="visable1=false"></el-button>
</div>
</div>
<!-- 表格区域 -->
<div class="table">
<!-- 表格组件数据绑定到 tableData -->
<el-table
:data="tableData"
style="width: 100%;"
size="medium">
<!-- 表格列显示序号 -->
<el-table-column
width="200"
type="index"
label="序号">
</el-table-column>
<!-- 表格列显示商品封面 -->
<el-table-column
prop="coverUrl"
label="封面">
<!-- 自定义列内容显示商品封面图片 -->
<template v-slot="scope">
<img height="60px" :src="scope.row.coverUrl">
</template>
</el-table-column>
<!-- 表格列显示商品名 -->
<el-table-column
prop="name"
label="商品名">
</el-table-column>
<!-- 表格列显示出货数量 -->
<el-table-column
prop="goodsNum"
label="出货数量">
</el-table-column>
<!-- 表格列显示操作按钮 -->
<el-table-column
width="100px"
label="操作">
<!-- 自定义列内容显示出货按钮 -->
<template v-slot="scope">
<!-- 点击后调用 outGoodsBtn1 方法处理出货操作 -->
<el-button type="warning"
@click="outGoodsBtn1(scope.row)" plain>出货
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件区域 -->
<div style="margin: 10px 0 15px 0;">
<!-- 分页组件处理分页相关操作 -->
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@ -74,18 +96,22 @@
</div>
</div>
</el-dialog>
<!--商品出库-->
<!-- 商品出库的对话框 -->
<el-dialog
title="商品出库"
:visible.sync="goodsOutVisable"
width="50%">
<!-- 选择商品和仓库的表单 selectGoodsVisable true 时显示 -->
<el-form v-if="selectGoodsVisable" :model="selectGoods" :rules="rules" ref="selectGoods" label-width="100px"
class="demo-ruleForm">
<!-- 商品选择的表单项 -->
<el-form-item style="width:40%" label="商品:" prop="goodsId">
<!-- 下拉选择框禁用状态双向绑定到 selectGoods.goodsId -->
<el-select disabled v-model="selectGoods.goodsId"
placeholder="请选择商品"
filterable
clearable>
<!-- 循环生成商品选项 -->
<el-option
v-for="item in options_goods"
:key="item.id"
@ -94,12 +120,15 @@
</el-option>
</el-select>
</el-form-item>
<!-- 仓库选择的表单项 -->
<el-form-item style="width:40%" label="仓库:" prop="storeId">
<!-- 下拉选择框双向绑定到 selectGoods.storeId -->
<el-select v-model="selectGoods.storeId"
@change="$forceUpdate"
placeholder="请选择仓库"
filterable
clearable>
<!-- 循环生成仓库选项 -->
<el-option
v-for="item in options_store"
:key="item.id"
@ -108,45 +137,63 @@
</el-option>
</el-select>
</el-form-item>
<!-- 类型选择的表单项 -->
<el-form-item style="width:40%" label="类型:" prop="state">
<!-- 下拉选择框双向绑定到 selectGoods.state -->
<el-select
v-model="selectGoods.state"
@change="$forceUpdate()"
filterable
placeholder="请选择类型" clearable>
<!-- 出库类型选项 -->
<el-option label="出库" value="0"></el-option>
</el-select>
</el-form-item>
<!-- 表单操作按钮的表单项 -->
<el-form-item style="width:40%">
<!-- 点击后调用 selectedGoods 方法确认选择 -->
<el-button type="success" @click="selectedGoods('selectGoods')" plain>确定</el-button>
<!-- 点击后调用 closeSelectedGoods 方法关闭表单 -->
<el-button type="warning" @click="closeSelectedGoods('selectGoods')" plain>关闭</el-button>
</el-form-item>
</el-form>
<!-- 新表单 newVisable true 时显示 -->
<el-form size="mini" v-if="newVisable" :model="newForm" :rules="rules" ref="newForm" label-width="100px"
class="demo-ruleForm">
<!-- 表单的行 -->
<el-row>
<!-- 表单的列显示商品名 -->
<el-col :span="12">
<el-form-item style="width: 60%" label="商品名:">
<!-- 只读输入框显示商品名双向绑定到 newForm.goodsName -->
<el-input readonly v-model="newForm.goodsName" placeholder="如:农夫山泉"></el-input>
</el-form-item>
</el-col>
<!-- 表单的列显示类型选择 -->
<el-col :span="12">
<el-form-item style="width:60%" label="类型:" prop="state">
<!-- 禁用的下拉选择框双向绑定到 newForm.state -->
<el-select disabled
v-model="newForm.state"
filterable
@change="$forceUpdate()"
placeholder="请选择类型" clearable>
<!-- 出库类型选项 -->
<el-option label="出库" value="0"></el-option>
<!-- 过期类型选项 -->
<el-option label="过期" value="1"></el-option>
<!-- 下架类型选项 -->
<el-option label="下架" value="2"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<!-- 表单的行 -->
<el-row>
<!-- 表单的列显示商品数量输入框 -->
<el-col :span="12">
<el-form-item style="width: 60%" label="商品数量:" prop="goodsNum">
<!-- 数字输入框双向绑定到 newForm.goodsNum有数量范围限制 -->
<el-input type="number" @change="()=>{
if(this.goodsNum_max<this.newForm.goodsNum){
this.newForm.goodsNum=this.goodsNum_max
@ -154,16 +201,18 @@
if(this.newForm.goodsNum<1){
this.newForm.goodsNum=1
}
}" min="1" :max="goodsNum_max" v-model="newForm.goodsNum" placeholder="1"></el-input>
</el-form-item>
</el-col>
<!-- 表单的列显示仓库选择 -->
<el-col :span="12">
<el-form-item style="width:60%" label="仓库:" prop="storeId">
<!-- 禁用的下拉选择框双向绑定到 newForm.storeId -->
<el-select disabled v-model="newForm.storeId"
placeholder="请选择仓库"
filterable
clearable>
<!-- 循环生成仓库选项 -->
<el-option
v-for="item in options_store"
:key="item.id"
@ -174,9 +223,12 @@
</el-form-item>
</el-col>
</el-row>
<!-- 表单的行 -->
<el-row>
<!-- 表单的列显示出库日期选择器 -->
<el-col :span="12">
<el-form-item style="width: 60%" label="出库日期:" prop="createTime">
<!-- 日期选择器双向绑定到 newForm.createTime -->
<el-date-picker
size="mini"
style="width: 140px"
@ -187,99 +239,132 @@
</el-date-picker>
</el-form-item>
</el-col>
<!-- 表单的列显示备注输入框 -->
<el-col :span="12">
<el-form-item style="width: 60%" label="备注:">
<!-- 文本域输入框双向绑定到 newForm.info -->
<el-input type="textarea" v-model="newForm.info" placeholder="如:某商品因什么原因出库"></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 表单操作按钮的表单项 -->
<el-form-item>
<!-- 点击后调用 submitNewForm 方法提交出库表单 -->
<el-button type="primary" @click="submitNewForm('newForm')"></el-button>
<!-- 点击后调用 saveCancel 方法取消操作 -->
<el-button @click="saveCancel('newForm')"></el-button>
</el-form-item>
</el-form>
</el-dialog>
<!--商品过期/下架列表显示-->
<!-- 商品过期/下架列表显示的对话框全屏显示 -->
<el-dialog
:fullscreen="true"
:visible.sync="visable2">
<!-- 搜索表单区域 -->
<div class="searchForm">
<!-- 搜索表单的列包含商品名输入框 -->
<div class="column">
<!-- 显示商品名标签 -->
<span>商品名</span>
<!-- 输入框用于输入商品名双向绑定到 searchForm1.name -->
<el-input style="height: 21px;width: 300px" placeholder="请输入商品名" v-model="searchForm1.name"/>
</div>
<!-- 搜索表单的列包含类型选择框 -->
<div class="column">
<!-- 显示类型标签 -->
<span>类型</span>
<!-- 下拉选择框双向绑定到 searchForm1.state -->
<el-select style="width: 120px"
v-model="searchForm1.state"
@change="$forceUpdate()"
placeholder="请选择类型" clearable>
<!-- 过期类型选项 -->
<el-option label="过期" value="1"></el-option>
<!-- 下架类型选项 -->
<el-option label="下架" value="2"></el-option>
</el-select>
</div>
<!-- 搜索表单的列包含搜索和关闭按钮 -->
<div class="column">
<!-- 点击后调用 submitSearchForm1 方法进行搜索 -->
<el-button type="success" @click="submitSearchForm1"></el-button>
<!-- 点击后隐藏对话框 -->
<el-button type="primary" @click="visable2=false"></el-button>
</div>
</div>
<!-- 表格区域 -->
<div class="table">
<!-- 表格组件数据绑定到 tableData1 -->
<el-table
:data="tableData1"
style="width: 100%;"
size="medium">
<!-- 表格列显示序号 -->
<el-table-column
width="200"
type="index"
label="序号">
</el-table-column>
<!-- 表格列显示商品封面 -->
<el-table-column
prop="coverUrl"
label="封面">
<!-- 自定义列内容显示商品封面图片 -->
<template v-slot="scope">
<img height="60px" :src="scope.row.coverUrl">
</template>
</el-table-column>
<!-- 表格列显示商品名 -->
<el-table-column
prop="goodsName"
label="商品名">
</el-table-column>
<!-- 表格列显示仓库名 -->
<el-table-column
prop="storeName"
label="仓库">
</el-table-column>
<!-- 表格列显示处理数量 -->
<el-table-column
prop="untreatedNum"
label="处理数量">
</el-table-column>
<!-- 表格列显示类型 -->
<el-table-column
prop="state"
label="类型">
<!-- 自定义列内容根据类型显示不同标签 -->
<template v-slot="scope">
<!-- 过期类型标签 -->
<el-tag type="warning" v-if="scope.row.state=='1'"></el-tag>
<!-- 下架类型标签 -->
<el-tag type="danger" v-if="scope.row.state=='2'"></el-tag>
</template>
</el-table-column>
<!-- 表格列显示通知时间 -->
<el-table-column
prop="createTime"
label="通知时间">
</el-table-column>
<!-- 表格列显示操作按钮 -->
<el-table-column
width="100px"
label="操作">
<!-- 自定义列内容显示处理按钮 -->
<template v-slot="scope">
<!-- 点击后调用 outUntreatedBtn 方法处理过期/下架商品 -->
<el-button type="warning"
@click="outUntreatedBtn(scope.row)" plain>处理
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件区域 -->
<div style="margin: 10px 0 15px 0;">
<!-- 分页组件处理分页相关操作 -->
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"
:current-page.sync="searchForm1.currentPage"
:page-sizes="[5, 10, 20, 50]"
:page-size="searchForm1.pageSize"
@ -289,29 +374,37 @@
</div>
</div>
</el-dialog>
<!--处理表单填写-->
<!-- 处理表单填写的对话框 -->
<el-dialog
title="过期/下架商品处理表单"
:visible.sync="visable3"
width="50%">
<!-- 处理表单当条件满足时显示 -->
<el-form v-if="" :model="outUntreatedForm" :rules="rules" ref="outUntreatedForm" label-width="100px"
class="demo-ruleForm">
<!-- 表单的行显示商品图片 -->
<el-row>
<!-- 表单的列 -->
<el-col :span="24">
<el-form-item style="width: 60%">
<!-- 显示商品图片 -->
<img height="200px" :src="outUntreatedForm.coverUrl" alt="商品图片"/>
</el-form-item>
</el-col>
</el-row>
<!-- 表单的行显示商品名称数量仓库和类型 -->
<el-row>
<!-- 表单的列显示商品名称 -->
<el-col :span="24">
<el-form-item style="width: 60%" label="商品名称:">
<!-- 只读输入框显示商品名称双向绑定到 outUntreatedForm.goodsName -->
<el-input readonly v-model="outUntreatedForm.goodsName" placeholder="商品名称"/>
</el-form-item>
</el-col>
<!-- 表单的列显示商品数量 -->
<el-col :span="24">
<el-form-item style="width: 60%" label="商品数量:" prop="untreatedNum">
<!-- 数字输入框双向绑定到 outUntreatedForm.untreatedNum有数量范围限制 -->
<el-input
@change="()=>{
if (outUntreatedForm.untreatedNum<=0){
@ -325,79 +418,106 @@
type="number" min="1" :max="untreatedNum" v-model="outUntreatedForm.untreatedNum"/>
</el-form-item>
</el-col>
<!-- 表单的列显示仓库名称 -->
<el-col :span="24">
<el-form-item style="width: 60%" label="仓库:">
<!-- 只读输入框显示仓库名称双向绑定到 outUntreatedForm.storeName -->
<el-input readonly v-model="outUntreatedForm.storeName" placeholder="仓库"/>
</el-form-item>
</el-col>
<!-- 表单的列显示类型选择 -->
<el-col :span="24">
<el-form-item style="width: 40%" label="类型:">
<!-- 禁用的下拉选择框双向绑定到 outUntreatedForm.state -->
<el-select disabled
v-model="outUntreatedForm.state"
@change="$forceUpdate()"
placeholder="请选择类型" clearable>
<!-- 过期类型选项 -->
<el-option label="过期" value="1"></el-option>
<!-- 下架类型选项 -->
<el-option label="下架" value="2"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<!-- 表单的行显示处理和关闭按钮 -->
<el-row>
<!-- 表单的列 -->
<el-col :span="24">
<el-form-item style="width: 60%">
<!-- 点击后调用 submitOutUntreatedForm 方法提交处理表单 -->
<el-button type="success" @click="submitOutUntreatedForm('outUntreatedForm')"></el-button>
<!-- 点击后调用 closeOutUntreatedForm 方法关闭表单 -->
<el-button type="primary" @click="closeOutUntreatedForm('outUntreatedForm')"></el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-dialog>
</div>
</template>
<script>
//
import {popup} from "@/assets/js/common";
// API
import {
queryPageNoticeOut_shelves,
queryPageNoticeOut_untreated, resolveOutUntreatedForm,
saveOut_shelves
} from "@/api/inventory_management/notice/noticeApi";
// API
import {
changeOutGoods,
changeOutStore,
initOutOptions, queryOutGoods, saveOut
} from "@/api/inventory_management/detail_store_goods/detail_store_goodsApi";
// Vue
export default {
//
data() {
return {
//
visable1: false,
// /
visable2: false,
//
visable3: false,
//
untreatedNum: '',
//
outUntreatedForm: {},
//
goodsOutVisable: false,
//
newVisable: false,
//
selectGoodsVisable: true,
//
selectGoods: {},
//
options_goods: [],
//
options_store: [],
/*表格*/
//
tableData: [],
//
searchForm: {
total: 0,
currentPage: 1,
pageSize: 5,
state: '0'
},
// 1
searchForm1: {
total: 0,
currentPage: 1,
pageSize: 5,
},
// 1
tableData1: [],
//
newForm: {
goodsId: '',
goodsNum: '',
@ -407,6 +527,7 @@
storeId: '',
state: ''
},
//
rules: {
goodsId: [
{required: true, message: '商品编号不能为空', trigger: 'blur'},
@ -429,40 +550,60 @@
},
}
},
//
methods: {
//
outGoodsBtn() {
//
this.init()
//
this.visable1 = true
},
//
closeOutUntreatedForm(formName) {
//
this.$refs[formName].resetFields()
//
this.visable3 = false
//
this.outUntreatedForm = {}
},
//
outGoodsBtn1(row) {
// ID
this.selectGoods.goodsId = row.id
//
var flag = false;
//
for (var item of this.options_goods) {
if (item.id == this.selectGoods.goodsId) {
flag = true;
}
}
//
if (!flag) {
popup("库存中没有该商品的库存", "error")
return;
}
// API ID
changeOutGoods({gid: this.selectGoods.goodsId}).then(res => {
res = res.data
if (res.code == 200) {
//
this.options_store = res.data
}
})
//
this.goodsOutVisable = true
//
this.selectGoodsVisable = true
//
this.newVisable = false
//
this.selectGoods.state = '0'
//
this.goodsNum_max = row.goodsNum
//
this.newForm = {
goodsId: '',
goodsNum: row.goodsNum,
@ -472,186 +613,266 @@
storeId: '',
state: ''
}
},
// /
outUntreatedBtn(param) {
//
this.outUntreatedForm = {...param}
//
this.untreatedNum = param.untreatedNum
//
this.visable3 = true
},
//
submitOutUntreatedForm(formName) {
//
this.$refs[formName].validate((valid) => {
if (valid) {
// API
resolveOutUntreatedForm(this.outUntreatedForm).then(res => {
res = res.data
if (res.code == 200) {
//
popup("处理成功")
//
this.visable3 = false
//
this.outUntreatedForm = {}
// /
this.init1()
} else {
//
popup(res.msg, "error")
}
}
)
})
}
})
},
// /
outUntreated() {
// /
this.init1()
// /
this.visable2 = true
},
//
changeGoods() {
//
this.$forceUpdate()
// API ID
changeOutGoods({gid: this.selectGoods.goodsId}).then(res => {
res = res.data
if (res.code == 200) {
//
this.options_store = res.data
}
})
},
//
initOptions() {
// API
initOutOptions().then(res => {
res = res.data
if (res.code == 200) {
//
this.options_goods = res.data.goods
//
this.options_store = res.data.stores
} else {
//
popup(res.msg, "error")
}
})
},
//
init() {
// API
queryPageNoticeOut_shelves(this.searchForm).then(res => {
res = res.data
if (res.code == 200) {
//
this.tableData = res.data.records
//
this.searchForm.total = res.data.total
//
this.searchForm.pageSize = res.data.size
//
this.searchForm.currentPage = res.data.current
} else {
//
popup(res.msg, "error")
}
})
},
/*分页*/
//
handleSizeChange(val) {
//
this.searchForm.pageSize = val
//
this.init()
console.log(`每页 ${val}`);
},
//
handleCurrentChange(val) {
//
this.searchForm.currentPage = val
//
this.init()
console.log(`当前页: ${val}`);
},
//
submitSearchForm() {
//
this.init()
},
/*过期、下架分页*/
// /
init1() {
// API /
queryPageNoticeOut_untreated(this.searchForm1).then(res => {
res = res.data
if (res.code == 200) {
// 1
this.tableData1 = res.data.records
// 1
this.searchForm1.total = res.data.total
// 1
this.searchForm1.pageSize = res.data.size
// 1
this.searchForm1.currentPage = res.data.current
} else {
//
popup(res.msg, "error")
}
})
},
// /
handleSizeChange1(val) {
// 1
this.searchForm1.pageSize = val
// /
this.init1()
console.log(`每页 ${val}`);
},
// /
handleCurrentChange1(val) {
// 1
this.searchForm1.currentPage = val
// /
this.init1()
console.log(`当前页: ${val}`);
},
// /
submitSearchForm1() {
// /
this.init1()
},
//
selectedGoods(formName) {
//
this.$refs[formName].validate((valid) => {
if (valid) {
// API
queryOutGoods(this.selectGoods).then(res => {
res = res.data
if (res.code == 200) {
//
this.selectGoodsVisable = false
//
this.newVisable = true
//
this.newForm.goodsName = res.data.goodsName
//
this.newForm.state = this.selectGoods.state
// ID
this.newForm.storeId = this.selectGoods.storeId
// ID
this.newForm.goodsId = this.selectGoods.goodsId
//
// this.selectGoods = {}
} else {
//
popup(res.msg, "error")
}
})
}
})
},
//
closeSelectedGoods(formName) {
//
this.$refs[formName].resetFields()
//
this.selectGoods = {}
//
this.goodsOutVisable = false
},
//
submitNewForm(formName) {
//
this.$refs[formName].validate((valid) => {
if (valid) {
// API
saveOut_shelves(this.newForm).then(res => {
res = res.data
if (res.code == 200) {
//
popup("出库成功")
//
this.searchForm.state1 = '0'
//
this.goodsOutVisable = false
//
this.selectGoods = {}
//
this.init()
} else {
//
popup(res.msg, "error")
}
})
}
})
},
//
saveCancel(formName) {
//
this.$refs[formName].resetFields()
//
this.newVisable = false
//
this.selectGoodsVisable = true
}
},
//
mounted() {
//
this.initOptions()
}
}
</script>
<style>
/* 设置 #detail_store_goods_in 下 .noticeOut 元素的高度和背景颜色 */
#detail_store_goods_in .noticeOut {
height: 660px;
background-color: #bfdcf6;
}
/* 设置 #detail_store_goods_in 下 .noticeOut 内的 h1 元素和 .btns 元素的宽度 */
#detail_store_goods_in .noticeOut h1, .btns {
width: 100%;
}
/* 设置搜索表单元素的高度 */
.searchForm {
height: 134px;
}
/* 设置表格元素的高度 */
.table {
height: 320px;
}
/* 设置分页工具元素的定位、宽度、外边距和高度 */
.pageUtils {
position: absolute;
width: 84%;
@ -659,6 +880,7 @@
height: 43px;
}
/* 再次设置搜索表单元素的显示方式、外边距、高度和行高,后定义的样式会覆盖前面的 */
.searchForm {
display: inline-block;
margin: 0 auto;
@ -666,6 +888,7 @@
line-height: 51px;
}
/* 设置搜索表单内 .column 元素的显示方式、外边距、行高和高度 */
.searchForm .column {
display: inline-block;
margin: 0 auto;

@ -1,111 +1,160 @@
<template>
<!-- 组件根元素 -->
<div>
<!-- 面包屑导航用于展示页面层级关系 -->
<el-breadcrumb separator="/">
<!-- 首页导航项 -->
<el-breadcrumb-item>首页</el-breadcrumb-item>
<!-- 库存管理导航项 -->
<el-breadcrumb-item>库存管理 </el-breadcrumb-item>
<el-breadcrumb-item>仓库管理</el-breadcrumb-item> </el-breadcrumb
><br />
<!-- 仓库管理导航项 -->
<el-breadcrumb-item>仓库管理</el-breadcrumb-item>
</el-breadcrumb>
<!-- 换行 -->
<br />
<!-- 栅格布局一行两列 -->
<el-row>
<!-- 第一列 8 -->
<el-col :span="8" style="text-align: left;padding-right: 10px;">
<!-- 输入框用于输入仓库名称双向绑定到 searchForm.name -->
<el-input placeholder="仓库名称" v-model="searchForm.name"/>
</el-col>
<!-- 第二列 8 -->
<el-col :span="8">
<!-- 下拉选择框用于选择仓库状态双向绑定到 searchForm.state -->
<el-select v-model="searchForm.state" placeholder="请选择状态" clearable>
<!-- 正常状态选项 -->
<el-option label="正常" value="0"></el-option>
<!-- 停用状态选项 -->
<el-option label="停用" value="-1"></el-option>
</el-select>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 栅格布局一行一列 -->
<el-row>
<!-- 24 -->
<el-col :span="24" style="text-align: left">
<!-- 主要按钮点击触发 subSearchForm 方法 -->
<el-button
type="primary"
@click="subSearchForm"
style="font-size: 18px"
>
<!-- 搜索图标 -->
<i class="iconfont icon-r-find" style="font-size: 18px">
</i>
搜索</el-button
>
<!-- 按钮文本 -->
搜索</el-button>
<!-- 成功按钮点击显示创建仓库对话框 -->
<el-button
type="success"
@click="newVisable = true"
style="font-size: 18px"
>
<!-- 添加图标 -->
<i class="iconfont icon-r-add" style="font-size: 18px"> </i>
<!-- 按钮文本 -->
创建仓库
</el-button>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 表格组件数据绑定到 tableData -->
<el-table
:data="tableData"
style="width: 100%">
<!-- 序号列 -->
<el-table-column
type="index"
label="序号"
width="180">
</el-table-column>
<!-- 仓库名称列 -->
<el-table-column
prop="name"
label="名称"
width="180">
</el-table-column>
<!-- 仓库地址列 -->
<el-table-column
prop="address"
label="地址"
width="180">
</el-table-column>
<!-- 仓库描述列内容溢出显示 tooltip -->
<el-table-column
prop="info"
:show-overflow-tooltip="true"
label="描述">
</el-table-column>
<!-- 仓库状态列 -->
<el-table-column
prop="state"
label="状态">
<!-- 自定义列内容 -->
<template v-slot="scope">
<!-- 状态为正常时显示绿色标签 -->
<el-tag v-if="scope.row.state=='0'" type="success"></el-tag>
<!-- 状态为停用显示红色标签 -->
<el-tag v-else type="danger">停用</el-tag>
</template>
</el-table-column>
<!-- 操作列固定在右侧 -->
<el-table-column width="240" fixed="right"
label="操作">
<!-- 自定义列内容 -->
<template v-slot="scope">
<!-- 修改按钮点击触发 editStore 方法 -->
<el-button type="success" style="font-size: 18px;" @click="editStore(scope.row)">
<!-- 修改图标 -->
<i class="iconfont icon-r-edit" style="font-size: 18px;"> </i>
<!-- 按钮文本 -->
修改
</el-button>
<!-- 停用按钮点击触发 forbidden 方法 -->
<el-button style="font-size: 18px;" type="danger" @click="forbidden(scope.row.id)">
<!-- 停用图标 -->
<i class="iconfont icon-r-no" style="font-size: 18px;"> </i>
<!-- 按钮文本 -->
停用
</el-button>
</template>
</el-table-column>
</el-table>
<!--修改仓库弹出框-->
<!-- 修改仓库信息的对话框 -->
<el-dialog
title="仓库信息修改"
:visible.sync="dialogVisible"
width="50%">
<!-- 表单数据绑定到 editForm -->
<el-form v-model="editForm" label-width="100px" class="demo-ruleForm">
<!-- 仓库名称表单字段 -->
<el-form-item label="名称:">
<!-- 输入框双向绑定到 editForm.name -->
<el-input v-model="editForm.name"></el-input>
</el-form-item>
<!-- 仓库地址表单字段 -->
<el-form-item label="地址:">
<!-- 输入框双向绑定到 editForm.address -->
<el-input type="text" v-model="editForm.address"></el-input>
</el-form-item>
<!-- 仓库描述表单字段 -->
<el-form-item label="描述:">
<!-- 输入框双向绑定到 editForm.info -->
<el-input type="text" v-model="editForm.info"></el-input>
</el-form-item>
<!-- 仓库状态表单字段 -->
<el-form-item label="状态:">
<!-- 下拉选择框双向绑定到 editForm.state -->
<el-select v-model="editForm.state"
clearable
@change="$forceUpdate()"
placeholder="请选择状态">
<!-- 循环渲染状态选项 -->
<el-option
v-for="item in options"
:key="item.value"
@ -114,33 +163,49 @@
</el-option>
</el-select>
</el-form-item>
<!-- 表单操作按钮 -->
<el-form-item>
<!-- 提交按钮点击触发 submitEditForm 方法 -->
<el-button type="primary" @click="submitEditForm" style="font-size: 18px;">
<!-- 确认图标 -->
<i class="iconfont icon-r-yes" style="font-size: 18px;"> </i>
<!-- 按钮文本 -->
提交
</el-button>
<!-- 取消按钮点击触发 editCancel 方法 -->
<el-button style="font-size: 18px;" @click="editCancel"></el-button>
</el-form-item>
</el-form>
</el-dialog>
<!--创建仓库弹出框-->
<!-- 创建仓库对话框 -->
<el-dialog
title="创建仓库"
:visible.sync="newVisable"
width="50%">
<!-- 表单数据绑定到 newForm有验证规则 -->
<el-form :model="newForm" :rules="rules" ref="newForm" label-width="100px" class="demo-ruleForm">
<!-- 仓库名称表单字段有验证规则 -->
<el-form-item label="名称:" prop="name">
<!-- 输入框双向绑定到 newForm.name -->
<el-input v-model="newForm.name"></el-input>
</el-form-item>
<!-- 仓库地址表单字段有验证规则 -->
<el-form-item label="地址:" prop="address">
<!-- 输入框双向绑定到 newForm.address -->
<el-input type="text" v-model="newForm.address"></el-input>
</el-form-item>
<!-- 仓库描述表单字段 -->
<el-form-item label="描述:">
<!-- 输入框双向绑定到 newForm.info -->
<el-input type="text" v-model="newForm.info"></el-input>
</el-form-item>
<!-- 表单操作按钮 -->
<el-form-item>
<!-- 提交按钮点击触发 submitNewForm 方法 -->
<el-button type="primary" @click="submitNewForm('newForm')" style="font-size: 18px;">
<!-- 确认图标 -->
<i class="iconfont icon-r-yes" style="font-size: 18px;"> </i> 提交</el-button>
<!-- 取消按钮点击触发 saveCancel 方法 -->
<el-button @click="saveCancel" style="font-size: 18px;">取消</el-button>
</el-form-item>
</el-form>
@ -148,109 +213,146 @@
</div>
</template>
<script>
// API
import {deactivate, save, storeList, update} from "@/api/inventory_management/store/storeApi";
//
import {popup} from "@/assets/js/common";
export default {
//
data() {
return {
//
tableData: [],
// 使 newVisable
newStoreVisable: false,
//
dialogVisible: false,
//
editForm: {},
//
searchForm:{},
//
newVisable: false,
//
newForm:{},
//
options: [
{label: '正常', value: '0'},
{label: '停用', value: '-1'}
],
//
rules: {
//
name:[
{required: true, message: '名称不能为空', trigger: 'blur'},
],
//
address:[
{required: true, message: '地名不能为空', trigger: 'blur'},
],
}
}
},
//
methods: {
//
subSearchForm(){
this.init()
},
// storeList API
init() {
storeList(this.searchForm).then(res => {
if (res.data.code == 200) {
//
this.tableData = res.data.data
} else {
//
popup(res.data.msg, "error")
}
})
},
//
editStore(row) {
this.editForm = {...row}
this.dialogVisible = true
},
// deactivate API
forbidden(sid) {
deactivate(sid).then(res => {
res = res.data
if (res.code == 200) {
//
popup("操作成功")
} else {
//
popup(res.msg, "error")
}
//
this.init()
})
},
// update API
submitEditForm() {
update(this.editForm).then(res => {
res = res.data
if (res.code == 200) {
//
popup("操作成功")
//
this.init()
//
this.dialogVisible=false
} else {
//
popup(res.msg, "error")
}
})
},
//
editCancel() {
this.dialogVisible = false
this.editForm = {}
//
popup("已取消操作", "info")
},
//
submitNewForm(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
save(this.newForm).then(res=>{
res=res.data
if (res.code==200){
//
popup("操作成功")
//
this.newForm={}
//
this.newVisable=false
//
this.init()
}else {
//
popup(res.msg, "error")
}
})
}
});
},
//
saveCancel(){
this.newVisable=false
this.$refs["newForm"].resetFields()
}
},
//
mounted() {
this.init()
}
}
</script>
<style>
/* 搜索区域样式 */
.search {
display: inline-block;
margin: 0 auto;
@ -258,6 +360,7 @@
line-height: 51px;
}
/* 搜索区域列样式 */
.search .column {
display: inline-block;
margin: 0 auto;

@ -1,15 +1,25 @@
<template>
<!-- 组件的根元素 -->
<div>
<!-- 面包屑导航显示页面层级关系 -->
<el-breadcrumb separator="/">
<!-- 首页导航项 -->
<el-breadcrumb-item>首页</el-breadcrumb-item>
<!-- 库存管理导航项 -->
<el-breadcrumb-item>库存管理 </el-breadcrumb-item>
<el-breadcrumb-item>库存统计</el-breadcrumb-item> </el-breadcrumb
><br />
<!-- 库存统计导航项 -->
<el-breadcrumb-item>库存统计</el-breadcrumb-item>
</el-breadcrumb>
<!-- 换行 -->
<br />
<!-- 第一行栅格布局 -->
<el-row>
<!-- 第一列 8 包含仓库名称输入框 -->
<el-col :span="8">
<el-input placeholder="仓库名称" v-model="searchForm.name" />
</el-col>
<!-- 第二列 16 显示总存储量信息 -->
<el-col :span="16">
<i class="iconfont icon-r-add" style="font-size: 28px">
<b>
@ -20,8 +30,12 @@
</i>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 第二行栅格布局 -->
<el-row>
<!-- 整列占 24 包含搜索按钮 -->
<el-col :span="24" style="text-align: left">
<el-button
type="primary"
@ -30,29 +44,38 @@
>
<i class="iconfont icon-r-find" style="font-size: 18px">
</i>
搜索</el-button
>
搜索</el-button>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 表格容器 -->
<div class="table">
<!-- 表格组件展示仓库列表数据 -->
<el-table :data="tableData" style="width: 100%" size="medium">
<!-- 序号列 -->
<el-table-column type="index" width="200" label="序号">
</el-table-column>
<!-- 仓库名列 -->
<el-table-column
prop="storeName"
:show-overflow-tooltip="true"
label="仓库名"
>
</el-table-column>
<!-- 存货数量列 -->
<el-table-column
prop="residueNum"
:show-overflow-tooltip="true"
label="存货数量"
>
</el-table-column>
<!-- 操作列 -->
<el-table-column label="操作">
<!-- 操作列的内容插槽 -->
<template v-slot="scope">
<!-- 存储明细按钮点击时调用 detailStoreBtn 方法 -->
<el-button
type="primary"
style="font-size: 18px"
@ -62,12 +85,13 @@
class="iconfont icon-r-find"
style="font-size: 18px"
></i>
存储明细</el-button
>
存储明细</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件容器 -->
<div style="margin: 10px 0 15px 0">
<!-- 分页组件处理仓库列表的分页操作 -->
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@ -80,13 +104,17 @@
</el-pagination>
</div>
</div>
<!-- 仓库存储明细对话框 -->
<el-dialog
title="仓库存储明细"
:visible.sync="detailStoreVisible"
width="95%"
height="100%"
>
<!-- 对话框内的第一行栅格布局 -->
<el-row>
<!-- 第一列 8 包含商品选择下拉框 -->
<el-col :span="8" style="text-align: right;">
<el-select
v-model="searchDetailForm.id"
@ -95,6 +123,7 @@
@change="$forceUpdate()"
clearable
>
<!-- 循环生成下拉选项 -->
<el-option
v-for="item in options_storeGoods"
:key="item.id"
@ -104,20 +133,19 @@
</el-option>
</el-select>
</el-col>
<!-- 第二列 8 包含搜索和关闭按钮 -->
<el-col :span="8">
<el-button type="success" @click="submitDetailSearchForm" style="font-size: 18px;"
>
<i class="iconfont icon-r-find" style="font-size: 18px;"></i>
搜索</el-button
>
搜索</el-button>
<el-button @click="closeDetailStoreVisible" style="font-size: 18px;"
>
<i class="iconfont icon-r-no" style="font-size: 18px;"></i>
关闭</el-button
>
关闭</el-button>
</el-col>
<!-- 第三列 8 显示仓库内商品的总存储量信息 -->
<el-col :span="8">
<i class="iconfont icon-r-add" style="font-size: 28px">
<b>
总存储量<span style="color: #fc4316"
@ -127,28 +155,37 @@
</i>
</el-col>
</el-row>
<!-- 换行 -->
<br>
<!-- 对话框内的表格容器 -->
<div class="table" style="overflow: auto;height: 300px;">
<!-- 表格组件展示仓库内商品的存储明细数据 -->
<el-table :data="tableData1" style="width: 100%" size="medium" >
<!-- 序号列 -->
<el-table-column type="index" width="200" label="序号">
</el-table-column>
<!-- 商品名列 -->
<el-table-column
prop="goodsName"
:show-overflow-tooltip="true"
label="商品名"
>
</el-table-column>
<!-- 商品数量列 -->
<el-table-column
prop="residueNum"
:show-overflow-tooltip="true"
label="商品数量"
>
</el-table-column>
<!-- 占总存储量列使用环形进度条展示比例 -->
<el-table-column
prop="percentage"
:show-overflow-tooltip="true"
label="占总存储量"
>
<!-- 列内容插槽 -->
<template v-slot="scope">
<el-progress
type="circle"
@ -159,7 +196,9 @@
</template>
</el-table-column>
</el-table>
<!-- 分页组件容器 -->
<div style="margin: 10px 0 15px 0">
<!-- 分页组件处理仓库内商品存储明细的分页操作 -->
<el-pagination
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"
@ -176,98 +215,149 @@
</div>
</template>
<script>
//
import { popup } from "@/assets/js/common";
// API
import {
queryPageByQo,
queryStoreGoodsByStoreId,
} from "@/api/inventory_management/storage_situation/storageSituationApi";
// Vue
export default {
//
data() {
return {
/*表格*/
//
tableData: [],
//
tableData1: [],
//
totalStoreNum: "",
//
totalStoreNum1: "",
//
searchForm: {
total: 0,
currentPage: 1,
pageSize: 5,
},
//
searchDetailForm: {
total: 0,
currentPage: 1,
pageSize: 10,
},
//
options_storeGoods: [],
//
detailStoreVisible: false,
};
},
//
methods: {
//
init() {
// API
queryPageByQo(this.searchForm).then((res) => {
res = res.data;
if (res.code == 200) {
//
this.totalStoreNum = res.data.totalStoreNum;
//
this.tableData = res.data.page.records;
//
this.searchForm.total = res.data.page.total;
//
this.searchForm.pageSize = res.data.page.size;
//
this.searchForm.currentPage = res.data.page.current;
} else {
//
popup(res.msg, "error");
}
});
},
/*分页*/
//
handleSizeChange(val) {
//
this.searchForm.pageSize = val;
//
this.init();
console.log(`每页 ${val}`);
},
//
handleCurrentChange(val) {
//
this.searchForm.currentPage = val;
//
this.init();
console.log(`当前页: ${val}`);
},
//
submitSearchForm() {
//
this.init();
},
//
init1() {
// API
queryStoreGoodsByStoreId(this.searchDetailForm).then((res) => {
res = res.data;
if (res.code == 200) {
//
this.options_storeGoods = res.data.optionsStoreGoods;
//
this.totalStoreNum1 = res.data.totalStoreNum1;
//
this.tableData1 = res.data.vos.records;
//
this.searchDetailForm.total = res.data.vos.total;
//
this.searchDetailForm.pageSize = res.data.vos.size;
//
this.searchDetailForm.currentPage = res.data.vos.current;
//
this.detailStoreVisible = true;
} else {
//
popup(res.msg, "error");
}
});
},
//
detailStoreBtn(row) {
//
this.options_storeGoods = [];
//
this.totalStoreNum1 = "";
// ID
this.searchDetailForm.storeId = row.storeId;
//
this.init1();
},
//
handleSizeChange1(val) {
//
this.searchDetailForm.pageSize = val;
//
this.init1();
console.log(`每页 ${val}`);
},
//
handleCurrentChange1(val) {
//
this.searchDetailForm.currentPage = val;
//
this.init1();
console.log(`当前页: ${val}`);
},
//
submitDetailSearchForm() {
//
this.init1();
},
//
customColorMethod(percentage) {
if (percentage < 30) {
return "#f56c6c";
@ -277,29 +367,37 @@ export default {
return "#67c23a";
}
},
//
closeDetailStoreVisible() {
//
this.searchDetailForm = {
total: 0,
currentPage: 1,
pageSize: 10,
};
//
this.detailStoreVisible = false;
},
},
//
mounted() {
//
this.init();
},
};
</script>
<style>
/* 搜索表单相关样式,这里的样式可能与当前组件实际结构不太匹配,存在重复定义 */
.searchForm {
height: 134px;
}
/* 表格容器样式,设置高度 */
.table {
height: 320px;
}
/* 分页工具样式,设置定位、宽度、外边距和高度 */
.pageUtils {
position: absolute;
width: 84%;
@ -307,6 +405,7 @@ export default {
height: 43px;
}
/* 再次定义搜索表单样式,覆盖前面的 height 等样式 */
.searchForm {
display: inline-block;
margin: 0 auto;
@ -314,6 +413,7 @@ export default {
line-height: 51px;
}
/* 搜索表单内列的样式 */
.searchForm.column {
display: inline-block;
margin: 0 auto;

@ -1,102 +1,138 @@
<template>
<!-- 组件根元素 -->
<div>
<!-- 面包屑导航展示页面层级关系 -->
<el-breadcrumb separator="/">
<!-- 首页导航项 -->
<el-breadcrumb-item>首页</el-breadcrumb-item>
<!-- 库存管理导航项 -->
<el-breadcrumb-item>库存管理 </el-breadcrumb-item>
<el-breadcrumb-item>供货商信息</el-breadcrumb-item> </el-breadcrumb
><br />
<!-- 供货商信息导航项 -->
<el-breadcrumb-item>供货商信息</el-breadcrumb-item>
</el-breadcrumb>
<!-- 换行 -->
<br />
<!-- 栅格布局一行三列 -->
<el-row>
<!-- 第一列 8 包含供货商名称输入框 -->
<el-col :span="8" style="text-align: left; padding-right: 10px">
<el-input placeholder="供货商名称" v-model="searchForm.name" />
</el-col>
<!-- 第二列 8 包含供货商地址输入框 -->
<el-col :span="8" style="text-align: left; padding-right: 10px">
<el-input placeholder="地址" v-model="searchForm.address" />
</el-col>
<!-- 第三列 8 包含供货商描述输入框 -->
<el-col :span="8">
<el-input placeholder="描述" v-model="searchForm.info" />
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 栅格布局一行一列 -->
<el-row>
<!-- 24 包含搜索和创建按钮 -->
<el-col :span="24" style="text-align: left">
<!-- 搜索按钮点击触发 subSearchForm 方法 -->
<el-button
type="primary"
@click="subSearchForm"
style="font-size: 18px"
>
<!-- 搜索图标 -->
<i class="iconfont icon-r-find" style="font-size: 18px">
</i>
搜索</el-button
>
<!-- 按钮文本 -->
搜索</el-button>
<!-- 创建供货商按钮点击显示创建对话框 -->
<el-button
type="success"
@click="newVisable = true"
style="font-size: 18px"
>
<!-- 添加图标 -->
<i class="iconfont icon-r-add" style="font-size: 18px"> </i>
<!-- 按钮文本 -->
创建供货商
</el-button>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 表格容器 -->
<div class="table">
<!-- 表格组件展示供货商列表数据 -->
<el-table :data="tableData" style="width: 100%" size="medium">
<!-- 序号列 -->
<el-table-column type="index" width="200" label="序号">
</el-table-column>
<!-- 供货商名称列 -->
<el-table-column
prop="name"
:show-overflow-tooltip="true"
label="名称"
>
</el-table-column>
<!-- 供货商地址列 -->
<el-table-column
prop="address"
:show-overflow-tooltip="true"
label="地址"
>
</el-table-column>
<!-- 供货商联系电话列 -->
<el-table-column
prop="tel"
:show-overflow-tooltip="true"
label="联系电话"
>
</el-table-column>
<!-- 供货商备注列 -->
<el-table-column
prop="info"
:show-overflow-tooltip="true"
label="备注"
>
</el-table-column>
<!-- 操作列固定在右侧 -->
<el-table-column width="240" fixed="right" label="操作">
<!-- 操作列内容插槽 -->
<template v-slot="scope">
<!-- 修改按钮点击触发 editBtn 方法 -->
<el-button
type="warning"
@click="editBtn(scope.row.cn)"
style="font-size: 18px"
>
<!-- 修改图标 -->
<i
class="iconfont icon-r-edit"
style="font-size: 18px"
></i>
修改</el-button
>
<!-- 按钮文本 -->
修改</el-button>
<!-- 删除按钮点击触发 delBtn 方法 -->
<el-button
type="danger"
@click="delBtn(scope.row.cn)"
style="font-size: 18px"
>
<!-- 删除图标 -->
<i
class="iconfont icon-r-delete"
style="font-size: 18px"
></i>
删除</el-button
>
<!-- 按钮文本 -->
删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件容器 -->
<div style="margin: 10px 0 15px 0">
<!-- 分页组件处理供货商列表分页 -->
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@ -109,12 +145,14 @@
</el-pagination>
</div>
</div>
<!--创建弹出框-->
<!-- 创建供货商信息对话框 -->
<el-dialog
title="创建供货商信息"
:visible.sync="newVisable"
width="50%"
>
<!-- 表单绑定 newForm 数据有验证规则 -->
<el-form
:model="newForm"
:rules="rules"
@ -122,45 +160,57 @@
label-width="100px"
class="demo-ruleForm"
>
<!-- 供货商名称表单字段有验证规则 -->
<el-form-item label="名称:" prop="name">
<!-- 输入框双向绑定到 newForm.name -->
<el-input
v-model="newForm.name"
placeholder="供应商名称"
></el-input>
</el-form-item>
<!-- 供货商地址表单字段有验证规则 -->
<el-form-item label="地址:" prop="address">
<!-- 输入框双向绑定到 newForm.address -->
<el-input
type="text"
v-model="newForm.address"
placeholder="供应商地址"
></el-input>
</el-form-item>
<!-- 供货商联系电话表单字段有验证规则 -->
<el-form-item label="电话:" prop="tel">
<!-- 输入框双向绑定到 newForm.tel -->
<el-input
type="text"
v-model="newForm.tel"
placeholder="联系电话"
></el-input>
</el-form-item>
<!-- 供货商描述表单字段 -->
<el-form-item label="描述:">
<!-- 文本域输入框双向绑定到 newForm.info -->
<el-input
type="textarea"
v-model="newForm.info"
placeholder="供应商的简单描述"
></el-input>
</el-form-item>
<!-- 表单操作按钮 -->
<el-form-item>
<!-- 提交按钮点击触发 submitNewForm 方法 -->
<el-button
type="primary"
@click="submitNewForm('newForm')"
style="font-size: 18px"
>
<!-- 确认图标 -->
<i
class="iconfont icon-r-yes"
style="font-size: 18px"
></i>
提交</el-button
>
<!-- 按钮文本 -->
提交</el-button>
<!-- 关闭按钮点击重置表单并隐藏对话框 -->
<el-button
@click="
() => {
@ -170,17 +220,18 @@
}
"
style="font-size: 18px"
>关闭</el-button
>
>关闭</el-button>
</el-form-item>
</el-form>
</el-dialog>
<!--修改弹出框-->
<!-- 修改供货商信息对话框 -->
<el-dialog
title="修改供货商信息"
:visible.sync="editVisable"
width="50%"
>
<!-- 表单绑定 editForm 数据有验证规则 -->
<el-form
:model="editForm"
:rules="rules"
@ -188,45 +239,57 @@
label-width="100px"
class="demo-ruleForm"
>
<!-- 供货商名称表单字段有验证规则 -->
<el-form-item label="名称:" prop="name">
<!-- 输入框双向绑定到 editForm.name -->
<el-input
v-model="editForm.name"
placeholder="供应商名称"
></el-input>
</el-form-item>
<!-- 供货商地址表单字段有验证规则 -->
<el-form-item label="地址:" prop="address">
<!-- 输入框双向绑定到 editForm.address -->
<el-input
type="text"
v-model="editForm.address"
placeholder="供应商地址"
></el-input>
</el-form-item>
<!-- 供货商联系电话表单字段有验证规则 -->
<el-form-item label="电话:" prop="tel">
<!-- 输入框双向绑定到 editForm.tel -->
<el-input
type="text"
v-model="editForm.tel"
placeholder="联系电话"
></el-input>
</el-form-item>
<!-- 供货商描述表单字段 -->
<el-form-item label="描述:">
<!-- 文本域输入框双向绑定到 editForm.info -->
<el-input
type="textarea"
v-model="editForm.info"
placeholder="供应商的简单描述"
></el-input>
</el-form-item>
<!-- 表单操作按钮 -->
<el-form-item>
<!-- 提交按钮点击触发 submitEditForm 方法 -->
<el-button
type="primary"
@click="submitEditForm('editForm')"
style="font-size: 18px"
>
<!-- 确认图标 -->
<i
class="iconfont icon-r-yes"
style="font-size: 18px"
></i>
提交</el-button
>
<!-- 按钮文本 -->
提交</el-button>
<!-- 关闭按钮点击重置表单并隐藏对话框 -->
<el-button
@click="
() => {
@ -236,15 +299,16 @@
}
"
style="font-size: 18px"
>关闭</el-button
>
>关闭</el-button>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
//
import { popup } from "@/assets/js/common";
// API
import {
delSupplier,
queryByCn,
@ -254,17 +318,26 @@ import {
} from "@/api/inventory_management/supplier/supplierApi";
export default {
//
data() {
return {
//
tableData: [],
//
editVisable: false,
//
editForm: {},
//
searchForm: {
pageSize: 5,
},
//
newVisable: false,
//
newForm: {},
//
rules: {
//
name: [
{
required: true,
@ -272,6 +345,7 @@ export default {
trigger: "blur",
},
],
//
address: [
{
required: true,
@ -279,6 +353,7 @@ export default {
trigger: "blur",
},
],
//
tel: [
{
required: true,
@ -289,54 +364,71 @@ export default {
},
};
},
//
methods: {
//
subSearchForm() {
this.init();
},
// API
init() {
queryPageSupplier(this.searchForm).then((res) => {
res = res.data;
if (res.code == 200) {
//
this.tableData = res.data.records;
//
this.searchForm.total = res.data.total;
//
this.searchForm.pageSize = res.data.size;
//
this.searchForm.currentPage = res.data.current;
} else {
//
popup(res.msg, "error");
}
});
},
/*分页*/
//
handleSizeChange(val) {
this.searchForm.pageSize = val;
this.init();
console.log(`每页 ${val}`);
},
//
handleCurrentChange(val) {
this.searchForm.currentPage = val;
this.init();
console.log(`当前页: ${val}`);
},
// subSearchForm
submitSearchForm() {
this.init();
},
//
submitNewForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
saveSupplier(this.newForm).then((res) => {
res = res.data;
if (res.code == 200) {
//
popup("添加成功");
//
this.newVisable = false;
//
this.newForm = {};
//
this.init();
} else {
//
popup(res.msg, "error");
}
});
}
});
},
//
delBtn(cn) {
this.$confirm("确定要删除这条记录" + "", "警示", {
confirmButtonText: "确定",
@ -347,42 +439,56 @@ export default {
delSupplier({ cn: cn }).then((res) => {
res = res.data;
if (res.code == 200) {
//
popup("删除成功");
//
this.init();
} else {
//
popup(res.msg, "warning");
}
});
})
.catch(() => {
//
this.$message({
type: "info",
message: "已取消操作",
});
});
},
//
editBtn(cn) {
queryByCn({ cn: cn }).then((res) => {
res = res.data;
if (res.code == 200) {
//
this.editForm = { ...res.data };
//
this.editVisable = true;
} else {
//
popup(res.msg, "error");
}
});
},
//
submitEditForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
updateSupplier(this.editForm).then((res) => {
res = res.data;
if (res.code == 200) {
//
popup("修改成功");
//
this.editVisable = false;
//
this.editForm = {};
//
this.init();
} else {
//
popup(res.msg, "error");
}
});
@ -390,16 +496,19 @@ export default {
});
},
},
//
mounted() {
this.init();
},
};
</script>
<style>
/* 表格容器样式,设置高度 */
.table {
height: 320px;
}
/* 分页工具样式,设置定位、宽度、外边距和高度 */
.pageUtils {
position: absolute;
width: 84%;
@ -407,6 +516,7 @@ export default {
height: 43px;
}
/* 搜索区域样式 */
.search {
display: inline-block;
margin: 0 auto;
@ -414,6 +524,7 @@ export default {
line-height: 51px;
}
/* 搜索区域列样式 */
.search .column {
display: inline-block;
margin: 0 auto;

@ -1,18 +1,29 @@
<template>
<!-- 定义组件的根元素id employee_index -->
<div id="employee_index">
<!-- 面包屑导航组件separator 属性设置分隔符为 / -->
<el-breadcrumb separator="/">
<!-- 面包屑导航的第一个项显示首页 -->
<el-breadcrumb-item>首页</el-breadcrumb-item>
<!-- 面包屑导航的第二个项显示会员管理 -->
<el-breadcrumb-item>会员管理</el-breadcrumb-item>
<el-breadcrumb-item>会员信息</el-breadcrumb-item> </el-breadcrumb
><br />
<!-- 面包屑导航的第三个项显示会员信息 -->
<el-breadcrumb-item>会员信息</el-breadcrumb-item>
</el-breadcrumb>
<!-- 换行 -->
<br />
<!-- 栅格布局容器一行分为三列 -->
<el-row>
<!-- 第一列 8 设置文本左对齐和右内边距为 10px包含姓名输入框 -->
<el-col :span="8" style="text-align: left; padding-right: 10px">
<el-input placeholder="姓名" v-model="searchForm.name" />
</el-col>
<!-- 第二列 8 设置文本左对齐和右内边距为 10px包含手机号码输入框 -->
<el-col :span="8" style="text-align: left; padding-right: 10px">
<el-input placeholder="手机号码" v-model="searchForm.phone" />
</el-col>
<!-- 第三列 8 包含会员状态选择框 -->
<el-col :span="8">
<el-select
v-model="searchForm.state"
@ -20,101 +31,132 @@
placeholder="状态"
clearable
>
<!-- 状态选择框的选项标签为正常值为 0 -->
<el-option label="正常" value="0"></el-option>
<!-- 状态选择框的选项标签为删除值为 1 -->
<el-option label="删除" value="1"></el-option>
</el-select>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 栅格布局容器一行只有一列 -->
<el-row>
<!-- 这一列占 24 设置文本左对齐包含搜索和录入会员按钮 -->
<el-col :span="24" style="text-align: left">
<!-- 搜索按钮类型为 primary点击时调用 submitSearchForm 方法设置字体大小 -->
<el-button
type="primary"
@click="submitSearchForm"
style="font-size: 18px"
>
<!-- 搜索按钮的图标 -->
<i class="iconfont icon-r-find" style="font-size: 18px">
</i>
搜索</el-button
>
<!-- 搜索按钮的文本 -->
搜索</el-button>
<!-- 录入会员按钮类型为 success点击时将 newVisable 设置为 true设置字体大小 -->
<el-button
type="success"
@click="newVisable = true"
style="font-size: 18px"
>
<!-- 录入会员按钮的图标 -->
<i class="iconfont icon-r-add" style="font-size: 18px"> </i>
<!-- 录入会员按钮的文本 -->
录入会员
</el-button>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!--表格数据-->
<!-- 表格数据的容器 -->
<div class="table">
<!-- 表格组件数据绑定到 tableData设置宽度为 100%大小为 medium -->
<el-table :data="tableData" style="width: 100%" size="medium">
<!-- 表格列显示手机号prop 绑定到数据中的 phone 字段 -->
<el-table-column prop="phone" label="手机号"> </el-table-column>
<!-- 表格列显示姓名prop 绑定到数据中的 name 字段 -->
<el-table-column prop="name" label="姓名"> </el-table-column>
<!-- 表格列显示邮箱设置当内容溢出时显示 tooltipprop 绑定到数据中的 email 字段 -->
<el-table-column
prop="email"
:show-overflow-tooltip="true"
label="邮箱"
>
</el-table-column>
<!-- 表格列显示积分prop 绑定到数据中的 integral 字段 -->
<el-table-column prop="integral" label="积分">
</el-table-column>
<!-- 表格列显示状态根据状态值显示不同的标签 -->
<el-table-column prop="state" label="状态">
<template v-slot="scope">
<!-- 如果状态为 0显示绿色的正常标签 -->
<el-tag v-if="scope.row.state == '0'" type="success"
>正常</el-tag
>
>正常</el-tag>
<!-- 否则显示红色的删除标签 -->
<el-tag v-else type="danger">删除</el-tag>
</template>
</el-table-column>
<!-- 表格列显示备注设置当内容溢出时显示 tooltipprop 绑定到数据中的 info 字段 -->
<el-table-column
prop="info"
:show-overflow-tooltip="true"
label="备注"
>
</el-table-column>
<!-- 表格列显示操作固定在右侧宽度为 420 -->
<el-table-column label="操作" width="420" fixed="right">
<template v-slot="scope">
<!-- 如果会员状态为 0显示积分兑换按钮点击时调用 exchangeProductsBtn 方法 -->
<el-button
v-if="scope.row.state == '0'"
type="warning"
@click="exchangeProductsBtn(scope.row.id)"
style="font-size: 18px"
>
<!-- 积分兑换按钮的图标 -->
<i
class="iconfont icon-r-refresh"
style="font-size: 18px"
></i>
<!-- 积分兑换按钮的文本 -->
积分兑换
</el-button>
<!-- 修改按钮点击时调用 editBtn 方法 -->
<el-button
type="success"
@click="editBtn(scope.row.id)"
style="font-size: 18px"
>
<!-- 修改按钮的图标 -->
<i
class="iconfont icon-r-edit"
style="font-size: 18px"
></i>
修改</el-button
>
<!-- 修改按钮的文本 -->
修改</el-button>
<!-- 删除按钮点击时调用 delBtn 方法 -->
<el-button
type="danger"
@click="delBtn(scope.row.id)"
style="font-size: 18px"
>
<!-- 删除按钮的图标 -->
<i
class="iconfont icon-r-delete"
style="font-size: 18px"
></i>
删除</el-button
>
<!-- 删除按钮的文本 -->
删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件的容器设置外边距 -->
<div style="margin: 10px 0 15px 0">
<!-- 分页组件监听 size-change current-change 事件绑定分页相关数据到 searchForm -->
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@ -128,13 +170,14 @@
</div>
</div>
<!--录入-->
<!-- 录入会员的对话框title 录入会员根据 newVisable 的值显示或隐藏设置标签宽度和宽度 -->
<el-dialog
title="录入会员"
:visible.sync="newVisable"
label-width="200"
width="50%"
>
<!-- 表单组件绑定到 newForm设置验证规则和引用设置标签宽度和类名 -->
<el-form
:model="newForm"
:rules="rules"
@ -142,6 +185,7 @@
label-width="100px"
class="demo-ruleForm"
>
<!-- 表单字段标签为号码prop phone包含手机号输入框 -->
<el-form-item label="号码:" prop="phone">
<el-input
max="11"
@ -150,18 +194,21 @@
></el-input>
</el-form-item>
<!-- 表单字段标签为姓名prop name包含姓名输入框 -->
<el-form-item label="姓名:" prop="name">
<el-input
v-model="newForm.name"
placeholder="请输入姓名"
></el-input>
</el-form-item>
<!-- 表单字段标签为邮箱包含邮箱输入框 -->
<el-form-item label="邮箱:">
<el-input
v-model="newForm.email"
placeholder="如xxx@qq.com"
></el-input>
</el-form-item>
<!-- 表单字段标签为备注包含备注的文本域输入框 -->
<el-form-item label="备注:">
<el-input
type="textarea"
@ -169,28 +216,31 @@
placeholder="如:新会员"
></el-input>
</el-form-item>
<!-- 表单操作项包含提交和取消按钮 -->
<el-form-item>
<!-- 提交按钮类型为 primary点击时调用 submitNewForm 方法设置字体大小 -->
<el-button
type="primary"
@click="submitNewForm('newForm')"
style="font-size: 18px"
>
<!-- 提交按钮的图标 -->
<i
class="iconfont icon-r-yes"
style="font-size: 18px"
></i>
提交</el-button
>
<!-- 提交按钮的文本 -->
提交</el-button>
<!-- 取消按钮点击时调用 saveCancel 方法设置字体大小 -->
<el-button
@click="saveCancel('newForm')"
style="font-size: 18px"
>
取消</el-button
>
取消</el-button>
</el-form-item>
</el-form>
</el-dialog>
<!--修改-->
<!-- 修改会员的对话框title 修改会员根据 editVisable 的值显示或隐藏设置大小标签宽度和宽度 -->
<el-dialog
title="修改会员"
:visible.sync="editVisable"
@ -198,6 +248,7 @@
label-width="200"
width="50%"
>
<!-- 表单组件绑定到 editForm设置验证规则和引用设置标签宽度和类名 -->
<el-form
:model="editForm"
:rules="rules"
@ -205,6 +256,7 @@
label-width="100px"
class="demo-ruleForm"
>
<!-- 表单字段标签为号码prop phone包含手机号输入框 -->
<el-form-item label="号码:" prop="phone">
<el-input
max="11"
@ -212,24 +264,28 @@
v-model="editForm.phone"
></el-input>
</el-form-item>
<!-- 表单字段标签为姓名prop name包含姓名输入框 -->
<el-form-item label="姓名:" prop="name">
<el-input
v-model="editForm.name"
placeholder="请输入姓名"
></el-input>
</el-form-item>
<!-- 表单字段标签为邮箱包含邮箱输入框 -->
<el-form-item label="邮箱:">
<el-input
v-model="editForm.email"
placeholder="如xxx@qq.com"
></el-input>
</el-form-item>
<!-- 表单字段标签为积分包含积分输入框 -->
<el-form-item label="积分:">
<el-input
v-model="editForm.integral"
placeholder="如10"
></el-input>
</el-form-item>
<!-- 表单字段标签为备注包含备注的文本域输入框 -->
<el-form-item label="备注:">
<el-input
type="textarea"
@ -237,6 +293,7 @@
placeholder="如:新会员"
></el-input>
</el-form-item>
<!-- 表单字段标签为状态prop state包含状态选择框 -->
<el-form-item label="状态:" prop="state">
<el-select
v-model="editForm.state"
@ -245,45 +302,52 @@
@change="$forceUpdate()"
clearable
>
<!-- 状态选择框的选项标签为正常值为 0 -->
<el-option label="正常" value="0"></el-option>
<!-- 状态选择框的选项标签为删除值为 1 -->
<el-option label="删除" value="1"></el-option>
</el-select>
</el-form-item>
<!-- 表单操作项包含提交和关闭按钮 -->
<el-form-item>
<!-- 提交按钮类型为 primary点击时调用 submitEditForm 方法设置字体大小 -->
<el-button
type="primary"
@click="submitEditForm('editForm')"
style="font-size: 18px"
>
<!-- 提交按钮的图标 -->
<i
class="iconfont icon-r-yes"
style="font-size: 18px"
></i>
提交</el-button
>
<!-- 提交按钮的文本 -->
提交</el-button>
<!-- 关闭按钮类型为 info点击时调用 resetEditForm 方法设置字体大小 -->
<el-button
type="info"
@click="resetEditForm('editForm')"
style="font-size: 18px"
>
关闭</el-button
>
关闭</el-button>
</el-form-item>
</el-form>
</el-dialog>
<!--积分商品-->
<!-- 兑换积分商品的对话框title 兑换积分商品根据 pointProductsVisable 的值显示或隐藏设置标签宽度和宽度 -->
<el-dialog
title="兑换积分商品"
:visible.sync="pointProductsVisable"
label-width="200"
width="40%"
>
<!-- 表单组件绑定到 pointProductsForm设置验证规则和引用设置类名 -->
<el-form
:model="pointProductsForm"
:rules="rules"
ref="pointProductsForm"
class="demo-ruleForm"
>
<!-- 如果选择了积分商品pointProductsForm.goodsId 有值显示商品图片 -->
<el-form-item v-if="pointProductsForm.goodsId">
<img
width="100px"
@ -291,6 +355,7 @@
alt="商品图片"
/>
</el-form-item>
<!-- 表单字段标签为积分商品prop goodsId包含积分商品选择框 -->
<el-form-item label="积分商品:" prop="goodsId">
<el-select
@change="
@ -303,6 +368,7 @@
filterable
clearable
>
<!-- 循环生成积分商品选择框的选项 -->
<el-option
v-for="item in options_pointProducts"
:key="item.id"
@ -312,6 +378,7 @@
</el-option>
</el-select>
</el-form-item>
<!-- 如果选择了积分商品pointProductsForm.goodsId 有值显示所需积分的输入框只读 -->
<el-form-item
v-if="pointProductsForm.goodsId"
label="所需积分:"
@ -323,291 +390,406 @@
placeholder="所需积分"
/>
</el-form-item>
<!-- 表单操作项包含兑换和关闭按钮 -->
<el-form-item>
<!-- 如果选择了积分商品pointProductsForm.goodsId 有值显示兑换按钮点击时调用 submitPointProductsForm 方法设置字体大小 -->
<el-button
v-if="pointProductsForm.goodsId"
type="warning"
@click="submitPointProductsForm('pointProductsForm')"
style="font-size: 18px"
>
@
<i
class="iconfont icon-r-yes"
style="font-size: 18px"
></i>
<!-- 兑换按钮的文本 -->
兑换
</el-button>
<!-- 关闭按钮类型为 info点击时调用 closePointProductsForm 方法设置字体大小 -->
<el-button
type="info"
@click="closePointProductsForm"
style="font-size: 18px"
>
关闭</el-button
>
关闭
</el-button>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
//
import { popup } from "@/assets/js/common";
// API
import {
delMember,
queryPageByQo,
save,
update,
queryMemberById,
queryMemberById
} from "@/api/member_management/member/memberApi";
// API
import {
queryPointProductByGoodsId,
queryPointProductBymemberId,
saveExchangePointProductRecords,
saveExchangePointProductRecords
} from "@/api/sale_management/exchange_point_products/exchangePointProductsApi";
export default {
//
data() {
return {
// Vuex API
BaseApi: this.$store.state.BaseApi,
//
newVisable: false,
//
editVisable: false,
// 5
searchForm: {
pageSize: 5,
pageSize: 5
},
//
tableData: [],
//
newForm: {},
//
editForm: {},
//
rules: {
name: [
{
//
required: true,
message: "名称不能为空",
trigger: "blur",
},
trigger: "blur"
}
],
phone: [
{
//
required: true,
message: "手机号不能为空",
trigger: "blur",
},
trigger: "blur"
}
],
state: [
{
//
required: true,
message: "状态不能为空",
trigger: "blur",
},
trigger: "blur"
}
],
goodsId: [
{
// ID
required: true,
message: "商品不能为空",
trigger: "blur",
},
],
trigger: "blur"
}
]
},
//
options_pointProducts: [],
//
pointProductsForm: {
goodsId: "",
coverUrl: "",
integral: "",
integral: ""
},
pointProductsVisable: false,
//
pointProductsVisable: false
};
},
//
methods: {
//
init() {
// API
queryPageByQo(this.searchForm).then((res) => {
//
res = res.data;
if (res.code == 200) {
//
console.log(res.data);
//
this.tableData = res.data.records;
//
this.searchForm.total = res.data.total;
//
this.searchForm.pageSize = res.data.size;
//
this.searchForm.currentPage = res.data.current;
} else {
//
popup(res.msg, "error");
}
});
},
/*分页*/
//
handleSizeChange(val) {
//
this.searchForm.pageSize = val;
//
this.init();
//
console.log(`每页 ${val}`);
},
//
handleCurrentChange(val) {
//
this.searchForm.currentPage = val;
//
this.init();
//
console.log(`当前页: ${val}`);
},
//
submitSearchForm() {
//
this.init();
},
//
saveCancel(formName) {
//
this.newForm = {};
//
this.$refs[formName].resetFields();
//
this.newVisable = false;
},
//
submitNewForm(formName) {
//
this.$refs[formName].validate((valid) => {
if (valid) {
// API
save(this.newForm).then((res) => {
//
res = res.data;
if (res.code == 200) {
//
popup("操作成功");
//
this.newForm = {};
//
this.newVisable = false;
//
this.init();
} else {
//
popup(res.msg, "error");
}
});
}
});
},
//
editBtn(id) {
// ID API
queryMemberById({ id: id }).then((res) => {
//
res = res.data;
if (res.code == 200) {
//
this.editForm = { ...res.data };
//
this.editVisable = true;
} else {
//
popup(res.msg, "error");
}
});
},
//
submitEditForm(formName) {
//
this.$refs[formName].validate((valid) => {
if (valid) {
// API
update(this.editForm).then((res) => {
//
res = res.data;
if (res.code == 200) {
//
popup("操作成功");
//
this.editForm = {};
//
this.editVisable = false;
//
this.init();
} else {
//
popup(res.msg, "error");
}
});
}
});
},
//
resetEditForm(formName) {
//
this.editForm = {};
//
this.$refs[formName].resetFields();
//
this.editVisable = false;
},
//
delBtn(id) {
//
this.$confirm("确定删除该会员?", "警示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
type: "warning"
})
.then(() => {
// API
delMember({ id: id }).then((res) => {
//
res = res.data;
if (res.code == 200) {
//
popup("操作成功");
//
this.searchForm.state = "0";
//
this.init();
} else {
//
popup(res.msg, "error");
}
});
})
.catch(() => {
//
this.$message({
type: "info",
message: "已取消操作",
message: "已取消操作"
});
});
},
/*兑换积分商品*/
//
exchangeProductsBtn(id) {
(this.pointProductsForm = {
//
this.pointProductsForm = {
memberId: this.pointProductsForm.memberId,
goodsId: "",
coverUrl: "",
integral: "",
}),
integral: ""
};
// ID API
queryPointProductBymemberId({ memberId: id }).then((res) => {
//
res = res.data;
if (res.code == 200) {
//
this.options_pointProducts = res.data;
if (!this.options_pointProducts.length) {
//
popup("该会员积分数无法兑换任何商品", "warning");
return;
}
// ID
this.pointProductsForm.memberId = id;
//
this.pointProductsVisable = true;
} else {
//
popup(res.msg, "error");
}
});
},
//
submitPointProductsForm(formName) {
//
this.$refs[formName].validate((valid) => {
if (valid) {
// API
saveExchangePointProductRecords(
this.pointProductsForm
).then((res) => {
//
res = res.data;
if (res.code == 200) {
//
popup("兑换成功");
//
this.pointProductsForm = {};
//
this.pointProductsVisable = false;
//
this.init();
} else {
//
popup(res.msg, "error");
}
});
}
});
},
//
closePointProductsForm() {
//
this.options_pointProducts = [];
//
this.pointProductsForm = {};
//
this.pointProductsVisable = false;
},
// ID
queryPointProductByGoodsId(goodsId) {
// ID API
queryPointProductByGoodsId({ goodsId: goodsId }).then((res) => {
//
res = res.data;
if (res.code == 200) {
if (!res.data) {
//
this.pointProductsForm = {
memberId: this.pointProductsForm.memberId,
goodsId: "",
coverUrl: "",
integral: "",
integral: ""
};
return;
}
//
this.pointProductsForm.integral = res.data.integral;
// URL
this.pointProductsForm.coverUrl = res.data.coverUrl;
} else {
//
popup(res.msg, "error");
// ID
this.pointProductsForm.goodsId = "";
}
});
}
},
},
//
mounted() {
/*初始化表格数据*/
//
this.searchForm.state = "0";
//
this.init();
},
}
};
</script>
<style>
/* 搜索表单样式,设置高度 */
.searchForm {
height: 134px;
}
/* 表格样式,设置高度 */
.table {
height: 320px;
}
/* 分页工具样式,设置定位、宽度、外边距和高度 */
.pageUtils {
position: absolute;
width: 84%;
@ -615,6 +797,7 @@ export default {
height: 43px;
}
/* 搜索表单样式,重新设置高度和布局 */
.searchForm {
display: inline-block;
margin: 0 auto;
@ -622,6 +805,7 @@ export default {
line-height: 51px;
}
/* 搜索表单列样式,设置布局和行高 */
.searchForm .column {
display: inline-block;
margin: 0 auto;
@ -630,6 +814,7 @@ export default {
height: 51px;
}
/* 头像上传组件的上传区域样式,设置边框、圆角、鼠标样式和溢出处理 */
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
@ -638,10 +823,12 @@ export default {
overflow: hidden;
}
/* 头像上传组件的上传区域鼠标悬停样式,设置边框颜色 */
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
/* 头像上传组件的图标样式,设置字体大小、颜色、宽度、高度、行高和文本对齐方式 */
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
@ -651,6 +838,7 @@ export default {
text-align: center;
}
/* 头像样式,设置宽度、高度和显示方式 */
.avatar {
width: 178px;
height: 178px;

@ -1,12 +1,20 @@
<template>
<!-- 组件的根容器 -->
<div>
<!-- 面包屑导航组件用于显示页面层级关系分隔符为 / -->
<el-breadcrumb separator="/">
<!-- 面包屑导航的第一个元素显示首页 -->
<el-breadcrumb-item>首页</el-breadcrumb-item>
<!-- 面包屑导航的第二个元素显示个人中心 -->
<el-breadcrumb-item>个人中心 </el-breadcrumb-item>
<el-breadcrumb-item>密码修改</el-breadcrumb-item> </el-breadcrumb
><br />
<!-- 面包屑导航的第三个元素显示密码修改 -->
<el-breadcrumb-item>密码修改</el-breadcrumb-item>
</el-breadcrumb>
<!-- 换行 -->
<br />
<!-- 密码修改表单的容器设置了 id edit_pwd -->
<div id="edit_pwd">
<!-- Element UI 的表单组件绑定表单数据到 pwdForm设置验证规则为 rules引用为 pwdForm标签宽度为 100px添加类名 demo-ruleForm -->
<el-form
:model="pwdForm"
:rules="rules"
@ -14,46 +22,62 @@
label-width="100px"
class="demo-ruleForm"
>
<!-- 显示一个图标和标题密码修改 -->
<i class="iconfont icon-r-lock" style="font-size: 32px">
<b style="font-size: 28px">密码修改</b></i
>
<!-- 换行 -->
<br />
<!-- 换行 -->
<br />
<!-- 表单中的账号字段标签为账号 -->
<el-form-item label="账号">
<!-- 输入框设置为禁用状态绑定账号数据到 pwdForm.username -->
<el-input disabled v-model="pwdForm.username"></el-input>
</el-form-item>
<!-- 表单中的旧密码字段标签为旧密码设置了验证规则 rules 中定义 -->
<el-form-item label="旧密码" prop="oldPwd">
<!-- 密码输入框绑定旧密码数据到 pwdForm.oldPwd -->
<el-input
type="password"
v-model="pwdForm.oldPwd"
></el-input>
</el-form-item>
<!-- 表单中的新密码字段标签为新密码设置了验证规则 rules 中定义 -->
<el-form-item label="新密码" prop="newPwd">
<!-- 密码输入框绑定新密码数据到 pwdForm.newPwd -->
<el-input
type="password"
v-model="pwdForm.newPwd"
></el-input>
</el-form-item>
<!-- 表单中的操作按钮区域 -->
<el-form-item>
<!-- 确定按钮类型为 primary点击触发 submitForm 方法设置字体大小为 18px -->
<el-button
type="primary"
@click="submitForm('pwdForm')"
style="font-size: 18px"
>
<!-- 按钮图标 -->
<i
class="iconfont icon-r-yes"
style="font-size: 18px"
></i>
<!-- 按钮文本 -->
确定</el-button
>
<!-- 重置按钮点击触发 resetForm 方法设置字体大小为 18px -->
<el-button
@click="resetForm('pwdForm')"
style="font-size: 18px"
>
<!-- 按钮图标 -->
<i
class="iconfont icon-r-refresh"
style="font-size: 18px"
></i>
<!-- 按钮文本 -->
重置</el-button
>
</el-form-item>
@ -62,93 +86,123 @@
</div>
</template>
<script>
// token
import { loginEmp, removeToken } from "@/assets/js/auth";
// js-cookie cookie
import Cookies from "js-cookie";
// ajaxPost POST popup
import { ajaxPost, popup } from "@/assets/js/common";
export default {
//
data() {
return {
//
pwdForm: {},
//
rules: {
newPwd: [
{
//
required: true,
message: "新密码不能为空",
trigger: "blur",
trigger: "blur"
},
{
// 6 - 8
min: 6,
max: 8,
message: "新密码长度为6 - 8位",
trigger: "blur",
},
trigger: "blur"
}
],
oldPwd: [
{
//
required: true,
message: "旧密码不能为空",
trigger: "blur",
trigger: "blur"
},
{
// 6 - 8
min: 6,
max: 8,
message: "旧密码长度为6 - 8位",
trigger: "blur",
},
],
},
trigger: "blur"
}
]
}
};
},
//
methods: {
//
init() {
// loginEmp pwdForm.username
this.pwdForm.username = loginEmp().username;
},
//
resetForm(formName) {
// resetFields
this.$refs[formName].resetFields();
},
//
submitForm(formName) {
//
this.$refs[formName].validate((valid) => {
if (valid) {
//
this.$confirm("确定修改密码?", "警示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
type: "warning"
})
.then(() => {
// POST /personal/edit_pwd
ajaxPost("/personal/edit_pwd", this.pwdForm).then(
(res) => {
//
res = res.data;
if (res.code == 200) {
//
popup("密码修改成功,请重新登录...");
//
this.pwdForm = {
username: this.pwdForm.username,
username: this.pwdForm.username
};
// employee cookie
Cookies.remove("employee");
// token
removeToken();
//
this.$router.push("/");
} else {
//
popup(res.msg, "error");
}
}
);
})
.catch(() => {
//
this.$message({
type: "info",
message: "已取消操作",
message: "已取消操作"
});
});
}
});
}
},
},
//
created() {
//
this.init();
},
}
};
</script>
<style>
/* 密码修改表单容器的样式,设置宽度为 50%,水平居中,背景颜色为白色,添加内边距 */
#edit_pwd {
width: 50%;
margin: 50px auto;

@ -1,16 +1,28 @@
<template>
<!-- 组件的根元素设置了 id information -->
<div id="information">
<!-- 面包屑导航组件用于显示页面层级分隔符为 / -->
<el-breadcrumb separator="/">
<!-- 面包屑导航的第一个项显示首页 -->
<el-breadcrumb-item>首页</el-breadcrumb-item>
<!-- 面包屑导航的第二个项显示个人中心 -->
<el-breadcrumb-item>个人中心 </el-breadcrumb-item>
<el-breadcrumb-item>个人资料</el-breadcrumb-item> </el-breadcrumb
><br />
<!-- 面包屑导航的第三个项显示个人资料 -->
<el-breadcrumb-item>个人资料</el-breadcrumb-item>
</el-breadcrumb>
<!-- 换行 -->
<br />
<!-- 显示一个图标和标题完善个人资料 -->
<i class="iconfont icon-r-paper" style="font-size: 32px">
<b style="font-size: 28px">完善个人资料</b></i
>
<!-- 换行 -->
<br />
<!-- 换行 -->
<br />
<!-- Element UI 的表单组件绑定表单数据到 informationForm设置验证规则为 rules引用为 informationForm标签宽度为 100px添加类名 demo-ruleForm -->
<el-form
:model="informationForm"
:rules="rules"
@ -18,9 +30,13 @@
label-width="100px"
class="demo-ruleForm"
>
<!-- 栅格布局的一行 -->
<el-row>
<!-- 这一行的第一列 12 -->
<el-col :span="12">
<!-- 表单字段项设置宽度为 40% -->
<el-form-item style="width: 40%">
<!-- 上传组件用于上传头像 -->
<el-upload
class="avatar-uploader"
action="http://localhost:9291/personnel_management/employee/uploadImg"
@ -28,11 +44,13 @@
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
>
<!-- 如果 imageUrl 存在显示上传的头像图片 -->
<img
v-if="imageUrl"
:src="BaseApi + imageUrl"
class="avatar"
/>
<!-- 如果 imageUrl 不存在显示一个添加图片的图标 -->
<i
v-else
class="el-icon-plus avatar-uploader-icon"
@ -41,8 +59,11 @@
</el-form-item>
</el-col>
</el-row>
<!-- 栅格布局的一行 -->
<el-row>
<!-- 这一行的第一列 12 -->
<el-col :span="12">
<!-- 表单字段项标签为电话号码设置宽度为 40%绑定数据到 informationForm.username -->
<el-form-item
style="width: 40%"
label="电话号码:"
@ -54,7 +75,9 @@
></el-input>
</el-form-item>
</el-col>
<!-- 这一行的第二列 12 -->
<el-col :span="12">
<!-- 表单字段项标签为姓名设置宽度为 40%绑定数据到 informationForm.nickName -->
<el-form-item
style="width: 40%"
label="姓名:"
@ -66,8 +89,11 @@
</el-form-item>
</el-col>
</el-row>
<!-- 栅格布局的一行 -->
<el-row>
<!-- 这一行的第一列 12 -->
<el-col :span="12">
<!-- 表单字段项标签为身份证号设置宽度为 40%绑定数据到 informationForm.idCard -->
<el-form-item
style="width: 40%"
label="身份证号:"
@ -78,7 +104,9 @@
></el-input>
</el-form-item>
</el-col>
<!-- 这一行的第二列 12 -->
<el-col :span="12">
<!-- 表单字段项标签为年龄设置宽度为 40%绑定数据到 informationForm.age限制输入为数字且在 18 70 之间 -->
<el-form-item style="width: 40%" label="年龄:">
<el-input
type="number"
@ -89,8 +117,11 @@
</el-form-item>
</el-col>
</el-row>
<!-- 栅格布局的一行 -->
<el-row>
<!-- 这一行的第一列 12 -->
<el-col :span="12">
<!-- 表单字段项标签为所属部门设置宽度为 40%绑定数据到 informationForm.deptId设置为禁用状态 -->
<el-form-item
style="width: 40%"
label="所属部门:"
@ -104,6 +135,7 @@
@change="$forceUpdate()"
clearable
>
<!-- 循环生成部门选项 -->
<el-option
v-for="item in options"
:key="item.id"
@ -114,7 +146,9 @@
</el-select>
</el-form-item>
</el-col>
<!-- 这一行的第二列 12 -->
<el-col :span="12">
<!-- 表单字段项标签为住址设置宽度为 40%绑定数据到 informationForm.address -->
<el-form-item style="width: 40%" label="住址:">
<el-input
type="text"
@ -123,8 +157,11 @@
</el-form-item>
</el-col>
</el-row>
<!-- 栅格布局的一行 -->
<el-row>
<!-- 这一行的第一列 12 -->
<el-col :span="12">
<!-- 表单字段项标签为备注设置宽度为 40%绑定数据到 informationForm.info使用文本域输入 -->
<el-form-item style="width: 40%" label="备注:">
<el-input
type="textarea"
@ -134,7 +171,9 @@
></el-input>
</el-form-item>
</el-col>
<!-- 这一行的第二列 12 -->
<el-col :span="12">
<!-- 表单字段项标签为性别设置宽度为 40%绑定数据到 informationForm.sex -->
<el-form-item style="width: 40%" label="性别:">
<el-select
style="width: 200px"
@ -143,29 +182,37 @@
placeholder="请选择性别"
clearable
>
<!-- 性别选项 -->
<el-option label="女" value="0"></el-option>
<el-option label="男" value="1"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<!-- 表单操作项 -->
<el-form-item>
<!-- 提交按钮类型为 primary点击时调用 submitInformationForm 方法设置字体大小 -->
<el-button
type="primary"
@click="submitInformationForm('informationForm')"
style="font-size: 18px"
>
<!-- 提交按钮的图标 -->
<i class="iconfont icon-r-yes" style="font-size: 18px"></i>
<!-- 提交按钮的文本 -->
提交</el-button
>
<!-- 重置按钮点击时调用 resetForm 方法设置字体大小 -->
<el-button
@click="resetForm('informationForm')"
style="font-size: 18px"
>
<!-- 重置按钮的图标 -->
<i
class="iconfont icon-r-refresh"
style="font-size: 18px"
></i>
<!-- 重置按钮的文本 -->
重置</el-button
>
</el-form-item>
@ -173,108 +220,157 @@
</div>
</template>
<script>
// API
import { listByQo } from "@/api/personnel_management/department/deptApi";
//
import { popup } from "@/assets/js/common";
// API
import { queryInformation } from "@/api/personal/personApi";
// API
import { update } from "@/api/personnel_management/employee/empApi";
//
import { loginEmp } from "@/assets/js/auth";
export default {
//
data() {
return {
// Vuex API
BaseApi: this.$store.state.BaseApi,
// ID
loginEid: loginEmp().id,
//
informationForm: {},
// URL
imageUrl: "",
//
options: [],
//
rules: {
username: [
{
//
required: true,
message: "手机号不能为空",
trigger: "blur",
},
trigger: "blur"
}
],
nickName: [
{
//
required: true,
message: "姓名不能为空",
trigger: "blur",
},
trigger: "blur"
}
],
idCard: [
{
//
required: true,
message: "身份证号不能为空",
trigger: "blur",
},
],
},
trigger: "blur"
}
]
}
};
},
//
methods: {
//
deptAll() {
// API
listByQo({}).then((res) => {
//
res = res.data;
if (res.code == 200) {
//
this.options = res.data;
} else {
//
popup(res.msg, "error");
}
});
},
//
init() {
// API
queryInformation().then((res) => {
//
res = res.data;
if (res.code == 200) {
//
this.informationForm = { ...res.data };
// URL
this.imageUrl = this.informationForm.headImg;
} else {
//
popup(res.msg, "error");
}
});
},
//
submitInformationForm(formName) {
//
this.$refs[formName].validate((valid) => {
if (valid) {
// API
update(this.informationForm).then((res) => {
//
res = res.data;
if (res.code == 200) {
//
popup("更新成功");
} else {
//
popup(res.msg, "error");
}
//
this.init();
});
}
});
},
//
resetForm(formName) {
//
this.$refs[formName].resetFields();
//
this.init();
},
/*上传头像*/
//
handleAvatarSuccess(res) {
// URL
this.informationForm.headImg = res.url;
// URL
this.imageUrl = res.url;
},
//
beforeAvatarUpload(file) {
// JPEG PNG
const isJPG =
file.type === "image/jpeg" || file.type === "image/png";
// 3MB
const isLt2M = file.size / 1024 / 1024 < 3;
if (!isJPG) {
//
this.$message.error("上传头像图片只能是 JPG或PNG 格式!");
}
if (!isLt2M) {
//
this.$message.error("上传头像图片大小不能超过 3MB!");
}
//
return isJPG && isLt2M;
}
},
},
//
mounted() {
// URL
this.imageUrl = "";
//
this.deptAll();
//
this.init();
},
}
};
</script>

@ -1,104 +1,130 @@
<template>
<!-- 组件的根元素设置了 id dept_list -->
<div id="dept_list">
<!-- 面包屑导航组件用于显示页面层级分隔符为 / -->
<el-breadcrumb separator="/">
<el-breadcrumb-item
>首页</el-breadcrumb-item
>
<el-breadcrumb-item
>人事管理
</el-breadcrumb-item>
<el-breadcrumb-item
>部门管理</el-breadcrumb-item
> </el-breadcrumb
><br />
<!-- 面包屑导航的第一个项显示首页 -->
<el-breadcrumb-item>首页</el-breadcrumb-item>
<!-- 面包屑导航的第二个项显示人事管理 -->
<el-breadcrumb-item>人事管理</el-breadcrumb-item>
<!-- 面包屑导航的第三个项显示部门管理 -->
<el-breadcrumb-item>部门管理</el-breadcrumb-item>
</el-breadcrumb>
<!-- 换行 -->
<br />
<!-- 栅格布局的一行 -->
<el-row>
<!-- 这一行的第一列 7 包含部门名称输入框 -->
<el-col :span="7">
<el-input placeholder="部门名称" v-model="searchForm.name"/>
</el-col>
<!-- 这一行的第二列 7 包含部门状态选择框 -->
<el-col :span="7">
<el-select v-model="searchForm.state" placeholder="请选择状态" clearable>
<!-- 状态选择框的选项标签为正常值为 0 -->
<el-option label="正常" value="0"></el-option>
<!-- 状态选择框的选项标签为停用值为 -1 -->
<el-option label="停用" value="-1"></el-option>
</el-select>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 栅格布局的一行 -->
<el-row>
<!-- 这一行的列 24 设置文本左对齐包含搜索和创建部门按钮 -->
<el-col :span="24" style="text-align: left">
<!-- 搜索按钮类型为 primary点击触发 subSearchForm 方法设置字体大小 -->
<el-button
type="primary"
@click="subSearchForm"
style="font-size: 18px"
>
<i class="iconfont icon-r-find" style="font-size: 18px">
</i>
搜索</el-button
>
<el-button type="success" @click="newVisable=true"
style="font-size: 18px"
>
<i class="iconfont icon-r-add" style="font-size: 18px">
</i> 创建部门
<!-- 搜索按钮的图标 -->
<i class="iconfont icon-r-find" style="font-size: 18px"></i>
<!-- 搜索按钮的文本 -->
搜索</el-button>
<!-- 创建部门按钮类型为 success点击将 newVisable 设置为 true设置字体大小 -->
<el-button type="success" @click="newVisable=true" style="font-size: 18px">
<!-- 创建部门按钮的图标 -->
<i class="iconfont icon-r-add" style="font-size: 18px"></i>
<!-- 创建部门按钮的文本 -->
创建部门
</el-button>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 表格组件数据绑定到 tableData设置宽度为 100% -->
<el-table
:data="tableData"
style="width: 100%">
<!-- 表格列显示序号类型为 index设置宽度 -->
<el-table-column
type="index"
label="序号"
width="180">
</el-table-column>
<!-- 表格列显示部门名称prop 绑定到数据中的 name 字段设置宽度 -->
<el-table-column
prop="name"
label="名称"
width="180">
</el-table-column>
<!-- 表格列显示部门描述prop 绑定到数据中的 info 字段 -->
<el-table-column
prop="info"
label="描述">
</el-table-column>
<!-- 表格列显示部门状态根据状态值显示不同的标签 -->
<el-table-column
prop="state"
label="状态">
<template v-slot="scope">
<!-- 如果状态为 0显示绿色的正常标签 -->
<el-tag v-if="scope.row.state=='0'" type="success" style="font-size: 14px;">
<i class="iconfont icon-r-yes" style="font-size: 14px;"></i> 正常</el-tag>
<!-- 否则显示红色的停用标签 -->
<el-tag v-else type="danger" style="font-size: 14px;">
<i class="iconfont icon-r-no" style="font-size: 14px;"></i> 停用</el-tag>
</template>
</el-table-column>
<!-- 表格列显示操作固定在右侧设置宽度 -->
<el-table-column
label="操作" width="240" fixed="right">
<template v-slot="scope">
<!-- 修改按钮类型为 success点击触发 edit 方法设置字体大小 -->
<el-button type="success" @click="edit(scope.row)" style="font-size: 18px;">
<i class="iconfont icon-r-edit" style="font-size: 18px;"></i> 修改</el-button>
<!-- 停用按钮类型为 danger点击触发 forbidden 方法设置字体大小 -->
<el-button type="danger" @click="forbidden(scope.row.id)" style="font-size: 18px;">
<i class="iconfont icon-r-no" style="font-size: 18px;"></i> 停用</el-button>
</template>
</el-table-column>
</el-table>
<!--修改描述/状态弹出框-->
<!-- 修改描述/状态的对话框title 部门修改根据 dialogVisible 的值显示或隐藏设置宽度 -->
<el-dialog
title="部门修改"
:visible.sync="dialogVisible"
width="50%">
<!-- 表单组件绑定到 editForm设置标签宽度和类名 -->
<el-form v-model="editForm" label-width="100px" class="demo-ruleForm">
<!-- 表单字段项标签为名称输入框设置为禁用绑定数据到 editForm.name -->
<el-form-item label="名称:">
<el-input disabled v-model="editForm.name"></el-input>
</el-form-item>
<!-- 表单字段项标签为描述绑定数据到 editForm.info -->
<el-form-item label="描述:">
<el-input type="text" v-model="editForm.info"></el-input>
</el-form-item>
<!-- 表单字段项标签为状态绑定数据到 editForm.state包含状态选择框 -->
<el-form-item label="状态:">
<el-select v-model="editForm.state"
clearable
@change="$forceUpdate()"
placeholder="请选择状态">
<el-select v-model="editForm.state" clearable @change="$forceUpdate()" placeholder="请选择状态">
<!-- 循环生成状态选项 -->
<el-option
v-for="item in options"
:key="item.value"
@ -107,28 +133,38 @@
</el-option>
</el-select>
</el-form-item>
<!-- 表单操作项包含提交和关闭按钮 -->
<el-form-item>
<!-- 提交按钮类型为 primary点击触发 submitEditForm 方法设置字体大小 -->
<el-button type="primary" @click="submitEditForm" style="font-size: 18px;">
<i class="iconfont icon-r-yes" style="font-size: 18px;"></i> 提交</el-button>
<!-- 关闭按钮点击触发 canCelEdit 方法设置字体大小 -->
<el-button @click="canCelEdit" style="font-size: 18px;">
关闭</el-button>
</el-form-item>
</el-form>
</el-dialog>
<!--创建弹出框-->
<!-- 创建部门的对话框title 创建部门根据 newVisable 的值显示或隐藏设置宽度 -->
<el-dialog
title="创建部门"
:visible.sync="newVisable"
width="50%">
<!-- 表单组件绑定到 newForm设置验证规则引用标签宽度和类名 -->
<el-form :model="newForm" :rules="rules" ref="newForm" label-width="100px" class="demo-ruleForm">
<!-- 表单字段项标签为名称绑定数据到 newForm.name设置验证规则 -->
<el-form-item label="名称:" prop="name">
<el-input v-model="newForm.name"></el-input>
</el-form-item>
<!-- 表单字段项标签为描述绑定数据到 newForm.info -->
<el-form-item label="描述:">
<el-input type="text" v-model="newForm.info"></el-input>
</el-form-item>
<!-- 表单操作项包含提交和重置按钮 -->
<el-form-item>
<!-- 提交按钮点击触发 submitNewForm 方法 -->
<el-button type="primary" @click="submitNewForm('newForm')"></el-button>
<!-- 重置按钮点击触发 resetNewForm 方法 -->
<el-button @click="resetNewForm('newForm')"></el-button>
</el-form-item>
</el-form>
@ -136,23 +172,35 @@
</div>
</template>
<script>
//
import { popup} from "@/assets/js/common";
// API
import {deactivate, listByQo, save, update} from "@/api/personnel_management/department/deptApi";
export default {
//
data() {
return {
//
tableData: [],
//
editForm: {},
// editRow
editRow:{},
//
dialogVisible: false,
//
newVisable:false,
//
newForm:{},
//
searchForm: {},
//
options: [
{label: '正常', value: '0'},
{label: '停用', value: '-1'}
],
//
rules: {
name:[
{required: true, message: '名称不能为空', trigger: 'blur'},
@ -160,86 +208,110 @@
}
}
},
//
methods: {
//
init() {
listByQo(this.searchForm).then(res => {
if (res.data.code == 200) {
//
this.tableData = res.data.data
}else {
//
popup(res.data.msg,"error")
}
})
},
// ID
forbidden(id) {
deactivate(id).then(res => {
res = res.data
if (res.code == 200) {
//
popup("操作成功")
} else {
//
popup(res.msg, "error")
}
//
this.init()
})
},
/*弹出修改表单*/
//
edit(row) {
// editForm
this.editForm= {...row}
//
this.dialogVisible = true
},
/*条件搜索*/
//
subSearchForm() {
this.init()
},
/*对接后端修改接口*/
//
submitEditForm() {
update(this.editForm).then(res=>{
res=res.data
if (res.code==200){
//
popup("操作成功")
//
this.dialogVisible=false
//
this.init()
}else {
//
popup(res.msg, "error")
}
})
},
/*修改重置按钮*/
//
canCelEdit(){
//
this.dialogVisible=false
// editForm
this.editForm={}
},
/*创建新角色*/
//
submitNewForm(formName){
//
this.$refs[formName].validate((valid) => {
if (valid) {
console.log(this.newForm)
// API
save(this.newForm).then(res=>{
res=res.data
if (res.code==200){
//
popup("操作成功")
//
this.newVisable=false
// newForm
this.newForm={}
//
this.init()
}else {
//
popup(res.msg, "error")
}
})
}
});
},
//
resetNewForm(formname){
//
this.$refs[formname].resetFields()
},
},
//
created() {
this.init()
}
}
</script>
<style>
/* 搜索相关的样式类,设置布局和高度等 */
.search {
display: inline-block;
margin: 0 auto;

@ -1,24 +1,30 @@
<template>
<!-- 定义一个 id sale_records div 容器作为整个页面的根容器 -->
<div id="sale_records">
<!-- 面包屑导航组件用于显示当前页面在整个网站结构中的位置分隔符为 / -->
<el-breadcrumb separator="/">
<el-breadcrumb-item
>首页</el-breadcrumb-item
>
<el-breadcrumb-item
>销售管理
</el-breadcrumb-item>
<el-breadcrumb-item
>积分兑换记录</el-breadcrumb-item
> </el-breadcrumb
><br />
<!-- 面包屑导航的第一个项目显示首页 -->
<el-breadcrumb-item>首页</el-breadcrumb-item>
<!-- 面包屑导航的第二个项目显示销售管理 -->
<el-breadcrumb-item>销售管理</el-breadcrumb-item>
<!-- 面包屑导航的第三个项目显示积分兑换记录 -->
<el-breadcrumb-item>积分兑换记录</el-breadcrumb-item>
</el-breadcrumb>
<!-- 换行 -->
<br />
<!-- 行布局组件用于将其子元素按行排列 -->
<el-row>
<!-- 列布局组件 7 列宽度 -->
<el-col :span="7">
<!-- 输入框组件占位符为兑换订单编号绑定到 searchForm 对象的 cn 属性 -->
<el-input
placeholder="兑换订单编号"
v-model="searchForm.cn"
/>
</el-col>
<!-- 列布局组件 7 列宽度 -->
<el-col :span="7">
<!-- 下拉选择框组件绑定到 searchForm 对象的 memberId 属性可过滤选项选择项改变时强制更新组件占位符为请选择会员账号可清除选择 -->
<el-select
v-model="searchForm.memberId"
placeholder="请选择会员账号"
@ -26,6 +32,7 @@
@change="$forceUpdate()"
clearable
>
<!-- 循环渲染下拉选择框的选项 options_memberPhone 数组中获取数据 -->
<el-option
v-for="item in options_memberPhone"
:key="item.id"
@ -35,8 +42,11 @@
</el-option>
</el-select>
</el-col>
<!-- 列布局组件 10 列宽度 -->
<el-col :span="10">
<!-- 文本提示兑换时间 -->
<span>兑换时间</span>
<!-- 日期选择器组件宽度为 140px绑定到 searchForm 对象的 startTime 属性日期格式为 yyyy-MM-dd占位符为起始时间 -->
<el-date-picker
style="width: 140px"
v-model="searchForm.startTime"
@ -45,7 +55,9 @@
placeholder="起始时间"
>
</el-date-picker>
<!-- 分隔符 -->
-
<!-- 日期选择器组件宽度为 140px绑定到 searchForm 对象的 endTime 属性日期格式为 yyyy-MM-dd占位符为结束时间 -->
<el-date-picker
v-model="searchForm.endTime"
style="width: 140px"
@ -56,26 +68,38 @@
</el-date-picker>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 行布局组件用于将其子元素按行排列 -->
<el-row>
<!-- 列布局组件 24 列宽度文本左对齐 -->
<el-col :span="24" style="text-align: left">
<!-- 按钮组件类型为成功按钮点击时调用 submitSearchForm 方法字体大小为 18px -->
<el-button
type="success"
@click="submitSearchForm"
style="font-size: 18px"
>
<!-- 图标 -->
<i class="iconfont icon-r-find" style="font-size: 18px">
</i>
搜索</el-button
>
<!-- 按钮文本 -->
搜索
</el-button>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 表格数据容器 -->
<div class="table">
<!-- 表格组件数据绑定到 tableData 数组宽度为 100%表格大小为中等 -->
<el-table :data="tableData" style="width: 100%" size="medium">
<!-- 表格列组件显示编号宽度为 200px绑定到数据的 cn 属性 -->
<el-table-column prop="cn" width="200" label="编号">
</el-table-column>
<!-- 表格列组件显示商品封面 -->
<el-table-column prop="goodsCoverUrl" label="商品封面">
<!-- 自定义表格列内容显示商品封面图片图片地址为 BaseApi 加上数据的 goodsCoverUrl 属性 -->
<template v-slot="scope">
<img
:src="BaseApi + scope.row.goodsCoverUrl"
@ -84,34 +108,46 @@
/>
</template>
</el-table-column>
<!-- 表格列组件显示商品绑定到数据的 goodsName 属性 -->
<el-table-column prop="goodsName" label="商品">
</el-table-column>
<!-- 表格列组件显示积分绑定到数据的 integral 属性 -->
<el-table-column prop="integral" label="积分">
</el-table-column>
<!-- 表格列组件显示会员账号宽度为 200px绑定到数据的 memberPhone 属性 -->
<el-table-column
width="200"
prop="memberPhone"
label="会员账号"
>
</el-table-column>
<!-- 表格列组件显示兑换时间宽度为 200px绑定到数据的 updateTime 属性 -->
<el-table-column prop="updateTime" width="200" label="兑换时间">
</el-table-column>
<!-- 表格列组件显示操作者绑定到数据的 updateby 属性 -->
<el-table-column prop="updateby" label="操作者">
</el-table-column>
<!-- 表格列组件显示操作宽度为 140px固定在表格右侧 -->
<el-table-column width="140" fixed="right" label="操作">
<!-- 自定义表格列内容包含删除按钮 -->
<template v-slot="scope">
<!-- 按钮组件类型为危险按钮点击时调用 del 方法传入当前行的 cn 属性字体大小为 18px -->
<el-button
type="danger"
@click="del(scope.row.cn)"
style="font-size: 18px;"
>
<!-- 图标 -->
<i class="iconfont icon-r-delete" style="font-size: 18px;"> </i>
<!-- 按钮文本 -->
删除
</el-button>
</template>
</el-table-column>
</el-table>
<div style="margin: 10px 0 15px 0;">
<!-- 分页组件容器 -->
<div style="margin: 10px 0 15px 0">
<!-- 分页组件页码大小改变时调用 handleSizeChange 方法当前页码改变时调用 handleCurrentChange 方法当前页码绑定到 searchForm currentPage 属性可选择的每页记录数为 [5, 10, 20, 50]每页记录数绑定到 searchForm pageSize 属性布局包含总数页码大小选择上一页页码下一页跳转输入框总记录数绑定到 searchForm total 属性 -->
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@ -127,7 +163,9 @@
</div>
</template>
<script>
//
import { popup } from "@/assets/js/common";
// API
import {
delExchangePointProducts,
queryOptionsMemberPhone,
@ -135,96 +173,141 @@ import {
} from "@/api/sale_management/exchange_point_products/exchangePointProductsApi";
export default {
//
data() {
return {
// store API
BaseApi: this.$store.state.BaseApi,
// 5
searchForm: {
pageSize: 5,
},
//
tableData: [],
//
options_memberPhone: [],
};
},
//
methods: {
//
queryOptionsMemberPhone() {
//
queryOptionsMemberPhone().then((res) => {
//
res = res.data;
if (res.code == 200) {
// 200 options_memberPhone
this.options_memberPhone = res.data;
} else {
// 200
popup(res.msg, "error");
}
});
},
//
init() {
//
if (this.searchForm.startTime > this.searchForm.endTime) {
//
popup("结束时间不能小于开始时间", "warning");
return;
}
//
queryPageByQoExchangePointProducts(this.searchForm).then((res) => {
//
res = res.data;
if (res.code == 200) {
// 200 tableData
this.tableData = res.data.records;
// total
this.searchForm.total = res.data.total;
// pageSize
this.searchForm.pageSize = res.data.size;
// currentPage
this.searchForm.currentPage = res.data.current;
} else {
// 200
popup(res.msg, "error");
}
});
},
//
del(cn) {
//
this.$confirm("确定删除这条记录?", "警示", {
//
confirmButtonText: "确定",
//
cancelButtonText: "取消",
//
type: "warning",
})
.then(() => {
//
delExchangePointProducts({ cn: cn }).then((res) => {
//
res = res.data;
if (res.code == 200) {
// 200
popup("操作成功");
//
this.init();
} else {
// 200
popup(res.msg, "error");
}
});
})
.catch(() => {
//
this.$message({
type: "info",
message: "已取消操作",
});
});
},
/*分页*/
//
handleSizeChange(val) {
// pageSize
this.searchForm.pageSize = val;
//
this.init();
},
//
handleCurrentChange(val) {
// currentPage
this.searchForm.currentPage = val;
//
this.init();
},
//
submitSearchForm() {
//
this.init();
},
},
//
mounted() {
//
this.init();
//
this.queryOptionsMemberPhone();
},
};
</script>
<style>
/* 搜索表单样式,设置高度 */
.searchForm {
height: 134px;
}
/* 表格样式,设置高度 */
.table {
height: 320px;
}
/* 分页工具样式,设置绝对定位、宽度、边距和高度 */
.pageUtils {
position: absolute;
width: 84%;
@ -232,6 +315,7 @@ export default {
height: 43px;
}
/* 搜索表单样式,设置为内联块元素,居中显示和高度、行高 */
.searchForm {
display: inline-block;
margin: 0 auto;
@ -239,6 +323,7 @@ export default {
line-height: 51px;
}
/* 搜索表单列样式,设置为内联块元素,居中显示、右边距、行高和高度 */
.searchForm .column {
display: inline-block;
margin: 0 auto;

@ -1,25 +1,37 @@
<template>
<!-- 定义一个 id sale_records div 容器作为整个销售记录页面的根容器 -->
<div id="sale_records">
<!-- 面包屑导航组件用于展示页面层级关系分隔符为 / -->
<el-breadcrumb separator="/">
<!-- 面包屑导航的第一个层级显示首页 -->
<el-breadcrumb-item
>首页</el-breadcrumb-item
>
<!-- 面包屑导航的第二个层级显示销售管理 -->
<el-breadcrumb-item
>销售管理</el-breadcrumb-item
>
<!-- 面包屑导航的第三个层级显示销售记录 -->
<el-breadcrumb-item>销售记录</el-breadcrumb-item>
</el-breadcrumb>
<!-- 换行 -->
<br />
<!-- 创建一个行布局 -->
<el-row>
<!-- 列布局 4 份宽度 -->
<el-col :span="4">
<!-- 输入框用于输入销售编号绑定到 searchForm cn 属性 -->
<el-input
style="height: 21px; width: 130px"
placeholder="销售编号"
v-model="searchForm.cn"
/>
</el-col>
<!-- 列布局 10 份宽度 -->
<el-col :span="10">
<!-- 显示销售时间文本 -->
<span>销售时间</span>
<!-- 日期选择器用于选择销售起始时间绑定到 searchForm startSellTime 属性 -->
<el-date-picker
style="width: 140px"
v-model="searchForm.startSellTime"
@ -28,7 +40,9 @@
placeholder="起始时间"
>
</el-date-picker>
<!-- 显示分隔符 - -->
-
<!-- 日期选择器用于选择销售结束时间绑定到 searchForm endSellTime 属性 -->
<el-date-picker
v-model="searchForm.endSellTime"
style="width: 140px"
@ -38,7 +52,9 @@
>
</el-date-picker>
</el-col>
<!-- 列布局 4 份宽度 -->
<el-col :span="4">
<!-- 下拉选择框用于选择顾客类型绑定到 searchForm type 属性 -->
<el-select
style="width: 120px"
v-model="searchForm.type"
@ -46,11 +62,15 @@
placeholder="顾客类型"
clearable
>
<!-- 下拉选项标签为非会员顾客值为 0 -->
<el-option label="非会员顾客" value="0"></el-option>
<!-- 下拉选项标签为会员值为 1 -->
<el-option label="会员" value="1"></el-option>
</el-select>
</el-col>
<!-- 列布局 4 份宽度 -->
<el-col :span="4">
<!-- 下拉选择框用于选择支付方式绑定到 searchForm sellway 属性 -->
<el-select
style="width: 120px"
v-model="searchForm.sellway"
@ -58,136 +78,192 @@
placeholder="支付方式"
clearable
>
<!-- 下拉选项标签为支付宝值为 0 -->
<el-option label="支付宝" value="0"></el-option>
<!-- 下拉选项标签为微信值为 1 -->
<el-option label="微信" value="1"></el-option>
<!-- 下拉选项标签为现金值为 2 -->
<el-option label="现金" value="2"></el-option>
<!-- 下拉选项标签为银行卡值为 3 -->
<el-option label="银行卡" value="3"></el-option>
</el-select>
</el-col>
</el-row>
<!-- 换行 -->
<br>
<!-- 创建一个行布局 -->
<el-row>
<!-- 列布局 24 份宽度文本左对齐 -->
<el-col :span="24" style="text-align: left;">
<!-- 按钮点击触发 submitSearchForm 方法用于搜索销售记录 -->
<el-button type="success" @click="submitSearchForm" style="font-size: 18px;"
>
<!-- 按钮内的图标 -->
<i class="iconfont icon-r-find" style="font-size: 18px;"> </i>
<!-- 按钮文本 -->
搜索</el-button
>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 定义一个类名为 table div 容器用于包裹表格和分页组件 -->
<div class="table">
<!-- 表格组件展示销售记录数据数据绑定到 tableData -->
<el-table :data="tableData" style="width: 100%" size="medium">
<!-- 表格列显示销售编号宽度为 200px -->
<el-table-column prop="cn" width="200" label="编号">
</el-table-column>
<!-- 表格列显示销售数量 -->
<el-table-column prop="sellTotal" label="销售数量">
</el-table-column>
<!-- 表格列显示销售总额 -->
<el-table-column prop="sellTotalmoney" label="销售总额">
<!-- 自定义表格单元格内容将销售总额保留两位小数显示 -->
<template v-slot="scope">
{{ parseFloat(scope.row.sellTotalmoney).toFixed(2) }}
</template>
</el-table-column>
<!-- 表格列显示销售时间当内容过长时显示 tooltip -->
<el-table-column
prop="sellTime"
:show-overflow-tooltip="true"
label="销售时间"
>
</el-table-column>
<!-- 表格列显示顾客类型宽度为 120px -->
<el-table-column prop="type" label="顾客类型" width="120">
<!-- 自定义表格单元格内容根据顾客类型显示不同标签 -->
<template v-slot="scope">
<!-- 若顾客类型为会员显示橙色标签 -->
<el-tag
effect="dark"
type="warning"
style="font-size: 14px;"
v-if="scope.row.type == '1'"
>
<!-- 标签内的图标 -->
<i class="iconfont icon-r-mark1"></i>
<!-- 标签文本 -->
会员</el-tag
>
<!-- 若顾客类型为非会员显示蓝色标签 -->
<el-tag effect="dark" type="info" v-else
>非会员</el-tag
>
</template>
</el-table-column>
<!-- 表格列显示销售员 -->
<el-table-column prop="sellby" label="销售员">
</el-table-column>
<!-- 表格列显示支付方式 -->
<el-table-column prop="sellway" label="支付方式">
<!-- 自定义表格单元格内容根据支付方式显示不同标签 -->
<template v-slot="scope">
<!-- 若支付方式为支付宝显示蓝色标签 -->
<el-tag
effect="dark"
type="primary"
v-if="scope.row.sellway == '0'"
>支付宝</el-tag
>
<!-- 若支付方式为微信显示绿色标签 -->
<el-tag
effect="dark"
type="success"
v-else-if="scope.row.sellway == '1'"
>微信</el-tag
>
<!-- 若支付方式为银行卡显示橙色标签 -->
<el-tag
effect="dark"
type="warning"
v-else-if="scope.row.sellway == '3'"
>银行卡</el-tag
>
<!-- 若支付方式为现金显示红色标签 -->
<el-tag effect="dark" type="danger" v-else></el-tag>
</template>
</el-table-column>
<!-- 表格列显示备注信息当内容过长时显示 tooltip -->
<el-table-column
prop="info"
:show-overflow-tooltip="true"
label="备注"
>
</el-table-column>
<!-- 表格列显示操作按钮固定在表格右侧宽度为 240px -->
<el-table-column width="240" label="操作" fixed="right">
<!-- 自定义表格单元格内容包含明细和删除按钮 -->
<template v-slot="scope">
<!-- 明细按钮点击触发 detailBtn 方法显示销售订单明细 -->
<el-button
type="success"
style="font-size: 18px;"
@click="detailBtn(scope.row)"
>
<!-- 按钮内的图标 -->
<i class="iconfont icon-r-find" style="font-size: 18px;"> </i>
<!-- 按钮文本 -->
明细
</el-button>
<!-- 删除按钮点击触发 del 方法删除当前销售记录 -->
<el-button
type="danger"
@click="del(scope.row.cn)"
style="font-size: 18px;"
>
<!-- 按钮内的图标 -->
<i class="iconfont icon-r-delete" style="font-size: 18px;"> </i>
<!-- 按钮文本 -->
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 定义一个 div 容器用于包裹分页组件设置上下外边距 -->
<div style="margin: 10px 0 15px 0;">
<!-- 分页组件用于切换表格数据的页码和每页显示数量 -->
<el-pagination
<!-- 每页显示数量变化时触发 handleSizeChange 方法 -->
@size-change="handleSizeChange"
<!-- 当前页码变化时触发 handleCurrentChange 方法 -->
@current-change="handleCurrentChange"
<!-- 双向绑定当前页码到 searchForm currentPage 属性 -->
:current-page.sync="searchForm.currentPage"
<!-- 每页显示数量的可选值 -->
:page-sizes="[5, 10, 20, 50]"
<!-- 绑定每页显示数量到 searchForm pageSize 属性 -->
:page-size="searchForm.pageSize"
<!-- 分页组件的布局 -->
layout="total,sizes, prev, pager, next,jumper"
<!-- 绑定数据总数到 searchForm total 属性 -->
:total="searchForm.total"
>
</el-pagination>
</div>
</div>
<!-- 对话框组件用于显示销售订单明细标题为销售订单明细 -->
<el-dialog
title="销售订单明细"
<!-- 双向绑定对话框的显示状态到 detailSaleRecordsVisable 属性 -->
:visible.sync="detailSaleRecordsVisable"
<!-- 对话框宽度为 80% -->
width="80%"
>
<!-- 表单组件绑定数据到 saleRecordForm标签宽度为 100px -->
<el-form
:model="saleRecordForm"
label-width="100px"
class="demo-ruleForm"
>
<!-- 创建一个行布局 -->
<el-row>
<!-- 列布局 12 份宽度 -->
<el-col :span="12">
<!-- 表单项目标签为销售编号 -->
<el-form-item style="width: 60%" label="销售编号:">
<!-- 输入框禁用且只读显示销售编号 -->
<el-input
disabled
readonly
@ -197,13 +273,17 @@
</el-form-item>
</el-col>
</el-row>
<!-- 创建一个行布局 -->
<el-row>
<!-- 列布局 12 份宽度 -->
<el-col :span="12">
<!-- 表单项目标签为支付方式 -->
<el-form-item
style="width: 80%"
label="支付方式:"
prop="sellway"
>
<!-- 支付宝支付方式单选框禁用状态绑定到 saleRecordForm sellway 属性 -->
<el-radio
disabled
type="radio"
@ -211,6 +291,7 @@
label="0"
>支付宝</el-radio
>
<!-- 微信支付方式单选框禁用状态绑定到 saleRecordForm sellway 属性 -->
<el-radio
disabled
type="radio"
@ -218,6 +299,7 @@
label="1"
>微信</el-radio
>
<!-- 现金支付方式单选框禁用状态绑定到 saleRecordForm sellway 属性 -->
<el-radio
disabled
type="radio"
@ -225,6 +307,7 @@
label="2"
>现金</el-radio
>
<!-- 银行卡支付方式单选框禁用状态绑定到 saleRecordForm sellway 属性 -->
<el-radio
disabled
type="radio"
@ -235,9 +318,13 @@
</el-form-item>
</el-col>
</el-row>
<!-- 创建一个行布局 -->
<el-row>
<!-- 列布局 12 份宽度 -->
<el-col :span="12">
<!-- 表单项目标签为顾客类型 -->
<el-form-item style="width: 60%" label="顾客类型:">
<!-- 会员单选框禁用状态绑定到 saleRecordForm type 属性 -->
<el-radio
disabled
type="radio"
@ -245,6 +332,7 @@
label="1"
>会员</el-radio
>
<!-- 非会员单选框禁用状态绑定到 saleRecordForm type 属性 -->
<el-radio
disabled
type="radio"
@ -254,12 +342,15 @@
>
</el-form-item>
</el-col>
<!-- 列布局 12 份宽度当顾客类型为会员时显示 -->
<el-col :span="12" v-if="saleRecordForm.type == '1'">
<!-- 表单项目标签为会员账号 -->
<el-form-item
style="width: 60%"
label="会员账号:"
prop="memberPhone"
>
<!-- 输入框只读状态显示会员账号 -->
<el-input
readonly
v-model="saleRecordForm.memberPhone"
@ -268,21 +359,31 @@
</el-form-item>
</el-col>
</el-row>
<!-- 水平线分隔 -->
<hr>
<!-- 创建一个行布局 -->
<el-row>
<!-- 列布局 24 份宽度 -->
<el-col :span="24">
<!-- 表格组件展示销售订单明细中的商品信息 -->
<el-table
:data="saleRecordForm.detailSaleRecords"
style="width: 100%"
size="medium"
>
<!-- 表格列显示商品编号 -->
<el-table-column prop="goodsId" label="商品编号">
</el-table-column>
<!-- 表格列显示商品名 -->
<el-table-column prop="goodsName" label="商品名">
</el-table-column>
<!-- 表格列显示商品数量 -->
<el-table-column prop="goodsNum" label="数量">
<!-- 自定义表格单元格内容显示商品数量输入框和加减按钮 -->
<template v-slot="scope">
<!-- 减号按钮禁用状态 -->
<el-button type="info" disabled>-</el-button>
<!-- 输入框禁用状态显示商品数量 -->
<el-input
disabled
style="width: 80px"
@ -290,18 +391,25 @@
min="1"
v-model="scope.row.goodsNum"
></el-input>
<!-- 加号按钮禁用状态 -->
<el-button type="info" disabled>+</el-button>
</template>
</el-table-column>
<!-- 表格列显示商品单价 -->
<el-table-column prop="goodsPrice" label="商品单价(元)">
</el-table-column>
</el-table>
</el-col>
</el-row>
<!-- 水平线分隔 -->
<hr>
<!-- 创建一个行布局 -->
<el-row>
<!-- 列布局 24 份宽度 -->
<el-col :span="24">
<!-- 表单项目标签为备注 -->
<el-form-item style="width: 100%" label="备注:">
<!-- 文本输入框禁用且只读显示备注信息 -->
<el-input
disabled
readonly
@ -312,21 +420,29 @@
</el-form-item>
</el-col>
</el-row>
<!-- 创建一个行布局 -->
<el-row>
<!-- 列布局 24 份宽度 -->
<el-col :span="24">
<!-- 当销售订单明细中有商品信息时显示订单详情 -->
<div v-if="saleRecordForm.detailSaleRecords.length > 0">
<!-- 显示订单号 -->
订单号{{ saleRecordForm.cn }}&nbsp;&nbsp;
<!-- 显示商品总数 -->
商品总数{{
saleRecordForm.sellTotal
? saleRecordForm.sellTotal
: 0
}}&nbsp;&nbsp; 消费{{
}}&nbsp;&nbsp;
<!-- 显示消费金额保留两位小数 -->
消费{{
saleRecordForm.sellTotalmoney
? parseFloat(
saleRecordForm.sellTotalmoney
).toFixed(2)
: 0
}}&nbsp;&nbsp;
<!-- 当有支付方式时显示支付方式 -->
<span v-if="saleRecordForm.sellway"
>支付方式{{
saleRecordForm.sellway == "0"
@ -338,9 +454,11 @@
: "银行卡"
}}&nbsp;&nbsp;</span
><br>
<!-- 当顾客类型为会员时显示会员享受 9 折信息 -->
<span v-if="saleRecordForm.type == '1'"
>会员享受9折&nbsp;&nbsp;</span
>
<!-- 当有销售时间时显示消费时间和操作者编号 -->
<span v-if="saleRecordForm.sellTime"
>消费时间{{
saleRecordForm.sellTime
@ -351,9 +469,13 @@
</div>
</el-col>
</el-row>
<!-- 创建一个行布局 -->
<el-row>
<!-- 列布局 24 份宽度 -->
<el-col :span="24">
<!-- 表单项目 -->
<el-form-item>
<!-- 关闭按钮点击关闭销售订单明细对话框 -->
<el-button
type="info"
@click="detailSaleRecordsVisable = false"
@ -367,74 +489,109 @@
</div>
</template>
<script>
//
import { popup } from "@/assets/js/common";
// API
import {
delSaleRecords,
queryPageByQoSaleRecords,
} from "@/api/sale_management/saleRecordsApi";
export default {
//
data() {
return {
//
detailSaleRecordsVisable: false,
// 5
searchForm: {
pageSize: 5
},
//
tableData: [],
//
saleRecordForm: {
//
cn: "",
//
sellway: "",
//
info: "",
//
sellTotal: "",
//
sellTotalmoney: "",
//
type: "0",
//
detailSaleRecords: [],
},
};
},
//
methods: {
//
init() {
//
if (this.searchForm.startSellTime > this.searchForm.endSellTime) {
//
popup("结束时间不能小于开始时间", "warning");
return;
}
// API
queryPageByQoSaleRecords(this.searchForm).then((res) => {
//
res = res.data;
if (res.code == 200) {
//
this.tableData = res.data.records;
//
this.searchForm.total = res.data.total;
//
this.searchForm.pageSize = res.data.size;
//
this.searchForm.currentPage = res.data.current;
} else {
//
popup(res.msg, "error");
}
});
},
//
del(cn) {
//
this.$confirm("确定删除这条记录?", "警示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
// API
delSaleRecords({ cn: cn }).then((res) => {
//
res = res.data;
if (res.code == 200) {
//
popup("操作成功");
//
this.init();
} else {
//
popup(res.msg, "error");
}
});
})
.catch(() => {
//
this.$message({
type: "info",
message: "已取消操作",
});
});
},
//
detailBtn(row) {
//
this.saleRecordForm = {
cn: "",
sellway: "",
@ -444,38 +601,55 @@ export default {
type: "0",
detailSaleRecords: [],
};
//
this.saleRecordForm = { ...row };
//
this.detailSaleRecordsVisable = true;
},
/*分页*/
//
handleSizeChange(val) {
//
this.searchForm.pageSize = val;
//
this.init();
//
console.log(`每页 ${val}`);
},
//
handleCurrentChange(val) {
//
this.searchForm.currentPage = val;
//
this.init();
//
console.log(`当前页: ${val}`);
},
//
submitSearchForm() {
//
this.init();
},
},
//
mounted() {
//
this.init();
},
};
</script>
<style>
/* 搜索表单样式,设置高度为 134px */
.searchForm {
height: 134px;
}
/* 表格容器样式,设置高度为 320px */
.table {
height: 320px;
}
/* 分页组件样式,绝对定位,宽度为 84%,水平居中,高度为 43px */
.pageUtils {
position: absolute;
width: 84%;

@ -1,41 +1,63 @@
<template>
<!-- 根容器 -->
<div>
<!-- 面包屑导航使用 / 作为分隔符 -->
<el-breadcrumb separator="/">
<!-- 面包屑的首页项 -->
<el-breadcrumb-item>首页</el-breadcrumb-item>
<!-- 面包屑的系统管理项 -->
<el-breadcrumb-item>系统管理</el-breadcrumb-item>
<!-- 面包屑的菜单管理项 -->
<el-breadcrumb-item>菜单管理</el-breadcrumb-item>
</el-breadcrumb
><br />
<!-- 闭合面包屑标签 -->
</el-breadcrumb>
<!-- 换行 -->
<br />
<!-- 创建一行布局 -->
<el-row>
<!-- 8 列宽度左对齐且右侧有 10px 内边距 -->
<el-col :span="8" style="text-align: left; padding-right: 10px">
<!-- 输入框用于输入菜单名称绑定到 searchForm name 属性 -->
<el-input placeholder="菜单名称" v-model="searchForm.name" />
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 创建一行布局 -->
<el-row>
<!-- 24 列宽度左对齐 -->
<el-col :span="24" style="text-align: left">
<!-- 搜索按钮点击触发 submitSearchForm 方法 -->
<el-button
type="primary"
@click="submitSearchForm"
style="font-size: 18px"
>
<!-- 搜索图标 -->
<i class="iconfont icon-r-find" style="font-size: 18px">
</i>
搜索</el-button
>
<!-- 按钮文本 -->
搜索
</el-button>
<!-- 重置按钮点击触发 resetSearchForm 方法 -->
<el-button
type="info"
@click="resetSearchForm"
style="font-size: 18px"
>
<!-- 重置图标 -->
<i class="iconfont icon-r-refresh" style="font-size: 18px">
</i>
<!-- 按钮文本 -->
重置
</el-button>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 表格容器 -->
<div class="table">
<!-- 表格组件绑定数据设置行键边框树形结构属性 -->
<el-table
:data="tableData"
style="width: 100%"
@ -44,75 +66,93 @@
border
:tree-props="{ children: 'children' }"
>
<!-- 菜单名列 -->
<el-table-column prop="label" label="菜单名"> </el-table-column>
<!-- 标识符列宽度 150px超长显示 tooltip -->
<el-table-column
width="150"
prop="flag"
:show-overflow-tooltip="true"
label="标识符"
>
<!-- 自定义单元格内容显示标识符标签 -->
<template v-slot="scope">
<el-tag type="info">{{
scope.row.flag ? scope.row.flag : "暂定"
}}</el-tag>
</template>
</el-table-column>
<!-- 类型列 -->
<el-table-column prop="type" label="类型">
<!-- 自定义单元格内容根据类型显示不同标签 -->
<template v-slot="scope">
<!-- 类型为 0 显示目录标签 -->
<el-tag v-if="scope.row.type == 0"
>目录</el-tag
>
<!-- 类型为 1 显示菜单标签 -->
<el-tag
v-else-if="scope.row.type == 1"
type="success"
>菜单</el-tag
>
<!-- 其他类型显示按钮标签 -->
<el-tag v-else type="warning"
>按钮</el-tag
>
</template>
</el-table-column>
<!-- 图标列 -->
<el-table-column prop="icon" label="图标">
<!-- 自定义单元格内容显示图标 -->
<template v-slot="scope">
<i :class="scope.row.icon"></i>
</template>
</el-table-column>
<!-- 描述列超长显示 tooltip -->
<el-table-column
prop="info"
:show-overflow-tooltip="true"
label="描述"
>
<!-- 自定义单元格内容显示描述标签 -->
<template v-slot="scope">
<el-tag type="info">{{
scope.row.info ? scope.row.info : "无"
}}</el-tag>
</template>
</el-table-column>
<!-- 组件路径列超长显示 tooltip -->
<el-table-column
prop="component"
:show-overflow-tooltip="true"
label="组件路径"
>
<!-- 自定义单元格内容显示组件路径标签 -->
<template v-slot="scope">
<el-tag type="info">{{
scope.row.component ? scope.row.component : "暂定"
}}</el-tag>
</template>
</el-table-column>
<!-- 状态列 -->
<el-table-column prop="state" label="状态">
<!-- 自定义单元格内容根据状态显示不同标签 -->
<template v-slot="scope">
<!-- 状态为 0 显示正常标签 -->
<el-tag
type="success"
v-if="scope.row.state == 0"
>正常</el-tag
>
<!-- 其他状态显示禁用标签 -->
<el-tag type="danger" v-else></el-tag>
</template>
</el-table-column>
</el-table>
<!-- 分页组件容器 -->
<div style="margin: 10px 0 15px 0">
<!-- 分页组件绑定分页相关事件和数据 -->
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@ -128,15 +168,18 @@
</div>
</template>
<script>
// API
import { queryPageByQo } from "@/api/system/menu/menuApi";
//
import { popup } from "@/assets/js/common";
export default {
//
data() {
return {
/*搜索*/
/*表格*/
//
tableData: [],
//
searchForm: {
total: 0,
currentPage: 1,
@ -144,59 +187,86 @@ export default {
},
};
},
//
methods: {
//
init() {
// API
queryPageByQo(this.searchForm).then((res) => {
//
res = res.data;
if (res.code == 200) {
//
console.log(res.data);
//
this.tableData = res.data.records;
//
this.searchForm.total = res.data.total;
//
this.searchForm.pageSize = res.data.size;
//
this.searchForm.currentPage = res.data.current;
} else {
//
popup(res.msg, "error");
}
});
},
//
submitSearchForm() {
//
this.init();
},
//
resetSearchForm() {
//
this.searchForm.name = "";
},
/*分页*/
// -
handleSizeChange(val) {
//
this.searchForm.pageSize = val;
//
this.init();
//
console.log(`每页 ${val}`);
},
// -
handleCurrentChange(val) {
//
this.searchForm.currentPage = val;
//
this.init();
//
console.log(`当前页: ${val}`);
},
},
//
mounted() {
//
this.init();
},
};
</script>
<style>
/* 搜索表单样式,高度 134px */
.searchForm {
height: 134px;
}
/* 表格样式,高度 320px */
.table {
height: 320px;
}
/* 分页工具样式,绝对定位,宽度 84%,居中,高度 43px */
.pageUtils {
position: absolute;
width: 84%;
margin: 2px auto;
height: 43px;
}
/* 搜索表单样式,内联块显示,居中,高度 51px行高 51px */
.searchForm {
display: inline-block;
margin: 0 auto;
@ -204,6 +274,7 @@ export default {
line-height: 51px;
}
/* 搜索表单列样式,内联块显示,居中,右侧外边距 2px行高 48px高度 51px */
.searchForm .column {
display: inline-block;
margin: 0 auto;

@ -1,126 +1,173 @@
<template>
<!-- 页面的根容器id role_list -->
<div id="role_list">
<!-- 面包屑导航组件使用 "/" 作为分隔符 -->
<el-breadcrumb separator="/">
<!-- 面包屑的首页项 -->
<el-breadcrumb-item>首页</el-breadcrumb-item>
<!-- 面包屑的系统管理项 -->
<el-breadcrumb-item>系统管理</el-breadcrumb-item>
<el-breadcrumb-item>角色管理</el-breadcrumb-item> </el-breadcrumb
><br />
<!-- 面包屑的角色管理项 -->
<el-breadcrumb-item>角色管理</el-breadcrumb-item>
</el-breadcrumb>
<!-- 换行 -->
<br />
<!-- 第一行布局 -->
<el-row>
<!-- 左侧列 8 列宽度左对齐右侧有 10px 内边距 -->
<el-col :span="8" style="text-align: left; padding-right: 10px">
<!-- 输入框用于输入角色名称双向绑定到 roleSearchForm name 属性 -->
<el-input
placeholder="角色名称"
v-model="roleSearchForm.name"
/>
</el-col>
<!-- 右侧列 8 列宽度 -->
<el-col :span="8">
<!-- 下拉选择框用于选择角色状态双向绑定到 roleSearchForm state 属性 -->
<el-select
@change="$forceUpdate"
v-model="roleSearchForm.state"
placeholder="状态"
clearable
>
<!-- 下拉选项标签为正常值为0 -->
<el-option label="正常" value="0"></el-option>
<!-- 下拉选项标签为停用值为-1 -->
<el-option label="停用" value="-1"></el-option>
</el-select>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 第二行布局 -->
<el-row>
<!-- 整行占 24 列宽度左对齐 -->
<el-col :span="24" style="text-align: left">
<!-- 搜索按钮点击触发 subSearchForm 方法传递参数 'ruleForm' -->
<el-button
type="primary"
@click="subSearchForm('ruleForm')"
style="font-size: 18px"
>
<!-- 搜索图标 -->
<i class="iconfont icon-r-find" style="font-size: 18px">
</i>
搜索</el-button
>
<!-- 按钮文本 -->
搜索
</el-button>
<!-- 创建角色按钮点击将 newRoleVisable 设置为 true显示创建角色对话框 -->
<el-button
type="success"
@click="newRoleVisable = true"
style="font-size: 18px"
>
<!-- 创建图标 -->
<i class="iconfont icon-r-add" style="font-size: 18px"> </i>
<!-- 按钮文本 -->
创建角色
</el-button>
</el-col>
</el-row>
<!-- 换行 -->
<br />
<!-- 表格组件用于展示角色列表数据数据绑定到 tableData -->
<el-table :data="tableData" style="width: 100%">
<!-- 序号列类型为 index显示行号宽度 180px -->
<el-table-column type="index" label="序号" width="180">
</el-table-column>
<!-- 名称列显示角色名称宽度 180px -->
<el-table-column prop="name" label="名称" width="180">
</el-table-column>
<!-- 描述列显示角色描述 -->
<el-table-column prop="info" label="描述"> </el-table-column>
<!-- 状态列根据角色状态显示不同标签 -->
<el-table-column prop="state" label="状态">
<!-- 自定义单元格内容 -->
<template v-slot="scope">
<!-- 如果角色状态为0显示绿色的正常标签 -->
<el-tag v-if="scope.row.state == '0'" type="success"
>正常</el-tag
>
<!-- 否则显示红色的停用标签 -->
<el-tag v-else type="danger">停用</el-tag>
</template>
</el-table-column>
<!-- 操作列固定在表格右侧宽度 360px -->
<el-table-column label="操作" width="360" fixed="right">
<!-- 自定义单元格内容 -->
<template v-slot="scope">
<!-- 修改按钮点击触发 editRole 方法传递当前行数据 -->
<el-button
type="success"
@click="editRole(scope.row)"
style="font-size: 18px"
>
<!-- 修改图标 -->
<i
class="iconfont icon-r-edit"
style="font-size: 18px"
></i>
修改</el-button
>
<!-- 按钮文本 -->
修改
</el-button>
<!-- 停用按钮只有当角色状态为0时显示点击触发 forbidden 方法传递角色 id -->
<el-button
v-if="scope.row.state == '0'"
type="danger"
@click="forbidden(scope.row.id)"
style="font-size: 18px"
>
<!-- 停用图标 -->
<i
class="iconfont icon-r-no"
style="font-size: 18px"
></i>
停用</el-button
>
<!-- 按钮文本 -->
停用
</el-button>
<!-- 授权按钮点击触发 checkPermissons 方法传递角色 id -->
<el-button
type="warning"
@click="checkPermissons(scope.row.id)"
style="font-size: 18px"
>
<!-- 授权图标 -->
<i
class="iconfont icon-r-setting"
style="font-size: 18px"
></i>
授权</el-button
>
<!-- 按钮文本 -->
授权
</el-button>
</template>
</el-table-column>
</el-table>
<!--修改描述/状态弹出框-->
<!-- 修改描述/状态弹出框标题为角色信息修改双向绑定显示状态到 dialogVisible宽度 50% -->
<el-dialog
title="角色信息修改"
:visible.sync="dialogVisible"
width="50%"
>
<!-- 表单组件绑定数据到 editRoleForm -->
<el-form
v-model="editRoleForm"
label-width="100px"
class="demo-ruleForm"
>
<!-- 名称表单项输入框禁用显示角色名称 -->
<el-form-item label="名称:">
<el-input disabled v-model="editRoleForm.name"></el-input>
</el-form-item>
<!-- 描述表单项输入框用于输入角色描述双向绑定到 editRoleForm info 属性 -->
<el-form-item label="描述:">
<el-input
type="text"
v-model="editRoleForm.info"
></el-input>
</el-form-item>
<!-- 状态表单项下拉选择框用于选择角色状态双向绑定到 editRoleForm state 属性 -->
<el-form-item label="状态:">
<el-select
v-model="editRoleForm.state"
@ -128,6 +175,7 @@
@change="$forceUpdate()"
placeholder="请选择状态"
>
<!-- 遍历 options 数组生成下拉选项 -->
<el-option
v-for="item in options"
:key="item.value"
@ -137,30 +185,38 @@
</el-option>
</el-select>
</el-form-item>
<!-- 提交和重置按钮表单项 -->
<el-form-item>
<!-- 提交按钮点击触发 submitEditForm 方法 -->
<el-button
type="primary"
@click="submitEditForm"
style="font-size: 18px"
>
<!-- 提交图标 -->
<i
class="iconfont icon-r-yes"
style="font-size: 18px"
></i>
提交</el-button
>
<!-- 按钮文本 -->
提交
</el-button>
<!-- 重置按钮点击触发 resetEditForm 方法 -->
<el-button @click="resetEditForm" style="font-size: 18px">
<!-- 重置图标 -->
<i
class="iconfont icon-r-refresh"
style="font-size: 18px"
></i>
重置</el-button
>
<!-- 按钮文本 -->
重置
</el-button>
</el-form-item>
</el-form>
</el-dialog>
<!--创建角色弹出框-->
<!-- 创建角色弹出框标题为创建角色双向绑定显示状态到 newRoleVisable宽度 50% -->
<el-dialog title="创建角色" :visible.sync="newRoleVisable" width="50%">
<!-- 表单组件绑定数据到 newRoleForm设置验证规则引用为 newRoleForm -->
<el-form
:model="newRoleForm"
:rules="rules"
@ -168,51 +224,62 @@
label-width="100px"
class="demo-ruleForm"
>
<!-- 名称表单项输入框用于输入角色名称双向绑定到 newRoleForm name 属性 -->
<el-form-item label="名称:" prop="name">
<el-input v-model="newRoleForm.name"></el-input>
</el-form-item>
<!-- 描述表单项输入框用于输入角色描述双向绑定到 newRoleForm info 属性 -->
<el-form-item label="描述:">
<el-input type="text" v-model="newRoleForm.info"></el-input>
</el-form-item>
<!-- 创建和重置按钮表单项 -->
<el-form-item>
<!-- 创建角色按钮点击触发 submitNewForm 方法传递参数 'newRoleForm' -->
<el-button
type="primary"
@click="submitNewForm('newRoleForm')"
style="font-size: 18px"
>
<!-- 创建图标 -->
<i
class="iconfont icon-r-add"
style="font-size: 18px"
></i>
创建角色</el-button
>
<!-- 按钮文本 -->
创建角色
</el-button>
<!-- 重置按钮点击触发 resetNewForm 方法 -->
<el-button @click="resetNewForm" style="font-size: 18px">
<!-- 重置图标 -->
<i
class="iconfont icon-r-refresh"
style="font-size: 18px"
></i
>重置</el-button
>
>重置
</el-button>
</el-form-item>
</el-form>
</el-dialog>
<!--职能分配框-->
<!-- 权限分配的弹出框标题为权限分配双向绑定显示状态到 distributionFulVisable宽度 50% -->
<el-dialog
title="权限分配"
:visible.sync="distributionFulVisable"
width="50%"
>
<!-- 表单组件绑定数据到 distributionFulForm -->
<el-form
:model="distributionFulForm"
label-width="100px"
class="demo-ruleForm"
>
<!-- 输入框和树形结构表单项输入框用于过滤树形结构数据 -->
<el-form-item>
<el-input
placeholder="输入关键字进行过滤"
v-model="filterText"
>
</el-input>
<!-- 树形结构组件绑定数据设置属性 -->
<el-tree
:data="fuloptions"
class="filter-tree"
@ -225,18 +292,23 @@
:props="props"
></el-tree>
</el-form-item>
<!-- 提交和取消按钮表单项 -->
<el-form-item>
<!-- 提交按钮点击触发 submitDistributionFulForm 方法 -->
<el-button
type="primary"
@click="submitDistributionFulForm"
style="font-size: 18px"
>
<!-- 提交图标 -->
<i
class="iconfont icon-r-add"
style="font-size: 18px"
></i>
提交</el-button
>
<!-- 按钮文本 -->
提交
</el-button>
<!-- 取消按钮点击触发 celDistributionFul 方法 -->
<el-button
@click="celDistributionFul"
style="font-size: 18px"
@ -248,6 +320,7 @@
</div>
</template>
<script>
// API
import {
forbiddenRole,
roleList,
@ -256,29 +329,46 @@ import {
checkPermissons,
saveRolePermissons,
} from "@/api/system/role/roleApi";
// ajaxPost
import { ajaxPost, popup } from "@/assets/js/common";
export default {
//
data() {
return {
//
tableData: [],
//
editRoleForm: {},
//
editRoleRow: {},
//
dialogVisible: false,
//
newRoleVisable: false,
//
distributionFulVisable: false,
//
newRoleForm: {},
//
roleSearchForm: {},
//
distributionFulForm: {},
//
options: [
{ label: "正常", value: "0" },
{ label: "停用", value: "-1" },
],
/*职能分配*/
/*职能分配相关数据*/
//
props: { multiple: true },
//
fuloptions: [],
//
default_checked_mid: [],
//
filterText: "",
// name
rules: {
name: [
{
@ -290,16 +380,20 @@ export default {
},
};
},
// filterText filter
watch: {
filterText(val) {
this.$refs.tree.filter(val);
},
},
//
methods: {
//
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
// roleList API tableData
init() {
roleList(this.roleSearchForm).then((res) => {
res = res.data;
@ -310,57 +404,70 @@ export default {
}
});
},
// forbiddenRole API id
forbidden(id) {
forbiddenRole(id).then((res) => {
res = res.data;
if (res.code == 200) {
// 0
this.roleSearchForm.state = "0";
//
this.init();
//
popup("操作成功");
} else {
//
popup(res.msg, "error");
}
});
},
/*弹出修改表单*/
/*弹出修改表单,将当前行数据赋值给 editRoleForm 和 editRoleRow并显示对话框*/
editRole(row) {
this.editRoleForm = { ...row };
this.editRoleRow = { ...row };
this.dialogVisible = true;
},
/*条件搜索*/
/*条件搜索方法,调用 init 方法重新获取角色列表数据*/
subSearchForm() {
this.init();
},
/*对接后端修改角色接口*/
/*对接后端修改角色接口的方法,检查是否有修改内容,有则调用 edit_role API 修改角色信息*/
submitEditForm() {
if (
this.editRoleForm.info == this.editRoleRow.info &&
this.editRoleForm.state == this.editRoleRow.state
) {
//
popup("您没有更改内容", "warning");
return;
}
edit_role (this.editRoleForm).then ((res) => {
res = res.data;
if (res.code == 200) {
//
popup ("操作成功");
//
this.editRoleForm = {};
//
this.editRoleRow = {};
//
this.dialogVisible = false;
// 0
this.roleSearchForm.state = "0";
//
this.init ();
} else {
//
popup (res.msg, "error");
}
});
},
/*修改角色重置按钮*/
/修改角色重置按钮方法,将 editRoleRow 数据赋值给 editRoleForm实现表单重置/
resetEditForm() {
this.editRoleForm = {...this.editRoleRow };
},
/*创建新角色*/
/创建新角色方法,验证表单数据,通过后调用 save_role API 创建角色/
submitNewForm (formName) {
this.$refs [formName].validate ((valid) => {
if (valid) {
@ -368,41 +475,48 @@ export default {
save_role (this.newRoleForm).then ((res) => {
res = res.data;
if (res.code == 200) {
//
popup ("操作成功");
//
this.newRoleForm = {};
//
this.newRoleVisable = false;
//
this.init ();
} else {
//
popup (res.msg, "error");
}
});
}
});
},
//
resetNewForm () {
this.newRoleForm = {};
},
/*职能分配*/
/*授权按钮*/
//
// distributionFulForm rid
checkPermissons (rid) {
this.distributionFulForm.rid = rid;
this.default_checked_mid = [];
checkPermissons (rid).then ((res) => {
res = res.data;
if (res.code == 200) {
//
this.fuloptions = res.data.menus;
this.default_checked_mid = res.data.menuIds.sort(
(x, y) => x - y
);
// id
this.default_checked_mid = res.data.menuIds.sort ((x, y) => x - y);
console.log (typeof this.default_checked_mid);
console.log (this.default_checked_mid);
} else {
//
popup (res.msg, "error");
}
});
this.distributionFulVisable = true;
},
// distributionFulForm menuIds saveRolePermissons API
submitDistributionFulForm () {
var keys = this.$refs.tree.getCheckedKeys ();
var v = JSON.stringify (keys).replace ("[", "").replace ("]","");
@ -411,17 +525,24 @@ export default {
saveRolePermissons (this.distributionFulForm).then ((res) => {
res = res.data;
if (res.code == 200) {
//
popup ("操作成功");
//
this.distributionFulVisable = false;
//
this.distributionFulForm = {};
//
this.default_checked_mid = [];
//
this.fuloptions = [];
} else {
//
popup (res.msg, "error");
}
});
this.distributionFulVisable = false;
},
//
celDistributionFul () {
this.default_checked_mid = [];
this.fuloptions = [];
@ -429,12 +550,17 @@ export default {
this.distributionFulVisable = false;
},
},
// init
created () {
this.init ();
},
};
</script>
### `<style>` 部分
```css
<style>
/* 搜索区域的样式,内联块显示,居中,高度 51px行高 51px */
.search {
display: inline-block;
margin: 0 auto;
@ -442,6 +568,7 @@ export default {
line-height: 51px;
}
/* 搜索区域内列的样式,内联块显示,居中,右侧外边距 2px行高 48px高度 51px */
.search.column {
display: inline-block;
margin: 0 auto;

Loading…
Cancel
Save