From d13067b35314847076290e2e21055210fd9a3b42 Mon Sep 17 00:00:00 2001
From: zzyuan <781948537@qq.com>
Date: Wed, 28 Jan 2026 18:16:16 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=97=AE=E9=A2=98=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/EquipmentLedger/index.vue | 21 +++++--
.../entryApply/components/AddEquip.vue | 28 ++++++---
.../toolsManage/codeToolsLedger/index.vue | 58 ++++++++++++++++---
3 files changed, 84 insertions(+), 23 deletions(-)
diff --git a/src/views/EquipmentLedger/index.vue b/src/views/EquipmentLedger/index.vue
index f7cc005e..ffdd9ef0 100644
--- a/src/views/EquipmentLedger/index.vue
+++ b/src/views/EquipmentLedger/index.vue
@@ -296,7 +296,15 @@
-
+
+
+
+
@@ -311,7 +319,7 @@
-
+
@@ -895,6 +903,7 @@ import AddEquip from '@/views/stockManagement/entryApply/components/AddEquip'
export default {
name: 'EquipmentLedger',
+ dicts: ['user_year_type'],
components: { AddEquip, QrcodeGenerator },
data() {
return {
@@ -1230,10 +1239,10 @@ export default {
* 重置查询条件
*/
resetQuery() {
- this.$refs.queryForm.resetFields()
- this.queryParams.minOriginalValue = ''
- this.queryParams.maxOriginalValue = ''
+ this.queryParams.minOriginalValue = undefined
+ this.queryParams.maxOriginalValue = undefined
this.queryParams.propertyUnitId = undefined
+ this.$refs.queryForm.resetFields()
this.queryParams.pageNum = 1
this.getDeviceList()
},
diff --git a/src/views/stockManagement/entryApply/components/AddEquip.vue b/src/views/stockManagement/entryApply/components/AddEquip.vue
index 167a4d7f..47bf6362 100644
--- a/src/views/stockManagement/entryApply/components/AddEquip.vue
+++ b/src/views/stockManagement/entryApply/components/AddEquip.vue
@@ -856,15 +856,7 @@ export default {
: ''
this.form.process = [String(res.data.mainProcessId), String(res.data.subProcessId)].filter(Boolean)
console.log('🚀 ~ getInfo ~ this.form.process:', this.form.process)
- const ids = []
- if (res.data?.parentId) {
- ids.push(res.data.parentId)
- }
- if (res.data?.propertyUnitId) {
- ids.push(res.data.propertyUnitId)
- }
- this.form.propertyUnitIds = [...ids.map(Number)]
-
+ this.form.propertyUnitIds = this.findParentsTailRecursive(this.propertyUnitList,res.data.propertyUnitId)
if (res.data.branchId) {
this.form.category = [
String(res.data.mainCategoryId),
@@ -895,6 +887,24 @@ export default {
console.log('🚀 ~ getInfo ~ error:', error)
}
},
+ //根据树形数据中的id获取所有父级id
+ findParentsTailRecursive(tree, id, parents = [], index = 0) {
+ if (index >= tree.length) {
+ return null;
+ }
+ const currentNode = tree[index];
+ const updatedParents = parents.concat(currentNode.id);
+ if (currentNode.id=== id) {
+ return updatedParents;
+ }
+ if (currentNode.children) {
+ const result =this.findParentsTailRecursive(currentNode.children, id, updatedParents);
+ if (result) {
+ return result; // 这里直接返回递归调用的结果
+ }
+ }
+ return this.findParentsTailRecursive(tree, id, parents, index + 1);
+ },
handleUnitChange(value) {
if (value.length === 0) {
this.form.propertyUnitId = undefined
diff --git a/src/views/toolsManage/codeToolsLedger/index.vue b/src/views/toolsManage/codeToolsLedger/index.vue
index 7817bcf6..658e0814 100644
--- a/src/views/toolsManage/codeToolsLedger/index.vue
+++ b/src/views/toolsManage/codeToolsLedger/index.vue
@@ -260,6 +260,18 @@
style="width: 240px"
/>
+
+
+
+
@@ -500,6 +512,7 @@ export default {
identifyCode: '',
nextCheckDate: '',
statusName: '',
+ propertyUnitIds:[],
propertyVoList: [],
// fileList: [], // 初始化文件列表为数组
certificateList: '',
@@ -532,20 +545,46 @@ export default {
await this.getDeptTreeSelect().catch(() => {})
const params = this.$route.query
this.queryParams.propertyUnitId = params?.deptId || ''
- const ids = []
- if (params?.parentId) {
- ids.push(params.parentId)
- }
- if (params?.deptId) {
- ids.push(params.deptId)
- }
- this.queryParams.propertyUnitIds = [...ids.map(Number)]
+ // const ids = []
+ // if (params?.parentId) {
+ // ids.push(params.parentId)
+ // }
+ // if (params?.deptId) {
+ // ids.push(params.deptId)
+ // }
+ // this.queryParams.propertyUnitIds = [...ids.map(Number)]
+ this.queryParams.propertyUnitIds = this.findParentsTailRecursive(this.propertyUnitList,params.deptId)
this.getList()
this.getSelectList()
this.columns2 = [...this.tableColumns];
},
methods: {
+ //根据树形数据中的id获取所有父级id
+ findParentsTailRecursive(tree, id, parents = [], index = 0) {
+ if (index >= tree.length) {
+ return null;
+ }
+ const currentNode = tree[index];
+ const updatedParents = parents.concat(currentNode.id);
+ if (currentNode.id== id) {
+ return updatedParents;
+ }
+ if (currentNode.children) {
+ const result =this.findParentsTailRecursive(currentNode.children, id, updatedParents);
+ if (result) {
+ return result; // 这里直接返回递归调用的结果
+ }
+ }
+ return this.findParentsTailRecursive(tree, id, parents, index + 1);
+ },
+ handleUnitChange2(value) {
+ if (value.length === 0) {
+ this.dialogForm.propertyUnitId = undefined
+ return
+ }
+ this.dialogForm.propertyUnitId = value[value.length - 1]
+ },
handleUnitChange(value) {
if (value.length === 0) {
this.queryParams.propertyUnitId = undefined
@@ -600,6 +639,8 @@ export default {
this.queryParams.pageSize = 10
this.queryParams.parentId = '0'
this.queryParams.level = '1'
+ this.queryParams.propertyUnitIds = null;
+ this.queryParams.propertyUnitId = null;
this.$refs.queryForm.resetFields()
this.getList()
},
@@ -737,6 +778,7 @@ export default {
propertyValue: '',
})
}
+ this.dialogForm.propertyUnitIds = this.findParentsTailRecursive(this.propertyUnitList,row.propertyUnitId)
if (this.dialogForm.certificates && this.dialogForm.certificates.length > 0) {
this.dialogForm.certificateList = this.dialogForm.certificates.map((item) => item.fileUrl).join(',')