ソースを参照

经销商导入文件

suxinf 4 年 前
コミット
d75ef4d761

+ 113 - 94
src/views/data/UploadLink.vue

@@ -36,7 +36,9 @@
             >
               <td v-if="flag">{{ index + 1 }}</td>
 
-              <td>{{ (obj.publishDate || '').replace(RegExp('-', 'g'), '/') }}</td>
+              <td>
+                {{ (obj.publishDate || "").replace(RegExp("-", "g"), "/") }}
+              </td>
               <!-- 发布日期 -->
               <td>{{ obj.informationName }}</td>
               <!-- 资料名称 -->
@@ -71,7 +73,7 @@
                 {{ obj.id ? "已反馈" : "未反馈" }}
               </td>
               <!-- 反馈状态  未定-->
-              <td>{{ (obj.endDate || '').replace(RegExp('-', 'g'), '/') }}</td>
+              <td>{{ (obj.endDate || "").replace(RegExp("-", "g"), "/") }}</td>
               <!-- 反馈截止日期 -->
               <td>{{ obj.mediaTitle }}</td>
               <!-- 稿件标题 -->
@@ -84,7 +86,15 @@
                 <!-- <span @click="toggleModal(index)" :class="showItemOperation"
                   >编辑</span
                 > -->
-                <span @click="toggleModal(index)" v-if="+((obj.endDate || '').replace(RegExp('-', 'g'), '')) - nowDate >= 0">编辑</span>
+                <span
+                  @click="toggleModal(index)"
+                  v-if="
+                    +(obj.endDate || '').replace(RegExp('-', 'g'), '') -
+                      nowDate >=
+                    0
+                  "
+                  >编辑</span
+                >
                 <span @click="viewHistoryRecord(obj, index)">查看</span>
                 <!-- <span @click="toggleModal2(index)">删除</span> -->
               </td>
@@ -100,7 +110,7 @@
         @update="editTitle"
         :selectedPlatform="selectedPlatform"
         :releaseMedia="releaseMedia"
-        :userId='userId'
+        :userId="userId"
       ></Modal>
 
       <!-- 弹窗: 确定删除? -->
@@ -193,17 +203,24 @@
         </div>
       </div>
     </div>
-
+    <ResultModal
+      v-show="isShowresultModal"
+      :tipText="tipModalText"
+      :flag="resultModalFlag"
+      @close_result_modal="closeResultModal"
+      @result_modal_submit="submit"
+    ></ResultModal>
     <router-view></router-view>
   </div>
 </template>
 
 <script>
 import Modal from "./components/UploadLinkEditModal";
+import ResultModal from "./components/UploadResultModal";
 import TablePage from "../../components/TablePage";
 import deleteModal from "../data/components/UploadLinkModalDelete";
