| | |
| | | import {paramLow,callPreEvent,callPostEvent,replaceFreeMarker} from './BaseAction'; |
| | | import {validatenull} from "@/util/validate"; |
| | | import Vue from "vue"; |
| | | import AddEditDialog from "@/components/actions/AddEditDialog"; |
| | | import Layout from "@/router/page"; |
| | | import router from '@/router/router'; |
| | | import ViewDialog from "@/components/actions/ViewDialog"; |
| | | |
| | | export const doAction = (options,callback) => { |
| | | const paramVOS = Object.assign({ |
| | |
| | | */ |
| | | export const doView = (options,callback)=> { |
| | | const paramVOS = options.paramVOS; |
| | | let component = '@/views/base/UIContentViewerInDialog'; |
| | | let component = 'base/UIContentViewerInDialog'; |
| | | if (!validatenull(paramVOS.customurl)) { |
| | | //自定义js |
| | | component = `@/views/custom-ui/` + paramVOS.customurl; |
| | | component = `custom-ui/` + paramVOS.customurl; |
| | | }else{ |
| | | if (!paramVOS['type'] || !paramVOS['context']) { |
| | | Vue.prototype.$message.error("按钮配置不正确"); |
| | | return false; |
| | | } |
| | | } |
| | | let name="查看数据" |
| | | paramVOS.component=component; |
| | | let name="查看详情" |
| | | if(paramVOS.showname){ |
| | | name=replaceFreeMarker(paramVOS.showname,options.dataStore,options.sourceData) |
| | | name="查看【"+replaceFreeMarker(paramVOS.showname,options.dataStore,options.sourceData)+"】" |
| | | } |
| | | router.addRoutes({ |
| | | path: '/view-form'+options.dataStore[0].oid, |
| | | name: name, |
| | | component: Layout, |
| | | meta: { |
| | | keepAlive: true, |
| | | isTab: true |
| | | }, |
| | | children: [ |
| | | { |
| | | path: '', // 空路径表示访问 '/dynamic-form' 时加载 Layout 组件 |
| | | component: () => import(component), |
| | | props: true |
| | | } |
| | | ] |
| | | }) |
| | | paramVOS.title=name; |
| | | const dialogConstructor = Vue.extend(ViewDialog); |
| | | let instance = new dialogConstructor(); |
| | | instance.sourceData = options.sourceData; |
| | | instance.dataStore = options.dataStore; |
| | | instance.paramVOS = paramVOS |
| | | |
| | | instance.dialogClose = function () { |
| | | vm.visible = false; |
| | | document.body.removeChild(vm.$el); |
| | | instance.$destroy(); |
| | | instance = null; |
| | | }; |
| | | if (callback) { |
| | | instance.saveCallback = callback; |
| | | } |
| | | let vm = instance.$mount(); |
| | | document.body.appendChild(vm.$el); |
| | | instance.visible = true; |
| | | } |
| | | /** |
| | | * 前置事件 |