|
|
|
@ -16,7 +16,7 @@
|
|
|
|
|
ref="tree"
|
|
|
|
|
:data="treeData"
|
|
|
|
|
:props="defaultProps"
|
|
|
|
|
node-key="id"
|
|
|
|
|
node-key="compositeKey"
|
|
|
|
|
:filter-node-method="filterNode"
|
|
|
|
|
:default-expand-all="true"
|
|
|
|
|
highlight-current
|
|
|
|
@ -216,6 +216,7 @@ export default {
|
|
|
|
|
defaultProps: {
|
|
|
|
|
children: "children",
|
|
|
|
|
label: "name",
|
|
|
|
|
key: "compositeKey", // 确保这里使用的是 uniqueKey
|
|
|
|
|
},
|
|
|
|
|
formdata: {}, //查询定义的form数据
|
|
|
|
|
activeName: "dataTab",
|
|
|
|
@ -262,18 +263,20 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
const thirtyDaysAgo = new Date();
|
|
|
|
|
this.$set(
|
|
|
|
|
this.formdata,
|
|
|
|
|
"starttime",
|
|
|
|
|
new Date(thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30))
|
|
|
|
|
);
|
|
|
|
|
console.log(this.formdata.starttime);
|
|
|
|
|
const currentDate = new Date(); // 获取当前时间
|
|
|
|
|
currentDate.setHours(23); // 设置小时为23
|
|
|
|
|
currentDate.setMinutes(59); // 设置分钟为59
|
|
|
|
|
currentDate.setSeconds(59); // 设置秒数为59
|
|
|
|
|
this.$set(this.formdata, "endtime", currentDate);
|
|
|
|
|
// const thirtyDaysAgo = new Date();
|
|
|
|
|
// this.$set(
|
|
|
|
|
// this.formdata,
|
|
|
|
|
// "starttime",
|
|
|
|
|
// new Date(thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30))
|
|
|
|
|
// );
|
|
|
|
|
// console.log(this.formdata.starttime);
|
|
|
|
|
// const currentDate = new Date(); // 获取当前时间
|
|
|
|
|
// currentDate.setHours(23); // 设置小时为23
|
|
|
|
|
// currentDate.setMinutes(59); // 设置分钟为59
|
|
|
|
|
// currentDate.setSeconds(59); // 设置秒数为59
|
|
|
|
|
// this.$set(this.formdata, "endtime", currentDate);
|
|
|
|
|
// console.log("我是开始时间", this.formdata.starttime);
|
|
|
|
|
// console.log("我是结束时间", currentDate);
|
|
|
|
|
this.treeData = [];
|
|
|
|
|
this.getSubNodes();
|
|
|
|
|
},
|
|
|
|
@ -302,13 +305,14 @@ export default {
|
|
|
|
|
if (response.data && response.data.length > 0) {
|
|
|
|
|
console.log(response.data);
|
|
|
|
|
//node.children = response.data.content; // 将获取到的子节点数据赋值给父节点的children属性
|
|
|
|
|
this.treeData = response.data; // 将获取到的子节点数据赋值给父节点的children属性
|
|
|
|
|
//this.treeData = response.data; // 将获取到的子节点数据赋值给父节点的children属性
|
|
|
|
|
this.treeData = this.processData(response.data);
|
|
|
|
|
console.log(this.treeData[0]);
|
|
|
|
|
this.defaultExpandedKeys = [
|
|
|
|
|
this.treeData[0].children[0].children[0].id,
|
|
|
|
|
];
|
|
|
|
|
this.currentNodekey =
|
|
|
|
|
this.treeData[0].children[0].children[0].children[0].id;
|
|
|
|
|
this.treeData[0].children[0].children[0].children[0].compositeKey;
|
|
|
|
|
console.log("我是选中的id", this.currentNodekey);
|
|
|
|
|
this.currentNodeData =
|
|
|
|
|
this.treeData[0].children[0].children[0].children[0];
|
|
|
|
@ -323,8 +327,19 @@ export default {
|
|
|
|
|
console.error("Failed to fetch sub-nodes:", error); // 处理请求错误,可以根据实际需求进行错误处理操作
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
processData(data, level = 0) {
|
|
|
|
|
return data.map((node) => {
|
|
|
|
|
const compositeKey = `${level}-${node.id}`; // 创建复合标识符
|
|
|
|
|
node.compositeKey = compositeKey; // 将复合标识符添加到节点属性中
|
|
|
|
|
if (node.children) {
|
|
|
|
|
node.children = this.processData(node.children, level + 1); // 递归处理子节点
|
|
|
|
|
}
|
|
|
|
|
return node;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
handleNodeClick(data, node) {
|
|
|
|
|
console.log(data, node);
|
|
|
|
|
|
|
|
|
|
console.log(this.currentNodeKey);
|
|
|
|
|
if (data.hasOwnProperty("children")) {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
@ -339,7 +354,7 @@ export default {
|
|
|
|
|
// });
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
this.currentNodeKey = data.id;
|
|
|
|
|
this.currentNodeKey = data.compositeKey;
|
|
|
|
|
this.crrrentName = data.name;
|
|
|
|
|
this.currentId = data.id;
|
|
|
|
|
this.page = 1;
|
|
|
|
@ -384,14 +399,49 @@ export default {
|
|
|
|
|
.then((res) => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
if (res.success) {
|
|
|
|
|
console.log(res.data.content[0].acquisitionTime);
|
|
|
|
|
this.formdata.endtime = res.data.content[0].acquisitionTime;
|
|
|
|
|
const thirtyDaysAgo = new Date(this.formdata.endtime);
|
|
|
|
|
this.$set(
|
|
|
|
|
this.formdata,
|
|
|
|
|
"starttime",
|
|
|
|
|
new Date(thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30))
|
|
|
|
|
);
|
|
|
|
|
if (res.data.content.length == 0) {
|
|
|
|
|
// this.formdata.endtime = new Date();
|
|
|
|
|
// const thirtyDaysAgo = new Date(this.formdata.endtime);
|
|
|
|
|
// this.$set(
|
|
|
|
|
// this.formdata,
|
|
|
|
|
// "starttime",
|
|
|
|
|
// new Date(thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30))
|
|
|
|
|
// );
|
|
|
|
|
const thirtyDaysAgo = new Date();
|
|
|
|
|
this.$set(
|
|
|
|
|
this.formdata,
|
|
|
|
|
"starttime",
|
|
|
|
|
new Date(thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30))
|
|
|
|
|
);
|
|
|
|
|
console.log(this.formdata.starttime);
|
|
|
|
|
const currentDate = new Date(); // 获取当前时间
|
|
|
|
|
console.log("asddddadadadadadasd", currentDate);
|
|
|
|
|
currentDate.setHours(23); // 设置小时为23
|
|
|
|
|
currentDate.setMinutes(59); // 设置分钟为59
|
|
|
|
|
currentDate.setSeconds(59); // 设置秒数为59
|
|
|
|
|
this.$set(this.formdata, "endtime", currentDate);
|
|
|
|
|
console.log("我是开始时间", this.formdata.starttime);
|
|
|
|
|
console.log("我是结束时间", currentDate);
|
|
|
|
|
} else {
|
|
|
|
|
console.log(res.data.content[0].acquisitionTime);
|
|
|
|
|
this.formdata.endtime = res.data.content[0].acquisitionTime;
|
|
|
|
|
const qet = new Date(this.formdata.endtime);
|
|
|
|
|
qet.setHours(23); // 设置小时为23
|
|
|
|
|
qet.setMinutes(59); // 设置分钟为59
|
|
|
|
|
qet.setSeconds(59); // 设置秒数为59
|
|
|
|
|
this.$set(this.formdata, "endtime", qet);
|
|
|
|
|
|
|
|
|
|
const thirtyDaysAgo = new Date(this.formdata.endtime);
|
|
|
|
|
thirtyDaysAgo.setHours(0); // 设置小时为23
|
|
|
|
|
thirtyDaysAgo.setMinutes(0); // 设置分钟为59
|
|
|
|
|
thirtyDaysAgo.setSeconds(0); // 设置秒数为59
|
|
|
|
|
this.$set(
|
|
|
|
|
this.formdata,
|
|
|
|
|
"starttime",
|
|
|
|
|
new Date(thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30))
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.handleSearch();
|
|
|
|
|
} else {
|
|
|
|
|
this.tableData = [];
|
|
|
|
|