Pārlūkot izejas kodu

Merge branch 'dev' of http://192.168.0.115:3000/bill/4pc into dev

bill 11 mēneši atpakaļ
vecāks
revīzija
dc94776265

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 7 - 0
src/assets/icon/cjgl.svg


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 7 - 0
src/assets/icon/cjgl_active.svg


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 9 - 0
src/assets/icon/dwgl.svg


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 9 - 0
src/assets/icon/dwgl_active.svg


+ 8 - 0
src/assets/icon/sbgl.svg

@@ -0,0 +1,8 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g id="sbgl">
+<g id="Union">
+<path d="M8 11C9.10457 11 10 10.1046 10 9C10 7.89543 9.10457 7 8 7C6.89543 7 6 7.89543 6 9C6 10.1046 6.89543 11 8 11Z" fill="#303133"/>
+<path d="M5.61803 2C5.23926 2 4.893 2.214 4.72361 2.55279L4 4H2C1.44772 4 1 4.44771 1 5V14C1 14.5523 1.44772 15 2 15H14C14.5523 15 15 14.5523 15 14V5C15 4.44772 14.5523 4 14 4H12L11.2764 2.55279C11.107 2.214 10.7607 2 10.382 2H5.61803ZM8 12C6.34315 12 5 10.6569 5 9C5 7.34315 6.34315 6 8 6C9.65685 6 11 7.34315 11 9C11 10.6569 9.65685 12 8 12Z" fill="#303133"/>
+</g>
+</g>
+</svg>

+ 8 - 0
src/assets/icon/sbgl_active.svg

@@ -0,0 +1,8 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g id="sbgl">
+<g id="Union">
+<path d="M8 11C9.10457 11 10 10.1046 10 9C10 7.89543 9.10457 7 8 7C6.89543 7 6 7.89543 6 9C6 10.1046 6.89543 11 8 11Z" fill="#409eff"/>
+<path d="M5.61803 2C5.23926 2 4.893 2.214 4.72361 2.55279L4 4H2C1.44772 4 1 4.44771 1 5V14C1 14.5523 1.44772 15 2 15H14C14.5523 15 15 14.5523 15 14V5C15 4.44772 14.5523 4 14 4H12L11.2764 2.55279C11.107 2.214 10.7607 2 10.382 2H5.61803ZM8 12C6.34315 12 5 10.6569 5 9C5 7.34315 6.34315 6 8 6C9.65685 6 11 7.34315 11 9C11 10.6569 9.65685 12 8 12Z" fill="#409eff"/>
+</g>
+</g>
+</svg>

+ 8 - 0
src/assets/icon/wwpc.svg

@@ -0,0 +1,8 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g id="wwpc">
+<g id="Union">
+<path d="M2 2C1.44772 2 1 2.44772 1 3V5H15V3C15 2.44772 14.5523 2 14 2H2Z" fill="#303133"/>
+<path d="M2 6H14V14C14 14.5523 13.5523 15 13 15H3C2.44772 15 2 14.5523 2 14V6ZM5 8.5C5 8.77614 5.22386 9 5.5 9H10.5C10.7761 9 11 8.77614 11 8.5C11 8.22386 10.7761 8 10.5 8H5.5C5.22386 8 5 8.22386 5 8.5Z" fill="#303133"/>
+</g>
+</g>
+</svg>

+ 8 - 0
src/assets/icon/wwpc_active.svg

@@ -0,0 +1,8 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g id="wwpc">
+<g id="Union">
+<path d="M2 2C1.44772 2 1 2.44772 1 3V5H15V3C15 2.44772 14.5523 2 14 2H2Z" fill="#409eff"/>
+<path d="M2 6H14V14C14 14.5523 13.5523 15 13 15H3C2.44772 15 2 14.5523 2 14V6ZM5 8.5C5 8.77614 5.22386 9 5.5 9H10.5C10.7761 9 11 8.77614 11 8.5C11 8.22386 10.7761 8 10.5 8H5.5C5.22386 8 5 8.22386 5 8.5Z" fill="#409eff"/>
+</g>
+</g>
+</svg>

+ 8 - 0
src/assets/icon/yhgl.svg

