Browse Source

update

master
2 years ago
parent
commit
595c290f09
  1. 19
      config/index.js
  2. 2
      package.json
  3. 4
      src/api/mdp_pub/mdp_config.js
  4. 10
      src/lang/zh.js
  5. 152
      src/views/login/components/login.vue
  6. 139
      src/views/xm/core/xmGroup/vue-okr-tree/README.md
  7. 3
      src/views/xm/core/xmGroup/vue-okr-tree/babel.config.js
  8. 10
      src/views/xm/core/xmGroup/vue-okr-tree/lib/demo.html
  9. 2802
      src/views/xm/core/xmGroup/vue-okr-tree/lib/vue-okr-tree.common.js
  10. 1
      src/views/xm/core/xmGroup/vue-okr-tree/lib/vue-okr-tree.common.js.map
  11. 1
      src/views/xm/core/xmGroup/vue-okr-tree/lib/vue-okr-tree.css
  12. 2812
      src/views/xm/core/xmGroup/vue-okr-tree/lib/vue-okr-tree.umd.js
  13. 1
      src/views/xm/core/xmGroup/vue-okr-tree/lib/vue-okr-tree.umd.js.map
  14. 2
      src/views/xm/core/xmGroup/vue-okr-tree/lib/vue-okr-tree.umd.min.js
  15. 1
      src/views/xm/core/xmGroup/vue-okr-tree/lib/vue-okr-tree.umd.min.js.map
  16. 5
      src/views/xm/core/xmGroup/vue-okr-tree/postcss.config.js
  17. 4
      src/views/xm/core/xmGroup/vue-okr-tree/vue.config.js

19
config/index.js

