Bladeren bron

新增分配

wangfumin 3 maanden geleden
bovenliggende
commit
808d296f4b
6 gewijzigde bestanden met toevoegingen van 2899 en 1902 verwijderingen
  1. 1 0
      .prettierrc
  2. 2653 1900
      pnpm-lock.yaml
  3. 18 1
      src/views/scene/actions.vue
  4. 1 0
      src/views/scene/list.vue
  5. 212 0
      src/views/scene/reassign.vue
  6. 14 1
      vite.config.ts

+ 1 - 0
.prettierrc

@@ -4,6 +4,7 @@
   "tabWidth": 2,
   "printWidth": 80,
   "trailingComma": "none",
+  "endOfLine": "auto",
   "arrowParens": "avoid",
   "eslintIntegration": true
 }

File diff suppressed because it is too large
+ 2653 - 1900
pnpm-lock.yaml


+ 18 - 1
src/views/scene/actions.vue

@@ -10,6 +10,10 @@
       <a @click="queryScene">{{ $t('sys.query') }}</a>
       <!-- <a>分享</a> -->
     </template>
+    <template v-if="done">
+      <a @click="openReassign">重新分配</a>
+      <!-- <a>分享</a> -->
+    </template>
     <a v-if="lastStep" class="warn" @click="deleteScene">
       {{ $t('sys.del') }}
     </a>
@@ -19,15 +23,17 @@
 <script setup lang="ts">
 import { useProject, BinType, BimStatus, SceneStatus } from '@/store'
 import { Modal } from 'ant-design-vue'
-import { computed } from 'vue'
+import { ref, computed } from 'vue'
 import { renderModal } from '@/helper'
 import { projectManage } from '@/env'
 import UploadBim from './update.vue'
+import Reassign from './reassign.vue'
 import type { ProjectScene } from '@/store'
 import { lang, ui18n } from '@/lang'
 
 const props = defineProps<{ scene: ProjectScene }>()
 const store = useProject()
+
 const bimDone = computed(
   () => props.scene.type === BinType && props.scene.status === BimStatus.done
 )
@@ -85,4 +91,15 @@ const updateBimName = () => {
     }
   })
 }
+
+const openReassign = () => {
+  renderModal(Reassign, {
+    visible: true,
+    scene: props.scene,
+    onSave: (data: any) => {
+      console.log(data, 888)
+    },
+    onCancel: () => {}
+  })
+}
 </script>

+ 1 - 0
src/views/scene/list.vue

@@ -44,6 +44,7 @@ import { sceneColumns } from './columns'
 import { renderModal } from '@/helper'
 
 const filterName = ref('')
