| | |
| | | :props="{label: 'id', value: 'id'}" |
| | | :dic="lifeData"></avue-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="备选生命周期列表:" label-width="138px"> |
| | | <avue-select multiple |
| | | :filterable="true" |
| | | v-model="form.subLifeCycleId" |
| | | v-model="form.subLifeCycleIdList" |
| | | placeholder="请选择生命周期" |
| | | :props="{label: 'id', value: 'id'}" |
| | | type="tree" |
| | | :dic="lifeData"></avue-select> |
| | | :dic="subLifeData" |
| | | @change="subLifeChange"></avue-select> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | |
| | | versionAddFlag: false, |
| | | inheritTreeData: [], |
| | | lifeData: [],//生命周期下拉数据 |
| | | subLifeData:[],//备选生命周期下拉数据 |
| | | allLifeData:[], |
| | | versionData: [],//版本规则数据 |
| | | dialogAttrSelectList: [], |
| | | searchAttrParams: {}, |
| | |
| | | delimiter: '', // 分隔符 |
| | | versionRule: '0', // 版次号规则 |
| | | lifeCycleId: '', // 生命周期 |
| | | subLifeCycleId: [], // 生命周期备选列表, |
| | | subLifeCycleId: '', // 生命周期备选列表, |
| | | subLifeCycleIdList:[], |
| | | apNameArray: "", // 属性池列表’,‘分隔 |
| | | }, |
| | | nodeRow: {}, |
| | |
| | | this.getLifeCycle(); |
| | | }, |
| | | mounted() { |
| | | }, |
| | | watch:{ |
| | | 'form.lifeCycleId':{ |
| | | handler(newval) { |
| | | if(this.form.lifeCycleId){ |
| | | this.subLifeData = this.allLifeData.filter(item=>{ |
| | | return item.id!=this.form.lifeCycleId |
| | | }); |
| | | }else { |
| | | this.subLifeData = this.allLifeData |
| | | } |
| | | }, |
| | | } |
| | | }, |
| | | methods: { |
| | | //树表查询 |
| | |
| | | //获取生命周期数据 |
| | | getLifeCycle(){ |
| | | gridLifeCycle().then(res => { |
| | | this.lifeData = res.data.data; |
| | | this.allLifeData=res.data.data; |
| | | }); |
| | | }, |
| | | // 创建按钮 |
| | |
| | | } |
| | | this.title = 'add'; |
| | | this.form.fName = this.nodeRow.id === 'topNode' ? "" : this.nodeRow.id; |
| | | this.lifeData = this.allLifeData; |
| | | this.subLifeData = this.allLifeData; |
| | | this.form.inputRevisionFlag = JSON.parse(this.form.inputRevisionFlag); // 字符串false转换为布尔值 |
| | | this.visible = true; |
| | | }, |
| | | |
| | | // 新增编辑保存 |
| | | addDialogSavaHandler() { |
| | | if (this.form.revLevel !== '0' &&!this.form.inputRevisionFlag && (!this.form.revisionRuleId || this.form.revisionRuleId === "")) { |
| | | this.$message.error('请检查版本号规则不能为空'); |
| | | return; |
| | | } |
| | | this.form.lifeCycleIds=this.form.subLifeCycleIdList.join(','); |
| | | this.form.subLifeCycleId=this.form.subLifeCycleIdList.join(','); |
| | | this.form.apNameArray = this.dialogAttrData ? this.dialogAttrData.map(item => item.id).join(',') : ""; |
| | | this.$refs.form.validate((valid) => { |
| | | const saveFunction = this.title === 'add' ? addLifeCycle : updateLifeCycle; |
| | | if (valid) { |
| | | if (this.form.revLevel === 0) { |
| | | this.form.versionRule = ""; |
| | | } |
| | | saveFunction(this.form).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.getTreeList(); |
| | | this.resetForm(); |
| | | this.visible = false; |
| | | } |
| | | }) |
| | | } else { |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 编辑按钮点击事件 |
| | | editClickHandler() { |
| | | /** |
| | | * id 名称 |
| | | * name 标签 |
| | | * implClass 实现类 |
| | | * fName 继承自 |
| | | * description 描述 |
| | | * revLevel 版本规则 |
| | | * revisionRuleId 版本号规则 |
| | | * inputRevisionFlag 手工输入 |
| | | * delimiter 分隔符 |
| | | * versionRule 版次号规则 |
| | | * lifeCycleId 生命周期 |
| | | * lifeCycleIds 生命周期列表 |
| | | * attributes 属性池列表 |
| | | */ |
| | | if (func.isEmptyObject(this.nodeRow)) { |
| | | this.$message.error('请至少选择一条数据'); |
| | | return; |
| | | } |
| | | if (this.nodeRow.id === 'topNode') { |
| | | this.$message.error('请选择子节点进行修改') |
| | | return; |
| | | } |
| | | this.form = {...this.nodeRow}; |
| | | this.form.inputRevisionFlag = JSON.parse(this.form.inputRevisionFlag); // 字符串false转换为布尔值 |
| | | // this.form.fName = this.nodeRow.id === 'topNode' ? "" : this.nodeRow.id; |
| | | this.form.subLifeCycleIdList = this.nodeRow.lifeCycleIds.split(','); |
| | | this.dialogAttrData = this.nodeRow.attributes ? JSON.parse(this.nodeRow.attributes) : []; |
| | | function processChildren(item,fName) { |
| | | if (item.children && item.children.length > 0) { |
| | | item.children = item.children.map(child => { |
| | | processChildren(child,fName); // 递归处理每个子节点 |
| | | if(fName==child.id){ |
| | | child.disabled=true; |
| | | }else { |
| | | child.disabled=false; |
| | | } |
| | | return child; |
| | | }); |
| | | } |
| | | }; |
| | | const inheritTreeData=this.inheritTreeData.map(item => { |
| | | processChildren(item,this.form.id); // 处理每个节点 |
| | | if(this.form.id==item.id){ |
| | | item.disabled=true; |
| | | }else { |
| | | item.disabled=false; |
| | | } |
| | | return item; |
| | | }); |
| | | this.inheritTreeData=inheritTreeData |
| | | this.title = 'edit'; |
| | | this.visible = true; |
| | | }, |
| | | |
| | | subLifeChange(data){ |
| | | if (data.value.length == 0) { |
| | | this.lifeData = this.allLifeData |
| | | } else { |
| | | this.lifeData = this.allLifeData.filter(item => { |
| | | return !data.value.includes(item.id) |
| | | }); |
| | | } |
| | | }, |
| | | // 对话框 属性池列表增加按钮 |
| | | addDialogClickHandler() { |
| | | this.dialogAttrLoading = true; |
| | |
| | | delimiter: '', // 分隔符 |
| | | versionRule: '0', // 版次号规则 |
| | | lifeCycleId: '', // 生命周期 |
| | | subLifeCycleId: [], // 生命周期备选列表, |
| | | subLifeCycleId: '', // 生命周期备选列表, |
| | | subLifeCycleIdList:[], |
| | | lifeCycleIds:'', |
| | | apNameArray: "", // 属性池列表’,‘分隔 |
| | | }; |
| | |
| | | this.form.delimiter = ""; |
| | | this.form.versionRule = "0"; |
| | | this.form.revisionRuleId = ""; |
| | | }, |
| | | |
| | | // 新增编辑保存 |
| | | addDialogSavaHandler() { |
| | | if (this.form.revLevel !== '0' &&!this.form.inputRevisionFlag && (!this.form.revisionRuleId || this.form.revisionRuleId === "")) { |
| | | this.$message.error('请检查版本号规则不能为空'); |
| | | return; |
| | | } |
| | | this.form.lifeCycleIds=this.form.subLifeCycleId.join(','); |
| | | this.form.apNameArray = this.dialogAttrData ? this.dialogAttrData.map(item => item.id).join(',') : ""; |
| | | this.$refs.form.validate((valid) => { |
| | | const saveFunction = this.title === 'add' ? addLifeCycle : updateLifeCycle; |
| | | if (valid) { |
| | | if (this.form.revLevel === 0) { |
| | | this.form.versionRule = ""; |
| | | } |
| | | saveFunction(this.form).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.getTreeList(); |
| | | this.resetForm(); |
| | | this.visible = false; |
| | | } |
| | | }) |
| | | } else { |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 编辑按钮点击事件 |
| | | editClickHandler() { |
| | | /** |
| | | * id 名称 |
| | | * name 标签 |
| | | * implClass 实现类 |
| | | * fName 继承自 |
| | | * description 描述 |
| | | * revLevel 版本规则 |
| | | * revisionRuleId 版本号规则 |
| | | * inputRevisionFlag 手工输入 |
| | | * delimiter 分隔符 |
| | | * versionRule 版次号规则 |
| | | * lifeCycleId 生命周期 |
| | | * lifeCycleIds 生命周期列表 |
| | | * attributes 属性池列表 |
| | | */ |
| | | if (func.isEmptyObject(this.nodeRow)) { |
| | | this.$message.error('请至少选择一条数据'); |
| | | return; |
| | | } |
| | | if (this.nodeRow.id === 'topNode') { |
| | | this.$message.error('请选择子节点进行修改') |
| | | return; |
| | | } |
| | | this.form = {...this.nodeRow}; |
| | | this.form.inputRevisionFlag = JSON.parse(this.form.inputRevisionFlag); // 字符串false转换为布尔值 |
| | | // this.form.fName = this.nodeRow.id === 'topNode' ? "" : this.nodeRow.id; |
| | | this.form.subLifeCycleId = (this.nodeRow.lifeCycleIds && this.nodeRow.lifeCycleIds.trim()) |
| | | ? this.nodeRow.lifeCycleIds.split(',').map(item => ({id: item.trim()})) |
| | | : []; |
| | | this.dialogAttrData = this.nodeRow.attributes ? JSON.parse(this.nodeRow.attributes) : []; |
| | | function processChildren(item,fName) { |
| | | if (item.children && item.children.length > 0) { |
| | | item.children = item.children.map(child => { |
| | | processChildren(child,fName); // 递归处理每个子节点 |
| | | if(fName==child.id){ |
| | | child.disabled=true; |
| | | }else { |
| | | child.disabled=false; |
| | | } |
| | | return child; |
| | | }); |
| | | } |
| | | }; |
| | | const inheritTreeData=this.inheritTreeData.map(item => { |
| | | processChildren(item,this.form.id); // 处理每个节点 |
| | | if(this.form.id==item.id){ |
| | | item.disabled=true; |
| | | }else { |
| | | item.disabled=false; |
| | | } |
| | | return item; |
| | | }); |
| | | this.inheritTreeData=inheritTreeData |
| | | this.title = 'edit'; |
| | | this.visible = true; |
| | | }, |
| | | |
| | | // 删除按钮 |