From fe25b9d9dc98187a0b885631bc39dfd5daa15163 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期四, 20 十一月 2025 17:26:04 +0800
Subject: [PATCH] 工位改为默认查询所有状态
---
src/views/mdc/MYTree.vue | 53 +++++++++++++++++++++++------------------------------
1 files changed, 23 insertions(+), 30 deletions(-)
diff --git a/src/views/mdc/MYTree.vue b/src/views/mdc/MYTree.vue
index 06363fd..24993bc 100644
--- a/src/views/mdc/MYTree.vue
+++ b/src/views/mdc/MYTree.vue
@@ -1,11 +1,11 @@
<!--
* @Date: 2024-04-18 19:53:35
- * @LastEditors: gaoshp
- * @LastEditTime: 2024-11-04 19:55:07
+ * @LastEditors: 鏉庡枂(寮�鍙戠粍) lzhe@yxqiche.com
+ * @LastEditTime: 2025-03-27 14:47:57
* @FilePath: /cps-web/src/views/mdc/MYTree.vue
-->
<template>
- <el-input v-model="word" style="max-width: 600px" @change="search" placeholder="" class="input-with-select">
+ <el-input v-model="word" style="max-width: 600px" placeholder="" @change="search" class="input-with-select">
<template #append>
<el-button :icon="ElementPlusIconsVue.Search" />
</template>
@@ -40,6 +40,10 @@
default: () => {
return {}
}
+ },
+ isSelectId: { //榛樿閫変腑
+ type: String,
+ default: ""
}
},
data() {
@@ -50,7 +54,7 @@
tableData: [],
pmsPng,
firstWorkKey: '',
- currentNodeKey: [],
+ currentNodeKey: '',
defalutProps: {
label: 'title',
children: 'children',
@@ -84,7 +88,6 @@
},
methods: {
search() {
- console.log('Search')
this.getList()
},
switchFn(val) {
@@ -92,6 +95,9 @@
localStorage.setItem(this.$route.path, val ? '1' : '0')
},
handleSelectionChange(selection) {
+ if (this.getAll) {
+ return this.value = selection
+ }
this.value = selection.map(v => v.id)
},
rowClick(row) {
@@ -117,19 +123,20 @@
}).then(({ code, data }) => {
if (code === 200) {
this.tableData = data.filter(v => v.isWorkstation && v.title.indexOf(this.word) > -1)
- this.data = this.formatData(data)
+ this.data = this.formatData(data.filter(v => !v.isWorkstation || (v.isWorkstation && v.title.indexOf(this.word) > -1)))
this.$nextTick(() => {
- this.currentNodeKey = this.firstWorkKey
- this.$emit('loaded', this.firstWorkKey)
+ this.setCurrentKey(data)
+ this.$emit('loaded', this.currentNodeKey)
this.$emit('request', data)
})
}
})
},
- setCurrentKey(v) {
- if (this.firstWorkKey) return
- if (v.isWorkstation) {
- this.firstWorkKey = v.id
+ setCurrentKey(data) {
+ if(this.isSelectId) {
+ this.currentNodeKey = this.isSelectId;
+ }else {
+ this.currentNodeKey = data.find(v => v.isWorkstation && v.title.indexOf(this.word) > -1).id;
}
},
formatData(data, current) {
@@ -137,34 +144,20 @@
if (!current) {
newData = data.filter(item => item.parentId == 0).map(v => {
if (!v.isWorkstation) v.disabled = true
- let children = this.formatData(data, v).sort((a, b) => {
+ v.children = this.formatData(data, v).sort((a, b) => {
return b.sort - a.sort
})
- v.children = children.filter(v => {
- if (v.isWorkstation) {
- return v.title.indexOf(this.word) > -1
- } else {
- return true
- }
- })
- this.setCurrentKey(v)
+ // this.setCurrentKey(v)
return v
})
} else {
let res = data.filter(v => v.parentId == current.id)
res = res.map(item => {
if (!item.isWorkstation) item.disabled = true
- let children = this.formatData(data, item).sort((a, b) => {
+ item.children = this.formatData(data, item).sort((a, b) => {
return b.sort - a.sort
})
- item.children = children.filter(v => {
- if (v.isWorkstation) {
- return v.title.indexOf(this.word) > -1
- } else {
- return true
- }
- })
- this.setCurrentKey(item)
+ // this.setCurrentKey(item)
return item
})
return res
--
Gitblit v1.9.3