@@ -0,0 +1,8 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g id="yhgl">
+<g id="Union">
+<path d="M8 9C10.2091 9 12 7.20914 12 5C12 2.79086 10.2091 1 8 1C5.79086 1 4 2.79086 4 5C4 7.20914 5.79086 9 8 9Z" fill="#303133"/>
+<path d="M5 10C3.34315 10 2 11.3431 2 13V14C2 14.5523 2.44772 15 3 15H13C13.5523 15 14 14.5523 14 14V13C14 11.3431 12.6569 10 11 10H5Z" fill="#303133"/>
+</g>
+</g>
+</svg>

+ 8 - 0
src/assets/icon/yhgl_active.svg

@@ -0,0 +1,8 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g id="yhgl">
+<g id="Union">
+<path d="M8 9C10.2091 9 12 7.20914 12 5C12 2.79086 10.2091 1 8 1C5.79086 1 4 2.79086 4 5C4 7.20914 5.79086 9 8 9Z" fill="#409eff"/>
+<path d="M5 10C3.34315 10 2 11.3431 2 13V14C2 14.5523 2.44772 15 3 15H13C13.5523 15 14 14.5523 14 14V13C14 11.3431 12.6569 10 11 10H5Z" fill="#409eff"/>
+</g>
+</g>
+</svg>

+ 150 - 0
src/components/pointEdit.vue

@@ -0,0 +1,150 @@
+<template>
+  <el-dialog
+    :model-value="visible"
+    @update:model-value="(val) => emit('update:visible', val)"
+    :title="title"
+    width="500"
+  >
+    <el-form
+      :model="form"
+      :rules="formRules"
+      label-width="100px"
+      class="container"
+      ref="formRef"
+      label-position="right"
+      status-icon
+    >
+      <el-form-item label="坐标" prop="coord">
+        <el-input
+          v-model="form.coord"
+          show-word-limit
+          :autosize="{ minRows: 3, maxRows: 3 }"
+          type="textarea"
+          disabled
+          :placeholder="placeholder"
+        />
+      </el-form-item>
+
+      <el-form-item label="测试类型" prop="type">
+        <el-select style="width: 100%" v-model="form.type" clearable>
+          <el-option
+            :value="Number(key)"
+            :label="type"
+            v-for="(type, key) in measurePointDesc"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="测试说明" prop="name" required>
+        <el-input
+          v-model.trim="form.name"
+          :maxlength="100"
+          show-word-limit
+          :autosize="{ minRows: 3, maxRows: 8 }"
+          type="textarea"
+          placeholder="请输入"
+        />
+      </el-form-item>
+
+      <el-form-item label="备注" prop="remark">
+        <el-input
+          v-model.trim="form.remark"
+          :maxlength="100"
+          type="text"
+          placeholder="请输入"
+        />
+      </el-form-item>
+    </el-form>
+
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button @click="emit('update:visible', false)">取消</el-button>
+        <el-button type="primary" @click="submit"> 确定 </el-button>
+      </div>
+    </template>
+  </el-dialog>
+</template>
+
+<script setup lang="ts">
+import { ElMessage } from "element-plus";
+import { ref, unref, watchEffect, reactive } from "vue";
+import type { FormRules } from "element-plus";
+import { measurePointDesc } from "@/store/relics";
+
+const form = ref({
+  coord: "",
+  name: "",
+  type: "",
+  remark: "",
+});
+
+const formRules = reactive<FormRules>({
+  type: [{ required: true, message: "请输入", trigger: "change" }],
+  name: [{ required: true, message: "请输入", trigger: "blur" }],
+});
+
+const props = withDefaults(
+  defineProps<{
+    visible: boolean;
+    value: any;
+    title: string;
+    name?: string;
+    placeholder: string;
+    isAllowEmpty?: boolean;
+    updateValue: (value: any) => void;
+  }>(),
+  {
+    placeholder: "请输入",
+  }
+);
+const emit = defineEmits<{
+  (e: "update:visible", visible: boolean): void;
+}>();
+const formRef = ref();
+// const ivalue = ref(props.value);
+
+watchEffect(() => {
+  // ivalue.value = props.value;
+  console.log("props.value", props.value);
+  if (props.value) {
+    // debugger
+    form.value.coord = `纬度:${props.value.pos[0]}\n经度:${props.value.pos[1]}\n高程:${props.value.pos[2]}`;
+    form.value.type = props.value.type;
+    form.value.name = props.value.name;
+    form.value.remark = props.value.remark;
+  } else {
+    form.value.coord = "";
+    form.value.type = "";
+    form.value.name = "";
+    form.value.remark = "";
+  }
+});
+
+const submit = async () => {
+  const res = await unref(formRef)?.validate();
+  console.log("res", res);
+  if (res) {
+    const lastObj = {
+      ...props.value,
+      ...form.value,
+    };
+    delete lastObj.coord;
+
+    lastObj.type = measurePointDesc[lastObj.type];
+    // console.log("lastObj", lastObj);
+    await props.updateValue(lastObj);
+    emit("update:visible", false);
+  }
+  // if (ivalue.value.length === 0 && !props.isAllowEmpty) {
+  //   return ElMessage.error(`${props.name || "点位"}名称不能为空!`);
+  // }
+};
+</script>
+
+<style lang="scss" scoped>
+.container {
+  padding: 0px 60px 0 20px;
+}
+:global(.container .el-form-item) {
+  margin-bottom: 20px;
+}
+</style>

