This commit is contained in:
朱文强 2025-01-15 13:35:15 +08:00
parent 19dbe38458
commit 0b03e6d44b
33 changed files with 4809 additions and 1234 deletions

View File

@ -51,6 +51,13 @@ export function getCode() {
})
}
// 获得可用的班次列表
export function listClassesEnabled() {
return request({
url: '/base/group-classes/listEnable',
method: 'get'
})
}
// 导出班次基础信息 Excel
export function exportGroupClassesExcel(query) {
return request({

View File

@ -0,0 +1,125 @@
import request from '@/utils/request'
// 创建排班计划配置基础信息
export function createGroupPlan(data) {
return request({
url: '/base/group-scheduling-plan/create',
method: 'post',
data: data
})
}
// 更新排班计划配置基础信息
export function updateGroupPlan(data) {
return request({
url: '/base/group-scheduling-plan/update',
method: 'put',
data: data
})
}
// 删除排班计划配置基础信息
export function deleteGroupPlan(id) {
return request({
url: '/base/group-scheduling-plan/delete?id=' + id,
method: 'delete'
})
}
// 获得排班计划配置基础信息
export function getGroupPlan(id) {
return request({
url: '/base/group-scheduling-plan/get?id=' + id,
method: 'get'
})
}
// 获得排班计划配置基础信息分页
export function getGroupPlanPage(query) {
return request({
url: '/base/group-scheduling-plan/page',
method: 'get',
params: query
})
}
// 获得所有排班计划列表
export function groupPlanList() {
return request({
url: '/base/group-scheduling-plan/listAll',
method: 'get'
})
}
// 获得排班计划相关班组列表
export function groupPlanTeamList(id) {
return request({
url: '/base/group-scheduling-plan-team/teamListByPlanId?planId=' + id,
method: 'get'
})
}
// 获得排班计划相关班次列表
export function groupPlanClassesList(id) {
return request({
url: '/base/group-scheduling-plan-classes/classesListByPlanId?planId=' + id,
method: 'get'
})
}
// 获取code
export function getCode() {
return request({
url: '/base/group-scheduling-plan/getCode',
method: 'get'
})
}
// 导出排班计划配置基础信息 Excel
export function exportGroupPlanExcel(query) {
return request({
url: '/base/group-scheduling-plan/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得产线工段树形结构
export function getGroupPlanTree() {
return request({
url: '/base/group-scheduling-plan/getLineSectionTree',
method: 'get'
})
}
// 创建排班计划产线工段
export function createGroupPlanLine(data) {
return request({
url: '/base/group-scheduling-plan-line-section/createPlanLineSection',
method: 'post',
data: data
})
}
// 更新排班计划产线工段
export function updateGroupPlanLine(data) {
return request({
url: '/base/group-scheduling-plan-line-section/updatePlanLineSection',
method: 'put',
data: data
})
}
// 获得排班计划配置基础信息
export function getGroupPlanLine(id) {
return request({
url: '/base/group-scheduling-plan-line-section/getLineSectionByPlanId?planId=' + id,
method: 'get'
})
}
// 获得当前登录用户所在部门id
export function getLoginUserDeptId() {
return request({
url: '/base/group-scheduling-plan-line-section/getLoginUserDeptId',
method: 'get'
})
}

View File

@ -0,0 +1,60 @@
import request from '@/utils/request'
// 创建排班规则基础信息
export function createGroupRule(data) {
return request({
url: '/base/group-scheduling-rule/create',
method: 'post',
data: data
})
}
// 作废排班规则
export function disableGroupRule(id) {
return request({
url: '/base/group-scheduling-rule/disable?id=' + id,
method: 'post',
})
}
// 更新排班规则基础信息
export function updateGroupRule(data) {
return request({
url: '/base/group-scheduling-rule/update',
method: 'put',
data: data
})
}
// 删除排班规则基础信息
export function deleteGroupRule(id) {
return request({
url: '/base/group-scheduling-rule/delete?id=' + id,
method: 'delete'
})
}
// 获得排班规则基础信息
export function getGroupRule(id) {
return request({
url: '/base/group-scheduling-rule/get?id=' + id,
method: 'get'
})
}
// 获得排班规则基础信息分页
export function getGroupRulePage(query) {
return request({
url: '/base/group-scheduling-rule/page',
method: 'get',
params: query
})
}
// 导出排班规则基础信息 Excel
export function exportGroupRuleExcel(query) {
return request({
url: '/base/group-scheduling-rule/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -58,3 +58,49 @@ export function listEnabled() {
method: 'get'
})
}
// 获得班组组员信息分页
export function groupTeamPage(query) {
return request({
url: '/base/group-team-det/page',
method: 'get',
params: query
})
}
// 获得班组组员信息
export function groupTeamDet(query) {
return request({
url: '/base/group-team-det/get',
method: 'get',
params: query
})
}
// 创建班组组员信息
export function teamDetCreate(data) {
return request({
url: '/base/group-team-det/create',
method: 'post',
data: data
})
}
// 更新班组组员信息
export function teamDetUpdate(data) {
return request({
url: '/base/group-team-det/update',
method: 'put',
data: data
})
}
// 删除班组组员信息
export function teamDetDelete(query) {
return request({
url: '/base/group-team-det/delete',
method: 'delete',
params: query
})
}

View File

@ -8,7 +8,14 @@ export function getPreset(query) {
params: query
})
}
// 获取某月预排班
export function getScheduling(query) {
return request({
url: '/base/group-team-scheduling/getScheduling',
method: 'get',
params: query
})
}
// 批量创建-更新排班信息
export function createOrUpdateList(data) {
return request({
@ -26,3 +33,12 @@ export function autoSet(query) {
params: query
})
}
// 获得排班信息分页
export function schedulingPage(query) {
return request({
url: '/base/group-team-scheduling/page',
method: 'get',
params: query
})
}

26
src/api/base/worker.js Normal file
View File

@ -0,0 +1,26 @@
import request from '@/utils/request'
// 获得所有员工列表
export function getWorkerList() {
return request({
url: '/base/core-worker/listAll',
method: 'get'
})
}
// 获得员工
export function getWorker(query) {
return request({
url: '/base/core-worker/get',
method: 'get',
params: query
})
}
// 获得该班组其他可选组员列表(除去现有组员)
export function otherWorkerList(query) {
return request({
url: '/base/group-team-det/otherWorkerList',
method: 'get',
params: query
})
}

View File

@ -40,3 +40,20 @@ export function getProductAuto(data) {
data: data
})
}
// 班组自动报表分页
export function getTeamReportPage(query) {
return request({
url: '/monitoring/team-auto-report/page',
method: 'get',
params: query
})
}
// 班组自动报表分页详细
export function getTeamReportPageDet(id) {
return request({
url: '/monitoring/team-auto-report/pageDet?id=' + id,
method: 'get',
})
}

View File

@ -0,0 +1,20 @@
export default {
data() {
return {
tableH: this.tableHeight(260),
};
},
created() {
this.tableH = this?.heightNum ? this.tableHeight(this.heightNum) : this.tableHeight(260);
window.addEventListener('resize', this._setTableHeight);
},
destroyed() {
window.removeEventListener('resize', this._setTableHeight);
},
methods: {
_setTableHeight() {
this.tableH = this?.heightNum ? this.tableHeight(this.heightNum) : this.tableHeight(260);
// this.tableH = this.tableHeight(260);
},
},
};

View File

@ -4,7 +4,8 @@
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
@select-changed="handleSearchBarChanged"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
@ -52,6 +53,8 @@ import {
getEquipmentBindSectionPage,
exportEquipmentBindSectionExcel,
} from '@/api/base/equipmentBindSection';
import { getPdList } from '@/api/core/monitoring/auto';
import { getFactoryPage } from '@/api/core/base/factory';
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import DialogForm from './dialogForm.vue';
@ -61,7 +64,7 @@ export default {
mixins: [basicPageMixin],
data() {
return {
searchBarKeys: ['workshopSectionId', 'equipmentName'],
searchBarKeys: ['factoryId','productionLineId','workshopSectionId', 'equipmentName'],
tableBtn: [
this.$auth.hasPermi('base:equipment-bind-section:update')
? {
@ -84,8 +87,9 @@ export default {
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{ prop: 'productionLine', label: '产线名称' },
{ prop: 'workshopSection', label: '工段名称' },
{ prop: 'factoryName', label: '工厂' },
{ prop: 'productionLine', label: '产线' },
{ prop: 'workshopSection', label: '工段' },
{ prop: 'equipment', label: '设备名称' },
{ prop: 'sort', label: '工段中排序' },
{
@ -129,6 +133,20 @@ export default {
// },
],
searchBarFormConfig: [
{
type: 'select',
label: '工厂',
selectOptions: [],
param: 'factoryId',
onchange: true,
},
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'productionLineId',
multiple: true,
},
{
type: 'select',
label: '工段',
@ -235,6 +253,8 @@ export default {
pageSize: 10,
workshopSectionId: null,
equipmentId: null,
factoryId: null,
productionLineId: [],
},
//
form: {},
@ -243,6 +263,7 @@ export default {
created() {
this.getList();
this.initWorksection();
this.getPdLineList();
},
methods: {
/** 准备工段数据 */
@ -252,7 +273,7 @@ export default {
method: 'get',
});
if (code == 0) {
this.searchBarFormConfig[0].selectOptions = data.map((item) => {
this.searchBarFormConfig[2].selectOptions = data.map((item) => {
return {
name: item.name,
id: item.id,
@ -260,6 +281,51 @@ export default {
});
}
},
getPdLineList() {
getPdList().then((res) => {
this.searchBarFormConfig[1].selectOptions = res.data || [];
});
const params = {
pageSize: 100,
pageNo: 1,
};
getFactoryPage(params).then((res) => {
this.searchBarFormConfig[0].selectOptions = res.data.list || [];
});
},
handleSearchBarChanged({ param, value }) {
this.queryParams.productionLineId = [];
this.$refs['search-bar'].formInline.productionLineId = undefined;
getPdList(value).then((res) => {
this.searchBarFormConfig[1].selectOptions = res.data || [];
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.pageSize = 10;
this.queryParams.name = val.name;
this.queryParams.workshopSectionId = val.workshopSectionId || undefined;
this.queryParams.equipmentId = val.equipmentId || undefined;
this.queryParams.factoryId = val.factoryId || undefined;
this.queryParams.productionLineId = val.productionLineId || [];
this.handleQuery();
break;
case 'add':
this.handleAdd();
break;
case 'export':
this.handleExport();
break;
case 'reset':
this.$refs['search-bar'].resetForm();
this.resetQuery();
break;
default:
console.log(val);
}
},
/** 查询列表 */
getList() {
this.loading = true;

View File

@ -3,6 +3,7 @@
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@select-changed="handleSearchBarChanged"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
@ -23,8 +24,14 @@ import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import { getLineBindProcessLogPage } from '@/api/core/base/lineBindProcess';
import { getProductionLinePage } from '@/api/core/base/productionLine';
import { getPdList } from '@/api/core/monitoring/auto';
import { getFactoryPage } from '@/api/core/base/factory';
const tableProps = [
{
prop: 'factoryName',
label: '工厂'
},
{
prop: 'lineName',
label: '产线',
@ -49,15 +56,24 @@ export default {
},
tableProps,
tableData: [],
optionArrUrl: [getProductionLinePage],
optionArrUrl: [getFactoryPage,getProductionLinePage],
listQuery: {
productionLineId: [],
},
formConfig: [
{
type: 'select',
label: '工厂',
selectOptions: [],
param: 'factoryId',
onchange: true,
},
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'productionLineId',
defaultSelect: '',
filterable: true,
multiple: true,
},
{
type: 'select',
@ -99,6 +115,13 @@ export default {
this.getArr();
},
methods: {
handleSearchBarChanged({ param, value }) {
this.listQuery.productionLineId = [];
this.$refs.searchBarForm.formInline.productionLineId = undefined;
getPdList(value).then((res) => {
this.formConfig[1].selectOptions = res.data || [];
});
},
getArr() {
const params = {
page: 1,
@ -115,7 +138,8 @@ export default {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.productionLineId = val.productionLineId;
this.listQuery.factoryId = val.factoryId || undefined;
this.listQuery.productionLineId = val.productionLineId || [];
this.listQuery.processDict = val.processDict;
this.listQuery.recordTime = val.startTime
? [val.startTime[0], val.startTime[1].substr(0, 10) + ' 23:59:59']

View File

@ -3,6 +3,7 @@
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@select-changed="handleSearchBarChanged"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
@ -24,8 +25,14 @@ 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';
import { getFactoryPage } from '@/api/core/base/factory';
import { getPdList } from '@/api/core/monitoring/auto';
const tableProps = [
{
prop: 'factoryName',
label: '工厂'
},
{
prop: 'productionLineName',
label: '产线',
@ -55,15 +62,24 @@ export default {
},
tableProps,
tableData: [],
optionArrUrl: [getProductionLinePage, getProductPage],
listQuery: {
productionLineId: [],
},
optionArrUrl: [getFactoryPage,getProductionLinePage, getProductPage],
formConfig: [
{
type: 'select',
label: '工厂',
selectOptions: [],
param: 'factoryId',
onchange: true,
},
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'productionLineId',
defaultSelect: '',
filterable: true,
multiple: true,
},
{
type: 'select',
@ -104,6 +120,13 @@ export default {
this.getArr();
},
methods: {
handleSearchBarChanged({ param, value }) {
this.listQuery.productionLineId = [];
this.$refs.searchBarForm.formInline.productionLineId = undefined;
getPdList(value).then((res) => {
this.formConfig[1].selectOptions = res.data || [];
});
},
getArr() {
const params = {
page: 1,
@ -120,7 +143,8 @@ export default {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.productionLineId = val.productionLineId;
this.listQuery.factoryId = val.factoryId || undefined;
this.listQuery.productionLineId = val.productionLineId || [];
this.listQuery.productId = val.productId;
this.listQuery.startTime = val.startTime ? val.startTime : null;
this.getDataList();

View File

@ -3,6 +3,7 @@
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@select-changed="handleSearchBarChanged"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
@ -46,6 +47,8 @@ import {
getWorkshopSectionPage,
exportWorkshopSectionExcel
} from "@/api/core/base/workshopSection";
import { getPdList } from '@/api/core/monitoring/auto';
import { getFactoryPage } from '@/api/core/base/factory';
const tableProps = [
{
@ -56,6 +59,10 @@ const tableProps = [
prop: 'name',
label: '工段名称'
},
{
prop: 'factoryName',
label: '工厂'
},
{
prop: 'productionLineName',
label: '产线'
@ -99,8 +106,25 @@ export default {
}
: undefined,
].filter((v)=>v),
listQuery: {
lineId: [],
},
tableData: [],
formConfig: [
{
type: 'select',
label: '工厂',
selectOptions: [],
param: 'factoryId',
onchange: true,
},
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'lineId',
multiple: true,
},
{
type: 'input',
label: '工段名称',
@ -146,14 +170,37 @@ export default {
components: {
AddOrUpdate,
},
created() {},
created() {
this.getPdLineList();
},
methods: {
getPdLineList() {
getPdList().then((res) => {
this.formConfig[1].selectOptions = res.data || [];
});
const params = {
pageSize: 100,
pageNo: 1,
};
getFactoryPage(params).then((res) => {
this.formConfig[0].selectOptions = res.data.list || [];
});
},
handleSearchBarChanged({ param, value }) {
this.listQuery.lineId = [];
this.$refs.searchBarForm.formInline.lineId = undefined;
getPdList(value).then((res) => {
this.formConfig[1].selectOptions = res.data || [];
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.factoryId = val.factoryId || undefined;
this.listQuery.lineId = val.lineId || [];
this.getDataList();
break;
case 'reset':

View File

@ -1,7 +1,7 @@
<!--
* @Author: Do not edit
* @Date: 2023-08-29 14:59:29
* @LastEditTime: 2025-01-07 10:53:31
* @LastEditTime: 2025-01-14 09:53:23
* @LastEditors: zwq
* @Description:
-->
@ -30,7 +30,7 @@
</template>
<script>
import { parseTime } from '../../mixins/code-filter';
import { parseTime } from '@/filter/code-filter';
import { getLineAuto, getPdList } from '@/api/core/monitoring/auto';
import { getFactoryPage } from '@/api/core/base/factory';
// import codeFilter from '../../mixins/code-filter'

View File

@ -1,6 +1,22 @@
<template>
<el-form ref="form" :rules="rules" label-width="110px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="工厂" prop="factoryId">
<el-select
v-model="form.factoryId"
filterable
clearable
style="width: 100%"
placeholder="请选择工厂">
<el-option
v-for="item in factoryArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="班次名称" prop="name">
<el-input v-model="form.name"></el-input>
@ -11,70 +27,40 @@
<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('start')"
>
</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('end')"
>
</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="startTime">
<el-time-picker
v-model="form.startTime"
format="HH:mm"
value-format="HH:mm"
style="width: 100%"
@change="timeFun('start')"></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('end')"></el-time-picker>
</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
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>
@ -82,107 +68,115 @@
</el-form>
</template>
<script>
import { getGroupClasses, updateGroupClasses, createGroupClasses, getCode } from '@/api/base/groupClasses'
import {
getGroupClasses,
updateGroupClasses,
createGroupClasses,
getCode,
} from '@/api/base/groupClasses';
import { getFactoryPage } from '@/api/core/base/factory';
export default {
name: 'groupClassAdd',
data() {
return {
form: {
id: '',
factoryId: '',
name: '',
code: '',
enableTime: '',
disableTime: '',
startTime: '',
endTime: '',
daySpan: '',
remark: ''
remark: '',
},
isEdit: false, //
factoryArr: [],
rules: {
factoryId: [
{ required: true, message: '请选择工厂', trigger: 'change' },
],
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' }]
}
}
startTime: [
{ required: true, message: '请输入生效时间', trigger: 'change' },
],
endTime: [
{ required: true, message: '请选择班次结束时间', trigger: 'change' },
],
},
};
},
created() {
const params = {
pageSize: 100,
pageNo: 1,
};
getFactoryPage(params).then((res) => {
this.factoryArr = res.data.list || [];
});
},
methods: {
init(id) {
if (id) {
this.isEdit = true
this.form.id = id
this.isEdit = true;
this.form.id = id;
getGroupClasses(id).then((res) => {
if (res.code === 0) {
this.form = res.data
this.form = res.data;
}
})
});
} else {
this.isEdit = false
this.form.id = ''
this.isEdit = false;
this.form.id = '';
getCode().then((res) => {
this.form.code = res.data
})
this.form.code = res.data;
});
}
},
timeFun(val) {
if (this.form.startTime && this.form.endTime) {
if (this.form.startTime > this.form.endTime) {
this.form.daySpan = 1
this.form.daySpan = 1;
} else if (this.form.startTime < this.form.endTime) {
this.form.daySpan = 0
this.form.daySpan = 0;
} else {
if (val === 'start') {
this.form.startTime = ''
this.form.startTime = '';
} else {
this.form.endTime = ''
this.form.endTime = '';
}
this.$modal.msgWarning('班次开始时间和结束时间不能相同')
this.$modal.msgWarning('班次开始时间和结束时间不能相同');
}
}
},
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) => {
updateGroupClasses({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
})
});
} else {
createGroupClasses({ ...obj }).then((res) => {
createGroupClasses({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
})
});
}
} else {
return false
return false;
}
})
});
},
formClear() {
this.$refs.form.resetFields()
this.isEdit = false
}
}
}
this.$refs.form.resetFields();
this.isEdit = false;
},
},
};
</script>

View File

@ -0,0 +1,53 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:53:55
* @LastEditors: zwq
* @LastEditTime: 2025-01-14 13:09:33
* @Description:
-->
<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
}
},
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() {
let params = {}
let payload = {}
params.name = 'state'
payload.id = this.injectData.id
payload.enabled = this.state ? '1' : '0'
payload.startTime = this.injectData.startTime
payload.endTime = this.injectData.endTime
payload.factoryId = this.injectData.factoryId
params.payload = payload
this.$emit('emitData', params)
}
}
}
</script>

View File

@ -1,12 +1,17 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:53:55
* @LastEditors: zwq
* @LastEditTime: 2025-01-15 13:15:05
* @Description:
-->
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick"
/>
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
@ -14,22 +19,20 @@
:table-props="tableProps"
:table-data="list"
:max-height="tableH"
>
@emitFun="handleTableEvents">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
@clickBtn="handleClick" />
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
@pagination="getList" />
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
@ -37,224 +40,250 @@
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width='50%'
>
width="50%">
<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'
import {
getGroupClassesPage,
deleteGroupClasses,
updateGroupClasses,
} from '@/api/base/groupClasses';
import GroupClassAdd from './components/groupClassAdd.vue';
import StatusBtn from './components/statusBtn';
import tableHeightMixin from '@/mixins/tableHeightMixin';
import { getFactoryPage } from '@/api/core/base/factory';
const tableProps = [
{
prop: 'enableTimeStr',
label: '生效时段',
minWidth: 300
prop: 'factoryName',
label: '工厂',
},
{
prop: 'name',
label: '班次名称'
label: '班次名称',
},
{
prop: 'timeStr',
label: '班次时间',
minWidth: 100
minWidth: 100,
},
{
prop: 'code',
label: '班次编码',
minWidth: 200
minWidth: 200,
},
{
prop: 'status',
label: '班次状态'
prop: 'enabled',
label: '班次状态',
subcomponent: StatusBtn,
},
{
prop: 'remark',
label: '备注'
}
]
// {
// prop: 'remark',
// label: '',
// },
];
export default {
name: "GroupClass",
name: 'GroupClass',
components: { GroupClassAdd },
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
{
type: 'select',
label: '工厂',
selectOptions: [],
param: 'factoryId',
onchange: true,
},
{
type: 'input',
label: '班次名称',
placeholder: '班次名称',
param: 'name'
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
color: 'primary',
},
{
type: 'separate'
type: 'separate',
},
{
type: this.$auth.hasPermi('base:group-classes:create') ? 'button' : '',
type: this.$auth.hasPermi('base:group-classes:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
plain: true,
},
],
tableProps,
tableBtn: [
{
type: 'cancel',
btnName: '作废',
showParam: {
type: '&',
data: [
{
type: 'unequal',
name: 'status',
value: '不可用'
}
]
}
},
this.$auth.hasPermi('base:group-classes:update')
? {
type: 'edit',
btnName: '编辑'
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:group-classes:delete')
? {
type: 'delete',
btnName: '删除'
btnName: '删除',
}
: undefined
: undefined,
].filter((v) => v),
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
//
addOrEditTitle: "",
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: null
}
name: null,
},
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList()
this.getList();
this.getPdLineList();
},
methods: {
getPdLineList() {
const params = {
pageSize: 100,
pageNo: 1,
};
getFactoryPage(params).then((res) => {
this.formConfig[0].selectOptions = res.data.list || [];
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.name = val.name
this.getList()
break
this.queryParams.name = val.name;
this.queryParams.factoryId = val.factoryId || undefined;
this.getList();
break;
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.classList.init()
this.$refs.classList.init();
});
}
},
//
handleTableEvents(params) {
if (params.name === 'state') {
//
updateGroupClasses({ ...params.payload })
.then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.getList();
}
})
.catch((res) => {
this.getList();
});
}
},
/** 查询列表 */
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 ? '可用' : '不可用'
})
getGroupClassesPage(this.queryParams).then((res) => {
if (res.code === 0 && res.data.list && res.data.list.length > 0) {
res.data.list.map((item) => {
item.timeStr =
item.startTime.slice(0, 5) + '-' + item.endTime.slice(0, 5);
});
this.list = res.data.list;
this.total = res.data.total;
} else {
this.list = []
this.total = 0
this.list = [];
this.total = 0;
}
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.classList.init(val.data.id)
})
this.centervisible = true
break
case 'cancel':
this.discard(val.data)
break
this.$refs.classList.init(val.data.id);
});
this.centervisible = true;
break;
default:
this.handleDelete(val.data)
this.handleDelete(val.data);
}
},
handleCancel() {
this.$refs.classList.formClear()
this.centervisible = false
this.addOrEditTitle = ''
this.$refs.classList.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.classList.submitForm()
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.handleCancel();
this.getList();
this.$modal.msgSuccess("操作成功");
}).catch(() => {});
},
/** 删除按钮操作 */
handleDelete(row) {
console.log(row)
let _this = this
if (row.status === '可用') {//
_this.$modal.confirm('删除的班次"' + row.name + '"可能会影响交接班计划,请点取消再次确认!').then(function() {
return _this.$modal.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?').then(function() {
let _this = this;
if (row.enabled) {
//
this.$confirm(
`是否确认删除 ${row.name} 的数据项?`,
'可能会影响交接班计划!',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
).then(function () {
return _this.$modal
.delConfirm(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(() => {
.then(() => {
_this.getList();
_this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
_this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
});
} else {
this.$confirm(`是否确认删除 ${row.name} 的数据项?`, '系统提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(function () {
return deleteGroupClasses(row.id);
})
.then(() => {
_this.getList();
_this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
}
},
},
};
</script>

View File

@ -0,0 +1,273 @@
<template>
<div class="baseTable">
<el-table
:ref="id"
:data="renderData"
v-bind="$attrs"
:border="cancelBorder ? false : true"
@current-change="currentChange"
@selection-change="handleSelectionChange"
style="width: 100%"
:header-cell-style="{
background: '#F2F4F9',
color: '#606266',
}">
<!-- 多选 -->
<el-table-column
v-if="selectWidth"
type="selection"
:width="selectWidth" />
<!-- 序号 -->
<el-table-column
v-if="page && limit"
prop="_pageIndex"
:width="pageWidth"
align="center"
:fixed="cancelPageFixed ? false : true">
<template slot="header">
<el-popover placement="bottom-start" width="300" trigger="click">
<div
class="setting-box"
style="max-height: 400px; overflow-y: auto">
<el-checkbox
v-for="(item, index) in tableProps"
:key="'cb' + index"
v-model="selectedBox[index]"
:label="item.label" />
</div>
<i slot="reference" class="el-icon-s-tools" />
</el-popover>
</template>
</el-table-column>
<el-table-column
v-for="item in renderTableHeadList"
:key="item.prop"
v-bind="item"
:label="item.label"
:prop="item.prop"
:fixed="item.fixed || false"
:show-overflow-tooltip="item.showOverflowtooltip || false"
:sortable="item.sortable || false">
<template slot="header">
<span>{{ item.label }}</span>
</template>
<!-- 多表头 -->
<template v-if="item.children">
<el-table-column
v-for="sub in item.children"
:prop="sub.prop"
:key="sub.prop"
v-bind="sub"
:label="sub.label">
<template v-if="sub.children">
<el-table-column
v-for="ssub in sub.children"
:prop="ssub.prop"
:key="ssub.prop"
v-bind="ssub"
:label="ssub.label">
<template slot-scope="sscopeInner">
<component
:is="ssub.subcomponent"
v-if="ssub.subcomponent"
:key="sscopeInner.row.id"
:inject-data="{ ...sscopeInner.row, ...ssub }"
@emitData="emitData" />
<span v-else>
{{ sscopeInner.row[ssub.prop] | commonFilter(ssub.filter) }}
</span>
</template>
</el-table-column>
</template>
<template slot-scope="scopeInner">
<component
:is="sub.subcomponent"
v-if="sub.subcomponent"
:key="scopeInner.row.id"
:inject-data="{ ...scopeInner.row, ...sub }"
@emitData="emitData" />
<span v-else>
{{ scopeInner.row[sub.prop] | commonFilter(sub.filter) }}
</span>
</template>
</el-table-column>
</template>
<template slot-scope="scope">
<component
:is="item.subcomponent"
v-if="item.subcomponent"
:key="scope.row.id"
:itemProp="item.prop"
:inject-data="{ ...scope.row, ...item }"
@emitData="emitData" />
<span v-else>
{{ scope.row[item.prop] | commonFilter(item.filter) }}
</span>
</template>
</el-table-column>
<slot name="handleBtn" />
</el-table>
<!-- 表格底部加号 -->
<el-button
v-if="addButtonShow"
class="addButton"
icon="el-icon-plus"
@click="emitButtonClick">
{{ addButtonShow }}
</el-button>
</div>
</template>
<script>
export default {
name: 'BaseTable',
filters: {
commonFilter: (source, filterType = (a) => a) => {
return filterType(source);
},
},
props: {
cancelBorder: {
type: Boolean,
default: false,
},
cancelPageFixed: {
type: Boolean,
default: false,
},
tableData: {
type: Array,
required: true,
default: () => {
return [];
},
},
tableProps: {
type: Array,
default: () => {
return [];
},
},
id: {
type: String,
required: false,
default: '',
},
page: {
type: Number,
required: false,
default: 0,
},
pageWidth: {
type: Number,
required: false,
default: 70,
},
limit: {
type: Number,
required: false,
default: 0,
},
selectWidth: {
type: Number,
required: false,
default: 0,
},
addButtonShow: {
type: String,
required: false,
default: '',
},
},
data() {
return {
selectedBox: new Array(100).fill(true),
};
},
computed: {
renderTableHeadList() {
return this.tableProps.filter((item, index) => {
return this.selectedBox[index];
});
},
renderData() {
return this.tableData.map((item, index) => {
return {
...item,
_pageIndex: (this.page - 1) * this.limit + index + 1,
};
});
},
},
beforeMount() {
this.selectedBox = new Array(100).fill(true);
},
methods: {
currentChange(newVal, oldVal) {
this.$emit('current-change', { newVal, oldVal });
},
handleSelectionChange(val) {
this.$emit('selection-change', val);
},
emitData(val) {
this.$emit('emitFun', val);
},
emitButtonClick() {
this.$emit('emitButtonClick');
},
setCurrent(name, index) {
let _this = this;
let obj = _this.$refs[name].data[index];
_this.$refs[name].setCurrentRow(obj);
},
doLayout(name) {
this.$refs[name].doLayout();
},
},
};
</script>
<style scoped>
.baseTable .show-col-btn {
margin-right: 5px;
line-height: inherit;
cursor: pointer;
}
.baseTable .el-icon-refresh {
cursor: pointer;
}
</style>
<style>
.baseTable .el-table__body tr.current-row > td.el-table__cell {
background-color: #eaf1fc;
}
.baseTable .el-table .el-table__cell {
padding: 0;
height: 35px;
}
.baseTable .addButton {
width: 100%;
height: 35px;
border-top: none;
color: #0b58ff;
border-color: #ebeef5;
border-radius: 0;
}
.baseTable .addButton:hover {
color: #0b58ff;
border-color: #ebeef5;
background-color: #fff;
}
.baseTable .addButton:focus {
border-color: #ebeef5;
background-color: #fff;
}
.el-tooltip__popper.is-dark {
background: rgba(0, 0, 0, 0.6) !important;
}
.el-tooltip__popper .popper__arrow,
.el-tooltip__popper .popper__arrow::after {
border-top-color: rgba(0, 0, 0, 0.4) !important;
}
</style>

View File

@ -0,0 +1,262 @@
<!--
* @Author: zwq
* @Date: 2023-08-24 14:47:58
* @LastEditors: zwq
* @LastEditTime: 2025-01-15 10:20:20
* @Description:
-->
<template>
<div>
<el-table
:data="tableData"
:header-cell-style="{
background: '#F2F4F9',
color: '#606266',
}"
border
:span-method="arraySpanMethod"
v-loading="dataListLoading"
style="width: 100%"
ref="dataList">
<el-table-column prop="lineName" label="产线" />
<el-table-column
prop="sizes"
width="105"
showOverflowtooltip
label="规格" />
<el-table-column prop="process" label="产品工艺" />
<el-table-column prop="inputN" label="投入">
<el-table-column prop="inputNum" label="投入数量/片" />
<el-table-column prop="inputArea" label="投入面积/m²">
<template v-slot="scope">
<span>
{{
scope.row.inputArea != null
? scope.row.inputArea.toFixed(2)
: '-'
}}
</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="outputN" label="产出">
<el-table-column prop="outputNum" label="产出数量/片" />
<el-table-column prop="outputArea" label="产出面积/m²">
<template v-slot="scope">
<span>
{{
scope.row.outputArea != null
? scope.row.outputArea.toFixed(2)
: '-'
}}
</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="lossN" label="不良">
<el-table-column prop="lossNum" label="不良数量/片" />
<el-table-column prop="lossArea" label="不良面积/m²">
<template v-slot="scope">
<span>
{{
scope.row.lossArea != null
? scope.row.lossArea.toFixed(2)
: '-'
}}
</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="lossRatio" label="不良率/%">
<template v-slot="scope">
<span>
{{
scope.row.lossRatio != null
? scope.row.lossRatio.toFixed(2)
: '-'
}}
</span>
</template>
</el-table-column>
<el-table-column prop="outputRatio" label="投入产出率/%">
<template v-slot="scope">
<span>
{{
scope.row.outputRatio != null
? scope.row.outputRatio.toFixed(2)
: '-'
}}
</span>
</template>
</el-table-column>
<el-table-column prop="processingRatio" label="加工成品率/%">
<template v-slot="scope">
<span>
{{
scope.row.processingRatio != null
? scope.row.processingRatio.toFixed(2)
: '-'
}}
</span>
</template>
</el-table-column>
<el-table-column prop="lossD" label="不良详情">
<el-table-column prop="original" label="原片">
<el-table-column prop="originalLossNum" label="原片不良/片" />
<el-table-column prop="originalLossArea" label="原片不良/m²">
<template v-slot="scope">
<span>
{{
scope.row.originalLossArea != null
? scope.row.originalLossArea.toFixed(2)
: '-'
}}
</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="edge" label="磨边">
<el-table-column prop="edgeLossNum" label="磨边不良/片" />
<el-table-column prop="edgeLossArea" label="磨边不良/m²">
<template v-slot="scope">
<span>
{{
scope.row.edgeLossArea != null
? scope.row.edgeLossArea.toFixed(2)
: '-'
}}
</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="drill" label="打孔">
<el-table-column prop="drillLossNum" label="打孔不良/片" />
<el-table-column prop="drillLossArea" label="打孔不良/m²">
<template v-slot="scope">
<span>
{{
scope.row.drillLossArea != null
? scope.row.drillLossArea.toFixed(2)
: '-'
}}
</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="coating" label="镀膜">
<el-table-column prop="coatingLossNum" label="镀膜不良/片" />
<el-table-column prop="coatingLossArea" label="镀膜不良/m²">
<template v-slot="scope">
<span>
{{
scope.row.coatingLossArea != null
? scope.row.coatingLossArea.toFixed(2)
: '-'
}}
</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="silk" label="丝印">
<el-table-column prop="silkLossNum" label="丝印不良/片" />
<el-table-column prop="silkLossArea" label="丝印不良/m²">
<template v-slot="scope">
<span>
{{
scope.row.silkLossArea != null
? scope.row.silkLossArea.toFixed(2)
: '-'
}}
</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="tempering" label="钢化">
<el-table-column prop="temperingLossNum" label="钢化不良/片" />
<el-table-column prop="temperingLossArea" label="钢化不良/m²">
<template v-slot="scope">
<span>
{{
scope.row.temperingLossArea != null
? scope.row.temperingLossArea.toFixed(2)
: '-'
}}
</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="packing" label="包装">
<el-table-column prop="packingLossNum" label="包装不良/片" />
<el-table-column prop="packingLossArea" label="包装不良/m²">
<template v-slot="scope">
<span>
{{
scope.row.packingLossArea != null
? scope.row.packingLossArea.toFixed(2)
: '-'
}}
</span>
</template>
</el-table-column>
</el-table-column>
</el-table-column>
</el-table>
</div>
</template>
<script>
import { getTeamReportPageDet } from '@/api/core/monitoring/auto';
export default {
components: {},
data() {
return {
tableData: [],
dataListLoading: false,
};
},
components: {},
created() {},
mounted() {},
methods: {
//
init(id) {
this.dataListLoading = true;
getTeamReportPageDet(id).then((response) => {
this.tableData = response.data?.map((item, index) => {
item.originalLossNum = item.original?.lossNum;
item.originalLossArea = item.original?.lossArea;
item.edgeLossNum = item.edge?.lossNum;
item.edgeLossArea = item.edge?.lossArea;
item.drillLossNum = item.drill?.lossNum;
item.drillLossArea = item.drill?.lossArea;
item.coatingLossNum = item.coating?.lossNum;
item.coatingLossArea = item.coating?.lossArea;
item.silkLossNum = item.silk?.lossNum;
item.silkLossArea = item.silk?.lossArea;
item.temperingLossNum = item.tempering?.lossNum;
item.temperingLossArea = item.tempering?.lossArea;
item.packingLossNum = item.packing?.lossNum;
item.packingLossArea = item.packing?.lossArea;
if(item.isSummaryReport){
item.lineName = '合计'
}
return item;
});
this.dataListLoading = false;
});
},
arraySpanMethod({ row, column, rowIndex, columnIndex }) {
if (row.isSummaryReport) {
if (columnIndex === 0) {
return [1, 3];
} else if (columnIndex === 1) {
return [0, 0];
}else if (columnIndex === 2) {
return [0, 0];
}
}
},
},
};
</script>

View File

@ -0,0 +1,510 @@
<!--
* @Author: Do not edit
* @Date: 2023-08-29 14:59:29
* @LastEditTime: 2025-01-15 10:24:05
* @LastEditors: zwq
* @Description:
-->
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table-s
v-if="showData.length"
class="right-aside"
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="showData">
<method-btn
v-if="showData.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table-s>
<div v-else class="no-data-bg"></div>
<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"
close-on-click-modal
top="0"
width="80%">
<gr-detail ref="grDetail" />
<slot name="footer">
<el-row slot="footer" type="flex" justify="end">
<el-col :span="24">
<el-button size="small" class="btnTextStyle" @click="handleCancel">
取消
</el-button>
</el-col>
</el-row>
</slot>
</base-dialog>
</div>
</template>
<script>
import grDetail from './gr-detail';
import { getTeamReportPage } from '@/api/core/monitoring/auto';
import { getFactoryPage } from '@/api/core/base/factory';
import { getGroupTeamPage } from '@/api/base/groupTeam';
// import codeFilter from '../../mixins/code-filter'
import * as XLSX from 'xlsx';
import FileSaver from 'file-saver';
import baseTableS from './baseTable.vue';
import { parseTime } from '@/utils/ruoyi';
const tableProps = [
{
prop: 'reportType',
label: '报表类型',
},
{
prop: 'reportStartTime',
label: '日期',
filter: (val) => (val ? parseTime(val, '{y}-{m}-{d}') : '-'),
width: 130,
},
{
prop: 'factoryName',
label: '工厂',
},
{
prop: 'teamName',
label: '班组',
},
{
prop: 'inputN',
label: '投入',
children: [
{
prop: 'inputNum',
label: '投入数量/片',
},
{
prop: 'inputArea',
label: '投入面积/m²',
},
],
},
{
prop: 'outputN',
label: '产出',
children: [
{
prop: 'outputNum',
label: '产出数量/片',
},
{
prop: 'outputArea',
label: '产出面积/㎡',
filter: (val) => (val != null ? val.toFixed(2) : '-'),
},
],
},
{
prop: 'lossN',
label: '不良',
children: [
{
prop: 'lossNum',
label: '不良数量/片',
},
{
prop: 'lossArea',
label: '不良面积/㎡',
filter: (val) => (val != null ? val.toFixed(2) : '-'),
},
],
},
{
prop: 'lossRatio',
label: '不良率/%',
filter: (val) => (val != null ? val.toFixed(2) : '-'),
},
{
prop: 'outputRatio',
label: '投入产出率/%',
filter: (val) => (val != null ? val.toFixed(2) : '-'),
},
{
prop: 'processingRatio',
label: '加工成品率/%',
filter: (val) => (val != null ? val.toFixed(2) : '-'),
},
{
prop: 'lossD',
label: '不良详情',
children: [
{
prop: 'original',
label: '原片',
children: [
{
prop: 'originalLossNum',
label: '原片不良/片',
},
{
prop: 'originalLossArea',
label: '原片不良/㎡',
filter: (val) => (val != null ? val.toFixed(2) : '-'),
},
],
},
{
prop: 'edge',
label: '磨边',
children: [
{
prop: 'edgeLossNum',
label: '磨边不良/片',
},
{
prop: 'edgeLossArea',
label: '磨边不良/㎡',
filter: (val) => (val != null ? val.toFixed(2) : '-'),
},
],
},
{
prop: 'drill',
label: '打孔',
children: [
{
prop: 'drillLossNum',
label: '打孔不良/片',
},
{
prop: 'drillLossArea',
label: '打孔不良/㎡',
filter: (val) => (val != null ? val.toFixed(2) : '-'),
},
],
},
{
prop: 'coating',
label: '镀膜',
children: [
{
prop: 'coatingLossNum',
label: '镀膜不良/片',
},
{
prop: 'coatingLossArea',
label: '镀膜不良/㎡',
filter: (val) => (val != null ? val.toFixed(2) : '-'),
},
],
},
{
prop: 'silk',
label: '丝印',
children: [
{
prop: 'silkLossNum',
label: '丝印不良/片',
},
{
prop: 'silkLossArea',
label: '丝印不良/㎡',
filter: (val) => (val != null ? val.toFixed(2) : '-'),
},
],
},
{
prop: 'tempering',
label: '钢化',
children: [
{
prop: 'temperingLossNum',
label: '钢化不良/片',
},
{
prop: 'temperingLossArea',
label: '钢化不良/㎡',
filter: (val) => (val != null ? val.toFixed(2) : '-'),
},
],
},
{
prop: 'packing',
label: '包装',
children: [
{
prop: 'packingLossNum',
label: '包装不良/片',
},
{
prop: 'packingLossArea',
label: '包装不良/㎡',
filter: (val) => (val != null ? val.toFixed(2) : '-'),
},
],
},
],
},
];
export default {
components: {
baseTableS,
grDetail,
},
data() {
return {
urlOptions: {
getDataListURL: getTeamReportPage,
},
listQuery: {
pageSize: 10,
pageNo: 1,
total: 1,
},
fileName: '',
dataListLoading: false,
tableProps,
tableBtn: [
{
type: 'eq',
btnName: '详情',
},
].filter((v) => v),
showData: [],
tableData: [],
formConfig: [
{
type: 'select',
label: '工厂',
selectOptions: [],
param: 'factoryId',
onchange: true,
},
{
type: 'select',
label: '报表类型',
selectOptions: [
{
id: 1,
name: '日',
},
{
id: 2,
name: '周',
},
{
id: 3,
name: '月',
},
{
id: 4,
name: '年',
},
],
param: 'reportType',
},
{
type: 'select',
label: '班组',
selectOptions: [],
param: 'teamId',
},
{
type: 'datePicker',
label: '报表开始时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '',
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
addOrEditTitle: '',
addOrUpdateVisible: false,
};
},
created() {
//
const now = new Date();
//
const yesterday = new Date(now.getTime() - 24 * 60 * 60 * 1000);
// 00:00:00
yesterday.setHours(0, 0, 0, 0);
// 23:59:59
const end = new Date(yesterday.getTime());
end.setHours(23, 59, 59, 59);
this.listQuery.reportStartTime = [
parseTime(yesterday, '{y}-{m}-{d} {h}:{i}:{s}'),
parseTime(end, '{y}-{m}-{d} {h}:{i}:{s}'),
];
this.$nextTick(() => {
this.$refs.searchBarForm.formInline.timeVal = [
parseTime(yesterday, '{y}-{m}-{d} {h}:{i}:{s}'),
parseTime(end, '{y}-{m}-{d} {h}:{i}:{s}'),
];
});
this.getDataList();
this.getPdLineList();
},
methods: {
handleExport() {
let tables = document.querySelector('.el-table').cloneNode(true);
const fix = tables.querySelector('.el-table__fixed');
const fixRight = tables.querySelector('.el-table__fixed-right');
if (fix) {
tables.removeChild(tables.querySelector('.el-table__fixed'));
}
if (fixRight) {
tables.removeChild(tables.querySelector('.el-table__fixed-right'));
}
let exportTable = XLSX.utils.table_to_book(tables);
var exportTableOut = XLSX.write(exportTable, {
bookType: 'xlsx',
bookSST: true,
type: 'array',
});
// sheetjs.xlsx
try {
FileSaver.saveAs(
new Blob([exportTableOut], {
type: 'application/octet-stream',
}),
this.fileName + '班组生产报表.xlsx'
);
} catch (e) {
if (typeof console !== 'undefined') console.log(e, exportTableOut);
}
return exportTableOut;
},
getPdLineList() {
const params = {
pageSize: 100,
pageNo: 1,
};
getGroupTeamPage(params).then((res) => {
this.formConfig[2].selectOptions = res.data.list || [];
});
getFactoryPage(params).then((res) => {
this.formConfig[0].selectOptions = res.data.list || [];
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.factoryId = val.factoryId || undefined;
this.listQuery.teamId = val.teamId || undefined;
this.listQuery.reportType = val.reportType || undefined;
this.listQuery.reportStartTime = val.timeVal
? val.timeVal
: undefined;
this.getDataList();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
//
getDataList() {
this.dataListLoading = true;
const arr = ['日', '周', '月', '年'];
this.urlOptions.getDataListURL(this.listQuery).then((response) => {
if(!response.data.list){
this.showData = []
this.dataListLoading = false;
return
}
this.tableData = response.data?.list.map((item, index) => {
item.reportType = arr[item.reportType - 1];
item.originalLossNum = item.original?.lossNum;
item.originalLossArea = item.original?.lossArea;
item.edgeLossNum = item.edge?.lossNum;
item.edgeLossArea = item.edge?.lossArea;
item.drillLossNum = item.drill?.lossNum;
item.drillLossArea = item.drill?.lossArea;
item.coatingLossNum = item.coating?.lossNum;
item.coatingLossArea = item.coating?.lossArea;
item.silkLossNum = item.silk?.lossNum;
item.silkLossArea = item.silk?.lossArea;
item.temperingLossNum = item.tempering?.lossNum;
item.temperingLossArea = item.tempering?.lossArea;
item.packingLossNum = item.packing?.lossNum;
item.packingLossArea = item.packing?.lossArea;
return item;
});
this.listQuery.total = response.data?.total;
this.dataListLoading = false;
this.showData = this.tableData;
});
},
handleClick(val) {
this.addOrUpdateVisible = true;
this.addOrEditTitle =
'时间:' +
val.data?.reportName +
' 班组:' +
val.data?.teamName +
' 组长:' +
val.data?.teamLeader +
' 详情';
this.$nextTick(() => {
this.$refs.grDetail.init(val.data.id);
});
},
handleCancel() {
this.addOrUpdateVisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.handleCancel();
},
//
sizeChangeHandle(val) {
this.listQuery.pageSize = val;
this.listQuery.pageNo = 1;
this.getDataList();
},
//
currentChangeHandle(val) {
this.listQuery.pageNo = val;
this.getDataList();
},
},
};
</script>

View File

@ -1,6 +1,22 @@
<template>
<el-form ref="form" :rules="rules" label-width="80px" :model="form">
<el-form ref="form" :rules="rules" label-width="100px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="工厂" prop="factoryId">
<el-select
v-model="form.factoryId"
filterable
clearable
style="width: 100%"
placeholder="请选择工厂">
<el-option
v-for="item in factoryArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="班组名称" prop="name">
<el-input v-model="form.name"></el-input>
@ -11,56 +27,88 @@
<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="num">
<el-input-number v-model="form.num" :min="1" :max="99999999" style="width: 100%;"></el-input-number>
<el-form-item label="班组组长" prop="leaderName">
<el-input v-model="form.leaderName" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="班组组长" prop="leaderName">
<el-input v-model="form.leaderName"></el-input>
<el-form-item label="手机号" prop="leaderPhone">
<el-input v-model="form.leaderPhone" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="班组人数" prop="num">
<el-input-number
style="width: 100%"
v-model="form.num"
:step="1"
step-strictly></el-input-number>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { getGroupTeam, updateGroupTeam, createGroupTeam, getCode } from '@/api/base/groupTeam'
import {
getGroupTeam,
updateGroupTeam,
createGroupTeam,
getCode,
} from '@/api/base/groupTeam';
import { getFactoryPage } from '@/api/core/base/factory';
export default {
name: 'groupTeamAdd',
data() {
return {
form: {
id: '',
factoryId: '',
name: '',
code: '',
num: null,
leaderName: ''
leaderName: '',
leaderPhone: '',
num: '',
},
factoryArr: [], //
isEdit: false, //
rules: {
name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }]
}
}
factoryId: [
{ required: true, message: '请选择工厂', trigger: 'change' },
],
name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }],
code: [{ required: true, message: '请输入班组编码', trigger: 'blur' }],
leaderName: [
{ required: true, message: '请输入组长', trigger: 'blur' },
],
},
};
},
created() {
const params = {
pageSize: 100,
pageNo: 1,
};
getFactoryPage(params).then((res) => {
this.factoryArr = res.data.list || [];
});
},
methods: {
init(id) {
if (id) {
this.isEdit = true
this.form.id = id
getGroupTeam( id ).then((res) => {
this.isEdit = true;
this.form.id = id;
getGroupTeam(id).then((res) => {
if (res.code === 0) {
this.form = res.data
this.form = res.data;
}
})
});
} else {
this.isEdit = false
this.form.id = ''
this.isEdit = false;
this.form.id = '';
getCode().then((res) => {
this.form.code = res.data
})
this.form.code = res.data;
});
}
},
submitForm() {
@ -70,27 +118,27 @@ export default {
//
updateGroupTeam({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
})
});
} else {
createGroupTeam({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
})
});
}
} else {
return false
return false;
}
})
});
},
formClear() {
this.$refs.form.resetFields()
this.isEdit = false
}
}
}
this.$refs.form.resetFields();
this.isEdit = false;
},
},
};
</script>

