2025-03-11 00:53:58 +00:00
|
|
|
import { getSimpTreeList, getTwoClass } from '@/api/Gantt'
|
|
|
|
|
|
|
|
const universalRules = {
|
|
|
|
name: { required: true, message: '请输入', trigger: 'blur' },
|
|
|
|
startTime: { required: true, message: '请输入', trigger: 'blur' },
|
|
|
|
}
|
|
|
|
const showMainEvent = ref(false)
|
|
|
|
|
|
|
|
watch(showMainEvent, show => {
|
|
|
|
if (!show) {
|
|
|
|
resetMainEventData()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
const mainEventData = ref({
|
|
|
|
name: '',
|
|
|
|
startTime: '',
|
|
|
|
endTime: '',
|
|
|
|
// type: 'mainEvent',
|
|
|
|
describe: '',
|
|
|
|
fileUrl: '',
|
|
|
|
})
|
|
|
|
|
|
|
|
function resetMainEventData() {
|
|
|
|
mainEventData.value = ref({
|
|
|
|
name: '',
|
|
|
|
startTime: '',
|
|
|
|
endTime: '',
|
|
|
|
// type: 'mainEvent',
|
|
|
|
describe: '',
|
|
|
|
fileUrl: '',
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
const targetId = ref(null)
|
|
|
|
const range = ref([new Date('2000-01-01').getTime(), Date.now()])
|
|
|
|
|
|
|
|
const showNewEvent = ref(false)
|
|
|
|
|
|
|
|
watch(showNewEvent, show => {
|
|
|
|
if (!show) {
|
|
|
|
oneClassData.value = null
|
|
|
|
resetEventData()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
const eventData = ref({
|
|
|
|
name: '',
|
|
|
|
startTime: '',
|
|
|
|
endTime: '',
|
|
|
|
fileUrl: '',
|
|
|
|
describe: '',
|
|
|
|
equipModel: '',
|
|
|
|
reportSite: '',
|
|
|
|
// type: 'subEvent',
|
|
|
|
})
|
|
|
|
|
|
|
|
function resetEventData() {
|
|
|
|
eventData.value = ref({
|
|
|
|
name: '',
|
|
|
|
startTime: '',
|
|
|
|
endTime: '',
|
|
|
|
fileUrl: '',
|
|
|
|
describe: '',
|
|
|
|
equipModel: '',
|
|
|
|
reportSite: '',
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
const tableData = ref([])
|
|
|
|
|
|
|
|
const oneClassData = ref(null)
|
|
|
|
async function searchTreeList() {
|
|
|
|
tableData.value = []
|
|
|
|
|
|
|
|
const res = await getSimpTreeList({
|
|
|
|
targetId: targetId.value,
|
|
|
|
startTime: new Date(range.value[0]).toISOString(),
|
|
|
|
endTime: new Date(range.value[1]).toISOString(),
|
|
|
|
})
|
|
|
|
tableData.value = res.data.list
|
|
|
|
// console.log('searchTreeList', tableData)
|
|
|
|
}
|
|
|
|
|
|
|
|
const sonOptions = ref([])
|
|
|
|
async function getTwoClassList(oneTypeId) {
|
|
|
|
const res = await getTwoClass({ oneType: oneTypeId })
|
|
|
|
sonOptions.value = res.data.list
|
|
|
|
}
|
|
|
|
// const getSonList = async()
|
|
|
|
export const useEvent = () => {
|
|
|
|
return {
|
|
|
|
universalRules,
|
|
|
|
showMainEvent,
|
|
|
|
mainEventData,
|
|
|
|
showNewEvent,
|
|
|
|
eventData,
|
|
|
|
targetId,
|
|
|
|
searchTreeList,
|
|
|
|
tableData,
|
|
|
|
range,
|
|
|
|
oneClassData,
|
|
|
|
sonOptions,
|
|
|
|
getTwoClassList,
|
|
|
|
}
|
|
|
|
}
|