库管员配置 维修员配置 优化

This commit is contained in:
bb_pan 2025-06-16 10:32:53 +08:00
parent 1295d87dd9
commit 4fe534d843
3 changed files with 51 additions and 34 deletions

View File

@ -229,3 +229,12 @@ export function delConfigDetails(data) {
data data
}) })
} }
// 配件1-2级树
export function getPartTreeApi(data) {
return request({
url: '/material/ma_part_type/getPartTree',
method: 'get',
params: data
})
}

View File

@ -256,7 +256,7 @@ export default {
data() { data() {
return { return {
// //
loading: true, loading: false,
// //
ids: [], ids: [],
// //
@ -458,11 +458,11 @@ export default {
this.treeOptionsTwo = response.data; this.treeOptionsTwo = response.data;
if ( if (
this.treeOptionsTwo.length > 0 && this.treeOptionsTwo.length > 0 &&
this.treeOptionsTwo[0].children.length > 0 this.treeOptionsTwo[0].children && this.treeOptionsTwo[0].children.length > 0
) { ) {
const firstNode = this.treeOptionsTwo[0].children[0]; const firstNode = this.treeOptionsTwo[0].children[0];
this.queryParams.typeId = firstNode.id; this.queryParams.typeId = firstNode.id;
this.queryParams.level = 1; this.queryParams.level = firstNode.level
this.queryParams.houseId = firstNode.houseId; this.queryParams.houseId = firstNode.houseId;
this.getList(); this.getList();
} }
@ -473,11 +473,20 @@ export default {
this.loading = true; this.loading = true;
this.queryParams.displayBindRelationship = "true"; this.queryParams.displayBindRelationship = "true";
console.log("queryParams1", this.queryParams); console.log("queryParams1", this.queryParams);
await getListByMaType(this.queryParams).then((response) => { try {
this.typeList = response.data.rows; const res = await getListByMaType(this.queryParams)
this.total = response.data.total; this.loading = false
this.loading = false; if (!res.data || !res.data.rows) {
}); this.typeList = []
this.total = 0
return
}
this.typeList = res.data.rows
this.total = res.data.total
} catch (error) {
console.log('🚀 ~ getList ~ error:', error)
this.loading = false
}
}, },
// - // -
filterNode(value, data) { filterNode(value, data) {
@ -500,15 +509,9 @@ export default {
}, },
// - // -
async handleNodeClickTwo(data, node) { async handleNodeClickTwo(data, node) {
if (data.level == 0) { this.queryParams.typeId = data.id;
this.queryParams.typeId = data.id; this.queryParams.level = data.level;
this.queryParams.level = data.level; this.queryParams.houseId = data.houseId;
this.queryParams.houseId = data.id;
} else {
this.queryParams.typeId = data.id;
this.queryParams.level = data.level;
this.queryParams.houseId = data.houseId;
}
this.handleQuery(); this.handleQuery();
}, },

View File

@ -255,7 +255,7 @@ export default {
data() { data() {
return { return {
// //
loading: true, loading: false,
// //
ids: [], ids: [],
// //
@ -408,11 +408,12 @@ export default {
this.treeOptionsTwo = response.data; this.treeOptionsTwo = response.data;
if ( if (
this.treeOptionsTwo.length > 0 && this.treeOptionsTwo.length > 0 &&
this.treeOptionsTwo[0].children.length > 0 this.treeOptionsTwo[0].children && this.treeOptionsTwo[0].children.length > 0
) { ) {
const firstNode = this.treeOptionsTwo[0].children[0]; const firstNode = this.treeOptionsTwo[0].children[0];
// console.log('🚀 ~ getMaTypeList ~ firstNode:', firstNode)
this.queryParams.typeId = firstNode.id; this.queryParams.typeId = firstNode.id;
this.queryParams.level = 1; this.queryParams.level = firstNode.level
this.queryParams.houseId = firstNode.houseId; this.queryParams.houseId = firstNode.houseId;
this.getList(); this.getList();
} }
@ -422,11 +423,20 @@ export default {
async getList() { async getList() {
this.loading = true; this.loading = true;
this.queryParams.displayBindRelationship = "true"; this.queryParams.displayBindRelationship = "true";
await getListByMaType(this.queryParams).then((response) => { try {
this.typeList = response.data.rows; const res = await getListByMaType(this.queryParams)
this.total = response.data.total; this.loading = false
this.loading = false; if (!res.data || !res.data.rows) {
}); this.typeList = []
this.total = 0
return
}
this.typeList = res.data.rows
this.total = res.data.total
} catch (error) {
console.log('🚀 ~ getList ~ error:', error)
this.loading = false
}
}, },
// - // -
filterNode(value, data) { filterNode(value, data) {
@ -449,15 +459,10 @@ export default {
}, },
// - // -
async handleNodeClickTwo(data, node) { async handleNodeClickTwo(data, node) {
if (data.level == 0) { // console.log('🚀 ~ handleNodeClickTwo ~ data:', data)
this.queryParams.typeId = data.id; this.queryParams.typeId = data.id;
this.queryParams.level = data.level; this.queryParams.level = data.level;
this.queryParams.houseId = data.id; this.queryParams.houseId = data.houseId;
} else {
this.queryParams.typeId = data.id;
this.queryParams.level = data.level;
this.queryParams.houseId = data.houseId;
}
this.handleQuery(); this.handleQuery();
}, },