2024-1-23-2 设备模块-申领备件等bug-临时任务

master
A0010407 10 months ago
parent ba48f3c0ad
commit f43ef0b3c1

@ -190,8 +190,9 @@ export default {
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams.equipmentTypeCode = null;
this.resetForm("queryForm"); this.resetForm("queryForm");
this.queryParams.itemCode = null;
this.queryParams.itemName = null;
this.handleQuery(); this.handleQuery();
}, },
@ -203,6 +204,11 @@ export default {
this.multiple = !selection.length; this.multiple = !selection.length;
}, },
cancel() {
this.showFlag = false;
this.resetQuery();
},
submitForm() { submitForm() {
if (this.$refs.multipleTable.selection.length > 1) { if (this.$refs.multipleTable.selection.length > 1) {
Message.warning("只能选择一个维修人,请勿选择多个!"); Message.warning("只能选择一个维修人,请勿选择多个!");
@ -210,7 +216,7 @@ export default {
console.log(this.$refs.multipleTable.selection); console.log(this.$refs.multipleTable.selection);
this.$emit("onSelected", this.$refs.multipleTable.selection); this.$emit("onSelected", this.$refs.multipleTable.selection);
this.showFlag = false; this.showFlag = false;
this.getList(); this.resetQuery();
} }
}, },
}, },

