Commit b29f6d3f authored by 赵汉亭's avatar 赵汉亭

Merge branch 'dev' of http://git.local.topsunit.com/mes/mes-ui into dev

parents 5dd0e5db 8fc6ee3b
......@@ -9,6 +9,15 @@ export function listCalholiday(query) {
})
}
// 查询上班数据工作单元列表
export function listItem(query) {
return request({
url: "/md/cal/plan/workunit/list",
method: "get",
params: query,
});
}
// 查询节假日设置详细
export function getCalholiday(holidayId) {
return request({
......@@ -20,10 +29,10 @@ export function getCalholiday(holidayId) {
// 新增节假日设置
export function addCalholiday(data) {
return request({
url: '/mes/cal/calholiday',
method: 'post',
data: data
})
url: "/md/cal/plan/workunit/editList",
method: "put",
data: data,
});
}
// 修改节假日设置
......
......@@ -29,12 +29,20 @@ export function addCalplan(data) {
// 修改排班计划
export function updateCalplan(data) {
return request({
url: '/mes/cal/calplan',
method: 'put',
data: data
})
url: "/mes/cal/calplan",
method: "put",
data: data,
});
}
// 完成排班计划
export function finishCalplan(data) {
return request({
url: "/mes/cal/calplan/releasePlan",
method: "put",
data: data,
});
}
// 删除排班计划
export function delCalplan(planId) {
return request({
......
import request from '@/utils/request'
// 查询计划班组列表
// 查询计划工作单元列表
export function listPlanteam(query) {
return request({
url: '/mes/cal/planteam/list',
method: 'get',
params: query
})
url: "/md/cal/workunit/list",
method: "get",
params: query,
});
}
// 新增计划班组
// 新增计划工作单元
export function addPlanteam(data) {
return request({
url: '/mes/cal/planteam',
method: 'post',
data: data
})
url: "/md/cal/workunit/addList",
method: "post",
data: data,
});
}
// 删除计划班组
// 删除计划工作单元
export function delPlanteam(recordId) {
return request({
url: '/mes/cal/planteam/' + recordId,
method: 'delete'
})
url: "/md/cal/workunit/" + recordId,
method: "delete",
});
}
......@@ -3,10 +3,17 @@ import request from '@/utils/request'
// 查询计划班次列表
export function listShift(query) {
return request({
url: '/mes/cal/shift/list',
method: 'get',
params: query
})
url: `/mes/cal/shift/getDetailShift/${query.shiftType}`,
method: "get"
});
}
// 查询计划班次列表
export function listEditShift(query) {
return request({
url: `/mes/cal/shift/list`,
method: "get",
params: query,
});
}
// 查询计划班次详细
......
import request from '@/utils/request'
// 查询班组列表
// 查询工作单元列表
export function listTeam(query) {
return request({
url: '/mes/cal/team/list',
url: '/md/workunit/list',
method: 'get',
params: query
})
......
<template>
<div class="app-container">
<el-container>
<el-aside width="200px">
<!-- <el-aside width="200px">
<el-radio-group v-model="selectedType" class="x-fillitem el-group-list" @change="onSelected">
<el-radio-button
v-for="dict in dict.type.mes_calendar_type"
......@@ -9,7 +9,7 @@
:label="dict.value"
>{{dict.label}}</el-radio-button>
</el-radio-group>
</el-aside>
</el-aside> -->
<el-main>
<el-calendar v-loading="loading" v-model="date">
<template slot="dateCell" slot-scope="{date, data }">
......
<template>
<div class="app-container">
<el-tabs type="border-card">
<el-tab-pane label="分类">
<el-tab-pane label="首页">
<CalendarTypeView></CalendarTypeView>
</el-tab-pane>
<el-tab-pane label="班组">
<el-tab-pane label="工作单元">
<TeamView></TeamView>
</el-tab-pane>
<el-tab-pane label="个人">
<!-- <el-tab-pane label="个人">
<UserView></UserView>
</el-tab-pane>
</el-tab-pane> -->
</el-tabs>
</div>
</template>
......@@ -30,4 +30,4 @@ export default {
<style>
</style>
\ No newline at end of file
</style>
......@@ -5,7 +5,7 @@
<div @contextmenu.prevent="onRightClick(data)">
<el-row>
<el-col :span="16">
<div class="solar">
<div class="solar">
{{ data.day.split('-')[2] }}
</div>
</el-col>
......@@ -17,13 +17,13 @@
<el-row>
<el-col :span="24">
<div class="lunar" :class="{ festival : isFestival(date, data) }">{{ solarDate2lunar(data.day) }}</div>
</el-col>
</el-row>
</div>
</el-col>
</el-row>
</div>
</template>
</el-calendar>
<!-- 添加或修改节假日设置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<!-- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
......@@ -45,14 +45,26 @@
<el-button type="primary" v-hasPermi="['mes:cal:calholiday:edit']" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog> -->
<el-dialog :title="title" :visible.sync="open" width="1300px" append-to-body>
<item-index ref="itemIndex" v-if="open" optType="add" :theDay="theDay"></item-index>
<div slot="footer" class="dialog-footer">
<el-button type="primary" v-hasPermi="['mes:cal:calholiday:edit']" @click="submitForm(2)">放 假</el-button>
<el-button type="primary" v-hasPermi="['mes:cal:calholiday:edit']" @click="submitForm(1)">加 班</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listCalholiday, getCalholiday, delCalholiday, addCalholiday, updateCalholiday } from "@/api/mes/cal/calholiday";
import ItemIndex from "./itemIndex";
import calendar from '@/utils/calendar';
export default {
components: {
ItemIndex
},
data(){
return {
// 遮罩层
......@@ -64,7 +76,7 @@ export default {
title: "节假日设置",
// 是否显示弹出层
open: false,
form:{},
theDay: null,
queryParams: {
theDay: null,
holidayType: null,
......@@ -85,10 +97,10 @@ export default {
methods:{
/** 查询节假日设置列表 */
getList() {
this.loading = true;
this.loading = true;
this.holidayList =[];
this.workdayList =[];
let that = this;
let that = this;
listCalholiday(this.queryParams).then(response => {
debugger;
if(response.data !=null){
......@@ -98,7 +110,7 @@ export default {
}else{
that.workdayList.push(theDay.theDay);
}
});
});
this.loading = false;
}
});
......@@ -106,18 +118,20 @@ export default {
onRightClick(date){
this.open = true;
this.reset();
this.form.theDay=date.day;
console.log()
this.theDay=date.day;
},
submitForm(){
this.$refs["form"].validate(valid => {
if (valid) {
addCalholiday(this.form).then(response => {
this.$modal.msgSuccess("设置成功");
this.open = false;
this.getList();
});
}
});
submitForm(isWork){
const datas = this.$refs.itemIndex.selectRow.map(item => {
return {
id: item.id,
isWork
}
})
addCalholiday(datas).then(response => {
this.$modal.msgSuccess("设置成功");
this.$refs.itemIndex.getList();
});
},
// 取消按钮
cancel() {
......@@ -138,20 +152,20 @@ export default {
isFestival(slotDate, slotData) {
let solarDayArr = slotData.day.split('-');
let lunarDay = calendar.solar2lunar(solarDayArr[0], solarDayArr[1], solarDayArr[2])
// 公历节日\农历节日\农历节气
let festAndTerm = [];
festAndTerm.push(lunarDay.festival == null ? '' : ' ' + lunarDay.festival)
festAndTerm.push(lunarDay.lunarFestival == null ? '' : '' + lunarDay.lunarFestival)
festAndTerm.push(lunarDay.Term == null ? '' : '' + lunarDay.Term)
festAndTerm = festAndTerm.join('')
return festAndTerm != ''
},
solarDate2lunar(solarDate) {
var solar = solarDate.split('-')
var lunar = calendar.solar2lunar(solar[0], solar[1], solar[2])
var lunar = calendar.solar2lunar(solar[0], solar[1], solar[2])
let lunarMD = lunar.IMonthCn + lunar.IDayCn;
// 公历节日\农历节日\农历节气
let festAndTerm = [];
......@@ -159,9 +173,9 @@ export default {
festAndTerm.push(lunar.lunarFestival == null ? '' : '' + lunar.lunarFestival)
festAndTerm.push(lunar.Term == null ? '' : '' + lunar.Term)
festAndTerm = festAndTerm.join('')
return festAndTerm == '' ? lunarMD : festAndTerm
}
}
}
......@@ -186,4 +200,4 @@ export default {
.el-calendar-table .holiday {
background-color: #88E325;
}
</style>
\ No newline at end of file
</style>
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="工作单元ID" prop="workunitId">
<el-input
v-model="queryParams.workunitId"
placeholder="请输入工作单元ID"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工作状态" prop="isWork">
<el-select
v-model="queryParams.isWork"
placeholder="请选择工作状态"
clearable
>
<el-option
label="工作"
value="1"
/>
<el-option
label="休息"
value="2"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="tmToolRequestItemList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="工作单元ID" align="center" prop="workunitId" />
<el-table-column label="工作单元编码" align="center" prop="workunitCode" />
<el-table-column label="工作单元名称" align="center" prop="workunitName" />
<el-table-column label="工作状态" align="center" prop="isWork" >
<template slot-scope="scope">
{{ scope.row.isWork == '1'? '工作': '休息' }}
</template>
</el-table-column>
<el-table-column label="工作单元名称" align="center" prop="workunitName" />
<el-table-column label="工作开始时间" align="center" prop="startTime" />
<el-table-column label="工作结束时间" align="center" prop="endTime" />
<el-table-column label="工作休息开始时间" align="center" prop="breakStartTime" />
<el-table-column label="工作休息结束时间" align="center" prop="breakEndTime" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { listItem, getTmToolRequestItem, delTmToolRequestItem, addTmToolRequestItem, updateTmToolRequestItem } from "@/api/mes/cal/calholiday";
import { getTaskIdMaxProcessTool } from "@/api/mes/pro/protask";
export default {
name: "TmToolRequestItem",
components: {},
props:{
theDay:{
type:String,
default:''
}
},
data() {
return {
// 遮罩层
loading: false,
// 选中数组
ids: [],
selectRow: [],
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 刀模板物料申请单表格数据
tmToolRequestItemList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
workunitId: null,
isWork: null,
theDay: this.theDay
},
// 表单参数
form: {},
// 表单校验
rules: {
},
addList: [],
detailList: []
};
},
watch: {
// 根据名称筛选分类树
theDay: {
handler (newName, oldName) {
if (newName) {
this.getList();
}
},
immediate: true
}
},
created() {
},
methods: {
onItemSelect(list){
// console.log(list, 'list')
this.addList = list.map(item => {
return {
itemId:item.itemId,
itemName:item.itemName,
allQuantity: 1,
nextMaintenPeriod: Number(this.$attrs.quantity)
}
})
this.tmToolRequestItemList = this.detailList.concat(this.addList)
this.$emit('sum')
},
/** 查询刀模板物料申请单列表 */
getList() {
this.loading = true;
listItem(this.queryParams).then(response => {
this.tmToolRequestItemList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
toolRequestItemId: null, toolRequestId: null, itemId: null, allQuantity: null, nextMaintenPeriod: null, createBy: null, createTime: null, updateBy: null, updateTime: null };
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.toolRequestItemId)
this.selectRow = selection
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加刀模板物料申请单";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const toolRequestItemId = row.toolRequestItemId || this.ids
getTmToolRequestItem(toolRequestItemId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改刀模板物料申请单";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.toolRequestItemId != null) {
updateTmToolRequestItem(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addTmToolRequestItem(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const toolRequestItemIds = row.toolRequestItemId || this.ids;
this.$modal.confirm('是否确认删除刀模板物料申请单编号为"' + toolRequestItemIds + '"的数据项?').then(function() {
return delTmToolRequestItem(toolRequestItemIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('tm/tmToolRequestItem/export', {
...this.queryParams
}, `tmToolRequestItem_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="班组类型" prop="calendarType">
<!-- <el-form-item label="班组类型" prop="calendarType">
<el-select v-model="queryParams.calendarType" placeholder="请选择班组类型">
<el-option
v-for="dict in dict.type.mes_calendar_type"
......@@ -10,7 +10,7 @@
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item label="计划编号" prop="planCode">
<el-input
v-model="queryParams.planCode"
......@@ -96,11 +96,11 @@
</template>
</el-table-column>
<el-table-column label="计划名称" width="200px" align="center" prop="planName" :show-overflow-tooltip="true"/>
<el-table-column label="班组类型" align="center" prop="calendarType">
<!-- <el-table-column label="班组类型" align="center" prop="calendarType">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_calendar_type" :value="scope.row.calendarType"/>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column label="开始日期" align="center" prop="startDate" width="120">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
......@@ -116,11 +116,6 @@
<dict-tag :options="dict.type.mes_shift_type" :value="scope.row.shiftType"/>
</template>
</el-table-column>
<el-table-column label="倒班方式" align="center" prop="shiftMethod" >
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_shift_method" :value="scope.row.shiftMethod"/>
</template>
</el-table-column>
<el-table-column label="单据状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status"/>
......@@ -163,13 +158,7 @@
<el-col :span="12">
<el-form-item label="计划编号" prop="planCode">
<div style="display:flex;align-items: center;">
<el-input v-model="form.planCode" placeholder="请输入计划编号" />
<el-switch v-model="autoGenFlag"
active-color="#13ce66"
active-text="自动生成"
style="width:175px;margin-left:10px;"
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'" >
</el-switch>
<el-input v-model="form.planCode" disabled placeholder="请输入计划编号" />
</div>
</el-form-item>
</el-col>
......@@ -180,41 +169,31 @@
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-col :span="12">
<el-form-item label="开始日期" prop="startDate">
<el-date-picker clearable
v-model="form.startDate"
type="date"
style="width: 100%;"
value-format="yyyy-MM-dd"
placeholder="请选择开始日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-col :span="12">
<el-form-item label="结束日期" prop="endDate">
<el-date-picker clearable
v-model="form.endDate"
type="date"
style="width: 100%;"
value-format="yyyy-MM-dd"
placeholder="请选择结束日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="班组类型" prop="calendarType">
<el-select v-model="form.calendarType" placeholder="请选择班组类型">
<el-option
v-for="dict in dict.type.mes_calendar_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-col :span="10">
<el-form-item label="轮班方式">
<el-radio-group v-model="form.shiftType">
<el-radio
......@@ -225,22 +204,20 @@
</el-radio-group>
</el-form-item>
</el-col>
<el-col v-if="form.shiftType !='SINGLE'" :span="6">
<el-form-item label="倒班方式" prop="shiftMethod">
<el-select style="width:100px" v-model="form.shiftMethod" placeholder="请选择倒班方式">
<el-option
v-for="dict in dict.type.mes_shift_method"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
<el-col :span="7">
<el-form-item label="周六是否上班">
<el-radio-group v-model="form.saturday">
<el-radio :label="1"></el-radio>
<el-radio :label="2"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col v-if="form.shiftMethod =='DAY' && form.shiftType !='SINGLE'" :span="6">
<el-form-item label-width="20" prop="shiftCount">
<el-input-number :min="1" controls-position="right" v-model="form.shiftCount" >
</el-input-number>
<el-col :span="7">
<el-form-item label="周日是否上班">
<el-radio-group v-model="form.sunday">
<el-radio :label="1"></el-radio>
<el-radio :label="2"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
......@@ -252,12 +229,12 @@
</el-col>
</el-row>
</el-form>
<el-tabs type="border-card" v-if="form.planId != null">
<el-tabs type="border-card">
<el-tab-pane label="班次">
<Shift ref="shiftTab" :planId="form.planId" :optType="optType"></Shift>
<Shift v-if="open" ref="shiftTab" :planId="form.planId" :shiftType="form.shiftType" :optType="optType"></Shift>
</el-tab-pane>
<el-tab-pane label="班组">
<Team ref="teamTab" :planId="form.planId" :calendarType="form.calendarType" :optType="optType"></Team>
<el-tab-pane v-if="open&&optType !== 'add'" label="工作单元">
<Team v-if="open&&optType !== 'add'" ref="teamTab" :planId="form.planId" :form="form" :calendarType="form.calendarType" :optType="optType"></Team>
</el-tab-pane>
</el-tabs>
<div slot="footer" class="dialog-footer">
......@@ -271,7 +248,7 @@
</template>
<script>
import { listCalplan, getCalplan, delCalplan, addCalplan, updateCalplan } from "@/api/mes/cal/calplan";
import { listCalplan, getCalplan, delCalplan, addCalplan, updateCalplan, finishCalplan } from "@/api/mes/cal/calplan";
import Shift from "./shift";
import Team from "./team";
import {genCode} from "@/api/system/autocode/rule"
......@@ -312,8 +289,7 @@ export default {
calendarType:null,
startDate: null,
endDate: null,
shiftType: null,
shiftMethod: null,
shiftType: null
},
// 表单参数
form: {},
......@@ -369,14 +345,8 @@ export default {
shiftCount: 1,
status: "PREPARE",
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
saturday: null,
sunday: null,
};
this.resetForm("form");
},
......@@ -401,6 +371,7 @@ export default {
this.reset();
this.open = true;
this.title = "添加排班计划";
this.handleAutoGenChange()
this.optType = "add";
},
// 查询明细按钮操作
......@@ -430,13 +401,18 @@ export default {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.planId != null) {
updateCalplan(this.form).then(response => {
let params = Object.assign({}, this.form)
params.calShifts = this.$refs.shiftTab.shiftList
params.calWorkunits = this.$refs.teamTab.teamList
updateCalplan(params).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCalplan(this.form).then(response => {
let params = Object.assign({}, this.form)
params.calShifts = this.$refs.shiftTab.shiftList
addCalplan(params).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
......@@ -456,20 +432,22 @@ export default {
}).catch(() => {});
},
handleFinish(){
let that = this;
this.$modal.confirm('是否完成计划编制?【完成后将不能更改】').then(function(){
that.form.status = 'CONFIRMED';
that.$refs["form"].validate(valid => {
this.$modal.confirm('是否完成计划编制?【完成后将不能更改】').then(()=>{
this.form.status = 'CONFIRMED';
this.$refs["form"].validate(valid => {
if (valid) {
if (that.form.planId != null) {
updateCalplan(that.form).then(response => {
that.$modal.msgSuccess("已完成");
that.open = false;
that.getList();
that.formLoading = false;
if (this.form.planId != null) {
let params = Object.assign({}, this.form)
params.calShifts = this.$refs.shiftTab.shiftList
params.calWorkunits = this.$refs.teamTab.teamList
finishCalplan(params).then(response => {
this.$modal.msgSuccess("已完成");
this.open = false;
this.getList();
this.formLoading = false;
},err =>{
that.form.status = 'PREPARE';
that.formLoading = false;
this.form.status = 'PREPARE';
this.formLoading = false;
});
}
}
......@@ -483,14 +461,10 @@ export default {
}, `calplan_${new Date().getTime()}.xlsx`)
},
//自动生成编码
handleAutoGenChange(autoGenFlag){
if(autoGenFlag){
genCode('CAL_PLAN_CODE').then(response =>{
this.form.planCode = response;
});
}else{
this.form.planCode = null;
}
handleAutoGenChange(){
genCode('CAL_PLAN_CODE').then(response =>{
this.form.planCode = response;
});
},
}
};
......
<template>
<div class="app-container">
<el-row v-if="optType !='view'" :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['mes:cal:calplan:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mes:cal:calplan:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:cal:calplan:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="shiftList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="orderNum" />
<el-table v-loading="loading" :data="shiftList">
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="序号" align="center" prop="orderNum" width="50"/>
<el-table-column label="班次名称" align="center" prop="shiftName" />
<el-table-column label="开始时间" align="center" prop="startTime" width="180">
<el-table-column label="工作开始时间" align="center" prop="startTime" width="100">
</el-table-column>
<el-table-column label="结束时间" align="center" prop="endTime" width="180">
<el-table-column label="工作结束时间" align="center" prop="endTime" width="100">
</el-table-column>
<el-table-column label="休息开始时间" align="center" prop="breakEndTime" width="100">
</el-table-column>
<el-table-column label="休息结束时间" align="center" prop="breakStartTime" width="100">
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" v-if="optType !='view'" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" width="70" v-if="optType !='view'" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
@click="handleUpdate(scope.row, scope.$index)"
v-hasPermi="['mes:cal:calplan:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:cal:calplan:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改计划班次对话框 -->
<el-dialog :title="title" :visible.sync="open" width="960px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<!-- <el-col :span="12">
<el-form-item label="序号" prop="orderNum">
<el-input-number :min="1" v-model="form.orderNum" placeholder="请输入序号" />
</el-form-item>
</el-col>
</el-col> -->
<el-col :span="12">
<el-form-item label="班次名称" prop="shiftName">
<el-input v-model="form.shiftName" placeholder="请输入班次名称" />
</el-form-item>
</el-col>
</el-row>
<el-row>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="开始时间" prop="startTime">
<el-form-item label="工作开始时间" prop="startTime">
<el-time-picker
v-model="form.startTime"
placeholder="请选择开始时间"
placeholder="请选择工作开始时间"
format ="HH:mm"
value-format="HH:mm"
>
......@@ -101,16 +58,43 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="结束时间" prop="endTime">
<el-form-item label="工作结束时间" prop="endTime">
<el-time-picker
v-model="form.endTime"
placeholder="请选择结束时间"
placeholder="请选择工作结束时间"
format ="HH:mm"
value-format="HH:mm"
>
</el-time-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="休息开始时间" prop="breakEndTime">
<el-time-picker
v-model="form.breakEndTime"
placeholder="请选择休息开始时间"
format ="HH:mm"
value-format="HH:mm"
>
</el-time-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="休息结束时间" prop="breakStartTime">
<el-time-picker
v-model="form.breakStartTime"
placeholder="请选择休息结束时间"
format ="HH:mm"
value-format="HH:mm"
>
>
</el-time-picker>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
......@@ -122,16 +106,39 @@
</template>
<script>
import { listShift, getShift, delShift, addShift, updateShift } from "@/api/mes/cal/shift";
import { listShift, listEditShift } from "@/api/mes/cal/shift";
export default {
name: "Shift",
props: {
shiftType: null,
planId: null,
optType: null,
optType: null
},
watch: {
// 根据名称筛选分类树
shiftType: {
handler (newName, oldName) {
if (newName&&this.optType === 'add'&& !this.plan) {
this.getList();
console.log(889999)
}
},
immediate: true
},
planId: {
handler (newName, oldName) {
if (newName&&this.optType === 'edit') {
this.getEditList();
}
},
immediate: true
}
},
data() {
return {
currentIndex: null,
currentRow: {},
// 遮罩层
loading: true,
// 选中数组
......@@ -142,8 +149,6 @@ export default {
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 计划班次表格数据
shiftList: [],
// 弹出层标题
......@@ -152,13 +157,7 @@ export default {
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
planId: this.planId,
orderNum: null,
shiftName: null,
startTime: null,
endTime: null,
shiftType: this.shiftType,
},
// 表单参数
form: {},
......@@ -177,15 +176,22 @@ export default {
};
},
created() {
this.getList();
},
methods: {
/** 查询计划班次列表 */
getList() {
this.loading = true;
listShift(this.queryParams).then(response => {
this.shiftList = response.data;
this.loading = false;
});
},
/** 查询计划班次列表 */
getEditList() {
this.loading = true;
listEditShift({planId: this.planId}).then(response => {
this.shiftList = response.rows;
this.total = response.total;
this.loading = false;
});
},
......@@ -196,23 +202,7 @@ export default {
},
// 表单重置
reset() {
this.form = {
shiftId: null,
planId: this.planId,
orderNum: null,
shiftName: null,
startTime: null,
endTime: null,
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.form = {}
this.resetForm("form");
},
/** 搜索按钮操作 */
......@@ -225,58 +215,31 @@ export default {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.shiftId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加班次";
},
/** 修改按钮操作 */
handleUpdate(row) {
handleUpdate(row, index) {
this.reset();
const shiftId = row.shiftId || this.ids
getShift(shiftId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改计划班次";
});
this.currentIndex = index
this.currentRow = row
this.form = Object.assign({}, row);
this.open = true;
this.title = "修改计划班次";
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.shiftId != null) {
updateShift(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addShift(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
// this.$modal.msgSuccess("修改成功");
this.currentRow.shiftName = this.form.shiftName
this.currentRow.startTime = this.form.startTime
this.currentRow.endTime = this.form.endTime
this.currentRow.breakEndTime = this.form.breakEndTime
this.currentRow.breakStartTime = this.form.breakStartTime
this.currentRow.remark = this.form.remark
this.open = false;
// this.$set(this.shiftList, this.currentIndex, this.form)
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const shiftIds = row.shiftId || this.ids;
this.$modal.confirm('是否确认删除班次?').then(function() {
return delShift(shiftIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
}
}
};
</script>
<template>
<div class="app-container">
<el-row>
<el-col :span="12">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>班组</span>
<el-button style="float: right; padding: 3px 0" v-if="optType !='view'" @click="handleAdd" type="text">添加</el-button>
</div>
<el-table v-loading="loading" :data="teamList" @row-click="onRowClick">
<el-table-column label="班组编号" align="center" prop="teamCode" >
</el-table-column>
<el-table-column label="班组名称" align="center" prop="teamName" />
<el-table-column label="操作" align="center" v-if="optType !='view'" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:cal:calplan:edit']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<TeamSelect ref="teamSelect" @onSelected="onTeamSelected"></TeamSelect>
</el-card>
</el-col>
<el-col :span="12">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>成员</span>
</div>
<el-table v-loading="loading" :data="teammemberList">
<el-table-column label="用户名" align="center" prop="userName" />
<el-table-column label="用户昵称" align="center" prop="nickName" />
<el-table-column label="电话" align="center" prop="tel" />
</el-table>
</el-card>
</el-col>
</el-row>
<div class="clearfix">
<span>工作单元</span>
<el-button style="float: right;" v-if="optType !='view'" @click="handleAdd" type="primary">新增</el-button>
</div>
<el-table v-loading="loading" :data="teamList">
<el-table-column label="工作单元ID" align="center" prop="workunitId" >
</el-table-column>
<el-table-column label="工作单元编码" align="center" prop="workunitCode" />
<el-table-column label="工作单元名称" align="center" prop="workunitName" />
<el-table-column label="操作" align="center" v-if="optType !='view'" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:cal:calplan:edit']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getTeamList"
/>
<TeamSelect ref="teamSelect" @onSelected="onTeamSelected"></TeamSelect>
</div>
</template>
<script>
import { listPlanteam, delPlanteam, addPlanteam } from "@/api/mes/cal/planteam";
import { listTeammember } from "@/api/mes/cal/teammember";
import TeamSelect from "@/components/calTeamSelect/multi.vue"
import TeamSelect from "../team/calTeamSelect/multi.vue"
export default {
name:"PlanTeam",
components:{TeamSelect},
props:{
planId:null,
optType:null,
form: null,
calendarType:null
},
data(){
......@@ -64,60 +54,47 @@ export default {
teammemberList: [],
form:{},
queryParams: {
pageNum: 1,
pageSize: 10,
planId: this.planId,
teamId: null,
teamCode: null,
teamName: null,
calendarType:this.calendarType
pageNum: 1,
pageSize: 10,
planId: this.planId
},
total: 0
}
},
created() {
this.getTeamList();
this.getTeamList();
},
methods:{
getTeamList(){
this.loading = true;
listPlanteam(this.queryParams).then(response => {
this.teamList = response.rows;
this.teamList = response.rows;
this.total = response.total
this.loading = false;
});
},
getMemberList(id){
var param = {
teamId:id
}
this.loading = true;
listTeammember(param).then(response => {
this.teammemberList = response.rows;
this.loading = false;
});
},
onRowClick(row){
this.getMemberList(row.teamId);
},
/** 新增按钮操作 */
handleAdd() {
this.$refs.teamSelect.showFlag = true;
},
onTeamSelected(rows){
rows.forEach(team => {
this.form.teamId = team.teamId;
this.form.teamCode = team.teamCode;
this.form.teamName = team.teamName;
this.form.planId = this.planId;
this.form.calendarType = this.calendarType;
addPlanteam(this.form).then(response => {
this.getTeamList();
});
});
// console.log(rows, 'rows')
const data = rows.map(team => {
return {
...team,
planId: this.planId,
planCode: this.form.planCode,
}
});
addPlanteam(data).then(response => {
this.getTeamList();
});
},
/** 删除按钮操作 */
handleDelete(row) {
const recordIds = row.recordId
this.$modal.confirm('是否确认删除班组?').then(function() {
const recordIds = row.id
this.$modal.confirm('是否确认删除工作单元?').then(function() {
return delPlanteam(recordIds);
}).then(() => {
this.getTeamList();
......@@ -130,4 +107,4 @@ export default {
<style>
</style>
\ No newline at end of file
</style>
<template>
<el-dialog title="班组选择"
<el-dialog title="工作单元选择"
v-if="showFlag"
:visible.sync="showFlag"
:modal= false
width="80%"
center
>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="班组编号" prop="teamCode">
<el-input
v-model="queryParams.teamCode"
......@@ -27,16 +26,19 @@
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-form> -->
<el-table v-loading="loading" :data="teamList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="班组编号" align="center" prop="teamCode" >
<el-table-column label="工作单元ID" width="80" align="center" prop="workunitId" >
</el-table-column>
<el-table-column label="班组名称" align="center" prop="teamName" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="工作单元编码" align="center" prop="workunitCode" />
<el-table-column label="工作单元名称" align="center" prop="workunitName" />
<el-table-column label="开始时间" align="center" prop="createTime" />
<el-table-column label="更新时间" align="center" prop="updateTime" />
</el-table>
<pagination
v-show="total>0"
:total="total"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment