|  | @@ -53,7 +53,7 @@ const {currentClickIndex, pageData, clearOnAndFunc, tableBind, handleSavaData} =
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const formRef = useCompRef(ElForm)
 | 
	
		
			
				|  |  |  const bindRef = ref(null)
 | 
	
		
			
				|  |  | -const headerRef = ref(null)
 | 
	
		
			
				|  |  | +const headerRef = ref<HTMLDivElement>()
 | 
	
		
			
				|  |  |  const {height: headerHeight} = useElementSize(headerRef)
 | 
	
		
			
				|  |  |  const emits = defineEmits(['changeTabs'])
 | 
	
		
			
				|  |  |  const userInfo = XEUtils.clone(userInfoStore.value, true)
 | 
	
	
		
			
				|  | @@ -70,15 +70,13 @@ const render = (item: PageHeader) => {
 | 
	
		
			
				|  |  |    if (item.on) {
 | 
	
		
			
				|  |  |      for (const onKey in item.on) {
 | 
	
		
			
				|  |  |        const key = capitalizeFirstLetter(onKey, 'on')
 | 
	
		
			
				|  |  | -      const func = new Function('pageJson', 'currentBind', 'apiFunc', 'val', 'userInfo', item.on[onKey])
 | 
	
		
			
				|  |  | -      tempProps[key] = (...val) => func(pageData.value, item, reportQueryCenterApi, val, userInfo)
 | 
	
		
			
				|  |  | +      tempProps[key] = (...val) => newFunc(item, val, item.on[onKey])
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    if (item.func) {
 | 
	
		
			
				|  |  |      for (let funcKey in item.func) {
 | 
	
		
			
				|  |  | -      const func = new Function('pageJson', 'currentBind', 'apiFunc', 'val', 'userInfo', item.func[funcKey])
 | 
	
		
			
				|  |  | -      tempProps[funcKey] = (...val) => func(pageData.value, item, reportQueryCenterApi, val, userInfo)
 | 
	
		
			
				|  |  | +      tempProps[funcKey] = (...val) => newFunc(item, val, item.func[funcKey])
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -139,7 +137,7 @@ async function queryClick() {
 | 
	
		
			
				|  |  |    const tempData = {
 | 
	
		
			
				|  |  |      ...pageData.value.params
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | -  await formRef.value.validate()
 | 
	
		
			
				|  |  | +  await formRef.value!.validate()
 | 
	
		
			
				|  |  |    loading.value = true
 | 
	
		
			
				|  |  |    await reportQueryCenterApi(pageData.value.submitUrl, tempData)
 | 
	
		
			
				|  |  |        .then(res => {
 | 
	
	
		
			
				|  | @@ -175,7 +173,7 @@ const columns = ref([])
 | 
	
		
			
				|  |  |  const loading = ref(false)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  function requiredInit(setDefaultValue = false) {
 | 
	
		
			
				|  |  | -  formRef.value.resetFields()
 | 
	
		
			
				|  |  | +  formRef.value!.resetFields()
 | 
	
		
			
				|  |  |    rules.value = []
 | 
	
		
			
				|  |  |    pageData.value.header.forEach(item => {
 | 
	
		
			
				|  |  |      if (setDefaultValue) {
 | 
	
	
		
			
				|  | @@ -187,27 +185,27 @@ function requiredInit(setDefaultValue = false) {
 | 
	
		
			
				|  |  |    })
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -function handleOnAndFuncEvent(data: PageJsonObject) {
 | 
	
		
			
				|  |  | -  XEUtils.arrayEach(data.header, (item: PageHeader) => {
 | 
	
		
			
				|  |  | -    if (item.on) {
 | 
	
		
			
				|  |  | -      for (let onKey in item.on) {
 | 
	
		
			
				|  |  | -        const func = new Function('pageJson', 'currentBind', 'apiFunc', 'val', 'userInfo', item.on[onKey])
 | 
	
		
			
				|  |  | -        if (onKey === 'mounted') {
 | 
	
		
			
				|  |  | -          func(data, item, reportQueryCenterApi, '', userInfo)
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +async function handleOnAndFuncEvent(data: PageJsonObject) {
 | 
	
		
			
				|  |  | +  for (let i = 0; i < data.header.length; i++) {
 | 
	
		
			
				|  |  | +    const item = data.header[i]
 | 
	
		
			
				|  |  | +    if (item.on && item.on.mounted) {
 | 
	
		
			
				|  |  | +      try {
 | 
	
		
			
				|  |  | +        await newFunc(item, '', item.on.mounted)
 | 
	
		
			
				|  |  | +      } catch (e) {
 | 
	
		
			
				|  |  | +        console.error("执行初始化函数错误", e)
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -  })
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  async function refresh() {
 | 
	
		
			
				|  |  |    clearOnAndFunc();
 | 
	
		
			
				|  |  | -  setPageData(pageData.value, currentClickIndex.value)
 | 
	
		
			
				|  |  | +  await setPageData(pageData.value, currentClickIndex.value)
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -function setPageData(data: PageJsonObject, currentIndex = -1) {
 | 
	
		
			
				|  |  | +async function setPageData(data: PageJsonObject, currentIndex = -1) {
 | 
	
		
			
				|  |  |    const temp = XEUtils.clone(data, true);
 | 
	
		
			
				|  |  | -  handleOnAndFuncEvent(temp)
 | 
	
		
			
				|  |  | +  await handleOnAndFuncEvent(temp)
 | 
	
		
			
				|  |  |    pageData.value = temp
 | 
	
		
			
				|  |  |    if (currentIndex > 0) {
 | 
	
		
			
				|  |  |      bindRef.value?.changeCurrentBind(pageData.value.header[currentClickIndex.value])
 | 
	
	
		
			
				|  | @@ -230,9 +228,25 @@ function getBindDefaultValue(name: string) {
 | 
	
		
			
				|  |  |    return res
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -function addComponent(data) {
 | 
	
		
			
				|  |  | +function newFunc(currentBind, value, funcStr) {
 | 
	
		
			
				|  |  | +  const func = new Function('pageJson', 'currentBind', 'apiFunc', 'val', 'userInfo', funcStr)
 | 
	
		
			
				|  |  | +  try {
 | 
	
		
			
				|  |  | +    return func(pageData.value, currentBind, reportQueryCenterApi, value, userInfo)
 | 
	
		
			
				|  |  | +  } catch (e) {
 | 
	
		
			
				|  |  | +    console.error('脚本错误', e)
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +async function addComponent(data) {
 | 
	
		
			
				|  |  |    const temp = XEUtils.clone(data, true)
 | 
	
		
			
				|  |  |    Object.assign(temp.bind, getBindDefaultValue(data.name))
 | 
	
		
			
				|  |  | +  if (temp.on && temp.on.mounted) {
 | 
	
		
			
				|  |  | +    try {
 | 
	
		
			
				|  |  | +      await newFunc(temp, '', temp.on.mounted)
 | 
	
		
			
				|  |  | +    } catch (e) {
 | 
	
		
			
				|  |  | +      console.error("执行初始化函数错误", e)
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |    pageData.value.header.push(temp)
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -252,7 +266,7 @@ async function addComponentRefresh() {
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  async function testClick() {
 | 
	
		
			
				|  |  | -  await formRef.value.validate()
 | 
	
		
			
				|  |  | +  await formRef.value!.validate()
 | 
	
		
			
				|  |  |    const data = {}
 | 
	
		
			
				|  |  |    pageData.value.header.forEach(item => {
 | 
	
		
			
				|  |  |      data[item.key] = pageData.value.params[item.key]
 | 
	
	
		
			
				|  | @@ -317,7 +331,7 @@ function setTableData(res) {
 | 
	
		
			
				|  |  |  function exportExcel(data: {
 | 
	
		
			
				|  |  |    data: any[],
 | 
	
		
			
				|  |  |    columns: Columns[],
 | 
	
		
			
				|  |  | -  fileName: string
 | 
	
		
			
				|  |  | +  fileName?: string
 | 
	
		
			
				|  |  |  }) {
 | 
	
		
			
				|  |  |    if (data.data.length === 0) {
 | 
	
		
			
				|  |  |      xcMessage.warning("没有可以导出的数据。")
 |