safecheck-client 3.0.33-135 → 3.0.33-136

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,348 @@
1
+ <template>
2
+ <dropdown :model='model' class="auto" id="res-tree" v-if="!islist" v-el:dropdown :style="{width:width}">
3
+ <button type="button" class="btn btn-default dropdown-toggle select-style" data-toggle="dropdown" style="width: 100%">
4
+ <span class='btn-content' :style="{textOverflow:'ellipsis',overflow: 'hidden'}">{{ orgnames }}</span>
5
+ <span class="caret"></span>
6
+ </button>
7
+ <div class="dropdown-menu auto" style="width:auto;max-height: 500px;overflow: auto" >
8
+ <input type="text" placeholder="Search"
9
+ placeholder='请输入'
10
+ slot="dropdown-menu"
11
+ v-model="searchText"
12
+ class="form-control" autocomplete="off"
13
+ @keydown.enter="buluer(searchText)">
14
+ <tree :filter="strsign" :model='model' v-ref:tree :is-click="false" role="menu">
15
+ <span partial>
16
+ <span class="glyphicon glyphicon-chevron-down" v-show="row.open&&row.data.children.length>0" style="color:balck;"></span>
17
+ <span class="glyphicon glyphicon-chevron-right" v-show="!row.open&&row.data.children.length>0" style="color:balck;"></span>
18
+ <span class="RightTreeCanSelect" v-if="row.data.hasright" @click.stop="$parent.$parent.$parent.selectclick(row.data)">{{row.data.name}}</span>
19
+ <span class="RightTreeCanNotSelect" v-else>{{row.data.name}}</span>
20
+ <span class="glyphicon glyphicon-ok " v-if="$parent.$parent.$parent.isSelect(row.data.id)" style="color:balck;"></span>
21
+ </span>
22
+ </tree>
23
+ </div>
24
+
25
+ </dropdown>
26
+ <v-select v-if="islist"
27
+ placeholder='请选择'
28
+ :options='childrenOptions'
29
+ @change="selectclick"
30
+ :value-single="true"
31
+ close-on-select></v-select>
32
+ </template>
33
+ <script>
34
+ import Vue from 'vue';
35
+ import co from 'co'
36
+ import { PagedList, HttpResetClass } from 'vue-client'
37
+ import * as ldapHelper from '../../../utils/LdapHelper'
38
+ let saveGen = function * (self) {
39
+ //获取分公司树
40
+ let data = {
41
+ source: self.source,
42
+ userid: self.userid
43
+ }
44
+ // if(self.$treeorg==null || (self.$treeorg!=null&&self.$treeorg.length==0)){
45
+ let http = new HttpResetClass()
46
+ let ret = yield http.load('POST', `${self.Url}/rs/search`, data, {resolveMsg: null, rejectMsg: null})
47
+ // 去掉前面的两层节点
48
+ ret.data[0].children[0].children.forEach((item) => {
49
+ self.model.push(item)
50
+ })
51
+ Vue.$treeorg = Vue.prototype.$treeorg = self.model;
52
+ // }
53
+ //if(self.$treeorg!=null){
54
+ // self.model = self.$treeorg;
55
+ //}
56
+ // 给资源添加父关系
57
+ ldapHelper.procParent(self.model)
58
+ // 树转列
59
+ // if (self.islist) {
60
+ // self.treetoList(self.model)
61
+ // }
62
+ if(self.initresid.length>0){
63
+ if(self.initresid[0] == ''){
64
+ self.initresid[0] = self.$login.f.f_orgids.substring(0,this.$login.f.f_orgids.length-1);
65
+ }
66
+ }else{
67
+ self.initresid = [];
68
+ self.initresid[0] = self.$login.f.f_orgids.substring(0,this.$login.f.f_orgids.length-1);
69
+ }
70
+ if(self.initresid&&self.initresid.length>0){
71
+ self.isselect = false;
72
+ self.initTreetoList(self.model)
73
+ self.initregion(self.childrenOptions)
74
+ self.childrenOptions.forEach((item) => {
75
+ if(item.id == null && item.value !=null ){
76
+ item = item.value
77
+ }
78
+ if(item.id==self.initresid[0]){
79
+ //默认加载如果已选中的和传入参数相等会取消选择,这种操作不应该被允许
80
+ if(self.orgids==item.id){
81
+ self.initdataone(item);
82
+ return;
83
+ }
84
+ self.selectclick(item);
85
+ self.isselect = true;
86
+ return;
87
+ }
88
+ })
89
+ //如果没有找到公司,说明是选择的是大区
90
+ if(!self.isselect){
91
+ self.childrenregionOption.forEach((item) => {
92
+ if(item.id == null && item.value !=null ){
93
+ item = item.value;
94
+ }
95
+ if(item.id==self.initresid[0]){
96
+ //默认加载如果已选中的和传入参数相等会取消选择,这种操作不应该被允许
97
+ if(self.orgids==item.id){
98
+ self.initdataone(item);
99
+ return;
100
+ }
101
+ self.selectclick(item);
102
+ return;
103
+ }
104
+ })
105
+ }
106
+ }
107
+ //self.selectRes()
108
+ }
109
+ export default {
110
+ title: '资源树',
111
+ props: {
112
+ searchText:'',
113
+ strsign:'',
114
+ source: {
115
+ type: String,
116
+ require: true,
117
+ default:`tool.getFullTree(this.getRights().where(row.getType() == $organization$))`
118
+ },
119
+ //资源初始化数据
120
+ initresid: {
121
+ type: Array,
122
+ default() { return [] },
123
+ },
124
+ resid: {
125
+ },
126
+ resobjprop:"",
127
+ islist: {
128
+ type: Boolean,
129
+ default: false
130
+ },
131
+ //是否有查看上级的权限
132
+ Url:{
133
+ type: String,
134
+ default:''
135
+ },
136
+ width:{
137
+ type:String,
138
+ default:'60%'
139
+ }
140
+ },
141
+ data () {
142
+ return {
143
+ resobj:{res:this.$login.f.f_fengongsi, resids:this.$login.f.f_orgids.substring(0,this.$login.f.f_orgids.length-1)},
144
+ userid: this.$login.f.id,
145
+ resname:[this.$login.f.f_fengongsi],
146
+ orgnames : "请选择",
147
+ //单选点击 返回所有子
148
+ orgids : null,
149
+ orgobj:null,
150
+ model: [
151
+
152
+ ],
153
+ childrenOptions: [],
154
+ childrenregionOption:[],
155
+ isselect: false
156
+ }
157
+ },
158
+ methods: {
159
+ selectRes () {
160
+ let newobj={
161
+ "res": [this.resname],
162
+ "resids": [this.orgids],
163
+ }
164
+ this.$emit('re-res', newobj)
165
+ },
166
+ //树形结构变成list
167
+ initTreetoList(val) {
168
+ for (let value of val) {
169
+ this.initErgodicList(value)
170
+ }
171
+ },
172
+ //找到跟节点
173
+ initErgodicList (val) {
174
+ if(val.children.length > 0){
175
+ this.childrenOptions.push(val)
176
+ this.treetoList(val.children)
177
+ }else{
178
+ this.childrenOptions.push(val)
179
+ }
180
+ },
181
+ initregion(val){
182
+ if(val ==null ) return;
183
+ val.forEach((item)=>{
184
+ if(item.name != null){
185
+ if(item.name.includes("公司")){
186
+ return;
187
+ }else{
188
+ this.initregion(item.children)
189
+ this.childrenregionOption.push({label:"",value:item})
190
+ //return item;
191
+ }
192
+ }else{
193
+ return;
194
+ }
195
+ })
196
+
197
+ },
198
+ async buluer (val) {
199
+ this.strsign=val
200
+ await new Promise(resolve => {
201
+ this.$nextTick(() => {
202
+ resolve()
203
+ })
204
+ })
205
+ },
206
+ //点击资源的方法
207
+ selectclick (row) {
208
+ if(this.orgids==row.id){
209
+ //取消点击
210
+ this.orgnames="请选择"
211
+ this.orgids=null
212
+ this.orgobj=null
213
+ let newobj={
214
+ "res": [],
215
+ "resids": [],
216
+ "orgobj": [],
217
+ }
218
+ this.$emit('re-res', newobj)
219
+ }else{
220
+ //点中点击
221
+ this.orgnames=row.name
222
+ this.orgids=row.id
223
+ this.orgobj=row
224
+ let objs=[]
225
+ let objids=[]
226
+ let objnames=[]
227
+ this.addResChild(row,objs)
228
+ objs.forEach((item) => {
229
+ objids.push(item.id)
230
+ objnames.push(item.name)
231
+ })
232
+ let newobj={
233
+ "res": objnames,
234
+ "resids": objids,
235
+ "orgobj": objs,
236
+ }
237
+ this.$emit('re-res', newobj)
238
+ }
239
+ },
240
+ initdataone(row){
241
+ //点中点击
242
+ this.orgnames=row.name
243
+ this.orgids=row.id
244
+ this.orgobj=row
245
+ let objs=[]
246
+ let objids=[]
247
+ let objnames=[]
248
+ this.addResChild(row,objs)
249
+ objs.forEach((item) => {
250
+ objids.push(item.id)
251
+ objnames.push(item.name)
252
+ })
253
+ let newobj={
254
+ "res": objnames,
255
+ "resids": objids,
256
+ "orgobj": objs,
257
+ }
258
+ this.$emit('re-res', newobj)
259
+ },
260
+ addResChild(val,objs){
261
+ objs.push(val)
262
+ if(val.children && val.children.length>0){
263
+ Object.keys(val.children).forEach((key) => {
264
+ this.addResChild(val.children[key],objs)
265
+ })
266
+ }
267
+ return objs
268
+ },
269
+ //检查是否显示对勾
270
+ isSelect(val) {
271
+ if(this.orgids==val){
272
+ return true
273
+ }else{
274
+ return false
275
+ }
276
+ },
277
+ //树形结构变成list
278
+ treetoList(val) {
279
+ for (let value of val) {
280
+ this.ergodicList(value)
281
+ }
282
+ },
283
+ //找到跟节点
284
+ ergodicList (val) {
285
+ val.children.length > 0 ? this.treetoList(val.children) : this.childrenOptions.push({label: val.name, value: val})
286
+ },
287
+ //处理显示默认值
288
+ dealResObj (val) {
289
+ try{
290
+ var arr=val.res.split(".")
291
+ //截取最后一个分公司名字
292
+ this.resname=arr[arr.length-1].toString()
293
+ this.orgnames=arr[arr.length-1].toString()
294
+ this.resid = val.resids
295
+ this.orgids = val.resids
296
+ }catch (e){
297
+ this.resname='请选择组织'
298
+ }
299
+ },
300
+ judgBoundary(){
301
+ //判断是否超出边界,超出移动
302
+ if(document.documentElement.offsetWidth< this.$els.dropdown.getBoundingClientRect().right){
303
+ this.left = document.documentElement.offsetWidth - this.$els.dropdown.getBoundingClientRect().right - 25
304
+ }
305
+ }
306
+ },
307
+ events: {
308
+
309
+ },
310
+ ready () {
311
+ this.dealResObj (this.resobj)
312
+ let gen = saveGen(this)
313
+ return co(gen)
314
+ },
315
+ watch: {
316
+ 'resobjprop'(){
317
+ //tag
318
+ this.dealResObj (this.resobjprop)
319
+ }
320
+ }
321
+ }
322
+ </script>
323
+ <style lang="less">
324
+ #res-tree {
325
+ .list-group-item {
326
+ background-color: #FFF;
327
+ color: #000;
328
+ padding: 5px 10px;
329
+ border:0px;
330
+ white-space: nowrap;
331
+ }
332
+ }
333
+ #res-tree .list-group {
334
+ width: auto;
335
+ min-width: 100%;
336
+ }
337
+ .hide-text-overflow{
338
+ overflow: hidden;
339
+ text-overflow: ellipsis
340
+ }
341
+ .select-style {
342
+ border: 0px;
343
+ /*border-bottom: 2px solid #C9CCCF;*/
344
+ border: 1px solid #93B2D3;
345
+ border-radius: 0px;
346
+ color: #555;
347
+ }
348
+ </style>
@@ -0,0 +1,160 @@
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
+ valueMultiple: {
29
+ type: Boolean,
30
+ default: false
31
+ },
32
+ roleName: {
33
+ type: String,
34
+ default: '安检员'
35
+ },
36
+ roleLable: {
37
+ type: String,
38
+ default: '安检员'
39
+ },
40
+ leftWidth: {
41
+ type: String,
42
+ default: '60%'
43
+ },
44
+ rightWidth: {
45
+ type: String,
46
+ default: '60%'
47
+ },
48
+ value: {
49
+ default: ''
50
+ },
51
+ resobjprop: {
52
+ default: {}
53
+ },
54
+ valueClose: {
55
+ type: Boolean,
56
+ default: true
57
+ }
58
+ },
59
+ data() {
60
+ return {
61
+ source: `tool.getChildrenOfResName($${this.roleName}$)`,
62
+ //source: `root.getResourceById($${this.$login.f.f_orgids.substring(0,this.$login.f.f_orgids.length-1)}$,$organization$).getSpecialResByType($user$).where(row.getAttributes().get($rolesnames$).indexOf($${this.roleName}$) != -1)`,
63
+ allUsers: [],
64
+ users: [],
65
+ selVal: '',
66
+ organizationname:this.$login.f.f_fengongsi,
67
+ resids: [],
68
+ changeval: ''
69
+ }
70
+ },
71
+ watch: {
72
+ 'value'(val) {
73
+ console.log("969696", val)
74
+ if (val) {
75
+ if (this.valueMultiple) {
76
+
77
+ } else {
78
+ this.selVal = val
79
+ }
80
+
81
+ }
82
+ }
83
+ },
84
+ async ready() {
85
+ await this.search()
86
+ await this.filterUser(this.resids)
87
+ },
88
+ methods: {
89
+ async search() {
90
+ let http = new HttpResetClass()
91
+ const res = await http.load('POST', '/rs/search', {
92
+ data: {
93
+ source: this.source,
94
+ userid: this.$login.f.id
95
+ }
96
+ }, {resolveMsg: null, rejectMsg: null})
97
+ this.allUsers = res.data
98
+ },
99
+ valuechange(val) {
100
+ console.log(`val instanceof Array======${!val instanceof Array}`)
101
+ if ((typeof val === 'object' && !val instanceof Array) || (val instanceof Event)) {
102
+ return
103
+ }
104
+ if (this.valueMultiple && Array.isArray(val)) {
105
+ if (val && val.length > 0) {
106
+ let valuesele = `(`
107
+ for (let i = 0; i < val.length; i++) {
108
+ valuesele += `'${val[i]}',`
109
+ }
110
+ this.value = valuesele.substring(0, valuesele.length - 1) + ')'
111
+ } else {
112
+ this.value = ''
113
+ }
114
+ } else {
115
+ this.value = val
116
+ }
117
+ // this.changeval = val
118
+ },
119
+ getRes(obj) {
120
+ this.resids = obj.resids
121
+ this.organizationname = obj.res[0]
122
+ this.filterUser(this.resids)
123
+ this.$dispatch('re-res', obj)
124
+ },
125
+ async filterUser(resids) {
126
+ // 处理第一次进入页面值异常问题
127
+ if (resids.length > 0 && typeof resids[0] == "object") {
128
+ resids = resids[0]
129
+ }
130
+ if (resids[0]) {
131
+ this.source = `tool.getChildrenOfResName($${this.roleName}$)`
132
+ await this.search()
133
+ }
134
+ this.users = []
135
+ this.allUsers.forEach(user => {
136
+ if (this.organizationname == user.organizationname || !user.organizationname){
137
+ this.users.push({label: user.name, value: user.name})
138
+ }
139
+ })
140
+ if (!this.valueMultiple && this.users.length > 0) {
141
+ this.users = [{label: '全部', value: ''}, ...this.users]
142
+ }
143
+ let temp = []
144
+ this.users = this.users.filter(item => {
145
+ if (!temp.includes(item.label)) {
146
+ temp.push(item.label)
147
+ return true
148
+ }
149
+ return false
150
+ })
151
+ this.$emit('alluser', this.allUsers)
152
+ //tag
153
+ }
154
+ }
155
+ }
156
+ </script>
157
+
158
+ <style scoped>
159
+
160
+ </style>
@@ -1,13 +1,17 @@
1
- // 分公司特殊组件页面注册
2
- import Vue from "vue";
3
-
4
- //手机特殊目录注册到该文件中
5
- let specialComp = {
6
- // 计划安检
7
- 'plan-manage': (resolve) => { require(['./pc/PlanManage'], resolve) },
8
- }
9
- exports.specialComp = specialComp
10
-
11
-
12
-
13
-
1
+ // 分公司特殊组件页面注册
2
+ import Vue from "vue";
3
+
4
+ //手机特殊目录注册到该文件中
5
+ let specialComp = {
6
+ // 计划安检
7
+ 'plan-manage': (resolve) => { require(['./pc/PlanManage'], resolve) },
8
+ 'role-selector-safe': (resolve) => { require(['./pc/RoleSelector'], resolve) },
9
+ 'right-tree-safe': (resolve) => { require(['./pc/RightTreeSafe'], resolve) },
10
+ 'plan-chooser': (resolve) => { require(['./pc/PlanChooser'], resolve) },
11
+ 'paper-main': (resolve) => { require(['./pc/PaperList'], resolve) },
12
+ }
13
+ exports.specialComp = specialComp
14
+
15
+
16
+
17
+