diff --git a/src/views/device/upkeepOrder/index.vue b/src/views/device/upkeepOrder/index.vue
index 3e7b818..16612eb 100644
--- a/src/views/device/upkeepOrder/index.vue
+++ b/src/views/device/upkeepOrder/index.vue
@@ -692,158 +692,138 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- 搜索
- 重置
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 添加
-
-
-
+
+
+
+
+ 选择备件
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- 领用数量
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 删除
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -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)) {
- this.$message({
- message: '超过库存数量!',
- type: 'warning'
- })
- row.applyNum = row.amount;
+ // 删除备件-备件数量
+ 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: 'success'
+ })
+ }
}
},
// 展示
@@ -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);
- this.$message({
- message: '删除成功!',
- type: 'success'
- })
+ 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.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()
diff --git a/src/views/device/upkeepPlan/index.vue b/src/views/device/upkeepPlan/index.vue
index 8693446..4d7f8dc 100644
--- a/src/views/device/upkeepPlan/index.vue
+++ b/src/views/device/upkeepPlan/index.vue
@@ -675,155 +675,135 @@
width="50%"
append-to-body
>
-
-
-
-
-
-
-
-
-
-
-
-
-
- 搜索
- 重置
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 添加
-
-
-
+
+
+
+
+ 选择备件
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- 领用数量
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 删除
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -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;