Parcourir la source

'导入功能'

蒋珅 il y a 1 an
Parent
commit
e0fd2f8c7c
1 fichiers modifiés avec 16 ajouts et 16 suppressions
  1. 16 16
      src/pages/dataFilter/prepare/components/search.vue

+ 16 - 16
src/pages/dataFilter/prepare/components/search.vue

@@ -1,5 +1,6 @@
 <script setup name="search">
-import { onMounted, reactive, ref } from 'vue'
+import { ElMessage } from "element-plus";
+import { onMounted, reactive, ref} from 'vue'
 import request from '@/api/axios.js'
 import SubmitBtn from '@com/SubmitBtn.vue'
 
@@ -100,17 +101,17 @@ const addok = async (params) => {
 	  let formData =new FormData()
 	  if (fileUplod.value.length>0) {
                 fileUplod.value.forEach(item =>{
-                    formData.append('files', item.raw)
+                    formData.append('file', item.raw)
                 })
             }
-//   formData.append("files",'files')
+//   formData.append("files",fileUplod.value)
   console.log(formData);
 	const res = await request({
-		url:`/power/prepare/import?station=${form.name}&interval=${form.region}&st=${new Date(form.value1).getTime()}&et=${new Date(form.value2).getTime()}`,
+		url:`/power/prepare/upload?station=${form.name}&interval=${form.region}&st=${new Date(form.value1).getTime()}&et=${new Date(form.value2).getTime()}`,
 		method:"post",
 		headers: { 'Content-Type': 'multipart/form-data'},
 		mimeType:"multipart/form-data",
-		files:formData
+		data:formData
 		 })
 	if (res.code === 200) {
 		ElMessage.success(res.msg)
@@ -182,18 +183,18 @@ funGetStation()
 	<div>
 		<el-dialog v-model="dialogFormVisible" title="导入">
     <el-form :model="form">
-      <el-form-item label="场站" :label-width="formLabelWidth">
-        <el-input v-model="form.name" autocomplete="off" />
+      <el-form-item label="场站" class="!ml-10" >
+        <el-input v-model="form.name" placeholder="请输入场站名" autocomplete="off" style="width:220px" />
       </el-form-item>
-      <el-form-item label="等间隔" :label-width="formLabelWidth">
-        <el-select v-model="form.region" placeholder="">
+      <el-form-item label="等间隔"  class="!ml-10">
+        <el-select v-model="form.region" >
           <el-option label="一秒钟" value="1" />
           <el-option label="一分钟" value="60" />
 		  <el-option label="十分钟" value="600" />
 		  <el-option label="十五分钟" value="900" />
         </el-select>
       </el-form-item>
-	  <el-form-item label="时间" class="!ml-20" >
+	  <el-form-item label="时间" class="!ml-10" >
           <el-date-picker
             v-model="form.value1"
             @change="BeginChange(form.value1)"
@@ -203,7 +204,7 @@ funGetStation()
           >
           </el-date-picker>
         </el-form-item>
-		 <el-form-item label="时间" class="!ml-20" >
+		 <el-form-item label="时间" class="!ml-10" >
           <el-date-picker
             v-model="form.value2"
             @change="BeginChange1(form.value2)"
@@ -219,7 +220,7 @@ funGetStation()
     <el-upload  
         class="upload-demo"
         action="#"
-        :limit="3"
+        :limit="5"
         :on-change="changeUpload"
         name="fileData"
         :on-exceed="handleExceed"
@@ -227,16 +228,15 @@ funGetStation()
         :auto-upload="false"
       >
         <template #trigger >
-          <el-button type="primary" class="mt-2.5" >选择文件</el-button>
+          <el-button type="primary" class="ml-10" >选择文件</el-button>
+		    <div slot="tip" class="el-upload__tip">只能上传不超过5个文件</div>
         </template>
       </el-upload>
      
     <template #footer>
       <span class="dialog-footer">
         <el-button @click="dialogFormVisible = false">取消</el-button>
-        <el-button type="primary" @click="addok">
-          确认
-        </el-button>
+        <el-button type="primary" @click="addok">确认</el-button>
       </span>
     </template>
   </el-dialog>