@zscreate/zhxy-app-component 1.0.397 → 1.0.400

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,1852 +1,1925 @@
1
- <template>
2
- <view class="evan-form-show" >
3
- <evan-form :hide-required-asterisk="hideRequiredAsterisk" ref="Form" :dataObj="dataObj">
4
- <template v-for="(item, index) in data.list">
5
- <template v-if="item.type === 'table' && item.options.canView">
6
- <view class="table-wrapper" :key="index">
7
- <view class="table-header">
8
- <text v-if="item.name" class="title-block"></text>
9
- <text>{{ item.name }}</text>
10
- </view>
11
- <view class="table-container">
12
- <template v-if="item.options.supportPage">
13
- <view class="table-item" v-for="(table, tableCIndex) in currTablePageData(item)"
14
- :key="tablePageIndex(item.model,tableCIndex)"
15
- :index="tablePageIndex(item.model,tableCIndex)"
16
- >
17
- <view class="item" v-show="!item.options.hiddenOperateBtn">
18
- <view class="index">{{table.index + 1}}</view>
19
- <view class="delete icon-delete" v-if="!item.options.disabled&&!item.options.hiddenOperateBtn"
20
- @click="handleDeleteRow(tablePageIndex(item.model,tableCIndex), item.model)">删除</view>
21
- <view class="extend"
22
- :class="{'icon-arrow-right': !tableRowsShow[item.model][tablePageIndex(item.model,tableCIndex)], 'icon-arrow-down':tableRowsShow[item.model][tablePageIndex(item.model,tableCIndex)]}"
23
- @click="showTableRow(item.model, tablePageIndex(item.model,tableCIndex))">
24
- {{tableRowsShow[item.model][tablePageIndex(item.model,tableCIndex)] ? '收起' : '展开'}}
25
- </view>
26
- </view>
27
- <view class="view-port" v-show="tableRowsShow[item.model][tablePageIndex(item.model,tableCIndex)]" style="border-bottom: 1px solid #b2b2b2;">
28
- <view v-for="(tableItem, tableItemIndex) in table.columns" :key="tableItemIndex" :class="'table-item-view' + (tableItemIndex % 3)">
29
- <evan-form-item v-show="tableItem.options.canView"
30
- :labelPosition="labelPosition"
31
- @upDateWidget="data => upDateTableWidget(data, tableItemIndex, item.model, tablePageIndex(item.model,tableCIndex))" :itemkey="tableItemIndex"
32
- :curLoadedPages="(tablePageInfo[item.model].current - 1) * tablePageInfo[item.model].pageSize + tablePageInfo[item.model].pageSize"
33
- :parentTableKey="item.key" :tableKey="item.model" :tableIndex="tablePageIndex(item.model,tableCIndex)" :prop="tableItem.model"
34
- :ref="String(Math.random()).split('.')[1]" :models.sync="models"
35
- :rules="rules" :widget.sync="tableItem" :isDraft="isDraft" :formId="formId"
36
- :linkage="linkage" :isApply="isApply" :applyId="applyId">
37
- </evan-form-item>
38
- </view>
39
- </view>
40
- </view>
41
- <!-- #ifdef H5 -->
42
- <page-pagination v-if="tablePageInfo[item.model]&&tablePageInfo[item.model].total" :total="tablePageInfo[item.model]&&tablePageInfo[item.model].total"
43
- :currentPage="tablePageInfo[item.model]&&tablePageInfo[item.model].current"
44
- @change="(...args) => tablePageChange(item,...args)"
45
- :numAround="true" :showBorder="false"></page-pagination>
46
- <!-- #endif -->
47
- <!-- #ifdef MP-WEIXIN -->
48
- <page-pagination v-if="tablePageInfo[item.model]&&tablePageInfo[item.model].total" :total="tablePageInfo[item.model]&&tablePageInfo[item.model].total"
49
- :currentPage="tablePageInfo[item.model]&&tablePageInfo[item.model].current"
50
- @change="tablePageChange(item, $event)"
51
- :numAround="true" :showBorder="false"></page-pagination>
52
- <!-- #endif -->
53
- </template>
54
- <template v-else>
55
- <view class="table-item" v-for="(table, tableCIndex) in tableData[item.model]"
56
- :key="tableCIndex">
57
- <view class="item" v-show="!item.options.hiddenOperateBtn">
58
- <view class="index">{{table.index + 1}}</view>
59
- <view class="delete icon-delete" v-if="!item.options.disabled&&!item.options.hiddenOperateBtn"
60
- @click="handleDeleteRow(tableCIndex, item.model)">删除</view>
61
- <view class="extend"
62
- :class="{'icon-arrow-right': !tableRowsShow[item.model][tableCIndex], 'icon-arrow-down':tableRowsShow[item.model][tableCIndex]}"
63
- @click="showTableRow(item.model, tableCIndex)">
64
- </view>
65
- </view>
66
- <view class="view-port" v-show="tableRowsShow[item.model][tableCIndex]" style="border-bottom: 1px solid #b2b2b2;">
67
- <view v-for="(tableItem, tableItemIndex) in table.columns" :key="tableItemIndex" :class="'table-item-view' + (tableItemIndex % 3)">
68
- <evan-form-item v-show="tableItem.options.canView"
69
- :labelPosition="labelPosition"
70
- @upDateWidget="data => upDateTableWidget(data, tableItemIndex, item.model, tableCIndex)" :itemkey="tableItemIndex"
71
- :tableKey="item.model" :tableIndex="tableCIndex" :prop="tableItem.model"
72
- :ref="String(Math.random()).split('.')[1]" :models.sync="models"
73
- :rules="rules" :widget.sync="tableItem" :isDraft="isDraft" :formId="formId"
74
- :linkage="linkage" :isApply="isApply" :applyId="applyId">
75
- </evan-form-item>
76
- </view>
77
- </view>
78
- </view>
79
- </template>
80
- <view class="add" v-if="isShowAdd && !item.options.disabled&&!item.options.hiddenOperateBtn" :data-data="item"
81
- :data-model="item.model" data-add-model="addModel"
82
- @click="addToTableData(item, item.model,'addModel')">+添加</view>
83
- </view>
84
- </view>
85
- </template>
86
-
87
- <view v-else-if="item.type === 'all-lay-out'" v-show="item.options.canView" class="form_layout">
88
- <view v-for="(colItem, colIndex) in item.columns" :key="colIndex" class="form-item-container">
89
- <view v-for="(col, itemIndex) in colItem.list" :key="itemIndex" v-show="col.options.canView">
90
- <evan-form-item :isCorrect="isCorrect" :labelPosition="labelPosition" :prop="col.model"
91
- :ref="String(Math.random()).split('.')[1]" :models.sync="models" :rules="rules"
92
- :widget.sync="col" :isDraft="isDraft" :formId="formId" :linkage="linkage" :isApply="isApply" :applyId="applyId">
93
- </evan-form-item>
94
- </view>
95
- </view>
96
- </view>
97
-
98
- <view v-else-if="item.type === 'grid-lay-out'" v-show="item.options.canView" class="form_layout">
99
- <view v-for="(colItem, colIndex) in item.columns" :key="colIndex" class="form-item-container ">
100
- <view v-for="(col, itemIndex) in colItem.list" :key="itemIndex" v-show="col.options.canView">
101
- <template v-if="['hnkj-confirm', 'hnkj-verify'].includes(col.type) && item.options.canView">
102
- <view class="verify">
103
- <view class="verify-step">
104
- <text v-if="col.name" class="title-block"></text>
105
- <text>{{col.name }}</text>
106
-
107
- </view>
108
- <view class="verify-cot">
109
- <m-textarea
110
- :value="models[col.model].comments"
111
- show-word-limit
112
- :max-length="col.options.commentsLength"
113
- :disabled="col.model !== verifyNode" :placeholder="col.options.placeholder"
114
- @change="val => handlerText(val, col.model)">
115
- </m-textarea>
116
- </view>
117
- <view v-if="col.model == verifyNode" class="verify-cot">
118
- <view class="verify-title">{{col.options.operation}}</view>
119
- <view id="suggestSelect" style="width:200rpx; flex-shrink: 0; text-align: right; font-size: 26rpx; color: #333; line-height: 60rpx;"
120
- @click="openSuggestSelect(col)">
121
- {{suggestType[col.model] || '请点击选择'}}
122
- <text style="font-size: 24rpx; color: #999; margin-left: 4rpx;">▼</text>
123
- </view>
124
- </view>
125
- <view v-if="col.model !== verifyNode" class="verify-cot">
126
- <view class="verify-title">{{col.options.operation}}</view>
127
- <view style="flex-shrink: 0">{{models[col.model].operation}}</view>
128
- </view>
129
- <view class="verify-cot">
130
- <view class="verify-title">{{ col.options.operator }}</view>
131
- <view style="flex-shrink: 0">{{ models[col.model].operator }}</view>
132
- </view>
133
- <view class="verify-cot">
134
- <view class="verify-title">{{ col.options.operationTime }}</view>
135
- <view style="flex-shrink: 0">{{ models[col.model].operationTime }}</view>
136
- </view>
137
- </view>
138
- </template>
139
- <template v-else>
140
- <evan-form-item :isCorrect="isCorrect" :prop="col.model"
141
- :labelPosition="labelPosition"
142
- :ref="String(Math.random()).split('.')[1]" :models.sync="models" :rules="rules"
143
- :widget.sync="col" :isDraft="isDraft" :formId="formId" :linkage="linkage" :isApply="isApply" :applyId="applyId">
144
- </evan-form-item>
145
- </template>
146
- </view>
147
- </view>
148
- </view>
149
-
150
- <view v-else-if="item.type === 'grid'" v-show="item.options.canView" class="form_layout">
151
- <view class="form-item-container" v-for="(colItem, colIndex) in item.columns" :key="colIndex">
152
- <view v-for="(col, itemIndex) in colItem.list" :key="itemIndex" v-show="col.options.canView">
153
- <evan-form-item @upDateWidget="data => upDateGridWidget(data)" :isCorrect="isCorrect" :labelPosition="labelPosition" :prop="col.model"
154
- :ref="String(Math.random()).split('.')[1]" :models.sync="models" :rules="rules"
155
- :widget.sync="col" :isDraft="isDraft" :formId="formId" :linkage="linkage" :isApply="isApply" :applyId="applyId"
156
- @changedate="changedate" :zbrqList="zbrqList" :thrqList="thrqList" :zjfmFormDesign="zjfmFormDesign" :thrqDataModalShow="thrqDataModalShow"
157
- >
158
- </evan-form-item>
159
- </view>
160
- </view>
161
- </view>
162
-
163
- <template v-else-if="['verify', 'hnkj-verify', 'hnkj-confirm'].includes(item.type)">
164
-
165
- <view class="verify" v-if="item.options.canView">
166
- <view class="verify-step">
167
- <text v-if="item.name" class="title-block"></text>
168
- <text>{{item.name }}</text>
169
- </view>
170
- <view v-if="item.options.supportMulti && (verifyLogs && verifyLogs[item.model])" >
171
- <view v-for="(v_log, idx) in verifyLogsList(item.model)" :key="idx">
172
- <view class="verify-cot">
173
- <textarea :value="v_log.note" disabled>
174
- </textarea>
175
- </view>
176
- <view class="verify-cot">
177
- <view class="verify-title">{{item.options.operation}}</view>
178
- <view style="flex-shrink: 0">{{v_log['shenpiYijian']}}</view>
179
- </view>
180
- <view class="verify-cot">
181
- <view class="verify-title">{{item.options.operator}}</view>
182
- <view style="flex-shrink: 0">{{v_log['realname']}}</view>
183
- </view>
184
- <view class="verify-cot">
185
- <view class="verify-title">{{item.options.operationTime}}</view>
186
- <view style="flex-shrink: 0">{{v_log['shenpiTime']}}</view>
187
- </view>
188
- </view>
189
- </view>
190
- <view class="verify-cot" :style="{position:item.model === verifyNode ? 'initial' : 'relative'}">
191
- <m-textarea
192
- v-if="models[item.model]"
193
- :max-length="item.options.commentsLength"
194
- show-word-limit
195
- :value="models[item.model].comments"
196
- :disabled="warpVerifyDisable(item)" :placeholder="item.options.placeholder"
197
- @change="val => handlerText(val, item.model)">
198
- </m-textarea>
199
- <m-textarea
200
- v-else
201
- disabled
202
- :placeholder="item.options.placeholder"
203
- >
204
- </m-textarea>
205
- </view>
206
- <!-- #ifdef HBSF-MODE -->
207
- <view style="display: flex;align-items: center;background-color: #fff;padding: 20rpx 30rpx;" v-if="item.model === verifyNode">
208
- <view style="color: #808080;">推荐审核意见:</view>
209
- <view style="display: flex;justify-content: space-between;">
210
- <view class="form-input-suggest" @click="models[item.model].comments = '同意'">同意</view>
211
- <view class="form-input-suggest" @click="models[item.model].comments = '情况属实'">情况属实</view>
212
- <view class="form-input-suggest" @click="models[item.model].comments = '确认审核'">确认审核</view>
213
- </view>
214
- </view>
215
- <!-- #endif -->
216
- <view v-if="!warpVerifyDisable(item)" class="verify-cot">
217
- <view class="verify-title">{{item.options.operation}}</view>
218
- <view id="suggestSelect" style="width:200rpx; flex-shrink: 0; text-align: right; font-size: 26rpx; color: #333; line-height: 60rpx;"
219
- @click="openSuggestSelect(item)">
220
- {{suggestType[item.model] || '请点击选择'}}
221
- <text style="font-size: 24rpx; color: #999; margin-left: 4rpx;">▼</text>
222
- </view>
223
- </view>
224
- <view v-if="warpVerifyDisable(item)" class="verify-cot">
225
- <view class="verify-title">{{item.options.operation}}</view>
226
- <view style="flex-shrink: 0" v-if="models[item.model]">{{models[item.model].operationShow || models[item.model].operation}}</view>
227
- </view>
228
- <view class="verify-cot">
229
- <view class="verify-title">{{ item.options.operator }}</view>
230
- <view style="flex-shrink: 0" v-if="models[item.model]">{{ models[item.model].operator }}</view>
231
- </view>
232
- <view class="verify-cot">
233
- <view class="verify-title">{{ item.options.operationTime }}</view>
234
- <view style="flex-shrink: 0" v-if="models[item.model]">{{ models[item.model].operationTime }}</view>
235
- </view>
236
- </view>
237
- </template>
238
-
239
- <template v-else>
240
- <view :key="index" class="form-item-container" v-show="item.options.canView" >
241
-
242
- <evan-form-item @upDateWidget="data => upDateWidget(data, index)" :labelPosition="labelPosition" :isCorrect="isCorrect" :prop="item.model"
243
- :ref="String(Math.random()).split('.')[1]" :models.sync="models" :rules="rules"
244
- :widget.sync="item" :itemkey="index" :isDraft="isDraft" :formId="formId" :linkage="linkage" :formData="value"
245
- :isApply="isApply" :applyId="applyId">
246
- </evan-form-item>
247
- </view>
248
- </template>
249
- <!-- {{ item.options.canView? 1 : 0 }}-->
250
- </template>
251
-
252
- </evan-form>
253
- </view>
254
- </template>
255
-
256
- <script>
257
- import utils from '../evan-form/utils.js'
258
- import {
259
- cloneObj
260
- } from "../../utils/util.js";
261
- import Pubsub from 'pubsub-js'
262
- import evanFormItem from "../evan-form-item/evan-form-item";
263
- import pagePagination from '../page-pagination/page-pagination';
264
- import evanForm from "../evan-form/evan-form";
265
- import mTextarea from "../m-textarea/m-textarea";
266
- import packageJson from '../../package.json'
267
- import { run } from "../../utils/formula_run"
268
- import moment from "../../utils/moment"
269
- import {intersection, isEqual, isEqualWith, reduce, cloneDeep} from "lodash";
270
- import {getRecursionWidget, cacheHttp} from "../../utils/util";
271
- console.log('zhxy-app-component: ', packageJson.version)
272
- function timeout(ms) {
273
- return new Promise(resolve => {
274
- setTimeout(() => {
275
- resolve()
276
- }, ms)
277
- })
278
- }
279
- export default {
280
- options: { styleIsolation: 'shared' },
281
- name: 'formContainer',
282
- props: ['dataObj', 'value', 'isButton', 'verifyNode', 'verifyLogs', 'suggest', 'isCorrect', 'isDraft', 'formId', 'linkage', "labelPosition",
283
- 'isApply','applyId'
284
- ],
285
- components: { evanFormItem ,evanForm, mTextarea, pagePagination, },
286
- provide() {
287
- return {
288
- formContext: this,
289
- dataObj: () => this.dataObj,
290
- getFormData: () => this.value,
291
- }
292
- },
293
- data() {
294
- return {
295
- timer: null,
296
- showVerify: false, //默认不展示审核信息
297
- selectShow: {
298
-
299
- },
300
- suggestType: {},
301
- selectList: {},
302
- models: {
303
-
304
- }, //models
305
- rules: {}, //校验规则1
306
- // value: {}, //后台返回的表单值 (通常是父组件传值过来的)
307
- tableData: {},
308
- tableModel: {},
309
- tableIndex: {},
310
- tableFlag: {
311
-
312
- },
313
- data: {},
314
- userSignature: null,
315
- userSignaturePromise: null,
316
- // dataObj:dataObj,
317
- isScroll: true,
318
- tableRowsShow: {},
319
- isShowAdd: true,
320
- hideRequiredAsterisk: false,
321
- sexes: [{
322
- name: '男',
323
- value: 'man'
324
- },
325
- {
326
- name: '女',
327
- value: 'woman'
328
- }
329
- ],
330
- // 表单的内容必须初始化
331
- info: {
332
- name: '',
333
- table: [{
334
- sub: '22'
335
- },
336
- {
337
- sub: '333'
338
- }
339
- ]
340
- },
341
- info2: {
342
- name: '222',
343
- email: '7556@qq.com',
344
- phone: '15232656598',
345
- sub: '',
346
- },
347
- pickerIndex: 0,
348
- zbrqList: null,
349
- thrqList: null,
350
- zjfmFormDesign: false,
351
- thrqDataModalShow: '',
352
- formDesignFlag: false,
353
- unwatch:null,
354
- publish_linkage_array:[],
355
- tablePageInfo: {}
356
- }
357
- },
358
- watch: {
359
- // models(v) {
360
- // // console.log('container models')
361
- // // console.log(v)
362
- // // console.log(this.models)
363
- // this.isScroll = true;
364
- // },
365
- "dataObj.config"(val) {
366
- if (val?.linkage_config) {
367
- this.data.config = val
368
- this.handleLinkAge()
369
- }
370
- },
371
- verifyNode: {
372
- handler(val) {
373
- if (val) {
374
- this.getUserSignature()
375
- }
376
- },
377
- immediate: true
378
- },
379
- models: {
380
- deep: true,
381
- handler(v) {
382
- this.isScroll = true;
383
- if(v && !this.formDesignFlag) {
384
- this.formDesignFlag = true
385
- this.$u.get('sys/dict/getDictItems/zbb_th_app_id').then((res) => {
386
- if (res.success) {
387
- if(res.result && res.result.length > 0 && res.result[0].value == this.$Route.query.id) {
388
- if(this.$Route.query.type && this.$Route.query.type === 'detail') {
389
-
390
- } else {
391
- this.$u.get('zhxyZbb/canOpenZbbThsq', {appId: this.$Route.query.id}).then((res) => {
392
- if(!res.result) {
393
- uni.showToast({
394
- title: "当前无值班信息!",
395
- duration: 2000,
396
- icon: "none",
397
- });
398
- setTimeout(() => {
399
- uni.navigateBack({
400
- //uni.navigateTo跳转的返回,默认1为返回上一级
401
- delta: 1,
402
- });
403
- }, 2000)
404
- return
405
- }
406
- })
407
- }
408
-
409
- this.zjfmFormDesign = true
410
- this.$u.post("zhxyZbb/zhxyZbbZbth", this.models).then((res) => {
411
- if (res.success) {
412
- this.zbrqList = res.result;
413
- } else {
414
- this.zbrqList = null
415
- }
416
- });
417
- if(this.models.zbrq) {
418
- this.getThrqList(this.models.zbrq, true)
419
- }
420
- if(this.models.thr) {
421
- this.$u.post("zhxyZbb/zhxyZbbZbth", {value:this.models, model: 'thrq', applyId: this.$Route.query.applyId }).then((res) => {
422
- if (res.success) {
423
- // this.zbrqList = res.result
424
- this.thrqDataModalShow = res.result.filter(item => item.gh == this.models.thr)[0].xm
425
- } else {
426
- this.thrqDataModalShow = ''
427
- }
428
- });
429
- }
430
- } else {
431
- this.zjfmFormDesign = false
432
- }
433
- } else {
434
- this.zjfmFormDesign = false
435
- }
436
- })
437
- }
438
- }
439
- },
440
- dataObj: {
441
- handler(v) {
442
- if (this._currObjId && this._currObjId !== this.dataObj._currObjId) return
443
- this.data = v
444
- if (this.dataObj && this.dataObj.list && this.dataObj.list.length > 0) {
445
- this.data = v
446
- this.dataObj._currObjId = this._currObjId = Math.random()
447
- this.rules = {};
448
- this.generateModle(this.data.list);
449
- this.initFormLinkage();
450
- this.updateFormDataToModels()
451
- }
452
- },
453
- immediate: true
454
- },
455
- data: {
456
- handler(val) {
457
- this.dataObj = val
458
- },
459
- deep: true
460
- },
461
- value: {
462
- handler(v) {
463
- if (v) {
464
- this.updateFormDataToModels()
465
- }
466
- },
467
- immediate: true
468
- },
469
- suggest(v) {
470
- this.$set(this.selectList, this.verifyNode, v);
471
- this.$set(this.selectShow, this.verifyNode, false);
472
- const item = this.dataObj.list.find(obj => obj.model === this.verifyNode)
473
- if (item
474
- && !this.models[this.verifyNode].operation
475
- && item.options.operationChooseFirst) {
476
- this.models[this.verifyNode].operation = this.suggest[0]
477
- ? this.suggest[0].value
478
- : "";
479
- this.$set(this.suggestType, this.verifyNode, this.models[this.verifyNode].operation)
480
- this.fillVerifySignSeal(item)
481
- }
482
- if (item
483
- && !this.models[this.verifyNode].operation
484
- && item.options.confirmOperationChooseFirst) {
485
- this.models[this.verifyNode].operation = this.suggest[0]
486
- ? this.suggest[0].value
487
- : "";
488
- this.$set(this.suggestType, this.verifyNode, this.models[this.verifyNode].operation)
489
- this.fillVerifySignSeal(item)
490
- }
491
- },
492
- tableData: {
493
- handler(val) {
494
- const keys = Object.keys(this.tableData)
495
- keys.forEach(key => {
496
- if (!this.tablePageInfo[key]) {
497
- this.$set(this.tablePageInfo, key, {
498
- current: 1,
499
- pageSize: 10,
500
- total: this.tableData[key].length
501
- })
502
- }
503
- this.tablePageInfo[key].total = this.tableData[key].length
504
- })
505
- },
506
- immediate: true,
507
- deep: true
508
- },
509
- // linkage:{
510
- // deep: true,
511
- // handler(v){
512
- // console.log(v,'12345675676575')
513
- // },
514
- // }
515
- },
516
- created() {
517
- this.updateWidget = Pubsub.subscribe("updateWidget",(key,data)=>{
518
- const findKey = arr =>{
519
- if(!arr || !arr.length){
520
- return false;
521
- }
522
- let index = -1;
523
- index = arr.findIndex(item=>item.model == data.model);
524
- if(index > -1){
525
- return true;
526
- }else{
527
- return false;
528
- }
529
- }
530
- const changeWidget = arr =>{
531
- return arr.map(item=>{
532
- if(item.model == data.model){
533
- return data;
534
- }else{
535
- return item;
536
- }
537
- })
538
- }
539
- if(findKey(this.data.list)){
540
- this.data.list = changeWidget(this.data.list);
541
- }else{
542
- this.data.list.forEach(item=>{
543
- if(item.columns){
544
- if(findKey(item.columns)){
545
- item.columns = changeWidget(item.columns);
546
- }else{
547
- item.columns.forEach(column=>{
548
- if(findKey(column.list)){
549
- column.list = changeWidget(column.list);
550
- }
551
- })
552
- }
553
- }
554
- })
555
- }
556
- })
557
- },
558
- updated() {
559
-
560
- },
561
- mounted() {
562
-
563
- // 回显关联组件
564
- // setTimeout(() => {
565
- // this.getchildren()
566
- // }, 1000)
567
- // console.log('thisdataObj', this.dataObj)
568
- // this.generateModle(dataObj.list);
569
- // if (this.dataObj && this.dataObj.list) {
570
- // this.rules = {};
571
- // this.generateModle(this.dataObj.list);
572
- // }
573
-
574
- // Pubsub.publish('randomObserve', this.models)
575
- // console.log('models', this.models)
576
- // console.log('tableData', this.tableData);
577
- // console.log('tableModel', this.tableModel)
578
- // console.log('tableIndex', this.tableIndex)
579
- // 这里必须放在mounted中,不然h5,支付宝小程序等会找不到this.$refs.form
580
- // console.log('rules', this.rules)
581
- // this.$refs.form.setRules(this.rules);
582
- // this.initPo();
583
- },
584
- methods: {
585
- getUserSignature() {
586
- if (!this.userSignaturePromise) {
587
- this.userSignaturePromise = cacheHttp.get('workhall/userseal/queryById')
588
- }
589
- return this.userSignaturePromise
590
- },
591
- tablePageIndex(model,index){
592
- return (this.tablePageInfo[model].current - 1) * this.tablePageInfo[model].pageSize + index
593
- },
594
- currTablePageData(item) {
595
- // TODO 处理首次加载页面很多select需要请求远程字典问题(分页,只请求前十条)
596
- const startPage = (this.tablePageInfo[item.model]?.current - 1)* this.tablePageInfo[item.model]?.pageSize
597
- const endPage = (this.tablePageInfo[item.model]?.current - 1) * this.tablePageInfo[item.model]?.pageSize + this.tablePageInfo[item.model]?.pageSize
598
- let pageData = this.tableData[item.model]?.slice(startPage, endPage)
599
- return pageData
600
- },
601
- async tablePageChange(item, page) {
602
- let pageSize=10;
603
- await this.$nextTick()
604
- if (this.tablePageInfo[item.model].pageSize !== pageSize) page = 1
605
- this.tablePageInfo[item.model].pageSize = pageSize
606
- await this.$nextTick()
607
- this.tablePageInfo[item.model].current = page
608
- await this.$nextTick()
609
- },
610
- // 表单联动部分组件并未放入evanFormItem,所以并未订阅相关事件,此方法将相关组件放入订阅模式
611
- initFormLinkage() {
612
- if(this.data?.list){
613
- this.data.list.forEach(item=>{
614
- if(['verify', 'hnkj-verify', 'hnkj-confirm'].includes(item.type)){
615
- this.publish_linkage_array.push(Pubsub.subscribe('formLinkage_' + item.model, (key, data) => {
616
- let onlyKey = key.replace("formLinkage_","");
617
- if (data.type === 'show') {
618
- this.data.list = this.data.list.map(l=>{
619
- if(l.model == onlyKey){
620
- this.$set(l.options,"canView",data.updateValue);
621
- }
622
- return l;
623
- })
624
- // this.widget.options.canView = data.updateValue
625
- }
626
- if(data.type === "update"){
627
- if(typeof data.updateValue == "string" && data.updateValue == ""){
628
- if(onlyKey.indexOf("hnkj_confirm")!=-1){
629
- this.$set(this.suggestType,onlyKey,"");
630
- this.models[onlyKey].comments = "";
631
- this.models[onlyKey].operation = null;
632
- }
633
- }
634
- }
635
- }))
636
- }
637
- })
638
- }
639
- },
640
- changedate(key,value) {
641
- if(key == 'thrq') {
642
- this.getThrqList(value)
643
- } else {
644
- this.thrqDataModalShow = ''
645
- }
646
- },
647
- getThrqList(value, flag) {
648
- this.models.zbrq = value
649
- this.$u.post("zhxyZbb/zhxyZbbZbth", {value:this.models, model: 'zbrq' }).then((res) => {
650
- if (res.success) {
651
- this.thrqList = res.result;
652
- if(!flag) this.models.zbxq = this.thrqList.zbxq
653
- } else {
654
- this.thrqList = null
655
- if(!flag) this.models.zbrq = ''
656
- if(this.$Route.query.type && this.$Route.query.type === 'detail') {
657
-
658
- } else {
659
- uni.showToast({
660
- title: res.message,
661
- duration: 2000,
662
- icon: "none",
663
- });
664
- }
665
-
666
- }
667
- });
668
- },
669
- warpVerifyDisable(widget) {
670
- if (widget.options.isConfirmComponent) return widget.options.disabled
671
- return widget.model !== this.verifyNode
672
- },
673
- m_isCorrectAudit() {
674
- return Number(this.isCorrect) === 1 && globalThis._CONFIG.JCTJBT
675
- },
676
- updateFormDataToModels() {
677
- // 将formData 中未绑定表单key 的数据也复制到models
678
- const modelsKeys = Object.keys(this.models)
679
- Object.keys(this.value).forEach(key => {
680
- if (!modelsKeys.includes(key)) {
681
- this.models[key] = this.value[key]
682
- }
683
- })
684
- },
685
- verifyLogsList(model) {
686
- const list = this.verifyLogs[model]
687
- if (model !== this.verifyNode && list.length >= 1) return list.slice(0, list.length - 1)
688
- return list
689
- },
690
- //回显关联组件的操作
691
- getchildren() {
692
- // console.log(this.$children[0])
693
- // this.handlerelation(this.$children[0].$children)
694
- },
695
- // 更新所有组件的值
696
- updateAllComponentValue() {
697
- for(const key in this.$refs) {
698
- this.$refs[key] && [].concat(this.$refs[key]).forEach(item => {
699
- item.updateDataModel && item.updateDataModel()
700
- item.showFormData && item.showFormData()
701
- })
702
- }
703
- },
704
- handlerelation(arr) {
705
- for (let i = 0; i < arr.length; i++) {
706
- const item = arr[i]
707
- if (item.widget && item.widget.type == 'relateSub') {
708
- if (item.tableKey) {
709
- item.pulishMsg(
710
- item.models[item.tableKey][item.tableIndex][item.widget.model],
711
- true
712
- )
713
- } else {
714
- item.pulishMsg(item.models[item.widget.model], true)
715
- }
716
- }
717
- if (item.widget && item.widget.type == 'table') {
718
- this.handlerelation(item.$children)
719
- }
720
- }
721
- },
722
- //更新widget 目前应用于关联组件隐藏 禁用
723
- upDateWidget(widget, key) {
724
- console.log(widget.options.canView)
725
- this.dataObj.list.splice(key, 1, widget)
726
- },
727
- //更新widget 目前应用于子表单关联子组件隐藏 禁用
728
- upDateTableWidget(widget, key, tableKey, tableIndex) {
729
- this.tableData[tableKey][tableIndex].columns.splice(key, 1, widget)
730
- },
731
- //更新widget 目前应用于栅格布局关联子组件隐藏 禁用
732
- upDateGridWidget(widget) {
733
- this.data.list.forEach((item, index) => {
734
- if(item.model == widget.parentModel) {
735
- let obj = {}
736
- obj = {...item}
737
- let idx = obj.columns.findIndex(val => val.list[0].model == widget.model)
738
- obj.columns[idx].list[0] = widget
739
- this.$set(this.dataObj.list, index, obj)
740
- }
741
- })
742
- },
743
- // 打开操作类型选择
744
- openSuggestSelect(item) {
745
- const list = this.selectList[item.model] || this.suggest || [];
746
- if (list.length === 0) return;
747
- uni.showActionSheet({
748
- itemList: list.map(opt => opt.label || opt.value),
749
- success: (res) => {
750
- this.selectConfirm([list[res.tapIndex]], item);
751
- }
752
- });
753
- },
754
- // 选择操作类型
755
- selectConfirm(e, item) {
756
- const { model, options, type } = item
757
- let label = ''
758
- e.map((val, index) => {
759
- label = val.label;
760
- this.$set(this.models[model], 'operation', label)
761
- if (options.isConfirmComponent) {
762
- this.$set(this.models[model], 'operation', val.value)
763
- }
764
- })
765
- this.$set(this.suggestType, model, label)
766
- this.fillVerifySignSeal(item)
767
-
768
- },
769
- fillVerifySignSeal(widget) {
770
- const { model, options, type } = widget
771
- if (options.isConfirmComponent) {
772
- return this.getUserSignature().then(res => {
773
- if (res.success) {
774
- const { userSign } = res?.result || {}
775
- if (userSign) {
776
- this.models[model].userSign = userSign
777
- }
778
- }
779
- }).finally(() => {
780
- this.models[model].loadingSign = false
781
- })
782
- return
783
- }
784
- if (type === 'hnkj-verify') {
785
- const select = this.selectList[widget.model].find(item => item.label === this.suggestType[model])
786
- const { enableSign , enableSeal } = options
787
- if (select.description === 'TIJIAO') {
788
- this.models[model].loadingSign = true
789
- this.getUserSignature().then(res => {
790
- if (res.success) {
791
- this.models[model].userSign = enableSign ? res.result.userSign : ''
792
- this.models[model].userSeal = enableSeal ? res.result.userSeal : ''
793
- }
794
- }).finally(() => {
795
- this.models[model].loadingSign = false
796
- })
797
- } else {
798
- this.models[model].userSign = ''
799
- this.models[model].userSeal = ''
800
- }
801
- }
802
- },
803
- scrollToTop(top) {
804
- const _this = this
805
- this.$nextTick(function() {
806
- uni.createSelectorQuery()
807
- .in(_this)
808
- .select('#suggestSelect').boundingClientRect(data => {
809
- uni.pageScrollTo({
810
- scrollTop: data.top - top,
811
- duration: 200
812
- });
813
- }).exec()
814
- })
815
- },
816
- //校验审核组件是否为空
817
- /* checkVerify() {
818
- if(this.suggestType == '') {
819
- uni.showToast({
820
- title: '审核操作不能为空',
821
- duration: 1000,
822
- icon: 'none'
823
- });
824
- this.scrollToTop()
825
- }
826
- }, */
827
- bindPickerChange(e, model) {
828
- // console.log('picker发送选择改变,携带值为', e.target.value)
829
- // console.log(this.suggest)
830
- this.pickerIndex = e.target.value
831
- // this.models[model].operation = e.target.value
832
- this.models[model].operation = this.suggest[e.target.value].value;
833
- console.log(this.models)
834
- },
835
- handlerText(value, model) {
836
- this.models[model].comments = value
837
- },
838
- /***单选修改赋值***/
839
- selectorOption(picked, model) {
840
- console.log(picked);
841
- console.log(model)
842
- this.models[model].operation = picked.value
843
- },
844
- /***option 数据重构**/
845
- selectDataTransForm(data) {
846
-
847
- if (!data || (data.length == 0)) {
848
- return []
849
- } else {
850
- return data.map(item => {
851
- // return {
852
- // label: item.value,
853
- // value: item.label
854
- // }
855
- return item.value
856
- })
857
- }
858
- },
859
- /**展开 收起 子表单列**/
860
- showTableRow(model, index) {
861
- // uni.createSelectorQuery()
862
- // .in(this)
863
- // .select('.table-header').boundingClientRect(data => {
864
- // console.log("得到布局位置信息" + JSON.stringify(data));
865
- // console.log("节点离页面顶部的距离为" + data.top);
866
- // uni.pageScrollTo({
867
- // scrollTop: data.top,
868
- // duration: 800
869
- // });
870
- // }).exec()
871
- // this.$set(this.tableFlag,'flag',[true])
872
- // this.tableFlag.flag = [true];
873
- // this.tableRowsShow[model][index] = !this.tableRowsShow[model][index];
874
- this.$set(this.tableRowsShow[model], index, !this.tableRowsShow[model][index]);
875
- /***解决小程序不能深度监听***/
876
- var tempObj = cloneObj(this.tableRowsShow)
877
- // console.log(this.tableRowsShow[model][index],index)
878
-
879
- // console.log(this.tableRowsShow[model][index])
880
- },
881
- //删除子表单row
882
- handleDeleteRow(index, model) {
883
- console.log('删除子表单row',index, model)
884
- // //更新tableData
885
- //更新models
886
- this.models[model].splice(index, 1);
887
- this.tableData[model].splice(index, 1);
888
- this.tableRowsShow[model].splice(index, 1);
889
- let _index = 0;
890
- this.tableData[model].forEach(item => {
891
- item.index = _index++;
892
- });
893
- this.tableIndex[model]--;
894
- },
895
- //添加子表单里面的row
896
- addToTableData(data, model, addModel) {
897
- let dataTemp = JSON.parse(JSON.stringify(data));
898
- this.tableIndex[model] === undefined ?
899
- this.$set(this.tableIndex, model, 0) :
900
- null;
901
- dataTemp.index = this.tableIndex[model];
902
- /***table row show start*/
903
- this.tableRowsShow[model] === undefined ?
904
- this.$set(this.tableRowsShow, model, []) :
905
- null;
906
- this.$set(this.tableRowsShow[model], this.tableIndex[model], true)
907
- /***table row show end*/
908
- this.tableIndex[model]++;
909
- this.tableData[model] === undefined ?
910
- this.$set(this.tableData, model, []) :
911
- null;
912
- if (addModel) {
913
- let addModelObject = {};
914
- dataTemp.columns.forEach(item => {
915
- item.options.isCorrect = false;
916
- let defaultValue = item.options.defaultValue
917
- if (String(defaultValue).startsWith('script:')) {
918
- defaultValue = ''
919
- }
920
- addModelObject[item.model] = item.defaultValue ?
921
- item.defaultValue :
922
- defaultValue;
923
- });
924
- if(!this.models[model]) this.models[model] = []
925
- this.models[model].push(addModelObject);
926
- dataTemp.options.isCorrect = false;
927
- } else {
928
- dataTemp.options.isCorrect = true;
929
- }
930
- this.tableData[model].push(dataTemp);
931
- // console.log(this.tableData[model])
932
- },
933
- //tableData init
934
- generateTableData(gen) {
935
- // console.log('JSON.models',JSON.stringify(this.models))
936
- // this.tableData = {};
937
- // this.tableIndex = {};
938
- this.isShowAdd = true;
939
- if (gen.type === "table") {
940
- var tableModel = gen.model;
941
- if (this.tableData[tableModel] instanceof Array) {
942
- this.tableData[tableModel].length = 0;
943
- this.tableIndex[tableModel] = 0;
944
- }
945
- this.tableModel[tableModel] = gen;
946
- this.tableModel[tableModel]["options"]["defaultValue"] = this.models[
947
- gen.model
948
- ];
949
- this.tableInitByModel(tableModel);
950
- if (gen.options.defaultAddRow && !gen.options.disabled && (!this.models[gen.model] || (Array.isArray(this.models[gen.model]) && this.models[gen.model].length === 0))) {
951
- this.addToTableData(gen, gen.model, 'addModel')
952
- }
953
- }
954
- },
955
- tableInitByModel(model) {
956
- if (
957
- this.models[model] &&
958
- this.models[model] instanceof Array &&
959
- this.models[model].length > 0
960
- ) {
961
- console.log('--',this.tableModel[model], model)
962
- this.models[model].forEach(async(item, index) => {
963
- this.originIndex++;
964
- await timeout(0)
965
- this.addToTableData(this.tableModel[model], model);
966
- });
967
- }
968
- // console.log('tableData',this.tableData)
969
- // console.log(this.models)
970
- },
971
- async or(...args) {
972
- for (const argsKey in args) {
973
- if (await args[argsKey]) return true
974
- }
975
- return false
976
- },
977
- async and(...args) {
978
- for (const argsKey in args) {
979
- if (!await args[argsKey]) return false
980
- }
981
- return true
982
- },
983
- async handleLinkAge() {
984
- // console.log(this.data.config.linkage_config)
985
- const that = this
986
- if (!this.data?.config?.linkage_config) return
987
- if (this.formFunctions) return
988
- this.formFunctions = {
989
- async call_func(list, models) {
990
- const widgetList = getRecursionWidget(that.data.list)
991
- const linkageWidget = widgetList.filter(item => list.map(item => item.model).includes(item.model))
992
- return list.map(item => this[item.type](models[item.model] ,item.value, linkageWidget.find(widget => widget.model === item.model)))
993
- },
994
- all_same(currVal, targetVal, widget) {
995
- if (Array.isArray(currVal) && Array.isArray(targetVal)) {
996
- return intersection(targetVal, currVal).length === targetVal.length
997
- }
998
- return false
999
- },
1000
- same(currVal, targetVal, widget) {
1001
- console.log(widget)
1002
- const { format } = widget.options
1003
-
1004
- if (widget.type === 'date') {
1005
- return moment(currVal).format(format) === moment(targetVal).format(format)
1006
- }
1007
- if (Array.isArray(currVal)) {
1008
- if (Array.isArray(targetVal)) {
1009
- if (currVal.length !== targetVal.length) return false
1010
- return isEqual(currVal.sort(), targetVal.sort()) || isEqualWith(currVal.sort(), targetVal.sort(), (a, b) => { if (!a.id) return false; return a.id === b.id})
1011
- }
1012
- }
1013
- return currVal == targetVal
1014
- },
1015
- not_same(currVal, targetVal, widget) {
1016
- const { format } = widget.options
1017
- if (widget.type === 'date') {
1018
- return moment(currVal).format(format) === moment(targetVal).format(format)
1019
- }
1020
- if (Array.isArray(currVal)) {
1021
- return currVal.every(item => {
1022
- return targetVal == item?.id || targetVal == item
1023
- })
1024
- }
1025
- return currVal != targetVal
1026
- },
1027
- gt(currVal, targetVal, widget) {
1028
- const { format } = widget.options
1029
- if (widget.type === 'date') {
1030
- return moment(currVal).isAfter(moment(targetVal))
1031
- }
1032
- return currVal > targetVal
1033
- },
1034
- gte(currVal, targetVal, widget) {
1035
- const { format } = widget.options
1036
- if (widget.type === 'date') {
1037
- return moment(currVal).isSameOrAfter(moment(targetVal))
1038
- }
1039
- return currVal >= targetVal
1040
- },
1041
- lt(currVal, targetVal, widget) {
1042
- if (widget.type === 'date') {
1043
- return moment(currVal).isBefore(moment(targetVal))
1044
- }
1045
- return currVal < targetVal
1046
- },
1047
- lte(currVal, targetVal, widget) {
1048
- const { format } = widget.options
1049
- if (widget.type === 'date') {
1050
- return moment(currVal).isSameOrBefore(moment(targetVal))
1051
- }
1052
- return currVal <= targetVal
1053
- },
1054
- same_some(currVal, targetVal, widget) {
1055
- if (Array.isArray(targetVal) && targetVal.includes('[未填写]')) {
1056
- targetVal = targetVal.concat(undefined, null, '')
1057
- }
1058
- if (Array.isArray(currVal) && !currVal.length) currVal = undefined
1059
-
1060
- return [].concat(currVal).some(item => targetVal.includes(item))
1061
- // return targetVal.includes(currVal)
1062
- },
1063
- not_same_some(currVal, targetVal, widget) {
1064
- if (Array.isArray(targetVal) && targetVal.includes('[未填写]')) {
1065
- targetVal = targetVal.concat(undefined, null, '')
1066
- }
1067
- if (Array.isArray(currVal) && !currVal.length) currVal = undefined
1068
- return [].concat(currVal).some(item => !targetVal.includes(item))
1069
- // return !targetVal.includes(currVal)
1070
- },
1071
- EMPTY(currVal, targetVal, widget) {
1072
- if (Array.isArray(currVal)) return !currVal.length
1073
- return !currVal
1074
- },
1075
- NOT_EMPTY(currVal, targetVal, widget) {
1076
- if (Array.isArray(currVal)) return !!currVal.length
1077
- return !!currVal
1078
- },
1079
- async include(currVal, targetVal, widget) {
1080
- if ([undefined, null, ''].includes(currVal)) return false
1081
- if (['checkbox', 'select', 'radio'].includes(widget.type) && global.dictData[widget.model] == null || Array.isArray(global.dictData[widget.model])) {
1082
- for (let i = 0; i < 10; i++) {
1083
- if (Array.isArray(global.dictData[widget.model])) {
1084
- return global.dictData[widget.model].filter(item => item.value == currVal)?.some( item => item.text.includes(targetVal || undefined) || item.value.includes(targetVal || undefined))
1085
- }
1086
- await timeout(300)
1087
- }
1088
- }
1089
- return currVal.includes(targetVal || undefined)
1090
- },
1091
- async not_include(currVal, targetVal, widget) {
1092
- return !(await this.include(currVal, targetVal, widget))
1093
- },
1094
- }
1095
- this.formFunctions._init = true
1096
- await this.$nextTick()
1097
- this.initLinkAge();
1098
- },
1099
- initLinkAge(){
1100
- if(this.unwatch){
1101
- this.unwatch();
1102
- }
1103
- this.unwatch = this.$watch('models', async (newVal, oldVal) => {
1104
- await timeout(0)
1105
- let diffModels = reduce(newVal, function(result, value, key) {
1106
- return isEqual(value, oldVal?.[key]) ?
1107
- result : result.concat(key);
1108
- }, []);
1109
- if (!diffModels?.length && (this.formFunctions._init && newVal && oldVal)) {
1110
- diffModels = Object.keys(newVal)
1111
- this.formFunctions._init = false
1112
- }
1113
- // const differenceObj = difference(cloneDeep(newVal), cloneDeep(oldVal))
1114
- console.log('diffModels', diffModels)
1115
- const widgetList = getRecursionWidget(this.data?.list)
1116
- this.data?.config?.linkage_config?.forEach(item => {
1117
- let { toTypeSelect, toWidgetList, typeSelect, list, updateValue, hideClearValue, forceClearValue } = item
1118
- // 表单详情会导致可编辑
1119
- if (['update', 'disabled'].includes(toTypeSelect) && this.$route?.query?.type === 'detail') return
1120
- toWidgetList.forEach(async toWidgetModel => {
1121
- const widget = widgetList.find(item => item.model === toWidgetModel)
1122
- const changeModelList = list.some(item => diffModels.includes(item.model)) ? list : []
1123
- if (changeModelList.length === 0) return
1124
-
1125
- const flag = await this[typeSelect].apply(this, await this.formFunctions.call_func(changeModelList, newVal))
1126
- switch (toTypeSelect) {
1127
- case 'show':
1128
- if (widget.parentType === 'table') {
1129
- this.$set(widget.options, 'canView', flag)
1130
- }
1131
- Pubsub.publish('formLinkage_' + widget.model, {
1132
- type: 'show',
1133
- updateValue: flag,
1134
- })
1135
- if (!flag && hideClearValue) {
1136
- /**跳过公文和编号字段的隐藏清空功能 */
1137
- if(!["editorAirt","codeControl"].includes(widget.type)){
1138
- Pubsub.publish('formLinkage_' + widget.model, {
1139
- type: 'update',
1140
- updateValue: '',
1141
- })
1142
- }
1143
- setTimeout(() => {
1144
- const isAllFlag = widgetList.filter(item => item.parentModel === widget.parentModel).every( item => item.options.canView === flag)
1145
- if (!flag && isAllFlag) {
1146
- // 删除所有行
1147
- this.tableData = [];
1148
- this.$set(this.tableIndex,widget.parentModel,0);
1149
- this.$set(this.models,widget.parentModel,[]);
1150
- }
1151
- }, 100)
1152
- }
1153
- // this.$set(widget.options, 'canView', flag)
1154
- // this.data.list = cloneDeep(this.data.list)
1155
- break
1156
- case 'required':
1157
- let rules = this.rules
1158
- if (widget.parentType === 'table') {
1159
- if (!rules[widget.parentModel]) rules[widget.parentModel] = {}
1160
- rules = rules[widget.parentModel]
1161
- }
1162
- if (!rules[widget.model]) rules[widget.model] = []
1163
- const hasRequiredConfig = rules[widget.model].some(item => {
1164
- if (item?.required !== undefined) {
1165
- item.required = flag
1166
- return true
1167
- }
1168
- return false
1169
- })
1170
- if (!hasRequiredConfig) {
1171
- if(flag){
1172
- /**当需要必填时,再推入校验数组 */
1173
- rules[widget.model].push( {
1174
- required: flag,
1175
- trigger: 'change',
1176
- message: `${(widget.name || "").replaceAll(' ', '')}必须填写`,
1177
- })
1178
- }
1179
- }
1180
- this.$set(widget.options, 'required', flag)
1181
-
1182
- !flag && this.$refs.Form.clearValidate(widget.model)
1183
-
1184
- this.$set(widget, 'rules', rules[widget.model])
1185
- this.generateRules(widget, this.data?.list?.find(item => item.model === widget.parentModel))
1186
- break
1187
- case 'update':
1188
- updateValue = String(updateValue)
1189
- if (isNaN(updateValue)) {
1190
- try {
1191
- updateValue = JSON.parse(updateValue)
1192
- } catch (e) {
1193
-
1194
- }
1195
- }
1196
- if (widget.type === 'rate' || widget.type === "number") updateValue = !isNaN(updateValue) ? Number(updateValue) : updateValue
1197
- // if (['responsibility', 'switch'].includes(widget.type)) updateValue = Boolean(updateValue) || updateValue === 'true'
1198
- if (widget.parentType === 'table') {
1199
- if (!Array.isArray(this.models[widget.parentModel])) this.models[widget.parentModel] = []
1200
- return this.models[widget.parentModel]?.forEach((item,idx) => {
1201
- this.models[widget.parentModel][idx][widget.model] = flag ? updateValue : ''
1202
- })
1203
- }
1204
- // 不符合时, 如果 未勾选 “不符合时清除值”, 就不用清理
1205
- if (!flag && !forceClearValue) break
1206
- Pubsub.publish('formLinkage_' + widget.model, {
1207
- type: 'update',
1208
- updateValue: flag ? updateValue : '',
1209
- })
1210
- // setTimeout(() => {
1211
- // this.$set(this.models, widget.model, flag ? updateValue : undefined)
1212
- // // this.models[widget.model] = flag ? updateValue : ''
1213
- // }, 1000)
1214
- break
1215
- case 'disabled':
1216
- this.$set(widget.options, 'disabled', flag)
1217
- break
1218
- }
1219
- // 当子表单内容column元素都隐藏时,隐藏整个子表单项
1220
- this.data.list = this.data.list.map(item=>{
1221
- if(item.type == "table"){
1222
- const sum = item.columns.reduce((pre,current)=>{
1223
- if(!current.options.canView){
1224
- pre++;
1225
- }
1226
- return pre;
1227
- },0)
1228
- if(sum == item.columns.length){
1229
- this.$set(item.options,"canView",false);
1230
- }else{
1231
- this.$set(item.options,"canView",true);
1232
- }
1233
- }
1234
- return item;
1235
- })
1236
- })
1237
-
1238
- })
1239
- },
1240
- {
1241
- immediate: true,
1242
- deep: true
1243
- })
1244
- },
1245
- /***初始化models***/
1246
- async generateModle(genList) {
1247
- if (!genList || genList.length === 0) return;
1248
- this.handleLinkAge()
1249
- for (let i = 0; i < genList.length; i++) {
1250
- if (["grid", 'grid-lay-out', 'all-lay-out', 'table'].includes(genList[i].type)) {
1251
- let subscribeKey = genList[i].options.subscribeOptions ?
1252
- genList[i].options.subscribeOptions.subscribeKey :
1253
- '';
1254
- Pubsub.subscribe(subscribeKey, (msg, data) => {
1255
- console.log('layout 接受消息', data);
1256
- const widget = genList[i]
1257
- const list = data.msg
1258
- const that = this
1259
-
1260
- that.isWx = true
1261
- let global = globalThis
1262
- // #ifdef H5
1263
- let operateValue = data.operateValue
1264
- if(data.operateValue.includes('this.$http')) {
1265
- operateValue = operateValue.replace(/this\.\$http/g, "this.$u")
1266
- }
1267
- eval(operateValue)
1268
- return
1269
- // #endif
1270
- let operateValueWx = data.operateValue
1271
- if(operateValueWx.includes('this.$http')) {
1272
- operateValueWx = operateValueWx.replace(/this\.\$http/g, "that.$u")
1273
- }
1274
- console.log(run(operateValueWx, {
1275
- that: this,
1276
- widget,
1277
- global: globalThis,
1278
- list,
1279
- isWx: true,
1280
- uni
1281
- }))
1282
- });
1283
-
1284
- }
1285
- if (["grid", 'grid-lay-out', 'all-lay-out'].includes(genList[i].type)) {
1286
- genList[i].columns.forEach(item => {
1287
- this.generateModle(item.list);
1288
- });
1289
- } else {
1290
-
1291
- if (
1292
- this.value &&
1293
- Object.keys(this.value).indexOf(genList[i].model) >= 0
1294
- ) {
1295
- this.models[genList[i].model] = cloneObj(
1296
- this.value[genList[i].model]
1297
- );
1298
-
1299
- console.log(genList[i].type)
1300
-
1301
- /**审核**/
1302
- if (genList[i].type === "verify") {
1303
- this.models[genList[i].model] = this.value[genList[i].model];
1304
- }
1305
-
1306
- if (genList[i].type === "table") {
1307
- this.generateTableData(genList[i]); //生成tableModel
1308
- //设置rules
1309
- }
1310
- if (genList[i].type === "hnkj-confirm") {
1311
- this.$set(this.selectShow, genList[i].model, false)
1312
- const dictName = genList[i].options.dictName
1313
- if(typeof this.models[genList[i].model] == "string" && this.models[genList[i].model] == ""){
1314
- this.models[genList[i].model] = {};
1315
- }
1316
- this.$set(this.models[genList[i].model], 'dictName',dictName )
1317
- if (dictName) cacheHttp.get(`/sys/dict/getDictItems/${dictName}`).then(res => {
1318
- if (res.success) {
1319
- this.$set(this.selectList, genList[i].model, res.result?.map(item => ({
1320
- label: item.title,
1321
- value: item.value,
1322
- description: item.value
1323
- })))
1324
- const operation = this.models[genList[i].model].operation
1325
- const label = this.selectList[genList[i].model].find(item => item.value === operation)?.label
1326
- this.$set(this.models[genList[i].model], 'operationShow',label )
1327
- this.$set(this.suggestType, genList[i].model, label)
1328
- }
1329
- })
1330
- }
1331
- } else {
1332
-
1333
- /**审核**/
1334
- if (genList[i].type === "verify") {
1335
- this.models[genList[i].model] = genList[i].operationColumns;
1336
- } else if (genList[i].type === "hnkj-confirm") {
1337
- this.$set(this.selectShow, genList[i].model, false)
1338
- if (genList[i].options.isConfirmComponent && !this.warpVerifyDisable(genList[i])) {
1339
- const dictName = genList[i].options.dictName
1340
- if (dictName) var res = await cacheHttp.get( `/sys/dict/getDictItems/${dictName}`)
1341
- if (res.success) {
1342
- this.$set(this.selectList ,genList[i].model, res.result?.map(item => ({ label: item.title, value: item.value, description: item.value})))
1343
- }
1344
- const userInfo = uni.getStorageSync('userinfo')
1345
- this.$set(
1346
- this.models,
1347
- genList[i].model,
1348
- {
1349
- comments: '',
1350
- operation: '',
1351
- dictName,
1352
- operator: userInfo.realname || userInfo.username,
1353
- operationTime: moment().format('YYYY-MM-DD HH:mm:ss'),
1354
- userSign: ''
1355
- }
1356
- )
1357
- // 确认组件==确认操作默认选中第一项
1358
- if (genList[i]
1359
- && !this.models[genList[i].model].operation
1360
- && genList[i].options.confirmOperationChooseFirst) {
1361
- this.models[genList[i].model].operation = this.selectList[genList[i].model][0]
1362
- ? this.selectList[genList[i].model][0].value
1363
- : "";
1364
- this.$set(this.suggestType, genList[i].model, this.models[genList[i].model].operation)
1365
- this.fillVerifySignSeal(genList[i])
1366
- }
1367
- }
1368
- } else if (genList[i].type === "blank") {
1369
- this.$set(
1370
- this.models,
1371
- genList[i].model,
1372
- genList[i].options.defaultType === "String" ?
1373
- "" :
1374
- genList[i].options.defaultType === "Object" ? {} : []
1375
- );
1376
- } else if (genList[i].type === "table") {
1377
- this.$set(this.models, genList[i].model, this.models[genList[i].model] ?
1378
- this.models[genList[i].model] :
1379
- (typeof genList[i].options.defaultValue == "string" ? [] : genList[i].options
1380
- .defaultValue))
1381
- this.generateTableData(genList[i]); //生成tableModel
1382
- } else {
1383
- // console.log('TO-JSON==',JSON.stringify(this.models));
1384
- // console.log(genList[i].model);
1385
- let default_value = !this.dataObj.config.status || this.dataObj.config.status == 'XZ' ? genList[i].options.defaultValue : ''
1386
- if (String(default_value).startsWith('script:')) {
1387
- default_value = ''
1388
- }
1389
- default_value = default_value ? default_value :
1390
- '' // 避免默认值为null
1391
-
1392
- this.$set(this.models, genList[i].model, this.models[genList[i].model] ?
1393
- this.models[genList[i].model] : default_value
1394
- )
1395
- // this.models[genList[i].model] = this.models[genList[i].model] ?
1396
- // this.models[genList[i].model] :
1397
- // genList[i].options.defaultValue;
1398
- }
1399
- }
1400
- if (genList[i].type === "table") {
1401
- var tableRlues = {};
1402
- if (genList[i].columns.length > 0) {
1403
- genList[i].columns.forEach(item => {
1404
- if (item.rules) {
1405
- tableRlues[item.model] = [
1406
- ...item.rules.map(i => {
1407
- return {
1408
- ...i
1409
- };
1410
- })
1411
- ];
1412
- }
1413
- });
1414
- this.rules[genList[i].model] = tableRlues;
1415
- }
1416
- } else {
1417
- if (this.rules[genList[i].model]) {
1418
- if (genList[i].rules) {
1419
- this.$set(this.rules, genList[i].model, [
1420
- ...this.rules[genList[i].model],
1421
- ...genList[i].rules.map(item => {
1422
- return {
1423
- ...item
1424
- };
1425
- })
1426
- ]);
1427
- // this.rules[genList[i].model] = [
1428
- // ...this.rules[genList[i].model],
1429
- // ...genList[i].rules.map(item => {
1430
- // return {
1431
- // ...item
1432
- // };
1433
- // })
1434
- // ];
1435
- }
1436
- } else {
1437
- if (genList[i].rules) {
1438
- this.rules[genList[i].model] = [
1439
- ...genList[i].rules.map(item => {
1440
- return {
1441
- ...item
1442
- };
1443
- })
1444
- ];
1445
- }
1446
- }
1447
- }
1448
- }
1449
- }
1450
- this.$nextTick(() => {
1451
- this.$emit('formUpdated')
1452
- })
1453
- },
1454
- generateRules(widget, parentWidget) {
1455
- if (parentWidget && parentWidget.columns) {
1456
- if (!this.rules[parentWidget.model]) this.rules[parentWidget.model] = {}
1457
- this.rules[parentWidget.model][widget.model] = widget.rules;
1458
- this.rules = cloneDeep(this.rules)
1459
- return
1460
- }
1461
- this.$set(this.rules, widget.model, widget.rules)
1462
- this.rules = cloneDeep(this.rules)
1463
- },
1464
- validateTable() {
1465
-
1466
- // 查找所有的table 子表单的配置组件
1467
- const findTableComponent = (list = []) => {
1468
- return list.reduce((all, curr) => {
1469
- if (Array.isArray(curr)) {
1470
- return all.concat(findTableComponent(curr))
1471
- }
1472
- if (curr.type === 'table') return all.concat(curr)
1473
- return all
1474
- }, [])
1475
- }
1476
- // 判断子表单内组件有没有必填的校验
1477
- const tables = findTableComponent(this.dataObj.list).filter(table => {
1478
- if ([table.options.canView, !table.options.disabled].includes(false)) return
1479
- const { columns = [] } = table
1480
- for (let i = 0; i < columns.length; i++) {
1481
- const { rules = [] } = columns[i]
1482
- if (rules.some(rule => rule.required)) return true
1483
- if (columns[i].options?.minValue) return true
1484
- }
1485
- })
1486
- // 子表单有必填校验 判断有没有添加行, 没有添加行需要手动添加行, 让它触发校验
1487
- // tables.forEach(table => {
1488
- // if (!table.options.requiredAddDefaultRow) return
1489
- // const model = this.models[table.model]
1490
- // if ( !model || ( Array.isArray(model) && model.length === 0 )) {
1491
- // this.addToTableData(table, table.model, 'addModel')
1492
- // }
1493
- // })
1494
- },
1495
- /**
1496
- * @param {回调函数} fn 成功的回调函数
1497
- * */
1498
- async getData(fn) {
1499
- // 校验子表单
1500
- this.validateTable()
1501
-
1502
- if (this.verifyNode && this.models[this.verifyNode]) {
1503
- if (this.models[this.verifyNode].loadingSign) {
1504
- uni.showToast({
1505
- title: '签名图片获取中',
1506
- icon: 'none',
1507
- duration: 1500
1508
- })
1509
- fn('failed')
1510
- return Promise.reject('签名图片获取中')
1511
- }
1512
- }
1513
- await this.$nextTick()
1514
-
1515
- var promiseArr = [];
1516
- for (var i in this.$refs) {
1517
- if (this.$refs[i] instanceof Array || this.$refs[i].constructor === Array) {
1518
- this.$refs[i].forEach(item => {
1519
- const { canView, disabled } = item._props.widget.options
1520
- if (!canView || (disabled && !this.m_isCorrectAudit())) return
1521
- if (item.validateInit && typeof item.validateInit === "function") {
1522
- promiseArr.push(item.validateInit().then(res => {}).catch((error) => {
1523
- if (this.isScroll && error === false) {
1524
- this.isScroll = false;
1525
- console.log('校验错误')
1526
- uni.createSelectorQuery()
1527
- .in(this)
1528
- .select('.evan-form-show').boundingClientRect(data => {
1529
- console.log('校验', data.top)
1530
- item.scrollToTop(data.top)
1531
- }).exec()
1532
- }
1533
- throw new Error(error) //报错 为了阻塞promise 返回
1534
- }));
1535
-
1536
-
1537
- }
1538
- })
1539
- } else {
1540
- if (this.$refs[i].validateInit && typeof this.$refs[i].validateInit === "function") {
1541
- const { canView, disabled } = item._props.widget.options
1542
- if (!canView || disabled) return
1543
- promiseArr.push(this.$refs[i].validateInit().then(res => {}).catch((error) => {
1544
- if (this.isScroll && error === false) {
1545
- this.isScroll = false;
1546
- uni.createSelectorQuery()
1547
- .in(this)
1548
- .select('.evan-form-show').boundingClientRect(data => {
1549
- this.$refs[i].scrollToTop(data.top)
1550
- }).exec()
1551
-
1552
- }
1553
- throw new Error(error) //报错 为了阻塞promise 返回
1554
- }))
1555
- }
1556
- }
1557
- // console.log(promiseArr)
1558
- // 校验审核表单
1559
- promiseArr.push(new Promise((resolve, reject) => {
1560
- let item = this.models[this.verifyNode]
1561
- let widgets = this.dataObj.list.filter(obj => obj.model === this.verifyNode || (obj.type === 'hnkj-confirm' && ( !obj.options.disabled && obj.options.canView ))) || []
1562
-
1563
- widgets.forEach( (widget) => {
1564
- item = this.models[widget.model]
1565
- if (item && widget) {
1566
- let rules = {
1567
- comments: widget.type === 'hnkj-confirm' ? (widget.options.isConfirmComponent?[{ required: widget.options.confirmOpinionRequire, message: '请输入确认意见' }]:[ { required: widget.options.required , message: widget.options.placeholder }]) : [{ required: widget.options.opinionRequire, message: '请输入审批意见' }],
1568
- operation: widget.type === 'hnkj-confirm' ? [ { required: widget.options.required , message: `请选择${widget.options.operation}` }] : []
1569
- }
1570
- utils.validateField(item, rules , Object.keys(rules), (success, errors) => {
1571
- if (success) {
1572
- resolve()
1573
- } else {
1574
- reject(errors)
1575
- }
1576
- },{
1577
- showMessage: true
1578
- })
1579
- }
1580
- })
1581
- if (!widgets.length) {
1582
- resolve()
1583
- }
1584
-
1585
- }))
1586
- }
1587
- Promise.all(promiseArr).then((result) => {
1588
- console.log(result, promiseArr.length)
1589
- if (result.length === promiseArr.length) {
1590
- console.log('校验成功')
1591
- fn(this.models)
1592
- } else {
1593
- console.log('校验失败')
1594
- fn('failed')
1595
- } //['成功了', 'success']
1596
- }).catch((error) => {
1597
- fn('failed')
1598
- console.log(error)
1599
- })
1600
- // this.$refs.form.validate((res) => {
1601
- // if (res) {
1602
- // uni.showToast({
1603
- // title: '验证通过'
1604
- // })
1605
- // }
1606
- // })
1607
- },
1608
- saveForm2() {
1609
-
1610
- // this.$refs.form2.validate((res) => {
1611
- // if (res) {
1612
- // uni.showToast({
1613
- // title: '验证通过'
1614
- // })
1615
- // }
1616
- // })
1617
- },
1618
- utilsSave() {
1619
- utils.validate(this.info, this.rules, (res, errors) => {
1620
- if (res) {
1621
- uni.showToast({
1622
- title: '验证通过'
1623
- })
1624
- }
1625
- })
1626
- },
1627
- hideReqired() {
1628
- this.hideRequiredAsterisk = !this.hideRequiredAsterisk
1629
- },
1630
- },
1631
- destroyed() {
1632
- Pubsub.unsubscribe(this.updateWidget);
1633
- if(this.publish_linkage_array.length > 0){
1634
- this.publish_linkage_array.forEach(item=>{
1635
- Pubsub.unsubscribe(item);
1636
- })
1637
- this.publish_linkage_array = [];
1638
- }
1639
- },
1640
- }
1641
- </script>
1642
-
1643
- <style lang="scss">
1644
- @import "../../static/iconfont.css";
1645
- $mybottom: 0; //底部按钮
1646
-
1647
- /**审核组件样式**/
1648
- .verify {
1649
- font-size: 28upx;
1650
- }
1651
-
1652
- .verify-step {
1653
- height: 90upx;
1654
- line-height: 90upx;
1655
- padding-left: $uni-form-padding-left;
1656
- font-size: $uni-form-title-font-size;
1657
- }
1658
-
1659
- .verify-cot {
1660
- background-color: #fff;
1661
- padding: 20upx $uni-form-padding-left;
1662
- display: flex;
1663
- justify-content: space-between;
1664
- align-items: center;
1665
-
1666
- m-textarea, .textarea-wrapper {
1667
- display: block;
1668
- width: 100%;
1669
- height: 120rpx;
1670
- padding-top: 20rpx;
1671
- }
1672
-
1673
- >view {
1674
- height: 50upx;
1675
- line-height: 50upx;
1676
- }
1677
-
1678
- >view+view {
1679
- height: 70upx;
1680
- line-height: 70upx;
1681
- font-size: $uni-form-content-font-size;
1682
- }
1683
-
1684
- .verify-title {
1685
- // 一行
1686
- overflow: hidden;
1687
- margin-right: 10rpx;
1688
- text-overflow: ellipsis;
1689
- display: -webkit-box;
1690
- -webkit-line-clamp: 1;
1691
- -webkit-box-orient: vertical;
1692
- // font-weight: bold;
1693
- font-size: $uni-form-title-font-size;
1694
- }
1695
- }
1696
-
1697
- @include onepx('.verify-cot', 'bottom', 'after', #e6e6e6);
1698
-
1699
- .table-header {
1700
- min-height: 86upx;
1701
- line-height: 86upx;
1702
- padding: 0 30upx;
1703
- font-weight: bold;
1704
- font-size: $uni-form-title-font-size;
1705
- }
1706
-
1707
- .table-wrapper {
1708
- margin: 0 auto 20upx auto;
1709
- }
1710
-
1711
- .table-container {
1712
- background-color: #ffffff;
1713
- font-size: $uni-form-title-font-size;
1714
-
1715
- .view-port {}
1716
-
1717
- .add {
1718
- color: #539dfa;
1719
- text-align: center;
1720
- height: 90upx;
1721
- line-height: 90upx;
1722
- font-size: $uni-form-content-font-size;
1723
- }
1724
-
1725
- .item {
1726
- display: flex;
1727
- height: 90upx;
1728
- line-height: 90upx;
1729
- justify-content: space-around;
1730
-
1731
- >view {
1732
- line-height: 90upx;
1733
- color: #9b9b9b;
1734
- text-indent: 10%;
1735
- font-size: $uni-form-content-font-size;
1736
- flex: 1;
1737
- min-width: 130rpx;
1738
- }
1739
-
1740
- >view+view {
1741
- flex-shrink: 18;
1742
- }
1743
- }
1744
-
1745
- @include onepx('.item', 'bottom', 'after', #eeeeee);
1746
- }
1747
-
1748
- .evan-form-show {
1749
- padding-bottom: $mybottom;
1750
- // padding-bottom: $mybottom;
1751
- // padding: 0 30rpx;
1752
- background-color: #efefef;
1753
-
1754
- .form-input {
1755
- font-size: 28rpx;
1756
- color: #333;
1757
- //text-align: right;
1758
- width: 100%;
1759
- box-sizing: border-box;
1760
-
1761
- &.textarea {
1762
- height: 240rpx;
1763
- padding: 24rpx 0;
1764
- text-align: left;
1765
- }
1766
- }
1767
-
1768
- .form-input-placeholder {
1769
- font-size: $uni-form-content-font-size;
1770
- color: #999;
1771
- }
1772
-
1773
- &__button {
1774
- width: 100%;
1775
- height: 88rpx;
1776
- border-radius: 8rpx;
1777
- display: flex;
1778
- align-items: center;
1779
- justify-content: center;
1780
- padding: 0;
1781
- font-size: 36rpx;
1782
- color: #fff;
1783
- margin-top: 20rpx;
1784
- background-color: #2D87D5;
1785
-
1786
- &::before,
1787
- &::after {
1788
- border: none;
1789
- }
1790
- }
1791
-
1792
- .customize-form-item {
1793
- &__label {
1794
- font-size: 28rpx;
1795
- color: #333;
1796
- margin-bottom: 16rpx;
1797
- }
1798
-
1799
- &__radio {
1800
- display: flex;
1801
- align-items: center;
1802
- margin-bottom: 16rpx;
1803
-
1804
- &__text {
1805
- font-size: 28rpx;
1806
- color: #333;
1807
- }
1808
- }
1809
- }
1810
- }
1811
-
1812
- .fixed {
1813
- position: fixed;
1814
- z-index: 20;
1815
- border-top: 1upx solid #eee;
1816
- background-color: #539dfa;
1817
- height: $mybottom;
1818
- width: 100%;
1819
- left: 0;
1820
- bottom: 0;
1821
- font-size: 30upx;
1822
- color: #fff;
1823
- display: flex;
1824
- justify-content: center;
1825
- align-items: center;
1826
- }
1827
-
1828
- cover-view button {
1829
- letter-spacing: 20upx;
1830
- background-color: #539dfa;
1831
- font-size: 30upx;
1832
- color: #fff;
1833
- }
1834
-
1835
- cover-view button::after {
1836
- border: none;
1837
- }
1838
-
1839
-
1840
-
1841
-
1842
- .uni-input {
1843
- padding: 5rpx 0;
1844
- }
1845
- .form-input-suggest {
1846
- padding: 10rpx 22rpx;
1847
- background-color: #ecf5fc;
1848
- border-radius: 20rpx;
1849
- color: #348cd2;
1850
- margin-right: 20rpx;
1851
- }
1852
- </style>
1
+ <template>
2
+ <view class="evan-form-show" >
3
+ <evan-form :hide-required-asterisk="hideRequiredAsterisk" ref="Form" :dataObj="dataObj">
4
+ <template v-for="(item, index) in data.list">
5
+ <template v-if="item.type === 'table' && item.options.canView">
6
+ <view class="table-wrapper" :key="index">
7
+ <view class="table-header">
8
+ <text v-if="item.name" class="title-block"></text>
9
+ <text>{{ item.name }}</text>
10
+ </view>
11
+ <view class="table-container">
12
+ <template v-if="item.options.supportPage">
13
+ <view class="table-item" v-for="(table, tableCIndex) in currTablePageData(item)"
14
+ :key="tablePageIndex(item.model,tableCIndex)"
15
+ :index="tablePageIndex(item.model,tableCIndex)"
16
+ >
17
+ <view class="item" v-show="!item.options.hiddenOperateBtn">
18
+ <view class="index">{{table.index + 1}}</view>
19
+ <view class="delete icon-delete" v-if="!item.options.disabled&&!item.options.hiddenOperateBtn"
20
+ @click="handleDeleteRow(tablePageIndex(item.model,tableCIndex), item.model)">删除</view>
21
+ <view class="extend"
22
+ :class="{'icon-arrow-right': !tableRowsShow[item.model][tablePageIndex(item.model,tableCIndex)], 'icon-arrow-down':tableRowsShow[item.model][tablePageIndex(item.model,tableCIndex)]}"
23
+ @click="showTableRow(item.model, tablePageIndex(item.model,tableCIndex))">
24
+ {{tableRowsShow[item.model][tablePageIndex(item.model,tableCIndex)] ? '收起' : '展开'}}
25
+ </view>
26
+ </view>
27
+ <view class="view-port" v-show="tableRowsShow[item.model][tablePageIndex(item.model,tableCIndex)]" style="border-bottom: 1px solid #b2b2b2;">
28
+ <view v-for="(tableItem, tableItemIndex) in table.columns" :key="tableItemIndex" :class="'table-item-view' + (tableItemIndex % 3)">
29
+ <evan-form-item v-show="tableItem.options.canView"
30
+ :labelPosition="labelPosition"
31
+ @upDateWidget="data => upDateTableWidget(data, tableItemIndex, item.model, tablePageIndex(item.model,tableCIndex))" :itemkey="tableItemIndex"
32
+ :curLoadedPages="(tablePageInfo[item.model].current - 1) * tablePageInfo[item.model].pageSize + tablePageInfo[item.model].pageSize"
33
+ :parentTableKey="item.key" :tableKey="item.model" :tableIndex="tablePageIndex(item.model,tableCIndex)" :prop="tableItem.model"
34
+ :ref="String(Math.random()).split('.')[1]" :models.sync="models"
35
+ :rules="rules" :widget.sync="tableItem" :isDraft="isDraft" :formId="formId"
36
+ :linkage="linkage" :isApply="isApply" :applyId="applyId">
37
+ </evan-form-item>
38
+ </view>
39
+ </view>
40
+ </view>
41
+ <!-- #ifdef H5 -->
42
+ <page-pagination v-if="tablePageInfo[item.model]&&tablePageInfo[item.model].total" :total="tablePageInfo[item.model]&&tablePageInfo[item.model].total"
43
+ :currentPage="tablePageInfo[item.model]&&tablePageInfo[item.model].current"
44
+ @change="(...args) => tablePageChange(item,...args)"
45
+ :numAround="true" :showBorder="false"></page-pagination>
46
+ <!-- #endif -->
47
+ <!-- #ifdef MP-WEIXIN -->
48
+ <page-pagination v-if="tablePageInfo[item.model]&&tablePageInfo[item.model].total" :total="tablePageInfo[item.model]&&tablePageInfo[item.model].total"
49
+ :currentPage="tablePageInfo[item.model]&&tablePageInfo[item.model].current"
50
+ @change="tablePageChange(item, $event)"
51
+ :numAround="true" :showBorder="false"></page-pagination>
52
+ <!-- #endif -->
53
+ </template>
54
+ <template v-else>
55
+ <view class="table-item" v-for="(table, tableCIndex) in tableData[item.model]"
56
+ :key="tableCIndex">
57
+ <view class="item" v-show="!item.options.hiddenOperateBtn">
58
+ <view class="index">{{table.index + 1}}</view>
59
+ <view class="delete icon-delete" v-if="!item.options.disabled&&!item.options.hiddenOperateBtn"
60
+ @click="handleDeleteRow(tableCIndex, item.model)">删除</view>
61
+ <view class="extend"
62
+ :class="{'icon-arrow-right': !tableRowsShow[item.model][tableCIndex], 'icon-arrow-down':tableRowsShow[item.model][tableCIndex]}"
63
+ @click="showTableRow(item.model, tableCIndex)">
64
+ </view>
65
+ </view>
66
+ <view class="view-port" v-show="tableRowsShow[item.model][tableCIndex]" style="border-bottom: 1px solid #b2b2b2;">
67
+ <view v-for="(tableItem, tableItemIndex) in table.columns" :key="tableItemIndex" :class="'table-item-view' + (tableItemIndex % 3)">
68
+ <evan-form-item v-show="tableItem.options.canView"
69
+ :labelPosition="labelPosition"
70
+ @upDateWidget="data => upDateTableWidget(data, tableItemIndex, item.model, tableCIndex)" :itemkey="tableItemIndex"
71
+ :tableKey="item.model" :tableIndex="tableCIndex" :prop="tableItem.model"
72
+ :ref="String(Math.random()).split('.')[1]" :models.sync="models"
73
+ :rules="rules" :widget.sync="tableItem" :isDraft="isDraft" :formId="formId"
74
+ :linkage="linkage" :isApply="isApply" :applyId="applyId">
75
+ </evan-form-item>
76
+ </view>
77
+ </view>
78
+ </view>
79
+ </template>
80
+ <view class="add" v-if="isShowAdd && !item.options.disabled&&!item.options.hiddenOperateBtn" :data-data="item"
81
+ :data-model="item.model" data-add-model="addModel"
82
+ @click="addToTableData(item, item.model,'addModel')">+添加</view>
83
+ </view>
84
+ </view>
85
+ </template>
86
+
87
+ <view v-else-if="item.type === 'all-lay-out'" v-show="item.options.canView" class="form_layout">
88
+ <view v-for="(colItem, colIndex) in item.columns" :key="colIndex" class="form-item-container">
89
+ <view v-for="(col, itemIndex) in colItem.list" :key="itemIndex" v-show="col.options.canView">
90
+ <evan-form-item :isCorrect="isCorrect" :labelPosition="labelPosition" :prop="col.model"
91
+ :ref="String(Math.random()).split('.')[1]" :models.sync="models" :rules="rules"
92
+ :widget.sync="col" :isDraft="isDraft" :formId="formId" :linkage="linkage" :isApply="isApply" :applyId="applyId">
93
+ </evan-form-item>
94
+ </view>
95
+ </view>
96
+ </view>
97
+
98
+ <view v-else-if="item.type === 'grid-lay-out'" v-show="item.options.canView" class="form_layout">
99
+ <view v-for="(colItem, colIndex) in item.columns" :key="colIndex" class="form-item-container ">
100
+ <view v-for="(col, itemIndex) in colItem.list" :key="itemIndex" v-show="col.options.canView">
101
+ <template v-if="['hnkj-confirm', 'hnkj-verify'].includes(col.type) && item.options.canView">
102
+ <view class="verify">
103
+ <view class="verify-step">
104
+ <text v-if="col.name" class="title-block"></text>
105
+ <text>{{col.name }}</text>
106
+
107
+ </view>
108
+ <view class="verify-cot">
109
+ <m-textarea
110
+ :value="models[col.model].comments"
111
+ show-word-limit
112
+ :max-length="col.options.commentsLength"
113
+ :disabled="col.model !== verifyNode" :placeholder="col.options.placeholder"
114
+ @change="val => handlerText(val, col.model)">
115
+ </m-textarea>
116
+ </view>
117
+ <view v-if="col.model == verifyNode" class="verify-cot">
118
+ <view class="verify-title">{{col.options.operation}}</view>
119
+ <view id="suggestSelect" style="width:200rpx; flex-shrink: 0; text-align: right; font-size: 26rpx; color: #333; line-height: 60rpx;"
120
+ @click="openSuggestSelect(col)">
121
+ {{suggestType[col.model] || '请点击选择'}}
122
+ <text style="font-size: 24rpx; color: #999; margin-left: 4rpx;">▼</text>
123
+ </view>
124
+ </view>
125
+ <view v-if="col.model !== verifyNode" class="verify-cot">
126
+ <view class="verify-title">{{col.options.operation}}</view>
127
+ <view style="flex-shrink: 0">{{models[col.model].operation}}</view>
128
+ </view>
129
+ <view class="verify-cot">
130
+ <view class="verify-title">{{ col.options.operator }}</view>
131
+ <view style="flex-shrink: 0">{{ models[col.model].operator }}</view>
132
+ </view>
133
+ <view class="verify-cot">
134
+ <view class="verify-title">{{ col.options.operationTime }}</view>
135
+ <view style="flex-shrink: 0">{{ models[col.model].operationTime }}</view>
136
+ </view>
137
+ </view>
138
+ </template>
139
+ <template v-else>
140
+ <evan-form-item :isCorrect="isCorrect" :prop="col.model"
141
+ :labelPosition="labelPosition"
142
+ :ref="String(Math.random()).split('.')[1]" :models.sync="models" :rules="rules"
143
+ :widget.sync="col" :isDraft="isDraft" :formId="formId" :linkage="linkage" :isApply="isApply" :applyId="applyId">
144
+ </evan-form-item>
145
+ </template>
146
+ </view>
147
+ </view>
148
+ </view>
149
+
150
+ <view v-else-if="item.type === 'grid'" v-show="item.options.canView" class="form_layout">
151
+ <view class="form-item-container" v-for="(colItem, colIndex) in item.columns" :key="colIndex">
152
+ <view v-for="(col, itemIndex) in colItem.list" :key="itemIndex" v-show="col.options.canView">
153
+ <evan-form-item @upDateWidget="data => upDateGridWidget(data)" :isCorrect="isCorrect" :labelPosition="labelPosition" :prop="col.model"
154
+ :ref="String(Math.random()).split('.')[1]" :models.sync="models" :rules="rules"
155
+ :widget.sync="col" :isDraft="isDraft" :formId="formId" :linkage="linkage" :isApply="isApply" :applyId="applyId"
156
+ @changedate="changedate" :zbrqList="zbrqList" :thrqList="thrqList" :zjfmFormDesign="zjfmFormDesign" :thrqDataModalShow="thrqDataModalShow"
157
+ >
158
+ </evan-form-item>
159
+ </view>
160
+ </view>
161
+ </view>
162
+
163
+ <template v-else-if="['verify', 'hnkj-verify', 'hnkj-confirm'].includes(item.type)">
164
+
165
+ <view class="verify" v-if="item.options.canView">
166
+ <view class="verify-step">
167
+ <text v-if="item.name" class="title-block"></text>
168
+ <text>{{item.name }}</text>
169
+ </view>
170
+ <view v-if="item.options.supportMulti && (verifyLogs && verifyLogs[item.model])" >
171
+ <view v-for="(v_log, idx) in verifyLogsList(item.model)" :key="idx">
172
+ <view class="verify-cot">
173
+ <textarea :value="v_log.note" disabled>
174
+ </textarea>
175
+ </view>
176
+ <view class="verify-cot">
177
+ <view class="verify-title">{{item.options.operation}}</view>
178
+ <view style="flex-shrink: 0">{{v_log['shenpiYijian']}}</view>
179
+ </view>
180
+ <view class="verify-cot">
181
+ <view class="verify-title">{{item.options.operator}}</view>
182
+ <view style="flex-shrink: 0">{{v_log['realname']}}</view>
183
+ </view>
184
+ <view class="verify-cot">
185
+ <view class="verify-title">{{item.options.operationTime}}</view>
186
+ <view style="flex-shrink: 0">{{v_log['shenpiTime']}}</view>
187
+ </view>
188
+ </view>
189
+ </view>
190
+ <view class="verify-cot" :style="{position:item.model === verifyNode ? 'initial' : 'relative'}">
191
+ <m-textarea
192
+ v-if="models[item.model]"
193
+ :max-length="item.options.commentsLength"
194
+ show-word-limit
195
+ :value="models[item.model].comments"
196
+ :disabled="warpVerifyDisable(item)" :placeholder="item.options.placeholder"
197
+ @change="val => handlerText(val, item.model)">
198
+ </m-textarea>
199
+ <m-textarea
200
+ v-else
201
+ disabled
202
+ :placeholder="item.options.placeholder"
203
+ >
204
+ </m-textarea>
205
+ </view>
206
+ <!-- 盖章按钮 -->
207
+ <view v-if="item.model === verifyNode && sealCache[item.model] && !(models[item.model] && models[item.model].userSeal) && !warpVerifyDisable(item)"
208
+ class="verify-seal-btn" @tap="handleVerifySeal(item.model)">
209
+ 盖章
210
+ </view>
211
+ <!-- #ifdef HBSF-MODE -->
212
+ <view style="display: flex;align-items: center;background-color: #fff;padding: 20rpx 30rpx;" v-if="item.model === verifyNode">
213
+ <view style="color: #808080;">推荐审核意见:</view>
214
+ <view style="display: flex;justify-content: space-between;">
215
+ <view class="form-input-suggest" @click="models[item.model].comments = '同意'">同意</view>
216
+ <view class="form-input-suggest" @click="models[item.model].comments = '情况属实'">情况属实</view>
217
+ <view class="form-input-suggest" @click="models[item.model].comments = '确认审核'">确认审核</view>
218
+ </view>
219
+ </view>
220
+ <!-- #endif -->
221
+ <view v-if="!warpVerifyDisable(item)" class="verify-cot">
222
+ <view class="verify-title">{{item.options.operation}}</view>
223
+ <view id="suggestSelect" style="width:200rpx; flex-shrink: 0; text-align: right; font-size: 26rpx; color: #333; line-height: 60rpx;"
224
+ @click="openSuggestSelect(item)">
225
+ {{suggestType[item.model] || '请点击选择'}}
226
+ <text style="font-size: 24rpx; color: #999; margin-left: 4rpx;">▼</text>
227
+ </view>
228
+ </view>
229
+ <view v-if="warpVerifyDisable(item)" class="verify-cot">
230
+ <view class="verify-title">{{item.options.operation}}</view>
231
+ <view style="flex-shrink: 0" v-if="models[item.model]">{{models[item.model].operationShow || models[item.model].operation}}</view>
232
+ </view>
233
+ <view class="verify-cot">
234
+ <view class="verify-title">{{ item.options.operator }}</view>
235
+ <view style="flex-shrink: 0" v-if="models[item.model]">{{ models[item.model].operator }}</view>
236
+ </view>
237
+ <view class="verify-cot">
238
+ <view class="verify-title">{{ item.options.operationTime }}</view>
239
+ <view style="flex-shrink: 0" v-if="models[item.model]">{{ models[item.model].operationTime }}</view>
240
+ </view>
241
+ <!-- 当前审核盖章 -->
242
+ <view v-if="item.model === verifyNode && models[item.model] && models[item.model].userSeal" class="verify-seal">
243
+ <image :src="resolveSealUrl(models[item.model].userSeal)" mode="aspectFit" class="verify-seal__img"></image>
244
+ <view v-if="!warpVerifyDisable(item)" class="verify-seal__close" @tap.stop="handleVerifySealClose(item.model)">
245
+ <text class="verify-seal__close-text">x</text>
246
+ </view>
247
+ </view>
248
+ <!-- 回显盖章 -->
249
+ <view v-if="item.model !== verifyNode && models[item.model] && models[item.model].userSeal" class="verify-seal">
250
+ <image :src="resolveSealUrl(models[item.model].userSeal)" mode="aspectFit" class="verify-seal__img"></image>
251
+ </view>
252
+ </view>
253
+ </template>
254
+
255
+ <template v-else>
256
+ <view :key="index" class="form-item-container" v-show="item.options.canView" >
257
+
258
+ <evan-form-item @upDateWidget="data => upDateWidget(data, index)" :labelPosition="labelPosition" :isCorrect="isCorrect" :prop="item.model"
259
+ :ref="String(Math.random()).split('.')[1]" :models.sync="models" :rules="rules"
260
+ :widget.sync="item" :itemkey="index" :isDraft="isDraft" :formId="formId" :linkage="linkage" :formData="value"
261
+ :isApply="isApply" :applyId="applyId">
262
+ </evan-form-item>
263
+ </view>
264
+ </template>
265
+ <!-- {{ item.options.canView? 1 : 0 }}-->
266
+ </template>
267
+
268
+ </evan-form>
269
+ </view>
270
+ </template>
271
+
272
+ <script>
273
+ import utils from '../evan-form/utils.js'
274
+ import {
275
+ cloneObj
276
+ } from "../../utils/util.js";
277
+ import Pubsub from 'pubsub-js'
278
+ import evanFormItem from "../evan-form-item/evan-form-item";
279
+ import pagePagination from '../page-pagination/page-pagination';
280
+ import evanForm from "../evan-form/evan-form";
281
+ import mTextarea from "../m-textarea/m-textarea";
282
+ import packageJson from '../../package.json'
283
+ import { run } from "../../utils/formula_run"
284
+ import moment from "../../utils/moment"
285
+ import {intersection, isEqual, isEqualWith, reduce, cloneDeep} from "lodash";
286
+ import {getRecursionWidget, cacheHttp} from "../../utils/util";
287
+ console.log('zhxy-app-component: ', packageJson.version)
288
+ function timeout(ms) {
289
+ return new Promise(resolve => {
290
+ setTimeout(() => {
291
+ resolve()
292
+ }, ms)
293
+ })
294
+ }
295
+ export default {
296
+ options: { styleIsolation: 'shared' },
297
+ name: 'formContainer',
298
+ props: ['dataObj', 'value', 'isButton', 'verifyNode', 'verifyLogs', 'suggest', 'isCorrect', 'isDraft', 'formId', 'linkage', "labelPosition",
299
+ 'isApply','applyId'
300
+ ],
301
+ components: { evanFormItem ,evanForm, mTextarea, pagePagination, },
302
+ provide() {
303
+ return {
304
+ formContext: this,
305
+ dataObj: () => this.dataObj,
306
+ getFormData: () => this.value,
307
+ }
308
+ },
309
+ data() {
310
+ return {
311
+ timer: null,
312
+ showVerify: false, //默认不展示审核信息
313
+ selectShow: {
314
+
315
+ },
316
+ suggestType: {},
317
+ selectList: {},
318
+ models: {
319
+
320
+ }, //models
321
+ rules: {}, //校验规则1
322
+ // value: {}, //后台返回的表单值 (通常是父组件传值过来的)
323
+ tableData: {},
324
+ tableModel: {},
325
+ tableIndex: {},
326
+ tableFlag: {
327
+
328
+ },
329
+ data: {},
330
+ userSignature: null,
331
+ userSignaturePromise: null,
332
+ sealCache: {},
333
+ imgUrl: '',
334
+ // dataObj:dataObj,
335
+ isScroll: true,
336
+ tableRowsShow: {},
337
+ isShowAdd: true,
338
+ hideRequiredAsterisk: false,
339
+ sexes: [{
340
+ name: '男',
341
+ value: 'man'
342
+ },
343
+ {
344
+ name: '',
345
+ value: 'woman'
346
+ }
347
+ ],
348
+ // 表单的内容必须初始化
349
+ info: {
350
+ name: '',
351
+ table: [{
352
+ sub: '22'
353
+ },
354
+ {
355
+ sub: '333'
356
+ }
357
+ ]
358
+ },
359
+ info2: {
360
+ name: '222',
361
+ email: '7556@qq.com',
362
+ phone: '15232656598',
363
+ sub: '',
364
+ },
365
+ pickerIndex: 0,
366
+ zbrqList: null,
367
+ thrqList: null,
368
+ zjfmFormDesign: false,
369
+ thrqDataModalShow: '',
370
+ formDesignFlag: false,
371
+ unwatch:null,
372
+ publish_linkage_array:[],
373
+ tablePageInfo: {}
374
+ }
375
+ },
376
+ watch: {
377
+ // models(v) {
378
+ // // console.log('container models')
379
+ // // console.log(v)
380
+ // // console.log(this.models)
381
+ // this.isScroll = true;
382
+ // },
383
+ "dataObj.config"(val) {
384
+ if (val?.linkage_config) {
385
+ this.data.config = val
386
+ this.handleLinkAge()
387
+ }
388
+ },
389
+ verifyNode: {
390
+ handler(val) {
391
+ if (val) {
392
+ this.getUserSignature().then(res => {
393
+ if (res.success && res.result && res.result.userSeal) {
394
+ this.$set(this.sealCache, val, res.result.userSeal)
395
+ }
396
+ })
397
+ }
398
+ },
399
+ immediate: true
400
+ },
401
+ models: {
402
+ deep: true,
403
+ handler(v) {
404
+ this.isScroll = true;
405
+ if(v && !this.formDesignFlag) {
406
+ this.formDesignFlag = true
407
+ this.$u.get('sys/dict/getDictItems/zbb_th_app_id').then((res) => {
408
+ if (res.success) {
409
+ if(res.result && res.result.length > 0 && res.result[0].value == this.$Route.query.id) {
410
+ if(this.$Route.query.type && this.$Route.query.type === 'detail') {
411
+
412
+ } else {
413
+ this.$u.get('zhxyZbb/canOpenZbbThsq', {appId: this.$Route.query.id}).then((res) => {
414
+ if(!res.result) {
415
+ uni.showToast({
416
+ title: "当前无值班信息!",
417
+ duration: 2000,
418
+ icon: "none",
419
+ });
420
+ setTimeout(() => {
421
+ uni.navigateBack({
422
+ //uni.navigateTo跳转的返回,默认1为返回上一级
423
+ delta: 1,
424
+ });
425
+ }, 2000)
426
+ return
427
+ }
428
+ })
429
+ }
430
+
431
+ this.zjfmFormDesign = true
432
+ this.$u.post("zhxyZbb/zhxyZbbZbth", this.models).then((res) => {
433
+ if (res.success) {
434
+ this.zbrqList = res.result;
435
+ } else {
436
+ this.zbrqList = null
437
+ }
438
+ });
439
+ if(this.models.zbrq) {
440
+ this.getThrqList(this.models.zbrq, true)
441
+ }
442
+ if(this.models.thr) {
443
+ this.$u.post("zhxyZbb/zhxyZbbZbth", {value:this.models, model: 'thrq', applyId: this.$Route.query.applyId }).then((res) => {
444
+ if (res.success) {
445
+ // this.zbrqList = res.result
446
+ this.thrqDataModalShow = res.result.filter(item => item.gh == this.models.thr)[0].xm
447
+ } else {
448
+ this.thrqDataModalShow = ''
449
+ }
450
+ });
451
+ }
452
+ } else {
453
+ this.zjfmFormDesign = false
454
+ }
455
+ } else {
456
+ this.zjfmFormDesign = false
457
+ }
458
+ })
459
+ }
460
+ }
461
+ },
462
+ dataObj: {
463
+ handler(v) {
464
+ if (this._currObjId && this._currObjId !== this.dataObj._currObjId) return
465
+ this.data = v
466
+ if (this.dataObj && this.dataObj.list && this.dataObj.list.length > 0) {
467
+ this.data = v
468
+ this.dataObj._currObjId = this._currObjId = Math.random()
469
+ this.rules = {};
470
+ this.generateModle(this.data.list);
471
+ this.initFormLinkage();
472
+ this.updateFormDataToModels()
473
+ }
474
+ },
475
+ immediate: true
476
+ },
477
+ data: {
478
+ handler(val) {
479
+ this.dataObj = val
480
+ },
481
+ deep: true
482
+ },
483
+ value: {
484
+ handler(v) {
485
+ if (v) {
486
+ this.updateFormDataToModels()
487
+ }
488
+ },
489
+ immediate: true
490
+ },
491
+ suggest(v) {
492
+ this.$set(this.selectList, this.verifyNode, v);
493
+ this.$set(this.selectShow, this.verifyNode, false);
494
+ const item = this.dataObj.list.find(obj => obj.model === this.verifyNode)
495
+ if (item
496
+ && !this.models[this.verifyNode].operation
497
+ && item.options.operationChooseFirst) {
498
+ this.models[this.verifyNode].operation = this.suggest[0]
499
+ ? this.suggest[0].value
500
+ : "";
501
+ this.$set(this.suggestType, this.verifyNode, this.models[this.verifyNode].operation)
502
+ this.fillVerifySignSeal(item)
503
+ }
504
+ if (item
505
+ && !this.models[this.verifyNode].operation
506
+ && item.options.confirmOperationChooseFirst) {
507
+ this.models[this.verifyNode].operation = this.suggest[0]
508
+ ? this.suggest[0].value
509
+ : "";
510
+ this.$set(this.suggestType, this.verifyNode, this.models[this.verifyNode].operation)
511
+ this.fillVerifySignSeal(item)
512
+ }
513
+ },
514
+ tableData: {
515
+ handler(val) {
516
+ const keys = Object.keys(this.tableData)
517
+ keys.forEach(key => {
518
+ if (!this.tablePageInfo[key]) {
519
+ this.$set(this.tablePageInfo, key, {
520
+ current: 1,
521
+ pageSize: 10,
522
+ total: this.tableData[key].length
523
+ })
524
+ }
525
+ this.tablePageInfo[key].total = this.tableData[key].length
526
+ })
527
+ },
528
+ immediate: true,
529
+ deep: true
530
+ },
531
+ // linkage:{
532
+ // deep: true,
533
+ // handler(v){
534
+ // console.log(v,'12345675676575')
535
+ // },
536
+ // }
537
+ },
538
+ created() {
539
+ this.imgUrl = this.uniEnv?.imgUrl || this.$imgUrl || global?._CONFIG?.imgUrl || ''
540
+ this.updateWidget = Pubsub.subscribe("updateWidget",(key,data)=>{
541
+ const findKey = arr =>{
542
+ if(!arr || !arr.length){
543
+ return false;
544
+ }
545
+ let index = -1;
546
+ index = arr.findIndex(item=>item.model == data.model);
547
+ if(index > -1){
548
+ return true;
549
+ }else{
550
+ return false;
551
+ }
552
+ }
553
+ const changeWidget = arr =>{
554
+ return arr.map(item=>{
555
+ if(item.model == data.model){
556
+ return data;
557
+ }else{
558
+ return item;
559
+ }
560
+ })
561
+ }
562
+ if(findKey(this.data.list)){
563
+ this.data.list = changeWidget(this.data.list);
564
+ }else{
565
+ this.data.list.forEach(item=>{
566
+ if(item.columns){
567
+ if(findKey(item.columns)){
568
+ item.columns = changeWidget(item.columns);
569
+ }else{
570
+ item.columns.forEach(column=>{
571
+ if(findKey(column.list)){
572
+ column.list = changeWidget(column.list);
573
+ }
574
+ })
575
+ }
576
+ }
577
+ })
578
+ }
579
+ })
580
+ },
581
+ updated() {
582
+
583
+ },
584
+ mounted() {
585
+
586
+ // 回显关联组件
587
+ // setTimeout(() => {
588
+ // this.getchildren()
589
+ // }, 1000)
590
+ // console.log('thisdataObj', this.dataObj)
591
+ // this.generateModle(dataObj.list);
592
+ // if (this.dataObj && this.dataObj.list) {
593
+ // this.rules = {};
594
+ // this.generateModle(this.dataObj.list);
595
+ // }
596
+
597
+ // Pubsub.publish('randomObserve', this.models)
598
+ // console.log('models', this.models)
599
+ // console.log('tableData', this.tableData);
600
+ // console.log('tableModel', this.tableModel)
601
+ // console.log('tableIndex', this.tableIndex)
602
+ // 这里必须放在mounted中,不然h5,支付宝小程序等会找不到this.$refs.form
603
+ // console.log('rules', this.rules)
604
+ // this.$refs.form.setRules(this.rules);
605
+ // this.initPo();
606
+ },
607
+ methods: {
608
+ getUserSignature() {
609
+ if (!this.userSignaturePromise) {
610
+ this.userSignaturePromise = cacheHttp.get('workhall/userseal/queryById')
611
+ }
612
+ return this.userSignaturePromise
613
+ },
614
+ tablePageIndex(model,index){
615
+ return (this.tablePageInfo[model].current - 1) * this.tablePageInfo[model].pageSize + index
616
+ },
617
+ currTablePageData(item) {
618
+ // TODO 处理首次加载页面很多select需要请求远程字典问题(分页,只请求前十条)
619
+ const startPage = (this.tablePageInfo[item.model]?.current - 1)* this.tablePageInfo[item.model]?.pageSize
620
+ const endPage = (this.tablePageInfo[item.model]?.current - 1) * this.tablePageInfo[item.model]?.pageSize + this.tablePageInfo[item.model]?.pageSize
621
+ let pageData = this.tableData[item.model]?.slice(startPage, endPage)
622
+ return pageData
623
+ },
624
+ async tablePageChange(item, page) {
625
+ let pageSize=10;
626
+ await this.$nextTick()
627
+ if (this.tablePageInfo[item.model].pageSize !== pageSize) page = 1
628
+ this.tablePageInfo[item.model].pageSize = pageSize
629
+ await this.$nextTick()
630
+ this.tablePageInfo[item.model].current = page
631
+ await this.$nextTick()
632
+ },
633
+ // 表单联动部分组件并未放入evanFormItem,所以并未订阅相关事件,此方法将相关组件放入订阅模式
634
+ initFormLinkage() {
635
+ if(this.data?.list){
636
+ this.data.list.forEach(item=>{
637
+ if(['verify', 'hnkj-verify', 'hnkj-confirm'].includes(item.type)){
638
+ this.publish_linkage_array.push(Pubsub.subscribe('formLinkage_' + item.model, (key, data) => {
639
+ let onlyKey = key.replace("formLinkage_","");
640
+ if (data.type === 'show') {
641
+ this.data.list = this.data.list.map(l=>{
642
+ if(l.model == onlyKey){
643
+ this.$set(l.options,"canView",data.updateValue);
644
+ }
645
+ return l;
646
+ })
647
+ // this.widget.options.canView = data.updateValue
648
+ }
649
+ if(data.type === "update"){
650
+ if(typeof data.updateValue == "string" && data.updateValue == ""){
651
+ if(onlyKey.indexOf("hnkj_confirm")!=-1){
652
+ this.$set(this.suggestType,onlyKey,"");
653
+ this.models[onlyKey].comments = "";
654
+ this.models[onlyKey].operation = null;
655
+ }
656
+ }
657
+ }
658
+ }))
659
+ }
660
+ })
661
+ }
662
+ },
663
+ changedate(key,value) {
664
+ if(key == 'thrq') {
665
+ this.getThrqList(value)
666
+ } else {
667
+ this.thrqDataModalShow = ''
668
+ }
669
+ },
670
+ getThrqList(value, flag) {
671
+ this.models.zbrq = value
672
+ this.$u.post("zhxyZbb/zhxyZbbZbth", {value:this.models, model: 'zbrq' }).then((res) => {
673
+ if (res.success) {
674
+ this.thrqList = res.result;
675
+ if(!flag) this.models.zbxq = this.thrqList.zbxq
676
+ } else {
677
+ this.thrqList = null
678
+ if(!flag) this.models.zbrq = ''
679
+ if(this.$Route.query.type && this.$Route.query.type === 'detail') {
680
+
681
+ } else {
682
+ uni.showToast({
683
+ title: res.message,
684
+ duration: 2000,
685
+ icon: "none",
686
+ });
687
+ }
688
+
689
+ }
690
+ });
691
+ },
692
+ warpVerifyDisable(widget) {
693
+ if (widget.options.isConfirmComponent) return widget.options.disabled
694
+ return widget.model !== this.verifyNode
695
+ },
696
+ m_isCorrectAudit() {
697
+ return Number(this.isCorrect) === 1 && globalThis._CONFIG.JCTJBT
698
+ },
699
+ updateFormDataToModels() {
700
+ // 将formData 中未绑定表单key 的数据也复制到models
701
+ const modelsKeys = Object.keys(this.models)
702
+ Object.keys(this.value).forEach(key => {
703
+ if (!modelsKeys.includes(key)) {
704
+ this.models[key] = this.value[key]
705
+ }
706
+ })
707
+ },
708
+ verifyLogsList(model) {
709
+ const list = this.verifyLogs[model]
710
+ if (model !== this.verifyNode && list.length >= 1) return list.slice(0, list.length - 1)
711
+ return list
712
+ },
713
+ //回显关联组件的操作
714
+ getchildren() {
715
+ // console.log(this.$children[0])
716
+ // this.handlerelation(this.$children[0].$children)
717
+ },
718
+ // 更新所有组件的值
719
+ updateAllComponentValue() {
720
+ for(const key in this.$refs) {
721
+ this.$refs[key] && [].concat(this.$refs[key]).forEach(item => {
722
+ item.updateDataModel && item.updateDataModel()
723
+ item.showFormData && item.showFormData()
724
+ })
725
+ }
726
+ },
727
+ handlerelation(arr) {
728
+ for (let i = 0; i < arr.length; i++) {
729
+ const item = arr[i]
730
+ if (item.widget && item.widget.type == 'relateSub') {
731
+ if (item.tableKey) {
732
+ item.pulishMsg(
733
+ item.models[item.tableKey][item.tableIndex][item.widget.model],
734
+ true
735
+ )
736
+ } else {
737
+ item.pulishMsg(item.models[item.widget.model], true)
738
+ }
739
+ }
740
+ if (item.widget && item.widget.type == 'table') {
741
+ this.handlerelation(item.$children)
742
+ }
743
+ }
744
+ },
745
+ //更新widget 目前应用于关联组件隐藏 禁用
746
+ upDateWidget(widget, key) {
747
+ console.log(widget.options.canView)
748
+ this.dataObj.list.splice(key, 1, widget)
749
+ },
750
+ //更新widget 目前应用于子表单关联子组件隐藏 禁用
751
+ upDateTableWidget(widget, key, tableKey, tableIndex) {
752
+ this.tableData[tableKey][tableIndex].columns.splice(key, 1, widget)
753
+ },
754
+ //更新widget 目前应用于栅格布局关联子组件隐藏 禁用
755
+ upDateGridWidget(widget) {
756
+ this.data.list.forEach((item, index) => {
757
+ if(item.model == widget.parentModel) {
758
+ let obj = {}
759
+ obj = {...item}
760
+ let idx = obj.columns.findIndex(val => val.list[0].model == widget.model)
761
+ obj.columns[idx].list[0] = widget
762
+ this.$set(this.dataObj.list, index, obj)
763
+ }
764
+ })
765
+ },
766
+ // 打开操作类型选择
767
+ openSuggestSelect(item) {
768
+ const list = this.selectList[item.model] || this.suggest || [];
769
+ if (list.length === 0) return;
770
+ uni.showActionSheet({
771
+ itemList: list.map(opt => opt.label || opt.value),
772
+ success: (res) => {
773
+ this.selectConfirm([list[res.tapIndex]], item);
774
+ }
775
+ });
776
+ },
777
+ // 选择操作类型
778
+ selectConfirm(e, item) {
779
+ const { model, options, type } = item
780
+ let label = ''
781
+ e.map((val, index) => {
782
+ label = val.label;
783
+ this.$set(this.models[model], 'operation', label)
784
+ if (options.isConfirmComponent) {
785
+ this.$set(this.models[model], 'operation', val.value)
786
+ }
787
+ })
788
+ this.$set(this.suggestType, model, label)
789
+ this.fillVerifySignSeal(item)
790
+
791
+ },
792
+ fillVerifySignSeal(widget) {
793
+ const { model, options, type } = widget
794
+ if (options.isConfirmComponent) {
795
+ return this.getUserSignature().then(res => {
796
+ if (res.success) {
797
+ const { userSign } = res?.result || {}
798
+ if (userSign) {
799
+ this.models[model].userSign = userSign
800
+ }
801
+ }
802
+ }).finally(() => {
803
+ this.models[model].loadingSign = false
804
+ })
805
+ return
806
+ }
807
+ if (type === 'hnkj-verify') {
808
+ const select = this.selectList[widget.model].find(item => item.label === this.suggestType[model])
809
+ const { enableSign , enableSeal } = options
810
+ if (select.description === 'TIJIAO') {
811
+ this.models[model].loadingSign = true
812
+ this.getUserSignature().then(res => {
813
+ if (res.success) {
814
+ this.models[model].userSign = enableSign ? res.result.userSign : ''
815
+ if (res.result.userSeal) {
816
+ this.$set(this.sealCache, model, res.result.userSeal)
817
+ } else {
818
+ this.$set(this.sealCache, model, '')
819
+ }
820
+ }
821
+ }).finally(() => {
822
+ this.models[model].loadingSign = false
823
+ })
824
+ } else {
825
+ this.models[model].userSign = ''
826
+ this.models[model].userSeal = ''
827
+ this.$set(this.sealCache, model, '')
828
+ }
829
+ }
830
+ },
831
+ handleVerifySeal(model) {
832
+ const seal = this.sealCache[model]
833
+ if (!seal) return
834
+ this.$set(this.models[model], 'userSeal', seal)
835
+ this.$set(this.models[model], 'userSealPosition', { left: 519, top: 0, width: 120, height: 120 })
836
+ },
837
+ handleVerifySealClose(model) {
838
+ this.$set(this.models[model], 'userSeal', '')
839
+ this.$set(this.models[model], 'userSealPosition', null)
840
+ },
841
+ resolveSealUrl(src) {
842
+ if (!src) return ''
843
+ if (src.startsWith('data:image') || /^https?:\/\//i.test(src)) return src
844
+ return (this.imgUrl || '') + src
845
+ },
846
+ scrollToTop(top) {
847
+ const _this = this
848
+ this.$nextTick(function() {
849
+ uni.createSelectorQuery()
850
+ .in(_this)
851
+ .select('#suggestSelect').boundingClientRect(data => {
852
+ uni.pageScrollTo({
853
+ scrollTop: data.top - top,
854
+ duration: 200
855
+ });
856
+ }).exec()
857
+ })
858
+ },
859
+ //校验审核组件是否为空
860
+ /* checkVerify() {
861
+ if(this.suggestType == '') {
862
+ uni.showToast({
863
+ title: '审核操作不能为空',
864
+ duration: 1000,
865
+ icon: 'none'
866
+ });
867
+ this.scrollToTop()
868
+ }
869
+ }, */
870
+ bindPickerChange(e, model) {
871
+ // console.log('picker发送选择改变,携带值为', e.target.value)
872
+ // console.log(this.suggest)
873
+ this.pickerIndex = e.target.value
874
+ // this.models[model].operation = e.target.value
875
+ this.models[model].operation = this.suggest[e.target.value].value;
876
+ console.log(this.models)
877
+ },
878
+ handlerText(value, model) {
879
+ this.models[model].comments = value
880
+ },
881
+ /***单选修改赋值***/
882
+ selectorOption(picked, model) {
883
+ console.log(picked);
884
+ console.log(model)
885
+ this.models[model].operation = picked.value
886
+ },
887
+ /***option 数据重构**/
888
+ selectDataTransForm(data) {
889
+
890
+ if (!data || (data.length == 0)) {
891
+ return []
892
+ } else {
893
+ return data.map(item => {
894
+ // return {
895
+ // label: item.value,
896
+ // value: item.label
897
+ // }
898
+ return item.value
899
+ })
900
+ }
901
+ },
902
+ /**展开 收起 子表单列**/
903
+ showTableRow(model, index) {
904
+ // uni.createSelectorQuery()
905
+ // .in(this)
906
+ // .select('.table-header').boundingClientRect(data => {
907
+ // console.log("得到布局位置信息" + JSON.stringify(data));
908
+ // console.log("节点离页面顶部的距离为" + data.top);
909
+ // uni.pageScrollTo({
910
+ // scrollTop: data.top,
911
+ // duration: 800
912
+ // });
913
+ // }).exec()
914
+ // this.$set(this.tableFlag,'flag',[true])
915
+ // this.tableFlag.flag = [true];
916
+ // this.tableRowsShow[model][index] = !this.tableRowsShow[model][index];
917
+ this.$set(this.tableRowsShow[model], index, !this.tableRowsShow[model][index]);
918
+ /***解决小程序不能深度监听***/
919
+ var tempObj = cloneObj(this.tableRowsShow)
920
+ // console.log(this.tableRowsShow[model][index],index)
921
+
922
+ // console.log(this.tableRowsShow[model][index])
923
+ },
924
+ //删除子表单row
925
+ handleDeleteRow(index, model) {
926
+ console.log('删除子表单row',index, model)
927
+ // //更新tableData
928
+ //更新models
929
+ this.models[model].splice(index, 1);
930
+ this.tableData[model].splice(index, 1);
931
+ this.tableRowsShow[model].splice(index, 1);
932
+ let _index = 0;
933
+ this.tableData[model].forEach(item => {
934
+ item.index = _index++;
935
+ });
936
+ this.tableIndex[model]--;
937
+ },
938
+ //添加子表单里面的row
939
+ addToTableData(data, model, addModel) {
940
+ let dataTemp = JSON.parse(JSON.stringify(data));
941
+ this.tableIndex[model] === undefined ?
942
+ this.$set(this.tableIndex, model, 0) :
943
+ null;
944
+ dataTemp.index = this.tableIndex[model];
945
+ /***table row show start*/
946
+ this.tableRowsShow[model] === undefined ?
947
+ this.$set(this.tableRowsShow, model, []) :
948
+ null;
949
+ this.$set(this.tableRowsShow[model], this.tableIndex[model], true)
950
+ /***table row show end*/
951
+ this.tableIndex[model]++;
952
+ this.tableData[model] === undefined ?
953
+ this.$set(this.tableData, model, []) :
954
+ null;
955
+ if (addModel) {
956
+ let addModelObject = {};
957
+ dataTemp.columns.forEach(item => {
958
+ item.options.isCorrect = false;
959
+ let defaultValue = item.options.defaultValue
960
+ if (String(defaultValue).startsWith('script:')) {
961
+ defaultValue = ''
962
+ }
963
+ addModelObject[item.model] = item.defaultValue ?
964
+ item.defaultValue :
965
+ defaultValue;
966
+ });
967
+ if(!this.models[model]) this.models[model] = []
968
+ this.models[model].push(addModelObject);
969
+ dataTemp.options.isCorrect = false;
970
+ } else {
971
+ dataTemp.options.isCorrect = true;
972
+ }
973
+ this.tableData[model].push(dataTemp);
974
+ // console.log(this.tableData[model])
975
+ },
976
+ //tableData init
977
+ generateTableData(gen) {
978
+ // console.log('JSON.models',JSON.stringify(this.models))
979
+ // this.tableData = {};
980
+ // this.tableIndex = {};
981
+ this.isShowAdd = true;
982
+ if (gen.type === "table") {
983
+ var tableModel = gen.model;
984
+ if (this.tableData[tableModel] instanceof Array) {
985
+ this.tableData[tableModel].length = 0;
986
+ this.tableIndex[tableModel] = 0;
987
+ }
988
+ this.tableModel[tableModel] = gen;
989
+ this.tableModel[tableModel]["options"]["defaultValue"] = this.models[
990
+ gen.model
991
+ ];
992
+ this.tableInitByModel(tableModel);
993
+ if (gen.options.defaultAddRow && !gen.options.disabled && (!this.models[gen.model] || (Array.isArray(this.models[gen.model]) && this.models[gen.model].length === 0))) {
994
+ this.addToTableData(gen, gen.model, 'addModel')
995
+ }
996
+ }
997
+ },
998
+ tableInitByModel(model) {
999
+ if (
1000
+ this.models[model] &&
1001
+ this.models[model] instanceof Array &&
1002
+ this.models[model].length > 0
1003
+ ) {
1004
+ console.log('--',this.tableModel[model], model)
1005
+ this.models[model].forEach(async(item, index) => {
1006
+ this.originIndex++;
1007
+ await timeout(0)
1008
+ this.addToTableData(this.tableModel[model], model);
1009
+ });
1010
+ }
1011
+ // console.log('tableData',this.tableData)
1012
+ // console.log(this.models)
1013
+ },
1014
+ async or(...args) {
1015
+ for (const argsKey in args) {
1016
+ if (await args[argsKey]) return true
1017
+ }
1018
+ return false
1019
+ },
1020
+ async and(...args) {
1021
+ for (const argsKey in args) {
1022
+ if (!await args[argsKey]) return false
1023
+ }
1024
+ return true
1025
+ },
1026
+ async handleLinkAge() {
1027
+ // console.log(this.data.config.linkage_config)
1028
+ const that = this
1029
+ if (!this.data?.config?.linkage_config) return
1030
+ if (this.formFunctions) return
1031
+ this.formFunctions = {
1032
+ async call_func(list, models) {
1033
+ const widgetList = getRecursionWidget(that.data.list)
1034
+ const linkageWidget = widgetList.filter(item => list.map(item => item.model).includes(item.model))
1035
+ return list.map(item => this[item.type](models[item.model] ,item.value, linkageWidget.find(widget => widget.model === item.model)))
1036
+ },
1037
+ all_same(currVal, targetVal, widget) {
1038
+ if (Array.isArray(currVal) && Array.isArray(targetVal)) {
1039
+ return intersection(targetVal, currVal).length === targetVal.length
1040
+ }
1041
+ return false
1042
+ },
1043
+ same(currVal, targetVal, widget) {
1044
+ console.log(widget)
1045
+ const { format } = widget.options
1046
+
1047
+ if (widget.type === 'date') {
1048
+ return moment(currVal).format(format) === moment(targetVal).format(format)
1049
+ }
1050
+ if (Array.isArray(currVal)) {
1051
+ if (Array.isArray(targetVal)) {
1052
+ if (currVal.length !== targetVal.length) return false
1053
+ return isEqual(currVal.sort(), targetVal.sort()) || isEqualWith(currVal.sort(), targetVal.sort(), (a, b) => { if (!a.id) return false; return a.id === b.id})
1054
+ }
1055
+ }
1056
+ return currVal == targetVal
1057
+ },
1058
+ not_same(currVal, targetVal, widget) {
1059
+ const { format } = widget.options
1060
+ if (widget.type === 'date') {
1061
+ return moment(currVal).format(format) === moment(targetVal).format(format)
1062
+ }
1063
+ if (Array.isArray(currVal)) {
1064
+ return currVal.every(item => {
1065
+ return targetVal == item?.id || targetVal == item
1066
+ })
1067
+ }
1068
+ return currVal != targetVal
1069
+ },
1070
+ gt(currVal, targetVal, widget) {
1071
+ const { format } = widget.options
1072
+ if (widget.type === 'date') {
1073
+ return moment(currVal).isAfter(moment(targetVal))
1074
+ }
1075
+ return currVal > targetVal
1076
+ },
1077
+ gte(currVal, targetVal, widget) {
1078
+ const { format } = widget.options
1079
+ if (widget.type === 'date') {
1080
+ return moment(currVal).isSameOrAfter(moment(targetVal))
1081
+ }
1082
+ return currVal >= targetVal
1083
+ },
1084
+ lt(currVal, targetVal, widget) {
1085
+ if (widget.type === 'date') {
1086
+ return moment(currVal).isBefore(moment(targetVal))
1087
+ }
1088
+ return currVal < targetVal
1089
+ },
1090
+ lte(currVal, targetVal, widget) {
1091
+ const { format } = widget.options
1092
+ if (widget.type === 'date') {
1093
+ return moment(currVal).isSameOrBefore(moment(targetVal))
1094
+ }
1095
+ return currVal <= targetVal
1096
+ },
1097
+ same_some(currVal, targetVal, widget) {
1098
+ if (Array.isArray(targetVal) && targetVal.includes('[未填写]')) {
1099
+ targetVal = targetVal.concat(undefined, null, '')
1100
+ }
1101
+ if (Array.isArray(currVal) && !currVal.length) currVal = undefined
1102
+
1103
+ return [].concat(currVal).some(item => targetVal.includes(item))
1104
+ // return targetVal.includes(currVal)
1105
+ },
1106
+ not_same_some(currVal, targetVal, widget) {
1107
+ if (Array.isArray(targetVal) && targetVal.includes('[未填写]')) {
1108
+ targetVal = targetVal.concat(undefined, null, '')
1109
+ }
1110
+ if (Array.isArray(currVal) && !currVal.length) currVal = undefined
1111
+ return [].concat(currVal).some(item => !targetVal.includes(item))
1112
+ // return !targetVal.includes(currVal)
1113
+ },
1114
+ EMPTY(currVal, targetVal, widget) {
1115
+ if (Array.isArray(currVal)) return !currVal.length
1116
+ return !currVal
1117
+ },
1118
+ NOT_EMPTY(currVal, targetVal, widget) {
1119
+ if (Array.isArray(currVal)) return !!currVal.length
1120
+ return !!currVal
1121
+ },
1122
+ async include(currVal, targetVal, widget) {
1123
+ if ([undefined, null, ''].includes(currVal)) return false
1124
+ if (['checkbox', 'select', 'radio'].includes(widget.type) && global.dictData[widget.model] == null || Array.isArray(global.dictData[widget.model])) {
1125
+ for (let i = 0; i < 10; i++) {
1126
+ if (Array.isArray(global.dictData[widget.model])) {
1127
+ return global.dictData[widget.model].filter(item => item.value == currVal)?.some( item => item.text.includes(targetVal || undefined) || item.value.includes(targetVal || undefined))
1128
+ }
1129
+ await timeout(300)
1130
+ }
1131
+ }
1132
+ return currVal.includes(targetVal || undefined)
1133
+ },
1134
+ async not_include(currVal, targetVal, widget) {
1135
+ return !(await this.include(currVal, targetVal, widget))
1136
+ },
1137
+ }
1138
+ this.formFunctions._init = true
1139
+ await this.$nextTick()
1140
+ this.initLinkAge();
1141
+ },
1142
+ initLinkAge(){
1143
+ if(this.unwatch){
1144
+ this.unwatch();
1145
+ }
1146
+ this.unwatch = this.$watch('models', async (newVal, oldVal) => {
1147
+ await timeout(0)
1148
+ let diffModels = reduce(newVal, function(result, value, key) {
1149
+ return isEqual(value, oldVal?.[key]) ?
1150
+ result : result.concat(key);
1151
+ }, []);
1152
+ if (!diffModels?.length && (this.formFunctions._init && newVal && oldVal)) {
1153
+ diffModels = Object.keys(newVal)
1154
+ this.formFunctions._init = false
1155
+ }
1156
+ // const differenceObj = difference(cloneDeep(newVal), cloneDeep(oldVal))
1157
+ console.log('diffModels', diffModels)
1158
+ const widgetList = getRecursionWidget(this.data?.list)
1159
+ this.data?.config?.linkage_config?.forEach(item => {
1160
+ let { toTypeSelect, toWidgetList, typeSelect, list, updateValue, hideClearValue, forceClearValue } = item
1161
+ // 表单详情会导致可编辑
1162
+ if (['update', 'disabled'].includes(toTypeSelect) && this.$route?.query?.type === 'detail') return
1163
+ toWidgetList.forEach(async toWidgetModel => {
1164
+ const widget = widgetList.find(item => item.model === toWidgetModel)
1165
+ const changeModelList = list.some(item => diffModels.includes(item.model)) ? list : []
1166
+ if (changeModelList.length === 0) return
1167
+
1168
+ const flag = await this[typeSelect].apply(this, await this.formFunctions.call_func(changeModelList, newVal))
1169
+ switch (toTypeSelect) {
1170
+ case 'show':
1171
+ if (widget.parentType === 'table') {
1172
+ this.$set(widget.options, 'canView', flag)
1173
+ }
1174
+ Pubsub.publish('formLinkage_' + widget.model, {
1175
+ type: 'show',
1176
+ updateValue: flag,
1177
+ })
1178
+ if (!flag && hideClearValue) {
1179
+ /**跳过公文和编号字段的隐藏清空功能 */
1180
+ if(!["editorAirt","codeControl"].includes(widget.type)){
1181
+ Pubsub.publish('formLinkage_' + widget.model, {
1182
+ type: 'update',
1183
+ updateValue: '',
1184
+ })
1185
+ }
1186
+ setTimeout(() => {
1187
+ const isAllFlag = widgetList.filter(item => item.parentModel === widget.parentModel).every( item => item.options.canView === flag)
1188
+ if (!flag && isAllFlag) {
1189
+ // 删除所有行
1190
+ this.tableData = [];
1191
+ this.$set(this.tableIndex,widget.parentModel,0);
1192
+ this.$set(this.models,widget.parentModel,[]);
1193
+ }
1194
+ }, 100)
1195
+ }
1196
+ // this.$set(widget.options, 'canView', flag)
1197
+ // this.data.list = cloneDeep(this.data.list)
1198
+ break
1199
+ case 'required':
1200
+ let rules = this.rules
1201
+ if (widget.parentType === 'table') {
1202
+ if (!rules[widget.parentModel]) rules[widget.parentModel] = {}
1203
+ rules = rules[widget.parentModel]
1204
+ }
1205
+ if (!rules[widget.model]) rules[widget.model] = []
1206
+ const hasRequiredConfig = rules[widget.model].some(item => {
1207
+ if (item?.required !== undefined) {
1208
+ item.required = flag
1209
+ return true
1210
+ }
1211
+ return false
1212
+ })
1213
+ if (!hasRequiredConfig) {
1214
+ if(flag){
1215
+ /**当需要必填时,再推入校验数组 */
1216
+ rules[widget.model].push( {
1217
+ required: flag,
1218
+ trigger: 'change',
1219
+ message: `${(widget.name || "").replaceAll(' ', '')}必须填写`,
1220
+ })
1221
+ }
1222
+ }
1223
+ this.$set(widget.options, 'required', flag)
1224
+
1225
+ !flag && this.$refs.Form.clearValidate(widget.model)
1226
+
1227
+ this.$set(widget, 'rules', rules[widget.model])
1228
+ this.generateRules(widget, this.data?.list?.find(item => item.model === widget.parentModel))
1229
+ break
1230
+ case 'update':
1231
+ updateValue = String(updateValue)
1232
+ if (isNaN(updateValue)) {
1233
+ try {
1234
+ updateValue = JSON.parse(updateValue)
1235
+ } catch (e) {
1236
+
1237
+ }
1238
+ }
1239
+ if (widget.type === 'rate' || widget.type === "number") updateValue = !isNaN(updateValue) ? Number(updateValue) : updateValue
1240
+ // if (['responsibility', 'switch'].includes(widget.type)) updateValue = Boolean(updateValue) || updateValue === 'true'
1241
+ if (widget.parentType === 'table') {
1242
+ if (!Array.isArray(this.models[widget.parentModel])) this.models[widget.parentModel] = []
1243
+ return this.models[widget.parentModel]?.forEach((item,idx) => {
1244
+ this.models[widget.parentModel][idx][widget.model] = flag ? updateValue : ''
1245
+ })
1246
+ }
1247
+ // 不符合时, 如果 未勾选 “不符合时清除值”, 就不用清理
1248
+ if (!flag && !forceClearValue) break
1249
+ Pubsub.publish('formLinkage_' + widget.model, {
1250
+ type: 'update',
1251
+ updateValue: flag ? updateValue : '',
1252
+ })
1253
+ // setTimeout(() => {
1254
+ // this.$set(this.models, widget.model, flag ? updateValue : undefined)
1255
+ // // this.models[widget.model] = flag ? updateValue : ''
1256
+ // }, 1000)
1257
+ break
1258
+ case 'disabled':
1259
+ this.$set(widget.options, 'disabled', flag)
1260
+ break
1261
+ }
1262
+ // 当子表单内容column元素都隐藏时,隐藏整个子表单项
1263
+ this.data.list = this.data.list.map(item=>{
1264
+ if(item.type == "table"){
1265
+ const sum = item.columns.reduce((pre,current)=>{
1266
+ if(!current.options.canView){
1267
+ pre++;
1268
+ }
1269
+ return pre;
1270
+ },0)
1271
+ if(sum == item.columns.length){
1272
+ this.$set(item.options,"canView",false);
1273
+ }else{
1274
+ this.$set(item.options,"canView",true);
1275
+ }
1276
+ }
1277
+ return item;
1278
+ })
1279
+ })
1280
+
1281
+ })
1282
+ },
1283
+ {
1284
+ immediate: true,
1285
+ deep: true
1286
+ })
1287
+ },
1288
+ /***初始化models***/
1289
+ async generateModle(genList) {
1290
+ if (!genList || genList.length === 0) return;
1291
+ this.handleLinkAge()
1292
+ for (let i = 0; i < genList.length; i++) {
1293
+ if (["grid", 'grid-lay-out', 'all-lay-out', 'table'].includes(genList[i].type)) {
1294
+ let subscribeKey = genList[i].options.subscribeOptions ?
1295
+ genList[i].options.subscribeOptions.subscribeKey :
1296
+ '';
1297
+ Pubsub.subscribe(subscribeKey, (msg, data) => {
1298
+ console.log('layout 接受消息', data);
1299
+ const widget = genList[i]
1300
+ const list = data.msg
1301
+ const that = this
1302
+
1303
+ that.isWx = true
1304
+ let global = globalThis
1305
+ // #ifdef H5
1306
+ let operateValue = data.operateValue
1307
+ if(data.operateValue.includes('this.$http')) {
1308
+ operateValue = operateValue.replace(/this\.\$http/g, "this.$u")
1309
+ }
1310
+ eval(operateValue)
1311
+ return
1312
+ // #endif
1313
+ let operateValueWx = data.operateValue
1314
+ if(operateValueWx.includes('this.$http')) {
1315
+ operateValueWx = operateValueWx.replace(/this\.\$http/g, "that.$u")
1316
+ }
1317
+ console.log(run(operateValueWx, {
1318
+ that: this,
1319
+ widget,
1320
+ global: globalThis,
1321
+ list,
1322
+ isWx: true,
1323
+ uni
1324
+ }))
1325
+ });
1326
+
1327
+ }
1328
+ if (["grid", 'grid-lay-out', 'all-lay-out'].includes(genList[i].type)) {
1329
+ genList[i].columns.forEach(item => {
1330
+ this.generateModle(item.list);
1331
+ });
1332
+ } else {
1333
+
1334
+ if (
1335
+ this.value &&
1336
+ Object.keys(this.value).indexOf(genList[i].model) >= 0
1337
+ ) {
1338
+ this.models[genList[i].model] = cloneObj(
1339
+ this.value[genList[i].model]
1340
+ );
1341
+
1342
+ console.log(genList[i].type)
1343
+
1344
+ /**审核**/
1345
+ if (["verify", "hnkj-verify"].includes(genList[i].type)) {
1346
+ this.models[genList[i].model] = this.value[genList[i].model];
1347
+ }
1348
+
1349
+ if (genList[i].type === "table") {
1350
+ this.generateTableData(genList[i]); //生成tableModel
1351
+ //设置rules
1352
+ }
1353
+ if (genList[i].type === "hnkj-confirm") {
1354
+ this.$set(this.selectShow, genList[i].model, false)
1355
+ const dictName = genList[i].options.dictName
1356
+ if(typeof this.models[genList[i].model] == "string" && this.models[genList[i].model] == ""){
1357
+ this.models[genList[i].model] = {};
1358
+ }
1359
+ this.$set(this.models[genList[i].model], 'dictName',dictName )
1360
+ if (dictName) cacheHttp.get(`/sys/dict/getDictItems/${dictName}`).then(res => {
1361
+ if (res.success) {
1362
+ this.$set(this.selectList, genList[i].model, res.result?.map(item => ({
1363
+ label: item.title,
1364
+ value: item.value,
1365
+ description: item.value
1366
+ })))
1367
+ const operation = this.models[genList[i].model].operation
1368
+ const label = this.selectList[genList[i].model].find(item => item.value === operation)?.label
1369
+ this.$set(this.models[genList[i].model], 'operationShow',label )
1370
+ this.$set(this.suggestType, genList[i].model, label)
1371
+ }
1372
+ })
1373
+ }
1374
+ } else {
1375
+
1376
+ /**审核**/
1377
+ if (["verify", "hnkj-verify"].includes(genList[i].type)) {
1378
+ this.models[genList[i].model] = genList[i].operationColumns;
1379
+ } else if (genList[i].type === "hnkj-confirm") {
1380
+ this.$set(this.selectShow, genList[i].model, false)
1381
+ if (genList[i].options.isConfirmComponent && !this.warpVerifyDisable(genList[i])) {
1382
+ const dictName = genList[i].options.dictName
1383
+ if (dictName) var res = await cacheHttp.get( `/sys/dict/getDictItems/${dictName}`)
1384
+ if (res.success) {
1385
+ this.$set(this.selectList ,genList[i].model, res.result?.map(item => ({ label: item.title, value: item.value, description: item.value})))
1386
+ }
1387
+ const userInfo = uni.getStorageSync('userinfo')
1388
+ this.$set(
1389
+ this.models,
1390
+ genList[i].model,
1391
+ {
1392
+ comments: '',
1393
+ operation: '',
1394
+ dictName,
1395
+ operator: userInfo.realname || userInfo.username,
1396
+ operationTime: moment().format('YYYY-MM-DD HH:mm:ss'),
1397
+ userSign: ''
1398
+ }
1399
+ )
1400
+ // 确认组件==确认操作默认选中第一项
1401
+ if (genList[i]
1402
+ && !this.models[genList[i].model].operation
1403
+ && genList[i].options.confirmOperationChooseFirst) {
1404
+ this.models[genList[i].model].operation = this.selectList[genList[i].model][0]
1405
+ ? this.selectList[genList[i].model][0].value
1406
+ : "";
1407
+ this.$set(this.suggestType, genList[i].model, this.models[genList[i].model].operation)
1408
+ this.fillVerifySignSeal(genList[i])
1409
+ }
1410
+ }
1411
+ } else if (genList[i].type === "blank") {
1412
+ this.$set(
1413
+ this.models,
1414
+ genList[i].model,
1415
+ genList[i].options.defaultType === "String" ?
1416
+ "" :
1417
+ genList[i].options.defaultType === "Object" ? {} : []
1418
+ );
1419
+ } else if (genList[i].type === "table") {
1420
+ this.$set(this.models, genList[i].model, this.models[genList[i].model] ?
1421
+ this.models[genList[i].model] :
1422
+ (typeof genList[i].options.defaultValue == "string" ? [] : genList[i].options
1423
+ .defaultValue))
1424
+ this.generateTableData(genList[i]); //生成tableModel
1425
+ } else {
1426
+ // console.log('TO-JSON==',JSON.stringify(this.models));
1427
+ // console.log(genList[i].model);
1428
+ let default_value = !this.dataObj.config.status || this.dataObj.config.status == 'XZ' ? genList[i].options.defaultValue : ''
1429
+ if (String(default_value).startsWith('script:')) {
1430
+ default_value = ''
1431
+ }
1432
+ default_value = default_value ? default_value :
1433
+ '' // 避免默认值为null
1434
+
1435
+ this.$set(this.models, genList[i].model, this.models[genList[i].model] ?
1436
+ this.models[genList[i].model] : default_value
1437
+ )
1438
+ // this.models[genList[i].model] = this.models[genList[i].model] ?
1439
+ // this.models[genList[i].model] :
1440
+ // genList[i].options.defaultValue;
1441
+ }
1442
+ }
1443
+ if (genList[i].type === "table") {
1444
+ var tableRlues = {};
1445
+ if (genList[i].columns.length > 0) {
1446
+ genList[i].columns.forEach(item => {
1447
+ if (item.rules) {
1448
+ tableRlues[item.model] = [
1449
+ ...item.rules.map(i => {
1450
+ return {
1451
+ ...i
1452
+ };
1453
+ })
1454
+ ];
1455
+ }
1456
+ });
1457
+ this.rules[genList[i].model] = tableRlues;
1458
+ }
1459
+ } else {
1460
+ if (this.rules[genList[i].model]) {
1461
+ if (genList[i].rules) {
1462
+ this.$set(this.rules, genList[i].model, [
1463
+ ...this.rules[genList[i].model],
1464
+ ...genList[i].rules.map(item => {
1465
+ return {
1466
+ ...item
1467
+ };
1468
+ })
1469
+ ]);
1470
+ // this.rules[genList[i].model] = [
1471
+ // ...this.rules[genList[i].model],
1472
+ // ...genList[i].rules.map(item => {
1473
+ // return {
1474
+ // ...item
1475
+ // };
1476
+ // })
1477
+ // ];
1478
+ }
1479
+ } else {
1480
+ if (genList[i].rules) {
1481
+ this.rules[genList[i].model] = [
1482
+ ...genList[i].rules.map(item => {
1483
+ return {
1484
+ ...item
1485
+ };
1486
+ })
1487
+ ];
1488
+ }
1489
+ }
1490
+ }
1491
+ }
1492
+ }
1493
+ this.$nextTick(() => {
1494
+ this.$emit('formUpdated')
1495
+ })
1496
+ },
1497
+ generateRules(widget, parentWidget) {
1498
+ if (parentWidget && parentWidget.columns) {
1499
+ if (!this.rules[parentWidget.model]) this.rules[parentWidget.model] = {}
1500
+ this.rules[parentWidget.model][widget.model] = widget.rules;
1501
+ this.rules = cloneDeep(this.rules)
1502
+ return
1503
+ }
1504
+ this.$set(this.rules, widget.model, widget.rules)
1505
+ this.rules = cloneDeep(this.rules)
1506
+ },
1507
+ validateTable() {
1508
+
1509
+ // 查找所有的table 子表单的配置组件
1510
+ const findTableComponent = (list = []) => {
1511
+ return list.reduce((all, curr) => {
1512
+ if (Array.isArray(curr)) {
1513
+ return all.concat(findTableComponent(curr))
1514
+ }
1515
+ if (curr.type === 'table') return all.concat(curr)
1516
+ return all
1517
+ }, [])
1518
+ }
1519
+ // 判断子表单内组件有没有必填的校验
1520
+ const tables = findTableComponent(this.dataObj.list).filter(table => {
1521
+ if ([table.options.canView, !table.options.disabled].includes(false)) return
1522
+ const { columns = [] } = table
1523
+ for (let i = 0; i < columns.length; i++) {
1524
+ const { rules = [] } = columns[i]
1525
+ if (rules.some(rule => rule.required)) return true
1526
+ if (columns[i].options?.minValue) return true
1527
+ }
1528
+ })
1529
+ // 子表单有必填校验 判断有没有添加行, 没有添加行需要手动添加行, 让它触发校验
1530
+ // tables.forEach(table => {
1531
+ // if (!table.options.requiredAddDefaultRow) return
1532
+ // const model = this.models[table.model]
1533
+ // if ( !model || ( Array.isArray(model) && model.length === 0 )) {
1534
+ // this.addToTableData(table, table.model, 'addModel')
1535
+ // }
1536
+ // })
1537
+ },
1538
+ /**
1539
+ * @param {回调函数} fn 成功的回调函数
1540
+ * */
1541
+ async getData(fn) {
1542
+ if (typeof fn !== 'function') return
1543
+ this.validateTable()
1544
+
1545
+ if (this.verifyNode && this.models[this.verifyNode]?.loadingSign) {
1546
+ uni.showToast({
1547
+ title: '签名图片获取中',
1548
+ icon: 'none',
1549
+ duration: 1500
1550
+ })
1551
+ fn('failed')
1552
+ return
1553
+ }
1554
+ await this.$nextTick()
1555
+
1556
+ const promiseArr = []
1557
+ for (const i in this.$refs) {
1558
+ if (i === 'Form') continue
1559
+ const refs = this.$refs[i]
1560
+ const refList = (refs instanceof Array || refs?.constructor === Array) ? refs : [refs]
1561
+ refList.forEach(refItem => {
1562
+ if (!refItem?.validateInit || typeof refItem.validateInit !== 'function') return
1563
+ const widget = refItem._props?.widget || refItem.$props?.widget
1564
+ if (!widget?.options) return
1565
+ const { canView, disabled } = widget.options
1566
+ if (!canView || (disabled && !this.m_isCorrectAudit())) return
1567
+ promiseArr.push(refItem.validateInit().then(() => {}).catch((error) => {
1568
+ if (this.isScroll && error === false) {
1569
+ this.isScroll = false
1570
+ uni.createSelectorQuery()
1571
+ .in(this)
1572
+ .select('.evan-form-show').boundingClientRect(data => {
1573
+ refItem.scrollToTop(data.top)
1574
+ }).exec()
1575
+ }
1576
+ throw new Error(error)
1577
+ }))
1578
+ })
1579
+ }
1580
+ promiseArr.push(this.validateVerifyWidgets())
1581
+
1582
+ try {
1583
+ await Promise.all(promiseArr)
1584
+ fn(this.models)
1585
+ } catch (error) {
1586
+ fn('failed')
1587
+ console.log(error)
1588
+ }
1589
+ },
1590
+ validateVerifyWidgets() {
1591
+ return new Promise((resolve, reject) => {
1592
+ // 发起申请场景(processGuide/appApply)不校验审核/确认组件
1593
+ if (this.isApply && !this.verifyNode) {
1594
+ resolve()
1595
+ return
1596
+ }
1597
+ const widgets = (this.dataObj?.list || []).filter(obj => {
1598
+ if (obj.model === this.verifyNode) return true
1599
+ if (obj.type === 'hnkj-confirm' && obj.options.canView && !obj.options.disabled) {
1600
+ return !this.warpVerifyDisable(obj)
1601
+ }
1602
+ return false
1603
+ })
1604
+ if (!widgets.length) {
1605
+ resolve()
1606
+ return
1607
+ }
1608
+ let finished = 0
1609
+ let hasError = false
1610
+ widgets.forEach(widget => {
1611
+ const item = this.models[widget.model]
1612
+ if (!item) {
1613
+ finished++
1614
+ if (finished === widgets.length && !hasError) resolve()
1615
+ return
1616
+ }
1617
+ const rules = {
1618
+ comments: widget.type === 'hnkj-confirm'
1619
+ ? (widget.options.isConfirmComponent
1620
+ ? [{ required: widget.options.confirmOpinionRequire, message: '请输入确认意见' }]
1621
+ : [{ required: widget.options.required, message: widget.options.placeholder }])
1622
+ : [{ required: widget.options.opinionRequire, message: '请输入审批意见' }],
1623
+ operation: widget.type === 'hnkj-confirm'
1624
+ ? [{ required: widget.options.required, message: `请选择${widget.options.operation}` }]
1625
+ : []
1626
+ }
1627
+ utils.validateField(item, rules, Object.keys(rules), (success) => {
1628
+ finished++
1629
+ if (!success) hasError = true
1630
+ if (finished === widgets.length) {
1631
+ hasError ? reject(hasError) : resolve()
1632
+ }
1633
+ }, {
1634
+ showMessage: true
1635
+ })
1636
+ })
1637
+ })
1638
+ },
1639
+ saveForm2() {
1640
+
1641
+ // this.$refs.form2.validate((res) => {
1642
+ // if (res) {
1643
+ // uni.showToast({
1644
+ // title: '验证通过'
1645
+ // })
1646
+ // }
1647
+ // })
1648
+ },
1649
+ utilsSave() {
1650
+ utils.validate(this.info, this.rules, (res, errors) => {
1651
+ if (res) {
1652
+ uni.showToast({
1653
+ title: '验证通过'
1654
+ })
1655
+ }
1656
+ })
1657
+ },
1658
+ hideReqired() {
1659
+ this.hideRequiredAsterisk = !this.hideRequiredAsterisk
1660
+ },
1661
+ },
1662
+ destroyed() {
1663
+ Pubsub.unsubscribe(this.updateWidget);
1664
+ if(this.publish_linkage_array.length > 0){
1665
+ this.publish_linkage_array.forEach(item=>{
1666
+ Pubsub.unsubscribe(item);
1667
+ })
1668
+ this.publish_linkage_array = [];
1669
+ }
1670
+ },
1671
+ }
1672
+ </script>
1673
+
1674
+ <style lang="scss">
1675
+ @import "../../static/iconfont.css";
1676
+ $mybottom: 0; //底部按钮
1677
+
1678
+ /**审核组件样式**/
1679
+ .verify {
1680
+ position: relative;
1681
+ font-size: 28upx;
1682
+ }
1683
+
1684
+ .verify-step {
1685
+ height: 90upx;
1686
+ line-height: 90upx;
1687
+ padding-left: $uni-form-padding-left;
1688
+ font-size: $uni-form-title-font-size;
1689
+ }
1690
+
1691
+ .verify-cot {
1692
+ background-color: #fff;
1693
+ padding: 20upx $uni-form-padding-left;
1694
+ display: flex;
1695
+ justify-content: space-between;
1696
+ align-items: center;
1697
+
1698
+ m-textarea, .textarea-wrapper {
1699
+ display: block;
1700
+ width: 100%;
1701
+ height: 120rpx;
1702
+ padding-top: 20rpx;
1703
+ }
1704
+
1705
+ >view {
1706
+ height: 50upx;
1707
+ line-height: 50upx;
1708
+ }
1709
+
1710
+ >view+view {
1711
+ height: 70upx;
1712
+ line-height: 70upx;
1713
+ font-size: $uni-form-content-font-size;
1714
+ }
1715
+
1716
+ .verify-title {
1717
+ // 一行
1718
+ overflow: hidden;
1719
+ margin-right: 10rpx;
1720
+ text-overflow: ellipsis;
1721
+ display: -webkit-box;
1722
+ -webkit-line-clamp: 1;
1723
+ -webkit-box-orient: vertical;
1724
+ // font-weight: bold;
1725
+ font-size: $uni-form-title-font-size;
1726
+ }
1727
+ }
1728
+
1729
+ .verify-seal {
1730
+ position: absolute;
1731
+ left: 200rpx;
1732
+ top: 260rpx;
1733
+ width: 260rpx;
1734
+ height: 260rpx;
1735
+ z-index: 10;
1736
+ }
1737
+
1738
+ .verify-seal__img {
1739
+ width: 100%;
1740
+ height: 100%;
1741
+ }
1742
+
1743
+ .verify-seal__close {
1744
+ position: absolute;
1745
+ top: -16rpx;
1746
+ right: -16rpx;
1747
+ width: 36rpx;
1748
+ height: 36rpx;
1749
+ background: rgba(0,0,0,0.4);
1750
+ border-radius: 50%;
1751
+ display: flex;
1752
+ align-items: center;
1753
+ justify-content: center;
1754
+ }
1755
+
1756
+ .verify-seal__close-text {
1757
+ color: #fff;
1758
+ font-size: 22rpx;
1759
+ line-height: 1;
1760
+ }
1761
+
1762
+ .verify-seal-btn {
1763
+ padding: 10rpx 24rpx;
1764
+ color: #0599d7;
1765
+ font-size: 26rpx;
1766
+ text-align: right;
1767
+ background-color: #fff;
1768
+ }
1769
+
1770
+ @include onepx('.verify-cot', 'bottom', 'after', #e6e6e6);
1771
+
1772
+ .table-header {
1773
+ min-height: 86upx;
1774
+ line-height: 86upx;
1775
+ padding: 0 30upx;
1776
+ font-weight: bold;
1777
+ font-size: $uni-form-title-font-size;
1778
+ }
1779
+
1780
+ .table-wrapper {
1781
+ margin: 0 auto 20upx auto;
1782
+ }
1783
+
1784
+ .table-container {
1785
+ background-color: #ffffff;
1786
+ font-size: $uni-form-title-font-size;
1787
+
1788
+ .view-port {}
1789
+
1790
+ .add {
1791
+ color: #539dfa;
1792
+ text-align: center;
1793
+ height: 90upx;
1794
+ line-height: 90upx;
1795
+ font-size: $uni-form-content-font-size;
1796
+ }
1797
+
1798
+ .item {
1799
+ display: flex;
1800
+ height: 90upx;
1801
+ line-height: 90upx;
1802
+ justify-content: space-around;
1803
+
1804
+ >view {
1805
+ line-height: 90upx;
1806
+ color: #9b9b9b;
1807
+ text-indent: 10%;
1808
+ font-size: $uni-form-content-font-size;
1809
+ flex: 1;
1810
+ min-width: 130rpx;
1811
+ }
1812
+
1813
+ >view+view {
1814
+ flex-shrink: 18;
1815
+ }
1816
+ }
1817
+
1818
+ @include onepx('.item', 'bottom', 'after', #eeeeee);
1819
+ }
1820
+
1821
+ .evan-form-show {
1822
+ padding-bottom: $mybottom;
1823
+ // padding-bottom: $mybottom;
1824
+ // padding: 0 30rpx;
1825
+ background-color: #efefef;
1826
+
1827
+ .form-input {
1828
+ font-size: 28rpx;
1829
+ color: #333;
1830
+ //text-align: right;
1831
+ width: 100%;
1832
+ box-sizing: border-box;
1833
+
1834
+ &.textarea {
1835
+ height: 240rpx;
1836
+ padding: 24rpx 0;
1837
+ text-align: left;
1838
+ }
1839
+ }
1840
+
1841
+ .form-input-placeholder {
1842
+ font-size: $uni-form-content-font-size;
1843
+ color: #999;
1844
+ }
1845
+
1846
+ &__button {
1847
+ width: 100%;
1848
+ height: 88rpx;
1849
+ border-radius: 8rpx;
1850
+ display: flex;
1851
+ align-items: center;
1852
+ justify-content: center;
1853
+ padding: 0;
1854
+ font-size: 36rpx;
1855
+ color: #fff;
1856
+ margin-top: 20rpx;
1857
+ background-color: #2D87D5;
1858
+
1859
+ &::before,
1860
+ &::after {
1861
+ border: none;
1862
+ }
1863
+ }
1864
+
1865
+ .customize-form-item {
1866
+ &__label {
1867
+ font-size: 28rpx;
1868
+ color: #333;
1869
+ margin-bottom: 16rpx;
1870
+ }
1871
+
1872
+ &__radio {
1873
+ display: flex;
1874
+ align-items: center;
1875
+ margin-bottom: 16rpx;
1876
+
1877
+ &__text {
1878
+ font-size: 28rpx;
1879
+ color: #333;
1880
+ }
1881
+ }
1882
+ }
1883
+ }
1884
+
1885
+ .fixed {
1886
+ position: fixed;
1887
+ z-index: 20;
1888
+ border-top: 1upx solid #eee;
1889
+ background-color: #539dfa;
1890
+ height: $mybottom;
1891
+ width: 100%;
1892
+ left: 0;
1893
+ bottom: 0;
1894
+ font-size: 30upx;
1895
+ color: #fff;
1896
+ display: flex;
1897
+ justify-content: center;
1898
+ align-items: center;
1899
+ }
1900
+
1901
+ cover-view button {
1902
+ letter-spacing: 20upx;
1903
+ background-color: #539dfa;
1904
+ font-size: 30upx;
1905
+ color: #fff;
1906
+ }
1907
+
1908
+ cover-view button::after {
1909
+ border: none;
1910
+ }
1911
+
1912
+
1913
+
1914
+
1915
+ .uni-input {
1916
+ padding: 5rpx 0;
1917
+ }
1918
+ .form-input-suggest {
1919
+ padding: 10rpx 22rpx;
1920
+ background-color: #ecf5fc;
1921
+ border-radius: 20rpx;
1922
+ color: #348cd2;
1923
+ margin-right: 20rpx;
1924
+ }
1925
+ </style>