View File

@ -1,3 +1,10 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:53:55
* @LastEditors: zwq
* @LastEditTime: 2024-07-10 10:00:03
* @Description:
-->
<template>
<el-switch v-model="state" type="text" size="small" :disabled="readonly" @change="changeHandler" />
</template>
@ -12,8 +19,7 @@ export default {
},
data() {
return {
state: false,
payload: {}
state: false
}
},
computed: {
@ -31,9 +37,17 @@ export default {
}
},
changeHandler() {
this.payload.id = this.injectData.id
this.payload.enabled = this.state ? '1' : '0'
this.$emit('emitData', this.payload)
let params = {}
let payload = {}
params.name = 'state'
payload.id = this.injectData.id
payload.enabled = this.state ? '1' : '0'
payload.code = this.injectData.code
payload.name = this.injectData.name
payload.factoryId = this.injectData.factoryId
payload.leaderName = this.injectData.leaderName
params.payload = payload
this.$emit('emitData', params)
}
}
}

View File

@ -0,0 +1,305 @@
<template>
<div>
<el-drawer :title="title" :visible.sync="visible" size="70%" @close='closeD' :show-close='false'>
<div class="box">
<el-row class="topBox">
<el-col :span="6">
<p class="boldTitle">班组名称</p>
<p class="lightText">{{ teamData.teamName }}</p>
</el-col>
<el-col :span="6">
<p class="boldTitle">班组长</p>
<p class="lightText">{{ teamData.leaderName }}</p>
</el-col>
<el-col :span="6">
<p class="boldTitle">班组人数</p>
<p class="lightText">{{ teamData.teamNum }}</p>
</el-col>
<el-col :span="6">
<p class="boldTitle">手机号</p>
<p class="lightText">{{ teamData.leaderTelephone }}</p>
</el-col>
</el-row>
<div class="bottomBox">
<!-- 搜索工作栏 -->
<search-bar
v-if="visible"
:formConfigs="formConfig"
@headBtnClick="buttonClick"
/>
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="tableData"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="100"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
</div>
</div>
</el-drawer>
<!-- 新增编辑组员 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width='40%'
>
<worker-team-add ref="workerTeamAdd" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
const tableProps = [
{
prop: 'workerName',
label: '人员姓名'
},
{
prop: 'workerMajorName',
label: '专业'
},
{
prop: 'workerTelephone',
label: '手机'
},
{
prop: 'remark',
label: '备注'
}
]
import { groupTeamPage, teamDetDelete } from '@/api/base/groupTeam'
import { getWorker } from '@/api/base/worker'
import WorkerTeamAdd from './workerTeamAdd.vue'
export default {
name: 'WorkerEdit',
data() {
return {
visible: false,
title: '',
formConfig: [],
teamData: {
teamName: '',
leaderName: '',
teamNum: '',
leaderTelephone: '-',
teamId: ''
},
queryParams: {
pageNo: 1,
pageSize: 20,
teamId: '',
workerName: ''
},
tableProps,
tableData: [],
tableBtn: [],
total: 0,
//
addOrEditTitle: "",
//
centervisible: false
}
},
components: { WorkerTeamAdd },
created() {
},
methods: {
init(val) {
this.visible = true
this.teamData.teamName = val.payload.name
this.teamData.leaderName = val.payload.leaderName
this.teamData.teamNum = val.payload.num
this.teamData.teamId = val.payload.teamId
this.queryParams.teamId = val.payload.id
getWorker({id:val.payload.leaderId}).then(res => {//
this.teamData.leaderTelephone = res.data.telephone || '-'
})
this.getList()
if (val.name === 'view') {
this.title = '查看组员'
this.tableBtn = []
this.formConfig = [
{
type: 'input',
label: '关键字',
placeholder: '姓名',
param: 'workerName'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
}
]
}else{
this.title = '编辑组员'
this.tableBtn = [
{
type: 'edit',
btnName: '编辑'
},
{
type: 'delete',
btnName: '删除'
}
]
this.formConfig = [
{
type: 'input',
label: '关键字',
placeholder: '姓名',
param: 'workerName'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: 'button',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
]
}
},
getList() {
groupTeamPage({ ...this.queryParams }).then(res => {
if (res.code === 0 && res.data.list && res.data.list.length > 0) {
let arr = []
res.data.list.map(item => {
let obj = {}
obj.workerName = item.worker.name
obj.workerMajorName = item.worker.majorName
obj.workerTelephone = item.worker.telephone
obj.remark = item.remark
obj.id = item.id
arr.push(obj)
})
this.tableData = arr
this.total = res.data.total
} else {
this.tableData = []
this.total = 0
}
})
},
buttonClick(val) {
console.log(val)
if (val.btnName === 'search') {
this.queryParams.workerName = val.workerName
this.queryParams.pageNo = 1
this.getList()
}else if (val.btnName === 'add') {
this.addNew()
}
},
//
addNew() {
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.workerTeamAdd.init({'teamId': this.queryParams.teamId, id: ''})
})
},
handleCancel() {
this.$refs.workerTeamAdd.formClear()
this.centervisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.workerTeamAdd.submitForm()
},
successSubmit() {
this.handleCancel()
this.getList()
},
handleClick(val) {
console.log(val)
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.centervisible = true
this.$nextTick(() => {
this.$refs.workerTeamAdd.init({'teamId': this.queryParams.teamId, 'id': val.data.id, 'workName':val.data.workerName, 'majorName':val.data.workerMajorName})
})
break
default:
this.handleDelete(val.data)
}
},
/** 删除按钮操作 */
handleDelete(row) {
console.log(row)
this.$modal.confirm('是否确认删除人员"' + row.workerName + '"的数据项?').then(function() {
return teamDetDelete({id: row.id});
}).then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
closeD() {
this.teamData.teamName = ''
this.teamData.leaderName = ''
this.teamData.teamNum = ''
this.teamData.leaderTelephone = ''
this.teamData.teamId = ''
this.queryParams.pageNo = 1
this.queryParams.pageSize = 20
this.queryParams.teamId = ''
this.queryParams.workerName = ''
this.total = 0
this.$emit('closeDrawer')
}
}
}
</script>
<style lang='scss' scoped>
.box {
padding:0 30px;
.topBox {
padding-bottom: 30px;
border-bottom: 1px solid #E9E9E9;
.boldTitle {
font-size: 14px;
font-weight: 600;
color: rgba(0,0,0,0.85);
margin: 0;
margin-bottom: 10px;
}
.lightText {
font-size: 14px;
font-weight: 400;
color: rgba(102,102,102,0.75);
margin: 0;
}
}
.bottomBox {
padding-top: 30px;
}
}
</style>