-import { env_url , php_url } from "../../config/env";
-import axiosTest from 'axios';
+import { env_url, php_url } from "../../config/env";
+import axiosTest from "axios";
 export default {
   props: {
     isManufacturer: {
@@ -215,6 +232,7 @@ export default {
     Modal,
     TablePage,
     deleteModal,
+    ResultModal,
   },
   data() {
     return {
@@ -256,8 +274,7 @@ export default {
         "链接",
         "操作",
       ],
-      tableData: [
-      ],
+      tableData: [],
       flag: true,
       modalData: {}, //17:44
       emptyData: {
@@ -285,10 +302,14 @@ export default {
       dictList: [],
       onlineUrl: env_url, //'http://8.140.188.129:8080'线上 //http://8.136.230.133:8080 //测试,
       otherUrl: php_url,
-      userId: '',
+      userId: "",
       //截止日期
       endTime: "",
       nowDate: 0,
+      isShowresultModal: false,
+      resultModalFlag: false,
+      tipModalText: "导入成功",
+      upLoadName: ""
     };
   },
   computed: {
@@ -313,7 +334,7 @@ export default {
     },
   },
   methods: {
-    getNowDate: function() {
+    getNowDate: function () {
       let data = new Date();
       let year = data.getFullYear();
       let month = data.getMonth() + 1;
@@ -375,9 +396,9 @@ export default {
               Rows: this.pageSize,
               agentId: this.userId,
             };
-            this.getDataList(config);           
+            this.getDataList(config);
           } else {
-            alert ('编辑失败,请重试');
+            alert("编辑失败,请重试");
           }
         })
         .catch((err) => {
@@ -432,36 +453,35 @@ export default {
       };
       this.getDataList(config);
     },
-      testRequest:function(config){
-          axiosTest({
-            url: this.otherUrl + '/lexus_php/api/mytask.php',
-            method: "post",
-            data: {
-                Page: config.Page,
-                Rows: config.Rows,
-                agentId:config.agentId,
-            },
+    testRequest: function (config) {
+      axiosTest({
+        url: this.otherUrl + "/lexus_php/api/mytask.php",
+        method: "post",
+        data: {
+          Page: config.Page,
+          Rows: config.Rows,
+          agentId: config.agentId,
+        },
+      })
+        .then((res) => {
+          if (res.data.code === 200) {
+            let data = res.data.data;
+            this.sum = res.data.count;
+            this.tableData = [];
+            for (let i = 0, j = 0; j < data.length; i++, j++) {
+              this.$set(this.tableData, i, data[j]);
+            }
+          }
         })
-            .then((res) => {
-                if (res.data.code === 200) {
-                    let data = res.data.data;
-                    console.log(data);
-                    this.sum = res.data.count;
-                    this.tableData = [];
-                    for (let i = 0, j = 0; j < data.length; i++, j++) {
-                        this.$set(this.tableData, i, data[j]);
-                    }
-                }
-            })
-            .catch((err) => {
-                console.log(err);
-            });
-      },
+        .catch((err) => {
+          console.log(err);
+        });
+    },
     //获取资料列表
     getDataList: function (config) {
       axiosTest({
-      //  url: "/firmsLinkUpload",
-        url: this.otherUrl + '/lexus_php/api/mytask.php',
+        //  url: "/firmsLinkUpload",
+        url: this.otherUrl + "/lexus_php/api/mytask.php",
         method: "post",
         data: {
           Page: config.Page,
@@ -477,27 +497,6 @@ export default {
             for (let i = 0, j = 0; j < data.length; i++, j++) {
               this.$set(this.tableData, i, data[j]);
             }
-            //修改素材时间显示格式
-           /*  let len = this.tableData.length;
-            for (let i = 0; i < len; i++) {
-              let newValue = "";
-              let temp = this.tableData[i].publishDate;
-              if (
-                this.tableData[i].publishDate != null &&
-                this.tableData[i].publishDate.length >= 10
-              ) {
-                newValue =
-                  temp.slice(0, 4) +
-                  "/" +
-                  temp.slice(5, 7) +
-                  "/" +
-                  temp.slice(8, 10);
-                this.$set(this.tableData[i], "publishDate", newValue);
-              } else {
-                this.$set(this.tableData[i], "publishDate", newValue);
-              }
-            } */
-            //console.log(this.tableData);
           }
         })
         .catch((err) => {
@@ -507,8 +506,10 @@ export default {
     //导出excel
     onOutputExcel: function () {
       //let url = this.onlineUrl + "/exportNoFactory";
-      let url = this.otherUrl + '/lexus_php/web/agent_export.php?agentId='+ this.userId;
-      console.log("导出excel:", url);
+      let url =
+        this.otherUrl +
+        "/lexus_php/web/agent_export.php?agentId=" +
+        this.userId;
       window.open(url);
     },
     // 获取文件
@@ -520,6 +521,27 @@ export default {
       });
       this.submitRequest();
     },
+    // 关闭导入结果弹窗
+    closeResultModal: function () {
+      this.isShowresultModal = false;
+    },
+    // 导入结果返回结果是code是0
+    submit: function () {
+      axiosTest({
+        url: this.otherUrl + "/lexus_php/api/report_import_continue.php",
+        data: {
+          agentId: this.userId,
+          name: this.upLoadName
+        },
+      }).then((res) => {
+        console.log(res);
+        this.resultModalFlag = false;
+        this.isShowresultModal = true;
+        this.tipModalText = res.data.msg || "";
+      }).catch((err) => {
+        console.log(err);
+      })
+    },
     // 导入接口
     submitRequest: function () {
       const paramData = new FormData();
@@ -542,19 +564,32 @@ export default {
       //     console.log(err);
       //   });
       axiosTest({
-        method: 'post',
-        url: this.otherUrl + '/lexus_php/api/report_import.php',
+        method: "post",
+        url: this.otherUrl + "/lexus_php/api/report_import.php",
         data: paramData,
         dataType: "json", //声明成功使用json数据类型回调
         cache: false,
         processData: false,
         contentType: false,
-      }
-      ).then((res) => {
-        console.log(res);
-      }).catch((err) => {
-        console.log(err);
       })
+        .then((res) => {
+          console.log(res);
+          // 完全成功和完全失败只需要显示message
+          this.resultModalFlag = false;
+          this.isShowresultModal = true;
+          if (res.data && (res.data.code === 1 || res.data.code === -1)) {
+            this.tipModalText = res.data.msg || "";
+          } else if(res.data && res.data.code === 0) { // res.data.code === 0,需要让用户选择是不是继续操作
+            this.tipModalText = res.data.msg || "";
+            this.resultModalFlag = true;
+            this.upLoadName = res.data.name;
+          } else {
+            alert('上传失败,请重试')
+          }
+        })
+        .catch((err) => {
+          console.log(err);
+        });
     },
     //获取平台列表
     getPlatform: function () {
@@ -567,7 +602,7 @@ export default {
           if (res.data.code === 200) {
             this.platform = res.data.data;
             this.platformVal = this.platform[0].platformName;
-           // this.choosePlatform();
+            // this.choosePlatform();
           }
         })
         .catch((err) => {
@@ -617,12 +652,9 @@ export default {
       })
         .then((res) => {
           if (res.data.code === 200) {
-            console.log(res);
             this.publishCount =
               res.data.data.length > 0 ? res.data.data[0].publishCount : 0;
             let len = this.publishCount;
-            let l = this.tableData.length;
-            console.log("获取可发布数量", len, l);
             this.tableData = [];
             while (len > 0) {
               this.tableData.push(this.emptyData);
@@ -647,10 +679,8 @@ export default {
         },
       })
         .then((res) => {
-          console.log(res);
           if (res.data.code === 200) {
             this.releaseMedia = res.data.data;
-            console.log("发布版块", this.releaseMedia);
           }
         })
         .catch((err) => {
@@ -660,8 +690,8 @@ export default {
     //导入模板
     importTemplate: function () {
       let str = "反馈链接上传导入表模板(经销商).xlsx";
-      let url = this.onlineUrl + "/downloadTemplate?templateName=" + str;
-      console.log("下载导入模板:", url);
+      // let url = this.onlineUrl + "/downloadTemplate?templateName=" + str;
+      let url = this.otherUrl + "/lexus_php/demo/" + str;
       window.open(url);
     },
 
@@ -678,7 +708,6 @@ export default {
               this.dictList = res.data.data;
               resolve();
             } else {
-              console.log(res);
               reject();
             }
           })
@@ -700,10 +729,7 @@ export default {
       })
         .then((res) => {
           if (res.data && res.data.code === 200) {
-            //this.dictId = res.data.data[0]["id"];
             this.feedbackTimeLimit = res.data.data[0]["dictName"];
-          } else {
-            console.log(res);
           }
         })
         .catch((err) => {
@@ -713,11 +739,14 @@ export default {
     viewHistoryRecord: function (obj, index) {
       this.$router.push({
         path: "uploadLink/sonUploadLink",
-        query: { informationName: obj.informationName, informationId: obj.informationId, i: index },
+        query: {
+          informationName: obj.informationName,
+          informationId: obj.informationId,
+          i: index,
+        },
       });
     },
     isFather: function () {
-      // console.log("isfffffff", this.$route.path.length);
       return this.$route.path.length > 11 ? false : true;
     },
   },
@@ -729,7 +758,7 @@ export default {
       this.userId = localUserId;
     } else {
       console.log("经销商ID '-");
-      this.userId = '';
+      this.userId = "";
     }
     // this.getPlatform();
     //分页取数据
@@ -740,16 +769,6 @@ export default {
     };
     this.getDataList(config);
     //this.testRequest(config);
-  },
-  created() {
-    /*   this.selectSysDataDictList()
-      .then(() => {
-        this.getDateList();
-      })
-      .catch((err) => {
-        console.log(err);
-      }); */
-    //this.getPlatform();
   }
 };
 </script>

+ 2 - 2
src/views/data/components/InfoListItemDetail.vue

@@ -145,9 +145,9 @@ export default {
         "&" +
         "fileId=" +
         this.fileData[index].id; */
-      let config = "fileId=" + this.fileData[index].id;
+      let config = "fileId=" + this.fileData[index].id + "&agentId=" + this.agentId;
       let url = this.onlineUrl + "/dealerDownload?" + config;
-      console.log("下载附件:", config, url);
+      // console.log("下载附件:", config, url);
       window.open(url);
     },
 

+ 5 - 3
src/views/data/components/UploadLinkModalDelete.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="modal-backdrop" v-if="showModalFlag">
+  <div class="modal-backdrop" v-if="showModalFlag" @mousewheel="mousewheel">
     <div class="modal">
       <div class="modal-body">
         <div class="bodyRow">确定删除?</div>
@@ -55,8 +55,10 @@ export default {
     },
     initial: function () {
       this.deleteId=this.LinkData.id;
-      console.log(this.LinkData)
-    }
+    },
+    mousewheel: function (e) {
+      e.preventDefault();
+    },
   },
   mounted() {
     this.initial();

+ 70 - 0
src/views/data/components/UploadResultModal.vue

@@ -0,0 +1,70 @@
+<template>
+  <div class="tip_modal" @mousewheel="mousewheel">
+    <div class="modal_content">
+      <p>{{ tipText }}</p>
+      <div class="button">
+        <div class="current_button" @click="sumit">确定</div>
+        <div class="current_button" @click="closeModal">取消</div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  props: {
+    tipText: {
+      type: String,
+      default: "导入成功",
+    },
+    flag: {
+      type: Boolean,
+      default: false,
+    },
+  },
+  methods: {
+    mousewheel: function (e) {
+      e.preventDefault();
+    },
+    sumit: function () {
+      if (this.flag) {
+        this.$emit("result_modal_submit");
+      }
+      this.closeModal();
+    },
+    closeModal: function () {
+      this.$emit("close_result_modal");
+    },
+  },
+};
+</script>
+
+<style scoped lang="less">
+.tip_modal {
+  position: fixed;
+  left: 0;
+  top: 0;
+  height: 100vh;
+  width: 100vw;
+  background-color: rgba(127, 127, 127, 0.7);
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  .modal_content {
+    width: 500px;
+    height: 230px;
+    background-color: #fff;
+    transform: translateY(-150px);
+    p {
+      font-size: 16px;
+      margin-top: 60px;
+      padding: 0 50px 0 80px;
+    }
+    .button {
+      margin-top: 60px;
+      display: flex;
+      justify-content: center;
+    }
+  }
+}
+</style>