+const openReassignModal = ref(true)
 const projectStore = useProject()
 const filterScene = computed(() =>
   projectStore.scenes.filter(

+ 212 - 0
src/views/scene/reassign.vue

@@ -0,0 +1,212 @@
+<template>
+  <a-modal
+    v-model:visible="openReassignModal"
+    width="900px"
+    wrapClassName="reassign-modal"
+    title="重新匹配"
+  >
+    <div class="reassign-table">
+      <div class="row header">
+        <div class="cell left">
+          <a-checkbox
+            :indeterminate="indeterminate"
+            :checked="checkAll"
+            @change="onCheckAllChange"
+          >
+            场景名称A
+          </a-checkbox>
+          <a-button type="link" size="small" @click="openPreview"
+            >查看户型图</a-button
+          >
+        </div>
+        <div class="cell right">
+          <span>场景名称B</span>
+          <a-button type="link" size="small" @click="openPreview"
+            >查看户型图</a-button
+          >
+        </div>
+      </div>
+      <div v-for="(row, idx) in rows" :key="idx" class="row">
+        <div class="cell left">
+          <a-checkbox v-model:checked="row.checked">{{ row.a }}</a-checkbox>
+        </div>
+        <div class="cell right">
+          <a-select
+            v-model:value="row.b"
+            style="width: 100%"
+            :options="options"
+          />
+        </div>
+      </div>
+    </div>
+
+    <template #footer>
+      <a-button key="cancel" @click="cancelRelative">取消关联</a-button>
+      <div>
+        <a-button key="back" @click="openReassignModal = false">取消</a-button>
+        <a-button
+          key="submit"
+          type="primary"
+          :loading="loading"
+          @click="handleOk"
+          >确定</a-button
+        >
+      </div>
+    </template>
+  </a-modal>
+
+  <a-modal
+    v-model:visible="previewVisible"
+    width="1000px"
+    title="查看户型图"
+    :footer="null"
+  >
+    <iframe
+      ref="iframeRef"
+      class="preview-iframe"
+      :src="previewUrl"
+      frameborder="0"
+      @load="handleLoad"
+    ></iframe>
+  </a-modal>
+</template>
+
+<script lang="ts" setup>
+import { ref, defineProps, reactive, computed, toRaw } from 'vue'
+
+import type { ProjectScene } from '@/store'
+// import { ui18n } from '@/lang'
+
+defineOptions({ name: 'Reassign' })
+
+const props = defineProps<{
+  visible?: boolean
+  scene: ProjectScene
+  onSave: (data: any) => void
+  onCancel: () => void
+}>()
+const openReassignModal = ref(props.visible ?? true)
+const loading = ref(false)
+
+const cancelRelative = () => {
+  props.onCancel()
+}
+
+// 生成行数据
+const count = (props.scene as any)?.shootCount || 2
+const pad = (n: number) => (n < 10 ? `0${n}` : `${n}`)
+type Row = { a: string; b: string; checked: boolean }
+const rows = reactive<Row[]>(
+  Array.from({ length: count }).map((_, i) => ({
+    a: `点位${pad(i + 1)}`,
+    b: `点位${pad(i + 1)}`,
+    checked: false
+  }))
+)
+
+const options = computed(() => rows.map(r => ({ label: r.b, value: r.b })))
+
+const checkAll = computed({
+  get() {
+    return rows.length > 0 && rows.every(r => r.checked)
+  },
+  set(val: boolean) {
+    rows.forEach(r => (r.checked = val))
+  }
+})
+const indeterminate = computed(
+  () => rows.some(r => r.checked) && !rows.every(r => r.checked)
+)
+const onCheckAllChange = (e: any) => {
+  checkAll.value = e.target.checked
+}
+
+const previewVisible = ref(false)
+const previewUrl = '/spg.html?m=SG-8PQm0PDdSZF&lang=zh&panoLabel'
+const openPreview = () => {
+  previewVisible.value = true
+}
+
+const handleOk = async () => {
+  const payload = toRaw(rows).map((r, index) => ({ index, ...r }))
+  await props.onSave(payload)
+  openReassignModal.value = false
+}
+
+const iframeRef = ref<HTMLIFrameElement>()
+const handleLoad = () => {
+  let timer = setInterval(() => {
+    if (iframeRef.value?.contentWindow?.__sdk) {
+      clearInterval(timer)
+      iframeRef.value?.contentWindow?.__sdk.Scene.whenLoaded(() => {
+        iframeRef.value?.contentWindow?.__sdk.Camera.floorplan()
+      })
+    }
+  }, 100)
+}
+</script>
+
+<style lang="scss" scoped>
+.reassign-table {
+  display: grid;
+  grid-template-columns: 1fr 1fr;
+  border: 1px solid #f0f0f0;
+  border-radius: 4px;
+  overflow: hidden;
+  border-bottom: 0;
+}
+
+.row {
+  display: contents;
+}
+.header .cell {
+  background: #fafafa;
+  font-weight: 600;
+}
+
+.cell {
+  padding: 10px 12px;
+  border-bottom: 1px solid #f0f0f0;
+  border-right: 1px solid #f0f0f0;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+.cell.right {
+  border-right: 0;
+}
+.preview-iframe {
+  width: 100%;
+  height: 70vh;
+}
+.footer {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+
+  p {
+    margin-bottom: 0;
+    color: #646566;
+    font-size: 14px;
+  }
+}
+</style>
+<style lang="scss">
+.reassign-modal {
+  .ant-modal-body {
+    max-height: 660px;
+    overflow: auto;
+  }
+  .ant-modal-footer {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+  }
+  .ant-btn {
+    min-width: 110px;
+  }
+  .controls-right-buttons {
+    display: none;
+  }
+}
+</style>

+ 14 - 1
vite.config.ts

@@ -18,7 +18,7 @@ export default async ({ mode }) => {
       rewrite: path => path.replace(/^\/dev/, '/dev')
     },
     '/api': {
-      target: 'https://test-jp.4dkankan.com/',
+      target: 'https://test.4dkankan.com/',
       changeOrigin: true,
       rewrite: path => path.replace(/^\/api/, '')
     },
@@ -26,6 +26,19 @@ export default async ({ mode }) => {
       target: 'http://192.168.0.152:8111',
       changeOrigin: true,
       rewrite: path => path.replace(/^\/local/, '')
+    },
+    // 这两个是给户型图用的
+    '/service':{
+      target: 'https://www.4dkankan.com',
+      changeOrigin: true,
+      rewrite: path => path.replace(/^\/spg/, ''),
+      secure: false
+    },
+    '/spg': {
+      target: 'https://www.4dkankan.com',
+      changeOrigin: true,
+      rewrite: path => path.replace(/^\/spg/, '/spg'),
+      secure: false
     }
   }
   const input: { [key in string]: string } = {}