bl-common-vue3 3.8.53 → 3.8.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bl-common-vue3",
3
- "version": "3.8.53",
3
+ "version": "3.8.55",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "description": "bailing vue3 common components lib",
@@ -3,140 +3,118 @@
3
3
  <a-card size="small">
4
4
  <template #title v-if="titles">
5
5
  <section class="file-title">
6
- <span class="mr-5">{{ t('AttachmentInfo.index.559728-0') }}</span>
7
- <template v-if="!showOption">
8
- (
9
- <a-breadcrumb>
10
- <a-breadcrumb-item
11
- class="crumb-item"
12
- v-for="(crumb, index) of crumbList"
13
- :key="crumb.key"
14
- @click="handleCrumbItemClick(crumb, index)"
15
- :class="crumb.key != currentCrumb.key ? 'active' : ''"
16
- >
17
- {{ crumb.title }}
18
- </a-breadcrumb-item>
19
- </a-breadcrumb>
20
- )
21
- </template>
6
+ <span class="mr-5">{{title || t('AttachmentInfo.index.559728-0')}}</span>
22
7
  </section>
23
8
  </template>
24
9
  <template #extra v-if="showOption">
25
- <a-dropdown :trigger="['click']" :disabled="disabled">
26
- <a-button>
27
- <template #icon>
28
- <PlusOutlined />
29
- </template>
30
- {{ t('AttachmentInfo.index.559728-1') }}
31
- </a-button>
32
- <template #overlay>
33
- <a-menu>
34
- <a-menu-item
35
- v-if="addfolder"
36
- key="new_folder"
37
- @click="addAttachment(1)"
38
- >
39
- <template #icon>
40
- <FolderAddOutlined></FolderAddOutlined>
41
- </template>
42
- {{ t('AttachmentInfo.index.559728-2') }}
43
- </a-menu-item>
44
- <a-menu-item
45
- v-if="batchupload"
46
- key="new_file"
47
- @click="addAttachment(3)"
48
- >
49
- <template #icon><UploadOutlined></UploadOutlined></template>
50
- <a-upload
51
- name="file"
52
- v-model:fileList="fileList"
53
- :action="$utils.fileAction"
54
- :headers="isOrg?{ 'org-token': $store.getters.token }:{'user-token': $store.getters.userToken}"
55
- multiple
56
- :showUploadList="false"
57
- accept=".doc,.docx,.pdf,.jpg,.jpeg,.png,.mp4,.mp3,.mov,.mpeg"
58
- :data="{ dir: 'org_contract_add_attachments' }"
59
- @change="handleChange"
60
- >
61
- {{ t('AttachmentInfo.index.559728-3') }}
62
- </a-upload>
63
- </a-menu-item>
64
- <a-menu-item
65
- v-if="mobileAnnexUpload"
66
- key="BlMobileAnnexUpload"
67
- >
68
- <BlMobileAnnexUpload
69
- :title="mobileAnnexUploadConfigInfo.title"
70
- :h5Domain="mobileAnnexUploadConfigInfo.h5Domain"
71
- :uploadConfig="mobileAnnexUploadConfigInfo.uploadConfig"
72
- :addRequest="mobileAnnexUploadConfigInfo.addRequest"
73
- @request="handleRequest"
74
- @handleCommit="handleAddSuccess">
75
- </BlMobileAnnexUpload>
76
- </a-menu-item>
77
- </a-menu>
78
- </template>
79
- </a-dropdown>
10
+ <AddAction
11
+ :disabled="disabled"
12
+ :addfolder="addfolder"
13
+ :batchupload="batchupload"
14
+ :attachParams="attachParams"
15
+ :serviceFrom="serviceFrom"
16
+ :parentId="0"
17
+ :annexAdd="annexAdd"
18
+ :typeFrom="typeFrom"
19
+ :isOrg="isOrg"
20
+ :id="id"
21
+ :staticPathes="staticPathes"
22
+ :fileAlias="fileAlias"
23
+ @getDataList="getDataList"
24
+ :mobileAnnexUpload="mobileAnnexUpload"
25
+ :mobileAnnexUploadConfig="mobileAnnexUploadConfig"
26
+ @handleRequest="handleRequest"
27
+ />
80
28
  </template>
81
29
  <a-table