View File

@ -0,0 +1,41 @@
<template>
<div class="workerOperate">
<div class="operateBtn">
<span class="view" v-if="this.$auth.hasPermi('base:group-team:view-worker')" @click="emitParams('view')">查看</span>
<span class="edit" v-if="this.$auth.hasPermi('base:group-team:edit-worker')" @click="emitParams('edit')">编辑</span>
</div>
</div>
</template>
<script>
export default {
name: 'WorkerOperate',
props: {
injectData: {
type: Object,
default: () => ({})
}
},
methods: {
emitParams(data) {
let params = {}
params.name = data
params.payload = this.injectData
this.$emit('emitData', params)
}
}
}
</script>
<style lang='scss' scoped>
.workerOperate {
.operateBtn{
color: #0B58FF;
.view {
margin-right: 10px;
cursor: pointer;
}
.edit {
cursor: pointer;
}
}
}
</style>

View File

@ -0,0 +1,121 @@
<template>
<el-form ref="form" :rules="rules" label-width="100px" :model="form">
<el-form-item label="员工" prop="workerId" v-if='!isEdit'>
<el-select v-model="form.workerId" placeholder="请选择" filterable style="width: 100%;" @change="selectWorker()">
<el-option
v-for="item in workerList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="员工" prop="workerId" v-if='isEdit'>
<el-input v-model="workName" disabled></el-input>
</el-form-item>
<el-form-item label="专业" prop="majorName">
<el-input v-model="form.majorName" disabled></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark"></el-input>
</el-form-item>
</el-form>
</template>
<script>
import { otherWorkerList } from '@/api/base/worker'
import { teamDetCreate, teamDetUpdate, groupTeamDet } from '@/api/base/groupTeam'
export default {
name: 'WorkerTeamAdd',
data() {
return {
workerList: [],
form: {
teamId: '',
workerId: '',
remark: '',
majorName: '',
id: ''
},
isEdit: false,
workName: '',//
rules: {
workerId: [{ required: true, message: '员工不能为空', trigger: 'change' }]
}
}
},
methods: {
init(param) {
this.form.teamId = param.teamId
this.form.majorName = param.majorName
this.workName = param.workName
otherWorkerList({teamId:this.form.teamId}).then(res => {
this.workerList = res.data || []
if (param.id) {
this.isEdit = true
this.form.id = param.id
groupTeamDet({id: this.form.id}).then((res) => {
if (res.code === 0) {
this.form.workerId = res.data.workerId
this.form.remark = res.data.remark
}
})
} else {
this.isEdit = false
this.form.id = ''
}
})
},
selectWorker() {
if (this.form.workerId) {
this.workerList.map(item => {
if (item.id === this.form.workerId) {
this.form.majorName = item.majorName
}
})
}else{
this.form.majorName = ''
}
},
//
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.isEdit) {
//
teamDetUpdate({
teamId: this.form.teamId,
workerId: this.form.workerId,
remark: this.form.remark,
id: this.form.id
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
teamDetCreate({
teamId: this.form.teamId,
workerId: this.form.workerId,
remark: this.form.remark
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
}
} else {
return false
}
})
},
formClear() {
this.$refs.form.resetFields()
this.workName = ''
this.form.majorName = ''
this.isEdit = false
}
}
}
</script>

