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, // data,
// }) // })
// } // }
const SimpList = {
data: {
list: [
{
id: 31834,
name: "事件1",
color: 1
}
]
},
}
export function getSimpList() { export function getSimpList() {
return request({ return new Promise((resolve, reject) => {
url: `${baseUrl}/gantt/target-info/simp-list`, setTimeout(() => {
method: 'get', resolve(SimpList)
}, 200)
}) })
} }
export function getSimpTreeList(data) { // export function getSimpList() {
return request({ // return request({
url: `${baseUrl}/gantt/target-activity/tree-list`, // url: `${baseUrl}/gantt/target-info/simp-list`,
method: 'post', // method: 'get',
data, // })
// }
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() { async function searchTreeList() {
tableData.value = [] tableData.value = []
const res = await getSimpTreeList({ // const res = await getSimpTreeList({
targetId: targetId.value, // targetId: targetId.value,
startTime: range.value ? range.value[0] : null, // startTime: range.value ? range.value[0] : null,
endTime: range.value ? range.value[1] : null, // endTime: range.value ? range.value[1] : null,
}) // })
const res = await getSimpTreeList()
tableData.value = res.data.list tableData.value = res.data.list
// console.log('searchTreeList', tableData) // console.log('searchTreeList', tableData)
} }

View File

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

View File

@ -13,7 +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('year')
const value = ref('day')
const types = ref([]) const types = ref([])
const router = useRouter() const router = useRouter()
@ -53,6 +54,10 @@ 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">
<NRadioButton value="hour" label="已发生" />
<NRadioButton value="day" label="未来计划" />
</NRadioGroup>
<NSelect <NSelect
v-model:value={types.value} v-model:value={types.value}
multiple multiple

View File

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