82
- :dataSource="dataList"
83
- :columns="columns"
84
- rowKey="id"
85
- :loading="loading"
86
- :pagination="pagination"
87
- @change="handleTableChange"
88
- size="small"
89
- bordered
30
+ :defaultExpandAllRows="true"
31
+ :key="tableKey"
32
+ :dataSource="dataList"
33
+ :columns="columns"
34
+ rowKey="id"
35
+ :loading="loading"
36
+ :pagination="pagination"
37
+ @change="handleTableChange"
38
+ size="small"
39
+ bordered
90
40
  >
91
41
  <template #bodyCell="{ text, record, column }">
92
42
  <template v-if="column.key === 'name'">
93
- <div class="file-name" @click="handleNameClick(record)">
94
- <FolderOutlined v-if="record.annex_type == 1" />
95
- <FileOutlined v-if="record.annex_type == 2" />
43
+ <div class="file-name">
44
+ <FolderOutlined v-if="record.annex_type == 1"/>
45
+ <FileOutlined v-if="record.annex_type == 2"/>
96
46
  <span class="name">{{ text }}</span>
97
47
  </div>
98
48
  </template>
99
49
 
100
50
  <template v-if="column.key === 'action'">
101
- <a-tooltip>
51
+ <a-tooltip v-if="record.annex_type == 2">
102
52
  <template #title>{{ t('AttachmentInfo.index.559728-5') }}</template>
103
- <a-button type="link" @click="previewClick(record)">
53
+ <a-button
54
+ type="link"
55
+ :disabled="record.online_preview && !record.online_preview.previewUrl &&
56
+ record.online_preview.documentType !== 'pic'
57
+ "
58
+ @click="previewClick(record)"
59
+ >
104
60
  <template #icon>
105
- <EyeOutlined v-if="record.annex_type == 2" />
61
+ <EyeOutlined/>
106
62
  </template>
107
63
  </a-button>
108
64
  </a-tooltip>
109
- <a-space v-if="record.operate && record.operate.length">
65
+ <a-space v-if="record.operate && record.operate.length || (showOption && record.annex_type == 1)">
66
+ <AddAction
67
+ v-if="showOption && record.annex_type == 1"
68
+ :disabled="disabled"
69
+ :addfolder="addfolder"
70
+ :batchupload="batchupload"
71
+ :attachParams="{
72
+ ...attachParams,
73
+ parent_id: record.id,
74
+ }"
75
+ :parentId="record.id"
76
+ :serviceFrom="serviceFrom"
77
+ :annexAdd="annexAdd"
78
+ :typeFrom="typeFrom"
79
+ :isOrg="isOrg"
80
+ :id="id"
81
+ :fileAlias="fileAlias"
82
+ :staticPathes="staticPathes"
83
+ @getDataList="getDataList"
84
+ :mobileAnnexUpload="mobileAnnexUpload"
85
+ :mobileAnnexUploadConfig="mobileAnnexUploadConfig"
86
+ @handleRequest="handleRequest"
87
+ />
110
88
  <a-tooltip v-if="record.operate.includes('Topping')">
111
89
  <template #title>{{ t('AttachmentInfo.index.559728-6') }}</template>
112
90
  <a-button
113
91
  type="link"
114
- @click="fileToTop(record)"
92
+ @click="fileToTop(record.id)"
115
93
  :disabled="disabled"
116
94
  >
117
95
  <template #icon>
118
- <ToTopOutlined />
96
+ <ToTopOutlined/>
119
97
  </template>
120
98
  </a-button>
121
99
  </a-tooltip>
122
100
  <a-tooltip v-if="record.operate.includes('Download')">
123
101
  <template #title>{{ t('AttachmentInfo.index.559728-7') }}</template>
124
- <a-button type="link" @click="downloadFile(record.file_path, record.name)">
102
+ <a-button type="link" @click="downloadFile(record.file_path)">
125
103
  <template #icon>
126
- <DownloadOutlined />
104
+ <DownloadOutlined/>
127
105
  </template>
128
106
  </a-button>
129
107
  </a-tooltip>
130
108
  <a-tooltip v-if="showOption && record.operate.includes('Delete')">
131
- <template #title>{{t('common.button.delete')}}</template>
109
+ <template #title>{{ t('common.button.delete') }}</template>
132
110
  <a-button
133
111
  type="link"
134
112
  danger
135
- @click="deleteFile(text)"
113
+ @click="deleteFile(record.id)"
136
114
  :disabled="disabled"
