| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="3" :xs="24"> |
| | | <el-col :span="4" :xs="24"> |
| | | <div class="head-container"> |
| | | <el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search" |
| | | style="margin-bottom: 15px" /> |
| | |
| | | <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" |
| | | :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> |
| | |
| | | watch: { |
| | | deptName(val) { |
| | | this.debounceFilter(val); |
| | | |
| | | }, |
| | | treeId(newVal) { |
| | | if (newVal && newVal.length > 0) { |
| | |
| | | const lastId = newVal[newVal.length - 1] || "532"; |
| | | const node = this.findNodeById(this.deptOptions, lastId); |
| | | if (node) { |
| | | this.$refs.tree.setCurrentKey(lastId); |
| | | this.$refs.tree1.setCurrentKey(lastId); |
| | | const nodeElement = document.querySelector(`.el-tree-node[data-key="${lastId}"] .el-tree-node__content`); |
| | | if (nodeElement) { |
| | | nodeElement.click(); |
| | |
| | | }, |
| | | methods: { |
| | | debounceFilter: debounce(function(val) { |
| | | this.$refs.tree.filter(val); |
| | | this.$refs.tree1.filter(val); |
| | | }, 300), |
| | | precomputePinyin() { |
| | | const traverse = (nodes) => { |
| | |
| | | traverse(this.deptOptions); |
| | | }, |
| | | filterNode(value, data) { |
| | | console.log(value, data,2233) |
| | | if (!value) return true; |
| | | const cached = this.pinyinCache.get(data.id); |
| | | if (!cached) return false; |
| | |
| | | } else if (this.form.proParentId) { |
| | | if (this.form.proParentId != 0) { |
| | | this.dialogTableVisible = true; |
| | | if (this.deptOptionstree.length != 0) { |
| | | this.$nextTick(() => { |
| | | this.chargeId.push(this.deptOptionstree[0].id); |
| | | }); |
| | | } |
| | | |
| | | this.getlistSfxm(); |
| | | } else { |
| | | this.dialogTableVisible = false; |
| | |
| | | getAllChildListById(data).then(() => { |
| | | this.loading = false; |
| | | }); |
| | | this.deptName = ""; |
| | | // 手动调用过滤方法(需等待 DOM 更新) |
| | | this.$nextTick(() => { |
| | | this.$refs.tree1.filter(this.deptName); |
| | | }); |
| | | }, |
| | | handleClose() { |
| | | this.cancel(); |
| | |
| | | resetQuery() { |
| | | this.resetForm("queryForm"); |
| | | this.queryParams.proId = undefined; |
| | | this.$refs.tree.setCurrentKey(null); |
| | | this.$refs.tree1.setCurrentKey(null); |
| | | this.handleQuery(); |
| | | }, |
| | | flexColumnWidth(column) { |
| | |
| | | } |
| | | } |
| | | }); |
| | | this.deptName = ""; |
| | | // 手动调用过滤方法(需等待 DOM 更新) |
| | | this.$nextTick(() => { |
| | | this.$refs.tree1.filter(this.deptName); |
| | | }); |
| | | }, |
| | | processSubmission(isUpdate, isY) { |
| | | if (isUpdate) { |
| | |
| | | this.sfxmId = parseInt(item.id); |
| | | }); |
| | | this.dialogTableVisible = false; |
| | | this.getDeptList(); |
| | | this.getDeptTree().then(() => { |
| | | this.precomputePinyin(); |
| | | }); |
| | | }, |
| | | handleDelete(row) { |
| | | const proIds = row.proId || this.ids; |