@ -248,8 +248,6 @@ export default {
}, },
/** 查询备品备件台账管理列表 */ /** 查询备品备件台账管理列表 */
getList() { getList() {
this.sparePartsLedgerList = null;
this.total = 0;
this.loading = true; this.loading = true;
listSparePartsLedger(this.queryParams).then((response) => { listSparePartsLedger(this.queryParams).then((response) => {
this.sparePartsLedgerList = response.rows; this.sparePartsLedgerList = response.rows;
@ -260,8 +258,7 @@ export default {
// //
cancel() { cancel() {
this.showFlag = false; this.showFlag = false;
this.reset(); this.resetQuery();
this.getList();
}, },
// //
reset() { reset() {
@ -331,6 +328,7 @@ export default {
this.single = selection.length !== 1; this.single = selection.length !== 1;
this.multiple = !selection.length; this.multiple = !selection.length;
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
console.log("data:", this.sparePartsLedgerList); console.log("data:", this.sparePartsLedgerList);
@ -338,16 +336,21 @@ export default {
this.$refs.multipleTable.selection.forEach((item) => { this.$refs.multipleTable.selection.forEach((item) => {
if (item.spareQuantity > item.amount - item.storageAmount) { if (item.spareQuantity > item.amount - item.storageAmount) {
Message.warning( Message.warning(
'备件编码"' + '申领失败!备件编码"' +
item.materialCode + item.materialCode +
'"的申领数量大于可用数量,请重新填写!' '"的申领数量大于可用数量,请重新填写!'
); );
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
} }
if(item.spareQuantity == null){
Message.warning('申领失败!请填写"'+item.materialCode+'"的申领数量!');
this.$refs.multipleTable.clearSelection();
}
}); });
this.$emit("onSelected", this.$refs.multipleTable.selection); this.$emit("onSelected", this.$refs.multipleTable.selection);
this.showFlag = false; this.showFlag = false;
this.getList(); //
this.resetQuery();
}, },
}, },
}; };

@ -548,7 +548,7 @@ export default {
}, },
// //
onItemSelectedPerson(obj) { onItemSelectedPerson(obj) {
this.form.applyPeople = obj; this.form.applyPeople = obj[0].userName;;
}, },
// //
indexMethod(index) { indexMethod(index) {

@ -6,7 +6,7 @@
:modal="false" :modal="false"
width="800px" width="800px"
center center
:before-close="cancelEquipmentForm" :before-close="cancel"
> >
<el-row :gutter="20"> <el-row :gutter="20">
<!--人员数据--> <!--人员数据-->
@ -53,8 +53,8 @@
<el-table <el-table
v-loading="loading" v-loading="loading"
:data="itemList" :data="itemList"
@selection-change="handleEquipmentSelectionChange" @selection-change="handleSelectionChange"
ref="myTable" ref="multipleTable"
> >
<el-table-column <el-table-column
width="50" width="50"
@ -75,7 +75,8 @@
key="itemCode" key="itemCode"
prop="userName" prop="userName"
v-if="columns[0].visible" v-if="columns[0].visible"
></el-table-column> >
</el-table-column>
<el-table-column <el-table-column
label="人员名称" label="人员名称"
align="left" align="left"
@ -96,14 +97,16 @@
</el-col> </el-col>
</el-row> </el-row>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitPersonForm"> </el-button> <el-button type="primary" @click="submitForm" :disabled="multiple"
<el-button @click="cancelEquipmentForm"> </el-button> > </el-button
>
<el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { getMaintenancePersonList } from "@/api/device/repairOrder"; import { getRepairPersonList } from "@/api/device/faultReport";
import { Message } from "element-ui"; import { Message } from "element-ui";
export default { export default {
@ -132,6 +135,8 @@ export default {
itemName: undefined, itemName: undefined,
itemCodeGet: "", itemCodeGet: "",
itemCode: undefined, itemCode: undefined,
nickName: null,
userName: null,
}, },
// //
columns: [ columns: [
@ -155,7 +160,7 @@ export default {
this.resetForm("form"); this.resetForm("form");
}, },
handleEquipmentSelectionChange(val) { handleSelectionChange(val) {
this.itemList = val; this.itemList = val;
}, },
@ -165,24 +170,18 @@ export default {
}, },
// //
/** 查询设备编码列表*/ /** 查询人员列表*/
getList() { getList() {
this.loading = true; this.loading = true;
getMaintenancePersonList(this.queryParams).then((response) => { this.queryParams.userName = this.queryParams.itemCode;
this.queryParams.nickName = this.queryParams.itemName;
getRepairPersonList(this.queryParams).then((response) => {
this.itemList = response.rows; this.itemList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });
}, },
//
handleNodeClick(data) {
console.log("id", data.id);
this.queryParams.equipmentTypeCode = data.equipmentTypeCode;
console.log(this.equipmentTypeCode);
this.handleQuery();
},
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
@ -191,33 +190,33 @@ export default {
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams.equipmentTypeCode = null;
this.resetForm("queryForm"); this.resetForm("queryForm");
this.queryParams.itemCode = null;
this.queryParams.itemName = null;
this.handleQuery(); this.handleQuery();
}, },
// //
handleEquipmentSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map((item) => item.nickName); this.ids = selection.map((item) => item.userId);
this.userCodes = selection.map((item) => item.userName);
this.single = selection.length !== 1; this.single = selection.length !== 1;
this.multiple = !selection.length; this.multiple = !selection.length;
console.log("多选框", this.ids);
}, },
submitPersonForm() { cancel() {
const data = this.ids; this.showFlag = false;
const nickName = data.toString(); this.resetQuery();
if (data.length > 1) { },
submitForm() {
if (this.$refs.multipleTable.selection.length > 1) {
Message.warning("只能选择一个维修人,请勿选择多个!"); Message.warning("只能选择一个维修人,请勿选择多个!");
} else { } else {
if (this.queryParams.itemCodeGet == "") { console.log(this.$refs.multipleTable.selection);
this.queryParams.itemCodeGet = nickName; this.$emit("onSelected", this.$refs.multipleTable.selection);
}
this.selectedRows = this.queryParams.itemCodeGet;
this.$emit("onSelected", this.selectedRows);
this.getList();
this.showFlag = false; this.showFlag = false;
this.queryParams.itemCodeGet = ""; this.resetQuery();
} }
}, },
}, },

@ -245,8 +245,6 @@ export default {
}, },
/** 查询备品备件台账管理列表 */ /** 查询备品备件台账管理列表 */
getList() { getList() {
this.sparePartsLedgerList = null;
this.total = 0;
this.loading = true; this.loading = true;
listSparePartsLedger(this.queryParams).then((response) => { listSparePartsLedger(this.queryParams).then((response) => {
this.sparePartsLedgerList = response.rows; this.sparePartsLedgerList = response.rows;
@ -258,6 +256,7 @@ export default {
cancel() { cancel() {
this.showFlag = false; this.showFlag = false;
this.reset(); this.reset();
this.resetQuery();
}, },
// //
reset() { reset() {
@ -338,7 +337,8 @@ export default {
} else { } else {
this.$emit("onSelected", this.$refs.multipleTable.selection); this.$emit("onSelected", this.$refs.multipleTable.selection);
this.showFlag = false; this.showFlag = false;
this.getList(); //
this.resetQuery();
} }
}, },
}, },

Loading…
Cancel
Save