zzy 2 years ago
parent
commit
e0c3ecb2e9
2 changed files with 82 additions and 23 deletions
  1. 1 1
      src/request/index.js
  2. 81 22
      src/views/evaluate/EvaluateRepeat.vue

+ 1 - 1
src/request/index.js

@@ -3,7 +3,7 @@ import Vue from "vue";
 let instance = axios.create({
     baseURL:'http://10.81.66.9:9250',
     //baseURL:'http://localhost:9250',
-    timeout:20000
+    timeout:400000
 })
 instance.interceptors.response.use(function(response){
     return response;

+ 81 - 22
src/views/evaluate/EvaluateRepeat.vue

@@ -2,28 +2,45 @@
   <div id="evaluate-repeat" >
 
     <el-form size="small" :model="formData" inline>
-      <el-form-item label="事项名称">
-        <el-input
-
-          v-model="formData.name"
-          placeholder="事项名称">
-        </el-input>
-      </el-form-item>
-      <el-form-item label="总体满意度">
-        <el-select v-model="formData.myTotalEvaluate" placeholder="请选择">
-          <el-option
-            v-for="item in totalEvaluate"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value">
-          </el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item class="btn-i">
-
-        <el-button class="role_button" role_button_code="a8f2fe9f-f63f-431e-83d9-cc014cc56737" @click="onCommit">查询</el-button>
-        <el-button class="role_button" role_button_code="ec6284bf-4a37-40e1-b833-7d33195ca82d" @click="ShowDownloadDialog()">导出</el-button>
-      </el-form-item>
+      <el-row :gutter="20">
+        <el-col :span="20">
+          <el-form-item label="事项名称">
+            <el-input
+
+                v-model="formData.name"
+                placeholder="事项名称">
+            </el-input>
+          </el-form-item>
+          <el-form-item label="总体满意度">
+            <el-select v-model="formData.myTotalEvaluate" placeholder="请选择">
+              <el-option
+                  v-for="item in totalEvaluate"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value">
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="4">
+          <el-form-item class="btn-i">
+
+            <el-button class="role_button" role_button_code="a8f2fe9f-f63f-431e-83d9-cc014cc56737" @click="onCommit">查询</el-button>
+            <el-button class="role_button" role_button_code="ec6284bf-4a37-40e1-b833-7d33195ca82d" @click="ShowDownloadDialog()">导出</el-button>
+            <el-upload style="display: inline-block;margin-left:8px"
+                       class="upload-demo"
+                       action="http://10.81.66.9:9250/ywtb/ywtbHcp_upload"
+                       :show-file-list="showList"
+                       :onError="uploadError"
+                       :onSuccess="uploadSuccess"
+                       :beforeUpload="beforeAvatarUpload"
+                       :file-list="fileList">
+              <el-button   type="primary">点击上传</el-button>
+            </el-upload>
+          </el-form-item>
+        </el-col>
+      </el-row>
     </el-form>
     <div class="tab-number">
       <div class="tab-area">
@@ -169,6 +186,8 @@ export default {
   },
   data() {
     return {
+      showList:false,
+      fileList:[],
       huifuState:'',
       loading: true,
       dialogRepeatTitle:'',
@@ -445,6 +464,46 @@ export default {
     }
   },
   methods:{
+    uploadError (response, file, fileList) {
+      this.loading=false;
+      console.log('上传失败,请重试!',response, file, fileList)
+    },
+    uploadSuccess (response, file, fileList) {
+      console.log('上传文件', response,file, fileList)
+      if(response.msg[0].success =='true'){
+        this.loading=false;
+        this.onCommit();
+        MessageBox.alert('文件上传成功', '提示', {
+          confirmButtonText: '确定'
+        });
+      }else{
+        this.loading=false;
+        this.onCommit();
+        MessageBox.alert('文件上传失败', '提示', {
+          confirmButtonText: '确定'
+        });
+      }
+    },
+    // 上传前对文件的大小的判断
+    beforeAvatarUpload (file) {
+      this.loading=true;
+      const extension = file.name.split('.')[1] === 'xls'
+      const extension2 = file.name.split('.')[1] === 'xlsx'
+      const isLt2M = file.size / 1024 / 1024 < 100
+      if (!extension && !extension2) {
+        this.loading=false;
+        MessageBox.alert('上传模板只能是 xls、xlsx 格式!', '提示', {
+          confirmButtonText: '确定'
+        });
+      }
+      if (!isLt2M) {
+        this.loading=false;
+        MessageBox.alert('上传模板大小不能超过 100MB!', '提示', {
+          confirmButtonText: '确定'
+        });
+      }
+      return extension || extension2  && isLt2M
+    },
     ShowDownloadDialog(){
       this.numberList = [];
       this.$request({