Merge branch 'projects/mes-test' into projects/mes-zhp

This commit is contained in:
‘937886381’
2024-08-13 08:36:54 +08:00
117 changed files with 24343 additions and 11539 deletions

View File

@@ -0,0 +1,168 @@
<template>
<div class="navbar">
<div class="logo-container">
<img
src="../../../assets/images/cnbm.png"
style="
width: 34px;
height: 34px;
position: relative;
top: 9px;
margin-right: 8px;
"
alt="" />
MES产品化重构
</div>
<top-nav id="warnmenu-container" class="warnmenu-container" v-if="topNav" />
<div style="padding-top: 5px; padding-right: 38px">
<navbar-right :blackTitle="true" />
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import TopNav from './TopNav';
import Hamburger from '@/components/Hamburger';
import Screenfull from '@/components/Screenfull';
import SizeSelect from '@/components/SizeSelect';
import Search from '@/components/HeaderSearch';
import NotifyMessage from '@/layout/components/Message';
// import {getPath} from "@/utils/ruoyi";
import NavbarRight from './NavbarRight.vue';
export default {
components: {
TopNav,
Hamburger,
Screenfull,
SizeSelect,
Search,
NotifyMessage,
NavbarRight,
},
computed: {
...mapGetters(['sidebar', 'avatar', 'nickname', 'device']),
setting: {
get() {
return this.$store.state.settings.showSettings;
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
value: val,
});
},
},
topNav: {
get() {
return this.$store.state.settings.topNav;
},
},
},
methods: {
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar');
},
async logout() {
this.$modal
.confirm('确定注销并退出系统吗?', '提示')
.then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = getPath('/');
});
})
.catch(() => {});
},
},
};
</script>
<style lang="scss" scoped>
.navbar {
height: 84px; // 56/48
overflow: hidden;
position: relative;
background-color: #fff;
.logo-container {
line-height: 84px;
height: 100%;
float: left;
cursor: pointer;
font-size: 26px;
padding-left: 40px;
font-weight: 500;
color: #0c0030;
}
.warnmenu-container {
position: absolute;
left: 290px;
}
.errLog-container {
display: inline-block;
vertical-align: top;
}
.right-menu {
float: right;
height: 100%;
line-height: 56px;
&:focus {
outline: none;
}
.right-menu-item {
display: inline-block;
padding: 0 8px;
height: 100%;
font-size: 18px;
color: #5a5e66;
vertical-align: text-bottom;
&.hover-effect {
cursor: pointer;
transition: background 0.3s;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
}
.avatar-container {
margin-right: 30px;
.avatar-wrapper {
display: flex;
justify-content: center;
align-items: center;
position: relative;
.user-avatar {
cursor: pointer;
width: 35px;
height: 35px;
border-radius: 50%;
}
.user-nickname {
margin-left: 5px;
font-size: 14px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 25px;
font-size: 12px;
}
}
}
}
}
</style>

View File

@@ -0,0 +1,138 @@
<template>
<div class="right-msg" :style="blackTitle ? 'color: #000' : 'color: #fff'">
<!-- <div class="home-icon" v-if="blackTitle">
<svg-icon
icon-class="alarm"
style="font-size: 24px; cursor: pointer"
@click="toHome" />
</div> -->
<!-- <div class="time-msg">
<div class="line1">{{timeZone}}&nbsp;&nbsp;&nbsp;&nbsp;{{topTime}}</div>
<div class="line2">{{topDate}}</div>
</div> -->
<div class="base-msg">
<div class="avatar">
<el-dropdown>
<img
:src="require(`../../../assets/images/choicepart/avatar.png`)"
alt=""
width="42"
height="42"
style="position: relative; top: 4px" />
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item>
<svg-icon icon-class="helpbtn" />
帮助文档
</el-dropdown-item> -->
<el-dropdown-item @click.native="logout">
<svg-icon icon-class="exitbtn" />
退出登录
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div class="use-msg">
<div class="line1">{{ nickname }}</div>
<div class="line2">{{ dept }}</div>
</div>
</div>
</div>
</template>
<script>
import moment from 'moment';
import { getUser } from '@/api/system/user.js';
import { getPath } from '@/utils/ruoyi';
export default {
name: 'navRight',
data() {
return {
// topDate: '',
// topTime: '',
// timeZone: '',
timer: '',
dept: ' ',
nickname: this.$store.getters.nickname,
};
},
props: {
blackTitle: {
type: Boolean,
default: () => {
return false;
},
},
},
created() {
this.getUserMsg();
// this.getTime();
},
beforeDestroy() {
clearInterval(this.timer);
},
methods: {
// getTime() {
// let _this = this;
// this.timer = setInterval(function () {
// _this.topDate = moment().format('YYYY/MM/DD');
// let temp = moment().format('A-hh:mm').split('-');
// _this.timeZone = temp[0];
// _this.topTime = temp[1];
// }, 1000);
// },
getUserMsg() {
let id = this.$store.getters.userId;
getUser(id).then((res) => {
this.dept = res.data.dept ? res.data.dept.name : '';
});
},
async logout() {
this.$modal
.confirm('确定注销并退出系统吗?', '提示')
.then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = getPath('/');
});
})
.catch(() => {});
},
toHome() {
this.$router.push({ path: '/' });
},
},
};
</script>
<style lang="scss" scoped>
.right-msg {
float: right;
height: 84px;
font-size: 14px;
.time-msg {
display: inline-block;
margin-right: 30px;
}
.home-icon {
display: inline-block;
margin-right: 20px;
vertical-align: top;
line-height: 84px;
}
.base-msg {
display: inline-block;
padding-top: 10px;
.avatar {
display: inline-block;
margin-right: 10px;
}
.use-msg {
display: inline-block;
}
}
.line1 {
height: 19px;
}
.line2 {
height: 19px;
opacity: 0.65;
}
}
</style>

View File

@@ -0,0 +1,273 @@
<template>
<el-menu
:default-active="activeMenu"
mode="horizontal"
@select="handleSelect">
<template v-for="(item, index) in topMenus">
<el-menu-item
:style="{ '--theme': theme }"
:index="item.path"
:key="index"
v-if="index < visibleNumber">
<!-- <svg-icon :icon-class="item.meta.icon" /> -->
<span class="menu-box">
<span class="menu-dot"></span>
{{ item.meta.title }}
</span>
</el-menu-item>
</template>
<!-- 顶部菜单超出数量折叠 -->
<el-submenu
:style="{ '--theme': theme }"
index="more"
v-if="topMenus.length > visibleNumber">
<template slot="title">更多菜单</template>
<template v-for="(item, index) in topMenus">
<el-menu-item
:index="item.path"
:key="index"
v-if="index >= visibleNumber">
<!-- <svg-icon :icon-class="item.meta.icon" /> -->
<span class="menu-box">
<span class="menu-dot"></span>
{{ item.meta.title }}
</span>
</el-menu-item>
</template>
</el-submenu>
</el-menu>
</template>
<script>
import { mapGetters } from 'vuex';
import { constantRoutes } from '@/router';
// 隐藏侧边栏路由
const hideList = ['/index', '/user/profile'];
export default {
data() {
return {
// 顶部栏初始数
visibleNumber: 5,
// 当前激活菜单的 index
// currentIndex: undefined,
};
},
computed: {
...mapGetters(['choicepart']),
currentIndex() {
return this.choicepart;
},
theme() {
return this.$store.state.settings.theme;
},
// 顶部显示菜单
topMenus() {
let topMenus = [];
this.routers.map((menu) => {
if (menu.hidden !== true) {
// 兼容顶部栏一级菜单内部跳转
if (menu.path === '/') {
topMenus.push(menu.children[0]);
} else {
topMenus.push(menu);
}
}
});
console.log('topMenus:', topMenus);
return topMenus;
},
// 所有的路由信息
routers() {
return this.$store.state.permission.topbarRouters;
},
// 设置子路由
childrenMenus() {
const childrenMenus = [];
this.routers.map((router) => {
for (let item in router.children) {
if (router.children[item].parentPath === undefined) {
if (router.path === '/') {
router.children[item].path = '/' + router.children[item].path;
} else {
if (!this.ishttp(router.children[item].path)) {
router.children[item].path =
router.path + '/' + router.children[item].path;
}
}
router.children[item].parentPath = router.path;
}
childrenMenus.push(router.children[item]);
}
});
return constantRoutes.concat(childrenMenus);
},
// 默认激活的菜单
activeMenu() {
const path = this.$route.path;
let activePath = path;
if (
path !== undefined &&
path.lastIndexOf('/') > 0 &&
hideList.indexOf(path) === -1
) {
const tmpPath = path.substring(1, path.length);
activePath = '/' + tmpPath.substring(0, tmpPath.indexOf('/'));
if (!this.$route.meta.link) {
this.$store.dispatch('app/toggleSideBarHide', false);
}
} else if (!this.$route.children) {
activePath = path;
this.$store.dispatch('app/toggleSideBarHide', true);
}
this.activeRoutes(activePath);
return activePath;
},
},
beforeMount() {
window.addEventListener('resize', this.setVisibleNumber);
},
beforeDestroy() {
window.removeEventListener('resize', this.setVisibleNumber);
},
mounted() {
this.setVisibleNumber();
},
methods: {
// 根据宽度计算设置显示栏数
setVisibleNumber() {
const width = window.innerWidth - 700;
console.log(width);
console.log('window.innerWidth:', window.innerWidth);
this.visibleNumber = parseInt(width / 110);
console.log('this.visibleNumber:', this.visibleNumber);
},
// 菜单选择事件
handleSelect(key, keyPath) {
// this.currentIndex = key;
const route = this.routers.find((item) => item.path === key);
console.log('route:', route);
this.$store.dispatch('app/setChoicepart', key);
this.toRouter(route);
// if (this.ishttp(key)) {
// // http(s):// 路径新窗口打开
// window.open(key, '_blank');
// console.log('aaaaaaaaaaaaaa');
// } else if (!route || !route.children) {
// // 没有子路由路径内部打开
// this.$router.push({ path: key });
// this.$store.dispatch('app/toggleSideBarHide', true);
// console.log('bbbbbbbbbbbbbbb');
// } else {
// // 显示左侧联动菜单
// this.activeRoutes(key);
// if (!this.$route.meta.link) {
// this.$store.dispatch('app/toggleSideBarHide', false);
// }
// console.log('cccccccccccccccc');
// }
},
toRouter(item) {
console.log(item);
if (item.children) {
this.toRouter(item.children[0]);
} else {
this.$router.push({ name: item.name });
}
},
// 当前激活的路由
activeRoutes(key) {
const routes = [];
if (this.childrenMenus && this.childrenMenus.length > 0) {
this.childrenMenus.map((item) => {
if (
key === item.parentPath ||
(key === 'index' && '' === item.path)
) {
routes.push(item);
}
});
}
if (routes.length > 0) {
this.$store.commit('SET_SIDEBAR_ROUTERS', routes);
} else {
this.$store.dispatch('app/toggleSideBarHide', true);
}
},
ishttp(url) {
return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1;
},
},
};
</script>
<style lang="scss">
.warnmenu-container.el-menu.el-menu--horizontal > .el-menu-item.is-active {
border-bottom: none !important;
}
.warnmenu-container.el-menu.el-menu--horizontal > .el-submenu.is-active {
--theme: none !important;
}
.warnmenu-container.el-menu--horizontal > .el-menu-item {
float: left;
height: 84px !important;
line-height: 84px !important;
color: #000 !important;
padding: 0 5px !important;
font-size: 18px;
.menu-box {
// color: #fff;
}
}
.warnmenu-container.el-menu--horizontal
> .el-menu-item:not(.is-disabled):hover {
background-color: transparent;
}
.warnmenu-container.el-menu {
background-color: transparent;
}
.warnmenu-container.el-menu.el-menu--horizontal {
border: none;
}
.warnmenu-container.el-menu--horizontal > .el-menu-item.is-active,
.el-menu--horizontal > .el-submenu.is-active .el-submenu__title {
border-bottom: 2px solid #{'var(--theme)'} !important;
color: #303133;
}
/* submenu item */
.warnmenu-container.el-menu--horizontal > .el-submenu .el-submenu__title {
float: left;
height: 84px !important;
line-height: 91px !important;
color: #000 !important;
padding: 0 5px !important;
margin: 0 10px !important;
font-size: 18px;
}
.warnmenu-container.el-menu--horizontal > .el-submenu .el-submenu__title:hover {
background-color: transparent;
}
.warnmenu-container.el-menu--horizontal > .el-submenu .el-submenu__title i {
// color: #fff;
}
</style>
<style lang="scss" scoped>
.menu-box {
padding: 3px 10px 5px 10px;
border-radius: 30px;
color: #000;
}
.menu-dot {
display: inline-block;
width: 5px;
height: 5px;
border-radius: 50%;
background: #0b58ff;
margin-right: 3px;
margin-bottom: 2px;
opacity: 0;
}
</style>

View File

