2025-03-11 00:53:58 +00:00
|
|
|
import { getSimpTreeList, getTwoClass } from '@/api/Gantt'
|
|
|
|
|
2025-03-12 01:13:41 +00:00
|
|
|
const subEventRules = {
|
|
|
|
name: { required: true, message: '请输入名称', trigger: ['blur', 'input'] },
|
|
|
|
timeRange: {
|
|
|
|
required: true,
|
|
|
|
message: '请选择时间',
|
|
|
|
trigger: ['blur', 'input'],
|
|
|
|
},
|
|
|
|
twoType: {
|
|
|
|
required: true,
|
|
|
|
message: '请选择二级分类',
|
|
|
|
trigger: ['blur', 'change'],
|
|
|
|
},
|
|
|
|
}
|
|
|
|
const mainEventRules = {
|
|
|
|
name: { required: true, message: '请输入名称', trigger: ['blur', 'input'] },
|
|
|
|
|
|
|
|
timeRange: {
|
|
|
|
required: true,
|
|
|
|
message: '请选择时间',
|
|
|
|
trigger: ['blur', 'input'],
|
|
|
|
},
|
2025-03-11 00:53:58 +00:00
|
|
|
}
|
|
|
|
const showMainEvent = ref(false)
|
|
|
|
|
|
|
|
watch(showMainEvent, show => {
|
|
|
|
if (!show) {
|
|
|
|
resetMainEventData()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
const mainEventData = ref({
|
|
|
|
name: '',
|
2025-03-12 01:13:41 +00:00
|
|
|
timeRange: null,
|
|
|
|
|
2025-03-11 00:53:58 +00:00
|
|
|
// type: 'mainEvent',
|
|
|
|
describe: '',
|
|
|
|
fileUrl: '',
|
|
|
|
})
|
|
|
|
|
|
|
|
function resetMainEventData() {
|
2025-03-12 01:13:41 +00:00
|
|
|
mainEventData.value = {
|
2025-03-11 00:53:58 +00:00
|
|
|
name: '',
|
2025-03-12 01:13:41 +00:00
|
|
|
timeRange: null,
|
|
|
|
|
2025-03-11 00:53:58 +00:00
|
|
|
describe: '',
|
|
|
|
fileUrl: '',
|
2025-03-12 01:13:41 +00:00
|
|
|
}
|
2025-03-11 00:53:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const targetId = ref(null)
|
2025-03-12 01:13:41 +00:00
|
|
|
const range = ref(null)
|
2025-03-11 00:53:58 +00:00
|
|
|
|
|
|
|
const showNewEvent = ref(false)
|
|
|
|
|
|
|
|
watch(showNewEvent, show => {
|
|
|
|
if (!show) {
|
|
|
|
oneClassData.value = null
|
|
|
|
resetEventData()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
const eventData = ref({
|
|
|
|
name: '',
|
2025-03-12 01:13:41 +00:00
|
|
|
timeRange: null,
|
2025-03-11 00:53:58 +00:00
|
|
|
fileUrl: '',
|
|
|
|
describe: '',
|
|
|
|
equipModel: '',
|
|
|
|
reportSite: '',
|
2025-03-12 01:13:41 +00:00
|
|
|
twoType: '',
|
2025-03-11 00:53:58 +00:00
|
|
|
// type: 'subEvent',
|
|
|
|
})
|
|
|
|
|
|
|
|
function resetEventData() {
|
2025-03-12 01:13:41 +00:00
|
|
|
eventData.value = {
|
2025-03-11 00:53:58 +00:00
|
|
|
name: '',
|
2025-03-12 01:13:41 +00:00
|
|
|
timeRange: null,
|
2025-03-11 00:53:58 +00:00
|
|
|
fileUrl: '',
|
|
|
|
describe: '',
|
|
|
|
equipModel: '',
|
|
|
|
reportSite: '',
|
2025-03-12 01:13:41 +00:00
|
|
|
twoType: '',
|
|
|
|
}
|
2025-03-11 00:53:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const tableData = ref([])
|
|
|
|
|
|
|
|
const oneClassData = ref(null)
|
|
|
|
async function searchTreeList() {
|
|
|
|
tableData.value = []
|
|
|
|
|
|
|
|
const res = await getSimpTreeList({
|
|
|
|
targetId: targetId.value,
|
2025-03-12 01:13:41 +00:00
|
|
|
startTime: range.value ? range.value[0] : null,
|
|
|
|
endTime: range.value ? range.value[1] : null,
|
2025-03-11 00:53:58 +00:00
|
|
|
})
|
|
|
|
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 {
|
2025-03-12 01:13:41 +00:00
|
|
|
subEventRules,
|
|
|
|
mainEventRules,
|
2025-03-11 00:53:58 +00:00
|
|
|
showMainEvent,
|
|
|
|
mainEventData,
|
|
|
|
showNewEvent,
|
|
|
|
eventData,
|
|
|
|
targetId,
|
|
|
|
searchTreeList,
|
|
|
|
tableData,
|
|
|
|
range,
|
|
|
|
oneClassData,
|
|
|
|
sonOptions,
|
|
|
|
getTwoClassList,
|
|
|
|
}
|
|
|
|
}
|