@zscreate/zhxy-app-component 1.0.92 → 1.0.93-table-app.2

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.
@@ -15,7 +15,7 @@
15
15
 
16
16
  <view v-if="widget.type ==='custom'" class="evan-form-item-container"
17
17
  :class="'evan-form-item-container--' + labelPosition"
18
- :style="{borderWidth:border?'1upx':0}">
18
+ >
19
19
  <view class="evan-form-item-container__label"
20
20
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
21
21
  {{ widget.name }}
@@ -27,7 +27,7 @@
27
27
  <!-- input -->
28
28
  <view v-if="widget.type ==='input'" class="evan-form-item-container"
29
29
  :class="'evan-form-item-container--' + labelPosition"
30
- :style="{borderWidth:border?'1upx':0}">
30
+ >
31
31
  <view class="evan-form-item-container__label"
32
32
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
33
33
  {{ widget.name }}
@@ -40,7 +40,7 @@
40
40
 
41
41
  <!-- uploadModel -->
42
42
  <view v-else-if="widget.type ==='uploadModel'" class="evan-form-item-container"
43
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
43
+ :class="'evan-form-item-container--' + labelPosition" >
44
44
  <view class="evan-form-item-container__label"
45
45
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
46
46
  {{ widget.name }}
@@ -57,7 +57,7 @@
57
57
 
58
58
  <!-- textarea -->
59
59
  <view v-else-if="widget.type ==='textarea'" class="evan-form-item-container"
60
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
60
+ :class="'evan-form-item-container--' + labelPosition" >
61
61
  <view class="evan-form-item-container__label"
62
62
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
63
63
  {{ widget.name }}
@@ -72,7 +72,7 @@
72
72
 
73
73
  <!-- rate -->
74
74
  <view v-else-if="widget.type ==='rate'" class="evan-form-item-container"
75
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
75
+ :class="'evan-form-item-container--' + labelPosition" >
76
76
  <view class="evan-form-item-container__label"
77
77
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
78
78
  {{ widget.name }}
@@ -82,15 +82,15 @@
82
82
  :max="widget.options.max ? widget.options.max : 1000000" :value="dataModel" @change="changeRate"
83
83
  :disabled="widget.options.disabled">
84
84
  </uni-rate>
85
- <view class="u_close" v-if="!widget.options.disabled" @click="dataModel = 0">
86
- <u-icon name="close-circle" color="#999999" size="38"></u-icon>
85
+ <view class="u_close" v-if="dataModel && !widget.options.disabled" @click="dataModel = 0">
86
+ <uni-icons type="clear" color="#e1e1e1" size="14"></uni-icons>
87
87
  </view>
88
88
  </view>
89
89
  </view>
90
90
 
91
91
  <!-- radio -->
92
92
  <view v-else-if="widget.type ==='radio'" :class="'evan-form-item-container--' + labelPosition"
93
- :style="{borderWidth:border?'1upx':0}">
93
+ >
94
94
  <view class="radio-height evan-form-item-container__label"
95
95
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}"
96
96
  style="padding-left: 30rpx;" :style="mLabelStyle">{{ widget.name }}
@@ -114,7 +114,7 @@
114
114
 
115
115
  <!-- switch -->
116
116
  <view v-else-if="widget.type ==='switch'" class="evan-form-item-container"
117
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
117
+ :class="'evan-form-item-container--' + labelPosition" >
118
118
  <view class="evan-form-item-container__label"
119
119
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
120
120
  {{ widget.name }}
@@ -127,7 +127,7 @@
127
127
 
128
128
  <!-- slider -->
129
129
  <view v-else-if="widget.type ==='slider'" class="evan-form-item-container"
130
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
130
+ :class="'evan-form-item-container--' + labelPosition" >
131
131
  <view class="evan-form-item-container__label"
132
132
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
133
133
  {{ widget.name }}
@@ -141,7 +141,7 @@
141
141
 
142
142
  <!-- checkbox -->
143
143
  <view v-else-if="widget.type ==='checkbox'" @click.native="isClickByUser = true"
144
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
144
+ :class="'evan-form-item-container--' + labelPosition" >
145
145
  <view class="radio-height evan-form-item-container__label"
146
146
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}"
147
147
  style="padding-left: 30rpx;" :style="mLabelStyle">{{ widget.name }}
@@ -167,7 +167,7 @@
167
167
 
168
168
  <!-- date -->
169
169
  <view v-else-if="widget.type ==='date'" class="evan-form-item-container"
170
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
170
+ :class="'evan-form-item-container--' + labelPosition" >
171
171
  <view class="evan-form-item-container__label"
172
172
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
173
173
  {{ widget.name }}
@@ -199,14 +199,14 @@
199
199
  </view>
200
200
  <view class="u_close" v-if="widget.options.clearable && dataModel && !widget.options.disabled"