View File

@ -1,12 +1,10 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick"
/>
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
@ -14,23 +12,20 @@
:table-props="tableProps"
:table-data="list"
:max-height="tableH"
@emitFun="handleTableEvents"
>
@emitFun="handleTableEvents">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
@clickBtn="handleClick" />
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
@pagination="getList" />
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
@ -38,104 +33,122 @@
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
>
width="40%">
<group-team-add ref="groupList" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import { getGroupTeamPage, deleteGroupTeam, updateGroupTeam } from "@/api/base/groupTeam";
import { parseTime } from '@/utils/ruoyi'
import GroupTeamAdd from './components/groupTeamAdd.vue'
import StatusBtn from './components/statusBtn.vue'
import {
getGroupTeamPage,
deleteGroupTeam,
updateGroupTeam,
} from '@/api/base/groupTeam';
import { parseTime } from '@/utils/ruoyi';
import GroupTeamAdd from './components/groupTeamAdd';
import StatusBtn from './components/statusBtn';
import tableHeightMixin from '@/mixins/tableHeightMixin';
import { getFactoryPage } from '@/api/core/base/factory';
const tableProps = [
{
prop: 'createTime',
label: '创建时间',
filter: parseTime,
minWidth: 150
minWidth: 160,
},
{
prop: 'factoryName',
label: '工厂',
},
{
prop: 'name',
label: '班组名称'
label: '班组名称',
},
{
prop: 'code',
label: '班组编码',
minWidth: 220
label: '编码',
minWidth: 220,
},
{
prop: 'num',
label: '班组人数'
label: '班组人数',
},
{
prop: 'leaderName',
label: '班组组长'
label: '组长',
},
{
prop: 'enabled',
label: '班组状态',
subcomponent: StatusBtn
}
]
subcomponent: StatusBtn,
},
];
export default {
name: "GroupTeam",
name: 'GroupTeam',
components: { GroupTeamAdd },
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
{
type: 'input',
label: '班组名称',
placeholder: '班组名称',
param: 'name'
type: 'select',
label: '工厂',
selectOptions: [],
param: 'factoryId',
onchange: true,
},
{
type: 'input',
label: '班组编码',
placeholder: '班组编码',
param: 'code'
label: '班组名称',
placeholder: '班组名称',
param: 'name',
},
{
type: 'input',
label: '组长',
placeholder: '组长',
param: 'leaderName',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
color: 'primary',
},
{
type: 'separate'
type: 'separate',
},
{
type: this.$auth.hasPermi('base:group-team:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
plain: true,
},
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:group-team:update')
? {
type: 'edit',
btnName: '编辑'
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:group-team:delete')
? {
type: 'delete',
btnName: '删除'
btnName: '删除',
}
: undefined
: undefined,
].filter((v) => v),
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
//
addOrEditTitle: "",
addOrEditTitle: '',
//
centervisible: false,
//
@ -143,36 +156,44 @@ export default {
pageNo: 1,
pageSize: 20,
name: null,
code: null
}
code: null,
},
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList();
this.getPdLineList();
},
methods: {
getPdLineList() {
const params = {
pageSize: 100,
pageNo: 1,
};
getFactoryPage(params).then((res) => {
this.formConfig[0].selectOptions = res.data.list || [];
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.name = val.name
this.queryParams.code = val.code
this.getList()
break
this.queryParams.leaderName = val.leaderName;
this.queryParams.factoryId = val.factoryId || undefined;
this.queryParams.name = val.name;
this.getList();
break;
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.groupList.init()
})
this.$refs.groupList.init();
});
}
},
/** 查询列表 */
getList() {
getGroupTeamPage(this.queryParams).then(response => {
getGroupTeamPage(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
});
@ -180,46 +201,64 @@ export default {
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑'
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.groupList.init(val.data.id)
})
this.centervisible = true
break
this.$refs.groupList.init(val.data.id);
});
this.centervisible = true;
break;
default:
this.handleDelete(val.data)
this.handleDelete(val.data);
}
},
//
handleTableEvents(data) {
updateGroupTeam({ ...data }).then((res) => {
handleTableEvents(params) {
if (params.name === 'state') {
//
updateGroupTeam({ ...params.payload })
.then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$modal.msgSuccess('操作成功');
this.getList();
}
})
.catch((res) => {
this.getList();
});
}
},
handleCancel() {
this.$refs.groupList.formClear()
this.centervisible = false
this.addOrEditTitle = ''
this.$refs.groupList.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.groupList.submitForm()
this.$refs.groupList.submitForm();
},
successSubmit() {
this.handleCancel()
this.getList()
this.handleCancel();
this.getList();
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除班组名称为"' + row.name + '"的数据项?').then(function() {
this.$confirm(`是否确认删除 ${row.name} 的数据项?`, "系统提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return deleteGroupTeam(row.id);
}).then(() => {
})
.then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
closeDrawer() {
this.getList();
},
},
};
</script>

