system-phone 3.0.7 → 3.0.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "system-phone",
3
- "version": "3.0.7",
3
+ "version": "3.0.8",
4
4
  "description": "手机模块 前端组件",
5
5
  "author": "何宁社 <524395609@qq.com>",
6
6
  "license": "ISC",
@@ -1,268 +1,268 @@
1
- <template>
2
- <div class="nav-bgcolor">
3
- <div class="auto">
4
- <div class="row nav-bgcolor" >
5
- <div class="col-xs-6 manbiankuang" v-for="tab in tabs" @click="gotopage(tab.link,tab.name,tab.navigate)">
6
- <div class="badge" v-show="tab.name == '维修派发'">
7
- <div class="badge-content">{{ pointNum?pointNum:0 }}</div>
8
- </div>
9
- <img class="imgs" :src="imgback(tab.name)" alt="">
10
- <p></p>
11
- <p class="pagesfoot">{{tab.name}}</p>
12
- <!--<p class="pagesfoot">{{tab.name}}&nbsp;{{tab.icon}}</p>-->
13
- <p></p>
14
- </div>
15
- </div>
16
- <!--<div class="row" style="overflow:auto;">-->
17
- <!--<repair-first v-show="componentName == 'repair-first'" worktype="报修单" :sourcet="sourcet" tabname="维修待办" v-on:changesum="changesum"></repair-first>-->
18
- <!--<zhihuan-first v-show="componentName == 'zhihuan-first'" worktype="置换通气单" :sourcet="sourcet" tabname="置换待办" v-on:changesum="changesum"></zhihuan-first>-->
19
- <!--</div>-->
20
- </div>
21
- </div>
22
- </template>
23
-
24
- <script scoped>
25
- import Vue from 'vue'
26
- import {HttpResetClass} from "vue-client";
27
-
28
- export default {
29
- title: '在线业务导航',
30
- data () {
31
- return {
32
- titleName:'在线业务',
33
- isMenu:true,
34
- tabs: this.getTabs(),
35
- text: '导航组件this',
36
- beforeName: '在线业务',
37
- sourcet: '竖屏',
38
- pointNum: null
39
-
40
- }
41
- },
42
- ready () {
43
- // this.getModelSum()
44
- },
45
-
46
- methods: {
47
- //看去哪个页面
48
- getModelSum(){
49
- for(var i = 0;i<this.tabs.length;i++){
50
- if(this.tabs[i].link == 'readmeter-home' ){
51
- this.getZhihuan()
52
- }
53
- if(this.tabs[i].link == 'weiup-load' ){
54
- this.getRepair()
55
- }
56
- if(this.tabs[i].link == 'upload-page' ){
57
- this.getSafeCheck()
58
- }
59
- }
60
-
61
- },
62
- getRepair(){
63
- var _this = this;
64
- this.timeoutRepair = window.setInterval(function() {
65
- let result = _this.$androidUtil.path({'alias':'notUpload','data': {f_workorder_type: '报修单'}})
66
- if (result.code === 200) {
67
- console.log('查询得到的代办2' + JSON.stringify(result))
68
- var crv = {
69
- title: '维修上传',
70
- sum: result.data.length
71
- }
72
- _this.changesum(crv)
73
- }
74
- }, 6000)
75
- },
76
- getSafeCheck(){
77
- var _this = this;
78
- this.timeoutRepair = window.setInterval(function() {
79
- let result = _this.$androidUtil.path({'alias':'safecheckNotUpload','data': {}})
80
- if (result.code === 200) {
81
- console.log('查询得到的安检上传' + JSON.stringify(result))
82
- var crv = {
83
- title: '安检上传',
84
- sum: result.data.length
85
- }
86
- _this.changesum(crv)
87
- }
88
- }, 6000)
89
- },
90
- getZhihuan(){
91
- var _this = this;
92
- this.timeoutZhihuan = window.setInterval(function() {
93
- let result = {code:200}
94
- if (result.code === 200) {
95
- console.log('查询得到的代办2' + JSON.stringify(result))
96
- var crv = {
97
- title: '置换上传',
98
- sum: result.data.length
99
- }
100
- _this.changesum(crv)
101
- }
102
- }, 6000)
103
- },
104
- changesum(titdata){
105
- for(var i = 0;i<this.tabs.length;i++){
106
- if(this.tabs[i].name == titdata.title){
107
- this.tabs[i].icon = titdata.sum + '单'
108
- console.log(JSON.stringify(this.tabs[i].icon))
109
- return
110
- }
111
- }
112
- },
113
- getTabs(){
114
- this.getRepairNum()
115
- for(let funs in Vue.functions){
116
- if(Vue.functions[funs].link == 'online-manage'){
117
- return Vue.functions[funs].children
118
- }
119
- }
120
- },
121
- getRepairNum() {
122
- if (!Vue.android || !Vue.come || !Vue.come == 'tongchuan') {
123
- return
124
- }
125
- window.setInterval(function () {
126
- let condition = `1 = 1 and f_workorder_type = '报修单' and f_state = null `
127
- let val = {
128
- condition: {
129
- condition: condition,
130
- sign: '1 = 1'
131
- },
132
- userid: Vue.user.name
133
- }
134
- let http = new HttpResetClass()
135
- http.load('POST', `${this.$androidUtil.getProxyUrl()}/rs/path/operatorServiceAndroid`, {data: val}, {
136
- resolveMsg: null,
137
- rejectMsg: null
138
- }).then((res) => {
139
- this.pointNum = res.data.length
140
- })
141
- },10000)
142
- this.timeOutGetRepairNum()
143
- },
144
- timeOutGetRepairNum(){
145
- let condition = `1 = 1 and f_workorder_type = '报修单' and f_state = null `
146
- let val = {
147
- condition: {
148
- condition: condition,
149
- sign: '1 = 1'
150
- },
151
- userid: Vue.user.name
152
- }
153
- let http = new HttpResetClass()
154
- http.load('POST', `${this.$androidUtil.getProxyUrl()}/rs/path/operatorServiceAndroid`, {data: val}, {
155
- resolveMsg: null,
156
- rejectMsg: null
157
- }).then((res) => {
158
- this.pointNum = res.data.length
159
- })
160
- },
161
- imgback(val){
162
- return require('../assets/'+val+'.png')
163
- },
164
- // 返回主界面
165
- back(){
166
- this.titleName = '主界面'
167
- this.isMenu = true
168
-
169
- },
170
- gotopage(param,title,navigate) {
171
- console.log('进入子组件')
172
- var prpdata = {
173
- _this:this,
174
- title:title,
175
- safe:false
176
- }
177
- this.$dispatch('gotoson',prpdata)
178
- if(navigate){
179
- this.$goto('embbed-page', {domainName: navigate, title: title, compName: param, login: Vue.user})
180
- }else{
181
- this.$goto(param,{sourcet:'竖屏',tabname:title})
182
- }
183
- },
184
- mute () {
185
- HostApp.mute()
186
- }
187
- },
188
- }
189
- </script>
190
- <style lang="less">
191
- .badge-content {
192
- color: #fff;
193
- box-sizing: border-box;
194
- min-width: 8px;
195
- font-size: 9px;
196
- line-height: 12px;
197
- white-space: nowrap;
198
- font-weight: 400;
199
- text-align: center;
200
- }
201
-
202
- .badge {
203
- top: 6px;
204
- position: absolute;
205
- max-height: 13px;
206
- min-height: 8px;
207
- right: 0;
208
- display: inline-flex;
209
- vertical-align: middle;
210
- box-sizing: content-box;
211
- border-radius: 100px;
212
- background-color: red;
213
- }
214
-
215
- .tab-befor-img {
216
- content: '';
217
- background-size: 30px;
218
- display: inline-block;
219
- margin-right: 8px;
220
- height: 30px;
221
- width: 30px;
222
- vertical-align: -35%;
223
- }
224
- .pageskuang{
225
- vertical-align:middle;
226
- display:table-cell;
227
- width: 32%;
228
- top:-50%;
229
- margin-top: 1%;
230
- margin-left: 1%;
231
- border:1px solid #e3e3e3;
232
- text-align: center;
233
- background-color: #ffffff;
234
- }
235
- .pgesfoot{
236
- font-size: 14px;
237
- color: #666666;
238
- /* font-family: "Pingfhs";*/
239
- }
240
- .imgs{
241
- width: 35px;
242
- margin-top: 15px;
243
- }
244
- .pages-bgcolor{
245
- text-align: center;
246
- background-color: #f0f0ef;
247
- }
248
- img[src=""],img:not([src]){
249
- opacity: 0;
250
- border:none;
251
- visibility: hidden;
252
- max-width: none;
253
- }
254
-
255
- .manbiankuang {
256
- width: 44%;
257
- margin-top: 15px;
258
- margin-left: 4%;
259
- border: 1px solid #e3e3e3;
260
- border-radius: 10px 10px 10px 10px;
261
- text-align: center;
262
- background-color: #ffffff;
263
- }
264
-
265
- .nav-bgcolor {
266
- background-color: #ffffff;
267
- }
268
- </style>
1
+ <template>
2
+ <div class="nav-bgcolor">
3
+ <div class="auto">
4
+ <div class="row nav-bgcolor" >
5
+ <div class="col-xs-6 manbiankuang" v-for="tab in tabs" @click="gotopage(tab.link,tab.name,tab.navigate)">
6
+ <div class="badge" v-show="tab.name == '维修派发'">
7
+ <div class="badge-content">{{ pointNum?pointNum:0 }}</div>
8
+ </div>
9
+ <img class="imgs" :src="imgback(tab.name)" alt="">
10
+ <p></p>
11
+ <p class="pagesfoot">{{tab.name}}</p>
12
+ <!--<p class="pagesfoot">{{tab.name}}&nbsp;{{tab.icon}}</p>-->
13
+ <p></p>
14
+ </div>
15
+ </div>
16
+ <!--<div class="row" style="overflow:auto;">-->
17
+ <!--<repair-first v-show="componentName == 'repair-first'" worktype="报修单" :sourcet="sourcet" tabname="维修待办" v-on:changesum="changesum"></repair-first>-->
18
+ <!--<zhihuan-first v-show="componentName == 'zhihuan-first'" worktype="置换通气单" :sourcet="sourcet" tabname="置换待办" v-on:changesum="changesum"></zhihuan-first>-->
19
+ <!--</div>-->
20
+ </div>
21
+ </div>
22
+ </template>
23
+
24
+ <script scoped>
25
+ import Vue from 'vue'
26
+ import {HttpResetClass} from "vue-client";
27
+
28
+ export default {
29
+ title: '在线业务导航',
30
+ data () {
31
+ return {
32
+ titleName:'在线业务',
33
+ isMenu:true,
34
+ tabs: this.getTabs(),
35
+ text: '导航组件this',
36
+ beforeName: '在线业务',
37
+ sourcet: '竖屏',
38
+ pointNum: null
39
+
40
+ }
41
+ },
42
+ ready () {
43
+ // this.getModelSum()
44
+ },
45
+
46
+ methods: {
47
+ //看去哪个页面
48
+ getModelSum(){
49
+ for(var i = 0;i<this.tabs.length;i++){
50
+ if(this.tabs[i].link == 'readmeter-home' ){
51
+ this.getZhihuan()
52
+ }
53
+ if(this.tabs[i].link == 'weiup-load' ){
54
+ this.getRepair()
55
+ }
56
+ if(this.tabs[i].link == 'upload-page' ){
57
+ this.getSafeCheck()
58
+ }
59
+ }
60
+
61
+ },
62
+ getRepair(){
63
+ var _this = this;
64
+ this.timeoutRepair = window.setInterval(function() {
65
+ let result = _this.$androidUtil.path({'alias':'notUpload','data': {f_workorder_type: '报修单'}})
66
+ if (result.code === 200) {
67
+ console.log('查询得到的代办2' + JSON.stringify(result))
68
+ var crv = {
69
+ title: '维修上传',
70
+ sum: result.data.length
71
+ }
72
+ _this.changesum(crv)
73
+ }
74
+ }, 6000)
75
+ },
76
+ getSafeCheck(){
77
+ var _this = this;
78
+ this.timeoutRepair = window.setInterval(function() {
79
+ let result = _this.$androidUtil.path({'alias':'safecheckNotUpload','data': {}})
80
+ if (result.code === 200) {
81
+ console.log('查询得到的安检上传' + JSON.stringify(result))
82
+ var crv = {
83
+ title: '安检上传',
84
+ sum: result.data.length
85
+ }
86
+ _this.changesum(crv)
87
+ }
88
+ }, 6000)
89
+ },
90
+ getZhihuan(){
91
+ var _this = this;
92
+ this.timeoutZhihuan = window.setInterval(function() {
93
+ let result = {code:200}
94
+ if (result.code === 200) {
95
+ console.log('查询得到的代办2' + JSON.stringify(result))
96
+ var crv = {
97
+ title: '置换上传',
98
+ sum: result.data.length
99
+ }
100
+ _this.changesum(crv)
101
+ }
102
+ }, 6000)
103
+ },
104
+ changesum(titdata){
105
+ for(var i = 0;i<this.tabs.length;i++){
106
+ if(this.tabs[i].name == titdata.title){
107
+ this.tabs[i].icon = titdata.sum + '单'
108
+ console.log(JSON.stringify(this.tabs[i].icon))
109
+ return
110
+ }
111
+ }
112
+ },
113
+ getTabs(){
114
+ this.getRepairNum()
115
+ for(let funs in Vue.functions){
116
+ if(Vue.functions[funs].link == 'online-manage'){
117
+ return Vue.functions[funs].children
118
+ }
119
+ }
120
+ },
121
+ getRepairNum() {
122
+ if (!Vue.android || !Vue.come || !Vue.come == 'tongchuan') {
123
+ return
124
+ }
125
+ window.setInterval(function () {
126
+ let condition = `1 = 1 and f_workorder_type = '报修单' and f_state = null `
127
+ let val = {
128
+ condition: {
129
+ condition: condition,
130
+ sign: '1 = 1'
131
+ },
132
+ userid: Vue.user.name
133
+ }
134
+ let http = new HttpResetClass()
135
+ http.load('POST', `${this.$androidUtil.getProxyUrl()}/rs/path/operatorServiceAndroid`, {data: val}, {
136
+ resolveMsg: null,
137
+ rejectMsg: null
138
+ }).then((res) => {
139
+ this.pointNum = res.data.length
140
+ })
141
+ },10000)
142
+ this.timeOutGetRepairNum()
143
+ },
144
+ timeOutGetRepairNum(){
145
+ let condition = `1 = 1 and f_workorder_type = '报修单' and f_state = null `
146
+ let val = {
147
+ condition: {
148
+ condition: condition,
149
+ sign: '1 = 1'
150
+ },
151
+ userid: Vue.user.name
152
+ }
153
+ let http = new HttpResetClass()
154
+ http.load('POST', `${this.$androidUtil.getProxyUrl()}/rs/path/operatorServiceAndroid`, {data: val}, {
155
+ resolveMsg: null,
156
+ rejectMsg: null
157
+ }).then((res) => {
158
+ this.pointNum = res.data.length
159
+ })
160
+ },
161
+ imgback(val){
162
+ return require('../assets/'+val+'.png')
163
+ },
164
+ // 返回主界面
165
+ back(){
166
+ this.titleName = '主界面'
167
+ this.isMenu = true
168
+
169
+ },
170
+ gotopage(param,title,navigate) {
171
+ console.log('进入子组件')
172
+ var prpdata = {
173
+ _this:this,
174
+ title:title,
175
+ safe:false
176
+ }
177
+ this.$dispatch('gotoson',prpdata)
178
+ if(navigate){
179
+ this.$goto('embbed-page', {domainName: navigate, title: title, compName: param, login: Vue.user})
180
+ }else{
181
+ this.$goto(param,{sourcet:'竖屏',tabname:title})
182
+ }
183
+ },
184
+ mute () {
185
+ HostApp.mute()
186
+ }
187
+ },
188
+ }
189
+ </script>
190
+ <style lang="less">
191
+ .badge-content {
192
+ color: #fff;
193
+ box-sizing: border-box;
194
+ min-width: 8px;
195
+ font-size: 9px;
196
+ line-height: 12px;
197
+ white-space: nowrap;
198
+ font-weight: 400;
199
+ text-align: center;
200
+ }
201
+
202
+ .badge {
203
+ top: 6px;
204
+ position: absolute;
205
+ max-height: 13px;
206
+ min-height: 8px;
207
+ right: 0;
208
+ display: inline-flex;
209
+ vertical-align: middle;
210
+ box-sizing: content-box;
211
+ border-radius: 100px;
212
+ background-color: red;
213
+ }
214
+
215
+ .tab-befor-img {
216
+ content: '';
217
+ background-size: 30px;
218
+ display: inline-block;
219
+ margin-right: 8px;
220
+ height: 30px;
221
+ width: 30px;
222
+ vertical-align: -35%;
223
+ }
224
+ .pageskuang{
225
+ vertical-align:middle;
226
+ display:table-cell;
227
+ width: 32%;
228
+ top:-50%;
229
+ margin-top: 1%;
230
+ margin-left: 1%;
231
+ border:1px solid #e3e3e3;
232
+ text-align: center;
233
+ background-color: #ffffff;
234
+ }
235
+ .pgesfoot{
236
+ font-size: 14px;
237
+ color: #666666;
238
+ /* font-family: "Pingfhs";*/
239
+ }
240
+ .imgs{
241
+ width: 35px;
242
+ margin-top: 15px;
243
+ }
244
+ .pages-bgcolor{
245
+ text-align: center;
246
+ background-color: #f0f0ef;
247
+ }
248
+ img[src=""],img:not([src]){
249
+ opacity: 0;
250
+ border:none;
251
+ visibility: hidden;
252
+ max-width: none;
253
+ }
254
+
255
+ .manbiankuang {
256
+ width: 44%;
257
+ margin-top: 15px;
258
+ margin-left: 4%;
259
+ border: 1px solid #e3e3e3;
260
+ border-radius: 10px 10px 10px 10px;
261
+ text-align: center;
262
+ background-color: #ffffff;
263
+ }
264
+
265
+ .nav-bgcolor {
266
+ background-color: #ffffff;
267
+ }
268
+ </style>
@@ -1,214 +1,217 @@
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">
4
- <span class='btn-content' :style="{textOverflow:'ellipsis',overflow: 'hidden'}">{{ 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-down" v-show="row.open&&row.data.children.length>0" style="color:balck;"></span>
10
- <span class="glyphicon glyphicon-chevron-right" 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-if="$parent.$parent.$parent.isSelect(row.data.id)" 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></v-select>
23
- </template>
24
- <script>
25
- import * as ldapHelper from './../util/LdapHelper'
26
- import Vue from 'vue'
27
- export default {
28
- title: '资源树',
29
- props: {
30
- source: {
31
- type: String,
32
- require: true,
33
- default:`tool.getFullTree(this.getRights().where(row.getType() == $organization$))`
34
- },
35
- resid: {
36
- },
37
- islist: {
38
- type: Boolean,
39
- default: false
40
- },
41
- //是否有查看上级的权限
42
- Url:{
43
- type: String,
44
- default:''
45
- }
46
- },
47
- data () {
48
- return {
49
- width:'100%',
50
- resobj:{res:Vue.user.orgs, resids:Vue.user.orgid},
51
- userid: Vue.user.id,
52
- resname:[Vue.user.orgs],
53
- orgnames : [Vue.user.orgs],
54
- orgids : [Vue.user.orgid],
55
- orgobj:[],
56
- model: [
57
-
58
- ],
59
- childrenOptions: []
60
- }
61
- },
62
- methods: {
63
- selectRes () {
64
- let newobj={
65
- "res": [this.resname],
66
- "resids": [this.orgids],
67
- }
68
- this.$emit('re-res', newobj)
69
- },
70
- //点击资源的方法
71
- selectclick (row) {
72
- if(this.orgids.includes(row.id)){
73
- this.orgnames=[]
74
- this.orgids=[]
75
- this.removeResChild(row)
76
- this.orgnames.push(row.name)
77
- this.orgids.push(row.id)
78
- this.orgobj.push(row)
79
- }else{
80
- this.orgnames=[]
81
- this.orgids=[]
82
- this.orgobj=[]
83
- this.addResChild(row)
84
- }
85
- console.log(this.orgnames.join(','))
86
- this.resname = this.orgnames.length > 0 ? this.orgnames.join(','):'请选择'
87
- let newobj={
88
- "res": this.orgnames,
89
- "resids": this.orgids,
90
- "orgobj": this.orgobj,
91
- }
92
- this.$emit('re-res', newobj)
93
- },
94
- addResChild(val){
95
- // if(this.orgids.includes(val.id)){
96
- // this.orgnames.splice(this.orgnames.indexOf(val.name),1)
97
- // this.orgids.splice(this.orgids.indexOf(val.id),1)
98
- // }
99
- this.orgnames.push(val.name)
100
- this.orgids.push(val.id)
101
- this.orgobj.push(val)
102
- if(val.children && val.children.length>0){
103
- Object.keys(val.children).forEach((key) => {
104
- this.addResChild(val.children[key])
105
- })
106
- }
107
- },
108
- removeResChild(val){
109
- this.orgnames.splice(this.orgnames.indexOf(val.name),1)
110
- this.orgids.splice(this.orgids.indexOf(val.id),1)
111
- this.orgobj.splice(this.orgids.indexOf(val),1)
112
- if(val.children && val.children.length>0){
113
- Object.keys(val.children).forEach((key) => {
114
- this.removeResChild(val.children[key])
115
- })
116
- }
117
- },
118
- //检查是否显示对勾
119
- isSelect(val) {
120
- if(this.orgids.includes(val)){
121
- return true
122
- }else{
123
- return false
124
- }
125
- },
126
- //树形结构变成list
127
- treetoList(val) {
128
- for (let value of val) {
129
- this.ergodicList(value)
130
- }
131
- },
132
- //找到跟节点
133
- ergodicList (val) {
134
- val.children.length > 0 ? this.treetoList(val.children) : this.childrenOptions.push({label: val.name, value: val})
135
- },
136
- //处理显示默认值
137
- dealResObj (val) {
138
- try{
139
- var arr=val.res.split(".")
140
- //截取最后一个分公司名字
141
- this.resname=arr[arr.length-1].toString()
142
- this.resid = val.resids
143
- }catch (e){
144
- this.resname='请选择组织'
145
- }
146
- },
147
- judgBoundary(){
148
- //判断是否超出边界,超出移动
149
- if(document.documentElement.offsetWidth< this.$els.dropdown.getBoundingClientRect().right){
150
- this.left = document.documentElement.offsetWidth - this.$els.dropdown.getBoundingClientRect().right - 25
151
- }
152
- }
153
- },
154
- events: {
155
-
156
- },
157
- ready () {
158
- console.log('righttree ready')
159
- if(this.$els.dropdown){
160
- console.log('righttree1')
161
- this.width = this.$els.dropdown.clientWidth * 0.7 +'px'
162
- }
163
- console.log('righttree2')
164
- this.dealResObj (this.resobj)
165
- console.log('righttree3')
166
- var data = {
167
- source: this.source,
168
- userid: this.userid
169
- }
170
- console.log('向资源服务发送请求')
171
- this.$resetpost(`${this.$androidUtil.getProxyUrl()}/rs/search`, data).then((ret) => {
172
- console.log('向资源服务请求结束')
173
- // 去掉前面的两层节点
174
- ret.data[0].children[0].children.forEach((item) => {
175
- this.model.push(item)
176
- })
177
- // 给资源添加父关系
178
- ldapHelper.procParent(this.model)
179
- if (this.islist) {
180
- this.treetoList(this.model)
181
- }
182
- this.selectRes()
183
- })
184
- },
185
- watch: {
186
- }
187
- }
188
- </script>
189
- <style lang="less">
190
- #res-tree {
191
- .list-group-item {
192
- background-color: #FFF;
193
- color: #000;
194
- padding: 5px 10px;
195
- border:0px;
196
- white-space: nowrap;
197
- }
198
- }
199
- #res-tree .list-group {
200
- width: auto;
201
- min-width: 100%;
202
- }
203
- .hide-text-overflow{
204
- overflow: hidden;
205
- text-overflow: ellipsis
206
- }
207
- .select-style {
208
- border: 0px;
209
- /*border-bottom: 2px solid #C9CCCF;*/
210
- border: 1px solid #93B2D3;
211
- border-radius: 0px;
212
- color: #555;
213
- }
214
- </style>
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">
4
+ <span class='btn-content' :style="{textOverflow:'ellipsis',overflow: 'hidden'}">{{ 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-down" v-show="row.open&&row.data.children.length>0" style="color:balck;"></span>
10
+ <span class="glyphicon glyphicon-chevron-right" 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-if="$parent.$parent.$parent.isSelect(row.data.id)" 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></v-select>
23
+ </template>
24
+ <script>
25
+ import * as ldapHelper from './../util/LdapHelper'
26
+ import Vue from 'vue'
27
+ export default {
28
+ title: '资源树',
29
+ props: {
30
+ source: {
31
+ type: String,
32
+ require: true,
33
+ default:`tool.getFullTree(this.getRights().where(row.getType() == $organization$))`
34
+ },
35
+ resid: {
36
+ },
37
+ islist: {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ //是否有查看上级的权限
42
+ Url:{
43
+ type: String,
44
+ default:''
45
+ }
46
+ },
47
+ data () {
48
+ return {
49
+ width:'100%',
50
+ resobj:{res:Vue.user.orgs, resids:Vue.user.orgid},
51
+ userid: Vue.user.id,
52
+ resname:[Vue.user.orgs],
53
+ orgnames : [Vue.user.orgs],
54
+ orgids : [Vue.user.orgid],
55
+ orgobj:[],
56
+ model: [
57
+
58
+ ],
59
+ childrenOptions: []
60
+ }
61
+ },
62
+ methods: {
63
+ selectRes () {
64
+ let newobj={
65
+ "res": [this.resname],
66
+ "resids": [this.orgids],
67
+ }
68
+ this.$emit('re-res', newobj)
69
+ },
70
+ //点击资源的方法
71
+ selectclick (row) {
72
+ if(this.orgids.includes(row.id)){
73
+ this.orgnames=[]
74
+ this.orgids=[]
75
+ this.removeResChild(row)
76
+ this.orgnames.push(row.name)
77
+ this.orgids.push(row.id)
78
+ this.orgobj.push(row)
79
+ }else{
80
+ this.orgnames=[]
81
+ this.orgids=[]
82
+ this.orgobj=[]
83
+ this.addResChild(row)
84
+ }
85
+ console.log(this.orgnames.join(','))
86
+ this.resname = this.orgnames.length > 0 ? this.orgnames.join(','):'请选择'
87
+ let newobj={
88
+ "res": this.orgnames,
89
+ "resids": this.orgids,
90
+ "orgobj": this.orgobj,
91
+ }
92
+ this.$emit('re-res', newobj)
93
+ },
94
+ addResChild(val){
95
+ // if(this.orgids.includes(val.id)){
96
+ // this.orgnames.splice(this.orgnames.indexOf(val.name),1)
97
+ // this.orgids.splice(this.orgids.indexOf(val.id),1)
98
+ // }
99
+ this.orgnames.push(val.name)
100
+ this.orgids.push(val.id)
101
+ this.orgobj.push(val)
102
+ if(val.children && val.children.length>0){
103
+ Object.keys(val.children).forEach((key) => {
104
+ this.addResChild(val.children[key])
105
+ })
106
+ }
107
+ },
108
+ removeResChild(val){
109
+ this.orgnames.splice(this.orgnames.indexOf(val.name),1)
110
+ this.orgids.splice(this.orgids.indexOf(val.id),1)
111
+ this.orgobj.splice(this.orgids.indexOf(val),1)
112
+ if(val.children && val.children.length>0){
113
+ Object.keys(val.children).forEach((key) => {
114
+ this.removeResChild(val.children[key])
115
+ })
116
+ }
117
+ },
118
+ //检查是否显示对勾
119
+ isSelect(val) {
120
+ if(this.orgids.includes(val)){
121
+ return true
122
+ }else{
123
+ return false
124
+ }
125
+ },
126
+ //树形结构变成list
127
+ treetoList(val) {
128
+ for (let value of val) {
129
+ this.ergodicList(value)
130
+ }
131
+ },
132
+ //找到跟节点
133
+ ergodicList (val) {
134
+ val.children.length > 0 ? this.treetoList(val.children) : this.childrenOptions.push({label: val.name, value: val})
135
+ },
136
+ //处理显示默认值
137
+ dealResObj (val) {
138
+ try{
139
+ var arr=val.res.split(".")
140
+ //截取最后一个分公司名字
141
+ this.resname=arr[arr.length-1].toString()
142
+ this.resid = val.resids
143
+ }catch (e){
144
+ this.resname='请选择组织'
145
+ }
146
+ },
147
+ judgBoundary(){
148
+ //判断是否超出边界,超出移动
149
+ if(document.documentElement.offsetWidth< this.$els.dropdown.getBoundingClientRect().right){
150
+ this.left = document.documentElement.offsetWidth - this.$els.dropdown.getBoundingClientRect().right - 25
151
+ }
152
+ }
153
+ },
154
+ events: {
155
+
156
+ },
157
+ ready () {
158
+ console.log('righttree ready')
159
+ if(this.$els.dropdown){
160
+ console.log('righttree1')
161
+ this.width = this.$els.dropdown.clientWidth * 0.7 +'px'
162
+ }
163
+ console.log('righttree2')
164
+ this.dealResObj (this.resobj)
165
+ console.log('righttree3')
166
+ var data = {
167
+ source: this.source,
168
+ userid: this.userid
169
+ }
170
+ console.log('向资源服务发送请求')
171
+ this.$resetpost(`${this.$androidUtil.getProxyUrl()}/rs/search`, data,{
172
+ resolveMsg : null ,
173
+ rejectMsg : null,
174
+ }).then((ret) => {
175
+ console.log('向资源服务请求结束')
176
+ // 去掉前面的两层节点
177
+ ret.data[0].children[0].children.forEach((item) => {
178
+ this.model.push(item)
179
+ })
180
+ // 给资源添加父关系
181
+ ldapHelper.procParent(this.model)
182
+ if (this.islist) {
183
+ this.treetoList(this.model)
184
+ }
185
+ this.selectRes()
186
+ })
187
+ },
188
+ watch: {
189
+ }
190
+ }
191
+ </script>
192
+ <style lang="less">
193
+ #res-tree {
194
+ .list-group-item {
195
+ background-color: #FFF;
196
+ color: #000;
197
+ padding: 5px 10px;
198
+ border:0px;
199
+ white-space: nowrap;
200
+ }
201
+ }
202
+ #res-tree .list-group {
203
+ width: auto;
204
+ min-width: 100%;
205
+ }
206
+ .hide-text-overflow{
207
+ overflow: hidden;
208
+ text-overflow: ellipsis
209
+ }
210
+ .select-style {
211
+ border: 0px;
212
+ /*border-bottom: 2px solid #C9CCCF;*/
213
+ border: 1px solid #93B2D3;
214
+ border-radius: 0px;
215
+ color: #555;
216
+ }
217
+ </style>