2025-03-11 00:53:58 +00:00
|
|
|
import { useRouter } from 'vue-router'
|
|
|
|
import {
|
|
|
|
NDatePicker,
|
|
|
|
NRadioButton,
|
|
|
|
NRadioGroup,
|
|
|
|
NButton,
|
|
|
|
NSelect,
|
|
|
|
} from 'naive-ui'
|
|
|
|
import GanttCom from '../Gantt'
|
|
|
|
import { getDDList } from '@/api/Gantt/gantt'
|
|
|
|
import { onBeforeMount } from 'vue'
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
setup() {
|
2025-03-12 01:13:41 +00:00
|
|
|
const range = ref([new Date('2000-01-01 00:00:00').getTime(), Date.now()])
|
2025-03-24 09:10:47 +00:00
|
|
|
//const value = ref('year')
|
|
|
|
const value = ref('day')
|
2025-03-11 00:53:58 +00:00
|
|
|
const types = ref([])
|
|
|
|
|
|
|
|
const router = useRouter()
|
|
|
|
const editEvent = () => {
|
|
|
|
console.log(router)
|
|
|
|
router.push('/gantt/mainEdit')
|
|
|
|
}
|
|
|
|
|
|
|
|
onBeforeMount(async () => {
|
|
|
|
await getDDOptions()
|
|
|
|
})
|
|
|
|
|
|
|
|
const ddOptions = ref([])
|
|
|
|
async function getDDOptions() {
|
|
|
|
const { code, data } = await getDDList()
|
|
|
|
if (code === 200) {
|
|
|
|
ddOptions.value = data.list
|
|
|
|
// types.value = ddOptions.value.map(item => item.id)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const ganttRef = ref(null)
|
|
|
|
function searchGanttData() {
|
|
|
|
ganttRef.value.refresh = true
|
|
|
|
}
|
|
|
|
|
|
|
|
return () => (
|
|
|
|
<>
|
|
|
|
<div class="flex gap-2">
|
2025-03-12 01:13:41 +00:00
|
|
|
<NDatePicker
|
|
|
|
class="w-[600px]"
|
|
|
|
v-model:value={range.value}
|
|
|
|
type="datetimerange"
|
|
|
|
clearable
|
|
|
|
/>
|
2025-03-11 00:53:58 +00:00
|
|
|
{/* <NRadioGroup v-model:value={value.value} name="radiobuttongroup">
|
|
|
|
<NRadioButton value="hour" label="日" />
|
|
|
|
<NRadioButton value="day" label="月" />
|
|
|
|
</NRadioGroup> */}
|
2025-03-24 09:10:47 +00:00
|
|
|
<NRadioGroup v-model:value={value.value} name="radiobuttongroup">
|
|
|
|
<NRadioButton value="hour" label="已发生" />
|
|
|
|
<NRadioButton value="day" label="未来计划" />
|
|
|
|
</NRadioGroup>
|
2025-03-11 00:53:58 +00:00
|
|
|
<NSelect
|
|
|
|
v-model:value={types.value}
|
|
|
|
multiple
|
|
|
|
options={ddOptions.value}
|
|
|
|
label-field="name"
|
|
|
|
clearable
|
|
|
|
value-field="id"
|
|
|
|
></NSelect>
|
|
|
|
{/* <NButton class="ml-auto" type="primary" onClick={editEvent}>
|
|
|
|
编辑事件
|
|
|
|
</NButton> */}
|
|
|
|
<NButton class="ml-auto" type="primary" onClick={searchGanttData}>
|
|
|
|
搜索
|
|
|
|
</NButton>
|
|
|
|
</div>
|
|
|
|
<GanttCom
|
|
|
|
ref={ganttRef}
|
|
|
|
scale={value.value}
|
|
|
|
dateRange={range.value}
|
|
|
|
types={types.value}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
},
|
|
|
|
})
|