+ 5 - 5
src/router.ts

@@ -48,7 +48,7 @@ const routes: RouteRecordRaw[] = [
       {
         path: "relics",
         name: "relics",
-        meta: { title: "文物普查" },
+        meta: { title: "文物普查", svgIcon: "wwpc" },
         component: () => import("@/view/relics.vue"),
       },
       {
@@ -91,25 +91,25 @@ const routes: RouteRecordRaw[] = [
       {
         path: "scene",
         name: "scene",
-        meta: { title: "场景管理" },
+        meta: { title: "场景管理", svgIcon: 'cjgl' },
         component: () => import("@/view/scene.vue"),
       },
       {
         path: "device",
         name: "device",
-        meta: { title: "设备管理" },
+        meta: { title: "设备管理", svgIcon: 'sbgl' },
         component: () => import("@/view/device.vue"),
       },
       {
         path: "organization",
         name: "organization",
-        meta: { title: "单位管理" },
+        meta: { title: "单位管理", svgIcon: 'dwgl' },
         component: () => import("@/view/organization.vue"),
       },
       {
         path: "users",
         name: "users",
-        meta: { title: "用户管理" },
+        meta: { title: "用户管理", svgIcon: 'yhgl' },
         component: () => import("@/view/users.vue"),
       },
     ],

+ 4 - 0
src/view/layout/nav.vue

@@ -194,6 +194,8 @@ const showBack = computed(() => {
   flex: 1;
   overflow: hidden;
   display: flex;
+  background: #f2f3f5ff;
+  --bgColor: #fff;
 
   .slide {
     width: 200px;
@@ -203,6 +205,8 @@ const showBack = computed(() => {
 
   .view {
     flex: 1;
+    margin-left: 8px;
+    margin-top: 8px;
     overflow: hidden;
     background-color: var(--bgColor);
     flex-direction: column;

+ 3 - 0
src/view/layout/slide/index.vue

@@ -23,6 +23,9 @@ import { user } from "@/store/user";
 
 import { router, findRoute } from "@/router";
 //@TODO
+
+const iconList = [{}];
+
 const isSuper = computed(
   () =>
     user.value.roles.filter((item) => item.roleKey === "super_admin").length > 0

+ 29 - 1
src/view/layout/slide/submenu.vue

@@ -1,10 +1,38 @@
 <template>
   <el-menu-item :index="name" :key="name">
-    <i :class="'iconfont ' + meta.icon" v-if="meta.icon"></i>
+    <img
+      class="svg-icon"
+      :src="getIconUrl(meta.svgIcon, isActiveRoute(name))"
+      v-if="meta.svgIcon"
+    />
+    <i :class="'iconfont ' + meta.icon" v-else-if="meta.icon"></i>
     <span>{{ meta.title }}</span>
   </el-menu-item>
 </template>
 
 <script lang="ts" setup>
+import { computed } from "vue";
+import { router } from "@/router";
 defineProps<{ meta: any; name: string }>();
+
+const isActiveRoute = computed(() => (name: string) => {
+  return router.currentRoute.value.name === name;
+});
+const getIconUrl = computed(() => (name: string, isActive: boolean) => {
+  const url = isActive
+    ? new URL(`../../../assets/icon/${name}_active.svg`, import.meta.url)
+    : new URL(`../../../assets/icon/${name}.svg`, import.meta.url);
+  return String(url);
+});
 </script>
+<style scoped>
+.svg-icon {
+  width: 16px;
+  height: 16px;
+  margin-right: 8px;
+}
+:global(.is-active .svg-icon) {
+  fill: var(--el-menu-active-color);
+  /* color: var(--el-menu-active-color); */
+}
+</style>