Files
yudao-dev/src/views/group/Schedule/detail.vue
2025-10-24 11:42:24 +08:00

188 lines
3.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--
* @Author: zwq
* @Date: 2025-10-21 14:27:23
* @LastEditors: zwq
* @LastEditTime: 2025-10-21 15:02:27
* @Description:
-->
<template>
<div>
<div class="info-div">
<div>
<span class="title">计划编号:</span>
{{ infoData.code }}
</div>
<div>
<span class="title">计划状态:</span>
{{ ['', '草稿', '已确认', '已作废'][infoData.status] }}
</div>
<div>
<span class="title">计划名称:</span>
{{ infoData.name }}
</div>
<div>
<span class="title">部门:</span>
{{ infoData.deptName }}
</div>
<div>
<span class="title">开始时间:</span>
{{ parseTime(infoData.startDay) }}
</div>
<div>
<span class="title">结束时间:</span>
{{ parseTime(infoData.endDay) }}
</div>
<div>
<span class="title">周末休假方式:</span>
{{ ['', '双休', '周六休', '周日休', '不休'][infoData.weekType] }}
</div>
<div>
<span class="title">倒班方式:</span>
{{ ['', '长白班', '两班倒', '三班倒'][infoData.shiftType] }}
</div>
<div>
<span class="title">同班次连排:</span>
{{ infoData.shiftSustainedNum }}
</div>
<div>
<span class="title">创建人:</span>
{{ infoData.creator }}
</div>
<div>
<span class="title">创建时间:</span>
{{ parseTime(infoData.createTime) }}
</div>
<div v-if="infoData.status == 3">
<span class="title">作废时间:</span>
{{ parseTime(infoData.disableTime) }}
</div>
<div>
<span class="title">备注:</span>
{{ infoData.remark }}
</div>
</div>
<div>
<el-tabs v-model="activeName" stretch>
<el-tab-pane label="班次" name="first"></el-tab-pane>
<el-tab-pane label="班组" name="second"></el-tab-pane>
</el-tabs>
<base-table
v-if="activeName == 'first'"
:table-props="tableProps1"
:page="1"
:limit="10"
:table-data="tableData1"></base-table>
<base-table
v-else
:table-props="tableProps2"
:page="1"
:limit="10"
:table-data="tableData2"></base-table>
</div>
</div>
</template>
<script>
import { parseTime } from '@/filter/code-filter';
import { getPlan } from '@/api/group/Schedule';
const tableProps1 = [
{
prop: 'name',
label: '班次名称',
},
{
prop: 'startTime',
label: '开始时间',
filter: (val) => {
return val ? val.slice(0, -3) : '-';
},
},
{
prop: 'endTime',
label: '结束时间',
filter: (val) => {
return val ? val.slice(0, -3) : '-';
},
},
{
prop: 'remark',
label: '备注',
},
];
const tableProps2 = [
{
prop: 'code',
label: '班组编号',
width: 140,
},
{
prop: 'name',
label: '班组名称',
},
{
prop: 'isProduction',
label: '是否生产班组',
filter: (val) => {
return val ? '是' : '否';
},
width: 110,
},
{
prop: 'lineName',
label: '产线及工段',
},
];
export default {
data() {
return {
infoData: {},
activeName: 'first',
tableProps1,
tableData1: [],
tableProps2,
tableData2: [],
};
},
methods: {
init(id) {
this.infoData = {};
getPlan(id).then((res) => {
this.infoData = res.data || {};
console.log(res);
this.tableData1 = res.data?.groupPlanClassesBaseVOList;
this.tableData2 = res.data?.groupPlanTeamBaseVOList;
this.tableData2.forEach((item, index) => {
let lineName = '';
lineName = this.setLineName(item.bindLineTree, lineName);
this.$set(this.tableData2[index], 'lineName', lineName.slice(0, -1));
});
});
},
//提取绑定的产线工段名展示出来
setLineName(val, lineName) {
val.forEach((item) => {
lineName += item.name + '';
if (item.children && item.children.length > 0) {
const childName = this.setLineName(item.children, lineName);
lineName = childName;
}
});
return lineName;
},
},
};
</script>
<style scoped>
.info-div {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 10px;
}
.title {
font-weight: bold;
}
</style>