Browse Source

Project Init

yigeren911 1 year ago
parent
commit
317113f549

+ 2 - 2
src/components/pictureUpload/multiple.vue

@@ -52,7 +52,7 @@ const props = defineProps({
 
 onMounted(() => {
   if (props.modelValue?.length > 0) {
-    fileUrl.value = JSON.parse(props.modelValue);
+    fileUrl.value = JSON.parse(props.modelValue ? props.modelValue : "[]");
   } else {
     fileUrl.value = [];
   }
@@ -60,7 +60,7 @@ onMounted(() => {
 
 watch(() => props.modelValue, () => {
   if (props.modelValue?.length > 0) {
-    fileUrl.value = JSON.parse(props.modelValue);
+    fileUrl.value = JSON.parse(props.modelValue ? props.modelValue : "[]");
   } else {
     fileUrl.value = [];
   }

+ 1 - 2
src/views/backend/enterprise/project/map/popupForm.vue

@@ -61,7 +61,7 @@ import type { ElForm, FormItemRule } from "element-plus";
 import FormItem from "/@/components/formItem/index.vue";
 import { building_list, community_list, district_list, orderExpress } from "/@/api/controllerUrls";
 import { ElNotification } from "element-plus/es";
-import pictureUpload from "/@/components/pictureUpload/multiple.vue";
+import pictureUpload from "/@/components/pictureUpload/index.vue";
 import request from "/@/api/request";
 
 
@@ -157,7 +157,6 @@ function selectCommunity(event: any) {
 
 function onSubmit(){
   delete baTable.form.items!.communityName
-  console.log(baTable.form.items);
   baTable.onSubmit(formRef.value)
 }
 

+ 0 - 1
src/views/backend/enterprise/project/parking/detailDialog.vue

@@ -62,7 +62,6 @@ let data = ref({});
 
 function open(event) {
   let e = Object.assign({}, event);
-  e.mapUrl = e.mapUrl ? JSON.parse(e.mapUrl)[0] : "";
   data.value = e;
   showDialog.value = true;
   setTimeout(() => {

+ 7 - 1
src/views/backend/enterprise/project/parking/editDialog.vue

@@ -28,9 +28,14 @@
                 <el-input v-model="formData.contactNumber"></el-input>
               </el-form-item>
             </el-col>
+            <el-col :span="24">
+              <el-form-item prop="pictureUrl" label="主展示图">
+                <pictureUpload v-model="formData.pictureUrl"></pictureUpload>
+              </el-form-item>
+            </el-col>
             <el-col :span="24">
               <el-form-item prop="parkingUrl" label="车位照片">
-                <pictureUpload v-model="formData.parkingUrl"></pictureUpload>
+                <pictureUpload2 :limit="10" v-model="formData.parkingUrl"></pictureUpload2>
               </el-form-item>
             </el-col>
             <el-col :span="12">
@@ -121,6 +126,7 @@ import request from "/@/api/request";
 import { district_list, parking } from "/@/api/controllerUrls";
 import { ElMessage } from "element-plus";
 import pictureUpload from "/@/components/pictureUpload/index.vue";
+import pictureUpload2 from "/@/components/pictureUpload/multiple.vue";
 import editor from "/@/components/editor/index.vue";
 
 let showDialog = ref(false);

+ 16 - 9
src/views/backend/enterprise/project/parking/mapSetting.vue

@@ -80,8 +80,9 @@ let width = ref(0);
 
 //图层样式
 let mapStyle = computed(() => {
+  const baseUrl = import.meta.env.VITE_AXIOS_BASE_URL;
   return {
-    backgroundImage: `url(${props.imgUrl})`,
+    backgroundImage: `url(${baseUrl + "/uploadFile/" + props.imgUrl})`,
     width: width.value + "px",
     height: height.value + "px",
     left: dragOption.x1 + "px",
@@ -95,9 +96,9 @@ let labelMap;
 
 onMounted(() => {
   labelMap = document.getElementById("labelMap");
-  setTimeout(()=>{
+  setTimeout(() => {
     setImgSize(props.imgUrl);
-  },100)
+  }, 100);
 
 });
 
@@ -106,11 +107,11 @@ onMounted(() => {
 function setImgSize(url) {
   const m = document.getElementById("mapContainer");
   let img = new Image();
-  img.onload=function (){
+  img.onload = function() {
     width.value = m.clientWidth;
     height.value = m.clientWidth * (img.naturalHeight / img.naturalWidth);
-  }
-  img.src = url;
+  };
+  img.src = import.meta.env.VITE_AXIOS_BASE_URL + "/uploadFile/" + url;
 }
 
 watch(() => props.imgUrl, (newValue) => {
@@ -218,6 +219,7 @@ function dbClick(event, item) {
   //点击地图
   if (event.target.id == "labelMap") {
     formRef.value?.resetFields();
+    formData.id = "";
     formData.mapInitWidth = width.value;
     formData.mapX = event.layerX;
     formData.mapY = event.layerY;
@@ -252,9 +254,14 @@ function dbClickItem(item) {
 //提交表单
 function submit() {
   if (dialogTitle.value == "添加") {
-    formData.mapId = props.mapId;
-    postMark();
-    showDialog.value = false;
+    formRef.value.validate((valid) => {
+      if (valid) {
+        formData.mapId = props.mapId;
+        postMark();
+        showDialog.value = false;
+      }
+    });
+
   }
 }
 

+ 0 - 1
src/views/backend/enterprise/project/parking/markDialog.vue

@@ -52,7 +52,6 @@ function getInitData() {
     if (res.code == 1) {
       title.value = `${res.data.districtName} / ${res.data.communityName} / ${res.data.buildingNumber}`;
       data.value = res.data;
-      data.value.mapUrl = data.value.mapUrl ? JSON.parse(data.value.mapUrl)[0] : "";
       allData.value = res.data.parkingList;
       unMapData.value = [];
       for (let i in allData.value) {

+ 3 - 3
src/views/backend/enterprise/project/parking/parkingView.vue

@@ -61,8 +61,9 @@ let width = ref(0);
 
 //图层样式
 let mapStyle = computed(() => {
+  const baseUrl = import.meta.env.VITE_AXIOS_BASE_URL;
   return {
-    backgroundImage: `url(${props.imgUrl})`,
+    backgroundImage: `url(${baseUrl + "/uploadFile/" + props.imgUrl})`,
     width: width.value + "px",
     height: height.value + "px",
     left: dragOption.x1 + "px",
@@ -90,8 +91,7 @@ function setImgSize(url) {
     width.value = m.clientWidth;
     height.value = m.clientWidth * (img.naturalHeight / img.naturalWidth);
   };
-  img.src = url;
-  console.log(m.clientWidth);
+  img.src = import.meta.env.VITE_AXIOS_BASE_URL +  "/uploadFile/"+ url;
 }