保养工单-快速工单

yangwl
wws 1 year ago
parent 4099231d7b
commit 7e0cf107c3

@ -206,7 +206,7 @@
plain plain
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="orderDialog = true" @click="cilckFastWork"
v-hasPermi="['device:upkeepOrder:add']" v-hasPermi="['device:upkeepOrder:add']"
>快速工单 >快速工单
</el-button> </el-button>
@ -355,7 +355,19 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="7">
<el-form-item label="工作中心:">
<el-select v-model="form.planWorkshop" placeholder="工作中心" clearable>
<el-option
v-for="item in workCenterList"
:key="item.factoryCode"
:label="item.factoryName"
:value="item.factoryCode">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="10" :offset="1">
<el-form-item label-width="100px" label="保养执行时间"> <el-form-item label-width="100px" label="保养执行时间">
<el-date-picker <el-date-picker
@change="changeArray" @change="changeArray"
@ -685,10 +697,24 @@
</el-dialog> </el-dialog>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="选择保养人员">
<el-row>
<el-col :span="24" :offset="1">
<el-transfer
:titles="['人员','已选择人员']"
filterable
:filter-method="filterMethod"
filter-placeholder="请输入人员名称"
v-model="selectPersonList"
:data="personList">
</el-transfer>
</el-col>
</el-row>
</el-tab-pane>
</el-tabs> </el-tabs>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="orderDialog = false"> </el-button> <el-button @click="orderDialog = false"> </el-button>
<el-button type="primary" @click="orderDialog = false"> </el-button> <el-button type="primary" @click="subOrder"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -732,7 +758,7 @@ import {
updateUpkeepOrder updateUpkeepOrder
} from "@/api/device/upkeepOrder"; } from "@/api/device/upkeepOrder";
import {formatEquItem, querySpareList} from "@/api/device/upkeepPlan"; import {formatEquItem, querySpareList} from "@/api/device/upkeepPlan";
import {getEquList} from "@/api/device/plan"; import {getEquList, getPersonList, getWorkCenter} from "@/api/device/plan";
import {getDeviceOrder} from "@/api/device/deviceOrder"; import {getDeviceOrder} from "@/api/device/deviceOrder";
export default { export default {
@ -868,10 +894,50 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
//
setWorkCenter() {
getWorkCenter().then(response => {
this.workCenterList = response.data;
})
},
//
cilckFastWork(){
this.selectPersonList = [];
this.personList = [];
this.setPerson();
this.setWorkCenter();
this.orderDialog = true;
},
// 穿
filterMethod(query, item) {
return item.label.indexOf(query) > -1;
},
//
subOrder() {
console.log("提交按钮")
console.log(this.form)
this.form.personList = this.selectPersonList;
addUpkeepOrder(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
},
// //
standardBtn() { standardBtn() {
this.editorItem = false; this.editorItem = false;
}, },
// List-穿
setPerson() {
getPersonList().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.personList.push({
label: response.data[i].nickName + '(' + response.data[i].userName + ')',
key: response.data[i].userId,
})
}
});
},
// //
delStandard(e) { delStandard(e) {
e.showFlag = false; e.showFlag = false;
@ -923,6 +989,7 @@ export default {
return return
} }
this.form.equipmentItem = [];
// //
formatEquItem(this.selectEquList).then(response => { formatEquItem(this.selectEquList).then(response => {
@ -1002,98 +1069,7 @@ export default {
}, },
// //
changeArray(e) { changeArray(e) {
console.log(e) console.log("改变了保养执行时间")
console.log(this.form.planTimeArray)
if (this.form.planLoop == null) {
this.$message({
message: '请输入循环周期!',
type: 'warning'
})
this.form.planTimeArray = [];
return
}
if (this.form.planLoopType == null) {
this.$message({
message: '请选择循环类型!',
type: 'warning'
})
this.form.planTimeArray = [];
return
}
//
if (this.form.planLoopType == 'day') {
//
let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime();
//
let days = Math.floor(diff / (1000 * 60 * 60 * 24));
if (days > this.form.planLoop) {
this.$message({
message: '可执行时间范围为' + days + '天,循环周期为' + days + '天,超过循环周期' + (days - this.form.planLoop) + '天,请重新选择执行时间!',
type: 'warning'
})
this.form.planTimeArray = [];
return
}
}
if (this.form.planLoopType == 'week') {
//
let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime();
//
let weeks = Math.floor(diff / (1000 * 60 * 60 * 24 * 7));
if (weeks > (this.form.planLoop / 7)) {
this.$message({
message: '可执行时间范围为' + weeks + '周,循环周期为' + weeks + '周,超过循环周期' + (weeks * 7 - this.form.planLoop) + '天,请重新选择执行时间!',
type: 'warning'
})
this.form.planTimeArray = [];
return
}
}
if (this.form.planLoopType == 'month') {
let monthsDiff = (this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear()) * 12 + this.form.planTimeArray[1].getMonth() - this.form.planTimeArray[0].getMonth();
if (monthsDiff > this.form.planLoop) {
this.$message({
message: '可执行时间范围为' + monthsDiff + '月,循环周期为' + monthsDiff + '月,超过循环周期' + (monthsDiff - this.form.planLoop) + '月,请重新选择执行时间!',
type: 'warning'
})
this.form.planTimeArray = [];
return
}
}
if (this.form.planLoopType == 'season') {
let monthsDiff = (this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear()) * 12 + this.form.planTimeArray[1].getMonth() - this.form.planTimeArray[0].getMonth();
if (monthsDiff * 3 > this.form.planLoop) {
this.$message({
message: '可执行时间范围为' + monthsDiff * 3 + '季度,循环周期为' + monthsDiff * 3 + '季度,超过循环周期' + (monthsDiff - this.form.planLoop) + '月,请重新选择执行时间!',
type: 'warning'
})
this.form.planTimeArray = [];
return
}
}
if (this.form.planLoopType == 'year') {
//
let yearsDiff = this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear();
if (yearsDiff > this.form.planLoop) {
this.$message({
message: '可执行时间范围为' + yearsDiff + '年,循环周期为' + yearsDiff + '年,超过循环周期' + (yearsDiff - this.form.planLoop) + '年,请重新选择执行时间!',
type: 'warning'
})
this.form.planTimeArray = [];
return
}
}
}, },
// //
confirmSelectSpareBtn() { confirmSelectSpareBtn() {
@ -1206,7 +1182,7 @@ export default {
this.single = selection.length !== 1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 快速工单按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
@ -1226,6 +1202,8 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
console.log("提交按钮")
console.log(this.form)
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.orderId != null) { if (this.form.orderId != null) {
@ -1235,11 +1213,13 @@ export default {
this.getList(); this.getList();
}); });
} else { } else {
addUpkeepOrder(this.form).then(response => { console.log("提交按钮")
this.$modal.msgSuccess("新增成功"); console.log(this.form)
this.open = false; // addUpkeepOrder(this.form).then(response => {
this.getList(); // this.$modal.msgSuccess("");
}); // this.open = false;
// this.getList();
// });
} }
} }
}); });
@ -1264,3 +1244,17 @@ export default {
} }
}; };
</script> </script>
<style>
.my-step-mar {
margin-left: 10px;
margin-right: 10px;
}
.my-step-body {
margin-top: 15px;
}
.el-transfer-panel {
width: 250px;
}
</style>

Loading…
Cancel
Save