备件申领页面优化

yangwl
wws 12 months ago
parent 60084d99e2
commit 44e0016452

@ -692,158 +692,138 @@
<el-dialog <el-dialog
title="备件领用" title="备件领用"
:visible.sync="spareDialog" :visible.sync="spareDialog"
width="900px" width="50%"
append-to-body append-to-body
> >
<el-tabs type="border-card"> <!-- 备件申领 -->
<el-tab-pane label="备件选择"> <el-row>
<el-form :model="spareQuery" ref="queryBPForm" size="small" :inline="true" v-show="showSearch" <el-col class="my-step-mar" :span="1.5">
label-width="68px"> <el-button
<el-form-item label="备件编码"> type="primary"
<el-input plain
v-model="spareQuery.materialCode" size="mini"
placeholder="请输入备件编码" @click="choseSpareBtn">
clearable 选择备件
/> </el-button>
</el-form-item> </el-col>
<el-form-item label="备件名称"> </el-row>
<el-input <el-table
v-model="spareQuery.materialDesc" border
placeholder="请输入备件名称" :data="chooseSpareList"
clearable v-loading="spareLoading"
/> stripe
</el-form-item> style="width: 100%">
<el-form-item v-if="false" label="备件类型"> <el-table-column
<el-input prop="materialCode"
v-model="spareQuery.spareType" label="备件号">
placeholder="请输入备件类型" </el-table-column>
clearable <el-table-column
/> prop="materialDesc"
</el-form-item> label="备件名称">
<el-form-item> </el-table-column>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getSpareList"></el-button> <el-table-column
<el-button icon="el-icon-refresh" size="mini" @click="resetSpare"></el-button> prop="spareType"
</el-form-item> label="备件类型">
</el-form> </el-table-column>
<!-- 搜索-备件列表 --> <el-table-column
<el-table prop="applyNum"
:data="spareList" label="领用数量">
v-loading="spareLoading" </el-table-column>
stripe <el-table-column
@selection-change="selectChangeSpare" fixed="right"
style="width: 100%"> label="操作"
<el-table-column v-if="false" type="selection" width="55" align="center"/> >
<el-table-column <template slot-scope="scope">
prop="materialCode" <el-button @click="delSpareList(scope.row)" type="text" size="small">删除</el-button>
label="备件号"> </template>
</el-table-column> </el-table-column>
<el-table-column </el-table>
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
width="150"
fixed="right"
label="操作"
>
<template slot-scope="scope">
<el-button @click="addSpareList(scope.row)" type="text" size="small">添加</el-button>
</template>
</el-table-column>
</el-table>
<pagination <!-- 选择备件 -->
v-show="spareTotal>0" <el-dialog
:total="spareTotal" title="选择备件"
:page.sync="spareQuery.pageNum" :visible.sync="selectSpareDialog"
:limit.sync="spareQuery.pageSize" width="60%"
@pagination="getSpareList" append-to-body
/> >
<el-form :model="spareQuery" ref="queryBPForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="备件编码">
<el-input
v-model="spareQuery.materialCode"
placeholder="请输入备件编码"
clearable
/>
</el-form-item>
<el-form-item label="备件名称">
<el-input
v-model="spareQuery.materialDesc"
placeholder="请输入备件名称"
clearable
/>
</el-form-item>
<el-form-item v-if="false" label="备件类型">
<el-input
v-model="spareQuery.spareType"
placeholder="请输入备件类型"
clearable
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getSpareList"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetSpare"></el-button>
</el-form-item>
</el-form>
<!-- 搜索-备件列表 -->
<el-table
:data="spareList"
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="storageAmount"
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>
<pagination
v-show="spareTotal>0"
:total="spareTotal"
:page.sync="spareQuery.pageNum"
:limit.sync="spareQuery.pageSize"
@pagination="getSpareList"
/>
<span slot="footer" class="dialog-footer"> <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> <el-button type="primary" @click="confirmSelectSpareBtn"> </el-button>
</span> </span>
</el-tab-pane> </el-dialog>
<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-dialog>
</el-tab-pane> </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'], dicts: ['device_order_status', 'device_loop_type','device_reach_standard','device_upkeep_type','device_inspect_status'],
data() { data() {
return { return {
// list
spareOnList:[],
//
selectSpareDialog:false,
standardListVo:[], standardListVo:[],
workDetail:false, workDetail:false,
// VO // VO
@ -1398,6 +1382,32 @@ export default {
this.getList(); this.getList();
}, },
methods: { 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() { resetEqu() {
this.equipmentQuery = { this.equipmentQuery = {
@ -1409,14 +1419,16 @@ export default {
}; };
this.getEquList(); this.getEquList();
}, },
// // -
handleEdit(index, row) { delSpareList(e) {
if (row.amount < Number(row.applyNum)) { for (let i = 0; i < this.chooseSpareList.length; i++){
this.$message({ if (this.chooseSpareList[i].materialCode == e.materialCode) {
message: '超过库存数量!', this.chooseSpareList.splice(i,1);
type: 'warning' this.$message({
}) message: '删除成功!',
row.applyNum = row.amount; type: 'success'
})
}
} }
}, },
// //
@ -1664,17 +1676,48 @@ export default {
this.selOnSpare[i].applyNum = e; 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++){ for (let i = 0; i < this.chooseSpareList.length; i++){
if (this.chooseSpareList[i].materialCode == e.materialCode) { for (let j = 0; j < this.spareOnList.length; j++) {
this.chooseSpareList.splice(i,1); if (this.chooseSpareList[i].materialCode == this.spareOnList[j].materialCode) {
this.$message({ this.$message({
message: '删除成功!', message: '不可重复添加!',
type: 'success' 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) { addSpareList(e) {
@ -1696,13 +1739,6 @@ export default {
// //
changeArray(e) { changeArray(e) {
}, },
//
confirmSelectSpareBtn() {
},
//
selectChangeSpare(e) {
this.selOnSpare = e;
},
// //
resetSpare() { resetSpare() {
this.spareQuery = { this.spareQuery = {
@ -1713,18 +1749,6 @@ export default {
}; };
this.setSpareList(); 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() { getSpareList() {
this.setSpareList() this.setSpareList()

@ -675,155 +675,135 @@
width="50%" width="50%"
append-to-body append-to-body
> >
<el-tabs type="border-card"> <!-- 备件申领 -->
<el-tab-pane label="备件选择"> <el-row>
<el-form :model="spareQuery" ref="queryBPForm" size="small" :inline="true" v-show="showSearch" <el-col class="my-step-mar" :span="1.5">
label-width="68px"> <el-button
<el-form-item label="备件编码"> type="primary"
<el-input plain
v-model="spareQuery.materialCode" size="mini"
placeholder="请输入备件编码" @click="choseSpareBtn">
clearable 选择备件
/> </el-button>
</el-form-item> </el-col>
<el-form-item label="备件名称"> </el-row>
<el-input <el-table
v-model="spareQuery.materialDesc" border
placeholder="请输入备件名称" :data="chooseSpareList"
clearable v-loading="spareLoading"
/> stripe
</el-form-item> style="width: 100%">
<el-form-item v-if="false" label="备件类型"> <el-table-column
<el-input prop="materialCode"
v-model="spareQuery.spareType" label="备件号">
placeholder="请输入备件类型" </el-table-column>
clearable <el-table-column
/> prop="materialDesc"
</el-form-item> label="备件名称">
<el-form-item> </el-table-column>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getSpareList"></el-button> <el-table-column
<el-button icon="el-icon-refresh" size="mini" @click="resetSpare"></el-button> prop="spareType"
</el-form-item> label="备件类型">
</el-form> </el-table-column>
<!-- 搜索-备件列表 --> <el-table-column
<el-table prop="applyNum"
:data="spareList" label="领用数量">
v-loading="spareLoading" </el-table-column>
stripe <el-table-column
@selection-change="selectChangeSpare" fixed="right"
style="width: 100%"> label="操作"
<el-table-column v-if="false" type="selection" width="55" align="center"/> >
<el-table-column <template slot-scope="scope">
prop="materialCode" <el-button @click="delSpareList(scope.row)" type="text" size="small">删除</el-button>
label="备件号"> </template>
</el-table-column> </el-table-column>
<el-table-column </el-table>
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
width="150"
fixed="right"
label="操作"
>
<template slot-scope="scope">
<el-button @click="addSpareList(scope.row)" type="text" size="small">添加</el-button>
</template>
</el-table-column>
</el-table>
<pagination <!-- 选择备件 -->
v-show="spareTotal>0" <el-dialog
:total="spareTotal" title="选择备件"
:page.sync="spareQuery.pageNum" :visible.sync="selectSpareDialog"
:limit.sync="spareQuery.pageSize" width="60%"
@pagination="getSpareList" append-to-body
/> >
<el-form :model="spareQuery" ref="queryBPForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="备件编码">
<el-input
v-model="spareQuery.materialCode"
placeholder="请输入备件编码"
clearable
/>
</el-form-item>
<el-form-item label="备件名称">
<el-input
v-model="spareQuery.materialDesc"
placeholder="请输入备件名称"
clearable
/>
</el-form-item>
<el-form-item v-if="false" label="备件类型">
<el-input
v-model="spareQuery.spareType"
placeholder="请输入备件类型"
clearable
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getSpareList"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetSpare"></el-button>
</el-form-item>
</el-form>
<!-- 搜索-备件列表 -->
<el-table
:data="spareList"
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="storageAmount"
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>
<pagination
v-show="spareTotal>0"
:total="spareTotal"
:page.sync="spareQuery.pageNum"
:limit.sync="spareQuery.pageSize"
@pagination="getSpareList"
/>
<span slot="footer" class="dialog-footer"> <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> <el-button type="primary" @click="confirmSelectSpareBtn"> </el-button>
</span> </span>
</el-tab-pane> </el-dialog>
<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-dialog>
@ -895,13 +875,25 @@ import {
updateUpkeepPlan, updateUpkeepPlan,
formatEquItem, setSpareList, querySpareList formatEquItem, setSpareList, querySpareList
} from "@/api/device/upkeepPlan"; } 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 { export default {
name: "UpkeepPlan", name: "UpkeepPlan",
dicts: ['device_loop_type', 'sys_normal_disable','device_upkeep_type'], dicts: ['device_loop_type', 'sys_normal_disable','device_upkeep_type'],
data() { data() {
return { return {
// list
spareOnList:[],
//
selectSpareDialog:false,
// //
pickerOptions: { pickerOptions: {
shortcuts: [{ shortcuts: [{
@ -1061,14 +1053,22 @@ export default {
this.setWorkCenter(); this.setWorkCenter();
}, },
methods: { methods: {
// btn
choseSpareBtn(){
//
this.spareOnList = [];
//
this.selectSpareDialog = true;
},
// //
handleEdit(index, row) { handleEdit(index, row) {
if (row.amount < Number(row.applyNum)) { // -
if ((Number(row.amount)-Number(row.storageAmount)) < Number(row.applyNum)) {
this.$message({ this.$message({
message: '超过库存数量!', message: '领用最大数量为:'+(Number(row.amount)-Number(row.storageAmount)),
type: 'warning' type: 'warning'
}) })
row.applyNum = row.amount; row.applyNum = (Number(row.amount)-Number(row.storageAmount));
} }
}, },
// //
@ -1212,10 +1212,46 @@ export default {
}, },
// //
confirmSelectSpareBtn() { 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) { selectChangeSpare(e) {
this.selOnSpare = e; //
this.spareOnList = [];
//
this.spareOnList = e;
}, },
// //
resetSpare() { resetSpare() {
@ -1232,10 +1268,6 @@ export default {
querySpareList(this.spareQuery).then(response => { querySpareList(this.spareQuery).then(response => {
this.spareTotal = response.total; this.spareTotal = response.total;
this.spareList = response.rows; 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; this.spareLoading = false;
}) })
}, },
@ -1629,7 +1661,7 @@ export default {
this.planLoading = true; this.planLoading = true;
if (this.form.planId != null) { if (this.form.planId != null) {
this.form.personList = this.selectPersonList; this.form.personList = this.selectPersonList;
updateUpkeepPlan(this.form).then(response => { updatePlan(this.form).then(response => {
this.planLoading = false; this.planLoading = false;
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
@ -1637,7 +1669,7 @@ export default {
}); });
} else { } else {
this.form.personList = this.selectPersonList; this.form.personList = this.selectPersonList;
addUpkeepPlan(this.form).then(response => { addPlan(this.form).then(response => {
this.planLoading = false; this.planLoading = false;
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;

Loading…
Cancel
Save