Browse Source

v1格式取用path

maxiaoxiao 1 month ago
parent
commit
bc6fff3101
2 changed files with 18 additions and 4 deletions
  1. 8 1
      src/components/FileUpload/index.vue
  2. 10 3
      src/views/pageCode/dataEntry/index.vue

+ 8 - 1
src/components/FileUpload/index.vue

@@ -62,6 +62,10 @@ const props = defineProps({
   isShowTip: {
     type: Boolean,
     default: true
+  },
+  urltype:{
+    type: String,
+    default: ''
   }
 });
 
@@ -69,7 +73,7 @@ const { proxy } = getCurrentInstance();
 const emit = defineEmits();
 const number = ref(0);
 const uploadList = ref([]);
-const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/file/upload"); // 上传文件服务器地址
+const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/file/upload" + props.urltype); // 上传文件服务器地址
 const headers = ref({ Authorization: "Bearer " + getToken() });
 const fileList = ref([]);
 const showTip = computed(
@@ -138,6 +142,9 @@ function handleUploadError(err) {
 // 上传成功回调
 function handleUploadSuccess(res, file) {
   if (res.code === 200) {
+    if (props.urltype == '/v1') 
+    uploadList.value.push({ name: res.data.url, url: res.data.path });
+    else
     uploadList.value.push({ name: res.data.url, url: res.data.url });
     uploadedSuccessfully();
   } else {

+ 10 - 3
src/views/pageCode/dataEntry/index.vue

@@ -112,14 +112,21 @@
 
     <!-- 添加或修改地块基本信息(DKJBXX)对话框 -->
     <el-dialog :title="title" v-model="open" width="500px" append-to-body>
-      <el-form ref="dkjbxxRef" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="shp属性json" prop="shpJson">
+      <el-form ref="dkjbxxRef" :model="form" :rules="rules" label-width="100px">
+        <el-form-item label="数据内容:" prop="shpJson">
           <el-input
             v-model="form.shpJson"
             type="textarea"
             placeholder="请输入内容"
           />
         </el-form-item>
+        <el-form-item label="数据内容:" prop="shpJson">
+          <fileUpload
+            v-model="form.fileList"
+            :limit="1"
+            urltype="/v1"
+          ></fileUpload>
+        </el-form-item>
       </el-form>
       <template #footer>
         <div class="dialog-footer">
@@ -234,7 +241,7 @@ function handleSelectionChange(selection) {
 function handleAdd() {
   reset();
   open.value = true;
-  title.value = "添加地块基本信息(DKJBXX)";
+  title.value = "数据录入";
 }
 
 /** 修改按钮操作 */