Compare commits

...

19 Commits

Author SHA1 Message Date
lb
ecfed2eddf Merge remote-tracking branch 'origin/test' into lb 2023-08-03 15:13:56 +08:00
lb
6b988bbaf7 merge 2023-08-03 15:10:49 +08:00
lb
4d0c0ae91a update 基本完成质量基础 2023-08-03 15:09:15 +08:00
lb
7c665484a7 update getCode逻辑 2023-08-03 15:03:59 +08:00
lb
1299ebd0c9 update 安灯按钮 2023-08-03 14:45:38 +08:00
lb
78777d5d24 update 2023-08-03 13:37:24 +08:00
lb
c357ab8005 update 质量检测信息 2023-08-03 11:35:16 +08:00
lb
73831ea8cf update 质量检测信息 2023-08-03 11:19:06 +08:00
3d1bc2cc98 Merge pull request '公共样式' (#8) from zjl into test
Reviewed-on: #8
2023-08-03 11:18:18 +08:00
01f459e811 公共样式 2023-08-03 11:18:03 +08:00
lb
a402a8bf63 update 2023-08-03 10:51:44 +08:00
969a5303a8 Merge pull request 'zjl' (#7) from zjl into test
Reviewed-on: #7
2023-08-02 09:24:21 +08:00
0719116cbc 班组 2023-08-02 09:17:46 +08:00
b281df661b Merge pull request 'test' (#6) from test into zjl
Reviewed-on: #6
2023-07-27 15:45:52 +08:00
50517c4244 Merge pull request 'update file structure' (#5) from lb into test
Reviewed-on: #5
2023-07-27 15:38:41 +08:00
6b9f7d7b9c Merge pull request 'test' (#4) from test into zjl
Reviewed-on: #4
2023-07-27 15:24:39 +08:00
f4662a33b9 Merge pull request 'add Files' (#3) from lb into test
Reviewed-on: #3
2023-07-27 15:20:53 +08:00
f5accd1f61 Merge pull request 'test' (#2) from test into zjl
Reviewed-on: #2
2023-07-27 14:47:59 +08:00
797dc1e029 Merge pull request 'add code-brick-zj' (#1) from lb into test
Reviewed-on: #1
2023-07-27 08:52:59 +08:00
27 changed files with 1582 additions and 858 deletions

View File

@ -43,6 +43,14 @@ export function getGroupClassesPage(query) {
}) })
} }
// 获取班组code
export function getCode() {
return request({
url: '/base/group-classes/getCode',
method: 'get'
})
}
// 导出班次基础信息 Excel // 导出班次基础信息 Excel
export function exportGroupClassesExcel(query) { export function exportGroupClassesExcel(query) {
return request({ return request({

View File

@ -43,12 +43,10 @@ export function getGroupTeamPage(query) {
}) })
} }
// 导出班组基础信息 Excel // 获取班组code
export function exportGroupTeamExcel(query) { export function getCode() {
return request({ return request({
url: '/base/group-team/export-excel', url: '/base/group-team/getCode',
method: 'get', method: 'get'
params: query,
responseType: 'blob'
}) })
} }

View File

@ -121,7 +121,7 @@ aside {
//main-container全局样式 //main-container全局样式
.app-container { .app-container {
padding: 20px; padding: 16px;
} }
.components-container { .components-container {
@ -129,10 +129,6 @@ aside {
position: relative; position: relative;
} }
.pagination-container {
margin-top: 30px;
}
.text-center { .text-center {
text-align: center text-align: center
} }

View File

@ -112,13 +112,13 @@
} }
/** 表格布局 **/ /** 表格布局 **/
.pagination-container { // .pagination-container {
position: relative; // position: relative;
height: 25px; // height: 25px;
margin-bottom: 10px; // margin-bottom: 10px;
margin-top: 15px; // margin-top: 15px;
padding: 10px 20px !important; // padding: 10px 20px !important;
} // }
/* tree border */ /* tree border */
.tree-border { .tree-border {

View File

@ -105,6 +105,10 @@
background-color: $base-sub-menu-hover !important; background-color: $base-sub-menu-hover !important;
} }
} }
& .theme-dark .el-submenu .el-menu-item.is-active {
background-color: #0b50ff !important;
}
} }
.hideSidebar { .hideSidebar {

View File

@ -9,20 +9,20 @@ $yellow:#FEC171;
$panGreen: #30B08F; $panGreen: #30B08F;
// 默认菜单主题风格 // 默认菜单主题风格
$base-menu-color:#bfcbd9; // $base-menu-color:#bfcbd9;
$base-menu-color-active:#f4f4f5; // $base-menu-color-active:#f4f4f5;
$base-menu-background:#304156; // $base-menu-background:#304156;
$base-logo-title-color: #ffffff; // $base-logo-title-color: #ffffff;
$base-menu-light-color:rgba(0,0,0,.70); // $base-menu-light-color:rgba(0,0,0,.70);
$base-menu-light-background:#ffffff; // $base-menu-light-background:#ffffff;
$base-logo-light-title-color: #001529; // $base-logo-light-title-color: #001529;
$base-sub-menu-background:#1f2d3d; // $base-sub-menu-background:#1f2d3d;
$base-sub-menu-hover:#001528; // $base-sub-menu-hover:#001528;
// 自定义暗色菜单风格 // 自定义暗色菜单风格
/** /*
$base-menu-color:hsla(0,0%,100%,.65); $base-menu-color:hsla(0,0%,100%,.65);
$base-menu-color-active:#fff; $base-menu-color-active:#fff;
$base-menu-background:#001529; $base-menu-background:#001529;
@ -35,8 +35,20 @@ $base-logo-light-title-color: #001529;
$base-sub-menu-background:#000c17; $base-sub-menu-background:#000c17;
$base-sub-menu-hover:#001528; $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 // the :export directive is the magic sauce for webpack
// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass

View File

@ -68,8 +68,12 @@ export default {
margin-left: 8px; margin-left: 8px;
.no-redirect { .no-redirect {
color: #97a8be; color: rgba(0, 0, 0, 0.65);
cursor: text; cursor: text;
} }
} }
.app-breadcrumb .el-breadcrumb__inner a, .el-breadcrumb__inner.is-link {
color: rgba(0, 0, 0, 0.45);
}
</style> </style>

View File

@ -28,11 +28,14 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.app-main { .app-main {
/* 50= navbar 50 */ /* 48= navbar 48 */
min-height: calc(100vh - 56px); min-height: calc(100vh - 56px);
width: 100%; min-width: calc(100vh - 280px);
position: relative; position: relative;
overflow: hidden; overflow: hidden;
margin: 8px 14px 0px 16px;
border-radius: 8px;
background-color: #fff;
} }
.fixed-header + .app-main { .fixed-header + .app-main {
@ -41,8 +44,8 @@ export default {
.hasTagsView { .hasTagsView {
.app-main { .app-main {
/* 84 = navbar + tags-view = 56 + 34 */ /* 84 = navbar + tags-view = 50 + 34 */
min-height: calc(100vh - 128px); min-height: calc(100vh - 120px - 8px);
} }
.fixed-header + .app-main { .fixed-header + .app-main {

View File

@ -7,16 +7,16 @@
<div class="right-menu"> <div class="right-menu">
<template v-if="device!=='mobile'"> <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" /> --> <!-- <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" /> <size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip> -->
</template> </template>
@ -30,9 +30,9 @@
<router-link to="/user/profile"> <router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item> <el-dropdown-item>个人中心</el-dropdown-item>
</router-link> </router-link>
<el-dropdown-item @click.native="setting = true"> <!-- <el-dropdown-item @click.native="setting = true">
<span>布局设置</span> <span>布局设置</span>
</el-dropdown-item> </el-dropdown-item> -->
<el-dropdown-item divided @click.native="logout"> <el-dropdown-item divided @click.native="logout">
<span>退出登录</span> <span>退出登录</span>
</el-dropdown-item> </el-dropdown-item>
@ -104,7 +104,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.navbar { .navbar {
height: 56px; height: 48px; // 56
overflow: hidden; overflow: hidden;
position: relative; position: relative;
background: #fff; background: #fff;

View File

@ -23,7 +23,7 @@
: variables.menuLightColor : variables.menuLightColor
" "
:unique-opened="true" :unique-opened="true"
:active-text-color="settings.theme" active-text-color="#fff"
:collapse-transition="false" :collapse-transition="false"
mode="vertical"> mode="vertical">
<!-- 根据 sidebarRouters 路由生成菜单 --> <!-- 根据 sidebarRouters 路由生成菜单 -->

View File

@ -78,8 +78,8 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.scroll-container { .scroll-container {
background: #f9f9f9; // background: #f9f9f9;
box-shadow: inset 0 0 8px 1px #e8e8e8; // box-shadow: inset 0 0 8px 1px #e8e8e8;
white-space: nowrap; white-space: nowrap;
position: relative; position: relative;
overflow: hidden; overflow: hidden;

View File

@ -259,7 +259,7 @@ export default {
height: 42px; height: 42px;
width: 100%; width: 100%;
background: #fff; background: #fff;
border-bottom: 1px solid #d8dce5; // border-bottom: 1px solid #d8dce5;
border-top: 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); // 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; cursor: pointer;
height: 28px; height: 28px;
line-height: 28px; line-height: 28px;
border: 1px solid #d8dce5; color: rgba(0, 0, 0, 0.45);
color: #495060; background: #F4F4F4FF;
background: #fff;
padding: 0 8px 0 12px; padding: 0 8px 0 12px;
font-size: 14px; font-size: 14px;
letter-spacing: 1px; letter-spacing: 1px;
margin-left: 4px; margin-left: 8px;
border-radius: 0; border-radius: 4px;
&:first-of-type { &:first-of-type {
margin-left: 15px; margin-left: 32px;
padding-right: 12px; padding-right: 12px;
} }

View File

@ -8,7 +8,7 @@
<tags-view v-if="needTagsView" /> <tags-view v-if="needTagsView" />
</div> </div>
<app-main /> <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;">&copy; 中建材智能自动化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;">&copy; 中建材智能自动化研究院有限公司</div>
<right-panel> <right-panel>
<settings /> <settings />
</right-panel> </right-panel>

View File

@ -49,6 +49,9 @@ Vue.prototype.DICT_TYPE = DICT_TYPE;
Vue.prototype.handleTree = handleTree; Vue.prototype.handleTree = handleTree;
Vue.prototype.addBeginAndEndTime = addBeginAndEndTime; Vue.prototype.addBeginAndEndTime = addBeginAndEndTime;
Vue.prototype.divide = divide; Vue.prototype.divide = divide;
Vue.prototype.tableHeight = function(n) {
return window.innerHeight - n
}
// 全局组件挂载 // 全局组件挂载
Vue.component('DictTag', DictTag); Vue.component('DictTag', DictTag);
@ -82,7 +85,7 @@ import Tinymce from '@/components/tinymce/index.vue';
Vue.component('tinymce', Tinymce); Vue.component('tinymce', Tinymce);
import '@/assets/icons'; import '@/assets/icons';
import request from '@/utils/request'; // 实现 form generator 使用自己定义的 axios request 对象 import request from '@/utils/request'; // 实现 form generator 使用自己定义的 axios request 对象
console.log(request); // console.log(request);
Vue.prototype.$axios = request; Vue.prototype.$axios = request;
import '@/styles/index.scss'; import '@/styles/index.scss';

View File

@ -2,7 +2,7 @@ $editorTabsborderColor: #121315;
body, html{ body, html{
margin: 0; margin: 0;
padding: 0; padding: 0;
background: #fff; background: #F2F4F9;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
@ -139,3 +139,40 @@ input, textarea{
.el-upload__tip{ .el-upload__tip{
line-height: 1.2; 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);
}

View File

@ -1,5 +1,5 @@
import axios from 'axios' import axios from 'axios'
import {Message, MessageBox, Notification} from 'element-ui' import {Message, MessageBox, Notification, Loading} from 'element-ui'
import store from '@/store' import store from '@/store'
import {getAccessToken, getRefreshToken, getTenantId, setToken} from '@/utils/auth' import {getAccessToken, getRefreshToken, getTenantId, setToken} from '@/utils/auth'
import errorCode from '@/utils/errorCode' import errorCode from '@/utils/errorCode'
@ -30,8 +30,44 @@ const service = axios.create({
// 禁用 Cookie 等信息 // 禁用 Cookie 等信息
withCredentials: false, 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拦截器 // request拦截器
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
showFullScreenLoading()
// 是否需要设置 token // 是否需要设置 token
const isToken = (config.headers || {}).isToken === false const isToken = (config.headers || {}).isToken === false
if (getAccessToken() && !isToken) { if (getAccessToken() && !isToken) {
@ -68,12 +104,14 @@ service.interceptors.request.use(config => {
} }
return config return config
}, error => { }, error => {
tryHideFullScreenLoading()
console.log(error) console.log(error)
Promise.reject(error) Promise.reject(error)
}) })
// 响应拦截器 // 响应拦截器
service.interceptors.response.use(async res => { service.interceptors.response.use(async res => {
tryHideFullScreenLoading()
// 未设置状态码则默认成功状态 // 未设置状态码则默认成功状态
const code = res.data.code || 200; const code = res.data.code || 200;
// 获取错误信息 // 获取错误信息
@ -151,6 +189,7 @@ service.interceptors.response.use(async res => {
return res.data return res.data
} }
}, error => { }, error => {
tryHideFullScreenLoading()
console.log('err' + error) console.log('err' + error)
let {message} = error; let {message} = error;
if (message === "Network Error") { if (message === "Network Error") {

View 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>

View File

@ -2,243 +2,247 @@
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <search-bar
<el-form-item label="班次名称" prop="name"> :formConfigs="formConfig"
<el-input v-model="queryParams.name" placeholder="请输入班次名称" clearable @keyup.enter.native="handleQuery"/> ref="searchBarForm"
</el-form-item> @headBtnClick="buttonClick"
<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-classes: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-classes:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 --> <!-- 列表 -->
<el-table v-loading="loading" :data="list"> <base-table
<el-table-column label="ID" align="center" prop="id" /> :page="queryParams.pageNo"
<el-table-column label="班次编码" align="center" prop="code" /> :limit="queryParams.pageSize"
<el-table-column label="班次名称" align="center" prop="name" /> :table-props="tableProps"
<el-table-column label="开始时间" align="center" prop="startTime" /> :table-data="list"
<el-table-column label="结束时间" align="center" prop="endTime" /> :max-height="tableH"
<el-table-column label="是否跨天" align="center" prop="daySpan" /> >
<el-table-column label="生效时间" align="center" prop="enableTime" width="180"> <method-btn
<template v-slot="scope"> v-if="tableBtn.length"
<span>{{ parseTime(scope.row.enableTime) }}</span> slot="handleBtn"
</template> :width="120"
</el-table-column> label="操作"
<el-table-column label="失效时间" align="center" prop="disableTime" width="180"> :method-list="tableBtn"
<template v-slot="scope"> @clickBtn="handleClick"
<span>{{ parseTime(scope.row.disableTime) }}</span> />
</template> </base-table>
</el-table-column> <pagination
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> :page.sync="queryParams.pageNo"
<template v-slot="scope"> :limit.sync="queryParams.pageSize"
<span>{{ parseTime(scope.row.createTime) }}</span> :total="total"
</template> @pagination="getList"
</el-table-column> />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <!-- 新增 -->
<template v-slot="scope"> <base-dialog
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" :dialogTitle="addOrEditTitle"
v-hasPermi="['base:group-classes:update']">修改</el-button> :dialogVisible="centervisible"
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" @cancel="handleCancel"
v-hasPermi="['base:group-classes:delete']">删除</el-button> @confirm="handleConfirm"
</template> :before-close="handleCancel"
</el-table-column> width='70%'
</el-table> >
<!-- 分页组件 --> <group-class-add ref="classList" @successSubmit="successSubmit" />
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" </base-dialog>
@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="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-item label="是否跨天" prop="daySpan">
<el-input v-model="form.daySpan" placeholder="请输入是否跨天" />
</el-form-item>
<el-form-item label="生效时间" prop="enableTime">
<el-date-picker clearable v-model="form.enableTime" type="date" value-format="timestamp" placeholder="选择生效时间" />
</el-form-item>
<el-form-item label="失效时间" prop="disableTime">
<el-date-picker clearable v-model="form.disableTime" 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>
</template> </template>
<script> <script>
import { createGroupClasses, updateGroupClasses, deleteGroupClasses, getGroupClasses, getGroupClassesPage, exportGroupClassesExcel } from "@/api/base/groupClasses"; import { getGroupClassesPage, deleteGroupClasses, updateGroupClasses } from "@/api/base/groupClasses";
import GroupClassAdd from './components/groupClassAdd.vue'
export default { import { formatDate } from '@/utils'
name: "GroupClasses", const tableProps = [
components: { {
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() { data() {
return { return {
// formConfig: [
loading: true, {
// type: 'input',
exportLoading: false, label: '班次名称',
// placeholder: '班次名称',
showSearch: true, 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, total: 0,
// //
list: [], list: [],
// //
title: "", addOrEditTitle: "",
// //
open: false, centervisible: false,
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 20,
name: null, name: null
},
//
form: {},
//
rules: {
startTime: [{ required: true, message: "开始时间不能为空", trigger: "blur" }],
endTime: [{ required: true, message: "结束时间不能为空", trigger: "blur" }],
enableTime: [{ required: true, message: "生效时间不能为空", trigger: "blur" }],
} }
}; };
}, },
created() { created() {
this.getList(); window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList()
}, },
methods: { 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() { getList() {
this.loading = true; getGroupClassesPage(this.queryParams).then(res => {
// if (res.code === 0 && res.data.list.length > 0) {
getGroupClassesPage(this.queryParams).then(response => { res.data.list.map(item => {
this.list = response.data.list; item.enableTimeStr = formatDate(item.enableTime) + '至' + (item.disableTime ? formatDate(item.disableTime) : '永久')
this.total = response.data.total; item.timeStr = item.startTime.slice(0, 5) + '-' + item.endTime.slice(0, 5)
this.loading = false; item.status = item.status === true ? '可用' : '不可用'
}); })
}, this.list = res.data.list;
/** 取消按钮 */ this.total = res.data.total;
cancel() { } else {
this.open = false; this.list = []
this.reset(); this.total = 0
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
code: undefined,
name: undefined,
startTime: undefined,
endTime: undefined,
daySpan: undefined,
enableTime: undefined,
disableTime: 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;
getGroupClasses(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) {
updateGroupClasses(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}); });
return; },
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)
} }
// },
createGroupClasses(this.form).then(response => { handleCancel() {
this.$modal.msgSuccess("新增成功"); this.$refs.classList.formClear()
this.open = false; 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.getList();
}); this.$modal.msgSuccess("操作成功");
}); }).catch(() => {});
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const id = row.id; if (row.status) {
this.$modal.confirm('是否确认删除班次基础信息编号为"' + id + '"的数据项?').then(function() { let _this = this
return deleteGroupClasses(id); _this.$modal.confirm('删除的班次"' + row.name + '"可能会影响交接班计划,请点取消再次确认!').then(function() {
return _this.$modal.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?').then(function() {
return deleteGroupClasses(row.id);
}).then(() => { }).then(() => {
this.getList(); _this.getList();
this.$modal.msgSuccess("删除成功"); _this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
}, })
/** 导出按钮操作 */ } else {
handleExport() { _this.$modal.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?').then(function() {
// return deleteGroupClasses(row.id);
let params = {...this.queryParams}; }).then(() => {
params.pageNo = undefined; _this.getList();
params.pageSize = undefined; _this.$modal.msgSuccess("删除成功");
this.$modal.confirm('是否确认导出所有班次基础信息数据项?').then(() => {
this.exportLoading = true;
return exportGroupClassesExcel(params);
}).then(response => {
this.$download.excel(response, '班次基础信息.xls');
this.exportLoading = false;
}).catch(() => {}); }).catch(() => {});
} }
} }
}
}; };
</script> </script>

View 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>

View 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>

View File

@ -2,221 +2,223 @@
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <search-bar
<el-form-item label="班组编码" prop="code"> :formConfigs="formConfig"
<el-input v-model="queryParams.code" placeholder="请输入班组编码" clearable @keyup.enter.native="handleQuery"/> ref="searchBarForm"
</el-form-item> @headBtnClick="buttonClick"
<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:group-team: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:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 --> <!-- 列表 -->
<el-table v-loading="loading" :data="list"> <base-table
<el-table-column label="ID" align="center" prop="id" /> :page="queryParams.pageNo"
<el-table-column label="班组编码" align="center" prop="code" /> :limit="queryParams.pageSize"
<el-table-column label="班组名称" align="center" prop="name" /> :table-props="tableProps"
<el-table-column label="班组人数" align="center" prop="num" /> :table-data="list"
<el-table-column label="组长名字" align="center" prop="leaderName" /> :max-height="tableH"
<el-table-column label="启用状态:0 、停用1、启用" align="center" prop="enabled" /> @emitFun="handleTableEvents"
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> >
<template v-slot="scope"> <method-btn
<span>{{ parseTime(scope.row.createTime) }}</span> v-if="tableBtn.length"
</template> slot="handleBtn"
</el-table-column> :width="80"
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> label="操作"
<template v-slot="scope"> :method-list="tableBtn"
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" @clickBtn="handleClick"
v-hasPermi="['base:group-team:update']">修改</el-button> />
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" </base-table>
v-hasPermi="['base:group-team:delete']">删除</el-button> <pagination
</template> :page.sync="queryParams.pageNo"
</el-table-column> :limit.sync="queryParams.pageSize"
</el-table> :total="total"
<!-- 分页组件 --> @pagination="getList"
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" />
@pagination="getList"/> <!-- 新增 -->
<base-dialog
<!-- 对话框(添加 / 修改) --> :dialogTitle="addOrEditTitle"
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body> :dialogVisible="centervisible"
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> @cancel="handleCancel"
<el-form-item label="班组编码" prop="code"> @confirm="handleConfirm"
<el-input v-model="form.code" placeholder="请输入班组编码" /> :before-close="handleCancel"
</el-form-item> >
<el-form-item label="班组名称" prop="name"> <group-team-add ref="groupList" @successSubmit="successSubmit" />
<el-input v-model="form.name" placeholder="请输入班组名称" /> </base-dialog>
</el-form-item>
<el-form-item label="班组人数" prop="num">
<el-input v-model="form.num" placeholder="请输入班组人数" />
</el-form-item>
<el-form-item label="组长名字" prop="leaderName">
<el-input v-model="form.leaderName" 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>
</template> </template>
<script> <script>
import { createGroupTeam, updateGroupTeam, deleteGroupTeam, getGroupTeam, getGroupTeamPage, exportGroupTeamExcel } from "@/api/base/groupTeam"; 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 { export default {
name: "GroupTeam", name: "GroupTeam",
components: { components: { GroupTeamAdd },
},
data() { data() {
return { return {
// formConfig: [
loading: true, {
// type: 'input',
exportLoading: false, label: '名称',
// placeholder: '名称',
showSearch: true, 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, total: 0,
// //
list: [], list: [],
// //
title: "", addOrEditTitle: "",
// //
open: false, centervisible: false,
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 20,
code: null,
name: null, name: null,
}, code: null
//
form: {},
//
rules: {
} }
}; };
}, },
created() { created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList(); this.getList();
}, },
methods: { 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() { getList() {
this.loading = true;
//
getGroupTeamPage(this.queryParams).then(response => { getGroupTeamPage(this.queryParams).then(response => {
this.list = response.data.list; this.list = response.data.list;
this.total = response.data.total; this.total = response.data.total;
this.loading = false;
}); });
}, },
/** 取消按钮 */ handleClick(val) {
cancel() { switch (val.type) {
this.open = false; case 'edit':
this.reset(); this.addOrEditTitle = '编辑'
}, this.$nextTick(() => {
/** 表单重置 */ this.$refs.groupList.init(val.data.id)
reset() { })
this.form = { this.centervisible = true
id: undefined, break
code: undefined, default:
name: undefined, this.handleDelete(val.data)
num: undefined,
leaderName: 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;
getGroupTeam(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) { //
updateGroupTeam(this.form).then(response => { handleTableEvents(data) {
this.$modal.msgSuccess("修改成功"); updateGroupTeam({ ...data }).then((res) => {
this.open = false; if (res.code === 0) {
this.getList(); this.$modal.msgSuccess("操作成功");
});
return;
} }
// })
createGroupTeam(this.form).then(response => { },
this.$modal.msgSuccess("新增成功"); handleCancel() {
this.open = false; this.$refs.groupList.formClear()
this.getList(); this.centervisible = false
}); this.addOrEditTitle = ''
}); },
handleConfirm() {
this.$refs.groupList.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const id = row.id; this.$modal.confirm('是否确认删除班组名称为"' + row.name + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除班组基础信息编号为"' + id + '"的数据项?').then(function() { return deleteGroupTeam(row.id);
return deleteGroupTeam(id);
}).then(() => { }).then(() => {
this.queryParams.pageNo = 1;
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有班组基础信息数据项?').then(() => {
this.exportLoading = true;
return exportGroupTeamExcel(params);
}).then(response => {
this.$download.excel(response, '班组基础信息.xls');
this.exportLoading = false;
}).catch(() => {});
} }
} }
}; };

View 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>

View File

@ -1,120 +1,243 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <SearchBar
<el-form-item> :formConfigs="searchBarFormConfig"
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> ref="search-bar"
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> @headBtnClick="handleSearchBarBtnClick" />
</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:quality-inspection-box-btn: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:quality-inspection-box-btn:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 --> <!-- 列表 -->
<el-table v-loading="loading" :data="list"> <base-table
<el-table-column label="ID" align="center" prop="id" /> :table-props="tableProps"
<el-table-column label="该按钮绑定的检测内容id" align="center" prop="inspectionDetId" /> :page="queryParams.pageNo"
<el-table-column label="检测内容设备推送消息时可能无对应id只填这个字段" align="center" prop="inspectionDetContent" /> :limit="queryParams.pageSize"
<el-table-column label="按钮盒所在产线id" align="center" prop="productionId" /> :table-data="list"
<el-table-column label="按钮盒所在工段id" align="center" prop="sectionId" /> @emit-fun="handleEmitFun">
<el-table-column label="按钮盒模式" align="center" prop="model" /> <method-btn
<el-table-column label="按钮值" align="center" prop="keyValue" /> v-if="tableBtn.length"
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> slot="handleBtn"
<template v-slot="scope"> label="操作"
<span>{{ parseTime(scope.row.createTime) }}</span> fixed="right"
</template> :method-list="tableBtn"
</el-table-column> @clickBtn="handleTableBtnClick" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> </base-table>
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['base:quality-inspection-box-btn:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['base:quality-inspection-box-btn: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
@pagination="getList"/> 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> <base-dialog
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> :dialogTitle="title"
<el-form-item label="该按钮绑定的检测内容id" prop="inspectionDetId"> :dialogVisible="open"
<el-input v-model="form.inspectionDetId" placeholder="请输入该按钮绑定的检测内容id" /> width="50%"
</el-form-item> @close="cancel"
<el-form-item label="检测内容设备推送消息时可能无对应id只填这个字段" prop="inspectionDetContent"> @cancel="cancel"
<el-input v-model="form.inspectionDetContent" type="textarea" placeholder="请输入内容" /> @confirm="submitForm">
</el-form-item> <DialogForm
<el-form-item label="按钮盒所在产线id" prop="productionId"> v-if="open"
<el-input v-model="form.productionId" placeholder="请输入按钮盒所在产线id" /> ref="form"
</el-form-item> :dataForm="form"
<el-form-item label="按钮盒所在工段id" prop="sectionId"> :rows="[
<el-input v-model="form.sectionId" placeholder="请输入按钮盒所在工段id" /> [
</el-form-item> {
<el-form-item label="按钮盒模式" prop="model"> select: true,
<el-input v-model="form.model" placeholder="请输入按钮盒模式" /> label: '产线',
</el-form-item> url: '/base/production-line/listAll',
<el-form-item label="按钮值" prop="keyValue"> prop: 'productionId',
<el-input v-model="form.keyValue" placeholder="请输入按钮值" /> rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
</el-form-item> bind: {
</el-form> filterable: true,
<div slot="footer" class="dialog-footer"> },
<el-button type="primary" @click="submitForm"> </el-button> },
<el-button @click="cancel"> </el-button> ],
</div> [
</el-dialog> {
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> </div>
</template> </template>
<script> <script>
import { createQualityInspectionBoxBtn, updateQualityInspectionBoxBtn, deleteQualityInspectionBoxBtn, getQualityInspectionBoxBtn, getQualityInspectionBoxBtnPage, exportQualityInspectionBoxBtnExcel } from "@/api/base/qualityInspectionBoxBtn"; import {
createQualityInspectionBoxBtn,
updateQualityInspectionBoxBtn,
deleteQualityInspectionBoxBtn,
getQualityInspectionBoxBtn,
getQualityInspectionBoxBtnPage,
exportQualityInspectionBoxBtnExcel,
} from '@/api/base/qualityInspectionBoxBtn';
import basicPageMixin from '../../mixin/basicPageMixin';
import moment from 'moment';
export default { export default {
name: "QualityInspectionBoxBtn", name: 'QualityInspectionBoxBtn',
components: { mixins: [basicPageMixin],
}, components: {},
data() { data() {
return { return {
// searchBarFormConfig: [
loading: true, {
// type: 'input',
exportLoading: false, label: '检查内容',
// placeholder: '请输入检查内容',
showSearch: true, param: 'inspectionDetContent',
// },
total: 0, {
// 16 type: 'button',
list: [], btnName: '查询',
// name: 'search',
title: "", color: 'primary',
// },
open: false, {
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: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
inspectionDetContent: null, inspectionDetContent: null,
}, },
// // keys, queryParams pageNo, pageSize key
form: {}, searchBarKeys: ['inspectionDetContent'],
// form: {
rules: { id: undefined,
productionId: [{ required: true, message: "按钮盒所在产线id不能为空", trigger: "blur" }], inspectionDetId: undefined,
sectionId: [{ required: true, message: "按钮盒所在工段id不能为空", trigger: "blur" }], inspectionDetContent: undefined,
} productionId: undefined,
sectionId: undefined,
model: undefined,
keyValue: undefined,
},
}; };
}, },
created() { created() {
@ -125,17 +248,12 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
// //
getQualityInspectionBoxBtnPage(this.queryParams).then(response => { getQualityInspectionBoxBtnPage(this.queryParams).then((response) => {
this.list = response.data.list; this.list = response.data.list;
this.total = response.data.total; this.total = response.data.total;
this.loading = false; this.loading = false;
}); });
}, },
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */ /** 表单重置 */
reset() { reset() {
this.form = { this.form = {
@ -147,52 +265,42 @@ export default {
model: undefined, model: undefined,
keyValue: undefined, keyValue: undefined,
}; };
this.resetForm("form"); this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加安灯按钮16键对应"; this.title = '添加安灯按钮16键对应';
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id; const id = row.id;
getQualityInspectionBoxBtn(id).then(response => { getQualityInspectionBoxBtn(id).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改安灯按钮16键对应"; this.title = '修改安灯按钮16键对应';
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs['form'].validate((valid) => {
if (!valid) { if (!valid) {
return; return;
} }
// //
if (this.form.id != null) { if (this.form.id != null) {
updateQualityInspectionBoxBtn(this.form).then(response => { updateQualityInspectionBoxBtn(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess('修改成功');
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
return; return;
} }
// //
createQualityInspectionBoxBtn(this.form).then(response => { createQualityInspectionBoxBtn(this.form).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess('新增成功');
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
@ -201,27 +309,35 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal.confirm('是否确认删除安灯按钮16键对应编号为"' + id + '"的数据项?').then(function() { this.$modal
.confirm('是否确认删除安灯按钮16键对应编号为"' + id + '"的数据项?')
.then(function () {
return deleteQualityInspectionBoxBtn(id); return deleteQualityInspectionBoxBtn(id);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess('删除成功');
}).catch(() => {}); })
.catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
// //
let params = {...this.queryParams}; let params = { ...this.queryParams };
params.pageNo = undefined; params.pageNo = undefined;
params.pageSize = undefined; params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有安灯按钮16键对应数据项?').then(() => { this.$modal
.confirm('是否确认导出所有安灯按钮16键对应数据项?')
.then(() => {
this.exportLoading = true; this.exportLoading = true;
return exportQualityInspectionBoxBtnExcel(params); return exportQualityInspectionBoxBtnExcel(params);
}).then(response => { })
.then((response) => {
this.$download.excel(response, '安灯按钮16键对应.xls'); this.$download.excel(response, '安灯按钮16键对应.xls');
this.exportLoading = false; this.exportLoading = false;
}).catch(() => {}); })
} .catch(() => {});
} },
},
}; };
</script> </script>

View File

@ -17,6 +17,7 @@
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
fixed="right"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> @clickBtn="handleTableBtnClick" />
</base-table> </base-table>
@ -33,28 +34,45 @@
<base-dialog <base-dialog
:dialogTitle="title" :dialogTitle="title"
:dialogVisible="open" :dialogVisible="open"
width="40%"
@close="cancel"
@cancel="cancel" @cancel="cancel"
@confirm="submitForm"> @confirm="submitForm">
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <DialogForm
<el-form-item label="检测类型id" prop="typeId"> v-if="open"
<el-select v-model="form.typeId" placeholder="请选择检测类型"> ref="form"
<el-option :dataForm="form"
v-for="opt in typeList" :rows="[
:key="opt.value" [
:label="opt.label" {
:value="opt.value" /> select: true,
</el-select> label: '检测类型',
</el-form-item> prop: 'typeId',
<el-form-item label="检测内容" prop="content"> url: '/base/quality-inspection-type/listAll',
<el-input v-model="form.content" placeholder="请输入检测内容" /> rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
</el-form-item> bind: {
<el-form-item label="检测编码" prop="code"> filterable: true,
<el-input v-model="form.code" placeholder="请输入检测编码" /> },
</el-form-item> },
<el-form-item label="备注" prop="remark"> ],
<el-input v-model="form.remark" placeholder="请输入备注" /> [
</el-form-item> {
</el-form> 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> </base-dialog>
</div> </div>
</template> </template>
@ -71,9 +89,11 @@ import {
import moment from 'moment'; import moment from 'moment';
import basicPageMixin from '../../mixin/basicPageMixin';
export default { export default {
name: 'QualityInspectionDet', name: 'QualityInspectionDet',
components: {}, mixins: [basicPageMixin],
data() { data() {
return { return {
typeList: [], // typeList: [], //
@ -84,19 +104,20 @@ export default {
placeholder: '请输入检测内容', placeholder: '请输入检测内容',
param: 'content', param: 'content',
}, },
{ // {
type: 'datePicker', // type: 'datePicker',
label: '创建时间', // label: '',
dateType: 'daterange', // datetimerange // dateType: 'daterange', // datetimerange
format: 'yyyy-MM-dd HH:mm:ss', // // format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-ddTHH:mm:ss', // format: 'yyyy-MM-dd',
rangeSeparator: '-', // valueFormat: 'yyyy-MM-dd HH:mm:ss',
startPlaceholder: '开始日期', // rangeSeparator: '-',
endPlaceholder: '结束日期', // startPlaceholder: '',
defaultTime: ['00:00:00', '23:59:59'], // endPlaceholder: '',
param: 'createTime', // defaultTime: ['00:00:00', '23:59:59'],
width: 350, // param: 'createTime',
}, // width: 350,
// },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
@ -143,7 +164,6 @@ export default {
} }
: undefined, : undefined,
].filter((v) => v), ].filter((v) => v),
tableData: [],
tableProps: [ tableProps: [
{ {
prop: 'createTime', prop: 'createTime',
@ -152,25 +172,11 @@ export default {
width: 180, width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
}, },
{ prop: 'typeId', label: '检测类型ID', align: 'center' }, { prop: 'typeName', label: '类型名称', align: 'center' },
{ prop: 'content', label: '检测类型内容', align: 'center' }, { prop: 'content', label: '检测内容', align: 'center' },
{ prop: 'code', label: '检测编码', align: 'center' }, { prop: 'code', label: '检测编码', align: 'center' },
{ prop: 'remark', label: '备注', align: 'center' }, { prop: 'remark', label: '备注', align: 'center' },
], ],
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: '',
//
open: false,
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
@ -178,16 +184,14 @@ export default {
content: null, content: null,
createTime: [], createTime: [],
}, },
// // keys, queryParams pageNo, pageSize key
form: {}, searchBarKeys: ['content', 'createTime'],
// form: {
rules: { id: undefined,
typeId: [ typeId: undefined,
{ required: true, message: '检测类型id不能为空', trigger: 'change' }, content: undefined,
], code: undefined,
content: [ remark: undefined,
{ required: true, message: '检测内容不能为空', trigger: 'blur' },
],
}, },
}; };
}, },
@ -196,59 +200,16 @@ export default {
this.getTypeList(); this.getTypeList();
}, },
methods: { 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', 'createTime']; // timeVal
switch (btn.btnName) {
case 'search':
keys.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);
},
/** 获取检测类型id */ /** 获取检测类型id */
getTypeList() { getTypeList() {
this.$axios('/base/quality-inspection-type/listAll').then( this.$axios('/base/quality-inspection-type/listAll').then((response) => {
(response) => {
this.typeList = response.data.map((item) => { this.typeList = response.data.map((item) => {
return { return {
label: item.name, label: item.name,
value: item.id, value: item.id,
}; };
}); });
} });
);
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
@ -260,11 +221,6 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */ /** 表单重置 */
reset() { reset() {
this.form = { this.form = {
@ -276,16 +232,6 @@ export default {
}; };
this.resetForm('form'); this.resetForm('form');
}, },
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();

View File

@ -52,7 +52,14 @@
// } // }
}, },
], ],
[{ input: true, label: '检测类型编码', prop: 'code' }], [
{
input: true,
label: '检测类型编码',
prop: 'code',
url: '/base/quality-inspection-type/getCode',
},
],
[{ input: true, label: '备注', prop: 'remark' }], [{ input: true, label: '备注', prop: 'remark' }],
]" /> ]" />
</base-dialog> </base-dialog>
@ -61,7 +68,6 @@
<script> <script>
import moment from 'moment'; import moment from 'moment';
import DialogForm from '../../components/dialogForm.vue';
import { import {
createQualityInspectionType, createQualityInspectionType,
@ -71,10 +77,11 @@ import {
getQualityInspectionTypePage, getQualityInspectionTypePage,
exportQualityInspectionTypeExcel, exportQualityInspectionTypeExcel,
} from '@/api/base/qualityInspectionType'; } from '@/api/base/qualityInspectionType';
import basicPageMixin from '../../mixin/basicPageMixin';
export default { export default {
name: 'QualityInspectionType', name: 'QualityInspectionType',
components: { DialogForm }, mixins: [basicPageMixin],
data() { data() {
return { return {
tableBtn: [ tableBtn: [
@ -91,7 +98,6 @@ export default {
} }
: undefined, : undefined,
].filter((v) => v), ].filter((v) => v),
tableData: [],
tableProps: [ tableProps: [
{ {
prop: 'createTime', prop: 'createTime',
@ -192,18 +198,6 @@ export default {
// [{ input: true, label: '', prop: 'code' }], // [{ input: true, label: '', prop: 'code' }],
// [{ input: true, label: '', prop: 'remark' }], // [{ input: true, label: '', prop: 'remark' }],
// ], // ],
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: '',
// //
open: false, open: false,
// //
@ -261,7 +255,6 @@ export default {
break; break;
} }
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
@ -272,11 +265,6 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */ /** 表单重置 */
reset() { reset() {
this.form = { this.form = {
@ -287,25 +275,12 @@ export default {
}; };
this.resetForm('form'); this.resetForm('form');
}, },
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = '添加质量检测类型基础'; this.title = '添加质量检测类型基础';
}, },
handleEmitFun(val) {
console.log('emit unf', val);
},
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();

View File

@ -18,10 +18,19 @@
v-if="col.input" v-if="col.input"
v-model="form[col.prop]" v-model="form[col.prop]"
@change="$emit('update', form)" @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" /> v-bind="col.bind" />
<el-select <el-select
v-if="col.select" v-if="col.select"
v-model="form[col.prop]" v-model="form[col.prop]"
:placeholder="`请选择${col.label}`"
@change="$emit('update', form)" @change="$emit('update', form)"
v-bind="col.bind"> v-bind="col.bind">
<el-option <el-option
@ -73,7 +82,7 @@ export default {
}, },
data() { data() {
return { return {
formLoading: false, formLoading: true,
optionListOf: {}, optionListOf: {},
}; };
}, },
@ -90,7 +99,6 @@ export default {
}, },
set(val) { set(val) {
console.log('set form', val); console.log('set form', val);
// this.$emit('update', val);
}, },
}, },
}, },
@ -106,21 +114,32 @@ export default {
resetFields(args) { resetFields(args) {
return this.$refs.form.resetFields(args); return this.$refs.form.resetFields(args);
}, },
// getCode
async getCode(url) {
const response = await this.$axios(url);
return response.data;
},
handleOptions() { handleOptions() {
// console.log("[dialogForm:handleOptions]")
const promiseList = []; const promiseList = [];
this.rows.forEach((cols) => { this.rows.forEach((cols) => {
cols.forEach(async (opt) => { cols.forEach(async (opt) => {
if (opt.options) { if (opt.options) {
this.optionListOf[opt.prop] = opt.options; this.optionListOf[opt.prop] = opt.options;
} else if (opt.url) { } else if (opt.url) {
//
if (opt.select || (opt.input && !this.form?.id)) {
promiseList.push(async () => { promiseList.push(async () => {
const response = await this.$axios(opt.url, { const response = await this.$axios(opt.url, {
method: opt.method ?? 'get', method: opt.method ?? 'get',
}); });
console.log('[dialogForm:handleOptions:response]', response); console.log('[dialogForm:handleOptions:response]', response);
if (opt.select) {
//
const list = const list =
'list' in response.data ? response.data.list : response.data; 'list' in response.data
? response.data.list
: response.data;
this.$set( this.$set(
this.optionListOf, this.optionListOf,
opt.prop, opt.prop,
@ -129,11 +148,18 @@ export default {
value: item[opt.valueKey ?? 'id'], value: item[opt.valueKey ?? 'id'],
})) }))
); );
} else if (opt.input) {
//
this.form[opt.prop] = response.data;
}
}); });
}
try { try {
this.formLoading = true; // this.formLoading = true;
await Promise.all(promiseList); // console.log("[dialogForm:handleOptions:promiseList]", promiseList)
await Promise.all(promiseList.map((fn) => fn()));
this.formLoading = false; this.formLoading = false;
// console.log("[dialogForm:handleOptions:optionListOf]", this.optionListOf)
} catch (error) { } catch (error) {
console.log('[dialogForm:handleOptions:error]', error); console.log('[dialogForm:handleOptions:error]', error);
this.formLoading = false; this.formLoading = false;
@ -141,10 +167,14 @@ export default {
} }
}); });
}); });
// this.formLoading = false; if (!promiseList.length) this.formLoading = false;
}, },
}, },
}; };
</script> </script>
<style scoped lang="scss"></style> <style scoped lang="scss">
.el-select {
width: 100%;
}
</style>

View File

@ -1,4 +1,7 @@
import DialogForm from '../components/dialogForm.vue';
export default { export default {
components: { DialogForm },
data() { data() {
return { return {
// 遮罩层 // 遮罩层
@ -15,28 +18,20 @@ export default {
title: '', title: '',
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
// 查询参数
queryParams: {
pageNo: 1,
pageSize: 10,
},
// 列表数据 // 列表数据
tableData: [], tableData: [],
tableProps: [], // 占位 // 弹窗的表单
tableBtn: [], // 占位 // form: {}, // 占位
searchBarFormConfig: [], // 占位 // 搜索框需要的 keys
// 弹窗表单配置 // searchBarKeys: [], // 占位
dialogFormConfig: [], // 占位 // tableProps: [], // 占位
// tableBtn: [], // 占位
// searchBarFormConfig: [], // 占位
// // 弹窗表单配置
// dialogFormConfig: [], // 占位
}; };
}, },
mounted() { mounted() {},
if (this.prepareSelectOptions) {
// 准备列表的options
// TODO: 也许需要挪到 dialogForm.vue 里
this.prepareSelectOptions();
}
},
methods: { methods: {
// 处理搜索条件 // 处理搜索条件
handleSearchBarBtnClick() {}, handleSearchBarBtnClick() {},
@ -53,10 +48,10 @@ export default {
}, },
// 处理搜索栏按钮 // 处理搜索栏按钮
handleSearchBarBtnClick(btn) { handleSearchBarBtnClick(btn) {
const keys = ['name', 'createTime']; // timeVal // const keys = ['name', 'createTime']; // timeVal // 已被 searchBarKeys 替代
switch (btn.btnName) { switch (btn.btnName) {
case 'search': case 'search':
keys.forEach((key) => { this.searchBarKeys.forEach((key) => {
if (key == 'timeVal') { if (key == 'timeVal') {
this.queryParams['startTime'] = btn.timeVal[0]; this.queryParams['startTime'] = btn.timeVal[0];
this.queryParams['endTime'] = btn.timeVal[1]; this.queryParams['endTime'] = btn.timeVal[1];
@ -83,5 +78,20 @@ export default {
}, },
// 获取列表数据 // 获取列表数据
getList() {}, getList() {},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
}, },
}; };