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,188 +1,182 @@
<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-col :span="12">
<el-form-item label="班次名称" prop="name"> <el-form-item label="工厂" prop="factoryId">
<el-input v-model="form.name"></el-input> <el-select
</el-form-item> v-model="form.factoryId"
</el-col> filterable
<el-col :span="12"> clearable
<el-form-item label="编码" prop="code"> style="width: 100%"
<el-input v-model="form.code" disabled></el-input> placeholder="请选择工厂">
</el-form-item> <el-option
</el-col> v-for="item in factoryArr"
</el-row> :key="item.id"
<el-row> :label="item.name"
<el-col :span="12"> :value="item.id"></el-option>
<el-form-item label="生效时间" prop="enableTime"> </el-select>
<el-date-picker </el-form-item>
v-model="form.enableTime" </el-col>
type="datetime" <el-col :span="12">
placeholder="选择日期时间" <el-form-item label="班次名称" prop="name">
label-format="yyyy-MM-dd HH:mm:ss" <el-input v-model="form.name"></el-input>
value-format="timestamp" </el-form-item>
style="width: 100%;"> </el-col>
</el-date-picker> <el-col :span="12">
</el-form-item> <el-form-item label="编码" prop="code">
</el-col> <el-input v-model="form.code" disabled></el-input>
<el-col :span="12"> </el-form-item>
<el-form-item label="失效时间" prop="disableTime"> </el-col>
<el-date-picker <el-col :span="12">
v-model="form.disableTime" <el-form-item label="备注" prop="remark">
type="datetime" <el-input v-model="form.remark"></el-input>
placeholder="选择日期时间" </el-form-item>
label-format="yyyy-MM-dd HH:mm:ss" </el-col>
value-format="timestamp" <el-col :span="12">
style="width: 100%;"> <el-form-item label="班次开始时间" prop="startTime">
</el-date-picker> <el-time-picker
</el-form-item> v-model="form.startTime"
</el-col> format="HH:mm"
</el-row> value-format="HH:mm"
<el-row> style="width: 100%"
<el-col :span="12"> @change="timeFun('start')"></el-time-picker>
<el-form-item label="班次开始时间" prop="startTime"> </el-form-item>
<el-time-picker </el-col>
v-model="form.startTime" <el-col :span="12">
format='HH:mm' <el-form-item label="班次结束时间" prop="endTime">
value-format='HH:mm' <el-time-picker
style="width: 100%;" v-model="form.endTime"
@change="timeFun('start')" format="HH:mm"
> value-format="HH:mm"
</el-time-picker> style="width: 100%"
</el-form-item> @change="timeFun('end')"></el-time-picker>
</el-col> </el-form-item>
<el-col :span="12"> </el-col>
<el-form-item label="班次结束时间" prop="endTime"> <el-col :span="12">
<el-time-picker <el-form-item label="是否跨天" prop="daySpan">
v-model="form.endTime" <el-select
format='HH:mm' v-model="form.daySpan"
value-format='HH:mm' placeholder="请选择"
style="width: 100%;" disabled
@change="timeFun('end')" style="width: 100%">
> <el-option label="否" :value="0"></el-option>
</el-time-picker> <el-option label="是" :value="1"></el-option>
</el-form-item> </el-select>
</el-col> </el-form-item>
</el-row> </el-col>
<el-row> </el-row>
<el-col :span="12"> </el-form>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否跨天" prop="daySpan">
<el-select v-model="form.daySpan" placeholder="请选择" disabled style="width: 100%;">
<el-option label="否" :value= '0' ></el-option>
<el-option label="是" :value= '1' ></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template> </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: '',
name: '', factoryId: '',
code: '', name: '',
enableTime: '', code: '',
disableTime: '', startTime: '',
startTime: '', endTime: '',
endTime: '', daySpan: '',
daySpan: '', remark: '',
remark: '' },
}, isEdit: false, //
isEdit: false, // factoryArr: [],
rules: { rules: {
name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }], factoryId: [
enableTime: [{ required: true, message: '请选择班次开始时间', trigger: 'change' }], { required: true, message: '请选择工厂', trigger: 'change' },
code: [{ required: true, message: '请输入编码', trigger: 'blur' }], ],
startTime: [{ required: true, message: '请输入生效时间', trigger: 'change' }], name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }],
endTime: [{ required: true, message: '请选择班次结束时间', trigger: 'change' }] code: [{ required: true, message: '请输入编码', trigger: 'blur' }],
} startTime: [
} { required: true, message: '请输入生效时间', trigger: 'change' },
}, ],
methods: { endTime: [
init(id) { { required: true, message: '请选择班次结束时间', trigger: 'change' },
if (id) { ],
this.isEdit = true },
this.form.id = id };
getGroupClasses(id).then((res) => { },
if (res.code === 0) { created() {
this.form = res.data const params = {
} pageSize: 100,
}) pageNo: 1,
} else { };
this.isEdit = false getFactoryPage(params).then((res) => {
this.form.id = '' this.factoryArr = res.data.list || [];
getCode().then((res) => { });
this.form.code = res.data },
}) methods: {
} init(id) {
}, if (id) {
timeFun(val) { this.isEdit = true;
if (this.form.startTime && this.form.endTime) { this.form.id = id;
if (this.form.startTime > this.form.endTime) { getGroupClasses(id).then((res) => {
this.form.daySpan = 1 if (res.code === 0) {
} else if (this.form.startTime < this.form.endTime) { this.form = res.data;
this.form.daySpan = 0 }
} else { });
if (val === 'start') { } else {
this.form.startTime = '' this.isEdit = false;
} else { this.form.id = '';
this.form.endTime = '' getCode().then((res) => {
} this.form.code = res.data;
this.$modal.msgWarning('班次开始时间和结束时间不能相同') });
} }
} },
}, timeFun(val) {
submitForm() { if (this.form.startTime && this.form.endTime) {
this.$refs['form'].validate((valid) => { if (this.form.startTime > this.form.endTime) {
if (valid) { this.form.daySpan = 1;
let obj = {} } else if (this.form.startTime < this.form.endTime) {
if (this.form.disableTime) { this.form.daySpan = 0;
obj = this.form } else {
} else { if (val === 'start') {
obj.id = this.form.id this.form.startTime = '';
obj.name = this.form.name } else {
obj.code = this.form.code this.form.endTime = '';
obj.enableTime = this.form.enableTime }
obj.startTime = this.form.startTime this.$modal.msgWarning('班次开始时间和结束时间不能相同');
obj.endTime = this.form.endTime }
obj.daySpan = this.form.daySpan }
obj.remark = this.form.remark },
} submitForm() {
if (this.isEdit) { this.$refs['form'].validate((valid) => {
// if (valid) {
updateGroupClasses({ ...obj }).then((res) => { if (this.isEdit) {
if (res.code === 0) { //
this.$modal.msgSuccess("操作成功"); updateGroupClasses({ ...this.form }).then((res) => {
this.$emit('successSubmit') if (res.code === 0) {
} this.$modal.msgSuccess('操作成功');
}) this.$emit('successSubmit');
} else { }
createGroupClasses({ ...obj }).then((res) => { });
if (res.code === 0) { } else {
this.$modal.msgSuccess("操作成功"); createGroupClasses({ ...this.form }).then((res) => {
this.$emit('successSubmit') if (res.code === 0) {
} this.$modal.msgSuccess('操作成功');
}) this.$emit('successSubmit');
} }
} else { });
return false }
} } else {
}) return false;
}, }
formClear() { });
this.$refs.form.resetFields() },
this.isEdit = false formClear() {
} this.$refs.form.resetFields();
} 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,260 +1,289 @@
<!--
* @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
<!-- 列表 --> :page="queryParams.pageNo"
<base-table :limit="queryParams.pageSize"
:page="queryParams.pageNo" :table-props="tableProps"
:limit="queryParams.pageSize" :table-data="list"
:table-props="tableProps" :max-height="tableH"
:table-data="list" @emitFun="handleTableEvents">
:max-height="tableH" <method-btn
> v-if="tableBtn.length"
<method-btn slot="handleBtn"
v-if="tableBtn.length" :width="120"
slot="handleBtn" label="操作"
:width="120" :method-list="tableBtn"
label="操作" @clickBtn="handleClick" />
:method-list="tableBtn" </base-table>
@clickBtn="handleClick" <pagination
/> :page.sync="queryParams.pageNo"
</base-table> :limit.sync="queryParams.pageSize"
<pagination :total="total"
:page.sync="queryParams.pageNo" @pagination="getList" />
:limit.sync="queryParams.pageSize" <!-- 新增 -->
:total="total" <base-dialog
@pagination="getList" :dialogTitle="addOrEditTitle"
/> :dialogVisible="centervisible"
<!-- 新增 --> @cancel="handleCancel"
<base-dialog @confirm="handleConfirm"
:dialogTitle="addOrEditTitle" :before-close="handleCancel"
:dialogVisible="centervisible" width="50%">
@cancel="handleCancel" <group-class-add ref="classList" @successSubmit="successSubmit" />
@confirm="handleConfirm" </base-dialog>
:before-close="handleCancel" </div>
width='50%'
>
<group-class-add ref="classList" @successSubmit="successSubmit" />
</base-dialog>
</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: 'enabled',
prop: 'status', label: '班次状态',
label: '班次状态' subcomponent: StatusBtn,
}, },
{ // {
prop: 'remark', // prop: 'remark',
label: '备注' // label: '',
} // },
] ];
export default { export default {
name: "GroupClass", name: 'GroupClass',
components: { GroupClassAdd }, components: { GroupClassAdd },
data() { mixins: [tableHeightMixin],
return { data() {
formConfig: [ return {
{ formConfig: [
type: 'input', {
label: '班次名称', type: 'select',
placeholder: '班次名称', label: '工厂',
param: 'name' selectOptions: [],
}, param: 'factoryId',
{ onchange: true,
type: 'button', },
btnName: '查询', {
name: 'search', type: 'input',
color: 'primary' label: '班次名称',
}, placeholder: '班次名称',
{ param: 'name',
type: 'separate' },
}, {
{ type: 'button',
type: this.$auth.hasPermi('base:group-classes:create') ? 'button' : '', btnName: '查询',
btnName: '新增', name: 'search',
name: 'add', color: 'primary',
color: 'success', },
plain: true {
} type: 'separate',
], },
tableProps, {
tableBtn: [ type: this.$auth.hasPermi('base:group-classes:create')
{ ? 'button'
type: 'cancel', : '',
btnName: '作废', btnName: '新增',
showParam: { name: 'add',
type: '&', color: 'success',
data: [ plain: true,
{ },
type: 'unequal', ],
name: 'status', tableProps,
value: '不可用' tableBtn: [
} this.$auth.hasPermi('base:group-classes:update')
] ? {
} type: 'edit',
}, btnName: '编辑',
this.$auth.hasPermi('base:group-classes:update') }
? { : undefined,
type: 'edit', this.$auth.hasPermi('base:group-classes:delete')
btnName: '编辑' ? {
} type: 'delete',
: undefined, btnName: '删除',
this.$auth.hasPermi('base:group-classes:delete') }
? { : undefined,
type: 'delete', ].filter((v) => v),
btnName: '删除' //
} total: 0,
: undefined //
].filter((v) => v), list: [],
tableH: this.tableHeight(260), //
// addOrEditTitle: '',
total: 0, //
// centervisible: false,
list: [], //
// queryParams: {
addOrEditTitle: "", pageNo: 1,
// pageSize: 20,
centervisible: false, name: null,
// },
queryParams: { };
pageNo: 1, },
pageSize: 20, created() {
name: null this.getList();
} this.getPdLineList();
}; },
}, methods: {
created() { getPdLineList() {
window.addEventListener('resize', () => { const params = {
this.tableH = this.tableHeight(260) pageSize: 100,
}) pageNo: 1,
this.getList() };
}, getFactoryPage(params).then((res) => {
methods: { this.formConfig[0].selectOptions = res.data.list || [];
buttonClick(val) { });
switch (val.btnName) { },
case 'search': buttonClick(val) {
this.queryParams.pageNo = 1; switch (val.btnName) {
this.queryParams.name = val.name case 'search':
this.getList() this.queryParams.pageNo = 1;
break this.queryParams.name = val.name;
default: this.queryParams.factoryId = val.factoryId || undefined;
this.addOrEditTitle = '新增' this.getList();
this.centervisible = true break;
this.$nextTick(() => { default:
this.$refs.classList.init() this.addOrEditTitle = '新增';
}) this.centervisible = true;
} this.$nextTick(() => {
}, this.$refs.classList.init();
/** 查询列表 */ });
getList() { }
getGroupClassesPage(this.queryParams).then(res => { },
if (res.code === 0 && res.data.list.length > 0) { //
res.data.list.map(item => { handleTableEvents(params) {
item.enableTimeStr = formatDate(item.enableTime) + '至' + (item.disableTime ? formatDate(item.disableTime) : '永久') if (params.name === 'state') {
item.timeStr = item.startTime.slice(0, 5) + '-' + item.endTime.slice(0, 5) //
item.status = item.status === true ? '可用' : '不可用' updateGroupClasses({ ...params.payload })
}) .then((res) => {
this.list = res.data.list; if (res.code === 0) {
this.total = res.data.total; this.$modal.msgSuccess('操作成功');
} else { this.getList();
this.list = [] }
this.total = 0 })
} .catch((res) => {
}); this.getList();
}, });
handleClick(val) { }
switch (val.type) { },
case 'edit': /** 查询列表 */
this.addOrEditTitle = '编辑' getList() {
this.$nextTick(() => { getGroupClassesPage(this.queryParams).then((res) => {
this.$refs.classList.init(val.data.id) if (res.code === 0 && res.data.list && res.data.list.length > 0) {
}) res.data.list.map((item) => {
this.centervisible = true item.timeStr =
break item.startTime.slice(0, 5) + '-' + item.endTime.slice(0, 5);
case 'cancel': });
this.discard(val.data) this.list = res.data.list;
break this.total = res.data.total;
default: } else {
this.handleDelete(val.data) this.list = [];
} this.total = 0;
}, }
handleCancel() { });
this.$refs.classList.formClear() },
this.centervisible = false handleClick(val) {
this.addOrEditTitle = '' switch (val.type) {
}, case 'edit':
handleConfirm() { this.addOrEditTitle = '编辑';
this.$refs.classList.submitForm() this.$nextTick(() => {
}, this.$refs.classList.init(val.data.id);
successSubmit() { });
this.handleCancel() this.centervisible = true;
this.getList() break;
}, default:
discard(row) { this.handleDelete(val.data);
let obj = {} }
obj.id = row.id },
obj.startTime = row.startTime handleCancel() {
obj.endTime = row.endTime this.$refs.classList.formClear();
obj.enableTime = row.enableTime this.centervisible = false;
obj.disableTime = Date.parse(new Date()) this.addOrEditTitle = '';
this.$modal.confirm('是否确认作废班次名称为"' + row.name + '"的数据项?').then(function() { },
return updateGroupClasses({ ...obj }) handleConfirm() {
}).then(() => { this.$refs.classList.submitForm();
this.getList(); },
this.$modal.msgSuccess("操作成功"); successSubmit() {
}).catch(() => {}); this.handleCancel();
}, this.getList();
/** 删除按钮操作 */ },
handleDelete(row) { /** 删除按钮操作 */
console.log(row) handleDelete(row) {
let _this = this let _this = this;
if (row.status === '可用') {// if (row.enabled) {
_this.$modal.confirm('删除的班次"' + row.name + '"可能会影响交接班计划,请点取消再次确认!').then(function() { //
return _this.$modal.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?').then(function() { this.$confirm(
return deleteGroupClasses(row.id); `是否确认删除 ${row.name} 的数据项?`,
}).then(() => { '可能会影响交接班计划!',
_this.getList(); {
_this.$modal.msgSuccess("删除成功"); confirmButtonText: '确定',
}).catch(() => {}); cancelButtonText: '取消',
}) type: 'warning',
} else { }
_this.$modal.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?').then(function() { ).then(function () {
return deleteGroupClasses(row.id); return _this.$modal
}).then(() => { .delConfirm(row.name)
_this.getList(); .then(function () {
_this.$modal.msgSuccess("删除成功"); return deleteGroupClasses(row.id);
}).catch(() => {}); })
} .then(() => {
} _this.getList();
} _this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
});
} else {
this.$confirm(`是否确认删除 ${row.name} 的数据项?`, '系统提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(function () {
return deleteGroupClasses(row.id);
})
.then(() => {
_this.getList();
_this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
}
},
},
}; };
</script> </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,96 +1,144 @@
<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-col :span="12">
<el-form-item label="班组名称" prop="name"> <el-form-item label="工厂" prop="factoryId">
<el-input v-model="form.name"></el-input> <el-select
</el-form-item> v-model="form.factoryId"
</el-col> filterable
<el-col :span="12"> clearable
<el-form-item label="班组编码" prop="code"> style="width: 100%"
<el-input v-model="form.code" disabled></el-input> placeholder="请选择工厂">
</el-form-item> <el-option
</el-col> v-for="item in factoryArr"
</el-row> :key="item.id"
<el-row> :label="item.name"
<el-col :span="12"> :value="item.id"></el-option>
<el-form-item label="班组人数" prop="num"> </el-select>
<el-input-number v-model="form.num" :min="1" :max="99999999" style="width: 100%;"></el-input-number> </el-form-item>
</el-form-item> </el-col>
</el-col> <el-col :span="12">
<el-col :span="12"> <el-form-item label="班组名称" prop="name">
<el-form-item label="班组组长" prop="leaderName"> <el-input v-model="form.name"></el-input>
<el-input v-model="form.leaderName"></el-input> </el-form-item>
</el-form-item> </el-col>
</el-col> <el-col :span="12">
</el-row> <el-form-item label="班组编码" prop="code">
</el-form> <el-input v-model="form.code" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="班组组长" prop="leaderName">
<el-input v-model="form.leaderName" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="手机号" prop="leaderPhone">
<el-input v-model="form.leaderPhone" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="班组人数" prop="num">
<el-input-number
style="width: 100%"
v-model="form.num"
:step="1"
step-strictly></el-input-number>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template> </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: '',
name: '', factoryId: '',
code: '', name: '',
num: null, code: '',
leaderName: '' leaderName: '',
}, leaderPhone: '',
isEdit: false, // num: '',
rules: { },
name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }] factoryArr: [], //
} isEdit: false, //
} rules: {
}, factoryId: [
methods: { { required: true, message: '请选择工厂', trigger: 'change' },
init(id) { ],
if (id) { name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }],
this.isEdit = true code: [{ required: true, message: '请输入班组编码', trigger: 'blur' }],
this.form.id = id leaderName: [
getGroupTeam( id ).then((res) => { { required: true, message: '请输入组长', trigger: 'blur' },
if (res.code === 0) { ],
this.form = res.data },
} };
}) },
} else { created() {
this.isEdit = false const params = {
this.form.id = '' pageSize: 100,
getCode().then((res) => { pageNo: 1,
this.form.code = res.data };
}) getFactoryPage(params).then((res) => {
} this.factoryArr = res.data.list || [];
}, });
submitForm() { },
this.$refs['form'].validate((valid) => { methods: {
if (valid) { init(id) {
if (this.isEdit) { if (id) {
// this.isEdit = true;
updateGroupTeam({ ...this.form }).then((res) => { this.form.id = id;
if (res.code === 0) { getGroupTeam(id).then((res) => {
this.$modal.msgSuccess("操作成功"); if (res.code === 0) {
this.$emit('successSubmit') this.form = res.data;
} }
}) });
} else { } else {
createGroupTeam({ ...this.form }).then((res) => { this.isEdit = false;
if (res.code === 0) { this.form.id = '';
this.$modal.msgSuccess("操作成功"); getCode().then((res) => {
this.$emit('successSubmit') this.form.code = res.data;
} });
}) }
} },
} else { submitForm() {
return false this.$refs['form'].validate((valid) => {
} if (valid) {
}) if (this.isEdit) {
}, //
formClear() { updateGroupTeam({ ...this.form }).then((res) => {
this.$refs.form.resetFields() if (res.code === 0) {
this.isEdit = false this.$modal.msgSuccess('操作成功');
} this.$emit('successSubmit');
} }
} });
} else {
createGroupTeam({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
}
});
}
} else {
return false;
}
});
},
formClear() {
this.$refs.form.resetFields();
this.isEdit = false;
},
},
};
</script> </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,225 +1,264 @@
<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
<!-- 列表 --> :page="queryParams.pageNo"
<base-table :limit="queryParams.pageSize"
:page="queryParams.pageNo" :table-props="tableProps"
:limit="queryParams.pageSize" :table-data="list"
:table-props="tableProps" :max-height="tableH"
:table-data="list" @emitFun="handleTableEvents">
:max-height="tableH" <method-btn
@emitFun="handleTableEvents" v-if="tableBtn.length"
> slot="handleBtn"
<method-btn :width="80"
v-if="tableBtn.length" label="操作"
slot="handleBtn" :method-list="tableBtn"
:width="80" @clickBtn="handleClick" />
label="操作" </base-table>
:method-list="tableBtn" <pagination
@clickBtn="handleClick" :page.sync="queryParams.pageNo"
/> :limit.sync="queryParams.pageSize"
</base-table> :total="total"
<pagination @pagination="getList" />
:page.sync="queryParams.pageNo" <!-- 新增 -->
:limit.sync="queryParams.pageSize" <base-dialog
:total="total" :dialogTitle="addOrEditTitle"
@pagination="getList" :dialogVisible="centervisible"
/> @cancel="handleCancel"
<!-- 新增 --> @confirm="handleConfirm"
<base-dialog :before-close="handleCancel"
:dialogTitle="addOrEditTitle" width="40%">
:dialogVisible="centervisible" <group-team-add ref="groupList" @successSubmit="successSubmit" />
@cancel="handleCancel" </base-dialog>
@confirm="handleConfirm" </div>
:before-close="handleCancel"
>
<group-team-add ref="groupList" @successSubmit="successSubmit" />
</base-dialog>
</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: 'name', prop: 'factoryName',
label: '班组名称' label: '工厂',
}, },
{ {
prop: 'code', prop: 'name',
label: '班组编码', label: '班组名称',
minWidth: 220 },
}, {
{ prop: 'code',
prop: 'num', label: '编码',
label: '班组人数' minWidth: 220,
}, },
{ {
prop: 'leaderName', prop: 'num',
label: '班组组长' label: '班组人数',
}, },
{ {
prop: 'enabled', prop: 'leaderName',
label: '班组状态', label: '组长',
subcomponent: StatusBtn },
} {
] prop: 'enabled',
label: '班组状态',
subcomponent: StatusBtn,
},
];
export default { export default {
name: "GroupTeam", name: 'GroupTeam',
components: { GroupTeamAdd }, components: { GroupTeamAdd },
data() { mixins: [tableHeightMixin],
return { data() {
formConfig: [ return {
{ formConfig: [
type: 'input', {
label: '班组名称', type: 'select',
placeholder: '班组名称', label: '工厂',
param: 'name' selectOptions: [],
}, param: 'factoryId',
{ onchange: true,
type: 'input', },
label: '班组编码', {
placeholder: '班组编码', type: 'input',
param: 'code' label: '班组名称',
}, placeholder: '班组名称',
{ param: 'name',
type: 'button', },
btnName: '查询', {
name: 'search', type: 'input',
color: 'primary' label: '组长',
}, placeholder: '组长',
{ param: 'leaderName',
type: 'separate' },
}, {
{ type: 'button',
type: this.$auth.hasPermi('base:group-team:create') ? 'button' : '', btnName: '查询',
btnName: '新增', name: 'search',
name: 'add', color: 'primary',
color: 'success', },
plain: true {
} type: 'separate',
], },
tableProps, {
tableBtn: [ type: this.$auth.hasPermi('base:group-team:create') ? 'button' : '',
this.$auth.hasPermi('base:group-team:update') btnName: '新增',
? { name: 'add',
type: 'edit', color: 'success',
btnName: '编辑' plain: true,
} },
: undefined, ],
this.$auth.hasPermi('base:group-team:delete') tableProps,
? { tableBtn: [
type: 'delete', this.$auth.hasPermi('base:group-team:update')
btnName: '删除' ? {
} type: 'edit',
: undefined btnName: '编辑',
].filter((v) => v), }
tableH: this.tableHeight(260), : undefined,
// this.$auth.hasPermi('base:group-team:delete')
total: 0, ? {
// type: 'delete',
list: [], btnName: '删除',
// }
addOrEditTitle: "", : undefined,
// ].filter((v) => v),
centervisible: false, //
// total: 0,
queryParams: { //
pageNo: 1, list: [],
pageSize: 20, //
name: null, addOrEditTitle: '',
code: null //
} centervisible: false,
}; //
}, queryParams: {
created() { pageNo: 1,
window.addEventListener('resize', () => { pageSize: 20,
this.tableH = this.tableHeight(260) name: null,
}) code: null,
this.getList(); },
}, };
methods: { },
buttonClick(val) { created() {
switch (val.btnName) { this.getList();
case 'search': this.getPdLineList();
this.queryParams.pageNo = 1; },
this.queryParams.name = val.name methods: {
this.queryParams.code = val.code getPdLineList() {
this.getList() const params = {
break pageSize: 100,
default: pageNo: 1,
this.addOrEditTitle = '新增' };
this.centervisible = true getFactoryPage(params).then((res) => {
this.$nextTick(() => { this.formConfig[0].selectOptions = res.data.list || [];
this.$refs.groupList.init() });
}) },
} buttonClick(val) {
}, switch (val.btnName) {
/** 查询列表 */ case 'search':
getList() { this.queryParams.pageNo = 1;
getGroupTeamPage(this.queryParams).then(response => { this.queryParams.leaderName = val.leaderName;
this.list = response.data.list; this.queryParams.factoryId = val.factoryId || undefined;
this.total = response.data.total; this.queryParams.name = val.name;
}); this.getList();
}, break;
handleClick(val) { default:
switch (val.type) { this.addOrEditTitle = '新增';
case 'edit': this.centervisible = true;
this.addOrEditTitle = '编辑' this.$nextTick(() => {
this.$nextTick(() => { this.$refs.groupList.init();
this.$refs.groupList.init(val.data.id) });
}) }
this.centervisible = true },
break /** 查询列表 */
default: getList() {
this.handleDelete(val.data) getGroupTeamPage(this.queryParams).then((response) => {
} this.list = response.data.list;
}, this.total = response.data.total;
// });
handleTableEvents(data) { },
updateGroupTeam({ ...data }).then((res) => { handleClick(val) {
if (res.code === 0) { switch (val.type) {
this.$modal.msgSuccess("操作成功"); case 'edit':
} this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.groupList.init(val.data.id);
});
this.centervisible = true;
break;
default:
this.handleDelete(val.data);
}
},
//
handleTableEvents(params) {
if (params.name === 'state') {
//
updateGroupTeam({ ...params.payload })
.then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
this.getList();
}
})
.catch((res) => {
this.getList();
});
}
},
handleCancel() {
this.$refs.groupList.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.groupList.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
/** 删除按钮操作 */
handleDelete(row) {
this.$confirm(`是否确认删除 ${row.name} 的数据项?`, "系统提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}) })
}, .then(function () {
handleCancel() { return deleteGroupTeam(row.id);
this.$refs.groupList.formClear() })
this.centervisible = false .then(() => {
this.addOrEditTitle = '' this.queryParams.pageNo = 1;
}, this.getList();
handleConfirm() { this.$modal.msgSuccess('删除成功');
this.$refs.groupList.submitForm() })
}, .catch(() => {});
successSubmit() { },
this.handleCancel() closeDrawer() {
this.getList() this.getList();
}, },
/** 删除按钮操作 */ },
handleDelete(row) {
this.$modal.confirm('是否确认删除班组名称为"' + row.name + '"的数据项?').then(function() {
return deleteGroupTeam(row.id);
}).then(() => {
this.queryParams.pageNo = 1;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
}; };
</script> </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,

File diff suppressed because it is too large Load Diff

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>