Browse Source

feat: fixing typo

gemercheung 1 năm trước cách đây
mục cha
commit
dcc3803cb8

+ 167 - 167
src/request/index.ts

@@ -17,7 +17,7 @@ import {
   ResPage,
   UserInfo,
   Device,
-  PolygonsAttrib,
+  // PolygonsAttrib,
 } from "./type";
 
 const error = throttle((msg: string) => ElMessage.error(msg), 2000);
@@ -188,172 +188,172 @@ export const relicsScenePosInfoFetch = (posId: number) =>
     { paths: { posId } }
   );
 
-export const relicsPolyginsFetch = () => {
-  return new Promise<PolygonsAttrib>((resolve) => {
-    setTimeout(() => {
-      resolve({
-        lines: [
-          {
-            id: "1",
-            pointIds: ["2666", "2667"],
-          },
-          {
-            id: "2",
-            pointIds: ["2667", "2669"],
-          },
-          {
-            id: "3",
-            pointIds: ["2669", "2674"],
-          },
-          {
-            id: "4",
-            pointIds: ["2674", "2675"],
-          },
-          {
-            id: "5",
-            pointIds: ["2675", "2676"],
-          },
-          {
-            id: "6",
-            pointIds: ["2676", "2673"],
-          },
-          {
-            id: "7",
-            pointIds: ["2673", "2672"],
-          },
-          {
-            id: "8",
-            pointIds: ["2672", "2670"],
-          },
-          {
-            id: "9",
-            pointIds: ["2677", "2678"],
-          },
-          {
-            id: "10",
-            pointIds: ["2678", "2679"],
-          },
-          {
-            id: "11",
-            pointIds: ["2679", "2680"],
-          },
-          {
-            id: "12",
-            pointIds: ["2680", "2681"],
-          },
-        ],
-        polygons: [
-          {
-            id: "1",
-            lineIds: ["1", "2", "3", "4", "5", "6", "7", "8"],
-          },
-          {
-            id: "2",
-            lineIds: ["9", "10", "11", "12"],
-          },
-        ],
-        points: [
-          {
-            rtk: false,
-            x: 115.949835199646,
-            y: 30.0971239995873,
-            id: "2666",
-          },
-          {
-            rtk: false,
-            x: 115.949706558269,
-            y: 30.0975243383135,
-            id: "2667",
-          },
-          {
-            rtk: false,
-            x: 115.950002555619,
-            y: 30.0977552558535,
-            id: "2668",
-          },
-          {
-            rtk: false,
-            x: 115.949968744193,
-            y: 30.097862045865,
-            id: "2669",
-          },
-          {
-            rtk: true,
-            x: 115.950063977564,
-            y: 30.0978879318173,
-            id: "2670",
-          },
-          {
-            rtk: true,
-            x: 115.949964417593,
-            y: 30.0978650571868,
-            id: "2671",
-          },
-          {
-            rtk: true,
-            x: 115.950300839723,
-            y: 30.0976756336231,
-            id: "2672",
-          },
-          {
-            rtk: true,
-            x: 115.950437426448,
-            y: 30.097269657442,
-            id: "2673",
-          },
-          {
-            rtk: false,
-            x: 115.95025353664198,
-            y: 30.097554052476422,
-            id: "2674",
-          },
-          {
-            rtk: false,
-            x: 115.95021286828855,
-            y: 30.09733715459145,
-            id: "2675",
-          },
-          {
-            rtk: false,
-            x: 115.95031589478391,
-            y: 30.097000962869746,
-            id: "2676",
-          },
-          {
-            rtk: false,
-            x: 115.95100324233627,
-            y: 30.09844929254667,
-            id: "2677",
-          },
-          {
-            rtk: false,
-            x: 115.95233898242569,
-            y: 30.098492207890907,
-            id: "2678",
-          },
-          {
-            rtk: false,
-            x: 115.95227997382736,
-            y: 30.097059908276954,
-            id: "2679",
-          },
-          {
-            rtk: false,
-            x: 115.95076720794296,
-            y: 30.0971403745474,
-            id: "2680",
-          },
-          {
-            rtk: false,
-            x: 115.95056336005783,
-            y: 30.098095240956702,
-            id: "2681",
-          },
-        ],
-      });
-    }, 500);
-  });
-};
+// export const relicsPolyginsFetch = () => {
+//   return new Promise<PolygonsAttrib>((resolve) => {
+//     setTimeout(() => {
+//       resolve({
+//         lines: [
+//           {
+//             id: "1",
+//             pointIds: ["2666", "2667"],
+//           },
+//           {
+//             id: "2",
+//             pointIds: ["2667", "2669"],
+//           },
+//           {
+//             id: "3",
+//             pointIds: ["2669", "2674"],
+//           },
+//           {
+//             id: "4",
+//             pointIds: ["2674", "2675"],
+//           },
+//           {
+//             id: "5",
+//             pointIds: ["2675", "2676"],
+//           },
+//           {
+//             id: "6",
+//             pointIds: ["2676", "2673"],
+//           },
+//           {
+//             id: "7",
+//             pointIds: ["2673", "2672"],
+//           },
+//           {
+//             id: "8",
+//             pointIds: ["2672", "2670"],
+//           },
+//           {
+//             id: "9",
+//             pointIds: ["2677", "2678"],
+//           },
+//           {
+//             id: "10",
+//             pointIds: ["2678", "2679"],
+//           },
+//           {
+//             id: "11",
+//             pointIds: ["2679", "2680"],
+//           },
+//           {
+//             id: "12",
+//             pointIds: ["2680", "2681"],
+//           },
+//         ],
+//         polygons: [
+//           {
+//             id: "1",
+//             lineIds: ["1", "2", "3", "4", "5", "6", "7", "8"],
+//           },
+//           {
+//             id: "2",
+//             lineIds: ["9", "10", "11", "12"],
+//           },
+//         ],
+//         points: [
+//           {
+//             rtk: false,
+//             x: 115.949835199646,
+//             y: 30.0971239995873,
+//             id: "2666",
+//           },
+//           {
+//             rtk: false,
+//             x: 115.949706558269,
+//             y: 30.0975243383135,
+//             id: "2667",
+//           },
+//           {
+//             rtk: false,
+//             x: 115.950002555619,
+//             y: 30.0977552558535,
+//             id: "2668",
+//           },
+//           {
+//             rtk: false,
+//             x: 115.949968744193,
+//             y: 30.097862045865,
+//             id: "2669",
+//           },
+//           {
+//             rtk: true,
+//             x: 115.950063977564,
+//             y: 30.0978879318173,
+//             id: "2670",
+//           },
+//           {
+//             rtk: true,
+//             x: 115.949964417593,
+//             y: 30.0978650571868,
+//             id: "2671",
+//           },
+//           {
+//             rtk: true,
+//             x: 115.950300839723,
+//             y: 30.0976756336231,
+//             id: "2672",
+//           },
+//           {
+//             rtk: true,
+//             x: 115.950437426448,
+//             y: 30.097269657442,
+//             id: "2673",
+//           },
+//           {
+//             rtk: false,
+//             x: 115.95025353664198,
+//             y: 30.097554052476422,
+//             id: "2674",
+//           },
+//           {
+//             rtk: false,
+//             x: 115.95021286828855,
+//             y: 30.09733715459145,
+//             id: "2675",
+//           },
+//           {
+//             rtk: false,
+//             x: 115.95031589478391,
+//             y: 30.097000962869746,
+//             id: "2676",
+//           },
+//           {
+//             rtk: false,
+//             x: 115.95100324233627,
+//             y: 30.09844929254667,
+//             id: "2677",
+//           },
+//           {
+//             rtk: false,
+//             x: 115.95233898242569,
+//             y: 30.098492207890907,
+//             id: "2678",
+//           },
+//           {
+//             rtk: false,
+//             x: 115.95227997382736,
+//             y: 30.097059908276954,
+//             id: "2679",
+//           },
+//           {
+//             rtk: false,
+//             x: 115.95076720794296,
+//             y: 30.0971403745474,
+//             id: "2680",
+//           },
+//           {
+//             rtk: false,
+//             x: 115.95056336005783,
+//             y: 30.098095240956702,
+//             id: "2681",
+//           },
+//         ],
+//       });
+//     }, 500);
+//   });
+// };
 
 export type ScenePageProps = PageProps<{
   sceneCode?: string;

+ 1 - 1
src/store/relics.ts

@@ -1,6 +1,6 @@
 import {
   relicsInfoFetch,
-  relicsPolyginsFetch,
+  // relicsPolyginsFetch,
   relicsSelfCheckFetch,
   updateRelicsFetch,
 } from "@/request";

+ 1 - 1
src/view/map/map-board.vue

@@ -61,7 +61,7 @@ import { onMounted, ref, watchEffect, watch, onUnmounted, computed } from "vue";
 import { createBoard, scenePosTransform } from "./board";
 import MapRightPoly from "./map-right-poly.vue";
 import { Back } from "@element-plus/icons-vue";
-import { relicsPolyginsFetch } from "@/request";
+// import { relicsPolyginsFetch } from "@/request";
 import {
   Grid,
   LocationInformation,

+ 6 - 94
src/view/map/map-right-poly.vue

@@ -11,33 +11,17 @@
 </template>
 
 <script setup lang="ts">
-import {
-    Plus,
-    Delete,
-    Grid,
-    Download,
-    LocationInformation,
-    DeleteLocation,
-    Edit,
-    Link,
-} from "@element-plus/icons-vue";
-import { computed, ref, watchEffect } from "vue";
+import { ref, watchEffect } from "vue";
 import {
     Scene,
-    scenes,
+    // scenes,
     ScenePoint,
-    updateScenePointName,
-    gotoScene,
-    relicsId,
-    refreshScenes,
+    // updateScenePointName,
+    // gotoScene,
+    // relicsId,
+    // refreshScenes,
 } from "@/store/scene";
 import { relics } from "@/store/relics";
-import SingleInput from "@/components/single-input.vue";
-import { router } from "@/router";
-import { selectScenes } from "../quisk";
-import { addRelicsScenesFetch, delRelicsScenesFetch } from "@/request";
-import { exportFile, exportImage } from "./pc4Helper";
-import { SceneStatus } from "@/store/scene";
 
 const emit = defineEmits<{
     (e: "flyScene", data: Scene): void;
@@ -45,82 +29,10 @@ const emit = defineEmits<{
     (e: "gotoPoint", data: ScenePoint): void;
 }>();
 
-const inputPoint = ref<ScenePoint | null>(null);
-const updatePointName = async (title: string) => {
-    await updateScenePointName(inputPoint.value!, title);
-};
 
 const relicsName = ref("");
 watchEffect(() => (relicsName.value = relics.value?.name || ""));
-// const updateRelics = async () => {
-//   await updateRelicsName(relicsName.value);
-//   ElMessage.success("修改成功");
-// };
-
-const treeRef = ref<any>();
-const treeNode = computed(() =>
-    scenes.value.map((scene) => ({
-        label: scene.sceneCode,
-        id: scene.id,
-        type: "scene",
-        run: scene.calcStatus !== SceneStatus.SUCCESS,
-        disable: scene.scenePos.every((pos) => !pos.pos || pos.pos.length === 0),
-        raw: scene,
-        children: scene.scenePos.map((pos) => ({
-            label: pos.name,
-            run: scene.calcStatus !== SceneStatus.SUCCESS,
-            disable: !pos.pos || pos.pos.length === 0,
-            id: pos.id,
-            type: "point",
-            raw: { ...pos, cameraType: scene.cameraType },
-        })),
-    }))
-);
-
-const getSelectPoints = () =>
-    treeRef
-        .value!.getCheckedNodes(false, false)
-        .filter((option: any) => option.type === "point")
-        .map((option: any) => option.raw) as ScenePoint[];
-
-const addHandler = async () => {
-    const sceneCodes = scenes.value.map((scene) => scene.sceneCode);
-    await selectScenes({
-        scenes: scenes.value,
-        selfScenes: scenes.value.filter((scene) => scene.creationMethod === 2),
-        submit: async (nScene) => {
-            const requests: Promise<any>[] = [];
-            const delScenes = sceneCodes
-                .filter((sceneCode) => !nScene.some((scene) => scene.sceneCode === sceneCode))
-                .map((sceneCode) => scenes.value.find((scene) => scene.sceneCode === sceneCode)!);
-
-            delScenes.length && requests.push(delRelicsScenes(delScenes));
-
-            const addScenes = nScene.filter(({ sceneCode }) => !sceneCodes.includes(sceneCode));
-            addScenes.length && requests.push(addSceneHandler(addScenes));
-
-            await Promise.all(requests);
-            requests.length && (await refreshScenes());
-        },
-    });
-};
-
-const delRelicsScenes = (scenes: Pick<Scene, "sceneId" | "sceneCode">[]) =>
-    delRelicsScenesFetch(
-        relicsId.value,
-        scenes.map((item) => ({ sceneCode: item.sceneCode, id: item.sceneId }))
-    );
-
-const delSceneHandler = async (scenes: Pick<Scene, "sceneId" | "sceneCode">[]) => {
-    await delRelicsScenes(scenes);
-    await refreshScenes();
-};
 
-const addSceneHandler = async (scenes: Pick<Scene, "sceneId" | "sceneCode">[]) =>
-    await addRelicsScenesFetch(
-        relicsId.value!,
-        scenes.map((item) => ({ sceneCode: item.sceneCode, id: item.sceneId }))
-    );
 </script>
 
 <style lang="scss" scoped>

+ 1 - 1
src/view/relics-edit.vue

@@ -77,7 +77,7 @@ defineExpose<QuiskExpose>({
       ElMessage.error("请输入文物名称!");
       throw "请输入文物名称!";
     }
-    props.submit(data.value);
+    props.submit(data.value as any as Relics);
   },
 });
 </script>

+ 31 - 57
src/view/scene.vue

@@ -4,50 +4,23 @@
       <div class="search">
         <el-form label-width="100px" inline>
           <el-form-item label="场景标题:">
-            <el-input
-              clearable
-              v-model="pageProps.sceneName"
-              style="width: 250px"
-              placeholder="请输入"
-            />
+            <el-input clearable v-model="pageProps.sceneName" style="width: 250px" placeholder="请输入" />
           </el-form-item>
           <el-form-item label="场景码:">
-            <el-input
-              clearable
-              v-model="pageProps.sceneCode"
-              style="width: 250px"
-              placeholder="请输入"
-            />
+            <el-input clearable v-model="pageProps.sceneCode" style="width: 250px" placeholder="请输入" />
           </el-form-item>
           <template v-if="!simple">
             <el-form-item label="SN码:">
-              <el-input
-                clearable
-                v-model="pageProps.snCode"
-                style="width: 250px"
-                placeholder="请输入"
-              />
+              <el-input clearable v-model="pageProps.snCode" style="width: 250px" placeholder="请输入" />
             </el-form-item>
             <el-form-item label="设备类型:">
               <el-select style="width: 250px" v-model="pageProps.cameraType" clearable>
-                <el-option
-                  :value="Number(key)"
-                  :label="type"
-                  v-for="(type, key) in DeviceTypeDesc"
-                />
+                <el-option :value="Number(key)" :label="type" v-for="(type, key) in DeviceTypeDesc" />
               </el-select>
             </el-form-item>
             <el-form-item label="拍摄时间:">
-              <el-date-picker
-                clearable
-                type="daterange"
-                v-model="pageProps.shootTime"
-                start-placeholder="请选择"
-                end-placeholder="请选择"
-                range-separator="-"
-                placeholder="请选择"
-                style="width: 250px"
-              />
+              <el-date-picker clearable type="daterange" v-model="pageProps.shootTime" start-placeholder="请选择"
+                end-placeholder="请选择" range-separator="-" placeholder="请选择" style="width: 250px" />
             </el-form-item>
             <!-- <el-form-item label="绑定账号:">
               <el-input
@@ -69,13 +42,7 @@
     </div>
 
     <div class="relics-content">
-      <el-table
-        :data="sceneArray"
-        border
-        row-key="'sceneCode'"
-        @selection-change="(val) => tableProps && tableProps.selectionChange(val)"
-        :ref="(table) => tableProps && (tableProps.tableRef.value = table)"
-      >
+      <el-table :data="sceneArray" border row-key="'sceneCode'" @selection-change="handleTableSelect" ref="tableRef">
         <slot name="table"></slot>
         <el-table-column label="场景标题" v-slot:default="{ row }">
           <a class="link" @click="gotoScene(row, false)">
@@ -123,13 +90,8 @@
             <el-button link type="primary" size="small" @click="gotoScene(row, true)">
               编辑
             </el-button>
-            <el-button
-              link
-              type="danger"
-              @click="delHandler(row.sceneId)"
-              size="small"
-              v-if="row.calcStatus !== SceneStatus.RUN"
-            >
+            <el-button link type="danger" @click="delHandler(row.sceneId)" size="small"
+              v-if="row.calcStatus !== SceneStatus.RUN">
               删除
             </el-button>
           </template>
@@ -137,21 +99,15 @@
       </el-table>
     </div>
     <div class="pag-layout">
-      <el-pagination
-        background
-        layout="total, prev, pager, next, sizes, jumper"
-        v-model:page-size="pageProps.pageSize"
-        :page-sizes="[10, 20, 50, 100]"
-        :total="total"
-        @current-change="(data: number) => pageProps.pageNum = data"
-        :current-page="pageProps.pageNum"
-      />
+      <el-pagination background layout="total, prev, pager, next, sizes, jumper" v-model:page-size="pageProps.pageSize"
+        :page-sizes="[10, 20, 50, 100]" :total="total" @current-change="(data: number) => pageProps.pageNum = data"
+        :current-page="pageProps.pageNum" />
     </div>
   </div>
 </template>
 
 <script lang="ts" setup>
-import { onActivated, ref, watch } from "vue";
+import { onActivated, ref, unref, watch, watchEffect } from "vue";
 import { scenePageFetch, ScenePageProps, delSceneFetch } from "@/request";
 import {
   SceneStatusDesc,
@@ -175,6 +131,7 @@ const initProps: ScenePageProps = {
 const pageProps = ref({ ...initProps });
 const total = ref<number>(0);
 const sceneArray = ref<Scene[]>([]);
+const tableRef = ref('');
 
 const refresh = debounce(async () => {
   const data = await scenePageFetch(pageProps.value);
@@ -197,6 +154,20 @@ const delHandler = async (relicsId: number) => {
 
 watch(pageProps, refresh, { deep: true, immediate: true });
 onActivated(refresh);
+
+watchEffect(() => {
+  if (unref(tableRef)) {
+    // props.tableProps.tableRef.value = unref(tableRef)
+  }
+})
+
+
+const handleTableSelect = (val: any) => {
+  if (props.tableProps && "selectionChange" in props.tableProps) {
+    console.log('selectionChange')
+    props.tableProps.selectionChange(val)
+  }
+}
 </script>
 
 <style scoped lang="scss">
@@ -205,6 +176,7 @@ onActivated(refresh);
   overflow-y: auto;
   padding: 30px;
 }
+
 .pag-layout {
   margin-top: 20px;
   display: flex;
@@ -215,9 +187,11 @@ onActivated(refresh);
   display: flex;
   align-items: center;
   margin-bottom: 20px;
+
   .search {
     flex: 1;
   }
+
   .relics-oper {
     flex: 0 0 100px;
     text-align: right;

+ 3 - 0
tsconfig.json

@@ -39,6 +39,9 @@
     "src/**/*.tsx",
     "src/**/*.vue"
   ],
+  "exclude":[
+       "./src/submodule/src/board/*"
+  ],
   "references": [
     {
       "path": "./tsconfig.node.json"

+ 6 - 0
vite.config.ts

@@ -33,6 +33,12 @@ export default defineConfig({
         changeOrigin: true,
         rewrite: (path) => path.replace(/^\/gear1/, "/gear1"),
       },
+      // "/api": {
+      //   target: `https://sp.4dkankan.com/`,
+      //   // target: `http://192.168.0.11:8324/relics/`,
+      //   changeOrigin: true,
+      //   rewrite: (path) => path.replace(/^\/api/, "/api"),
+      // },
       "/api": {
         target: `https://uat-sp.4dkankan.com/`,
         // target: `http://192.168.0.11:8324/relics/`,