diff --git a/src/api/Gantt/index.js b/src/api/Gantt/index.js index e544d9e02..47317867b 100755 --- a/src/api/Gantt/index.js +++ b/src/api/Gantt/index.js @@ -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) }) } diff --git a/src/views/Gantt/components/EventList/hooks.jsx b/src/views/Gantt/components/EventList/hooks.jsx index defb07663..ad14a8dda 100644 --- a/src/views/Gantt/components/EventList/hooks.jsx +++ b/src/views/Gantt/components/EventList/hooks.jsx @@ -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) } diff --git a/src/views/Gantt/components/Gantt/hooks/gantt.ts b/src/views/Gantt/components/Gantt/hooks/gantt.ts index a57f47b61..d6e613361 100644 --- a/src/views/Gantt/components/Gantt/hooks/gantt.ts +++ b/src/views/Gantt/components/Gantt/hooks/gantt.ts @@ -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) } diff --git a/src/views/Gantt/components/MainGantt/index.jsx b/src/views/Gantt/components/MainGantt/index.jsx index 9f0e9e1d1..b44f463cb 100644 --- a/src/views/Gantt/components/MainGantt/index.jsx +++ b/src/views/Gantt/components/MainGantt/index.jsx @@ -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({ */} + + + + ( <>
- 态势展示 + {/* 态势展示 */} { router.go(-1)