doway-coms 1.1.52 → 1.1.55

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.
Files changed (52) hide show
  1. package/lib/doway-coms.common.js +1506 -53
  2. package/lib/doway-coms.umd.js +1506 -53
  3. package/node_modules/vxe-table/package.json +1 -1
  4. package/package.json +13 -4
  5. package/packages/BaseCheckbox/index.js +8 -0
  6. package/packages/BaseCheckbox/src/index.vue +123 -0
  7. package/packages/BaseDate/index.js +8 -0
  8. package/packages/BaseDate/src/index.vue +145 -0
  9. package/packages/BaseDateWeek/index.js +8 -0
  10. package/packages/BaseDateWeek/src/index.vue +115 -0
  11. package/packages/BaseDatetime/index.js +8 -0
  12. package/packages/BaseDatetime/src/index.vue +143 -0
  13. package/packages/BaseForm/index.js +8 -0
  14. package/packages/BaseForm/src/index.vue +631 -0
  15. package/packages/BaseGrid/index.js +10 -0
  16. package/packages/BaseGrid/src/index.vue +2375 -0
  17. package/packages/BaseInput/index.js +8 -0
  18. package/packages/BaseInput/src/index.vue +122 -0
  19. package/packages/BaseIntervalInput/index.js +8 -0
  20. package/packages/BaseIntervalInput/src/index.vue +275 -0
  21. package/packages/BaseNumberInput/index.js +8 -0
  22. package/packages/BaseNumberInput/src/index.vue +216 -0
  23. package/packages/BasePagination/index.js +8 -0
  24. package/packages/BasePagination/src/index.vue +74 -0
  25. package/packages/BasePictureCard/index.js +8 -0
  26. package/packages/BasePictureCard/src/index.vue +580 -0
  27. package/packages/BasePulldown/index.js +8 -0
  28. package/packages/BasePulldown/src/index.vue +817 -0
  29. package/packages/BaseSelect/index.js +8 -0
  30. package/packages/BaseSelect/src/index.vue +141 -0
  31. package/packages/BaseSelectMulti/index.js +8 -0
  32. package/packages/BaseSelectMulti/src/index.vue +135 -0
  33. package/packages/BaseTextArea/index.js +8 -0
  34. package/packages/BaseTextArea/src/index.vue +138 -0
  35. package/packages/BaseTime/index.js +8 -0
  36. package/packages/BaseTime/src/index.vue +117 -0
  37. package/packages/BaseTool/index.js +8 -0
  38. package/packages/BaseTool/src/index.vue +350 -0
  39. package/packages/BaseToolStatus/index.js +8 -0
  40. package/packages/BaseToolStatus/src/index.vue +384 -0
  41. package/packages/index.js +138 -0
  42. package/packages/styles/default.less +79 -0
  43. package/packages/utils/api.js +35 -0
  44. package/packages/utils/auth.js +38 -0
  45. package/packages/utils/common.js +259 -0
  46. package/packages/utils/dom.js +181 -0
  47. package/packages/utils/enum.js +81 -0
  48. package/packages/utils/filters.js +459 -0
  49. package/packages/utils/msg.js +17 -0
  50. package/packages/utils/patchFiles.js +45 -0
  51. package/packages/utils/request.js +80 -0
  52. package/packages/utils/store.js +117 -0