@@ -0,0 +1,196 @@
<template>
<div class="warning-page">
<navbar />
<div class="main-box">
<div class="title">
<span></span>
异常警告
<div class="return-home" @click="toHome">
<svg-icon
icon-class="alarm-home"
style="font-size: 20px; position: relative; top: 2px" />
返回首页
</div>
</div>
<search-bar
:formConfigs="formConfig"
removeBlue
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
:page="1"
:limit="100000"
:table-props="tableProps"
:table-data="list"
:max-height="tableH" />
</div>
<div class="footer">
<img src="../../assets/img/alarm-bg.png" alt="" />
<div>&copy; 中建材智能自动化研究院有限公司</div>
</div>
</div>
</template>
<script>
import Navbar from './components/Navbar';
import moment from 'moment';
import tableHeightMixin from '@/mixins/tableHeightMixin';
export default {
name: 'AbnormalWarning',
mixins: [tableHeightMixin],
components: { Navbar },
data() {
return {
formConfig: [
{
type: 'input',
label: '报警来源',
placeholder: '报警来源',
param: 'content',
},
{
type: 'select',
label: '时间段',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'typeId',
filterable: true,
},
{
type: 'select',
label: '报警级别',
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'typeId',
filterable: true,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
heightNum: 280,
tableProps: [
{
prop: 'createTime',
label: '报警时间',
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{
prop: 'productionLineName1',
label: '报警来源',
showOverflowtooltip: true,
},
{
prop: 'productionLineName2',
label: '报警类型',
showOverflowtooltip: true,
},
{
prop: 'productionLineName3',
label: '报警级别',
showOverflowtooltip: true,
},
{
prop: 'productionLineName4',
label: '报警原因',
showOverflowtooltip: true,
},
{
prop: 'sectionName5',
label: '报警详情',
showOverflowtooltip: true,
},
],
list: [
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
],
};
},
created() {},
methods: {
buttonClick(val) {},
toHome() {
this.$router.push({ path: '/' });
},
},
};
</script>
<style lang="scss" scoped>
.warning-page {
width: 100%;
height: 100vh;
.main-box {
position: relative;
width: 64.58%;
height: calc(100vh - 160px);
background-color: #fff;
border-radius: 24px;
margin: 16px auto 0;
z-index: 10;
padding: 24px 32px;
.title {
font-size: 16px;
color: #000000;
position: relative;
cursor: pointer;
span {
display: inline-block;
float: left;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
margin-top: 4px;
}
.return-home {
position: absolute;
color: rgba(0, 0, 0, 0.3);
font-size: 14px;
right: 0px;
top: 0px;
}
}
}
.footer {
position: fixed;
width: 100%;
bottom: -3px;
z-index: 8;
img {
width: 100%;
height: 220px;
}
div {
width: 100%;
color: red;
position: absolute;
bottom: 10px;
text-align: center;
font-size: 12px;
color: #c7c7c7;
letter-spacing: 1px;
}
}
}
</style>

View File

@@ -1,8 +1,8 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: DY
* @LastEditTime: 2023-09-21 16:02:07
* @LastEditors: zwq
* @LastEditTime: 2024-07-22 11:15:10
* @Description:
*/
export default {
@@ -17,7 +17,7 @@ export default {
},
tableData: [],
listQuery: {
pageSize: 10,
pageSize: 20,
pageNo: 1,
total: 1,
},
@@ -101,11 +101,8 @@ export default {
},
// 删除
deleteHandle(id, name, index) {
this.$confirm(`确定对${name ? '[名称=' + name + ']' : '[序号=' + index + ']'}进行删除操作?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
this.$modal
.delConfirm(name ? '名称: ' + name : '序号: ' + index)
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.$message({

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2024-07-01 14:53:55
* @LastEditors: zwq
* @LastEditTime: 2024-07-12 16:19:13
* @LastEditTime: 2024-07-22 15:20:51
* @Description:
-->
<template>
@@ -54,6 +54,8 @@ import {
} from '@/api/base/groupClasses';
import GroupClassAdd from './components/groupClassAdd.vue';
import StatusBtn from './components/statusBtn';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'name',
@@ -82,6 +84,7 @@ const tableProps = [
export default {
name: 'GroupClass',
components: { GroupClassAdd },
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
@@ -125,7 +128,6 @@ export default {
}
: undefined,
].filter((v) => v),
tableH: this.tableHeight(260),
// 总条数
total: 0,
// 班次基础信息列表
@@ -143,9 +145,6 @@ export default {
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260);
});
this.getList();
},
methods: {
@@ -223,19 +222,18 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
console.log(row);
let _this = this;
if (row.enabled) {
// 可用
_this.$modal
.confirm(
.newConfirm(
'删除的班次"' +
row.name +
'"可能会影响交接班计划,请点取消再次确认!'
)
,'提示')
.then(function () {
return _this.$modal
.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?')
.delConfirm('名称: ' + row.name)
.then(function () {
return deleteGroupClasses(row.id);
})
@@ -247,7 +245,7 @@ export default {
});
} else {
_this.$modal
.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?')
.delConfirm('名称: ' + row.name)
.then(function () {
return deleteGroupClasses(row.id);
})

View File

@@ -1,234 +1,238 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick"
/>
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH"
@emitFun="handleTableEvents"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width='40%'
>
<group-team-add ref="groupList" @successSubmit="successSubmit" />
</base-dialog>
</div>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH"
@emitFun="handleTableEvents">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" />
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="40%">
<group-team-add ref="groupList" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import { getGroupTeamPage, deleteGroupTeam, updateGroupTeam } from "@/api/base/groupTeam";
import { parseTime } from '@/utils/ruoyi'
import GroupTeamAdd from './components/groupTeamAdd'
import StatusBtn from './components/statusBtn'
import {
getGroupTeamPage,
deleteGroupTeam,
updateGroupTeam,
} from '@/api/base/groupTeam';
import { parseTime } from '@/utils/ruoyi';
import GroupTeamAdd from './components/groupTeamAdd';
import StatusBtn from './components/statusBtn';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'createTime',
label: '创建时间',
filter: parseTime,
minWidth: 160
},
{
prop: 'name',
label: '班组名称'
},
{
prop: 'code',
label: '编码',
minWidth: 220
},
{
prop: 'num',
label: '班组人数'
},
{
prop: 'leaderName',
label: '组长'
},
{
prop: 'enabled',
label: '班组状态',
subcomponent: StatusBtn
},
]
{
prop: 'createTime',
label: '创建时间',
filter: parseTime,
minWidth: 160,
},
{
prop: 'name',
label: '班组名称',
},
{
prop: 'code',
label: '编码',
minWidth: 220,
},
{
prop: 'num',
label: '班组人数',
},
{
prop: 'leaderName',
label: '组长',
},
{
prop: 'enabled',
label: '班组状态',
subcomponent: StatusBtn,
},
];
export default {
name: "GroupTeam",
components: { GroupTeamAdd },
data() {
return {
formConfig: [
{
type: 'input',
label: '班组名称',
placeholder: '班组名称',
param: 'name'
},
{
type: 'input',
label: '组长',
placeholder: '组长',
param: 'leaderName'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('base:group-team:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:group-team:update')
? {
type: 'edit',
btnName: '编辑'
}
: undefined,
this.$auth.hasPermi('base:group-team:delete')
? {
type: 'delete',
btnName: '删除'
}
: undefined
].filter((v) => v),
tableH: this.tableHeight(260),
// 总条数
total: 0,
// 班次基础信息列表
list: [],
// 弹出层标题
addOrEditTitle: "",
// 是否显示弹出层
centervisible: false,
// 查询参数
queryParams: {
pageNo: 1,
pageSize: 20,
name: null,
code: null
},
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.leaderName = val.leaderName
this.queryParams.name = val.name
this.getList()
break
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.groupList.init()
})
}
},
/** 查询列表 */
getList() {
getGroupTeamPage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.$nextTick(() => {
this.$refs.groupList.init(val.data.id)
})
this.centervisible = true
break
default:
this.handleDelete(val.data)
}
},
// 班组状态
handleTableEvents(params) {
if (params.name === 'state') {// 班组状态
updateGroupTeam({ ...params.payload }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.getList()
}
}).catch((res)=>{
this.getList()
})
}
},
handleCancel() {
this.$refs.groupList.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.groupList.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除班组名称为"' + row.name + '"的数据项?').then(function() {
return deleteGroupTeam(row.id);
}).then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
closeDrawer() {
this.getList()
}
}
name: 'GroupTeam',
components: { GroupTeamAdd },
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
{
type: 'input',
label: '班组名称',
placeholder: '班组名称',
param: 'name',
},
{
type: 'input',
label: '组长',
placeholder: '组长',
param: 'leaderName',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:group-team:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:group-team:update')
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:group-team:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
// 总条数
total: 0,
// 班次基础信息列表
list: [],
// 弹出层标题
addOrEditTitle: '',
// 是否显示弹出层
centervisible: false,
// 查询参数
queryParams: {
pageNo: 1,
pageSize: 20,
name: null,
code: null,
},
};
},
created() {
this.getList();
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.leaderName = val.leaderName;
this.queryParams.name = val.name;
this.getList();
break;
default:
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.groupList.init();
});
}
},
/** 查询列表 */
getList() {
getGroupTeamPage(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.groupList.init(val.data.id);
});
this.centervisible = true;
break;
default:
this.handleDelete(val.data);
}
},
// 班组状态
handleTableEvents(params) {
if (params.name === 'state') {
// 班组状态
updateGroupTeam({ ...params.payload })
.then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.getList();
}
})
.catch((res) => {
this.getList();
});
}
},
handleCancel() {
this.$refs.groupList.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.groupList.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.delConfirm('名称: ' + row.name)
.then(function () {
return deleteGroupTeam(row.id);
})
.then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
closeDrawer() {
this.getList();
},
},
};
</script>

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2024-07-10 11:08:48
* @LastEditors: zwq
* @LastEditTime: 2024-07-12 16:19:28
* @LastEditTime: 2024-07-19 14:09:18
* @Description:
-->
<template>
@@ -52,6 +52,7 @@ import {
} from '@/api/base/groupSchedulingPlan';
import { listDept } from '@/api/system/dept';
import schedulingPlanConfigAdd from './components/schedulingPlanConfigAdd.vue';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'deptName',
@@ -78,6 +79,7 @@ const tableProps = [
export default {
name: 'schedulingPlanConfig',
components: { schedulingPlanConfigAdd },
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
@@ -129,7 +131,6 @@ export default {
}
: undefined,
].filter((v) => v),
tableH: this.tableHeight(260),
// 总条数
total: 0,
// 列表
@@ -147,9 +148,6 @@ export default {
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260);
});
listDept().then((response) => {
this.formConfig[0].selectOptions = response.data;
});

View File

@@ -47,6 +47,7 @@ import {
} from '@/api/base/groupSchedulingRule';
import schedulingRuleConfigAdd from './components/schedulingRuleConfigAdd.vue';
import { formatDate } from '@/utils';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'enableTimeStr',
@@ -71,6 +72,7 @@ const tableProps = [
export default {
name: 'schedulingRuleConfig',
components: { schedulingRuleConfigAdd },
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
@@ -140,7 +142,6 @@ export default {
}
: undefined,
].filter((v) => v),
tableH: this.tableHeight(260),
// 总条数
total: 0,
// 班次基础信息列表
@@ -158,9 +159,6 @@ export default {
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260);
});
this.getList();
},
methods: {

View File

@@ -31,6 +31,7 @@
import { getByWorkOrder } from '@/api/monitoring/groupTeamView'
import { workOrderList } from '@/api/base/workOrder'
import GroupTeamViewDetail from './components/groupTeamViewDetail.vue'
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'name',
@@ -51,6 +52,7 @@ const tableProps = [
]
export default {
name: 'GroupTeamView',
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
@@ -86,16 +88,12 @@ export default {
: undefined
].filter((v) => v),
tableProps,
tableH: this.tableHeight(220),
list: [],
paramVisible: false
}
},
components: { GroupTeamViewDetail },
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(220)
})
this.getOrderList()
},
methods: {
@@ -140,4 +138,4 @@ export default {
}
}
}
</script>
</script>

View File

@@ -37,6 +37,7 @@
import { groupTeamSchedulingPage, groupClassesListAll } from '@/api/monitoring/teamProduction'
import { parseTime } from '@/utils/ruoyi'
import TeamProductionDetail from './components/teamProductionDetail'
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'createTime',
@@ -74,6 +75,7 @@ const tableProps = [
]
export default {
name: 'GroupTeamScheduling',
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
@@ -126,16 +128,12 @@ export default {
: undefined
].filter((v) => v),
list: [],
tableH: this.tableHeight(260),
total: 0,
paramVisible: false
}
},
components: { TeamProductionDetail },
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getGroupClass()
this.getList()
},
@@ -169,4 +167,4 @@ export default {
}
}
}
</script>
</script>

View File

@@ -0,0 +1,167 @@
<template>
<div class="navbar">
<div class="logo-container">
<img
src="../../../assets/images/cnbm.png"
style="
width: 34px;
height: 34px;
position: relative;
top: 9px;
margin-right: 8px;
"
alt="" />
MES产品化重构
</div>
<top-nav id="homemenu-container" class="homemenu-container" v-if="topNav" />
<div style="padding-top: 5px; padding-right: 24px">
<navbar-right :blackTitle="true" />
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import TopNav from './TopNav';
import Hamburger from '@/components/Hamburger';
import Screenfull from '@/components/Screenfull';
import SizeSelect from '@/components/SizeSelect';
import Search from '@/components/HeaderSearch';
import NotifyMessage from '@/layout/components/Message';
// import {getPath} from "@/utils/ruoyi";
import NavbarRight from './NavbarRight.vue';
export default {
components: {
TopNav,
Hamburger,
Screenfull,
SizeSelect,
Search,
NotifyMessage,
NavbarRight,
},
computed: {
...mapGetters(['sidebar', 'avatar', 'nickname', 'device']),
setting: {
get() {
return this.$store.state.settings.showSettings;
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
value: val,
});
},
},
topNav: {
get() {
return this.$store.state.settings.topNav;
},
},
},
methods: {
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar');
},
async logout() {
this.$modal
.confirm('确定注销并退出系统吗?', '提示')
.then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = getPath('/');
});
})
.catch(() => {});
},
},
};
</script>
<style lang="scss" scoped>
.navbar {
height: 84px; // 56/48
overflow: hidden;
position: relative;
.logo-container {
color: #fff;
line-height: 84px;
height: 100%;
float: left;
cursor: pointer;
font-size: 26px;
padding-left: 40px;
font-weight: 500;
}
.homemenu-container {
position: absolute;
left: 290px;
}
.errLog-container {
display: inline-block;
vertical-align: top;
}
.right-menu {
float: right;
height: 100%;
line-height: 56px;
&:focus {
outline: none;
}
.right-menu-item {
display: inline-block;
padding: 0 8px;
height: 100%;
font-size: 18px;
color: #5a5e66;
vertical-align: text-bottom;
&.hover-effect {
cursor: pointer;
transition: background 0.3s;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
}
.avatar-container {
margin-right: 30px;
.avatar-wrapper {
display: flex;
justify-content: center;
align-items: center;
position: relative;
.user-avatar {
cursor: pointer;
width: 35px;
height: 35px;
border-radius: 50%;
}
.user-nickname {
margin-left: 5px;
font-size: 14px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 25px;
font-size: 12px;
}
}
}
}
}
</style>

View File

@@ -0,0 +1,143 @@
<template>
<div class="right-msg" :style="blackTitle ? 'color: #000' : 'color: #fff'">
<div class="home-icon" v-if="blackTitle">
<!-- <svg-icon
icon-class="home"
style="font-size: 24px; cursor: pointer"
@click="toHome" /> -->
<svg-icon
icon-class="home-alarm-white"
style="font-size: 24px; cursor: pointer"
@click="toAlarm" />
</div>
<!-- <div class="time-msg">
<div class="line1">{{timeZone}}&nbsp;&nbsp;&nbsp;&nbsp;{{topTime}}</div>
<div class="line2">{{topDate}}</div>
</div> -->
<div class="base-msg">
<div class="avatar">
<el-dropdown>
<img
:src="require(`../../../assets/images/choicepart/avatar.png`)"
alt=""
width="42"
height="42"
style="position: relative; top: 4px" />
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item>
<svg-icon icon-class="helpbtn" />
帮助文档
</el-dropdown-item> -->
<el-dropdown-item @click.native="logout">
<svg-icon icon-class="exitbtn" />
退出登录
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div class="use-msg">
<div class="line1">{{ nickname }}</div>
<div class="line2">{{ dept }}</div>
</div>
</div>
</div>
</template>
<script>
import moment from 'moment';
import { getUser } from '@/api/system/user.js';
import { getPath } from '@/utils/ruoyi';
export default {
name: 'navRight',
data() {
return {
// topDate: '',
// topTime: '',
// timeZone: '',
timer: '',
dept: ' ',
nickname: this.$store.getters.nickname,
};
},
props: {
blackTitle: {
type: Boolean,
default: () => {
return false;
},
},
},
created() {
this.getUserMsg();
// this.getTime();
},
// beforeDestroy() {
// clearInterval(this.timer);
// },
methods: {
// getTime() {
// let _this = this;
// this.timer = setInterval(function () {
// _this.topDate = moment().format('YYYY/MM/DD');
// let temp = moment().format('A-hh:mm').split('-');
// _this.timeZone = temp[0];
// _this.topTime = temp[1];
// }, 1000);
// },
getUserMsg() {
let id = this.$store.getters.userId;
getUser(id).then((res) => {
this.dept = res.data.dept ? res.data.dept.name : '';
});
},
async logout() {
this.$modal
.confirm('确定注销并退出系统吗?', '提示')
.then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = getPath('/');
});
})
.catch(() => {});
},
toAlarm() {
this.$router.push({ path: '/abnormalWarning' });
},
},
};
</script>
<style lang="scss" scoped>
.right-msg {
float: right;
height: 84px;
font-size: 14px;
.time-msg {
display: inline-block;
margin-right: 30px;
}
.home-icon {
display: inline-block;
margin-right: 20px;
vertical-align: top;
line-height: 84px;
}
.base-msg {
display: inline-block;
padding-top: 10px;
.avatar {
display: inline-block;
margin-right: 10px;
}
.use-msg {
display: inline-block;
color: #fff;
}
}
.line1 {
height: 19px;
}
.line2 {
height: 19px;
opacity: 0.65;
}
}
</style>

View File

@@ -0,0 +1,273 @@
<template>
<el-menu
:default-active="activeMenu"
mode="horizontal"
@select="handleSelect">
<template v-for="(item, index) in topMenus">
<el-menu-item
:style="{ '--theme': theme }"
:index="item.path"
:key="index"
v-if="index < visibleNumber">
<!-- <svg-icon :icon-class="item.meta.icon" /> -->
<span class="menu-box">
<span class="menu-dot"></span>
{{ item.meta.title }}
</span>
</el-menu-item>
</template>
<!-- 顶部菜单超出数量折叠 -->
<el-submenu
:style="{ '--theme': theme }"
index="more"
v-if="topMenus.length > visibleNumber">
<template slot="title">更多菜单</template>
<template v-for="(item, index) in topMenus">
<el-menu-item
:index="item.path"
:key="index"
v-if="index >= visibleNumber">
<!-- <svg-icon :icon-class="item.meta.icon" /> -->
<span class="menu-box">
<span class="menu-dot"></span>
{{ item.meta.title }}
</span>
</el-menu-item>
</template>
</el-submenu>
</el-menu>
</template>
<script>
import { mapGetters } from 'vuex';
import { constantRoutes } from '@/router';
// 隐藏侧边栏路由
const hideList = ['/index', '/user/profile'];
export default {
data() {
return {
// 顶部栏初始数
visibleNumber: 5,
// 当前激活菜单的 index
// currentIndex: undefined,
};
},
computed: {
...mapGetters(['choicepart']),
currentIndex() {
return this.choicepart;
},
theme() {
return this.$store.state.settings.theme;
},
// 顶部显示菜单
topMenus() {
let topMenus = [];
this.routers.map((menu) => {
if (menu.hidden !== true) {
// 兼容顶部栏一级菜单内部跳转
if (menu.path === '/') {
topMenus.push(menu.children[0]);
} else {
topMenus.push(menu);
}
}
});
console.log('topMenus:', topMenus);
return topMenus;
},
// 所有的路由信息
routers() {
return this.$store.state.permission.topbarRouters;
},
// 设置子路由
childrenMenus() {
const childrenMenus = [];
this.routers.map((router) => {
for (let item in router.children) {
if (router.children[item].parentPath === undefined) {
if (router.path === '/') {
router.children[item].path = '/' + router.children[item].path;
} else {
if (!this.ishttp(router.children[item].path)) {
router.children[item].path =
router.path + '/' + router.children[item].path;
}
}
router.children[item].parentPath = router.path;
}
childrenMenus.push(router.children[item]);
}
});
return constantRoutes.concat(childrenMenus);
},
// 默认激活的菜单
activeMenu() {
const path = this.$route.path;
let activePath = path;
if (
path !== undefined &&
path.lastIndexOf('/') > 0 &&
hideList.indexOf(path) === -1
) {
const tmpPath = path.substring(1, path.length);
activePath = '/' + tmpPath.substring(0, tmpPath.indexOf('/'));
if (!this.$route.meta.link) {
this.$store.dispatch('app/toggleSideBarHide', false);
}
} else if (!this.$route.children) {
activePath = path;
this.$store.dispatch('app/toggleSideBarHide', true);
}
this.activeRoutes(activePath);
return activePath;
},
},
beforeMount() {
window.addEventListener('resize', this.setVisibleNumber);
},
beforeDestroy() {
window.removeEventListener('resize', this.setVisibleNumber);
},
mounted() {
this.setVisibleNumber();
},
methods: {
// 根据宽度计算设置显示栏数
setVisibleNumber() {
const width = window.innerWidth - 700;
console.log(width);
console.log('window.innerWidth:', window.innerWidth);
this.visibleNumber = parseInt(width / 110);
console.log('this.visibleNumber:', this.visibleNumber);
},
// 菜单选择事件
handleSelect(key, keyPath) {
// this.currentIndex = key;
const route = this.routers.find((item) => item.path === key);
console.log('route:', route);
this.$store.dispatch('app/setChoicepart', key);
this.toRouter(route);
// if (this.ishttp(key)) {
// // http(s):// 路径新窗口打开
// window.open(key, '_blank');
// console.log('aaaaaaaaaaaaaa');
// } else if (!route || !route.children) {
// // 没有子路由路径内部打开
// this.$router.push({ path: key });
// this.$store.dispatch('app/toggleSideBarHide', true);
// console.log('bbbbbbbbbbbbbbb');
// } else {
// // 显示左侧联动菜单
// this.activeRoutes(key);
// if (!this.$route.meta.link) {
// this.$store.dispatch('app/toggleSideBarHide', false);
// }
// console.log('cccccccccccccccc');
// }
},
toRouter(item) {
console.log(item);
if (item.children) {
this.toRouter(item.children[0]);
} else {
this.$router.push({ name: item.name });
}
},
// 当前激活的路由
activeRoutes(key) {
const routes = [];
if (this.childrenMenus && this.childrenMenus.length > 0) {
this.childrenMenus.map((item) => {
if (
key === item.parentPath ||
(key === 'index' && '' === item.path)
) {
routes.push(item);
}
});
}
if (routes.length > 0) {
this.$store.commit('SET_SIDEBAR_ROUTERS', routes);
} else {
this.$store.dispatch('app/toggleSideBarHide', true);
}
},
ishttp(url) {
return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1;
},
},
};
</script>
<style lang="scss">
.homemenu-container.el-menu.el-menu--horizontal > .el-submenu.is-active {
--theme: none !important;
}
.homemenu-container.el-menu.el-menu--horizontal > .el-menu-item.is-active {
border-bottom: none !important;
}
.homemenu-container.el-menu--horizontal > .el-menu-item {
float: left;
height: 84px !important;
line-height: 84px !important;
color: #999093 !important;
padding: 0 5px !important;
font-size: 18px;
.menu-box {
color: #fff;
}
}
.homemenu-container.el-menu--horizontal
> .el-menu-item:not(.is-disabled):hover {
background-color: transparent;
}
.homemenu-container.el-menu {
background-color: transparent;
}
.homemenu-container.el-menu.el-menu--horizontal {
border: none;
}
.homemenu-container.el-menu--horizontal > .el-menu-item.is-active,
.el-menu--horizontal > .el-submenu.is-active .el-submenu__title {
border-bottom: 2px solid #{'var(--theme)'} !important;
color: #303133;
}
/* submenu item */
.homemenu-container.el-menu--horizontal > .el-submenu .el-submenu__title {
float: left;
height: 84px !important;
line-height: 91px !important;
color: #fff !important;
padding: 0 5px !important;
margin: 0 10px !important;
font-size: 18px;
}
.homemenu-container.el-menu--horizontal > .el-submenu .el-submenu__title:hover {
background-color: transparent;
}
.homemenu-container.el-menu--horizontal > .el-submenu .el-submenu__title i {
color: #fff;
}
</style>
<style lang="scss" scoped>
.menu-box {
padding: 3px 10px 5px 10px;
border-radius: 30px;
color: #000;
}
.menu-dot {
display: inline-block;
width: 5px;
height: 5px;
border-radius: 50%;
background: #0b58ff;
margin-right: 3px;
margin-bottom: 2px;
opacity: 0;
}
</style>

444
src/views/home/index.vue Normal file
View File

@@ -0,0 +1,444 @@
<template>
<div class="home-page">
<div>
<navbar />
</div>
<div class="date-tabs">
<el-tabs v-model="activeName" :stretch="true">
<el-tab-pane
:label="'\u2002\u2002日\u2002\u2002'"
name="日"></el-tab-pane>
<el-tab-pane
:label="'\u2002\u2002周\u2002\u2002'"
name="周"></el-tab-pane>
<el-tab-pane
:label="'\u2002\u2002月\u2002\u2002'"
name="月"></el-tab-pane>
<el-tab-pane
:label="'\u2002\u2002年\u2002\u2002'"
name="年"></el-tab-pane>
</el-tabs>
<div class="current-date">(6.13-6.20)</div>
<div class="current-time">
<span style="display: inline-block; margin-right: 16px">
{{ topTime + timeZone }}
</span>
<span>{{ topDate }}</span>
</div>
</div>
<el-row class="main-top" :gutter="16">
<el-col :span="12" style="position: relative">
<div class="title">
<svg-icon icon-class="home-produce" />
<span class="title-inner">生产总览</span>
</div>
<el-row class="box">
<el-col :span="6" class="num-box shadow">
<div class="num-style">9,301.01</div>
<div class="unit-style">产量/千片</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">94.34</div>
<div class="unit-style">良品率/%</div>
</el-col>
<el-col :span="8" class="num-box shadow">
<div class="num-style">29,301.01</div>
<div class="unit-style">完成工单数量/千片</div>
</el-col>
<el-col :span="6" class="num-box">
<div class="num-style">1,340</div>
<div class="unit-style">完成订单数量/</div>
</el-col>
</el-row>
</el-col>
<el-col :span="12" style="position: relative">
<div class="title">
<svg-icon icon-class="home-device" />
<span class="title-inner">设备总览</span>
</div>
<el-row class="box">
<el-col :span="6" class="num-box shadow">
<div class="num-style">2,931</div>
<div class="unit-style">设备总数/</div>
</el-col>
<el-col :span="6" class="num-box shadow">
<div class="num-style">931</div>
<div class="unit-style">在线设备总数/</div>
</el-col>
<el-col :span="6" class="num-box shadow">
<div class="num-style">7</div>
<div class="unit-style">故障设备总数/</div>
</el-col>
<el-col :span="6" class="num-box">
<div class="num-style">0</div>
<div class="unit-style">停机设备总数/</div>
</el-col>
</el-row>
</el-col>
</el-row>
<div class="main-middle">
<div
class="item"
:class="{ shadow: index !== middleMenu.length - 1 }"
v-for="(item, index) in middleMenu"
:key="index">
<div style="width: 160px; margin: 0 auto; padding-top: 20px">
<svg-icon :icon-class="item.icon" style="font-size: 56px" />
<div class="title-box">
<div class="title">{{ item.name }}</div>
<div class="triangle">
<span class="c1"></span>
<span class="c2"></span>
<span class="c3"></span>
</div>
</div>
</div>
</div>
</div>
<el-row class="main-bottom" :gutter="16">
<el-col :span="12">
<div class="box">
<div class="title-box">
<svg-icon icon-class="home-order-monitor" />
<span class="title">工单监控</span>
</div>
<div class="order-box">
<div
class="order-item"
v-for="(item, index) in orderList"
:key="index">
<div>
<span class="order-name">{{ item.name }}</span>
<span class="order-value">{{ item.value }}%</span>
</div>
<el-progress
:percentage="item.value"
:text-inside="false"
:stroke-width="15"
:show-text="false"></el-progress>
</div>
</div>
</div>
</el-col>
<el-col :span="12">
<div class="box">
<div class="title-box">
<svg-icon icon-class="home-device-alarm" />
<span class="title">设备告警</span>
</div>
<base-table
:page="1"
:limit="100000"
:table-props="tableProps"
:table-data="list"
:max-height="tableH" />
</div>
</el-col>
</el-row>
<div
class="main-footer"
style="
color: #c7c7c7;
user-select: none;
font-size: 14px;
letter-spacing: 1px;
height: 30px;
display: grid;
place-content: center;
">
&copy; 中建材智能自动化研究院有限公司
</div>
</div>
</template>
<script>
import Navbar from './components/Navbar';
import moment from 'moment';
import tableHeightMixin from '@/mixins/tableHeightMixin';
export default {
name: 'Home',
mixins: [tableHeightMixin],
components: { Navbar },
computed: {
gradientBackground() {
return {
'background-image':
'linear-gradient(90deg, #f0f0f0 25%, rgba(255, 255, 255, 0) 25%, rgba(255, 255, 255, 0) 50%, #f0f0f0 50%, #f0f0f0 75%, rgba(255, 255, 255, 0) 75%, rgba(255, 255, 255, 0))',
'background-size': '100px 100px', // 调整条纹的大小
};
},
},
data() {
return {
activeName: '日',
topDate: '',
topTime: '',
timeZone: '',
middleMenu: [
{ name: '工单管理', url: '', icon: 'home-work-menu' },
{ name: '订单管理', url: '', icon: 'home-order-menu' },
{ name: '设备管理', url: '', icon: 'home-device-menu' },
{ name: '质量管理', url: '', icon: 'home-quality-menu' },
{ name: '仓库管理', url: '', icon: 'home-store-menu' },
],
orderList: [
{ name: '工单1', value: 50 },
{ name: '工单2', value: 60 },
{ name: '工单3', value: 30 },
{ name: '工单4', value: 60 },
{ name: '工单5', value: 10 },
{ name: '工单6', value: 60 },
{ name: '工单7', value: 40 },
{ name: '工单8', value: 70 },
{ name: '工单9', value: 90 },
],
heightNum: 640,
tableProps: [
{
prop: 'productionLineName',
label: '设备名称',
showOverflowtooltip: true,
},
{
prop: 'sectionName',
label: '告警内容',
showOverflowtooltip: true,
},
{
prop: 'createTime',
label: '告警时间',
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
],
list: [
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
{ productionLineName: 1 },
],
};
},
created() {
this.getTime();
},
beforeDestroy() {
clearInterval(this.timer);
},
methods: {
getTime() {
let _this = this;
this.timer = setInterval(function () {
_this.topDate = moment().format('YYYY.MM.DD');
let temp = moment().format('A-hh:mm').split('-');
_this.timeZone = temp[0];
_this.topTime = temp[1];
}, 1000);
},
},
};
</script>
<style lang="scss" scoped>
.home-page {
background-image: url('~@/assets/img/home-bg.png');
background-size: cover;
background-repeat: no-repeat;
background-position: center;
height: 300px;
width: 100%;
}
.date-tabs {
padding-left: 40px;
padding-top: 20px;
position: relative;
}
:deep(.date-tabs) {
.el-tabs__header {
margin-bottom: 8px;
display: inline-block;
transform: translateY(-12px);
}
.el-tabs__content {
overflow: visible;
}
.el-tabs__item {
font-size: 18px;
color: #fff;
padding-left: 0 !important;
padding-right: 0 !important;
line-height: 36px !important;
height: 36px;
}
.el-tabs__item.is-active {
color: #0b58ff;
}
}
.current-date {
color: #fff;
font-size: 18px;
position: absolute;
left: 260px;
top: 14px;
}
.current-time {
color: #fff;
font-size: 18px;
position: absolute;
right: 38px;
top: 14px;
}
.main-top {
width: 100%;
padding: 0 20px 0 40px;
.title {
position: absolute;
left: 34px;
top: 20px;
width: 180px;
font-size: 32px;
z-index: 10;
.title-inner {
position: absolute;
left: 42px;
top: 5px;
font-size: 24px;
}
}
.box {
background-color: #fff;
border-radius: 24px;
height: 192px;
padding: 40px 24px 32px 24px;
.num-box {
height: 120px;
padding-top: 26px;
text-align: center;
.num-style {
color: #000;
font-size: 40px;
}
.unit-style {
color: rgba(0, 0, 0, 0.7);
font-size: 18px;
}
}
.shadow {
background: linear-gradient(90deg, #ffffff 80%, #f2f4f9 100%);
}
}
}
.main-middle {
display: flex;
flex-flow: row nowrap;
background-color: #fff;
border-radius: 24px;
height: 133px;
margin: 16px 38px 16px 40px;
padding-top: 15px;
.item {
width: 20%;
height: 100px;
cursor: pointer;
.title-box {
display: inline-block;
padding-left: 20px;
vertical-align: bottom;
.title {
height: 35px;
font-size: 18px;
color: #000;
padding-top: 6px;
letter-spacing: 2px;
}
.triangle {
height: 15px;
span {
display: inline-block;
width: 0;
height: 0;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
}
.c1 {
border-left: 12px solid rgba(11, 88, 255, 1);
margin-right: 5px;
}
.c2 {
border-left: 12px solid rgba(11, 88, 255, 0.5);
margin-right: 5px;
}
.c3 {
border-left: 12px solid rgba(11, 88, 255, 0.2);
}
}
}
}
.shadow {
background: linear-gradient(90deg, #ffffff 90%, #f2f4f9 100%);
}
}
.main-bottom {
width: 100%;
padding: 0 20px 0 40px;
.box {
background-color: #fff;
border-radius: 24px;
height: calc(100vh - 534px);
padding: 24px;
.title-box {
position: relative;
font-size: 32px;
margin-bottom: 16px;
.title {
position: absolute;
left: 44px;
top: 6px;
font-size: 24px;
}
}
.order-box {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
font-size: 18px;
padding: 0 30px;
.order-item {
width: 48%;
margin-bottom: 16px;
position: relative;
.order-name {
color: #000000;
}
.order-value {
position: absolute;
right: 0;
color: #0b58ff;
}
}
}
}
}
</style>
<style lang="scss">
.home-page {
.el-progress-bar__inner {
background-image: url('~@/assets/img/home-progress-bg.png');
background-size: cover;
}
}
</style>

View File

@@ -0,0 +1,223 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-08-05 16:12:18
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="100px"
label-position="top">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="物料产品名称" prop="name">
<el-input
v-model="dataForm.name"
clearable
placeholder="请输入物料产品名称" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="物料产品编码" prop="code">
<el-input
v-model="dataForm.code"
clearable
placeholder="请输入物料产品编码" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="物料产品类型" prop="typeId">
<treeselect
v-model="dataForm.typeId"
:options="deptOptions"
:normalizer="normalizer"
@select="setShowTime"
:show-count="true"
:appendToBody="true"
z-index="99999"
placeholder="选择物料产品类型" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单位" prop="unit">
<el-select
v-model="dataForm.unit"
filterable
style="width: 100%"
placeholder="请选择单位">
<el-option
v-for="dict in getDictDatas(DICT_TYPE.UNIT_DICT)"
:key="dict.value"
:label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="规格" prop="specifications">
<el-input
v-model="dataForm.specifications"
clearable
placeholder="请输入规格" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="供应商" prop="supplierId">
<el-select
v-model="dataForm.supplierId"
filterable
clearable
:style="{ width: '100%' }"
placeholder="请选择供应商">
<el-option
v-for="item in supplierArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8" v-if="showTime">
<el-form-item label="生产单位用时" prop="processTime">
<el-input
v-model.number="dataForm.processTime"
type="number"
clearable
placeholder="请输入产线生产单位用时" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注" prop="remark">
<el-input
v-model="dataForm.remark"
clearable
placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../mixins/basic-add';
import { getTreeArr } from '../mixins/code-filter';
import {
createProductMaterial,
updateProductMaterial,
getProductMaterial,
getProductMaterialCode,
getSupplierList,
getMaterialTree,
} from '@/api/base/material';
import Treeselect from '@riophae/vue-treeselect';
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
export default {
mixins: [basicAdd],
components: {
Treeselect,
},
data() {
return {
urlOptions: {
isGetCode: true,
codeURL: getProductMaterialCode,
createURL: createProductMaterial,
updateURL: updateProductMaterial,
infoURL: getProductMaterial,
},
deptOptions: undefined,
showTime: false,
dataForm: {
id: undefined,
code: undefined,
name: '',
typeId: undefined,
unit: undefined,
specifications: undefined,
supplierId: undefined,
processTime: 0,
remark: undefined,
},
supplierArr: [],
treeArr: [],
dataRule: {
code: [{ required: true, message: '编号不能为空', trigger: 'blur' }],
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
typeId: [
{
required: true,
message: '物料产品类型不能为空',
trigger: 'blur',
},
],
},
};
},
mounted() {},
methods: {
init(id) {
this.dataForm.id = id || '';
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
this.urlOptions.infoURL(id).then((response) => {
this.dataForm = response.data;
this.setDataForm();
});
} else {
if (this.urlOptions.isGetCode) {
this.getCode();
this.setDataForm();
}
}
});
},
typeId(typeId, product) {
this.$nextTick(() => {
this.dataForm.typeId = typeId || undefined;
this.showTime = product || false;
});
},
setDataForm() {
getSupplierList().then((res) => {
this.supplierArr = res.data;
});
// 下拉树结构
getMaterialTree().then((response) => {
this.deptOptions = [];
this.deptOptions.push(...this.handleTree(response.data, 'id'));
this.$nextTick(() => {
if (this.dataForm.id) {
this.treeArr = [];
this.treeArr = getTreeArr(response.data);//解构,树结构变为普通数组
this.showTime = this.treeArr.find(
(item) => item.id == this.dataForm.typeId
).product;
}
});
});
},
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children,
};
},
setShowTime(node) {
this.showTime = node.product || false;
},
},
};
</script>

View File

@@ -0,0 +1,141 @@
<template>
<el-dialog
:visible.sync="visible"
:width="'30%'"
:append-to-body="true"
:close-on-click-modal="false"
class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">
{{ !dataForm.id ? '新增' : '编辑' }}
</div>
</slot>
</template>
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="70px"
@keyup.enter.native="dataFormSubmit()">
<el-form-item label="属性名" prop="attrName">
<el-input
v-model="dataForm.attrName"
placeholder="请输入属性名"
clearable />
</el-form-item>
<el-form-item label="属性值" prop="attrValue">
<el-input
v-model="dataForm.attrValue"
placeholder="请输入属性值"
clearable />
</el-form-item>
</el-form>
<el-row style="text-align: right">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row>
</el-dialog>
</template>
<script>
import {
createMaterialAttr,
updateMaterialAttr,
getMaterialAttr
} from '@/api/base/material';
export default {
props: {
materialId: {
type: String,
default: '',
},
},
data() {
return {
visible: false,
dataForm: {
id: undefined,
attrName: '',
attrValue: '',
},
dataRule: {
attrName: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
},
};
},
methods: {
init(id) {
this.dataForm.id = id || '';
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
getMaterialAttr({
id: this.dataForm.id
}).then((res) => {
const { attrName, attrValue } = res.data;
this.dataForm.attrName = attrName;
this.dataForm.attrValue = attrValue;
});
}
});
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
// 修改的提交
if (this.dataForm.id) {
updateMaterialAttr({
...this.dataForm,
materialId: this.materialId,
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
// 添加的提交
createMaterialAttr({
...this.dataForm,
materialId: this.materialId,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
}
});
},
},
};
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
.dialog >>> .el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
}
.dialog >>> .el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
}
</style>

View File

@@ -0,0 +1,466 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:54:06
* @LastEditors: zwq
* @LastEditTime: 2024-08-08 16:46:44
* @Description:
-->
<template>
<div style="display: flex; gap: 16px; flex: 1; background: #eff1f6">
<div
class="app-container"
style="background: white; width: 280px; border-radius: 8px">
<div class="head-container">
<el-input
v-model="treeName"
placeholder="请输入名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px" />
</div>
<div class="head-container">
<el-tree
v-loading="treeLoading"
element-loading-text="拼命加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.8)"
:data="deptOptions1"
:props="defaultProps"
node-key="id"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
default-expand-all
highlight-current
@node-click="handleNodeClick">
<span class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ node.label }}</span>
<span style="float: right" v-if="data.parentId !== -1">
<el-button
class="btnHover"
type="text"
icon="el-icon-edit"
size="mini"
v-if="data.parentId !== 0"
@click="() => edit(node, data)" />
<el-button
class="btnHover"
type="text"
icon="el-icon-circle-plus-outline"
size="mini"
@click="() => append(data)" />
<el-button
class="btnHover"
type="text"
icon="el-icon-remove-outline"
size="mini"
v-if="data.parentId !== 0"
@click="() => remove(node, data)" />
</span>
</span>
</el-tree>
</div>
</div>
<div
class="app-container"
style="background: #fff; border-radius: 8px; width: 1px; flex: 1">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
<!-- 添加或修改菜单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="700px">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="父类型">
<treeselect
v-model="form.parentId"
:options="deptOptions"
:normalizer="normalizer"
:show-count="true"
:appendToBody="true"
z-index="99999"
placeholder="选择父类型" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import { publicFormatter } from '@/utils/dict';
import {
getProductMaterialPage,
deleteProductMaterial,
getMaterialTree,
createMaterialTree,
updateMaterialTree,
deleteMaterialTree,
} from '@/api/base/material';
import Treeselect from '@riophae/vue-treeselect';
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime,
width: 150,
},
{
prop: 'name',
label: '物料产品名称',
},
{
prop: 'code',
label: '物料产品编码',
width: 160,
},
{
prop: 'typeNameChain',
label: '物料产品类型',
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict'),
width: 60,
},
{
prop: 'specifications',
label: '规格',
},
{
prop: 'supplierName',
label: '供应商',
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicPage, tableHeightMixin],
name: '',
components: {
AddOrUpdate,
Treeselect,
},
data() {
return {
// 部门树选项
treeName: undefined,
deptOptions: undefined,
deptOptions1: undefined,
treeLoading: false,
defaultProps: {
children: 'children',
label: 'name',
},
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 表单参数
form: {
id: undefined,
parentId: undefined,
name: undefined,
defaultType: false,
},
// 表单校验
rules: {
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
},
urlOptions: {
getDataListURL: getProductMaterialPage,
deleteURL: deleteProductMaterial,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:core-product:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:core-product:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableData: [],
formConfig: [
{
type: 'input',
label: '物料产品名称',
placeholder: '物料产品名称',
param: 'name',
},
{
type: 'input',
label: '物料产品编号',
placeholder: '物料产品编号',
param: 'code',
},
{
type: 'input',
label: '物料产品类型',
param: 'type',
disabled: true,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:material:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
};
},
watch: {
// 根据名称筛选部门树
treeName(val) {
this.$refs.tree.filter(val);
},
},
created() {
this.getDataList();
this.getTreeselect();
},
methods: {
// 删除
deleteHandle(id, name, index) {
this.$confirm(`是否确认删除物料产品名称为"${name}"的数据项`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
})
.catch(() => {});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20;
this.listQuery.name = val.name ? val.name : undefined;
this.listQuery.code = val.code ? val.code : undefined;
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init();
this.$refs.addOrUpdate.typeId(
this.listQuery.typeId,
this.listQuery.product
);
});
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
/** 树操作 */
// 查询下拉树结构
getTreeselect() {
this.treeLoading = true;
getMaterialTree().then((response) => {
// treeArr[0].push(...this.handleTree(response.data, 'id'));
// 处理 deptOptions 参数
this.deptOptions = [];
this.treeLoading = false;
this.deptOptions.push(...this.handleTree(response.data, 'id'));
const arr = [{ name: '全部', parentId: -1 }];
this.deptOptions1 = arr.concat(this.deptOptions);
});
},
// 筛选节点
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
// 节点单击事件
handleNodeClick(data) {
this.listQuery.typeId = data.id || undefined;
this.listQuery.product = data.product;
this.$refs.searchBarForm.formInline.type = data.name || undefined;
},
// 新增节点
append(data) {
this.open = true;
this.title = '新增物料产品类型';
this.form.id = undefined;
this.form.parentId = data.id;
},
// 删除节点
remove(node, data) {
this.$confirm(`是否确认删除名称为"${data.name}"的数据项`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
deleteMaterialTree(data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getTreeselect();
},
});
});
})
.catch(() => {});
},
// 编辑节点
edit(node, data) {
this.open = true;
this.title = '编辑物料产品类型';
this.form.id = data.id;
this.form.name = data.name;
this.form.parentId = data.parentId;
},
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children,
};
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: undefined,
parentId: 0,
name: undefined,
defaultType: false,
};
this.resetForm('form');
},
// 表单提交
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return false;
}
// 修改的提交
if (this.form.id) {
updateMaterialTree(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.cancel();
this.getTreeselect();
});
return;
}
// 添加的提交
createMaterialTree(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.cancel();
this.getTreeselect();
});
});
},
},
};
</script>
<style scoped>
.btnHover:hover {
color: #67c23a;
transform: scale(1.5);
}
</style>

View File

@@ -0,0 +1,108 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-08-05 16:12:58
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="物料名称" prop="materialId">
<el-select
v-model="dataForm.materialId"
placeholder="请选择物料"
@change="setMaterialCode"
style="width: 100%">
<el-option
v-for="dict in materialList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="dataForm.materialCode"
disabled
placeholder="请输入物料编码" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="批次号" prop="code">
<el-input v-model="dataForm.code" clearable placeholder="请输入批次号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="批次名称" prop="name">
<el-input v-model="dataForm.name" clearable placeholder="请输入批次名称" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" clearable placeholder="请输入备注" />
</el-form-item>
</el-form>
</template>
<script>
import basicAdd from '../mixins/basic-add';
import { createMaterialDate, updateMaterialDate, getMaterialDate, getCode } from "@/api/base/materialDate";
import { getMaterialList } from "@/api/base/material";
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: false,
codeURL: getCode,
createURL: createMaterialDate,
updateURL: updateMaterialDate,
infoURL: getMaterialDate,
},
dataForm: {
id: undefined,
code: undefined,
name: undefined,
materialId: undefined,
materialCode: undefined,
remark: undefined,
},
materialList: [],
dataRule: {
materialId: [{ required: true, message: "物料不能为空", trigger: "blur" }],
code: [{ required: true, message: "批次号不能为空", trigger: "blur" }],
name: [{ required: true, message: "批次名称不能为空", trigger: "blur" }],
}
};
},
mounted() {
this.getDict()
console.log('我看看', this.dataForm)
},
methods: {
async getDict() {
// 物料列表
const res = await getMaterialList();
this.materialList = res.data;
},
setMaterialCode() {
const chooseM = this.materialList.filter(item => {
return item.id === this.dataForm.materialId
})
this.dataForm.materialCode = chooseM[0].code
}
},
};
</script>

View File

@@ -0,0 +1,190 @@
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="40%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import {
getMaterDatePage,
deleteMaterialDate
} from '@/api/base/materialDate';
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime
},
{
prop: 'code',
label: '批次号'
},
{
prop: 'name',
label: '批次名称'
},
{
prop: 'materialCode',
label: '物料编码'
},
{
prop: 'materialName',
label: '物料名称'
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getMaterDatePage,
deleteURL: deleteMaterialDate,
// exportURL: exportFactoryExcel,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:material-date:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:material-date:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v)=>v),
tableData: [],
formConfig: [
{
type: 'input',
label: '批次名',
placeholder: '批次名',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:material-date:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
},
],
};
},
components: {
AddOrUpdate,
},
created() {},
methods: {
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.records;
this.listQuery.total = response.data.total;
this.dataListLoading = false;
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name ? val.name : undefined;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
// 删除
deleteHandle(id, name, index) {
this.$confirm(`是否删除物料批次名称为"${name}"的数据项?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
})
.catch(() => { });
}
},
};
</script>

View File

@@ -0,0 +1,65 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 15:27:31
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:25:54
* @Description:
-->
<template>
<div :class="[className, { 'p-0': noPadding }]">
<slot />
</div>
</template>
<script>
export default {
props: {
size: {
// 取值范围: xl lg md sm
type: String,
default: 'de',
validator: function (val) {
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
},
},
noPadding: {
type: Boolean,
default: false,
},
},
computed: {
className: function () {
return `${this.size}-title`;
},
},
};
</script>
<style lang="scss" scoped>
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
$mgr: 8px;
@each $size, $height in $pxls {
.#{$size}-title {
font-size: 18px;
line-height: $height;
color: #000;
font-weight: 500;
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
&::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: $height + 2px;
border-radius: 1px;
margin-right: $mgr;
background-color: #0b58ff;
}
}
}
.p-0 {
padding: 0;
}
</style>

