liuYb vor 4 Jahren
Ursprung
Commit
27d3cb76bf
2 geänderte Dateien mit 33 neuen und 57 gelöschten Zeilen
  1. 9 2
      src/components/Modal.vue
  2. 24 55
      src/views/data/UploadLink.vue

+ 9 - 2
src/components/Modal.vue

@@ -404,7 +404,14 @@ export default {
           console.log(err);
         });
     },
-
+    
+    initialData: function () {
+      this.ziliaoId=this.LinkData.id;
+      this.carS=this.LinkData.carTypeName;
+      this.carT=this.LinkData.carPlatformName;
+      console.log(this.LinkData);
+      console.log(this.ziliaoId);
+    }
 
   },
   mounted() {
@@ -413,7 +420,7 @@ export default {
     this.firstContent1Classify();
     this.firstContent2Classify();
     //this.chooseReleasePlate();
-
+    this.initialData();
   },
 };
 </script>

+ 24 - 55
src/views/data/UploadLink.vue

@@ -72,7 +72,7 @@
     </div>
     <!-- 弹窗: 编辑表格内容 -->
     <Modal
-      v-show="showModal"
+      v-if="showModal"
       v-on:closeme="closeme"
       :LinkData="modalData"
       @update="editTitle"
@@ -385,14 +385,23 @@ export default {
       })
         .then((res) => {
           if (res.data.code === 200) {
-            this.tableData = [];
+            //this.tableData = [];
             let data = res.data.data;
             //this.tableData.push(data[0]);
-            Array.prototype.push.apply(this.tableData, data);
-            console.log(res.data.data);
+            //Array.prototype.push.apply(this.tableData, data);
+            //this.tableData.push(data[0]);
+            for (
+              let i = 0, j = 0;
+              i < this.tableData.length && j < data.length;
+              i++, j++
+            ) {
+              this.tableData.splice(i, 1, data[j]);
+              console.log("399", this.tableData);
+            }
+            console.log(data.length, this.tableData.length);
+            console.log(data[0]);
+            console.log(this.tableData);
           }
-          //console.log("uploadLink this.tableData:", this.tableData);
-          //console.log(res.data.data)
         })
         .catch((err) => {
           console.log(err);
@@ -424,50 +433,7 @@ export default {
     onOutputExcel: function () {},
     //导入excel
     onImportExcel: function () {
-      /* // 获取上传的文件对象
-      const { files } = file.target;
-      // 通过FileReader对象读取文件
-      const fileReader = new FileReader();
-      fileReader.onload = (event) => {
-        try {
-          const { result } = event.target;
-          // 以二进制流方式读取得到整份excel表格对象
-          const workbook = XLSX.read(result, { type: "binary" });
-          // 存储获取到的数据
-          let data = [];
-          // 遍历每张工作表进行读取(这里默认只读取第一张表)
-          for (const sheet in workbook.Sheets) {
-            // esline-disable-next-line
-            if (workbook.Sheets.hasOwnProperty(sheet)) {
-              // 利用 sheet_to_json 方法将 excel 转成 json 数据
-              data = data.concat(
-                XLSX.utils.sheet_to_json(workbook.Sheets[sheet])
-              );
-              // break; // 如果只取第一张表,就取消注释这行
-            }
-          }
-          // 最终获取到并且格式化后的 json 数据
-          const uploadData = data.map((item) => {
-            return {
-              id: Number(item["人员ID"]),
-              name: item["姓名"],
-              idType: this.findIdType(item["证件类型"], "string"),
-              credentialsId: item["证件号码"],
-              tel: item["固定电话"],
-              mobile: item["移动电话"],
-            };
-          });
-          console.log(uploadData); //这里得到了后端需要的json数据,调用接口传给后端就行了
-          //message.success('上传成功!') //这里用了antd中的message组件
-          console.log("上传成功!");
-        } catch (e) {
-          // 这里可以抛出文件类型错误不正确的相关提示
-          //  message.error('文件类型不正确!');
-          console.log("文件类型不正确!");
-        }
-      };
-      // 以二进制方式打开文件
-      fileReader.readAsBinaryString(files[0]); */
+      //
     },
     //获取平台列表
     getPlatform: function () {
@@ -479,6 +445,8 @@ export default {
         .then((res) => {
           if (res.data.code === 200) {
             this.platform = res.data.data;
+            this.platformVal = this.platform[0].platformName;
+            this.choosePlatform();
           }
         })
         .catch((err) => {
@@ -495,11 +463,12 @@ export default {
       });
       this.selectedPlatform = val;
 
+      //获取可发布数量
+      this.getReleaseQuantity(obj.id);
+
       //发布平台ID
       this.getDataList(obj.id);
 
-      //获取可发布数量
-      this.getReleaseQuantity(obj.id);
       //获取发布版块
       this.chooseReleasePlate(obj.id);
     },
@@ -521,13 +490,13 @@ export default {
       })
         .then((res) => {
           if (res.data.code === 200) {
-            console.log(res)
+            console.log(res);
             this.publishCount = res.data.data[1].publishCount;
             let len = this.publishCount;
             let l = this.tableData.length;
             console.log("获取可发布数量", len, l);
-            
-            while (len > l) {
+            this.tableData = [];
+            while (len > 0) {
               //this.tableData.push([]);
               Array.prototype.push.apply(this.tableData, [this.emptyData]);
               len--;