提交 c235e785 编写于 作者: Mosher's avatar Mosher

update:新增登录界面,调整树导航,忽略png

上级 8be0ecd3
**.ibizlab-generator-ignore
**.DS_Store
**@macro/**
\ No newline at end of file
**@macro/**
**.png
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1616652640756" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="651" width="48" height="48" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path d="M512 2C230.2 2 2 230.2 2 512s228.2 510 510 510 510-228.2 510-510S793.3 2 512 2z m235.9 442c-1 4.6-3.6 10.8-7.2 19.1l-0.5 0.5c-21.6 45.8-77.3 135.5-77.3 135.5l-0.5-0.5-16.5 28.3h78.8L574.3 826.8l34-136h-61.8l21.6-90.2c-17.5 4.1-38.1 9.8-62.3 18 0 0-33 19.1-94.8-37.1 0 0-41.7-37.1-17.5-45.8 10.3-4.1 50-8.8 81.4-12.9 42.2-5.7 68.5-8.8 68.5-8.8s-130.3 2.1-161.2-3.1c-30.9-4.6-70.1-56.7-78.3-102 0 0-12.9-24.7 27.8-12.9 40.2 11.8 209.2 45.8 209.2 45.8S321.4 375 307 358.5c-14.4-16.5-42.8-89.6-39.2-134.5 0 0 1.5-11.3 12.9-8.2 0 0 161.8 74.2 272.5 114.4C664.5 371.4 760.8 392 747.9 444z" fill="#3296FA" p-id="652"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1616652700601" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="973" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48"><defs><style type="text/css"></style></defs><path d="M512 2c281.7 0 510 228.3 510 510s-228.3 510-510 510S2 793.7 2 512 230.3 2 512 2z m159.8 680.3c-4 3.9-4 10.2-0.2 14.1 0.4 0.5 0.9 0.9 1.5 1.2 22.1 20.4 36.4 47.9 40.4 77.7 6.2 22.4 29.7 35.7 52.4 29.5 22.5-5.9 35.9-28.9 30-51.3 0-0.1-0.1-0.2-0.1-0.4-4.7-16.8-19.3-29.1-36.7-30.8-28-5.1-53.5-19.2-72.8-40.1-4.1-3.8-10.5-3.8-14.5 0.1z m-225.7-483c-76.4 8.3-145.8 40.6-195.6 91-19.4 19.4-35.5 41.8-47.8 66.3-37.7 74.9-31.4 164.4 16.5 233.2 13.5 20.2 35.8 45.4 56.1 63.3l-9.2 71.3-1 3c-0.3 0.9-0.3 1.9-0.4 2.8l-0.2 2.3 0.2 2.3c1.2 12.7 12.5 22 25.2 20.9 3.5-0.3 6.8-1.4 9.8-3.1h0.4l1.4-1 22-10.8 65.5-32.5c31.1 8.8 63.4 13.2 95.8 13 40 0.1 79.8-6.7 117.5-20.2-18.8-6-30.9-24.3-29-44-39 12.4-80.2 16.4-120.8 11.9l-6.5-0.9c-14.7-1.9-29.2-4.9-43.4-8.9-7.8-2.4-16.1-1.5-23.3 2.4l-1.8 0.9-53.9 31.3-2.3 1.4c-1.3 0.7-1.9 1-2.6 1-2-0.1-3.5-1.8-3.4-3.8l2-8.2 2.4-8.9 3.9-14.7 4.5-16.4c3-9.2-0.3-19.2-8.2-24.8-21.1-15.5-39.5-34.4-54.4-56-37.9-54.2-43-124.8-13.3-183.8 9.9-19.5 22.9-37.4 38.4-52.9 40.9-41.6 98.3-68.1 161.9-74.9 22-2.4 44.2-2.4 66.2 0 63.2 7.2 120.4 34 161.1 75.4 15.4 15.7 28.2 33.6 37.9 53.2 12.5 24.8 19 52.3 19.1 80.1 0 2.9-0.3 5.8-0.4 8.6 16.8-10.2 38.4-7.7 52.4 6.1l1.9 2.3c3.3-41.2-4.8-82.5-23.3-119.5-12.1-24.5-28.1-46.8-47.3-66.3-52.5-52-121.4-84.3-194.9-91.7-26.4-3.4-52.9-3.5-79.1-0.7z m418.2 405.4c-7.2 1.9-13.8 5.7-19.2 11h-0.1c-6.9 6.8-11.2 15.7-12.2 25.3-5.2 27.8-19.5 53.1-40.5 72-4 3.8-4.1 10.1-0.3 14.1l0.1 0.1c4 4 10.5 4.1 14.6 0.1 0.5-0.5 0.9-0.9 1.2-1.5 20.9-21.9 48.7-36 78.7-39.8 22.8-6.1 36.2-29.2 30.1-51.6-6.2-22.5-29.6-35.8-52.4-29.7z m-160.4-42l-0.7 0.7c-20.9 22.7-49.2 37.3-79.9 41.2-22.6 5.9-36.2 28.7-30.2 51.1 1.9 7.3 5.9 14 11.3 19.3 16.7 16.4 43.7 16.4 60.4-0.1 6.8-6.8 11.1-15.7 12.2-25.2 5.3-27.8 19.6-53.1 40.7-72 4.1-3.7 4.5-10 0.9-14.1l-0.1-0.1c-4-4.2-10.4-4.5-14.6-0.8z m39.6-76.6c-7.1 1.9-13.6 5.7-18.7 10.8-16.4 16.2-16.6 42.6-0.4 59l0.5 0.5c6.9 6.8 15.9 11 25.5 12.1 28 5.1 53.6 19.1 72.9 39.9 4 4 10.4 4 14.4 0.1 4-3.8 4.1-10.1 0.3-14.1-0.5-0.5-1.1-1-1.7-1.4-22.1-20.4-36.4-47.8-40.4-77.6-6.1-22.4-29.6-35.5-52.4-29.3z" fill="#0082EF" p-id="974"></path></svg>
\ No newline at end of file
<template>
<div class="login">
<img src="@/assets/img/background.png" />
<div class="login-con" v-if="!isEmbedThridPlatForm">
<card :bordered="false">
<p slot="title" style="text-align: center">&nbsp;&nbsp;{{ appTitle }}</p>
<div class="form-con">
<a-form ref="loginForm" :rules="rules" :model="loginState">
<a-form-item name="loginname">
<a-input
size="large"
v-model:value="loginState.loginname"
placeholder="请输入用户名"
@pressEnter="handleSubmit">
<template #prefix>
<user-outlined />
</template>
</a-input>
</a-form-item>
<a-form-item name="password">
<a-input-password
size="large"
v-model:value="loginState.password"
type="password"
placeholder="请输入密码"
@pressEnter="handleSubmit">
<template #prefix>
<lock-outlined />
</template>
</a-input-password>
</a-form-item>
<a-form-item>
<a-button @click="handleSubmit" type="primary" class="login_btn">
登录
</a-button>
<a-button @click="goReset" type="success" class="login_reset">
重置
</a-button>
</a-form-item>
<a-form-item>
<div style="text-align: center">
<span class="form_tipinfo">其他登录方式</span>
</div>
<div style="text-align: center">
<div class="sign-btn" @click="handleThridLogin('DINGDING')">
<img src="@/assets/img/dingding.svg" class="third-svg-container" draggable="false" />
</div>
<div class="sign-btn" @click="handleThridLogin('WXWORK')">
<img src="@/assets/img/qiyeweixin.svg" class="third-svg-container" draggable="false" />
</div>
</div>
</a-form-item>
</a-form>
<p class="login-tip">
{{ this.loginTip }}
</p>
</div>
</card>
<div class="log_footer">
<div class="copyright">
<a href="https://www.ibizlab.cn/" target="_blank">{{ appTitle }} is based on ibizlab .</a>
</div>
</div>
</div>
<div class="login-loadding-container" v-if="isEmbedThridPlatForm">
<div class="content-loadding">
<span>第三方登录跳转中</span>
<div class="loading">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { Ref, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { clearCookie, setCookie } from 'qx-util';
import { Environment } from '@/environments/environment';
import { Http } from '@core';
/**
* 表单对象
*
* @type {*}
* @memberof Login
*/
const loginState = reactive<LoginState>({
loginname: '',
password: ''
});
/**
* 登录提示语
*
* @type {string}
* @memberof Login
*/
const loginTip: Ref<string> = ref('');
/**
* 运行平台
*
* @type {*}
* @memberof Login
*/
const platform: Ref<any> = ref({});
/**
* 是否嵌入第三方平台
*
* @type {boolean}
* @memberof Login
*/
const isEmbedThridPlatForm: Ref<boolean> = ref(false);
/**
* 按钮可点击
*
* @type {boolean}
* @memberof Login
*/
const canClick: Ref<boolean> = ref(true);
/**
* 应用名称
*
* @type {string}
* @memberof Login
*/
const appTitle: string = Environment.AppTitle;
interface LoginState {
loginname: string,
password: ''
}
/**
* 值规则
*
* @type {*}
* @memberof Login
*/
const rules: Ref<any> = ref({});
const loginForm: Ref<any> = ref(null);
const setRules = () => {
rules.value = {
loginname: [{ required: true, message: '用户名不能为空', trigger: 'change' }],
password: [{ required: true, message: '密码不能为空', trigger: 'change' }],
};
};
const afterCreated = () => {
setRules();
platform.value = window.navigator.userAgent.toUpperCase();
if (platform.value.indexOf('DINGTALK') !== -1) {
// this.DingDingLogin();
isEmbedThridPlatForm.value = true;
} else if (platform.value.indexOf('WXWORK') !== -1) {
// this.WXWorkLogin();
isEmbedThridPlatForm.value = true;
}
};
onMounted(() => {
setTimeout(() => {
const el = document.getElementById('app-loading-x');
if (el) {
el.style.display = 'none';
}
}, 300);
});
const goReset = () => {
loginForm.value = { loginname: '', password: '' };
};
const handleSubmit = (): void => {
// clearAppData();
const _form = unref(loginForm);
let validatestate: boolean = true;
_form.validate((valid: boolean) => {
validatestate = valid ? true : false;
});
if (!validatestate) {
return;
}
const loginname: string = loginState.loginname;
console.log("登录用户名", loginState)
// TODO 使用AppAuthService
Http.getInstance()
.post('/v7/login', loginState, true)
.then((post: any) => {
const { status, data } = post;
if (status == 200) {
if (data && data.token) {
setCookie('ibzuaa-token', data.token, 7, true);
}
if (data && data.user) {
setCookie('ibzuaa-user', JSON.stringify(data.user), 7, true);
}
// 设置cookie,保存账号密码7天
setCookie('loginname', loginname, 7, true);
// TODO 从路由中获取
const route = useRoute();
const url: any = route.query?.redirecrt ? route.query.redirecrt : '*';
const router = useRouter();
router.push({ path: url });
}
})
.catch((error: any) => {
console.log('登录失败', error);
const data = error.data;
if (data && data.message) {
loginTip.value = data.message;
// this.$throw((this.$t('components.login.loginfailed') as string) + ' ' + data.message,'handleSubmit');
} else {
// this.$throw(this.$t('components.login.loginfailed') as string,'handleSubmit');
}
});
};
const clearAppData = () => {
// 清除user、token
clearCookie('ibzuaa-token', true);
clearCookie('ibzuaa-expired', true);
clearCookie('ibzuaa-user', true);
// 清除应用级数据
localStorage.removeItem('localdata');
// this.$store.commit('addAppData', {});
// this.$store.dispatch('authresource/commitAuthData', {});
// 清除租户相关信息
// removeSessionStorage("activeOrgData");
// removeSessionStorage("srfdynaorgid");
// removeSessionStorage("dcsystem");
// removeSessionStorage("orgsData");
};
/**
* 第三方登录(网页扫码方式)
*
* @memberof Login
*/
const handleThridLogin = (type: string) => {
if (!type) return;
switch (type) {
case 'DINGDING':
dingtalkHandleClick();
break;
case 'WXWORK':
wxWorkHandleClick();
break;
default:
// LogUtil.log(`暂不支持${type}登录`);
break;
}
};
/**
* 钉钉授权登录
*
* @memberof Login
*/
const dingtalkHandleClick = async () => {
// let result: any = await this.appThirdService.dingtalkLogin(Environment);
// if (result?.state && Object.is(result?.state, 'SUCCESS')) {
// const data = result.data;
// // 截取地址,拼接需要部分组成新地址
// const baseUrl = this.getNeedLocation();
// // 1.钉钉开放平台提供的appId
// const appId = data.appid;
// // 2.钉钉扫码后回调地址,需要UrlEncode转码
// const redirect_uri = baseUrl + 'assets/third/dingdingRedirect.html?id=' + data.appid;
// const redirect_uri_encode = encodeURIComponent(redirect_uri);
// // 3.钉钉扫码url
// const url =
// 'https://oapi.dingtalk.com/connect/qrconnect?response_type=code' +
// '&appid=' +
// appId +
// '&redirect_uri=' +
// redirect_uri_encode +
// '&scope=snsapi_login' +
// '&state=STATE';
// // 4.跳转钉钉扫码
// window.location.href = url;
// } else {
// this.$throw(result?.message,'dingtalkHandleClick');
// }
};
/**
* 企业微信授权登录
*
* @memberof Login
*/
const wxWorkHandleClick = async () => {
// let result: any = await this.appThirdService.wxWorkLogin(Environment);
// if (result?.state && Object.is(result?.state, 'SUCCESS')) {
// const data = result.data;
// // 截取地址,拼接需要部分组成新地址
// const baseUrl = this.getNeedLocation();
// // 1.钉钉开放平台提供的appId
// const appId = data.corp_id;
// const agentId = data.agentid;
// // 2.钉钉扫码后回调地址,需要UrlEncode转码
// const redirect_uri = baseUrl + 'assets/third/wxWorkRedirect.html?id=' + data.appid;
// const redirect_uri_encode = encodeURIComponent(redirect_uri);
// // 3.钉钉扫码url
// const url =
// 'https://open.work.weixin.qq.com/wwopen/sso/qrConnect?state=STATE' +
// '&appid=' +
// appId +
// '&agentid=' +
// agentId +
// '&redirect_uri=' +
// redirect_uri_encode;
// // 4.跳转钉钉扫码
// window.location.href = url;
// } else {
// // this.$throw(result?.message,'wxWorkHandleClick');
// }
};
/**
* 钉钉免登
*
* @memberof Login
*/
const DingDingLogin = async () => {
// let result: any = await this.appThirdService.embedDingTalkLogin(Environment);
// if (result?.state && Object.is(result?.state, 'SUCCESS')) {
// if (result.data.token && result.data.user) {
// setCookie('ibzuaa-token', result.data.token, 7,true);
// if (this.$route.query.redirect) {
// window.location.href = decodeURIComponent(this.$route.query.redirect as any);
// } else {
// this.$router.push({ path: '/' });
// }
// }
// } else {
// this.$throw(result?.message,'DingDingLogin');
// }
};
const WXWorkLogin = async () => {
// let result: any = await this.appThirdService.embedwxWorkLogin(Environment);
// if (result?.state && Object.is(result?.state, 'SUCCESS')) {
// // 截取地址,拼接需要部分组成新地址
// const baseUrl = this.getNeedLocation();
// // 1.企业微信提供的corp_id
// const appId = result.data.corp_id;
// // 2.认证成功后回调地址,需要UrlEncode转码
// const redirect_uri = baseUrl + 'assets/third/wxWorkRedirect.html?id=' + result.data.appid;
// const redirect_uri_encode = encodeURIComponent(redirect_uri);
// // 3.微信认证url
// const url =
// 'https://open.weixin.qq.com/connect/oauth2/authorize?response_type=code&scope=snsapi_base&#wechat_redirect' +
// '&appid=' +
// appId +
// '&redirect_uri=' +
// redirect_uri_encode +
// '&scope=snsapi_base' +
// '&state=STATE';
// // 4.跳转到微信认证地址
// window.location.href = url;
// } else {
// this.$throw(result?.message,'WXWorkLogin');
// }
};
const getNeedLocation = () => {
// 截取地址,拼接需要部分组成新地址
const scheme = window.location.protocol;
const host = window.location.host;
let baseUrl: any = scheme + '//' + host;
const port = window.location.port;
if (port) {
if (port == '80' || port == '443') {
baseUrl += '/';
} else {
baseUrl += ':' + port + '/';
}
} else {
baseUrl += '/';
}
return baseUrl;
};
</script>
<style lang='scss'>
.login {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
min-height: 100%;
background: #108cee;
> img {
width: 100vw;
height: 100vh;
}
&-con {
position: absolute;
left: 0;
right: 0;
top: 20%;
margin: auto;
width: 450px;
.ivu-card-head {
padding: 30px 0px 20px 0px;
border-bottom: 0px;
> p {
height: 30px;
line-height: 30px;
font-size: 20px;
color: #666666;
font-weight: 600;
}
}
&-header {
font-size: 16px;
font-weight: 300;
text-align: center;
padding: 30px 0;
}
.form-con {
padding: 0px 20px 0px 20px;
> i-button {
width: 170px;
height: 40px;
}
}
.login-tip {
font-size: 10px;
text-align: center;
color: red;
height: 30px;
}
}
&-loadding-container {
position: absolute;
left: 0;
right: 0;
top: 70%;
margin: auto;
width: 450px;
}
}
.login_btn {
width: 175px;
height: 40px;
font-size: 18px;
font-family: MicrosoftYaHei;
}
.login_reset {
width: 175px;
height: 40px;
font-size: 18px;
font-family: MicrosoftYaHei;
float: right;
}
.form_tipinfo {
font-family: MicrosoftYaHei-Bold;
font-size: 14px;
font-weight: bold;
font-stretch: normal;
line-height: 24px;
letter-spacing: 0px;
color: #666666;
}
.form_tipinfo_more {
font-family: MicrosoftYaHei;
font-size: 14px;
font-weight: normal;
letter-spacing: 0px;
color: #666666;
}
.log_footer {
display: block;
padding: 0 16px;
margin: 48px 0 24px;
text-align: center;
color: #212529;
}
.log_footer a {
color: white;
text-decoration: none;
}
.sign-btn {
display: inline-block;
cursor: pointer;
margin-left: 10px;
}
.third-svg-container {
display: inline-block;
width: 40px;
height: 40px;
line-height: 40px;
text-align: center;
padding-top: 1px;
border-radius: 4px;
margin-bottom: -20px;
margin-top: 10px;
}
.content-loadding {
display: flex;
> span {
font-size: 24px;
color: #fff;
}
}
.loading {
width: 150px;
height: 15px;
margin: 0 auto;
margin-top: 12px;
padding-left: 12px;
> span {
display: inline-block;
width: 15px;
height: 100%;
margin-right: 5px;
border-radius: 50%;
background: #fff;
-webkit-animation: load 1.04s ease infinite;
}
> span:last-child {
margin-right: 0px;
}
> span:nth-child(1) {
-webkit-animation-delay: 0.13s;
}
> span:nth-child(2) {
-webkit-animation-delay: 0.26s;
}
> span:nth-child(3) {
-webkit-animation-delay: 0.39s;
}
> span:nth-child(4) {
-webkit-animation-delay: 0.52s;
}
> span:nth-child(5) {
-webkit-animation-delay: 0.65s;
}
}
@-webkit-keyframes load {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
</style>
\ No newline at end of file
import { IActionParam, MainControl } from "@core";
import { IActionParam, IParam, MainControl } from "@core";
import { ExpBarControlProps } from "./exp-bar-control-prop";
import { ExpBarControlState } from "./exp-bar-control-state";
......@@ -16,6 +16,40 @@ export class ExpBarControl extends MainControl {
*/
public declare state: ExpBarControlState;
/**
* 当前视图表格部件
*
* @type {IParam}
* @memberof GridView
*/
public declare xData: IParam;
/**
* 通知状态
*
* @param { tag: string, action: string, data: any } { tag, action, data }
* @memberof ViewEngine
*/
public next({ tag, action, data }: { tag: string, action: string, data: any }): void {
const { viewSubject } = this.props;
viewSubject.next({ tag: tag, action: action, data: data })
}
/**
* @description 导航部件初始化
* @protected
* @memberof ExpBarControl
*/
protected useExpCtrlInit() {
this.xData = ref(null);
onMounted(() => {
const xDataControl = this.getXDataCtrl();
if (xDataControl) {
this.next({ tag: xDataControl.name, action: 'load', data: null });
}
})
}
/**
* @description 处理部件事件
* @param {IActionParam} actionParam
......@@ -31,10 +65,19 @@ export class ExpBarControl extends MainControl {
}
}
protected onSelectionChange(data: any[]) {
console.log("处理选中事件", data);
}
/**
* @description 处理选中事件
* @protected
* @param {any[]} data
* @memberof ExpBarControl
*/
protected onSelectionChange(data: any[]) { }
/**
* @description 计算工具栏权限
* @param {boolean} state
* @memberof ExpBarControl
*/
public calcToolbarItemState(state: boolean) {
// TODO 计算工具栏权限
// let _this: any = this;
......@@ -57,6 +100,10 @@ export class ExpBarControl extends MainControl {
// }
}
/**
* @description 计算导航栏工具栏权限
* @memberof ExpBarControl
*/
public calcNavigationToolbarState() {
let _this: any = this;
if (_this.toolbarModels) {
......@@ -64,6 +111,16 @@ export class ExpBarControl extends MainControl {
}
}
/**
* @description 获取多数据部件
* @private
* @return {*}
* @memberof ExpBarControl
*/
private getXDataCtrl() {
return unref(this.xData);
}
/**
* @description 安装部件所有功能模块的方法
* @return {*}
......@@ -71,8 +128,10 @@ export class ExpBarControl extends MainControl {
*/
public moduleInstall() {
const superParams = super.moduleInstall();
this.useExpCtrlInit();
return {
...superParams,
xData: this.xData,
onCtrlEvent: this.onCtrlEvent.bind(this)
};
}
......
import { MainControlState } from "@core";
import { MDControlState } from "@core";
/**
* @description 树部件通讯对象
......@@ -6,6 +6,6 @@ import { MainControlState } from "@core";
* @interface TreeControlState
* @extends {MainControlState}
*/
export interface TreeControlState extends MainControlState {
export interface TreeControlState extends MDControlState {
}
\ No newline at end of file
import { deepCopy, deepObjectMerge, IActionParam, MainControl } from "@core";
import { deepCopy, deepObjectMerge, IActionParam, MDControl } from "@core";
import { TreeControlProps } from "./tree-control-prop";
import { TreeControlState } from "./tree-control-state";
......@@ -8,7 +8,7 @@ import { TreeControlState } from "./tree-control-state";
* @class TreeControl
* @extends {MainControl}
*/
export class TreeControl extends MainControl {
export class TreeControl extends MDControl {
/**
* @description 部件状态
* @type {TreeControlState}
......@@ -68,6 +68,16 @@ export class TreeControl extends MainControl {
return tempContext;
}
/**
* @description 加载数据
* @protected
* @param {*} node 树节点
* @param {boolean} [isFirst]
* @return {*} {Promise<any>}
* @memberof TreeControl
*/
protected async load(node: any, isFirst?: boolean): Promise<any> {}
/**
* @description 使用加载功能模块
* @return {*}
......@@ -75,7 +85,7 @@ export class TreeControl extends MainControl {
*/
public useLoad() {
const { viewSubject, controlName } = this.state;
const load = async (node: any, isFirst: boolean = false) => {
const load = async (node?: any, isFirst: boolean = false): Promise<any> => {
if (node?.dataRef?.children) {
return null;
}
......@@ -86,7 +96,7 @@ export class TreeControl extends MainControl {
let curNode: any = {};
curNode = deepObjectMerge(curNode, node);
const params: any = {
srfnodeid: node.dataRef && node.dataRef.id ? node.dataRef.id : '#',
srfnodeid: node?.dataRef && node.dataRef.id ? node.dataRef.id : '#',
srfnodefilter: srfnodefilter,
parentData: curNode.dataRef?.curData
}
......@@ -113,7 +123,7 @@ export class TreeControl extends MainControl {
// TODO 展开
// this.formatExpanded(items);
// this.formatAppendCaption(items);
const isRoot = Object.is(node.level, 0);
const isRoot = Object.is(node?.level, 0);
if (isFirst) {
data.splice(0, data.length);
items.forEach((item: any) => {
......@@ -122,7 +132,7 @@ export class TreeControl extends MainControl {
} else {
node.dataRef.children = items;
}
const isSelectedAll = node.checked;
const isSelectedAll = node?.checked;
// TODO 默认选中
// this.setDefaultSelection(items, isRoot, isSelectedAll);
this.emit("ctrlEvent", { tag: this.props.name, action: "load", data: items });
......@@ -130,10 +140,17 @@ export class TreeControl extends MainControl {
console.error(error);
}
}
// 在类里绑定能力方法
this.load = load;
// 订阅viewSubject,监听load行为
if (viewSubject) {
let subscription = viewSubject.subscribe(({ tag, action, data }: IActionParam) => {
if (Object.is(controlName, tag) && Object.is("load", action)) {
if (!Object.is(controlName, tag)) {
return;
}
if (Object.is("load", action)) {
load(data, true);
}
})
......
......@@ -15,6 +15,13 @@ export class TreeExpBarControl extends ExpBarControl {
*/
public declare state: TreeExpBarControlState;
/**
* @description 选中数据变化
* @protected
* @param {any[]} args
* @return {*}
* @memberof TreeExpBarControl
*/
protected onSelectionChange(args: any[]) {
if (args.length == 0) {
this.calcToolbarItemState(true);
......@@ -26,7 +33,7 @@ export class TreeExpBarControl extends ExpBarControl {
return;
}
const nodeType = arg.id.split(';')[0];
// const refView: any = this.get
// 获取导航视图
const refView = this.getExpItemView({ nodeType: nodeType });
// TODO 选择视图面板支持
if (refView) {
......@@ -45,6 +52,13 @@ export class TreeExpBarControl extends ExpBarControl {
}
}
/**
* @description 获取导航视图
* @protected
* @param {*} [arg={}]
* @return {*} {(IParam | null)}
* @memberof TreeExpBarControl
*/
protected getExpItemView(arg: any = {}): IParam | null {
const expMode: string = `EXPITEM:${arg.nodeType}`;
const { viewRefs } = this.state;
......@@ -56,6 +70,13 @@ export class TreeExpBarControl extends ExpBarControl {
}
}
/**
* @description 计算导航参数
* @protected
* @param {*} arg
* @return {*} \{{ tempContext: any, tempViewParams: any }}
* @memberof TreeExpBarControl
*/
protected computeNavParams(arg: any): { tempContext: any, tempViewParams: any } {
const tempContext: any = {};
const tempViewParams: any = {};
......
......@@ -37,6 +37,11 @@ const routes = [
path: "/",
redirect: "/apps/{{lowerCase app.codeName}}"
},
{
path: '/login',
name: 'login',
component: () => import("@components/common/login.vue")
}
]
const router = createRouter({
history: createWebHashHistory(),
......
......@@ -7,11 +7,11 @@ import { ctrlState } from './{{spinalCase ctrl.codeName}}-tree-exp-bar-state';
import { {{codeName}}Tree} from '@widgets/{{spinalCase appEntity.codeName}}/{{spinalCase codeName}}-tree';
{{/eq}}
{{/ctrl.ctrls}}
{{!-- {{#each ctrl.getAppViewRefs as | viewRef |}}
{{#each ctrl.getAppViewRefs as | viewRef |}}
{{#if viewRef.refPSAppView}}
import {{viewRef.refPSAppView.name}} from '@views/{{spinalCase viewRef.refPSAppView.psAppModule.codeName}}/{{spinalCase viewRef.refPSAppView.codeName}}';
{{/if}}
{{/each}} --}}
{{/each}}
interface Props {
context: IContext;
......@@ -35,7 +35,7 @@ interface CtrlEmit {
const emit = defineEmits <CtrlEmit> ();
// 安装功能模块,提供状态和能力方法
const { state, onCtrlEvent } = new TreeExpBarControl(ctrlState, props, emit).moduleInstall();
const { state, onCtrlEvent, xData } = new TreeExpBarControl(ctrlState, props, emit).moduleInstall();
// 暴露内部状态及能力
defineExpose({ state, name: '{{ctrl.name}}' });
......@@ -49,6 +49,7 @@ defineExpose({ state, name: '{{ctrl.name}}' });
{{#ctrl.ctrls}}
{{#eq controlType "TREEVIEW"}}
<{{codeName}}Tree
ref="xData"
:context="state.context"
:viewParams="state.viewParams"
:viewSubject="state.viewSubject"
......@@ -59,7 +60,7 @@ defineExpose({ state, name: '{{ctrl.name}}' });
{{/ctrl.ctrls}}
</a-layout-sider>
<a-layout>
{{!-- {{#each ctrl.psAppViewRefs as | viewRef |}}
{{#each ctrl.psAppViewRefs as | viewRef |}}
{{#if viewRef.refPSAppView}}
<{{viewRef.refPSAppView.name}}
v-if="state.selection.viewName && state.selection.viewName === '{{viewRef.refPSAppView.name}}'"
......@@ -68,7 +69,7 @@ defineExpose({ state, name: '{{ctrl.name}}' });
:viewParams="JSON.stringify(state.selection.viewParams)">
</{{viewRef.refPSAppView.name}}>
{{/if}}
{{/each}} --}}
{{/each}}
</a-layout>
</a-layout>
</template>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册