201
201
  @click="handleClose">
202
- <u-icon name="close-circle" color="#999999" size="38"></u-icon>
202
+ <u-icon name="close-circle" color="#999999" size="18"></u-icon>
203
203
  </view> -->
204
204
  </view>
205
205
  </view>
206
206
 
207
207
  <!-- time -->
208
208
  <view v-else-if="widget.type ==='time'" class="evan-form-item-container"
209
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
209
+ :class="'evan-form-item-container--' + labelPosition" >
210
210
  <view class="evan-form-item-container__label"
211
211
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
212
212
  {{ widget.name }}
@@ -235,14 +235,14 @@
235
235
  </view>
236
236
  <view class="u_close" v-if="widget.options.clearable && getTime(dataModel) && !widget.options.disabled"
237
237
  @click="handleClose">
238
- <u-icon name="close-circle" color="#999999" size="38"></u-icon>
238
+ <uni-icons type="clear" color="#e1e1e1" size="14"></uni-icons>
239
239
  </view>
240
240
  </view>
241
241
  </view>
242
242
 
243
243
  <!-- color -->
244
244
  <view v-else-if="widget.type ==='color'" class="evan-form-item-container"
245
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
245
+ :class="'evan-form-item-container--' + labelPosition" >
246
246
  <view class="evan-form-item-container__label"
247
247
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
248
248
  {{ widget.name }}
@@ -255,7 +255,7 @@
255
255
 
256
256
  <!-- imgupload -->
257
257
  <view v-else-if="widget.type ==='imgupload'" class="evan-form-item-container"
258
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
258
+ :class="'evan-form-item-container--' + labelPosition" >
259
259
  <view class="evan-form-item-container__label"
260
260
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
261
261
  {{ widget.name }}
@@ -267,21 +267,21 @@
267
267
 
268
268
  <!-- fileupload -->
269
269
  <view v-else-if="widget.type ==='fileupload'" class="evan-form-item-container"
270
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
270
+ :class="'evan-form-item-container--' + labelPosition" >
271
271
  <view class="evan-form-item-container__label"
272
272
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
273
273
  {{ widget.name }}
274
274
  </view>
275
275
  <view class="evan-form-item-container__main" :style="mContentStyle">
276
- <l-file :url="actionUrl + widget.options.action" :disabled="widget.options.disabled"
277
- @filePost="filePost" @fileDelete="fileDelete" :defaultFile="dataModel" :widget="widget.options">
276
+ <l-file :url="getUploadFileUrl(widget)" :disabled="widget.options.disabled"
277
+ @filePost="filePost" @fileDelete="fileDelete" :defaultFile="dataModel" :widget="widget">
278
278
  </l-file>
279
279
  </view>
280
280
  </view>
281
281
 
282
282
  <!-- editor -->
283
283
  <!-- <view v-else-if="widget.type ==='editor'" class="evan-form-item-container"
284
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
284
+ :class="'evan-form-item-container--' + labelPosition" >
285
285
  <view class="evan-form-item-container__label"
286
286
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
287
287
  {{widget.name}}
@@ -294,7 +294,7 @@
294
294
 
295
295
  <!-- cascader -->
296
296
  <view v-else-if="widget.type ==='cascader'" class="evan-form-item-container"
297
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
297
+ :class="'evan-form-item-container--' + labelPosition" >
298
298
  <view class="evan-form-item-container__label"
299
299
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
300
300
  {{ widget.name }}
@@ -308,7 +308,7 @@
308
308
 
309
309
  <!-- number -->
310
310
  <view v-else-if="widget.type ==='number'" class="evan-form-item-container"
311
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
311
+ :class="'evan-form-item-container--' + labelPosition" >
312
312
  <view class="evan-form-item-container__label"
313
313
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
314
314
  {{ widget.name }}
@@ -324,7 +324,7 @@
324
324
 
325
325
  <!-- codeControl -->
326
326
  <view v-else-if="widget.type ==='codeControl'" class="evan-form-item-container"
327
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
327
+ :class="'evan-form-item-container--' + labelPosition" >
328
328
  <view class="evan-form-item-container__label"
329
329
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
330
330
  {{ widget.name }}
@@ -336,7 +336,7 @@
336
336
 
337
337
  <!-- superLink -->
338
338
  <view v-else-if="widget.type ==='superLink'" class="evan-form-item-container"
339
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
339
+ :class="'evan-form-item-container--' + labelPosition" >
340
340
  <view class="evan-form-item-container__label"
341
341
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
342
342
  {{ widget.name }}
@@ -350,7 +350,7 @@
350
350
 
351
351
  <!-- placeholder -->
352
352
  <view v-else-if="widget.type ==='placeholder'" class="evan-form-item-container"
353
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
353
+ :class="'evan-form-item-container--' + labelPosition" >
354
354
  <view class="evan-form-item-container__label"
