保养工单-快速工单

master
wws 1 year ago
parent 4099231d7b
commit 7e0cf107c3

@ -206,7 +206,7 @@
plain
icon="el-icon-plus"
size="mini"
@click="orderDialog = true"
@click="cilckFastWork"
v-hasPermi="['device:upkeepOrder:add']"
>快速工单
</el-button>
@ -355,7 +355,19 @@
</el-col>
</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-date-picker
@change="changeArray"
@ -685,10 +697,24 @@
</el-dialog>
</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>
<span slot="footer" class="dialog-footer">
<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>
</el-dialog>
@ -732,7 +758,7 @@ import {
updateUpkeepOrder
} from "@/api/device/upkeepOrder";
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";
export default {
@ -868,10 +894,50 @@ export default {
this.getList();
},
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() {
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) {
e.showFlag = false;
@ -923,6 +989,7 @@ export default {
return
}
this.form.equipmentItem = [];
//
formatEquItem(this.selectEquList).then(response => {
@ -1002,98 +1069,7 @@ export default {
},
//
changeArray(e) {
console.log(e)
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
}
}
console.log("改变了保养执行时间")
},
//
confirmSelectSpareBtn() {
@ -1206,7 +1182,7 @@ export default {
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
/** 快速工单按钮操作 */
handleAdd() {
this.reset();
this.open = true;
@ -1226,6 +1202,8 @@ export default {
},
/** 提交按钮 */
submitForm() {
console.log("提交按钮")
console.log(this.form)
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.orderId != null) {
@ -1235,11 +1213,13 @@ export default {
this.getList();
});
} else {
addUpkeepOrder(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
console.log("提交按钮")
console.log(this.form)
// addUpkeepOrder(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
}
}
});
@ -1264,3 +1244,17 @@ export default {
}
};
</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