diff --git a/src/resources/assets/languages/term/en.json b/src/resources/assets/languages/term/en.json index 7dc25857ed074d04a785596834f4e5c0f214296f..d0a7c7da3e03d29182120f11f27794781f1898dc 100644 --- a/src/resources/assets/languages/term/en.json +++ b/src/resources/assets/languages/term/en.json @@ -191,9 +191,9 @@ "startci": "Select the starting model first", "writeci": "Write model", "writecitip": "Select constants or specify the model for data writing through form mapping. If the parent model is an abstract model and does not support adding configuration items, data needs to be written into the child model.", - "abstractcireltip": "Firstly, configure the parent model, complete the mapping of common attributes in the parent model, and specify the model for data writing. After completing the configuration of the parent model, return to the current interface before clicking on the sub model to configure the mapping of non-public (non inherited) attributes in the sub model.", "subci": "Submodel", "selectrelpath": "Select relationship path", + "relciconfigtip": "After configuring the parent model, child models cannot be configured; After configuring the sub model, the parent model cannot be configured, but other sub models can be configured", "topotemplate": "Topology template", "selectagain": "Re select", "topotype": "Unfolding method" diff --git a/src/resources/assets/languages/term/zh.json b/src/resources/assets/languages/term/zh.json index 3900fa1ccbf41dc7367794845fb1fad03f3ba974..a91309eebe53ea89b737eada47bd716d94f19b7f 100644 --- a/src/resources/assets/languages/term/zh.json +++ b/src/resources/assets/languages/term/zh.json @@ -191,9 +191,9 @@ "startci": "先选择起始模型", "writeci": "写入模型", "writecitip": "选择常量或通过表单映射的方式,指定数据写入的模型。若父模型为抽象模型,不支持添加配置项,需将数据写入子模型。", - "abstractcireltip": "首先配置父模型,完成父模型中公共属性的映射,并指定数据写入的模型。完成父模型配置后,返回当前界面,才可点击子模型,配置子模型中的非公共(非继承)属性映射。", "subci": "子模型", "selectrelpath": "选择关系路径", + "relciconfigtip": "配置父模型后,不可配置子模型;配置子模型后,不可配置父模型,但可配置其他子模型", "topotemplate": "拓扑模板", "selectagain": "重新选择", "topotype": "展开方式" diff --git a/src/views/pages/cmdb/flow/node/nodesetting/cmdbpolicy/children-ci.vue b/src/views/pages/cmdb/flow/node/nodesetting/cmdbpolicy/children-ci.vue deleted file mode 100644 index de8fa3140c3b052af8cc3f473e0d14c6de7bebca..0000000000000000000000000000000000000000 --- a/src/views/pages/cmdb/flow/node/nodesetting/cmdbpolicy/children-ci.vue +++ /dev/null @@ -1,163 +0,0 @@ - - - diff --git a/src/views/pages/cmdb/flow/node/nodesetting/cmdbpolicy/cmdbsync-dialog.vue b/src/views/pages/cmdb/flow/node/nodesetting/cmdbpolicy/cmdbsync-dialog.vue index a22bbffdb73bfca06ca863fa421baacdfbab93cf..98b8960d6bc9dc15105582dc27a465e750c18190 100644 --- a/src/views/pages/cmdb/flow/node/nodesetting/cmdbpolicy/cmdbsync-dialog.vue +++ b/src/views/pages/cmdb/flow/node/nodesetting/cmdbpolicy/cmdbsync-dialog.vue @@ -42,7 +42,6 @@ @@ -142,7 +137,6 @@ :ciData="ciData" :subFormComponentList="getTreeSubFormComponent()" :tableComponentAttrList="getTableAttrList()" - :saveCiEntityMap="saveCiEntityMap" @new="addNewCiEntity" @edit="editNewCiEntity" @remove="removeNewCiEntity" @@ -271,9 +265,7 @@ export default { value: 'partial', description: this.$t('term.cmdb.partialeditmodetip') } - ], - isInherit: false, //判断子模型需要继承根模型的策略 - subCiUuidList: [] //子模型临时数据(标识) + ] }; }, beforeCreate() {}, @@ -303,9 +295,7 @@ export default { this.currentFormItemList = this.$utils.deepClone(this.allFormitemList); } }, - initValue(cientity, preCiEntity, rel) { - this.subCiUuidList = rel && rel.subCiUuidList || []; - this.isInherit = false; + initValue(cientity, preCiEntity) { let findItem = this.saveCiEntityMap[cientity.uuid]; if (findItem) { Object.keys(findItem).forEach(key => { @@ -342,29 +332,6 @@ export default { } }); } - //子模型 - if (rel && rel._rootId) { - if (rel.isChildren) { - //初始模型是抽象模型 - let rootConfig = this.ciEntityQueue[0]; - if (rootConfig) { - this.$set(cientity, 'action', rootConfig.action); - this.$set(cientity, 'batchDataSource', rootConfig.batchDataSource); - this.$set(cientity, 'editMode', rootConfig.editMode); - this.$set(cientity, 'createPolicy', rootConfig.createPolicy); - } - this.isInherit = true; - } else if (rel._rootId != cientity.ciId) { - if (this.saveCiEntityMap[rel._rootUuid]) { - let rootConfig = this.saveCiEntityMap[rel._rootUuid]; - this.$set(cientity, 'action', rootConfig.action); - this.$set(cientity, 'batchDataSource', rootConfig.batchDataSource); - this.$set(cientity, 'editMode', rootConfig.editMode); - this.$set(cientity, 'createPolicy', rootConfig.createPolicy); - } - this.isInherit = true; - } - } }, okDialog() { if (!this.valid()) { @@ -406,9 +373,6 @@ export default { allAttrEntityData: {}, isAbstract: ci.isAbstract }; - if (ci.isAbstract) { - this.$set(cientity, 'children', []); - } cientity['_elementList'] = this.getElementByCiId(ci); cientity['_uniqueAttrList'] = ci.uniqueAttrIdList; cientity['_description'] = this.descriptionConfig; @@ -466,8 +430,7 @@ export default { const relId = rel._relId; const direction = rel.direction == 'from' ? 'to' : 'from'; //目标关系需要取反 const uuid = rel.ciEntityUuid || this.$utils.setUuid(); //新的配置项标识 - const rootId = rel._rootId || null; - this.$api.cmdb.ci.getCiForprocessmapping({id: ciId, rootId: rootId}).then(res => { + this.$api.cmdb.ci.getCiForprocessmapping({id: ciId}).then(res => { if (res.Return) { const ci = res.Return; //获取当前配置项数据 @@ -487,30 +450,25 @@ export default { relEntityData: {}, _disableRel: 'rel' + direction + '_' + relId, //标记哪个关系不允许添加或选择 allAttrEntityData: {}, //所有的属性 - isAbstract: ci.isAbstract, - isChildren: !!rel.isChildren + isAbstract: ci.isAbstract }; newCiEntity['_elementList'] = this.getElementByCiId(ci); newCiEntity['_uniqueAttrList'] = ci.uniqueAttrIdList; newCiEntity['_description'] = this.descriptionConfig; - if (!rel.isChildren) { - newCiEntity['relEntityData']['rel' + direction + '_' + relId] = { - valueList: [ - { - ciEntityUuid: currentCiEntity.uuid, - ciEntityName: currentCiEntity.ciLabel, - ciId: ciId, - type: 'from' - } - ] - }; - } - this.initValue(newCiEntity, currentCiEntity, rel); + newCiEntity['relEntityData']['rel' + direction + '_' + relId] = { + valueList: [ + { + ciEntityUuid: currentCiEntity.uuid, + ciEntityName: currentCiEntity.ciLabel, + ciId: ciId, + type: 'from' + } + ] + }; + this.initValue(newCiEntity, currentCiEntity); this.ciData = newCiEntity; this.ciEntityQueue.push(newCiEntity); - if (!rel.isChildren) { - this.updateCurrentFormItemList(rel); - } + this.updateCurrentFormItemList(); } }).finally(() => { this.loadingShow = false; @@ -525,7 +483,6 @@ export default { } }, back() { - this.isInherit = false; const cientity = this.ciEntityQueue.pop(); if (cientity._isnew) { this.$set(this.saveCiEntityMap, cientity.uuid, this.tmpCiEntityData); @@ -638,7 +595,6 @@ export default { if (!this.valid()) { return false; } - this.isInherit = false; //队列只剩一个配置项时才写入数据库 if (this.ciEntityQueue.length > 1) { const cientity = this.ciEntityQueue.pop(); @@ -660,12 +616,6 @@ export default { currentCiEntity['relEntityData']['rel' + cientity._direction + '_' + cientity._relId] = { valueList: [] }; } currentCiEntity['relEntityData']['rel' + cientity._direction + '_' + cientity._relId]['valueList'].push(newRelEntity); - } else if (this.currentCiEntity.children) { - currentCiEntity.children.push({ - ciEntityUuid: cientity.uuid, - ciEntityName: cientity.ciLabel, - ciId: cientity.ciId - }); } } //标记为已保存的新配置项,用于点击“取消”后判断是否需要删除数据 @@ -673,14 +623,8 @@ export default { this.saveCiEntityMap[cientity.uuid] = cientity; this.ciData = this.ciEntityQueue[this.ciEntityQueue.length - 1]; this.updateCurrentFormItemList(); - this.updateSubCiData(cientity); } else if (this.ciEntityQueue.length == 1) { const cientity = this.ciEntityQueue[0]; - if (!this.$utils.isEmpty(cientity.children)) { - //初始模型为抽象模型 - this.subCiUuidList = this.$utils.mapArray(cientity.children, 'ciEntityUuid'); - this.updateSubCiData(cientity); - } this.saveCiEntityMap[cientity.uuid] = cientity; const ciEntityList = []; for (let uuid in this.saveCiEntityMap) { @@ -707,10 +651,6 @@ export default { }; if (item.hasOwnProperty('isStart')) { config.isStart = item.isStart; - //抽象模型的子模型 - if (item.hasOwnProperty('children')) { - config.children = item.children; - } } if (item.hasOwnProperty('action')) { config.action = item.action; @@ -755,7 +695,7 @@ export default { if (this.currentCiEntity) { if (this.currentCiEntity.batchDataSource) { if (this.currentCiEntity.batchDataSource.type === 'formTableComponent') { - if (!this.isInherit && this.preCiEntity && this.preCiEntity.batchDataSource && this.preCiEntity.batchDataSource.attributeUuid) { + if (this.preCiEntity && this.preCiEntity.batchDataSource && this.preCiEntity.batchDataSource.attributeUuid) { let findTable = this.allFormitemList.find(item => item.uuid === this.preCiEntity.batchDataSource.attributeUuid); if (findTable && findTable.config && findTable.config.dataConfig) { findTable.config.dataConfig.forEach(d => { @@ -974,36 +914,6 @@ export default { if (ciEntity) { this.$set(ciEntity, 'editMode', val); } - }, - updateSubCiData(cientity) { - //抽象模型修改遍历对象的时候,子模型,映射到旧的遍历对象的哪些属性,全部清空 - if (!this.$utils.isEmpty(this.subCiUuidList)) { - this.subCiUuidList.forEach(uuid => { - if (this.saveCiEntityMap[uuid]) { - this.$set(this.saveCiEntityMap[uuid], 'editMode', cientity.editMode); - this.$set(this.saveCiEntityMap[uuid], 'action', cientity.action); - if (cientity.createPolicy != this.saveCiEntityMap[uuid].createPolicy || - (!this.$utils.isEmpty(cientity.batchDataSource) && (cientity.batchDataSource.type != this.saveCiEntityMap[uuid].batchDataSource.type) || (cientity.batchDataSource.attributeUuid != this.saveCiEntityMap[uuid].batchDataSource.attributeUuid)) - ) { - if (!this.$utils.isEmpty(this.saveCiEntityMap[uuid].allAttrEntityData)) { - Object.keys(this.saveCiEntityMap[uuid].allAttrEntityData).forEach(key => { - let config = this.saveCiEntityMap[uuid].allAttrEntityData[key]; - if (config.mappingMode === 'formTableComponent' || config.mappingMode === 'formSubassemblyComponent') { - this.$set(config, 'valueList', []); - } - }); - } else if (!this.$utils.isEmpty(this.saveCiEntityMap[uuid].mappingList)) { - let mappingList = this.saveCiEntityMap[uuid].mappingList.filter(item => { - return item.mappingMode !== 'formTableComponent' && item.mappingMode !== 'formSubassemblyComponent'; - }); - this.$set(this.saveCiEntityMap[uuid], 'mappingList', mappingList); - } - } - this.$set(this.saveCiEntityMap[uuid], 'createPolicy', cientity.createPolicy); - this.$set(this.saveCiEntityMap[uuid], 'batchDataSource', cientity.batchDataSource); - } - }); - } } }, filter: {}, diff --git a/src/views/pages/cmdb/flow/node/nodesetting/cmdbpolicy/cmdbsync-edit.vue b/src/views/pages/cmdb/flow/node/nodesetting/cmdbpolicy/cmdbsync-edit.vue index 8fa3f0001faa5c545b2f6d2db8ea5489c56edb4c..b49e1585e2e344f1a4c53e73623282f9fa5c0fc2 100644 --- a/src/views/pages/cmdb/flow/node/nodesetting/cmdbpolicy/cmdbsync-edit.vue +++ b/src/views/pages/cmdb/flow/node/nodesetting/cmdbpolicy/cmdbsync-edit.vue @@ -11,21 +11,6 @@ :tableComponentAttrList="tableComponentAttrList" :subFormComponentList="subFormComponentList" > - -
@@ -79,7 +64,7 @@
- {{ $t('term.cmdb.abstractcireltip') }} + {{ $t('term.cmdb.relciconfigtip') }}
- {{ relentity.ciEntityName }} @@ -298,8 +282,7 @@ export default { TsFormSelect: resolve => require(['@/resources/plugins/TsForm/TsFormSelect'], resolve), AttrInputer: resolve => require(['@/views/pages/cmdb/cientity/attr-inputer.vue'], resolve), TsFormCascader: resolve => require(['@/resources/plugins/TsForm/TsFormCascader.vue'], resolve), - TargetCi: resolve => require(['./target-ci.vue'], resolve), - ChildrenCi: resolve => require(['./children-ci.vue'], resolve) + TargetCi: resolve => require(['./target-ci.vue'], resolve) }, props: { ciData: Object, @@ -311,8 +294,7 @@ export default { } }, subFormComponentList: Array, - tableComponentAttrList: Array, - saveCiEntityMap: Object + tableComponentAttrList: Array }, data() { return { @@ -393,7 +375,7 @@ export default { } } }, - ciEntityDatafn(key, relentity, rowdata) { + ciEntityDatafn(key, relentity) { if (this.ciEntityData.relEntityData[key] && this.ciEntityData.relEntityData[key]['valueList']) { for (let i = this.ciEntityData.relEntityData[key]['valueList'].length - 1; i >= 0; i--) { if (this.ciEntityData.relEntityData[key]['valueList'][i] == relentity) { @@ -405,30 +387,13 @@ export default { } } }, - delRelEntity(key, relentity, rowdata) { - this.ciEntityDatafn(key, relentity, rowdata); + delRelEntity(key, relentity) { + this.ciEntityDatafn(key, relentity); }, editNewRelEntity(rel, config) { if (this.getTagType(rel) == 'success') { let data = this.$utils.deepClone(rel); data.direction = config.direction; - if (config.direction === 'from') { - data._rootId = config.toCiId; - } else { - data._rootId = config.fromCiId; - } - //存在抽象模型和子模型的标识 - let abstractCiList = this.ciEntityData.relEntityData['rel' + config.direction + '_' + config.id]['valueList'] || []; - if (abstractCiList && abstractCiList.length > 1) { - if (data.ciId === data._rootId) { - let subCiList = abstractCiList.filter((item) => { - return item.ciId !== data._rootId; - }); - data.subCiUuidList = this.$utils.mapArray(subCiList, 'ciEntityUuid'); - } else if (data.ciId != data._rootId) { - data._rootUuid = abstractCiList[0].ciEntityUuid; - } - } this.$emit('edit', data); } }, @@ -472,20 +437,6 @@ export default { rel.ciId = ciId; rel._relId = rel.id; this.isRelPopShow[rel.id + '_' + rel.direction] = false; - if (rel.direction === 'from') { - rel._rootId = rel.toCiId; - } else { - rel._rootId = rel.fromCiId; - } - //存在抽象模型和子模型的标识 - if (this.ciEntityData.relEntityData['rel' + rel.direction + '_' + rel.id]) { - let abstractCiList = this.ciEntityData.relEntityData['rel' + rel.direction + '_' + rel.id]['valueList'] || []; - if (abstractCiList && abstractCiList.length > 0) { - if (ciId != rel._rootId) { - rel._rootUuid = abstractCiList[0].ciEntityUuid; - } - } - } this.$emit('new', rel); }, //删除选中的属性 @@ -695,34 +646,25 @@ export default { if (relEntityData && relEntityData['valueList'] && relEntityData['valueList'].length > 0) { relValueList = relEntityData['valueList']; } + //设置了父模型(抽象模型),就不能设置子模型。设置了子模型,就不可以设置父模型,但是还可以设置其他子模型。 if (!this.$utils.isEmpty(relValueList)) { - findItem = relValueList.find(item => item.ciId === relCi.id); //保存的抽象模型 - } - if (findItem) { - isDisabled = true; - } else if (!relCi.isAbstract) { let findAbstractCi = abstractCi && relValueList.find(item => item.ciId === abstractCi.id); - if (!findAbstractCi) { //存在抽象模型,其他子模型才能编辑 + if (findAbstractCi) { isDisabled = true; + } else { + findItem = relValueList.find(item => item.ciId === relCi.id); + if (relCi.isAbstract) { + isDisabled = true; + } else { + if (findItem) { + isDisabled = true; + } + } } } } return isDisabled; }; - }, - isClosableCi() { //存在子模型,抽象模型不能删除 - return (relEntityData, rel, subRel) => { - let isCan = true; - if (relEntityData['rel' + rel.direction + '_' + rel.id]['valueList'] && - relEntityData['rel' + rel.direction + '_' + rel.id]['valueList'].length > 1 - ) { - if ((rel.direction === 'from' && rel['toCiId'] === subRel.ciId) || - (rel.direction === 'to' && rel['formCiId'] === subRel.ciId)) { - isCan = false; - } - } - return isCan; - }; } }, watch: {}