Commit 3216fafd by 郁子恒

新增跳转页面动作,完善点击、输入动作,单个动作导出软件可执行

parents 541697ee a2fe75d9
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
<draggable v-model="treeNode" chosenClass="chosen" forceFallback="true" group="people" animation="1000" @start="onStart" @end="onEnd" v-if="isChildrenTree == false"> <draggable v-model="treeNode" chosenClass="chosen" forceFallback="true" group="people" animation="1000" @start="onStart" @end="onEnd" v-if="isChildrenTree == false">
<transition-group> <transition-group>
<el-tag class="boxtags" :key="tag.tagId" v-for="(tag, index) in treeNode" @click="selectTag(tag)" :style="{ backgroundColor: tag.Kvid == Kvid ? '#68C23A!important' : '#409EFF' }"> <el-tag class="boxtags" :key="tag.tagId" v-for="(tag, index) in treeNode" @click="selectTag(tag)" :style="{ backgroundColor: tag.Kvid == Kvid ? '#68C23A!important' : '#409EFF' }">
>>>>>>> a2fe75d9465a60707de78a267eed1fecb935958e
<div style="display: flex;align-items: center;height: 25px;position: relative;"> <div style="display: flex;align-items: center;height: 25px;position: relative;">
<span style="min-width: 40px;display: flex;align-items: center;"> <span style="min-width: 40px;display: flex;align-items: center;">
<div class="circle">{{ index + 1 }}</div> <div class="circle">{{ index + 1 }}</div>
...@@ -79,7 +80,9 @@ ...@@ -79,7 +80,9 @@
<!-- 容器配置 --> <!-- 容器配置 -->
<div v-if="isShowAction"> <div v-if="isShowAction">
<div style="height: 35px;display: flex;justify-content: space-between;align-items: center;border-bottom: 1px solid #888888;"> <div style="height: 35px;display: flex;justify-content: space-between;align-items: center;border-bottom: 1px solid #888888;">
<div style="width: 211px;display: flex;align-items: center;margin-left: 15px;"> <div style="height: 35px;display: flex;justify-content: space-between;align-items: center;margin-left: 15px;margin-right: 15px;">
<div style="width: 211px;display: flex;align-items: center;">
>>>>>>> a2fe75d9465a60707de78a267eed1fecb935958e
<span style="width: 90px;">动作名称:</span> <span style="width: 90px;">动作名称:</span>
<el-input class="input-new-tag dongzuo" v-model="actionName" size="small" placeholder="请输入动作名称"> <el-input class="input-new-tag dongzuo" v-model="actionName" size="small" placeholder="请输入动作名称">
</el-input> </el-input>
...@@ -99,6 +102,7 @@ ...@@ -99,6 +102,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</template> </template>
<script> <script>
...@@ -178,7 +182,8 @@ export default { ...@@ -178,7 +182,8 @@ export default {
Kvid: 123123, Kvid: 123123,
actions: [] actions: []
}], }],
actionConfigs: {} actionConfigs: {},
selectTagItem: {}
} }
}, },
...@@ -197,8 +202,7 @@ export default { ...@@ -197,8 +202,7 @@ export default {
actionName (newVal, oldVal) { actionName (newVal, oldVal) {
// 在输入值发生变化时触发 // 在输入值发生变化时触发
if (newVal !== oldVal) { if (newVal !== oldVal) {
// console.log(newVal)
// console.log(this.dynamicTags)
const targetObject = this.dynamicTags.find(obj => obj.tagId === this.dynamicTagObj.tagId); const targetObject = this.dynamicTags.find(obj => obj.tagId === this.dynamicTagObj.tagId);
if (targetObject) { if (targetObject) {
if (newVal == undefined) return if (newVal == undefined) return
...@@ -292,7 +296,7 @@ export default { ...@@ -292,7 +296,7 @@ export default {
// console.log(this.subData); // console.log(this.subData);
// console.log('接收到的数据:', newData); // console.log('接收到的数据:', newData);
const targetObject = this.dynamicTags.find(obj => obj.Kvid === this.dynamicTagObj.Kvid); const targetObject = this.dynamicTags.find(obj => obj.Kvid === this.dynamicTagObj.Kvid);
console.log(targetObject) // console.log(targetObject)
if (targetObject) { if (targetObject) {
// if (newVal == undefined) return // if (newVal == undefined) return
// // 找到匹配的对象 // // 找到匹配的对象
...@@ -312,6 +316,7 @@ export default { ...@@ -312,6 +316,7 @@ export default {
this.actionName = "新建动作" this.actionName = "新建动作"
this.actionType = "" this.actionType = ""
this.Kvid = null this.Kvid = null
this.selectTagItem = {}
let obj = {} let obj = {}
obj.taskName = this.taskName obj.taskName = this.taskName
obj.taskAddress = this.taskAddress obj.taskAddress = this.taskAddress
...@@ -342,43 +347,86 @@ export default { ...@@ -342,43 +347,86 @@ export default {
}, },
// 进入容器 // 进入容器
toActions () { toActions () {
this.isShowAction = false let _this = this
if (this.actionType == 'actions') { _this.isShowAction = false
// this.actionType = '' if (_this.actionType == 'actions') {
// this.actionName = '' if (Object.keys(_this.selectTagItem).length == 0) {
this.parentKvid = this.Kvid _this.parentKvid = _this.Kvid
let activeItem = this.findObjectByKvid(this.treeNode, this.Kvid); }
this.childrenTreeNode = [] let activeItem = _this.findObjectByKvid(_this.treeNode, _this.Kvid);
this.isChildrenTree = true _this.childrenTreeNode = []
console.log(activeItem) _this.isChildrenTree = true
let activeParentItem = this.findObjectByKvid(this.treeNode, activeItem.parentKvid); let activeParentItem = _this.findObjectByKvid(_this.treeNode, activeItem.parentKvid);
activeItem.actions = []
if (activeParentItem == null) { if (activeParentItem == null) {
console.log('已经有容器了') //根节点再次进容器
// if (this.actionAll[0].actions.length > 0) return if (Object.keys(_this.selectTagItem).length !== 0) {
_this.Kvid = _this.selectTagItem.Kvid
let obj = {}
obj.name = _this.selectTagItem.actionName
obj.Kvid = _this.selectTagItem.Kvid
obj.actions = []
// console.log(_this.treeNode)
for (let i = 0; i < _this.treeNode.length; i++) {
_this.actionAll[0].actions.push(_this.treeNode[i])
}
_this.actionAll.push(obj)
_this.findOrPushObject(_this.actionAll[0].actions, obj)
_this.childrenTreeNode = []
_this.isChildrenTree = true
if (_this.selectTagItem.actions != undefined && _this.selectTagItem.actions.length > 0) {
_this.childrenTreeNode = []
for (let i = 0; i < _this.selectTagItem.actions.length; i++) {
_this.childrenTreeNode.push(_this.selectTagItem.actions[i])
}
_this.isChildrenTree = true
}
} else {
let obj = {} let obj = {}
obj.name = activeItem.actionName obj.name = activeItem.actionName
obj.Kvid = activeItem.Kvid obj.Kvid = activeItem.Kvid
obj.actions = [] obj.actions = []
console.log(this.treeNode) // console.log(_this.treeNode)
for (let i = 0; i < this.treeNode.length; i++) { for (let i = 0; i < _this.treeNode.length; i++) {
this.actionAll[0].actions.push(this.treeNode[i]) _this.actionAll[0].actions.push(_this.treeNode[i])
}
_this.actionAll.push(obj)
_this.findOrPushObject(_this.actionAll[0].actions, obj)
}
} else {
// 子节点再次进入容器
if (Object.keys(_this.selectTagItem).length !== 0) {
_this.childrenTreeNode = []
let obj = {}
obj.name = _this.selectTagItem.actionName
obj.Kvid = _this.selectTagItem.Kvid
obj.actions = []
for (let i = 0; i < _this.selectTagItem.actions.length; i++) {
obj.actions.push(_this.selectTagItem.actions[i])
_this.childrenTreeNode.push(_this.selectTagItem.actions[i])
}
_this.findOrPushObject(_this.actionAll, obj)
_this.isChildrenTree = true
if (_this.selectTagItem.actions != undefined && _this.selectTagItem.actions.length > 0) {
_this.childrenTreeNode = []
for (let i = 0; i < _this.selectTagItem.actions.length; i++) {
_this.childrenTreeNode.push(_this.selectTagItem.actions[i])
}
_this.isChildrenTree = true
} }
this.actionAll.push(obj)
this.findOrPushObject(this.actionAll[0].actions, obj)
} else { } else {
// this.actionType = ''
// this.actionName = ''
let obj = {} let obj = {}
obj.name = activeItem.actionName obj.name = activeItem.actionName
obj.Kvid = activeItem.Kvid obj.Kvid = activeItem.Kvid
obj.actions = [] obj.actions = []
activeItem.actions = []
for (let i = 0; i < activeItem.actions.length; i++) { for (let i = 0; i < activeItem.actions.length; i++) {
obj.actions.push(activeItem.actions[i]) obj.actions.push(activeItem.actions[i])
} }
this.childrenTreeNode = obj.actions _this.childrenTreeNode = obj.actions
this.findOrPushObject(this.actionAll, obj) _this.findOrPushObject(_this.actionAll, obj)
// console.log(this.actionAll) }
} }
} else { } else {
this.parentKvid = null this.parentKvid = null
...@@ -421,42 +469,25 @@ export default { ...@@ -421,42 +469,25 @@ export default {
this.parentKvid = item.Kvid this.parentKvid = item.Kvid
this.isShowAction = false this.isShowAction = false
} }
console.log() // console.log()
}, },
// 单击标签 // 单击标签
selectTag (item) { selectTag (item) {
// this.parentTree = item // this.parentTree = item
// console.log(item)
let _this = this let _this = this
_this.selectTagItem = item
if (item.actionType == 'actions') { if (item.actionType == 'actions') {
if (_this.parentKvid == null && item.parentKvid == undefined) { if (_this.parentKvid == null && item.parentKvid == undefined) {
_this.parentKvid = item.Kvid _this.parentKvid = item.Kvid
console.log(item) _this.actionType = item.actionType
let obj = {} _this.actionName = item.actionName
obj.name = item.actionName _this.isShowAction = true
obj.Kvid = item.Kvid
obj.actions = []
for (let i = 0; i < _this.treeNode.length; i++) {
_this.actionAll[0].actions.push(_this.treeNode[i])
}
_this.actionAll.push(obj)
_this.findOrPushObject(_this.actionAll[0].actions, obj)
_this.childrenTreeNode = []
_this.isChildrenTree = true
} else { } else {
_this.parentKvid = item.Kvid _this.parentKvid = item.Kvid
_this.childrenTreeNode = [] _this.actionName = item.actionName
_this.isShowAction = false _this.actionType = item.actionType
let obj = {} _this.isShowAction = true
obj.name = item.actionName
obj.Kvid = item.Kvid
obj.actions = []
for (let i = 0; i < item.actions.length; i++) {
obj.actions.push(item.actions[i])
_this.childrenTreeNode.push(item.actions[i])
}
_this.findOrPushObject(_this.actionAll, obj)
_this.isChildrenTree = true
} }
} else { } else {
_this.actionName = item.actionName _this.actionName = item.actionName
...@@ -464,13 +495,6 @@ export default { ...@@ -464,13 +495,6 @@ export default {
_this.isShowAction = true _this.isShowAction = true
} }
_this.Kvid = item.Kvid _this.Kvid = item.Kvid
if (item.actions != undefined && item.actions.length > 0) {
_this.childrenTreeNode = []
for (let i = 0; i < item.actions.length; i++) {
_this.childrenTreeNode.push(item.actions[i])
}
_this.isChildrenTree = true
}
_this.dynamicTagObj = item _this.dynamicTagObj = item
// 点击切换组件 // 点击切换组件
_this.loadComponent(item.actionType) _this.loadComponent(item.actionType)
...@@ -592,6 +616,7 @@ export default { ...@@ -592,6 +616,7 @@ export default {
submitPlan (formName) { submitPlan (formName) {
this.isShowAction = true this.isShowAction = true
console.log(this.subData) console.log(this.subData)
// console.log(this.treeNode)
// 将JSON对象转换为JSON字符串 // 将JSON对象转换为JSON字符串
// const arrayOfObjects = [this.subData]; // const arrayOfObjects = [this.subData];
const jsonString = JSON.stringify(this.subData, null, 2); const jsonString = JSON.stringify(this.subData, null, 2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment