From 428356b5bb37605319166e7addfcf45f3e3e312e Mon Sep 17 00:00:00 2001 From: dengbf Date: Tue, 17 Oct 2023 11:06:40 +0800 Subject: [PATCH 01/16] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20cmdb=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flowedit/components/cmdbsync-node.vue | 163 ++++++++++++++++++ .../process/flow/flowedit/components/index.js | 4 +- .../nodesetting/cmdbsync-setting.vue | 99 +++++++++++ 3 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 src/views/pages/process/flow/flowedit/components/cmdbsync-node.vue create mode 100644 src/views/pages/process/flow/flowedit/components/nodesetting/cmdbsync-setting.vue diff --git a/src/views/pages/process/flow/flowedit/components/cmdbsync-node.vue b/src/views/pages/process/flow/flowedit/components/cmdbsync-node.vue new file mode 100644 index 000000000..5ba32e8cd --- /dev/null +++ b/src/views/pages/process/flow/flowedit/components/cmdbsync-node.vue @@ -0,0 +1,163 @@ + + + diff --git a/src/views/pages/process/flow/flowedit/components/index.js b/src/views/pages/process/flow/flowedit/components/index.js index 08884cb10..19273316f 100644 --- a/src/views/pages/process/flow/flowedit/components/index.js +++ b/src/views/pages/process/flow/flowedit/components/index.js @@ -9,6 +9,7 @@ import autoexec from './autoexec-node'; import timer from './timer-node'; //cmdb import cmdb from '@/views/pages/cmdb/flow/node/index.js'; +import cmdbsync from './cmdbsync-node'; export default { condition, @@ -20,5 +21,6 @@ export default { event, autoexec, ...cmdb, - timer + timer, + cmdbsync }; diff --git a/src/views/pages/process/flow/flowedit/components/nodesetting/cmdbsync-setting.vue b/src/views/pages/process/flow/flowedit/components/nodesetting/cmdbsync-setting.vue new file mode 100644 index 000000000..7c3437073 --- /dev/null +++ b/src/views/pages/process/flow/flowedit/components/nodesetting/cmdbsync-setting.vue @@ -0,0 +1,99 @@ + + + -- Gitee From 81b825067a526a54bdf5bba779550a50878be2b9 Mon Sep 17 00:00:00 2001 From: dengbf Date: Thu, 26 Oct 2023 17:01:10 +0800 Subject: [PATCH 02/16] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E7=BC=96=E8=BE=91=EF=BC=9Acmdb=E5=90=8C=E6=AD=A5=E8=8A=82?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flow/node/cmdbsync.vue} | 26 +- src/views/pages/cmdb/flow/node/index.js | 5 +- .../flow/node/nodesetting/cmdbsync-dialog.vue | 513 +++++++++++++ .../flow/node/nodesetting/cmdbsync-edit.vue | 683 ++++++++++++++++++ .../node}/nodesetting/cmdbsync-setting.vue | 65 +- .../process/flow/flowedit/components/index.js | 4 +- 6 files changed, 1274 insertions(+), 22 deletions(-) rename src/views/pages/{process/flow/flowedit/components/cmdbsync-node.vue => cmdb/flow/node/cmdbsync.vue} (76%) create mode 100644 src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-dialog.vue create mode 100644 src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-edit.vue rename src/views/pages/{process/flow/flowedit/components => cmdb/flow/node}/nodesetting/cmdbsync-setting.vue (59%) diff --git a/src/views/pages/process/flow/flowedit/components/cmdbsync-node.vue b/src/views/pages/cmdb/flow/node/cmdbsync.vue similarity index 76% rename from src/views/pages/process/flow/flowedit/components/cmdbsync-node.vue rename to src/views/pages/cmdb/flow/node/cmdbsync.vue index 5ba32e8cd..af6a30fb2 100644 --- a/src/views/pages/process/flow/flowedit/components/cmdbsync-node.vue +++ b/src/views/pages/cmdb/flow/node/cmdbsync.vue @@ -40,6 +40,8 @@ :nodeConfig="nodeConfig" @updatebutton="updatebutton" > + + + diff --git a/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-edit.vue b/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-edit.vue new file mode 100644 index 000000000..00a8412c6 --- /dev/null +++ b/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-edit.vue @@ -0,0 +1,683 @@ + + + diff --git a/src/views/pages/process/flow/flowedit/components/nodesetting/cmdbsync-setting.vue b/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-setting.vue similarity index 59% rename from src/views/pages/process/flow/flowedit/components/nodesetting/cmdbsync-setting.vue rename to src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-setting.vue index 7c3437073..9e1f63316 100644 --- a/src/views/pages/process/flow/flowedit/components/nodesetting/cmdbsync-setting.vue +++ b/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-setting.vue @@ -15,7 +15,7 @@ - + @@ -25,7 +25,7 @@
+
+
+
模型映射
+
+ 编辑 +
+
+
{{ ciEntityConfig.configList[0].ciName }}
+
+ - diff --git a/src/views/pages/process/flow/flowedit/components/index.js b/src/views/pages/process/flow/flowedit/components/index.js index 19273316f..08884cb10 100644 --- a/src/views/pages/process/flow/flowedit/components/index.js +++ b/src/views/pages/process/flow/flowedit/components/index.js @@ -9,7 +9,6 @@ import autoexec from './autoexec-node'; import timer from './timer-node'; //cmdb import cmdb from '@/views/pages/cmdb/flow/node/index.js'; -import cmdbsync from './cmdbsync-node'; export default { condition, @@ -21,6 +20,5 @@ export default { event, autoexec, ...cmdb, - timer, - cmdbsync + timer }; -- Gitee From 5933ce82d21ba304d5e0e65e11a8eebda988602b Mon Sep 17 00:00:00 2001 From: dengbf Date: Fri, 27 Oct 2023 17:38:58 +0800 Subject: [PATCH 03/16] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20cmbd=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/resources/assets/languages/term/en.json | 3 +- src/resources/assets/languages/term/zh.json | 3 +- .../cmdb/ci/attrhandler/input/table-attr.vue | 1 + src/views/pages/cmdb/flow/node/cmdbsync.vue | 6 +-- .../flow/node/nodesetting/cmdbsync-dialog.vue | 2 - .../flow/node/nodesetting/cmdbsync-edit.vue | 38 ++++++++++++++--- .../node/nodesetting/cmdbsync-setting.vue | 41 +++++++++++++++---- src/views/pages/process/flow/flow-valid.js | 20 +++++++++ 8 files changed, 92 insertions(+), 22 deletions(-) diff --git a/src/resources/assets/languages/term/en.json b/src/resources/assets/languages/term/en.json index 74c1834db..011f8df87 100644 --- a/src/resources/assets/languages/term/en.json +++ b/src/resources/assets/languages/term/en.json @@ -163,7 +163,8 @@ "gotoresourcetypetreesetting": "Please set the root directory in Configuration Management - Asset List", "resourcebatchsearchtooltip": "Batch search is a keyword fuzzy search, in which the wildcard * is supported for batch search of IP, matching any character, such as 192.168.1.1, 192.168.12.1, and 192.168.123.1", "onlybackbone": "Show only backbone relationships", - "showallrel": "Show all branch relationships" + "showallrel": "Show all branch relationships", + "modemapping": "Model Mapping" }, "process": { "workordercenter": "Work Center", diff --git a/src/resources/assets/languages/term/zh.json b/src/resources/assets/languages/term/zh.json index 9572d9380..55de14872 100644 --- a/src/resources/assets/languages/term/zh.json +++ b/src/resources/assets/languages/term/zh.json @@ -163,7 +163,8 @@ "gotoresourcetypetreesetting": "请到配置管理-资产清单中设置根目录", "resourcebatchsearchtooltip": "批量搜索是关键字模糊搜索,其中批量搜索ip时,支持通配符*,匹配任意个字符,例如192.168.*.1可匹配192.168.1.1、192.168.12.1、192.168.123.1", "onlybackbone": "只显示主干关系", - "showallrel": "显示所有分支关系" + "showallrel": "显示所有分支关系", + "modemapping": "模型映射" }, "process": { "workordercenter": "工单中心", diff --git a/src/views/pages/cmdb/ci/attrhandler/input/table-attr.vue b/src/views/pages/cmdb/ci/attrhandler/input/table-attr.vue index be6320fe1..b8bf3532f 100644 --- a/src/views/pages/cmdb/ci/attrhandler/input/table-attr.vue +++ b/src/views/pages/cmdb/ci/attrhandler/input/table-attr.vue @@ -172,6 +172,7 @@ export default { watch: { valueList: { handler: function(val) { + console.log(val, 'val'); if (val && val.length > 0) { //添加配置项 const newCiEntityIdList = []; diff --git a/src/views/pages/cmdb/flow/node/cmdbsync.vue b/src/views/pages/cmdb/flow/node/cmdbsync.vue index af6a30fb2..d140a7119 100644 --- a/src/views/pages/cmdb/flow/node/cmdbsync.vue +++ b/src/views/pages/cmdb/flow/node/cmdbsync.vue @@ -41,7 +41,7 @@ @updatebutton="updatebutton" > - + { if (querySelect != 'assignData') { - this.$refs[`${querySelect}`].valid(); + this.$refs[`${querySelect}`] && this.$refs[`${querySelect}`].valid(); } else { - this.$refs.assignData.assignValid(); + this.$refs.assignData && this.$refs.assignData.assignValid(); } }); }, diff --git a/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-dialog.vue b/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-dialog.vue index b85751361..dcfe353e3 100644 --- a/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-dialog.vue +++ b/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-dialog.vue @@ -145,8 +145,6 @@ export default { changeCiId(val, item) { this.saveCiEntityMap = {}; if (val) { - this.ciData.ciId = val; - this.ciData.ciName = item.text; this.getCiEntityById(); } }, diff --git a/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-edit.vue b/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-edit.vue index 00a8412c6..82918139e 100644 --- a/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-edit.vue +++ b/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-edit.vue @@ -136,6 +136,8 @@ :attrData="e.element" :valueList="getValueList(ciEntityData.attrEntityData, e.element)" @setData="setAttrData(e.element, arguments[0], arguments[1])" + @delete="deleteAttrEntity('attr_' + e.element.id, $event)" + @select="selectAttrEntity('attr_' + e.element.id, $event)" >
@@ -343,7 +345,8 @@ export default { } else if (!data['attr_' + id]['valueList']) { this.$set(data['attr_' + id], 'valueList', []); } - return data['attr_' + id]['valueList']; + console.log(this.ciEntityData.attrEntityData, ' this.ciEntityData.attrEntityData1000'); + return this.$utils.deepClone(data['attr_' + id]['valueList']); }, disabledFn(elementId) { if (this.ciEntityData.editableAttrRelIdList && this.ciEntityData.editableAttrRelIdList.length > 0 && !this.ciEntityData.editableAttrRelIdList.includes(elementId)) { @@ -482,11 +485,13 @@ export default { if (!this.ciEntityData.attrEntityData[key]['actualValueList']) { this.$set(this.ciEntityData.attrEntityData[key], 'actualValueList', []); } - let valueList = this.ciEntityData.attrEntityData[key]['valueList']; - if (valueList.findIndex(v => (typeof v == 'object' && (v.uuid == attrentity.uuid || v.id == attrentity.id)) || (typeof v == 'number' && v == attrentity.id)) == -1) { - this.ciEntityData.attrEntityData[key]['valueList'].push(attrentity); - this.ciEntityData.attrEntityData[key]['actualValueList'].push(attrentity); - } + this.$nextTick(() => { + let valueList = this.ciEntityData.attrEntityData[key]['valueList']; + if (valueList.findIndex(v => (typeof v == 'object' && (v.uuid == attrentity.uuid || v.id == attrentity.id)) || (typeof v == 'number' && v == attrentity.id)) == -1) { + this.ciEntityData.attrEntityData[key]['valueList'].push(attrentity); + this.ciEntityData.attrEntityData[key]['actualValueList'].push(attrentity); + } + }); }, valid() { const attrHandlers = this.$refs['attrHandler']; @@ -550,6 +555,12 @@ export default { if (this.ciEntityData) { const uniqueList = this.ciEntityData['_uniqueAttrList'] || []; const elementList = this.ciEntityData['_elementList']; + //流程节点中,模型映射,下框和table不能新增 + elementList.forEach(e => { + if (e.element.type === 'select' || e.element.type === 'table') { + e.element.config && this.$delete(e.element.config, 'mode'); + } + }); const globalObj = { type: 'global', label: this.$t('term.cmdb.globalattr'), elementList: [], isShow: true }; globalObj.elementList = elementList.filter(d => d.type === 'global'); if (globalObj.elementList.length > 0) { @@ -600,6 +611,21 @@ export default { } return null; }, + // getValueList() { + // return (data, attr) => { + // if (attr) { + // const id = attr.id; + // if (!data['attr_' + id]) { + // this.$set(data, 'attr_' + id, { type: attr.type, config: attr.config, valueList: [] }); + // } else if (!data['attr_' + id]['valueList']) { + // this.$set(data['attr_' + id], 'valueList', []); + // } + // return data['attr_' + id]['valueList']; + // } else { + // return null; + // } + // }; + // }, getFormComponent() { return (type) => { let dataList = []; diff --git a/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-setting.vue b/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-setting.vue index 9e1f63316..1a8d9874c 100644 --- a/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-setting.vue +++ b/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-setting.vue @@ -35,12 +35,17 @@
-
模型映射
+
{{ $t('term.cmdb.modemapping') }}
- 编辑 + {{ $t('page.edit') }}
-
{{ ciEntityConfig.configList[0].ciName }}
+
{{ ciEntityConfig.configList[0].ciLabel }} + ({{ ciEntityConfig.configList[0].ciName }}) +
+
+ {{ $t('form.validate.required', { target: $t('term.cmdb.modemapping') }) }} +
@@ -52,7 +57,6 @@ export default { TsFormSwitch: resolve => require(['@/resources/plugins/TsForm/TsFormSwitch'], resolve), TsFormSelect: resolve => require(['@/resources/plugins/TsForm/TsFormSelect'], resolve), CmdbsyncDialog: resolve => require(['./cmdbsync-dialog.vue'], resolve) - }, props: { defaultCiEntityConfig: Object @@ -66,7 +70,8 @@ export default { failPolicy: '', rerunStepToSync: 0, configList: [] - } + }, + isValid: true //校验 }; }, beforeCreate() {}, @@ -74,9 +79,7 @@ export default { this.getFailPolicyList(); }, beforeMount() {}, - mounted() { - this.initData(); - }, + mounted() {}, beforeUpdate() {}, updated() {}, activated() {}, @@ -128,13 +131,33 @@ export default { } this.isShowDialog = false; }, + valid() { + this.isValid = true; + if (!this.$refs.failPolicy.valid()) { + this.isValid = false; + } + if (this.$utils.isEmpty(this.ciEntityConfig.configList)) { + this.isValid = false; + } + return this.isValid; + }, save() { return this.ciEntityConfig; } }, filter: {}, computed: {}, - watch: {} + watch: { + defaultCiEntityConfig: { + handler(val) { + if (!this.$utils.isEmpty(val)) { + this.initData(); + } + }, + deep: true, + immediate: true + } + } }; diff --git a/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-dialog.vue b/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-dialog.vue index dcfe353e3..dec5c95b9 100644 --- a/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-dialog.vue +++ b/src/views/pages/cmdb/flow/node/nodesetting/cmdbsync-dialog.vue @@ -11,7 +11,26 @@