Browse Source

'导入功能'

蒋珅 1 year ago
parent
commit
e0fd2f8c7c
1 changed files with 16 additions and 16 deletions
  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">
 <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 request from '@/api/axios.js'
 import SubmitBtn from '@com/SubmitBtn.vue'
 import SubmitBtn from '@com/SubmitBtn.vue'
 
 
@@ -100,17 +101,17 @@ const addok = async (params) => {
 	  let formData =new FormData()
 	  let formData =new FormData()
 	  if (fileUplod.value.length>0) {
 	  if (fileUplod.value.length>0) {
                 fileUplod.value.forEach(item =>{
                 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);
   console.log(formData);
 	const res = await request({
 	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",
 		method:"post",
 		headers: { 'Content-Type': 'multipart/form-data'},
 		headers: { 'Content-Type': 'multipart/form-data'},
 		mimeType:"multipart/form-data",
 		mimeType:"multipart/form-data",
-		files:formData
+		data:formData
 		 })
 		 })
 	if (res.code === 200) {
 	if (res.code === 200) {
 		ElMessage.success(res.msg)
 		ElMessage.success(res.msg)
@@ -182,18 +183,18 @@ funGetStation()
 	<div>
 	<div>
 		<el-dialog v-model="dialogFormVisible" title="导入">
 		<el-dialog v-model="dialogFormVisible" title="导入">
     <el-form :model="form">
     <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>
-      <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="1" />
           <el-option label="一分钟" value="60" />
           <el-option label="一分钟" value="60" />
 		  <el-option label="十分钟" value="600" />
 		  <el-option label="十分钟" value="600" />
 		  <el-option label="十五分钟" value="900" />
 		  <el-option label="十五分钟" value="900" />
         </el-select>
         </el-select>
       </el-form-item>
       </el-form-item>
-	  <el-form-item label="时间" class="!ml-20" >
+	  <el-form-item label="时间" class="!ml-10" >
           <el-date-picker
           <el-date-picker
             v-model="form.value1"
             v-model="form.value1"
             @change="BeginChange(form.value1)"
             @change="BeginChange(form.value1)"
@@ -203,7 +204,7 @@ funGetStation()
           >
           >
           </el-date-picker>
           </el-date-picker>
         </el-form-item>
         </el-form-item>
-		 <el-form-item label="时间" class="!ml-20" >
+		 <el-form-item label="时间" class="!ml-10" >
           <el-date-picker
           <el-date-picker
             v-model="form.value2"
             v-model="form.value2"
             @change="BeginChange1(form.value2)"
             @change="BeginChange1(form.value2)"
@@ -219,7 +220,7 @@ funGetStation()
     <el-upload  
     <el-upload  
         class="upload-demo"
         class="upload-demo"
         action="#"
         action="#"
-        :limit="3"
+        :limit="5"
         :on-change="changeUpload"
         :on-change="changeUpload"
         name="fileData"
         name="fileData"
         :on-exceed="handleExceed"
         :on-exceed="handleExceed"
@@ -227,16 +228,15 @@ funGetStation()
         :auto-upload="false"
         :auto-upload="false"
       >
       >
         <template #trigger >
         <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>
         </template>
       </el-upload>
       </el-upload>
      
      
     <template #footer>
     <template #footer>
       <span class="dialog-footer">
       <span class="dialog-footer">
         <el-button @click="dialogFormVisible = false">取消</el-button>
         <el-button @click="dialogFormVisible = false">取消</el-button>
-        <el-button type="primary" @click="addok">
-          确认
-        </el-button>
+        <el-button type="primary" @click="addok">确认</el-button>
       </span>
       </span>
     </template>
     </template>
   </el-dialog>
   </el-dialog>