|
@@ -13,8 +13,26 @@
|
|
|
</div>
|
|
|
<div class="radio" v-else @click.stop="funCheckChange(child, node)"></div>
|
|
|
</div>
|
|
|
- <span :class="child.showSpan ? 'changenodeLabel' : 'nodeLabel'"
|
|
|
- @click.stop="funCurrentChange(child, node)">{{child.label}}</span>
|
|
|
+ <!-- <span :class="child.showSpan ? 'changenodeLabel' : 'nodeLabel'"
|
|
|
+ @click.stop="funCurrentChange(child, node)">{{child.label}}</span> -->
|
|
|
+ <el-dropdown ref="dropdown1" size="small" trigger="contextmenu" @command="funCommand"
|
|
|
+ style="margin-right: 30px"
|
|
|
+ :class="!node.expanded || (node.isLeaf && !node.isCurrent) ? '' : 'eldropdownCla'">
|
|
|
+ <span :class="child.showSpan ? 'changenodeLabel' : 'nodeLabel'"
|
|
|
+ @click.stop="funCurrentChange(child, node)">{{child.label}}</span>
|
|
|
+ <template #dropdown>
|
|
|
+ <el-dropdown-menu>
|
|
|
+ <el-dropdown-item class="text-[#409EFF]" v-if="dropdownMenu.includes('save')"
|
|
|
+ :command="{ type: 'save', child, node }">保存</el-dropdown-item>
|
|
|
+ <el-dropdown-item class="text-[#409EFF]"
|
|
|
+ v-if="child.childs && child.childs.length && dropdownMenu.includes('export')"
|
|
|
+ :command="{ type: 'export', child, node }">导出
|
|
|
+ </el-dropdown-item>
|
|
|
+ <el-dropdown-item class="text-[#F56C6C]" v-if="dropdownMenu.includes('delete')"
|
|
|
+ :command="{ type: 'delete', child, node }">删除</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </template>
|
|
|
+ </el-dropdown>
|
|
|
</div>
|
|
|
</div>
|
|
|
<tree-node :node="child.children" :data="node" v-if="child.children.length>0" :show-checkbox="showCheckbox">
|
|
@@ -46,6 +64,14 @@
|
|
|
return false;
|
|
|
},
|
|
|
},
|
|
|
+ dropdownMenu: {
|
|
|
+ type: Array,
|
|
|
+ default: () => {
|
|
|
+ return ['export',
|
|
|
+ 'delete',
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ },
|
|
|
},
|
|
|
data() {
|
|
|
return {};
|
|
@@ -102,7 +128,122 @@
|
|
|
})
|
|
|
}
|
|
|
this.$parent.funCheckChange(current, current)
|
|
|
- }
|
|
|
+ },
|
|
|
+ async funCommand({
|
|
|
+ type,
|
|
|
+ data,
|
|
|
+ node
|
|
|
+ }) {
|
|
|
+ switch (type) {
|
|
|
+ case 'save':
|
|
|
+ /**该保存功能目前暂用于风电场, combine页 */
|
|
|
+ if (this.type !== 'wind') {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ ElMessageBox.confirm("确认保存当前节点的拟合功率?", "保存", {
|
|
|
+ confirmButtonText: "确认",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(async () => {
|
|
|
+ let saveArr = [];
|
|
|
+ const repeatArr = (arr, saveArr) => {
|
|
|
+ for (const unit of arr) {
|
|
|
+ if (unit.childs.length) {
|
|
|
+ saveArr.push(...unit.childs.map((o) => o.id));
|
|
|
+ } else if (unit.children.length) {
|
|
|
+ repeatArr(unit.children, saveArr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ if (data.childs.length) {
|
|
|
+ saveArr = data.childs.map((o) => o.id);
|
|
|
+ } else if (data.children.length) {
|
|
|
+ repeatArr(data.children, saveArr);
|
|
|
+ }
|
|
|
+ let res = {
|
|
|
+ code: 500
|
|
|
+ }
|
|
|
+ res = await httpRequest.get("/power/fitting/curve/save", {
|
|
|
+ params: {
|
|
|
+ ids: saveArr.join(",")
|
|
|
+ },
|
|
|
+ }); //删除当前节点
|
|
|
+
|
|
|
+ if (res.code === 200) {
|
|
|
+ ElMessage.success(res.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case "export":
|
|
|
+ ElMessageBox.confirm("确认导出当前节点的所有数据?", "导出", {
|
|
|
+ confirmButtonText: "确认",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ debugger
|
|
|
+
|
|
|
+ const a = document.createElement("a");
|
|
|
+ let childs = []
|
|
|
+ childs = this.type === 'wind' ? data.childs.map((o) => o.id) : data.childs.map(
|
|
|
+ (o) => o.path)
|
|
|
+ const url = this.type === 'wind' ? '/data/option/download?ids=' :
|
|
|
+ '/export/files?filename='
|
|
|
+ a.href =
|
|
|
+ // config.baseURL + url + childs.join(",");
|
|
|
+ process.env.VUE_APP_GENERAT_URL + url + childs.join(",");
|
|
|
+ a.download = "";
|
|
|
+ a.target = '_blank'
|
|
|
+ a.click();
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case "delete":
|
|
|
+ ElMessageBox.confirm("确认删除当前节点的所有数据?", "删除", {
|
|
|
+ confirmButtonText: "确认",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(async () => {
|
|
|
+ let deleteArr = [];
|
|
|
+ const repeatArr = (arr, deleteArr) => {
|
|
|
+ for (const unit of arr) {
|
|
|
+ if (unit.childs.length) {
|
|
|
+ deleteArr.push(...unit.childs.map((o) => this.type ===
|
|
|
+ 'wind' ? o.id : o.path));
|
|
|
+ } else if (unit.children.length) {
|
|
|
+ repeatArr(unit.children, deleteArr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ if (data.childs.length) {
|
|
|
+ deleteArr = data.childs.map((o) => this.type === 'wind' ? o.id : o
|
|
|
+ .path);
|
|
|
+ } else if (data.children.length) {
|
|
|
+ repeatArr(data.children, deleteArr);
|
|
|
+ }
|
|
|
+ let res = {
|
|
|
+ code: 500
|
|
|
+ }
|
|
|
+ if (this.type === 'wind') {
|
|
|
+ res = await httpRequest.get("/data/option/delete", {
|
|
|
+ params: {
|
|
|
+ ids: deleteArr.join(",")
|
|
|
+ },
|
|
|
+ }); //删除当前节点
|
|
|
+ } else {
|
|
|
+ res = await httpRequest.delete("/delete/files", {
|
|
|
+ data: {
|
|
|
+ filename: deleteArr.join(",")
|
|
|
+ },
|
|
|
+ }); //删除当前节点
|
|
|
+ }
|
|
|
+ if (res.code === 200) {
|
|
|
+ ElMessage.success(res.msg);
|
|
|
+ this.$emit("refresh");
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
@@ -148,6 +289,10 @@
|
|
|
font-size: 14px;
|
|
|
color: #121212;
|
|
|
line-height: 30px;
|
|
|
+ width: 100%;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
|
|
|
.changenodeLabel {
|
|
@@ -163,6 +308,10 @@
|
|
|
box-shadow: 0px 0px 3px 0px rgba(83, 86, 94, 0.23);
|
|
|
border-radius: 5px;
|
|
|
border: 1px solid rgba(84, 115, 232, 0.3);
|
|
|
+ width: 100%;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
|
|
|
img {
|