This commit is contained in:
Lx 2025-03-24 17:10:47 +08:00
parent 7426a33282
commit 9761ce29ab
5 changed files with 122 additions and 48 deletions

View File

@ -377,19 +377,79 @@ const baseUrl = window.settings.apis + '/gantt'
// data,
// })
// }
const SimpList = {
data: {
list: [
{
id: 31834,
name: "事件1",
color: 1
}
]
},
}
export function getSimpList() {
return request({
url: `${baseUrl}/gantt/target-info/simp-list`,
method: 'get',
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(SimpList)
}, 200)
})
}
export function getSimpTreeList(data) {
return request({
url: `${baseUrl}/gantt/target-activity/tree-list`,
method: 'post',
data,
// export function getSimpList() {
// return request({
// url: `${baseUrl}/gantt/target-info/simp-list`,
// method: 'get',
// })
// }
const SimpTreeList =
{
data: {
list: [
{
childList: [
{
childList: [
{
endTime: "2025-02-28T09:02:19.195Z",
fileUrl: "https://www.iocoder.cn",
id: 31834,
name: "事件1",
startTime: "2025-02-28T09:02:19.195Z",
}
],
id: 0,
name: "string"
}
],
describe: "string",
endTime: "2025-02-28T09:02:19.195Z",
fileUrl: "https://www.iocoder.cn",
id: 2734,
name: "事件2",
startTime: "2025-02-28T09:02:19.195Z"
}
]
},
}
// export function getSimpTreeList(data) {
// return request({
// url: `${baseUrl}/gantt/target-activity/tree-list`,
// method: 'post',
// data,
// })
// }
export function getSimpTreeList() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(SimpTreeList)
}, 200)
})
}

View File

@ -90,11 +90,12 @@ const oneClassData = ref(null)
async function searchTreeList() {
tableData.value = []
const res = await getSimpTreeList({
targetId: targetId.value,
startTime: range.value ? range.value[0] : null,
endTime: range.value ? range.value[1] : null,
})
// const res = await getSimpTreeList({
// targetId: targetId.value,
// startTime: range.value ? range.value[0] : null,
// endTime: range.value ? range.value[1] : null,
// })
const res = await getSimpTreeList()
tableData.value = res.data.list
// console.log('searchTreeList', tableData)
}

View File

@ -25,6 +25,7 @@ const useGantt = ({ router, route }: GanttParams) => {
const records = ref([])
const timeRange = ref([])
const plans = ref()
// onMounted(() => {
// getGanttData()
// })
@ -82,10 +83,12 @@ const useGantt = ({ router, route }: GanttParams) => {
const date = new Date(mainEvent.startTime)
const year = date.getFullYear()
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)
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 endOfMonth = new Date(
year,
month,
@ -287,13 +290,13 @@ const useGantt = ({ router, route }: GanttParams) => {
width: '120',
mergeCell: true,
})
columns.unshift({
field: 'isChecked',
title: '',
width: '60',
headerType: 'checkbox',
cellType: 'checkbox',
})
// columns.unshift({
// field: 'isChecked',
// title: '',
// width: '60',
// headerType: 'checkbox',
// cellType: 'checkbox',
// })
}
return columns
}
@ -534,30 +537,34 @@ const useGantt = ({ router, route }: GanttParams) => {
opacity: taskRecord.status === 2 ? 0.3 : 1,
})
container.add(end)
const rect = new Rect({
width: width,
height: 7,
fill: {
gradient: 'linear',
x0: 0,
y0: 0,
x1: 1,
y1: 0,
stops: [
{
offset: 0,
color: textColor,
},
{
offset: 1,
color: textColorWithOp,
},
],
},
boundsPadding: [10, 0, 0, 0],
opacity: taskRecord.status === 2 ? 0.3 : 1,
})
container.add(rect)
// 事件条
if (plans.value == 'hour') {
const rect = new Rect({
width: width,
height: 7,
fill: {
gradient: 'linear',
x0: 0,
y0: 0,
x1: 1,
y1: 0,
stops: [
{
offset: 0,
color: textColor,
},
{
offset: 1,
// color: textColorWithOp,
color: textColor,
},
],
},
boundsPadding: [10, 0, 0, 0],
opacity: taskRecord.status === 2 ? 0.3 : 1,
})
container.add(rect)
}
return {
rootContainer: container,
@ -603,6 +610,7 @@ const useGantt = ({ router, route }: GanttParams) => {
}
function changeTimeScales(scale: TYPES.ITimelineScale['unit']) {
plans.value = scale
const scales = getTimeScales(scale)
ganttInstance && ganttInstance.updateScales(scales)
}

View File

@ -13,7 +13,8 @@ import { onBeforeMount } from 'vue'
export default defineComponent({
setup() {
const range = ref([new Date('2000-01-01 00:00:00').getTime(), Date.now()])
const value = ref('year')
//const value = ref('year')
const value = ref('day')
const types = ref([])
const router = useRouter()
@ -53,6 +54,10 @@ export default defineComponent({
<NRadioButton value="hour" label="日" />
<NRadioButton value="day" label="月" />
</NRadioGroup> */}
<NRadioGroup v-model:value={value.value} name="radiobuttongroup">
<NRadioButton value="hour" label="已发生" />
<NRadioButton value="day" label="未来计划" />
</NRadioGroup>
<NSelect
v-model:value={types.value}
multiple

View File

@ -17,7 +17,7 @@ export default defineComponent({
return () => (
<>
<div class="flex gap-2">
<NButton onClick={showView}>态势展示</NButton>
{/* <NButton onClick={showView}>态势展示</NButton> */}
<NButton
onClick={() => {
router.go(-1)