View File

@@ -0,0 +1,420 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-08-08 16:47:36
* @Description:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="isdetail"
class="drawer"
size="70%">
<small-title slot="title" :no-padding="true">
{{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }}
</small-title>
<div class="content">
<div class="visual-part">
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="100px"
label-position="top">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="产品名称" prop="productId">
<el-select
v-model="dataForm.productId"
filterable
clearable
:disabled="isdetail"
style="width: 100%"
placeholder="请选择产品">
<el-option
v-for="dict in productList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品BOM编码" prop="code">
<el-input
v-model="dataForm.code"
:disabled="isdetail"
placeholder="请输入产品Bom编码" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注" prop="remark">
<el-input
v-model="dataForm.remark"
:disabled="isdetail"
clearable
placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div class="attr-list" v-if="idAttrShow">
<small-title
style="margin: 16px 0; padding-left: 8px"
:no-padding="true">
BOM明细
</small-title>
<div v-if="!isdetail" class="action_btn">
<template>
<span style="display: inline-block">
<el-button type="text" @click="addNew()" icon="el-icon-plus">
添加
</el-button>
</span>
</template>
</div>
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
<method-btn
v-if="!isdetail"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
v-show="listQuery.total > 0"
:total="listQuery.total"
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" />
</div>
<div v-if="!isdetail" class="drawer-body__footer">
<el-button style="" @click="goback()">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</div>
</div>
<attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:bom-id="dataForm.id"
@refreshDataList="getList" />
</el-drawer>
</template>
<script>
import basicAdd from '../mixins/basic-add';
import {
createMaterialPB,
updateMaterialPB,
getMaterialPB,
getCode,
getProBomList,
createMaterialPBDet,
updateMaterialPBDet,
deleteMaterialPBDet,
} from '@/api/base/materialProductBom';
import { getMaterialTree, getMaterialList } from '@/api/base/material';
import SmallTitle from './SmallTitle';
import { parseTime } from '../mixins/code-filter';
import attrAdd from './attr-add';
import { publicFormatter } from '@/utils/dict';
const tableBtn = [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
];
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime,
width: 160,
},
{
prop: 'materialName',
label: '物料名称',
showOverflowtooltip: true,
},
{
prop: 'materialCode',
label: '物料编码',
width: 160,
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict'),
width: 60,
},
{
prop: 'num',
label: '数量',
width: 60,
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicAdd],
components: { SmallTitle, attrAdd },
data() {
return {
tableBtn,
tableProps,
addOrUpdateVisible: false,
urlOptions: {
isGetCode: true,
codeURL: getCode,
createURL: createMaterialPB,
updateURL: updateMaterialPB,
infoURL: getMaterialPB,
},
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
},
dataForm: {
id: undefined,
code: undefined,
productId: '',
remark: undefined,
},
productList: [],
materialAttrList: [],
tableData: [],
visible: false,
isdetail: false,
idAttrShow: false,
dataRule: {
productId: [
{ required: true, message: '产品不能为空', trigger: 'blur' },
],
},
};
},
mounted() {
this.getDict();
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.deleteDetail(raw.data);
} else {
this.addNew(raw.data.id);
}
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
// 修改的提交
if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
// 添加的提交
this.urlOptions.createURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('新增成功');
// this.visible = false;
this.idAttrShow = true;
this.dataForm.id = response.data;
this.$emit('refreshDataList');
});
});
},
async getDict() {
const materRes = await getMaterialTree();
let typeId = materRes.data[0].product
? materRes.data[0].id
: materRes.data[1].id;
const listQuery = {
typeId: typeId,
};
const materData = await getMaterialList(listQuery);
this.productList = [];
this.productList = materData.data;
},
initData() {
// this.materialAttrList.splice(0);
this.listQuery.total = 0;
},
deleteDetail(raw) {
this.$confirm(
`是否确认删除物料名称为"${raw.materialName}"的数据项?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
deleteMaterialPBDet(raw.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
},
getList() {
// 获取产品Bom详细列表
getProBomList({
...this.listQuery,
bomId: this.dataForm.id,
}).then((response) => {
this.tableData = response.data.records;
this.listQuery.total = response.data.total;
});
},
// 构造一行
addRow() {
const row = {
bomId: this.dataForm.id,
materialId: '',
num: 0,
materialCode: undefined,
unit: undefined,
remark: '',
isEdit: true,
};
this.tableData.push(row);
},
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined;
this.visible = true;
if (id) {
this.idAttrShow = true;
} else {
this.idAttrShow = false;
}
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
// 获取物料详情
this.urlOptions.infoURL(id).then((response) => {
this.dataForm = response.data;
});
// 获取Bom明细
this.getList();
} else {
if (this.urlOptions.isGetCode) {
this.getCode();
}
}
});
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
// this.initData();
},
goEdit() {
this.isdetail = false;
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
display: flex;
flex-direction: column;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
}
.drawer >>> .el-drawer__body {
flex: 1;
height: 1px;
display: flex;
flex-direction: column;
}
.drawer >>> .content {
padding: 30px 24px;
flex: 1;
display: flex;
flex-direction: column;
/* height: 100%; */
}
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 20vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form,
.drawer >>> .attr-list {
padding: 0 16px;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
.action_btn {
float: right;
margin: -40px 15px;
font-size: 14px;
}
.add {
color: #0b58ff;
}
</style>

View File

@@ -0,0 +1,203 @@
<template>
<el-dialog
:visible.sync="visible"
:width="'40%'"
:append-to-body="true"
:close-on-click-modal="false"
class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">
{{ !dataForm.id ? '新增' : '编辑' }}
</div>
</slot>
</template>
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="80px"
@keyup.enter.native="dataFormSubmit()">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="物料名称" prop="materialId">
<el-select
v-model="dataForm.materialId"
placeholder="请选择物料"
clearable
filterable
@change="setCode"
style="width: 100%"
>
<el-option
v-for="dict in materialList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="dataForm.materialCode"
clearable
disabled
placeholder="请输入物料编码" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="单位" prop="unit">
<el-select
v-model="dataForm.unit"
style="width: 100%"
disabled
placeholder="请选择单位">
<el-option
v-for="dict in getDictDatas(DICT_TYPE.UNIT_DICT)"
:key="dict.value"
:label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数量" prop="num">
<el-input-number v-model="dataForm.num" controls-position="right" clearable placeholder="请输入数量" style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" clearable placeholder="请输入备注" />
</el-form-item>
</el-form>
<el-row style="text-align: right">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row>
</el-dialog>
</template>
<script>
import { getMaterialTree,getMaterialList } from '@/api/base/material';
import { createMaterialPBDet, updateMaterialPBDet, getMaterialPBDet } from "@/api/base/materialProductBom";
export default {
props: {
bomId: {
type: String,
default: '',
},
},
data() {
return {
visible: false,
dataForm: {
id: undefined,
materialId: '',
num: 0,
materialCode: undefined,
unit: undefined,
remark: '',
},
materialList: [],
dataRule: {
materialId: [{ required: true, message: '物料名称不能为空', trigger: 'change' }],
num: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
},
};
},
mounted() {
this.getDict()
},
methods: {
async getDict() {
// 物料列表
const materRes = await getMaterialTree();
let typeId = materRes.data[0].product?materRes.data[1].id:materRes.data[0].id
const listQuery= {
typeId:typeId
}
const materData = await getMaterialList(listQuery);
this.materialList = [];
this.materialList = materData.data;
},
init(id) {
this.dataForm.id = id || '';
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
getMaterialPBDet(this.dataForm.id).then((res) => {
this.dataForm = res.data
this.setCode()
});
}
});
},
setCode() {
const tempMaterial = this.materialList.filter(item =>{
return item.id === this.dataForm.materialId
})
this.dataForm.materialCode = tempMaterial[0]?.code
this.dataForm.unit = tempMaterial[0].unit === undefined ? undefined : String(tempMaterial[0]?.unit)
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
// 修改的提交
if (this.dataForm.id) {
updateMaterialPBDet({
...this.dataForm,
bomId: this.bomId,
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
// 添加的提交
createMaterialPBDet({
...this.dataForm,
bomId: this.bomId,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
}
});
},
},
};
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
.dialog >>> .el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
}
.dialog >>> .el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
}
</style>

View File

@@ -0,0 +1,182 @@
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<add-or-update
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getDataList" />
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../mixins/basic-page';
// import { parseTime } from '../mixins/code-filter';
import {
getMaterialPBPage,
deleteMaterialPB
} from '@/api/base/materialProductBom';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'productName',
label: '产品名称'
},
{
prop: 'code',
label: '产品BOM编码'
},
{
prop: 'remark',
label: '备注'
}
];
export default {
mixins: [basicPage, tableHeightMixin],
components: {
AddOrUpdate,
},
data() {
return {
urlOptions: {
getDataListURL: getMaterialPBPage,
deleteURL: deleteMaterialPB
// exportURL: exportFactoryExcel,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:material-product-bom:queryMaterial`)
? {
type: 'detail',
btnName: '查看物料',
}
: undefined,
this.$auth.hasPermi(`base:material-product-bom:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
// this.$auth.hasPermi(`base:material-product-bom:editMaterial`)
// ? {
// type: 'editMaterial',
// btnName: '编辑物料',
// }
// : undefined,
this.$auth.hasPermi(`base:material-product-bom:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v)=>v),
tableData: [],
formConfig: [
{
type: 'input',
label: '产品名称',
placeholder: '产品名称',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:material:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
},
],
};
},
created() {},
methods: {
otherMethods(val) {
if (val.type === 'detail') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
} else {
this.addOrEditTitle = '编辑';
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
}
},
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.records;
this.listQuery.total = response.data.total;
this.dataListLoading = false;
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20;
this.listQuery.productName = val.name ? val.name : undefined;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 20,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@@ -0,0 +1,284 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-08-05 16:13:52
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px"
label-position="top">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="物料名称" prop="materialId">
<el-select
v-model="dataForm.materialId"
placeholder="请选择物料"
clearable
filterable
@change="setCode"
style="width: 100%">
<el-option
v-for="dict in materialList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="dataForm.materialCode"
clearable
disabled
placeholder="请输入物料编码" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="物料批次" prop="materialDateId">
<el-select
v-model="dataForm.materialDateId"
clearable
filterable
placeholder="请选择物料批次"
style="width: 100%">
<el-option
v-for="dict in materialDateList"
:key="dict.id"
:label="dict.code"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="使用设备" prop="equipmentId">
<el-select
v-model="dataForm.equipmentId"
clearable
filterable
placeholder="请选择使用设备"
style="width: 100%">
<el-option
v-for="dict in eqList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="使用时间" prop="useTime">
<el-date-picker
v-model="dataForm.useTime"
type="datetime"
format="yyyy-MM-dd HH:mm:ss"
value-format="timestamp"
placeholder="选择日期时间" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="操作员" prop="userNames">
<el-select
v-model="dataForm.userNames"
clearable
filterable
multiple
placeholder="请选择操作员"
style="width: 100%">
<el-option
v-for="dict in workersList"
:key="dict.id"
:label="dict.nickname"
:value="dict.nickname" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="使用数量" prop="num">
<el-input-number
v-model="dataForm.num"
clearable
controls-position="right"
placeholder="请输入使用数量"
style="width: 100%" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="数据来源" prop="source">
<el-select
v-model="dataForm.source"
clearable
placeholder="请选择数据来源">
<el-option
v-for="dict in this.dataSourceList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注" prop="remark">
<el-input
v-model="dataForm.remark"
clearable
placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../mixins/basic-add';
import {
createMaterialLog,
updateMaterialLog,
getMaterialLog,
getEqListAll,
} from '@/api/base/materialUseLog';
import { getMaterialTree,getMaterialList } from '@/api/base/material';
import { getMaterDateList } from '@/api/base/materialDate';
import { listSimpleUsers } from '@/api/system/user';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
createURL: createMaterialLog,
updateURL: updateMaterialLog,
infoURL: getMaterialLog,
},
dataForm: {
id: undefined,
materialId: undefined,
materialCode: undefined,
materialDateId: undefined,
equipmentId: undefined,
userName: undefined,
userNames: [],
useTime: new Date().getTime(),
address: undefined,
num: 0,
source: undefined,
remark: undefined,
},
dataSourceList: [
{
id: 1,
name: '手动',
},
{
id: 2,
name: 'PDA',
},
],
materialList: [],
materialDateList: [],
eqList: [],
workersList: [],
dataRule: {
materialId: [
{ required: true, message: '物料不能为空', trigger: 'blur' },
],
useTime: [
{ required: true, message: '使用时间不能为空', trigger: 'blur' },
],
userNames: [
{ required: true, message: '操作员不能为空', trigger: 'blur' },
],
num: [{ required: true, message: '使用数量不能为空', trigger: 'blur' }],
},
};
},
mounted() {
this.getDictData();
},
methods: {
async getDictData() {
const materRes = await getMaterialTree();
let typeId = materRes.data[0].product?materRes.data[1].id:materRes.data[0].id
const listQuery= {
typeId:typeId
}
const materData = await getMaterialList(listQuery);
this.materialList = [];
this.materialList = materData.data;
const dateRes = await getMaterDateList();
this.materialDateList = dateRes.data;
const eqRes = await getEqListAll();
this.eqList = eqRes.data;
const workerRes = await listSimpleUsers();
this.workersList = workerRes.data;
},
// 表单提交
dataFormSubmit() {
this.dataForm.userName = this.dataForm.userNames.join(',');
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
// 修改的提交
if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
// 添加的提交
this.urlOptions.createURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
init(id) {
this.dataForm.id = id || undefined;
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
this.urlOptions.infoURL(id).then((response) => {
this.dataForm.id = response.data.id;
this.dataForm.materialCode = response.data.materialCode;
this.dataForm.materialId = response.data.materialId;
this.dataForm.materialDateId = response.data.materialDateId;
this.dataForm.equipmentId = response.data.equipmentId;
this.dataForm.useTime = response.data.useTime;
// this.dataForm.userName = response.data.userName
this.dataForm.num = response.data.num;
this.dataForm.source = response.data.source;
this.dataForm.remark = response.data.remark;
this.dataForm.userNames = response.data.userName.split(',');
});
} else {
}
});
},
setCode() {
const tempMaterial = this.materialList.filter((item) => {
return item.id === this.dataForm.materialId;
});
this.dataForm.materialCode = tempMaterial[0].code;
getMaterDateList({ materialId: this.dataForm.materialId }).then((res) => {
this.materialDateList = res.data;
});
},
},
};
</script>

