diff --git a/sgzb-ui/src/views/store/tools/accessory.vue b/sgzb-ui/src/views/store/tools/accessory.vue index 212eef51..824cbbd5 100644 --- a/sgzb-ui/src/views/store/tools/accessory.vue +++ b/sgzb-ui/src/views/store/tools/accessory.vue @@ -61,7 +61,7 @@ - @@ -170,23 +170,19 @@ export default { } ] }, - + isEdit:false }; }, created() { this.getList(); - // this.initApiGetPartTree() }, methods: { /** 查询部门列表 */ getList() { // this.loading = true; listPartType(this.queryParams).then(response => { - console.log("response", response) this.deptList = this.handleTree(response.data, "paId"); - // this.deptList = response.data - this.loading = false; }).catch(err => { console.log("err", err) @@ -235,11 +231,9 @@ export default { /** 新增按钮操作 */ handleAdd() { this.reset(); - // if (row != undefined) { - // this.form.currentId = row.paId; - // } this.open = true; this.title = "添加"; + this.isEdit = false this.initApiGetPartTree() }, @@ -247,7 +241,6 @@ export default { toggleExpandAll() { this.refreshTable = false; this.isExpandAll = !this.isExpandAll; - console.log("isExpandAll", this.isExpandAll) this.$nextTick(() => { this.refreshTable = true; }); @@ -255,23 +248,20 @@ export default { /** 修改按钮操作 */ handleUpdate(row) { this.reset(); - // getDept(row.paId).then(response => { - // this.form = row; this.open = true; this.title = "修改部门"; + this.isEdit = true this.initGetPartType(row) }, /** 提交按钮 */ submitForm() { this.$refs["form"].validate(valid => { if (valid) { - console.log("ressearchTreeform", this.form) if (this.form.paId != undefined) { delete this.form.currentId updatePartTypeById(this.form).then(response => { this.$modal.msgSuccess("修改成功"); this.open = false; - this.getList(); }); } else { @@ -287,22 +277,16 @@ export default { async initApiGetPartTree() { try { const res = await apiGetPartTree() - console.log("res--apiGetPartTree", res) this.deptOptions = res.data } catch (error) { - } }, handleNodeClick(ev) { - console.log("scurrentIdcurrentIdcurrentId", ev) - const res = this.searchTree(this.deptOptions,this.form.currentId&&this.form.currentId.length > 0 ? this.form.currentId.slice(-1)[0] : {}) - console.log("ressearchTreeres", res) - if(res){ + const res = this.searchTree(this.deptOptions, this.form.currentId && this.form.currentId.length > 0 ? this.form.currentId.slice(-1)[0] : {}) + if (res) { this.form.parentId = res.id this.form.level = Number(res.level) + 1 - } - }, /** 删除按钮操作 */ handleDelete(row) { @@ -346,20 +330,13 @@ export default { } }, handleRowClick(ev) { - console.log("handleRowClick", ev) this.form.currentId = row.parentId; } , async initGetPartType(row) { - console.log("rowgetPartType",row) - // const res = await getPartType(row.paId) const currentItem = this.getAllParentArr(this.deptList, row.parentId, 'parentId', 'children') - console.log("currcurrentItemetn", currentItem) - this.form = JSON.parse(JSON.stringify(row)) + this.form = JSON.parse(JSON.stringify(row)) this.form.currentId = currentItem && currentItem.reverse().map(ele => ele.paId) - console.log - // this.form = res.data - this.initApiGetPartTree() } }