system-clients 1.6.38 → 1.6.39-byhy
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +102 -102
- package/src/components/server/Login.vue +14 -3
- package/src/components/server/ModifyPw.vue +6 -5
- package/src/components/server/RightTree.vue +166 -159
- package/src/components/server/TestRightTree.vue +42 -42
- package/src/plugins/GetLoginInfoService.js +513 -513
- package/src/plugins/validation.js +6 -2
- package/.npmignore +0 -9
- package/build/.npmignore +0 -1
- package/src/.npmignore +0 -1
package/package.json
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "system-clients",
|
|
3
|
-
"version": "1.6.
|
|
4
|
-
"description": "系统基础框架",
|
|
5
|
-
"main": "src/index.js",
|
|
6
|
-
"directories": {
|
|
7
|
-
"example": "examples",
|
|
8
|
-
"test": "test"
|
|
9
|
-
},
|
|
10
|
-
"scripts": {
|
|
11
|
-
"example": "node build/example-server.js",
|
|
12
|
-
"dev": "node build/dev-server.js",
|
|
13
|
-
"lint": "eslint src/**.js test/e2e/**.js test/unit/specs/** build/**.js",
|
|
14
|
-
"build": "rimraf dist && mkdirp dist && ncp static dist/static && cross-env NODE_ENV=production webpack --progress --hide-modules --config build/webpack.prod.conf.js",
|
|
15
|
-
"e2e": "node test/e2e/runner.js",
|
|
16
|
-
"unit": "karma start test/unit/karma.conf.js",
|
|
17
|
-
"release": "npm set registry http://registry.npmjs.org && npm publish && npm set registry http://registry.npm.taobao.org"
|
|
18
|
-
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"base64-js": "^1.3.0",
|
|
21
|
-
"js-base64": "^2.4.9",
|
|
22
|
-
"jsencrypt": "^3.0.0-rc.1",
|
|
23
|
-
"less": "^2.7.1",
|
|
24
|
-
"less-loader": "^2.2.3",
|
|
25
|
-
"src": "^1.1.2",
|
|
26
|
-
"vue": "^1.0.17"
|
|
27
|
-
},
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"babel-core": "^6.0.0",
|
|
30
|
-
"babel-loader": "^6.0.0",
|
|
31
|
-
"babel-plugin-transform-runtime": "^6.0.0",
|
|
32
|
-
"babel-preset-es2015": "^6.0.0",
|
|
33
|
-
"babel-preset-stage-2": "^6.0.0",
|
|
34
|
-
"chai": "^3.5.0",
|
|
35
|
-
"connect-history-api-fallback": "^1.1.0",
|
|
36
|
-
"cross-env": "^1.0.7",
|
|
37
|
-
"cross-spawn": "^2.1.5",
|
|
38
|
-
"css-loader": "^0.23.0",
|
|
39
|
-
"eslint": "^2.0.0",
|
|
40
|
-
"eslint-config-standard": "^5.1.0",
|
|
41
|
-
"eslint-friendly-formatter": "^1.2.2",
|
|
42
|
-
"eslint-loader": "^1.3.0",
|
|
43
|
-
"eslint-plugin-html": "^1.3.0",
|
|
44
|
-
"eslint-plugin-promise": "^1.0.8",
|
|
45
|
-
"eslint-plugin-standard": "^1.3.2",
|
|
46
|
-
"eslint-plugin-vue": "^0.1.1",
|
|
47
|
-
"eventsource-polyfill": "^0.9.6",
|
|
48
|
-
"express": "^4.13.3",
|
|
49
|
-
"extract-text-webpack-plugin": "^1.0.1",
|
|
50
|
-
"file-loader": "^0.8.4",
|
|
51
|
-
"function-bind": "^1.0.2",
|
|
52
|
-
"html-webpack-plugin": "^2.8.1",
|
|
53
|
-
"http-proxy-middleware": "^0.11.0",
|
|
54
|
-
"inject-loader": "^2.0.1",
|
|
55
|
-
"isparta-loader": "^2.0.0",
|
|
56
|
-
"jasmine-core": "^2.4.1",
|
|
57
|
-
"jquery": "^3.3.1",
|
|
58
|
-
"json-loader": "^0.5.4",
|
|
59
|
-
"karma": "^1.4.1",
|
|
60
|
-
"karma-chrome-launcher": "^2.2.0",
|
|
61
|
-
"karma-coverage": "^1.1.1",
|
|
62
|
-
"karma-mocha": "^1.3.0",
|
|
63
|
-
"karma-sinon-chai": "^1.3.1",
|
|
64
|
-
"karma-sourcemap-loader": "^0.3.7",
|
|
65
|
-
"karma-spec-reporter": "0.0.31",
|
|
66
|
-
"karma-webpack": "^2.0.2",
|
|
67
|
-
"manage-client": "^1.4.20",
|
|
68
|
-
"mkdirp": "^0.5.1",
|
|
69
|
-
"mocha": "^3.2.0",
|
|
70
|
-
"ncp": "^2.0.0",
|
|
71
|
-
"nightwatch": "^0.8.18",
|
|
72
|
-
"rimraf": "^2.5.0",
|
|
73
|
-
"selenium-server": "2.52.0",
|
|
74
|
-
"sinon": "^2.1.0",
|
|
75
|
-
"sinon-chai": "^2.8.0",
|
|
76
|
-
"style": "0.0.3",
|
|
77
|
-
"style-loader": "^0.20.3",
|
|
78
|
-
"url-loader": "^0.5.7",
|
|
79
|
-
"vue-client": "^1.18.5",
|
|
80
|
-
"vue-hot-reload-api": "^1.2.0",
|
|
81
|
-
"vue-html-loader": "^1.0.0",
|
|
82
|
-
"vue-loader": "^8.2.1",
|
|
83
|
-
"vue-resource": "^1.5.0",
|
|
84
|
-
"vue-router": "^0.7.13",
|
|
85
|
-
"vue-strap": "^1.0.9",
|
|
86
|
-
"vue-style-loader": "^1.0.0",
|
|
87
|
-
"vue-validator": "^3.0.0-alpha.2",
|
|
88
|
-
"webpack": "^1.12.2",
|
|
89
|
-
"webpack-dev-middleware": "^1.4.0",
|
|
90
|
-
"webpack-hot-middleware": "^2.6.0",
|
|
91
|
-
"webpack-merge": "^0.8.3"
|
|
92
|
-
},
|
|
93
|
-
"repository": {
|
|
94
|
-
"type": "git",
|
|
95
|
-
"url": "https://gitee.com/aotu/System"
|
|
96
|
-
},
|
|
97
|
-
"keywords": [
|
|
98
|
-
"system_clients"
|
|
99
|
-
],
|
|
100
|
-
"author": "杨文宇",
|
|
101
|
-
"license": "ISC"
|
|
102
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "system-clients",
|
|
3
|
+
"version": "1.6.39-byhy",
|
|
4
|
+
"description": "系统基础框架",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"directories": {
|
|
7
|
+
"example": "examples",
|
|
8
|
+
"test": "test"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"example": "node build/example-server.js",
|
|
12
|
+
"dev": "node build/dev-server.js",
|
|
13
|
+
"lint": "eslint src/**.js test/e2e/**.js test/unit/specs/** build/**.js",
|
|
14
|
+
"build": "rimraf dist && mkdirp dist && ncp static dist/static && cross-env NODE_ENV=production webpack --progress --hide-modules --config build/webpack.prod.conf.js",
|
|
15
|
+
"e2e": "node test/e2e/runner.js",
|
|
16
|
+
"unit": "karma start test/unit/karma.conf.js",
|
|
17
|
+
"release": "npm set registry http://registry.npmjs.org && npm publish && npm set registry http://registry.npm.taobao.org"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"base64-js": "^1.3.0",
|
|
21
|
+
"js-base64": "^2.4.9",
|
|
22
|
+
"jsencrypt": "^3.0.0-rc.1",
|
|
23
|
+
"less": "^2.7.1",
|
|
24
|
+
"less-loader": "^2.2.3",
|
|
25
|
+
"src": "^1.1.2",
|
|
26
|
+
"vue": "^1.0.17"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"babel-core": "^6.0.0",
|
|
30
|
+
"babel-loader": "^6.0.0",
|
|
31
|
+
"babel-plugin-transform-runtime": "^6.0.0",
|
|
32
|
+
"babel-preset-es2015": "^6.0.0",
|
|
33
|
+
"babel-preset-stage-2": "^6.0.0",
|
|
34
|
+
"chai": "^3.5.0",
|
|
35
|
+
"connect-history-api-fallback": "^1.1.0",
|
|
36
|
+
"cross-env": "^1.0.7",
|
|
37
|
+
"cross-spawn": "^2.1.5",
|
|
38
|
+
"css-loader": "^0.23.0",
|
|
39
|
+
"eslint": "^2.0.0",
|
|
40
|
+
"eslint-config-standard": "^5.1.0",
|
|
41
|
+
"eslint-friendly-formatter": "^1.2.2",
|
|
42
|
+
"eslint-loader": "^1.3.0",
|
|
43
|
+
"eslint-plugin-html": "^1.3.0",
|
|
44
|
+
"eslint-plugin-promise": "^1.0.8",
|
|
45
|
+
"eslint-plugin-standard": "^1.3.2",
|
|
46
|
+
"eslint-plugin-vue": "^0.1.1",
|
|
47
|
+
"eventsource-polyfill": "^0.9.6",
|
|
48
|
+
"express": "^4.13.3",
|
|
49
|
+
"extract-text-webpack-plugin": "^1.0.1",
|
|
50
|
+
"file-loader": "^0.8.4",
|
|
51
|
+
"function-bind": "^1.0.2",
|
|
52
|
+
"html-webpack-plugin": "^2.8.1",
|
|
53
|
+
"http-proxy-middleware": "^0.11.0",
|
|
54
|
+
"inject-loader": "^2.0.1",
|
|
55
|
+
"isparta-loader": "^2.0.0",
|
|
56
|
+
"jasmine-core": "^2.4.1",
|
|
57
|
+
"jquery": "^3.3.1",
|
|
58
|
+
"json-loader": "^0.5.4",
|
|
59
|
+
"karma": "^1.4.1",
|
|
60
|
+
"karma-chrome-launcher": "^2.2.0",
|
|
61
|
+
"karma-coverage": "^1.1.1",
|
|
62
|
+
"karma-mocha": "^1.3.0",
|
|
63
|
+
"karma-sinon-chai": "^1.3.1",
|
|
64
|
+
"karma-sourcemap-loader": "^0.3.7",
|
|
65
|
+
"karma-spec-reporter": "0.0.31",
|
|
66
|
+
"karma-webpack": "^2.0.2",
|
|
67
|
+
"manage-client": "^1.4.20",
|
|
68
|
+
"mkdirp": "^0.5.1",
|
|
69
|
+
"mocha": "^3.2.0",
|
|
70
|
+
"ncp": "^2.0.0",
|
|
71
|
+
"nightwatch": "^0.8.18",
|
|
72
|
+
"rimraf": "^2.5.0",
|
|
73
|
+
"selenium-server": "2.52.0",
|
|
74
|
+
"sinon": "^2.1.0",
|
|
75
|
+
"sinon-chai": "^2.8.0",
|
|
76
|
+
"style": "0.0.3",
|
|
77
|
+
"style-loader": "^0.20.3",
|
|
78
|
+
"url-loader": "^0.5.7",
|
|
79
|
+
"vue-client": "^1.18.5",
|
|
80
|
+
"vue-hot-reload-api": "^1.2.0",
|
|
81
|
+
"vue-html-loader": "^1.0.0",
|
|
82
|
+
"vue-loader": "^8.2.1",
|
|
83
|
+
"vue-resource": "^1.5.0",
|
|
84
|
+
"vue-router": "^0.7.13",
|
|
85
|
+
"vue-strap": "^1.0.9",
|
|
86
|
+
"vue-style-loader": "^1.0.0",
|
|
87
|
+
"vue-validator": "^3.0.0-alpha.2",
|
|
88
|
+
"webpack": "^1.12.2",
|
|
89
|
+
"webpack-dev-middleware": "^1.4.0",
|
|
90
|
+
"webpack-hot-middleware": "^2.6.0",
|
|
91
|
+
"webpack-merge": "^0.8.3"
|
|
92
|
+
},
|
|
93
|
+
"repository": {
|
|
94
|
+
"type": "git",
|
|
95
|
+
"url": "https://gitee.com/aotu/System"
|
|
96
|
+
},
|
|
97
|
+
"keywords": [
|
|
98
|
+
"system_clients"
|
|
99
|
+
],
|
|
100
|
+
"author": "杨文宇",
|
|
101
|
+
"license": "ISC"
|
|
102
|
+
}
|
|
@@ -77,6 +77,8 @@
|
|
|
77
77
|
<modal> -->
|
|
78
78
|
<!-- 注册模态框结束 -->
|
|
79
79
|
<!--<load-data @ready="onReady"></load-data>-->
|
|
80
|
+
<!-- 修改密码组件 -->
|
|
81
|
+
<modify-pw :show.sync="modifyPwShow" v-if="modifyPwShow"></modify-pw>
|
|
80
82
|
</div>
|
|
81
83
|
</template>
|
|
82
84
|
|
|
@@ -121,8 +123,15 @@
|
|
|
121
123
|
throw new Error('Mac地址验证失败, 请联系管理员!!')
|
|
122
124
|
}
|
|
123
125
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
// 弱口令验证
|
|
127
|
+
// 跳转过来的不进行验证
|
|
128
|
+
if (self.config.weakPassword && !(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?!.*(123|321|abc|cba))[a-zA-Z\d!@#$%^&*()_+-=<>?]{8,16}$/.test(self.model.password))) {
|
|
129
|
+
self.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm']).then((res) => {
|
|
130
|
+
self.modifyPwShow = true
|
|
131
|
+
})
|
|
132
|
+
} else {
|
|
133
|
+
self.$goto('home-page', {functions: self.$login.f})
|
|
134
|
+
}
|
|
126
135
|
} catch (ret) {
|
|
127
136
|
console.error('登录失败', ret)
|
|
128
137
|
let msg
|
|
@@ -162,8 +171,10 @@
|
|
|
162
171
|
data () {
|
|
163
172
|
return {
|
|
164
173
|
config: {
|
|
165
|
-
isMac: false
|
|
174
|
+
isMac: false,
|
|
175
|
+
weakPassword: true
|
|
166
176
|
},
|
|
177
|
+
modifyPwShow: false,
|
|
167
178
|
login: false,
|
|
168
179
|
model: {},
|
|
169
180
|
show: false,
|
|
@@ -18,14 +18,15 @@
|
|
|
18
18
|
</div>
|
|
19
19
|
</div>
|
|
20
20
|
<div class="has-feedback form-group"
|
|
21
|
-
:class="{'has-warning':$v.newpassword.required,'has-error'
|
|
22
|
-
'has-success': !$v.newpassword.required && !$v.newpassword.
|
|
21
|
+
:class="{'has-warning':$v.newpassword.required,'has-error':($v.newpassword.numbersAndLetter8to16 || $v.newpassword.minlength)&& !$v.newpassword.required && !$v.newpassword.chinesePassword,
|
|
22
|
+
'has-success': !$v.newpassword.required && !$v.newpassword.numbersAndLetter8to16&&!$v.newpassword.minlength && !$v.newpassword.chinesePassword}">
|
|
23
23
|
<label for="newpassword" class="col-sm-4 col-sm-offset-1 control-label">新的密码: </label>
|
|
24
24
|
<div class="col-sm-4">
|
|
25
|
-
<input type="password" v-model="deliver.newpassword" class="form-control" id="newpassword" v-validate:newpassword='{required:true,
|
|
26
|
-
<span class="glyphicon glyphicon-ok form-control-feedback" v-if="!$v.newpassword.required && !($v.newpassword.
|
|
25
|
+
<input type="password" v-model="deliver.newpassword" class="form-control" id="newpassword" v-validate:newpassword='{required:true, numbersAndLetter8to16: true, minlength: 6,chinesePassword: true}'>
|
|
26
|
+
<span class="glyphicon glyphicon-ok form-control-feedback" v-if="!$v.newpassword.required && !$v.newpassword.minlength && !($v.newpassword.numbersAndLetter8to16 && !($v.newpassword.required)) && !($v.newpassword.chinesePassword) "></span>
|
|
27
27
|
<span v-if="$v.newpassword.required">不能为空</span>
|
|
28
|
-
<span v-if="$v.newpassword.
|
|
28
|
+
<span v-if="($v.newpassword.numbersAndLetter8to16||$v.newpassword.minlength) && !($v.newpassword.required&&$v.newpassword.minlength)">密码必须是8~16位数字与大小字母外加特殊字符的组合,并且不能出现类似'123','abc'等连贯数字或者字母</span>
|
|
29
|
+
<span v-if="$v.newpassword.chinesePassword">密码不能包含中文</span>
|
|
29
30
|
</div>
|
|
30
31
|
</div>
|
|
31
32
|
<div class="has-feedback form-group"
|
|
@@ -1,159 +1,166 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<dropdown :model='model' class="auto" id="res-tree" v-if="!islist">
|
|
3
|
-
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
|
4
|
-
<span>{{ resname }}</span>
|
|
5
|
-
<span class="caret"></span>
|
|
6
|
-
</button>
|
|
7
|
-
<tree :model='model' :is-click="false" slot="dropdown-menu" class="dropdown-menu auto" role="menu">
|
|
8
|
-
<span partial>
|
|
9
|
-
<span class="glyphicon glyphicon-chevron-up" v-show="row.open&&row.data.children.length>0" style="color:balck;"></span>
|
|
10
|
-
<span class="glyphicon glyphicon-chevron-down" v-show="!row.open&&row.data.children.length>0" style="color:balck;"></span>
|
|
11
|
-
<span class="RightTreeCanSelect" v-if="row.data.hasright" @click.stop="$parent.$parent.$parent.selectclick(row.data)">{{row.data.name}}</span>
|
|
12
|
-
<span class="RightTreeCanNotSelect" v-else>{{row.data.name}}</span>
|
|
13
|
-
<span class="glyphicon glyphicon-ok " v-show="$parent.$parent.$parent.isSelect(row.data.name)" style="color:balck;"></span>
|
|
14
|
-
</span>
|
|
15
|
-
</tree>
|
|
16
|
-
</dropdown>
|
|
17
|
-
<v-select v-if="islist"
|
|
18
|
-
placeholder='请选择'
|
|
19
|
-
:options='childrenOptions'
|
|
20
|
-
@change="selectclick"
|
|
21
|
-
:value-single="true"
|
|
22
|
-
close-on-select clear-button></v-select>
|
|
23
|
-
</template>
|
|
24
|
-
<script>
|
|
25
|
-
import co from 'co'
|
|
26
|
-
import { PagedList, HttpResetClass } from 'vue-client'
|
|
27
|
-
import * as ldapHelper from '../../util/LdapHelper'
|
|
28
|
-
|
|
29
|
-
let saveGen = function * (self) {
|
|
30
|
-
//获取分公司树
|
|
31
|
-
let data = {
|
|
32
|
-
source: self.source,
|
|
33
|
-
userid: self.userid
|
|
34
|
-
}
|
|
35
|
-
let http = new HttpResetClass()
|
|
36
|
-
let ret = yield http.load('POST', `${self.Url}/rs/search`, data, {resolveMsg: null, rejectMsg: null})
|
|
37
|
-
// 去掉前面的两层节点
|
|
38
|
-
ret.data[0].children[0].children.forEach((item) => {
|
|
39
|
-
self.model.push(item)
|
|
40
|
-
})
|
|
41
|
-
// 给资源添加父关系
|
|
42
|
-
ldapHelper.procParent(self.model)
|
|
43
|
-
if (self.islist) {
|
|
44
|
-
self.treetoList(self.model)
|
|
45
|
-
}
|
|
46
|
-
self.selectRes()
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export default {
|
|
50
|
-
title: '资源树',
|
|
51
|
-
props: {
|
|
52
|
-
userid: {
|
|
53
|
-
type: String,
|
|
54
|
-
require: true
|
|
55
|
-
},
|
|
56
|
-
source: {
|
|
57
|
-
type: String,
|
|
58
|
-
require: true
|
|
59
|
-
},
|
|
60
|
-
resname: {
|
|
61
|
-
default: '请选择组织'
|
|
62
|
-
},
|
|
63
|
-
resid: {
|
|
64
|
-
},
|
|
65
|
-
resobj:{
|
|
66
|
-
type: Object,
|
|
67
|
-
},
|
|
68
|
-
islist: {
|
|
69
|
-
type: Boolean,
|
|
70
|
-
default: false
|
|
71
|
-
},
|
|
72
|
-
//是否有查看上级的权限
|
|
73
|
-
Url:{
|
|
74
|
-
type: String,
|
|
75
|
-
default:''
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
data () {
|
|
79
|
-
return {
|
|
80
|
-
model: [
|
|
81
|
-
|
|
82
|
-
],
|
|
83
|
-
childrenOptions: []
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
methods: {
|
|
87
|
-
// 当外面传入的选中对象发生变化时调用
|
|
88
|
-
selectRes () {
|
|
89
|
-
if (this.resid) {
|
|
90
|
-
// 当外面传入了新的选中数据后,根据外面传入的数据进行选择
|
|
91
|
-
let str = this.resid
|
|
92
|
-
let res = ldapHelper.find(this.model, str.substring(0, str.length - 1))
|
|
93
|
-
this.selectclick(res)
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
//点击资源的方法
|
|
97
|
-
selectclick (row) {
|
|
98
|
-
this.resname = row.name
|
|
99
|
-
let newobj={
|
|
100
|
-
"res": ldapHelper.getFullName(row, 'name'),
|
|
101
|
-
"resids": ldapHelper.getFullName(row, 'id') + '.',
|
|
102
|
-
}
|
|
103
|
-
this.$emit('re-res', newobj)
|
|
104
|
-
},
|
|
105
|
-
//检查是否显示对勾
|
|
106
|
-
isSelect(val) {
|
|
107
|
-
if(this.resname==val){
|
|
108
|
-
return true
|
|
109
|
-
}else{
|
|
110
|
-
return false
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
//树形结构变成list
|
|
114
|
-
treetoList(val) {
|
|
115
|
-
for (let value of val) {
|
|
116
|
-
this.ergodicList(value)
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
//找到跟节点
|
|
120
|
-
ergodicList (val) {
|
|
121
|
-
val.children.length > 0 ? this.treetoList(val.children) : this.childrenOptions.push({label: val.name, value: val})
|
|
122
|
-
},
|
|
123
|
-
//处理显示默认值
|
|
124
|
-
dealResObj (val) {
|
|
125
|
-
try{
|
|
126
|
-
var arr=val.res.split(".")
|
|
127
|
-
//截取最后一个分公司名字
|
|
128
|
-
this.resname=arr[arr.length-1].toString()
|
|
129
|
-
this.resid = val.resids
|
|
130
|
-
}catch (e){
|
|
131
|
-
this.resname='请选择组织'
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
events: {
|
|
136
|
-
|
|
137
|
-
},
|
|
138
|
-
ready () {
|
|
139
|
-
this.dealResObj (this.resobj)
|
|
140
|
-
let gen = saveGen(this)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<dropdown :model='model' class="auto" id="res-tree" v-if="!islist">
|
|
3
|
+
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
|
4
|
+
<span>{{ resname }}</span>
|
|
5
|
+
<span class="caret"></span>
|
|
6
|
+
</button>
|
|
7
|
+
<tree :model='model' :is-click="false" slot="dropdown-menu" class="dropdown-menu auto" role="menu">
|
|
8
|
+
<span partial>
|
|
9
|
+
<span class="glyphicon glyphicon-chevron-up" v-show="row.open&&row.data.children.length>0" style="color:balck;"></span>
|
|
10
|
+
<span class="glyphicon glyphicon-chevron-down" v-show="!row.open&&row.data.children.length>0" style="color:balck;"></span>
|
|
11
|
+
<span class="RightTreeCanSelect" v-if="row.data.hasright" @click.stop="$parent.$parent.$parent.selectclick(row.data)">{{row.data.name}}</span>
|
|
12
|
+
<span class="RightTreeCanNotSelect" v-else>{{row.data.name}}</span>
|
|
13
|
+
<span class="glyphicon glyphicon-ok " v-show="$parent.$parent.$parent.isSelect(row.data.name)" style="color:balck;"></span>
|
|
14
|
+
</span>
|
|
15
|
+
</tree>
|
|
16
|
+
</dropdown>
|
|
17
|
+
<v-select v-if="islist"
|
|
18
|
+
placeholder='请选择'
|
|
19
|
+
:options='childrenOptions'
|
|
20
|
+
@change="selectclick"
|
|
21
|
+
:value-single="true"
|
|
22
|
+
close-on-select clear-button></v-select>
|
|
23
|
+
</template>
|
|
24
|
+
<script>
|
|
25
|
+
import co from 'co'
|
|
26
|
+
import { PagedList, HttpResetClass } from 'vue-client'
|
|
27
|
+
import * as ldapHelper from '../../util/LdapHelper'
|
|
28
|
+
|
|
29
|
+
let saveGen = function * (self) {
|
|
30
|
+
//获取分公司树
|
|
31
|
+
let data = {
|
|
32
|
+
source: self.source,
|
|
33
|
+
userid: self.userid
|
|
34
|
+
}
|
|
35
|
+
let http = new HttpResetClass()
|
|
36
|
+
let ret = yield http.load('POST', `${self.Url}/rs/search`, data, {resolveMsg: null, rejectMsg: null})
|
|
37
|
+
// 去掉前面的两层节点
|
|
38
|
+
ret.data[0].children[0].children.forEach((item) => {
|
|
39
|
+
self.model.push(item)
|
|
40
|
+
})
|
|
41
|
+
// 给资源添加父关系
|
|
42
|
+
ldapHelper.procParent(self.model)
|
|
43
|
+
if (self.islist) {
|
|
44
|
+
self.treetoList(self.model)
|
|
45
|
+
}
|
|
46
|
+
self.selectRes()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default {
|
|
50
|
+
title: '资源树',
|
|
51
|
+
props: {
|
|
52
|
+
userid: {
|
|
53
|
+
type: String,
|
|
54
|
+
require: true
|
|
55
|
+
},
|
|
56
|
+
source: {
|
|
57
|
+
type: String,
|
|
58
|
+
require: true
|
|
59
|
+
},
|
|
60
|
+
resname: {
|
|
61
|
+
default: '请选择组织'
|
|
62
|
+
},
|
|
63
|
+
resid: {
|
|
64
|
+
},
|
|
65
|
+
resobj:{
|
|
66
|
+
type: Object,
|
|
67
|
+
},
|
|
68
|
+
islist: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: false
|
|
71
|
+
},
|
|
72
|
+
//是否有查看上级的权限
|
|
73
|
+
Url:{
|
|
74
|
+
type: String,
|
|
75
|
+
default:''
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
data () {
|
|
79
|
+
return {
|
|
80
|
+
model: [
|
|
81
|
+
|
|
82
|
+
],
|
|
83
|
+
childrenOptions: []
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
methods: {
|
|
87
|
+
// 当外面传入的选中对象发生变化时调用
|
|
88
|
+
selectRes () {
|
|
89
|
+
if (this.resid) {
|
|
90
|
+
// 当外面传入了新的选中数据后,根据外面传入的数据进行选择
|
|
91
|
+
let str = this.resid
|
|
92
|
+
let res = ldapHelper.find(this.model, str.substring(0, str.length - 1))
|
|
93
|
+
this.selectclick(res)
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
//点击资源的方法
|
|
97
|
+
selectclick (row) {
|
|
98
|
+
this.resname = row.name
|
|
99
|
+
let newobj={
|
|
100
|
+
"res": ldapHelper.getFullName(row, 'name'),
|
|
101
|
+
"resids": ldapHelper.getFullName(row, 'id') + '.',
|
|
102
|
+
}
|
|
103
|
+
this.$emit('re-res', newobj)
|
|
104
|
+
},
|
|
105
|
+
//检查是否显示对勾
|
|
106
|
+
isSelect(val) {
|
|
107
|
+
if(this.resname==val){
|
|
108
|
+
return true
|
|
109
|
+
}else{
|
|
110
|
+
return false
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
//树形结构变成list
|
|
114
|
+
treetoList(val) {
|
|
115
|
+
for (let value of val) {
|
|
116
|
+
this.ergodicList(value)
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
//找到跟节点
|
|
120
|
+
ergodicList (val) {
|
|
121
|
+
val.children.length > 0 ? this.treetoList(val.children) : this.childrenOptions.push({label: val.name, value: val})
|
|
122
|
+
},
|
|
123
|
+
//处理显示默认值
|
|
124
|
+
dealResObj (val) {
|
|
125
|
+
try{
|
|
126
|
+
var arr=val.res.split(".")
|
|
127
|
+
//截取最后一个分公司名字
|
|
128
|
+
this.resname=arr[arr.length-1].toString()
|
|
129
|
+
this.resid = val.resids
|
|
130
|
+
}catch (e){
|
|
131
|
+
this.resname='请选择组织'
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
events: {
|
|
136
|
+
|
|
137
|
+
},
|
|
138
|
+
ready () {
|
|
139
|
+
this.dealResObj (this.resobj)
|
|
140
|
+
let gen = saveGen(this)
|
|
141
|
+
co(gen).then(() => {
|
|
142
|
+
// 如果有组织数据,设置默认显示为第一个组织的名称
|
|
143
|
+
if (this.model.length > 0 && this.model[0].children.length > 0) {
|
|
144
|
+
this.resname = this.model[0].name
|
|
145
|
+
} else {
|
|
146
|
+
this.resname = '请选择组织'
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
},
|
|
150
|
+
watch: {
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
</script>
|
|
154
|
+
<style lang="less">
|
|
155
|
+
#res-tree {
|
|
156
|
+
.list-group-item {
|
|
157
|
+
background-color: #FFF;
|
|
158
|
+
color: #000;
|
|
159
|
+
padding: 5px;
|
|
160
|
+
border:0px;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
#res-tree .list-group {
|
|
164
|
+
width: 250px;
|
|
165
|
+
}
|
|
166
|
+
</style>
|