@ -34,7 +34,7 @@ module.exports = {
'^/api/m1/arc': '/arc' '^/api/m1/arc': '/arc'
} }
}, },
'/api/m1/sys': { '/api/m1/sys': {
target: 'http://localhost:7015', target: 'http://localhost:7015',
changeOrigin: true, changeOrigin: true,
@ -50,7 +50,7 @@ module.exports = {
// '^/api/m1/pay': '/pay' // '^/api/m1/pay': '/pay'
// } // }
// }, // },
/** /**
'/api/m1/workflow': { '/api/m1/workflow': {
target: 'http://localhost:7080', target: 'http://localhost:7080',
@ -60,13 +60,14 @@ module.exports = {
} }
}, },
**/ **/
'/api': {
target: 'https://www.qingqinkj.com',
changeOrigin: true,
pathRewrite: {
'^/api': '/api'
}
}
'/api/m1/lcode': {
target: 'http://localhost:7014',
changeOrigin: true,
pathRewrite: {
'^/api/m1/lcode': '/'
}
},
}, },
// Various Dev Server settings // Various Dev Server settings

2
package.json

@ -45,7 +45,7 @@
"simplemde": "1.11.2", "simplemde": "1.11.2",
"sortablejs": "1.7.0", "sortablejs": "1.7.0",
"v-region": "^2.3.0", "v-region": "^2.3.0",
"vue": "2.6.14",
"vue": "2.7.16",
"vue-clipboard2": "^0.3.1", "vue-clipboard2": "^0.3.1",
"vue-contextmenujs": "^1.3.10", "vue-contextmenujs": "^1.3.10",
"vue-count-to": "1.0.13", "vue-count-to": "1.0.13",

4
src/api/mdp_pub/mdp_config.js

@ -9,7 +9,7 @@ var sysName="唛盟智能开发";//系统名称,用于展示
export default { export default {
//登录相关 //登录相关
getOauth2LoginContext:function(){ getOauth2LoginContext:function(){
return "oauth2client"
return "lcode"
}, },
//短信相关 //短信相关
getSmsContext: function() { getSmsContext: function() {
@ -135,7 +135,7 @@ export default {
getSupportComponents:function(){ getSupportComponents:function(){
return ['myFocus'] return ['myFocus']
}, },
getOpenSourceLink:function(){ getOpenSourceLink:function(){
return "https://gitee.com/qingqinkj218/collections/375320" return "https://gitee.com/qingqinkj218/collections/375320"
} }

10
src/lang/zh.js

@ -47,9 +47,9 @@ export default {
exportZip: 'Export Zip', exportZip: 'Export Zip',
theme: '换肤', theme: '换肤',
clipboardDemo: 'Clipboard', clipboardDemo: 'Clipboard',
i18n: '国际化',
},
i18n: '国际化',
},
navbar: { navbar: {
logOut: '退出登录', logOut: '退出登录',
dashboard: '首页', dashboard: '首页',
@ -59,8 +59,8 @@ export default {
}, },
login: { login: {
mainTitle:'唛盟云', mainTitle:'唛盟云',
subTitle:'唛盟研发管理',
title: '唛盟研发管理',
subTitle:'琛海项目管理',
title: '琛海项目管理',
logIn: '登录', logIn: '登录',
username: '账号', username: '账号',
password: '密码', password: '密码',

152
src/views/login/components/login.vue

@ -9,27 +9,28 @@
<el-form-item prop="password" v-show="loginForm.authType=='password_display_userid'" label="登录密码"> <el-form-item prop="password" v-show="loginForm.authType=='password_display_userid'" label="登录密码">
<el-input class="inp" show-password v-model="loginForm.password" autoComplete="on" placeholder="登录密码"></el-input> <el-input class="inp" show-password v-model="loginForm.password" autoComplete="on" placeholder="登录密码"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="phoneno" v-show="loginForm.authType=='sms'" label="手机号码">
<el-form-item prop="phoneno" v-show="loginForm.authType=='sms'" label="手机号码">
<el-input class="inp" name="phoneno" type="text" v-model="loginForm.phoneno" autoComplete="on" placeholder="手机号码"> <el-input class="inp" name="phoneno" type="text" v-model="loginForm.phoneno" autoComplete="on" placeholder="手机号码">
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="smsCode" v-show="loginForm.authType=='sms'" label="短信验证码">
<el-form-item prop="smsCode" v-show="loginForm.authType=='sms'" label="短信验证码">
<el-input class="inp smsCode" name="smsCode" type="text" v-model="loginForm.smsCode" autoComplete="on" placeholder="短信验证码"> <el-input class="inp smsCode" name="smsCode" type="text" v-model="loginForm.smsCode" autoComplete="on" placeholder="短信验证码">
</el-input> </el-input>
<el-button class="sendCode" :disabled="abledBut" @click.prevent="sendPhonenoSmsCode('login')"> <el-button class="sendCode" :disabled="abledBut" @click.prevent="sendPhonenoSmsCode('login')">
<span class="text" v-if="!abledBut">发送验证码</span> <span class="text" v-if="!abledBut">发送验证码</span>
<span class="text" v-else>({{setTimeNum}}s)</span> <span class="text" v-else>({{setTimeNum}}s)</span>
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-button class="login" :loading="loading" @click.native.prevent="handleLogin"> <el-button class="login" :loading="loading" @click.native.prevent="handleLogin">
<span class="text"> </span> <span class="text"> </span>
</el-button> </el-button>
</el-form> </el-form>
<div class="oper"> <div class="oper">
<el-button type="primary" @click="doLoginByAction(data.action)">已点赞继续登陆</el-button>
<a @click="isRestPwd = true">忘记密码</a> <a @click="isRestPwd = true">忘记密码</a>
<a @click="$refs['starDialog'].open({action:loginByShowAccount})">演示账户登录</a> <a @click="$refs['starDialog'].open({action:loginByShowAccount})">演示账户登录</a>
<a v-if="loginForm.authType == 'password_display_userid' " @click="loginForm.authType = 'sms'">手机号登录</a> <a v-if="loginForm.authType == 'password_display_userid' " @click="loginForm.authType = 'sms'">手机号登录</a>
@ -38,11 +39,11 @@
</div> </div>
<div class="bottom"> <div class="bottom">
<el-divider content-position="center">第三方登录方式</el-divider> <el-divider content-position="center">第三方登录方式</el-divider>
<div class="other">
<div class="other">
<el-popover trigger="manual" v-model="wxLoginCodeVisible" placement="top-start"> <div id="login_container"></div> <el-popover trigger="manual" v-model="wxLoginCodeVisible" placement="top-start"> <div id="login_container"></div>
<img slot="reference" src="@/assets/image/module/weixin.png" @click="$refs['starDialog'].open({action:weixinLogin})"> <img slot="reference" src="@/assets/image/module/weixin.png" @click="$refs['starDialog'].open({action:weixinLogin})">
<el-button type="text" @click="wxLoginCodeVisible=false" icon="el-icon-close">关闭</el-button><el-button type="text" @click="weixinLogin" icon="el-icon-refresh"></el-button> <el-button type="text" @click="wxLoginCodeVisible=false" icon="el-icon-close">关闭</el-button><el-button type="text" @click="weixinLogin" icon="el-icon-refresh"></el-button>
</el-popover>
</el-popover>
</div> </div>
</div> </div>
</div> </div>
@ -50,11 +51,11 @@
<div v-if="isRestPwd"> <div v-if="isRestPwd">
<div class="login_form"> <div class="login_form">
<el-form autoComplete="on" :model="loginForm" :rules="loginRules" ref="loginForm" label-position="top"> <el-form autoComplete="on" :model="loginForm" :rules="loginRules" ref="loginForm" label-position="top">
<el-form-item prop="phoneno" label="手机号码">
<el-form-item prop="phoneno" label="手机号码">
<el-input class="inp" name="phoneno" type="text" v-model="loginForm.phoneno" autoComplete="on" placeholder="手机号码"> <el-input class="inp" name="phoneno" type="text" v-model="loginForm.phoneno" autoComplete="on" placeholder="手机号码">
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="smsCode" label="短信验证码">
<el-form-item prop="smsCode" label="短信验证码">
<el-input class="inp smsCode" name="smsCode" type="text" v-model="loginForm.smsCode" autoComplete="on" placeholder="短信验证码"> <el-input class="inp smsCode" name="smsCode" type="text" v-model="loginForm.smsCode" autoComplete="on" placeholder="短信验证码">
</el-input> </el-input>
<el-button :disabled="abledBut" class="sendCode" @click.prevent="sendPhonenoSmsCode('changePassword')"> <el-button :disabled="abledBut" class="sendCode" @click.prevent="sendPhonenoSmsCode('changePassword')">
@ -62,8 +63,8 @@
<span class="text" v-else>({{setTimeNum}}s)</span> <span class="text" v-else>({{setTimeNum}}s)</span>
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-form-item prop="password" label="新密码">
<el-form-item prop="password" label="新密码">
<el-input class="inp" show-password name="password" :type="passwordType" v-model="loginForm.password" autoComplete="on" placeholder="新密码"> <el-input class="inp" show-password name="password" :type="passwordType" v-model="loginForm.password" autoComplete="on" placeholder="新密码">
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -76,13 +77,11 @@
</el-button> </el-button>
</div> </div>
</div> </div>
<mdp-dialog ref="starDialog" width="600px" title="hi~同学,来支持一下【唛盟开源】吧,为项目点个Star!">
<el-row class="center">
<el-button size="large" @click="toStar" target="_blank" type="warning" icon="el-icon-star-off">唛盟项目</el-button>
</el-row>
<mdp-dialog ref="starDialog" width="600px" title="项目管理演示账号">
<template #footer="{visible,data,dialog}"> <template #footer="{visible,data,dialog}">
<el-row slot="footer"> <el-row slot="footer">
<el-button @click="dialog.close()">取消</el-button><el-button type="primary" @click="doLoginByAction(data.action)">已点赞继续登陆</el-button>
<el-button @click="dialog.close()">取消</el-button><el-button type="primary" @click="doLoginByAction(data.action)">继续登陆</el-button>
</el-row> </el-row>
</template> </template>
</mdp-dialog> </mdp-dialog>
@ -92,9 +91,9 @@
<script> <script>
import { sendNoAuthSmsCode } from '@/api/sms/sms'; import { sendNoAuthSmsCode } from '@/api/sms/sms';
import { mapGetters } from 'vuex';
import { mapGetters } from 'vuex';
import md5 from 'js-md5'; import md5 from 'js-md5';
import { resetPasswordByPhoneno,getTpaState } from '@/api/login';
import { resetPasswordByPhoneno,getTpaState } from '@/api/login';
export default { export default {
name: 'login', name: 'login',
@ -131,7 +130,7 @@ export default {
callback(new Error('请输入6位以上用户账号')) callback(new Error('请输入6位以上用户账号'))
}else{ }else{
callback() callback()
}
}
} else { } else {
callback() callback()
} }
@ -142,10 +141,10 @@ export default {
callback(new Error('密码最少为六位')) callback(new Error('密码最少为六位'))
}else{ }else{
callback() callback()
}
}
} else { } else {
callback() callback()
}
}
} }
const validatePhoneno = (rule, value, callback) => { const validatePhoneno = (rule, value, callback) => {
if (this.loginForm.authType=='sms') { if (this.loginForm.authType=='sms') {
@ -153,10 +152,10 @@ export default {
callback(new Error('手机号码必须为11位号码')) callback(new Error('手机号码必须为11位号码'))
}else{ }else{
callback() callback()
}
}
} else { } else {
callback() callback()
}
}
} }
const validateSmsCode = (rule, value, callback) => { const validateSmsCode = (rule, value, callback) => {
if (this.loginForm.authType=='sms') { if (this.loginForm.authType=='sms') {
@ -164,10 +163,10 @@ export default {
callback(new Error('请输入6位短信验证码')) callback(new Error('请输入6位短信验证码'))
}else{ }else{
callback() callback()
}
}
} else { } else {
callback() callback()
}
}
} }
return { return {
loginForm: { loginForm: {
@ -182,16 +181,16 @@ export default {
password: [{ required: true, trigger: 'blur', validator: validatePassword }], password: [{ required: true, trigger: 'blur', validator: validatePassword }],
phoneno: [{ required: true, trigger: 'blur', validator: validatePhoneno }], phoneno: [{ required: true, trigger: 'blur', validator: validatePhoneno }],
smsCode: [{ required: true, trigger: 'blur', validator: validateSmsCode }], smsCode: [{ required: true, trigger: 'blur', validator: validateSmsCode }],
},
},
passwordType: 'password', passwordType: 'password',
loading: false, loading: false,
showResetPasswordDialog:false,// showResetPasswordDialog:false,//
showTpLoginDialog: false, // showTpLoginDialog: false, //
showRegisterDialog: false,// showRegisterDialog: false,//
deptSelectVisible:false,// deptSelectVisible:false,//
userDeptid:'',//
userDeptid:'',//
userBranchId:'',// userBranchId:'',//
addBranchFormVisible:false, //
addBranchFormVisible:false, //
isRestPwd: false, isRestPwd: false,
abledBut: false, // abledBut: false, //
setTimeNum: 60, // setTimeNum: 60, //
@ -208,7 +207,7 @@ export default {
this.passwordType = 'password' this.passwordType = 'password'
} }
}, },
sendPhonenoSmsCode(scene){ sendPhonenoSmsCode(scene){
var params={ var params={
phoneno:this.loginForm.phoneno, phoneno:this.loginForm.phoneno,
@ -230,16 +229,16 @@ export default {
}, },
handleResetPasswordByPhoneno() { handleResetPasswordByPhoneno() {
this.loading = true
this.loading = true
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate(valid => {
if (valid) {
if (valid) {
let params={ let params={
newPassword:md5(this.loginForm.password), newPassword:md5(this.loginForm.password),
phoneno:this.loginForm.phoneno, phoneno:this.loginForm.phoneno,
smsCode:this.loginForm.smsCode smsCode:this.loginForm.smsCode
}
}
resetPasswordByPhoneno(params).then(res=>{ resetPasswordByPhoneno(params).then(res=>{
this.loading = false
this.loading = false
if(res.data.tips.isOk){ if(res.data.tips.isOk){
this.$notify.success(res.data.tips.msg); this.$notify.success(res.data.tips.msg);
this.isRestPwd = false; this.isRestPwd = false;
@ -248,7 +247,7 @@ export default {
} }
}) })
} else { } else {
this.loading = false
this.loading = false
return false return false
} }
}) })
@ -256,7 +255,7 @@ export default {
handleLogin() { handleLogin() {
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate(valid => {
if (valid) {
if (valid) {
this.loading = true this.loading = true
let params={ let params={
displayUserid:this.loginForm.displayUserid, displayUserid:this.loginForm.displayUserid,
@ -272,7 +271,7 @@ export default {
loginParams.userloginid=params.displayUserid loginParams.userloginid=params.displayUserid
loginParams.password=params.password loginParams.password=params.password
loginParams.grantType="password" loginParams.grantType="password"
loginParams.authType='password_display_userid'
loginParams.authType='password_display_userid'
//loginParams.deptid=params.deptid //loginParams.deptid=params.deptid
loginParams.branchId=params.branchId loginParams.branchId=params.branchId
}else if(params.authType=='sms'){ }else if(params.authType=='sms'){
@ -283,26 +282,26 @@ export default {
//loginParams.deptid=params.deptid //loginParams.deptid=params.deptid
loginParams.branchId=params.branchId loginParams.branchId=params.branchId
} }
this.$store.dispatch("LoginByUserloginid",loginParams).then(res => {
this.loading = false
this.$store.dispatch("LoginByUserloginid",loginParams).then(res => {
this.loading = false
if(res.data.tips.isOk==true){ if(res.data.tips.isOk==true){
this.loading = true; this.loading = true;
this.$store.dispatch('GetUserInfo').then((res2)=>{
this.$store.dispatch('GetUserInfo').then((res2)=>{
this.loading = false this.loading = false
if(res2.data.tips.isOk==true){
this.userDeptid=res2.data.userInfo.deptid
this.rolesChecked();
if(res2.data.tips.isOk==true){
this.userDeptid=res2.data.userInfo.deptid
this.rolesChecked();
}else{ }else{
this.$notify.error(res2.data.tips.msg); this.$notify.error(res2.data.tips.msg);
} }
}).catch(err=>{ }).catch(err=>{
console.log(err);
console.log(err);
this.loading = false this.loading = false
});
});
}else{ }else{
this.$notify.error(res.data.tips.msg); this.$notify.error(res.data.tips.msg);
}
}
}).catch((e) => { }).catch((e) => {
this.loading = false this.loading = false
}) })
@ -326,27 +325,27 @@ export default {
} }
}, },
// //
rolesChecked(){
rolesChecked(){
var indexPath=sessionStorage.getItem("index-path"); var indexPath=sessionStorage.getItem("index-path");
if(!indexPath){ if(!indexPath){
indexPath="" indexPath=""
} }
if(this.userInfo.isSuperAdmin){
if(this.userInfo.isSuperAdmin){
location.replace(indexPath) location.replace(indexPath)
}else if(this.userInfo.isPlatformAdmin){
}else if(this.userInfo.isPlatformAdmin){
location.replace(indexPath) location.replace(indexPath)
}else{
}else{
location.replace(indexPath) location.replace(indexPath)
} }
},
},
afterAddBranchSubmit(branch){ afterAddBranchSubmit(branch){
this.addBranchFormVisible=false; this.addBranchFormVisible=false;
this.handleLogin(); this.handleLogin();
}, },
weixinLogin(){
var curlDomain=window.location.protocol+"//"+window.location.host; //
weixinLogin(){
var curlDomain=window.location.protocol+"//"+window.location.host; //
var mdpRedirectUri=curlDomain+"/"+process.env.CONTEXT+"/"+process.env.VERSION+"/" var mdpRedirectUri=curlDomain+"/"+process.env.CONTEXT+"/"+process.env.VERSION+"/"
var tpaContext=this.$mdp.getTpaContext(); var tpaContext=this.$mdp.getTpaContext();
var domain=this.$mdp.getFixedDomain(); var domain=this.$mdp.getFixedDomain();
@ -359,19 +358,20 @@ export default {
var state=res.data.data var state=res.data.data
var obj = new WxLogin({ var obj = new WxLogin({
self_redirect:false, self_redirect:false,
id:"login_container",
appid: this.$mdp.getWxpubConfig().appid,
scope: scope,
id:"login_container",
appid: this.$mdp.getWxpubConfig().appid,
scope: scope,
redirect_uri: encodeURIComponent(`${domain}/api/${process.env.VERSION}/${tpaContext}/login/token?authType=wechat_wxpub&appType=${appType}&redirectUri=${mdpRedirectUri}`), redirect_uri: encodeURIComponent(`${domain}/api/${process.env.VERSION}/${tpaContext}/login/token?authType=wechat_wxpub&appType=${appType}&redirectUri=${mdpRedirectUri}`),
state: state, state: state,
style: "", style: "",
href: "" href: ""
});
});
} }
}) })
}, },
doLoginByAction(action){ doLoginByAction(action){
debugger
this.$refs['starDialog'].close(); this.$refs['starDialog'].close();
action(); action();
}, },
@ -392,39 +392,39 @@ export default {
// this.$router.push({ path: '/' }) // this.$router.push({ path: '/' })
// }) // })
// } // }
},
loginByShowAccount(){
},
loginByShowAccount(){
this.loading = true
var loginParams={ }
this.loading = true
var loginParams={ }
loginParams.userloginid="demo-branch-01" loginParams.userloginid="demo-branch-01"
loginParams.password=md5("888888") loginParams.password=md5("888888")
loginParams.grantType="password" loginParams.grantType="password"
loginParams.authType='password_display_userid'
loginParams.authType='password_display_userid'
this.$store.dispatch("LoginByUserloginid",loginParams).then(res => { this.$store.dispatch("LoginByUserloginid",loginParams).then(res => {
this.loading = false
this.loading = false
if(res.data.tips.isOk==true){ if(res.data.tips.isOk==true){
this.loading = true; this.loading = true;
this.$store.dispatch('GetUserInfo').then((res2)=>{
this.$store.dispatch('GetUserInfo').then((res2)=>{
this.loading = false this.loading = false
if(res2.data.tips.isOk==true){
if(res2.data.tips.isOk==true){
this.userDeptid=res2.data.userInfo.deptid this.userDeptid=res2.data.userInfo.deptid
this.rolesChecked();
this.rolesChecked();
}else{ }else{
this.$notify.error(res2.data.tips.msg); this.$notify.error(res2.data.tips.msg);
} }
}).catch(err=>{ }).catch(err=>{
console.log(err);
console.log(err);
this.loading = false this.loading = false
});
});
}else{ }else{
this.$notify.error(res.data.tips.msg); this.$notify.error(res.data.tips.msg);
}
}
}).catch((e) => { }).catch((e) => {
this.loading = false this.loading = false
})
})
}, },
toStar(){ toStar(){
window.open(this.$mdp.getOpenSourceLink()) window.open(this.$mdp.getOpenSourceLink())
@ -453,4 +453,4 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../index.scss'; @import '../index.scss';
</style>
</style>

139
src/views/xm/core/xmGroup/vue-okr-tree/README.md

@ -0,0 +1,139 @@
## 更新日志
* 更新时间 2023/02/20
* 结合业务层实现对齐,修复左侧层数不一样的情况无法对齐
* 更新时间 2023/02/16
* 新增支持根节点对齐,伸缩不改变根节点位置
* 更新时间 2022/11/04
* 修复右子树更新左子树丢失问题:vue-okr-tree@1.0.15
* 更新时间 2022/11/03
* 修复左子树更新无效问题:vue-okr-tree@1.0.13
* 更新时间 2022/09/07
* 修复安装包内容不一样 对应版本:vue-okr-tree@1.0.12
* 更新时间 2022/07/25
* 优化文档 对应版本:vue-okr-tree@1.0.11
* 更新时间 2020/12/02
* 修复异步修改data不渲染问题 对应版本:vue-okr-tree@1.0.5
* 更新时间 2020/12/05
* 修改部分展示 bug 对应版本:vue-okr-tree@1.0.6
* 更新时间 2021/01/13
* 增加 updateKeyChildren 方法:vue-okr-tree@1.0.7
* 更新时间 2021/02/03
* 增加 node-btn-content 属性,对展开圆圈内容自定义处理 vue-okr-tree@1.0.8
* 更新时间 2021/02/04
* 增加 showNodeNum 属性显示子节点数 vue-okr-tree@1.0.9
* 更新时间 2021/09/07
* 修复节点倒叙显示问题 对应版本:vue-okr-tree@1.0.10
## 文档和事例
地址:http://www.longstudy.club/vue-okr-tree-doc/index.html
## vue-okr-tree
基于 Vue 2的组织架构树组件
## Install
```
# use npm
npm i vue-okr-tree
# use yarn
yarn add vue-okr-tree
```
## Quick Start
``` js
import {VueOkrTree} from 'vue-okr-tree';
import 'vue-okr-tree/dist/vue-okr-tree.css'
// ...
```
### CDN
``` html
# css
<link href="http://qjge81f6q.hd-bkt.clouddn.com/vue-okr-tree.css">
# js
<script src="http://qjge81f6q.hd-bkt.clouddn.com/vue-okr-tree.umd.min.js"></script>
```
## API
#### Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :-----| ---- | :----: | :----: | :----: |
| data | 展示数据 | array | — | —
| direction | 树的展开方向 | String | horizontal / vertical | vertical
| onlyBothTree | 子树在根节点左右两边展开,该模式只有在 direction 为 horizontal 有效,且必须提供 leftData 数据| Boolean | — | false
| leftData | 展示左子数的数据,该属性于在 onlyBothTree 模式启用 | array | — | —
| label-width | 节点的宽度,默认为自动宽度。如果 label-width 为 number 类型,单位 px;如果 label-width 为 string 类型,则这个宽度会设置为 节点 的 style.width 的值,节点的宽度会受控于外部样式 | string/number | — | —
| label-height | 节点的高度,默认为自动高度。如果 label-height 为 number 类型,单位 px;如果 label-height 为 string 类型,则这个高度会设置为 节点 的 style.height 的值,节点的高度会受控于外部样式 | string/number | — | —
| label-class-name | 节点 className 的回调方法,也可以使用字符串为所有的节点设置一个固定的 className | Function(node)/String | — | —
| current-lable-class-name | 当前选中节点的样式 | Function(node)/String | — | —
| show-collapsable | 节点是否可被展开 | Boolean | — | false
| show-node-num | 显示子节点数 | Boolean | — | false
| default-expand-all | 是否默认展开所有节点,该参数只有在 show-collapsable 为 true 时有效 | Boolean | — | false
| render-content | 树节点的内容区的渲染 Function | Function(h, node) | — | —
| node-btn-content | 展开的按钮内容渲染 Function | Function(h, node) | — | —
| props | 配置选项,具体看下表 | object | — | —
| node-key | 每个树节点用来作为唯一标识的属性,整棵树应该是唯一的 | String | — | —
| default-expanded-keys | 默认展开的节点的 key 的数组(需要注意的是,此时必须设置node-key,其值为节点数据中的一个字段名,该字段在整棵树中是唯一的。) | array | — | —
| filter-node-method | 对树节点进行筛选时执行的方法,返回 true 表示这个节点可以显示,返回 false 则表示这个节点会被隐藏 | Function(value, data, node) | — | —
| aniamte | 是否开启节点展开的过渡动画 | Boolean | — | false
| animate-name | 过渡动画名称,支持动画类型有 okr-fade-in-linear/okr-fade-in/okr-zoom-in-center/okr-zoom-in-top/okr-zoom-in-bottom | String | — | okr-zoom-in-center
#### props
| 参数 | 说明 | 类型 | 可选值 | 默认值
| :-----| ---- | :----: | :----: | :----: |
| label | 指定节点标签为节点对象的某个属性值 | string, function(data, node) | — | —
| children | 指定节点标签为节点对象的某个属性值 | string | — | —
#### Events
事件名称 | 说明 | 回调参数
------------------|-----------------------------------------|:----------------------
node-click | 节点被点击时的回调 | 共三个参数,依次为:传递给 data 属性的数组中该节点所对应的对象、节点对应的 Node、节点组件本身。
node-expand | 节点被展开时触发的事件 | 共三个参数,依次为:传递给 data 属性的数组中该节点所对应的对象、节点对应的 Node、节点组件本身
node-collapse | 节点被关闭时触发的事件 | 共三个参数,依次为:传递给 data 属性的数组中该节点所对应的对象、节点对应的 Node、节点组件本身
node-contextmenu | 当某一节点被鼠标右键点击时会触发该事件 | 共四个参数,依次为:event、传递给 data 属性的数组中该节点所对应的对象、节点对应的 Node、节点组件本身。
#### 方法
方法名 | 说明 | 回调参数
------------------|-----------------------------------------|:----------------------
filter | 对树节点进行筛选操作 | 接收一个任意类型的参数,该参数会在 filter-node-method 中作为第一个参数
updateKeyChildren | 通过 keys 设置节点子元素,使用此方法必须设置 node-key 属性 | (key, data) 接收两个参数,1. 节点 key 2. 节点数据的数组
getNode | 根据 data 或者 key 拿到 Tree 组件中的 node,使用此方法必须设置 node-key 属性 | (data) 要获得 node 的 key 或者 data
setCurrentNode | 通过 node 设置某个节点的当前选中状态,使用此方法必须设置 node-key 属性 | (node) 待被选节点的 node
setCurrentKey | 通过 key 设置某个节点的当前选中状态,使用此方法必须设置 node-key 属性 | (key) 待被选节点的 key,若为 null 则取消当前高亮的节点
getCurrentKey | 获取当前被选中节点的 key,使用此方法必须设置 node-key 属性,若没有节点被选中则返回 null | —
getCurrentNode | 获取当前被选中节点的 data,若没有节点被选中则返回 null | —
remove | 删除 Tree 中的一个节点,使用此方法必须设置 node-key 属性 | (data) 要删除的节点的 id 或者 data 或者 node
append | 为 Tree 中的一个节点追加一个子节点 | (data, parentNode) 接收两个参数,1. 要追加的子节点的 data 2. 子节点的 parent 的 data、key 或者 node
insertBefore | 为 Tree 的一个节点的前面增加一个节点 | (data, refNode) 接收两个参数,1. 要增加的节点的 data 2. 要增加的节点的后一个节点的 data、key 或者 node
insertAfter | 为 Tree 的一个节点的后面增加一个节点 | (data, refNode) 接收两个参数,1. 要增加的节点的 data 2. 要增加的节点的前一个节点的 data、key 或者 node
## 浏览器支持情况
Modern browsers and Internet Explorer 10+.
## License
[MIT](http://opensource.org/licenses/MIT)
## 作品展示
![](./src/assets/pro1.png)

3
src/views/xm/core/xmGroup/vue-okr-tree/babel.config.js

@ -0,0 +1,3 @@
module.exports = {
presets: ["@vue/app"]
};

10
src/views/xm/core/xmGroup/vue-okr-tree/lib/demo.html

@ -0,0 +1,10 @@
<meta charset="utf-8">
<title>vue-okr-tree demo</title>
<script src="./vue-okr-tree.umd.js"></script>
<link rel="stylesheet" href="./vue-okr-tree.css">
<script>
console.log(vue-okr-tree)
</script>

2802
src/views/xm/core/xmGroup/vue-okr-tree/lib/vue-okr-tree.common.js
File diff suppressed because it is too large
View File

1
src/views/xm/core/xmGroup/vue-okr-tree/lib/vue-okr-tree.common.js.map
File diff suppressed because it is too large
View File

1
src/views/xm/core/xmGroup/vue-okr-tree/lib/vue-okr-tree.css
File diff suppressed because it is too large
View File

2812
src/views/xm/core/xmGroup/vue-okr-tree/lib/vue-okr-tree.umd.js
File diff suppressed because it is too large
View File

1
src/views/xm/core/xmGroup/vue-okr-tree/lib/vue-okr-tree.umd.js.map
File diff suppressed because it is too large
View File

2
src/views/xm/core/xmGroup/vue-okr-tree/lib/vue-okr-tree.umd.min.js
File diff suppressed because it is too large
View File

1
src/views/xm/core/xmGroup/vue-okr-tree/lib/vue-okr-tree.umd.min.js.map
File diff suppressed because it is too large
View File

5
src/views/xm/core/xmGroup/vue-okr-tree/postcss.config.js

@ -0,0 +1,5 @@
module.exports = {
plugins: {
autoprefixer: {}
}
};

4
src/views/xm/core/xmGroup/vue-okr-tree/vue.config.js

@ -0,0 +1,4 @@
module.exports = {
publicPath: "./",
outputDir: 'lib'
};
Loading…
Cancel
Save