jinx 2 gadi atpakaļ
vecāks
revīzija
24703775ed

+ 5 - 2
src/components/files/TagEditor.vue

@@ -36,7 +36,7 @@
     </div>
 </template>
 <script setup>
-import { ref, inject, onMounted, onBeforeUnmount, watch } from 'vue'
+import { ref, inject, onMounted, onBeforeUnmount, watch, defineEmits } from 'vue'
 import { convertBlob2File } from '@/utils/file'
 import { http } from '@/utils/request'
 import browser from '@/utils/browser'
@@ -48,6 +48,7 @@ import UiMedias from '../form/medias'
 import UiSelectList from '../form/SelectList.vue'
 import { from } from 'readable-stream'
 import i18n from '@/i18n'
+const emits = defineEmits(['action'])
 const { t } = i18n.global
 const showLoading = ref(false)
 const showTips = ref(null)
@@ -160,6 +161,7 @@ const handlerUpload = async data => {
 
     http.post(`smart-site/marking/addOrUpdate`, params).then(response => {
         showLoading.value = false
+
         if (response.success) {
             notify.value.status = tag.status
             notify.value.members = tag.members
@@ -169,7 +171,7 @@ const handlerUpload = async data => {
                 pushData.content = tag.content
                 pushData.members = tag.members
                 pushData.createTime = response.data.createTime
-              
+
                 tags.value.push(pushData)
                 pushData = null
             }
@@ -177,6 +179,7 @@ const handlerUpload = async data => {
             delete notify.value.__temp
             notify.value.id = response.data.markingId
             notify.value = null
+            emits('action', '提交成功')
         } else if (response.code == 4008) {
             showTips.value = t('code.4008')
         } else {

+ 5 - 2
src/components/files/TagItem.vue

@@ -6,7 +6,7 @@
         :style="{ transform: `translate(${props.tag.x}px,${props.tag.y}px)`, display: props.tag.visible ? 'block' : 'none' }"
         class="tag-item"
     >
-        <div class="tag-icon">
+        <div class="tag-icon" :class="{ active: editTagId == props.tag.sid }">
             <span>{{ props.index }} </span>
         </div>
     </div>
@@ -26,8 +26,8 @@ const props = defineProps({
 
 const notify = inject('notify')
 const isEdit = inject('isEdit')
+const editTagId = inject('editTagId')
 const onClick = () => {
-  console.log(isEdit.value)
     if (isEdit.value) {
         return
     }
@@ -74,6 +74,9 @@ const onClick = () => {
     border: 1px solid #fff;
     transform: rotate(-135deg);
     background-color: #0076f6;
+    &.active {
+        background-color: green;
+    }
     span {
         display: block;
         transform: rotate(135deg);

+ 7 - 4
src/components/files/TagManager.vue

@@ -4,13 +4,14 @@
         <TagEditor v-if="notify && isEdit" :notify="notify" @action="onAction" />
         <TagView v-if="notify && !isEdit" :notify="notify" />
     </div>
+    <Toast v-if="showTips" type="warn" :content="showTips" :close="() => (showTips = null)" />
 </template>
 <script setup>
-import { inject, watch, computed } from 'vue'
+import { inject, watch, computed ,ref} from 'vue'
 import TagItem from './TagItem.vue'
 import TagEditor from './TagEditor.vue'
 import TagView from './TagView.vue'
-
+import Toast from '@/components/dialog/Toast'
 let timer = setInterval(() => {
     if (window.kankan) {
         init(window.kankan)
@@ -20,14 +21,16 @@ let timer = setInterval(() => {
         clearInterval(timer)
     }
 }, 50)
-
+const showTips = ref(null)
 const notify = inject('notify')
 const tags = inject('tags')
 const isEdit = inject('isEdit')
 const init = sdk => {
     // sdk.TagManager.load(tags)
 }
-
+const onAction = text => {
+    showTips.value = text
+}
 const initLaserTag = () => {
     window.laser.then(sdk => {
         sdk.scene.on('posChange', cameraPos => {

+ 12 - 3
src/components/files/index.vue

@@ -41,7 +41,7 @@
     <Toast v-if="showTips" type="warn" :content="showTips" :close="() => (showTips = null)" />
 </template>
 <script setup>
-import { ref, inject, watchEffect, onMounted, nextTick } from 'vue'
+import { ref, inject, watchEffect, onMounted, nextTick, watch } from 'vue'
 import browser from '@/utils/browser'
 import { http } from '@/utils/request'
 import UiConfirm from '@/components/dialog/Confirm.vue'
@@ -80,10 +80,18 @@ const showFiles = ref(false)
 const showToolbar = ref(false)
 const showMoreSid = ref('')
 const tags = inject('tags')
-
+const editTagId = inject('editTagId')
 const notify = inject('notify')
 const isEdit = inject('isEdit')
 const isFlying = inject('isFlying')
+watch(
+    () => isEdit.value,
+    (val, old) => {
+        if (!val) {
+            editTagId.value = null
+        }
+    }
+)
 const onClick = tag => {
     notify.value = null
     nextTick(() => {
@@ -109,7 +117,7 @@ const onAdd = () => {
         showToolbar.value = true
     }
 }
-const laserPosition = (tag) => {
+const laserPosition = tag => {
     window.laser.then(sdk => {
         let pos = tag.position
         sdk.scene.comeToTag(new THREE.Vector3(pos.x, pos.y, pos.z))
@@ -249,6 +257,7 @@ const onMoreHandler = (type, tag) => {
                 editor.enter(editTag)
             })
         } else {
+            editTagId.value = editTag.sid
             laserPosition(editTag)
         }
         // window.kankan.TagManager.focusBeforeModify(editTag.sid)

+ 9 - 6
src/pages/Viewer.vue

@@ -72,18 +72,19 @@
                 </div>
             </div>
             <div class="model" v-show="showWidget && !showAdjust && !showRules">
-                <div v-if="isLogin" class="file" :class="{ active: fileChecked, disable: fileDisable }" v-show="!fscChecked && !showBim && !dbsChecked && !bimChecked && !ruleChecked">
-                    <div @click="onFileChecked">
-                        <i class="iconfont icon-note1"></i>
-                        <span>{{ $t('home.tag') }}</span>
-                    </div>
-                </div>
                 <div class="rule" :class="{ active: ruleChecked, disable: fileDisable }" v-show="!fscChecked && !showBim && !dbsChecked && !bimChecked">
                     <div @click="onRuleChecked">
                         <i class="iconfont icon-measurement"></i>
                         <span>{{ $t('common.measure') }}</span>
                     </div>
                 </div>
+                <div v-if="isLogin" class="file" :class="{ active: fileChecked, disable: fileDisable }" v-show="!fscChecked && !showBim && !dbsChecked && !bimChecked && !ruleChecked">
+                    <div @click="onFileChecked">
+                        <i class="iconfont icon-note1"></i>
+                        <span>{{ $t('home.tag') }}</span>
+                    </div>
+                </div>
+
                 <div class="bim" :class="{ active: bimChecked, disable: bimDisable }" v-show="!fscChecked && !showBim && !ruleChecked">
                     <div @click="onBimChecked">
                         <i class="iconfont icon-BIM"></i>
@@ -129,9 +130,11 @@ const notify = ref(null)
 const isEdit = ref(false)
 const isLogin = ref(false)
 const isFlying = ref(false)
+const editTagId = ref(null)
 provide('tags', tags)
 provide('notify', notify)
 provide('isEdit', isEdit)
+provide('editTagId', editTagId)
 provide('isLogin', isLogin)
 provide('isFlying', isFlying)
 const userId = ref(localStorage.getItem('userId') || null)

+ 1 - 1
vue.config.js

@@ -20,7 +20,7 @@ const devServer = {
             changeOrigin: true
         },
         '/smart-site': {
-            target: 'http://192.168.0.152:8111',//'https://test.4dkankan.com/',//'http://192.168.0.152:8111', //
+            target: 'https://test.4dkankan.com/',//'http://192.168.0.152:8111', //
             changeOrigin: true
         }
     }