Browse Source

兼容多个表格导入,excel下载链接修改

qzy 10 months ago
parent
commit
e94e470df1

+ 2 - 2
.env.production

@@ -5,10 +5,10 @@ VUE_APP_TITLE = 综合保税区管理系统
 ENV = 'production'
 
 # 综合保税区管理系统/生产环境
-# VUE_APP_BASE_API = 'http://bsq-server.aseanbusiness.cn'
+ VUE_APP_BASE_API = 'http://bsq-server.aseanbusiness.cn'
 # VUE_APP_BASE_API ='http://106.55.241.82:9001'
 # VUE_APP_BASE_API = 'http://localhost:9527'
-VUE_APP_BASE_API = 'https://bsq.bbwb.gxzf.gov.cn/server'
+# VUE_APP_BASE_API = 'https://bsq.bbwb.gxzf.gov.cn/server'
 # 请求、响应数据加密
 VUE_APP_AES_ENCRYPT_ENABLED = 'false'
 # 请求数据加密秘钥串

+ 90 - 77
src/views/report/RECORD/index.vue

@@ -106,12 +106,10 @@
           </el-input>
           <div>用于计算综保区外贸占全区外贸进出口百分比</div>
         </el-form-item>
-        <el-form-item label="进出口总值">
+        <el-form-item label="原数据">
           <el-upload
               ref="upload"
-              :auto-upload="false"
-              :limit="1"
-              :data="{gxTradeTotalMoney:form.gxTradeTotalMoney}"
+              :multiple="true"
               accept=".xlsx, .xls"
               :headers="upload.headers"
               :action="upload.url + '?updateSupport=' + upload.updateSupport"
@@ -119,7 +117,6 @@
               :on-progress="handleFileUploadProgress"
               :before-upload="beforeUpload"
               :on-success="handleFileSuccess"
-              :on-change="onChange"
               drag
           >
             <i class="el-icon-upload"></i>
@@ -130,15 +127,14 @@
             <div class="el-upload__tip text-left" slot="tip">
               <div class="el-upload__tip" slot="tip">
                 <label class="notice-tip">注意</label>
-                导入相同的统计数据会覆盖原来的数据
+                进出口总值.xlsx,活跃企业数.xlsx,部分贸易方式.xlsx表格
               </div>
-              <span>仅允许导入xls、xlsx格式文件。</span>
             </div>
           </el-upload>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button type="primary" @click="submitForm">保 存</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
@@ -147,10 +143,10 @@
         title="提示"
         :visible.sync="notice.visible"
         width="30%">
-      <span>确认不填写全区外贸总值直接上传?</span>
+      <span>确认不填写全区外贸总值直接提交?</span>
       <span slot="footer" class="dialog-footer">
         <el-button @click="notice.visible = false">返回填写</el-button>
-        <el-button type="warning" @click="sureUpload">直接上传</el-button>
+        <el-button type="warning" @click="sureSubmit">直接提交</el-button>
       </span>
     </el-dialog>
     <el-dialog
@@ -163,7 +159,8 @@
               v-for="(activity, index) in word.activities"
               :key="index"
               :timestamp="activity.timestamp" style="padding-top: 20px">
-            {{activity.content}}<span style="font-size: 10px;padding-left: 15px"><el-link type="primary" @click="prev(activity)">下载</el-link></span>
+            {{ activity.content }}<span style="font-size: 10px;padding-left: 15px"><el-link type="primary"
+                                                                                            @click="prev(activity)">下载</el-link></span>
           </el-timeline-item>
         </el-timeline>
       </div>
@@ -171,7 +168,8 @@
         <el-button type="primary" @click="word.visible=false">关 闭</el-button>
       </span>
     </el-dialog>
-    <el-dialog :title="self.title" :visible.sync="self.open" :modal="false" width="500px" append-to-body id="upload-win">
+    <el-dialog :title="self.title" :visible.sync="self.open" :modal="false" width="500px" append-to-body
+               id="upload-win">
       <div style="text-align: center;padding: 20px">
         <el-upload
             ref="selfUpload"
