safecheck-client 3.0.33-18 → 3.0.33-19

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.
@@ -1,172 +1,172 @@
1
- <template>
2
- <div style="width: 100%;height: 100%">
3
- <div class="col-sm-6 form-group" style="margin-bottom: 0px">
4
- <label class="font_normal_body">公&emsp;&emsp;司</label>
5
- <right-tree-safe :width="leftWidth" @re-res="getRes" :resobjprop.sync="resobjprop"></right-tree-safe>
6
- </div>
7
- <div class="col-sm-6 form-group" style="margin-bottom: 0px">
8
- <label class="font_normal_body">{{ roleLable }}</label>
9
- <v-select :value="selVal" v-model='selVal'
10
- :value-single="!valueMultiple"
11
- class="select_list select"
12
- :options='users' :placeholder='roleName'
13
- :close-on-select = 'valueClose'
14
- :multiple="valueMultiple"
15
- :width="rightWidth"
16
- @change="valuechange">
17
- </v-select>
18
- </div>
19
- </div>
20
- </template>
21
-
22
- <script>
23
- import {HttpResetClass} from 'vue-client'
24
-
25
- export default {
26
- name: "RoleSelector",
27
- props: {
28
-
29
- valueMultiple: {
30
- type: Boolean,
31
- default: false
32
- },
33
- roleName: {
34
- type: String,
35
- default: '安检员'
36
- },
37
- roleLable: {
38
- type: String,
39
- default: '安检员'
40
- },
41
- leftWidth: {
42
- type: String,
43
- default: '60%'
44
- },
45
- rightWidth: {
46
- type: String,
47
- default: '60%'
48
- },
49
- value: {
50
- default: ''
51
- },
52
- resobjprop: {
53
- default: {}
54
- },
55
- valueClose: {
56
- type: Boolean,
57
- default: true
58
- }
59
- },
60
- data() {
61
- return {
62
- // source: `tool.getChildrenOfResName($${this.roleName}$)`,
63
- source: `root.getResourceById($${this.$login.f.orgid}$,$organization$).getSpecialResByType($user$).where(row.getAttributes().get($rolestr$).indexOf($${this.roleName}$) != -1)`,
64
- allUsers: [],
65
- rootNode:'',
66
- users: [],
67
- selVal: '',
68
- organizationname:this.$login.f.organizationname,
69
- resids: [],
70
- changeval: ''
71
- }
72
- },
73
- watch: {
74
- 'value'(val) {
75
- console.log("969696", val)
76
- if (val) {
77
- if (this.valueMultiple) {
78
-
79
- } else {
80
- this.selVal = val
81
- }
82
-
83
- }
84
- }
85
- },
86
- async ready() {
87
- await this.search()
88
- console.log('this.resids',this.resids)
89
- await this.filterUser(this.resids)
90
- },
91
- methods: {
92
- async search() {
93
- let http = new HttpResetClass()
94
- const res = await http.load('POST', '/rs/search', {
95
- data: {
96
- source: this.source,
97
- userid: this.$login.f.id
98
- }
99
- }, {resolveMsg: null, rejectMsg: null})
100
- this.allUsers = res.data
101
- },
102
- valuechange(val) {
103
- console.log(`val instanceof Array======${!val instanceof Array}`)
104
- if ((typeof val === 'object' && !val instanceof Array) || (val instanceof Event)) {
105
- return
106
- }
107
- if (this.valueMultiple && Array.isArray(val)) {
108
- if (val && val.length > 0) {
109
- let valuesele = `(`
110
- for (let i = 0; i < val.length; i++) {
111
- valuesele += `'${val[i]}',`
112
- }
113
- this.value = valuesele.substring(0, valuesele.length - 1) + ')'
114
- } else {
115
- this.value = ''
116
- }
117
- } else {
118
- this.value = val
119
- }
120
- // this.changeval = val
121
- },
122
- getRes(obj) {
123
- if(obj.orgobj.length>1){
124
- this.rootNode='组织机构'
125
- }
126
- this.resids = obj.resids
127
- this.organizationname = obj.res[0]
128
- this.filterUser(this.resids)
129
- this.$dispatch('re-res', obj)
130
- },
131
- async filterUser(resids) {
132
- // 处理第一次进入页面值异常问题
133
- if (resids.length > 0 && typeof resids[0] == "object") {
134
- resids = resids[0]
135
- }
136
- if (resids[0]) {
137
- this.source = `root.getResourceById($${resids[0]}$,$organization$).getSpecialResByType($user$).where(row.getAttributes().get($rolestr$).indexOf($${this.roleName}$) != -1)`
138
- await this.search()
139
- }
140
- this.users = []
141
- if(this.rootNode=='组织机构'){
142
- this.allUsers.forEach(user => {
143
- this.users.push({label: user.name, value: user.name})
144
- })
145
- } else{
146
- this.allUsers.forEach(user => {
147
- if (this.organizationname == user.organizationname || !user.organizationname){
148
- this.users.push({label: user.name, value: user.name})
149
- }
150
- })
151
- }
152
- if (!this.valueMultiple && this.users.length > 0) {
153
- this.users = [{label: '全部', value: ''}, ...this.users]
154
- }
155
- let temp = []
156
- this.users = this.users.filter(item => {
157
- if (!temp.includes(item.label)) {
158
- temp.push(item.label)
159
- return true
160
- }
161
- return false
162
- })
163
- this.$emit('alluser', this.allUsers)
164
- //tag
165
- }
166
- }
167
- }
168
- </script>
169
-
170
- <style scoped>
171
-
172
- </style>
1
+ <template>
2
+ <div style="width: 100%;height: 100%">
3
+ <div class="col-sm-6 form-group" style="margin-bottom: 0px">
4
+ <label class="font_normal_body">公&emsp;&emsp;司</label>
5
+ <right-tree-safe :width="leftWidth" @re-res="getRes" :resobjprop.sync="resobjprop"></right-tree-safe>
6
+ </div>
7
+ <div class="col-sm-6 form-group" style="margin-bottom: 0px">
8
+ <label class="font_normal_body">{{ roleLable }}</label>
9
+ <v-select :value="selVal" v-model='selVal'
10
+ :value-single="!valueMultiple"
11
+ class="select_list select"
12
+ :options='users' :placeholder='roleName'
13
+ :close-on-select = 'valueClose'
14
+ :multiple="valueMultiple"
15
+ :width="rightWidth"
16
+ @change="valuechange">
17
+ </v-select>
18
+ </div>
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ import {HttpResetClass} from 'vue-client'
24
+
25
+ export default {
26
+ name: "RoleSelector",
27
+ props: {
28
+
29
+ valueMultiple: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ roleName: {
34
+ type: String,
35
+ default: '安检员'
36
+ },
37
+ roleLable: {
38
+ type: String,
39
+ default: '安检员'
40
+ },
41
+ leftWidth: {
42
+ type: String,
43
+ default: '60%'
44
+ },
45
+ rightWidth: {
46
+ type: String,
47
+ default: '60%'
48
+ },
49
+ value: {
50
+ default: ''
51
+ },
52
+ resobjprop: {
53
+ default: {}
54
+ },
55
+ valueClose: {
56
+ type: Boolean,
57
+ default: true
58
+ }
59
+ },
60
+ data() {
61
+ return {
62
+ // source: `tool.getChildrenOfResName($${this.roleName}$)`,
63
+ source: `root.getResourceById($${this.$login.f.orgid}$,$organization$).getSpecialResByType($user$).where(row.getAttributes().get($rolestr$).indexOf($${this.roleName}$) != -1)`,
64
+ allUsers: [],
65
+ rootNode:'',
66
+ users: [],
67
+ selVal: '',
68
+ organizationname:this.$login.f.organizationname,
69
+ resids: [],
70
+ changeval: ''
71
+ }
72
+ },
73
+ watch: {
74
+ 'value'(val) {
75
+ console.log("969696", val)
76
+ if (val) {
77
+ if (this.valueMultiple) {
78
+
79
+ } else {
80
+ this.selVal = val
81
+ }
82
+
83
+ }
84
+ }
85
+ },
86
+ async ready() {
87
+ await this.search()
88
+ console.log('this.resids',this.resids)
89
+ await this.filterUser(this.resids)
90
+ },
91
+ methods: {
92
+ async search() {
93
+ let http = new HttpResetClass()
94
+ const res = await http.load('POST', '/rs/search', {
95
+ data: {
96
+ source: this.source,
97
+ userid: this.$login.f.id
98
+ }
99
+ }, {resolveMsg: null, rejectMsg: null})
100
+ this.allUsers = res.data
101
+ },
102
+ valuechange(val) {
103
+ console.log(`val instanceof Array======${!val instanceof Array}`)
104
+ if ((typeof val === 'object' && !val instanceof Array) || (val instanceof Event)) {
105
+ return
106
+ }
107
+ if (this.valueMultiple && Array.isArray(val)) {
108
+ if (val && val.length > 0) {
109
+ let valuesele = `(`
110
+ for (let i = 0; i < val.length; i++) {
111
+ valuesele += `'${val[i]}',`
112
+ }
113
+ this.value = valuesele.substring(0, valuesele.length - 1) + ')'
114
+ } else {
115
+ this.value = ''
116
+ }
117
+ } else {
118
+ this.value = val
119
+ }
120
+ // this.changeval = val
121
+ },
122
+ getRes(obj) {
123
+ if(obj.orgobj.length>1){
124
+ this.rootNode='组织机构'
125
+ }
126
+ this.resids = obj.resids
127
+ this.organizationname = obj.res[0]
128
+ this.filterUser(this.resids)
129
+ this.$dispatch('re-res', obj)
130
+ },
131
+ async filterUser(resids) {
132
+ // 处理第一次进入页面值异常问题
133
+ if (resids.length > 0 && typeof resids[0] == "object") {
134
+ resids = resids[0]
135
+ }
136
+ if (resids[0]) {
137
+ this.source = `root.getResourceById($${resids[0]}$,$organization$).getSpecialResByType($user$).where(row.getAttributes().get($rolestr$).indexOf($${this.roleName}$) != -1)`
138
+ await this.search()
139
+ }
140
+ this.users = []
141
+ if(this.rootNode=='组织机构'){
142
+ this.allUsers.forEach(user => {
143
+ this.users.push({label: user.name, value: user.name})
144
+ })
145
+ } else{
146
+ this.allUsers.forEach(user => {
147
+ if (this.organizationname == user.organizationname || !user.organizationname){
148
+ this.users.push({label: user.name, value: user.name})
149
+ }
150
+ })
151
+ }
152
+ if (!this.valueMultiple && this.users.length > 0) {
153
+ this.users = [{label: '全部', value: ''}, ...this.users]
154
+ }
155
+ let temp = []
156
+ this.users = this.users.filter(item => {
157
+ if (!temp.includes(item.label)) {
158
+ temp.push(item.label)
159
+ return true
160
+ }
161
+ return false
162
+ })
163
+ this.$emit('alluser', this.allUsers)
164
+ //tag
165
+ }
166
+ }
167
+ }
168
+ </script>
169
+
170
+ <style scoped>
171
+
172
+ </style>