12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import { message } from 'ant-design-vue'
- import crossWindowWatcher from '@/common/services/cross-window-watcher'
- import { getUserInfo } from '@/common/store-mixin'
- // import XmSingleDataService from './xm-single-data-service'
- export default function ({ button, eventScript, context: { args, dataList, fieldInfos } }) {
- return new Promise((resolve) => {
- const record = args[0]
- let href = ''
- // 判断当前人是否是起草人
- const curuser = getUserInfo().account
- const author = fieldInfos.find((f) => f.name === 'REGISTER_USER')?.value
- let authoraccount = ''
- const flowstatus = fieldInfos.find((f) => f.name === 'FLOW_STATUS')?.value
- if (author) {
- authoraccount = JSON.parse(author)[0]?.code
- }
- if (authoraccount !== curuser) {
- // 判断是否有查看权限
- if (record.openLink) {
- href = '/sd-webflow/done-pages/' + record.instId
- }
- // window.open(href, '_blank')
- crossWindowWatcher.waitForChanged(href).then((refreshFlag) => {
- if (refreshFlag) {
- this.$refs[this.activeKey][0].refresh(true)
- }
- })
- resolve()
- } else {
- // 所属组织机构没有值时直接打开
- if (flowstatus === 0) {
- href = '/sd-webflow/pages/draft/' + record.instId
- } else {
- href = '/sd-webflow/done-pages/' + record.instId
- }
- // window.open(href, '_blank')
- crossWindowWatcher.waitForChanged(href).then((refreshFlag) => {
- if (refreshFlag) {
- this.$refs[this.activeKey][0].refresh(true)
- }
- })
- resolve()
- }
- })
- }
|