apply-clients 5.0.35-65 → 5.0.35-66

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,540 +1,727 @@
1
- <template>
2
- <div>
3
- <work-busy :is-busy="loading"></work-busy>
4
- <service-view-app v-ref:service_show :data.sync="show_data.ppp" :model.sync="selectmodel" v-if="showview"></service-view-app>
5
- </div>
6
- </template>
7
- <script>
8
- import co from 'co'
9
- import Vue from 'vue'
10
- import {HttpResetClass} from 'vue-client'
11
- export default {
12
- title: '报建流程业务控制层',
13
- props: ['selectdata','selectmodel','show_data'],
14
- data () {
15
- return {
16
- model:'',
17
- delteLocal:false,
18
- loading:false,
19
- data:null, // 数据库数据,json配置文件数据的数据集合
20
- json_datas:null, // Json配置文件集合
21
- showview:false, // 控制显示service-view组件
22
- // 给view层显示的数据
23
- department_search:null // 当前部门下所有人
24
- }
25
- },
26
- methods: {
27
- // 特殊化处理
28
- saveCallBack(jo){
29
- console.log(JSON.stringify(jo))
30
- console.log("hhhhhhhhhhhhhhhhh")
31
- console.log(JSON.stringify(jo))
32
- if(jo.state == 'ok'){
33
- console.log("hhhhhhhhhhhhhhhhh2")
34
- let res = JSON.parse(jo.result)
35
- console.log("hhhhhhhhhhhhhhhhh3")
36
- if(res.code = 200){
37
- this.showview = false
38
- // 如果需要删除本地记录则去删除
39
- console.log("hhhhhhhhhhhhhhhhh4")
40
- if(this.delteLocal){
41
- console.log("hhhhhhhhhhhhhhhhh5")
42
- this.deleteLocalApply(this.model)
43
- }
44
- console.log("hhhhhhhhhhhhhhhhh6")
45
- // 特殊处理
46
- this.special(this.model)
47
- console.log("hhhhhhhhhhhhhhhhh7")
48
- this.loading=false
49
- this.$dispatch('close')
50
- console.log("hhhhhhhhhhhhhhhhh8")
51
- this.initializtion()
52
- console.log("hhhhhhhhhhhhhhhhh9")
53
- this.$showMessage('操作成功')
54
- }else{
55
- this.$showMessage('操作失败,原因:' + res.data.msg)
56
- }
57
- }
58
-
59
- },
60
- async special(model){
61
- console.log('进入async special方法')
62
- if(this.data.distribute_async && model.button.button_name==='下发'){
63
- // 流程异步处理
64
- let http = new HttpResetClass();
65
- // let res = await http.load('POST',this.$androidUtil.getProxyUrl() + '/rs/logic/syncprocess',{data:{model:model,loginUser:this.$login.f}}, {resolveMsg: null, rejectMsg: '流程异步下发据保存失败'})
66
- let res = await http.load('POST',this.$androidUtil.getProxyUrl() + '/rs/logic/syncprocess',{data:{model:model,loginUser: Vue.user}}, {resolveMsg: null, rejectMsg: '流程异步下发据保存失败'})
67
- console.log("流程的异步处理:",JSON.stringify(res.data))
68
- }
69
- if(this.data.distribute_async && model.button.button_name==='完成'){
70
- // 强制结束
71
- let http = new HttpResetClass();
72
- let res = await http.load('POST',this.$androidUtil.getProxyUrl() + '/rs/logic/stoprocess',{data:{model:model,loginUser: Vue.user}}, {resolveMsg: null, rejectMsg: '流程异步完成数据保存失败'})
73
- // let res = await http.load('POST',this.$androidUtil.getProxyUrl() + '/rs/logic/stoprocess',{data:{model:model,loginUser:this.$login.f}}, {resolveMsg: null, rejectMsg: '流程异步完成数据保存失败'})
74
- console.log("流程的异步处理:",JSON.stringify(res.data))
75
- }
76
- },
77
- // 组件初始化操作
78
- refurbish(){
79
- if(!this.$workflow_vue){
80
- this.$showMessage('流程配置文件不存在,请反馈系统管理员')
81
- return
82
- }
83
- console.log('内存中的流程配置文件数据=>' + JSON.stringify(this.$workflow_vue))
84
- this.json_datas=this.$workflow_vue
85
- let sum = 0
86
- let jsonData ={}
87
- for(let i=0;i<this.json_datas.activitys.length;i++){
88
- if(this.selectdata.defname==this.json_datas.activitys[i].title){
89
- jsonData = this.json_datas.activitys[i]
90
- sum++
91
- }
92
- }
93
- console.log('sum=>' + sum)
94
- if(sum==1){
95
- this.data =null
96
- this.data = jsonData
97
- console.log('调用initializtion前的this.data=>' + JSON.stringify(this.data))
98
- this.initializtion()
99
-
100
- } else if(sum==0) {
101
- this.$showMessage(`没有在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置`)
102
- } else {
103
- this.$showMessage(`在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置:${sum}个`)
104
- }
105
- },
106
- // json配置数据处理 比如下拉框的options
107
- async initializtion() {
108
-
109
- console.log('进入initializtion()方法')
110
- console.log('接收到的selectdata有无变化'+JSON.stringify(this.selectdata))
111
- console.log('接收到的selectdata有无actorexpression'+JSON.stringify(this.selectdata.actorexpression))
112
- // 下发人 options 处理,options初始化
113
- if(this.selectdata.actorexpression){
114
- //截取actorexpression
115
-
116
- let http = new HttpResetClass()
117
- var url = this.$androidUtil.getProxyUrl() + '/rs/search'
118
- console.log('即将请求后台获取下发人员,url=>' + url)
119
- // R(安装员报装)
120
- console.log("777777776"+JSON.stringify(this.selectdata.actorexpression))
121
- let res
122
- if (this.selectdata.actorexpression.startsWith('R')) {
123
- let actorexpression = this.selectdata.actorexpression
124
- //let actorexpression="R(安装员报装)"
125
- let actor = actorexpression.substring(actorexpression.indexOf('(') + 1, actorexpression.indexOf(')'))
126
- console.log("看看角色" + JSON.stringify(actor))
127
- res= await http.load('POST', url, {
128
- source: `tool.getChildrenOfResName($${actor}$)`,
129
- userid: Vue.user.id
130
- }, {resolveMsg: null, rejectMsg: '获取当前部门人员失败'})
131
- }else{
132
- res = await http.load('POST', url, this.selectdata.actorexpression, {resolveMsg: null, rejectMsg: '获取当前部门人员失败'})
133
- }
134
- console.log("请求后台获取下发人员结果转换=>" + JSON.stringify(res))
135
- let jsonString = JSON.stringify(res.data)
136
- let jsonArray = []
137
- if(jsonString.startsWith("{")){
138
- jsonArray.push(res.data)
139
- res.data = jsonArray
140
- }
141
- this.department_search = res.data
142
- }
143
-
144
- // data 填充 selectdata
145
- console.log('即将合并data与selectdata,selectdata数据=>' + JSON.stringify(this.selectdata))
146
- this.data = Object.assign({},this.data, this.selectdata)
147
- console.log('this.data的值=>' + JSON.stringify(this.data))
148
-
149
- // 初始化 fields
150
- console.log('this.data.fields.length=>' + this.data.fields.length)
151
- for(let i=0;i<this.data.fields.length;i++){
152
- // 如果selectdata有这些key,则把selectdata的value赋值给data的value
153
- if(this.selectdata[this.data.fields[i].field]){
154
- this.data.fields[i].value = this.selectdata[this.data.fields[i].field]
155
- }
156
- // 如果配置类型为select,优先从参数列表获取options
157
- if(this.data.fields[i].type == 'select'){
158
- console.log('进入下拉框参数获取方法,参数名称=>' + this.data.fields[i].label)
159
- console.log('$appdata中的缓存参数与单值=>' + JSON.stringify(this.$appdata))
160
- var param = this.$appdata.getParam(this.data.fields[i].label)
161
- console.log(param)
162
- if (param){
163
- this.data.fields[i].options = param
164
- }
165
-
166
- }
167
- // 设置用户类型
168
- if (this.data.fields[i].label == '用户类型') {
169
- this.data.fields[i].options = [{label: '民用', value: '民用'},{label: '非民用', value: '非民用'}]
170
- }
171
- // 获取县区
172
- if (this.data.fields[i].label == '县/区') {
173
- let area = await this.$resetpost(`${this.$androidUtil.getProxyUrl()}/rs/sql/singleTable`, {
174
- data: {
175
- // items: 'f_bill_url,f_url_code',
176
- tablename: 't_pcd',
177
- condition: `f_filialeids = '${Vue.user.f_orgids}'`
178
- }
179
- }, {resolveMsg: null, rejectMsg: null})
180
- let rs = []
181
- for (let i = 0; i < area.data.length; i++) {
182
- let temp = {
183
- label: area.data[i].f_pcd,
184
- value: area.data[i].f_pcd
185
- }
186
- rs.push(temp)
187
- }
188
- this.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
189
- }
190
- }
191
- // 初始化 buttons_fields
192
- for(let i=0;i<this.data.buttons.length;i++){
193
- if(this.data.buttons[i].button_fields){
194
- for(let j=0;j<this.data.buttons[i].button_fields.length;j++){
195
- // 如果selectdata有这些key,则把selectdata的value赋值给data的value
196
- if(this.selectdata[this.data.buttons[i].button_fields[j].field]){
197
- this.data.buttons[i].button_fields[j].value = this.selectdata[this.data.buttons[i].button_fields[j].field]
198
- }
199
- // 如果配置类型为select,优先从参数列表获取options
200
- if(this.data.buttons[i].button_fields[j].type==='select'&&this.$appdata.getParam(this.data.buttons[i].button_fields[j].label)){
201
- console.log("这里是给select赋值的地方"+JSON.stringify(this.data.buttons[i].button_fields[j]))
202
- console.log("参数列表获取到的"+JSON.stringify(this.$appdata.getParam(this.data.buttons[i].button_fields[j].label)))
203
- this.data.buttons[i].button_fields[j].options=this.$appdata.getParam(this.data.buttons[i].button_fields[j].label)
204
- }
205
- // 下发特殊配置
206
- if(this.data.buttons[i].button_name==='下发'){
207
- if(this.data.buttons[i].button_fields.length===1){
208
- // value初始化
209
- // if(this.department_search){
210
- console.log("看看111department_search"+JSON.stringify(this.department_search))
211
-
212
- if(this.selectdata[this.data.buttons[i].button_fields[0].field]){
213
-
214
- for(let k=0;k<this.department_search.length;k++){
215
- // 将id转换为name
216
- if(Number(this.department_search[k].id) === Number(this.selectdata[this.data.buttons[i].button_fields[0].field])){
217
- this.data.buttons[i].button_fields[0].value=this.department_search[k].name
218
- }
219
- }
220
- }
221
-
222
- if(this.department_search){
223
- let array = []
224
- console.log("看看department_search"+JSON.stringify(this.department_search))
225
- this.department_search.forEach((paper)=>{
226
- array.push({label:paper.name,value:paper.name})
227
- })
228
- this.data.buttons[i].button_fields[0].options = array
229
- }
230
- }else {
231
- this.$showMessage("下发按钮必须满足 当且仅当一个字段")
232
- }
233
- }
234
- }
235
- }
236
- }
237
- // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
238
- let temp = JSON.parse(JSON.stringify(this.data))
239
- // 退回原因展示
240
- if(this.selectdata.f_back_reason){
241
- temp['back_reason'] = this.selectdata.f_back_reason
242
- }
243
- console.log('即将给show_data赋值temp=>' + JSON.stringify(temp))
244
- console.log(JSON.stringify(this.show_data.ppp))
245
- if (JSON.stringify(this.show_data.ppp)=='{}'){
246
- this.show_data.ppp = temp
247
- console.log("重新赋值")
248
-
249
- }else{
250
- console.log("不重新赋值")
251
- }
252
- console.log('initializtion()方法结束,showview')
253
- this.showview = true
254
- },
255
- deleteLocalApply(model){
256
- console.log(`前台上传完成,开始删除本地报建工单`)
257
- this.$androidUtil.bzLogic('deleteApply', {data:model})
258
- }
259
- },
260
- events: {
261
- 'checkboxSelectControl'(index,index2){
262
- if(this.$refs.service_show.data.fields[index].label=="施工提交资料"){
263
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
264
- if(this.$refs.service_show.data.fields[i].label=="施工已上传文件"){
265
- //增加和删除框中的内容
266
- if(this.$refs.service_show.data.fields[index].items[index2].value == false){
267
- // this.$refs.service_show.data.fields[i].value+=this.$refs.service_show.data.fields[index].items[index2].label+" ";
268
- this.$refs.service_show.data.fields[i].value=this.$refs.service_show.data.fields[i].value==undefined?'':this.$refs.service_show.data.fields[i].value+this.$refs.service_show.data.fields[index].items[index2].label+" ";
269
- this.$refs.service_show.data.fields[index].items[index2].value=true;
270
- }else{
271
- let deleteValue = this.$refs.service_show.data.fields[index].items[index2].label;
272
- let values =this.$refs.service_show.data.fields[i].value;
273
- let result = values.split(" ").filter((item)=>{
274
- return item!=deleteValue;
275
- }).join(" ")
276
- this.$refs.service_show.data.fields[i].value =result;
277
- this.$refs.service_show.data.fields[index].items[index2].value=false;
278
- }
279
- //}
280
- }
281
- }
282
- }
283
- if(this.$refs.service_show.data.fields[index].label=="验收提交资料"){
284
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
285
-
286
- if(this.$refs.service_show.data.fields[i].label=="验收已上传文件"){
287
- //增加和删除框中的内容
288
- if(this.$refs.service_show.data.fields[index].items[index2].value == false){
289
- this.$refs.service_show.data.fields[i].value=this.$refs.service_show.data.fields[i].value==undefined?'':this.$refs.service_show.data.fields[i].value+this.$refs.service_show.data.fields[index].items[index2].label+" ";
290
- this.$refs.service_show.data.fields[index].items[index2].value=true;
291
- }else{
292
- let deleteValue = this.$refs.service_show.data.fields[index].items[index2].label;
293
- let values =this.$refs.service_show.data.fields[i].value;
294
- let result = values.split(" ").filter((item)=>{
295
- return item!=deleteValue;
296
- }).join(" ")
297
- this.$refs.service_show.data.fields[i].value =result;
298
- this.$refs.service_show.data.fields[index].items[index2].value=false;
299
- }
300
- //}
301
- }
302
- }
303
- }
304
- this.$refs.service_show.update()
305
- },
306
- // 任意select选中时触发事件
307
- async 'select_cascade'(index){
308
- // this.$refs.service_show.model_temp // 子业务显示组件
309
- // 级联操作示例:
310
- /*
311
- if(this.$refs.service_show.model_temp.activitys.ields[index].label==='报建类型'){
312
- for(let i=0;i<this.$refs.service_show.model_temp.activitys.fields.length;i++){
313
- // 控制设置级联
314
- // 源select所选的值 this.$refs.service_show.model_temp.activitys.fields[index].value
315
- if(this.$refs.service_show.model_temp.activitys.fields[i].label==='级联测试2'){
316
- this.$refs.service_show.model_temp.activitys.fields[i].options=[
317
- {label:'级联选项1',value:'级联选项1'},{label:'级联选项2',value:'级联选项2'},{label:'级联选项3',value:'级联选项3'}
318
- ]
319
- }
320
- }
321
- }
322
- */
323
- if (this.$refs.service_show.data.fields[index].label === '县/区') {
324
- let temp = this.$refs.service_show.data.fields[index].value
325
- console.log('==============================县/区:' + temp)
326
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
327
- // 控制设置级联
328
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
329
- if (this.$refs.service_show.data.fields[i].label === '街道名称') {
330
- await this.$resetpost(`${this.$androidUtil.getProxyUrl()}/rs/sql/singleTable`, {
331
- data: {
332
- tablename: 't_street',
333
- condition: `f_filialeids = '${Vue.user.f_orgids}' and f_pcd='${temp}'`
334
- }
335
- }, {resolveMsg: null, rejectMsg: null}).then(res => {
336
- let streetrs = []
337
- for (let i = 0; i < res.data.length; i++) {
338
- let temp = {
339
- label: res.data[i].f_street,
340
- value: res.data[i].f_street
341
- }
342
- streetrs.push(temp)
343
- }
344
- this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...streetrs]
345
- // console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~option:', this.$refs.service_show.data.fields[i].options)
346
- this.$refs.service_show.update()
347
- })
348
- }
349
- }
350
- }
351
- if (this.$refs.service_show.data.fields[index].label === '街道名称') {
352
- let temp = this.$refs.service_show.data.fields[index].value
353
- console.log('=============================街道:' + temp)
354
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
355
- // 控制设置级联
356
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
357
- if (this.$refs.service_show.data.fields[i].label === '小区名称') {
358
- await this.$resetpost(`${this.$androidUtil.getProxyUrl()}/rs/sql/singleTable`, {
359
- data: {
360
- tablename: 't_area',
361
- condition: `f_filialeids = '${Vue.user.f_orgids}' and f_street='${temp}'`
362
- }
363
- }, {resolveMsg: null, rejectMsg: null}).then(res => {
364
- let arears = []
365
- for (let i = 0; i < res.data.length; i++) {
366
- let temp = {
367
- label: res.data[i].f_residential_area,
368
- value: res.data[i].f_residential_area
369
- }
370
- arears.push(temp)
371
- }
372
- this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...arears]
373
- // console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~option:', this.$refs.service_show.data.fields[i].options)
374
- this.$refs.service_show.update()
375
- })
376
- }
377
- }
378
- }
379
- // 合成地址
380
- if (
381
- this.$refs.service_show.data.fields[index].label === '县/区' ||
382
- this.$refs.service_show.data.fields[index].label === '街道名称' ||
383
- this.$refs.service_show.data.fields[index].label === '小区名称' ||
384
- this.$refs.service_show.data.fields[index].label === '楼号' ||
385
- this.$refs.service_show.data.fields[index].label === '单元号' ||
386
- this.$refs.service_show.data.fields[index].label === '楼层' ||
387
- this.$refs.service_show.data.fields[index].label === '门牌号'
388
- ) {
389
- console.log('即将合成地址')
390
- var address = ''
391
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
392
- // 控制设置级联
393
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
394
- // xxx xx xxx
395
- if (this.$refs.service_show.data.fields[i].label === '县/区' && this.$refs.service_show.data.fields[i].value) {
396
- address += this.$refs.service_show.data.fields[i].value
397
- }
398
- if (this.$refs.service_show.data.fields[i].label === '街道名称' && this.$refs.service_show.data.fields[i].value) {
399
- address += this.$refs.service_show.data.fields[i].value
400
- }
401
- if (this.$refs.service_show.data.fields[i].label === '小区名称' && this.$refs.service_show.data.fields[i].value) {
402
- address += this.$refs.service_show.data.fields[i].value
403
- }
404
- if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value) {
405
- address += this.$refs.service_show.data.fields[i].value
406
- }
407
- if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value) {
408
- address += '栋'
409
- }
410
- if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value) {
411
- address += '-' +this.$refs.service_show.data.fields[i].value
412
- }
413
- if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value) {
414
- address += '单元'
415
- }
416
- if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value) {
417
- address += '-' +this.$refs.service_show.data.fields[i].value
418
- }
419
- if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value) {
420
- address += '层'
421
- }
422
- if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value) {
423
- address += '-' +this.$refs.service_show.data.fields[i].value
424
- }
425
- if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value) {
426
- address += '室'
427
- }
428
-
429
- }
430
- console.log('获取到的address=>' + address)
431
- // 数据获取完毕时放入地址text
432
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
433
- if (this.$refs.service_show.data.fields[i].label === '地址' || this.$refs.service_show.data.fields[i].label === '报装地址') {
434
- this.$refs.service_show.data.fields[i].value = address
435
- console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
436
- }
437
- }
438
- }
439
- },
440
- // 获取view层button事件
441
- async 'button'(model){
442
- this.loading=true
443
-
444
- console.log('进入async button事件方法')
445
- var delteLocal = true
446
- // 点击保存与重置按钮不需要修改本地工单状态
447
- if(model.button.button_name == '保存' || model.button.button_name==='重置'){
448
- delteLocal = false
449
- }
450
- // 点击重置按钮就重置数据
451
- if(model.button.button_name==='重置'){
452
- this.initializtion()
453
- return
454
- }
455
- if(model.button.button_name==='下发'){
456
- let person_name = model.button.button_fields[this.show_data.buttons[model.button.button_index].button_fields[0].field]
457
- for(let i=0;i<this.department_search.length;i++){
458
- // 找到人名为person_name 的人,然后把人名换成id
459
- if(this.department_search[i].name === person_name){
460
- model.button.button_fields[this.show_data.buttons[model.button.button_index].button_fields[0].field] = this.department_search[i].id
461
- }
462
- }
463
- }
464
- console.log("button事件接收参数model=>" + JSON.stringify(model))
465
- model=Object.assign({},this.selectdata,model)
466
- console.log('合并selectdata与model后的model=>' + JSON.stringify(model))
467
- let http = new HttpResetClass()
468
- var url = this.$androidUtil.getProxyUrl() + '/rs/logic/ApplyProductService'
469
- // let res = await http.load('POST',url,{data:{tables:this.data.tables,start_activity:this.$workflow_vue.start_activity,model:model,loginUser:Vue.user}}, {resolveMsg: null, rejectMsg: null})
470
- // // 先判断是否包含code,如果服务端异常,可能不存在code
471
- // console.log("service处理完成返回数据=>" + res)
472
- // if(!res.code){
473
- // console.log("service处理完成返回数据=>" + res)
474
- // this.$showMessage('操作异常,原因:' + res)
475
- // }else{
476
- // console.log("service处理完成返回数据=>" + JSON.stringify(res))
477
- // if(res.code = 200){
478
- // this.showview = false
479
- // // 特殊处理
480
- // this.special(model)
481
- // this.$dispatch('close')
482
- // this.initializtion()
483
- // this.$showMessage('操作成功')
484
- // }else{
485
- // this.$showMessage('操作失败,原因:' + res.data.msg)
486
- // }
487
- // }
488
- let btn = btn_operate(this, url, http, model, delteLocal)
489
- co(btn)
490
- }
491
- },
492
- watch:{
493
- // 监听selectdata的变化
494
- 'selectdata'() {
495
- console.log('进入selectdata改变事件data=>' + JSON.stringify(this.selectdata))
496
- this.refurbish()
497
- },
498
- deep:true
499
- }
500
- }
501
-
502
- let btn_operate = function * (self, url, http, model, delteLocal) {
503
- self.delteLocal=delteLocal
504
-
505
- // 下发,提交,保存,退回都在后台处理
506
- console.log('即将请求后台url=>' + url)
507
- model.employeetemplate=''
508
- self.model=model
509
- console.log(JSON.stringify(self.model))
510
- let param={
511
- employeetemplate:'',
512
- tables:self.data.tables,
513
- start_activity:self.$workflow_vue.start_activity,
514
- model:model,
515
- loginUser:Vue.user
516
- }
517
- if(param.model.defname === '现场勘查定价'){
518
- param.model.f_unaccounts_money = param.model.f_total_cost
519
- }
520
- // http.load('POST',url,{data:{employeetemplate:'',tables:self.data.tables,start_activity:self.$workflow_vue.start_activity,model:model,loginUser:Vue.user}}, {resolveMsg: null, rejectMsg: null})
521
- let paramStr = JSON.stringify(param)
522
- // 多长截断一次
523
- let subLength = 800
524
- for (let i = 0; i < paramStr.length; i += subLength) {
525
- HostApp.param_cache(paramStr.substr(i, subLength))
526
- }
527
- HostApp.__this__ = self
528
- HostApp.syncLogic({
529
- // logic别名,key必须为logic
530
- 'logic': 'updatePic',
531
- // 回调执行方法名,key必须为callback
532
- 'callback': 'javascript:HostApp.__this__.saveCallBack()',
533
- // 固定key,代表是否将logic执行结果作为参数传入回调方法,1代表true,0代表false,
534
- // 执行回调方法传入key为backresult
535
- // 如需额外拼接参数,写在logic返回值的params,例如xxlogic返回:{"params": "success"}
536
- 'backresult': 1
537
- })
538
-
539
- }
540
- </script>
1
+ <template>
2
+ <div>
3
+ <work-busy :is-busy="loading"></work-busy>
4
+ <service-view-app v-ref:service_show :data.sync="show_data.ppp" :model.sync="selectmodel" v-if="showview"></service-view-app>
5
+ </div>
6
+ <modal :show.sync="stop_show" v-ref:modal stop_show="false">
7
+ <header slot="modal-header" class="modal-header">
8
+ <button type="button" class="close" @click="closeback"><span>&times;</span></button>
9
+ <h4 class="modal-title">终止备注</h4>
10
+ </header>
11
+ <article slot="modal-body" class="modal-body">
12
+ <div class="from-group">
13
+ <input type="text" class="form-control" v-model="models.f_stop_remarks"/>
14
+ </div>
15
+ </article>
16
+ <footer slot="modal-footer" class="modal-footer">
17
+ <button v-show="stop_show" type="button" class="btn btn-default" @click='stopapplys'>确认</button>
18
+ </footer>
19
+ </modal>
20
+ <modal :show.sync="apply_show" v-ref:modal apply_show="false" >
21
+ <header slot="modal-header" class="modal-header">
22
+ <button type="button" class="close" @click="closeapply"><span>&times;</span></button>
23
+ <h4 class="modal-title">转单报建</h4>
24
+ </header>
25
+ <article slot="modal-body" class="modal-body">
26
+ <div class="from-group">
27
+ <v-select style="min-width: 80%;"
28
+ placeholder='请选择'
29
+ :options="applytypes"
30
+ :search="false"
31
+ v-model="apply_type"
32
+ :value.sync="apply_type"
33
+ close-on-select>
34
+ </v-select>
35
+ </div>
36
+ </article>
37
+ <footer slot="modal-footer" class="modal-footer">
38
+ <button v-show="apply_show" type="button" class="btn btn-default" @click='addactive()'>确认</button>
39
+ </footer>
40
+ </modal>
41
+ </template>
42
+ <script>
43
+ import co from 'co'
44
+ import Vue from 'vue'
45
+ import {HttpResetClass} from 'vue-client'
46
+ import * as Util from "../Util";
47
+ export default {
48
+ title: '报建流程业务控制层',
49
+ props: ['selectdata','selectmodel','show_data'],
50
+ data () {
51
+ return {
52
+ model:'',
53
+ delteLocal:false,
54
+ loading:false,
55
+ data:null, // 数据库数据,json配置文件数据的数据集合
56
+ json_datas:null, // Json配置文件集合
57
+ showview:false, // 控制显示service-view组件
58
+ // 给view层显示的数据
59
+ department_search:null, // 当前部门下所有人
60
+ stop_show:false, // 终止备注开关
61
+ apply_show:false, // 转单报建开关
62
+ apply_type:'',
63
+ applytypes:[{label:"散户报装",value:"报装申请"},{label:"集体报装",value:"集体报装申请"}],// 报建类型
64
+ models: {
65
+ f_date: Util.toStandardTimeString(),
66
+ f_department: Vue.user.f_parentname,
67
+ f_operator: Vue.user.name,
68
+ f_filiale: Vue.user.f_fengongsi
69
+ },
70
+ models2:{}
71
+ }
72
+ },
73
+ methods: {
74
+ // 转到报建
75
+ async addactive(){
76
+ this.selectdata.applyid = this.selectdata.id
77
+ // this.$resetpost('rs/logic/stopapply', {data: this.selectdata})
78
+ console.log(this.apply_type[0])
79
+ this.$workflow_vue.start_activity = this.apply_type[0]
80
+ let http = new HttpResetClass()
81
+ let res = await http.load('POST',this.$androidUtil.getProxyUrl() +'/rs/logic/ApplyGetProcessID',{data:{filename:this.$workflow_vue.workflow_xmlfilename,start_activity:this.$workflow_vue.start_activity}}, {resolveMsg: null, rejectMsg: '获取流程ID失败,请联系开发人员'})
82
+ let data = {
83
+ defname: this.$workflow_vue.start_activity,
84
+ f_process_id: res.data.f_process_id,
85
+ f_apply_date: Util.toStandardTimeString(),
86
+ f_product_id: res.data.f_product_id,
87
+ start_activity:this.$workflow_vue.start_activity,
88
+ f_user_type:this.models2.f_user_type,
89
+ f_user_name:this.models2.f_user_name,
90
+ f_phone:this.models2.f_phone,
91
+ f_area:this.models2.f_area,
92
+ f_street:this.models2.f_street,
93
+ f_residential_area:this.models2.f_residential_area,
94
+ f_building:this.models2.f_building,
95
+ f_unit:this.models2.f_unit,
96
+ f_floor:this.models2.f_floor,
97
+ f_room:this.models2.f_room,
98
+ f_address:this.models2.f_address,
99
+ f_idnumber:this.models2.f_social_credit_code,
100
+ user:Vue.user
101
+ }
102
+ await http.load('POST',this.$androidUtil.getProxyUrl() +'/rs/logic/newaddApplyproduct',{data:data}, {resolveMsg: null, rejectMsg: '转发失败,请联系开发人员'})
103
+ var flag = false
104
+ if (this.data.defname == '合同审核') {
105
+ flag = true
106
+ let http = new HttpResetClass()
107
+ let data = {
108
+ tablename: 't_singlevalue',
109
+ condition: `name = '合同编号' and f_filialeids = '${Vue.user.f_orgids}'`
110
+ }
111
+ let res = await http.load('POST', this.$androidUtil.getProxyUrl() +'/rs/sql/applysingleTable', {data: data}, {
112
+ resolveMsg: null,
113
+ rejectMsg: "获取合同编号失败"
114
+ })
115
+ if (this.contract != res.data[0].value && !this.selectdata.f_contract_number) {
116
+ this.$showMessage("合同编号已经被使用,请按F5刷新页面后重新登记")
117
+ return
118
+ }
119
+ }
120
+ let model = this.models2
121
+ let url = this.$androidUtil.getProxyUrl() +'/rs/logic/ApplyProductService'
122
+ let requestData = {
123
+ tables: this.data.tables, model: model
124
+ }
125
+ requestData.start_activity = '踏勘、建立工程编号'
126
+ requestData.loginUser = Vue.user
127
+ requestData.workflow_xmlfilename = this.$workflow_vue.workflow_xmlfilename
128
+ console.log('即将发送请求url=>' + url + ',参数=>' + JSON.stringify(requestData))
129
+ res = await http.load('POST', url, {data: requestData}, {resolveMsg: null, rejectMsg: '数据保存失败'})
130
+ console.log("service处理完成返回数据:", JSON.stringify(res.data))
131
+ if(res.data.msg=="地址重复,请修改后重新提交"){
132
+ this.$showMessage(res.data.msg)
133
+ }
134
+ if (res.data.code == 200) {
135
+ // flag 为合同编号更新标志
136
+ if (flag) {
137
+ let http = new HttpResetClass()
138
+ let data = {
139
+ tablename: 't_singlevalue',
140
+ condition: `name = '合同编号' and f_filialeids = '${Vue.user.f_orgids}'`,
141
+ value: (Number(this.contract) + 1) + ''
142
+ }
143
+ await http.load('POST', this.$androidUtil.getProxyUrl() +'/rs/logic/updatesinglevalue', {data: data}, {
144
+ resolveMsg: null,
145
+ rejectMsg: "获取合同编号更新失败"
146
+ })
147
+ }
148
+ this.showview = false
149
+ // 特殊处理
150
+ this.special(model)
151
+ this.$dispatch('close')
152
+ this.initializtion()
153
+ } else {
154
+ if (res.data.msg) {
155
+ this.$showMessage(res.data.msg)
156
+ }
157
+ }
158
+
159
+ this.apply_show = false
160
+ },
161
+ // 终止报建
162
+ async stopapplys () {
163
+ this.models = Object.assign({}, this.selectdata, this.models)
164
+ this.models.id = null
165
+ this.models.applyid = this.selectdata.id
166
+ this.models.f_operat_type = '终止报建'
167
+ this.models.f_state = '有效'
168
+ this.models.f_describe = this.selectdata.f_user_name + '已终止报建'
169
+ let data ={
170
+ tablename:'t_project_stop',
171
+ parameters:this.models
172
+ }
173
+ let http = new HttpResetClass()
174
+ await http.load('POST',this.$androidUtil.getProxyUrl() + '/rs/logic/save', {data:data},{resolveMsg: null, rejectMsg: "添加失败"})
175
+ await http.load('POST',this.$androidUtil.getProxyUrl() +'/rs/logic/stopapply', {data:this.models},{resolveMsg: null, rejectMsg: "终止失败"})
176
+ this.closeback()
177
+ this.$dispatch('close')
178
+ },
179
+ // 关闭终止备注弹框
180
+ closeback() {
181
+ this.stop_show = false
182
+ },
183
+ // 关闭报建弹框
184
+ closeapply() {
185
+ this.apply_show = false
186
+ },
187
+ // 特殊化处理
188
+ saveCallBack(jo){
189
+ console.log(JSON.stringify(jo))
190
+ console.log("hhhhhhhhhhhhhhhhh")
191
+ console.log(JSON.stringify(jo))
192
+ if(jo.state == 'ok'){
193
+ console.log("hhhhhhhhhhhhhhhhh2")
194
+ let res = JSON.parse(jo.result)
195
+ console.log("hhhhhhhhhhhhhhhhh3")
196
+ if(res.code = 200){
197
+ this.showview = false
198
+ // 如果需要删除本地记录则去删除
199
+ console.log("hhhhhhhhhhhhhhhhh4")
200
+ if(this.delteLocal){
201
+ console.log("hhhhhhhhhhhhhhhhh5")
202
+ this.deleteLocalApply(this.model)
203
+ }
204
+ console.log("hhhhhhhhhhhhhhhhh6")
205
+ // 特殊处理
206
+ this.special(this.model)
207
+ console.log("hhhhhhhhhhhhhhhhh7")
208
+ this.loading=false
209
+ this.$dispatch('close')
210
+ console.log("hhhhhhhhhhhhhhhhh8")
211
+ this.initializtion()
212
+ console.log("hhhhhhhhhhhhhhhhh9")
213
+ this.$showMessage('操作成功')
214
+ }else{
215
+ this.$showMessage('操作失败,原因:' + res.data.msg)
216
+ }
217
+ }
218
+
219
+ },
220
+ async special(model){
221
+ console.log('进入async special方法')
222
+ if(this.data.distribute_async && model.button.button_name==='下发'){
223
+ // 流程异步处理
224
+ let http = new HttpResetClass();
225
+ // let res = await http.load('POST',this.$androidUtil.getProxyUrl() + '/rs/logic/syncprocess',{data:{model:model,loginUser:this.$login.f}}, {resolveMsg: null, rejectMsg: '流程异步下发据保存失败'})
226
+ let res = await http.load('POST',this.$androidUtil.getProxyUrl() + '/rs/logic/syncprocess',{data:{model:model,loginUser: Vue.user}}, {resolveMsg: null, rejectMsg: '流程异步下发据保存失败'})
227
+ console.log("流程的异步处理:",JSON.stringify(res.data))
228
+ }
229
+ if(this.data.distribute_async && model.button.button_name==='完成'){
230
+ // 强制结束
231
+ let http = new HttpResetClass();
232
+ let res = await http.load('POST',this.$androidUtil.getProxyUrl() + '/rs/logic/stoprocess',{data:{model:model,loginUser: Vue.user}}, {resolveMsg: null, rejectMsg: '流程异步完成数据保存失败'})
233
+ // let res = await http.load('POST',this.$androidUtil.getProxyUrl() + '/rs/logic/stoprocess',{data:{model:model,loginUser:this.$login.f}}, {resolveMsg: null, rejectMsg: '流程异步完成数据保存失败'})
234
+ console.log("流程的异步处理:",JSON.stringify(res.data))
235
+ }
236
+ },
237
+ // 组件初始化操作
238
+ refurbish(){
239
+ if(!this.$workflow_vue){
240
+ this.$showMessage('流程配置文件不存在,请反馈系统管理员')
241
+ return
242
+ }
243
+ console.log('内存中的流程配置文件数据=>' + JSON.stringify(this.$workflow_vue))
244
+ this.json_datas=this.$workflow_vue
245
+ let sum = 0
246
+ let jsonData ={}
247
+ for(let i=0;i<this.json_datas.activitys.length;i++){
248
+ if(this.selectdata.defname==this.json_datas.activitys[i].title){
249
+ jsonData = this.json_datas.activitys[i]
250
+ sum++
251
+ }
252
+ }
253
+ console.log('sum=>' + sum)
254
+ if(sum==1){
255
+ this.data =null
256
+ this.data = jsonData
257
+ console.log('调用initializtion前的this.data=>' + JSON.stringify(this.data))
258
+ this.initializtion()
259
+
260
+ } else if(sum==0) {
261
+ this.$showMessage(`没有在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置`)
262
+ } else {
263
+ this.$showMessage(`在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置:${sum}个`)
264
+ }
265
+ },
266
+ // json配置数据处理 比如下拉框的options
267
+ async initializtion() {
268
+
269
+ console.log('进入initializtion()方法')
270
+ console.log('接收到的selectdata有无变化'+JSON.stringify(this.selectdata))
271
+ console.log('接收到的selectdata有无actorexpression'+JSON.stringify(this.selectdata.actorexpression))
272
+ // 下发人 options 处理,options初始化
273
+ if(this.selectdata.actorexpression){
274
+ //截取actorexpression
275
+ let http = new HttpResetClass()
276
+ var url = this.$androidUtil.getProxyUrl() + '/rs/search'
277
+ console.log('即将请求后台获取下发人员,url=>' + url)
278
+ // R(安装员报装)
279
+ console.log("777777776"+JSON.stringify(this.selectdata.actorexpression))
280
+ let res
281
+ if (this.selectdata.actorexpression.startsWith('R')) {
282
+ let actorexpression = this.selectdata.actorexpression
283
+ //let actorexpression="R(安装员报装)"
284
+ let actor = actorexpression.substring(actorexpression.indexOf('(') + 1, actorexpression.indexOf(')'))
285
+ console.log("看看角色" + JSON.stringify(actor))
286
+ res= await http.load('POST', url, {
287
+ source: `tool.getChildrenOfResName($${actor}$)`,
288
+ userid: Vue.user.id
289
+ }, {resolveMsg: null, rejectMsg: '获取当前部门人员失败'})
290
+ }else{
291
+ res = await http.load('POST', url, this.selectdata.actorexpression, {resolveMsg: null, rejectMsg: '获取当前部门人员失败'})
292
+ }
293
+ console.log("请求后台获取下发人员结果转换=>" + JSON.stringify(res))
294
+ let jsonString = JSON.stringify(res.data)
295
+ let jsonArray = []
296
+ if(jsonString.startsWith("{")){
297
+ jsonArray.push(res.data)
298
+ res.data = jsonArray
299
+ }
300
+ this.department_search = res.data
301
+ }
302
+
303
+ // data 填充 selectdata
304
+ console.log('即将合并data与selectdata,selectdata数据=>' + JSON.stringify(this.selectdata))
305
+ this.data = Object.assign({},this.data, this.selectdata)
306
+ console.log('this.data的值=>' + JSON.stringify(this.data))
307
+
308
+ // 初始化 fields
309
+ console.log('this.data.fields.length=>' + this.data.fields.length)
310
+ for(let i=0;i<this.data.fields.length;i++){
311
+ // 如果selectdata有这些key,则把selectdata的value赋值给data的value
312
+ if(this.selectdata[this.data.fields[i].field]){
313
+ this.data.fields[i].value = this.selectdata[this.data.fields[i].field]
314
+ }
315
+ // 如果配置类型为select,优先从参数列表获取options
316
+ if(this.data.fields[i].type == 'select'){
317
+ console.log('进入下拉框参数获取方法,参数名称=>' + this.data.fields[i].label)
318
+ console.log('$appdata中的缓存参数与单值=>' + JSON.stringify(this.$appdata))
319
+ var param = this.$appdata.getParam(this.data.fields[i].label)
320
+ console.log(param)
321
+ if (param){
322
+ this.data.fields[i].options = param
323
+ }
324
+
325
+ }
326
+ // 设置用户类型
327
+ if (this.data.fields[i].label == '用户类型') {
328
+ this.data.fields[i].options = [{label: '民用', value: '民用'},{label: '非民用', value: '非民用'}]
329
+ }
330
+ // 获取县区
331
+ if (this.data.fields[i].label == '县/区') {
332
+ let http = new HttpResetClass()
333
+ let area = await http.load('post',`${this.$androidUtil.getProxyUrl()}/rs/sql/applysingleTable`, {
334
+ data: {
335
+ // items: 'f_bill_url,f_url_code',
336
+ tablename: 't_pcd',
337
+ condition: `f_filialeids = '${Vue.user.f_orgids}'`
338
+ }
339
+ }, {resolveMsg: null, rejectMsg: null})
340
+ let rs = []
341
+ for (let i = 0; i < area.data.length; i++) {
342
+ let temp = {
343
+ label: area.data[i].f_pcd,
344
+ value: area.data[i].f_pcd
345
+ }
346
+ rs.push(temp)
347
+ }
348
+ this.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
349
+ }
350
+ }
351
+ // 初始化 buttons_fields
352
+ for(let i=0;i<this.data.buttons.length;i++){
353
+ if(this.data.buttons[i].button_fields){
354
+ for(let j=0;j<this.data.buttons[i].button_fields.length;j++){
355
+ // 如果selectdata有这些key,则把selectdata的value赋值给data的value
356
+ if(this.selectdata[this.data.buttons[i].button_fields[j].field]){
357
+ this.data.buttons[i].button_fields[j].value = this.selectdata[this.data.buttons[i].button_fields[j].field]
358
+ }
359
+ // 如果配置类型为select,优先从参数列表获取options
360
+ if(this.data.buttons[i].button_fields[j].type==='select'&&this.$appdata.getParam(this.data.buttons[i].button_fields[j].label)){
361
+ console.log("这里是给select赋值的地方"+JSON.stringify(this.data.buttons[i].button_fields[j]))
362
+ console.log("参数列表获取到的"+JSON.stringify(this.$appdata.getParam(this.data.buttons[i].button_fields[j].label)))
363
+ this.data.buttons[i].button_fields[j].options=this.$appdata.getParam(this.data.buttons[i].button_fields[j].label)
364
+ }
365
+ // 下发特殊配置
366
+ if(this.data.buttons[i].button_name==='下发'){
367
+ if(this.data.buttons[i].button_fields.length===1){
368
+ // value初始化
369
+ // if(this.department_search){
370
+ console.log("看看111department_search"+JSON.stringify(this.department_search))
371
+
372
+ if(this.selectdata[this.data.buttons[i].button_fields[0].field]){
373
+
374
+ for(let k=0;k<this.department_search.length;k++){
375
+ // 将id转换为name
376
+ if(Number(this.department_search[k].id) === Number(this.selectdata[this.data.buttons[i].button_fields[0].field])){
377
+ this.data.buttons[i].button_fields[0].value=this.department_search[k].name
378
+ }
379
+ }
380
+ }
381
+
382
+ if(this.department_search){
383
+ let array = []
384
+ console.log("看看department_search"+JSON.stringify(this.department_search))
385
+ this.department_search.forEach((paper)=>{
386
+ array.push({label:paper.name,value:paper.name})
387
+ })
388
+ this.data.buttons[i].button_fields[0].options = array
389
+ }
390
+ }else {
391
+ this.$showMessage("下发按钮必须满足 当且仅当一个字段")
392
+ }
393
+ }
394
+ }
395
+ }
396
+ }
397
+ // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
398
+ let temp = JSON.parse(JSON.stringify(this.data))
399
+ // 退回原因展示
400
+ if(this.selectdata.f_back_reason){
401
+ temp['back_reason'] = this.selectdata.f_back_reason
402
+ }
403
+ console.log('即将给show_data赋值temp=>' + JSON.stringify(temp))
404
+ console.log(JSON.stringify(this.show_data.ppp))
405
+ if (JSON.stringify(this.show_data.ppp)=='{}'){
406
+ this.show_data.ppp = temp
407
+ console.log("重新赋值")
408
+
409
+ }else{
410
+ console.log("不重新赋值")
411
+ }
412
+ console.log('initializtion()方法结束,showview')
413
+ this.showview = true
414
+ },
415
+ deleteLocalApply(model){
416
+ console.log(`前台上传完成,开始删除本地报建工单`)
417
+ this.$androidUtil.bzLogic('deleteApply', {data:model})
418
+ }
419
+ },
420
+ events: {
421
+ 'checkboxSelectControl'(index,index2){
422
+ if(this.$refs.service_show.data.fields[index].label=="施工提交资料"){
423
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
424
+ if(this.$refs.service_show.data.fields[i].label=="施工已上传文件"){
425
+ //增加和删除框中的内容
426
+ if(this.$refs.service_show.data.fields[index].items[index2].value == false){
427
+ // this.$refs.service_show.data.fields[i].value+=this.$refs.service_show.data.fields[index].items[index2].label+" ";
428
+ this.$refs.service_show.data.fields[i].value=this.$refs.service_show.data.fields[i].value==undefined?'':this.$refs.service_show.data.fields[i].value+this.$refs.service_show.data.fields[index].items[index2].label+" ";
429
+ this.$refs.service_show.data.fields[index].items[index2].value=true;
430
+ }else{
431
+ let deleteValue = this.$refs.service_show.data.fields[index].items[index2].label;
432
+ let values =this.$refs.service_show.data.fields[i].value;
433
+ let result = values.split(" ").filter((item)=>{
434
+ return item!=deleteValue;
435
+ }).join(" ")
436
+ this.$refs.service_show.data.fields[i].value =result;
437
+ this.$refs.service_show.data.fields[index].items[index2].value=false;
438
+ }
439
+ //}
440
+ }
441
+ }
442
+ }
443
+ if(this.$refs.service_show.data.fields[index].label=="验收提交资料"){
444
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
445
+
446
+ if(this.$refs.service_show.data.fields[i].label=="验收已上传文件"){
447
+ //增加和删除框中的内容
448
+ if(this.$refs.service_show.data.fields[index].items[index2].value == false){
449
+ this.$refs.service_show.data.fields[i].value=this.$refs.service_show.data.fields[i].value==undefined?'':this.$refs.service_show.data.fields[i].value+this.$refs.service_show.data.fields[index].items[index2].label+" ";
450
+ this.$refs.service_show.data.fields[index].items[index2].value=true;
451
+ }else{
452
+ let deleteValue = this.$refs.service_show.data.fields[index].items[index2].label;
453
+ let values =this.$refs.service_show.data.fields[i].value;
454
+ let result = values.split(" ").filter((item)=>{
455
+ return item!=deleteValue;
456
+ }).join(" ")
457
+ this.$refs.service_show.data.fields[i].value =result;
458
+ this.$refs.service_show.data.fields[index].items[index2].value=false;
459
+ }
460
+ //}
461
+ }
462
+ }
463
+ }
464
+ this.$refs.service_show.update()
465
+ },
466
+ // 任意select选中时触发事件
467
+ async 'select_cascade'(index){
468
+ // this.$refs.service_show.model_temp // 子业务显示组件
469
+ // 级联操作示例:
470
+ /*
471
+ if(this.$refs.service_show.model_temp.activitys.ields[index].label==='报建类型'){
472
+ for(let i=0;i<this.$refs.service_show.model_temp.activitys.fields.length;i++){
473
+ // 控制设置级联
474
+ // 源select所选的值 this.$refs.service_show.model_temp.activitys.fields[index].value
475
+ if(this.$refs.service_show.model_temp.activitys.fields[i].label==='级联测试2'){
476
+ this.$refs.service_show.model_temp.activitys.fields[i].options=[
477
+ {label:'级联选项1',value:'级联选项1'},{label:'级联选项2',value:'级联选项2'},{label:'级联选项3',value:'级联选项3'}
478
+ ]
479
+ }
480
+ }
481
+ }
482
+ */
483
+ if (this.$refs.service_show.data.fields[index].label === '县/区') {
484
+ let temp = this.$refs.service_show.data.fields[index].value
485
+ console.log('==============================县/区:' + temp)
486
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
487
+ // 控制设置级联
488
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
489
+ if (this.$refs.service_show.data.fields[i].label === '街道名称') {
490
+ await this.$resetpost(`${this.$androidUtil.getProxyUrl()}/rs/sql/applysingleTable`, {
491
+ data: {
492
+ tablename: 't_street',
493
+ condition: `f_filialeids = '${Vue.user.f_orgids}' and f_pcd='${temp}'`
494
+ }
495
+ }, {resolveMsg: null, rejectMsg: null}).then(res => {
496
+ let streetrs = []
497
+ for (let i = 0; i < res.data.length; i++) {
498
+ let temp = {
499
+ label: res.data[i].f_street,
500
+ value: res.data[i].f_street
501
+ }
502
+ streetrs.push(temp)
503
+ }
504
+ this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...streetrs]
505
+ // console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~option:', this.$refs.service_show.data.fields[i].options)
506
+ this.$refs.service_show.update()
507
+ })
508
+ }
509
+ }
510
+ }
511
+ if (this.$refs.service_show.data.fields[index].label === '街道名称') {
512
+ let temp = this.$refs.service_show.data.fields[index].value
513
+ console.log('=============================街道:' + temp)
514
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
515
+ // 控制设置级联
516
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
517
+ if (this.$refs.service_show.data.fields[i].label === '小区名称') {
518
+ await this.$resetpost(`${this.$androidUtil.getProxyUrl()}/rs/sql/applysingleTable`, {
519
+ data: {
520
+ tablename: 't_area',
521
+ condition: `f_filialeids = '${Vue.user.f_orgids}' and f_street='${temp}'`
522
+ }
523
+ }, {resolveMsg: null, rejectMsg: null}).then(res => {
524
+ let arears = []
525
+ for (let i = 0; i < res.data.length; i++) {
526
+ let temp = {
527
+ label: res.data[i].f_residential_area,
528
+ value: res.data[i].f_residential_area
529
+ }
530
+ arears.push(temp)
531
+ }
532
+ this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...arears]
533
+ // console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~option:', this.$refs.service_show.data.fields[i].options)
534
+ this.$refs.service_show.update()
535
+ })
536
+ }
537
+ }
538
+ }
539
+ // 合成地址
540
+ if (
541
+ this.$refs.service_show.data.fields[index].label === '县/区' ||
542
+ this.$refs.service_show.data.fields[index].label === '街道名称' ||
543
+ this.$refs.service_show.data.fields[index].label === '小区名称' ||
544
+ this.$refs.service_show.data.fields[index].label === '楼号' ||
545
+ this.$refs.service_show.data.fields[index].label === '单元号' ||
546
+ this.$refs.service_show.data.fields[index].label === '楼层' ||
547
+ this.$refs.service_show.data.fields[index].label === '门牌号'
548
+ ) {
549
+ console.log('即将合成地址')
550
+ var address = ''
551
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
552
+ // 控制设置级联
553
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
554
+ // xxx xx xxx
555
+ if (this.$refs.service_show.data.fields[i].label === '县/区' && this.$refs.service_show.data.fields[i].value) {
556
+ address += this.$refs.service_show.data.fields[i].value
557
+ }
558
+ if (this.$refs.service_show.data.fields[i].label === '街道名称' && this.$refs.service_show.data.fields[i].value) {
559
+ address += this.$refs.service_show.data.fields[i].value
560
+ }
561
+ if (this.$refs.service_show.data.fields[i].label === '小区名称' && this.$refs.service_show.data.fields[i].value) {
562
+ address += this.$refs.service_show.data.fields[i].value
563
+ }
564
+ if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value) {
565
+ address += this.$refs.service_show.data.fields[i].value
566
+ }
567
+ if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value) {
568
+ address += '栋'
569
+ }
570
+ if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value) {
571
+ address += '-' +this.$refs.service_show.data.fields[i].value
572
+ }
573
+ if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value) {
574
+ address += '单元'
575
+ }
576
+ if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value) {
577
+ address += '-' +this.$refs.service_show.data.fields[i].value
578
+ }
579
+ if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value) {
580
+ address += '层'
581
+ }
582
+ if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value) {
583
+ address += '-' +this.$refs.service_show.data.fields[i].value
584
+ }
585
+ if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value) {
586
+ address += '室'
587
+ }
588
+
589
+ }
590
+ console.log('获取到的address=>' + address)
591
+ // 数据获取完毕时放入地址text
592
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
593
+ if (this.$refs.service_show.data.fields[i].label === '地址' || this.$refs.service_show.data.fields[i].label === '报装地址') {
594
+ this.$refs.service_show.data.fields[i].value = address
595
+ console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
596
+ }
597
+ }
598
+ }
599
+ if (this.$refs.service_show.data.fields[index].label == '用户类型'){
600
+ if(this.$refs.service_show.data.fields[index].value == '非民用'){
601
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
602
+ if (this.$refs.service_show.data.fields[i].label === '小区名称') {
603
+ this.$refs.service_show.data.fields[i].required=false;
604
+ }
605
+ }
606
+ }else{
607
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
608
+ if (this.$refs.service_show.data.fields[i].label === '小区名称') {
609
+ this.$refs.service_show.data.fields[i].required=true;
610
+ }
611
+ }
612
+ }
613
+ }
614
+ },
615
+ // 获取view层button事件
616
+ async 'button'(model){
617
+ if (this.data.defname==='踏勘、建立工程编号'){
618
+ if (model.button.button_name === '终止'){
619
+ this.stop_show=true
620
+ return
621
+ }
622
+ }
623
+ this.loading=true
624
+ console.log('进入async button事件方法')
625
+ var delteLocal = true
626
+ // 点击保存与重置按钮不需要修改本地工单状态
627
+ if(model.button.button_name == '保存' || model.button.button_name==='重置'){
628
+ delteLocal = false
629
+ }
630
+ // 点击重置按钮就重置数据
631
+ if(model.button.button_name==='重置'){
632
+ this.initializtion()
633
+ return
634
+ }
635
+ if(model.button.button_name==='下发'){
636
+ let person_name = model.button.button_fields[this.show_data.buttons[model.button.button_index].button_fields[0].field]
637
+ for(let i=0;i<this.department_search.length;i++){
638
+ // 找到人名为person_name 的人,然后把人名换成id
639
+ if(this.department_search[i].name === person_name){
640
+ model.button.button_fields[this.show_data.buttons[model.button.button_index].button_fields[0].field] = this.department_search[i].id
641
+ }
642
+ }
643
+ }
644
+ console.log("button事件接收参数model=>" + JSON.stringify(model))
645
+ model=Object.assign({},this.selectdata,model)
646
+ console.log('合并selectdata与model后的model=>' + JSON.stringify(model))
647
+ if (this.data.defname==='踏勘、建立工程编号'&& model.button.button_name === '提交'){
648
+ this.loading=false
649
+ this.apply_show=true
650
+ this.models2 = model
651
+ return
652
+ }
653
+ let http = new HttpResetClass()
654
+ var url = this.$androidUtil.getProxyUrl() + '/rs/logic/ApplyProductService'
655
+ // let res = await http.load('POST',url,{data:data}, {resolveMsg: null, rejectMsg: null})
656
+ // // 先判断是否包含code,如果服务端异常,可能不存在code
657
+ // console.log("service处理完成返回数据=>" + res)
658
+ // if(!res.code){
659
+ // console.log("service处理完成返回数据=>" + res)
660
+ // this.$showMessage('操作异常,原因:' + res)
661
+ // }else{
662
+ // console.log("service处理完成返回数据=>" + JSON.stringify(res))
663
+ // if(res.code = 200){
664
+ // this.showview = false
665
+ // // 特殊处理
666
+ // this.special(model)
667
+ // this.$dispatch('close')
668
+ // this.initializtion()
669
+ // this.$showMessage('操作成功')
670
+ // }else{
671
+ // this.$showMessage('操作失败,原因:' + res.data.msg)
672
+ // }
673
+ // }
674
+ let btn = btn_operate(this, url, http, model, delteLocal)
675
+ co(btn)
676
+ }
677
+ },
678
+ watch:{
679
+ // 监听selectdata的变化
680
+ 'selectdata'() {
681
+ console.log('进入selectdata改变事件data=>' + JSON.stringify(this.selectdata))
682
+ this.refurbish()
683
+ },
684
+ deep:true
685
+ }
686
+ }
687
+
688
+ let btn_operate = function * (self, url, http, model, delteLocal) {
689
+ self.delteLocal=delteLocal
690
+ console.log("model的信息",model)
691
+ // 下发,提交,保存,退回都在后台处理
692
+ console.log('即将请求后台url=>' + url)
693
+ model.employeetemplate=''
694
+ self.model=model
695
+ console.log(JSON.stringify(self.model))
696
+ let param={
697
+ employeetemplate:'',
698
+ tables:self.data.tables,
699
+ workflow_xmlfilename : self.$workflow_vue.workflow_xmlfilename,
700
+ start_activity:model.start_activity,
701
+ model:model,
702
+ loginUser:Vue.user
703
+ }
704
+ if(param.model.defname === '现场勘查定价'){
705
+ param.model.f_unaccounts_money = param.model.f_total_cost
706
+ }
707
+ // http.load('POST',url,{data:{employeetemplate:'',tables:self.data.tables,start_activity:self.$workflow_vue.start_activity,model:model,loginUser:Vue.user}}, {resolveMsg: null, rejectMsg: null})
708
+ let paramStr = JSON.stringify(param)
709
+ // 多长截断一次
710
+ let subLength = 800
711
+ for (let i = 0; i < paramStr.length; i += subLength) {
712
+ HostApp.param_cache(paramStr.substr(i, subLength))
713
+ }
714
+ HostApp.__this__ = self
715
+ HostApp.syncLogic({
716
+ // logic别名,key必须为logic
717
+ 'logic': 'updatePic',
718
+ // 回调执行方法名,key必须为callback
719
+ 'callback': 'javascript:HostApp.__this__.saveCallBack()',
720
+ // 固定key,代表是否将logic执行结果作为参数传入回调方法,1代表true,0代表false,
721
+ // 执行回调方法传入key为backresult
722
+ // 如需额外拼接参数,写在logic返回值的params,例如xxlogic返回:{"params": "success"}
723
+ 'backresult': 1
724
+ })
725
+
726
+ }
727
+ </script>