Compare commits
2 Commits
9761ce29ab
...
42841de47d
Author | SHA1 | Date | |
---|---|---|---|
42841de47d | |||
df5c821b10 |
1
components.d.ts
vendored
1
components.d.ts
vendored
@ -9,6 +9,7 @@ declare module '@vue/runtime-core' {
|
|||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
AboutView: typeof import('./src/components/AboutView.vue')['default']
|
AboutView: typeof import('./src/components/AboutView.vue')['default']
|
||||||
Collapse: typeof import('./src/components/Collapse/index.vue')['default']
|
Collapse: typeof import('./src/components/Collapse/index.vue')['default']
|
||||||
|
Dialog: typeof import('./src/components/Dialog/index.vue')['default']
|
||||||
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
|
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
|
||||||
HomeView: typeof import('./src/components/HomeView.vue')['default']
|
HomeView: typeof import('./src/components/HomeView.vue')['default']
|
||||||
IconCommunity: typeof import('./src/components/icons/IconCommunity.vue')['default']
|
IconCommunity: typeof import('./src/components/icons/IconCommunity.vue')['default']
|
||||||
|
521
src/api/Gantt/gantt.js
Executable file → Normal file
521
src/api/Gantt/gantt.js
Executable file → Normal file
@ -1,26 +1,525 @@
|
|||||||
import { defAxios as request } from '@/utils/http'
|
import { defAxios as request } from '@/utils/http'
|
||||||
const baseUrl = `${window.settings.apis}/gantt`
|
const baseUrl = `${window.settings.apis}/gantt`
|
||||||
|
|
||||||
|
const ddList = {
|
||||||
|
code: 200,
|
||||||
|
message: '成功',
|
||||||
|
data: {
|
||||||
|
list: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: '民兵3',
|
||||||
|
model: null,
|
||||||
|
countryName: '美国',
|
||||||
|
remark: null,
|
||||||
|
children: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: '三叉戟II',
|
||||||
|
model: 'D5',
|
||||||
|
countryName: '美国',
|
||||||
|
remark: null,
|
||||||
|
children: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: '火星-15',
|
||||||
|
model: null,
|
||||||
|
countryName: '朝鲜',
|
||||||
|
remark: null,
|
||||||
|
children: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
name: '东风-5甲',
|
||||||
|
model: null,
|
||||||
|
countryName: '中国',
|
||||||
|
remark: null,
|
||||||
|
children: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
name: '东风-5乙',
|
||||||
|
model: null,
|
||||||
|
countryName: '中国',
|
||||||
|
remark: null,
|
||||||
|
children: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 6,
|
||||||
|
name: '东风-31',
|
||||||
|
model: null,
|
||||||
|
countryName: '中国',
|
||||||
|
remark: null,
|
||||||
|
children: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 7,
|
||||||
|
name: 'SS-18“撒旦”',
|
||||||
|
model: null,
|
||||||
|
countryName: '俄罗斯',
|
||||||
|
remark: null,
|
||||||
|
children: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 8,
|
||||||
|
name: 'M51',
|
||||||
|
model: null,
|
||||||
|
countryName: '法国',
|
||||||
|
remark: null,
|
||||||
|
children: null,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const sub = {
|
||||||
|
code: 200,
|
||||||
|
message: '成功',
|
||||||
|
data: {
|
||||||
|
list: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: '飞机',
|
||||||
|
level: 2,
|
||||||
|
pid: 1,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: '轰炸机',
|
||||||
|
level: 3,
|
||||||
|
pid: 1,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: 10,
|
||||||
|
activityId: 1,
|
||||||
|
name: '轰炸合计',
|
||||||
|
equipModel: '歼-15',
|
||||||
|
describe: null,
|
||||||
|
reportSite: null,
|
||||||
|
startTime: '2026-11-30 16:00:00',
|
||||||
|
endTime: '2025-03-27 16:00:00',
|
||||||
|
fileUrl:
|
||||||
|
'/upload/1741082451927/Snipaste_2026-12-26_09-53-15.png',
|
||||||
|
oneType: 1,
|
||||||
|
twoType: 2,
|
||||||
|
twoTypeName: '轰炸机',
|
||||||
|
level: 4,
|
||||||
|
pid: 2,
|
||||||
|
status: 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: '战斗机',
|
||||||
|
level: 3,
|
||||||
|
pid: 1,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
activityId: 1,
|
||||||
|
name: 'cehi',
|
||||||
|
equipModel: '歼-15',
|
||||||
|
describe: null,
|
||||||
|
reportSite: null,
|
||||||
|
startTime: '2025-01-31 16:00:00',
|
||||||
|
endTime: '2025-04-28 16:00:00',
|
||||||
|
fileUrl:
|
||||||
|
'/upload/1741078260582/Snipaste_2026-12-26_09-53-15.png',
|
||||||
|
oneType: 1,
|
||||||
|
twoType: 1,
|
||||||
|
twoTypeName: '战斗机',
|
||||||
|
level: 4,
|
||||||
|
pid: 1,
|
||||||
|
status: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
activityId: 1,
|
||||||
|
name: 'rr',
|
||||||
|
equipModel: '歼-20',
|
||||||
|
describe: null,
|
||||||
|
reportSite: null,
|
||||||
|
startTime: '2026-12-31 16:00:00',
|
||||||
|
endTime: '2025-04-09 16:00:00',
|
||||||
|
fileUrl:
|
||||||
|
'/upload/1741078034784/Snipaste_2026-12-26_09-53-15.png',
|
||||||
|
oneType: 1,
|
||||||
|
twoType: 1,
|
||||||
|
twoTypeName: '战斗机',
|
||||||
|
level: 4,
|
||||||
|
pid: 1,
|
||||||
|
status: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
activityId: 1,
|
||||||
|
name: '测试战斗机',
|
||||||
|
equipModel: 'adsf',
|
||||||
|
describe: null,
|
||||||
|
reportSite: null,
|
||||||
|
startTime: '2025-03-04 16:00:00',
|
||||||
|
endTime: '2025-04-09 16:00:00',
|
||||||
|
fileUrl:
|
||||||
|
'/upload/1741077889066/Snipaste_2026-12-26_09-53-15.png',
|
||||||
|
oneType: 1,
|
||||||
|
twoType: 1,
|
||||||
|
twoTypeName: '战斗机',
|
||||||
|
level: 4,
|
||||||
|
pid: 1,
|
||||||
|
status: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
activityId: 1,
|
||||||
|
name: '起飞',
|
||||||
|
equipModel: '歼-20',
|
||||||
|
describe: '飞机起飞',
|
||||||
|
reportSite: '北京站',
|
||||||
|
startTime: '2025-03-03 09:21:34',
|
||||||
|
endTime: '2025-03-03 09:21:34',
|
||||||
|
fileUrl: 'https://www.iocoder.cn',
|
||||||
|
oneType: 1,
|
||||||
|
twoType: 1,
|
||||||
|
twoTypeName: '战斗机',
|
||||||
|
level: 4,
|
||||||
|
pid: 1,
|
||||||
|
status: 2,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: '舰船',
|
||||||
|
level: 2,
|
||||||
|
pid: 1,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: 7,
|
||||||
|
name: '驱逐舰',
|
||||||
|
level: 3,
|
||||||
|
pid: 2,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: 9,
|
||||||
|
activityId: 1,
|
||||||
|
name: '优惠',
|
||||||
|
equipModel: '歼-15',
|
||||||
|
describe: null,
|
||||||
|
reportSite: null,
|
||||||
|
startTime: '2025-02-28 16:00:00',
|
||||||
|
endTime: '2025-03-04 16:00:00',
|
||||||
|
fileUrl:
|
||||||
|
'/upload/1741080337527/Snipaste_2026-12-26_09-53-15.png',
|
||||||
|
oneType: 2,
|
||||||
|
twoType: 7,
|
||||||
|
twoTypeName: '驱逐舰',
|
||||||
|
level: 4,
|
||||||
|
pid: 7,
|
||||||
|
status: 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: '遥感',
|
||||||
|
level: 2,
|
||||||
|
pid: 1,
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
name: '公开源',
|
||||||
|
level: 2,
|
||||||
|
pid: 1,
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
name: '航警',
|
||||||
|
level: 2,
|
||||||
|
pid: 1,
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 6,
|
||||||
|
name: '频谱&组网',
|
||||||
|
level: 2,
|
||||||
|
pid: 1,
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 7,
|
||||||
|
name: '声音&视频&流量&告警',
|
||||||
|
level: 2,
|
||||||
|
pid: 1,
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const main = {
|
||||||
|
code: 200,
|
||||||
|
message: '成功',
|
||||||
|
data: {
|
||||||
|
list: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: '民兵3',
|
||||||
|
model: null,
|
||||||
|
countryName: '美国',
|
||||||
|
remark: null,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: 22,
|
||||||
|
targetId: 1,
|
||||||
|
name: 'sdfas',
|
||||||
|
code: null,
|
||||||
|
describe: 'adfdf',
|
||||||
|
startTime: '2025-03-05 00:00:00',
|
||||||
|
endTime: '2025-05-01 00:00:00',
|
||||||
|
fileUrl: null,
|
||||||
|
source: null,
|
||||||
|
publishTime: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 15,
|
||||||
|
targetId: 1,
|
||||||
|
name: '朝鲜发射火星-18洲际弹道导弹事件',
|
||||||
|
code: null,
|
||||||
|
describe:
|
||||||
|
'2025年10月4日,朝鲜发射火星-18洲际弹道导弹,这是一种固体燃料的洲际弹道导弹。\n导弹发射后,美国、日本、韩国强烈谴责,认为此举加剧地区紧张,同时联合国呼吁朝鲜遵守安理会决议,停止导弹试验。',
|
||||||
|
startTime: '2025-10-03 16:00:00',
|
||||||
|
endTime: '2025-10-03 16:00:00',
|
||||||
|
fileUrl: null,
|
||||||
|
source: null,
|
||||||
|
publishTime: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
targetId: 1,
|
||||||
|
name: '美国民兵3发射试验2',
|
||||||
|
code: null,
|
||||||
|
describe: '美国民兵3在太平洋发射试验2',
|
||||||
|
startTime: '2026-03-05 13:14:58',
|
||||||
|
endTime: '2026-03-13 13:15:10',
|
||||||
|
fileUrl: null,
|
||||||
|
source: null,
|
||||||
|
publishTime: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
targetId: 1,
|
||||||
|
name: '美国民兵3发射试验1',
|
||||||
|
code: null,
|
||||||
|
describe: '美国民兵3在太平洋发射试验1',
|
||||||
|
startTime: '2026-05-04 13:14:05',
|
||||||
|
endTime: '2026-05-05 13:14:14',
|
||||||
|
fileUrl: null,
|
||||||
|
source: null,
|
||||||
|
publishTime: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
targetId: 1,
|
||||||
|
name: '美国民兵3发射试验',
|
||||||
|
code: null,
|
||||||
|
describe: '美国民兵3在太平洋发射试验',
|
||||||
|
startTime: '2025-01-04 13:12:40',
|
||||||
|
endTime: '2025-01-05 13:12:50',
|
||||||
|
fileUrl: null,
|
||||||
|
source: null,
|
||||||
|
publishTime: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 12,
|
||||||
|
targetId: 1,
|
||||||
|
name: '测试添加---编辑',
|
||||||
|
code: null,
|
||||||
|
describe: '测试添加描述---编辑',
|
||||||
|
startTime: '2025-03-01 00:00:00',
|
||||||
|
endTime: '2025-03-03 00:00:00',
|
||||||
|
fileUrl: null,
|
||||||
|
source: null,
|
||||||
|
publishTime: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 21,
|
||||||
|
targetId: 1,
|
||||||
|
name: '0307测试事件',
|
||||||
|
code: null,
|
||||||
|
describe: '1111111111',
|
||||||
|
startTime: '2025-03-07 00:00:00',
|
||||||
|
endTime: '2025-03-07 00:00:00',
|
||||||
|
fileUrl: null,
|
||||||
|
source: null,
|
||||||
|
publishTime: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const main2 = {
|
||||||
|
code: 200,
|
||||||
|
message: '成功',
|
||||||
|
data: {
|
||||||
|
list: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: '民兵3',
|
||||||
|
model: null,
|
||||||
|
countryName: '美国',
|
||||||
|
remark: null,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: 22,
|
||||||
|
targetId: 1,
|
||||||
|
name: 'sdfas123',
|
||||||
|
code: null,
|
||||||
|
describe: 'adfdf',
|
||||||
|
startTime: '2025-03-27 00:00:00',
|
||||||
|
endTime: '2025-05-01 00:00:00',
|
||||||
|
fileUrl: null,
|
||||||
|
source: null,
|
||||||
|
publishTime: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 12,
|
||||||
|
targetId: 1,
|
||||||
|
name: '测试添加-12--编辑',
|
||||||
|
code: null,
|
||||||
|
describe: '测试添加描述---编辑',
|
||||||
|
startTime: '2025-04-01 00:00:00',
|
||||||
|
endTime: '2025-04-03 00:00:00',
|
||||||
|
fileUrl: null,
|
||||||
|
source: null,
|
||||||
|
publishTime: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 21,
|
||||||
|
targetId: 1,
|
||||||
|
name: '0307测试12事件',
|
||||||
|
code: null,
|
||||||
|
describe: '1111111111',
|
||||||
|
startTime: '2025-04-07 00:00:00',
|
||||||
|
endTime: '2025-04-07 00:00:00',
|
||||||
|
fileUrl: null,
|
||||||
|
source: null,
|
||||||
|
publishTime: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
targetId: 1,
|
||||||
|
name: '美国民兵3发射12试验',
|
||||||
|
code: null,
|
||||||
|
describe: '美国民兵3在太平洋发射试验',
|
||||||
|
startTime: '2025-06-04 13:12:40',
|
||||||
|
endTime: '2025-06-05 13:12:50',
|
||||||
|
fileUrl: null,
|
||||||
|
source: null,
|
||||||
|
publishTime: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 15,
|
||||||
|
targetId: 1,
|
||||||
|
name: '朝鲜发射火星-18洲123际弹道导弹事件',
|
||||||
|
code: null,
|
||||||
|
describe:
|
||||||
|
'2025年10月4日,朝鲜发射火星-18洲际弹道导弹,这是一种固体燃料的洲际弹道导弹。\n导弹发射后,美国、日本、韩国强烈谴责,认为此举加剧地区紧张,同时联合国呼吁朝鲜遵守安理会决议,停止导弹试验。',
|
||||||
|
startTime: '2025-10-03 16:00:00',
|
||||||
|
endTime: '2025-10-03 16:00:00',
|
||||||
|
fileUrl: null,
|
||||||
|
source: null,
|
||||||
|
publishTime: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
targetId: 1,
|
||||||
|
name: '美国民兵3发射试123验2',
|
||||||
|
code: null,
|
||||||
|
describe: '美国民兵3在太平洋发射试验2',
|
||||||
|
startTime: '2026-03-05 13:14:58',
|
||||||
|
endTime: '2026-03-13 13:15:10',
|
||||||
|
fileUrl: null,
|
||||||
|
source: null,
|
||||||
|
publishTime: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
targetId: 1,
|
||||||
|
name: '美国民兵3发射123试验1',
|
||||||
|
code: null,
|
||||||
|
describe: '美国民兵3在太平洋发射试验1',
|
||||||
|
startTime: '2026-05-04 13:14:05',
|
||||||
|
endTime: '2026-05-05 13:14:14',
|
||||||
|
fileUrl: null,
|
||||||
|
source: null,
|
||||||
|
publishTime: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
export function getDDList() {
|
export function getDDList() {
|
||||||
return request({
|
return new Promise((resolve, reject) => {
|
||||||
url: `${baseUrl}/gantt/target-info/simp-list`,
|
setTimeout(() => {
|
||||||
method: 'get',
|
resolve(ddList)
|
||||||
|
}, 200)
|
||||||
})
|
})
|
||||||
|
// return request({
|
||||||
|
// url: `${baseUrl}/gantt/target-info/simp-list`,
|
||||||
|
// method: 'get',
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMainGantt(data = {}) {
|
export function getMainGantt(data = {}) {
|
||||||
return request({
|
return new Promise((resolve, reject) => {
|
||||||
url: `${baseUrl}/gantt/target-info/gantt-list`,
|
setTimeout(() => {
|
||||||
method: 'post',
|
if (data.status === 1) {
|
||||||
data,
|
resolve(main)
|
||||||
|
} else {
|
||||||
|
resolve(main2)
|
||||||
|
}
|
||||||
|
}, 200)
|
||||||
})
|
})
|
||||||
|
// return request({
|
||||||
|
// url: `${baseUrl}/gantt/target-info/gantt-list`,
|
||||||
|
// method: 'post',
|
||||||
|
// data,
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSubGantt(params) {
|
export function getSubGantt(params) {
|
||||||
return request({
|
return new Promise((resolve, reject) => {
|
||||||
url: `${baseUrl}/gantt/activity-event/gantt-list`,
|
setTimeout(() => {
|
||||||
method: 'get',
|
resolve(sub)
|
||||||
params,
|
}, 200)
|
||||||
})
|
})
|
||||||
|
// return request({
|
||||||
|
// url: `${baseUrl}/gantt/activity-event/gantt-list`,
|
||||||
|
// method: 'get',
|
||||||
|
// params,
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
0
src/api/Gantt/index.js
Executable file → Normal file
0
src/api/Gantt/index.js
Executable file → Normal file
0
src/assets/fonts/digital.ttf
Executable file → Normal file
0
src/assets/fonts/digital.ttf
Executable file → Normal file
13
src/components/Dialog/index.vue
Normal file
13
src/components/Dialog/index.vue
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { useDialog } from 'naive-ui'
|
||||||
|
import { defineComponent } from 'vue'
|
||||||
|
|
||||||
|
// content
|
||||||
|
export default defineComponent({
|
||||||
|
setup() {
|
||||||
|
window.$dialog = useDialog()
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template></template>
|
@ -4,6 +4,7 @@ export const useTree = () => {
|
|||||||
getAllKeys,
|
getAllKeys,
|
||||||
getLeafNodeIds,
|
getLeafNodeIds,
|
||||||
getLeafNode,
|
getLeafNode,
|
||||||
|
getTimeRangeForTree,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,3 +73,36 @@ function getLeafNode(tree) {
|
|||||||
|
|
||||||
return leafNodes
|
return leafNodes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTimeRangeForTree(tree) {
|
||||||
|
let earliestStartTime = null
|
||||||
|
let latestEndTime = null
|
||||||
|
function traverse(node) {
|
||||||
|
if ('startTime' in node) {
|
||||||
|
const nodeStartTime = new Date(node.startTime).getTime()
|
||||||
|
const nodeEndTime = new Date(node.endTime).getTime()
|
||||||
|
if (
|
||||||
|
earliestStartTime === null ||
|
||||||
|
nodeStartTime < new Date(earliestStartTime).getTime()
|
||||||
|
) {
|
||||||
|
earliestStartTime = node.startTime
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
latestEndTime === null ||
|
||||||
|
nodeEndTime > new Date(latestEndTime).getTime()
|
||||||
|
) {
|
||||||
|
latestEndTime = node.endTime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
node.children &&
|
||||||
|
Array.isArray(node.children) &&
|
||||||
|
node.children.length > 0
|
||||||
|
) {
|
||||||
|
node.children.forEach(child => traverse(child))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tree.forEach(rootNode => traverse(rootNode))
|
||||||
|
return [earliestStartTime, latestEndTime]
|
||||||
|
}
|
||||||
|
@ -26,6 +26,7 @@ const useGantt = ({ router, route }: GanttParams) => {
|
|||||||
|
|
||||||
const timeRange = ref([])
|
const timeRange = ref([])
|
||||||
const plans = ref()
|
const plans = ref()
|
||||||
|
const happen = ref()
|
||||||
// onMounted(() => {
|
// onMounted(() => {
|
||||||
// getGanttData()
|
// getGanttData()
|
||||||
// })
|
// })
|
||||||
@ -83,12 +84,12 @@ const useGantt = ({ router, route }: GanttParams) => {
|
|||||||
const date = new Date(mainEvent.startTime)
|
const date = new Date(mainEvent.startTime)
|
||||||
const year = date.getFullYear()
|
const year = date.getFullYear()
|
||||||
const month = date.getMonth()
|
const month = date.getMonth()
|
||||||
//const startOfMonth = new Date(year, month, 1)
|
const startOfMonth = new Date(year, month, 1)
|
||||||
const startOfMonth = new Date(year, month, mainEvent.startTime)
|
// const startOfMonth = new Date(year, month, mainEvent.startTime)
|
||||||
startOfMonth.setHours(0, 0, 0, 0)
|
startOfMonth.setHours(0, 0, 0, 0)
|
||||||
|
|
||||||
// const lastDayOfMonth = new Date(year, month + 1, 0)
|
const lastDayOfMonth = new Date(year, month + 1, 0)
|
||||||
const lastDayOfMonth = new Date(year, month ,mainEvent.startTime)
|
// const lastDayOfMonth = new Date(year, month ,mainEvent.startTime)
|
||||||
const endOfMonth = new Date(
|
const endOfMonth = new Date(
|
||||||
year,
|
year,
|
||||||
month,
|
month,
|
||||||
@ -230,7 +231,7 @@ const useGantt = ({ router, route }: GanttParams) => {
|
|||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
field: 'name',
|
field: 'name',
|
||||||
title: subId ? '事件类型' : '事件主体',
|
title: subId ? '目标' : '事件主体',
|
||||||
width: '120',
|
width: '120',
|
||||||
mergeCell: true,
|
mergeCell: true,
|
||||||
customLayout: args => {
|
customLayout: args => {
|
||||||
@ -284,12 +285,12 @@ const useGantt = ({ router, route }: GanttParams) => {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
if (subId) {
|
if (subId) {
|
||||||
columns.unshift({
|
// columns.unshift({
|
||||||
field: 'parentName',
|
// field: 'parentName',
|
||||||
title: '事件分类',
|
// title: '事件分类',
|
||||||
width: '120',
|
// width: '120',
|
||||||
mergeCell: true,
|
// mergeCell: true,
|
||||||
})
|
// })
|
||||||
// columns.unshift({
|
// columns.unshift({
|
||||||
// field: 'isChecked',
|
// field: 'isChecked',
|
||||||
// title: '',
|
// title: '',
|
||||||
@ -538,7 +539,7 @@ const useGantt = ({ router, route }: GanttParams) => {
|
|||||||
})
|
})
|
||||||
container.add(end)
|
container.add(end)
|
||||||
// 事件条
|
// 事件条
|
||||||
if (plans.value == 'hour') {
|
if (happen.value == 2) {
|
||||||
const rect = new Rect({
|
const rect = new Rect({
|
||||||
width: width,
|
width: width,
|
||||||
height: 7,
|
height: 7,
|
||||||
@ -609,8 +610,9 @@ const useGantt = ({ router, route }: GanttParams) => {
|
|||||||
return new Image(opt)
|
return new Image(opt)
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeTimeScales(scale: TYPES.ITimelineScale['unit']) {
|
function changeTimeScales(scale: TYPES.ITimelineScale['unit'], val: number) {
|
||||||
plans.value = scale
|
plans.value = scale
|
||||||
|
happen.value = val
|
||||||
const scales = getTimeScales(scale)
|
const scales = getTimeScales(scale)
|
||||||
ganttInstance && ganttInstance.updateScales(scales)
|
ganttInstance && ganttInstance.updateScales(scales)
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,11 @@ export default defineComponent({
|
|||||||
props: {
|
props: {
|
||||||
scale: {
|
scale: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'day',
|
default: 'year',
|
||||||
|
},
|
||||||
|
happen: {
|
||||||
|
type: Number,
|
||||||
|
default: 1,
|
||||||
},
|
},
|
||||||
dateRange: {
|
dateRange: {
|
||||||
type: Array,
|
type: Array,
|
||||||
@ -61,6 +65,7 @@ export default defineComponent({
|
|||||||
ids: props.types,
|
ids: props.types,
|
||||||
startTime: props.dateRange ? props.dateRange[0] : null,
|
startTime: props.dateRange ? props.dateRange[0] : null,
|
||||||
endTime: props.dateRange ? props.dateRange[1] : null,
|
endTime: props.dateRange ? props.dateRange[1] : null,
|
||||||
|
status: props.happen, //发生状态:1已发生、2未发生
|
||||||
})
|
})
|
||||||
|
|
||||||
stopRefresh()
|
stopRefresh()
|
||||||
@ -72,7 +77,13 @@ export default defineComponent({
|
|||||||
watch(
|
watch(
|
||||||
() => props.scale,
|
() => props.scale,
|
||||||
val => {
|
val => {
|
||||||
changeTimeScales(val)
|
changeTimeScales(val, props.happen)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
watch(
|
||||||
|
() => props.happen,
|
||||||
|
val => {
|
||||||
|
changeTimeScales(props.scale, val)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -90,6 +101,7 @@ export default defineComponent({
|
|||||||
ids: props.types,
|
ids: props.types,
|
||||||
startTime: props.dateRange ? props.dateRange[0] : null,
|
startTime: props.dateRange ? props.dateRange[0] : null,
|
||||||
endTime: props.dateRange ? props.dateRange[1] : null,
|
endTime: props.dateRange ? props.dateRange[1] : null,
|
||||||
|
status: props.happen, //发生状态:1已发生、2未发生
|
||||||
})
|
})
|
||||||
|
|
||||||
updateMarkLine()
|
updateMarkLine()
|
||||||
|
@ -2,7 +2,7 @@ import { Group, Image, Text, CheckBox, Rect } from '@visactor/vtable/es/vrender'
|
|||||||
|
|
||||||
import { useDialog } from 'naive-ui'
|
import { useDialog } from 'naive-ui'
|
||||||
import { Gantt, tools, TYPES } from '@visactor/vtable-gantt'
|
import { Gantt, tools, TYPES } from '@visactor/vtable-gantt'
|
||||||
import { getMainGantt, getSubGantt } from '@/api/Gantt'
|
import { getMainGantt, getSubGantt } from '@/api/Gantt/gantt'
|
||||||
|
|
||||||
type GanttParams = {
|
type GanttParams = {
|
||||||
route?: any
|
route?: any
|
||||||
|
@ -13,8 +13,8 @@ import { onBeforeMount } from 'vue'
|
|||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
setup() {
|
setup() {
|
||||||
const range = ref([new Date('2000-01-01 00:00:00').getTime(), Date.now()])
|
const range = ref([new Date('2000-01-01 00:00:00').getTime(), Date.now()])
|
||||||
//const value = ref('year')
|
|
||||||
const value = ref('day')
|
const value = ref('day')
|
||||||
|
const happen = ref(1)
|
||||||
const types = ref([])
|
const types = ref([])
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@ -40,6 +40,9 @@ export default defineComponent({
|
|||||||
function searchGanttData() {
|
function searchGanttData() {
|
||||||
ganttRef.value.refresh = true
|
ganttRef.value.refresh = true
|
||||||
}
|
}
|
||||||
|
function changeHappen() {
|
||||||
|
range.value = [Date.now(), new Date('2027-01-01 00:00:00').getTime()]
|
||||||
|
}
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<>
|
<>
|
||||||
@ -54,9 +57,13 @@ export default defineComponent({
|
|||||||
<NRadioButton value="hour" label="日" />
|
<NRadioButton value="hour" label="日" />
|
||||||
<NRadioButton value="day" label="月" />
|
<NRadioButton value="day" label="月" />
|
||||||
</NRadioGroup> */}
|
</NRadioGroup> */}
|
||||||
<NRadioGroup v-model:value={value.value} name="radiobuttongroup">
|
<NRadioGroup
|
||||||
<NRadioButton value="hour" label="已发生" />
|
v-model:value={happen.value}
|
||||||
<NRadioButton value="day" label="未来计划" />
|
name="radiobuttongroup"
|
||||||
|
onChange={changeHappen}
|
||||||
|
>
|
||||||
|
<NRadioButton value={1} label="已发生" />
|
||||||
|
<NRadioButton value={2} label="未来计划" />
|
||||||
</NRadioGroup>
|
</NRadioGroup>
|
||||||
<NSelect
|
<NSelect
|
||||||
v-model:value={types.value}
|
v-model:value={types.value}
|
||||||
@ -76,6 +83,7 @@ export default defineComponent({
|
|||||||
<GanttCom
|
<GanttCom
|
||||||
ref={ganttRef}
|
ref={ganttRef}
|
||||||
scale={value.value}
|
scale={value.value}
|
||||||
|
happen={happen.value}
|
||||||
dateRange={range.value}
|
dateRange={range.value}
|
||||||
types={types.value}
|
types={types.value}
|
||||||
/>
|
/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { NForm, NFormItem, NInput, NDataTable, NButton } from 'naive-ui'
|
import { NForm, NFormItem, NInput, NDataTable, NButton } from 'naive-ui'
|
||||||
import ModalCom from '@/components/Modal/index.vue'
|
import ModalCom from '@/components/Modal/index.vue'
|
||||||
import { getMainGantt } from '@/api/gantt'
|
import { getMainGantt } from '@/api/Gantt/gantt'
|
||||||
import useTask from './hooks'
|
import useTask from './hooks'
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
// props: {
|
// props: {
|
||||||
|
Loading…
Reference in New Issue
Block a user