View File

@ -95,7 +95,8 @@ export default {
type: this.$auth.hasPermi('base:group-team:create') ? 'button' : '',
btnName: '导出',
name: 'export',
color: 'warning',
color: 'success',
plain: true
}
],
tableProps,

View File

@ -1,6 +1,20 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:54:06
* @LastEditors: zwq
* @LastEditTime: 2025-01-15 13:23:17
* @Description:
-->
<template>
<div class="groupTeamScheduling">
<div class="operationArea">
<el-tabs v-model="planId" @tab-click="setPlan">
<el-tab-pane
v-for="item in planArr"
:key="item.id"
:label="item.name"
:name="item.id" />
</el-tabs>
<el-form :inline="true" class="demo-form-inline">
<span class="blue-block"></span>
<el-form-item label="月份选择">
@ -12,42 +26,55 @@
:disabled="showSetting"
@change="selectMonth"
:clearable="false"
style="width: 120px">
</el-date-picker>
style="width: 120px"></el-date-picker>
</el-form-item>
<el-form-item>
<span class="separateStyle"></span>
<span
class="separateStyle"
v-if="this.$auth.hasPermi('base:group-team-scheduling:set')"></span>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" :disabled="showSetting || settingBtnDis" @click="settingMsg">设置</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" v-show="showSetting && autoScheduling" @click="schedulingBtn">自动排班</el-button>
<el-button
type="primary"
size="small"
v-if="this.$auth.hasPermi('base:group-team-scheduling:set')"
:disabled="showSetting || settingBtnDis"
@click="settingMsg">
设置
</el-button>
</el-form-item>
<el-form-item>
<span class="separateStyle" v-show="showSetting"></span>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" v-show="showSetting" @click="confirmSetting">确认</el-button>
<el-button
type="primary"
size="small"
v-show="showSetting"
@click="confirmSetting">
确认
</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" plain v-show="showSetting" @click="cancelSetting">取消</el-button>
</el-form-item>
<el-form-item label="请先选择查询的班组" class="rightItem">
<el-button type="primary" size="small" :disabled="jumpDisabled" @click="toOtherPage('1')">班组上下片查询</el-button>
<el-button type="primary" size="small" :disabled="jumpDisabled" @click="toOtherPage('2')">班组能源查询</el-button>
<el-button type="primary" size="small" :disabled="jumpDisabled" @click="toOtherPage('3')">班组检测查询</el-button>
<el-button
type="primary"
size="small"
plain
v-show="showSetting"
@click="cancelSetting">
取消
</el-button>
</el-form-item>
</el-form>
</div>
<!-- 日历区域 -->
<div class="calenderArea">
<div style="font-size: 24px;font-weight: 500">{{ this.month }} {{ this.year }}</div>
<div style="font-size: 24px; font-weight: 500">
{{ this.month }} {{ this.year }}
</div>
<el-calendar v-model="startDay">
<!-- 这里使用的是 2.5 slot 语法对于新项目请使用 2.6 slot 语法-->
<template
slot="dateCell"
slot-scope="{date, data}">
<template slot="dateCell" slot-scope="{ date, data }">
<div v-if="data.type === 'current-month'">
<!-- 日期 -->
<div class="dateStyle">
@ -55,30 +82,76 @@
</div>
<!-- 班次班组 -->
<!-- class有两个样式一个是类似class1还有个是选中红框显示 -->
<el-row :gutter="2" :class="'class' + (index+1) + (chooseTip === (item.startDay+item.classesId) ? ' team-active' : '')" v-for="(item, index) in list[Number(data.day.split('-')[2])]" :key='index'>
<!-- <el-row
:gutter="2"
:class="
'class' +
(index + 1) +
(chooseTip === item.startDay + item.classesId
? ' team-active'
: '')
"
v-for="(item, index) in list[Number(data.day.split('-')[2])]"
:key="index"> -->
<el-row
:gutter="2"
:class="
'class' +
(index + 1)
"
v-for="(item, index) in list[Number(data.day.split('-')[2])]"
:key="index">
<el-col :span="12">
<div class="selectDiv">
<!-- 选择班组图标 -->
<div class="toggle-icon" v-show="showSetting && (new Date(data.day).valueOf() < new Date().valueOf() ? false: true)">
<svg-icon icon-class="toggle"/>
<div
class="toggle-icon"
v-show="
showSetting &&
(new Date(data.day).valueOf() < new Date().valueOf()
? false
: true)
">
<svg-icon icon-class="toggle" />
</div>
<!-- 不能选择班组 -->
<div class="toggle-icon-hide" v-show="!(showSetting && (new Date(data.day).valueOf() < new Date().valueOf() ? false: true))"></div>
<el-select v-model="item.teamId" size='small' :disabled="!showSetting || (new Date(data.day).valueOf() > new Date().valueOf() ? false: true)">
<div
class="toggle-icon-hide"
v-show="
!(
showSetting &&
(new Date(data.day).valueOf() < new Date().valueOf()
? false
: true)
)
"></div>
<el-select
v-model="item.teamId"
size="small"
:disabled="
!showSetting ||
(new Date(data.day).valueOf() > new Date().valueOf()
? false
: true)
">
<el-option
v-for="i in teamList"
:key="i.id"
:label="i.name"
:value="i.id">
</el-option>
:value="i.id"></el-option>
</el-select>
</div>
</el-col>
<el-col :span="12">
<el-button class="labelClass" @click="chooseTeam(item)">{{ item.classesName }}</el-button>
<el-button class="labelClass" @click="chooseTeam(item)">
{{ item.classesName }}
</el-button>
</el-col>
</el-row>
</div>
<div v-else style='font-size: 20px;font-weight: 500;text-align: right;'>
{{ Number(data.day.split('-')[2]) }}
</div>
</template>
</el-calendar>
</div>
@ -86,240 +159,213 @@
</template>
<script>
import { getPreset, createOrUpdateList, autoSet } from "@/api/base/groupTeamScheduling";
import { listEnabled } from "@/api/base/groupTeam";
import {
getScheduling,
createOrUpdateList,
} from '@/api/base/groupTeamScheduling';
import {
groupPlanList,
groupPlanTeamList,
} from '@/api/base/groupSchedulingPlan';
import { listEnabled } from '@/api/base/groupTeam';
import moment from 'moment';
export default {
name: "GroupTeamScheduling",
name: 'GroupTeamScheduling',
data() {
return {
startDay: '',//
year: '',// 2023
month: '',//
monthList: ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],
startDay: '', //
year: '', // 2023
month: '', //
monthList: [
'一月',
'二月',
'三月',
'四月',
'五月',
'六月',
'七月',
'八月',
'九月',
'十月',
'十一月',
'十二月',
],
planId: undefined, //id
list: {},
teamList: [],//
showSetting: false,//
planArr: [], //
teamList: [], //
showSetting: false, //
settingBtnDis: false,
jumpDisabled: true,//
jumpDisabled: true, //
chooseObj: {}, //
chooseTip: '',//
autoScheduling: false //
chooseTip: '', //
autoScheduling: false, //
};
},
created() {
this.startDay = new Date()
this.startDay = new Date();
groupPlanList().then((res) => {
this.planArr = res.data || [];
this.planId = this.planArr[0] ? this.planArr[0].id : undefined;
if (this.planId) {
this.getList();
this.getTeamList();
}
});
//
this.settingBtn()
this.getTeamList()
this.toggleMonth()
this.getList()
this.settingBtn();
this.toggleMonth();
},
methods: {
setPlan() {
this.getList();
this.getTeamList();
},
//
selectMonth() {
if (this.startDay) {
this.settingBtn() // ,getlist
this.toggleMonth()
this.getList()
this.clearChoose()
if ( moment(this.startDay).valueOf() > moment().endOf('month').valueOf()) {
this.autoScheduling = true
this.settingBtn(); // ,getlist
this.toggleMonth();
this.getList();
this.clearChoose();
if (
moment(this.startDay).valueOf() > moment().endOf('month').valueOf()
) {
this.autoScheduling = true;
} else {
this.autoScheduling = false
this.autoScheduling = false;
}
}
},
//
//
getTeamList() {
listEnabled().then(res => {
this.teamList = res.data || []
})
groupPlanTeamList(this.planId).then((res) => {
this.teamList = res.data || [];
});
},
//
getList() {
let year = moment(this.startDay).format('YYYY')
let month = moment(this.startDay).format('M')
getPreset({
let year = moment(this.startDay).format('YYYY');
let month = moment(this.startDay).format('M');
getScheduling({
year: year,
month: month
}).then(res => {
let obj = res.data || {}
month: month,
planId: this.planId,
})
.then((res) => {
let obj = res.data || {};
if (obj) {
for (let item in obj) {
for (let i = 0; i < obj[item].length; i++) {
if (!obj[item][i].teamId) {
obj[item][i].teamId = ''
obj[item][i].teamId = '';
}
}
}
}
this.list = obj
}).catch(() => {
this.list = {}
this.settingBtnDis = true //
this.list = obj;
})
.catch(() => {
this.list = {};
this.settingBtnDis = true; //
});
},
//
settingMsg() {
this.showSetting = !this.showSetting
this.clearChoose()
this.showSetting = !this.showSetting;
this.clearChoose();
},
//
cancelSetting() {
this.showSetting = !this.showSetting
this.getList() //
this.showSetting = !this.showSetting;
this.getList(); //
},
//
confirmSetting() {
let num = 0
let num = 0;
//
if (moment(this.startDay).format('YYYY-MM') === moment().format('YYYY-MM')) {
num = Number(moment().format('DD'))
if (
moment(this.startDay).format('YYYY-MM') === moment().format('YYYY-MM')
) {
num = Number(moment().format('DD'));
} else {
num = 0
num = 0;
}
//
//
let tempArr = Object.values(this.list)
let arr = []
let tempArr = Object.values(this.list);
console.log(tempArr)
console.log(num)
let arr = [];
for (let i = num; i < tempArr.length; i++) {
for (let j = 0; j < tempArr[i].length; j++) {
arr.push(tempArr[i][j])
arr.push(tempArr[i][j]);
}
}
createOrUpdateList(arr).then(res => {
createOrUpdateList(arr).then((res) => {
if (res.code === 0) {
this.showSetting = !this.showSetting
this.$modal.msgSuccess("操作成功")
this.getList() //
this.showSetting = !this.showSetting;
this.$modal.msgSuccess('操作成功');
this.getList(); //
}
})
});
},
//
chooseTeam(value) {
if (this.showSetting) {
this.$modal.msgWarning("当前处于设置模式")
return false
}
this.chooseObj = value
this.chooseTip = value.startDay + value.classesId //
this.jumpDisabled = false //
},
//
schedulingBtn() {
let tempData = this.list
// 1
if (this.list[1][0].teamId) {
let tempArr = Object.values(this.list)
let arr = []
let n = 0
for (let i = 0; i < tempArr.length; i++) {
if (n > 0) {
break;
}
for (let j = 0; j < tempArr[i].length; j++) {
if (tempArr[i][j].teamId) {
arr.push(tempArr[i][j].teamId)
} else {
n++
}
}
}
let tempNum = 0
for (let k = 0; k < tempArr.length; k++) {
for (let v = 0; v < tempArr[k].length; v++) {
let t = tempNum % arr.length
if (arr.length === 1) {
tempData[k+1][v].teamId = arr[0]
} else {
tempData[k+1][v].teamId = arr[t]
}
tempNum++
}
}
this.list = []
this.list = tempData
} else {
// 1,
// console.log(moment(this.startDay).format("YYYY-MM-DD"))
autoSet({
year: this.year,
month: moment(this.startDay).month() + 1
}).then(res => {
this.list = res.data || {}
})
}
// if (this.showSetting) {
// this.$modal.msgWarning('');
// return false;
// }
this.chooseObj = value;
this.chooseTip = value.startDay + value.classesId; //
this.jumpDisabled = false; //
},
//
settingBtn() {
let nowMonth = moment().startOf('month').valueOf()
let startMonth = moment(this.startDay).valueOf()
let nowDate = moment(new Date()).date()
let sumDate = moment().daysInMonth()
if (nowMonth > startMonth) { //
this.settingBtnDis = true
let nowMonth = moment().startOf('month').valueOf();
let startMonth = moment(this.startDay).valueOf();
let nowDate = moment(new Date()).date();
let sumDate = moment().daysInMonth();
if (nowMonth > startMonth) {
//
this.settingBtnDis = true;
} else {
if (nowDate < sumDate) {
this.settingBtnDis = false
this.settingBtnDis = false;
} else {
this.settingBtnDis = true
this.settingBtnDis = true;
}
}
},
//
clearChoose() {
this.chooseObj = {}
this.chooseTip = ""
this.jumpDisabled = true
this.chooseObj = {};
this.chooseTip = '';
this.jumpDisabled = true;
},
//
toggleMonth() {
this.year = moment(this.startDay).format("YYYY")
let month = Number(moment(this.startDay).format("MM"))
this.month = this.monthList[month - 1]
this.year = moment(this.startDay).format('YYYY');
let month = Number(moment(this.startDay).format('MM'));
this.month = this.monthList[month - 1];
},
// 3
toOtherPage(val) {
switch (val) {
case '1':
this.$router.push({
// path: '/core/monitoring/production-line-data',
name: 'ProductionLineData',
params: { startTime: this.chooseObj.startTime, endTime: this.chooseObj.endTime }
})
break;
case '2': //
this.$router.push({
name: 'EnergyReportSearch',
params: { startTime: this.chooseObj.startTime, endTime: this.chooseObj.endTime }
})
break;
default:
this.$router.push({
// path: '/quality/monitoring/quality-statistics',
name: 'QualityStatistics',
params: { startTime: this.chooseObj.startTime, endTime: this.chooseObj.endTime }
})
}
}
}
}
},
};
</script>
<style lang='scss'>
<style lang="scss">
.demo-form-inline {
.el-date-editor .el-range__icon {
font-size: 16px;
color: #0B58FF;
color: #0b58ff;
}
.el-input__prefix .el-icon-date {
font-size: 16px;
color: #0B58FF;
color: #0b58ff;
}
}
.groupTeamScheduling {
background-color: #F2F4F9;
background-color: #f2f4f9;
.operationArea {
padding: 14px 10px 0 16px;
margin-bottom: 8px;
@ -329,7 +375,7 @@ export default {
display: inline-block;
width: 4px;
height: 16px;
background-color: #0B58FF;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
margin-top: 10px;
@ -338,7 +384,7 @@ export default {
display: inline-block;
width: 1px;
height: 24px;
background: #E8E8E8;
background: #e8e8e8;
vertical-align: middle;
}
.el-form-item {
@ -368,7 +414,8 @@ export default {
}
.el-calendar-table__row {
height: 133px;
.prev, .next {
.prev,
.next {
pointer-events: none;
}
.el-calendar-day {
@ -385,10 +432,13 @@ export default {
}
}
}
.team-active {//
border:2px solid red
.team-active {
//
border: 2px solid #409eff;
}
.class1, .class2, .class3 {
.class1,
.class2,
.class3 {
padding: 0;
font-weight: 600;
margin-bottom: 2px;
@ -432,47 +482,50 @@ export default {
}
.class1 {
.selectDiv {
.toggle-icon, .toggle-icon-hide {
background-color: #FACE00;
.toggle-icon,
.toggle-icon-hide {
background-color: #face00;
}
.el-input--small .el-input__inner {
color: #E7A200;
background-color: #FFEFC0;
color: #e7a200;
background-color: #ffefc0;
}
}
.labelClass {
color: #E7A200;
background-color: #FFEFC0;
color: #e7a200;
background-color: #ffefc0;
}
}
.class2 {
.selectDiv {
.toggle-icon, .toggle-icon-hide {
background-color: #3984FF;
.toggle-icon,
.toggle-icon-hide {
background-color: #3984ff;
}
.el-input--small .el-input__inner {
color: #2D7BFF;
background-color: #BEEAFF;
color: #2d7bff;
background-color: #beeaff;
}
}
.labelClass {
color: #2D7BFF;
background-color: #BEEAFF;
color: #2d7bff;
background-color: #beeaff;
}
}
.class3 {
.selectDiv {
.toggle-icon, .toggle-icon-hide {
background-color: #37D97F;
.toggle-icon,
.toggle-icon-hide {
background-color: #37d97f;
}
.el-input--small .el-input__inner {
color: #129F51;
background-color: #E0FFEE;
color: #129f51;
background-color: #e0ffee;
}
}
.labelClass {
color: #129F51;
background-color: #E0FFEE;
color: #129f51;
background-color: #e0ffee;
}
}
}

View File

@ -0,0 +1,216 @@
<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">
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" />
</div>
</template>
<script>
import { parseTime } from '@/utils/ruoyi';
import tableHeightMixin from '@/mixins/tableHeightMixin';
import { schedulingPage } from '@/api/base/groupTeamScheduling';
import { getFactoryPage } from '@/api/core/base/factory';
import {
getGroupClassesPage,
} from '@/api/base/groupClasses';
import {
getGroupTeamPage,
} from '@/api/base/groupTeam';
import * as XLSX from 'xlsx';
import FileSaver from 'file-saver';
const tableProps = [
{
prop: 'factoryName',
label: '工厂',
},
{
prop: 'startDay',
label: '上班日期',
filter: parseTime,
minWidth: 160,
},
{
prop: 'startTime',
label: '上班时间',
filter: (val) => (val ? parseTime(val, '{h}:{i}') : '-'),
width: 100,
},
{
prop: 'endTime',
label: '下班时间',
filter: (val) => (val ? parseTime(val, '{h}:{i}') : '-'),
width: 100,
},
{
prop: 'classesName',
label: '班次名称',
},
{
prop: 'teamName',
label: '班组名称',
},
];
export default {
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
{
type: 'select',
label: '工厂',
selectOptions: [],
param: 'factoryId',
onchange: true,
},
{
type: 'select',
label: '班次',
selectOptions: [],
param: 'classesId',
},
{
type: 'select',
label: '班组',
selectOptions: [],
param: 'teamId',
},
{
type: 'datePicker',
label: '上班日期',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '',
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
tableProps,
//
total: 0,
//
list: [],
//
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
},
};
},
created() {
this.getList();
this.getPdLineList();
},
methods: {
handleExport() {
let tables = document.querySelector('.el-table').cloneNode(true);
const fix = tables.querySelector('.el-table__fixed');
const fixRight = tables.querySelector('.el-table__fixed-right');
if (fix) {
tables.removeChild(tables.querySelector('.el-table__fixed'));
}
if (fixRight) {
tables.removeChild(tables.querySelector('.el-table__fixed-right'));
}
let exportTable = XLSX.utils.table_to_book(tables);
var exportTableOut = XLSX.write(exportTable, {
bookType: 'xlsx',
bookSST: true,
type: 'array',
});
// sheetjs.xlsx
try {
FileSaver.saveAs(
new Blob([exportTableOut], {
type: 'application/octet-stream',
}),
this.fileName + '班组上班记录.xlsx'
);
} catch (e) {
if (typeof console !== 'undefined') console.log(e, exportTableOut);
}
return exportTableOut;
},
getPdLineList() {
const params = {
pageSize: 100,
pageNo: 1,
};
getGroupClassesPage(params).then((res) => {
this.formConfig[1].selectOptions = res.data.list || [];
});
getGroupTeamPage(params).then((res) => {
this.formConfig[2].selectOptions = res.data.list || [];
});
getFactoryPage(params).then((res) => {
this.formConfig[0].selectOptions = res.data.list || [];
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.factoryId = val.factoryId || undefined;
this.queryParams.classesId = val.classesId || undefined;
this.queryParams.teamName = val.teamId || undefined;
this.queryParams.startDay = val.timeVal
? val.timeVal
: undefined;
this.getList();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
/** 查询列表 */
getList() {
schedulingPage(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
});
},
},
};
</script>

View File

@ -0,0 +1,240 @@
<!--
* @Author: zwq
* @Date: 2024-07-10 13:43:41
* @LastEditors: zwq
* @LastEditTime: 2025-01-14 11:06:24
* @Description:
-->
<template>
<el-form ref="form" :rules="rules" label-width="110px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="工厂" prop="factoryId">
<el-select
v-model="form.factoryId"
filterable
clearable
style="width: 100%"
placeholder="请选择工厂">
<el-option
v-for="item in factoryArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计划名称" prop="name">
<el-input v-model="form.name" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="相关班组" prop="teamIdList">
<el-select
v-model="form.teamIdList"
filterable
clearable
multiple
style="width: 100%"
placeholder="请选择班组">
<el-option
v-for="item in teamList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="相关班次" prop="classesIdList">
<el-select
v-model="form.classesIdList"
filterable
clearable
multiple
style="width: 100%"
placeholder="请选择班次">
<el-option
v-for="item in classList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark"></el-input>
</el-form-item>
</el-col>
<el-col :span="12" v-if="false">
<el-form-item label="是否生产班组" prop="isProduction">
<el-radio-group v-model="form.isProduction">
<el-radio :label="true"></el-radio>
<el-radio :label="false"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24" v-show="form.isProduction">
<tree-transfer
:title="title"
:from_data="fromData"
:to_data="toData"
@add-btn="add"
@remove-btn="remove"
pid="productionLineId"
:defaultProps="{ label: 'name' }"
height="450px"
:mode="mode"
filter
openAll></tree-transfer>
</el-col>
</el-row>
</el-form>
</template>
<script>
import {
getGroupPlan,
updateGroupPlan,
createGroupPlan,
getGroupPlanTree,
createGroupPlanLine,
updateGroupPlanLine,
getGroupPlanLine,
getLoginUserDeptId,
} from '@/api/base/groupSchedulingPlan';
import { getFactoryPage } from '@/api/core/base/factory';
import { listDept } from '@/api/system/dept';
import { listEnabled } from '@/api/base/groupTeam';
import { listClassesEnabled } from '@/api/base/groupClasses';
import treeTransfer from 'el-tree-transfer';
export default {
components: { treeTransfer },
name: '',
data() {
return {
form: {
id: '',
name: '',
factoryId: '',
teamIdList: [],
classesIdList: [],
remark: '',
},
factoryArr: [], //
teamList: [], //
classList: [], //
rules: {
name: [{ required: true, message: '请输入计划名称', trigger: 'blur' }],
factoryId: [
{ required: true, message: '请选择工厂', trigger: 'change' },
],
teamIdList: [
{ required: true, message: '请选择相关班组', trigger: 'change' },
],
classesIdList: [
{ required: true, message: '请选择相关班次', trigger: 'change' },
],
},
title: ['待选', '已选'], // Array false ["", ""]
mode: 'transfer',
fromData: [], //
toData: [], //
};
},
methods: {
init(id) {
this.form.id = id || undefined;
this.fromData = [];
this.toData = [];
this.getArr();
this.$nextTick(() => {
this.$refs['form'].resetFields();
if (this.form.id) {
getGroupPlan(id).then((response) => {
this.form = response.data;
});
}
});
},
getArr() {
const params = {
pageSize: 100,
pageNo: 1,
};
getFactoryPage(params).then((res) => {
this.factoryArr = res.data.list || [];
});
listEnabled().then((res) => {
this.teamList = res.data || [];
});
listClassesEnabled().then((res) => {
this.classList = res.data || [];
});
getGroupPlanTree().then((res) => {
this.fromData = res.data;
this.fromData.forEach((item) => {
item.productionLineId = 0;
});
});
},
// 穿
add(fromData, toData, obj) {
console.log('fromData:', fromData);
console.log('toData:', toData);
},
// 穿
remove(fromData, toData, obj) {
console.log('fromData:', fromData);
console.log('toData:', toData);
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.form.id) {
//
updateGroupPlan({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
});
} else {
createGroupPlan({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
});
}
} else {
return false;
}
});
},
formClear() {
this.$refs.form.resetFields();
},
/** 消除组件左边与右边选中数据相同项 */
//
getFilterLeftData(data, selData) {
for (let i = data.length - 1; i >= 0; i--) {
for (let j = selData.length - 1; j >= 0; j--) {
if (data[i] && data[i].id === selData[j].id) {
// id
if (!data[i].children) {
data.splice(i, 1);
} else {
this.getFilterLeftData(data[i].children, selData[j].children);
}
}
}
}
},
},
};
</script>

View File

@ -0,0 +1,230 @@
<!--
* @Author: zwq
* @Date: 2024-07-10 11:08:48
* @LastEditors: zwq
* @LastEditTime: 2025-01-14 13:28:40
* @Description:
-->
<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="50%">
<schedulingPlanConfigAdd ref="classList" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import {
getGroupPlanPage,
deleteGroupPlan,
} from '@/api/base/groupSchedulingPlan';
import schedulingPlanConfigAdd from './components/schedulingPlanConfigAdd.vue';
import tableHeightMixin from '@/mixins/tableHeightMixin';
import { getFactoryPage } from '@/api/core/base/factory';
const tableProps = [
{
prop: 'factoryName',
label: '工厂',
},
{
prop: 'name',
label: '计划名称',
},
{
prop: 'teamName',
label: '班组名称',
},
{
prop: 'classesName',
label: '班次名称',
},
];
export default {
name: 'schedulingPlanConfig',
components: { schedulingPlanConfigAdd },
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
{
type: 'select',
label: '工厂',
selectOptions: [],
param: 'factoryId',
onchange: true,
},
{
type: 'input',
label: '计划名称',
placeholder: '计划名称',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:group-scheduling-plan:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:group-scheduling-plan:update')
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:group-scheduling-plan:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
//
total: 0,
//
list: [],
//
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: null,
},
};
},
created() {
this.getList();
this.getPdLineList();
},
methods: {
getPdLineList() {
const params = {
pageSize: 100,
pageNo: 1,
};
getFactoryPage(params).then((res) => {
this.formConfig[0].selectOptions = res.data.list || [];
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.name = val.name || undefined;
this.queryParams.factoryId = val.factoryId || undefined;
this.getList();
break;
default:
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.classList.init();
});
}
},
/** 查询列表 */
getList() {
getGroupPlanPage(this.queryParams).then((res) => {
if (res.code === 0 && res.data.list && res.data.list.length > 0) {
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;
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();
},
/** 删除按钮操作 */
handleDelete(row) {
let _this = this;
this.$confirm(`是否确认删除 ${row.name} 的数据项?`, "系统提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return deleteGroupPlan(row.id);
})
.then(() => {
_this.getList();
_this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
};
</script>

View File

@ -0,0 +1,340 @@
<!--
* @Author: zwq
* @Date: 2024-07-11 09:30:21
* @LastEditors: zwq
* @LastEditTime: 2025-01-14 15:35:03
* @Description:
-->
<template>
<el-form ref="form" :rules="rules" label-width="110px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="工厂" prop="factoryId">
<el-select
v-model="form.factoryId"
filterable
clearable
style="width: 100%"
placeholder="请选择工厂">
<el-option
v-for="item in factoryArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="排班开始日期" prop="startDay">
<el-date-picker
v-model="form.startDay"
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="endDay">
<el-date-picker
v-model="form.endDay"
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="planId">
<el-select
v-model="form.planId"
filterable
clearable
@change="setTableArr"
style="width: 100%"
placeholder="请选择排班计划">
<el-option
v-for="item in planArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<div class="min-title">班组上班顺序</div>
</el-col>
<el-col :span="12">
<el-form-item prop="groupTeamNum">
<el-input-number
v-model="form.groupTeamNum"
:step="1"
:min="1"
step-strictly></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-select
v-model="teamList"
clearable
style="width: 100%; display: inline-block; margin-bottom: 28px"
@change="teamRuleMore"
@visible-change="teamRuleLess"
multiple
placeholder="请选择班组">
<el-option
v-for="item in teamArr"
:key="item.id"
:label="item.name"
:value="item.id">
<span slot="default" style="width: 100%">
{{ item.name }}
<span v-if="teamList.includes(item.id)" style="float: right">
{{ teamList.findIndex((v) => v === item.id) + 1 }}
</span>
</span>
</el-option>
</el-select>
</el-col>
<el-col :span="12">
<el-form-item prop="groupClassesNum">
<el-input-number
v-model="form.groupClassesNum"
:step="1"
:min="1"
step-strictly></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-select
v-model="classesList"
clearable
style="width: 100%; display: inline-block; margin-bottom: 28px"
@change="classesRuleMore"
@visible-change="classesRuleLess"
multiple
placeholder="请选择班次">
<el-option
v-for="item in classesArr"
:key="item.id"
:label="item.name"
:value="item.id">
<span slot="default" style="width: 100%">
{{ item.name }}
<span v-if="classesList.includes(item.id)" style="float: right">
{{ classesList.findIndex((v) => v === item.id) + 1 }}
</span>
</span>
</el-option>
</el-select>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import {
getGroupRule,
updateGroupRule,
createGroupRule,
} from '@/api/base/groupSchedulingRule';
import {
groupPlanList,
groupPlanTeamList,
groupPlanClassesList,
} from '@/api/base/groupSchedulingPlan';
import { getFactoryPage } from '@/api/core/base/factory';
import tableSelect from './tableSelect';
export default {
name: 'schedulingRuleConfigAdd',
data() {
return {
form: {
id: '',
factoryId: '',
startDay: '',
endDay: '',
planId: '',
groupTeamNum: 1,
groupClassesNum: 1,
groupClassesList: [],
groupTeamList: [],
remark: '',
},
factoryArr: [], //
planArr: [], //
classesArr: [],
teamArr: [],
classesList: [],
teamList: [],
rules: {
factoryId: [
{ required: true, message: '请选择工厂', trigger: 'change' },
],
startDay: [
{ required: true, message: '请选择排班开始时间', trigger: 'change' },
],
endDay: [
{ required: true, message: '请选择排班结束时间', trigger: 'change' },
],
planId: [
{ required: true, message: '请选择排班计划', trigger: 'change' },
],
},
};
},
methods: {
init(id) {
this.form = {
id: id || undefined,
factoryId: '',
startDay: '',
endDay: '',
planId: '',
groupClassesList: [],
groupTeamList: [],
remark: '',
};
this.classesList = [];
this.teamList = [];
this.getArr();
this.$nextTick(() => {
this.$refs['form'].resetFields();
if (this.form.id) {
getGroupRule(id).then((response) => {
this.form = response.data;
response.data.teamSequenceList.forEach(item=>{
this.teamList.push(item.teamId)
})
response.data.classesSequenceList.forEach(item=>{
this.classesList.push(item.classesId)
})
this.form.groupTeamNum = response.data.teamSequenceList.length
this.form.groupClassesNum = response.data.classesSequenceList.length
this.getTableArr(response.data.planId);
});
}
});
},
getArr() {
const params = {
pageSize: 100,
pageNo: 1,
};
getFactoryPage(params).then((res) => {
this.factoryArr = res.data.list || [];
});
groupPlanList().then((res) => {
this.planArr = res.data || [];
});
},
setTableArr() {
if (this.form.planId) {
this.getTableArr(this.form.planId);
}
},
async getTableArr(id) {
//
const res0 = await groupPlanClassesList(id);
this.classesArr = res0.data || [];
const res1 = await groupPlanTeamList(id);
this.teamArr = res1.data || [];
},
teamRuleMore() {
if (this.teamList.length > this.form.groupTeamNum) {
this.$message('选择班组数 超过 排班数');
}
},
teamRuleLess(val) {
if (val === false) {
if (this.teamList.length < this.form.groupTeamNum) {
this.$message('选择班组数 小于 排班数');
}
}
},
classesRuleMore() {
if (this.classesList.length > this.form.groupClassesNum) {
this.$message('选择班次数 超过 倒班数');
}
},
classesRuleLess(val) {
if (val === false) {
if (this.classesList.length < this.form.groupClassesNum) {
this.$message('选择班组数 小于 倒班数');
}
}
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.teamList.length > this.form.groupTeamNum) {
this.$message('选择班组数 超过 排班数');
return
} else if (this.teamList.length < this.form.groupTeamNum) {
this.$message('选择班组数 小于 排班数');
return
}
if (this.classesList.length > this.form.groupClassesNum) {
this.$message('选择班次数 超过 倒班数');
return
} else if (this.classesList.length < this.form.groupClassesNum) {
this.$message('选择班组数 小于 倒班数');
return
}
this.form.groupTeamList = []
this.teamList.forEach((item,index)=>{
this.form.groupTeamList.push({
teamId: item,
sequence:index+1
})
})
this.form.groupClassesList = []
this.classesList.forEach((item,index)=>{
this.form.groupClassesList.push({
classesId: item,
sequence:index+1
})
})
if (this.form.id) {
//
updateGroupRule({ ...this.form }).then((res) => {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
});
} else {
createGroupRule({ ...this.form }).then((res) => {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
});
}
} else {
return false;
}
});
},
formClear() {
this.$refs.form.resetFields();
},
},
};
</script>
<style scoped>
.min-title {
margin-bottom: 5px;
}
.min-title::before {
content: '*';
color: #ff5454;
margin-right: 4px;
}
</style>

View File

@ -0,0 +1,44 @@
<template>
<div class="tableInner">
<el-select :key="itemProp+list._pageIndex" v-model="list[itemProp]" @change="changeInput">
<el-option
v-for="item in itemProp==='classesId'?list.classesArr:list.teamArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</div>
</template>
<script>
export default {
name: 'tableSelect',
props: {
injectData: {
type: Object,
default: () => ({}),
},
itemProp: {
type: String,
},
},
data() {
return {
list: this.injectData,
};
},
methods: {
changeInput() {
this.$emit('emitData', this.list);
},
},
};
</script>
<style scoped>
.tableInner >>> .el-input__inner {
color: #409EFF;
border: 1px rgb(232, 231, 231) solid;
padding: 0;
text-align: center;
height: 30px;
}
</style>

View File

@ -0,0 +1,284 @@
<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="50%">
<schedulingRuleConfigAdd ref="classList" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import {
getGroupRulePage,
deleteGroupRule,
updateGroupRule,
getGroupRule,
disableGroupRule
} from '@/api/base/groupSchedulingRule';
import schedulingRuleConfigAdd from './components/schedulingRuleConfigAdd.vue';
import { formatDate } from '@/utils';
import tableHeightMixin from '@/mixins/tableHeightMixin';
import { getFactoryPage } from '@/api/core/base/factory';
const tableProps = [
{
prop: 'factoryName',
label: '工厂',
},
{
prop: 'enableTimeStr',
label: '排班日期',
minWidth: 200,
},
{
prop: 'planName',
label: '排班计划',
},
{
prop: 'str',
label: '排班规则',
minWidth: 100,
},
{
prop: 'enabled',
label: '状态',
filter: (val) => (val ? '正常' : '作废'),
},
];
export default {
name: 'schedulingRuleConfig',
components: { schedulingRuleConfigAdd },
mixins: [tableHeightMixin],
data() {
return {
formConfig: [
{
type: 'select',
label: '工厂',
selectOptions: [],
param: 'factoryId',
onchange: true,
},
{
type: 'input',
label: '班次',
placeholder: '班次',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:group-scheduling-rule:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:group-scheduling-rule:cancel')
? {
type: 'cancel',
btnName: '作废',
showParam: {
type: '&',
data: [
{
type: 'unequal',
name: 'enabled',
value: 0,
},
],
},
}
: undefined,
this.$auth.hasPermi('base:group-scheduling-rule:update')
? {
type: 'edit',
btnName: '编辑',
showParam: {
type: '&',
data: [
{
type: 'unequal',
name: 'enabled',
value: 0,
},
],
},
}
: undefined,
this.$auth.hasPermi('base:group-scheduling-rule:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
//
total: 0,
//
list: [],
//
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: null,
},
};
},
created() {
this.getList();
this.getPdLineList();
},
methods: {
getPdLineList() {
const params = {
pageSize: 100,
pageNo: 1,
};
getFactoryPage(params).then((res) => {
this.formConfig[0].selectOptions = res.data.list || [];
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.classesName = val.name || undefined;
this.queryParams.factoryId = val.factoryId || undefined;
this.getList();
break;
default:
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.classList.init();
});
}
},
/** 查询列表 */
getList() {
getGroupRulePage(this.queryParams).then((res) => {
if (res.code === 0 && res.data.list && res.data.list.length > 0) {
res.data.list.map((item) => {
item.enableTimeStr =
formatDate(item.startDay) +
'至' +
(item.endDay ? formatDate(item.endDay) : '永久');
item.str = item.strList.join(',');
});
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 _this = this
this.$confirm(`是否确认作废 ${row.planName} 的数据项?`, "系统提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
disableGroupRule(row.id).then((response) => {
_this.getList();
_this.$modal.msgSuccess('操作成功');
});
})
.catch(() => {});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$confirm(`是否确认删除 ${row.planName} 的数据项?`, "系统提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return deleteGroupRule(row.id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
};
</script>