yudao-dev/src/views/group/monitoring/teamProduction/index.vue
2023-11-22 16:58:32 +08:00

172 lines
4.0 KiB
Vue

<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="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
<!-- 查看生产情况 -->
<team-production-detail v-if='paramVisible' ref='schedulingMonitoringDetail'/>
</div>
</template>
<script>
import { groupTeamSchedulingPage, groupClassesListAll } from '@/api/monitoring/teamProduction'
import { parseTime } from '@/utils/ruoyi'
import TeamProductionDetail from './components/teamProductionDetail'
const tableProps = [
{
prop: 'createTime',
label: '排班创建时间',
filter: parseTime,
minWidth: 160
},
{
prop: 'startDay',
label: '上班日期',
minWidth: 100
},
{
prop: 'startTime',
label: '上班时间',
filter: parseTime,
minWidth: 160
},
{
prop: 'endTime',
label: '下班时间',
filter: parseTime,
minWidth: 160
},
{
prop: 'classesName',
label: '班次名称',
showOverflowtooltip: true
},
{
prop: 'teamName',
label: '班组名称',
showOverflowtooltip: true
}
]
export default {
name: 'GroupTeamScheduling',
data() {
return {
formConfig: [
{
type: 'select',
label: '班次信息',
selectOptions: [],
param: 'classesId'
},
{
type: 'input',
label: '班组信息',
placeholder: '班组信息',
param: 'teamName'
},
{
type: 'datePicker',
label: '上班日期',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
rangeSeparator: '-',
// valueFormat: "timestamp",
param: 'tiemStr',
defaultSelect: '',
width: 250
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
}
],
// 查询参数
queryParams: {
pageNo: 1,
pageSize: 20,
classesId: '',
teamName: '',
startDay: []
},
tableProps,
tableBtn: [
this.$auth.hasPermi('base:team-production:detail')
? {
type: 'detail',
btnName: '详情'
}
: undefined
].filter((v) => v),
list: [],
tableH: this.tableHeight(260),
total: 0,
paramVisible: false
}
},
components: { TeamProductionDetail },
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.getGroupClass()
this.getList()
},
methods: {
buttonClick(val) {
this.queryParams.pageNo = 1;
this.queryParams.classesId = val.classesId
this.queryParams.teamName = val.teamName
this.queryParams.startDay[0] = val.tiemStr ? val.tiemStr[0] + ' 00:00:00' : ''
this.queryParams.startDay[1] = val.tiemStr ? val.tiemStr[1] + ' 23:59:59' : ''
this.getList()
},
getList() {
groupTeamSchedulingPage({...this.queryParams}).then(res => {
console.log(res)
this.list = res.data.list || []
this.total = res.data.total || 0
})
},
getGroupClass() {
groupClassesListAll().then(res => {
this.formConfig[0].selectOptions = res.data || []
})
},
handleClick(val) {
console.log(val)
this.paramVisible = true
this.$nextTick(() => {
this.$refs.schedulingMonitoringDetail.init(val.data)
})
}
}
}
</script>