137
115
  >
138
116
  <template #icon>
139
- <DeleteOutlined />
117
+ <DeleteOutlined/>
140
118
  </template>
141
119
  </a-button>
142
120
  </a-tooltip>
@@ -146,33 +124,12 @@
146
124
  </template>
147
125
  </a-table>
148
126
  </a-card>
149
- <add-attachments
150
- :params="addParams"
151
- :visible="addVisible"
152
- :fileAlias="fileAlias"
153
- :id="id"
154
- @cancel="addVisible = false"
155
- @success="handleAddSuccess"
156
- @request="handleRequest"
157
- />
158
-
159
- <MultipleAddAttachments
160
- :visible="multiAddVisible"
161
- :file-list="fileList"
162
- :fileAlias="fileAlias"
163
- :id="id"
164
- @handleCancel="handleCancel"
165
- :params="addParams"
166
- @handleCommit="handleAddSuccess"
167
- @request="handleRequest"
168
- />
169
127
  </section>
170
128
  </template>
171
129
 
172
130
  <script>
173
- import { defineComponent, ref, watch, computed, createVNode } from "vue";
131
+ import { defineComponent, ref, watch, computed, createVNode, nextTick } from "vue";
174
132
  import {
175
- PlusOutlined,
176
133
  ToTopOutlined,
177
134
  FolderOutlined,
178
135
  FileOutlined,
@@ -180,17 +137,12 @@ import {
180
137
  DeleteOutlined,
181
138
  EyeOutlined,
182
139
  ExclamationCircleOutlined,
183
- FolderAddOutlined,
184
- UploadOutlined
185
140
  } from "@ant-design/icons-vue";
186
- import addAttachments from "./modules/AddAttachments.vue";
187
141
  import utils from "../../common/utils/util";
188
142
  import {
189
143
  message,
190
144
  Modal,
191
145
  Card,
192
- Breadcrumb,
193
- BreadcrumbItem,
194
146
  Dropdown,
195
147
  Menu,
196
148
  MenuItem,
@@ -200,36 +152,23 @@ import {
200
152
  Button,
201
153
  Space,
202
154
  } from "ant-design-vue";
203
- import MultipleAddAttachments from "./modules/MultipleAddAttachments.vue";
204
155
  import {t, loadLanguageAsync} from "../../locale";
205
- import BlMobileAnnexUpload from "../BlMobileAnnexUpload/index.vue";
156
+ import AddAction from "./modules/AddAction.vue";
206
157
  export default defineComponent({
207
158
  name: "ContractAttachmentInfo",
208
159
  components: {
209
- PlusOutlined,
210
160
  ToTopOutlined,
211
161
  FolderOutlined,
212
162
  FileOutlined,
213
- addAttachments,
214
163
  DownloadOutlined,
215
164
  DeleteOutlined,
216
165
  EyeOutlined,
217
- MultipleAddAttachments,
218
-
166
+ AddAction,
219
167
  "a-card": Card,
220
- "a-breadcrumb": Breadcrumb,
221
- "a-breadcrumb-item": BreadcrumbItem,
222
- "a-dropdown": Dropdown,
223
- "a-menu": Menu,
224
- "a-menu-item": MenuItem,
225
- "a-upload": Upload,
226
168
  "a-table": Table,
227
169
  "a-tooltip": Tooltip,
228
170
  "a-button": Button,
229
171
  "a-space": Space,
230
- FolderAddOutlined,
231
- UploadOutlined,
232
- BlMobileAnnexUpload
233
172
  },
234
173
  props: {
235
174
  active: {
@@ -301,6 +240,10 @@ export default defineComponent({
301
240
  type: Boolean,
302
241
  default: true,
303
242
  },
243
+ title: {
244
+ type: String,
245
+ default: '',
246
+ },
304
247
  titles: {
305
248
  type: Boolean,
306
249
  default: true,
@@ -342,45 +285,29 @@ export default defineComponent({
342
285
  isOrg:{
343
286
  type: Boolean,
344
287
  default: true,
345
- }
288
+ },
289
+ typeFrom: {
290
+ type: String,
291
+ default: "",
292
+ },
293
+ staticPathes: {
294
+ type: String,
295
+ default: "",
296
+ },
346
297
  },
347
298
  setup(props, context) {
348
299
  const homeCrumb = { key: "home", parentId: 0, title: t('AttachmentInfo.index.559728-8') };
349
300
  const crumbList = ref([homeCrumb]);
350
301
  const currentCrumb = ref(homeCrumb);
351
- // 点击面包屑
352
- const handleCrumbItemClick = (crumb, index) => {
353
- if (currentCrumb.value.key == crumb.key) {
354
- return;
355
- }
356
- currentCrumb.value = crumb;
357
- crumbList.value.splice(index + 1, crumbList.value.length - index - 1);
358
- getDataList();
359
- };
360
-
361
- // 点击进入文件夹
362
- const handleNameClick = (record) => {
363
- if (record.annex_type == 1) {
364
- let item = {
365
- key: "sub_" + record.id,
366
- parentId: record.id,
367
- title: record.name,
368
- };
369
- crumbList.value.push(item);
370
- currentCrumb.value = item;
371
- getDataList();
372
- }
373
- };
302
+ let attachParams = {};
374
303
 
375
304
  // 添加文件、文件夹
376
305
  const addVisible = ref(false);
377
306
  //批量上传
378
307
  const multiAddVisible = ref(false);
379
- const fileList = ref([]);
380
308
 
381
309
  const successIds = ref([]);
382
310
  const handleAddSuccess = ({ data }) => {
383
- fileList.value = [];
384
311
  multiAddVisible.value = false;
385
312
  addVisible.value = false;
386
313
  page.value = 1;
@@ -402,16 +329,6 @@ export default defineComponent({
402
329
  }
403
330
  };
404
331
 
405
- const handleChange = (info) => {
406
- fileList.value = info.fileList;
407
- multiAddVisible.value = true;
408
- console.log(fileList.value);
409
- };
410
- const handleCancel = () => {
411
- fileList.value = [];
412
- multiAddVisible.value = false;
413
- };
414
-
415
332
  // 附件列表
416
333
  const page = ref(1);
417
334
  const limit = ref(20);
@@ -426,28 +343,24 @@ export default defineComponent({
426
343
  const handleTableChange = (pager) => {
427
344
  page.value = pager.current;
428
345
  limit.value = pager.pageSize;
346
+ getDataList();
429
347
  };
430
348
  watch([page, limit], () => {
431
349
  getDataList();
432
350
  });
433
351
  const addParams = ref({});
434
352
  const dataList = ref([]);
435
-
436
353
  const filters = ref([]);
437
354
 
438
355
  // const fis
439
- const getDataList = () => {
356
+ const getDataList = (init) => {
357
+ if (init) {
358
+ page.value = 1;
359
+ }
440
360
  let params = {
441
361
  page: page.value,
442
362
  pageSize: limit.value,
443
363
  };
444
- if (!filters.value.find((item) => item.field == "parent_id")) {
445
- filters.value.push({
446
- field: "parent_id",
447
- type: "equal",
448
- value: currentCrumb.value.parentId,
449
- });
450
- }
451
364
 
452
365
  if (props.id) {
453
366
  if (!filters.value.find((item) => item.field == "business_id")) {
@@ -475,9 +388,6 @@ export default defineComponent({
475
388
  });
476
389
  }
477
390
  filters.value.forEach((item) => {
478
- if (item.field == "parent_id") {
479
- item.value = currentCrumb.value.parentId;
480
- }
481
391
  if (item.field == "id") {
482
392
  item.value = successIds.value;
483
393
  }
@@ -499,12 +409,16 @@ export default defineComponent({
499
409
  },
500
410
  },
501
411
  success: (res) => {
412
+ dataList.value = []
502
413
  dataList.value = res.list;
503
414
  let ids = res.list.map((item) => item.id);
504
415
  if (!successIds.value.length) {
505
416
  successIds.value = ids;
506
417
  }
507
418
  total.value = res.total;
419
+ nextTick(() => {
420
+ getPicList(dataList.value)
421
+ })
508
422
  context.emit(
509
423
  "annexNumChange",
510
424
  dataList.value.length,
@@ -513,8 +427,16 @@ export default defineComponent({
513
427
  });
514
428
  };
515
429
 
430
+ const getPicList = (list) => {
431
+ list.forEach((v) => {
432
+ if (v?.children?.length) {
433
+ getPicList(v.children);
434
+ }
435
+ });
436
+ };
437
+
516
438
  // 文件置顶
517
- const fileToTop = (record) => {
439
+ const fileToTop = (id) => {
518
440
  const params = {
519
441
  needMsg: true,
520
442
  };
@@ -526,7 +448,7 @@ export default defineComponent({
526
448
  params: {
527
449
  method: "put",
528
450
  server: `${props.serviceFrom}`,
529
- url: `${props.annexTopFrom}/${record.id}`,
451
+ url: `${props.annexTopFrom}/${id}`,
530
452
  extra: params,
531
453
  },
532
454
  success: (res) => {
@@ -599,8 +521,6 @@ export default defineComponent({
599
521
  const randomStr = utils.getRandomUid(18);
600
522
  let loaded = false;
601
523
 
602
- let attachParams = {};
603
-
604
524
  // 在线预览
605
525
  const imgVisible = ref(false);
606
526
  const imgList = ref([]);
@@ -648,6 +568,9 @@ export default defineComponent({
648
568
  if (!attachParams.object_id) {
649
569
  attachParams.object_id = randomStr;
650
570
  }
571
+ if(props.typeFrom){
572
+ attachParams.typeFrom = props.typeFrom;
573
+ }
651
574
  console.log("attachParams", attachParams);
652
575
  getDataList();
653
576
  loaded = true;
@@ -688,13 +611,16 @@ export default defineComponent({
688
611
  },
689
612
  {
690
613
  title: t('AttachmentInfo.index.559728-14'),
691
- dataIndex: "operate_name",
692
- key: "operate_name",
614
+ dataIndex: "operate_user",
615
+ key: "operate_user",
693
616
  },
694
617
  {
695
618
  title: t('AttachmentInfo.index.559728-15'),
696
619
  dataIndex: "operate_time",
697
620
  key: "operate_time",
621
+ customRender: ({record}) => {
622
+ return utils.i18nTypeShow(record,'date','operate_time') || '--'
623
+ }
698
624
  },
699
625
  {
700
626
  title: t('common.table.operation'),
@@ -715,21 +641,8 @@ export default defineComponent({
715
641
  const mobileAnnexUploadConfigInfo = computed(() => {
716
642
  return {
717
643
  title: props.mobileAnnexUploadConfig?.title || "",
718
- h5Domain: props.mobileAnnexUploadConfig?.h5Domain || location.origin,
644
+ h5Domain: props.mobileAnnexUploadConfig?.h5Domain || location.origin || props.staticPathes,
719
645
  uploadConfig: props.mobileAnnexUploadConfig?.uploadConfig || {},
720
- addRequest: {
721
- extra: {
722
- objectId: attachParams.object_id,
723
- annex_type: 2,
724
- parent_id: currentCrumb.value.parentId,
725
- ...attachParams,
726
- id: props.id,
727
- alias: props.fileAlias,
728
- },
729
- server: props.serviceFrom,
730
- url: props.annexAdd,
731
- method: 'post'
732
- }
733
646
  }
734
647
  })
735
648
 
@@ -744,8 +657,6 @@ export default defineComponent({
744
657
  loading,
745
658
  loaded,
746
659
  addParams,
747
- handleCrumbItemClick,
748
- handleNameClick,
749
660
  handleAddSuccess,
750
661
  addAttachment,
751
662
  handleTableChange,
@@ -757,14 +668,14 @@ export default defineComponent({
757
668
 
758
669
  imgList,
759
670
  imgVisible,
760
- handleChange,
761
671
  multiAddVisible,
762
- fileList,
763
- handleCancel,
764
672
  handleRequest,
765
673
 
766
674
  getAnnexEdit,
767
- mobileAnnexUploadConfigInfo
675
+ mobileAnnexUploadConfigInfo,
676
+ getDataList,
677
+ getPicList,
678
+ attachParams,
768
679
  };
769
680
  },
770
681
  });
@@ -779,7 +690,6 @@ export default defineComponent({
779
690
  .crumb-item {
780
691
  padding: 0 4px;
781
692
  cursor: pointer;
782
- color: rgba(0, 0, 0, 0.45);
783
693
  }
784
694
 
785
695
  .active {
@@ -788,9 +698,7 @@ export default defineComponent({
788
698
  }
789
699
 
790
700
  .file-name {
791
- font-size: 12px;
792
- color: @primary-color;
793
- cursor: pointer;
701
+ font-size: inherit;
794
702
 
795
703
  .name {
796
704
  margin-left: 8px;