View File

@@ -0,0 +1,250 @@
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="60%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import {
getMaterialLogPage,
deleteMaterialLog
} from '@/api/base/materialUseLog';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'materialName',
label: '物料名称'
},
{
prop: 'materialCode',
label: '物料编码',
width: 160,
},
{
prop: 'materialDateName',
label: '物料批次'
},
{
prop: 'equipName',
label: '使用设备'
},
{
prop: 'num',
label: '使用数量'
},
{
prop: 'useTime',
label: '使用时间',
filter: parseTime,
width: 160,
},
{
prop: 'userName',
label: '操作人',
showOverflowtooltip: true,
},
{
prop: 'source',
label: '数据来源',
filter: (val) => ['未知', '手动', '自动'][val],
width: 80,
},
{
prop: 'remark',
label: '备注'
}
];
export default {
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getMaterialLogPage,
deleteURL: deleteMaterialLog,
// exportURL: exportFactoryExcel,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:material-use-log:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:material-use-log:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v)=>v),
tableData: [],
listQuery: {
pageSize: 20,
pageNo: 1,
total: 1,
materialName: undefined,
useTime: []
},
formConfig: [
{
type: 'input',
label: '物料名称',
placeholder: '物料名称',
param: 'name',
},
{
type: 'datePicker',
label: '使用时间段',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
width: 350,
param: 'time',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:material-use-log:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
},
],
};
},
components: {
AddOrUpdate,
},
created() {},
methods: {
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.records;
this.listQuery.total = response.data.total;
this.dataListLoading = false;
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20;
this.listQuery.materialName = val.name ? val.name : undefined;
if (val.time) {
this.listQuery.useTime[0] = val.time[0]
this.listQuery.useTime[1] = val.time[1]
} else {
this.listQuery.useTime = []
}
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 20,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
//tableBtn点击
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "编辑";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
} else if (val.type === "delete") {
this.deleteHandle(val.data.id, val.data.materialName)
} else if (val.type === "change") {
this.changeStatus(val.data.id)
} else {
this.otherMethods(val)
}
},
// 删除
deleteHandle(id, name) {
this.$modal
.delConfirm(name ? '名称: ' + name : '序号: ' + index).then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
})
.catch(() => { });
}
},
};
</script>

View File

@@ -0,0 +1,100 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: zwq
* @LastEditTime: 2023-08-03 14:21:04
* @Description:
*/
export default {
data() {
/* eslint-disable */
return {
urlOptions: {
createURL: '',
updateURL: '',
infoURL: '',
codeURL: '',
getOption: false,
isGetCode: false,
optionArrUrl: [],
optionArr: {}
},
visible: false,
setData: false
}
},
created() {
},
activated() {
},
methods: {
init(id) {
this.dataForm.id = id || "";
this.visible = true;
if (this.urlOptions.getOption) {
this.getArr()
}
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.dataForm.id) {
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data;
if (this.setData) {
this.setDataForm()
}
});
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
}
}
});
},
getCode() {
this.urlOptions.codeURL()
.then(({ data: res }) => {
this.dataForm.code = res;
})
.catch(() => {});
},
getArr() {
const params = {
pageSize: 100,
pageNo: 1,
}
this.urlOptions.optionArrUrl.forEach((item, index) => {
item(params).then(({ data: res }) => {
this.$set(this.urlOptions.optionArr, `arr${index}`, res.list)
})
.catch(() => {
});
});
},
// 表单提交
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
// 修改的提交
if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
// 添加的提交
this.urlOptions.createURL(this.dataForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.visible = false;
this.$emit("refreshDataList");
});
});
},
formClear() {
this.$refs.dataForm.resetFields()
}
}
}

View File

@@ -0,0 +1,165 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: zwq
* @LastEditTime: 2024-08-05 16:35:15
* @Description:
*/
export default {
data() {
/* eslint-disable */
return {
urlOptions: {
getDataListURL: '',
deleteURL: '',
statusUrl: '',
exportURL: ''
},
tableData: [],
listQuery: {
pageSize: 20,
pageNo: 1,
total: 1,
},
exportLoading: false,
dataListLoading: false,
addOrEditTitle: '',
addOrUpdateVisible: false,
}
},
created() {
},
mounted() {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.list;
this.listQuery.total = response.data.total;
this.dataListLoading = false;
});
},
// 每页数
sizeChangeHandle(val) {
this.listQuery.pageSize = val;
this.listQuery.pageNo = 1;
this.getDataList();
},
// 当前页
currentChangeHandle(val) {
this.listQuery.pageNo = val;
this.getDataList();
},
// 新增 / 修改
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
cancel(id) {
this.$refs["popover-" + id].showPopper = false;
},
//改变状态
changeStatus(id) {
this.$http
.post(this.urlOptions.statusUrl, { id })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.$refs["popover-" + id].showPopper = false;
this.$message({
message: this.$t("prompt.success"),
type: "success",
duration: 500,
onClose: () => {
this.getDataList();
},
});
})
.catch(() => { });
},
//tableBtn点击
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "编辑";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
} else if (val.type === "delete") {
this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex)
} else if (val.type === "change") {
this.changeStatus(val.data.id)
} else {
this.otherMethods(val)
}
},
// 删除
deleteHandle(id, name, index) {
this.$modal
.delConfirm(name ? '名称: ' + name : '序号: ' + index)
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
})
.catch(() => { });
},
//search-bar点击
buttonClick(val) {
switch (val.btnName) {
case "search":
this.listQuery.xm1 = val.xm1;
this.listQuery.xm2 = val.xm2;
this.listQuery.pageNo = 1;
this.getDataList();
break;
case "add":
this.addOrEditTitle = '新增'
this.addOrUpdateVisible = true;
this.addOrUpdateHandle()
break;
default:
console.log(val)
}
},
handleCancel() {
this.$refs.addOrUpdate.formClear()
this.addOrUpdateVisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.addOrUpdate.dataFormSubmit()
},
successSubmit() {
this.handleCancel()
this.getDataList()
},
/** 导出按钮操作 */
handleExport() {
// 处理查询参数
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有数据项?').then(() => {
this.exportLoading = true;
return this.urlOptions.exportURL(params);
}).then(response => {
this.$download.excel(response, '工厂.xls');
this.exportLoading = false;
}).catch(() => { });
}
}
}

View File

@@ -0,0 +1,85 @@
/*
* @Date: 2020-12-29 16:49:28
* @LastEditors: zwq
* @LastEditTime: 2024-07-08 16:27:39
* @FilePath: \basic-admin\src\filters\basicData\index.js
* @Description:
*/
const table = {
lineStatus: {
1: '生产中',
2: '停止',
3: '未知',
},
reportType: {
1: '日',
2: '周',
3: '月'
}
}
// 日期格式化
export function parseTime(time, pattern) {
if (arguments.length === 0 || !time) {
return null
}
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time)
} else if (typeof time === 'string') {
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm), '');
}
if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000
}
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') {
return ['日', '一', '二', '三', '四', '五', '六'][value]
}
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
}
// 遍历树结构返回数组
export function getTreeArr(arr) {
let result =[]
arr.forEach(item => {
if(item.children && item.children.length>0){
let {children,...obj} = item
result.push(obj)
result = result.concat(getTreeArr(children))
}else{
let {children,...obj} = item
result.push(obj)
}
});
return result
}
export default function (dictTable) {
return function (val) {
return table?.[dictTable]?.[val]
}
}

View File

