

import { router } from '@/common/router-ready'

export default function({ button, eventScript, context: { args, dataList, fieldInfos } }) {
  return new Promise((resolve) => {
    // 打开新建页面
    const wid = fieldInfos?.find((item) => item.name === 'id').value
    const caseId = fieldInfos?.find((item) => item.name === 'CASE_ID').value
    const instId= fieldInfos?.find((item) => item.name === 'instId').value
    if (wid) {
      const url = '/case-library-form?pageId=onl:a1ec7c3068a3467a817d914237727dd8 &Jid='+wid+'&caseId='+caseId+'&instId='+instId
      const query = {}
      const oRoute = router.resolve({
        path: url,
        query: {
          ...query,
        },
      })
      window.open(oRoute.href, '_blank')
        resolve()
    }
  })
}
