| | |
| | | </div> |
| | | <div class="scrollable-container"> |
| | | <div class="content"> |
| | | <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" |
| | | :filter-node-method="filterNode" ref="tree" node-key="id" :default-expanded-keys="treeId" |
| | | highlight-current @node-click="handleNodeClick" :render-content="renderContent" v-loading="loadings" /> |
| | | <el-tree |
| | | :data="deptOptions" |
| | | :props="defaultProps" |
| | | :expand-on-click-node="false" |
| | | :filter-node-method="filterNode" |
| | | ref="tree1" |
| | | node-key="id" |
| | | :default-expanded-keys="treeId" |
| | | highlight-current |
| | | @node-click="handleNodeClick" |
| | | :render-content="renderContent" |
| | | v-loading="loadings" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | |
| | | width="90px" |
| | | > |
| | | </el-table-column> |
| | | <el-table-column label="Lis项目名称" align="center" prop="lisXmmc" :show-overflow-tooltip="true" width="200px"> |
| | | <el-table-column |
| | | label="Lis项目名称" |
| | | align="center" |
| | | prop="lisXmmc" |
| | | :show-overflow-tooltip="true" |
| | | width="200px" |
| | | > |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="Lis编码" |
| | |
| | | }, |
| | | methods: { |
| | | debounceFilter: debounce(function (val) { |
| | | this.$refs.tree.filter(val); |
| | | }, 800), |
| | | this.$refs.tree1.filter(val); |
| | | }, 300), |
| | | precomputePinyin() { |
| | | const traverse = (nodes) => { |
| | | nodes.forEach((node) => { |
| | | if (node.label) { |
| | | const lowerSpell = cnchar.spell(node.label, 'low', 'array').join(''); // 完整小写拼音 |
| | | const upperSpell = cnchar.spell(node.label, 'up', 'array').join(''); // 完整大写拼音 |
| | | const shortPinyin = node.label |
| | | .split('') |
| | | .map(char => cnchar.spell(char, 'array')[0]?.[0]?.toLowerCase() || char) // 拼音首字母 |
| | | .join(''); |
| | | const lowerSpell = node.label.spell("low", "array").join(""); |
| | | const upperSpell = node.label.spell("up", "array").join(""); |
| | | this.pinyinCache.set(node.id, { |
| | | lowerSpell, |
| | | upperSpell, |
| | | shortPinyin, // 缓存拼音简写 |
| | | label: node.label |
| | | label: node.label, |
| | | }); |
| | | } |
| | | if (node.children) traverse(node.children); |
| | |
| | | filterNode(value, data) { |
| | | if (!value) return true; |
| | | const cached = this.pinyinCache.get(data.id); |
| | | if (!cached) return false; // 如果没有缓存数据,不显示该节点 |
| | | const searchLower = value.toLowerCase(); // 将搜索词转为小写 |
| | | if (!cached) return false; |
| | | return ( |
| | | cached.label.includes(value) || // 直接匹配汉字 |
| | | cached.shortPinyin.includes(searchLower) || // 匹配拼音简写 |
| | | cached.lowerSpell.includes(searchLower) // 匹配完整拼音 |
| | | cached.label.includes(value) || |
| | | cached.lowerSpell.includes(value) || |
| | | cached.upperSpell.includes(value) |
| | | ); |
| | | }, |
| | | filterNode2(value, data) { |
| | |
| | | this.open = true; |
| | | } else if (this.treeDate.id) { |
| | | if (this.treeDate.qf == "0") { |
| | | this.form.proParentId = "0" |
| | | this.form.deptId = this.treeDate.id |
| | | this.form.proParentId = "0"; |
| | | this.form.deptId = this.treeDate.id; |
| | | } else { |
| | | this.form.proParentId = this.treeDate.id; |
| | | this.projectOptions.forEach((item) => { |
| | |
| | | }); |
| | | } |
| | | |
| | | |
| | | this.open = true; |
| | | } else { |
| | | this.form.proParentId = "0" |
| | | this.form.proParentId = "0"; |
| | | this.open = true; |
| | | } |
| | | } |