Przeglądaj źródła

修改 反馈时间限制,反馈新增

liuYb 4 lat temu
rodzic
commit
0d5af98c9c
2 zmienionych plików z 69 dodań i 13 usunięć
  1. 5 2
      src/request/api.js
  2. 64 11
      src/views/data/UploadLink.vue

+ 5 - 2
src/request/api.js

@@ -15,6 +15,9 @@ axios.interceptors.request.use((config) => {
     if (config.url === '/firmsUpload') { //针对上传文件的接口 data不做转义 否则会造成传值为空
         config.data = baseData
     }
+    if (config.url === '/importDealerFeedback') { //针对经销商导入文件的接口 data不做转义 否则会造成传值为空
+        config.data = baseData
+    }
     return config;
 }, (err) => {
     console.log('请求拦截', err);
@@ -28,7 +31,7 @@ axios.interceptors.response.use((config) => {
     console.log('响应拦截', err);
     return Promise.reject(err);
 })
-axios.uploadFile = function (url, data) {
+axios.uploadFile = function(url, data) {
     console.log(data.getAll('file'));
     let config = {
         //请求的接口,在请求的时候,如axios.get(url,config);这里的url会覆盖掉config中的url
@@ -48,4 +51,4 @@ axios.uploadFile = function (url, data) {
     return axios.post(url, data, config);
 };
 
-export default axios
+export default axios

+ 64 - 11
src/views/data/UploadLink.vue

@@ -97,6 +97,7 @@
             type="file"
             name="fileName"
             id="fileInput"
+            accept=".xlsx, .xls"
             multiple
         /></label>
         <!-- <button @click="toggleModal4()">导出</button> <input
@@ -274,6 +275,7 @@ export default {
         startTime: null,
       },
       file: "",
+      dictList: [],
     };
   },
   computed: {
@@ -303,7 +305,6 @@ export default {
       this.nowIndex = i;
       this.modalData = this.tableData[i];
       console.log("INtoggleModal2", this.modalData, this.nowIndex);
-
     },
     closeme2: function () {
       this.showModal2 = !this.showModal2;
@@ -334,12 +335,14 @@ export default {
         .catch((err) => {
           console.log(err);
         });
+        //更新数据
+        this.choosePlatform();
     },
 
     toDel: function (n) {
-       console.log("inToDel:", n);
+      console.log("inToDel:", n);
       //清空数据
-     /*  if (n == -2) {
+      /*  if (n == -2) {
         this.tableData = "";
       }
       //清空某一项数据
@@ -472,7 +475,7 @@ export default {
     // 获取文件
     getFileInfo: function (event) {
       this.file = event.target.files;
-
+      console.log(this.file);
       let fileDes = [];
       this.file.forEach((item) => {
         fileDes.push(item.name);
@@ -483,13 +486,9 @@ export default {
     // 导入接口
     submitRequest: function () {
       let paramData = new FormData();
-      //paramData.append("file", this.file[0]);
-      this.file.forEach((item)=>{
-          paramData.append("file", item);
-          console.log(item)
-      })
-      console.log(this.file);
-      console.log(paramData);
+      this.file.forEach((item) => {
+        paramData.append("file", item);
+      });
       this.$http
         .uploadFile("/importDealerFeedback", paramData)
         .then((res) => {
@@ -675,10 +674,64 @@ export default {
           console.log(err);
         });
     }, */
+    // 上传时间为xx个月内的资料进行反馈  获取内容分类、媒体平台、常用参数接口的标识,再调接口时需要用到
+    selectSysDataDictList: function () {
+      return new Promise((resolve, reject) => {
+        this.$http({
+          method: "post",
+          url: "/sys/dataDict/selectSysDataDictList",
+          data: {},
+        })
+          .then((res) => {
+            if (res.data && res.data.code === 200) {
+              this.dictList = res.data.data;
+              resolve();
+            } else {
+              console.log(res);
+              reject();
+            }
+          })
+          .catch((err) => {
+            console.log(err);
+            reject();
+          });
+      });
+    },
+    // 获取列表数据   接口
+    getDateList: function () {
+      this.$http({
+        method: "post",
+        url: "/sys/dataDict/selectSysDataDictPage",
+        data: {
+          dictCode: this.dictList[0]["dictCode"],
+          parentId: this.dictList[0]["id"],
+        },
+      })
+        .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) => {
+          console.log(err);
+        });
+    },
   },
   mounted() {
     this.getPlatform();
   },
+  created() {
+    this.selectSysDataDictList()
+      .then(() => {
+        this.getDateList();
+      })
+      .catch((err) => {
+        console.log(err);
+      });
+  },
 };
 </script>