apply-clients 5.0.35-22 → 5.0.35-26

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,765 +1,765 @@
1
- <template>
2
- <div class="auto select-overspread">
3
- <div v-if="data.back_reason" class="panel panel-info">
4
- <span style="color: red"> 请注意被退回原因为:{{ data.back_reason }}</span>
5
- </div>
6
- <validator name="v">
7
- <form class="form-horizontal">
8
- <div class="col-sm-11 form-group">
9
- <div v-for="(index,item) in data.fields">
10
- <!--input-->
11
- <div v-if="item.type==='input'" v-show="!item.hidden"
12
- :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-4 form-group']">
13
- <label
14
- :class="item.label_bootstraped?item.label_bootstraped+' control-label':'control-label col-sm-6'">{{
15
- item.label
16
- }}:</label>
17
- <div :class="item.value_bootstraped?item.value_bootstraped:'col-sm-6'">
18
- <input class="form-control"
19
- :type="item.type"
20
- v-model="data.fields[index].value"
21
- :placeholder="item.placeholder"
22
- :value="data.fields[index].value"
23
- :readonly="item.readonly"
24
- :disable="item.disable"
25
- @change="disabled_check(index,data.fields[index].required,data.fields[index].value)"
26
- @blur="check_disable"
27
- />
28
- </div>
29
- </div>
30
- <!--number-->
31
- <div v-if="item.type==='number'" v-show="!item.hidden"
32
- :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-4 form-group']">
33
- <label
34
- :class="item.label_bootstraped?item.label_bootstraped+' control-label':'control-label col-sm-6'">{{
35
- item.label
36
- }}:</label>
37
- <div :class="item.value_bootstraped?item.value_bootstraped:'col-sm-6'">
38
- <input class="form-control"
39
- :type="item.type"
40
- v-model="data.fields[index].value"
41
- :placeholder="item.placeholder"
42
- :value="data.fields[index].value"
43
- :readonly="item.readonly"
44
- :disable="item.disable"
45
- @change="disabled_check(index,data.fields[index].required,data.fields[index].value)"
46
- @blur="check_disable"
47
- />
48
- </div>
49
- </div>
50
-
51
- <!--时间datepicker-->
52
- <div v-if="item.type==='datepicker'"
53
- :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-xs-12 form-group']">
54
- <label style="margin-top: 0.7em"
55
- :class="item.label_bootstraped?item.label_bootstraped +' control-label':'control-label col-sm-6'">{{
56
- item.label
57
- }}:</label>
58
- <div :class="item.value_bootstraped?item.value_bootstraped:'col-sm-6'">
59
- <datepicker
60
- :placeholder="item.placeholder"
61
- :value.sync="data.fields[index].value"
62
- :format="'yyyy-MM-dd HH:mm:ss'"
63
- v-model="data.fields[index].value"
64
- :width="'100%'"
65
- class="form-control"
66
- :readonly="item.readonly"
67
- :disabled="item.disabled"
68
- @blur="check_disable"
69
- :show-reset-button="reset">
70
- </datepicker>
71
- </div>
72
- </div>
73
-
74
-
75
- <!--textarea-->
76
- <div v-if="item.type==='textarea'"
77
- :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-12 form-group']">
78
- <label
79
- :class="item.label_bootstraped?item.label_bootstraped+' control-label':'control-label col-sm-2'">{{
80
- item.label
81
- }}:</label>
82
- <div :class="item.value_bootstraped?item.value_bootstraped:'col-sm-10'">
83
- <textarea
84
- :readonly="item.readonly"
85
- :disabled="item.disabled"
86
- class="form-control"
87
- :rows="item.rows"
88
- v-model="data.fields[index].value"
89
- @change="disabled_check(index,data.fields[index].required,data.fields[index].value)"
90
- @blur="check_disable"
91
- >
92
- </textarea>
93
- </div>
94
- </div>
95
-
96
- <!--radio-->
97
- <div v-if="item.type==='radio'"
98
- :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-12 form-group']">
99
- <label v-if="item.label"
100
- :class="item.label_bootstraped?item.label_bootstraped+' control-label':'control-label col-sm-2'">{{
101
- item.label
102
- }}:</label>
103
- <div class="col-xs-12">
104
- <div
105
- :class="item.value_bootstraped?item.value_bootstraped:item.items.length%2 == 0?'col-xs-5': 'col-xs-3'"
106
- v-for="(index2,row) in item.items">
107
- <label style="margin-top: 0.7em" for="row.label"
108
- :class="item.items.length%2 == 0?'col-xs-4': 'col-xs-2'">{{ row.label }}</label>
109
- <input @blur="check_disable" :class="item.items.length%2 == 0?'col-xs-1': 'col-xs-1'"
110
- :readonly="item.readonly" :disabled="item.disabled" style="margin-top: 10px" type="radio"
111
- :name="index" :id="row.label" v-bind:value="data.fields[index].items[index2].value"
112
- v-model="data.fields[index].value">
113
- </div>
114
- </div>
115
- </div>
116
-
117
- <!--select-->
118
- <div v-if="item.type==='select'"
119
- :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-4 form-group']">
120
- <label
121
- :class="item.label_bootstraped?item.label_bootstraped+' control-label':'control-label col-sm-6'">{{
122
- item.label
123
- }}:</label>
124
- <input-select :class="item.value_bootstraped?item.value_bootstraped:'col-sm-6'" @blur="check_disable"
125
- @change="select_change(index),disabled_check(index,data.fields[index].required,data.fields[index].value)"
126
- :readonly="item.readonly" :disable="item.disabled" :value.sync="data.fields[index].value"
127
- v-model="data.fields[index].value"
128
- :options='item.options' :valueSingle="true"></input-select>
129
-
130
- </div>
131
-
132
- <!--checkbox-->
133
- <div v-if="item.type==='checkbox'"
134
- :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-12 form-group']">
135
- <label v-if="item.label"
136
- :class="item.label_bootstraped?item.label_bootstraped+' control-label':'control-label col-sm-2'">{{
137
- item.label
138
- }}:</label>
139
- <div style="margin-top: 0.7em"
140
- :class="item.value_bootstraped?item.value_bootstraped:'control-label col-sm-2'"
141
- v-for="(index2,row) in item.items">
142
- <label class="font-size form-group col-sm-6">{{ row.label }}</label>
143
- <input :readonly="item.readonly" :disabled="item.disabled" type="checkbox" class="col-sm-6"
144
- :id="row.label" v-model="data.fields[index].items[index2].value">
145
- </div>
146
- </div>
147
-
148
-
149
- </div>
150
- </div>
151
- <div class="form-group col-sm-11">
152
- <label class="text-left font">现场照片</label>
153
-
154
- <div class="auto">
155
- <div class="panel" style="padding: 10px 10px 5px 10px;">
156
- <div class="panel-body panel-self"
157
- style="background-color: #F8F8F8;width: 100%;height: 260px;position: relative">
158
- <div class="row" style="height: 240px;overflow: scroll;top: 1px">
159
- <div class="col-xs-4 col-sm-3 col-md-2" style="margin-bottom: 35px"
160
- v-for="(index,img) in model.f_overall_imgs">
161
- <img-self :src="img.f_overall_path" alt="现场照片" :width="140" :height="170"></img-self>
162
- <img src="../../../assets/删除.png" @click="delfile('f_overall_path', img.f_overall_path,index)"
163
- style="width: 15px;margin-top: -80px" alt="">
164
- </div>
165
- </div>
166
- <div class="row text-right div-photo">
167
- <button type="button" name="button" class="btn btn-photo" @click="takePic('f_overall_path', '现场照片')">
168
- 拍照
169
- </button>
170
- <!--<button type="button" name="button" class="btn btn-primary btn-photo" @click="takePic('f_overall_path', '总体安检照片1')">拍照</button>-->
171
- <!--&nbsp;&nbsp;&nbsp;&nbsp;<img src="../../../assets/remove.png" :class="style__" @click="delfile('f_overall_path', img.f_overall_path)" style="width: 25%;"></img>-->
172
- </div>
173
- </div>
174
- </div>
175
- </div>
176
- </div>
177
- <div class="form-group col-sm-11" v-show="isshow">
178
- <label class="text-left font">用户签名</label>
179
- <div class="auto">
180
- <div class="panel">
181
- <div class="panel-body panel-self"
182
- style="background-color: #F8F8F8;width: 100%;height: 260px;position: relative">
183
- <div class="row" style="height: 240px;overflow: scroll;top: 1px">
184
- <div class="col-sm-4">
185
- <img :src="model.f_sign_path" :width="200" :height="150"/>
186
- </div>
187
- </div>
188
- <div class="row text-right div-photo">
189
- <button type="button" name="button" class="btn btn-primary btn-photo" @click="sign">签名</button>
190
- </div>
191
- </div>
192
- </div>
193
- </div>
194
- </div>
195
-
196
- <!-- <input @click="gotohetong('民用')" type="checkbox" v-model="model.f_hege"/><label class="text-left font">我已阅读<a href="#" @click="gotohetong('民用')">居民天然气供用气合同</a></label>-->
197
- <div class="form-group col-sm-11" v-show="kchege&&data.f_user_type=='民用'&&data.title!='现场勘查'">
198
- <input type="checkbox" v-model="model.f_hege"/><label class="text-left font">我已阅读<a href="#"
199
- @click="gotohetong('民用')">居民天然气供用气合同</a></label>
200
- </div>
201
- <div class="form-group col-sm-11" v-show="kchege&&(data.f_user_type=='非民用'||data.title=='现场勘查')">
202
- <input type="checkbox" v-model="model.f_hege"/><label class="text-left font">我已阅读<a href="#"
203
- @click="gotohetong('非民用1')">天然气工程建设安装合同</a>,<a
204
- href="#" @click="gotohetong('非民用2')">管道燃气供用气合同</a></label>
205
- </div>
206
- <div class="form-group col-sm-11" v-show="kcbuhege">
207
- <div class="col-sm-12 form-group">
208
- <label class="control-label col-sm-2">不合格原因:</label>
209
- <div class="col-sm-10">
210
- <textarea
211
- class="form-control"
212
- v-model="model.f_buhege_reason">
213
- </textarea>
214
- </div>
215
- </div>
216
-
217
-
218
- </div>
219
- <div class="col-sm-11 form-group">
220
- <div class="form-group col-sm-6">
221
- <label class=" col-sm-4 control-label">分公司:</label>
222
- <div class="col-sm-5">
223
- <input class="form-control" type="text" v-model="model.f_filiale" disabled>
224
- </div>
225
- </div>
226
- <div class="col-sm-6 form-group">
227
- <label class="control-label col-sm-6">部门:</label>
228
- <div class="col-sm-5">
229
- <input type="text" class="form-control" disabled v-model="model.f_parentname"/>
230
- </div>
231
- </div>
232
- </div>
233
- <div class="col-sm-11 form-group">
234
- <div class="col-sm-6 form-group">
235
- <label class="control-label col-sm-4">操作日期:</label>
236
- <div class="col-sm-5">
237
- <input type="text" class="form-control" disabled v-model="model.f_operate_date"/>
238
- </div>
239
- </div>
240
- <div class="col-sm-6 form-group">
241
- <label class="control-label col-sm-6">操作人:</label>
242
- <div class="col-sm-5">
243
- <input type="text" class="form-control" disabled v-model="model.f_operator"/>
244
- </div>
245
- </div>
246
- </div>
247
-
248
- </form>
249
- </validator>
250
- <div class="from-group col-xs-12">
251
- <center>
252
- <div v-for="(index,button) in data.buttons"
253
- :class="[data.buttons.length==4?'col-xs-3':'',data.buttons.length==3?'col-xs-4':'',data.buttons.length==2?'col-xs-6':'']">
254
- <!-- 按钮组 -->
255
- <button :disabled="(button.button_name==='提交'||button.button_name==='下发')&&disable_button"
256
- type="button" @click="clicked(index,button)" style="border-radius:5px; "
257
- :class="[(button.button_name==='提交'||button.button_name==='下发')&&disable_button?'btn btn-default':'btn btn-primary',data.buttons.length==4 ? 'col-xs-2 col-xs-offset-1':'',data.buttons.length==3 ? 'col-xs-2 col-xs-offset-2':'',data.buttons.length==2 ? 'col-xs-4 col-xs-offset-2':'']">
258
- {{ button.button_name }}
259
- </button>
260
- </div>
261
- </center>
262
- </div>
263
- <div class="form-group col-xs-12" style="height: 50px;width: 100%"></div>
264
- <!-- 模态框 -->
265
- <modal v-if="showmodal" :show.sync="showmodal" v-ref:modal backdrop="false">
266
- <header slot="modal-header" class="modal-header">
267
- <button type="button" class="close" @click="closemodal"><span>&times;</span></button>
268
- <h4 class="modal-title">{{ model.button.button_name }}</h4>
269
- </header>
270
- <article slot="modal-body" class="modal-body">
271
- <div class="col-sm-12" v-for="(index,button_field) in data.buttons[model.button.button_index].button_fields">
272
- <label class="control-label col-sm-3" style="margin-top: 10px">{{ button_field.label }}:</label>
273
- <div class="col-sm-7">
274
- <!--select-->
275
- <input-select v-if="button_field.type=='select'"
276
- :value.sync="data.buttons[model.button.button_index].button_fields[index].value"
277
- v-model="data.buttons[model.button.button_index].button_fields[index].value"
278
- :options='button_field.options'></input-select>
279
- <!-- input -->
280
- <input v-else type="text" class="form-control"
281
- v-model="data.buttons[model.button.button_index].button_fields[index].value"/>
282
- </div>
283
- </div>
284
- </article>
285
- <footer slot="modal-footer" style="border-top:none" class="modal-footer">
286
- <button v-show="showmodal" type="button" class="btn btn-primary" @click='acknowledge'>确认</button>
287
- </footer>
288
- </modal>
289
- </div>
290
- </template>
291
- <script>
292
-
293
- // Date格式化
294
-
295
-
296
- Date.prototype.Format = function (fmt) {
297
- var o = {
298
- "M+": this.getMonth() + 1, //月份
299
- "d+": this.getDate(), //日
300
- "H+": this.getHours(), //小时
301
- "m+": this.getMinutes(), //分
302
- "s+": this.getSeconds(), //秒
303
- "q+": Math.floor((this.getMonth() + 3) / 3), //季度
304
- "S": this.getMilliseconds() //毫秒
305
- };
306
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
307
- for (var k in o)
308
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
309
- return fmt;
310
- }
311
-
312
- import Vue from 'vue'
313
- import * as Util from '../../Util'
314
- import {HttpResetClass} from 'vue-client'
315
- export default {
316
- title: '报建业务通用组件',
317
- props: ['data', 'model'],
318
-
319
- data() {
320
- return {
321
- isshow: true,
322
- kchege: false,
323
- kcbuhege: false,
324
- countmoney: [0, 0, 0],
325
- data: null,
326
- showmodal: false,
327
- disable_button: true
328
- }
329
- },
330
- created() {
331
-
332
- // 初始化数据
333
- this.initializtion()
334
- },
335
- methods: {
336
- gotohetong(val) {
337
- console.log(val)
338
- console.log("进入goto")
339
- this.$dispatch('gotonewpage', val)
340
- },
341
- cameraCallBack(prop, fileName) {
342
- if (prop == 'f_overall_path') {
343
- let f_overall_path = fileName + '?' + Math.random()
344
- HostApp.__this__.model.f_overall_imgs.push({
345
- f_overall_path: f_overall_path,
346
- f_overall_name: this.data.title
347
- })
348
- } else {
349
- HostApp.__this__.model[prop] = fileName + '?' + Math.random()
350
- }
351
- HostApp.__callback__ = null
352
- HostApp.__this__ = null
353
- },
354
- takePic(prop, title, index) {
355
- HostApp.__callback__ = this.cameraCallBack
356
- HostApp.__this__ = this
357
- console.log("prop:" + prop)
358
- console.log("this.prop:" + this.model[prop])
359
- let fileName
360
- if (prop == 'f_overall_path') {
361
- if (!this.model.f_overall_imgs[index] || this.model.f_overall_imgs[index].f_overall_path.includes("nopic.png")) {
362
- fileName = Util.guid() + '-' + prop + '.jpg'
363
- } else {
364
- fileName = Util.getFileName(this.model.f_overall_imgs[index].f_overall_path)
365
- }
366
- } else {
367
- if (!this.model[prop] || this.model[prop].includes("nopic.png")) {
368
- fileName = Util.guid() + '-' + prop + '.jpg'
369
- } else {
370
- fileName = Util.getFileName(this.model[prop])
371
- }
372
- }
373
-
374
- HostApp._open_a_page({
375
- type: 'boomerang',
376
- page: 'com.aofeng.hybrid.android.peripheral.CameraActivity',
377
- param: {
378
- file: fileName,
379
- requestCode: 111,
380
- callback: 'javascript:HostApp.__callback__("' + prop + '", "%s");',
381
- watermark: title + '\t时间:' + Util.toStandardTimeString() + '\t' + Vue.user.name
382
- }
383
- })
384
- },
385
- signCallback(prop, fileName) {
386
- // HostApp.alert('绑定属性:' + prop + ' 文件全路径如file:///storage/sdcard0/safecheck/abc.jpg:' + fullFileName)
387
- HostApp.__this__.$set('model.f_sign_path', fileName)
388
- HostApp.__callback__ = null
389
- HostApp.__this__ = null
390
- },
391
- delAudioFile(prop, fileName) {
392
- if (!fileName)
393
- return
394
- else {
395
- HostApp.delfile(fileName)
396
- this.model[prop] = null
397
- }
398
- },
399
- sign() {
400
- this.delAudioFile('f_sign_path', this.model.f_sign_path)
401
- let prop = 'f_sign_path'
402
- let idx = 'aofeng'
403
- let fileName
404
- if (!this.model.f_sign_path) {
405
- fileName = Util.guid() + '-valve-' + idx + '-' + prop + '.jpg'
406
- } else {
407
- fileName = Util.getFileName(this.model.f_sign_path)
408
- }
409
- HostApp.__callback__ = this.signCallback
410
- HostApp.__this__ = this
411
- HostApp.getSignature({
412
- file: fileName,
413
- requestCode: 111,
414
- callback: 'javascript:HostApp.__callback__("' + prop + '", "%s");'
415
- })
416
- },
417
- delfile(prop, fileName, index) {
418
- if (fileName == Vue.nopic)
419
- return
420
- else {
421
- if (prop == 'f_overall_path') {
422
- this.model.f_overall_imgs.splice(index, 1)
423
- HostApp.delfile(fileName)
424
- } else {
425
- HostApp.delfile(fileName)
426
- this.model[prop] = Vue.nopic
427
- }
428
- }
429
- },
430
- // 初始化数据
431
- initializtion() {
432
-
433
- if (this.data.title == '现场勘查' || this.data.title == '现场勘查定价') {
434
- this.isshow = false
435
- }
436
- console.log("5555555555555")
437
- console.log(this.data.f_user_type)
438
- console.log(this.isshow)
439
- Vue.nopic = 'file:///android_asset/nopic.png'
440
- if (!this.model.f_sign_path)
441
- this.$set('model.f_sign_path', Vue.nopic)
442
- console.log('!this.model.f_overall_imgs==>' + !this.model.f_overall_imgs)
443
- if (!this.model.f_overall_imgs) {
444
- let imgs = []
445
- this.$set('model.f_overall_imgs', imgs)
446
- console.log('进入setmodel.f_overall_imgs')
447
- }
448
- console.log('进入serviceview的initializtion方法')
449
- console.log(JSON.stringify(this.data))
450
- if (this.data.fields) {
451
- for (let i = 0; i < this.data.fields.length; i++) {
452
- if (this.data.fields[i].value) {
453
- if (this.data.fields[i].value == 'null') {
454
- console.log("看看为空的字段名" + this.data.fields[i].label)
455
- this.data.fields[i].value = null
456
- console.log("赋值完成")
457
- }
458
- }
459
- if (this.data.fields[i].type === 'datepicker' && !this.data.fields[i].value) {
460
- this.data.fields[i].value = new Date().Format("yyyy-MM-dd HH:mm:ss")
461
- }
462
- if (this.data.fields[i].label==='气价名称'){
463
- console.log(this.data.fields[i].options)
464
- let data={
465
- items:"f_price_name",
466
- tablename:"t_stairprice",
467
- condition:`f_filialeids = '${Vue.user.f_orgids}' and f_state= '有效' and getdate()>=f_perform_date and getdate()<=f_end_date `,
468
- orderitem:'id'
469
- }
470
- let qijia=[]
471
- new HttpResetClass().load('POST', `${this.$androidUtil.getProxyUrl()}/rs/sql/tel_singleTable_OrderBy`, {data: data}, {resolveMsg: null, rejectMsg: null}).then(res=>{
472
- console.log("66666666666666666666")
473
- console.log(JSON.stringify(res))
474
- console.log(typeof res)
475
- //console.log(JSON.stringify(res.data[0]))
476
- let result=res.data
477
- result.forEach(ress=>{
478
- qijia.push({
479
- label:ress.f_price_name,
480
- value:ress.f_price_name
481
- })
482
- })
483
- this.data.fields[i].options=qijia
484
- })
485
- }
486
- if (this.data.fields[i].label==='气表品牌'){
487
- console.log(this.data.fields[i].options)
488
- let data={
489
- items:"f_meter_brand",
490
- tablename:"t_gasbrand",
491
- condition:`f_filialeids = '${Vue.user.f_orgids}'`,
492
- orderitem:'id'
493
- }
494
- let pinpai=[]
495
- new HttpResetClass().load('POST', `${this.$androidUtil.getProxyUrl()}/rs/sql/tel_singleTable_OrderBy`, {data: data}, {resolveMsg: null, rejectMsg: null}).then(res=>{
496
- console.log("666666666666666666662")
497
- console.log(JSON.stringify(res))
498
- console.log(typeof res)
499
- //console.log(JSON.stringify(res.data[0]))
500
- let result=res.data
501
- result.forEach(ress=>{
502
- pinpai.push({
503
- label:ress.f_meter_brand,
504
- value:ress.f_meter_brand
505
- })
506
- })
507
- this.data.fields[i].options=pinpai
508
- })
509
- }
510
- }
511
- }
512
-
513
- if (this.data.filiale) {
514
- this.model.f_filiale = this.data.f_filiale
515
- } else if (Vue.user.orgs) {
516
- this.model.f_filiale = Vue.user.orgs
517
- } else {
518
- this.model.f_filiale = Vue.user.f_fengongsi
519
- }
520
- if (this.data.f_parentname) {
521
- this.model.f_parentname = this.data.f_parentname
522
- } else if (Vue.user.f_department_name) {
523
- this.model.f_parentname = Vue.user.f_department_name
524
- } else {
525
- this.model.f_parentname = Vue.user.f_parentname
526
- }
527
- if (this.data.operate_date) {
528
- this.model.f_operate_date = this.data.operate_date
529
- } else {
530
- this.model.f_operate_date = new Date().Format("yyyy-MM-dd HH:mm:ss")
531
- }
532
- if (this.data.operator) {
533
- this.model.f_operator = this.data.operator
534
- } else {
535
- this.model.f_operator = Vue.user.name
536
- }
537
- },
538
- // 模态框点击确定按钮
539
- acknowledge() {
540
- for (let i = 0; i < this.data.buttons[this.model.button.button_index].button_fields.length; i++) {
541
- this.model.button.button_fields[this.data.buttons[this.model.button.button_index].button_fields[i].field] = this.data.buttons[this.model.button.button_index].button_fields[i].value
542
- }
543
- this.showmodal = false
544
- this.$dispatch('button', this.model)
545
- },
546
- // 关闭模态框
547
- closemodal() {
548
- this.showmodal = false
549
- },
550
- watchmoney(val1, val2) {
551
- console.log("监听改变的值")
552
- console.log(val1)
553
- console.log(val2)
554
- },
555
- // 点击按钮
556
- clicked(index, button) {
557
- console.log(`点击了按钮index:${index}+button:${JSON.stringify(button)}`);
558
- if (this.data.title != '现场勘查' && this.data.title != '现场勘查定价' && button.button_name=='提交') {
559
- if (!this.model.f_overall_imgs || this.model.f_overall_imgs.length == 0){
560
- this.$showMessage("必须有现场照片")
561
- return;
562
- }
563
- if(Vue.nopic==this.model.f_sign_path){
564
- this.$showMessage("必须有签名照片")
565
- return;
566
- }
567
- this.model.f_overall_imgs.push({
568
- f_overall_path: this.model.f_sign_path,
569
- f_overall_name: this.data.title
570
- })
571
- }
572
-
573
-
574
- if ((this.data.title == '现场勘查' || this.data.title == '现场勘查定价') && button.button_name=='提交') {
575
- if (!this.model.f_overall_imgs || this.model.f_overall_imgs.length == 0){
576
- this.$showMessage("必须有现场照片")
577
- return;
578
- }
579
- }
580
- if (this.kchege == 'true') {
581
- console.log(this.model.f_hege)
582
- if (this.model.f_hege != 'true') {
583
- this.$showMessage("请勾选阅读合同")
584
- return
585
- }
586
- }
587
- // 组织model.fields数据
588
- let modeldatas = {}
589
- for (let i = 0; i < this.data.fields.length; i++) {
590
- console.log(JSON.stringify(this.data.fields[i]))
591
- // checkbox特殊处理
592
- if (this.data.fields[i].type === 'checkbox') {
593
- for (let j = 0; j < this.data.fields[i].items.length; j++) {
594
- modeldatas[this.data.fields[i].items[j].field] = this.data.fields[i].items[j].value
595
- }
596
- } else {
597
- modeldatas[this.data.fields[i].field] = this.data.fields[i].value
598
- }
599
- }
600
- modeldatas.f_process_id = this.data.f_process_id
601
- modeldatas.f_filiale = this.model.f_filiale
602
- modeldatas.f_parentname = this.model.f_parentname
603
- modeldatas.f_operator = this.model.f_operator
604
- modeldatas.f_operate_date = this.model.f_operate_date
605
- modeldatas.f_overall_imgs = this.model.f_overall_imgs
606
- modeldatas.f_sign_path = this.model.f_sign_path
607
- this.model = null
608
- this.model = modeldatas
609
- // 初始化model.button数据
610
- let buttondatas = {
611
- button_fields: {}
612
- }
613
- buttondatas.button_name = button.button_name
614
- buttondatas.button_index = index
615
- if (button.button_fields) {
616
- for (let i = 0; i < button.button_fields.length; i++) {
617
- buttondatas.button_fields[button.button_fields[i].field] = button.button_fields[i].value
618
- }
619
- }
620
- this.model.button = buttondatas
621
-
622
- if (button.button_name === '退回') {
623
- this.showmodal = true
624
- } else if (button.button_name === '下发') {
625
- this.showmodal = true
626
- } else {
627
- this.$dispatch('button', this.model)
628
- }
629
- },
630
- // 级联操作预留
631
- select_change(index) {
632
- this.$dispatch('select_cascade', index)
633
- },
634
- // 检测按钮的disable
635
- disabled_check(index, required, value) {
636
- console.log("被检测到的值是什么")
637
- console.log(index)
638
- console.log(required)
639
- console.log(value)
640
- console.log(this.data.title)
641
- if (this.data.fields[index].label=='气表品牌'){
642
- console.log("进入改变气表型号")
643
- console.log(this.data.fields[index+1].options)
644
- this.data.fields[index+1].options=[]
645
- let data={
646
- items:"gm.f_meter_style",
647
- tablename:"t_gasmodel gm left join t_gasbrand gb on gm.f_gasbrand_id=gb.id",
648
- condition:`gb.f_filialeids = '${Vue.user.f_orgids}' and gb.f_meter_brand='${value}'`,
649
- orderitem:'gm.id'
650
- }
651
- let xinghao=[]
652
- new HttpResetClass().load('POST', `${this.$androidUtil.getProxyUrl()}/rs/sql/tel_singleTable_OrderBy`, {data: data}, {resolveMsg: null, rejectMsg: null}).then(res=>{
653
- console.log("66666666666666666666")
654
- console.log(JSON.stringify(res))
655
- console.log(typeof res)
656
- //console.log(JSON.stringify(res.data[0]))
657
- let result=res.data
658
- result.forEach(ress=>{
659
- xinghao.push({
660
- label:ress.f_meter_style,
661
- value:ress.f_meter_style
662
- })
663
- })
664
- this.data.fields[index+1].options=xinghao
665
- })
666
- }
667
- if (this.data.title == '现场勘查') {
668
- if (index == 4) {
669
- if (value == '合格') {
670
- this.kchege = true
671
- this.kcbuhege = false
672
- console.log("1111111111" + this.kchege)
673
- } else if (value == '不合格') {
674
- this.kcbuhege = true
675
- this.kchege = false
676
- console.log("1111111111" + this.kcbuhege)
677
- }
678
- }
679
- }
680
- if (this.data.title == '现场勘查定价') {
681
- if (index == 6 || index == 7 || index == 5) {
682
- this.countmoney[index - 5] = parseInt(this.data.fields[index].value)
683
- console.log(this.data.fields[index].value)
684
- console.log("做出了改变")
685
- }
686
- console.log(JSON.stringify(this.countmoney))
687
- let money = 0
688
- for (let i = 0; i < this.countmoney.length; i++) {
689
- money += this.countmoney[i]
690
- }
691
- this.$set('data.fields[8].value', money)
692
- this.$set('data.fields[9].value', money)
693
- if (index == 10) {
694
- console.log("1111111111" + value)
695
- if (value == '合格') {
696
- this.kchege = true
697
- this.kcbuhege = false
698
- console.log("1111111111" + this.kchege)
699
- } else if (value == '不合格') {
700
- this.kcbuhege = true
701
- this.kchege = false
702
- console.log("1111111111" + this.kcbuhege)
703
- }
704
- }
705
- }
706
- if (required && value) {
707
- this.disable_button = false
708
-
709
- let fields = this.data.fields
710
- let flag = false
711
- for (let i = 0; i < fields.length; i++) {
712
- if (fields[i].type !== 'checkbox' && fields[i].required && !fields[i].value) {
713
- flag = true
714
- }
715
- }
716
- this.disable_button = flag
717
- }
718
- }
719
- },
720
- watch: {
721
- 'data.filed[12].value'(val) {
722
- console.log("变动")
723
- if (this.data.title == '现场勘查定价') {
724
-
725
- }
726
- },
727
- 'data.operate_date'() {
728
- if (this.data.filiale) {
729
- this.model.f_filiale = this.data.filiale
730
- } else {
731
- this.model.f_filiale = Vue.user.f_parentname
732
- }
733
- if (this.data.f_parentname) {
734
- this.model.f_parentname = this.data.f_parentname
735
- } else {
736
- this.model.f_parentname = Vue.user.f_parentname
737
- }
738
- if (this.data.operate_date) {
739
- this.model.f_operate_date = this.data.operate_date
740
- } else {
741
- this.model.f_operate_date = new Date().Format("yyyy-MM-dd HH:mm:ss")
742
- }
743
- if (this.data.operator) {
744
- this.model.f_operator = this.data.operator
745
- } else {
746
- this.model.f_operator = Vue.user.name
747
- }
748
- },
749
- deep: true
750
- },
751
- computed: {
752
- // 输入后按钮检测
753
- check_disable: function () {
754
- let fields = this.data.fields
755
- let flag = false
756
- for (let i = 0; i < fields.length; i++) {
757
- if (fields[i].type !== 'checkbox' && fields[i].required && !fields[i].value) {
758
- flag = true
759
- }
760
- }
761
- this.disable_button = flag
762
- }
763
- }
764
- }
765
- </script>
1
+ <template>
2
+ <div class="auto select-overspread">
3
+ <div v-if="data.back_reason" class="panel panel-info">
4
+ <span style="color: red"> 请注意被退回原因为:{{ data.back_reason }}</span>
5
+ </div>
6
+ <validator name="v">
7
+ <form class="form-horizontal">
8
+ <div class="col-sm-11 form-group">
9
+ <div v-for="(index,item) in data.fields">
10
+ <!--input-->
11
+ <div v-if="item.type==='input'" v-show="!item.hidden"
12
+ :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-4 form-group']">
13
+ <label
14
+ :class="item.label_bootstraped?item.label_bootstraped+' control-label':'control-label col-sm-6'">{{
15
+ item.label
16
+ }}:</label>
17
+ <div :class="item.value_bootstraped?item.value_bootstraped:'col-sm-6'">
18
+ <input class="form-control"
19
+ :type="item.type"
20
+ v-model="data.fields[index].value"
21
+ :placeholder="item.placeholder"
22
+ :value="data.fields[index].value"
23
+ :readonly="item.readonly"
24
+ :disable="item.disable"
25
+ @change="disabled_check(index,data.fields[index].required,data.fields[index].value)"
26
+ @blur="check_disable"
27
+ />
28
+ </div>
29
+ </div>
30
+ <!--number-->
31
+ <div v-if="item.type==='number'" v-show="!item.hidden"
32
+ :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-4 form-group']">
33
+ <label
34
+ :class="item.label_bootstraped?item.label_bootstraped+' control-label':'control-label col-sm-6'">{{
35
+ item.label
36
+ }}:</label>
37
+ <div :class="item.value_bootstraped?item.value_bootstraped:'col-sm-6'">
38
+ <input class="form-control"
39
+ :type="item.type"
40
+ v-model="data.fields[index].value"
41
+ :placeholder="item.placeholder"
42
+ :value="data.fields[index].value"
43
+ :readonly="item.readonly"
44
+ :disable="item.disable"
45
+ @change="disabled_check(index,data.fields[index].required,data.fields[index].value)"
46
+ @blur="check_disable"
47
+ />
48
+ </div>
49
+ </div>
50
+
51
+ <!--时间datepicker-->
52
+ <div v-if="item.type==='datepicker'"
53
+ :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-xs-12 form-group']">
54
+ <label style="margin-top: 0.7em"
55
+ :class="item.label_bootstraped?item.label_bootstraped +' control-label':'control-label col-sm-6'">{{
56
+ item.label
57
+ }}:</label>
58
+ <div :class="item.value_bootstraped?item.value_bootstraped:'col-sm-6'">
59
+ <datepicker
60
+ :placeholder="item.placeholder"
61
+ :value.sync="data.fields[index].value"
62
+ :format="'yyyy-MM-dd HH:mm:ss'"
63
+ v-model="data.fields[index].value"
64
+ :width="'100%'"
65
+ class="form-control"
66
+ :readonly="item.readonly"
67
+ :disabled="item.disabled"
68
+ @blur="check_disable"
69
+ :show-reset-button="reset">
70
+ </datepicker>
71
+ </div>
72
+ </div>
73
+
74
+
75
+ <!--textarea-->
76
+ <div v-if="item.type==='textarea'"
77
+ :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-12 form-group']">
78
+ <label
79
+ :class="item.label_bootstraped?item.label_bootstraped+' control-label':'control-label col-sm-2'">{{
80
+ item.label
81
+ }}:</label>
82
+ <div :class="item.value_bootstraped?item.value_bootstraped:'col-sm-10'">
83
+ <textarea
84
+ :readonly="item.readonly"
85
+ :disabled="item.disabled"
86
+ class="form-control"
87
+ :rows="item.rows"
88
+ v-model="data.fields[index].value"
89
+ @change="disabled_check(index,data.fields[index].required,data.fields[index].value)"
90
+ @blur="check_disable"
91
+ >
92
+ </textarea>
93
+ </div>
94
+ </div>
95
+
96
+ <!--radio-->
97
+ <div v-if="item.type==='radio'"
98
+ :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-12 form-group']">
99
+ <label v-if="item.label"
100
+ :class="item.label_bootstraped?item.label_bootstraped+' control-label':'control-label col-sm-2'">{{
101
+ item.label
102
+ }}:</label>
103
+ <div class="col-xs-12">
104
+ <div
105
+ :class="item.value_bootstraped?item.value_bootstraped:item.items.length%2 == 0?'col-xs-5': 'col-xs-3'"
106
+ v-for="(index2,row) in item.items">
107
+ <label style="margin-top: 0.7em" for="row.label"
108
+ :class="item.items.length%2 == 0?'col-xs-4': 'col-xs-2'">{{ row.label }}</label>
109
+ <input @blur="check_disable" :class="item.items.length%2 == 0?'col-xs-1': 'col-xs-1'"
110
+ :readonly="item.readonly" :disabled="item.disabled" style="margin-top: 10px" type="radio"
111
+ :name="index" :id="row.label" v-bind:value="data.fields[index].items[index2].value"
112
+ v-model="data.fields[index].value">
113
+ </div>
114
+ </div>
115
+ </div>
116
+
117
+ <!--select-->
118
+ <div v-if="item.type==='select'"
119
+ :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-4 form-group']">
120
+ <label
121
+ :class="item.label_bootstraped?item.label_bootstraped+' control-label':'control-label col-sm-6'">{{
122
+ item.label
123
+ }}:</label>
124
+ <input-select :class="item.value_bootstraped?item.value_bootstraped:'col-sm-6'" @blur="check_disable"
125
+ @change="select_change(index),disabled_check(index,data.fields[index].required,data.fields[index].value)"
126
+ :readonly="item.readonly" :disable="item.disabled" :value.sync="data.fields[index].value"
127
+ v-model="data.fields[index].value"
128
+ :options='item.options' :valueSingle="true"></input-select>
129
+
130
+ </div>
131
+
132
+ <!--checkbox-->
133
+ <div v-if="item.type==='checkbox'"
134
+ :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-12 form-group']">
135
+ <label v-if="item.label"
136
+ :class="item.label_bootstraped?item.label_bootstraped+' control-label':'control-label col-sm-2'">{{
137
+ item.label
138
+ }}:</label>
139
+ <div style="margin-top: 0.7em"
140
+ :class="item.value_bootstraped?item.value_bootstraped:'control-label col-sm-2'"
141
+ v-for="(index2,row) in item.items">
142
+ <label class="font-size form-group col-sm-6">{{ row.label }}</label>
143
+ <input :readonly="item.readonly" :disabled="item.disabled" type="checkbox" class="col-sm-6"
144
+ :id="row.label" v-model="data.fields[index].items[index2].value">
145
+ </div>
146
+ </div>
147
+
148
+
149
+ </div>
150
+ </div>
151
+ <div class="form-group col-sm-11">
152
+ <label class="text-left font">现场照片</label>
153
+
154
+ <div class="auto">
155
+ <div class="panel" style="padding: 10px 10px 5px 10px;">
156
+ <div class="panel-body panel-self"
157
+ style="background-color: #F8F8F8;width: 100%;height: 260px;position: relative">
158
+ <div class="row" style="height: 240px;overflow: scroll;top: 1px">
159
+ <div class="col-xs-4 col-sm-3 col-md-2" style="margin-bottom: 35px"
160
+ v-for="(index,img) in model.f_overall_imgs">
161
+ <img-self :src="img.f_overall_path" alt="现场照片" :width="140" :height="170"></img-self>
162
+ <img src="../../../assets/删除.png" @click="delfile('f_overall_path', img.f_overall_path,index)"
163
+ style="width: 15px;margin-top: -80px" alt="">
164
+ </div>
165
+ </div>
166
+ <div class="row text-right div-photo">
167
+ <button type="button" name="button" class="btn btn-photo" @click="takePic('f_overall_path', '现场照片')">
168
+ 拍照
169
+ </button>
170
+ <!--<button type="button" name="button" class="btn btn-primary btn-photo" @click="takePic('f_overall_path', '总体安检照片1')">拍照</button>-->
171
+ <!--&nbsp;&nbsp;&nbsp;&nbsp;<img src="../../../assets/remove.png" :class="style__" @click="delfile('f_overall_path', img.f_overall_path)" style="width: 25%;"></img>-->
172
+ </div>
173
+ </div>
174
+ </div>
175
+ </div>
176
+ </div>
177
+ <div class="form-group col-sm-11" v-show="isshow">
178
+ <label class="text-left font">用户签名</label>
179
+ <div class="auto">
180
+ <div class="panel">
181
+ <div class="panel-body panel-self"
182
+ style="background-color: #F8F8F8;width: 100%;height: 260px;position: relative">
183
+ <div class="row" style="height: 240px;overflow: scroll;top: 1px">
184
+ <div class="col-sm-4">
185
+ <img :src="model.f_sign_path" :width="200" :height="150"/>
186
+ </div>
187
+ </div>
188
+ <div class="row text-right div-photo">
189
+ <button type="button" name="button" class="btn btn-primary btn-photo" @click="sign">签名</button>
190
+ </div>
191
+ </div>
192
+ </div>
193
+ </div>
194
+ </div>
195
+
196
+ <!-- <input @click="gotohetong('民用')" type="checkbox" v-model="model.f_hege"/><label class="text-left font">我已阅读<a href="#" @click="gotohetong('民用')">居民天然气供用气合同</a></label>-->
197
+ <div class="form-group col-sm-11" v-show="kchege&&data.f_user_type=='民用'&&data.title!='现场勘查'">
198
+ <input type="checkbox" v-model="model.f_hege"/><label class="text-left font">我已阅读<a href="#"
199
+ @click="gotohetong('民用')">居民天然气供用气合同</a></label>
200
+ </div>
201
+ <div class="form-group col-sm-11" v-show="kchege&&(data.f_user_type=='非民用'||data.title=='现场勘查')">
202
+ <input type="checkbox" v-model="model.f_hege"/><label class="text-left font">我已阅读<a href="#"
203
+ @click="gotohetong('非民用1')">天然气工程建设安装合同</a>,<a
204
+ href="#" @click="gotohetong('非民用2')">管道燃气供用气合同</a></label>
205
+ </div>
206
+ <div class="form-group col-sm-11" v-show="kcbuhege">
207
+ <div class="col-sm-12 form-group">
208
+ <label class="control-label col-sm-2">不合格原因:</label>
209
+ <div class="col-sm-10">
210
+ <textarea
211
+ class="form-control"
212
+ v-model="model.f_buhege_reason">
213
+ </textarea>
214
+ </div>
215
+ </div>
216
+
217
+
218
+ </div>
219
+ <div class="col-sm-11 form-group">
220
+ <div class="form-group col-sm-6">
221
+ <label class=" col-sm-4 control-label">分公司:</label>
222
+ <div class="col-sm-5">
223
+ <input class="form-control" type="text" v-model="model.f_filiale" disabled>
224
+ </div>
225
+ </div>
226
+ <div class="col-sm-6 form-group">
227
+ <label class="control-label col-sm-6">部门:</label>
228
+ <div class="col-sm-5">
229
+ <input type="text" class="form-control" disabled v-model="model.f_parentname"/>
230
+ </div>
231
+ </div>
232
+ </div>
233
+ <div class="col-sm-11 form-group">
234
+ <div class="col-sm-6 form-group">
235
+ <label class="control-label col-sm-4">操作日期:</label>
236
+ <div class="col-sm-5">
237
+ <input type="text" class="form-control" disabled v-model="model.f_operate_date"/>
238
+ </div>
239
+ </div>
240
+ <div class="col-sm-6 form-group">
241
+ <label class="control-label col-sm-6">操作人:</label>
242
+ <div class="col-sm-5">
243
+ <input type="text" class="form-control" disabled v-model="model.f_operator"/>
244
+ </div>
245
+ </div>
246
+ </div>
247
+
248
+ </form>
249
+ </validator>
250
+ <div class="from-group col-xs-12">
251
+ <center>
252
+ <div v-for="(index,button) in data.buttons"
253
+ :class="[data.buttons.length==4?'col-xs-3':'',data.buttons.length==3?'col-xs-4':'',data.buttons.length==2?'col-xs-6':'']">
254
+ <!-- 按钮组 -->
255
+ <button :disabled="(button.button_name==='提交'||button.button_name==='下发')&&disable_button"
256
+ type="button" @click="clicked(index,button)" style="border-radius:5px; "
257
+ :class="[(button.button_name==='提交'||button.button_name==='下发')&&disable_button?'btn btn-default':'btn btn-primary',data.buttons.length==4 ? 'col-xs-2 col-xs-offset-1':'',data.buttons.length==3 ? 'col-xs-2 col-xs-offset-2':'',data.buttons.length==2 ? 'col-xs-4 col-xs-offset-2':'']">
258
+ {{ button.button_name }}
259
+ </button>
260
+ </div>
261
+ </center>
262
+ </div>
263
+ <div class="form-group col-xs-12" style="height: 50px;width: 100%"></div>
264
+ <!-- 模态框 -->
265
+ <modal v-if="showmodal" :show.sync="showmodal" v-ref:modal backdrop="false">
266
+ <header slot="modal-header" class="modal-header">
267
+ <button type="button" class="close" @click="closemodal"><span>&times;</span></button>
268
+ <h4 class="modal-title">{{ model.button.button_name }}</h4>
269
+ </header>
270
+ <article slot="modal-body" class="modal-body">
271
+ <div class="col-sm-12" v-for="(index,button_field) in data.buttons[model.button.button_index].button_fields">
272
+ <label class="control-label col-sm-3" style="margin-top: 10px">{{ button_field.label }}:</label>
273
+ <div class="col-sm-7">
274
+ <!--select-->
275
+ <input-select v-if="button_field.type=='select'"
276
+ :value.sync="data.buttons[model.button.button_index].button_fields[index].value"
277
+ v-model="data.buttons[model.button.button_index].button_fields[index].value"
278
+ :options='button_field.options'></input-select>
279
+ <!-- input -->
280
+ <input v-else type="text" class="form-control"
281
+ v-model="data.buttons[model.button.button_index].button_fields[index].value"/>
282
+ </div>
283
+ </div>
284
+ </article>
285
+ <footer slot="modal-footer" style="border-top:none" class="modal-footer">
286
+ <button v-show="showmodal" type="button" class="btn btn-primary" @click='acknowledge'>确认</button>
287
+ </footer>
288
+ </modal>
289
+ </div>
290
+ </template>
291
+ <script>
292
+
293
+ // Date格式化
294
+
295
+
296
+ Date.prototype.Format = function (fmt) {
297
+ var o = {
298
+ "M+": this.getMonth() + 1, //月份
299
+ "d+": this.getDate(), //日
300
+ "H+": this.getHours(), //小时
301
+ "m+": this.getMinutes(), //分
302
+ "s+": this.getSeconds(), //秒
303
+ "q+": Math.floor((this.getMonth() + 3) / 3), //季度
304
+ "S": this.getMilliseconds() //毫秒
305
+ };
306
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
307
+ for (var k in o)
308
+ if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
309
+ return fmt;
310
+ }
311
+
312
+ import Vue from 'vue'
313
+ import * as Util from '../../Util'
314
+ import {HttpResetClass} from 'vue-client'
315
+ export default {
316
+ title: '报建业务通用组件',
317
+ props: ['data', 'model'],
318
+
319
+ data() {
320
+ return {
321
+ isshow: true,
322
+ kchege: false,
323
+ kcbuhege: false,
324
+ countmoney: [0, 0, 0],
325
+ data: null,
326
+ showmodal: false,
327
+ disable_button: true
328
+ }
329
+ },
330
+ created() {
331
+
332
+ // 初始化数据
333
+ this.initializtion()
334
+ },
335
+ methods: {
336
+ gotohetong(val) {
337
+ console.log(val)
338
+ console.log("进入goto")
339
+ this.$dispatch('gotonewpage', val)
340
+ },
341
+ cameraCallBack(prop, fileName) {
342
+ if (prop == 'f_overall_path') {
343
+ let f_overall_path = fileName + '?' + Math.random()
344
+ HostApp.__this__.model.f_overall_imgs.push({
345
+ f_overall_path: f_overall_path,
346
+ f_overall_name: this.data.title
347
+ })
348
+ } else {
349
+ HostApp.__this__.model[prop] = fileName + '?' + Math.random()
350
+ }
351
+ HostApp.__callback__ = null
352
+ HostApp.__this__ = null
353
+ },
354
+ takePic(prop, title, index) {
355
+ HostApp.__callback__ = this.cameraCallBack
356
+ HostApp.__this__ = this
357
+ console.log("prop:" + prop)
358
+ console.log("this.prop:" + this.model[prop])
359
+ let fileName
360
+ if (prop == 'f_overall_path') {
361
+ if (!this.model.f_overall_imgs[index] || this.model.f_overall_imgs[index].f_overall_path.includes("nopic.png")) {
362
+ fileName = Util.guid() + '-' + prop + '.jpg'
363
+ } else {
364
+ fileName = Util.getFileName(this.model.f_overall_imgs[index].f_overall_path)
365
+ }
366
+ } else {
367
+ if (!this.model[prop] || this.model[prop].includes("nopic.png")) {
368
+ fileName = Util.guid() + '-' + prop + '.jpg'
369
+ } else {
370
+ fileName = Util.getFileName(this.model[prop])
371
+ }
372
+ }
373
+
374
+ HostApp._open_a_page({
375
+ type: 'boomerang',
376
+ page: 'com.aofeng.hybrid.android.peripheral.CameraActivity',
377
+ param: {
378
+ file: fileName,
379
+ requestCode: 111,
380
+ callback: 'javascript:HostApp.__callback__("' + prop + '", "%s");',
381
+ watermark: title + '\t时间:' + Util.toStandardTimeString() + '\t' + Vue.user.name
382
+ }
383
+ })
384
+ },
385
+ signCallback(prop, fileName) {
386
+ // HostApp.alert('绑定属性:' + prop + ' 文件全路径如file:///storage/sdcard0/safecheck/abc.jpg:' + fullFileName)
387
+ HostApp.__this__.$set('model.f_sign_path', fileName)
388
+ HostApp.__callback__ = null
389
+ HostApp.__this__ = null
390
+ },
391
+ delAudioFile(prop, fileName) {
392
+ if (!fileName)
393
+ return
394
+ else {
395
+ HostApp.delfile(fileName)
396
+ this.model[prop] = null
397
+ }
398
+ },
399
+ sign() {
400
+ this.delAudioFile('f_sign_path', this.model.f_sign_path)
401
+ let prop = 'f_sign_path'
402
+ let idx = 'aofeng'
403
+ let fileName
404
+ if (!this.model.f_sign_path) {
405
+ fileName = Util.guid() + '-valve-' + idx + '-' + prop + '.jpg'
406
+ } else {
407
+ fileName = Util.getFileName(this.model.f_sign_path)
408
+ }
409
+ HostApp.__callback__ = this.signCallback
410
+ HostApp.__this__ = this
411
+ HostApp.getSignature({
412
+ file: fileName,
413
+ requestCode: 111,
414
+ callback: 'javascript:HostApp.__callback__("' + prop + '", "%s");'
415
+ })
416
+ },
417
+ delfile(prop, fileName, index) {
418
+ if (fileName == Vue.nopic)
419
+ return
420
+ else {
421
+ if (prop == 'f_overall_path') {
422
+ this.model.f_overall_imgs.splice(index, 1)
423
+ HostApp.delfile(fileName)
424
+ } else {
425
+ HostApp.delfile(fileName)
426
+ this.model[prop] = Vue.nopic
427
+ }
428
+ }
429
+ },
430
+ // 初始化数据
431
+ initializtion() {
432
+
433
+ if (this.data.title == '现场勘查' || this.data.title == '现场勘查定价') {
434
+ this.isshow = false
435
+ }
436
+ console.log("5555555555555")
437
+ console.log(this.data.f_user_type)
438
+ console.log(this.isshow)
439
+ Vue.nopic = 'file:///android_asset/nopic.png'
440
+ if (!this.model.f_sign_path)
441
+ this.$set('model.f_sign_path', Vue.nopic)
442
+ console.log('!this.model.f_overall_imgs==>' + !this.model.f_overall_imgs)
443
+ if (!this.model.f_overall_imgs) {
444
+ let imgs = []
445
+ this.$set('model.f_overall_imgs', imgs)
446
+ console.log('进入setmodel.f_overall_imgs')
447
+ }
448
+ console.log('进入serviceview的initializtion方法')
449
+ console.log(JSON.stringify(this.data))
450
+ if (this.data.fields) {
451
+ for (let i = 0; i < this.data.fields.length; i++) {
452
+ if (this.data.fields[i].value) {
453
+ if (this.data.fields[i].value == 'null') {
454
+ console.log("看看为空的字段名" + this.data.fields[i].label)
455
+ this.data.fields[i].value = null
456
+ console.log("赋值完成")
457
+ }
458
+ }
459
+ if (this.data.fields[i].type === 'datepicker' && !this.data.fields[i].value) {
460
+ this.data.fields[i].value = new Date().Format("yyyy-MM-dd HH:mm:ss")
461
+ }
462
+ if (this.data.fields[i].label==='气价名称'){
463
+ console.log(this.data.fields[i].options)
464
+ let data={
465
+ items:"f_price_name",
466
+ tablename:"t_stairprice",
467
+ condition:`f_filialeids = '${Vue.user.f_orgids}' and f_state= '有效' and getdate()>=f_perform_date and getdate()<=f_end_date `,
468
+ orderitem:'id'
469
+ }
470
+ let qijia=[]
471
+ new HttpResetClass().load('POST', `${this.$androidUtil.getProxyUrl()}/rs/sql/tel_singleTable_OrderBy`, {data: data}, {resolveMsg: null, rejectMsg: null}).then(res=>{
472
+ console.log("66666666666666666666")
473
+ console.log(JSON.stringify(res))
474
+ console.log(typeof res)
475
+ //console.log(JSON.stringify(res.data[0]))
476
+ let result=res.data
477
+ result.forEach(ress=>{
478
+ qijia.push({
479
+ label:ress.f_price_name,
480
+ value:ress.f_price_name
481
+ })
482
+ })
483
+ this.data.fields[i].options=qijia
484
+ })
485
+ }
486
+ if (this.data.fields[i].label==='气表品牌'){
487
+ console.log(this.data.fields[i].options)
488
+ let data={
489
+ items:"f_meter_brand",
490
+ tablename:"t_gasbrand",
491
+ condition:`f_filialeids = '${Vue.user.f_orgids}'`,
492
+ orderitem:'id'
493
+ }
494
+ let pinpai=[]
495
+ new HttpResetClass().load('POST', `${this.$androidUtil.getProxyUrl()}/rs/sql/tel_singleTable_OrderBy`, {data: data}, {resolveMsg: null, rejectMsg: null}).then(res=>{
496
+ console.log("666666666666666666662")
497
+ console.log(JSON.stringify(res))
498
+ console.log(typeof res)
499
+ //console.log(JSON.stringify(res.data[0]))
500
+ let result=res.data
501
+ result.forEach(ress=>{
502
+ pinpai.push({
503
+ label:ress.f_meter_brand,
504
+ value:ress.f_meter_brand
505
+ })
506
+ })
507
+ this.data.fields[i].options=pinpai
508
+ })
509
+ }
510
+ }
511
+ }
512
+
513
+ if (this.data.filiale) {
514
+ this.model.f_filiale = this.data.f_filiale
515
+ } else if (Vue.user.orgs) {
516
+ this.model.f_filiale = Vue.user.orgs
517
+ } else {
518
+ this.model.f_filiale = Vue.user.f_fengongsi
519
+ }
520
+ if (this.data.f_parentname) {
521
+ this.model.f_parentname = this.data.f_parentname
522
+ } else if (Vue.user.f_department_name) {
523
+ this.model.f_parentname = Vue.user.f_department_name
524
+ } else {
525
+ this.model.f_parentname = Vue.user.f_parentname
526
+ }
527
+ if (this.data.operate_date) {
528
+ this.model.f_operate_date = this.data.operate_date
529
+ } else {
530
+ this.model.f_operate_date = new Date().Format("yyyy-MM-dd HH:mm:ss")
531
+ }
532
+ if (this.data.operator) {
533
+ this.model.f_operator = this.data.operator
534
+ } else {
535
+ this.model.f_operator = Vue.user.name
536
+ }
537
+ },
538
+ // 模态框点击确定按钮
539
+ acknowledge() {
540
+ for (let i = 0; i < this.data.buttons[this.model.button.button_index].button_fields.length; i++) {
541
+ this.model.button.button_fields[this.data.buttons[this.model.button.button_index].button_fields[i].field] = this.data.buttons[this.model.button.button_index].button_fields[i].value
542
+ }
543
+ this.showmodal = false
544
+ this.$dispatch('button', this.model)
545
+ },
546
+ // 关闭模态框
547
+ closemodal() {
548
+ this.showmodal = false
549
+ },
550
+ watchmoney(val1, val2) {
551
+ console.log("监听改变的值")
552
+ console.log(val1)
553
+ console.log(val2)
554
+ },
555
+ // 点击按钮
556
+ clicked(index, button) {
557
+ console.log(`点击了按钮index:${index}+button:${JSON.stringify(button)}`);
558
+ if (this.data.title != '现场勘查' && this.data.title != '现场勘查定价' && button.button_name=='提交') {
559
+ if (!this.model.f_overall_imgs || this.model.f_overall_imgs.length == 0){
560
+ this.$showMessage("必须有现场照片")
561
+ return;
562
+ }
563
+ if(Vue.nopic==this.model.f_sign_path){
564
+ this.$showMessage("必须有签名照片")
565
+ return;
566
+ }
567
+ this.model.f_overall_imgs.push({
568
+ f_overall_path: this.model.f_sign_path,
569
+ f_overall_name: this.data.title
570
+ })
571
+ }
572
+
573
+
574
+ if ((this.data.title == '现场勘查' || this.data.title == '现场勘查定价') && button.button_name=='提交') {
575
+ if (!this.model.f_overall_imgs || this.model.f_overall_imgs.length == 0){
576
+ this.$showMessage("必须有现场照片")
577
+ return;
578
+ }
579
+ }
580
+ if (this.kchege == 'true') {
581
+ console.log(this.model.f_hege)
582
+ if (this.model.f_hege != 'true') {
583
+ this.$showMessage("请勾选阅读合同")
584
+ return
585
+ }
586
+ }
587
+ // 组织model.fields数据
588
+ let modeldatas = {}
589
+ for (let i = 0; i < this.data.fields.length; i++) {
590
+ console.log(JSON.stringify(this.data.fields[i]))
591
+ // checkbox特殊处理
592
+ if (this.data.fields[i].type === 'checkbox') {
593
+ for (let j = 0; j < this.data.fields[i].items.length; j++) {
594
+ modeldatas[this.data.fields[i].items[j].field] = this.data.fields[i].items[j].value
595
+ }
596
+ } else {
597
+ modeldatas[this.data.fields[i].field] = this.data.fields[i].value
598
+ }
599
+ }
600
+ modeldatas.f_process_id = this.data.f_process_id
601
+ modeldatas.f_filiale = this.model.f_filiale
602
+ modeldatas.f_parentname = this.model.f_parentname
603
+ modeldatas.f_operator = this.model.f_operator
604
+ modeldatas.f_operate_date = this.model.f_operate_date
605
+ modeldatas.f_overall_imgs = this.model.f_overall_imgs
606
+ modeldatas.f_sign_path = this.model.f_sign_path
607
+ this.model = null
608
+ this.model = modeldatas
609
+ // 初始化model.button数据
610
+ let buttondatas = {
611
+ button_fields: {}
612
+ }
613
+ buttondatas.button_name = button.button_name
614
+ buttondatas.button_index = index
615
+ if (button.button_fields) {
616
+ for (let i = 0; i < button.button_fields.length; i++) {
617
+ buttondatas.button_fields[button.button_fields[i].field] = button.button_fields[i].value
618
+ }
619
+ }
620
+ this.model.button = buttondatas
621
+
622
+ if (button.button_name === '退回') {
623
+ this.showmodal = true
624
+ } else if (button.button_name === '下发') {
625
+ this.showmodal = true
626
+ } else {
627
+ this.$dispatch('button', this.model)
628
+ }
629
+ },
630
+ // 级联操作预留
631
+ select_change(index) {
632
+ this.$dispatch('select_cascade', index)
633
+ },
634
+ // 检测按钮的disable
635
+ disabled_check(index, required, value) {
636
+ console.log("被检测到的值是什么")
637
+ console.log(index)
638
+ console.log(required)
639
+ console.log(value)
640
+ console.log(this.data.title)
641
+ if (this.data.fields[index].label=='气表品牌'){
642
+ console.log("进入改变气表型号")
643
+ console.log(this.data.fields[index+1].options)
644
+ this.data.fields[index+1].options=[]
645
+ let data={
646
+ items:"gm.f_meter_style",
647
+ tablename:"t_gasmodel gm left join t_gasbrand gb on gm.f_gasbrand_id=gb.id",
648
+ condition:`gb.f_filialeids = '${Vue.user.f_orgids}' and gb.f_meter_brand='${value}'`,
649
+ orderitem:'gm.id'
650
+ }
651
+ let xinghao=[]
652
+ new HttpResetClass().load('POST', `${this.$androidUtil.getProxyUrl()}/rs/sql/tel_singleTable_OrderBy`, {data: data}, {resolveMsg: null, rejectMsg: null}).then(res=>{
653
+ console.log("66666666666666666666")
654
+ console.log(JSON.stringify(res))
655
+ console.log(typeof res)
656
+ //console.log(JSON.stringify(res.data[0]))
657
+ let result=res.data
658
+ result.forEach(ress=>{
659
+ xinghao.push({
660
+ label:ress.f_meter_style,
661
+ value:ress.f_meter_style
662
+ })
663
+ })
664
+ this.data.fields[index+1].options=xinghao
665
+ })
666
+ }
667
+ if (this.data.title == '现场勘查') {
668
+ if (index == 4) {
669
+ if (value == '合格') {
670
+ this.kchege = true
671
+ this.kcbuhege = false
672
+ console.log("1111111111" + this.kchege)
673
+ } else if (value == '不合格') {
674
+ this.kcbuhege = true
675
+ this.kchege = false
676
+ console.log("1111111111" + this.kcbuhege)
677
+ }
678
+ }
679
+ }
680
+ if (this.data.title == '现场勘查定价') {
681
+ if (index == 6 || index == 7 || index == 5) {
682
+ this.countmoney[index - 5] = parseInt(this.data.fields[index].value)
683
+ console.log(this.data.fields[index].value)
684
+ console.log("做出了改变")
685
+ }
686
+ console.log(JSON.stringify(this.countmoney))
687
+ let money = 0
688
+ for (let i = 0; i < this.countmoney.length; i++) {
689
+ money += this.countmoney[i]
690
+ }
691
+ this.$set('data.fields[8].value', money)
692
+ this.$set('data.fields[9].value', money)
693
+ if (index == 10) {
694
+ console.log("1111111111" + value)
695
+ if (value == '合格') {
696
+ this.kchege = true
697
+ this.kcbuhege = false
698
+ console.log("1111111111" + this.kchege)
699
+ } else if (value == '不合格') {
700
+ this.kcbuhege = true
701
+ this.kchege = false
702
+ console.log("1111111111" + this.kcbuhege)
703
+ }
704
+ }
705
+ }
706
+ if (required && value) {
707
+ this.disable_button = false
708
+
709
+ let fields = this.data.fields
710
+ let flag = false
711
+ for (let i = 0; i < fields.length; i++) {
712
+ if (fields[i].type !== 'checkbox' && fields[i].required && !fields[i].value) {
713
+ flag = true
714
+ }
715
+ }
716
+ this.disable_button = flag
717
+ }
718
+ }
719
+ },
720
+ watch: {
721
+ 'data.filed[12].value'(val) {
722
+ console.log("变动")
723
+ if (this.data.title == '现场勘查定价') {
724
+
725
+ }
726
+ },
727
+ 'data.operate_date'() {
728
+ if (this.data.filiale) {
729
+ this.model.f_filiale = this.data.filiale
730
+ } else {
731
+ this.model.f_filiale = Vue.user.f_parentname
732
+ }
733
+ if (this.data.f_parentname) {
734
+ this.model.f_parentname = this.data.f_parentname
735
+ } else {
736
+ this.model.f_parentname = Vue.user.f_parentname
737
+ }
738
+ if (this.data.operate_date) {
739
+ this.model.f_operate_date = this.data.operate_date
740
+ } else {
741
+ this.model.f_operate_date = new Date().Format("yyyy-MM-dd HH:mm:ss")
742
+ }
743
+ if (this.data.operator) {
744
+ this.model.f_operator = this.data.operator
745
+ } else {
746
+ this.model.f_operator = Vue.user.name
747
+ }
748
+ },
749
+ deep: true
750
+ },
751
+ computed: {
752
+ // 输入后按钮检测
753
+ check_disable: function () {
754
+ let fields = this.data.fields
755
+ let flag = false
756
+ for (let i = 0; i < fields.length; i++) {
757
+ if (fields[i].type !== 'checkbox' && fields[i].required && !fields[i].value) {
758
+ flag = true
759
+ }
760
+ }
761
+ this.disable_button = flag
762
+ }
763
+ }
764
+ }
765
+ </script>