@@ -0,0 +1,74 @@
1
+ <template>
2
+ <div>
3
+ <Pagination
4
+ show-quick-jumper
5
+ :current="currentPage"
6
+ size="small"
7
+ show-size-changer
8
+ @showSizeChange="onShowSizeChange"
9
+ :total="totalRows"
10
+ :page-size-options="pageSizeOptions"
11
+ :defaultPageSize="pageSize"
12
+ style="margin-top: 10px;"
13
+ @change="onPageChange"
14
+ :show-total="total => `总共 ${totalRows} 条`"
15
+ />
16
+ </div>
17
+ </template>
18
+ <script>
19
+ import { Pagination } from 'ant-design-vue'
20
+ export default {
21
+ components: {
22
+ Pagination
23
+ },
24
+ name: 'BasePagination',
25
+ data() {
26
+ return {}
27
+ },
28
+ props: {
29
+ pageSizeOptions: {
30
+ type: Array,
31
+ default: function() {
32
+ return ['50', '100', '150', '200']
33
+ }
34
+ },
35
+ totalRows: {
36
+ type: Number,
37
+ default: function() {
38
+ return 0
39
+ }
40
+ },
41
+ currentPage: {
42
+ type: Number,
43
+ default: function() {
44
+ return 0
45
+ }
46
+ },
47
+ pageSize: {
48
+ type: Number,
49
+ default: function() {
50
+ return 0
51
+ }
52
+ }
53
+ },
54
+ watch: {},
55
+ created() {},
56
+ methods: {
57
+ onPageChange(current, pageSize) {
58
+ if (current === 0) {
59
+ current = 1
60
+ }
61
+ this.$emit('pageChange', current, pageSize)
62
+ },
63
+ onShowSizeChange(current, pageSize) {
64
+ if (current === 0) {
65
+ current = 1
66
+ }
67
+ this.$emit('pageSizeChange', current, pageSize)
68
+ }
69
+ }
70
+ }
71
+ </script>
72
+ <style lang="less">
73
+ @import '../../styles/default.less';
74
+ </style>
@@ -0,0 +1,8 @@
1
+ // 导入组件,组件必须声明 name
2
+ import BasePictureCard from './src/index.vue';
3
+ // 为组件提供 install 安装方法,供按需引入
4
+ BasePictureCard.install = function(Vue) {
5
+ Vue.component(BasePictureCard.name, BasePictureCard);
6
+ };
7
+ // 默认导出组件
8
+ export default BasePictureCard;
@@ -0,0 +1,580 @@
1
+ <template>
2
+ <div style="display: inline-block">
3
+ <div class="file-card">
4
+ <div
5
+ class="attach-wrapper"
6
+ v-for="internalRow in internalRows.filter(
7
+ x => x.sysRowState != 'delete'
8
+ )"
9
+ :key="internalRow.attach.fileName"
10
+ >
11
+ <template v-if="internalRow.sysRowState !== sysRowState.delete">
12
+ <div class="attach" v-if="internalRow.attach.content === 'image'">
13
+ <img
14
+ @click="attachFileClick(internalRow.attach)"
15
+ :style="{ width: width, height: height, lineHeight: height }"
16
+ style="
17
+ border: 1px solid #ccc;
18
+ border-radius: 6px;
19
+ overflow: hidden;
20
+ margin: 0;
21
+ padding: 0;
22
+ "
23
+ :src="
24
+ `${internalServiceUrl}/GetAttachFile/${internalRow.attach.id}?accessToken=${$store.getters.token}`
25
+ "
26
+ />
27
+ <i
28
+ class="el-icon-error attach-delete"
29
+ v-if="edit === true"
30
+ @click="removeAttach(internalRow.attach)"
31
+ ></i>
32
+ <i
33
+ class="el-icon-download attach-download"
34
+ @click="downloadAttach(internalRow.attach)"
35
+ ></i>
36
+ <i
37
+ class="el-icon-view attach-view"
38
+ @click="viewAttach(internalRow.attach)"
39
+ ></i>
40
+ <VxeCheckbox
41
+ class="attach-circle"
42
+ v-model="internalRow.isDefault"
43
+ @change="circleAttach(internalRow.attach, internalRow)"
44
+ :disabled="formState == 'view'"
45
+ ></VxeCheckbox>
46
+ </div>
47
+ <div class="attach" v-else>
48
+ <img
49
+ @click="attachFileClick(internalRow.attach)"
50
+ class="o_image"
51
+ :data-mimetype="internalRow.attach.contentType"
52
+ />
53
+ <i
54
+ class="el-icon-error attach-delete"
55
+ v-if="edit === true"
56
+ @click="removeAttach(internalRow.attach)"
57
+ ></i>
58
+ <i
59
+ class="el-icon-download attach-download"
60
+ @click="downloadAttach(internalRow.attach)"
61
+ ></i>
62
+ <i
63
+ class="el-icon-view attach-view"
64
+ @click="viewAttach(internalRow.attach)"
65
+ ></i>
66
+ <VxeCheckbox
67
+ class="attach-circle"
68
+ v-model="internalRow.isDefault"
69
+ @change="circleAttach(internalRow.attach, internalRow)"
70
+ :disabled="formState == 'view'"
71
+ ></VxeCheckbox>
72
+ </div>
73
+ <div
74
+ :style="{ width: width }"
75
+ :title="internalRow.attach.name"
76
+ style="
77
+ overflow: hidden;
78
+ text-overflow: ellipsis;
79
+ white-space: nowrap;
80
+ "
81
+ >
82
+ {{ internalRow.attach.name }}
83
+ </div>
84
+ </template>
85
+ </div>
86
+ <a-upload
87
+ class="avatar-uploader"
88
+ :headers="uploadHeaders"
89
+ :action="uploadData.picAction"
90
+ :data="uploadData"
91
+ v-if="edit === true"
92
+ :on-success="handleAvatarSuccess"
93
+ :show-file-list="false"
94
+ :before-upload="beforeAvatarUpload"
95
+ >
96
+ <div
97
+ style="border: 1px solid #d9d9d9; border-radius: 6px"
98
+ :style="{ width: width, height: height, lineHeight: height }"
99
+ >
100
+ <i
101
+ class="el-icon-plus avatar-uploader-icon"
102
+ style="text-align: center"
103
+ :style="{ width: width, height: height, lineHeight: height }"
104
+ ></i>
105
+ </div>
106
+ </a-upload>
107
+ <div v-if="edit !== true && showEmptyText && internalRows.length === 0">
108
+ 没有附件信息哦,请编辑添加附件信息
109
+ </div>
110
+ </div>
111
+ <VxeModal
112
+ v-model="dialogVisible"
113
+ show-zoom
114
+ transfer
115
+ resize
116
+ destroy-on-close
117
+ :fullscreen="isFullscreen || dialogViewType == 'application/pdf'"
118
+ >
119
+ <!-- 添加普通图片全屏属性控制 -->
120
+ <template #title>
121
+ <div
122
+ v-if="dialogViewType !== 'application/pdf'"
123
+ style="text-align: right; margin-right: 15px; padding-top: 5px"
124
+ >
125
+ <!-- 全屏 -->
126
+ <i
127
+ v-if="!isFullscreen"
128
+ class="el-icon-full-screen"
129
+ style="font-size: 19px; margin-right: 10px"
130
+ @click="screenClick"
131
+ ></i>
132
+ <!-- 取消全屏 -->
133
+ <i
134
+ v-else
135
+ class="el-icon-connection"
136
+ style="font-size: 19px; margin-right: 10px"
137
+ @click="narrowClick"
138
+ ></i>
139
+ </div>
140
+ </template>
141
+ <!-- pdf -->
142
+ <embed
143
+ v-if="dialogViewType == 'application/pdf'"
144
+ :src="dialogImageUrl"
145
+ :type="dialogViewType"
146
+ width="100%"
147
+ height="100%"
148
+ />
149
+ <!-- 普通图片 -->
150
+ <img width="90%" height="auto" :src="dialogImageUrl" v-else />
151
+ </VxeModal>
152
+ </div>
153
+ </template>
154
+
155
+ <script>
156
+ import { notification,Upload } from 'ant-design-vue'
157
+ import { sysRowState } from '../../utils/enum'
158
+ import { getToken } from '../../utils/auth'
159
+ import { Checkbox,Modal } from 'vxe-table'
160
+ import store from '../../utils/store'
161
+ import {attachGetAttachUrlApi,attachSearchApi} from '../../utils/api'
162
+
163
+ export default {
164
+ name: 'BasePictureCard',
165
+ components:{
166
+ 'VxeCheckbox':Checkbox,
167
+ 'a-upload':Upload,
168
+ 'VxeModal':Modal
169
+ },
170
+ data() {
171
+ return {
172
+ demo1: '',
173
+ demo2: '',
174
+ internalServiceUrl: '',
175
+ downFilePath: '',
176
+ downFileName: '',
177
+ isShowPdf: false,
178
+ pdfData: null,
179
+ internalUrls: [],
180
+ internalRows: [],
181
+ picName: [],
182
+ // internalUrl: '',
183
+ dialogImageUrl: '',
184
+ dialogViewType: '',
185
+ sysRowState: sysRowState,
186
+ dialogVisible: false,
187
+ uploadData: {
188
+ picType: '',
189
+ picAction: '',
190
+ resId: ''
191
+ },
192
+ uploadHeaders: {
193
+ Authorization: `Bearer ${getToken()}`
194
+ },
195
+ isFullscreen: false
196
+ }
197
+ },
198
+ props: {
199
+ showEmptyText: {
200
+ type: Boolean,
201
+ default: true
202
+ },
203
+ picType: {
204
+ type: String,
205
+ default: 'cust'
206
+ },
207
+ value: {
208
+ type: String
209
+ },
210
+ resId: {
211
+ type: String
212
+ },
213
+ dataName: {
214
+ type: String
215
+ },
216
+ edit: {
217
+ // 列信息
218
+ type: Boolean
219
+ },
220
+ limitSize: {
221
+ // 限制上传大小
222
+ type: Number,
223
+ default: 5
224
+ },
225
+ limitType: {
226
+ // 限制上传类型
227
+ type: Array,
228
+ default: () => {
229
+ return []
230
+ }
231
+ },
232
+ formRow: {
233
+ type: Object,
234
+ default: () => {
235
+ return {}
236
+ }
237
+ },
238
+ width: {
239
+ type: String,
240
+ default: '100px'
241
+ },
242
+ height: {
243
+ type: String,
244
+ default: '100px'
245
+ },
246
+ rows: {
247
+ // 表格数据
248
+ type: Array,
249
+ default: function() {
250
+ return []
251
+ }
252
+ },
253
+ cols: {
254
+ // 表格列信息
255
+ type: Array,
256
+ default: function() {
257
+ return []
258
+ }
259
+ },
260
+ formState: {
261
+ // 表格列信息
262
+ type: String,
263
+ default: ''
264
+ }
265
+ },
266
+ watch: {
267
+ rows: {
268
+ handler: function(newVal) {
269
+ this.getAttachInfo(newVal)
270
+ },
271
+ deep: true
272
+ },
273
+ resId: {
274
+ handler: function(newVal) {
275
+ this.uploadData.resId = newVal
276
+ }
277
+ }
278
+ },
279
+ created() {},
280
+ mounted() {
281
+ this.internalServiceUrl = attachGetAttachUrlApi()
282
+ this.uploadData.picType = this.picType
283
+ this.uploadData.resId = this.resId
284
+ this.uploadData.picAction = this.internalServiceUrl + '/UploadAttach'
285
+ this.getAttachInfo(this.rows)
286
+ },
287
+ methods: {
288
+ getCurrentToken(){
289
+ return store.getters.token
290
+ },
291
+ /**
292
+ * 获取附件信息
293
+ */
294
+ getAttachInfo(newRows) {
295
+ let attachIds = []
296
+ for (let i = 0; i < newRows.length; i++) {
297
+ if (newRows[i].attach) {
298
+ continue
299
+ }
300
+ attachIds.push(newRows[i].attachId)
301
+ newRows[i].attach = {
302
+ fileName: '',
303
+ contentType: '',
304
+ content: '',
305
+ name: '',
306
+ id: newRows[i].attachId
307
+ }
308
+ }
309
+ if (attachIds.length == 0) {
310
+ this.internalRows = newRows
311
+ return
312
+ }
313
+ let postData = {
314
+ fields: 'id,fileName,contentType,name,content,isDefault',
315
+ begin: 1,
316
+ size: 0,
317
+ exp: 'id in ('
318
+ }
319
+ for (let i = 0; i < attachIds.length; i++) {
320
+ postData.exp = postData.exp + attachIds[i] + ','
321
+ }
322
+ let vm = this
323
+ postData.exp = postData.exp.substr(0, postData.exp.length - 1) + ')'
324
+ attachSearchApi(postData)
325
+ .then(responseData => {
326
+ for (let i = 0; i < responseData.content.length; i++) {
327
+ for (let x = 0; x < newRows.length; x++) {
328
+ if (responseData.content[i].id === newRows[x].attachId) {
329
+ newRows[x].attach.fileName = responseData.content[i].fileName
330
+ newRows[x].attach.name = responseData.content[i].name
331
+ newRows[x].attach.content = responseData.content[i].content
332
+ newRows[x].attach.contentType =
333
+ responseData.content[i].contentType
334
+ // newRows[x].attach.isDefault = false
335
+ break
336
+ }
337
+ }
338
+ }
339
+ vm.internalRows = newRows
340
+ })
341
+ .catch(() => {})
342
+ },
343
+ attachFileClick(attachFile) {},
344
+ handleAvatarSuccess(res, file, fileList) {
345
+ let addRow = {
346
+ attachId: res.content.id,
347
+ sysRowState: sysRowState.add,
348
+ attach: res.content
349
+ }
350
+ let tempField
351
+ for (let i = 0; i < this.cols.length; i++) {
352
+ // 赋值关联字段数据
353
+ let tempValue = addRow
354
+ tempField = this.cols[i].field
355
+ if (this.cols[i].isAuto) {
356
+ tempValue[tempField] = this.$store.getters.newId() + ''
357
+ continue
358
+ }
359
+ if (
360
+ this.cols[i].controlType === 'text' &&
361
+ this.cols[i].linkValueField !== null &&
362
+ this.cols[i].linkValueField !== '' &&
363
+ this.cols[i].linkValueField !== undefined
364
+ ) {
365
+ tempValue[tempField] = this.formRow[this.cols[i].linkValueField]
366
+ }
367
+ }
368
+ this.internalRows.push(addRow)
369
+ // this.$emit('add', this.dataName, res.data)
370
+ },
371
+ beforeAvatarUpload(file) {
372
+ // const isPic = file.type === 'image/jpeg' || file.type === 'image/png'
373
+ if (file.size / 1024 / 1024 > this.limitSize) {
374
+ notification.error({
375
+ message: '错误',
376
+ description: '上传图片大小不能超过 ' + this.limitSize + 'MB!'
377
+ })
378
+ }
379
+ if (this.limitType.length > 0 && !this.limitType[file.type]) {
380
+ notification.error({
381
+ message: '错误',
382
+ description: '上传附件格式错误!'
383
+ })
384
+ }
385
+ return true
386
+ },
387
+ handleRemove(file, fileList) {
388
+ // this.dialogVisible = !this.dialogVisible
389
+ // alert(this.dialogVisible)
390
+ this.internalUrls = fileList
391
+ this.$emit('remove', this.dataName, file.response.data)
392
+ // this.$emit('remove', this.dataName, file.response.data)
393
+ },
394
+ circleAttach(attachFile, internalRow) {
395
+ let vm = this
396
+ // if(internalRow.isDefault == true){
397
+ this.internalRows.forEach(element => {
398
+ if (element.id !== internalRow.id) {
399
+ element.isDefault = false
400
+ }
401
+ })
402
+ // }
403
+ },
404
+ removeAttach(attachFile) {
405
+
406
+ for (let i = 0; i < this.internalRows.length; i++) {
407
+ if (this.internalRows[i].attachId === attachFile.id) {
408
+ if (this.internalRows[i].sysRowState === sysRowState.add) {
409
+ this.internalRows.splice(i, 1)
410
+ } else {
411
+ this.$set(this.internalRows[i], 'sysRowState', sysRowState.delete)
412
+ }
413
+ break
414
+ }
415
+ }
416
+ this.$emit('remove', attachFile.id)
417
+ },
418
+ downloadAttach(attachFile) {
419
+ window.open(this.internalServiceUrl + '/DownAttachFile/' + attachFile.id)
420
+ },
421
+ /**
422
+ * 查看附件
423
+ */
424
+ viewAttach(attachFile) {
425
+ if (attachFile.contentType === 'application/pdf') {
426
+ this.dialogImageUrl = `${this.internalServiceUrl}/GetAttachFile/${attachFile.id}?accessToken=${this.$store.getters.token}`
427
+ this.dialogViewType = attachFile.contentType
428
+ this.dialogVisible = true
429
+ } else if (attachFile.content === 'image') {
430
+ this.dialogImageUrl = `${this.internalServiceUrl}/GetAttachFile/${attachFile.id}?accessToken=${this.$store.getters.token}`
431
+ this.dialogViewType = attachFile.contentType
432
+ this.dialogVisible = true
433
+ }
434
+ },
435
+ closePdf() {
436
+ this.isShowPdf = false
437
+ },
438
+ // 放大
439
+ screenClick() {
440
+ this.isFullscreen = true
441
+ },
442
+ // 局部展示
443
+ narrowClick() {
444
+ this.isFullscreen = false
445
+ }
446
+ }
447
+ }
448
+ </script>
449
+
450
+ <style lang="scss" scoped>
451
+ .file-card {
452
+ display: flex;
453
+ flex-flow: row wrap;
454
+ margin: 0 0 5px 5px;
455
+
456
+ .attach-wrapper {
457
+ .attach {
458
+ position: relative;
459
+ margin-right: 5px;
460
+
461
+ .attach-delete {
462
+ position: absolute;
463
+ top: -2px;
464
+ right: -4px;
465
+ opacity: 0;
466
+ font-size: 20px;
467
+ background-color: red;
468
+ }
469
+
470
+ .attach-delete:hover {
471
+ cursor: pointer;
472
+ }
473
+
474
+ .attach-download {
475
+ position: absolute;
476
+ bottom: 10px;
477
+ left: 4px;
478
+ opacity: 0;
479
+ font-size: 18px;
480
+ font-weight: bolder;
481
+ border: 1px solid #ccc;
482
+ border-radius: 50%;
483
+ border-color: transparent;
484
+ //background-color: rgb(255, 1, 1);
485
+ color: #000;
486
+ }
487
+
488
+ .attach-download:hover {
489
+ cursor: pointer;
490
+ color: rgb(189, 8, 8);
491
+ }
492
+
493
+ .attach-view {
494
+ position: absolute;
495
+ bottom: 10px;
496
+ right: 4px;
497
+ opacity: 0;
498
+ font-size: 18px;
499
+ font-weight: bolder;
500
+ border: 1px solid #ccc;
501
+ border-radius: 50%;
502
+ border-color: transparent;
503
+ //background-color: #666;
504
+ color: #000;
505
+ }
506
+
507
+ .attach-circle {
508
+ position: absolute;
509
+ // bottom: 10px;
510
+ top: 2px;
511
+ left: 4px;
512
+ opacity: 0;
513
+ }
514
+
515
+ .attach-view:hover {
516
+ cursor: pointer;
517
+ color: rgb(189, 8, 8);
518
+ }
519
+ }
520
+
521
+ .attach:hover > .attach-delete {
522
+ opacity: 0.8;
523
+ }
524
+
525
+ .attach:hover > .attach-download {
526
+ opacity: 0.7;
527
+ }
528
+
529
+ .attach:hover > .attach-view {
530
+ opacity: 0.7;
531
+ }
532
+
533
+ .attach:hover > .attach-circle {
534
+ opacity: 0.9;
535
+ }
536
+ }
537
+ }
538
+
539
+ .avatar-uploader .el-upload {
540
+ border: 1px solid #d9d9d9;
541
+
542
+ border-radius: 6px;
543
+ cursor: pointer;
544
+ position: relative;
545
+ overflow: hidden;
546
+ }
547
+
548
+ .avatar-uploader .el-upload:hover {
549
+ border-color: #409eff;
550
+ }
551
+
552
+ .avatar-uploader-icon {
553
+ font-size: 28px;
554
+ color: #8c939d;
555
+ // width: 178px;
556
+ // height: 178px;
557
+ line-height: 178px;
558
+ text-align: center;
559
+ }
560
+
561
+ .avatar {
562
+ // width: 178px;
563
+ // height: 178px;
564
+ display: block;
565
+ }
566
+
567
+ .el-upload-list__item is-success {
568
+ float: left;
569
+ }
570
+
571
+ .el-icon-connection:hover {
572
+ color: white;
573
+ cursor: pointer;
574
+ }
575
+
576
+ .el-icon-full-screen:hover {
577
+ color: white;
578
+ cursor: pointer;
579
+ }
580
+ </style>
@@ -0,0 +1,8 @@
1
+ // 导入组件,组件必须声明 name
2
+ import BasePulldown from './src/index.vue';
3
+ // 为组件提供 install 安装方法,供按需引入
4
+ BasePulldown.install = function(Vue) {
5
+ Vue.component(BasePulldown.name, BasePulldown);
6
+ };
7
+ // 默认导出组件
8
+ export default BasePulldown;