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 // 导出班次基础信息 Excel
export function exportGroupClassesExcel(query) { export function exportGroupClassesExcel(query) {
return request({ 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' 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 params: query
}) })
} }
// 获取某月预排班
export function getScheduling(query) {
return request({
url: '/base/group-team-scheduling/getScheduling',
method: 'get',
params: query
})
}
// 批量创建-更新排班信息 // 批量创建-更新排班信息
export function createOrUpdateList(data) { export function createOrUpdateList(data) {
return request({ return request({
@ -26,3 +33,12 @@ export function autoSet(query) {
params: 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 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 <SearchBar
:formConfigs="searchBarFormConfig" :formConfigs="searchBarFormConfig"
ref="search-bar" ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" /> @select-changed="handleSearchBarChanged"
@headBtnClick="buttonClick" />
<!-- 列表 --> <!-- 列表 -->
<base-table <base-table
@ -52,6 +53,8 @@ import {
getEquipmentBindSectionPage, getEquipmentBindSectionPage,
exportEquipmentBindSectionExcel, exportEquipmentBindSectionExcel,
} from '@/api/base/equipmentBindSection'; } from '@/api/base/equipmentBindSection';
import { getPdList } from '@/api/core/monitoring/auto';
import { getFactoryPage } from '@/api/core/base/factory';
import moment from 'moment'; import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import DialogForm from './dialogForm.vue'; import DialogForm from './dialogForm.vue';
@ -61,7 +64,7 @@ export default {
mixins: [basicPageMixin], mixins: [basicPageMixin],
data() { data() {
return { return {
searchBarKeys: ['workshopSectionId', 'equipmentName'], searchBarKeys: ['factoryId','productionLineId','workshopSectionId', 'equipmentName'],
tableBtn: [ tableBtn: [
this.$auth.hasPermi('base:equipment-bind-section:update') this.$auth.hasPermi('base:equipment-bind-section:update')
? { ? {
@ -84,8 +87,9 @@ export default {
width: 180, width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
}, },
{ prop: 'productionLine', label: '产线名称' }, { prop: 'factoryName', label: '工厂' },
{ prop: 'workshopSection', label: '工段名称' }, { prop: 'productionLine', label: '产线' },
{ prop: 'workshopSection', label: '工段' },
{ prop: 'equipment', label: '设备名称' }, { prop: 'equipment', label: '设备名称' },
{ prop: 'sort', label: '工段中排序' }, { prop: 'sort', label: '工段中排序' },
{ {
@ -129,6 +133,20 @@ export default {
// }, // },
], ],
searchBarFormConfig: [ searchBarFormConfig: [
{
type: 'select',
label: '工厂',
selectOptions: [],
param: 'factoryId',
onchange: true,
},
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'productionLineId',
multiple: true,
},
{ {
type: 'select', type: 'select',
label: '工段', label: '工段',
@ -235,6 +253,8 @@ export default {
pageSize: 10, pageSize: 10,
workshopSectionId: null, workshopSectionId: null,
equipmentId: null, equipmentId: null,
factoryId: null,
productionLineId: [],
}, },
// //
form: {}, form: {},
@ -243,6 +263,7 @@ export default {
created() { created() {
this.getList(); this.getList();
this.initWorksection(); this.initWorksection();
this.getPdLineList();
}, },
methods: { methods: {
/** 准备工段数据 */ /** 准备工段数据 */
@ -252,7 +273,7 @@ export default {
method: 'get', method: 'get',
}); });
if (code == 0) { if (code == 0) {
this.searchBarFormConfig[0].selectOptions = data.map((item) => { this.searchBarFormConfig[2].selectOptions = data.map((item) => {
return { return {
name: item.name, name: item.name,
id: item.id, 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() { getList() {
this.loading = true; this.loading = true;

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,22 @@
<template> <template>
<el-form ref="form" :rules="rules" label-width="110px" :model="form"> <el-form ref="form" :rules="rules" label-width="110px" :model="form">
<el-row> <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-col :span="12">
<el-form-item label="班次名称" prop="name"> <el-form-item label="班次名称" prop="name">
<el-input v-model="form.name"></el-input> <el-input v-model="form.name"></el-input>
@ -11,70 +27,40 @@
<el-input v-model="form.code" disabled></el-input> <el-input v-model="form.code" disabled></el-input>
</el-form-item> </el-form-item>
</el-col> </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-col :span="12">
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark"></el-input> <el-input v-model="form.remark"></el-input>
</el-form-item> </el-form-item>
</el-col> </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-col :span="12">
<el-form-item label="是否跨天" prop="daySpan"> <el-form-item label="是否跨天" prop="daySpan">
<el-select v-model="form.daySpan" placeholder="请选择" disabled style="width: 100%;"> <el-select
<el-option label="否" :value= '0' ></el-option> v-model="form.daySpan"
<el-option label="是" :value= '1' ></el-option> placeholder="请选择"
disabled
style="width: 100%">
<el-option label="否" :value="0"></el-option>
<el-option label="是" :value="1"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -82,107 +68,115 @@
</el-form> </el-form>
</template> </template>
<script> <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 { export default {
name: 'groupClassAdd', name: 'groupClassAdd',
data() { data() {
return { return {
form: { form: {
id: '', id: '',
factoryId: '',
name: '', name: '',
code: '', code: '',
enableTime: '',
disableTime: '',
startTime: '', startTime: '',
endTime: '', endTime: '',
daySpan: '', daySpan: '',
remark: '' remark: '',
}, },
isEdit: false, // isEdit: false, //
factoryArr: [],
rules: { rules: {
factoryId: [
{ required: true, message: '请选择工厂', trigger: 'change' },
],
name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }], name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }],
enableTime: [{ required: true, message: '请选择班次开始时间', trigger: 'change' }],
code: [{ required: true, message: '请输入编码', trigger: 'blur' }], code: [{ required: true, message: '请输入编码', trigger: 'blur' }],
startTime: [{ required: true, message: '请输入生效时间', trigger: 'change' }], startTime: [
endTime: [{ required: true, message: '请选择班次结束时间', trigger: 'change' }] { 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: { methods: {
init(id) { init(id) {
if (id) { if (id) {
this.isEdit = true this.isEdit = true;
this.form.id = id this.form.id = id;
getGroupClasses(id).then((res) => { getGroupClasses(id).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.form = res.data this.form = res.data;
} }
}) });
} else { } else {
this.isEdit = false this.isEdit = false;
this.form.id = '' this.form.id = '';
getCode().then((res) => { getCode().then((res) => {
this.form.code = res.data this.form.code = res.data;
}) });
} }
}, },
timeFun(val) { timeFun(val) {
if (this.form.startTime && this.form.endTime) { if (this.form.startTime && this.form.endTime) {
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) { } else if (this.form.startTime < this.form.endTime) {
this.form.daySpan = 0 this.form.daySpan = 0;
} else { } else {
if (val === 'start') { if (val === 'start') {
this.form.startTime = '' this.form.startTime = '';
} else { } else {
this.form.endTime = '' this.form.endTime = '';
} }
this.$modal.msgWarning('班次开始时间和结束时间不能相同') this.$modal.msgWarning('班次开始时间和结束时间不能相同');
} }
} }
}, },
submitForm() { submitForm() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (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) { if (this.isEdit) {
// //
updateGroupClasses({ ...obj }).then((res) => { updateGroupClasses({ ...this.form }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit') this.$emit('successSubmit');
} }
}) });
} else { } else {
createGroupClasses({ ...obj }).then((res) => { createGroupClasses({ ...this.form }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit') this.$emit('successSubmit');
} }
}) });
} }
} else { } else {
return false return false;
} }
}) });
}, },
formClear() { formClear() {
this.$refs.form.resetFields() this.$refs.form.resetFields();
this.isEdit = false this.isEdit = false;
} },
} },
} };
</script> </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> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-bar <search-bar
:formConfigs="formConfig" :formConfigs="formConfig"
ref="searchBarForm" ref="searchBarForm"
@headBtnClick="buttonClick" @headBtnClick="buttonClick" />
/>
<!-- 列表 --> <!-- 列表 -->
<base-table <base-table
:page="queryParams.pageNo" :page="queryParams.pageNo"
@ -14,22 +19,20 @@
:table-props="tableProps" :table-props="tableProps"
:table-data="list" :table-data="list"
:max-height="tableH" :max-height="tableH"
> @emitFun="handleTableEvents">
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
:width="120" :width="120"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleClick" @clickBtn="handleClick" />
/>
</base-table> </base-table>
<pagination <pagination
:page.sync="queryParams.pageNo" :page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
:total="total" :total="total"
@pagination="getList" @pagination="getList" />
/>
<!-- 新增 --> <!-- 新增 -->
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
@ -37,224 +40,250 @@
@cancel="handleCancel" @cancel="handleCancel"
@confirm="handleConfirm" @confirm="handleConfirm"
:before-close="handleCancel" :before-close="handleCancel"
width='50%' width="50%">
>
<group-class-add ref="classList" @successSubmit="successSubmit" /> <group-class-add ref="classList" @successSubmit="successSubmit" />
</base-dialog> </base-dialog>
</div> </div>
</template> </template>
<script> <script>
import { getGroupClassesPage, deleteGroupClasses, updateGroupClasses } from "@/api/base/groupClasses"; import {
import GroupClassAdd from './components/groupClassAdd.vue' getGroupClassesPage,
import { formatDate } from '@/utils' 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 = [ const tableProps = [
{ {
prop: 'enableTimeStr', prop: 'factoryName',
label: '生效时段', label: '工厂',
minWidth: 300
}, },
{ {
prop: 'name', prop: 'name',
label: '班次名称' label: '班次名称',
}, },
{ {
prop: 'timeStr', prop: 'timeStr',
label: '班次时间', label: '班次时间',
minWidth: 100 minWidth: 100,
}, },
{ {
prop: 'code', prop: 'code',
label: '班次编码', label: '班次编码',
minWidth: 200 minWidth: 200,
}, },
{ {
prop: 'status', prop: 'enabled',
label: '班次状态' label: '班次状态',
subcomponent: StatusBtn,
}, },
{ // {
prop: 'remark', // prop: 'remark',
label: '备注' // label: '',
} // },
] ];
export default { export default {
name: "GroupClass", name: 'GroupClass',
components: { GroupClassAdd }, components: { GroupClassAdd },
mixins: [tableHeightMixin],
data() { data() {
return { return {
formConfig: [ formConfig: [
{
type: 'select',
label: '工厂',
selectOptions: [],
param: 'factoryId',
onchange: true,
},
{ {
type: 'input', type: 'input',
label: '班次名称', label: '班次名称',
placeholder: '班次名称', placeholder: '班次名称',
param: 'name' param: 'name',
}, },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
name: 'search', 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: '新增', btnName: '新增',
name: 'add', name: 'add',
color: 'success', color: 'success',
plain: true plain: true,
} },
], ],
tableProps, tableProps,
tableBtn: [ tableBtn: [
{
type: 'cancel',
btnName: '作废',
showParam: {
type: '&',
data: [
{
type: 'unequal',
name: 'status',
value: '不可用'
}
]
}
},
this.$auth.hasPermi('base:group-classes:update') this.$auth.hasPermi('base:group-classes:update')
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑' btnName: '编辑',
} }
: undefined, : undefined,
this.$auth.hasPermi('base:group-classes:delete') this.$auth.hasPermi('base:group-classes:delete')
? { ? {
type: 'delete', type: 'delete',
btnName: '删除' btnName: '删除',
} }
: undefined : undefined,
].filter((v) => v), ].filter((v) => v),
tableH: this.tableHeight(260),
// //
total: 0, total: 0,
// //
list: [], list: [],
// //
addOrEditTitle: "", addOrEditTitle: '',
// //
centervisible: false, centervisible: false,
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 20, pageSize: 20,
name: null name: null,
} },
}; };
}, },
created() { created() {
window.addEventListener('resize', () => { this.getList();
this.tableH = this.tableHeight(260) this.getPdLineList();
})
this.getList()
}, },
methods: { methods: {
getPdLineList() {
const params = {
pageSize: 100,
pageNo: 1,
};
getFactoryPage(params).then((res) => {
this.formConfig[0].selectOptions = res.data.list || [];
});
},
buttonClick(val) { buttonClick(val) {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.queryParams.name = val.name this.queryParams.name = val.name;
this.getList() this.queryParams.factoryId = val.factoryId || undefined;
break this.getList();
break;
default: default:
this.addOrEditTitle = '新增' this.addOrEditTitle = '新增';
this.centervisible = true this.centervisible = true;
this.$nextTick(() => { 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() { getList() {
getGroupClassesPage(this.queryParams).then(res => { getGroupClassesPage(this.queryParams).then((res) => {
if (res.code === 0 && res.data.list.length > 0) { if (res.code === 0 && res.data.list && res.data.list.length > 0) {
res.data.list.map(item => { res.data.list.map((item) => {
item.enableTimeStr = formatDate(item.enableTime) + '至' + (item.disableTime ? formatDate(item.disableTime) : '永久') item.timeStr =
item.timeStr = item.startTime.slice(0, 5) + '-' + item.endTime.slice(0, 5) item.startTime.slice(0, 5) + '-' + item.endTime.slice(0, 5);
item.status = item.status === true ? '可用' : '不可用' });
})
this.list = res.data.list; this.list = res.data.list;
this.total = res.data.total; this.total = res.data.total;
} else { } else {
this.list = [] this.list = [];
this.total = 0 this.total = 0;
} }
}); });
}, },
handleClick(val) { handleClick(val) {
switch (val.type) { switch (val.type) {
case 'edit': case 'edit':
this.addOrEditTitle = '编辑' this.addOrEditTitle = '编辑';
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.classList.init(val.data.id) this.$refs.classList.init(val.data.id);
}) });
this.centervisible = true this.centervisible = true;
break break;
case 'cancel':
this.discard(val.data)
break
default: default:
this.handleDelete(val.data) this.handleDelete(val.data);
} }
}, },
handleCancel() { handleCancel() {
this.$refs.classList.formClear() this.$refs.classList.formClear();
this.centervisible = false this.centervisible = false;
this.addOrEditTitle = '' this.addOrEditTitle = '';
}, },
handleConfirm() { handleConfirm() {
this.$refs.classList.submitForm() this.$refs.classList.submitForm();
}, },
successSubmit() { successSubmit() {
this.handleCancel() this.handleCancel();
this.getList()
},
discard(row) {
let obj = {}
obj.id = row.id
obj.startTime = row.startTime
obj.endTime = row.endTime
obj.enableTime = row.enableTime
obj.disableTime = Date.parse(new Date())
this.$modal.confirm('是否确认作废班次名称为"' + row.name + '"的数据项?').then(function() {
return updateGroupClasses({ ...obj })
}).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("操作成功");
}).catch(() => {});
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
console.log(row) let _this = this;
let _this = this if (row.enabled) {
if (row.status === '可用') {// //
_this.$modal.confirm('删除的班次"' + row.name + '"可能会影响交接班计划,请点取消再次确认!').then(function() { this.$confirm(
return _this.$modal.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?').then(function() { `是否确认删除 ${row.name} 的数据项?`,
'可能会影响交接班计划!',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
).then(function () {
return _this.$modal
.delConfirm(row.name)
.then(function () {
return deleteGroupClasses(row.id); return deleteGroupClasses(row.id);
}).then(() => {
_this.getList();
_this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}) })
} else { .then(() => {
_this.$modal.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?').then(function() {
return deleteGroupClasses(row.id);
}).then(() => {
_this.getList(); _this.getList();
_this.$modal.msgSuccess("删除成功"); _this.$modal.msgSuccess('删除成功');
}).catch(() => {}); })
} .catch(() => {});
} });
} else {
this.$confirm(`是否确认删除 ${row.name} 的数据项?`, '系统提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(function () {
return deleteGroupClasses(row.id);
})
.then(() => {
_this.getList();
_this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
} }
},
},
}; };
</script> </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> <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-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-col :span="12">
<el-form-item label="班组名称" prop="name"> <el-form-item label="班组名称" prop="name">
<el-input v-model="form.name"></el-input> <el-input v-model="form.name"></el-input>
@ -11,56 +27,88 @@
<el-input v-model="form.code" disabled></el-input> <el-input v-model="form.code" disabled></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="班组人数" prop="num"> <el-form-item label="班组组长" prop="leaderName">
<el-input-number v-model="form.num" :min="1" :max="99999999" style="width: 100%;"></el-input-number> <el-input v-model="form.leaderName" clearable></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="班组组长" prop="leaderName"> <el-form-item label="手机号" prop="leaderPhone">
<el-input v-model="form.leaderName"></el-input> <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-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</template> </template>
<script> <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 { export default {
name: 'groupTeamAdd', name: 'groupTeamAdd',
data() { data() {
return { return {
form: { form: {
id: '', id: '',
factoryId: '',
name: '', name: '',
code: '', code: '',
num: null, leaderName: '',
leaderName: '' leaderPhone: '',
num: '',
}, },
factoryArr: [], //
isEdit: false, // isEdit: false, //
rules: { 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: { methods: {
init(id) { init(id) {
if (id) { if (id) {
this.isEdit = true this.isEdit = true;
this.form.id = id this.form.id = id;
getGroupTeam( id ).then((res) => { getGroupTeam(id).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.form = res.data this.form = res.data;
} }
}) });
} else { } else {
this.isEdit = false this.isEdit = false;
this.form.id = '' this.form.id = '';
getCode().then((res) => { getCode().then((res) => {
this.form.code = res.data this.form.code = res.data;
}) });
} }
}, },
submitForm() { submitForm() {
@ -70,27 +118,27 @@ export default {
// //
updateGroupTeam({ ...this.form }).then((res) => { updateGroupTeam({ ...this.form }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit') this.$emit('successSubmit');
} }
}) });
} else { } else {
createGroupTeam({ ...this.form }).then((res) => { createGroupTeam({ ...this.form }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit') this.$emit('successSubmit');
} }
}) });
} }
} else { } else {
return false return false;
} }
}) });
}, },
formClear() { formClear() {
this.$refs.form.resetFields() this.$refs.form.resetFields();
this.isEdit = false this.isEdit = false;
} },
} },
} };
</script> </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> <template>
<el-switch v-model="state" type="text" size="small" :disabled="readonly" @change="changeHandler" /> <el-switch v-model="state" type="text" size="small" :disabled="readonly" @change="changeHandler" />
</template> </template>
@ -12,8 +19,7 @@ export default {
}, },
data() { data() {
return { return {
state: false, state: false
payload: {}
} }
}, },
computed: { computed: {
@ -31,9 +37,17 @@ export default {
} }
}, },
changeHandler() { changeHandler() {
this.payload.id = this.injectData.id let params = {}
this.payload.enabled = this.state ? '1' : '0' let payload = {}
this.$emit('emitData', this.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> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-bar <search-bar
:formConfigs="formConfig" :formConfigs="formConfig"
ref="searchBarForm" ref="searchBarForm"
@headBtnClick="buttonClick" @headBtnClick="buttonClick" />
/>
<!-- 列表 --> <!-- 列表 -->
<base-table <base-table
:page="queryParams.pageNo" :page="queryParams.pageNo"
@ -14,23 +12,20 @@
:table-props="tableProps" :table-props="tableProps"
:table-data="list" :table-data="list"
:max-height="tableH" :max-height="tableH"
@emitFun="handleTableEvents" @emitFun="handleTableEvents">
>
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
:width="80" :width="80"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleClick" @clickBtn="handleClick" />
/>
</base-table> </base-table>
<pagination <pagination
:page.sync="queryParams.pageNo" :page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
:total="total" :total="total"
@pagination="getList" @pagination="getList" />
/>
<!-- 新增 --> <!-- 新增 -->
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
@ -38,104 +33,122 @@
@cancel="handleCancel" @cancel="handleCancel"
@confirm="handleConfirm" @confirm="handleConfirm"
:before-close="handleCancel" :before-close="handleCancel"
> width="40%">
<group-team-add ref="groupList" @successSubmit="successSubmit" /> <group-team-add ref="groupList" @successSubmit="successSubmit" />
</base-dialog> </base-dialog>
</div> </div>
</template> </template>
<script> <script>
import { getGroupTeamPage, deleteGroupTeam, updateGroupTeam } from "@/api/base/groupTeam"; import {
import { parseTime } from '@/utils/ruoyi' getGroupTeamPage,
import GroupTeamAdd from './components/groupTeamAdd.vue' deleteGroupTeam,
import StatusBtn from './components/statusBtn.vue' 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 = [ const tableProps = [
{ {
prop: 'createTime', prop: 'createTime',
label: '创建时间', label: '创建时间',
filter: parseTime, filter: parseTime,
minWidth: 150 minWidth: 160,
},
{
prop: 'factoryName',
label: '工厂',
}, },
{ {
prop: 'name', prop: 'name',
label: '班组名称' label: '班组名称',
}, },
{ {
prop: 'code', prop: 'code',
label: '班组编码', label: '编码',
minWidth: 220 minWidth: 220,
}, },
{ {
prop: 'num', prop: 'num',
label: '班组人数' label: '班组人数',
}, },
{ {
prop: 'leaderName', prop: 'leaderName',
label: '班组组长' label: '组长',
}, },
{ {
prop: 'enabled', prop: 'enabled',
label: '班组状态', label: '班组状态',
subcomponent: StatusBtn subcomponent: StatusBtn,
} },
] ];
export default { export default {
name: "GroupTeam", name: 'GroupTeam',
components: { GroupTeamAdd }, components: { GroupTeamAdd },
mixins: [tableHeightMixin],
data() { data() {
return { return {
formConfig: [ formConfig: [
{ {
type: 'input', type: 'select',
label: '班组名称', label: '工厂',
placeholder: '班组名称', selectOptions: [],
param: 'name' param: 'factoryId',
onchange: true,
}, },
{ {
type: 'input', type: 'input',
label: '班组编码', label: '班组名称',
placeholder: '班组编码', placeholder: '班组名称',
param: 'code' param: 'name',
},
{
type: 'input',
label: '组长',
placeholder: '组长',
param: 'leaderName',
}, },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary' color: 'primary',
}, },
{ {
type: 'separate' type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('base:group-team:create') ? 'button' : '', type: this.$auth.hasPermi('base:group-team:create') ? 'button' : '',
btnName: '新增', btnName: '新增',
name: 'add', name: 'add',
color: 'success', color: 'success',
plain: true plain: true,
} },
], ],
tableProps, tableProps,
tableBtn: [ tableBtn: [
this.$auth.hasPermi('base:group-team:update') this.$auth.hasPermi('base:group-team:update')
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑' btnName: '编辑',
} }
: undefined, : undefined,
this.$auth.hasPermi('base:group-team:delete') this.$auth.hasPermi('base:group-team:delete')
? { ? {
type: 'delete', type: 'delete',
btnName: '删除' btnName: '删除',
} }
: undefined : undefined,
].filter((v) => v), ].filter((v) => v),
tableH: this.tableHeight(260),
// //
total: 0, total: 0,
// //
list: [], list: [],
// //
addOrEditTitle: "", addOrEditTitle: '',
// //
centervisible: false, centervisible: false,
// //
@ -143,36 +156,44 @@ export default {
pageNo: 1, pageNo: 1,
pageSize: 20, pageSize: 20,
name: null, name: null,
code: null code: null,
} },
}; };
}, },
created() { created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getList(); this.getList();
this.getPdLineList();
}, },
methods: { methods: {
getPdLineList() {
const params = {
pageSize: 100,
pageNo: 1,
};
getFactoryPage(params).then((res) => {
this.formConfig[0].selectOptions = res.data.list || [];
});
},
buttonClick(val) { buttonClick(val) {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.queryParams.name = val.name this.queryParams.leaderName = val.leaderName;
this.queryParams.code = val.code this.queryParams.factoryId = val.factoryId || undefined;
this.getList() this.queryParams.name = val.name;
break this.getList();
break;
default: default:
this.addOrEditTitle = '新增' this.addOrEditTitle = '新增';
this.centervisible = true this.centervisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.groupList.init() this.$refs.groupList.init();
}) });
} }
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
getGroupTeamPage(this.queryParams).then(response => { getGroupTeamPage(this.queryParams).then((response) => {
this.list = response.data.list; this.list = response.data.list;
this.total = response.data.total; this.total = response.data.total;
}); });
@ -180,46 +201,64 @@ export default {
handleClick(val) { handleClick(val) {
switch (val.type) { switch (val.type) {
case 'edit': case 'edit':
this.addOrEditTitle = '编辑' this.addOrEditTitle = '编辑';
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.groupList.init(val.data.id) this.$refs.groupList.init(val.data.id);
}) });
this.centervisible = true this.centervisible = true;
break break;
default: default:
this.handleDelete(val.data) this.handleDelete(val.data);
} }
}, },
// //
handleTableEvents(data) { handleTableEvents(params) {
updateGroupTeam({ ...data }).then((res) => { if (params.name === 'state') {
//
updateGroupTeam({ ...params.payload })
.then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess('操作成功');
this.getList();
} }
}) })
.catch((res) => {
this.getList();
});
}
}, },
handleCancel() { handleCancel() {
this.$refs.groupList.formClear() this.$refs.groupList.formClear();
this.centervisible = false this.centervisible = false;
this.addOrEditTitle = '' this.addOrEditTitle = '';
}, },
handleConfirm() { handleConfirm() {
this.$refs.groupList.submitForm() this.$refs.groupList.submitForm();
}, },
successSubmit() { successSubmit() {
this.handleCancel() this.handleCancel();
this.getList() this.getList();
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$modal.confirm('是否确认删除班组名称为"' + row.name + '"的数据项?').then(function() { this.$confirm(`是否确认删除 ${row.name} 的数据项?`, "系统提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return deleteGroupTeam(row.id); return deleteGroupTeam(row.id);
}).then(() => { })
.then(() => {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess('删除成功');
}).catch(() => {}); })
} .catch(() => {});
} },
closeDrawer() {
this.getList();
},
},
}; };
</script> </script>

View File

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