| | |
| | | }, |
| | | //分类树数据处理 |
| | | getAttr() { |
| | | this.loading = true; |
| | | return new Promise((resolve, reject) => { |
| | | getAtrrList() |
| | | .then(res => { |
| | |
| | | } |
| | | return item; |
| | | }); |
| | | this.loading = false; |
| | | resolve(); // 完成请求,调用resolve方法 |
| | | }) |
| | | .catch(error => { |
| | |
| | | this.$refs.myForm.clearValidate(); |
| | | }, |
| | | //树节点添加事件 |
| | | TreeAddHandler() { |
| | | async TreeAddHandler() { |
| | | if ((!this.TreeAddform.id || !this.TreeAddform.name) || (this.TreeFlagCode && !this.TreeAddform.btmTypeName)) { |
| | | this.$message.warning('请输入内容!'); |
| | | } else { |
| | | return; |
| | | } |
| | | try { |
| | | const data = this.TreeAddform; |
| | | this.$set(data, "parentCodeClassifyOid", this.nodeClickList.oid); |
| | | TreeSave(data) |
| | | .then(() => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "添加成功!", |
| | | }); |
| | | Object.keys(this.TreeAddform).forEach(key => { |
| | | this.TreeAddform[key] = ""; |
| | | this.TreeAddform.codeKeyAttrValue = true; |
| | | this.TreeAddform.isParticipateCheck = 1; |
| | | }); |
| | | this.getAttr(); |
| | | this.TreeAddFormVisible = false; |
| | | //添加完成后右侧清空 |
| | | this.ProData = []; |
| | | this.Formlist = []; |
| | | }) |
| | | .catch((res) => { |
| | | this.$message({ |
| | | type: "warning", |
| | | message: res, |
| | | }); |
| | | }); |
| | | await TreeSave(data) |
| | | this.$message.success("添加成功!"); |
| | | Object.keys(this.TreeAddform).forEach(key => { |
| | | this.TreeAddform[key] = ""; |
| | | }); |
| | | this.TreeAddform.codeKeyAttrValue = true; |
| | | this.TreeAddform.isParticipateCheck = 1; |
| | | this.getAttr(); |
| | | this.TreeAddFormVisible = false; |
| | | //添加完成后右侧清空 |
| | | this.ProData = []; |
| | | this.Formlist = []; |
| | | } catch (res) { |
| | | this.$message({ |
| | | type: "warning", |
| | | message: res, |
| | | }); |
| | | } |
| | | }, |
| | | //树节点删除按钮 |
| | |
| | | }, |
| | | //树刷新 |
| | | async flushed() { |
| | | this.loading = true; |
| | | try { |
| | | await this.getAttr() |
| | | this.$refs.tree.setCurrentKey(null); |
| | | this.nodeClickList = {} |
| | | this.TreeList = [] |
| | | this.TreeFlagCode = true; |
| | | } finally { |
| | | this.loading = false; |
| | | } |
| | | }, |
| | | //启用和停用都先判断状态 |
| | | //启用 |