355
355
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
356
356
  {{ widget.name }}
@@ -365,7 +365,7 @@
365
365
 
366
366
  <!-- signature-write -->
367
367
  <view v-else-if="widget.type ==='signature-write'" class="evan-form-item-container"
368
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
368
+ :class="'evan-form-item-container--' + labelPosition" >
369
369
  <view class="evan-form-item-container__label"
370
370
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
371
371
  {{ widget.name }}
@@ -389,7 +389,7 @@
389
389
 
390
390
  <!-- select -->
391
391
  <view v-else-if="widget.type ==='select'" class="evan-form-item-container"
392
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
392
+ :class="'evan-form-item-container--' + labelPosition" >
393
393
  <view class="evan-form-item-container__label"
394
394
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
395
395
  {{ widget.name }}
@@ -404,13 +404,13 @@
404
404
  <!-- userSelector -->
405
405
  <view v-else-if="widget.type ==='userSelector'" @click.native="isClickByUser = true"
406
406
  class="evan-form-item-container" :class="'evan-form-item-container--' + labelPosition"
407
- :style="{borderWidth:border?'1upx':0}">
407
+ >
408
408
  <view class="evan-form-item-container__label"
409
409
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
410
410
  {{ widget.name }}
411
411
  </view>
412
412
  <view class="evan-form-item-container__main" :style="mContentStyle"
413
- @click.stop="selectUser(widget.options.multiple)">
413
+ @click="selectUser(widget.options.multiple)">
414
414
  <!-- <input class="form-input" placeholder-class="form-input-placeholder" v-model="dataModelShow"
415
415
  :placeholder="widget.options.placeholder" :disabled="widget.options.disabled" /> -->
416
416
  <view class="form-input">{{ dataModelShow ? dataModelShow : widget.options.placeholder }}</view>
@@ -420,14 +420,14 @@
420
420
  <!-- userSelectorByRole -->
421
421
  <view v-else-if="widget.type ==='userSelectorByRole'" @click.native="isClickByUser = true"
422
422
  class="evan-form-item-container" :class="'evan-form-item-container--' + labelPosition"
423
- :style="{borderWidth:border?'1upx':0}">
423
+ >
424
424
  <view class="evan-form-item-container__label"
425
425
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
426
426
  {{ widget.name }}
427
427
  </view>
428
428
  <view class="evan-form-item-container__main" :style="mContentStyle"
429
- @click.stop="selectUserByRole(widget)">
430
- <user-select-by-role ref="userSelectByRole" @ok="handleSelectRoleUserOk"/>
429
+ @click="selectUserByRole(widget)">
430
+ <!-- <user-select-by-role ref="userSelectByRole" @ok="handleSelectRoleUserOk"/>-->
431
431
  <!-- <input class="form-input" placeholder-class="form-input-placeholder" v-model="dataModelShow"
432
432
  :placeholder="widget.options.placeholder" :disabled="widget.options.disabled" /> -->
433
433
  <view class="form-input">{{ dataModelShow ? dataModelShow : widget.options.placeholder }}</view>
@@ -437,13 +437,13 @@
437
437
 
438
438
  <!-- deptSelector -->
439
439
  <view v-else-if="widget.type ==='deptSelector'" class="evan-form-item-container"
440
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
440
+ :class="'evan-form-item-container--' + labelPosition" >
441
441
  <view class="evan-form-item-container__label"
442
442
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
443
443
  {{ widget.name }}
444
444
  </view>
445
445
  <view class="evan-form-item-container__main" :style="mContentStyle"
446
- @click.stop="selectdept(widget.options.multiple)">
446
+ @click="selectdept(widget.options.multiple)">
447
447
  <!-- <input class="form-input" placeholder-class="form-input-placeholder" v-model="dataModelShow"
448
448
  :placeholder="widget.options.placeholder" :disabled="widget.options.disabled"
449
449
  :departvalue="widget.options.defaultValue" /> -->
@@ -453,7 +453,7 @@
453
453
 
454
454
  <!-- relateSub -->
455
455
  <view v-else-if="widget.type ==='relateSub'" class="evan-form-item-container"
456
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
456
+ :class="'evan-form-item-container--' + labelPosition" >
457
457
  <view class="evan-form-item-container__label"
458
458
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
459
459
  {{ widget.name }}
@@ -468,7 +468,7 @@
468
468
 
469
469
  <!-- richEditor -->
470
470
  <view v-else-if="widget.type === 'hnkj-richEditor'" class="evan-form-item-container"
471
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
471
+ :class="'evan-form-item-container--' + labelPosition" >
472
472
  <view class="evan-form-item-container__label"
473
473
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
474
474
  {{widget.name}}
@@ -485,7 +485,7 @@
485
485
 
486
486
  <!-- nameSignature 签名 -->
