mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-13 03:52:50 +00:00
feat:融合子应用调整
This commit is contained in:
parent
7bae000a28
commit
a603211f1a
130
resources/assets/js/components/MicroApps.vue
Normal file
130
resources/assets/js/components/MicroApps.vue
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page-microapp">
|
||||||
|
<transition name="microapp-load">
|
||||||
|
<div class="microapp-load">
|
||||||
|
<Loading />
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
<micro-app v-if="url && !loading"
|
||||||
|
:name='name'
|
||||||
|
:url='url'
|
||||||
|
inline
|
||||||
|
destroy
|
||||||
|
disableSandbox
|
||||||
|
:data='appData'
|
||||||
|
@created='handleCreate'
|
||||||
|
@beforemount='handleBeforeMount'
|
||||||
|
@mounted='handleMount'
|
||||||
|
@unmount='handleUnmount'
|
||||||
|
@error='handleError'
|
||||||
|
@datachange='handleDataChange'
|
||||||
|
></micro-app>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Vue from 'vue'
|
||||||
|
import store from '../store/index'
|
||||||
|
import { mapState } from "vuex";
|
||||||
|
import { EventCenterForMicroApp } from '@micro-zoe/micro-app'
|
||||||
|
import DialogWrapper from '../pages/manage/components/DialogWrapper.vue'
|
||||||
|
import UserSelect from "./UserSelect.vue";
|
||||||
|
import { languageList, languageType } from "../language";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "MicroApps",
|
||||||
|
props: {
|
||||||
|
name: {
|
||||||
|
type: String,
|
||||||
|
default: "micro-app"
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
type: String,
|
||||||
|
default: ""
|
||||||
|
},
|
||||||
|
path: {
|
||||||
|
type: String,
|
||||||
|
default: ""
|
||||||
|
},
|
||||||
|
data:{
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
appUrl: '',
|
||||||
|
appData: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deactivated() {
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
url(val) {
|
||||||
|
this.loading = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.loading = false;
|
||||||
|
this.appUrl = val
|
||||||
|
})
|
||||||
|
},
|
||||||
|
path(val) {
|
||||||
|
this.appData = { path: val }
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
handler(info) {
|
||||||
|
this.appData = info
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState([
|
||||||
|
'userInfo',
|
||||||
|
'themeMode',
|
||||||
|
])
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleCreate(e) {
|
||||||
|
window.eventCenterForAppNameVite = new EventCenterForMicroApp(this.name)
|
||||||
|
},
|
||||||
|
handleBeforeMount(e) {
|
||||||
|
this.appData = {
|
||||||
|
type: 'init',
|
||||||
|
vues: {
|
||||||
|
Vue,
|
||||||
|
store,
|
||||||
|
components: {
|
||||||
|
DialogWrapper,
|
||||||
|
UserSelect
|
||||||
|
}
|
||||||
|
},
|
||||||
|
theme: this.themeMode,
|
||||||
|
languages: {
|
||||||
|
languageList,
|
||||||
|
languageType,
|
||||||
|
},
|
||||||
|
userInfo: this.userInfo,
|
||||||
|
path: this.path
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleMount(e) {
|
||||||
|
this.appData = this.data;
|
||||||
|
if(this.path){
|
||||||
|
this.appData.path = this.path
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleUnmount(e) {
|
||||||
|
window.dispatchEvent(new Event('apps-unmount'));
|
||||||
|
},
|
||||||
|
handleError(e) {
|
||||||
|
console.error("子应用加载出错了",e.detail.error)
|
||||||
|
},
|
||||||
|
handleDataChange(e) {
|
||||||
|
// console.log('来自子应用 child-vite 的数据:', e.detail.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
8
resources/assets/js/microapp.js
vendored
8
resources/assets/js/microapp.js
vendored
@ -1,11 +1,9 @@
|
|||||||
import microApp from '@micro-zoe/micro-app'
|
import microApp from '@micro-zoe/micro-app'
|
||||||
import DialogWrapper from "./pages/manage/components/DialogWrapper.vue";
|
|
||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
let urls = "";
|
let urls = "";
|
||||||
let route = "/microapp/";
|
let route = "/";
|
||||||
let modules = {};
|
let modules = {};
|
||||||
|
|
||||||
let obj = {
|
let obj = {
|
||||||
loader(code,url) {
|
loader(code,url) {
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
@ -25,11 +23,11 @@ export default function() {
|
|||||||
|
|
||||||
// 微应用名称
|
// 微应用名称
|
||||||
modules["micro-app"] = [obj]
|
modules["micro-app"] = [obj]
|
||||||
|
modules["okr-details"] = [obj]
|
||||||
|
|
||||||
// 微应用
|
// 微应用
|
||||||
microApp.start({
|
microApp.start({
|
||||||
plugins: {
|
plugins: {
|
||||||
global: [DialogWrapper],
|
|
||||||
modules: modules
|
modules: modules
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -302,6 +302,9 @@
|
|||||||
</transition>
|
</transition>
|
||||||
<MobileBack :showTabbar="showMobileTabbar"/>
|
<MobileBack :showTabbar="showMobileTabbar"/>
|
||||||
<MobileNotification ref="mobileNotification"/>
|
<MobileNotification ref="mobileNotification"/>
|
||||||
|
|
||||||
|
<!-- okr明细 -->
|
||||||
|
<MicroApps v-show="false" v-if="$route.name != 'manage-apps'" name="okr-details" :url="okrUrl" :data="okrWindow"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -325,6 +328,7 @@ import TaskExport from "./manage/components/TaskExport";
|
|||||||
import ApproveExport from "./manage/components/ApproveExport";
|
import ApproveExport from "./manage/components/ApproveExport";
|
||||||
import notificationKoro from "notification-koro1";
|
import notificationKoro from "notification-koro1";
|
||||||
import {Store} from "le5le-store";
|
import {Store} from "le5le-store";
|
||||||
|
import MicroApps from "../components/MicroApps.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -342,7 +346,9 @@ export default {
|
|||||||
DrawerOverlay,
|
DrawerOverlay,
|
||||||
ProjectManagement,
|
ProjectManagement,
|
||||||
TeamManagement,
|
TeamManagement,
|
||||||
ProjectArchived},
|
ProjectArchived,
|
||||||
|
MicroApps
|
||||||
|
},
|
||||||
directives: {longpress},
|
directives: {longpress},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -396,6 +402,8 @@ export default {
|
|||||||
operateItem: {},
|
operateItem: {},
|
||||||
|
|
||||||
needStartHome: false,
|
needStartHome: false,
|
||||||
|
|
||||||
|
okrUrl: import.meta.env.VITE_OKR_WEB_URL || "/apps/okr/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -459,6 +467,8 @@ export default {
|
|||||||
|
|
||||||
'reportUnreadNumber',
|
'reportUnreadNumber',
|
||||||
'approveUnreadNumber',
|
'approveUnreadNumber',
|
||||||
|
|
||||||
|
'okrWindow'
|
||||||
]),
|
]),
|
||||||
|
|
||||||
...mapGetters(['dashboardTask']),
|
...mapGetters(['dashboardTask']),
|
||||||
@ -781,12 +791,12 @@ export default {
|
|||||||
return;
|
return;
|
||||||
case 'okrManage':
|
case 'okrManage':
|
||||||
case 'okrAnalyze':
|
case 'okrAnalyze':
|
||||||
let query = { url: import.meta.env.VITE_OKR_WEB_URL || "/apps/okr/" }
|
this.goForward({
|
||||||
if(path=='okrManage'){
|
path:'/manage/apps/' + ( path == 'okrManage' ? '/#/list' : '/#/analysis') ,
|
||||||
this.goForward({ path: '/manage/apps/', query });
|
query: {
|
||||||
}else{
|
baseUrl: this.okrUrl
|
||||||
this.goForward({ path: '/manage/apps/#/analysis', query });
|
}
|
||||||
}
|
});
|
||||||
return;
|
return;
|
||||||
case 'logout':
|
case 'logout':
|
||||||
$A.modalConfirm({
|
$A.modalConfirm({
|
||||||
|
|||||||
@ -1,41 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page-microapp">
|
<MicroApps :url="appUrl" :path="path" v-if="!loading" />
|
||||||
<transition name="microapp-load">
|
|
||||||
<div class="microapp-load">
|
|
||||||
<Loading/>
|
|
||||||
</div>
|
|
||||||
</transition>
|
|
||||||
<micro-app name='micro-app' v-if="appUrl && !loading"
|
|
||||||
:url='appUrl'
|
|
||||||
inline
|
|
||||||
destroy
|
|
||||||
disableSandbox
|
|
||||||
:data='appData'
|
|
||||||
@created='handleCreate'
|
|
||||||
@beforemount='handleBeforeMount'
|
|
||||||
@mounted='handleMount'
|
|
||||||
@unmount='handleUnmount'
|
|
||||||
@error='handleError'
|
|
||||||
@datachange='handleDataChange'
|
|
||||||
></micro-app>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Vue from 'vue'
|
import MicroApps from "../../components/MicroApps.vue";
|
||||||
import store from '../../store/index'
|
|
||||||
import {mapState} from "vuex";
|
|
||||||
import { EventCenterForMicroApp } from '@micro-zoe/micro-app'
|
|
||||||
import DialogWrapper from './components/DialogWrapper'
|
|
||||||
import UserSelect from "../../components/UserSelect.vue";
|
|
||||||
import {languageList, languageType} from "../../language";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: { MicroApps },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
appUrl: '',
|
appUrl: '',
|
||||||
appData: {}
|
path: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -46,66 +22,20 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
'$route': {
|
'$route': {
|
||||||
handler(to) {
|
handler(to) {
|
||||||
if( to.name == 'manage-apps' ){
|
if (to.name == 'manage-apps') {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.$nextTick(()=>{
|
this.$nextTick(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
let url = $A.apiUrl(this.$route.query.url)
|
let url = $A.apiUrl(this.$route.query.baseUrl)
|
||||||
if( url.indexOf('http') == -1 ){
|
if (url.indexOf('http') == -1) {
|
||||||
url = window.location.origin + url
|
url = window.location.origin + url
|
||||||
}
|
}
|
||||||
this.appUrl = url
|
this.appUrl = url
|
||||||
window.eventCenterForAppNameVite = new EventCenterForMicroApp("micro-app")
|
this.path = this.$route.query.path || '';
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
immediate: true,
|
immediate: true
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
|
||||||
...mapState([
|
|
||||||
'userInfo',
|
|
||||||
'themeMode',
|
|
||||||
])
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
handleCreate(e) {
|
|
||||||
// console.log("子应用创建了",e)
|
|
||||||
},
|
|
||||||
handleBeforeMount(e) {
|
|
||||||
this.appData = {
|
|
||||||
type: 'init',
|
|
||||||
vues:{
|
|
||||||
Vue,
|
|
||||||
store,
|
|
||||||
components:{
|
|
||||||
DialogWrapper,
|
|
||||||
UserSelect
|
|
||||||
}
|
|
||||||
},
|
|
||||||
theme: this.themeMode,
|
|
||||||
languages: {
|
|
||||||
languageList,
|
|
||||||
languageType,
|
|
||||||
},
|
|
||||||
userInfo: this.userInfo,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleMount(e) {
|
|
||||||
|
|
||||||
},
|
|
||||||
handleUnmount(e) {
|
|
||||||
this.loading = true;
|
|
||||||
window.dispatchEvent(new Event('apps-unmount'));
|
|
||||||
// console.log("子应用卸载了",e)
|
|
||||||
},
|
|
||||||
handleError(e) {
|
|
||||||
// console.log("子应用加载出错了",e.detail.error)
|
|
||||||
},
|
|
||||||
handleDataChange(e) {
|
|
||||||
// console.log('来自子应用 child-vite 的数据:', e.detail.data)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1801,11 +1801,7 @@ export default {
|
|||||||
if (!this.dialogData.link_id) {
|
if (!this.dialogData.link_id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.taskId > 0) {
|
this.$store.dispatch("openOkr", this.dialogData.link_id);
|
||||||
// 如果当前打开着任务窗口则关闭对话窗口
|
|
||||||
this.$store.dispatch("openDialog", 0);
|
|
||||||
}
|
|
||||||
this.$store.dispatch("openTask", this.dialogData.link_id);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onPrevPage() {
|
onPrevPage() {
|
||||||
@ -2439,6 +2435,9 @@ export default {
|
|||||||
if (target.classList.contains('mention') && target.classList.contains('task')) {
|
if (target.classList.contains('mention') && target.classList.contains('task')) {
|
||||||
this.$store.dispatch("openTask", $A.runNum(target.getAttribute("data-id")));
|
this.$store.dispatch("openTask", $A.runNum(target.getAttribute("data-id")));
|
||||||
}
|
}
|
||||||
|
if (target.classList.contains('mention') && target.classList.contains('okr')) {
|
||||||
|
this.$store.dispatch("openOkr", $A.runNum(target.getAttribute("data-id")));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
21
resources/assets/js/store/actions.js
vendored
21
resources/assets/js/store/actions.js
vendored
@ -3401,7 +3401,6 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/** *****************************************************************************************/
|
/** *****************************************************************************************/
|
||||||
/** *************************************** meeting *********************************************/
|
/** *************************************** meeting *********************************************/
|
||||||
/** *****************************************************************************************/
|
/** *****************************************************************************************/
|
||||||
@ -3432,4 +3431,24 @@ export default {
|
|||||||
meetingid: meetingid
|
meetingid: meetingid
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** *****************************************************************************************/
|
||||||
|
/** *************************************** okr *********************************************/
|
||||||
|
/** *****************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开Okr详情页
|
||||||
|
* @param state
|
||||||
|
* @param dispatch
|
||||||
|
* @param link_id
|
||||||
|
*/
|
||||||
|
openOkr({state, dispatch}, link_id) {
|
||||||
|
if (link_id > 0) {
|
||||||
|
state.okrWindow = {
|
||||||
|
type: 'okrDetails',
|
||||||
|
show: true,
|
||||||
|
id: link_id
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
7
resources/assets/js/store/state.js
vendored
7
resources/assets/js/store/state.js
vendored
@ -200,5 +200,12 @@ export default {
|
|||||||
show: false,
|
show: false,
|
||||||
type: "",
|
type: "",
|
||||||
meetingid: 0
|
meetingid: 0
|
||||||
|
},
|
||||||
|
|
||||||
|
// okr窗口
|
||||||
|
okrWindow: {
|
||||||
|
type: 'okrDetails',
|
||||||
|
id: 0,
|
||||||
|
show: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user