system-clients 4.0.11 → 4.0.12

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.
@@ -0,0 +1,4 @@
1
+ // 分公司特殊组件页面注册
2
+ exports.specialComp = {
3
+ 'home-page': (resolve) => require(['./Main.vue'], resolve)
4
+ }
@@ -1,189 +1,189 @@
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() {
36
- return []
37
- },
38
- },
39
- //父层id
40
- parentresid: {
41
- type: Array,
42
- default() {
43
- return []
44
- },
45
- },
46
- mustselect: {
47
- type: Boolean,
48
- default: false
49
- },
50
- },
51
- data() {
52
- return {
53
- //资源数据
54
- resObj: {},
55
- //资源数据列表
56
- resoptions: [],
57
- //选中资源数据
58
- selectres: [],
59
- }
60
- },
61
- ready() {
62
- //获取资源列表
63
- this.getResList()
64
- },
65
- methods: {
66
- //树形结构变成list
67
- findById(val) {
68
- if (val) {
69
- if (this.checkidres(val)) {
70
- this.treetoList(val, '')
71
- } else if (val.children.length > 0) {
72
- for (let value of val.children) {
73
- this.findById(value)
74
- }
75
- }
76
- }
77
- },
78
- //树形结构变成list
79
- treetoList(val, parentname) {
80
- for (let value of val.children) {
81
- this.ergodicList(value, parentname)
82
- }
83
- },
84
- //找到跟节点
85
- ergodicList(val, parentname) {
86
- if (val.children.length > 0) {
87
- parentname = parentname + val.name
88
- this.treetoList(val, parentname)
89
- } else {
90
- //截取组织机构【组织机构】
91
- if (this.restype == 'organization') {
92
- parentname = parentname.replace("组织机构", "")
93
- this.resoptions.push({label: val.name + ' - ' + parentname, value: val.id})
94
- } else if (this.restype == 'department') {
95
- if (this.specialquery) {
96
- if (val.f_dep_type === '营业厅') {
97
- this.resoptions.push({label: val.name, value: val.id})
98
- }
99
- } else {
100
- if (this.$login.r.includes('部门默认选中') && this.$login.r.includes('限制查询当前部门')) {
101
- if (val.id == this.initresid[0]) {
102
- this.resoptions.push({label: val.name, value: val.id})
103
- }
104
- } else {
105
- this.resoptions.push({label: val.name, value: val.id})
106
- }
107
- }
108
- } else {
109
- this.resoptions.push({label: val.name, value: val.id})
110
- }
111
- }
112
- },
113
- //检查id是否存在
114
- checkidres(val) {
115
- let flag = false
116
- //如果没传值得话 不过滤
117
- if (this.parentresid.length == 0 && this.restype == 'organization') {
118
- flag = true
119
- }
120
- this.parentresid.forEach((item) => {
121
- if (item == val.id) {
122
- flag = true
123
- }
124
- })
125
- return flag;
126
- },
127
- //资源改变
128
- resChange(val) {
129
- let orgnames = []
130
- Object.keys(this.resoptions).forEach((key) => {
131
- if (this.selectres.includes(this.resoptions[key].value))
132
- orgnames.push(this.resoptions[key].label)
133
- })
134
- console.log('资源改变。。', val, orgnames)
135
- this.$dispatch('res-select', this.selectres, orgnames)
136
- },
137
- //获取资源数据
138
- async getResList() {
139
-
140
- let http = new HttpResetClass()
141
-
142
- let req = await http.load('POST', '/rs/search', {
143
- data: {
144
- source: `tool.getFullTree(this.getRights().where(row.getType()==$${this.restype}$))`,
145
- userid: this.$login.f.id
146
- }
147
- }, {resolveMsg: null, rejectMsg: '获取组织结构数据出错'})
148
- this.resObj = req.data[0]
149
- this.dealdata()
150
- },
151
- dealdata() {
152
- this.resoptions = []
153
- this.findById(this.resObj);
154
- //赋值资源数据
155
- let arryselect = []
156
- this.resoptions.forEach((item) => {
157
- if (this.initresid.length > 0) {
158
- this.initresid.forEach((init) => {
159
- if (item.value == init) {
160
- arryselect.push(item.value)
161
- }
162
- })
163
- }
164
- })
165
- //赋值资源选中初始值
166
- this.selectres = arryselect
167
- }
168
- },
169
- watch: {
170
- //监听初始化资源id
171
- 'initresid.length'() {
172
- this.dealdata()
173
- },
174
- //监听初始化资源id
175
- 'parentresid'() {
176
- this.dealdata()
177
- },
178
- initresid: {
179
- handler(newVal, oldVal) {
180
- // 避免重复触发
181
- if (JSON.stringify(newVal) === JSON.stringify(oldVal)) {
182
- return;
183
- }
184
- this.dealdata();
185
- },
186
- }
187
- }
188
- }
189
- </script>
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() {
36
+ return []
37
+ },
38
+ },
39
+ //父层id
40
+ parentresid: {
41
+ type: Array,
42
+ default() {
43
+ return []
44
+ },
45
+ },
46
+ mustselect: {
47
+ type: Boolean,
48
+ default: false
49
+ },
50
+ },
51
+ data() {
52
+ return {
53
+ //资源数据
54
+ resObj: {},
55
+ //资源数据列表
56
+ resoptions: [],
57
+ //选中资源数据
58
+ selectres: [],
59
+ }
60
+ },
61
+ ready() {
62
+ //获取资源列表
63
+ this.getResList()
64
+ },
65
+ methods: {
66
+ //树形结构变成list
67
+ findById(val) {
68
+ if (val) {
69
+ if (this.checkidres(val)) {
70
+ this.treetoList(val, '')
71
+ } else if (val.children.length > 0) {
72
+ for (let value of val.children) {
73
+ this.findById(value)
74
+ }
75
+ }
76
+ }
77
+ },
78
+ //树形结构变成list
79
+ treetoList(val, parentname) {
80
+ for (let value of val.children) {
81
+ this.ergodicList(value, parentname)
82
+ }
83
+ },
84
+ //找到跟节点
85
+ ergodicList(val, parentname) {
86
+ if (val.children.length > 0) {
87
+ parentname = parentname + val.name
88
+ this.treetoList(val, parentname)
89
+ } else {
90
+ //截取组织机构【组织机构】
91
+ if (this.restype == 'organization') {
92
+ parentname = parentname.replace("组织机构", "")
93
+ this.resoptions.push({label: val.name + ' - ' + parentname, value: val.id})
94
+ } else if (this.restype == 'department') {
95
+ if (this.specialquery) {
96
+ if (val.f_dep_type === '营业厅') {
97
+ this.resoptions.push({label: val.name, value: val.id})
98
+ }
99
+ } else {
100
+ if (this.$login.r.includes('部门默认选中') && this.$login.r.includes('限制查询当前部门')) {
101
+ if (val.id == this.initresid[0]) {
102
+ this.resoptions.push({label: val.name, value: val.id})
103
+ }
104
+ } else {
105
+ this.resoptions.push({label: val.name, value: val.id})
106
+ }
107
+ }
108
+ } else {
109
+ this.resoptions.push({label: val.name, value: val.id})
110
+ }
111
+ }
112
+ },
113
+ //检查id是否存在
114
+ checkidres(val) {
115
+ let flag = false
116
+ //如果没传值得话 不过滤
117
+ if (this.parentresid.length == 0 && this.restype == 'organization') {
118
+ flag = true
119
+ }
120
+ this.parentresid.forEach((item) => {
121
+ if (item == val.id) {
122
+ flag = true
123
+ }
124
+ })
125
+ return flag;
126
+ },
127
+ //资源改变
128
+ resChange(val) {
129
+ let orgnames = []
130
+ Object.keys(this.resoptions).forEach((key) => {
131
+ if (this.selectres.includes(this.resoptions[key].value))
132
+ orgnames.push(this.resoptions[key].label)
133
+ })
134
+ console.log('资源改变。。', val, orgnames)
135
+ this.$dispatch('res-select', this.selectres, orgnames)
136
+ },
137
+ //获取资源数据
138
+ async getResList() {
139
+
140
+ let http = new HttpResetClass()
141
+
142
+ let req = await http.load('POST', '/rs/search', {
143
+ data: {
144
+ source: `tool.getFullTree(this.getRights().where(row.getType()==$${this.restype}$))`,
145
+ userid: this.$login.f.id
146
+ }
147
+ }, {resolveMsg: null, rejectMsg: '获取组织结构数据出错'})
148
+ this.resObj = req.data[0]
149
+ this.dealdata()
150
+ },
151
+ dealdata() {
152
+ this.resoptions = []
153
+ this.findById(this.resObj);
154
+ //赋值资源数据
155
+ let arryselect = []
156
+ this.resoptions.forEach((item) => {
157
+ if (this.initresid.length > 0) {
158
+ this.initresid.forEach((init) => {
159
+ if (item.value == init) {
160
+ arryselect.push(item.value)
161
+ }
162
+ })
163
+ }
164
+ })
165
+ //赋值资源选中初始值
166
+ this.selectres = arryselect
167
+ }
168
+ },
169
+ watch: {
170
+ //监听初始化资源id
171
+ 'initresid.length'() {
172
+ this.dealdata()
173
+ },
174
+ //监听初始化资源id
175
+ 'parentresid'() {
176
+ this.dealdata()
177
+ },
178
+ initresid: {
179
+ handler(newVal, oldVal) {
180
+ // 避免重复触发
181
+ if (JSON.stringify(newVal) === JSON.stringify(oldVal)) {
182
+ return;
183
+ }
184
+ this.dealdata();
185
+ },
186
+ }
187
+ }
188
+ }
189
+ </script>
@@ -1,6 +1,6 @@
1
- // 分公司特殊组件页面注册
2
-
3
- let specialComp = {
4
- 'res-select': (resolve) => require(['./ResSelect.vue'], resolve)
5
- }
6
- exports.specialComp = specialComp
1
+ // 分公司特殊组件页面注册
2
+
3
+ let specialComp = {
4
+ 'res-select': (resolve) => require(['./ResSelect.vue'], resolve)
5
+ }
6
+ exports.specialComp = specialComp