487
487
  <view v-if="widget.type ==='hnkj-nameSignature'" class="evan-form-item-container"
488
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
488
+ :class="'evan-form-item-container--' + labelPosition" >
489
489
  <view class="evan-form-item-container__label"
490
490
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
491
491
  {{widget.name}}
@@ -531,13 +531,13 @@ import {
531
531
  import {
532
532
  getMode
533
533
  } from './utilForForm'
534
- import UserSelectByRole from "../userSelectByRole/userSelectByRole";
535
534
  import {downloadFile} from "../../utils/util";
535
+ import XpPicker from "../xp-picker/xp-picker.vue";
536
536
 
537
537
  export default {
538
538
  mixins: [computedMixin, validateFormMixin, pubSubMixin, valueChangeMixin],
539
539
  components: {
540
- UserSelectByRole,
540
+ 'xp-picker': XpPicker,
541
541
  UniRate,
542
542
  tColorPicker,
543
543
  unploadFile,
@@ -691,6 +691,15 @@ export default {
691
691
  uni.$off(this.widget.model);
692
692
  },
693
693
  methods: {
694
+ getUploadFileUrl(widget) {
695
+ let action = ''
696
+ if (String(widget.options.action).startsWith('http')) {
697
+ action = this.widget.options.action;
698
+ } else {
699
+ action = this.actionUrl.includes('sys/common/upload') ? this.actionUrl : (this.actionUrl + '/sys/common/upload')
700
+ }
701
+ return action
702
+ },
694
703
  // 图片加载失败,就显示dataModel
695
704
  nameSignLoadError() {
696
705
  this.nameSign = ''
@@ -1091,7 +1100,6 @@ export default {
1091
1100
  });
1092
1101
  this.$emit("input-change", val, this.widget.model);
1093
1102
  },
1094
- /****/
1095
1103
  // getParentModels(){
1096
1104
  // Pubsub.subscribe('randomObserve',(msg,data) => {
1097
1105
  // // console.log('fu传递model',msg, data)
@@ -1110,8 +1118,9 @@ export default {
1110
1118
  }
1111
1119
  return false
1112
1120
  },
1113
- /****选择人员****/
1121
+ // 选择人员
1114
1122
  selectUser(flag) {
1123
+
1115
1124
  if (this.widget.options.disabled) return
1116
1125
  this.isClickByUser = true
1117
1126
  var PubsubSign = 'SelectUser' + String(Math.random()).split('.')[1];
@@ -1137,7 +1146,7 @@ export default {
1137
1146
  selectUserByRole(widget) {
1138
1147
  if (widget.options.disabled) return
1139
1148
  this.isClickByUser = true
1140
- this.$refs.userSelectByRole.init(widget, this.dataModel)
1149
+ // this.$refs.userSelectByRole.init(widget, this.dataModel)
1141
1150
  },
1142
1151
  handleSelectRoleUserOk(value) {
1143
1152
  this.dataModelShow = ""
@@ -1328,6 +1337,15 @@ export default {
1328
1337
 
1329
1338
  <style lang="scss" scoped>
1330
1339
  @import "../../static/uni.css";
1340
+ //.clear-btn {
1341
+ // position: absolute;
1342
+ // width: 31px;
1343
+ // height: 31px;
1344
+ // line-height: 31px;
1345
+ // z-index: 80;
1346
+ // top: 0;
1347
+ // right: 0px;
1348
+ //}
1331
1349
 
1332
1350
  $form-item-bottom-padding: 20rpx; // 每个组件底部间隔
1333
1351
 
@@ -1339,7 +1357,7 @@ icon {
1339
1357
  }
1340
1358
 
1341
1359
  .u_close {
1342
- padding: 20rpx 20rpx;
1360
+ width: 31px;
1343
1361
  position: absolute;
1344
1362
  right: 0;
1345
1363
  top: 72%;
@@ -1478,7 +1496,7 @@ checkbox-group label {
1478
1496
  }
1479
1497
  }
1480
1498
 
1481
- /deep/ .form-input-placeholder {
1499
+ ::v-deep .form-input-placeholder {
1482
1500
  // line-height: 90upx;
1483
1501
  color: #555;
1484
1502
  }
@@ -1497,7 +1515,7 @@ checkbox-group label {
1497
1515
  display: inline-block;
1498
1516
  }
1499
1517
 
1500
- /deep/ .wx-picker-container .wx-picker-action.wx-picker-action-confirm {
1518
+ ::v-deep .wx-picker-container .wx-picker-action.wx-picker-action-confirm {
1501
1519
  color: #007AFF !important;
1502
1520
  }
1503
1521
 
@@ -749,19 +749,20 @@ export default {
749
749
  }
750
750
  }
751
751
  // console.log(promiseArr)
752
- Promise.all(promiseArr).then((result) => {
753
- console.log(result, promiseArr.length)
754
- if (result.length === promiseArr.length) {
755
- console.log('校验成功')
756
- fn(this.models)
757
- } else {
758
- console.log('校验失败')
759
- fn('failed')
760
- } //['成功了', 'success']
761
- }).catch((error) => {
762
- console.log(error)
763
- })
752
+
764
753
  }
754
+ Promise.all(promiseArr).then((result) => {
755
+ console.log(result, promiseArr.length)
756
+ if (result.length === promiseArr.length) {
757
+ console.log('校验成功')
758
+ fn(this.models)
759
+ } else {
760
+ console.log('校验失败')
761
+ fn('failed')
762
+ } //['成功了', 'success']
763
+ }).catch((error) => {
764
+ console.log(error)
765
+ })
765
766
  // this.$refs.form.validate((res) => {
766
767
  // if (res) {
767
768
  // uni.showToast({
@@ -69,7 +69,7 @@
69
69
  },
70
70
  methods: {
71
71
  getShow(val){
72
- if(val && val.length>=this.widget.length){
72
+ if(val && val.length>=this.widget.options.length){
73
73
  this.isShow = false
74
74
  }
75
75
  else{
@@ -85,7 +85,8 @@
85
85
  },
86
86
  chooseMessageFile: function(e) {
87
87
  console.log(this.widget, )
88
- if (this.disabled || (this.defaultFile.length && this.defaultFile.length >= this.widget.length)) return false;
88
+ const { options } = this.widget
89
+ if (this.disabled || (this.defaultFile.length && this.defaultFile.length >= options.length)) return false;
89
90
  var that = this;
90
91
  //#ifdef H5
91
92
  uni.chooseFile
@@ -96,10 +97,19 @@
96
97
  ({
97
98
  count: 1,
98
99
  type: 'all',
99
- success(res) {
100
+ success: (res) => {
100
101
  console.log(res.tempFiles)
101
102
  const path = res.tempFiles
103
+ const { ext = '' } = this.widget
102
104
  that.name = res.tempFiles[0].name
105
+ console.log(ext, that.name.split('.').pop())
106
+ if (!ext.includes(that.name.split('.').pop())) {
107
+ return uni.showToast({
108
+ title: `不支持该文件`,
109
+ icon: 'none'
110
+ })
111
+ }
112
+
103
113
  const uploadTask = uni.uploadFile({
104
114
  url: that.url,
105
115
  filePath: path[0].path,
@@ -1,123 +1,177 @@
1
1
  <template>
2
- <view>
3
- <u-upload ref="uUpload" :file-list="fileList" :action="action" :upload-text="widget.options.placeholder" :max-size="maxSize"
4
- width="150" height="150" :multiple="false" :max-count="maxCount" :disabled="disabled" @on-remove="onRemove" @on-oversize="onOversize" @on-success="onSuccess"
5
- :show-progress="showProgress" ></u-upload>
6
- <!-- uview组件 修改了 disabled 用法 更新需要注意 -->
7
- </view>
2
+ <view>
3
+ <u-upload ref="uUpload" :file-list="fileList" :action="action"
4
+ @afterRead="afterRead"
5
+ @delete="onRemove"
6
+ :upload-text="widget.options.placeholder" :max-size="maxSize"
7
+ width="150" height="150" :multiple="false" :max-count="maxCount" :disabled="disabled" @on-remove="onRemove" @on-oversize="onOversize" @on-success="onSuccess"
8
+ :show-progress="showProgress" ></u-upload>
9
+ <!-- uview组件 修改了 disabled 用法 更新需要注意 -->
10
+ </view>
8
11
  </template>
9
12
 
10
13
  <script>
11
- var _self;
12
- export default {
13
- props: {
14
- defaultImg: {
15
- type: Array,
16
- default: () => {
17
- return []
18
- }
19
- },
20
- widget: {
21
- type: Object,
22
- default: () => {
23
- return {}
24
- }
25
- }
26
- },
27
- data() {
28
- return {
29
- actionUrl: this.uniEnv.uploadUrl,
30
- action: '',
31
- percent: 0,
32
- upimg: '',
33
- maxCount: 8,
34
- maxSize: 300000,
35
- disabled: false,
36
- show: true,
37
- fileList: [],
38
- emitList:[],
39
- showProgress: true
40
- };
41
- },
42
- created() {
43
- if (this.widget && Object.keys(this.widget).length > 0) {
44
- this.initWidget();
45
- this.showImage();
46
- }
14
+ var _self;
15
+ export default {
16
+ props: {
17
+ defaultImg: {
18
+ type: Array,
19
+ default: () => {
20
+ return []
21
+ }
22
+ },
23
+ widget: {
24
+ type: Object,
25
+ default: () => {
26
+ return {}
27
+ }
28
+ }
29
+ },
30
+ data() {
31
+ return {
32
+ actionUrl: this.uniEnv.uploadUrl,
33
+ action: '',
34
+ percent: 0,
35
+ upimg: '',
36
+ maxCount: 8,
37
+ maxSize: 300000,
38
+ disabled: false,
39
+ show: true,
40
+ fileList: [],
41
+ emitList:[],
42
+ showProgress: true
43
+ };
44
+ },
45
+ created() {
46
+ if (this.widget && Object.keys(this.widget).length > 0) {
47
+ this.initWidget();
48
+ this.showImage();
49
+ }
47
50
 
48
- },
49
- mounted() {
50
- this.upimg = this.img
51
- },
51
+ },
52
+ mounted() {
53
+ this.upimg = this.img
54
+ },
52
55
 
53
- methods: {
54
- onOversize(val, lists, index){
55
- // uni.showToast({
56
- // title: '超出允许的文件大小',
57
- // icon: 'none',
58
- // duration: 2000
59
- // });
60
- },
61
- showImage() {
62
- this.emitList = this.defaultImg
63
- this.showProgress = false;
64
- if (this.defaultImg && this.defaultImg.length && this.defaultImg.length > 0) {
65
- this.fileList = this.defaultImg
66
- .map((item,index) => {
67
- let tempItem = { ...item,
68
- };
69
- tempItem.url = this.uniEnv.imgUrl + tempItem.url;
70
- return tempItem;
71
- })
56
+ methods: {
57
+ async afterRead(event) {
58
+ const { ext = '' } = this.widget
59
+ if (!ext.includes(event.name.split('.').pop())) {
60
+ return uni.showToast({
61
+ title: `不支持该文件`,
62
+ icon: 'none'
63
+ })
64
+ }
65
+ // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
66
+ let lists = [].concat(event.file)
67
+ // lists.map((item) => {
68
+ // this.fileList.push({
69
+ // ...item,
70
+ // status: 'uploading',
71
+ // message: '上传中'
72
+ // })
73
+ // })
74
+ for (let i = 0; i < lists.length; i++) {
75
+ const result = await this.uploadFilePromise(lists[i].url)
76
+ let id = new Date().getTime();
77
+ const item = {
78
+ key: id,
79
+ uid: id,
80
+ url: result,
81
+ status: "done",
82
+ name: id
83
+ }
84
+ this.emitList.push(item)
85
+ this.fileList.push(Object.assign({}, item, {url: this.uniEnv.imgUrl + item.url}))
86
+ this.$emit('imgUrlPost', this.emitList)
87
+ }
88
+ },
89
+ uploadFilePromise(url) {
90
+ return new Promise((resolve, reject) => {
91
+ uni.uploadFile({
92
+ url: this.action,
93
+ filePath: url,
94
+ name: 'file',
95
+ success: (uploadFileRes) => {
96
+ const res = JSON.parse(uploadFileRes.data)
97
+ resolve(res.message)
98
+ }
99
+ });
100
+ })
101
+ },
102
+ onOversize(val, lists, index){
103
+ // uni.showToast({
104
+ // title: '超出允许的文件大小',
105
+ // icon: 'none',
106
+ // duration: 2000
107
+ // });
108
+ },
109
+ showImage() {
110
+ this.emitList = this.defaultImg
111
+ this.showProgress = false;
112
+ if (this.defaultImg && this.defaultImg.length && this.defaultImg.length > 0) {
113
+ this.fileList = this.defaultImg
114
+ .map((item,index) => {
115
+ let tempItem = { ...item,
116
+ };
117
+ tempItem.url = this.uniEnv.imgUrl + tempItem.url;
118
+ return tempItem;
119
+ })
72
120
 
73
- console.log(this.fileList)
74
- }
75
- },
76
- initWidget() {
77
- //action url
78
- this.action = this.actionUrl + this.widget.options.action;
79
- //文件大小限制
80
- this.maxSize = this.widget.options.fileSize ? this.widget.options.fileSize * 1000 : 300000;
121
+ console.log(this.fileList)
122
+ }
123
+ },
124
+ initWidget() {
125
+ //action url
126
+ if (String(this.widget.options.action).startsWith('http')) {
127
+ this.action = this.widget.options.action;
128
+ } else {
129
+ this.action = this.actionUrl.includes('sys/common/upload') ? this.actionUrl : (this.actionUrl + '/sys/common/upload')
130
+ }
131
+ //文件大小限制
132
+ this.maxSize = this.widget.options.fileSize ? this.widget.options.fileSize * 1000 : 300000;
81
133
 
82
- // this.maxSize = 100
83
- //最大上传个数
84
- this.maxCount = parseInt(this.widget.options.length);
85
- //是否禁用
86
- this.disabled = this.widget.options.disabled;
87
- },
88
- // beforeUpload(index, list) {
134
+ // this.maxSize = 100
135
+ //最大上传个数
136
+ this.maxCount = parseInt(this.widget.options.length);
137
+ //是否禁用
138
+ this.disabled = this.widget.options.disabled;
139
+ },
140
+ // beforeUpload(index, list) {
89
141
 
90
- // let errorIndex = list.findIndex( item => {
91
- // return item.file.size > this.maxSize
92
- // })
93
- // if (errorIndex > -1) {
94
- // uni.showToast({
95
- // title: '超出允许的文件大小',
96
- // duration: 2000
97
- // });
98
- // return
99
- // }
142
+ // let errorIndex = list.findIndex( item => {
143
+ // return item.file.size > this.maxSize
144
+ // })
145
+ // if (errorIndex > -1) {
146
+ // uni.showToast({
147
+ // title: '超出允许的文件大小',
148
+ // duration: 2000
149
+ // });
150
+ // return
151
+ // }
100
152
 
101
- // },
102
- onSuccess(data, index, lists, name) {
103
- let id = new Date().getTime();
104
- let imgArr = data.message.split('/');
105
- let _name = imgArr[imgArr.length - 1]
106
- this.emitList.push({
107
- key: id,
108
- uid: id,
109
- url: data.message,
110
- status: "done",
111
- name: _name
112
- });
113
- this.$emit('imgUrlPost', this.emitList)
114
- },
115
- onRemove(index, lists, name) {
116
- this.emitList.splice(index, 1);
117
- this.$emit('imgUrlPost', this.emitList)
118
- }
119
- }
120
- }
153
+ // },
154
+ onSuccess(data, index, lists, name) {
155
+ let id = new Date().getTime();
156
+ let imgArr = data.message.split('/');
157
+ let _name = imgArr[imgArr.length - 1]
158
+ this.emitList.push({
159
+ key: id,
160
+ uid: id,
161
+ url: data.message,
162
+ status: "done",
163
+ name: _name
164
+ });
165
+ this.$emit('imgUrlPost', this.emitList)
166
+ },
167
+ onRemove(index, lists, name) {
168
+ if (typeof(index) === 'object') index = index.index
169
+ this.emitList.splice(index, 1);
170
+ this.fileList.splice(index, 1);
171
+ this.$emit('imgUrlPost', this.emitList)
172
+ }
173
+ }
174
+ }
121
175
  </script>
122
176
 
123
177
  <style lang="less" scoped>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zscreate/zhxy-app-component",
3
- "version": "1.0.92",
3
+ "version": "1.0.93-table-app.2",
4
4
  "private": false,
5
5
  "description": "zhxy-app-component",
6
6
  "main": "index.js",
@@ -1,210 +0,0 @@
1
- <template>
2
- <u-popup v-model="roleSelectShow" width="100%">
3
- <view class="role-select-body" style="padding: 20rpx; margin-top: 40rpx">
4
- <view>角色选择</view>
5
- <u-radio-group v-model="roleChecked" >
6
- <u-radio
7
- @change="roleChange"
8
- v-for="(item, index) in rolesList" :key="index"
9
- :name="item.id"
10
- >
11
- {{item.roleName}}
12
- </u-radio>
13
- </u-radio-group>
14
- <view style="margin-top: 20rpx; display: flex; flex-wrap: wrap">
15
- <view>已选:</view>
16
- <u-tag style="margin-right: 5px" v-for="val in currValue" :text="val.realname" closeable @close="removeClick(val)" :key="val.id" />
17
- </view>
18
- <view style="margin-top: 20rpx">
19
- <u-table>
20
- <u-tr>
21
- <u-th width="50px" style="box-sizing: border-box">
22
- <view v-if="multiple">
23
- <u-checkbox :value="isAllCheck" @change="roleCheckAll">
24
- </u-checkbox>
25
- </view>
26
- <view v-else>选择</view>
27
- </u-th>
28
- <u-th >姓名</u-th>
29
- <u-th>所属部门</u-th>
30
- </u-tr>
31
- <u-tr v-for="user in roleUserList" :key="user.id">
32
- <u-td width="50px" >
33
- <view>
34
- <u-checkbox v-model="user.checked" @change="handleCheck" :name="user.id">
35
- </u-checkbox>
36
- </view>
37
- </u-td>
38
- <u-td style="flex: 1"><view>{{ user.realname }}</view></u-td>
39
- <u-td style="flex: 1; word-break: break-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"><view>{{ user.departName }}</view></u-td>
40
- </u-tr>
41
- </u-table>
42
-
43
- </view>
44
-
45
- <view style="display: flex; justify-content: space-between; margin-top: 20rpx">
46
- <u-button type="primary" size="medium" @click="handleSelectRoleUserOk">确定</u-button>
47
- <u-button size="medium" @click="roleSelectShow = false">取消</u-button>
48
- </view>
49
- </view>
50
-
51
-
52
- <t-loading :isLoading="isLoading"/>
53
- </u-popup>
54
- </template>
55
-
56
- <script>
57
- import {cloneObj} from "../../utils/util";
58
-
59
- export default {
60
- name: "userSelectByRole",
61
- props: {
62
-
63
- },
64
- data() {
65
- return {
66
- roleSelectShow: false,
67
- rolesList: [],
68
- roleUserList: [],
69
- currValue: [],
70
- role: '',
71
- multiple: false,
72
- depId: '',
73
- roleChecked: '',
74
- isLoading: true,
75
- }
76
- },
77
- computed: {
78
- checkIds() {
79
- return this.currValue.map(item => item.id)
80
- },
81
- isAllCheck() {
82
- if (this.roleUserList.length === 0) return false
83
- return this.roleUserList.every(item => item.checked)
84
- },
85
- },
86
- methods: {
87
- init(widget, value) {
88
- this.roleSelectShow = true
89
- this.isLoading = true
90
- if (widget.options.departRelation) {
91
- const userInfo = uni.getStorageSync('userinfo')
92
- console.log("userInfo: ", userInfo)
93
- this.depId = userInfo.departId || userInfo.depart_id
94
- }
95
- this.role = widget.options.role
96
- this.multiple = widget.options.multiple
97
- this.currValue = cloneObj(value || [])
98
- this.$u.get('/sys/role/list', {
99
- pageNo: 1,
100
- pageSize: 100000,
101
- }).then(res => {
102
- this.rolesList = res.result.records.filter((item) => {
103
- return this.role.includes(item.id);
104
- })
105
- }).finally(() => {
106
- this.isLoading = false
107
- })
108
- },
109
- removeClick(val) {
110
- this.currValue = this.currValue.filter(item => item.id !== val.id)
111
- const len = this.roleUserList
112
- this.roleUserList.checked = this.roleUserList.filter((item, idx) => {
113
- if (val.id === item.id) this.$set(item, 'checked', false )
114
- return item.checked
115
- }).length === len
116
- },
117
- handleCheck({value , name}) {
118
- console.log(value, name)
119
- if (!this.multiple) {
120
- this.currValue = []
121
- this.roleUserList = this.roleUserList.map((item, idx) => {
122
- item.checked = false
123
- return item
124
- })
125
- }
126
- if (!value) {
127
- this.currValue = this.currValue.filter(item => item.id != name)
128
- }
129
- const len = this.roleUserList
130
- this.roleUserList.checked = this.roleUserList.filter((item, idx) => {
131
- if (item.id === name) {
132
- if (value && !this.checkIds.includes(item.id)) {
133
- this.currValue.push(item)
134
- }
135
- this.$set(item, 'checked', value)
136
- return value
137
- }
138
- return item.checked
139
- }).length === len
140
- console.log(this.currValue)
141
- },
142
-
143
- handleSelectRoleUserOk() {
144
- this.roleSelectShow = false
145
- // let checked = this.roleUserList.filter(item => {
146
- // if (item.checked) return item
147
- // })
148
- //
149
- // let ids = []
150
- // checked = checked.concat(this.currValue).filter(item => {
151
- // if (ids[item.id]) return false
152
- // ids[item.id] = true
153
- // return item
154
- // })
155
-
156
- this.$emit("ok", this.currValue)
157
- },
158
- roleCheckAll({value}) {
159
- this.roleUserList.checked != this.roleUserList.checked
160
- if (value) {
161
- this.roleUserList.forEach(item => {
162
- if (!this.checkIds.includes(item.id)) {
163
- this.currValue.push(item)
164
- }
165
- this.$set(item, 'checked', value)
166
- })
167
- }
168
- if (!value) {
169
- this.roleUserList.forEach(item => {
170
- this.currValue = this.currValue.filter(curr => curr.id !== item.id)
171
- })
172
- }
173
- },
174
- roleChange(roleId) {
175
- this.isLoading = true
176
- this.$u.get('/formApi/listFormUserByRole', {
177
- pageNo: 1,
178
- pageSize: 100000,
179
- depId: this.depId,
180
- roleId
181
- }).then(res => {
182
- this.roleUserList = res.result.records.filter(item => {
183
- item.checked = this.checkIds.includes(item.id)
184
- return item
185
- })
186
- }).finally( () => {
187
- this.$nextTick(() => {
188
- this.isLoading = false
189
- })
190
- })
191
-
192
- },
193
- }
194
- }
195
- </script>
196
-
197
- <style scoped>
198
- /deep/ u-th:nth-child(1) {
199
- flex: 0 0 40px;
200
- }
201
- /deep/ u-th {
202
- flex: 1;
203
- }
204
-
205
-
206
- .role-select-body {
207
- display: flex;
208
- flex-direction: column;
209
- }
210
- </style>