@@ -70,7 +70,7 @@ export default {
};
},
mounted() {
this.getList();
// this.getList();
},
methods: {
/** 查询列表 */

View File

@@ -24,7 +24,7 @@ export default {
},
data() {
return {
heightNum: 200,
heightNum: 236,
nameData: [],
list: [],
};

View File

@@ -45,7 +45,7 @@ export default {
<style scoped lang="scss">
.currentDataContainer {
width: 100%;
min-height: calc(100vh - 120px - 8px);
min-height: calc(100vh - 164px);
background: rgba(242, 244, 249, 1);
.topBox {
.el-menu {
@@ -79,10 +79,11 @@ export default {
}
}
.bottomBox {
min-height: calc(100vh - 184px);
height: calc(100vh - 220px);
background: #fff;
padding: 16px;
border-radius: 8px;
overflow-y: auto;
}
}
</style>

View File

@@ -48,7 +48,7 @@
</div>
</div>
<!-- side bar -->
<div class="side-bar__left" style="width: 240px; height: 100%">
<div class="side-bar__left">
<el-tree
class="custom-tree-class"
:data="currentFactory?.children"
@@ -87,6 +87,7 @@
:table-props="table.tableProps"
:table-data="table.dataManager?.dataList ?? []"
:span-method="spanMethod"
:max-height="tableH"
@emitFun="(val) => handleEmitFun(table, val)"></base-table>
<pagination
:key="table.key + '__pagination'"
@@ -115,9 +116,11 @@
<script>
// import Graph from './graph.vue';
import { getWorkOrderList, getTreeData } from '@/api/quality/deviceParameters';
import tableHeightMixin from '@/mixins/tableHeightMixin';
export default {
name: 'EquipmentProcessAmount',
// components: { Graph },
mixins: [tableHeightMixin],
props: {},
data() {
const now = new Date();
@@ -578,6 +581,10 @@ export default {
</script>
<style scoped>
.side-bar__left {
width: 240px;
height: calc(100% - 70px);
}
.side-bar__left >>> .is-current {
padding: 0;
color: #111;

View File

@@ -81,7 +81,7 @@ export default {
mixins: [tableHeightMixin],
data() {
return {
heightNum: 220,
heightNum: 256,
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:packaging-print-log:update`)

View File

@@ -0,0 +1,38 @@
<template>
<div>
<span class="dot" :class="injectData.status === 1 ? 'red' : 'green'"></span>
<span>{{ state }}</span>
</div>
</template>
<script>
export default {
name: "StatusBtn",
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
computed: {
state() {
return this.injectData.status === 1 ? "停用" : "启用";
},
},
};
</script>
<style scoped>
.dot {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 3px;
vertical-align: middle;
margin-right: 8px;
}
.green {
background: #10dc76;
}
.red {
background: #ff5656;
}
</style>

View File

@@ -0,0 +1,38 @@
<template>
<div>
<span class="dot" :class="injectData.status === 1 ? 'red' : 'green'"></span>
<span>{{ state }}</span>
</div>
</template>
<script>
export default {
name: "StatusBtn2",
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
computed: {
state() {
return this.injectData.status === 1 ? "关闭" : "开启";
},
},
};
</script>
<style scoped>
.dot {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 3px;
vertical-align: middle;
margin-right: 8px;
}
.green {
background: #10dc76;
}
.red {
background: #ff5656;
}
</style>

View File

@@ -0,0 +1,41 @@
<template>
<div>
<span
class="dot"
:class="injectData.resultCode === 0 ? 'green' : 'red'"
></span>
<span>{{ state }}</span>
</div>
</template>
<script>
export default {
name: "StatusBtn3",
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
computed: {
state() {
return this.injectData.resultCode === 0 ? "成功" : "失败";
},
},
};
</script>
<style scoped>
.dot {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 3px;
vertical-align: middle;
margin-right: 8px;
}
.green {
background: #10dc76;
}
.red {
background: #ff5656;
}
</style>

View File

@@ -0,0 +1,38 @@
<template>
<div>
<span class="dot" :class="injectData.result === 0 ? 'green' : 'red'"></span>
<span>{{ state }}</span>
</div>
</template>
<script>
export default {
name: "StatusBtn3",
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
computed: {
state() {
return this.injectData.result === 0 ? "成功" : "失败";
},
},
};
</script>
<style scoped>
.dot {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 3px;
vertical-align: middle;
margin-right: 8px;
}
.green {
background: #10dc76;
}
.red {
background: #ff5656;
}
</style>

View File

@@ -0,0 +1,39 @@
<template>
<el-switch
v-model="status"
type="text"
size="small"
@change="changeHandler"
/>
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
data() {
return {
status: false,
};
},
mounted() {
this.mapToState();
},
methods: {
mapToState() {
this.status = this.injectData.status === 0 ? true : false;
},
changeHandler() {
let params = {};
params.id = this.injectData.id;
params.status = this.status ? "0" : "1";
params.username = this.injectData.username;
this.$emit("emitData", params);
},
},
};
</script>

View File

@@ -0,0 +1,162 @@
<template>
<el-form :model="form" label-width="80px">
<el-form-item label="角色名称">
<el-input v-model="form.name" :disabled="true" />
</el-form-item>
<el-form-item label="角色标识">
<el-input v-model="form.code" :disabled="true" />
</el-form-item>
<el-form-item label="权限范围">
<el-select v-model="form.dataScope" style="width: 100%">
<el-option
v-for="item in dataScopeDictDatas"
:key="parseInt(item.value)"
:label="item.label"
:value="parseInt(item.value)"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label="数据权限"
v-show="form.dataScope === SysDataScopeEnum.DEPT_CUSTOM"
>
<el-checkbox
:checked="!form.deptCheckStrictly"
@change="handleCheckedTreeConnect($event, 'dept')"
>父子联动(选中父节点自动选择子节点)</el-checkbox
>
<el-checkbox
v-model="deptExpand"
@change="handleCheckedTreeExpand($event, 'dept')"
>展开/折叠</el-checkbox
>
<el-checkbox
v-model="deptNodeAll"
@change="handleCheckedTreeNodeAll($event, 'dept')"
>全选/全不选</el-checkbox
>
<el-tree
class="tree-border"
:data="deptOptions"
show-checkbox
default-expand-all
ref="dept"
node-key="id"
:check-strictly="form.deptCheckStrictly"
empty-text="加载中请稍后"
:props="defaultProps"
></el-tree>
</el-form-item>
</el-form>
</template>
<script>
import { SystemDataScopeEnum } from "@/utils/constants";
import { getRole } from "@/api/system/role";
import { listSimpleDepts } from "@/api/system/dept";
import { DICT_TYPE, getDictDatas } from "@/utils/dict";
import { assignRoleDataScope } from "@/api/system/permission";
export default {
name: "DataAuth",
data() {
return {
form: {
id: undefined,
name: undefined,
code: undefined,
deptIds: [],
dataScope: undefined,
deptCheckStrictly: false,
},
deptExpand: true,
deptNodeAll: false,
// 部门列表
deptOptions: [], // 部门属性结构
depts: [], // 部门列表
defaultProps: {
label: "name",
children: "children",
},
// 枚举
SysDataScopeEnum: SystemDataScopeEnum,
// 数据字典
dataScopeDictDatas: getDictDatas(DICT_TYPE.SYSTEM_DATA_SCOPE),
};
},
methods: {
init(id) {
this.form.id = id;
getRole(id).then((res) => {
this.form.name = res.data.name;
this.form.code = res.data.code;
this.form.dataScope = res.data.dataScope;
// 获得部门列表
listSimpleDepts().then((response) => {
// 处理 deptOptions 参数
this.deptOptions = [];
this.deptOptions.push(...this.handleTree(response.data, "id"));
this.depts = response.data;
this.$refs.dept.setCheckedKeys(res.data.dataScopeDeptIds, false);
});
});
},
submitForm() {
if (this.form.id !== undefined) {
assignRoleDataScope({
roleId: this.form.id,
dataScope: this.form.dataScope,
dataScopeDeptIds:
this.form.dataScope !== SystemDataScopeEnum.DEPT_CUSTOM
? []
: this.$refs.dept.getCheckedKeys(),
}).then((response) => {
this.$modal.msgSuccess("修改成功");
this.$emit("successSubmitd");
});
}
},
formClear() {
this.deptExpand = true;
this.deptNodeAll = false;
this.form = {
id: undefined,
name: undefined,
code: undefined,
deptIds: [],
dataScope: undefined,
deptCheckStrictly: false,
};
},
// 树权限(父子联动)
handleCheckedTreeConnect(value, type) {
if (type === "menu") {
this.form.menuCheckStrictly = value;
} else if (type === "dept") {
this.form.deptCheckStrictly = !value;
}
},
// 树权限(展开/折叠)
handleCheckedTreeExpand(value, type) {
if (type === "menu") {
let treeList = this.menuOptions;
for (let i = 0; i < treeList.length; i++) {
this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value;
}
} else if (type === "dept") {
let treeList = this.deptOptions;
for (let i = 0; i < treeList.length; i++) {
this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value;
}
}
},
// 树权限(全选/全不选)
handleCheckedTreeNodeAll(value, type) {
if (type === "menu") {
this.$refs.menu.setCheckedNodes(value ? this.menuOptions : []);
} else if (type === "dept") {
// this.$refs.dept.setCheckedNodes(value ? this.deptOptions: []);
this.$refs.dept.setCheckedNodes(value ? this.depts : []);
}
},
},
};
</script>

View File

@@ -0,0 +1,146 @@
<template>
<el-form :model="form" label-width="80px">
<el-form-item label="角色名称">
<el-input v-model="form.name" :disabled="true" />
</el-form-item>
<el-form-item label="角色标识">
<el-input v-model="form.code" :disabled="true" />
</el-form-item>
<el-form-item label="菜单权限">
<el-checkbox
v-model="menuExpand"
@change="handleCheckedTreeExpand($event, 'menu')"
>展开/折叠</el-checkbox
>
<el-checkbox
v-model="menuNodeAll"
@change="handleCheckedTreeNodeAll($event, 'menu')"
>全选/全不选</el-checkbox
>
<el-tree
class="tree-border"
:data="menuOptions"
show-checkbox
ref="menu"
node-key="id"
:check-strictly="form.menuCheckStrictly"
empty-text="加载中请稍后"
:props="defaultProps"
></el-tree>
</el-form-item>
</el-form>
</template>
<script>
import { getRole } from "@/api/system/role";
import { SystemDataScopeEnum } from "@/utils/constants";
import { assignRoleMenu, listRoleMenus } from "@/api/system/permission";
import { DICT_TYPE, getDictDatas } from "@/utils/dict";
import { listSimpleMenus } from "@/api/system/menu";
export default {
name: "MenuAuth",
data() {
return {
form: {
id: undefined,
name: undefined,
code: undefined,
menuIds: [],
menuCheckStrictly: true,
},
// 菜单列表
menuOptions: [],
menuExpand: false,
menuNodeAll: false,
SysDataScopeEnum: SystemDataScopeEnum,
// 数据字典
dataScopeDictDatas: getDictDatas(DICT_TYPE.SYSTEM_DATA_SCOPE),
defaultProps: {
label: "name",
children: "children",
},
};
},
methods: {
init(id) {
this.form.id = id;
getRole(id).then((res) => {
this.form.name = res.data.name;
this.form.code = res.data.code;
listSimpleMenus().then((response) => {
// 处理 menuOptions 参数
this.menuOptions = [];
this.menuOptions.push(...this.handleTree(response.data, "id"));
// 获取角色拥有的菜单权限
listRoleMenus(id).then((response) => {
// 设置为严格,避免设置父节点自动选中子节点,解决半选中问题
this.form.menuCheckStrictly = true;
// 设置选中
this.$refs.menu.setCheckedKeys(response.data);
// 设置为非严格,继续使用半选中
this.form.menuCheckStrictly = false;
});
});
});
},
submitForm() {
if (this.form.id !== undefined) {
assignRoleMenu({
roleId: this.form.id,
menuIds: [
...this.$refs.menu.getCheckedKeys(),
...this.$refs.menu.getHalfCheckedKeys(),
],
}).then((response) => {
this.$modal.msgSuccess("修改成功");
this.$emit("successSubmitm");
});
}
},
formClear() {
if (this.$refs.menu !== undefined) {
this.$refs.menu.setCheckedKeys([]);
}
this.menuExpand = false;
this.menuNodeAll = false;
this.form = {
id: undefined,
name: undefined,
code: undefined,
menuIds: [],
menuCheckStrictly: true,
};
},
// 树权限(父子联动)
handleCheckedTreeConnect(value, type) {
if (type === "menu") {
this.form.menuCheckStrictly = value;
} else if (type === "dept") {
this.form.deptCheckStrictly = !value;
}
},
// 树权限(展开/折叠)
handleCheckedTreeExpand(value, type) {
if (type === "menu") {
let treeList = this.menuOptions;
for (let i = 0; i < treeList.length; i++) {
this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value;
}
} else if (type === "dept") {
let treeList = this.deptOptions;
for (let i = 0; i < treeList.length; i++) {
this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value;
}
}
},
// 树权限(全选/全不选)
handleCheckedTreeNodeAll(value, type) {
if (type === "menu") {
this.$refs.menu.setCheckedNodes(value ? this.menuOptions : []);
} else if (type === "dept") {
// this.$refs.dept.setCheckedNodes(value ? this.deptOptions: []);
this.$refs.dept.setCheckedNodes(value ? this.depts : []);
}
},
},
};
</script>

View File

@@ -0,0 +1,129 @@
<template>
<el-form ref="form" :rules="rules" label-width="100px" :model="form">
<el-row>
<el-col :span="24">
<el-form-item label="角色编码" prop="code">
<el-input v-model="form.code"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="角色名称" prop="name">
<el-input v-model="form.name"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="角色顺序" prop="sort">
<el-input-number
v-model="form.sort"
controls-position="right"
:min="1"
:max="999999999"
style="width: 100%"
></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态" prop="status" v-if="isEdit">
<el-switch v-model="form.status"> </el-switch>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { addRole, getRole, updateRole } from "@/api/system/role";
export default {
name: "RoleAdd",
data() {
return {
form: {
id: "",
code: "",
name: "",
sort: 1,
status: 0,
remark: "",
},
isEdit: false, //是否是编辑
rules: {
code: [
{ required: true, message: "角色编码不能为空", trigger: "blur" },
],
name: [
{ required: true, message: "角色名称不能为空", trigger: "blur" },
],
sort: [{ required: true }],
},
};
},
methods: {
init(id) {
if (id) {
this.isEdit = true;
this.form.id = id;
getRole(id).then((res) => {
if (res.code === 0) {
this.form.id = res.data.id;
this.form.code = res.data.code;
this.form.name = res.data.name;
this.form.sort = res.data.sort;
this.form.remark = res.data.remark;
this.form.status = res.data.status ? false : true;
}
});
} else {
this.isEdit = false;
this.form.id = "";
}
},
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.isEdit) {
//编辑
updateRole({
id: this.form.id,
code: this.form.code,
name: this.form.name,
sort: this.form.sort,
remark: this.form.remark,
status: this.form.status ? 0 : 1,
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit("successSubmit");
}
});
} else {
addRole({
code: this.form.code,
name: this.form.name,
sort: this.form.sort,
remark: this.form.remark,
status: 0,
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit("successSubmit");
}
});
}
} else {
return false;
}
});
},
formClear() {
this.$refs.form.resetFields();
this.isEdit = false;
},
},
};
</script>

View File

@@ -1,495 +1,292 @@
<template>
<div class="app-container">
<!-- <doc-alert title="功能权限" url="https://doc.iocoder.cn/resource-permission" />
<div class="app-container">
<!-- <doc-alert
title="功能权限"
url="https://doc.iocoder.cn/resource-permission"
/>
<doc-alert title="数据权限" url="https://doc.iocoder.cn/data-permission" /> -->
<el-form :model="queryParams" ref="queryForm" v-show="showSearch" :inline="true">
<el-form-item label="角色名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入角色名称" clearable size="small" style="width: 240px"
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="角色标识" prop="code">
<el-input v-model="queryParams.code" placeholder="请输入角色标识" clearable size="small" style="width: 240px"
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="角色状态" clearable size="small" style="width: 240px">
<el-option v-for="dict in statusDictDatas" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="230"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" />
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:role:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['system:role:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="roleList">
<el-table-column label="角色编号" prop="id" width="120" />
<el-table-column label="角色名称" prop="name" :show-overflow-tooltip="true" width="150" />
<el-table-column label="角色标识" prop="code" :show-overflow-tooltip="true" width="150" />
<el-table-column label="角色类型" prop="type" width="80">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.SYSTEM_ROLE_TYPE" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="显示顺序" prop="sort" width="100" />
<el-table-column label="状态" align="center" width="100">
<template v-slot="scope">
<el-switch v-model="scope.row.status" :active-value="0" :inactive-value="1" @change="handleStatusChange(scope.row)"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:role:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-circle-check" @click="handleMenu(scope.row)"
v-hasPermi="['system:permission:assign-role-menu']">菜单权限</el-button>
<el-button size="mini" type="text" icon="el-icon-circle-check" @click="handleDataScope(scope.row)"
v-hasPermi="['system:permission:assign-role-data-scope']">数据权限</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['system:role:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 添加或修改角色配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="角色名称" prop="name">
<el-input v-model="form.name" placeholder="请输入角色名称" />
</el-form-item>
<el-form-item label="角色标识" prop="code">
<el-input v-model="form.code" placeholder="请输入角色标识" />
</el-form-item>
<el-form-item label="角色顺序" prop="sort">
<el-input-number v-model="form.sort" controls-position="right" :min="0" />
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 分配角色的数据权限对话框 -->
<el-dialog title="分配数据权限" :visible.sync="openDataScope" width="500px" append-to-body>
<el-form :model="form" label-width="80px">
<el-form-item label="角色名称">
<el-input v-model="form.name" :disabled="true" />
</el-form-item>
<el-form-item label="角色标识">
<el-input v-model="form.code" :disabled="true" />
</el-form-item>
<el-form-item label="权限范围">
<el-select v-model="form.dataScope">
<el-option
v-for="item in dataScopeDictDatas"
:key="parseInt(item.value)"
:label="item.label"
:value="parseInt(item.value)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="数据权限" v-show="form.dataScope === SysDataScopeEnum.DEPT_CUSTOM">
<el-checkbox :checked="!form.deptCheckStrictly" @change="handleCheckedTreeConnect($event, 'dept')">父子联动(选中父节点自动选择子节点)</el-checkbox>
<el-checkbox v-model="deptExpand" @change="handleCheckedTreeExpand($event, 'dept')">展开/折叠</el-checkbox>
<el-checkbox v-model="deptNodeAll" @change="handleCheckedTreeNodeAll($event, 'dept')">全选/全不选</el-checkbox>
<el-tree
class="tree-border"
:data="deptOptions"
show-checkbox
default-expand-all
ref="dept"
node-key="id"
:check-strictly="form.deptCheckStrictly"
empty-text="加载中请稍后"
:props="defaultProps"
></el-tree>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitDataScope"> </el-button>
<el-button @click="cancelDataScope"> </el-button>
</div>
</el-dialog>
<!-- 分配角色的菜单权限对话框 -->
<el-dialog :title="title" :visible.sync="openMenu" width="500px" append-to-body>
<el-form :model="form" label-width="80px">
<el-form-item label="角色名称">
<el-input v-model="form.name" :disabled="true" />
</el-form-item>
<el-form-item label="角色标识">
<el-input v-model="form.code" :disabled="true" />
</el-form-item>
<el-form-item label="菜单权限">
<el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>
<el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox>
<el-tree class="tree-border" :data="menuOptions" show-checkbox ref="menu" node-key="id"
:check-strictly="form.menuCheckStrictly" empty-text="加载中请稍后" :props="defaultProps"></el-tree>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitMenu"> </el-button>
<el-button @click="cancelMenu"> </el-button>
</div>
</el-dialog>
</div>
<!-- 新增&编辑 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<role-add ref="roleAdd" @successSubmit="successSubmit" />
</base-dialog>
<!-- 菜单权限 -->
<base-dialog
dialogTitle="分配菜单权限"
:dialogVisible="menuVisible"
@cancel="handleCancelm"
@confirm="handleConfirmm"
:before-close="handleCancelm"
width="50%">
<menu-auth ref="menuAuth" @successSubmitm="successSubmitm" />
</base-dialog>
<!-- 数据权限 -->
<base-dialog
dialogTitle="分配数据权限"
:dialogVisible="dataVisible"
@cancel="handleCanceld"
@confirm="handleConfirmd"
:before-close="handleCanceld"
width="50%">
<data-auth ref="dataAuth" @successSubmitd="successSubmitd" />
</base-dialog>
</div>
</template>
<script>
import {
addRole,
changeRoleStatus,
delRole,
exportRole,
getRole,
listRole,
updateRole
} from "@/api/system/role";
import {listSimpleMenus} from "@/api/system/menu";
import {assignRoleMenu, listRoleMenus, assignRoleDataScope} from "@/api/system/permission";
import {listSimpleDepts} from "@/api/system/dept";
import {CommonStatusEnum, SystemDataScopeEnum} from "@/utils/constants";
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import { delRole, listRole } from '@/api/system/role';
import tableHeightMixin from '@/mixins/tableHeightMixin';
import RoleAdd from './components/roleAdd';
import MenuAuth from './components/menuAuth';
import DataAuth from './components/dataAuth';
import statusBtn from './../components/statusBtn.vue';
const tableProps = [
{
prop: 'code',
label: '角色编码',
minWidth: 140,
showOverflowtooltip: true,
},
{
prop: 'name',
label: '角色名称',
minWidth: 140,
showOverflowtooltip: true,
},
{
prop: 'sort',
label: '角色顺序',
minWidth: 90,
showOverflowtooltip: true,
},
{
prop: 'status',
label: '状态',
minWidth: 100,
subcomponent: statusBtn,
},
{
prop: 'remark',
label: '角色描述',
minWidth: 140,
showOverflowtooltip: true,
},
];
export default {
name: "SystemRole",
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 角色表格数据
roleList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 是否显示弹出层(数据权限)
openDataScope: false,
// 是否显示弹出层(菜单权限)
openMenu: false,
menuExpand: false,
menuNodeAll: false,
deptExpand: true,
deptNodeAll: false,
// 菜单列表
menuOptions: [],
// 部门列表
deptOptions: [], // 部门属性结构
depts: [], // 部门列表
// 查询参数
queryParams: {
pageNo: 1,
pageSize: 10,
name: undefined,
code: undefined,
status: undefined,
createTime: []
},
// 表单参数
form: {},
defaultProps: {
label: "name",
children: "children"
},
// 表单校验
rules: {
name: [
{ required: true, message: "角色名称不能为空", trigger: "blur" }
],
code: [
{ required: true, message: "角色标识不能为空", trigger: "blur" }
],
sort: [
{ required: true, message: "角色顺序不能为空", trigger: "blur" }
]
},
// 枚举
SysCommonStatusEnum: CommonStatusEnum,
SysDataScopeEnum: SystemDataScopeEnum,
// 数据字典
roleTypeDictDatas: getDictDatas(DICT_TYPE.SYSTEM_ROLE_TYPE),
statusDictDatas: getDictDatas(DICT_TYPE.COMMON_STATUS),
dataScopeDictDatas: getDictDatas(DICT_TYPE.SYSTEM_DATA_SCOPE)
};
},
created() {
this.getList();
},
methods: {
/** 查询角色列表 */
getList() {
this.loading = true;
listRole(this.queryParams).then(
response => {
this.roleList = response.data.list;
this.total = response.data.total;
this.loading = false;
}
);
},
// 角色状态修改
handleStatusChange(row) {
// 此时row 已经变成目标状态了,所以可以直接提交请求和提示
let text = row.status === CommonStatusEnum.ENABLE ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '""' + row.name + '"角色吗?').then(function() {
return changeRoleStatus(row.id, row.status);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function() {
// 异常时,需要将 row.status 状态重置回之前的
row.status = row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE
: CommonStatusEnum.ENABLE;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 取消按钮(数据权限)
cancelDataScope() {
this.openDataScope = false;
this.reset();
},
// 取消按钮(菜单权限)
cancelMenu() {
this.openMenu = false;
this.reset();
},
// 表单重置
reset() {
if (this.$refs.menu !== undefined) {
this.$refs.menu.setCheckedKeys([]);
}
this.menuExpand = false;
this.menuNodeAll = false;
this.deptExpand = true;
this.deptNodeAll = false;
this.form = {
id: undefined,
name: undefined,
code: undefined,
sort: 0,
deptIds: [],
menuIds: [],
dataScope: undefined,
deptCheckStrictly: false,
menuCheckStrictly: true,
remark: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 树权限(展开/折叠)
handleCheckedTreeExpand(value, type) {
if (type === 'menu') {
let treeList = this.menuOptions;
for (let i = 0; i < treeList.length; i++) {
this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value;
}
} else if (type === 'dept') {
let treeList = this.deptOptions;
for (let i = 0; i < treeList.length; i++) {
this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value;
}
}
},
// 树权限(全选/全不选)
handleCheckedTreeNodeAll(value, type) {
if (type === 'menu') {
this.$refs.menu.setCheckedNodes(value ? this.menuOptions: []);
} else if (type === 'dept') {
// this.$refs.dept.setCheckedNodes(value ? this.deptOptions: []);
this.$refs.dept.setCheckedNodes(value ? this.depts: []);
}
},
// 树权限(父子联动)
handleCheckedTreeConnect(value, type) {
if (type === 'menu') {
this.form.menuCheckStrictly = value;
} else if (type === 'dept') {
this.form.deptCheckStrictly = !value;
}
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加角色";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id
getRole(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改角色";
});
},
/** 分配菜单权限操作 */
handleMenu(row) {
this.reset();
const id = row.id
// 处理了 form 的角色 name 和 code 的展示
this.form.id = id;
this.form.name = row.name;
this.form.code = row.code;
// 打开弹窗
this.openMenu = true;
// 获得菜单列表
listSimpleMenus().then(response => {
// 处理 menuOptions 参数
this.menuOptions = [];
this.menuOptions.push(...this.handleTree(response.data, "id"));
// 获取角色拥有的菜单权限
listRoleMenus(id).then(response => {
// 设置为严格,避免设置父节点自动选中子节点,解决半选中问题
this.form.menuCheckStrictly = true
// 设置选中
this.$refs.menu.setCheckedKeys(response.data);
// 设置为非严格,继续使用半选中
this.form.menuCheckStrictly = false
})
});
},
/** 分配数据权限操作 */
handleDataScope(row) {
this.reset();
// 处理了 form 的角色 name 和 code 的展示
this.form.id = row.id;
this.form.name = row.name;
this.form.code = row.code;
// 打开弹窗
this.openDataScope = true;
// 获得部门列表
listSimpleDepts().then(response => {
// 处理 deptOptions 参数
this.deptOptions = [];
this.deptOptions.push(...this.handleTree(response.data, "id"));
this.depts = response.data;
// this.deptIds = response.data.map(x => x.id);
// 获得角色拥有的数据权限
getRole(row.id).then(response => {
this.form.dataScope = response.data.dataScope;
this.$refs.dept.setCheckedKeys(response.data.dataScopeDeptIds, false);
});
});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id !== undefined) {
updateRole(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addRole(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 提交按钮(数据权限) */
submitDataScope: function() {
if (this.form.id !== undefined) {
assignRoleDataScope({
roleId: this.form.id,
dataScope: this.form.dataScope,
dataScopeDeptIds: this.form.dataScope !== SystemDataScopeEnum.DEPT_CUSTOM ? [] :
this.$refs.dept.getCheckedKeys()
}).then(response => {
this.$modal.msgSuccess("修改成功");
this.openDataScope = false;
this.getList();
});
}
},
/** 提交按钮(菜单权限) */
submitMenu: function() {
if (this.form.id !== undefined) {
assignRoleMenu({
roleId: this.form.id,
menuIds: [...this.$refs.menu.getCheckedKeys(), ...this.$refs.menu.getHalfCheckedKeys()]
}).then(response => {
this.$modal.msgSuccess("修改成功");
this.openMenu = false;
this.getList();
});
}
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除角色编号为"' + ids + '"的数据项?').then(function() {
return delRole(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$modal.confirm('是否确认导出所有角色数据项?').then(function() {
this.exportLoading = true;
return exportRole(queryParams);
}).then(response => {
this.$download.excel(response, '角色数据.xls');
this.exportLoading = false;
}).catch(() => {});
}
}
name: 'SystemRole',
mixins: [tableHeightMixin],
components: { RoleAdd, MenuAuth, DataAuth },
data() {
return {
formConfig: [
{
type: 'input',
label: '角色名称',
placeholder: '角色名称',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('system:role:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('system:role:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
queryParams: {
pageNo: 1,
pageSize: 20,
name: '',
},
tableProps,
list: [],
tableBtn: [
this.$auth.hasPermi('system:permission:assign-role-menu')
? {
type: 'menuAuth',
btnName: '菜单权限',
}
: undefined,
this.$auth.hasPermi('system:permission:assign-role-data-scope')
? {
type: 'dataAuth',
btnName: '数据权限',
// showTip: "新增工单",
}
: undefined,
this.$auth.hasPermi('system:role:update')
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('system:role:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
addOrEditTitle: '',
centervisible: false,
// 菜单权限
menuVisible: false,
// 数据权限
dataVisible: false,
// 总条数
total: 0,
};
},
created() {
this.getList();
},
methods: {
/** 查询角色列表 */
getList() {
listRole(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
});
},
buttonClick(val) {
console.log(val);
if (val.btnName === 'search') {
this.queryParams.pageNo = 1;
this.queryParams.name = val.name;
this.getList();
} else {
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.roleAdd.init();
});
}
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.roleAdd.init(val.data.id);
});
break;
case 'delete':
this.handleDelete(val.data);
break;
case 'menuAuth':
this.menuVisible = true;
this.$nextTick(() => {
this.$refs.menuAuth.init(val.data.id);
});
break;
default:
this.dataVisible = true;
this.$nextTick(() => {
this.$refs.dataAuth.init(val.data.id);
});
}
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.delConfirm(row.name)
.then(function () {
return delRole(row.id);
})
.then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
// 新增取消
handleCancel() {
this.$refs.roleAdd.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.roleAdd.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
// 菜单权限
handleCancelm() {
this.$refs.menuAuth.formClear();
this.menuVisible = false;
},
handleConfirmm() {
this.$refs.menuAuth.submitForm();
},
successSubmitm() {
this.handleCancelm();
this.getList();
},
// 数据权限
handleCanceld() {
this.$refs.dataAuth.formClear();
this.dataVisible = false;
},
handleConfirmd() {
this.$refs.dataAuth.submitForm();
},
successSubmitd() {
this.handleCanceld();
this.getList();
},
},
};
</script>
<style lang="scss" scoped>
.app-container {
width: 100%;
height: calc(100vh - 164px);
background-color: #fff;
border-radius: 8px;
padding: 8px;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -7,9 +7,9 @@
<span>个人信息</span>
</div>
<div>
<!-- <div class="text-center">
<div class="text-center">
<userAvatar :user="user" />
</div> -->
</div>
<ul class="list-group list-group-striped">
<li class="list-group-item">
<svg-icon icon-class="user" />用户名称
@@ -66,7 +66,7 @@
</template>
<script>
// import userAvatar from "./userAvatar";
import userAvatar from "./userAvatar";
import userInfo from "./userInfo";
import resetPwd from "./resetPwd";
import userSocial from "./userSocial";
@@ -74,7 +74,7 @@ import { getUserProfile } from "@/api/system/user";
export default {
name: "Profile",
components: { /** userAvatar , **/ userInfo, resetPwd, userSocial },
components: { userAvatar, userInfo, resetPwd, userSocial },
data() {
return {
user: {},

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: zwq
* @LastEditTime: 2023-11-21 10:37:05
* @LastEditTime: 2024-08-09 15:51:09
* @Description:
*/
export default {
@@ -17,7 +17,7 @@ export default {
},
tableData: [],
listQuery: {
pageSize: 10,
pageSize: 20,
pageNo: 1,
total: 1,
},
@@ -41,6 +41,8 @@ export default {
if(response.hasOwnProperty('data')){
this.tableData = response.data.list;
this.listQuery.total = response.data.total;
}else{
this.tableData = []
}
this.dataListLoading = false;
});
@@ -104,11 +106,8 @@ export default {
},
// 删除
deleteHandle(id, name, index) {
this.$confirm(`是否确认删除${name ? '名称为"' + name + '"' : '序号为"' + index + '"'}的数据项?`, "系统提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
this.$modal
.delConfirm(name ? '名称: ' + name : '序号: ' + index)
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.$message({

View File

@@ -2,7 +2,7 @@
/*
* @Date: 2020-12-29 16:49:28
* @LastEditors: zwq
* @LastEditTime: 2023-10-24 16:30:25
* @LastEditTime: 2024-08-07 15:57:27
* @FilePath: \basic-admin\src\filters\basicData\index.js
* @Description:
*/
@@ -17,11 +17,6 @@ const table = {
1: '启用',
0: '停用',
},
wareType: {
1: '缓存',
2: '活动',
3: '其它',
},
}
// 日期格式化

View File

@@ -0,0 +1,73 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:54:06
* @LastEditors: zwq
* @LastEditTime: 2024-07-30 14:49:14
* @Description:
-->
<template>
<div class="warehouse-base">
<div class="operationArea">
<el-tabs v-model="pane" @tab-click="setPane" stretch>
<el-tab-pane label="仓库设置" name="warehouseSetup">
<warehouseSetup
ref="warehouseSetup"
v-if="pane === 'warehouseSetup'"></warehouseSetup>
</el-tab-pane>
<el-tab-pane label="库区设置" name="areaSetup">
<areaSetup
ref="areaSetup"
v-if="pane === 'areaSetup'"></areaSetup>
</el-tab-pane>
<el-tab-pane label="库位设置" name="locationSetup">
<locationSetup
ref="locationSetup"
v-if="pane === 'locationSetup'"></locationSetup>
</el-tab-pane>
</el-tabs>
</div>
</div>
</template>
<script>
import areaSetup from './warehouse-area-setup';
import locationSetup from './warehouse-location-setup';
import warehouseSetup from './warehouse-setup';
export default {
name: 'warehouseBase',
components: {
warehouseSetup,
areaSetup,
locationSetup,
},
data() {
return {
pane: 'warehouseSetup',
};
},
created() {
this.$nextTick(() => {
this.$refs.warehouseSetup.getDataList();
});
},
methods: {
setPane() {
this.$nextTick(() => {
this.$refs[this.pane].getDataList();
});
},
},
};
</script>
<style lang="scss">
.warehouse-base {
background-color: #f2f4f9;
.operationArea {
background-color: #fff;
border-radius: 8px;
}
.el-tabs__header {
padding: 14px 50% 0 10px;
}
}
</style>

View File

@@ -0,0 +1,124 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 13:52:10
* @LastEditors: zwq
* @LastEditTime: 2024-07-30 15:06:35
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
v-if="visible"
@keyup.enter.native="dataFormSubmit()"
label-width="100px"
label-position="top">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="仓库名称" prop="warehouseId">
<el-select
v-model="dataForm.warehouseId"
filterable
clearable
:style="{ width: '100%' }"
placeholder="请选择仓库名称">
<el-option
v-for="item in warehouseArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="库区名称" prop="name">
<el-input
v-model="dataForm.name"
clearable
placeholder="请输入库区名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="库区类型" prop="areaType">
<el-input
v-model="dataForm.areaType"
clearable
placeholder="请输入库区类型" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="enabled" label="是否启用">
<el-select
v-model="dataForm.enabled"
filterable
:style="{ width: '100%' }"
placeholder="请选择是否启用">
<el-option
v-for="item in isorno"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../../mixins/basic-add';
import {
createWarehouseArea,
updateWarehouseArea,
getWarehouseArea,
} from "@/api/warehouse/warehouse-area-setup";
import {
getWarehouseList
} from "@/api/warehouse/warehouse-setup";
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
createURL: createWarehouseArea,
updateURL: updateWarehouseArea,
infoURL: getWarehouseArea,
},
dataForm: {
id: undefined,
name: '',
warehouseId: '',
enabled: 1,
areaType: ''
},
dataRule: {
warehouseId: [
{ required: true, message: '仓库名称不能为空', trigger: 'change' },
],
name: [
{ required: true, message: '库区名称不能为空', trigger: 'blur' },
],
},
warehouseArr: [],
isorno: [
{
id: 0,
name: '停用',
},
{
id: 1,
name: '启用',
},
],
};
},
created() {
getWarehouseList().then((response) => {
this.warehouseArr = response.data;
});
},
methods: {},
};
</script>

View File

@@ -0,0 +1,185 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="40%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../../mixins/basic-page';
import codeFilter from '../../mixins/code-filter';
import {
deleteWarehouseArea,
getWarehouseAreaPage,
getWarehouseAreaList
} from "@/api/warehouse/warehouse-area-setup";
import {
getWarehouseList
} from "@/api/warehouse/warehouse-setup";
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'warehouseName',
label: '仓库名称',
},
{
prop: 'name',
label: '库区名称',
},
{
prop: 'areaType',
label: '库区类型',
},
{
prop: 'enabled',
label: '是否启用',
filter: codeFilter('deactivate'),
},
];
export default {
mixins: [basicPage,tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getWarehouseAreaPage,
deleteURL: deleteWarehouseArea,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`warehouse:warehouse-area-setup:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`warehouse:warehouse-area-setup:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v)=>v),
tableData: [],
formConfig: [
{
type: 'select',
label: '仓库',
selectOptions: [],
param: 'warehouseId',
defaultSelect: '',
filterable: true,
},
{
type: 'select',
label: '库区',
selectOptions: [],
param: 'areaId',
defaultSelect: '',
filterable: true,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('warehouse:warehouse-area-setup:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
};
},
components: {
AddOrUpdate,
},
created() {
getWarehouseList().then((response) => {
this.formConfig[0].selectOptions = response.data;
});
getWarehouseAreaList().then((response) => {
this.formConfig[1].selectOptions = response.data;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20;
this.listQuery.warehouseId = val.warehouseId;
this.listQuery.areaId = val.areaId;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 20,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@@ -0,0 +1,223 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 13:52:10
* @LastEditors: zwq
* @LastEditTime: 2024-08-07 15:53:15
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
v-if="visible"
@keyup.enter.native="dataFormSubmit()"
label-width="100px"
label-position="top">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="仓库名称" prop="warehouseId">
<el-select
v-model="dataForm.warehouseId"
filterable
clearable
:style="{ width: '100%' }"
placeholder="请选择仓库名称">
<el-option
v-for="item in warehouseArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="库区名称" prop="areaId">
<el-select
v-model="dataForm.areaId"
filterable
clearable
:style="{ width: '100%' }"
@change="setAreaType"
placeholder="请选择库区名称">
<el-option
v-for="item in areaArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="库区类型" prop="areaType">
<el-input
v-model="dataForm.areaType"
disabled
placeholder="库区类型" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="库位名称" prop="name">
<el-input
v-model="dataForm.name"
clearable
placeholder="请输入库位名称" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="库位编码" prop="code">
<el-input
v-model="dataForm.code"
clearable
placeholder="请输入库位编码" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item prop="type" label="库位类型">
<el-select
v-model="dataForm.type"
filterable
:style="{ width: '100%' }"
placeholder="请选择库位类型">
<el-option
v-for="item in urlOptions.dictList.dict0"
:key="item.id"
:label="item.label"
:value="parseInt(item.value)"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="排" prop="arrange">
<el-input
v-model="dataForm.arrange"
clearable
placeholder="请输入排" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="列" prop="col">
<el-input v-model="dataForm.col" clearable placeholder="请输入列" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="层" prop="layer">
<el-input v-model="dataForm.layer" clearable placeholder="请输入层" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item prop="enabled" label="是否启用">
<el-select
v-model="dataForm.enabled"
filterable
:style="{ width: '100%' }"
placeholder="请选择是否启用">
<el-option
v-for="item in isorno"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../../mixins/basic-add';
import {
createWarehouseLocation,
updateWarehouseLocation,
getWarehouseLocation,
getCode,
} from '@/api/warehouse/warehouse-location-setup';
import { getWarehouseList } from '@/api/warehouse/warehouse-setup';
import { getWarehouseAreaList } from '@/api/warehouse/warehouse-area-setup';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: true,
codeURL: getCode,
getDictList: true,
createURL: createWarehouseLocation,
updateURL: updateWarehouseLocation,
infoURL: getWarehouseLocation,
},
nameList: ['location_type'],
dataForm: {
id: undefined,
name: '',
code: '',
warehouseId: '',
areaId: '',
areaType: '',
type: '',
enabled: 1,
arrange: '',
col: '',
layer: '',
},
dataRule: {
warehouseId: [
{ required: true, message: '仓库名称不能为空', trigger: 'change' },
],
areaId: [
{ required: true, message: '库区名称不能为空', trigger: 'change' },
],
code: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
arrange: [{ required: true, message: '排不能为空', trigger: 'blur' }],
col: [{ required: true, message: '列不能为空', trigger: 'blur' }],
layer: [{ required: true, message: '层不能为空', trigger: 'blur' }],
},
warehouseArr: [],
areaArr: [],
isorno: [
{
id: 0,
name: '停用',
},
{
id: 1,
name: '启用',
},
],
typeArr: [
{
id: 1,
name: '缓存',
},
{
id: 2,
name: '活动',
},
{
id: 3,
name: '其它',
},
],
};
},
created() {
getWarehouseList().then((response) => {
this.warehouseArr = response.data;
});
getWarehouseAreaList().then((response) => {
this.areaArr = response.data;
});
},
methods: {
setAreaType() {
if (this.dataForm.areaId) {
this.dataForm.areaType = this.areaArr.find(
(item) => item.id === this.dataForm.areaId
).areaType;
}
},
},
};
</script>

View File

@@ -0,0 +1,213 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="40%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../../mixins/basic-page';
import codeFilter from '../../mixins/code-filter';
import {
deleteWarehouseLocation,
getWarehouseLocationPage,
} from "@/api/warehouse/warehouse-location-setup";
import {
getWarehouseAreaList
} from "@/api/warehouse/warehouse-area-setup";
import {
getWarehouseList
} from "@/api/warehouse/warehouse-setup";
import tableHeightMixin from '@/mixins/tableHeightMixin';
import { publicFormatter } from '@/utils/dict';
const tableProps = [
{
prop: 'warehouseName',
label: '仓库名称',
},
{
prop: 'areaName',
label: '库区名称',
},
{
prop: 'areaType',
label: '库区类型',
},
{
prop: 'name',
label: '库位名称',
},
{
prop: 'code',
label: '库位编码',
},
{
prop: 'type',
label: '库位类型',
filter: publicFormatter('location_type')
},
{
prop: 'arrange',
label: '排',
},
{
prop: 'col',
label: '列',
},
{
prop: 'layer',
label: '层',
},
{
prop: 'enabled',
label: '是否启用',
filter: codeFilter('deactivate'),
},
];
export default {
mixins: [basicPage,tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getWarehouseLocationPage,
deleteURL: deleteWarehouseLocation,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`warehouse:warehouse-location-setup:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`warehouse:warehouse-location-setup:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v)=>v),
tableData: [],
formConfig: [
{
type: 'select',
label: '仓库',
selectOptions: [],
param: 'warehouseId',
defaultSelect: '',
filterable: true,
},
{
type: 'select',
label: '库区',
selectOptions: [],
param: 'areaId',
defaultSelect: '',
filterable: true,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('warehouse:warehouse-location-setup:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
};
},
components: {
AddOrUpdate,
},
created() {
getWarehouseList().then((response) => {
this.formConfig[0].selectOptions = response.data;
});
getWarehouseAreaList().then((response) => {
this.formConfig[1].selectOptions = response.data;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20;
this.listQuery.warehouseId = val.warehouseId;
this.listQuery.areaId = val.areaId;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@@ -0,0 +1,126 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 13:52:10
* @LastEditors: zwq
* @LastEditTime: 2024-08-07 16:39:08
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
v-if="visible"
@keyup.enter.native="dataFormSubmit()"
label-width="100px"
label-position="top">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="仓库名称" prop="name">
<el-input
v-model="dataForm.name"
clearable
placeholder="请输入仓库名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="仓库编码" prop="code">
<el-input
v-model="dataForm.code"
clearable
placeholder="请输入仓库编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="enabled" label="是否启用">
<el-select
v-model="dataForm.enabled"
filterable
:style="{ width: '100%' }"
placeholder="请选择是否启用">
<el-option
v-for="item in isorno"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="type" label="仓库类型">
<el-select
v-model="dataForm.type"
filterable
:style="{ width: '100%' }"
placeholder="请选择仓库类型">
<el-option
v-for="item in urlOptions.dictList.dict0"
:key="item.id"
:label="item.label"
:value="parseInt(item.value)"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../../mixins/basic-add';
import {
createWarehouse,
updateWarehouse,
getWarehouse,
getCode,
} from '@/api/warehouse/warehouse-setup';
import { getUserProfile } from "@/api/system/user";
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: true,
codeURL: getCode,
getDictList: true,
createURL: createWarehouse,
updateURL: updateWarehouse,
infoURL: getWarehouse,
},
nameList: ['warehouse_type'],
dataForm: {
id: undefined,
name: '',
code: '',
enabled: 1,
type: 2,
creator: ''
},
dataRule: {
code: [
{ required: true, message: '仓库编码不能为空', trigger: 'blur' },
],
name: [
{ required: true, message: '仓库名称不能为空', trigger: 'blur' },
],
},
isorno: [
{
id: 0,
name: '停用',
},
{
id: 1,
name: '启用',
},
],
};
},
created() {
getUserProfile().then(response => {
this.dataForm.creator = response.data.username;
});
},
methods: {},
};
</script>

View File

@@ -0,0 +1,172 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="40%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import codeFilter from '../../mixins/code-filter';
import {
deleteWarehouse,
getWarehousePage,
} from "@/api/warehouse/warehouse-setup";
import tableHeightMixin from '@/mixins/tableHeightMixin';
import { publicFormatter } from '@/utils/dict';
const tableProps = [
{
prop: 'name',
label: '仓库名称',
},
{
prop: 'creator',
label: '创建人',
},
{
prop: 'createTime',
label: '创建时间',
filter: parseTime,
minWidth: 100,
},
{
prop: 'type',
label: '仓库类型',
filter: publicFormatter('warehouse_type')
},
{
prop: 'enabled',
label: '是否启用',
filter: codeFilter('deactivate'),
},
];
export default {
mixins: [basicPage,tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getWarehousePage,
deleteURL: deleteWarehouse,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`warehouse:warehouse-setup:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`warehouse:warehouse-setup:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v)=>v),
tableData: [],
formConfig: [
{
type: 'input',
label: '仓库名称',
placeholder: '仓库名称',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('warehouse:warehouse-setup:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
};
},
components: {
AddOrUpdate,
},
created() {},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20;
this.listQuery.name = val.name;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 20,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@@ -10,7 +10,6 @@ require('echarts/theme/macarons'); // echarts theme
import resize from '@/utils/chartMixins/resize';
const animationDuration = 1000;
export default {
mixins: [resize],
props: {
@@ -38,6 +37,7 @@ export default {
data() {
return {
chart: null,
targetId: '',
};
},
beforeDestroy() {
@@ -50,7 +50,7 @@ export default {
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons');
const _this = this;
this.chart.setOption({
title: {
text: this.title
@@ -81,6 +81,18 @@ export default {
// 坐标轴指示器,坐标轴触发有效
type: 'shadow', // 默认为直线,可选为:'line' | 'shadow'
},
formatter: function (params) {
_this.targetId = params[0].data.id;
let res =
'<div>' +
params[0].name +
'</div><br/>' +
params[0].marker +
'<div style="float:right">库存数量:' +
params[0].value +
'</div>';
return res;
},
},
grid: {
containLabel: true,
@@ -119,12 +131,36 @@ export default {
type: 'bar',
barWidth: '20',
data: this.barData.map((item) => {
return item.value;
const obj = {
value: item.num,
id: item.id,
};
return obj;
}),
animationDuration,
},
],
});
this.chart.getZr().off('click');
this.chart.getZr().on('click', function () {
if (_this.targetId !== '') {
switch (_this.targetId) {
case 1:
_this.$router.push({
path: 'warehouse-manage1/InventoryOverview/' + _this.targetId,
});
break;
case '1818175999715164161':
_this.$router.push({
path: 'warehouse-manage2/InventoryOverview/' + _this.targetId,
});
break;
default:
console.log(_this.targetId);
break;
}
}
});
},
},
};

View File

@@ -2,21 +2,26 @@
* @Author: zwq
* @Date: 2024-07-02 15:56:48
* @LastEditors: zwq
* @LastEditTime: 2024-07-02 16:55:43
* @LastEditTime: 2024-08-02 14:57:52
* @Description:
-->
<template>
<div class="app-container">
<div class="flexDiv">
<div v-for="i in wareName" :key="i + 'a'" class="divClass up">
{{ i }}
<div class="divClass up">仓库名称</div>
<div
v-for="i in wareArr"
:key="i.id + 'a'"
class="divClass up"
:title="i.name">
{{ i.name }}
</div>
</div>
<div class="flexDiv">
<div v-for="i in stockNum" :key="i + 'b'" class="divClass down">
<span v-if="i === '库存数量'">{{ i }}</span>
<el-link v-else :underline="false" type="primary" @click="toPage(i)">
{{ i }}
<div class="divClass down">库存数量</div>
<div v-for="i in wareArr" :key="i.id + 'a'" class="divClass down">
<el-link :underline="false" type="primary" @click="toPage(i)">
{{ i.num }}
</el-link>
</div>
</div>
@@ -25,8 +30,8 @@
ref="barChart"
height="600px"
:title="'库存数量'"
v-if="barData.length"
:bar-data="barData" />
v-if="wareArr.length"
:bar-data="wareArr" />
<!-- 没有数据 -->
<div class="no-data-bg" v-else></div>
</div>
@@ -34,37 +39,41 @@
<script>
import barChart from './BarChart.vue';
import { getWarehouseAllInfo } from '@/api/warehouse/warehouse-setup';
export default {
data() {
return {
wareName: ['仓库名称'],
stockNum: ['库存数量'],
barData: [],
wareArr: [],
};
},
components: {
barChart,
},
created() {
for (let i = 0; i < 5; i++) {
this.wareName.push('仓库' + i);
this.stockNum.push(i * 100 + i);
}
},
methods: {
toPage(i) {
console.log(i);
for (let i = 1; i < 6; i++) {
const obj = {
name: this.wareName[i],
value: this.stockNum[i],
};
this.barData.push(obj);
}
console.log(this.barData);
getWarehouseAllInfo().then((response) => {
this.wareArr = response.data;
this.$nextTick(() => {
this.$refs.barChart.initChart();
});
});
},
methods: {
toPage(i) {
switch (i.id) {
case 1:
this.$router.push({
path: 'warehouse-manage1/InventoryOverview/' + i.id,
});
break;
case '1818175999715164161':
this.$router.push({
path: 'warehouse-manage2/InventoryOverview/' + i.id,
});
break;
default:
console.log(i.id);
break;
}
},
},
};
@@ -82,6 +91,9 @@ export default {
border: 1px solid #ededed;
font-size: 14px;
color: #606266;
white-space: nowrap; /* 确保文本不换行 */
overflow: hidden; /* 超出部分隐藏 */
text-overflow: ellipsis; /* 使用省略号表示超出的文本 */
}
.up:nth-child(n) {
border-bottom: none;

View File

@@ -0,0 +1,150 @@
<!--
* @Author: zwq
* @Date: 2023-08-22 15:01:54
* @LastEditors: zwq
* @LastEditTime: 2024-08-02 15:00:47
* @Description:
-->
<template>
<el-row :gutter="10" class="chart-container">
<el-col :span="wareType === 1 ? 14 : 24">
<div class="chart-card">
<div class="title">库存总览</div>
<div class="sub-title">
产品总数量
<div style="color: black">{{ totalNum }}</div>
</div>
<barChart
ref="barChart"
height="600px"
title="库存总览"
v-if="overviewList.length"
:histogram="overviewList" />
<!-- 没有数据 -->
<div class="no-data-bg" v-else></div>
</div>
</el-col>
<el-col :span="wareType === 1 ? 10 : 0">
<div class="chart-card">
<div class="title">库位占用率</div>
<pieChart
ref="pieChart"
height="600px"
title="库位占用率"
v-if="rateList.length"
:pie-data="rateList" />
<!-- 没有数据 -->
<div class="no-data-bg" v-else></div>
</div>
</el-col>
</el-row>
</template>
<script>
import barChart from '../../chart/BarChart.vue';
import pieChart from '../../chart/PieChart.vue';
import { getOverview, getRate } from '@/api/warehouse/warehouseLocation';
import { getWarehouse } from '@/api/warehouse/warehouse-setup';
export default {
data() {
return {
urlOptions: {
allURL: getOverview,
rateURL: getRate,
},
warehouseId: '',
wareType: 1,
totalNum: 0,
overviewList: [],
rateList: [],
};
},
components: {
barChart,
pieChart,
},
mounted() {
},
created() {
let str = this.$router.currentRoute.path;
let lastIndex = str.lastIndexOf('/');
this.warehouseId = str.slice(lastIndex + 1);
getWarehouse(this.warehouseId).then((response) => {
this.wareType = response.data.type;
this.getDataList();
});
},
methods: {
// 获取数据列表
getDataList() {
const data = {
warehouseId: this.warehouseId,
};
this.urlOptions.allURL(data).then((response) => {
if (response.data && response.data.length) {
this.overviewList = response.data;
this.overviewList.forEach((item) => {
this.totalNum += item.num;
});
this.$nextTick(() => {
this.$refs.barChart.initChart();
});
}
});
if (this.wareType === 1) {
this.urlOptions.rateURL(data).then((response) => {
if (response.data && response.data.length) {
this.rateList = response.data;
this.$nextTick(() => {
this.$refs.pieChart.initChart();
});
}
});
}
},
},
};
</script>
<style scoped>
.chart-container {
min-height: calc(100vh - 120px - 8px);
background-color: #f0f2f7;
}
.chart-card {
min-height: calc(100vh - 120px - 8px);
background-color: #fff;
padding: 16px;
border-radius: 8px;
}
.title {
font-size: 18px;
line-height: 16px;
margin-bottom: 10px;
color: #000;
font-weight: 500;
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
}
.title::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: 16px;
border-radius: 1px;
margin-right: 5px;
background-color: #0b58ff;
}
.sub-title {
font-size: 16px;
line-height: 18px;
color: #888686;
min-width: 80px;
text-align: center;
font-weight: 500;
margin-right: 30px;
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
float: right;
}
</style>

View File

@@ -0,0 +1,258 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 13:52:10
* @LastEditors: zwq
* @LastEditTime: 2024-08-09 10:30:18
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
v-if="visible"
@keyup.enter.native="dataFormSubmit()"
label-width="100px"
label-position="top">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="仓库名称" prop="warehouseName">
<el-input
v-model="dataForm.warehouseName"
readonly
placeholder="请输入仓库名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="库区名称" prop="warehouseAreaId">
<el-select
v-model="dataForm.warehouseAreaId"
filterable
:style="{ width: '100%' }"
:disabled="dataForm.id ? true : false"
placeholder="请选择库区名称">
<el-option
v-for="item in warehouseAreaArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品名称" prop="goodsId">
<el-select
v-model="dataForm.goodsId"
filterable
clearable
:disabled="dataForm.id ? true : false"
:style="{ width: '100%' }"
@change="setGoodInfo"
placeholder="请选择物品名称">
<el-option
v-for="item in goodsArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品编码" prop="code">
<el-input
v-model="dataForm.code"
readonly
placeholder="请输入物品编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品规格" prop="specifications">
<el-input
v-model="dataForm.specifications"
readonly
placeholder="请输入物品规格" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品批次" prop="goodsBatch">
<el-input
v-if="!dataForm.id ? true : false"
v-model="dataForm.goodsBatch"
clearable
placeholder="请输入物品批次" />
<el-select
v-else
v-model="dataForm.goodsBatch"
filterable
clearable
style="width: 100%"
placeholder="请选择物品名称">
<el-option
v-for="(item, index) in Batch"
:key="index"
:label="item.goodsBatch"
:value="item.goodsBatch"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="dataForm.id ? '出库数量' : '入库数量'"
prop="numDet">
<el-input-number
v-model="dataForm.numDet"
clearable
style="width: 100%"
:min="0"
placeholder="请输入数量" />
<!-- :max="max?max:9999999" -->
</el-form-item>
</el-col>
<el-col :span="12" v-if="!dataForm.id ? true : false">
<el-form-item label="供应商" prop="supplierId">
<el-select
v-model="dataForm.supplierId"
filterable
disabled
:style="{ width: '100%' }"
placeholder="请选择供应商">
<el-option
v-for="item in supplierArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../../mixins/basic-add';
import {
createWarehouseRealtime,
outWarehouseRealtime,
getWarehouseRealtime,
getWarehouseRealtimeDet,
} from '@/api/warehouse/warehouseRealtime';
import { getWarehouse } from '@/api/warehouse/warehouse-setup';
import { getWarehouseAreaList } from '@/api/warehouse/warehouse-area-setup';
import { getMaterialList, getSupplierList } from '@/api/base/material';
import { mapGetters } from 'vuex';
export default {
mixins: [basicAdd],
computed: {
...mapGetters(['nickname']),
},
data() {
return {
urlOptions: {
getOption: true,
createURL: createWarehouseRealtime,
updateURL: outWarehouseRealtime,
infoURL: getWarehouseRealtime,
},
dataForm: {
id: undefined,
warehouseName: '',
warehouseId: '',
warehouseAreaId: '',
goodsId: '',
code: '',
specifications: '',
goodsBatch: '',
numDet: '',
operator: '',
supplierId: '',
},
goodsArr: [], //产品物料数组
Batch: [], //物品批次数组
warehouseAreaArr: [], //库区数组
supplierArr: [], //供应商数组
//max: 0,
dataRule: {
goodsId: [
{ required: true, message: '物品名称不能为空', trigger: 'change' },
],
warehouseAreaId: [
{ required: true, message: '库区名称不能为空', trigger: 'change' },
],
goodsBatch: [
{
required: true,
message: '物品批次不能为空,若无请填写无',
trigger: 'blur',
},
],
numDet: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
},
};
},
created() {},
methods: {
init(warehouseId) {
this.dataForm.warehouseId = warehouseId || '';
this.dataForm.id = undefined;
this.visible = true;
this.dataForm.operator = this.nickname;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.getArr();
});
},
getArr() {
getWarehouse(this.dataForm.warehouseId).then((response) => {
this.dataForm.warehouseName = response.data.name;
});
getMaterialList().then((response) => {
this.goodsArr = response.data;
});
getSupplierList().then((res) => {
this.supplierArr = res.data;
});
getWarehouseAreaList(this.dataForm.warehouseId).then((response) => {
this.warehouseAreaArr = response.data;
});
},
setGoodInfo() {
this.goodsArr.forEach((item) => {
if (item.id === this.dataForm.goodsId) {
this.dataForm.code = item.code;
this.dataForm.specifications = item.specifications;
this.dataForm.supplierId = item.supplierId;
}
});
},
// setBatchInfo(){
// this.Batch.forEach((item) => {
// if (item.goodsBatch === this.dataForm.goodsBatch) {
// this.max = item.numDet
// }
// });
// },
outWare(data) {
this.dataForm.warehouseId = data.warehouseId;
this.getArr();
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm.realTimeId = data.id;
this.dataForm.warehouseAreaId = data.warehouseAreaId;
this.dataForm.warehouseAreaId = data.warehouseAreaId;
this.dataForm.id = data.id;
this.dataForm.goodsId = data.goodsId;
this.dataForm.code = data.code;
this.dataForm.specifications = data.spec;
getWarehouseRealtimeDet(data.id).then((res) => {
this.Batch = res.data;
});
// this.urlOptions.infoURL(data.id).then((response) => {
// this.dataForm = response.data;
// });
});
},
},
};
</script>

View File

@@ -0,0 +1,208 @@
<!--
* @Author: zwq
* @Date: 2023-11-03 16:37:06
* @LastEditors: zwq
* @LastEditTime: 2024-08-09 14:13:46
* @Description:
-->
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<el-table
:data="tableData"
:header-cell-style="{
background: '#F2F4F9',
color: '#606266',
}"
:max-height="tableH"
border
v-loading="dataListLoading"
style="width: 100%"
ref="dataList">
<el-table-column type="expand">
<template slot-scope="scope">
<product :warehouse-id="scope.row.id"></product>
</template>
</el-table-column>
<el-table-column prop="warehouseName" label="仓库名称" min-width="150" />
<el-table-column prop="warehouseAreaName" label="库区名称" />
<el-table-column prop="name" label="物品名称" />
<el-table-column prop="code" label="物品编码" width="150" />
<el-table-column prop="spec" label="物品规格" />
<el-table-column prop="num" label="数量" />
<el-table-column prop="operator" label="操作人" />
<el-table-column prop="latestInTime" label="最新入库时间" width="150">
<template v-slot="scope">
<span>{{ parseTime(scope.row.latestInTime) }}</span>
</template>
</el-table-column>
<el-table-column prop="latestOutTime" label="最新出库时间" width="150">
<template v-slot="scope">
<span>{{ parseTime(scope.row.latestOutTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="70">
<template v-slot="scope">
<el-button
size="mini"
type="text"
@click="handleClick({ data: scope.row, type: 'out' })"
v-hasPermi="['warehouse:warehouse-manage:in&out-nothing:out']">
出库
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="40%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import product from './product-mini';
import basicPage from '../../mixins/basic-page';
import { getMaterialList } from '@/api/base/material';
import AddOrUpdate from './add-or-updata';
import { getWarehouseRealtimePage } from '@/api/warehouse/warehouseRealtime';
import tableHeightMixin from '@/mixins/tableHeightMixin';
export default {
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getWarehouseRealtimePage,
},
listQuery: {
warehouseId: '',
},
tableData: [],
formConfig: [
{
type: 'select',
label: '物品名称',
selectOptions: [],
param: 'goodsId',
defaultSelect: '',
filterable: true,
},
{
type: 'input',
label: '操作人',
placeholder: '操作人',
param: 'operator',
},
{
type: 'datePicker',
label: '最新入库时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'datePicker',
label: '最新出库时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime1',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('warehouse:warehouse-manage:in&out-nothing:in')
? 'button'
: '',
btnName: '入库',
name: 'add',
color: 'primary',
plain: true,
},
],
};
},
components: {
product,
AddOrUpdate,
},
created() {
let str = this.$router.currentRoute.path;
let lastIndex = str.lastIndexOf('/');
this.listQuery.warehouseId = str.slice(lastIndex + 1);
getMaterialList().then((response) => {
this.formConfig[0].selectOptions = response.data;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20;
this.listQuery.goodsId = val.goodsId;
this.listQuery.operator = val.operator;
this.listQuery.latestInTime = val.searchTime ? val.searchTime : null;
this.listQuery.latestOutTime = val.searchTime1
? val.searchTime1
: null;
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '入库';
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(this.listQuery.warehouseId);
});
break;
default:
console.log(val);
}
},
otherMethods(val) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '出库';
this.$nextTick(() => {
this.$refs.addOrUpdate.outWare(val.data);
});
},
},
};
</script>
<style>
.app-container .el-table .el-table__cell {
padding: 0;
height: 35px;
}
</style>

View File

@@ -0,0 +1,71 @@
<!--
* @Author: zwq
* @Date: 2023-08-24 14:47:58
* @LastEditors: zwq
* @LastEditTime: 2023-11-04 10:31:56
* @Description:
-->
<template>
<div>
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
max-height="200"
:table-data="tableData" />
</div>
</template>
<script>
import { parseTime } from '../../mixins/code-filter';
import { getWarehouseRealtimeDet } from '@/api/warehouse/warehouseRealtime';
const tableProps = [
{
prop: 'goodsBatch',
label: '产品批次',
},
{
prop: 'numDet',
label: '批次数量',
},
{
prop: 'createTime',
label: '入库时间',
filter: parseTime,
},
];
export default {
props: {
warehouseId: {
type: String,
default: '',
},
},
data() {
return {
urlOptions: {
getDataListURL: getWarehouseRealtimeDet
},
tableProps,
tableData: [],
dataListLoading: false,
};
},
components: {
},
created() {},
mounted() {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.warehouseId).then(response => {
this.tableData = response.data;
this.dataListLoading = false;
});
},
},
};
</script>

View File

@@ -0,0 +1,65 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 15:27:31
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:25:54
* @Description:
-->
<template>
<div :class="[className, { 'p-0': noPadding }]">
<slot />
</div>
</template>
<script>
export default {
props: {
size: {
// 取值范围: xl lg md sm
type: String,
default: 'de',
validator: function (val) {
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
},
},
noPadding: {
type: Boolean,
default: false,
},
},
computed: {
className: function () {
return `${this.size}-title`;
},
},
};
</script>
<style lang="scss" scoped>
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
$mgr: 8px;
@each $size, $height in $pxls {
.#{$size}-title {
font-size: 18px;
line-height: $height;
color: #000;
font-weight: 500;
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
&::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: $height + 2px;
border-radius: 1px;
margin-right: $mgr;
background-color: #0b58ff;
}
}
}
.p-0 {
padding: 0;
}
</style>

View File

@@ -0,0 +1,191 @@
<!--
* @Author: zwq
* @Date: 2024-08-02 16:26:58
* @LastEditors: zwq
* @LastEditTime: 2024-08-08 16:38:53
* @Description:,
-->
<template>
<div>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
v-if="visible && !moveMode"
@keyup.enter.native="dataFormSubmit()"
label-width="100px"
label-position="top">
<el-row :gutter="20">
<el-col :span="24">
<el-form-item prop="targetName" label="出库目的地">
<el-select
v-model="dataForm.targetName"
filterable
:style="{ width: '100%' }"
placeholder="请选择出库目的地">
<el-option
v-for="item in urlOptions.dictList.dict0"
:key="item.id"
:label="item.label"
:value="item.label"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="出库用途" prop="useFor">
<el-input
v-model="dataForm.useFor"
clearable
placeholder="请输入出库用途" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-form v-else ref="form" label-width="100px">
<el-row>
<el-col :span="24">
<el-form-item label="请选择目的地">
<el-cascader
:value="oldLocationId"
:style="{ width: '100%' }"
:options="deptOptions"
:props="{
value: 'id',
label: 'name',
}"
@change="handleChange"></el-cascader>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
import basicAdd from '../../mixins/basic-add';
import {
outWarehouseRealtimeLocation,
outWarehouseRealtimeLocationList,
moveWarehouseRealtimeLocation,
} from '@/api/warehouse/warehouseRealtimeLocation';
import { getWarehouseLocationTree } from '@/api/warehouse/warehouse-location-setup';
import { getUserProfile } from '@/api/system/user';
export default {
mixins: [basicAdd],
components: {},
data() {
return {
urlOptions: {
getDictList: true,
updateURL: outWarehouseRealtimeLocation,
allupdateURL: outWarehouseRealtimeLocationList,
},
nameList: ['outbound-dest'],
dataForm: {
id: undefined,
targetName: '',
useFor: '',
operator: '',
},
selectData: [],
moveMode: false, //是否移库
modeName: '出库',
oldLocationId: '', //移库原id
newLocationId: '', //移库目的id
dataRule: {
targetName: [
{ required: true, message: '出库目的地不能为空', trigger: 'change' },
],
},
deptOptions: undefined,
};
},
created() {
getUserProfile().then((response) => {
this.dataForm.operator = response.data.username;
});
},
methods: {
init(id, selectData) {
this.moveMode = false;
this.visible = true;
if (id === '批量出库') {
this.modeName = '批量出库';
this.selectData = selectData;
} else if (id === '移库') {
this.modeName = '移库';
this.getTreeselect();
this.moveMode = true;
this.oldLocationId = selectData;
this.newLocationId = selectData;
return;
} else {
this.modeName = '出库';
this.selectData = [];
this.dataForm.id = id || '';
}
if (this.urlOptions.getDictList) {
this.getDict();
}
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
});
},
// 表单提交
dataFormSubmit() {
if (this.modeName === '移库') {
// 移库
const obj = {
oldLocationId: this.oldLocationId,
newLocationId: this.newLocationId,
operator: this.dataForm.operator,
};
moveWarehouseRealtimeLocation(obj).then((response) => {
this.$modal.msgSuccess('出库成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
if (this.modeName === '批量出库') {
this.selectData.forEach((item) => {
item.realtimeLocationId = item.id;
item.targetName = this.dataForm.targetName;
item.useFor = this.dataForm.useFor;
item.operator = this.dataForm.operator;
});
// 批量出库
this.urlOptions.allupdateURL(this.selectData).then((response) => {
this.$modal.msgSuccess('批量出库成功');
this.visible = false;
this.$emit('refreshDataList');
});
} else if (this.modeName === '出库') {
// 出库
this.dataForm.realtimeLocationId = this.dataForm.id;
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('出库成功');
this.visible = false;
this.$emit('refreshDataList');
});
}
});
},
handleChange(val) {
this.newLocationId = val[2];
},
// 查询下拉树结构
getTreeselect() {
getWarehouseLocationTree().then((response) => {
this.deptOptions = [];
this.deptOptions.push(...this.handleTree(response.data, 'id'));
});
},
},
};
</script>

View File

@@ -0,0 +1,125 @@
<template>
<el-dialog
:visible.sync="visible"
:width="'30%'"
:append-to-body="true"
:close-on-click-modal="false"
class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">
新增产品
</div>
</slot>
</template>
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="100px"
@keyup.enter.native="dataFormSubmit()">
<el-form-item label="产品" prop="productInfo">
<el-select
v-model="dataForm.productInfo"
style="width: 60%"
filterable
value-key="id"
placeholder="请选择产品">
<el-option
v-for="item in productArr"
:key="item.id"
:disabled="!item.enabled"
:label="item.name"
:value="item" />
</el-select>
</el-form-item>
</el-form>
<el-row style="text-align: right">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row>
</el-dialog>
</template>
<script>
import {
getMaterialList
} from "@/api/base/material";
export default {
data() {
return {
visible: false,
dataForm: {
index: -1,
productInfo: '',
},
productArr: [],
dataRule: {
productId: [{ required: true, message: '产品不能为空', trigger: 'blur' }],
},
};
},
methods: {
init(index) {
if (index >= 0) {
this.dataForm.index = index;
}
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
getMaterialList().then((response) => {
this.productArr = response.data;
});
});
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (this.dataForm.productInfo) {
this.dataForm.productInfo.goodsId = this.dataForm.productInfo.id
this.dataForm.productInfo.remark = ''
// 修改的提交
if (this.dataForm.index >= 0) {
this.visible = false;
this.$emit('refreshDataList', this.dataForm);
return;
}
// 添加的提交
this.visible = false;
this.$emit('refreshDataList', this.dataForm);
} else {
this.$modal.msgWarning('请选择产品');
}
});
},
},
};
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
.dialog >>> .el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
}
.dialog >>> .el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
}
</style>

View File

@@ -0,0 +1,360 @@
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:destroy-on-close="true"
:wrapper-closable="false"
class="drawer"
size="60%">
<small-title slot="title" :no-padding="true">库位信息</small-title>
<div class="content">
<div class="visual-part">
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="100px"
label-position="top"
@keyup.enter.native="dataFormSubmit">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="库位名称" prop="name">
<el-input v-model="dataForm.name" readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="托盘编码" prop="palletCode">
<el-input
v-model="dataForm.palletCode"
@input="$forceUpdate()"
:readonly="isDetail"
placeholder="请输入托盘编码" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<small-title
style="margin: 16px 0; padding-left: 8px"
:no-padding="true">
物品信息
<!-- <el-alert
title="产品信息新增和修改后,需点击最下方保存按钮确定修改"
type="warning"
show-icon></el-alert> -->
</small-title>
<div class="attr-list">
<div
style="position: absolute; top: -40px; right: 15px"
v-if="!isDetail">
<el-button @click="addNew" type="text">
<i class="el-icon-plus"></i>
新增
</el-button>
</div>
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
@emitFun="inputChange"
:height="400"
:table-data="productAttributeList"
v-if="productAttributeList.length">
<method-btn
slot="handleBtn"
v-if="!isDetail"
:width="70"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<!-- 没有数据 -->
<div class="no-data-bg" v-else></div>
</div>
</div>
</div>
<div style="position: absolute; bottom: 24px; right: 24px">
<el-button style="margin-right: 10px" @click="goback()">返回</el-button>
<span v-if="!isDetail">
<el-button type="primary" @click="dataFormSubmit()">入库</el-button>
</span>
</div>
<product-attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="addList" />
</el-drawer>
</template>
<script>
import productAttrAdd from './attr-add';
import inputArea from '../../mixins/inputArea';
import SmallTitle from './SmallTitle';
import {
inWarehouseRealtimeLocation,
getWarehouseRealtimeLocation,
} from '@/api/warehouse/warehouseRealtimeLocation';
import { publicFormatter } from '@/utils/dict';
const tableBtn = [
{
type: 'delete',
btnName: '删除',
},
];
const tableProps1 = [
{
prop: 'name',
label: '物品名称',
},
{
prop: 'code',
label: '物品编码',
showOverflowtooltip: true,
},
{
prop: 'specifications',
label: '物品规格',
},
{
prop: 'goodsBatch',
label: '物品批次',
subcomponent: inputArea,
width: 100,
},
{
prop: 'num',
label: '数量',
subcomponent: inputArea,
width: 100,
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict'),
width: 60,
},
];
const tableProps2 = [
{
prop: 'name',
label: '物品名称',
},
{
prop: 'code',
label: '物品编码',
showOverflowtooltip: true,
},
{
prop: 'specifications',
label: '物品规格',
},
{
prop: 'goodsBatch',
label: '物品批次',
width: 100,
},
{
prop: 'num',
label: '数量',
width: 100,
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict'),
width: 60,
},
];
export default {
components: { productAttrAdd, SmallTitle },
data() {
return {
visible: false,
addOrUpdateVisible: false,
tableBtn,
tableProps: [],
productAttributeList: [],
operator: '',
dataForm: {
id: null,
name: '',
palletCode: '',
},
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
},
isDetail: false,
dataRule: {
// palletCode: [
// {
// required: true,
// message: '托盘编码不能为空',
// trigger: 'blur',
// },
// ],
},
};
},
methods: {
initData() {
this.productAttributeList.splice(0);
},
init(val, nickname, isDetail) {
this.isDetail = isDetail || false;
if (isDetail) {
this.tableProps= tableProps2;
}else{
this.tableProps= tableProps1;
}
this.operator = nickname;
this.dataForm.id = val.id;
this.dataForm.locationId = val.locationId;
this.dataForm.name = val.name;
this.dataForm.palletCode = val.palletCode;
this.initData();
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
// 获取产品详情
// 获取产品的属性列表
this.getList();
}
});
},
getList() {
// 获取产品的属性列表
getWarehouseRealtimeLocation(this.dataForm.locationId).then(
(response) => {
this.productAttributeList = response.data;
}
);
},
inputChange(data) {
switch (data.sType) {
case 1:
this.productAttributeList[data._pageIndex - 1][data.prop] =
data[data.prop];
break;
case 2:
this.productAttributeList[data._pageIndex - 1][data.prop] =
data.string ? data.string.split('+')[0] : '';
this.productAttributeList[data._pageIndex - 1][data.prop + 'Name'] =
data.string ? data.string.split('+')[1] : '';
break;
default:
console.log(val);
}
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`是否确认删除名称为"${raw.data.name}"的数据项?`,
'系统提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
this.productAttributeList.splice(raw.data._pageIndex - 1, 1);
})
.catch(() => {});
} else {
this.addNew(raw.data._pageIndex);
}
},
// 表单提交
dataFormSubmit() {
this.productAttributeList.forEach((item) => {
item.id = '';
});
const data = {
realtimeLocationId: this.dataForm.id,
palletCode: this.dataForm.palletCode,
operator: this.operator,
goodsInfos: this.productAttributeList,
};
this.$refs['dataForm'].validate((valid) => {
if (valid) {
// 修改的提交
if (this.dataForm.id) {
inWarehouseRealtimeLocation(data).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
}
});
},
// 新增 / 修改
addNew(index) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(index);
});
},
addList(data) {
this.productAttributeList.push(data.productInfo);
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
this.initData();
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-form-item {
margin: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 10px;
}
.drawer >>> .content {
padding: 0 24px 30px;
display: flex;
flex-direction: column;
height: 100%;
}
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 76vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form,
.drawer >>> .attr-list {
padding: 0 16px;
position: relative;
}
</style>

View File

@@ -0,0 +1,314 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:selectWidth="selectHasPermi"
@selection-change="selectChange"
:max-height="tableH"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="168"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<drawer
v-if="drawerVisible"
ref="drawerRef"
@refreshDataList="getDataList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
destroy-on-close
width="40%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import Drawer from './drawer';
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import { getWarehouseRealtimeLocationPage } from '@/api/warehouse/warehouseRealtimeLocation';
import { listData } from '@/api/system/dict/data';
import { publicFormatter } from '@/utils/dict';
import { mapGetters } from 'vuex';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'warehouseName',
label: '仓库名称',
},
{
prop: 'name',
label: '库位名称',
},
{
prop: 'code',
label: '库位编码',
},
{
prop: 'type',
label: '库位类型',
filter: publicFormatter('location_type'),
},
{
prop: 'status',
label: '库位状态',
filter: publicFormatter('AreaDetStatus'),
},
{
prop: 'palletCode',
label: '托盘编码',
},
{
prop: 'inTime',
label: '入库时间',
filter: parseTime,
width: 150,
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicPage, tableHeightMixin],
computed: {
...mapGetters(['nickname']),
},
data() {
return {
urlOptions: {
getDataListURL: getWarehouseRealtimeLocationPage,
},
listQuery: {
warehouseId: '',
},
tableData: [],
tableProps,
tableBtn: [
this.$auth.hasPermi(`warehouse:warehouse-manage:in&out:detail`)
? {
type: 'detail',
btnName: '详情',
}
: undefined,
this.$auth.hasPermi(`warehouse:warehouse-manage:in&out:out`)
? {
type: 'out',
btnName: '出库',
showParam: {
type: '&',
data: [
{
type: 'unequal',
name: 'status',
value: 0,
},
],
},
}
: undefined,
this.$auth.hasPermi(`warehouse:warehouse-manage:in&out:in`)
? {
type: 'in',
btnName: '入库',
showParam: {
type: '&',
data: [
{
type: 'equal',
name: 'status',
value: 0,
},
],
},
}
: undefined,
this.$auth.hasPermi(`warehouse:warehouse-manage:in&out:move`)
? {
type: 'move',
btnName: '移库',
showParam: {
type: '&',
data: [
{
type: 'unequal',
name: 'status',
value: 0,
},
],
},
}
: undefined,
].filter((v) => v),
drawerVisible: false,
selectData: [],
selectHasPermi:this.$auth.hasPermi(`warehouse:warehouse-manage:in&out:out`)
? 55
: undefined,
formConfig: [
{
type: 'input',
label: '库位编码',
placeholder: '库位编码',
param: 'kcode',
},
{
type: 'input',
label: '托盘编码',
placeholder: '托盘编码',
param: 'tcode',
},
{
type: 'select',
label: '库位状态',
selectOptions: [],
param: 'status',
defaultSelect: '',
filterable: true,
labelField: 'label',
valueField: 'value',
},
{
type: 'datePicker',
label: '入库时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: '',
btnName: '批量出库',
name: 'allOut',
color: 'primary',
},
],
};
},
components: {
AddOrUpdate,
Drawer,
},
created() {
let str = this.$router.currentRoute.path;
let lastIndex = str.lastIndexOf('/');
this.listQuery.warehouseId = str.slice(lastIndex + 1);
const queryParams = {
pageNo: 1,
pageSize: 99,
dictType: 'AreaDetStatus',
};
listData(queryParams).then((response) => {
this.formConfig[2].selectOptions = response.data.list;
});
},
methods: {
selectChange(val) {
this.selectData = val;
if (this.selectData.length > 0) {
this.formConfig[5].type = 'button';
} else {
this.formConfig[5].type = '';
}
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20;
this.listQuery.locationCode = val.kcode;
this.listQuery.palletCode = val.tcode;
this.listQuery.status = val.status;
this.listQuery.inTime = val.searchTime ? val.searchTime : null;
this.getDataList();
break;
case 'allOut':
this.addOrUpdateVisible = true;
this.addOrEditTitle = '批量出库';
this.$nextTick(() => {
this.$refs.addOrUpdate.init('批量出库', this.selectData);
});
break;
default:
console.log(val);
}
},
otherMethods(val) {
if (val.type === 'out') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '出库';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
} else if (val.type === 'in') {
this.drawerVisible = true;
this.$nextTick(() => {
this.$refs.drawerRef.init(val.data, this.nickname);
});
} else if (val.type === 'detail') {
this.drawerVisible = true;
this.$nextTick(() => {
this.$refs.drawerRef.init(val.data, this.nickname,true);
});
} else if (val.type === 'move') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '移库';
this.$nextTick(() => {
this.$refs.addOrUpdate.init('移库', val.data.locationId);
});
}
},
handleCancel() {
this.addOrUpdateVisible = false;
this.addOrEditTitle = '';
},
},
};
</script>
<style>
.app-container .el-table .el-table__cell {
padding: 0;
height: 35px;
}
</style>

View File

@@ -0,0 +1,345 @@
<!--
* @Author: zwq
* @Date: 2024-01-17 09:58:41
* @LastEditors: zwq
* @LastEditTime: 2024-08-02 16:24:47
* @Description:
-->
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<div class="tips">
<el-tag effect="dark" color="#d3d3d3" style="border: none"></el-tag>
<el-tag effect="dark" color="#16DC09" style="border: none"></el-tag>
<el-tag effect="dark" color="#ff0000" style="border: none">不可用</el-tag>
</div>
<div class="mainbody">
<div v-for="i in listQuery.total" :key="i">
<el-row style="margin-bottom: 10px">
<el-col :span="24">
<el-row type="flex" class="flex-warp">
<div
class="dashboard-layout-item"
v-for="j in wareData.filter(
(item) => item.arrange === (i - 1) * 4 + 1
)"
:key="j.id + j.name"
:title="j.name">
<div class="x-coordinate coordinate" v-if="j.arrange === 1">
{{ j.col }}
</div>
<div class="y-coordinate coordinate" v-if="j.col === 1">
{{ j.arrange }}
</div>
<el-popover
placement="top-start"
:title="j.name"
width="200"
trigger="click"
@show="getLocationInfo(j.id)">
<div v-for="(k, index) in goodsData" :key="index">
物品名称:
<span style="margin-left: 5px;">{{ k.name }}</span>
<br />
物品数量:
<span style="margin-left: 5px">{{ k.num }}</span>
<br />
入库时间:
<span style="margin-left: 5px">{{ parseTime(k.inTime) }}</span>
</div>
<div
slot="reference"
class="hoverDiv"
:style="{
cursor: j.enabled === 0 ? 'not-allowed' : 'pointer',
background:
j.enabled === 1
? j.status === 0
? '#d3d3d3'
: '#16DC09'
: '#ff0000',
}" />
</el-popover>
</div>
</el-row>
<el-row type="flex" class="flex-warp">
<div
class="dashboard-layout-item"
v-for="j in wareData.filter(
(item) => item.arrange === (i - 1) * 4 + 2
)"
:key="j.id + j.name"
:title="j.name">
<div class="y-coordinate coordinate" v-if="j.col === 1">
{{ j.arrange }}
</div>
<el-popover
placement="top-start"
:title="j.name"
width="200"
trigger="click"
@show="getLocationInfo(j.id)">
<div v-for="(k, index) in goodsData" :key="index">
物品名称:
<span style="margin-left: 5px">{{ k.name }}</span>
<br />
物品数量:
<span style="margin-left: 5px">{{ k.num }}</span>
<br />
入库时间:
<span style="margin-left: 5px">{{ parseTime(k.inTime) }}</span>
</div>
<div
slot="reference"
class="hoverDiv"
:style="{
cursor: j.enabled === 0 ? 'not-allowed' : 'pointer',
background:
j.enabled === 1
? j.status === 0
? '#d3d3d3'
: '#16DC09'
: '#ff0000',
}" />
</el-popover>
</div>
</el-row>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-row type="flex" class="flex-warp">
<div
class="dashboard-layout-item"
v-for="j in wareData.filter(
(item) => item.arrange === (i - 1) * 4 + 3
)"
:key="j.id + j.name"
:title="j.name">
<div class="y-coordinate coordinate" v-if="j.col === 1">
{{ j.arrange }}
</div>
<el-popover
placement="top-start"
:title="j.name"
width="200"
trigger="click"
@show="getLocationInfo(j.id)">
<div v-for="(k, index) in goodsData" :key="index">
物品名称:
<span style="margin-left: 5px">{{ k.name }}</span>
<br />
物品数量:
<span style="margin-left: 5px">{{ k.num }}</span>
<br />
入库时间:
<span style="margin-left: 5px">{{ parseTime(k.inTime) }}</span>
</div>
<div
slot="reference"
class="hoverDiv"
:style="{
cursor: j.enabled === 0 ? 'not-allowed' : 'pointer',
background:
j.enabled === 1
? j.status === 0
? '#d3d3d3'
: '#16DC09'
: '#ff0000',
}" />
</el-popover>
</div>
</el-row>
<el-row type="flex" class="flex-warp">
<div
class="dashboard-layout-item"
v-for="j in wareData.filter((item) => item.arrange === i * 4)"
:key="j.id + j.name"
:title="j.name">
<div class="y-coordinate coordinate" v-if="j.col === 1">
{{ j.arrange }}
</div>
<el-popover
placement="top-start"
:title="j.name"
width="200"
trigger="click"
@show="getLocationInfo(j.id)">
<div v-for="(k, index) in goodsData" :key="index">
物品名称:
<span style="margin-left: 5px">{{ k.name }}</span>
<br />
物品数量:
<span style="margin-left: 5px">{{ k.num }}</span>
<br />
入库时间:
<span style="margin-left: 5px">{{ parseTime(k.inTime) }}</span>
</div>
<div
slot="reference"
class="hoverDiv"
:style="{
cursor: j.enabled === 0 ? 'not-allowed' : 'pointer',
background:
j.enabled === 1
? j.status === 0
? '#d3d3d3'
: '#16DC09'
: '#ff0000',
}" />
</el-popover>
</div>
</el-row>
</el-col>
</el-row>
<el-divider class="divider" v-if="i < listQuery.total"></el-divider>
</div>
</div>
</div>
</template>
<script>
import { listByWarehouse } from '@/api/warehouse/warehouseLocation';
import { getWarehouseRealtimeLocation } from '@/api/warehouse/warehouseRealtimeLocation';
export default {
data() {
return {
listQuery: {
layer: 1,
warehouseId: '',
total: 0,
},
wareData: [],
goodsData: [],
formConfig: [
{
type: 'select',
label: '选择层',
selectOptions: [
{ id: 1, name: '1' },
{ id: 2, name: '2' },
{ id: 3, name: '3' },
{ id: 4, name: '4' },
],
param: 'value',
filterable: true,
defaultSelect: 1,
clearable: false,
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
],
};
},
components: {},
created() {
let str = this.$router.currentRoute.path;
let lastIndex = str.lastIndexOf('/');
this.listQuery.warehouseId = str.slice(lastIndex + 1);
this.getDataList();
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.layer = val.value;
this.getDataList();
break;
case 'export':
// this.handleExport(this.aId);
break;
default:
console.log(val);
}
},
// 获取数据列表
getDataList() {
listByWarehouse(this.listQuery).then((response) => {
this.wareData = response.data;
this.listQuery.total = Math.ceil(response.data.length / 120);
});
},
getLocationInfo(id) {
getWarehouseRealtimeLocation(id).then((response) => {
this.goodsData = response.data;
});
},
},
};
</script>
<style lang="scss" scoped>
.mainbody {
display: flex;
flex-direction: column;
justify-content: space-around;
min-width: 80vw;
border-radius: 5px;
padding-top: 25px;
}
.flex-warp {
flex-wrap: nowrap;
}
.dashboard-layout-item {
width: 30px;
height: 30px;
background-color: #d3d3d3;
border-radius: 2px;
margin: 0 6px 8px 0;
position: relative;
&:nth-child(2n) {
margin-right: 30px;
}
&:first-child {
margin-left: 40px;
}
&:last-child {
margin-right: 30px;
}
.coordinate {
font-weight: bold;
font-size: 18px;
}
.x-coordinate {
position: absolute;
top: -25px;
text-align: center;
width: 100%;
}
.y-coordinate {
position: absolute;
line-height: 30px;
text-align: center;
width: 20px;
height: 30px;
left: -25px;
}
}
.hoverDiv {
width: 100%;
height: 30px;
&:hover {
border: 1px #000000 dashed;
transform: scale(1.3);
}
}
.el-divider--horizontal {
margin: 0 0 8px 0;
}
.el-divider {
background-color: black;
}
.tips {
position: absolute;
top: 22px;
right: 120px;
}
</style>

View File

@@ -0,0 +1,178 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
</div>
</template>
<script>
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import {
getWarehouseRealtimeHisPage,
} from '@/api/warehouse/warehouseRealtime';
import { getMaterialList } from '@/api/base/material';
import tableHeightMixin from '@/mixins/tableHeightMixin';
import { listData } from '@/api/system/dict/data';
import { publicFormatter } from '@/utils/dict';
const tableProps = [
{
prop: 'warehouseName',
label: '仓库名称',
},
{
prop: 'warehouseAreaName',
label: '库区名称',
},
{
prop: 'name',
label: '物品名称',
},
{
prop: 'code',
label: '物品编码',
},
{
prop: 'spec',
label: '物品规格',
},
{
prop: 'goodsBatch',
label: '物品批次',
},
{
prop: 'num',
label: '出入库数量',
},
{
prop: 'operateStatus',
label: '操作状态',
filter: publicFormatter('warehouse_operate_status'),
},
{
prop: 'operateTime',
label: '操作时间',
filter: parseTime,
width: 150,
},
{
prop: 'operator',
label: '操作人',
},
];
export default {
mixins: [basicPage,tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getWarehouseRealtimeHisPage,
},
tableData: [],
tableProps,
drawerVisible: false,
formConfig: [
{
type: 'select',
label: '物品名称',
selectOptions: [],
param: 'goodsId',
defaultSelect: '',
filterable: true,
},
{
type: 'input',
label: '操作人',
placeholder: '操作人',
param: 'operator',
},
{
type: 'select',
label: '操作状态',
selectOptions: [],
param: 'status',
defaultSelect: '',
filterable: true,
labelField: 'label',
valueField: 'value',
},
{
type: 'datePicker',
label: '操作时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
};
},
components: {
},
created() {
const queryParams = {
pageNo: 1,
pageSize: 99,
dictType: 'warehouse_operate_status',
};
listData(queryParams).then((response) => {
this.formConfig[2].selectOptions = response.data.list;
});
getMaterialList().then((response) => {
this.formConfig[0].selectOptions = response.data;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.goodsId = val.goodsId;
this.listQuery.operator = val.operator;
this.listQuery.operateStatus = val.status;
this.listQuery.operateTime = val.searchTime?val.searchTime:null;
this.getDataList();
break;
default:
console.log(val);
}
},
},
};
</script>
<style>
.app-container .el-table .el-table__cell {
padding: 0;
height: 35px;
}
</style>

View File

@@ -0,0 +1,79 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2023-11-23 16:09:47
* @Description:
-->
<template>
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:height="300"
:table-data="tableData"
v-if="tableData.length" />
<!-- 没有数据 -->
<div class="no-data-bg" v-else></div>
</template>
<script>
import { parseTime } from '../../mixins/code-filter';
import { getWarehouseLocationHisDet } from '@/api/warehouse/warehouseRealtimeLocation';
const tableProps = [
{
prop: 'name',
label: '物品名称',
},
{
prop: 'code',
label: '物品编码',
},
{
prop: 'spec',
label: '物品规格',
},
{
prop: 'batchCode',
label: '物品批次',
},
{
prop: 'num',
label: '数量',
},
{
prop: 'allowTime',
label: '允许留存时长(天)',
width: 150
},
{
prop: 'remark',
label: '备注',
},
];
export default {
data() {
return {
tableData: [],
tableProps,
listQuery: {
pageSize: 100,
pageNo: 1,
total: 1,
},
dataListLoading: false,
};
},
methods: {
// 获取数据列表
init(id) {
this.dataListLoading = true;
getWarehouseLocationHisDet(id).then((response) => {
this.tableData = response.data;
this.dataListLoading = false;
});
},
},
};
</script>

View File

@@ -0,0 +1,219 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="100"
label="库位详情"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
<slot name="footer">
<el-row slot="footer" type="flex" justify="end">
<el-col :span="24">
<el-button size="small" class="btnTextStyle" @click="handleCancel">
取消
</el-button>
</el-col>
</el-row>
</slot>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import {
getWarehouseLocationHisPage,
} from '@/api/warehouse/warehouseRealtimeLocation';
import { listData } from '@/api/system/dict/data';
import { publicFormatter } from '@/utils/dict';
const tableProps = [
{
prop: 'warehouseName',
label: '仓库名称',
},
{
prop: 'name',
label: '库区名称',
},
{
prop: 'code',
label: '库位编码',
},
{
prop: 'type',
label: '库位类型',
filter: publicFormatter('location_type'),
},
{
prop: 'palletCode',
label: '托盘编码',
},
{
prop: 'palletCode',
label: '物品名称',
},
{
prop: 'operateStatus',
label: '操作状态',
filter: publicFormatter('warehouse_operate_status'),
},
{
prop: 'createTime',
label: '操作时间',
filter: parseTime,
minWidth: 100,
},
{
prop: 'creator',
label: '操作人',
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getWarehouseLocationHisPage,
},
listQuery: {
storageType: 1,
},
tableData: [],
tableProps,
tableBtn: [
this.$auth.hasPermi(`raw-material:warehouse-location-his:query`)
? {
type: 'detail',
btnName: '详情',
}
: undefined,
].filter((v) => v),
drawerVisible: false,
formConfig: [
{
type: 'input',
label: '库位编码',
placeholder: '库位编码',
param: 'kcode',
},
{
type: 'input',
label: '托盘编码',
placeholder: '托盘编码',
param: 'tcode',
},
{
type: 'select',
label: '操作状态',
selectOptions: [],
param: 'status',
defaultSelect: '',
filterable: true,
labelField: 'label',
valueField: 'value',
},
{
type: 'datePicker',
label: '操作时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
};
},
components: {
AddOrUpdate,
},
created() {
const queryParams = {
pageNo: 1,
pageSize: 99,
dictType: 'warehouse_operate_status',
};
listData(queryParams).then((response) => {
this.formConfig[2].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.locationCode= val.kcode;
this.listQuery.palletCode = val.tcode;
this.listQuery.operateStatus = val.status;
this.listQuery.createTime = val.searchTime?val.searchTime:null;
this.getDataList();
break;
default:
console.log(val);
}
},
otherMethods(val) {
if (val.type === 'detail') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = val.data.name + ' -产品信息';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
}
},
handleCancel() {
this.addOrUpdateVisible = false;
this.addOrEditTitle = '';
},
},
};
</script>
<style>
.app-container .el-table .el-table__cell {
padding: 0;
height: 35px;
}
</style>

View File

@@ -0,0 +1,118 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-08-09 17:00:46
* @Description:
-->
<template>
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:height="300"
:table-data="tableData"
v-if="tableData.length > 1" />
<!-- 一条数据 -->
<div v-else-if="tableData.length === 1">
<el-form
:model="tableData[0]"
ref="dataForm"
label-width="100px"
label-position="top">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="物品名称" prop="name">
<el-input v-model="tableData[0].name" readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品编码" prop="code">
<el-input v-model="tableData[0].code" readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品规格" prop="specifications">
<el-input v-model="tableData[0].specifications" readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品批次" prop="batchCode">
<el-input v-model="tableData[0].batchCode" readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数量" prop="num">
<el-input v-model="tableData[0].num" readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品单位" prop="name">
<el-input v-model="tableData[0].name" readonly />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<!-- 没有数据 -->
<div class="no-data-bg" v-else></div>
</template>
<script>
import { publicFormatter } from '@/utils/dict';
import { getWarehouseLocationHisDet } from '@/api/warehouse/warehouseRealtimeLocation';
const tableProps = [
{
prop: 'name',
label: '物品名称',
},
{
prop: 'code',
label: '物品编码',
width: 160,
},
{
prop: 'specifications',
label: '物品规格',
},
{
prop: 'batchCode',
label: '物品批次',
},
{
prop: 'num',
label: '数量',
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict'),
width: 60,
},
];
export default {
data() {
return {
tableData: [],
tableProps,
listQuery: {
pageSize: 100,
pageNo: 1,
total: 1,
},
dataListLoading: false,
};
},
methods: {
// 获取数据列表
init(id) {
this.dataListLoading = true;
getWarehouseLocationHisDet(id).then((response) => {
this.tableData = response.data;
this.dataListLoading = false;
});
},
},
};
</script>

View File

@@ -0,0 +1,203 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="100"
label="库位详情"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
<slot name="footer">
<el-row slot="footer" type="flex" justify="end">
<el-col :span="24">
<el-button size="small" class="btnTextStyle" @click="handleCancel">
取消
</el-button>
</el-col>
</el-row>
</slot>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import {
getMoveHisPage,
} from '@/api/warehouse/warehouseRealtimeLocation';
import { publicFormatter } from '@/utils/dict';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'oldWarehouseName',
label: '源仓库名称',
},
{
prop: 'oldWarehouseAreaName',
label: '源库区名称',
},
{
prop: 'oldCode',
label: '源库位编码',
},
{
prop: 'palletCode',
label: '移动托盘编码',
},
{
prop: 'goodName',
label: '物品名称',
filter: (val) => (val ? val.join(',') : '-'),
},
{
prop: 'newWarehouseName',
label: '目的仓库',
},
{
prop: 'newWarehouseAreaName',
label: '目的库区',
},
{
prop: 'newCode',
label: '目的库位编码',
width: 150,
},
{
prop: 'createTime',
label: '操作时间',
filter: parseTime,
width: 150,
},
{
prop: 'creator',
label: '操作人',
},
];
export default {
mixins: [basicPage,tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getMoveHisPage,
},
tableData: [],
tableProps,
tableBtn: [
this.$auth.hasPermi(`raw-material:warehouse-location-his:query`)
? {
type: 'detail',
btnName: '详情',
}
: undefined,
].filter((v) => v),
drawerVisible: false,
formConfig: [
{
type: 'input',
label: '库位编码',
placeholder: '库位编码',
param: 'kcode',
},
{
type: 'input',
label: '托盘编码',
placeholder: '托盘编码',
param: 'tcode',
},
{
type: 'datePicker',
label: '操作时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
};
},
components: {
AddOrUpdate,
},
created() {
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.locationCode = val.kcode;
this.listQuery.palletCode = val.tcode;
this.listQuery.operateStatus = val.status;
this.listQuery.createTime = val.searchTime?val.searchTime:null;
this.getDataList();
break;
default:
console.log(val);
}
},
otherMethods(val) {
if (val.type === 'detail') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
}
},
handleCancel() {
this.addOrUpdateVisible = false;
this.addOrEditTitle = '';
},
},
};
</script>
<style>
.app-container .el-table .el-table__cell {
padding: 0;
height: 35px;
}
</style>

View File

@@ -0,0 +1,178 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
</div>
</template>
<script>
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import {
getWarehouseRealtimeHisPage,
} from '@/api/warehouse/warehouseRealtime';
import { getMaterialList } from '@/api/base/material';
import tableHeightMixin from '@/mixins/tableHeightMixin';
import { listData } from '@/api/system/dict/data';
import { publicFormatter } from '@/utils/dict';
const tableProps = [
{
prop: 'warehouseName',
label: '仓库名称',
},
{
prop: 'warehouseAreaName',
label: '库区名称',
},
{
prop: 'name',
label: '物品名称',
},
{
prop: 'code',
label: '物品编码',
},
{
prop: 'spec',
label: '物品规格',
},
{
prop: 'goodsBatch',
label: '物品批次',
},
{
prop: 'num',
label: '出入库数量',
},
{
prop: 'operateStatus',
label: '操作状态',
filter: publicFormatter('warehouse_operate_status'),
},
{
prop: 'operateTime',
label: '操作时间',
filter: parseTime,
width: 150,
},
{
prop: 'operator',
label: '操作人',
},
];
export default {
mixins: [basicPage,tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getWarehouseRealtimeHisPage,
},
tableData: [],
tableProps,
drawerVisible: false,
formConfig: [
{
type: 'select',
label: '物品名称',
selectOptions: [],
param: 'goodsId',
defaultSelect: '',
filterable: true,
},
{
type: 'input',
label: '操作人',
placeholder: '操作人',
param: 'operator',
},
{
type: 'select',
label: '操作状态',
selectOptions: [],
param: 'status',
defaultSelect: '',
filterable: true,
labelField: 'label',
valueField: 'value',
},
{
type: 'datePicker',
label: '操作时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
};
},
components: {
},
created() {
const queryParams = {
pageNo: 1,
pageSize: 99,
dictType: 'warehouse_operate_status',
};
listData(queryParams).then((response) => {
this.formConfig[2].selectOptions = response.data.list;
});
getMaterialList().then((response) => {
this.formConfig[0].selectOptions = response.data;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.goodsId = val.goodsId;
this.listQuery.operator = val.operator;
this.listQuery.operateStatus = val.status;
this.listQuery.operateTime = val.searchTime?val.searchTime:null;
this.getDataList();
break;
default:
console.log(val);
}
},
},
};
</script>
<style>
.app-container .el-table .el-table__cell {
padding: 0;
height: 35px;
}
</style>

View File

@@ -0,0 +1,129 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-08-09 16:59:34
* @Description:
-->
<template>
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:height="300"
:table-data="tableData"
v-if="tableData.length > 1" />
<div v-else-if="tableData.length === 1">
<el-form
:model="tableData[0]"
ref="dataForm"
label-width="100px"
label-position="top">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="物品名称" prop="name">
<el-input
v-model="tableData[0].name"
readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品编码" prop="code">
<el-input
v-model="tableData[0].code"
readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品规格" prop="specifications">
<el-input
v-model="tableData[0].specifications"
readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品批次" prop="batchCode">
<el-input
v-model="tableData[0].batchCode"
readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数量" prop="num">
<el-input
v-model="tableData[0].num"
readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品单位" prop="name">
<el-input
v-model="tableData[0].name"
readonly />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<!-- 没有数据 -->
<div class="no-data-bg" v-else></div>
</template>
<script>
import { publicFormatter } from '@/utils/dict';
import { getWarehouseLocationHisDet } from '@/api/warehouse/warehouseRealtimeLocation';
const tableProps = [
{
prop: 'name',
label: '物品名称',
},
{
prop: 'code',
label: '物品编码',
width: 160,
},
{
prop: 'specifications',
label: '物品规格',
},
{
prop: 'batchCode',
label: '物品批次',
},
{
prop: 'num',
label: '数量',
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict'),
width: 60,
},
];
export default {
data() {
return {
tableData: [],
tableProps,
listQuery: {
pageSize: 100,
pageNo: 1,
total: 1,
},
dataListLoading: false,
};
},
methods: {
// 获取数据列表
init(id) {
this.dataListLoading = true;
getWarehouseLocationHisDet(id).then((response) => {
this.tableData = response.data;
this.dataListLoading = false;
});
},
},
};
</script>

View File

@@ -0,0 +1,219 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="100"
label="库位详情"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
<slot name="footer">
<el-row slot="footer" type="flex" justify="end">
<el-col :span="24">
<el-button size="small" class="btnTextStyle" @click="handleCancel">
取消
</el-button>
</el-col>
</el-row>
</slot>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import {
getWarehouseLocationHisPage,
} from '@/api/warehouse/warehouseRealtimeLocation';
import { listData } from '@/api/system/dict/data';
import { publicFormatter } from '@/utils/dict';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'warehouseName',
label: '仓库名称',
},
{
prop: 'warehouseAreaName',
label: '库区名称',
},
{
prop: 'code',
label: '库位编码',
},
{
prop: 'type',
label: '库位类型',
filter: publicFormatter('location_type'),
},
{
prop: 'palletCode',
label: '托盘编码',
},
{
prop: 'goodName',
label: '物品名称',
filter: (val) => (val ? val.join(',') : '-'),
},
{
prop: 'operateStatus',
label: '操作状态',
filter: publicFormatter('warehouse_operate_status'),
},
{
prop: 'createTime',
label: '操作时间',
filter: parseTime,
width: 150,
},
{
prop: 'creator',
label: '操作人',
},
];
export default {
mixins: [basicPage,tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getWarehouseLocationHisPage,
},
tableData: [],
tableProps,
tableBtn: [
this.$auth.hasPermi(`raw-material:warehouse-location-his:query`)
? {
type: 'detail',
btnName: '详情',
}
: undefined,
].filter((v) => v),
drawerVisible: false,
formConfig: [
{
type: 'input',
label: '库位编码',
placeholder: '库位编码',
param: 'kcode',
},
{
type: 'input',
label: '托盘编码',
placeholder: '托盘编码',
param: 'tcode',
},
{
type: 'select',
label: '操作状态',
selectOptions: [],
param: 'status',
defaultSelect: '',
filterable: true,
labelField: 'label',
valueField: 'value',
},
{
type: 'datePicker',
label: '操作时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
};
},
components: {
AddOrUpdate,
},
created() {
const queryParams = {
pageNo: 1,
pageSize: 99,
dictType: 'warehouse_operate_status',
};
listData(queryParams).then((response) => {
this.formConfig[2].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.locationCode= val.kcode;
this.listQuery.palletCode = val.tcode;
this.listQuery.operateStatus = val.status;
this.listQuery.createTime = val.searchTime?val.searchTime:null;
this.getDataList();
break;
default:
console.log(val);
}
},
otherMethods(val) {
if (val.type === 'detail') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
}
},
handleCancel() {
this.addOrUpdateVisible = false;
this.addOrEditTitle = '';
},
},
};
</script>
<style>
.app-container .el-table .el-table__cell {
padding: 0;
height: 35px;
}
</style>