system-clients 4.0.5 → 4.0.7
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 +105 -105
- package/src/App.vue +24 -24
- package/src/components/Util.js +343 -343
- package/src/components/server/Menu.vue +188 -188
- package/src/components/server/ResSelect.vue +186 -178
- package/src/project/State.js +17 -17
@@ -1,178 +1,186 @@
|
|
1
|
-
<template>
|
2
|
-
<v-select :options='resoptions' placeholder='请选择'
|
3
|
-
:value.sync="selectres"
|
4
|
-
:multiple="isMul"
|
5
|
-
search="true"
|
6
|
-
:disabled="mustselect"
|
7
|
-
:close-on-select="!isMul"
|
8
|
-
@change="resChange"
|
9
|
-
>
|
10
|
-
</v-select>
|
11
|
-
</template>
|
12
|
-
<script>
|
13
|
-
import {HttpResetClass} from 'vue-client'
|
14
|
-
|
15
|
-
export default {
|
16
|
-
title: '资源选择',
|
17
|
-
props: {
|
18
|
-
|
19
|
-
//资源类型
|
20
|
-
restype:'',
|
21
|
-
//是否只查询营业厅
|
22
|
-
specialquery: {
|
23
|
-
type: Boolean,
|
24
|
-
default: false
|
25
|
-
},
|
26
|
-
//资源数据
|
27
|
-
resObj:{},
|
28
|
-
isMul: {
|
29
|
-
type: Boolean,
|
30
|
-
default: true
|
31
|
-
},
|
32
|
-
//资源初始化数据
|
33
|
-
initresid: {
|
34
|
-
type: Array,
|
35
|
-
default() { return [] },
|
36
|
-
},
|
37
|
-
//父层id
|
38
|
-
parentresid: {
|
39
|
-
type: Array,
|
40
|
-
default() { return [] },
|
41
|
-
},
|
42
|
-
mustselect: {
|
43
|
-
type: Boolean,
|
44
|
-
default: false
|
45
|
-
},
|
46
|
-
},
|
47
|
-
data () {
|
48
|
-
return {
|
49
|
-
//资源数据
|
50
|
-
resObj:{},
|
51
|
-
//资源数据列表
|
52
|
-
resoptions:[],
|
53
|
-
//选中资源数据
|
54
|
-
selectres: [],
|
55
|
-
}
|
56
|
-
},
|
57
|
-
ready () {
|
58
|
-
//获取资源列表
|
59
|
-
this.getResList()
|
60
|
-
},
|
61
|
-
methods:{
|
62
|
-
//树形结构变成list
|
63
|
-
findById(val) {
|
64
|
-
if(val){
|
65
|
-
if(this.checkidres(val)){
|
66
|
-
this.treetoList(val,'')
|
67
|
-
}else if(val.children.length>0){
|
68
|
-
for (let value of val.children) {
|
69
|
-
this.findById(value)
|
70
|
-
}
|
71
|
-
}
|
72
|
-
}
|
73
|
-
},
|
74
|
-
//树形结构变成list
|
75
|
-
treetoList(val,parentname) {
|
76
|
-
for (let value of val.children) {
|
77
|
-
this.ergodicList(value,parentname)
|
78
|
-
}
|
79
|
-
},
|
80
|
-
//找到跟节点
|
81
|
-
ergodicList (val,parentname) {
|
82
|
-
if(val.children.length > 0 ){
|
83
|
-
if (val.name !== '组织机构' && parentname !== '资源管理'){
|
84
|
-
this.resoptions.push({label: parentname === '组织机构' ? val.name : val.name+' - '+parentname, value: val.id})
|
85
|
-
}
|
86
|
-
parentname=parentname+val.name
|
87
|
-
this.treetoList(val,parentname)
|
88
|
-
}else {
|
89
|
-
//截取组织机构【组织机构】
|
90
|
-
if(this.restype=='organization'){
|
91
|
-
parentname=parentname.replace("组织机构","")
|
92
|
-
this.resoptions.push({label: val.name+' - '+parentname, value: val.id})
|
93
|
-
}else{
|
94
|
-
if (this.specialquery
|
95
|
-
if (val.f_dep_type === '营业厅') {
|
96
|
-
this.resoptions.push({label: val.name, value: val.id})
|
97
|
-
}
|
98
|
-
}else {
|
99
|
-
this.
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
}
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
this.
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
1
|
+
<template>
|
2
|
+
<v-select :options='resoptions' placeholder='请选择'
|
3
|
+
:value.sync="selectres"
|
4
|
+
:multiple="isMul"
|
5
|
+
search="true"
|
6
|
+
:disabled="mustselect"
|
7
|
+
:close-on-select="!isMul"
|
8
|
+
@change="resChange"
|
9
|
+
>
|
10
|
+
</v-select>
|
11
|
+
</template>
|
12
|
+
<script>
|
13
|
+
import {HttpResetClass} from 'vue-client'
|
14
|
+
|
15
|
+
export default {
|
16
|
+
title: '资源选择',
|
17
|
+
props: {
|
18
|
+
|
19
|
+
//资源类型
|
20
|
+
restype:'',
|
21
|
+
//是否只查询营业厅
|
22
|
+
specialquery: {
|
23
|
+
type: Boolean,
|
24
|
+
default: false
|
25
|
+
},
|
26
|
+
//资源数据
|
27
|
+
resObj:{},
|
28
|
+
isMul: {
|
29
|
+
type: Boolean,
|
30
|
+
default: true
|
31
|
+
},
|
32
|
+
//资源初始化数据
|
33
|
+
initresid: {
|
34
|
+
type: Array,
|
35
|
+
default() { return [] },
|
36
|
+
},
|
37
|
+
//父层id
|
38
|
+
parentresid: {
|
39
|
+
type: Array,
|
40
|
+
default() { return [] },
|
41
|
+
},
|
42
|
+
mustselect: {
|
43
|
+
type: Boolean,
|
44
|
+
default: false
|
45
|
+
},
|
46
|
+
},
|
47
|
+
data () {
|
48
|
+
return {
|
49
|
+
//资源数据
|
50
|
+
resObj:{},
|
51
|
+
//资源数据列表
|
52
|
+
resoptions:[],
|
53
|
+
//选中资源数据
|
54
|
+
selectres: [],
|
55
|
+
}
|
56
|
+
},
|
57
|
+
ready () {
|
58
|
+
//获取资源列表
|
59
|
+
this.getResList()
|
60
|
+
},
|
61
|
+
methods:{
|
62
|
+
//树形结构变成list
|
63
|
+
findById(val) {
|
64
|
+
if(val){
|
65
|
+
if(this.checkidres(val)){
|
66
|
+
this.treetoList(val,'')
|
67
|
+
}else if(val.children.length>0){
|
68
|
+
for (let value of val.children) {
|
69
|
+
this.findById(value)
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
},
|
74
|
+
//树形结构变成list
|
75
|
+
treetoList(val,parentname) {
|
76
|
+
for (let value of val.children) {
|
77
|
+
this.ergodicList(value,parentname)
|
78
|
+
}
|
79
|
+
},
|
80
|
+
//找到跟节点
|
81
|
+
ergodicList (val,parentname) {
|
82
|
+
if(val.children.length > 0 ){
|
83
|
+
if (val.name !== '组织机构' && parentname !== '资源管理'){
|
84
|
+
this.resoptions.push({label: parentname === '组织机构' ? val.name : val.name+' - '+parentname, value: val.id})
|
85
|
+
}
|
86
|
+
parentname=parentname+val.name
|
87
|
+
this.treetoList(val,parentname)
|
88
|
+
}else {
|
89
|
+
//截取组织机构【组织机构】
|
90
|
+
if(this.restype=='organization'){
|
91
|
+
parentname=parentname.replace("组织机构","")
|
92
|
+
this.resoptions.push({label: val.name+' - '+parentname, value: val.id})
|
93
|
+
} else if (this.restype == 'department') {
|
94
|
+
if (this.specialquery) {
|
95
|
+
if (val.f_dep_type === '营业厅') {
|
96
|
+
this.resoptions.push({label: val.name, value: val.id})
|
97
|
+
}
|
98
|
+
} else {
|
99
|
+
if (this.$login.r.includes('部门默认选中') && this.$login.r.includes('限制查询当前部门')) {
|
100
|
+
if (val.id == this.initresid[0]) {
|
101
|
+
this.resoptions.push({label: val.name, value: val.id})
|
102
|
+
}
|
103
|
+
} else {
|
104
|
+
this.resoptions.push({label: val.name, value: val.id})
|
105
|
+
}
|
106
|
+
}
|
107
|
+
} else {
|
108
|
+
this.resoptions.push({label: val.name, value: val.id})
|
109
|
+
}
|
110
|
+
}
|
111
|
+
},
|
112
|
+
//检查id是否存在
|
113
|
+
checkidres(val){
|
114
|
+
let flag=false
|
115
|
+
//如果没传值得话 不过滤
|
116
|
+
if(this.parentresid.length==0&&this.restype=='organization'){
|
117
|
+
flag=true
|
118
|
+
}
|
119
|
+
this.parentresid.forEach((item) => {
|
120
|
+
if(item==val.id){
|
121
|
+
flag=true
|
122
|
+
}
|
123
|
+
})
|
124
|
+
return flag;
|
125
|
+
},
|
126
|
+
//资源改变
|
127
|
+
resChange(val){
|
128
|
+
let orgnames=[]
|
129
|
+
Object.keys(this.resoptions).forEach((key) => {
|
130
|
+
if(this.selectres.includes(this.resoptions[key].value))
|
131
|
+
orgnames.push(this.resoptions[key].label)
|
132
|
+
})
|
133
|
+
console.log('资源改变。。', val, orgnames)
|
134
|
+
this.$dispatch('res-select', this.selectres, orgnames)
|
135
|
+
},
|
136
|
+
//获取资源数据
|
137
|
+
async getResList() {
|
138
|
+
|
139
|
+
let http = new HttpResetClass()
|
140
|
+
|
141
|
+
let req = await http.load('POST', '/rs/search', {data: {
|
142
|
+
source: `tool.getFullTree(this.getRights().where(row.getType()==$${this.restype}$))`,
|
143
|
+
userid: this.$login.f.id
|
144
|
+
}}, {resolveMsg: null, rejectMsg: '获取组织结构数据出错'})
|
145
|
+
this.resObj=req.data[0]
|
146
|
+
this.dealdata()
|
147
|
+
},
|
148
|
+
dealdata(){
|
149
|
+
this.resoptions=[]
|
150
|
+
this.findById(this.resObj);
|
151
|
+
//赋值资源数据
|
152
|
+
let arryselect=[]
|
153
|
+
this.resoptions.forEach((item) => {
|
154
|
+
if(this.initresid.length>0){
|
155
|
+
this.initresid.forEach((init) => {
|
156
|
+
if(item.value==init){
|
157
|
+
arryselect.push(item.value)
|
158
|
+
}
|
159
|
+
})
|
160
|
+
}
|
161
|
+
})
|
162
|
+
//赋值资源选中初始值
|
163
|
+
this.selectres=arryselect
|
164
|
+
}
|
165
|
+
},
|
166
|
+
watch: {
|
167
|
+
//监听初始化资源id
|
168
|
+
'initresid.length'() {
|
169
|
+
this.dealdata()
|
170
|
+
},
|
171
|
+
//监听初始化资源id
|
172
|
+
'parentresid'() {
|
173
|
+
this.dealdata()
|
174
|
+
},
|
175
|
+
initresid: {
|
176
|
+
handler(newVal, oldVal) {
|
177
|
+
// 避免重复触发
|
178
|
+
if (JSON.stringify(newVal) === JSON.stringify(oldVal)) {
|
179
|
+
return;
|
180
|
+
}
|
181
|
+
this.dealdata();
|
182
|
+
},
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}
|
186
|
+
</script>
|
package/src/project/State.js
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
import { TreeList } from 'vue-client'
|
2
|
-
|
3
|
-
export default class {
|
4
|
-
constructor () {
|
5
|
-
this.selected = null
|
6
|
-
// 左侧项目树
|
7
|
-
this.projects = new TreeList('/rs/sql/project.sql')
|
8
|
-
}
|
9
|
-
|
10
|
-
select (selected) {
|
11
|
-
this.selected = selected
|
12
|
-
}
|
13
|
-
|
14
|
-
getSelected () {
|
15
|
-
return this.selected
|
16
|
-
}
|
17
|
-
}
|
1
|
+
import { TreeList } from 'vue-client'
|
2
|
+
|
3
|
+
export default class {
|
4
|
+
constructor () {
|
5
|
+
this.selected = null
|
6
|
+
// 左侧项目树
|
7
|
+
this.projects = new TreeList('/rs/sql/project.sql')
|
8
|
+
}
|
9
|
+
|
10
|
+
select (selected) {
|
11
|
+
this.selected = selected
|
12
|
+
}
|
13
|
+
|
14
|
+
getSelected () {
|
15
|
+
return this.selected
|
16
|
+
}
|
17
|
+
}
|