Explorar el Código

新增所有模型的json导出功能(v1.0,待核对修改)

xyh123999 hace 2 años
padre
commit
0995f91b93
Se han modificado 1 ficheros con 187 adiciones y 4 borrados
  1. 187 4
      src/views/onlineForm/formRender/onlineFormMixins.js

+ 187 - 4
src/views/onlineForm/formRender/onlineFormMixins.js

@@ -784,7 +784,6 @@ const OnlineFormMixins = {
             let fileInfoStr = row.component_movementjson;
             let fileInfoArr = JSON.parse(fileInfoStr);
             let fileInfo = fileInfoArr[0]; // 假设只有一个文件
-            console.log('row[id] :>> ', row);
             await axios.get('http://localhost:8084/admin/online/onlineOperation/downloadDatasource/mainUnit', {
               params: {
                 datasourceId: '1657931215497334784',
@@ -860,12 +859,197 @@ const OnlineFormMixins = {
             link.click();
             document.body.removeChild(link);
           }
+          else if(this.formId == 1675055217952952320){
+            console.log('row :>> ', row);
+            let number = row.number
+            const data = {};
+            data[number] = {
+              type: row.type,
+              properties:{
+                id: row.id,
+                lon: row.lon,
+                lat: row.lat,
+                h: row.h,
+                picture: row.picture,
+              }
+            }
+            const jsonData = JSON.stringify(data);
+            const blob = new Blob([jsonData], { type: 'application/json' });
+            const url = URL.createObjectURL(blob);
+
+            const link = document.createElement('a');
+            link.href = url;
+            link.download = '指挥中心-' + row.number + '.json';
+            document.body.appendChild(link);
+            link.click();
+            document.body.removeChild(link);
+          }
+          else if(this.formId == 1675055674104483840){
+            console.log('row :>> ', row);
+            let name = row.name
+            const data = {};
+            data[name] = {
+                id:row.id,
+                name: row.name,
+                BW: row.BW,
+                PW: row.PW,
+                fc: row.fc,
+                fs: row.fs,
+                h: row.h,
+                lat: row.lat,
+                lon: row.lon,
+                modulation: row.modulation,
+                prf: row.prf,
+                prf_mode: row.prf_mode,
+                type: row.type,
+                style: row.style,
+                url: row.url,
+                picture: row.picture,
+            }
+            const jsonData = JSON.stringify(data);
+            const blob = new Blob([jsonData], { type: 'application/json' });
+            const url = URL.createObjectURL(blob);
+
+            const link = document.createElement('a');
+            link.href = url;
+            link.download = '末端拦截-' + row.name + '.json';
+            document.body.appendChild(link);
+            link.click();
+            document.body.removeChild(link);
+          }
+          else if(this.formId == 1675056214280507392){
+            let number = row.number
+            const data = {};
+            data[number] = {
+              type: row.type,
+              properties:{
+                id: row.id,
+                CSV_starttime: row.CSV_starttime,
+                CSV_endtime: row.CSV_endtime,
+                CSV_path: row.CSV_path,
+                CSV_sampletime: row.CSV_sampletime,
+                TLE_Propagator: row.TLE_Propagator,
+                common_RAAN: row.common_RAAN,
+                common_argofperiapsis: row.common_argofperiapsis,
+                common_eccentricity: row.common_eccentricity,
+                common_inclination: row.common_inclination,
+                common_semiMajorAxis: row.common_semiMajorAxis,
+                common_trueanomaly: row.common_trueanomaly,
+                config_type: row.config_type,
+                mark: row.mark,
+                picture: row.picture,
+              }
+            }
+            const jsonData = JSON.stringify(data);
+            const blob = new Blob([jsonData], { type: 'application/json' });
+            const url = URL.createObjectURL(blob);
+
+            const link = document.createElement('a');
+            link.href = url;
+            link.download = '预警卫星-' + row.number + '.json';
+            document.body.appendChild(link);
+            link.click();
+            document.body.removeChild(link);
+          }
+          else if(this.formId == 1675048581024714752)
+          {
+            console.log('row :>> ', row);
+            let number = row.number
+            const data = {};
+            data[number] = {
+              type: row.type,
+              properties:{
+                id: row.id,
+                launch_lon: row.launch_lon,
+                launch_lat: row.launch_lat,
+                launch_h: row.launch_h,
+                target_lon: row.target_lon,
+                target_lat: row.target_lat,
+                target_h: row.target_h,
+                apogee_height: row.apogee_height,
+                fly_time: row.fly_time,
+                filepath: row.filepath,
+                acceleration: row.acceleration
+              }
+            }
+            const jsonData = JSON.stringify(data);
+            const blob = new Blob([jsonData], { type: 'application/json' });
+            const url = URL.createObjectURL(blob);
+
+            const link = document.createElement('a');
+            link.href = url;
+            link.download = '弹道导弹-' + row.number + '.json';
+            document.body.appendChild(link);
+            link.click();
+            document.body.removeChild(link);
+          }
+          else if(this.formId == 1674960384441716736){
+           
+            let number = row.number
+            const data = {};
+            data[number] = {
+              type: row.type,
+              properties:{
+                id: row.id,
+                N: row.N,
+                f0: row.fo,
+                number: row.number,
+                tau: row.tau,
+                tr: row.tr,
+                ts: row.ts,
+                url: row.url,
+                method: row.method,
+              }
+            }
+            const jsonData = JSON.stringify(data);
+            const blob = new Blob([jsonData], { type: 'application/json' });
+            const url = URL.createObjectURL(blob);
+
+            const link = document.createElement('a');
+            link.href = url;
+            link.download = '干扰雷达-' + row.number + '.json';
+            document.body.appendChild(link);
+            link.click();
+            document.body.removeChild(link);
+          }
+          else if(this.formId == 1674971627114205184){
+            console.log('row :>> ', row);
+            let number = row.number
+            const data = {};
+            data[number] = {
+              type: row.type,
+              creator: row.creator,
+              properties:{
+                id: row.id,
+                f0: row.fo,
+                number: row.number,
+                tau: row.tau,
+                k: row.k,
+                time: row.time,
+                tr: row.tr,
+                t_r: row.t_r,
+                ts: row.ts,
+                url: row.url,
+                method: row.method,
+              }
+            }
+            const jsonData = JSON.stringify(data);
+            const blob = new Blob([jsonData], { type: 'application/json' });
+            const url = URL.createObjectURL(blob);
+
+            const link = document.createElement('a');
+            link.href = url;
+            link.download = '诱饵雷达-' + row.number + '.json';
+            document.body.appendChild(link);
+            link.click();
+            document.body.removeChild(link);
+          }
           else {
             //todo 场景想定json导出
-            console.log('row :>> ', row);
+        
             let fileInfoStr = row.blueunit;
             let fileInfoArr = JSON.parse(fileInfoStr);
-            console.log('fileInfoArr :>> ', fileInfoArr);
+   
             let fileInfo = fileInfoArr[0]; // 假设只有一个文件
             for(let i = 0;i<fileInfoArr.length;i++){
             await axios.get('http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main', {
@@ -914,7 +1098,6 @@ const OnlineFormMixins = {
                 console.error(error);
               });
             }
-            console.log('this.redunit :>> ', this.redunit);
             const data = {
               id: row.id,
               xdname: row.xdname,