@@ -211,20 +209,20 @@ export default {
   name: "RECORD",
   data() {
     return {
-      word:{
-        title:'',
+      word: {
+        title: '',
         visible: false,
-        activities:[]
+        activities: []
       },
       notice: {
         visible: false,
       },
       selfUrl: process.env.VUE_APP_BASE_API + '/report/RECORD/upload',
-      self:{
-        title:'',
+      self: {
+        title: '',
         visible: false,
-        open:false,
-        form:{}
+        open: false,
+        form: {}
       },
       // 根路径
       baseURL: process.env.VUE_APP_BASE_API,
@@ -259,7 +257,8 @@ export default {
         // 设置上传的请求头部
         headers: {Authorization: 'Bearer ' + getToken()},
         // 上传的地址
-        url: process.env.VUE_APP_BASE_API + '/template/importExcel'
+        // url: process.env.VUE_APP_BASE_API + '/template/importExcel',
+        url: process.env.VUE_APP_BASE_API + '/report/RECORD/importExcel'
       },
       // 查询参数
       queryParams: {
@@ -273,6 +272,7 @@ export default {
       form: {
         preface: null,
         gxTradeTotalMoney: null,
+        fileList: []
       },
       // 表单校验
       rules: {
@@ -294,33 +294,28 @@ export default {
     beforeUpload(file) {
 
     },
-    sureUpload() {
-      this.notice.visible = false;
-      this.$refs.upload.submit();
-    },
-    onChange(file, fileList) {
-      let gxTradeTotalMoney = this.form.gxTradeTotalMoney;
-      if (!gxTradeTotalMoney && !this.upload.uploadFinish) {
-        this.notice.visible = true;
-        return;
-      }
-      this.$refs.upload.submit();
-    },
+
+
     handleFileUploadProgress(event, file, fileList) {
 
     },
     handleFileSuccess(response, file, fileList) {
       let code = response.code;
-      this.$refs.upload.clearFiles();
       this.upload.uploadFinish = true;
       if (code !== 200) {
-        this.$message.error(response.msg);
+        this.$message.error("上传失败");
         return;
       }
-      this.$message.success('处理成功');
-      this.reset();
-      this.open = false;
-      this.getList();
+      let obj = {
+        name: file.name,
+        path: response.data
+      }
+      this.form.fileList.push(obj);
+      this.$message.success('上传成功');
+
+      // this.reset();
+      //this.open = false;
+      //this.getList();
     },
     handleUploadSuccess(response, file, fileList) {
       let code = response.code;
@@ -330,43 +325,43 @@ export default {
         return;
       }
       this.$message.success('上传成功');
-      this.self.open = false;
-      this.self.visible=false;
+      //this.self.open = false;
+      //this.self.visible=false;
     },
-    uploadReport(data){
-      this.self={
-        title: "上传【"+data.reportYear+"年"+data.reportMonth+"月】的自定义报告",
+    uploadReport(data) {
+      this.self = {
+        title: "上传【" + data.reportYear + "年" + data.reportMonth + "月】的自定义报告",
         visible: true,
         open: true,
         form: data
       }
     },
     handleInfo(row) {
-      listAllWORD({recordId:row.id}).then(resp=>{
-      let list = resp.data;
-      if (list.length===1){
-        window.location.href=list[0].wordPath;
-        return;
-      }
-      let activities=[];
-      list.forEach(data=>{
-        let obj={
-          timestamp:data.createTime,
-          content:data.wordName,
-          path:data.wordPath
+      listAllWORD({recordId: row.id}).then(resp => {
+        let list = resp.data;
+        if (list.length >= 1) {
+          window.location.href = process.env.VUE_APP_BASE_API + list[0].wordPath;
+          return;
         }
-        activities.push(obj)
-      })
+        let activities = [];
+        list.forEach(data => {
+          let obj = {
+            timestamp: data.createTime,
+            content: data.wordName,
+            path: process.env.VUE_APP_BASE_API + data.wordPath
+          }
+          activities.push(obj)
+        })
         this.word = {
           title: row.reportYear + '年' + row.reportMonth + '月历史报告',
           open: true,
-          visible:true,
+          visible: true,
           activities: activities
         }
       })
     },
-    prev(data){
-      window.location.href=data.path;
+    prev(data) {
+      window.location.href = data.path;
     },
     /** 查询辅助决策列表 */
     getList() {
@@ -414,8 +409,13 @@ export default {
     handleAdd() {
       this.reset();
       this.open = true;
-      this.title = "导入分析数据";
+      this.title = "导入原数据";
+      //this.$refs.upload.clearFiles();
       this.upload.uploadFinish = false;
+      this.form.fileList = [];
+      setTimeout(() => {
+        this.$refs.upload.clearFiles();
+      }, 30)
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
@@ -429,24 +429,37 @@ export default {
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateRECORD(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addRECORD(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
+      let obj = this.form;
+      let fileList = obj.fileList;
+      if (fileList.length === 0) {
+        this.$message.error('原数据未上传');
+        return;
+      }
+      let gxTradeTotalMoney = obj.gxTradeTotalMoney;
+      if (!gxTradeTotalMoney) {
+        this.notice.visible = true;
+        return;
+      }
+      this.saveForm();
+    },
+    sureSubmit() {
+      this.notice.visible = false;
+      this.saveForm();
+    },
+    saveForm() {
+      let form = this.form;
+      let obj = {
+        preface: form.preface,
+        gxTradeTotalMoney: form.gxTradeTotalMoney,
+        paths: form.fileList.map(o => o.path).join(",")
+      }
+      addRECORD(obj).then(response => {
+        this.$modal.msgSuccess("保存成功");
+        this.open = false;
+        this.getList();
       });
     },
+
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;

+ 4 - 4
src/views/report/TEMPLATE/index.vue

@@ -66,8 +66,8 @@
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="模版名称" align="center" prop="title">
       </el-table-column>
-      <el-table-column label="模版路径" align="center" prop="filename" width="450">
-      </el-table-column>
+<!--      <el-table-column label="模版路径" align="center" prop="filename" width="450">-->
+<!--      </el-table-column>-->
       <el-table-column label="是否启用" align="center" prop="status">
         <template slot-scope="scope">
           <el-switch
@@ -383,8 +383,8 @@
     },
     /** 导出按钮操作 */
     handleExport(row) {
-      let templatePath = row.templatePath;
-      window.location.href=templatePath;
+      let templatePath = row.filename;
+      window.location.href=process.env.VUE_APP_BASE_API+templatePath;
     }
   }
 };

+ 4 - 3
src/views/system/user/profile/userAvatar.vue

@@ -1,6 +1,7 @@
 <template>
   <div>
-    <div class="user-info-head" @click="editCropper()"><img v-bind:src="options.img" title="点击上传头像" class="img-circle img-lg" /></div>
+    <div class="user-info-head" @click="editCropper()">
+      <img v-bind:src="options.img" title="点击上传头像" class="img-circle img-lg" /></div>
     <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="800px" append-to-body @opened="modalOpened"  @close="closeDialog">
       <el-row>
         <el-col :xs="24" :md="12" :style="{height: '350px'}">
@@ -130,7 +131,7 @@ export default {
         //   store.commit('SET_AVATAR', this.options.img);
         //   this.$modal.msgSuccess("修改成功");
         //   this.visible = false;
-          
+
         // });
         let formData = new FormData();
         formData.append("avatarfile", data);
@@ -179,4 +180,4 @@ export default {
   line-height: 110px;
   border-radius: 50%;
 }
-</style>
+</style>