修改
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
</div>
|
||||
<div class="boxBody">
|
||||
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="80px"
|
||||
@keyup.enter.native="submitForm(ruleForm)" @submit.native.prevent>
|
||||
@keyup.enter.native="submitForm(ruleForm)" @submit.native.prevent>
|
||||
<el-form-item label="名称:" prop="sourceName">
|
||||
<!-- @input="removeSpaces" -->
|
||||
<el-input v-model.trim="form.sourceName" placeholder="节点名称"></el-input>
|
||||
@ -29,12 +29,13 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { $changeComponentPop } from '@/utils/communication'
|
||||
import { throttle } from '@/utils/index'
|
||||
import { ElMessage, FormInstance } from 'element-plus'
|
||||
import { TreeApi } from '@/api/tree'
|
||||
import { useTreeNode } from '@/views/components/tree/hooks/treeNode'
|
||||
const { getKeyOfSelectedNode, getSelectedNode, cusUpdateNode, getSameLevel, getSelectedNodes } = useTreeNode()
|
||||
import {$changeComponentPop} from '@/utils/communication'
|
||||
import {throttle} from '@/utils/index'
|
||||
import {ElMessage, FormInstance} from 'element-plus'
|
||||
import {TreeApi} from '@/api/tree'
|
||||
import {useTreeNode} from '@/views/components/tree/hooks/treeNode'
|
||||
|
||||
const {getKeyOfSelectedNode, getSelectedNode, cusUpdateNode, getSameLevel, getSelectedNodes} = useTreeNode()
|
||||
const title = ref('编辑节点')
|
||||
const sourceId = ref('')
|
||||
let form: any = reactive({
|
||||
@ -42,7 +43,7 @@ let form: any = reactive({
|
||||
})
|
||||
const ruleForm = ref()
|
||||
const rules = reactive({
|
||||
sourceName: [{ required: true, message: '请输入名称', trigger: 'blur' }]
|
||||
sourceName: [{required: true, message: '请输入名称', trigger: 'blur'}]
|
||||
})
|
||||
const removeSpaces = (value: string) => {
|
||||
form.sourceName = value.replace(/\s/g, '')
|
||||
@ -70,7 +71,7 @@ const add = throttle(async () => {
|
||||
id: sourceId.value,
|
||||
sourceName: form.sourceName
|
||||
})
|
||||
cusUpdateNode({ id: sourceId.value, sourceName: form.sourceName, params: undefined })
|
||||
cusUpdateNode({id: sourceId.value, sourceName: form.sourceName, params: undefined})
|
||||
close()
|
||||
// console.log(res)
|
||||
}, 3000)
|
||||
@ -117,6 +118,7 @@ defineExpose({
|
||||
|
||||
<style lang="scss">
|
||||
.editdirectoryBox {
|
||||
|
||||
user-select: none;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
|
||||
@ -428,7 +428,7 @@ let rightClick = (event: MouseEvent, treeId: string, treeNode: any) => {
|
||||
let menus = showRightMenuTs(event, treeObj.value, getSelectedNodes(treeObj.value), nodeType)
|
||||
// console.log("menus", menus)
|
||||
// canCheckType.includes(treeNode.sourceType) 包含的类型才有视角
|
||||
if (treeNode && treeNode.sourceType != 'directory') {
|
||||
if (treeNode && treeNode.sourceType != 'directory' && selectNodes.length == 1) {
|
||||
let customView
|
||||
let entity = window['_entityMap'].get(treeNode.id)
|
||||
customView = Boolean(entity.customView && entity.customView.orientation)
|
||||
|
||||
@ -110,13 +110,27 @@ const updateEvent = () => {
|
||||
let durationS = eventObj.value.duration_time
|
||||
// console.log("eventObj.value", eventObj.value)
|
||||
// console.log("eventObj.value", durationS)
|
||||
// 数据是否合法有效
|
||||
let isRight = true
|
||||
let errorFields = []//数据错误的字段
|
||||
if (!durationS)
|
||||
durationS = (eventObj.value.endTime - eventObj.value.startTime) / 1000
|
||||
switch (eventObj.value.callback) {
|
||||
case "flicker":
|
||||
detail.value.times = Number((durationS / detail.value.numbers).toFixed(2))
|
||||
if (Number(obj.numbers) == 0 || !Number(obj.numbers)) {
|
||||
isRight = false
|
||||
errorFields.push("闪烁次数")
|
||||
}
|
||||
if (isRight) {
|
||||
detail.value.times = Number((durationS / detail.value.numbers).toFixed(2))
|
||||
}
|
||||
break
|
||||
}
|
||||
if (!isRight) {
|
||||
let eventType = eventObj.value.name.split("-")[0] + "事件"
|
||||
ElMessage({message: eventType + errorFields.join("、") + "数据不合法", type: "warning"})
|
||||
return
|
||||
}
|
||||
obj.detail = JSON.stringify(detail.value)
|
||||
console.log(obj)
|
||||
delete obj.createdAt
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
import {$changeComponentPop} from '@/utils/communication'
|
||||
import {throttle} from '@/utils/index'
|
||||
import {ElMessage, FormInstance} from 'element-plus'
|
||||
import {TreeApi} from '@/api/tree'
|
||||
import {useTreeNode} from '@/views/components/tree/hooks/treeNode'
|
||||
import {addMapSource} from "../entity";
|
||||
import {useI18n} from 'vue-i18n'
|
||||
@ -51,7 +50,7 @@ const removeSpaces = (value: string) => {
|
||||
form.sourceName = value.replace(/\s/g, '')
|
||||
}
|
||||
const close = () => {
|
||||
$changeComponentPop('.adddirectory', false)
|
||||
$changeComponentPop('.tsdirectory', false)
|
||||
}
|
||||
const submitForm = async (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return
|
||||
@ -75,66 +74,8 @@ const add = throttle(async () => {
|
||||
cancel()
|
||||
}
|
||||
})
|
||||
/* const res: any = await TreeApi.addDirectory({
|
||||
id: new YJ.Tools().randomString(),
|
||||
sourceName: form.sourceName,
|
||||
parentId: parentId || undefined
|
||||
})
|
||||
console.log(res)
|
||||
if (res.code == 0 || res.code == 200) {
|
||||
const node = {
|
||||
...res.data
|
||||
}
|
||||
let addNode = await cusAddNodes(window.treeObj, getSelectedNode(window.treeObj), [node], true) //添加节点
|
||||
//获取该节点下的同级节点
|
||||
const someNode: any = getSameLevel(window.treeObj, addNode[0])
|
||||
console.log('someNode', someNode)
|
||||
const newNode = someNode.map((item: any) => {
|
||||
let index = item.getIndex()
|
||||
item.treeIndex = index + 1
|
||||
return {
|
||||
...item,
|
||||
treeIndex: item.getIndex()
|
||||
}
|
||||
})
|
||||
ElMessage({
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
})
|
||||
cancel()
|
||||
} else {
|
||||
ElMessage({
|
||||
message: '添加失败',
|
||||
type: 'error'
|
||||
})
|
||||
}*/
|
||||
// console.log(res)
|
||||
}, 3000)
|
||||
////上传或修改树的层级
|
||||
// const updateTree = async (newNode: any) => {
|
||||
// const list = newNode.map((item: any) => {
|
||||
// return {
|
||||
// id: item.id,
|
||||
// treeIndex: item.treeIndex,
|
||||
// parentId: item.parentId
|
||||
// }
|
||||
// })
|
||||
// console.log(list)
|
||||
// const res = await TreeApi.updateTree({ list })
|
||||
// if (res.code == 0) {
|
||||
// ElMessage({
|
||||
// message: '添加成功',
|
||||
// type: 'success'
|
||||
// })
|
||||
|
||||
// cancel()
|
||||
// } else {
|
||||
// ElMessage({
|
||||
// message: '添加失败',
|
||||
// type: 'error'
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
}, 3000)
|
||||
|
||||
const cancel = () => {
|
||||
$changeComponentPop('.tsdirectory', false)
|
||||
|
||||
@ -171,6 +171,8 @@
|
||||
<deduction :TSOBJ="tsOBJ"></deduction>
|
||||
<newEvent></newEvent>
|
||||
<addDirectory class="adddirectoryBox absolute zIndex999"></addDirectory>
|
||||
<directoryTs ref="editDirectoryTsBox" class="editDirectoryTsBox absolute zIndex999"></directoryTs>
|
||||
|
||||
<mouseRight></mouseRight>
|
||||
<component :is="currentComponent" ref="dynamicComponentRef"/>
|
||||
<!-- 方案描述编辑框 -->
|
||||
@ -319,11 +321,13 @@ import {ElMessage} from "element-plus";
|
||||
import {addMapSource} from "../../common/addMapSource";
|
||||
import {$changeComponentShow} from "../../utils/communication";
|
||||
import {useI18n} from "vue-i18n";
|
||||
import directoryTs from "./edit/directoryTs.vue";
|
||||
import billboardObject from "./edit/billboardObjectTs.vue";
|
||||
import polylineObject from "./edit/polylineObjectTs.vue";
|
||||
import polygonObject from "./edit/polygonObjectTs.vue";
|
||||
|
||||
const {t} = useI18n()
|
||||
let editDirectoryTsBox = ref()
|
||||
const planInfo = ref({})
|
||||
const isShowPup = ref(false)
|
||||
const showStandText = ref(false)
|
||||
@ -569,6 +573,10 @@ eventBus.on('openDialog', async (sourceType: any, id: any) => {
|
||||
dynamicComponentRef.value.close()
|
||||
}
|
||||
switch (sourceType) {
|
||||
case 'directory':
|
||||
console.log(editDirectoryTsBox.value)
|
||||
editDirectoryTsBox.value.open()
|
||||
break
|
||||
case 'point':
|
||||
currentComponent.value = billboardObject
|
||||
await nextTick()
|
||||
@ -748,7 +756,7 @@ eventBus.on('destroyComponent', (id) => {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.adddirectoryBox {
|
||||
.adddirectoryBox, .editDirectoryTsBox {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
228
src/renderer/src/views/TS/edit/directoryTs.vue
Normal file
228
src/renderer/src/views/TS/edit/directoryTs.vue
Normal file
@ -0,0 +1,228 @@
|
||||
<template>
|
||||
<div class="directoryTs">
|
||||
<div class="box">
|
||||
<div class="boxHeader nav">
|
||||
<!-- <span></span> -->
|
||||
<span class="label">{{ title }}</span>
|
||||
<div class="close-box" @click="close">
|
||||
<span class="close"></span>
|
||||
<i>x</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="boxBody">
|
||||
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="80px"
|
||||
@keyup.enter.native="submitForm(ruleForm)" @submit.native.prevent>
|
||||
<el-form-item label="名称:" prop="sourceName">
|
||||
<!-- @input="removeSpaces" -->
|
||||
<el-input v-model.trim="form.sourceName" placeholder="节点名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div class="btnOption">
|
||||
<el-button type="primary" @click="submitForm(ruleForm)">确定</el-button>
|
||||
<el-button @click="close">取消</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {inject, ref} from "vue";
|
||||
import {$changeComponentPop} from "../../../utils/communication";
|
||||
import {FormInstance} from "element-plus";
|
||||
import {throttle} from '@/utils/index'
|
||||
import {useTreeNode} from "../../components/tree/hooks/treeNode";
|
||||
import {TsApi} from "../../../api/ts";
|
||||
|
||||
const {getSelectedNodes, cusSelectNode, getSameLevel, cusNodeIcon, nodeType, cusUpdateNode} = useTreeNode()
|
||||
const title = ref('编辑节点')
|
||||
const eventBus: any = inject('bus')
|
||||
const baseDialog: any = ref(null)
|
||||
const sourceId = ref('')
|
||||
let form: any = reactive({
|
||||
sourceName: ''
|
||||
})
|
||||
const ruleForm = ref()
|
||||
const rules = reactive({
|
||||
sourceName: [{required: true, message: '请输入名称', trigger: 'blur'}]
|
||||
})
|
||||
const close = () => {
|
||||
$changeComponentPop('.editDirectoryTsBox', false)
|
||||
setTimeout(() => {
|
||||
sourceId.value = ''
|
||||
form.sourceName = ''
|
||||
ruleForm.value?.resetFields()
|
||||
}, 200);
|
||||
}
|
||||
const submitForm = async (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return
|
||||
await formEl.validate((valid, fields) => {
|
||||
if (valid) {
|
||||
add()
|
||||
} else {
|
||||
console.log('error submit!', fields)
|
||||
}
|
||||
})
|
||||
}
|
||||
const add = throttle(async () => {
|
||||
const res: any = await TsApi.updateTsSource({
|
||||
id: sourceId.value,
|
||||
sourceName: form.sourceName
|
||||
})
|
||||
cusUpdateNode({id: sourceId.value, sourceName: form.sourceName, params: undefined})
|
||||
close()
|
||||
console.log(res, form.sourceName)
|
||||
}, 3000)
|
||||
const open = () => {
|
||||
console.log("文件夹编辑框")
|
||||
let selectNodes = getSelectedNodes(window.treeObj);
|
||||
if (selectNodes && selectNodes[selectNodes.length - 1]) {
|
||||
sourceId.value = selectNodes[selectNodes.length - 1].id
|
||||
form.sourceName = selectNodes[selectNodes.length - 1].sourceName
|
||||
$changeComponentPop('.editDirectoryTsBox', true)
|
||||
}
|
||||
}
|
||||
const closeCallback = () => {
|
||||
/* entityOptions.value.originalOptions = structuredClone(originalOptions)
|
||||
that.positionEditing = false
|
||||
that.reset()*/
|
||||
eventBus?.emit('destroyComponent')
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.directoryTs {
|
||||
|
||||
user-select: none;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
|
||||
.box {
|
||||
width: 20vw;
|
||||
height: 10vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 45%;
|
||||
transform: translate(-50%, -50%);
|
||||
color: var(--color-sdk-auxiliary-public);
|
||||
font-size: 14px;
|
||||
// z-index: 999999;
|
||||
background: linear-gradient(0deg, var(--color-sdk-bg-gradual)), rgba(0, 0, 0, 0.6);
|
||||
border: 1.5px solid;
|
||||
backdrop-filter: blur(2px);
|
||||
border-image: linear-gradient(to bottom, var(--color-sdk-gradual)) 1;
|
||||
text-align: left;
|
||||
font-family: 'sy-boldface';
|
||||
|
||||
.boxHeader {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 18px;
|
||||
line-height: 46px;
|
||||
padding: 5px 16px 5px 16px;
|
||||
height: 46px;
|
||||
|
||||
.label {
|
||||
font-family: 'Ali-mother-counts-bold';
|
||||
font-size: 18px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
text-align: left;
|
||||
text-shadow: 0px 0px 9px rgb(20 118 255);
|
||||
}
|
||||
|
||||
.close-box {
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
right: 0;
|
||||
height: 30px;
|
||||
cursor: pointer;
|
||||
width: 30px;
|
||||
border-radius: 0 0 0 90%;
|
||||
overflow: hidden;
|
||||
|
||||
.close {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(var(--color-base1), 1);
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
i {
|
||||
font-style: normal;
|
||||
font-size: 18px;
|
||||
font-weight: 900;
|
||||
position: absolute;
|
||||
top: -13px;
|
||||
left: 11px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.boxBody {
|
||||
flex: auto;
|
||||
flex-direction: column;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
padding: 20px;
|
||||
|
||||
.el-form--label-top .el-form-item__label {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
:deep(.el-form-item__label) {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.el-input__wrapper {
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
border: 0.2px solid rgba(var(--color-base1), 0.5);
|
||||
box-shadow: 0 0 0 0.2px rgba(var(--color-base1), 0.5) inset !important;
|
||||
/* 新增此行 */
|
||||
}
|
||||
|
||||
.el-input__inner {
|
||||
background-color: transparent;
|
||||
color: #fff;
|
||||
// border-color: rgba(var(--color-base1), 0.5) !important;
|
||||
}
|
||||
|
||||
.btnOption {
|
||||
margin-top: 5px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.el-button {
|
||||
background: rgba(var(--color-base1), 0.2);
|
||||
border-color: rgba(var(--color-base1), 0.5) !important;
|
||||
color: #ffffff;
|
||||
padding: 8px 16px;
|
||||
}
|
||||
|
||||
.el-button:hover {
|
||||
border-color: rgba(var(--color-base1), 1) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -62,6 +62,7 @@ export class TS extends Tools {
|
||||
const value = l.num
|
||||
// 第几个大格,小标-=1
|
||||
this.setWheel(value)
|
||||
this._Store.setCursorLeft(this._Store._currentTimestamp)
|
||||
break;
|
||||
case "scroll-chart":
|
||||
this._Store._scales.scrollTop = obj.top
|
||||
|
||||
Reference in New Issue
Block a user