Compare commits
33 Commits
0fca3e1ec4
...
4350bafa23
Author | SHA1 | Date | |
---|---|---|---|
4350bafa23 | |||
a49db190e3 | |||
ecfed2eddf | |||
6b988bbaf7 | |||
4d0c0ae91a | |||
7c665484a7 | |||
1299ebd0c9 | |||
78777d5d24 | |||
c357ab8005 | |||
73831ea8cf | |||
3d1bc2cc98 | |||
01f459e811 | |||
a402a8bf63 | |||
d3760f5dee | |||
006e94a865 | |||
b6e4767346 | |||
77688fed77 | |||
969a5303a8 | |||
0719116cbc | |||
6d4f44fd68 | |||
30e8548a0d | |||
63931b883c | |||
6fdc9b2826 | |||
443ca29d3f | |||
b281df661b | |||
50517c4244 | |||
3efb35d31d | |||
6b9f7d7b9c | |||
f4662a33b9 | |||
1c64bafdf8 | |||
f5accd1f61 | |||
797dc1e029 | |||
b6dd73370d |
2
.env.dev
2
.env.dev
@ -5,7 +5,7 @@ ENV = 'development'
|
||||
VUE_APP_TITLE = 芋道管理系统
|
||||
|
||||
# 芋道管理系统/开发环境
|
||||
VUE_APP_BASE_API = 'http://192.168.1.8:48080'
|
||||
VUE_APP_BASE_API = 'http://192.168.0.33:48080'
|
||||
|
||||
# 路由懒加载
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
@ -47,6 +47,7 @@
|
||||
"benz-amr-recorder": "^1.1.5",
|
||||
"bpmn-js-token-simulation": "0.10.0",
|
||||
"clipboard": "2.0.8",
|
||||
"code-brick-zj": "^1.0.2",
|
||||
"core-js": "^3.26.0",
|
||||
"crypto-js": "^4.0.0",
|
||||
"echarts": "5.4.0",
|
||||
@ -57,6 +58,7 @@
|
||||
"js-beautify": "1.13.0",
|
||||
"jsencrypt": "3.3.1",
|
||||
"min-dash": "3.5.2",
|
||||
"moment": "^2.29.4",
|
||||
"nprogress": "0.2.0",
|
||||
"qrcode.vue": "^1.7.0",
|
||||
"quill": "1.3.7",
|
||||
|
62
src/api/base/groupClasses.js
Normal file
62
src/api/base/groupClasses.js
Normal file
@ -0,0 +1,62 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 创建班次基础信息
|
||||
export function createGroupClasses(data) {
|
||||
return request({
|
||||
url: '/base/group-classes/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新班次基础信息
|
||||
export function updateGroupClasses(data) {
|
||||
return request({
|
||||
url: '/base/group-classes/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除班次基础信息
|
||||
export function deleteGroupClasses(id) {
|
||||
return request({
|
||||
url: '/base/group-classes/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得班次基础信息
|
||||
export function getGroupClasses(id) {
|
||||
return request({
|
||||
url: '/base/group-classes/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得班次基础信息分页
|
||||
export function getGroupClassesPage(query) {
|
||||
return request({
|
||||
url: '/base/group-classes/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 获取班组code
|
||||
export function getCode() {
|
||||
return request({
|
||||
url: '/base/group-classes/getCode',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出班次基础信息 Excel
|
||||
export function exportGroupClassesExcel(query) {
|
||||
return request({
|
||||
url: '/base/group-classes/export-excel',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
52
src/api/base/groupTeam.js
Normal file
52
src/api/base/groupTeam.js
Normal file
@ -0,0 +1,52 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 创建班组基础信息
|
||||
export function createGroupTeam(data) {
|
||||
return request({
|
||||
url: '/base/group-team/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新班组基础信息
|
||||
export function updateGroupTeam(data) {
|
||||
return request({
|
||||
url: '/base/group-team/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除班组基础信息
|
||||
export function deleteGroupTeam(id) {
|
||||
return request({
|
||||
url: '/base/group-team/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得班组基础信息
|
||||
export function getGroupTeam(id) {
|
||||
return request({
|
||||
url: '/base/group-team/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得班组基础信息分页
|
||||
export function getGroupTeamPage(query) {
|
||||
return request({
|
||||
url: '/base/group-team/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 获取班组code
|
||||
export function getCode() {
|
||||
return request({
|
||||
url: '/base/group-team/getCode',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
54
src/api/base/groupTeamScheduling.js
Normal file
54
src/api/base/groupTeamScheduling.js
Normal file
@ -0,0 +1,54 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 创建排班信息
|
||||
export function createGroupTeamScheduling(data) {
|
||||
return request({
|
||||
url: '/base/group-team-scheduling/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新排班信息
|
||||
export function updateGroupTeamScheduling(data) {
|
||||
return request({
|
||||
url: '/base/group-team-scheduling/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除排班信息
|
||||
export function deleteGroupTeamScheduling(id) {
|
||||
return request({
|
||||
url: '/base/group-team-scheduling/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得排班信息
|
||||
export function getGroupTeamScheduling(id) {
|
||||
return request({
|
||||
url: '/base/group-team-scheduling/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得排班信息分页
|
||||
export function getGroupTeamSchedulingPage(query) {
|
||||
return request({
|
||||
url: '/base/group-team-scheduling/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 导出排班信息 Excel
|
||||
export function exportGroupTeamSchedulingExcel(query) {
|
||||
return request({
|
||||
url: '/base/group-team-scheduling/export-excel',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
54
src/api/base/qualityInspectionBoxBtn.js
Normal file
54
src/api/base/qualityInspectionBoxBtn.js
Normal file
@ -0,0 +1,54 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 创建安灯按钮16键对应
|
||||
export function createQualityInspectionBoxBtn(data) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-box-btn/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新安灯按钮16键对应
|
||||
export function updateQualityInspectionBoxBtn(data) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-box-btn/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除安灯按钮16键对应
|
||||
export function deleteQualityInspectionBoxBtn(id) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-box-btn/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得安灯按钮16键对应
|
||||
export function getQualityInspectionBoxBtn(id) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-box-btn/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得安灯按钮16键对应分页
|
||||
export function getQualityInspectionBoxBtnPage(query) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-box-btn/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 导出安灯按钮16键对应 Excel
|
||||
export function exportQualityInspectionBoxBtnExcel(query) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-box-btn/export-excel',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
54
src/api/base/qualityInspectionDet.js
Normal file
54
src/api/base/qualityInspectionDet.js
Normal file
@ -0,0 +1,54 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 创建质量检测信息基础
|
||||
export function createQualityInspectionDet(data) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-det/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新质量检测信息基础
|
||||
export function updateQualityInspectionDet(data) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-det/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除质量检测信息基础
|
||||
export function deleteQualityInspectionDet(id) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-det/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得质量检测信息基础
|
||||
export function getQualityInspectionDet(id) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-det/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得质量检测信息基础分页
|
||||
export function getQualityInspectionDetPage(query) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-det/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 导出质量检测信息基础 Excel
|
||||
export function exportQualityInspectionDetExcel(query) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-det/export-excel',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
54
src/api/base/qualityInspectionType.js
Normal file
54
src/api/base/qualityInspectionType.js
Normal file
@ -0,0 +1,54 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 创建质量检测类型基础
|
||||
export function createQualityInspectionType(data) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-type/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新质量检测类型基础
|
||||
export function updateQualityInspectionType(data) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-type/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除质量检测类型基础
|
||||
export function deleteQualityInspectionType(id) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-type/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得质量检测类型基础
|
||||
export function getQualityInspectionType(id) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-type/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得质量检测类型基础分页
|
||||
export function getQualityInspectionTypePage(query) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-type/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 导出质量检测类型基础 Excel
|
||||
export function exportQualityInspectionTypeExcel(query) {
|
||||
return request({
|
||||
url: '/base/quality-inspection-type/export-excel',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
@ -33,7 +33,13 @@ export function getFactory(id) {
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得工厂code
|
||||
export function getCode() {
|
||||
return request({
|
||||
url: '/base/factory/getCode',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
// 获得工厂分页
|
||||
export function getFactoryPage(query) {
|
||||
return request({
|
||||
|
@ -8,7 +8,14 @@ export function createLineBindProduct(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 切换产品
|
||||
export function switchLineBindProduct(data) {
|
||||
return request({
|
||||
url: '/base/line-bind-product/switch',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 更新产线目前生产产品表 主要为更新
|
||||
export function updateLineBindProduct(data) {
|
||||
return request({
|
||||
|
@ -9,6 +9,13 @@ export function createProduct(data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 获得产品code
|
||||
export function getCode() {
|
||||
return request({
|
||||
url: '/base/product/getCode',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
// 更新产品
|
||||
export function updateProduct(data) {
|
||||
return request({
|
||||
|
@ -8,6 +8,13 @@ export function createProductionLine(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 获得产线code
|
||||
export function getCode() {
|
||||
return request({
|
||||
url: '/base/production-line/getCode',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 更新工厂产线
|
||||
export function updateProductionLine(data) {
|
||||
|
@ -9,6 +9,13 @@ export function createWorkshopSection(data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 获得工段code
|
||||
export function getCode() {
|
||||
return request({
|
||||
url: '/base/workshop-section/getCode',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
// 更新产线工段
|
||||
export function updateWorkshopSection(data) {
|
||||
return request({
|
||||
|
@ -121,7 +121,7 @@ aside {
|
||||
|
||||
//main-container全局样式
|
||||
.app-container {
|
||||
padding: 20px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.components-container {
|
||||
@ -129,10 +129,6 @@ aside {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center
|
||||
}
|
||||
|
@ -112,13 +112,13 @@
|
||||
}
|
||||
|
||||
/** 表格布局 **/
|
||||
.pagination-container {
|
||||
position: relative;
|
||||
height: 25px;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 15px;
|
||||
padding: 10px 20px !important;
|
||||
}
|
||||
// .pagination-container {
|
||||
// position: relative;
|
||||
// height: 25px;
|
||||
// margin-bottom: 10px;
|
||||
// margin-top: 15px;
|
||||
// padding: 10px 20px !important;
|
||||
// }
|
||||
|
||||
/* tree border */
|
||||
.tree-border {
|
||||
|
@ -105,6 +105,10 @@
|
||||
background-color: $base-sub-menu-hover !important;
|
||||
}
|
||||
}
|
||||
|
||||
& .theme-dark .el-submenu .el-menu-item.is-active {
|
||||
background-color: #0b50ff !important;
|
||||
}
|
||||
}
|
||||
|
||||
.hideSidebar {
|
||||
|
@ -9,20 +9,20 @@ $yellow:#FEC171;
|
||||
$panGreen: #30B08F;
|
||||
|
||||
// 默认菜单主题风格
|
||||
$base-menu-color:#bfcbd9;
|
||||
$base-menu-color-active:#f4f4f5;
|
||||
$base-menu-background:#304156;
|
||||
$base-logo-title-color: #ffffff;
|
||||
// $base-menu-color:#bfcbd9;
|
||||
// $base-menu-color-active:#f4f4f5;
|
||||
// $base-menu-background:#304156;
|
||||
// $base-logo-title-color: #ffffff;
|
||||
|
||||
$base-menu-light-color:rgba(0,0,0,.70);
|
||||
$base-menu-light-background:#ffffff;
|
||||
$base-logo-light-title-color: #001529;
|
||||
// $base-menu-light-color:rgba(0,0,0,.70);
|
||||
// $base-menu-light-background:#ffffff;
|
||||
// $base-logo-light-title-color: #001529;
|
||||
|
||||
$base-sub-menu-background:#1f2d3d;
|
||||
$base-sub-menu-hover:#001528;
|
||||
// $base-sub-menu-background:#1f2d3d;
|
||||
// $base-sub-menu-hover:#001528;
|
||||
|
||||
// 自定义暗色菜单风格
|
||||
/**
|
||||
/*
|
||||
$base-menu-color:hsla(0,0%,100%,.65);
|
||||
$base-menu-color-active:#fff;
|
||||
$base-menu-background:#001529;
|
||||
@ -35,8 +35,20 @@ $base-logo-light-title-color: #001529;
|
||||
$base-sub-menu-background:#000c17;
|
||||
$base-sub-menu-hover:#001528;
|
||||
*/
|
||||
$base-menu-color: #fff;
|
||||
$base-menu-color-active:#fff;
|
||||
$base-menu-background:#001529;
|
||||
$base-logo-title-color: #ffffff;
|
||||
|
||||
$base-sidebar-width: 280px;
|
||||
$base-menu-light-color:rgba(0,0,0,.70);
|
||||
$base-menu-light-background:#ffffff;
|
||||
$base-logo-light-title-color: #001529;
|
||||
|
||||
$base-sub-menu-background:#0B253F;
|
||||
$base-sub-menu-hover:#0b50ff;
|
||||
|
||||
|
||||
$base-sidebar-width: 248px;
|
||||
|
||||
// the :export directive is the magic sauce for webpack
|
||||
// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass
|
||||
|
@ -68,8 +68,12 @@ export default {
|
||||
margin-left: 8px;
|
||||
|
||||
.no-redirect {
|
||||
color: #97a8be;
|
||||
color: rgba(0, 0, 0, 0.65);
|
||||
cursor: text;
|
||||
}
|
||||
}
|
||||
|
||||
.app-breadcrumb .el-breadcrumb__inner a, .el-breadcrumb__inner.is-link {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
</style>
|
||||
|
@ -28,11 +28,14 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-main {
|
||||
/* 50= navbar 50 */
|
||||
/* 48= navbar 48 */
|
||||
min-height: calc(100vh - 56px);
|
||||
width: 100%;
|
||||
min-width: calc(100vh - 280px);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin: 8px 14px 0px 16px;
|
||||
border-radius: 8px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.fixed-header + .app-main {
|
||||
@ -41,8 +44,8 @@ export default {
|
||||
|
||||
.hasTagsView {
|
||||
.app-main {
|
||||
/* 84 = navbar + tags-view = 56 + 34 */
|
||||
min-height: calc(100vh - 128px);
|
||||
/* 84 = navbar + tags-view = 50 + 34 */
|
||||
min-height: calc(100vh - 120px - 8px);
|
||||
}
|
||||
|
||||
.fixed-header + .app-main {
|
||||
|
@ -7,16 +7,16 @@
|
||||
|
||||
<div class="right-menu">
|
||||
<template v-if="device!=='mobile'">
|
||||
<search id="header-search" class="right-menu-item" />
|
||||
<!-- <search id="header-search" class="right-menu-item" /> -->
|
||||
|
||||
<!-- 站内信 -->
|
||||
<!-- <notify-message class="right-menu-item hover-effect" /> -->
|
||||
|
||||
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
||||
<!-- <screenfull id="screenfull" class="right-menu-item hover-effect" /> -->
|
||||
|
||||
<el-tooltip content="布局大小" effect="dark" placement="bottom">
|
||||
<!-- <el-tooltip content="布局大小" effect="dark" placement="bottom">
|
||||
<size-select id="size-select" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
</el-tooltip> -->
|
||||
|
||||
</template>
|
||||
|
||||
@ -30,9 +30,9 @@
|
||||
<router-link to="/user/profile">
|
||||
<el-dropdown-item>个人中心</el-dropdown-item>
|
||||
</router-link>
|
||||
<el-dropdown-item @click.native="setting = true">
|
||||
<!-- <el-dropdown-item @click.native="setting = true">
|
||||
<span>布局设置</span>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-item> -->
|
||||
<el-dropdown-item divided @click.native="logout">
|
||||
<span>退出登录</span>
|
||||
</el-dropdown-item>
|
||||
@ -104,7 +104,7 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.navbar {
|
||||
height: 56px;
|
||||
height: 48px; // 56
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #fff;
|
||||
|
@ -23,7 +23,7 @@
|
||||
: variables.menuLightColor
|
||||
"
|
||||
:unique-opened="true"
|
||||
:active-text-color="settings.theme"
|
||||
active-text-color="#fff"
|
||||
:collapse-transition="false"
|
||||
mode="vertical">
|
||||
<!-- 根据 sidebarRouters 路由,生成菜单 -->
|
||||
|
@ -78,8 +78,8 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.scroll-container {
|
||||
background: #f9f9f9;
|
||||
box-shadow: inset 0 0 8px 1px #e8e8e8;
|
||||
// background: #f9f9f9;
|
||||
// box-shadow: inset 0 0 8px 1px #e8e8e8;
|
||||
white-space: nowrap;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
@ -259,7 +259,7 @@ export default {
|
||||
height: 42px;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #d8dce5;
|
||||
// border-bottom: 1px solid #d8dce5;
|
||||
border-top: 1px solid #d8dce5;
|
||||
|
||||
// box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
|
||||
@ -270,17 +270,16 @@ export default {
|
||||
cursor: pointer;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
border: 1px solid #d8dce5;
|
||||
color: #495060;
|
||||
background: #fff;
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
background: #F4F4F4FF;
|
||||
padding: 0 8px 0 12px;
|
||||
font-size: 14px;
|
||||
letter-spacing: 1px;
|
||||
margin-left: 4px;
|
||||
border-radius: 0;
|
||||
margin-left: 8px;
|
||||
border-radius: 4px;
|
||||
|
||||
&:first-of-type {
|
||||
margin-left: 15px;
|
||||
margin-left: 32px;
|
||||
padding-right: 12px;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
<tags-view v-if="needTagsView" />
|
||||
</div>
|
||||
<app-main />
|
||||
<div class="main-footer" style="color: #777; border-top: 1px solid #eee; user-select: none; font-size: 14px; letter-spacing: 1px; height: 30px; display: grid; place-content: center;">© 中建材智能自动化院 2023</div>
|
||||
<div class="main-footer" style="color: #C7C7C7; user-select: none; font-size: 14px; letter-spacing: 1px; height: 30px; display: grid; place-content: center;">© 中建材智能自动化研究院有限公司</div>
|
||||
<right-panel>
|
||||
<settings />
|
||||
</right-panel>
|
||||
|
141
src/main.js
141
src/main.js
@ -1,80 +1,97 @@
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
|
||||
import Element from 'element-ui'
|
||||
import './assets/styles/element-variables.scss'
|
||||
import Element from 'element-ui';
|
||||
import './assets/styles/element-variables.scss';
|
||||
import '@/assets/styles/index.scss'; // global css
|
||||
import '@/assets/styles/ruoyi.scss'; // ruoyi css
|
||||
import App from './App';
|
||||
import store from './store';
|
||||
import router from './router';
|
||||
import directive from './directive'; // directive
|
||||
import plugins from './plugins'; // plugins
|
||||
|
||||
import '@/assets/styles/index.scss' // global css
|
||||
import '@/assets/styles/ruoyi.scss' // ruoyi css
|
||||
import App from './App'
|
||||
import store from './store'
|
||||
import router from './router'
|
||||
import directive from './directive' // directive
|
||||
import plugins from './plugins' // plugins
|
||||
|
||||
import './assets/icons' // icon
|
||||
import './permission' // permission control
|
||||
import './assets/icons'; // icon
|
||||
import './permission'; // permission control
|
||||
// import './tongji' // 百度统计
|
||||
import { getDicts } from "@/api/system/dict/data";
|
||||
import { getConfigKey } from "@/api/infra/config";
|
||||
import { parseTime, resetForm, handleTree, addBeginAndEndTime, divide} from "@/utils/ruoyi";
|
||||
import Pagination from "@/components/Pagination";
|
||||
import { getDicts } from '@/api/system/dict/data';
|
||||
import { getConfigKey } from '@/api/infra/config';
|
||||
import {
|
||||
parseTime,
|
||||
resetForm,
|
||||
handleTree,
|
||||
addBeginAndEndTime,
|
||||
divide,
|
||||
} from '@/utils/ruoyi';
|
||||
import Pagination from '@/components/Pagination';
|
||||
// 自定义表格工具扩展
|
||||
import RightToolbar from "@/components/RightToolbar"
|
||||
import RightToolbar from '@/components/RightToolbar';
|
||||
// 代码高亮插件
|
||||
// import hljs from 'highlight.js'
|
||||
// import 'highlight.js/styles/github-gist.css'
|
||||
import {DICT_TYPE, getDictDataLabel, getDictDatas, getDictDatas2} from "@/utils/dict";
|
||||
import {
|
||||
DICT_TYPE,
|
||||
getDictDataLabel,
|
||||
getDictDatas,
|
||||
getDictDatas2,
|
||||
} from '@/utils/dict';
|
||||
|
||||
import './theme/index.css'; // 自定义主题包 - code-brick-zj
|
||||
|
||||
// 全局方法挂载
|
||||
Vue.prototype.getDicts = getDicts
|
||||
Vue.prototype.getConfigKey = getConfigKey
|
||||
Vue.prototype.parseTime = parseTime
|
||||
Vue.prototype.resetForm = resetForm
|
||||
Vue.prototype.getDictDatas = getDictDatas
|
||||
Vue.prototype.getDictDatas2 = getDictDatas2
|
||||
Vue.prototype.getDictDataLabel = getDictDataLabel
|
||||
Vue.prototype.DICT_TYPE = DICT_TYPE
|
||||
Vue.prototype.handleTree = handleTree
|
||||
Vue.prototype.addBeginAndEndTime = addBeginAndEndTime
|
||||
Vue.prototype.divide = divide
|
||||
Vue.prototype.getDicts = getDicts;
|
||||
Vue.prototype.getConfigKey = getConfigKey;
|
||||
Vue.prototype.parseTime = parseTime;
|
||||
Vue.prototype.resetForm = resetForm;
|
||||
Vue.prototype.getDictDatas = getDictDatas;
|
||||
Vue.prototype.getDictDatas2 = getDictDatas2;
|
||||
Vue.prototype.getDictDataLabel = getDictDataLabel;
|
||||
Vue.prototype.DICT_TYPE = DICT_TYPE;
|
||||
Vue.prototype.handleTree = handleTree;
|
||||
Vue.prototype.addBeginAndEndTime = addBeginAndEndTime;
|
||||
Vue.prototype.divide = divide;
|
||||
Vue.prototype.tableHeight = function(n) {
|
||||
return window.innerHeight - n
|
||||
}
|
||||
|
||||
// 全局组件挂载
|
||||
Vue.component('DictTag', DictTag)
|
||||
Vue.component('DocAlert', DocAlert)
|
||||
Vue.component('Pagination', Pagination)
|
||||
Vue.component('RightToolbar', RightToolbar)
|
||||
Vue.component('DictTag', DictTag);
|
||||
Vue.component('DocAlert', DocAlert);
|
||||
Vue.component('Pagination', Pagination);
|
||||
Vue.component('RightToolbar', RightToolbar);
|
||||
// 字典标签组件
|
||||
import DictTag from '@/components/DictTag'
|
||||
import DocAlert from '@/components/DocAlert'
|
||||
import DictTag from '@/components/DictTag';
|
||||
import DocAlert from '@/components/DocAlert';
|
||||
// 头部标签插件
|
||||
import VueMeta from 'vue-meta'
|
||||
import VueMeta from 'vue-meta';
|
||||
import CodeBrickZj from 'code-brick-zj';
|
||||
|
||||
Vue.use(directive)
|
||||
Vue.use(plugins)
|
||||
Vue.use(VueMeta)
|
||||
Vue.use(CodeBrickZj)
|
||||
Vue.use(directive);
|
||||
Vue.use(plugins);
|
||||
Vue.use(VueMeta);
|
||||
// Vue.use(hljs.vuePlugin);
|
||||
|
||||
// bpmnProcessDesigner 需要引入
|
||||
import MyPD from "@/components/bpmnProcessDesigner/package/index.js";
|
||||
import MyPD from '@/components/bpmnProcessDesigner/package/index.js';
|
||||
Vue.use(MyPD);
|
||||
import "@/components/bpmnProcessDesigner/package/theme/index.scss";
|
||||
import "bpmn-js/dist/assets/diagram-js.css";
|
||||
import "bpmn-js/dist/assets/bpmn-font/css/bpmn.css";
|
||||
import "bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css";
|
||||
import "bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css";
|
||||
import '@/components/bpmnProcessDesigner/package/theme/index.scss';
|
||||
import 'bpmn-js/dist/assets/diagram-js.css';
|
||||
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css';
|
||||
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css';
|
||||
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css';
|
||||
|
||||
// Form Generator 组件需要使用到 tinymce
|
||||
import Tinymce from '@/components/tinymce/index.vue'
|
||||
Vue.component('tinymce', Tinymce)
|
||||
import '@/assets/icons'
|
||||
import request from "@/utils/request" // 实现 form generator 使用自己定义的 axios request 对象
|
||||
console.log(request)
|
||||
Vue.prototype.$axios = request
|
||||
import '@/styles/index.scss'
|
||||
import Tinymce from '@/components/tinymce/index.vue';
|
||||
Vue.component('tinymce', Tinymce);
|
||||
import '@/assets/icons';
|
||||
import request from '@/utils/request'; // 实现 form generator 使用自己定义的 axios request 对象
|
||||
// console.log(request);
|
||||
Vue.prototype.$axios = request;
|
||||
import '@/styles/index.scss';
|
||||
|
||||
// 默认点击背景不关闭弹窗
|
||||
import ElementUI from 'element-ui'
|
||||
ElementUI.Dialog.props.closeOnClickModal.default = false
|
||||
import ElementUI from 'element-ui';
|
||||
ElementUI.Dialog.props.closeOnClickModal.default = false;
|
||||
|
||||
/**
|
||||
* If you don't want to use mock-server
|
||||
@ -86,14 +103,14 @@ ElementUI.Dialog.props.closeOnClickModal.default = false
|
||||
*/
|
||||
|
||||
Vue.use(Element, {
|
||||
size: localStorage.getItem("size") || "medium", // set element-ui default size
|
||||
size: localStorage.getItem('size') || 'medium', // set element-ui default size
|
||||
});
|
||||
|
||||
Vue.config.productionTip = false
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
router,
|
||||
store,
|
||||
render: h => h(App)
|
||||
})
|
||||
el: '#app',
|
||||
router,
|
||||
store,
|
||||
render: (h) => h(App),
|
||||
});
|
||||
|
@ -2,7 +2,7 @@ $editorTabsborderColor: #121315;
|
||||
body, html{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: #fff;
|
||||
background: #F2F4F9;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-rendering: optimizeLegibility;
|
||||
@ -138,4 +138,41 @@ input, textarea{
|
||||
}
|
||||
.el-upload__tip{
|
||||
line-height: 1.2;
|
||||
}
|
||||
// 滚动条
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track-piece {
|
||||
background-color:rgba(144,147,153,0);
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-corner {
|
||||
background-color:rgba(144,147,153,0);
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
width: 6px;
|
||||
background: rgba(144,147,153,0);
|
||||
-webkit-border-radius: 2em;
|
||||
-moz-border-radius: 2em;
|
||||
border-radius: 2em;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background-color: rgba(144,147,153,.5);
|
||||
background-clip: padding-box;
|
||||
min-height: 28px;
|
||||
-webkit-border-radius: 2em;
|
||||
-moz-border-radius: 2em;
|
||||
border-radius: 2em;
|
||||
transition: background-color .3s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background-color: rgba(144,147,153,.3);
|
||||
}
|
BIN
src/theme/fonts/element-icons.ttf
Normal file
BIN
src/theme/fonts/element-icons.ttf
Normal file
Binary file not shown.
BIN
src/theme/fonts/element-icons.woff
Normal file
BIN
src/theme/fonts/element-icons.woff
Normal file
Binary file not shown.
1
src/theme/index.css
Normal file
1
src/theme/index.css
Normal file
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
import axios from 'axios'
|
||||
import {Message, MessageBox, Notification} from 'element-ui'
|
||||
import {Message, MessageBox, Notification, Loading} from 'element-ui'
|
||||
import store from '@/store'
|
||||
import {getAccessToken, getRefreshToken, getTenantId, setToken} from '@/utils/auth'
|
||||
import errorCode from '@/utils/errorCode'
|
||||
@ -30,8 +30,44 @@ const service = axios.create({
|
||||
// 禁用 Cookie 等信息
|
||||
withCredentials: false,
|
||||
})
|
||||
|
||||
/*
|
||||
当页面有两个接口时,第一个接口loading的close事件会直接将第二个接口的loading实例也close
|
||||
每次创建Loading实例的时候判断当前是否存在,如果当前还没有Loading实例就创建一个,
|
||||
如果有就不会再创建而是计数;每次关闭的时候判断当前的计数,
|
||||
如果是0了就关闭,否则也计数减一,直到为0的时候表示当前所有页面所有接口都返回结束了,
|
||||
此时执行关闭Loading.close()操作
|
||||
*/
|
||||
|
||||
let loadingInstance = null
|
||||
function startLoading() {
|
||||
loadingInstance = Loading.service({
|
||||
fullscreen: false,
|
||||
text: '拼命加载中...',
|
||||
background: 'rgba(0, 0, 0, 0.1)'
|
||||
})
|
||||
}
|
||||
function endLoading() {
|
||||
loadingInstance.close()
|
||||
}
|
||||
let needLoadingRequestCount = 0
|
||||
function showFullScreenLoading() {
|
||||
if (needLoadingRequestCount === 0) {
|
||||
startLoading()
|
||||
}
|
||||
needLoadingRequestCount++
|
||||
}
|
||||
function tryHideFullScreenLoading() {
|
||||
if (needLoadingRequestCount <= 0) return
|
||||
needLoadingRequestCount--
|
||||
if (needLoadingRequestCount === 0) {
|
||||
endLoading()
|
||||
}
|
||||
}
|
||||
|
||||
// request拦截器
|
||||
service.interceptors.request.use(config => {
|
||||
showFullScreenLoading()
|
||||
// 是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getAccessToken() && !isToken) {
|
||||
@ -68,12 +104,14 @@ service.interceptors.request.use(config => {
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
tryHideFullScreenLoading()
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
})
|
||||
|
||||
// 响应拦截器
|
||||
service.interceptors.response.use(async res => {
|
||||
tryHideFullScreenLoading()
|
||||
// 未设置状态码则默认成功状态
|
||||
const code = res.data.code || 200;
|
||||
// 获取错误信息
|
||||
@ -151,6 +189,7 @@ service.interceptors.response.use(async res => {
|
||||
return res.data
|
||||
}
|
||||
}, error => {
|
||||
tryHideFullScreenLoading()
|
||||
console.log('err' + error)
|
||||
let {message} = error;
|
||||
if (message === "Network Error") {
|
||||
|
78
src/views/core/base/factory/add-or-updata.vue
Normal file
78
src/views/core/base/factory/add-or-updata.vue
Normal file
@ -0,0 +1,78 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2023-08-01 16:59:06
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-form
|
||||
:model="dataForm"
|
||||
:rules="dataRule"
|
||||
ref="dataForm"
|
||||
@keyup.enter.native="dataFormSubmit()"
|
||||
label-width="80px">
|
||||
<el-form-item label="工厂编码" prop="code">
|
||||
<el-input
|
||||
v-model="dataForm.code"
|
||||
clearable
|
||||
placeholder="请输入工厂编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工厂名称" prop="name">
|
||||
<el-input
|
||||
v-model="dataForm.name"
|
||||
clearable
|
||||
placeholder="请输入工厂名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地址" prop="address">
|
||||
<el-input v-model="dataForm.address" clearable placeholder="请输入地址" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="启用状态" prop="enabled">
|
||||
<el-select
|
||||
v-model="dataForm.enabled"
|
||||
placeholder="请选择启用状态">
|
||||
<el-option
|
||||
v-for="dict in this.getDictDatas(DICT_TYPE.INFRA_BOOLEAN_STRING)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<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 { createFactory, updateFactory, getFactory, getCode } from "@/api/core/base/factory";
|
||||
|
||||
export default {
|
||||
mixins: [basicAdd],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
isGetCode: true,
|
||||
codeURL: getCode,
|
||||
createURL: createFactory,
|
||||
updateURL: updateFactory,
|
||||
infoURL: getFactory,
|
||||
},
|
||||
dataForm: {
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
address: undefined,
|
||||
remark: undefined,
|
||||
},
|
||||
dataRule: {
|
||||
code: [{ required: true, message: "工厂编码不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: "工厂名称不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
};
|
||||
</script>
|
@ -1,258 +1,202 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="工厂编码" prop="code">
|
||||
<el-input v-model="queryParams.code" placeholder="请输入工厂编码" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工厂名称" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入工厂名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</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" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<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="['base:factory:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
||||
v-hasPermi="['base:factory:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="id" align="center" prop="id" />
|
||||
<el-table-column label="工厂编码" align="center" prop="code" />
|
||||
<el-table-column label="工厂名称" align="center" prop="name" />
|
||||
<el-table-column label="地址" align="center" prop="address" />
|
||||
<el-table-column label="描述" align="center" prop="description" />
|
||||
<el-table-column label="启用状态:0 、停用,1、启用" align="center" prop="enabled">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.enabled" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="版本号" align="center" prop="version" />
|
||||
<el-table-column label="外部系统编码" align="center" prop="externalCode" />
|
||||
<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="['base:factory:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['base:factory: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" v-dialogDrag append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="工厂编码" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入工厂编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工厂名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入工厂名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地址" prop="address">
|
||||
<el-input v-model="form.address" placeholder="请输入地址" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-select v-model="form.enabled" placeholder="请选择启用状态:0 、停用,1、启用">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.INFRA_BOOLEAN_STRING)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="form.version" placeholder="请输入版本号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="外部系统编码" prop="externalCode">
|
||||
<el-input v-model="form.externalCode" placeholder="请输入外部系统编码" />
|
||||
</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>
|
||||
</div>
|
||||
<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="70%">
|
||||
<add-or-update
|
||||
ref="addOrUpdate"
|
||||
@refreshDataList="successSubmit"></add-or-update>
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createFactory, updateFactory, deleteFactory, getFactory, getFactoryPage, exportFactoryExcel } from "@/api/core/base/factory";
|
||||
import AddOrUpdate from './add-or-updata';
|
||||
import basicPage from '../../mixins/basic-page';
|
||||
import { parseTime } from '../../mixins/code-filter';
|
||||
import {
|
||||
deleteFactory,
|
||||
getFactoryPage,
|
||||
exportFactoryExcel,
|
||||
} from '@/api/core/base/factory';
|
||||
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'code',
|
||||
label: '工厂编码',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '工厂名称',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'address',
|
||||
label: '地址',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
align: 'center',
|
||||
filter: parseTime,
|
||||
},
|
||||
];
|
||||
|
||||
export default {
|
||||
name: "Factory",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 工厂列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
code: null,
|
||||
name: null,
|
||||
createTime: [],
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
code: [{ required: true, message: "工厂编码不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: "工厂名称不能为空", trigger: "blur" }],
|
||||
enabled: [{ required: true, message: "启用状态:0 、停用,1、启用不能为空", trigger: "change" }],
|
||||
externalCode: [{ required: true, message: "外部系统编码不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getFactoryPage(this.queryParams).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
address: undefined,
|
||||
description: undefined,
|
||||
enabled: undefined,
|
||||
remark: undefined,
|
||||
version: undefined,
|
||||
externalCode: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加工厂";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getFactory(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改工厂";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateFactory(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createFactory(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除工厂编号为"' + id + '"的数据项?').then(function() {
|
||||
return deleteFactory(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有工厂数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportFactoryExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '工厂.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
mixins: [basicPage],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
getDataListURL: getFactoryPage,
|
||||
deleteURL: deleteFactory,
|
||||
exportURL: exportFactoryExcel,
|
||||
},
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi(`base:factory:update`)
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:factory:delete`)
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
}
|
||||
: undefined,
|
||||
].filter((v)=>v),
|
||||
tableData: [],
|
||||
formConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
label: '工厂编码',
|
||||
placeholder: '工厂编码',
|
||||
param: 'code',
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
label: '工厂名称',
|
||||
placeholder: '工厂名称',
|
||||
param: 'name',
|
||||
},
|
||||
{
|
||||
type: 'datePicker',
|
||||
label: '创建时间',
|
||||
dateType: 'daterange',
|
||||
format: 'yyyy-MM-dd',
|
||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
rangeSeparator: '-',
|
||||
startPlaceholder: '开始时间',
|
||||
endPlaceholder: '结束时间',
|
||||
param: 'createTime',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '搜索',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '重置',
|
||||
name: 'reset',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:factory:create') ? 'button' : '',
|
||||
btnName: '新增',
|
||||
name: 'add',
|
||||
color: 'success',
|
||||
plain: true,
|
||||
},
|
||||
// {
|
||||
// type: this.$auth.hasPermi('base:factory:create') ? 'separate' : '',
|
||||
// },
|
||||
// {
|
||||
// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '',
|
||||
// btnName: '导出',
|
||||
// name: 'export',
|
||||
// color: 'warning',
|
||||
// },
|
||||
],
|
||||
};
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
buttonClick(val) {
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.listQuery.pageNo = 1;
|
||||
this.listQuery.pageSize = 10;
|
||||
this.listQuery.name = val.name;
|
||||
this.listQuery.code = val.code;
|
||||
this.listQuery.createTime = val.createTime;
|
||||
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>
|
||||
|
@ -1,208 +1,103 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2023-08-02 15:12:42
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2023-08-03 14:24:36
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<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="['base:line-bind-product:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
||||
v-hasPermi="['base:line-bind-product:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="ID" align="center" prop="id" />
|
||||
<el-table-column label="产线id" align="center" prop="productionLineId" />
|
||||
<el-table-column label="产品id" align="center" prop="productId" />
|
||||
<el-table-column label="记录时间" align="center" prop="recordTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.recordTime) }}</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="['base:line-bind-product:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['base:line-bind-product: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" v-dialogDrag append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="产线id" prop="productionLineId">
|
||||
<el-input v-model="form.productionLineId" placeholder="请输入产线id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品id" prop="productId">
|
||||
<el-input v-model="form.productId" placeholder="请输入产品id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="记录时间" prop="recordTime">
|
||||
<el-date-picker clearable v-model="form.recordTime" type="date" value-format="timestamp" placeholder="选择记录时间" />
|
||||
</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>
|
||||
</div>
|
||||
<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"
|
||||
@emitFun="inputChange" />
|
||||
<pagination
|
||||
:limit.sync="listQuery.pageSize"
|
||||
:page.sync="listQuery.pageNo"
|
||||
:total="listQuery.total"
|
||||
@pagination="getDataList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createLineBindProduct, updateLineBindProduct, deleteLineBindProduct, getLineBindProduct, getLineBindProductPage, exportLineBindProductExcel } from "@/api/core/base/lineBindProduct";
|
||||
import basicPage from '../../mixins/basic-page';
|
||||
import { parseTime } from '../../mixins/code-filter';
|
||||
import { getLineBindProductPage } from '@/api/core/base/lineBindProduct';
|
||||
import selectProduct from './selectProduct';
|
||||
import { getProductPage } from '@/api/core/base/product';
|
||||
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'lineName',
|
||||
label: '产线',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'productName',
|
||||
label: '在制产品',
|
||||
align: 'center',
|
||||
list: [],
|
||||
subcomponent: selectProduct,
|
||||
},
|
||||
{
|
||||
prop: 'recordTime',
|
||||
label: '开始时间',
|
||||
align: 'center',
|
||||
filter: parseTime,
|
||||
},
|
||||
];
|
||||
|
||||
export default {
|
||||
name: "LineBindProduct",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 产线目前生产产品表 主要为更新列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getLineBindProductPage(this.queryParams).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
productionLineId: undefined,
|
||||
productId: undefined,
|
||||
recordTime: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加产线目前生产产品表 主要为更新";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getLineBindProduct(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改产线目前生产产品表 主要为更新";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateLineBindProduct(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createLineBindProduct(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除产线目前生产产品表 主要为更新编号为"' + id + '"的数据项?').then(function() {
|
||||
return deleteLineBindProduct(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有产线目前生产产品表 主要为更新数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportLineBindProductExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '产线目前生产产品表 主要为更新.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
mixins: [basicPage, selectProduct],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
getDataListURL: getLineBindProductPage,
|
||||
},
|
||||
tableProps,
|
||||
tableData: [],
|
||||
formConfig: [
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '同步',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
components: {},
|
||||
created() {
|
||||
const params = {
|
||||
pageSize: 100,
|
||||
pageNo: 1,
|
||||
};
|
||||
getProductPage(params).then((response) => {
|
||||
this.tableProps[1].list = response.data.list;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
buttonClick(val) {
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.listQuery.pageNo = 1;
|
||||
this.listQuery.pageSize = 10;
|
||||
this.getDataList();
|
||||
break;
|
||||
default:
|
||||
console.log(val);
|
||||
}
|
||||
},
|
||||
inputChange() {
|
||||
this.getDataList();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
73
src/views/core/base/lineBindProduct/selectProduct.vue
Normal file
73
src/views/core/base/lineBindProduct/selectProduct.vue
Normal file
@ -0,0 +1,73 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2023-08-03 14:09:18
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2023-08-03 14:51:16
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="tableInner">
|
||||
<el-input readonly v-model="list.productName" style="width: 50%;" ></el-input>
|
||||
<el-popover
|
||||
placement="top"
|
||||
title="切换在制产品"
|
||||
width="160"
|
||||
v-model="visible">
|
||||
<el-select v-model="list.string" style="margin: 5px;" filterable>
|
||||
<el-option
|
||||
v-for="item in injectData.list"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id + '+' + item.name"></el-option>
|
||||
</el-select>
|
||||
<div style="text-align: right; margin: 0">
|
||||
<el-button size="mini" type="text" @click="visible = false">
|
||||
取消
|
||||
</el-button>
|
||||
<el-button type="primary" size="mini" @click="changeInput">
|
||||
确定
|
||||
</el-button>
|
||||
</div>
|
||||
<el-button type="text" slot="reference">切换</el-button>
|
||||
</el-popover>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { switchLineBindProduct } from '@/api/core/base/lineBindProduct';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: this.injectData,
|
||||
visible: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
changeInput() {
|
||||
const data = {
|
||||
id: this.list.id,
|
||||
productId: this.list.string.split('+')[0],
|
||||
productName: this.list.string.split('+')[1],
|
||||
};
|
||||
switchLineBindProduct(data).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.visible = false;
|
||||
this.$emit('emitData');
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.tableInner .el-input__inner {
|
||||
border: none;
|
||||
padding: 0;
|
||||
height: 33px;
|
||||
}
|
||||
</style>
|
@ -1,241 +1,147 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="产线id" prop="productionLineId">
|
||||
<el-select v-model="queryParams.productionLineId" placeholder="请选择产线id" clearable size="small">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品id" prop="productId">
|
||||
<el-select v-model="queryParams.productId" placeholder="请选择产品id" clearable size="small">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="开始时间" prop="startTime">
|
||||
<el-date-picker v-model="queryParams.startTime" 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" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<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="['base:line-bind-product-log:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
||||
v-hasPermi="['base:line-bind-product-log:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="ID" align="center" prop="id" />
|
||||
<el-table-column label="产线id" align="center" prop="productionLineId" />
|
||||
<el-table-column label="产品id" align="center" prop="productId" />
|
||||
<el-table-column label="开始时间" align="center" prop="startTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.startTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结束时间" align="center" prop="endTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.endTime) }}</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="['base:line-bind-product-log:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['base:line-bind-product-log: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" v-dialogDrag append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="产线id" prop="productionLineId">
|
||||
<el-select v-model="form.productionLineId" placeholder="请选择产线id">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品id" prop="productId">
|
||||
<el-select v-model="form.productId" placeholder="请选择产品id">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="开始时间" prop="startTime">
|
||||
<el-date-picker clearable v-model="form.startTime" type="date" value-format="timestamp" placeholder="选择开始时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="结束时间" prop="endTime">
|
||||
<el-date-picker clearable v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择结束时间" />
|
||||
</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>
|
||||
</div>
|
||||
<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" />
|
||||
<pagination
|
||||
:limit.sync="listQuery.pageSize"
|
||||
:page.sync="listQuery.pageNo"
|
||||
:total="listQuery.total"
|
||||
@pagination="getDataList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createLineBindProductLog, updateLineBindProductLog, deleteLineBindProductLog, getLineBindProductLog, getLineBindProductLogPage, exportLineBindProductLogExcel } from "@/api/core/base/lineBindProductLog";
|
||||
import basicPage from '../../mixins/basic-page';
|
||||
import { parseTime } from '../../mixins/code-filter';
|
||||
import { getLineBindProductLogPage } from '@/api/core/base/lineBindProductLog';
|
||||
import { getProductionLinePage } from '@/api/core/base/productionLine';
|
||||
import { getProductPage } from '@/api/core/base/product';
|
||||
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'productionLineName',
|
||||
label: '产线',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'productName',
|
||||
label: '在制产品',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'startTime',
|
||||
label: '开始时间',
|
||||
align: 'center',
|
||||
filter: parseTime,
|
||||
},
|
||||
{
|
||||
prop: 'endTime',
|
||||
label: '结束时间',
|
||||
align: 'center',
|
||||
filter: parseTime,
|
||||
},
|
||||
];
|
||||
|
||||
export default {
|
||||
name: "LineBindProductLog",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 产线目前生产产品表 主要为更新列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
productionLineId: null,
|
||||
productId: null,
|
||||
startTime: [],
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
productionLineId: [{ required: true, message: "产线id不能为空", trigger: "change" }],
|
||||
productId: [{ required: true, message: "产品id不能为空", trigger: "change" }],
|
||||
startTime: [{ required: true, message: "开始时间不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getLineBindProductLogPage(this.queryParams).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
productionLineId: undefined,
|
||||
productId: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加产线目前生产产品表 主要为更新";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getLineBindProductLog(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改产线目前生产产品表 主要为更新";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateLineBindProductLog(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createLineBindProductLog(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除产线目前生产产品表 主要为更新编号为"' + id + '"的数据项?').then(function() {
|
||||
return deleteLineBindProductLog(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有产线目前生产产品表 主要为更新数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportLineBindProductLogExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '产线目前生产产品表 主要为更新.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
mixins: [basicPage],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
getDataListURL: getLineBindProductLogPage,
|
||||
},
|
||||
tableProps,
|
||||
tableData: [],
|
||||
optionArrUrl: [getProductionLinePage, getProductPage],
|
||||
formConfig: [
|
||||
{
|
||||
type: 'select',
|
||||
label: '产线',
|
||||
selectOptions: [],
|
||||
param: 'productionLineId',
|
||||
defaultSelect: '',
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
label: '在制产品',
|
||||
selectOptions: [],
|
||||
param: 'productId',
|
||||
defaultSelect: '',
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
type: 'datePicker',
|
||||
label: '时间',
|
||||
dateType: 'daterange',
|
||||
format: 'yyyy-MM-dd',
|
||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
rangeSeparator: '-',
|
||||
startPlaceholder: '开始时间',
|
||||
endPlaceholder: '结束时间',
|
||||
param: 'createTime',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '搜索',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '重置',
|
||||
name: 'reset',
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
components: {
|
||||
},
|
||||
created() {
|
||||
this.getArr();
|
||||
},
|
||||
methods: {
|
||||
getArr() {
|
||||
const params = {
|
||||
page: 1,
|
||||
limit: 500,
|
||||
};
|
||||
this.optionArrUrl.forEach((item, index) => {
|
||||
item(params).then((response) => {
|
||||
this.formConfig[index].selectOptions = response.data.list;
|
||||
});
|
||||
});
|
||||
},
|
||||
buttonClick(val) {
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.listQuery.pageNo = 1;
|
||||
this.listQuery.pageSize = 10;
|
||||
this.listQuery.productionLineId = val.productionLineId;
|
||||
this.listQuery.productId = val.productId;
|
||||
this.listQuery.createTime = val.createTime;
|
||||
this.getDataList();
|
||||
break;
|
||||
case 'reset':
|
||||
this.$refs.searchBarForm.resetForm();
|
||||
this.listQuery = {
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
total: 1,
|
||||
};
|
||||
this.getDataList();
|
||||
break;
|
||||
default:
|
||||
console.log(val);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
65
src/views/core/base/product/SmallTitle.vue
Normal file
65
src/views/core/base/product/SmallTitle.vue
Normal 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>
|
425
src/views/core/base/product/add-or-updata.vue
Normal file
425
src/views/core/base/product/add-or-updata.vue
Normal file
@ -0,0 +1,425 @@
|
||||
<template>
|
||||
<el-drawer
|
||||
:visible.sync="visible"
|
||||
:show-close="false"
|
||||
:wrapper-closable="false"
|
||||
class="drawer"
|
||||
size="60%">
|
||||
<small-title slot="title" :no-padding="true">
|
||||
{{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }}
|
||||
</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="code">
|
||||
<el-input
|
||||
v-model="dataForm.code"
|
||||
clearable
|
||||
:disabled="isdetail"
|
||||
placeholder="请输入产品编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="产品名称" prop="name">
|
||||
<el-input
|
||||
v-model="dataForm.name"
|
||||
clearable
|
||||
:disabled="isdetail"
|
||||
placeholder="请输入产品名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="产品类型" prop="typeDictValue">
|
||||
<el-select
|
||||
v-model="dataForm.typeDictValue"
|
||||
style="width: 100%"
|
||||
:disabled="isdetail"
|
||||
placeholder="请选择产品类型">
|
||||
<el-option
|
||||
v-for="dict in getDictDatas(DICT_TYPE.PRODUCT_TYPE)"
|
||||
: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="unitDictValue">
|
||||
<el-select
|
||||
v-model="dataForm.unitDictValue"
|
||||
style="width: 100%"
|
||||
:disabled="isdetail"
|
||||
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-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="规格" prop="specifications">
|
||||
<el-input
|
||||
:disabled="isdetail"
|
||||
v-model="dataForm.specifications"
|
||||
placeholder="请输入规格" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="单位平方数" prop="area">
|
||||
<el-input
|
||||
:disabled="isdetail"
|
||||
v-model="dataForm.area"
|
||||
placeholder="请输入单位平方数" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="完成单位产品用时" prop="processTime">
|
||||
<el-input
|
||||
:disabled="isdetail"
|
||||
v-model="dataForm.processTime"
|
||||
placeholder="请输入完成单位产品用时" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<small-title
|
||||
style="margin: 16px 0; padding-left: 8px"
|
||||
:no-padding="true">
|
||||
产品属性列表
|
||||
</small-title>
|
||||
|
||||
<div class="attr-list">
|
||||
<base-table
|
||||
:table-props="tableProps"
|
||||
:page="listQuery.pageNo"
|
||||
:limit="listQuery.pageSize"
|
||||
:table-data="productAttributeList">
|
||||
<method-btn
|
||||
v-if="!isdetail"
|
||||
slot="handleBtn"
|
||||
:width="120"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick" />
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="listQuery.total > 0"
|
||||
:total="listQuery.total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
:page-sizes="[5, 10, 15]"
|
||||
@pagination="getList" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="position: absolute; bottom: 24px; right: 24px">
|
||||
<el-button style="margin-right: 10px" @click="goback()">返回</el-button>
|
||||
<el-button v-if="isdetail" type="primary" @click="goEdit()">
|
||||
编辑
|
||||
</el-button>
|
||||
<span v-if="!isdetail">
|
||||
<el-button type="primary" @click="dataFormSubmit()">保存</el-button>
|
||||
<el-button
|
||||
v-if="dataForm.id && !isdetail"
|
||||
type="primary"
|
||||
@click="addNew()">
|
||||
添加属性
|
||||
</el-button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<product-attr-add
|
||||
v-if="addOrUpdateVisible"
|
||||
ref="addOrUpdate"
|
||||
:product-id="dataForm.id"
|
||||
@refreshDataList="getList" />
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
deleteProductAttr,
|
||||
getProductAttrPage,
|
||||
} from '@/api/core/base/productAttr';
|
||||
|
||||
import {
|
||||
createProduct,
|
||||
updateProduct,
|
||||
getProduct,
|
||||
getCode,
|
||||
} from '@/api/core/base/product';
|
||||
import productAttrAdd from './attr-add';
|
||||
import { parseTime } from '../../mixins/code-filter';
|
||||
import SmallTitle from './SmallTitle';
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
},
|
||||
];
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '添加时间',
|
||||
filter: parseTime,
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '属性名',
|
||||
},
|
||||
{
|
||||
prop: 'value',
|
||||
label: '属性值',
|
||||
},
|
||||
];
|
||||
|
||||
export default {
|
||||
components: { productAttrAdd, SmallTitle },
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
tableProps,
|
||||
productAttributeList: [],
|
||||
dataForm: {
|
||||
id: null,
|
||||
name: '', // 产品名称
|
||||
code: '', // 产品编码
|
||||
area: 0, // 单位平方数(float only)
|
||||
typeDictValue: null, // 产品类型id
|
||||
processTime: null, // 单位产品用时 (s)
|
||||
specifications: '', // 规格
|
||||
unitDictValue: '', // 单位id
|
||||
},
|
||||
listQuery: {
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
total: 0,
|
||||
},
|
||||
dataRule: {
|
||||
code: [
|
||||
{
|
||||
required: true,
|
||||
message: '产品编码不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
// {
|
||||
// type: 'number',
|
||||
// message: '产品编码为数字类型',
|
||||
// trigger: 'blur',
|
||||
// transfom: 'val => Number(val)',
|
||||
// },
|
||||
],
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: '产品名称不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
typeDictValue: [
|
||||
{
|
||||
required: true,
|
||||
message: '产品类型不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
area: [
|
||||
// {
|
||||
// type: 'float',
|
||||
// message: '单位平方数为浮点类型',
|
||||
// trigger: 'blur',
|
||||
// transfom: 'val => Float(val)',
|
||||
// },
|
||||
],
|
||||
processTime: [
|
||||
{
|
||||
required: true,
|
||||
message: '完成单位产品用时不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
// {
|
||||
// type: 'number',
|
||||
// message: '完成单位产品用时为浮点类型',
|
||||
// trigger: 'blur',
|
||||
// transfom: 'val => Number(val)',
|
||||
// },
|
||||
],
|
||||
},
|
||||
isdetail: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
initData() {
|
||||
this.productAttributeList.splice(0);
|
||||
},
|
||||
init(id, isdetail) {
|
||||
this.initData();
|
||||
this.isdetail = isdetail || false;
|
||||
this.dataForm.id = id || null;
|
||||
this.visible = true;
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields();
|
||||
|
||||
if (this.dataForm.id) {
|
||||
// 获取产品详情
|
||||
getProduct(id).then((response) => {
|
||||
this.dataForm = response.data;
|
||||
});
|
||||
// 获取产品的属性列表
|
||||
this.getList();
|
||||
} else {
|
||||
getCode().then((res) => {
|
||||
this.dataForm.code = res.data;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getList() {
|
||||
// 获取产品的属性列表
|
||||
const params = {
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
productId: this.dataForm.id,
|
||||
};
|
||||
getProductAttrPage(params).then((response) => {
|
||||
this.productAttributeList = response.data.list;
|
||||
this.listQuery.total = response.data.total;
|
||||
});
|
||||
},
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(
|
||||
`确定对${
|
||||
val.data.name
|
||||
? '[名称=' + val.data.name + ']'
|
||||
: '[序号=' + val.data._pageIndex + ']'
|
||||
}进行删除操作?`,
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
deleteProductAttr(val.data.id).then(({ data }) => {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList();
|
||||
},
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
} else {
|
||||
this.addNew(raw.data.id);
|
||||
}
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
// 修改的提交
|
||||
if (this.dataForm.id) {
|
||||
updateProduct(this.dataForm).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createProduct(this.dataForm).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
goEdit() {
|
||||
this.isdetail = false;
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id);
|
||||
});
|
||||
},
|
||||
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-drawer__header {
|
||||
margin: 0;
|
||||
padding: 32px 32px 24px;
|
||||
border-bottom: 1px solid #dcdfe6;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
</style>
|
139
src/views/core/base/product/attr-add.vue
Normal file
139
src/views/core/base/product/attr-add.vue
Normal file
@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:visible.sync="visible"
|
||||
:width="'35%'"
|
||||
: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="100px"
|
||||
@keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item label="属性名" prop="name">
|
||||
<el-input
|
||||
v-model="dataForm.name"
|
||||
placeholder="请输入属性名"
|
||||
clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="属性值" prop="value">
|
||||
<el-input
|
||||
v-model="dataForm.value"
|
||||
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 {
|
||||
createProductAttr,
|
||||
updateProductAttr,
|
||||
getProductAttr,
|
||||
} from '@/api/core/base/productAttr';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
productId: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
name: '',
|
||||
value: '',
|
||||
},
|
||||
dataRule: {
|
||||
name: [{ 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) {
|
||||
getProductAttr(this.dataForm.id).then((res) => {
|
||||
const { name, value } = res.data;
|
||||
this.dataForm.name = name;
|
||||
this.dataForm.value = value;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
// 修改的提交
|
||||
if (this.dataForm.id) {
|
||||
updateProductAttr({
|
||||
...this.dataForm,
|
||||
productId: this.productId,
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createProductAttr({
|
||||
...this.dataForm,
|
||||
productId: this.productId,
|
||||
}).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>
|
@ -1,498 +1,205 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2023-08-01 14:55:51
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2023-08-03 15:22:53
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="search-form"
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
size="small"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="68px">
|
||||
<el-form-item prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="code">
|
||||
<el-input
|
||||
v-model="queryParams.code"
|
||||
placeholder="编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">
|
||||
搜索
|
||||
</el-button>
|
||||
<!-- <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> -->
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['base:product:create']">
|
||||
新增
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item>
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['base:product:export']">
|
||||
导出
|
||||
</el-button>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
|
||||
<div class="data-list">
|
||||
<!-- <el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5"></el-col>
|
||||
<el-col :span="1.5"></el-col>
|
||||
<right-toolbar
|
||||
:showSearch.sync="showSearch"
|
||||
@queryTable="getList"></right-toolbar>
|
||||
</el-row> -->
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table class="f-table-list" v-loading="loading" :data="list">
|
||||
<!-- <el-table-column label="ID" align="center" prop="id" /> -->
|
||||
<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" prop="name" />
|
||||
<el-table-column label="产品编码" align="center" prop="code" />
|
||||
<el-table-column label="规格" align="center" prop="specifications" />
|
||||
<el-table-column label="单位" align="center" prop="unitDictValue">
|
||||
<template v-slot="scope">
|
||||
<dict-tag
|
||||
:type="DICT_TYPE.UNIT_DICT"
|
||||
:value="scope.row.unitDictValue" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="产品类型" align="center" prop="typeDictValue">
|
||||
<template v-slot="scope">
|
||||
<dict-tag
|
||||
:type="DICT_TYPE.PRODUCT_TYPE"
|
||||
:value="scope.row.typeDictValue" />
|
||||
</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="['base:product:update']">
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['base:product: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" />
|
||||
</div>
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog
|
||||
:title="title"
|
||||
:visible.sync="open"
|
||||
width="50%"
|
||||
v-dialogDrag
|
||||
append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="产品编码" prop="code">
|
||||
<el-input v-model="form.code" 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-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="产品类型" prop="typeDictValue">
|
||||
<el-select
|
||||
v-model="form.typeDictValue"
|
||||
placeholder="请选择产品类型">
|
||||
<el-option
|
||||
v-for="dict in getDictDatas(DICT_TYPE.PRODUCT_TYPE)"
|
||||
: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="unitDictValue">
|
||||
<el-select v-model="form.unitDictValue" 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-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="规格" prop="specifications">
|
||||
<el-input
|
||||
v-model="form.specifications"
|
||||
placeholder="请输入规格" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="单位平方数" prop="area">
|
||||
<el-input v-model="form.area" placeholder="请输入单位平方数" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="完成单位产品用时" prop="processTime">
|
||||
<el-input
|
||||
v-model="form.processTime"
|
||||
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>
|
||||
<search-bar
|
||||
:formConfigs="formConfig"
|
||||
ref="searchBarForm"
|
||||
@headBtnClick="buttonClick" />
|
||||
<base-table
|
||||
: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" />
|
||||
<add-or-update
|
||||
v-if="addOrUpdateVisible"
|
||||
ref="addOrUpdate"
|
||||
@refreshDataList="getDataList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './add-or-updata';
|
||||
import unitDict from './unitDict';
|
||||
import basicPage from '../../mixins/basic-page';
|
||||
import { parseTime } from '../../mixins/code-filter';
|
||||
import {
|
||||
createProduct,
|
||||
updateProduct,
|
||||
deleteProduct,
|
||||
getProduct,
|
||||
getProductPage,
|
||||
exportProductExcel,
|
||||
} from '@/api/core/base/product';
|
||||
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'code',
|
||||
label: '产品编码',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '产品名称',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'specifications',
|
||||
label: '规格',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'unitDictValue',
|
||||
label: '单位',
|
||||
align: 'center',
|
||||
subcomponent: unitDict,
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
align: 'center',
|
||||
filter: parseTime,
|
||||
},
|
||||
];
|
||||
|
||||
export default {
|
||||
name: 'Product',
|
||||
components: {},
|
||||
mixins: [basicPage],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 产品列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
code: null,
|
||||
name: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
code: [
|
||||
{
|
||||
required: true,
|
||||
message: '产品编码不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
message: '产品编码为数字类型',
|
||||
trigger: 'blur',
|
||||
transfom: 'val => Number(val)',
|
||||
},
|
||||
],
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: '产品名称不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
typeDictValue: [
|
||||
{
|
||||
required: true,
|
||||
message: '产品类型不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
area: [
|
||||
{
|
||||
type: 'number',
|
||||
message: '单位平方数为浮点类型',
|
||||
trigger: 'blur',
|
||||
transfom: 'val => Number(val)',
|
||||
},
|
||||
],
|
||||
processTime: [
|
||||
{
|
||||
required: true,
|
||||
message: '完成单位产品用时不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
message: '完成单位产品用时为浮点类型',
|
||||
trigger: 'blur',
|
||||
transfom: 'val => Number(val)',
|
||||
},
|
||||
],
|
||||
urlOptions: {
|
||||
getDataListURL: getProductPage,
|
||||
deleteURL: deleteProduct,
|
||||
exportURL: exportProductExcel,
|
||||
},
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi(`base:product:update`)
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:product:delete`)
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:product:update`)
|
||||
? {
|
||||
type: 'detail',
|
||||
btnName: '详情',
|
||||
}
|
||||
: undefined,
|
||||
].filter((v) => v),
|
||||
tableData: [],
|
||||
formConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
label: '产品编码',
|
||||
placeholder: '产品编码',
|
||||
param: 'code',
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
label: '产品名称',
|
||||
placeholder: '产品名称',
|
||||
param: 'name',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '搜索',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '重置',
|
||||
name: 'reset',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:product:create') ? 'button' : '',
|
||||
btnName: '新增',
|
||||
name: 'add',
|
||||
color: 'success',
|
||||
plain: true,
|
||||
},
|
||||
// {
|
||||
// type: 'separate',
|
||||
// type: this.$auth.hasPermi('base:product:create') ? 'separate' : '',
|
||||
// },
|
||||
// {
|
||||
// type: this.$auth.hasPermi('base:product:export') ? 'button' : '',
|
||||
// btnName: '导出',
|
||||
// name: 'export',
|
||||
// color: 'warning',
|
||||
// },
|
||||
],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
console.log('DICTYPE', this.DICT_TYPE);
|
||||
this.getList();
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getProductPage(this.queryParams).then((response) => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
buttonClick(val) {
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.listQuery.pageNo = 1;
|
||||
this.listQuery.pageSize = 10;
|
||||
this.listQuery.name = val.name;
|
||||
this.listQuery.code = val.code;
|
||||
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);
|
||||
}
|
||||
},
|
||||
otherMethods(val) {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.addOrEditTitle = '详情';
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(val.data.id, true);
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
specifications: undefined,
|
||||
unitDictValue: undefined,
|
||||
area: undefined,
|
||||
processTime: undefined,
|
||||
typeDictValue: undefined,
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm');
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = '添加产品';
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getProduct(id).then((response) => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = '修改产品';
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateProduct(this.form).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createProduct(this.form).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal
|
||||
.confirm('是否确认删除产品编号为"' + id + '"的数据项?')
|
||||
.then(function () {
|
||||
return deleteProduct(id);
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess('删除成功');
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = { ...this.queryParams };
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal
|
||||
.confirm('是否确认导出所有产品数据项?')
|
||||
.then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportProductExcel(params);
|
||||
})
|
||||
.then((response) => {
|
||||
this.$download.excel(response, '产品.xls');
|
||||
this.exportLoading = false;
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
// .app-container {
|
||||
// padding: 20px 0;
|
||||
// }
|
||||
|
||||
// .el-form {
|
||||
// // border: 1px solid red;
|
||||
|
||||
// .el-form-item {
|
||||
// // border: 1px solid blue;
|
||||
// margin: 0;
|
||||
|
||||
// &:not(:last-child) {
|
||||
// margin-right: 8px;
|
||||
// }
|
||||
|
||||
// // input,select,textarea {
|
||||
// // border: none;
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
|
||||
// .search-form {
|
||||
// margin-bottom: 12px;
|
||||
|
||||
// .el-button {
|
||||
// border: none;
|
||||
// border-radius: 0;
|
||||
// }
|
||||
|
||||
// :deep(.el-form-item__content) {
|
||||
// [class*='__inner'] {
|
||||
// border: none;
|
||||
// border-bottom: 1px solid #ccc;
|
||||
// margin-bottom: 8px;
|
||||
// border-radius: 0;
|
||||
|
||||
// &:focus {
|
||||
// background-color: #ffa70020;
|
||||
// border-color: #ffa700;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// form.el-form.search-form.el-form--inline {
|
||||
// position: relative;
|
||||
// padding-left: 100px;
|
||||
// }
|
||||
|
||||
// .f-table-list {
|
||||
// :deep(th) {
|
||||
// &.el-table__cell {
|
||||
// border-top: 1px solid #dfe6ec;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// .flex {
|
||||
// display: flex;
|
||||
// }
|
||||
|
||||
// .items-center {
|
||||
// align-items: center;
|
||||
// }
|
||||
|
||||
// form.el-form.search-form.el-form--inline::before {
|
||||
// content: '搜索条件';
|
||||
// display: inline-block;
|
||||
// height: 28px;
|
||||
// line-height: 28px;
|
||||
// width: 80px;
|
||||
// background: #ffa700;
|
||||
// color: white;
|
||||
// letter-spacing: 1px;
|
||||
// font-weight: 600;
|
||||
// padding-left: 8px;
|
||||
// position: absolute;
|
||||
// top: 2px;
|
||||
// left: 0;
|
||||
// border-top-right-radius: 6px;
|
||||
// border-bottom-right-radius: 6px;
|
||||
// }
|
||||
</style>
|
||||
|
15
src/views/core/base/product/unitDict.vue
Normal file
15
src/views/core/base/product/unitDict.vue
Normal file
@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<dict-tag
|
||||
:type="DICT_TYPE.UNIT_DICT"
|
||||
:value="injectData.unitDictValue" />
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
104
src/views/core/base/productionLine/add-or-updata.vue
Normal file
104
src/views/core/base/productionLine/add-or-updata.vue
Normal file
@ -0,0 +1,104 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2023-08-01 13:52:10
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2023-08-01 16:59:35
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-form
|
||||
:model="dataForm"
|
||||
:rules="dataRule"
|
||||
ref="dataForm"
|
||||
@keyup.enter.native="dataFormSubmit()"
|
||||
label-width="90px">
|
||||
<el-form-item label="产线编码" prop="code">
|
||||
<el-input
|
||||
v-model="dataForm.code"
|
||||
clearable
|
||||
placeholder="请输入产线编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产线名称" prop="name">
|
||||
<el-input
|
||||
v-model="dataForm.name"
|
||||
clearable
|
||||
placeholder="请输入产线名称" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="factoryId" label="工厂名称">
|
||||
<el-select
|
||||
v-model="dataForm.factoryId" filterable clearable placeholder="请选择工厂">
|
||||
<el-option
|
||||
v-for="item in urlOptions.optionArr.arr0"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="产线TT值(h)" prop="tvalue">
|
||||
<el-input v-model="dataForm.tvalue" clearable placeholder="请输入每小时下片数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input
|
||||
v-model="dataForm.description"
|
||||
type="textarea"
|
||||
placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<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 {
|
||||
createProductionLine,
|
||||
updateProductionLine,
|
||||
getProductionLine,
|
||||
getCode,
|
||||
} from '@/api/core/base/productionLine';
|
||||
import {
|
||||
getFactoryPage,
|
||||
} from '@/api/core/base/factory';
|
||||
|
||||
export default {
|
||||
mixins: [basicAdd],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
getOption: true,
|
||||
isGetCode: true,
|
||||
codeURL: getCode,
|
||||
createURL: createProductionLine,
|
||||
updateURL: updateProductionLine,
|
||||
infoURL: getProductionLine,
|
||||
optionArrUrl: [getFactoryPage],
|
||||
},
|
||||
dataForm: {
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
tvalue: undefined,
|
||||
factoryId: undefined,
|
||||
remark: undefined,
|
||||
description: undefined,
|
||||
},
|
||||
dataRule: {
|
||||
code: [
|
||||
{ required: true, message: '产线编码不能为空', trigger: 'blur' },
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: '产线名称不能为空', trigger: 'blur' },
|
||||
],
|
||||
factoryId: [
|
||||
{ required: true, message: '工厂不能为空', trigger: 'change' },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
};
|
||||
</script>
|
@ -1,236 +1,188 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<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="['base:production-line:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
||||
v-hasPermi="['base:production-line:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="id" align="center" prop="id" />
|
||||
<el-table-column label="工厂表ID" align="center" prop="factoryId" />
|
||||
<el-table-column label="编码" align="center" prop="code" />
|
||||
<el-table-column label="名称" align="center" prop="name" />
|
||||
<el-table-column label="描述" align="center" prop="description" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<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="['base:production-line:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['base:production-line: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" v-dialogDrag append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="工厂表ID" prop="factoryId">
|
||||
<el-select v-model="form.factoryId" placeholder="请选择工厂表ID">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="编码" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="每小时下片数量" prop="tvalue">
|
||||
<el-input v-model="form.tvalue" placeholder="请输入每小时下片数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="外部系统编码(大屏数据使用,LINE_1,LINE_2,LINE_3,LINE_4)" prop="externalCode">
|
||||
<el-input v-model="form.externalCode" placeholder="请输入外部系统编码(大屏数据使用,LINE_1,LINE_2,LINE_3,LINE_4)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</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>
|
||||
</div>
|
||||
<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="70%">
|
||||
<add-or-update
|
||||
ref="addOrUpdate"
|
||||
@refreshDataList="successSubmit"></add-or-update>
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createProductionLine, updateProductionLine, deleteProductionLine, getProductionLine, getProductionLinePage, exportProductionLineExcel } from "@/api/core/base/productionLine";
|
||||
import AddOrUpdate from './add-or-updata';
|
||||
import basicPage from '../../mixins/basic-page';
|
||||
import { parseTime } from '../../mixins/code-filter';
|
||||
import {
|
||||
deleteProductionLine,
|
||||
getProductionLinePage,
|
||||
exportProductionLineExcel
|
||||
} from "@/api/core/base/productionLine";
|
||||
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'code',
|
||||
label: '产线编码',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '产线名称',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'factoryName',
|
||||
label: '工厂',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'description',
|
||||
label: '描述',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
align: 'center',
|
||||
filter: parseTime,
|
||||
},
|
||||
];
|
||||
|
||||
export default {
|
||||
name: "ProductionLine",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 工厂产线列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
factoryId: [{ required: true, message: "工厂表ID不能为空", trigger: "change" }],
|
||||
code: [{ required: true, message: "编码不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: "名称不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getProductionLinePage(this.queryParams).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
factoryId: undefined,
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
description: undefined,
|
||||
tvalue: undefined,
|
||||
externalCode: undefined,
|
||||
remark: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加工厂产线";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getProductionLine(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改工厂产线";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateProductionLine(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createProductionLine(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除工厂产线编号为"' + id + '"的数据项?').then(function() {
|
||||
return deleteProductionLine(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有工厂产线数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportProductionLineExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '工厂产线.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
mixins: [basicPage],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
getDataListURL: getProductionLinePage,
|
||||
deleteURL: deleteProductionLine,
|
||||
exportURL: exportProductionLineExcel,
|
||||
},
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi(`base:production-line:update`)
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:production-line: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: 'button',
|
||||
btnName: '重置',
|
||||
name: 'reset',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:production-line:create') ? 'button' : '',
|
||||
btnName: '新增',
|
||||
name: 'add',
|
||||
color: 'success',
|
||||
plain: true,
|
||||
},
|
||||
// {
|
||||
// type: this.$auth.hasPermi('base:production-line:create') ? 'separate' : '',
|
||||
// },
|
||||
// {
|
||||
// type: this.$auth.hasPermi('base:production-line:export') ? 'button' : '',
|
||||
// btnName: '导出',
|
||||
// name: 'export',
|
||||
// color: 'warning',
|
||||
// },
|
||||
],
|
||||
};
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
buttonClick(val) {
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.listQuery.pageNo = 1;
|
||||
this.listQuery.pageSize = 10;
|
||||
this.listQuery.name = val.name;
|
||||
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>
|
||||
|
100
src/views/core/base/workshopSection/add-or-updata.vue
Normal file
100
src/views/core/base/workshopSection/add-or-updata.vue
Normal file
@ -0,0 +1,100 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2023-08-01 13:52:10
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2023-08-01 16:58:44
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-form
|
||||
:model="dataForm"
|
||||
:rules="dataRule"
|
||||
ref="dataForm"
|
||||
@keyup.enter.native="dataFormSubmit()"
|
||||
label-width="90px">
|
||||
<el-form-item label="工段编码" prop="code">
|
||||
<el-input
|
||||
v-model="dataForm.code"
|
||||
clearable
|
||||
placeholder="请输入工段编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工段名称" prop="name">
|
||||
<el-input
|
||||
v-model="dataForm.name"
|
||||
clearable
|
||||
placeholder="请输入工段名称" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="productionLineId" label="产线">
|
||||
<el-select
|
||||
v-model="dataForm.productionLineId" filterable clearable placeholder="请选择产线">
|
||||
<el-option
|
||||
v-for="item in urlOptions.optionArr.arr0"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input-number v-model="dataForm.sort" :min="1" clearable placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
<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 {
|
||||
createWorkshopSection,
|
||||
updateWorkshopSection,
|
||||
getWorkshopSection,
|
||||
getCode,
|
||||
} from '@/api/core/base/workshopSection';
|
||||
import {
|
||||
getProductionLinePage,
|
||||
} from '@/api/core/base/productionLine';
|
||||
|
||||
export default {
|
||||
mixins: [basicAdd],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
getOption: true,
|
||||
isGetCode: true,
|
||||
codeURL: getCode,
|
||||
createURL: createWorkshopSection,
|
||||
updateURL: updateWorkshopSection,
|
||||
infoURL: getWorkshopSection,
|
||||
optionArrUrl: [getProductionLinePage],
|
||||
},
|
||||
dataForm: {
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
productionLineId: undefined,
|
||||
sort: undefined,
|
||||
name: undefined,
|
||||
remark: undefined,
|
||||
},
|
||||
dataRule: {
|
||||
code: [
|
||||
{ required: true, message: '工段编码不能为空', trigger: 'blur' },
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: '工段名称不能为空', trigger: 'blur' },
|
||||
],
|
||||
sort: [
|
||||
{ required: true, message: '排序不能为空', trigger: 'blur' },
|
||||
],
|
||||
productionLineId: [
|
||||
{ required: true, message: '产线不能为空', trigger: 'change' },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
};
|
||||
</script>
|
@ -1,227 +1,188 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<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="['base:workshop-section:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
||||
v-hasPermi="['base:workshop-section:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="id" align="center" prop="id" />
|
||||
<el-table-column label="产线ID" align="center" prop="productionLineId" />
|
||||
<el-table-column label="编码" align="center" prop="code" />
|
||||
<el-table-column label="名称" align="center" prop="name" />
|
||||
<el-table-column label="排序" align="center" prop="sort" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<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="['base:workshop-section:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['base:workshop-section: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" v-dialogDrag append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="产线ID" prop="productionLineId">
|
||||
<el-input v-model="form.productionLineId" placeholder="请输入产线ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="编码" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input v-model="form.sort" placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</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>
|
||||
</div>
|
||||
<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="70%">
|
||||
<add-or-update
|
||||
ref="addOrUpdate"
|
||||
@refreshDataList="successSubmit"></add-or-update>
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createWorkshopSection, updateWorkshopSection, deleteWorkshopSection, getWorkshopSection, getWorkshopSectionPage, exportWorkshopSectionExcel } from "@/api/core/base/workshopSection";
|
||||
import AddOrUpdate from './add-or-updata';
|
||||
import basicPage from '../../mixins/basic-page';
|
||||
import { parseTime } from '../../mixins/code-filter';
|
||||
import {
|
||||
deleteWorkshopSection,
|
||||
getWorkshopSectionPage,
|
||||
exportWorkshopSectionExcel
|
||||
} from "@/api/core/base/workshopSection";
|
||||
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'code',
|
||||
label: '工段编码',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '工段名称',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'productionLineName',
|
||||
label: '产线',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'sort',
|
||||
label: '排序',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
align: 'center',
|
||||
filter: parseTime,
|
||||
},
|
||||
];
|
||||
|
||||
export default {
|
||||
name: "WorkshopSection",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 产线工段列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
productionLineId: [{ required: true, message: "产线ID不能为空", trigger: "blur" }],
|
||||
code: [{ required: true, message: "编码不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: "名称不能为空", trigger: "blur" }],
|
||||
sort: [{ required: true, message: "排序不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getWorkshopSectionPage(this.queryParams).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
productionLineId: undefined,
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
sort: undefined,
|
||||
remark: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加产线工段";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getWorkshopSection(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改产线工段";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateWorkshopSection(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createWorkshopSection(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除产线工段编号为"' + id + '"的数据项?').then(function() {
|
||||
return deleteWorkshopSection(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有产线工段数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportWorkshopSectionExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '产线工段.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
mixins: [basicPage],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
getDataListURL: getWorkshopSectionPage,
|
||||
deleteURL: deleteWorkshopSection,
|
||||
exportURL: exportWorkshopSectionExcel,
|
||||
},
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi(`base:workshop-section:update`)
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:workshop-section: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: 'button',
|
||||
btnName: '重置',
|
||||
name: 'reset',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:workshop-section:create') ? 'button' : '',
|
||||
btnName: '新增',
|
||||
name: 'add',
|
||||
color: 'success',
|
||||
plain: true,
|
||||
},
|
||||
// {
|
||||
// type: this.$auth.hasPermi('base:workshop-section:create') ? 'separate' : '',
|
||||
// },
|
||||
// {
|
||||
// type: this.$auth.hasPermi('base:workshop-section:export') ? 'button' : '',
|
||||
// btnName: '导出',
|
||||
// name: 'export',
|
||||
// color: 'warning',
|
||||
// },
|
||||
],
|
||||
};
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
buttonClick(val) {
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.listQuery.pageNo = 1;
|
||||
this.listQuery.pageSize = 10;
|
||||
this.listQuery.name = val.name;
|
||||
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>
|
||||
|
100
src/views/core/mixins/basic-add.js
Normal file
100
src/views/core/mixins/basic-add.js
Normal 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()
|
||||
}
|
||||
}
|
||||
}
|
168
src/views/core/mixins/basic-page.js
Normal file
168
src/views/core/mixins/basic-page.js
Normal file
@ -0,0 +1,168 @@
|
||||
/*
|
||||
* @Author: zwq
|
||||
* @Date: 2022-08-24 11:19:43
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2023-08-02 10:56:37
|
||||
* @Description:
|
||||
*/
|
||||
export default {
|
||||
data() {
|
||||
/* eslint-disable */
|
||||
return {
|
||||
urlOptions: {
|
||||
getDataListURL: '',
|
||||
deleteURL: '',
|
||||
statusUrl: '',
|
||||
exportURL: ''
|
||||
},
|
||||
tableData: [],
|
||||
listQuery: {
|
||||
pageSize: 10,
|
||||
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.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.$confirm(`确定对${name ? '[名称=' + name + ']' : '[序号=' + index + ']'}进行删除操作?`, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.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(() => { });
|
||||
}
|
||||
}
|
||||
}
|
99
src/views/core/mixins/code-filter.js
Normal file
99
src/views/core/mixins/code-filter.js
Normal file
@ -0,0 +1,99 @@
|
||||
|
||||
/*
|
||||
* @Date: 2020-12-29 16:49:28
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2023-08-01 11:10:04
|
||||
* @FilePath: \basic-admin\src\filters\basicData\index.js
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
const table = {
|
||||
eightDisciplineType: {
|
||||
1: '客诉问题',
|
||||
2: '重大质量问题',
|
||||
0: '重复发生问题',
|
||||
},
|
||||
examineStatus: {
|
||||
1: '需要审批',
|
||||
0: '不需要审批',
|
||||
},
|
||||
gradeFinish: {
|
||||
1: '已打分',
|
||||
0: '未打分',
|
||||
},
|
||||
step: {
|
||||
0: 'D0',
|
||||
1: 'D1',
|
||||
2: 'D2',
|
||||
3: 'D3',
|
||||
4: 'D4',
|
||||
5: 'D5',
|
||||
6: 'D6',
|
||||
7: 'D7',
|
||||
8: 'D8',
|
||||
},
|
||||
containmentLocaleName:
|
||||
{
|
||||
1: "装配线",
|
||||
2: "生产线",
|
||||
3: "实验室",
|
||||
4: "成品在途",
|
||||
5: "第三方中间商",
|
||||
},
|
||||
developCountermeasuresName:
|
||||
{
|
||||
1: "让步接收",
|
||||
2: "分选返工",
|
||||
3: "隔离",
|
||||
4: "退换货",
|
||||
5: "通知供应商",
|
||||
},
|
||||
}
|
||||
|
||||
// 日期格式化
|
||||
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 default function (dictTable) {
|
||||
return function (val) {
|
||||
return table?.[dictTable]?.[val]
|
||||
}
|
||||
}
|
181
src/views/group/base/groupClasses/components/groupClassAdd.vue
Normal file
181
src/views/group/base/groupClasses/components/groupClassAdd.vue
Normal file
@ -0,0 +1,181 @@
|
||||
<template>
|
||||
<el-form ref="form" :rules="rules" label-width="110px" :model="form">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="班次名称" prop="name">
|
||||
<el-input v-model="form.name"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="编码" prop="code">
|
||||
<el-input v-model="form.code" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="生效时间" prop="enableTime">
|
||||
<el-date-picker
|
||||
v-model="form.enableTime"
|
||||
type="datetime"
|
||||
placeholder="选择日期时间"
|
||||
label-format="yyyy-MM-dd HH:mm:ss"
|
||||
value-format="timestamp"
|
||||
style="width: 100%;">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="失效时间" prop="disableTime">
|
||||
<el-date-picker
|
||||
v-model="form.disableTime"
|
||||
type="datetime"
|
||||
placeholder="选择日期时间"
|
||||
label-format="yyyy-MM-dd HH:mm:ss"
|
||||
value-format="timestamp"
|
||||
style="width: 100%;">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="班次开始时间" prop="startTime">
|
||||
<el-time-picker
|
||||
v-model="form.startTime"
|
||||
format='HH:mm'
|
||||
value-format='HH:mm'
|
||||
style="width: 100%;"
|
||||
@change="timeFun"
|
||||
>
|
||||
</el-time-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="班次结束时间" prop="endTime">
|
||||
<el-time-picker
|
||||
v-model="form.endTime"
|
||||
format='HH:mm'
|
||||
value-format='HH:mm'
|
||||
style="width: 100%;"
|
||||
@change="timeFun"
|
||||
>
|
||||
</el-time-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否跨天" prop="daySpan">
|
||||
<el-select v-model="form.daySpan" placeholder="请选择" disabled style="width: 100%;">
|
||||
<el-option label="否" :value= '0' ></el-option>
|
||||
<el-option label="是" :value= '1' ></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
<script>
|
||||
import { getGroupClasses, updateGroupClasses, createGroupClasses, getCode } from '@/api/base/groupClasses'
|
||||
export default {
|
||||
name: 'groupClassAdd',
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
id: '',
|
||||
name: '',
|
||||
code: '',
|
||||
enableTime: '',
|
||||
disableTime: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
daySpan: '',
|
||||
remark: ''
|
||||
},
|
||||
isEdit: false, //是否是编辑
|
||||
rules: {
|
||||
name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }],
|
||||
enableTime: [{ required: true, message: '请选择班次开始时间', trigger: 'change' }],
|
||||
code: [{ required: true, message: '请输入编码', trigger: 'blur' }],
|
||||
startTime: [{ required: true, message: '请输入生效时间', trigger: 'change' }],
|
||||
endTime: [{ required: true, message: '请选择班次结束时间', trigger: 'change' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
if (id) {
|
||||
this.isEdit = true
|
||||
this.form.id = id
|
||||
getGroupClasses(id).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.form = res.data
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.isEdit = false
|
||||
this.form.id = ''
|
||||
getCode().then((res) => {
|
||||
this.form.code = res.data
|
||||
})
|
||||
}
|
||||
},
|
||||
timeFun() {
|
||||
if (this.form.startTime && this.form.endTime) {
|
||||
if (this.form.startTime > this.form.endTime) {
|
||||
this.form.daySpan = 1
|
||||
} else {
|
||||
this.form.daySpan = 0
|
||||
}
|
||||
}
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
let obj = {}
|
||||
if (this.form.disableTime) {
|
||||
obj = this.form
|
||||
} else {
|
||||
obj.id = this.form.id
|
||||
obj.name = this.form.name
|
||||
obj.code = this.form.code
|
||||
obj.enableTime = this.form.enableTime
|
||||
obj.startTime = this.form.startTime
|
||||
obj.endTime = this.form.endTime
|
||||
obj.daySpan = this.form.daySpan
|
||||
obj.remark = this.form.remark
|
||||
}
|
||||
if (this.isEdit) {
|
||||
//编辑
|
||||
updateGroupClasses({ ...obj }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
this.$emit('successSubmit')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
createGroupClasses({ ...obj }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
this.$emit('successSubmit')
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
formClear() {
|
||||
this.$refs.form.resetFields()
|
||||
this.isEdit = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
248
src/views/group/base/groupClasses/index.vue
Normal file
248
src/views/group/base/groupClasses/index.vue
Normal file
@ -0,0 +1,248 @@
|
||||
<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"
|
||||
>
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
:width="120"
|
||||
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='70%'
|
||||
>
|
||||
<group-class-add ref="classList" @successSubmit="successSubmit" />
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getGroupClassesPage, deleteGroupClasses, updateGroupClasses } from "@/api/base/groupClasses";
|
||||
import GroupClassAdd from './components/groupClassAdd.vue'
|
||||
import { formatDate } from '@/utils'
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'enableTimeStr',
|
||||
label: '生效时段',
|
||||
minWidth: 300
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '班次名称'
|
||||
},
|
||||
{
|
||||
prop: 'timeStr',
|
||||
label: '班次时间'
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: '班次编码',
|
||||
minWidth: 200
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '班次状态'
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注'
|
||||
}
|
||||
]
|
||||
export default {
|
||||
name: "GroupClass",
|
||||
components: { GroupClassAdd },
|
||||
data() {
|
||||
return {
|
||||
formConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
label: '班次名称',
|
||||
placeholder: '班次名称',
|
||||
param: 'name'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary'
|
||||
},
|
||||
{
|
||||
type: 'separate'
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:group-classes:create') ? 'button' : '',
|
||||
btnName: '新增',
|
||||
name: 'add',
|
||||
color: 'success',
|
||||
plain: true
|
||||
}
|
||||
],
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('base:group-classes:update')
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑'
|
||||
}
|
||||
: undefined,
|
||||
{
|
||||
type: 'cancel',
|
||||
btnName: '作废'
|
||||
},
|
||||
this.$auth.hasPermi('base:group-classes: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
|
||||
}
|
||||
};
|
||||
},
|
||||
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.name = val.name
|
||||
this.getList()
|
||||
break
|
||||
default:
|
||||
this.addOrEditTitle = '新增'
|
||||
this.centervisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.classList.init()
|
||||
})
|
||||
}
|
||||
},
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
getGroupClassesPage(this.queryParams).then(res => {
|
||||
if (res.code === 0 && res.data.list.length > 0) {
|
||||
res.data.list.map(item => {
|
||||
item.enableTimeStr = formatDate(item.enableTime) + '至' + (item.disableTime ? formatDate(item.disableTime) : '永久')
|
||||
item.timeStr = item.startTime.slice(0, 5) + '-' + item.endTime.slice(0, 5)
|
||||
item.status = item.status === true ? '可用' : '不可用'
|
||||
})
|
||||
this.list = res.data.list;
|
||||
this.total = res.data.total;
|
||||
} else {
|
||||
this.list = []
|
||||
this.total = 0
|
||||
}
|
||||
});
|
||||
},
|
||||
handleClick(val) {
|
||||
switch (val.type) {
|
||||
case 'edit':
|
||||
this.addOrEditTitle = '编辑'
|
||||
this.$nextTick(() => {
|
||||
this.$refs.classList.init(val.data.id)
|
||||
})
|
||||
this.centervisible = true
|
||||
break
|
||||
case 'cancel':
|
||||
this.discard(val.data)
|
||||
break
|
||||
default:
|
||||
this.handleDelete(val.data)
|
||||
}
|
||||
},
|
||||
handleCancel() {
|
||||
this.$refs.classList.formClear()
|
||||
this.centervisible = false
|
||||
this.addOrEditTitle = ''
|
||||
},
|
||||
handleConfirm() {
|
||||
this.$refs.classList.submitForm()
|
||||
},
|
||||
successSubmit() {
|
||||
this.handleCancel()
|
||||
this.getList()
|
||||
},
|
||||
discard(row) {
|
||||
let obj = {}
|
||||
obj.id = row.id
|
||||
obj.startTime = row.startTime
|
||||
obj.endTime = row.endTime
|
||||
obj.enableTime = row.enableTime
|
||||
obj.disableTime = Date.parse(new Date())
|
||||
this.$modal.confirm('是否确认作废班次名称为"' + row.name + '"的数据项?').then(function() {
|
||||
return updateGroupClasses({ ...obj })
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
if (row.status) {
|
||||
let _this = this
|
||||
_this.$modal.confirm('删除的班次"' + row.name + '"可能会影响交接班计划,请点取消再次确认!').then(function() {
|
||||
return _this.$modal.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?').then(function() {
|
||||
return deleteGroupClasses(row.id);
|
||||
}).then(() => {
|
||||
_this.getList();
|
||||
_this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
})
|
||||
} else {
|
||||
_this.$modal.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?').then(function() {
|
||||
return deleteGroupClasses(row.id);
|
||||
}).then(() => {
|
||||
_this.getList();
|
||||
_this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
84
src/views/group/base/groupTeam/components/groupTeamAdd.vue
Normal file
84
src/views/group/base/groupTeam/components/groupTeamAdd.vue
Normal file
@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<el-form ref="form" :rules="rules" label-width="80px" :model="form">
|
||||
<el-form-item label="班组名称" prop="name">
|
||||
<el-input v-model="form.name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="班组编码" prop="code">
|
||||
<el-input v-model="form.code" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="班组人数" prop="num">
|
||||
<el-input v-model="form.num"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="班组组长" prop="leaderName">
|
||||
<el-input v-model="form.leaderName"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
<script>
|
||||
import { getGroupTeam, updateGroupTeam, createGroupTeam, getCode } from '@/api/base/groupTeam'
|
||||
export default {
|
||||
name: 'groupTeamAdd',
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
id: '',
|
||||
name: '',
|
||||
code: '',
|
||||
num: null,
|
||||
leaderName: ''
|
||||
},
|
||||
isEdit: false, //是否是编辑
|
||||
rules: {
|
||||
name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
if (id) {
|
||||
this.isEdit = true
|
||||
this.form.id = id
|
||||
getGroupTeam( id ).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.form = res.data
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.isEdit = false
|
||||
this.form.id = ''
|
||||
getCode().then((res) => {
|
||||
this.form.code = res.data
|
||||
})
|
||||
}
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.isEdit) {
|
||||
//编辑
|
||||
updateGroupTeam({ ...this.form }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
this.$emit('successSubmit')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
createGroupTeam({ ...this.form }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
this.$emit('successSubmit')
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
formClear() {
|
||||
this.$refs.form.resetFields()
|
||||
this.isEdit = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
40
src/views/group/base/groupTeam/components/statusBtn.vue
Normal file
40
src/views/group/base/groupTeam/components/statusBtn.vue
Normal file
@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<el-switch v-model="state" type="text" size="small" :disabled="readonly" @change="changeHandler" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
state: false,
|
||||
payload: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
readonly() {
|
||||
return !!this.injectData.readonly
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.mapToState()
|
||||
},
|
||||
methods: {
|
||||
mapToState() {
|
||||
if (this.injectData.prop === 'enabled') {
|
||||
this.state = this.injectData.enabled === 1 ? true : false
|
||||
}
|
||||
},
|
||||
changeHandler() {
|
||||
this.payload.id = this.injectData.id
|
||||
this.payload.enabled = this.state ? '1' : '0'
|
||||
this.$emit('emitData', this.payload)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
225
src/views/group/base/groupTeam/index.vue
Normal file
225
src/views/group/base/groupTeam/index.vue
Normal file
@ -0,0 +1,225 @@
|
||||
<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"
|
||||
>
|
||||
<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.vue'
|
||||
import StatusBtn from './components/statusBtn.vue'
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
filter: parseTime,
|
||||
minWidth: 150
|
||||
},
|
||||
{
|
||||
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: 'code'
|
||||
},
|
||||
{
|
||||
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.name = val.name
|
||||
this.queryParams.code = val.code
|
||||
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(data) {
|
||||
updateGroupTeam({ ...data }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
}
|
||||
})
|
||||
},
|
||||
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(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
233
src/views/group/base/groupTeamScheduling/index copy.vue
Normal file
233
src/views/group/base/groupTeamScheduling/index copy.vue
Normal file
@ -0,0 +1,233 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="上班日期" prop="startDay">
|
||||
<el-input v-model="queryParams.startDay" placeholder="请输入上班日期" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<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="['base:group-team-scheduling:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
||||
v-hasPermi="['base:group-team-scheduling:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="ID" align="center" prop="id" />
|
||||
<el-table-column label="班组ID" align="center" prop="teamId" />
|
||||
<el-table-column label="班次id" align="center" prop="classesId" />
|
||||
<el-table-column label="上班日期" align="center" prop="startDay" />
|
||||
<el-table-column label="上班时间" align="center" prop="startTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.startTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="下班时间" align="center" prop="endTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.endTime) }}</span>
|
||||
</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="['base:group-team-scheduling:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['base:group-team-scheduling: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" v-dialogDrag append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="班组ID" prop="teamId">
|
||||
<el-input v-model="form.teamId" placeholder="请输入班组ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="班次id" prop="classesId">
|
||||
<el-input v-model="form.classesId" placeholder="请输入班次id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="上班日期" prop="startDay">
|
||||
<el-input v-model="form.startDay" placeholder="请输入上班日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="上班时间" prop="startTime">
|
||||
<el-date-picker clearable v-model="form.startTime" type="date" value-format="timestamp" placeholder="选择上班时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="下班时间" prop="endTime">
|
||||
<el-date-picker clearable v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择下班时间" />
|
||||
</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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createGroupTeamScheduling, updateGroupTeamScheduling, deleteGroupTeamScheduling, getGroupTeamScheduling, getGroupTeamSchedulingPage, exportGroupTeamSchedulingExcel } from "@/api/base/groupTeamScheduling";
|
||||
|
||||
export default {
|
||||
name: "GroupTeamScheduling",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 排班信息列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
startDay: [],
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
teamId: [{ required: true, message: "班组ID不能为空", trigger: "blur" }],
|
||||
classesId: [{ required: true, message: "班次id不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getGroupTeamSchedulingPage(this.queryParams).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
teamId: undefined,
|
||||
classesId: undefined,
|
||||
startDay: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加排班信息";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getGroupTeamScheduling(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改排班信息";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateGroupTeamScheduling(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createGroupTeamScheduling(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除排班信息编号为"' + id + '"的数据项?').then(function() {
|
||||
return deleteGroupTeamScheduling(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有排班信息数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportGroupTeamSchedulingExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '排班信息.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
233
src/views/group/base/groupTeamScheduling/index.vue
Normal file
233
src/views/group/base/groupTeamScheduling/index.vue
Normal file
@ -0,0 +1,233 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="上班日期" prop="startDay">
|
||||
<el-input v-model="queryParams.startDay" placeholder="请输入上班日期" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<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="['base:group-team-scheduling:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
||||
v-hasPermi="['base:group-team-scheduling:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="ID" align="center" prop="id" />
|
||||
<el-table-column label="班组ID" align="center" prop="teamId" />
|
||||
<el-table-column label="班次id" align="center" prop="classesId" />
|
||||
<el-table-column label="上班日期" align="center" prop="startDay" />
|
||||
<el-table-column label="上班时间" align="center" prop="startTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.startTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="下班时间" align="center" prop="endTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.endTime) }}</span>
|
||||
</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="['base:group-team-scheduling:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['base:group-team-scheduling: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" v-dialogDrag append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="班组ID" prop="teamId">
|
||||
<el-input v-model="form.teamId" placeholder="请输入班组ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="班次id" prop="classesId">
|
||||
<el-input v-model="form.classesId" placeholder="请输入班次id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="上班日期" prop="startDay">
|
||||
<el-input v-model="form.startDay" placeholder="请输入上班日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="上班时间" prop="startTime">
|
||||
<el-date-picker clearable v-model="form.startTime" type="date" value-format="timestamp" placeholder="选择上班时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="下班时间" prop="endTime">
|
||||
<el-date-picker clearable v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择下班时间" />
|
||||
</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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createGroupTeamScheduling, updateGroupTeamScheduling, deleteGroupTeamScheduling, getGroupTeamScheduling, getGroupTeamSchedulingPage, exportGroupTeamSchedulingExcel } from "@/api/base/groupTeamScheduling";
|
||||
|
||||
export default {
|
||||
name: "GroupTeamScheduling",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 排班信息列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
startDay: [],
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
teamId: [{ required: true, message: "班组ID不能为空", trigger: "blur" }],
|
||||
classesId: [{ required: true, message: "班次id不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getGroupTeamSchedulingPage(this.queryParams).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
teamId: undefined,
|
||||
classesId: undefined,
|
||||
startDay: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加排班信息";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getGroupTeamScheduling(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改排班信息";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateGroupTeamScheduling(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createGroupTeamScheduling(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除排班信息编号为"' + id + '"的数据项?').then(function() {
|
||||
return deleteGroupTeamScheduling(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有排班信息数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportGroupTeamSchedulingExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '排班信息.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
343
src/views/quality/base/qualityInspectionBoxBtn/index.vue
Normal file
343
src/views/quality/base/qualityInspectionBoxBtn/index.vue
Normal file
@ -0,0 +1,343 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<SearchBar
|
||||
:formConfigs="searchBarFormConfig"
|
||||
ref="search-bar"
|
||||
@headBtnClick="handleSearchBarBtnClick" />
|
||||
|
||||
<!-- 列表 -->
|
||||
<base-table
|
||||
:table-props="tableProps"
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:table-data="list"
|
||||
@emit-fun="handleEmitFun">
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
label="操作"
|
||||
fixed="right"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleTableBtnClick" />
|
||||
</base-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<base-dialog
|
||||
:dialogTitle="title"
|
||||
:dialogVisible="open"
|
||||
width="50%"
|
||||
@close="cancel"
|
||||
@cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
<DialogForm
|
||||
v-if="open"
|
||||
ref="form"
|
||||
:dataForm="form"
|
||||
:rows="[
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
label: '产线',
|
||||
url: '/base/production-line/listAll',
|
||||
prop: 'productionId',
|
||||
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
bind: {
|
||||
filterable: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
label: '工段',
|
||||
url: '/base/workshop-section/listAll',
|
||||
prop: 'sectionId',
|
||||
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
},
|
||||
// {
|
||||
// select: true,
|
||||
// url: '', //
|
||||
// label: '检测内容',
|
||||
// prop: 'inspectionDetContent',
|
||||
// rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
// },
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '按钮盒识别码',
|
||||
prop: 'buttonId',
|
||||
rules: [
|
||||
{
|
||||
type: 'number',
|
||||
message: '请输入数字',
|
||||
trigger: 'blur',
|
||||
transform: (val) => Number(val),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
[{ input: true, label: '按钮盒模式', prop: 'model' }],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '按钮值',
|
||||
prop: 'keyValue',
|
||||
rules: [
|
||||
{
|
||||
type: 'number',
|
||||
message: '请输入100以内的数字',
|
||||
trigger: 'blur',
|
||||
transform: (val) => Number(val) <= 100 && Number(val),
|
||||
},
|
||||
],
|
||||
bind: { type: 'number', min: 0, max: 100 },
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
textarea: true,
|
||||
label: '检测内容',
|
||||
prop: 'inspectionDetContent',
|
||||
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
},
|
||||
],
|
||||
]" />
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
createQualityInspectionBoxBtn,
|
||||
updateQualityInspectionBoxBtn,
|
||||
deleteQualityInspectionBoxBtn,
|
||||
getQualityInspectionBoxBtn,
|
||||
getQualityInspectionBoxBtnPage,
|
||||
exportQualityInspectionBoxBtnExcel,
|
||||
} from '@/api/base/qualityInspectionBoxBtn';
|
||||
import basicPageMixin from '../../mixin/basicPageMixin';
|
||||
import moment from 'moment';
|
||||
|
||||
export default {
|
||||
name: 'QualityInspectionBoxBtn',
|
||||
mixins: [basicPageMixin],
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
searchBarFormConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
label: '检查内容',
|
||||
placeholder: '请输入检查内容',
|
||||
param: 'inspectionDetContent',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:quality-inspection-box-btn:create')
|
||||
? 'button'
|
||||
: '',
|
||||
btnName: '新增',
|
||||
name: 'add',
|
||||
plain: true,
|
||||
color: 'success',
|
||||
},
|
||||
],
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('base:quality-inspection-box-btn:update')
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '修改',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:quality-inspection-box-btn:delete')
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
}
|
||||
: undefined,
|
||||
].filter((v) => v),
|
||||
tableProps: [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '添加时间',
|
||||
fixed: true,
|
||||
width: 180,
|
||||
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||
},
|
||||
{
|
||||
width: 128,
|
||||
prop: 'productionName',
|
||||
label: '产线',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
width: 128,
|
||||
prop: 'sectionName',
|
||||
label: '工段',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
width: 128,
|
||||
prop: 'inspectionDetContent',
|
||||
label: '检测内容',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
width: 160,
|
||||
prop: 'buttonId',
|
||||
label: '按钮盒识别码',
|
||||
align: 'center',
|
||||
},
|
||||
// {
|
||||
// width: 256,
|
||||
// prop: 'productionId',
|
||||
// label: '按钮盒所在产线ID',
|
||||
// align: 'center',
|
||||
// },
|
||||
// {
|
||||
// width: 256,
|
||||
// prop: 'sectionId',
|
||||
// label: '按钮盒所在工段ID',
|
||||
// align: 'center',
|
||||
// },
|
||||
{ width: 90, prop: 'keyValue', label: '按钮值', align: 'center' },
|
||||
{ width: 128, prop: 'model', label: '按钮盒模式', align: 'center' },
|
||||
],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
inspectionDetContent: null,
|
||||
},
|
||||
// 搜索框需要的 keys, 与上面 queryParams 的除 pageNo, pageSize 之外的 key 一一对应
|
||||
searchBarKeys: ['inspectionDetContent'],
|
||||
form: {
|
||||
id: undefined,
|
||||
inspectionDetId: undefined,
|
||||
inspectionDetContent: undefined,
|
||||
productionId: undefined,
|
||||
sectionId: undefined,
|
||||
model: undefined,
|
||||
keyValue: undefined,
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getQualityInspectionBoxBtnPage(this.queryParams).then((response) => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
inspectionDetId: undefined,
|
||||
inspectionDetContent: undefined,
|
||||
productionId: undefined,
|
||||
sectionId: undefined,
|
||||
model: undefined,
|
||||
keyValue: undefined,
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = '添加安灯按钮16键对应';
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getQualityInspectionBoxBtn(id).then((response) => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = '修改安灯按钮16键对应';
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateQualityInspectionBoxBtn(this.form).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createQualityInspectionBoxBtn(this.form).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal
|
||||
.confirm('是否确认删除安灯按钮16键对应编号为"' + id + '"的数据项?')
|
||||
.then(function () {
|
||||
return deleteQualityInspectionBoxBtn(id);
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess('删除成功');
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = { ...this.queryParams };
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal
|
||||
.confirm('是否确认导出所有安灯按钮16键对应数据项?')
|
||||
.then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportQualityInspectionBoxBtnExcel(params);
|
||||
})
|
||||
.then((response) => {
|
||||
this.$download.excel(response, '安灯按钮16键对应.xls');
|
||||
this.exportLoading = false;
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
314
src/views/quality/base/qualityInspectionDet/index.vue
Normal file
314
src/views/quality/base/qualityInspectionDet/index.vue
Normal file
@ -0,0 +1,314 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<SearchBar
|
||||
:formConfigs="searchBarFormConfig"
|
||||
ref="search-bar"
|
||||
@headBtnClick="handleSearchBarBtnClick" />
|
||||
|
||||
<!-- 列表 -->
|
||||
<base-table
|
||||
:table-props="tableProps"
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:table-data="list"
|
||||
@emit-fun="handleEmitFun">
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
label="操作"
|
||||
fixed="right"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleTableBtnClick" />
|
||||
</base-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<base-dialog
|
||||
:dialogTitle="title"
|
||||
:dialogVisible="open"
|
||||
width="40%"
|
||||
@close="cancel"
|
||||
@cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
<DialogForm
|
||||
v-if="open"
|
||||
ref="form"
|
||||
:dataForm="form"
|
||||
:rows="[
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
label: '检测类型',
|
||||
prop: 'typeId',
|
||||
url: '/base/quality-inspection-type/listAll',
|
||||
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
bind: {
|
||||
filterable: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '检测内容',
|
||||
prop: 'content',
|
||||
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '内容编码',
|
||||
prop: 'code',
|
||||
url: '/base/quality-inspection-det/getCode',
|
||||
},
|
||||
],
|
||||
[{ input: true, label: '备注', prop: 'remark' }],
|
||||
]" />
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
createQualityInspectionDet,
|
||||
updateQualityInspectionDet,
|
||||
deleteQualityInspectionDet,
|
||||
getQualityInspectionDet,
|
||||
getQualityInspectionDetPage,
|
||||
exportQualityInspectionDetExcel,
|
||||
} from '@/api/base/qualityInspectionDet';
|
||||
|
||||
import moment from 'moment';
|
||||
|
||||
import basicPageMixin from '../../mixin/basicPageMixin';
|
||||
|
||||
export default {
|
||||
name: 'QualityInspectionDet',
|
||||
mixins: [basicPageMixin],
|
||||
data() {
|
||||
return {
|
||||
typeList: [], // 检测类型列表
|
||||
searchBarFormConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
label: '检测内容',
|
||||
placeholder: '请输入检测内容',
|
||||
param: 'content',
|
||||
},
|
||||
// {
|
||||
// type: 'datePicker',
|
||||
// label: '创建时间',
|
||||
// dateType: 'daterange', // datetimerange
|
||||
// // format: 'yyyy-MM-dd HH:mm:ss',
|
||||
// format: 'yyyy-MM-dd',
|
||||
// valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
// rangeSeparator: '-',
|
||||
// startPlaceholder: '开始日期',
|
||||
// endPlaceholder: '结束日期',
|
||||
// defaultTime: ['00:00:00', '23:59:59'],
|
||||
// param: 'createTime',
|
||||
// width: 350,
|
||||
// },
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
// {
|
||||
// type: 'button',
|
||||
// btnName: '重置',
|
||||
// name: 'reset',
|
||||
// },
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:quality-inspection-det:create')
|
||||
? 'button'
|
||||
: '',
|
||||
btnName: '新增',
|
||||
name: 'add',
|
||||
plain: true,
|
||||
color: 'success',
|
||||
},
|
||||
// {
|
||||
// type: this.$auth.hasPermi('base:quality-inspection-type:export')
|
||||
// ? 'button'
|
||||
// : '',
|
||||
// btnName: '导出',
|
||||
// name: 'export',
|
||||
// color: 'warning',
|
||||
// },
|
||||
],
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('base:quality-inspection-det:update')
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '修改',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:quality-inspection-det:delete')
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
}
|
||||
: undefined,
|
||||
].filter((v) => v),
|
||||
tableProps: [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '添加时间',
|
||||
fixed: true,
|
||||
width: 180,
|
||||
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||
},
|
||||
{ prop: 'typeName', label: '类型名称', align: 'center' },
|
||||
{ prop: 'content', label: '检测内容', align: 'center' },
|
||||
{ prop: 'code', label: '检测编码', align: 'center' },
|
||||
{ prop: 'remark', label: '备注', align: 'center' },
|
||||
],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
content: null,
|
||||
createTime: [],
|
||||
},
|
||||
// 搜索框需要的 keys, 与上面 queryParams 的除 pageNo, pageSize 之外的 key 一一对应
|
||||
searchBarKeys: ['content', 'createTime'],
|
||||
form: {
|
||||
id: undefined,
|
||||
typeId: undefined,
|
||||
content: undefined,
|
||||
code: undefined,
|
||||
remark: undefined,
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getTypeList();
|
||||
},
|
||||
methods: {
|
||||
/** 获取检测类型id */
|
||||
getTypeList() {
|
||||
this.$axios('/base/quality-inspection-type/listAll').then((response) => {
|
||||
this.typeList = response.data.map((item) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getQualityInspectionDetPage(this.queryParams).then((response) => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
typeId: undefined,
|
||||
content: undefined,
|
||||
code: undefined,
|
||||
remark: undefined,
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = '添加质量检测信息';
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getQualityInspectionDet(id).then((response) => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = '修改质量检测信息';
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateQualityInspectionDet(this.form).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createQualityInspectionDet(this.form).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal
|
||||
.confirm('是否确认删除质量检测信息基础编号为"' + id + '"的数据项?')
|
||||
.then(function () {
|
||||
return deleteQualityInspectionDet(id);
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess('删除成功');
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = { ...this.queryParams };
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal
|
||||
.confirm('是否确认导出所有质量检测信息基础数据项?')
|
||||
.then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportQualityInspectionDetExcel(params);
|
||||
})
|
||||
.then((response) => {
|
||||
this.$download.excel(response, '质量检测信息基础.xls');
|
||||
this.exportLoading = false;
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-select {
|
||||
width: 100% !important;
|
||||
}
|
||||
</style>
|
354
src/views/quality/base/qualityInspectionType/index.vue
Normal file
354
src/views/quality/base/qualityInspectionType/index.vue
Normal file
@ -0,0 +1,354 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<SearchBar
|
||||
:formConfigs="searchBarFormConfig"
|
||||
ref="search-bar"
|
||||
@headBtnClick="handleSearchBarBtnClick" />
|
||||
|
||||
<!-- 列表 -->
|
||||
<base-table
|
||||
:table-props="tableProps"
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:table-data="list"
|
||||
@emit-fun="handleEmitFun">
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleTableBtnClick" />
|
||||
</base-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<base-dialog
|
||||
:dialogTitle="title"
|
||||
:dialogVisible="open"
|
||||
@close="cancel"
|
||||
@cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
<DialogForm
|
||||
v-if="open"
|
||||
ref="form"
|
||||
:dataForm="form"
|
||||
:rows="[
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '检测类型名称',
|
||||
prop: 'name',
|
||||
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
// bind: {
|
||||
// disabled: true, // some condition, like detail mode...
|
||||
// }
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '检测类型编码',
|
||||
prop: 'code',
|
||||
url: '/base/quality-inspection-type/getCode',
|
||||
},
|
||||
],
|
||||
[{ input: true, label: '备注', prop: 'remark' }],
|
||||
]" />
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import moment from 'moment';
|
||||
|
||||
import {
|
||||
createQualityInspectionType,
|
||||
updateQualityInspectionType,
|
||||
deleteQualityInspectionType,
|
||||
getQualityInspectionType,
|
||||
getQualityInspectionTypePage,
|
||||
exportQualityInspectionTypeExcel,
|
||||
} from '@/api/base/qualityInspectionType';
|
||||
import basicPageMixin from '../../mixin/basicPageMixin';
|
||||
|
||||
export default {
|
||||
name: 'QualityInspectionType',
|
||||
mixins: [basicPageMixin],
|
||||
data() {
|
||||
return {
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('base:quality-inspection-type:update')
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '修改',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:quality-inspection-type:delete')
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
}
|
||||
: undefined,
|
||||
].filter((v) => v),
|
||||
tableProps: [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '添加时间',
|
||||
fixed: true,
|
||||
width: 180,
|
||||
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||
},
|
||||
{ prop: 'name', label: '检测类型名称', align: 'center' },
|
||||
{ prop: 'code', label: '检测类型编码', align: 'center' },
|
||||
{ prop: 'remark', label: '备注', align: 'center' },
|
||||
// {
|
||||
// label: '操作',
|
||||
// alignt: 'center',
|
||||
// subcomponent: {
|
||||
// render: function (h) {
|
||||
// return h('div', null, [
|
||||
// h(
|
||||
// 'el-button',
|
||||
// {
|
||||
// props: {
|
||||
// icon: 'el-icon-edit',
|
||||
// size: 'mini',
|
||||
// type: 'text',
|
||||
// },
|
||||
// },
|
||||
// ' 修改'
|
||||
// ),
|
||||
// h(
|
||||
// 'el-button',
|
||||
// {
|
||||
// props: {
|
||||
// icon: 'el-icon-edit',
|
||||
// size: 'mini',
|
||||
// type: 'text',
|
||||
// },
|
||||
// },
|
||||
// ' 修改'
|
||||
// ),
|
||||
// ]);
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
],
|
||||
//
|
||||
searchBarFormConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
label: '检测类型',
|
||||
placeholder: '请输入检测类型',
|
||||
param: 'name',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
// {
|
||||
// type: 'button',
|
||||
// btnName: '重置',
|
||||
// name: 'reset',
|
||||
// },
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:quality-inspection-type:create')
|
||||
? 'button'
|
||||
: '',
|
||||
btnName: '新增',
|
||||
name: 'add',
|
||||
plain: true,
|
||||
color: 'success',
|
||||
},
|
||||
// {
|
||||
// type: this.$auth.hasPermi('base:quality-inspection-type:export')
|
||||
// ? 'button'
|
||||
// : '',
|
||||
// btnName: '导出',
|
||||
// name: 'export',
|
||||
// color: 'warning',
|
||||
// },
|
||||
],
|
||||
// 表单配置
|
||||
// formRows: [
|
||||
// [
|
||||
// {
|
||||
// input: true,
|
||||
// label: '检测类型名称',
|
||||
// prop: 'name',
|
||||
// rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
// // bind: {
|
||||
// // disabled: true, // some condition, like detail mode...
|
||||
// // }
|
||||
// },
|
||||
// ],
|
||||
// [{ input: true, label: '检测类型编码', prop: 'code' }],
|
||||
// [{ input: true, label: '备注', prop: 'remark' }],
|
||||
// ],
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
};
|
||||
},
|
||||
// watch: {
|
||||
// form: {
|
||||
// handler: (val) => {
|
||||
// console.log('form changed', val);
|
||||
// },
|
||||
// deep: true
|
||||
// },
|
||||
// },
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** base table related */
|
||||
handleTableBtnClick({ data, type }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
this.handleUpdate(data);
|
||||
break;
|
||||
case 'delete':
|
||||
this.handleDelete(data);
|
||||
break;
|
||||
}
|
||||
},
|
||||
/** search bar related */
|
||||
handleSearchBarBtnClick(btn) {
|
||||
const keys = ['name'];
|
||||
switch (btn.btnName) {
|
||||
case 'search':
|
||||
keys.forEach((key) => {
|
||||
this.queryParams[key] = btn[key] || null;
|
||||
});
|
||||
this.handleQuery();
|
||||
break;
|
||||
case 'add':
|
||||
this.handleAdd();
|
||||
break;
|
||||
case 'export':
|
||||
this.handleExport();
|
||||
break;
|
||||
case 'reset':
|
||||
this.$refs['search-bar'].resetForm();
|
||||
this.resetQuery();
|
||||
break;
|
||||
}
|
||||
},
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getQualityInspectionTypePage(this.queryParams).then((response) => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
code: undefined,
|
||||
remark: undefined,
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = '添加质量检测类型基础';
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getQualityInspectionType(id).then((response) => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = '修改质量检测类型基础';
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
// console.log('this.$refs.form', this.$refs.form);
|
||||
// return;
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
console.log('final form', JSON.stringify(this.form));
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateQualityInspectionType(this.form).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createQualityInspectionType(this.form).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal
|
||||
.confirm('是否确认删除质量检测类型基础编号为"' + id + '"的数据项?')
|
||||
.then(function () {
|
||||
return deleteQualityInspectionType(id);
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess('删除成功');
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = { ...this.queryParams };
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal
|
||||
.confirm('是否确认导出所有质量检测类型基础数据项?')
|
||||
.then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportQualityInspectionTypeExcel(params);
|
||||
})
|
||||
.then((response) => {
|
||||
this.$download.excel(response, '质量检测类型基础.xls');
|
||||
this.exportLoading = false;
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
180
src/views/quality/components/dialogForm.vue
Normal file
180
src/views/quality/components/dialogForm.vue
Normal file
@ -0,0 +1,180 @@
|
||||
<!--
|
||||
filename: dialogForm.vue
|
||||
author: liubin
|
||||
date: 2023-08-02 10:32:36
|
||||
description: 弹窗的表单组件
|
||||
-->
|
||||
|
||||
<template>
|
||||
<el-form
|
||||
ref="form"
|
||||
:model="form"
|
||||
:label-width="`${labelWidth}px`"
|
||||
v-loading="formLoading">
|
||||
<el-row :gutter="20" v-for="(row, rindex) in rows" :key="rindex">
|
||||
<el-col v-for="col in row" :key="col.label" :span="24 / row.length">
|
||||
<el-form-item :label="col.label" :prop="col.prop" :rules="col.rules">
|
||||
<el-input
|
||||
v-if="col.input"
|
||||
v-model="form[col.prop]"
|
||||
@change="$emit('update', form)"
|
||||
:placeholder="`请输入${col.label}`"
|
||||
v-bind="col.bind" />
|
||||
<el-input
|
||||
v-if="col.textarea"
|
||||
type="textarea"
|
||||
v-model="form[col.prop]"
|
||||
@change="$emit('update', form)"
|
||||
:placeholder="`请输入${col.label}`"
|
||||
v-bind="col.bind" />
|
||||
<el-select
|
||||
v-if="col.select"
|
||||
v-model="form[col.prop]"
|
||||
:placeholder="`请选择${col.label}`"
|
||||
@change="$emit('update', form)"
|
||||
v-bind="col.bind">
|
||||
<el-option
|
||||
v-for="opt in optionListOf[col.prop]"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 找到最长的label
|
||||
* @param {*} options
|
||||
*/
|
||||
function findMaxLabelWidth(rows) {
|
||||
let max = 0;
|
||||
rows.forEach((row) => {
|
||||
row.forEach((opt) => {
|
||||
if (opt.label.length > max) {
|
||||
max = opt.label.length;
|
||||
}
|
||||
});
|
||||
});
|
||||
return max;
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'DialogForm',
|
||||
model: {
|
||||
prop: 'dataForm',
|
||||
event: 'update',
|
||||
},
|
||||
emits: ['update'],
|
||||
components: {},
|
||||
props: {
|
||||
rows: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
dataForm: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formLoading: true,
|
||||
optionListOf: {},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
labelWidth() {
|
||||
let max = findMaxLabelWidth(this.rows);
|
||||
// 每个汉字占20px
|
||||
return max * 20;
|
||||
// return max * 20 + 'px';
|
||||
},
|
||||
form: {
|
||||
get() {
|
||||
return this.dataForm;
|
||||
},
|
||||
set(val) {
|
||||
console.log('set form', val);
|
||||
},
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
// 处理 options
|
||||
this.handleOptions();
|
||||
},
|
||||
methods: {
|
||||
/** 模拟透传 ref */
|
||||
validate(cb) {
|
||||
return this.$refs.form.validate(cb);
|
||||
},
|
||||
resetFields(args) {
|
||||
return this.$refs.form.resetFields(args);
|
||||
},
|
||||
// getCode
|
||||
async getCode(url) {
|
||||
const response = await this.$axios(url);
|
||||
return response.data;
|
||||
},
|
||||
handleOptions() {
|
||||
// console.log("[dialogForm:handleOptions]")
|
||||
const promiseList = [];
|
||||
this.rows.forEach((cols) => {
|
||||
cols.forEach(async (opt) => {
|
||||
if (opt.options) {
|
||||
this.optionListOf[opt.prop] = opt.options;
|
||||
} else if (opt.url) {
|
||||
// 如果是下拉框,或者新增模式下的输入框,才去请求
|
||||
if (opt.select || (opt.input && !this.form?.id)) {
|
||||
promiseList.push(async () => {
|
||||
const response = await this.$axios(opt.url, {
|
||||
method: opt.method ?? 'get',
|
||||
});
|
||||
console.log('[dialogForm:handleOptions:response]', response);
|
||||
if (opt.select) {
|
||||
// 处理下拉框选项
|
||||
const list =
|
||||
'list' in response.data
|
||||
? response.data.list
|
||||
: response.data;
|
||||
this.$set(
|
||||
this.optionListOf,
|
||||
opt.prop,
|
||||
list.map((item) => ({
|
||||
label: item[opt.labelKey ?? 'name'],
|
||||
value: item[opt.valueKey ?? 'id'],
|
||||
}))
|
||||
);
|
||||
} else if (opt.input) {
|
||||
// 处理输入框数据
|
||||
this.form[opt.prop] = response.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
try {
|
||||
// this.formLoading = true;
|
||||
// console.log("[dialogForm:handleOptions:promiseList]", promiseList)
|
||||
await Promise.all(promiseList.map((fn) => fn()));
|
||||
this.formLoading = false;
|
||||
// console.log("[dialogForm:handleOptions:optionListOf]", this.optionListOf)
|
||||
} catch (error) {
|
||||
console.log('[dialogForm:handleOptions:error]', error);
|
||||
this.formLoading = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
if (!promiseList.length) this.formLoading = false;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.el-select {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
97
src/views/quality/mixin/basicPageMixin.js
Normal file
97
src/views/quality/mixin/basicPageMixin.js
Normal file
@ -0,0 +1,97 @@
|
||||
import DialogForm from '../components/dialogForm.vue';
|
||||
|
||||
export default {
|
||||
components: { DialogForm },
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 质量检测信息基础列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 列表数据
|
||||
tableData: [],
|
||||
// 弹窗的表单
|
||||
// form: {}, // 占位
|
||||
// 搜索框需要的 keys
|
||||
// searchBarKeys: [], // 占位
|
||||
// tableProps: [], // 占位
|
||||
// tableBtn: [], // 占位
|
||||
// searchBarFormConfig: [], // 占位
|
||||
// // 弹窗表单配置
|
||||
// dialogFormConfig: [], // 占位
|
||||
};
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
// 处理搜索条件
|
||||
handleSearchBarBtnClick() {},
|
||||
// 处理表格按钮
|
||||
handleTableBtnClick({ data, type }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
this.handleUpdate(data);
|
||||
break;
|
||||
case 'delete':
|
||||
this.handleDelete(data);
|
||||
break;
|
||||
}
|
||||
},
|
||||
// 处理搜索栏按钮
|
||||
handleSearchBarBtnClick(btn) {
|
||||
// const keys = ['name', 'createTime']; // timeVal // 已被 searchBarKeys 替代
|
||||
switch (btn.btnName) {
|
||||
case 'search':
|
||||
this.searchBarKeys.forEach((key) => {
|
||||
if (key == 'timeVal') {
|
||||
this.queryParams['startTime'] = btn.timeVal[0];
|
||||
this.queryParams['endTime'] = btn.timeVal[1];
|
||||
return;
|
||||
}
|
||||
this.queryParams[key] = btn[key] || null;
|
||||
});
|
||||
this.handleQuery();
|
||||
break;
|
||||
case 'add':
|
||||
this.handleAdd();
|
||||
break;
|
||||
case 'export':
|
||||
this.handleExport();
|
||||
break;
|
||||
case 'reset':
|
||||
this.$refs['search-bar'].resetForm();
|
||||
this.resetQuery();
|
||||
break;
|
||||
}
|
||||
},
|
||||
handleEmitFun(val) {
|
||||
console.log('emit unf', val);
|
||||
},
|
||||
// 获取列表数据
|
||||
getList() {},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm');
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
},
|
||||
};
|
10
yarn.lock
10
yarn.lock
@ -2994,6 +2994,11 @@ coa@^2.0.2:
|
||||
chalk "^2.4.1"
|
||||
q "^1.1.2"
|
||||
|
||||
code-brick-zj@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmmirror.com/code-brick-zj/-/code-brick-zj-1.0.2.tgz#f9f5fa97faa65262e887a3a15014827ac95b1fea"
|
||||
integrity sha512-V8XwYqXjIPMfPCaZMja4I2MJPT45EEnzRmTL1Ps6aMsmUQ/PhZ48OwUvddBFNqNZeVV13aPm1b5K1c3ogfad8Q==
|
||||
|
||||
collection-visit@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.npmmirror.com/collection-visit/-/collection-visit-1.0.0.tgz"
|
||||
@ -6837,6 +6842,11 @@ moddle@^5.0.2:
|
||||
dependencies:
|
||||
min-dash "^3.0.0"
|
||||
|
||||
moment@^2.29.4:
|
||||
version "2.29.4"
|
||||
resolved "https://registry.npmmirror.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
|
||||
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==
|
||||
|
||||
move-concurrently@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npmmirror.com/move-concurrently/-/move-concurrently-1.0.1.tgz"
|
||||
|
Loading…
Reference in New Issue
Block a user