备件申领页面优化

yangwl
wws 12 months ago
parent 60084d99e2
commit 44e0016452

@ -692,11 +692,60 @@
<el-dialog
title="备件领用"
:visible.sync="spareDialog"
width="900px"
width="50%"
append-to-body
>
<!-- 备件申领 -->
<el-row>
<el-col class="my-step-mar" :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="choseSpareBtn">
选择备件
</el-button>
</el-col>
</el-row>
<el-table
border
:data="chooseSpareList"
v-loading="spareLoading"
stripe
style="width: 100%">
<el-table-column
prop="materialCode"
label="备件号">
</el-table-column>
<el-table-column
prop="materialDesc"
label="备件名称">
</el-table-column>
<el-table-column
prop="spareType"
label="备件类型">
</el-table-column>
<el-table-column
prop="applyNum"
label="领用数量">
</el-table-column>
<el-table-column
fixed="right"
label="操作"
>
<template slot-scope="scope">
<el-button @click="delSpareList(scope.row)" type="text" size="small">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 选择备件 -->
<el-dialog
title="选择备件"
:visible.sync="selectSpareDialog"
width="60%"
append-to-body
>
<el-tabs type="border-card">
<el-tab-pane label="备件选择">
<el-form :model="spareQuery" ref="queryBPForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="备件编码">
@ -732,7 +781,7 @@
stripe
@selection-change="selectChangeSpare"
style="width: 100%">
<el-table-column v-if="false" type="selection" width="55" align="center"/>
<el-table-column type="selection" width="55" align="center"/>
<el-table-column
prop="materialCode"
label="备件号">
@ -750,12 +799,14 @@
label="库存数量">
</el-table-column>
<el-table-column
width="150"
fixed="right"
label="操作"
>
prop="storageAmount"
label="冻结数量">
</el-table-column>
<el-table-column
prop="applyNum"
label="领用数量">
<template slot-scope="scope">
<el-button @click="addSpareList(scope.row)" type="text" size="small">添加</el-button>
<el-input size="small" v-model="scope.row.applyNum" @change="handleEdit(scope.$index,scope.row)"></el-input>
</template>
</el-table-column>
</el-table>
@ -769,81 +820,10 @@
/>
<span slot="footer" class="dialog-footer">
<el-button @click="spareDialog = false"> </el-button>
<el-button @click="selectSpareDialog = false"> </el-button>
<el-button type="primary" @click="confirmSelectSpareBtn"> </el-button>
</span>
</el-tab-pane>
<el-tab-pane label="备件数量">
<el-row>
<el-col class="my-step-mar" :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="applyNumDialog = true , applyNum = null">
领用数量
</el-button>
</el-col>
</el-row>
<el-table
:data="chooseSpareList"
v-loading="spareLoading"
stripe
@selection-change="selectChangeSpare"
style="width: 100%">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column
prop="materialCode"
label="备件号">
</el-table-column>
<el-table-column
prop="materialDesc"
label="备件名称">
</el-table-column>
<el-table-column
prop="spareType"
label="备件类型">
</el-table-column>
<el-table-column
prop="amount"
label="库存数量">
</el-table-column>
<el-table-column
prop="applyNum"
label="领用数量">
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.applyNum" @change="handleEdit(scope.$index,scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column
width="150"
fixed="right"
label="操作"
>
<template slot-scope="scope">
<el-button @click="delSpareList(scope.row)" type="text" size="small">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog
title="申领数量"
:visible.sync="applyNumDialog"
width="30%"
append-to-body
>
<el-row>
<el-col :span="8" :offset="7">
<el-input-number v-model="applyNum" @change="changeApplySpareNum" :min="1" label="描述文字"></el-input-number>
</el-col>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button v-if="false" @click="applyNumDialog = false"> </el-button>
<el-button type="primary" @click="applyNumDialog = false"> </el-button>
</span>
</el-dialog>
</el-tab-pane>
<el-button type="primary" class="dialog-footer" @click="spareChangeCom"></el-button>
</el-tabs>
</el-dialog>
</el-tab-pane>
@ -1200,6 +1180,10 @@ export default {
dicts: ['device_order_status', 'device_loop_type','device_reach_standard','device_upkeep_type','device_inspect_status'],
data() {
return {
// list
spareOnList:[],
//
selectSpareDialog:false,
standardListVo:[],
workDetail:false,
// VO
@ -1398,6 +1382,32 @@ export default {
this.getList();
},
methods: {
//
setSpareList() {
querySpareList(this.spareQuery).then(response => {
this.spareTotal = response.total;
this.spareList = response.rows;
this.spareLoading = false;
})
},
// btn
choseSpareBtn(){
//
this.spareOnList = [];
//
this.selectSpareDialog = true;
},
//
handleEdit(index, row) {
// -
if ((Number(row.amount)-Number(row.storageAmount)) < Number(row.applyNum)) {
this.$message({
message: '领用最大数量为:'+(Number(row.amount)-Number(row.storageAmount)),
type: 'warning'
})
row.applyNum = (Number(row.amount)-Number(row.storageAmount));
}
},
//
resetEqu() {
this.equipmentQuery = {
@ -1409,14 +1419,16 @@ export default {
};
this.getEquList();
},
//
handleEdit(index, row) {
if (row.amount < Number(row.applyNum)) {
// -
delSpareList(e) {
for (let i = 0; i < this.chooseSpareList.length; i++){
if (this.chooseSpareList[i].materialCode == e.materialCode) {
this.chooseSpareList.splice(i,1);
this.$message({
message: '超过库存数量!',
type: 'warning'
message: '删除成功',
type: 'success'
})
row.applyNum = row.amount;
}
}
},
//
@ -1664,17 +1676,48 @@ export default {
this.selOnSpare[i].applyNum = e;
}
},
// -
delSpareList(e) {
//
confirmSelectSpareBtn() {
if (this.spareOnList.length == 0) {
this.$message({
message: "请勾选要申领的备件!",
type: "warning"
})
return
}
for (let i = 0; i < this.chooseSpareList.length; i++){
if (this.chooseSpareList[i].materialCode == e.materialCode) {
this.chooseSpareList.splice(i,1);
for (let j = 0; j < this.spareOnList.length; j++) {
if (this.chooseSpareList[i].materialCode == this.spareOnList[j].materialCode) {
this.$message({
message: '删除成功!',
type: 'success'
message: '不可重复添加',
type: 'warning'
})
return;
}
}
}
for (let j = 0; j < this.spareOnList.length; j++) {
if (this.spareOnList[j].applyNum == null) {
this.spareOnList[j].applyNum=1;
}
this.chooseSpareList.push(this.spareOnList[j]);
}
this.$message({
message: '添加成功!',
type: 'success'
})
//
this.selectSpareDialog = false;
},
//
selectChangeSpare(e) {
//
this.spareOnList = [];
//
this.spareOnList = e;
},
// -
addSpareList(e) {
@ -1696,13 +1739,6 @@ export default {
//
changeArray(e) {
},
//
confirmSelectSpareBtn() {
},
//
selectChangeSpare(e) {
this.selOnSpare = e;
},
//
resetSpare() {
this.spareQuery = {
@ -1713,18 +1749,6 @@ export default {
};
this.setSpareList();
},
//
setSpareList() {
querySpareList(this.spareQuery).then(response => {
this.spareTotal = response.total;
this.spareList = response.rows;
// -
for (let i = 0; i < this.spareList.length; i++) {
this.spareList[i].amount = Number(this.spareList[i].amount) - Number(this.spareList[i].storageAmount)
}
this.spareLoading = false;
})
},
//
getSpareList() {
this.setSpareList()

@ -675,8 +675,57 @@
width="50%"
append-to-body
>
<el-tabs type="border-card">
<el-tab-pane label="备件选择">
<!-- 备件申领 -->
<el-row>
<el-col class="my-step-mar" :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="choseSpareBtn">
选择备件
</el-button>
</el-col>
</el-row>
<el-table
border
:data="chooseSpareList"
v-loading="spareLoading"
stripe
style="width: 100%">
<el-table-column
prop="materialCode"
label="备件号">
</el-table-column>
<el-table-column
prop="materialDesc"
label="备件名称">
</el-table-column>
<el-table-column
prop="spareType"
label="备件类型">
</el-table-column>
<el-table-column
prop="applyNum"
label="领用数量">
</el-table-column>
<el-table-column
fixed="right"
label="操作"
>
<template slot-scope="scope">
<el-button @click="delSpareList(scope.row)" type="text" size="small">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 选择备件 -->
<el-dialog
title="选择备件"
:visible.sync="selectSpareDialog"
width="60%"
append-to-body
>
<el-form :model="spareQuery" ref="queryBPForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="备件编码">
@ -712,7 +761,7 @@
stripe
@selection-change="selectChangeSpare"
style="width: 100%">
<el-table-column v-if="false" type="selection" width="55" align="center"/>
<el-table-column type="selection" width="55" align="center"/>
<el-table-column
prop="materialCode"
label="备件号">
@ -730,12 +779,14 @@
label="库存数量">
</el-table-column>
<el-table-column
width="150"
fixed="right"
label="操作"
>
prop="storageAmount"
label="冻结数量">
</el-table-column>
<el-table-column
prop="applyNum"
label="领用数量">
<template slot-scope="scope">
<el-button @click="addSpareList(scope.row)" type="text" size="small">添加</el-button>
<el-input size="small" v-model="scope.row.applyNum" @change="handleEdit(scope.$index,scope.row)"></el-input>
</template>
</el-table-column>
</el-table>
@ -749,81 +800,10 @@
/>
<span slot="footer" class="dialog-footer">
<el-button @click="spareDialog = false"> </el-button>
<el-button @click="selectSpareDialog = false"> </el-button>
<el-button type="primary" @click="confirmSelectSpareBtn"> </el-button>
</span>
</el-tab-pane>
<el-tab-pane label="备件数量">
<el-row>
<el-col class="my-step-mar" :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="applyNumDialog = true , applyNum = null">
领用数量
</el-button>
</el-col>
</el-row>
<el-table
:data="chooseSpareList"
v-loading="spareLoading"
stripe
@selection-change="selectChangeSpare"
style="width: 100%">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column
prop="materialCode"
label="备件号">
</el-table-column>
<el-table-column
prop="materialDesc"
label="备件名称">
</el-table-column>
<el-table-column
prop="spareType"
label="备件类型">
</el-table-column>
<el-table-column
prop="amount"
label="库存数量">
</el-table-column>
<el-table-column
prop="applyNum"
label="领用数量">
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.applyNum" @change="handleEdit(scope.$index,scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column
width="150"
fixed="right"
label="操作"
>
<template slot-scope="scope">
<el-button @click="delSpareList(scope.row)" type="text" size="small">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog
title="申领数量"
:visible.sync="applyNumDialog"
width="30%"
append-to-body
>
<el-row>
<el-col :span="8" :offset="7">
<el-input-number v-model="applyNum" @change="changeApplySpareNum" :min="1" label="描述文字"></el-input-number>
</el-col>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button v-if="false" @click="applyNumDialog = false"> </el-button>
<el-button type="primary" @click="applyNumDialog = false"> </el-button>
</span>
</el-dialog>
</el-tab-pane>
<el-button type="primary" class="dialog-footer" @click="spareChangeCom"></el-button>
</el-tabs>
</el-dialog>
@ -895,13 +875,25 @@ import {
updateUpkeepPlan,
formatEquItem, setSpareList, querySpareList
} from "@/api/device/upkeepPlan";
import {delPlan, getEquList, getPersonList, getWorkCenter, initUpdatePlanInfo, listPlan} from "@/api/device/plan";
import {
addPlan,
delPlan,
getEquList,
getPersonList,
getWorkCenter,
initUpdatePlanInfo,
listPlan, updatePlan
} from "@/api/device/plan";
export default {
name: "UpkeepPlan",
dicts: ['device_loop_type', 'sys_normal_disable','device_upkeep_type'],
data() {
return {
// list
spareOnList:[],
//
selectSpareDialog:false,
//
pickerOptions: {
shortcuts: [{
@ -1061,14 +1053,22 @@ export default {
this.setWorkCenter();
},
methods: {
// btn
choseSpareBtn(){
//
this.spareOnList = [];
//
this.selectSpareDialog = true;
},
//
handleEdit(index, row) {
if (row.amount < Number(row.applyNum)) {
// -
if ((Number(row.amount)-Number(row.storageAmount)) < Number(row.applyNum)) {
this.$message({
message: '超过库存数量!',
message: '领用最大数量为:'+(Number(row.amount)-Number(row.storageAmount)),
type: 'warning'
})
row.applyNum = row.amount;
row.applyNum = (Number(row.amount)-Number(row.storageAmount));
}
},
//
@ -1212,10 +1212,46 @@ export default {
},
//
confirmSelectSpareBtn() {
if (this.spareOnList.length == 0) {
this.$message({
message: "请勾选要申领的备件!",
type: "warning"
})
return
}
for (let i = 0; i < this.chooseSpareList.length; i++){
for (let j = 0; j < this.spareOnList.length; j++) {
if (this.chooseSpareList[i].materialCode == this.spareOnList[j].materialCode) {
this.$message({
message: '不可重复添加!',
type: 'warning'
})
return;
}
}
}
for (let j = 0; j < this.spareOnList.length; j++) {
if (this.spareOnList[j].applyNum == null) {
this.spareOnList[j].applyNum=1;
}
this.chooseSpareList.push(this.spareOnList[j]);
}
this.$message({
message: '添加成功!',
type: 'success'
})
//
this.selectSpareDialog = false;
},
//
selectChangeSpare(e) {
this.selOnSpare = e;
//
this.spareOnList = [];
//
this.spareOnList = e;
},
//
resetSpare() {
@ -1232,10 +1268,6 @@ export default {
querySpareList(this.spareQuery).then(response => {
this.spareTotal = response.total;
this.spareList = response.rows;
// -
for (let i = 0; i < this.spareList.length; i++) {
this.spareList[i].amount = Number(this.spareList[i].amount) - Number(this.spareList[i].storageAmount)
}
this.spareLoading = false;
})
},
@ -1629,7 +1661,7 @@ export default {
this.planLoading = true;
if (this.form.planId != null) {
this.form.personList = this.selectPersonList;
updateUpkeepPlan(this.form).then(response => {
updatePlan(this.form).then(response => {
this.planLoading = false;
this.$modal.msgSuccess("修改成功");
this.open = false;
@ -1637,7 +1669,7 @@ export default {
});
} else {
this.form.personList = this.selectPersonList;
addUpkeepPlan(this.form).then(response => {
addPlan(this.form).then(response => {
this.planLoading = false;
this.$modal.msgSuccess("新增成功");
this.open = false;

Loading…
Cancel
Save