zjl #16

Manually merged
juzi merged 2 commits from zjl into test 2023-09-08 16:02:54 +08:00
10 changed files with 317 additions and 471 deletions
Showing only changes of commit df0dc6bfa0 - Show all commits

View File

@ -0,0 +1,8 @@
import request from '@/utils/request'
// 获得所有设备列表
export function getEquipmentAll() {
return request({
url: '/base/equipment/listAll',
method: 'get'
})
}

View File

@ -0,0 +1,8 @@
import request from '@/utils/request'
// 获得所有工厂产线列表
export function getLineAll() {
return request({
url: '/base/production-line/listAll',
method: 'get'
})
}

View File

@ -0,0 +1,8 @@
import request from '@/utils/request'
// 获得所有产线工段列表
export function getWorkShopAll() {
return request({
url: '/base/workshop-section/listAll',
method: 'get'
})
}

View File

@ -48,13 +48,39 @@ export default {
} }
this.chartDom = document.getElementById('analysischartBar') this.chartDom = document.getElementById('analysischartBar')
this.chart = echarts.init(this.chartDom) this.chart = echarts.init(this.chartDom)
let tempArr = []
let xData = [] let xData = []
let yData = [] let yData = []
let legendData = []
if (this.chartData.length === 0) {
return false
} else {
tempArr = this.chartData[0].trendRespVOList
}
for (let k = 0; k < tempArr.length; k++) {
xData.push(tempArr[k].time)
}
for (let i = 0; i < this.chartData.length; i++) { for (let i = 0; i < this.chartData.length; i++) {
xData.push(this.chartData[i].time) let obj = {
yData.push(this.chartData[i].useNum) name: this.chartData[i].objName + this.chartData[i].objCode,
type: 'bar',
data: []
}
legendData.push(this.chartData[i].objName + this.chartData[i].objCode)
let temp = this.chartData[i].trendRespVOList
for (let j = 0; j < temp.length; j++) {
let num = temp[j].useNum ? temp[j].useNum : 0
obj.data.push(num)
}
yData.push(obj)
} }
var option = { var option = {
tooltip: {
trigger: 'axis'
},
legend: {
data: legendData
},
xAxis: { xAxis: {
type: 'category', type: 'category',
data: xData data: xData
@ -62,12 +88,7 @@ export default {
yAxis: { yAxis: {
type: 'value' type: 'value'
}, },
series: [ series: yData
{
data: yData,
type: 'bar'
}
]
}; };
option && this.chart.setOption(option); option && this.chart.setOption(option);

View File

@ -48,14 +48,41 @@ export default {
} }
this.chartDom = document.getElementById('analysischartLine') this.chartDom = document.getElementById('analysischartLine')
this.chart = echarts.init(this.chartDom) this.chart = echarts.init(this.chartDom)
let tempArr = []
let xData = [] let xData = []
let yData = [] let yData = []
let legendData = []
if (this.chartData.length === 0) {
return false
} else {
tempArr = this.chartData[0].trendRespVOList
}
for (let k = 0; k < tempArr.length; k++) {
xData.push(tempArr[k].time)
}
for (let i = 0; i < this.chartData.length; i++) { for (let i = 0; i < this.chartData.length; i++) {
xData.push(this.chartData[i].time) let obj = {
yData.push(this.chartData[i].useNum) name: this.chartData[i].objName + this.chartData[i].objCode,
type: 'line',
stack: 'Total',
data: []
}
legendData.push(this.chartData[i].objName + this.chartData[i].objCode)
let temp = this.chartData[i].trendRespVOList
for (let j = 0; j < temp.length; j++) {
let num = temp[j].useNum ? temp[j].useNum : 0
obj.data.push(num)
}
yData.push(obj)
} }
var option = { var option = {
tooltip: {
trigger: 'axis'
},
legend: {
data: legendData
},
xAxis: { xAxis: {
type: 'category', type: 'category',
data: xData data: xData
@ -63,12 +90,7 @@ export default {
yAxis: { yAxis: {
type: 'value' type: 'value'
}, },
series: [ series: yData
{
data: yData,
type: 'line'
}
]
}; };
option && this.chart.setOption(option); option && this.chart.setOption(option);

View File

@ -33,6 +33,7 @@
:picker-options="pickerOptions" :picker-options="pickerOptions"
popper-class="noneMinute" popper-class="noneMinute"
@change="timeSelect" @change="timeSelect"
:clearable="false"
> >
</el-date-picker> </el-date-picker>
</div> </div>
@ -45,6 +46,7 @@
end-placeholder="结束日期" end-placeholder="结束日期"
value-format="timestamp" value-format="timestamp"
:picker-options="pickerOptions" :picker-options="pickerOptions"
:clearable="false"
@change="timeSelect" @change="timeSelect"
> >
</el-date-picker> </el-date-picker>
@ -57,6 +59,7 @@
style='width:150px;' style='width:150px;'
:picker-options="pickerOptionsWeek" :picker-options="pickerOptionsWeek"
@change="startWeek" @change="startWeek"
:clearable="false"
placeholder="选择周"> placeholder="选择周">
</el-date-picker>- </el-date-picker>-
<el-date-picker <el-date-picker
@ -66,6 +69,7 @@
:picker-options="pickerOptionsWeek" :picker-options="pickerOptionsWeek"
style='width:150px;' style='width:150px;'
@change="endWeek" @change="endWeek"
:clearable="false"
placeholder="选择周"> placeholder="选择周">
</el-date-picker> </el-date-picker>
</div> </div>
@ -77,6 +81,7 @@
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
value-format="timestamp" value-format="timestamp"
:clearable="false"
:picker-options="pickerOptions" :picker-options="pickerOptions"
@change="timeSelect" @change="timeSelect"
> >
@ -91,6 +96,7 @@
value-format="timestamp" value-format="timestamp"
placeholder="选择年" placeholder="选择年"
@change="startYear" @change="startYear"
:clearable="false"
> >
</el-date-picker>- </el-date-picker>-
<el-date-picker <el-date-picker
@ -101,6 +107,7 @@
value-format="timestamp" value-format="timestamp"
placeholder="选择年" placeholder="选择年"
@change="endYear" @change="endYear"
:clearable="false"
> >
</el-date-picker> </el-date-picker>
</div> </div>
@ -116,12 +123,14 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="对象选择"> <el-form-item label="对象选择">
<el-select v-model="queryParams.objIds" placeholder="请选择" multiple style="width: 80px;"> <el-select v-model="queryParams.objIds" placeholder="请选择" multiple collapse-tags style="width: 200px;">
<el-option <el-option
v-for="item in objectList" v-for="item in objectList"
:key="item.value" :key="item.id"
:label="item.label" :label="item.name"
:value="item.value"> :value="item.id">
<span style="float: left">{{ item.name }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.code }}</span>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -132,6 +141,9 @@
</template> </template>
<script> <script>
import { getEnergyTypeListAll } from "@/api/base/energyType" import { getEnergyTypeListAll } from "@/api/base/energyType"
import { getLineAll } from "@/api/base/productionLine"
import { getWorkShopAll } from "@/api/base/workshopSection"
import { getEquipmentAll } from "@/api/base/equipment"
import moment from 'moment' import moment from 'moment'
export default { export default {
name: 'searchArea', name: 'searchArea',
@ -268,6 +280,25 @@ export default {
// //
selectObjs(val) { selectObjs(val) {
console.log(val) console.log(val)
switch (val) {
case '1':
getLineAll().then(res => {
this.objectList = res.data || []
this.queryParams.objIds = []
})
break;
case '2':
getWorkShopAll().then(res => {
this.objectList = res.data || []
this.queryParams.objIds = []
})
break;
default:
getEquipmentAll().then(res => {
this.objectList = res.data || []
this.queryParams.objIds = []
})
}
}, },
// //
search() { search() {
@ -332,8 +363,17 @@ export default {
return false return false
} }
} }
if (!this.queryParams.objType) {
this.$modal.msgError('请选择对象维度')
return false
}
if (this.queryParams.objIds.length === 0) {
this.$modal.msgError('请选择对象')
return false
}
this.queryParams.startTime = this.queryParams.startTime + '' this.queryParams.startTime = this.queryParams.startTime + ''
this.queryParams.endTime = this.queryParams.endTime + '' this.queryParams.endTime = this.queryParams.endTime + ''
console.log(this.queryParams)
this.$emit('submit', this.queryParams) this.$emit('submit', this.queryParams)
}, },
transformTime(timeStamp) {// transformTime(timeStamp) {//

View File

@ -4,16 +4,16 @@
<search-area @submit="getList"/> <search-area @submit="getList"/>
<el-tabs v-model="activeName" @tab-click="switchChart"> <el-tabs v-model="activeName" @tab-click="switchChart">
<el-tab-pane label="柱状图" name="bar"> <el-tab-pane label="柱状图" name="bar">
<bar-chart ref="contrastBarChart" :chartData="chartData" /> <bar-chart ref="analysisBarChart" :chartData="chartData" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="折线图" name="line"> <el-tab-pane label="折线图" name="line">
<line-chart ref="contrastLineChart" :chartData="chartData"/> <line-chart ref="analysisLineChart" :chartData="chartData"/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
</template> </template>
<script> <script>
import { getEnergyTrend } from "@/api/analysis/energyAnalysis" import { getCompare } from "@/api/analysis/energyAnalysis"
import SearchArea from "./components/searchArea" import SearchArea from "./components/searchArea"
import BarChart from "./components/barChart" import BarChart from "./components/barChart"
import LineChart from "./components/lineChart" import LineChart from "./components/lineChart"
@ -30,23 +30,14 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
getList(params) { getList(params) {
getEnergyTrend({ ...params }).then((res) => { getCompare({ ...params }).then((res) => {
console.log(res)
if (res.code === 0) { if (res.code === 0) {
this.chartData = res.data this.chartData = res.data || []
} else { } else {
this.chartData = [] this.chartData = []
} }
}) })
// getEnergyTrend({
// energyTypeId: "1681183397517406210",
// objId: "1679031282510532610",
// timeDim: "2",
// startTime: "1690732800000",
// endTime: "1690992000000"
// }).then((res) => {
// console.log(res)
// this.chartData = res.data
// })
}, },
switchChart() { switchChart() {
if (this.activeName === 'bar') { if (this.activeName === 'bar') {

View File

@ -0,0 +1,147 @@
<template>
<div>
<el-drawer title="班组上下片" :visible.sync="visible" size="80%" @close='closeD'>
<div class="box">
<!-- 搜索工作栏 -->
<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"
/>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
</div>
</el-drawer>
</div>
</template>
<script>
const tableProps = [
{
prop: 'name',
label: '产线名称'
},
{
prop: 'code',
label: '投入数量/片'
},
{
prop: 'code1',
label: '产出数量/片'
},
{
prop: 'num2',
label: '产出面积/㎡'
},
{
prop: 'num3',
label: '损耗数量/片'
},
{
prop: 'num4',
label: '损耗面积/㎡'
},
{
prop: 'num5',
label: '损耗比例/%'
}
]
export default {
name: 'GroupUpperLower',
data() {
return {
visible: false,
formConfig: [
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'xb2',
width: 120,
defaultSelect: 2 //
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime2'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('base:group-team:create') ? 'button' : '',
btnName: '导出',
name: 'export',
color: 'success',
plain: true
}
],
tableProps,
list: [],
tableH: this.tableHeight(260),
//
queryParams: {
pageNo: 1,
pageSize: 20
},
total: 0
}
},
methods: {
init() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
this.visible = true
},
getList() {},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1
this.queryParams.name = val.name
this.queryParams.code = val.code
this.getList()
break
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.groupList.init()
})
}
},
closeD() {
// this.$emit('closeDrawer')
}
}
}
</script>
<style lang="scss" scoped>
.box {
padding: 0 32px;
}
</style>

View File

@ -1,233 +0,0 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="上班日期" prop="startDay">
<el-input v-model="queryParams.startDay" placeholder="请输入上班日期" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['base:group-team-scheduling:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['base:group-team-scheduling:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="班组ID" align="center" prop="teamId" />
<el-table-column label="班次id" align="center" prop="classesId" />
<el-table-column label="上班日期" align="center" prop="startDay" />
<el-table-column label="上班时间" align="center" prop="startTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.startTime) }}</span>
</template>
</el-table-column>
<el-table-column label="下班时间" align="center" prop="endTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.endTime) }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['base:group-team-scheduling:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['base:group-team-scheduling:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="班组ID" prop="teamId">
<el-input v-model="form.teamId" placeholder="请输入班组ID" />
</el-form-item>
<el-form-item label="班次id" prop="classesId">
<el-input v-model="form.classesId" placeholder="请输入班次id" />
</el-form-item>
<el-form-item label="上班日期" prop="startDay">
<el-input v-model="form.startDay" placeholder="请输入上班日期" />
</el-form-item>
<el-form-item label="上班时间" prop="startTime">
<el-date-picker clearable v-model="form.startTime" type="date" value-format="timestamp" placeholder="选择上班时间" />
</el-form-item>
<el-form-item label="下班时间" prop="endTime">
<el-date-picker clearable v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择下班时间" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { createGroupTeamScheduling, updateGroupTeamScheduling, deleteGroupTeamScheduling, getGroupTeamScheduling, getGroupTeamSchedulingPage, exportGroupTeamSchedulingExcel } from "@/api/base/groupTeamScheduling";
export default {
name: "GroupTeamScheduling",
components: {
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
startDay: [],
},
//
form: {},
//
rules: {
teamId: [{ required: true, message: "班组ID不能为空", trigger: "blur" }],
classesId: [{ required: true, message: "班次id不能为空", trigger: "blur" }],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
getGroupTeamSchedulingPage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
teamId: undefined,
classesId: undefined,
startDay: undefined,
startTime: undefined,
endTime: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加排班信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getGroupTeamScheduling(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改排班信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateGroupTeamScheduling(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createGroupTeamScheduling(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除排班信息编号为"' + id + '"的数据项?').then(function() {
return deleteGroupTeamScheduling(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有排班信息数据项?').then(() => {
this.exportLoading = true;
return exportGroupTeamSchedulingExcel(params);
}).then(response => {
this.$download.excel(response, '排班信息.xls');
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>

View File

@ -1,232 +1,66 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div>
<!-- 搜索工作栏 --> <el-form :inline="true" class="demo-form-inline">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="月份选择">
<el-form-item label="上班日期" prop="startDay"> <el-date-picker
<el-input v-model="queryParams.startDay" placeholder="请输入上班日期" clearable @keyup.enter.native="handleQuery"/> v-model="queryParams.startDay"
type="month"
placeholder="选择月">
</el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> <el-button type="primary">自动排班</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> </el-form-item>
<el-form-item>
<el-button type="primary">编辑</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" plain @click="toUpperLower">班组上下片查询</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" plain>班组能源查询</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" plain>班组检测查询</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['base:group-team-scheduling:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['base:group-team-scheduling:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="班组ID" align="center" prop="teamId" />
<el-table-column label="班次id" align="center" prop="classesId" />
<el-table-column label="上班日期" align="center" prop="startDay" />
<el-table-column label="上班时间" align="center" prop="startTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.startTime) }}</span>
</template>
</el-table-column>
<el-table-column label="下班时间" align="center" prop="endTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.endTime) }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['base:group-team-scheduling:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['base:group-team-scheduling:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="班组ID" prop="teamId">
<el-input v-model="form.teamId" placeholder="请输入班组ID" />
</el-form-item>
<el-form-item label="班次id" prop="classesId">
<el-input v-model="form.classesId" placeholder="请输入班次id" />
</el-form-item>
<el-form-item label="上班日期" prop="startDay">
<el-input v-model="form.startDay" placeholder="请输入上班日期" />
</el-form-item>
<el-form-item label="上班时间" prop="startTime">
<el-date-picker clearable v-model="form.startTime" type="date" value-format="timestamp" placeholder="选择上班时间" />
</el-form-item>
<el-form-item label="下班时间" prop="endTime">
<el-date-picker clearable v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择下班时间" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> <!-- 班组上下片查询 -->
<group-upper-lower v-if="upperLowerVisible" ref="upperLowerParam"></group-upper-lower>
</div> </div>
</template> </template>
<script> <script>
import { createGroupTeamScheduling, updateGroupTeamScheduling, deleteGroupTeamScheduling, getGroupTeamScheduling, getGroupTeamSchedulingPage, exportGroupTeamSchedulingExcel } from "@/api/base/groupTeamScheduling"; import { createGroupTeamScheduling } from "@/api/base/groupTeamScheduling";
import GroupUpperLower from "./components/groupUpperLower.vue"
export default { export default {
name: "GroupTeamScheduling", name: "GroupTeamScheduling",
components: { components: { GroupUpperLower },
},
data() { data() {
return { return {
// monthList: [
loading: true, {id: ''}
// ],
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10
startDay: [],
}, },
// upperLowerVisible: false
form: {},
//
rules: {
teamId: [{ required: true, message: "班组ID不能为空", trigger: "blur" }],
classesId: [{ required: true, message: "班次id不能为空", trigger: "blur" }],
}
}; };
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询列表 */ getList() {},
getList() { toUpperLower() {
this.loading = true; this.upperLowerVisible = true
// this.$nextTick(() => {
getGroupTeamSchedulingPage(this.queryParams).then(response => { this.$refs.upperLowerParam.init()
this.list = response.data.list; })
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
teamId: undefined,
classesId: undefined,
startDay: undefined,
startTime: undefined,
endTime: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加排班信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getGroupTeamScheduling(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改排班信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateGroupTeamScheduling(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createGroupTeamScheduling(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除排班信息编号为"' + id + '"的数据项?').then(function() {
return deleteGroupTeamScheduling(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有排班信息数据项?').then(() => {
this.exportLoading = true;
return exportGroupTeamSchedulingExcel(params);
}).then(response => {
this.$download.excel(response, '排班信息.xls');
this.exportLoading = false;
}).catch(() => {});
} }
} }
}; };