|
@@ -39,6 +39,15 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import httpRequest from '@/utils/request.js'
|
|
|
+ import {
|
|
|
+ saveAs
|
|
|
+ } from 'file-saver'
|
|
|
+ import {
|
|
|
+ apiGetExportMsg
|
|
|
+ } from '@/api/gengra'
|
|
|
+ import {
|
|
|
+ DebugCameraPrimitive
|
|
|
+ } from 'cesium'
|
|
|
export default {
|
|
|
props: {
|
|
|
data: {
|
|
@@ -53,6 +62,12 @@
|
|
|
return '';
|
|
|
},
|
|
|
},
|
|
|
+ type: {
|
|
|
+ type: String,
|
|
|
+ default: () => {
|
|
|
+ return 'wind';
|
|
|
+ },
|
|
|
+ },
|
|
|
dropdownMenu: {
|
|
|
type: Array,
|
|
|
default: () => {
|
|
@@ -101,7 +116,7 @@
|
|
|
switch (type) {
|
|
|
case 'save':
|
|
|
/**该保存功能目前暂用于风电场, combine页 */
|
|
|
- if (props.type !== 'wind') {
|
|
|
+ if (this.type !== 'wind') {
|
|
|
return false
|
|
|
}
|
|
|
ElMessageBox.confirm("确认保存当前节点的拟合功率?", "保存", {
|
|
@@ -146,15 +161,32 @@
|
|
|
}).then(() => {
|
|
|
const a = document.createElement("a");
|
|
|
let childs = []
|
|
|
- childs = props.type === 'wind' ? data.childs.map((o) => o.id) : data.childs.map(
|
|
|
+ childs = this.type === 'wind' ? data.childs.map((o) => o.id) : data.childs.map(
|
|
|
(o) => o.path)
|
|
|
- const url = props.type === 'wind' ? '/data/option/download?ids=' :
|
|
|
+ const url = this.type === 'wind' ? '/data/option/download?ids=' :
|
|
|
'/export/files?filename='
|
|
|
a.href =
|
|
|
- config.baseURL + url + childs.join(",");
|
|
|
+ // config.baseURL + url + childs.join(",");
|
|
|
+ process.env.VUE_APP_GENERAT_URL + url + childs.join(",");
|
|
|
a.download = "";
|
|
|
a.target = '_blank'
|
|
|
a.click();
|
|
|
+
|
|
|
+ // let that = this
|
|
|
+ // let childs = []
|
|
|
+ // childs = this.type === 'wind' ? data.childs.map((o) => o.id) : data.childs.map(
|
|
|
+ // (o) => o.path)
|
|
|
+ // let params = {
|
|
|
+ // ids: childs.join(",")
|
|
|
+ // }
|
|
|
+ // apiGetExportMsg(params).then(datas => {
|
|
|
+ // let blob = new Blob([datas], {
|
|
|
+ // type: `application/vnd.ms-excel;charset=utf-8`
|
|
|
+ // })
|
|
|
+ // saveAs(blob)
|
|
|
+ // }).catch((r) => {
|
|
|
+ // console.error(r)
|
|
|
+ // })
|
|
|
});
|
|
|
break;
|
|
|
case "delete":
|
|
@@ -167,7 +199,7 @@
|
|
|
const repeatArr = (arr, deleteArr) => {
|
|
|
for (const unit of arr) {
|
|
|
if (unit.childs.length) {
|
|
|
- deleteArr.push(...unit.childs.map((o) => props.type ===
|
|
|
+ deleteArr.push(...unit.childs.map((o) => this.type ===
|
|
|
'wind' ? o.id : o.path));
|
|
|
} else if (unit.children.length) {
|
|
|
repeatArr(unit.children, deleteArr);
|
|
@@ -175,7 +207,7 @@
|
|
|
}
|
|
|
};
|
|
|
if (data.childs.length) {
|
|
|
- deleteArr = data.childs.map((o) => props.type === 'wind' ? o.id : o
|
|
|
+ deleteArr = data.childs.map((o) => this.type === 'wind' ? o.id : o
|
|
|
.path);
|
|
|
} else if (data.children.length) {
|
|
|
repeatArr(data.children, deleteArr);
|
|
@@ -183,7 +215,7 @@
|
|
|
let res = {
|
|
|
code: 500
|
|
|
}
|
|
|
- if (props.type === 'wind') {
|
|
|
+ if (this.type === 'wind') {
|
|
|
res = await httpRequest.get("/generat/data/option/delete", {
|
|
|
params: {
|
|
|
ids: deleteArr.join(",")
|