@cmstops/pro-compo 0.1.3 → 0.1.5

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 (132) hide show
  1. package/dist/index.css +120 -4
  2. package/dist/index.min.css +1 -1
  3. package/es/appCenter/component.js +2 -1
  4. package/es/config.d.ts +2 -0
  5. package/es/config.js +3 -0
  6. package/es/contentModal/component.d.ts +0 -0
  7. package/es/contentModal/component.js +175 -0
  8. package/es/contentModal/components/CompoList/CompoFilter/index.d.ts +0 -0
  9. package/es/contentModal/components/CompoList/CompoFilter/index.js +103 -0
  10. package/es/contentModal/components/CompoList/index.d.ts +0 -0
  11. package/es/contentModal/components/CompoList/index.js +234 -0
  12. package/es/contentModal/components/ViewAllColumn/MediaFilter/index.d.ts +0 -0
  13. package/es/contentModal/components/ViewAllColumn/MediaFilter/index.js +44 -0
  14. package/es/contentModal/components/ViewAllColumn/columnTree/index.d.ts +0 -0
  15. package/es/contentModal/components/ViewAllColumn/columnTree/index.js +101 -0
  16. package/es/contentModal/components/ViewAllColumn/index.d.ts +0 -0
  17. package/es/contentModal/components/ViewAllColumn/index.js +277 -0
  18. package/es/contentModal/components/storeBox/index.d.ts +0 -0
  19. package/es/contentModal/components/storeBox/index.js +107 -0
  20. package/es/contentModal/index.d.ts +2 -0
  21. package/es/contentModal/index.js +7 -0
  22. package/es/contentModal/script/api.d.ts +10 -0
  23. package/es/contentModal/script/api.js +45 -0
  24. package/es/contentModal/style/MediaFilter.less +8 -0
  25. package/es/contentModal/style/ViewAllColumn.less +33 -0
  26. package/es/contentModal/style/columnTree.less +9 -0
  27. package/es/contentModal/style/index.css +107 -0
  28. package/es/contentModal/style/index.less +19 -0
  29. package/es/contentModal/style/storeBox.less +45 -0
  30. package/es/hooks/batch.d.ts +8 -0
  31. package/es/hooks/batch.js +26 -0
  32. package/es/hooks/user.d.ts +11 -0
  33. package/es/hooks/user.js +46 -0
  34. package/es/index.css +120 -4
  35. package/es/index.d.ts +4 -1
  36. package/es/index.js +4 -1
  37. package/es/index.less +4 -1
  38. package/es/messageBox/component.js +2 -1
  39. package/es/messageBox/list.js +4 -4
  40. package/es/resourceModal/component.d.ts +0 -0
  41. package/es/resourceModal/component.js +14 -0
  42. package/es/resourceModal/index.d.ts +2 -0
  43. package/es/resourceModal/index.js +7 -0
  44. package/es/resourceModal/style/css.js +1 -0
  45. package/es/resourceModal/style/index.d.ts +1 -0
  46. package/es/resourceModal/style/index.js +1 -0
  47. package/es/style.css +5 -0
  48. package/es/typeIcons/component.d.ts +0 -0
  49. package/es/typeIcons/component.js +62 -0
  50. package/es/typeIcons/index.d.ts +2 -0
  51. package/es/typeIcons/index.js +7 -0
  52. package/es/typeIcons/style/css.js +1 -0
  53. package/es/typeIcons/style/index.css +5 -0
  54. package/es/typeIcons/style/index.d.ts +1 -0
  55. package/es/typeIcons/style/index.js +1 -0
  56. package/es/typeIcons/style/index.less +5 -0
  57. package/es/uploadStep/component.d.ts +0 -0
  58. package/es/uploadStep/component.js +14 -0
  59. package/es/uploadStep/index.d.ts +2 -0
  60. package/es/uploadStep/index.js +7 -0
  61. package/es/uploadStep/style/css.js +1 -0
  62. package/es/uploadStep/style/index.d.ts +1 -0
  63. package/es/uploadStep/style/index.js +1 -0
  64. package/es/userAvater/component.js +3 -3
  65. package/es/utils/index.d.ts +1 -0
  66. package/es/utils/index.js +7 -0
  67. package/es/utils/request.js +3 -4
  68. package/es/utils/typeMap.d.ts +116 -0
  69. package/es/utils/typeMap.js +22 -0
  70. package/lib/appCenter/component.js +2 -1
  71. package/lib/config.js +6 -0
  72. package/lib/contentModal/component.js +176 -0
  73. package/lib/contentModal/components/CompoList/CompoFilter/index.js +104 -0
  74. package/lib/contentModal/components/CompoList/index.js +235 -0
  75. package/lib/contentModal/components/ViewAllColumn/MediaFilter/index.js +45 -0
  76. package/lib/contentModal/components/ViewAllColumn/columnTree/index.js +102 -0
  77. package/lib/contentModal/components/ViewAllColumn/index.js +278 -0
  78. package/lib/contentModal/components/storeBox/index.js +108 -0
  79. package/lib/contentModal/index.js +8 -0
  80. package/lib/contentModal/script/api.js +52 -0
  81. package/lib/contentModal/style/MediaFilter.less +8 -0
  82. package/lib/contentModal/style/ViewAllColumn.less +33 -0
  83. package/lib/contentModal/style/columnTree.less +9 -0
  84. package/lib/contentModal/style/index.css +107 -0
  85. package/lib/contentModal/style/index.less +19 -0
  86. package/lib/contentModal/style/storeBox.less +45 -0
  87. package/lib/hooks/batch.js +27 -0
  88. package/lib/hooks/user.js +49 -0
  89. package/lib/index.css +120 -4
  90. package/lib/index.js +14 -8
  91. package/lib/index.less +4 -1
  92. package/lib/messageBox/component.js +2 -1
  93. package/lib/messageBox/list.js +4 -4
  94. package/lib/resourceModal/component.js +15 -0
  95. package/lib/resourceModal/index.js +8 -0
  96. package/lib/resourceModal/style/css.js +2 -0
  97. package/lib/resourceModal/style/index.css +4 -0
  98. package/lib/resourceModal/style/index.js +2 -0
  99. package/lib/resourceModal/style/index.less +4 -0
  100. package/lib/typeIcons/component.js +63 -0
  101. package/lib/{button → typeIcons}/index.js +2 -2
  102. package/lib/typeIcons/style/css.js +2 -0
  103. package/lib/typeIcons/style/index.css +5 -0
  104. package/lib/typeIcons/style/index.js +2 -0
  105. package/lib/typeIcons/style/index.less +5 -0
  106. package/lib/uploadStep/component.js +15 -0
  107. package/lib/uploadStep/index.js +8 -0
  108. package/lib/uploadStep/style/css.js +2 -0
  109. package/lib/uploadStep/style/index.css +4 -0
  110. package/lib/uploadStep/style/index.js +2 -0
  111. package/lib/uploadStep/style/index.less +4 -0
  112. package/lib/userAvater/component.js +3 -3
  113. package/lib/utils/index.js +13 -0
  114. package/lib/utils/request.js +3 -4
  115. package/lib/utils/typeMap.js +25 -0
  116. package/package.json +4 -2
  117. package/es/_virtual/plugin-vue_export-helper.js +0 -7
  118. package/es/button/component.d.ts +0 -24
  119. package/es/button/component.js +0 -43
  120. package/es/button/index.d.ts +0 -103
  121. package/es/button/index.js +0 -7
  122. package/lib/_virtual/plugin-vue_export-helper.js +0 -8
  123. package/lib/button/component.js +0 -44
  124. /package/es/{button → contentModal}/style/css.js +0 -0
  125. /package/es/{button → contentModal}/style/index.d.ts +0 -0
  126. /package/es/{button → contentModal}/style/index.js +0 -0
  127. /package/es/{button → resourceModal}/style/index.css +0 -0
  128. /package/es/{button → resourceModal}/style/index.less +0 -0
  129. /package/{lib/button → es/uploadStep}/style/index.css +0 -0
  130. /package/{lib/button → es/uploadStep}/style/index.less +0 -0
  131. /package/lib/{button → contentModal}/style/css.js +0 -0
  132. /package/lib/{button → contentModal}/style/index.js +0 -0
@@ -0,0 +1,234 @@
1
+ import { defineComponent, ref, computed, watch, onMounted, openBlock, createElementBlock, createVNode, createElementVNode, unref, withCtx, withModifiers, createBlock, toDisplayString, renderSlot } from "vue";
2
+ import { Table, Checkbox } from "@arco-design/web-vue";
3
+ import _sfc_main$2 from "../../../typeIcons/component.js";
4
+ import _sfc_main$1 from "./CompoFilter/index.js";
5
+ import useTableBatch from "../../../hooks/batch.js";
6
+ import { searchMlists, getCategorylistsGroups } from "../../script/api.js";
7
+ import { compoColumnsMap } from "../../../utils/typeMap.js";
8
+ import { dateYYYYDDMMHHmm } from "../../../utils/index.js";
9
+ const _hoisted_1 = { class: "view-all-column-container" };
10
+ const _hoisted_2 = { class: "content-table-view" };
11
+ const _hoisted_3 = { class: "title-span" };
12
+ const _hoisted_4 = ["onClick"];
13
+ const _hoisted_5 = { class: "title" };
14
+ const _hoisted_6 = { class: "bottom-view" };
15
+ const _hoisted_7 = { class: "left" };
16
+ const _sfc_main = defineComponent({
17
+ ...{ name: "CompoList" },
18
+ __name: "index",
19
+ props: {
20
+ maxSelect: {},
21
+ defaultSelectedData: {},
22
+ typeData: {},
23
+ userInfo: {}
24
+ },
25
+ emits: ["change"],
26
+ setup(__props, { emit }) {
27
+ const props = __props;
28
+ const columnIdMap = compoColumnsMap();
29
+ const _maxSelect = props.maxSelect || 100;
30
+ const selectedData = ref([]);
31
+ const tempSelectedData = computed(() => {
32
+ return props.defaultSelectedData || [];
33
+ });
34
+ watch(
35
+ () => tempSelectedData.value,
36
+ (val) => {
37
+ selectedData.value = val;
38
+ }
39
+ );
40
+ const {
41
+ isItemChecked,
42
+ hoverBatchBox,
43
+ tableCellMouseEnter,
44
+ tableCellMouseLeave
45
+ } = useTableBatch();
46
+ const clickCheckbox = (e, record) => {
47
+ e.stopPropagation();
48
+ e.preventDefault();
49
+ selectData(record);
50
+ };
51
+ const selectTableCell = (record) => {
52
+ selectData(record);
53
+ };
54
+ const selectData = (record) => {
55
+ addDataToSelectedList(record);
56
+ };
57
+ const addDataToSelectedList = async (record) => {
58
+ const index = selectedData.value.findIndex((v) => v.id === record.id);
59
+ if (selectedData.value.length < _maxSelect) {
60
+ if (index === -1) {
61
+ selectedData.value.push(record);
62
+ } else {
63
+ selectedData.value.splice(index, 1);
64
+ }
65
+ emitChange();
66
+ } else {
67
+ if (index === -1) {
68
+ selectedData.value.splice(selectedData.value.length - 1, 1);
69
+ selectedData.value.push(record);
70
+ } else {
71
+ selectedData.value.splice(index, 1);
72
+ }
73
+ emitChange();
74
+ }
75
+ };
76
+ const emitChange = () => {
77
+ emit("change", selectedData.value);
78
+ };
79
+ const group_id = ref("all");
80
+ const groupData = ref([]);
81
+ const scrollPercent = { y: "100%" };
82
+ const search = (_filter) => {
83
+ if (_filter.keyword || _filter.columns) {
84
+ filter.value = { ..._filter };
85
+ } else {
86
+ filter.value = null;
87
+ }
88
+ loadData();
89
+ };
90
+ watch(
91
+ () => group_id.value,
92
+ () => {
93
+ loadData();
94
+ }
95
+ );
96
+ const columns = [
97
+ {
98
+ title: "\u7EC4\u4EF6\u6807\u9898",
99
+ dataIndex: "title",
100
+ slotName: "title"
101
+ },
102
+ {
103
+ title: "\u7EC4\u4EF6\u7C7B\u578B",
104
+ dataIndex: "type",
105
+ slotName: "type"
106
+ },
107
+ {
108
+ title: "\u53D1\u5E03\u65F6\u95F4",
109
+ dataIndex: "pub_time",
110
+ slotName: "pub_time"
111
+ }
112
+ ];
113
+ const mediaFileData = ref([]);
114
+ const filter = ref(null);
115
+ const dataLoading = ref(false);
116
+ const loadData = async () => {
117
+ const gid = group_id.value;
118
+ if (!gid)
119
+ return;
120
+ let params = {
121
+ rid: props.userInfo.repository_id,
122
+ state: 1,
123
+ group_type: 2
124
+ };
125
+ if (filter.value) {
126
+ params = { ...params, ...filter.value };
127
+ }
128
+ if (gid !== "all") {
129
+ params.gid = gid;
130
+ }
131
+ dataLoading.value = true;
132
+ const { code, message } = await searchMlists(props.userInfo.BASE_API, params);
133
+ dataLoading.value = false;
134
+ if (code === 0) {
135
+ mediaFileData.value = message.map((v) => {
136
+ v.catalog = "contentList";
137
+ v.channel_type = 1;
138
+ v.target_id = v.id;
139
+ v.target_type = 6;
140
+ v.pub_time = dateYYYYDDMMHHmm(v.publish_at);
141
+ v.update_time = v.updated_at;
142
+ v.pub_user_alias = v.publish_user_alias;
143
+ v.creator_alias = v.creator_alias || v.author_alias;
144
+ v._type = 2;
145
+ return v;
146
+ }) || [];
147
+ }
148
+ };
149
+ const getGroupData = async () => {
150
+ const params = {
151
+ rid: props.userInfo.repository_id,
152
+ cid: props.userInfo.default_wap_channel_id,
153
+ group_type: 2,
154
+ less: true,
155
+ active: true,
156
+ limit: 500,
157
+ offset: 0
158
+ };
159
+ const { code, message } = await getCategorylistsGroups(
160
+ props.userInfo.BASE_API,
161
+ params
162
+ );
163
+ if (code === 0 && message) {
164
+ const { groups } = message;
165
+ groupData.value = groups.map((v) => {
166
+ v._type = 1;
167
+ v.catalog = "group";
168
+ return v;
169
+ });
170
+ loadData();
171
+ }
172
+ };
173
+ onMounted(() => {
174
+ getGroupData();
175
+ });
176
+ return (_ctx, _cache) => {
177
+ return openBlock(), createElementBlock("div", _hoisted_1, [
178
+ createVNode(_sfc_main$1, {
179
+ group_id: group_id.value,
180
+ "onUpdate:group_id": _cache[0] || (_cache[0] = ($event) => group_id.value = $event),
181
+ groups: groupData.value,
182
+ "user-info": props.userInfo,
183
+ onSearch: search
184
+ }, null, 8, ["group_id", "groups", "user-info"]),
185
+ createElementVNode("div", _hoisted_2, [
186
+ createVNode(unref(Table), {
187
+ columns,
188
+ scroll: scrollPercent,
189
+ pagination: false,
190
+ bordered: false,
191
+ data: mediaFileData.value,
192
+ loading: dataLoading.value,
193
+ onCellMouseEnter: unref(tableCellMouseEnter),
194
+ onCellMouseLeave: unref(tableCellMouseLeave),
195
+ onRowClick: selectTableCell
196
+ }, {
197
+ title: withCtx(({ record }) => [
198
+ createElementVNode("span", _hoisted_3, [
199
+ unref(hoverBatchBox)(selectedData.value, record) ? (openBlock(), createElementBlock("span", {
200
+ key: 0,
201
+ onClick: withModifiers(($event) => clickCheckbox($event, record), ["stop"])
202
+ }, [
203
+ createVNode(unref(Checkbox), {
204
+ class: "icon",
205
+ "model-value": unref(isItemChecked)(selectedData.value, record)
206
+ }, null, 8, ["model-value"])
207
+ ], 8, _hoisted_4)) : (openBlock(), createBlock(_sfc_main$2, {
208
+ key: 1,
209
+ class: "icon",
210
+ type: record.series
211
+ }, null, 8, ["type"])),
212
+ createElementVNode("span", _hoisted_5, toDisplayString(record.title || record.alias || "--"), 1)
213
+ ])
214
+ ]),
215
+ type: withCtx(({ record }) => [
216
+ createElementVNode("span", null, toDisplayString(unref(columnIdMap)[record.columns]), 1)
217
+ ]),
218
+ pub_time: withCtx(({ record }) => [
219
+ createElementVNode("span", null, toDisplayString(record.pub_time), 1)
220
+ ]),
221
+ _: 1
222
+ }, 8, ["data", "loading", "onCellMouseEnter", "onCellMouseLeave"])
223
+ ]),
224
+ createElementVNode("div", _hoisted_6, [
225
+ createElementVNode("div", _hoisted_7, [
226
+ renderSlot(_ctx.$slots, "store")
227
+ ]),
228
+ renderSlot(_ctx.$slots, "options")
229
+ ])
230
+ ]);
231
+ };
232
+ }
233
+ });
234
+ export { _sfc_main as default };
@@ -0,0 +1,44 @@
1
+ import { defineComponent, ref, watch, openBlock, createElementBlock, createVNode } from "vue";
2
+ import _sfc_main$1 from "../columnTree/index.js";
3
+ const _hoisted_1 = { class: "media-filter-container" };
4
+ const _sfc_main = defineComponent({
5
+ ...{ name: "MediaFilter" },
6
+ __name: "index",
7
+ props: {
8
+ group_id: {},
9
+ tree: {},
10
+ series: {},
11
+ banner: {},
12
+ height: {},
13
+ userInfo: {}
14
+ },
15
+ emits: ["update:group_id"],
16
+ setup(__props, { emit }) {
17
+ const props = __props;
18
+ const column_id = ref(0);
19
+ watch(
20
+ () => props.group_id,
21
+ (val) => {
22
+ column_id.value = val;
23
+ }
24
+ );
25
+ watch(
26
+ () => column_id.value,
27
+ (val) => {
28
+ emit("update:group_id", val);
29
+ }
30
+ );
31
+ return (_ctx, _cache) => {
32
+ return openBlock(), createElementBlock("div", _hoisted_1, [
33
+ createVNode(_sfc_main$1, {
34
+ column_id: column_id.value,
35
+ "onUpdate:column_id": _cache[0] || (_cache[0] = ($event) => column_id.value = $event),
36
+ height: props.height,
37
+ tree: props.tree,
38
+ "user-info": props.userInfo
39
+ }, null, 8, ["column_id", "height", "tree", "user-info"])
40
+ ]);
41
+ };
42
+ }
43
+ });
44
+ export { _sfc_main as default };
@@ -0,0 +1,101 @@
1
+ import { defineComponent, ref, watch, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, normalizeStyle, createTextVNode, toDisplayString } from "vue";
2
+ import { Popover, Scrollbar, Tree, Button } from "@arco-design/web-vue";
3
+ import { IconDragDotVertical, IconCaretRight } from "@arco-design/web-vue/es/icon";
4
+ import { getCategoryPath } from "../../../script/api.js";
5
+ const _hoisted_1 = { class: "column-selection-container" };
6
+ const _sfc_main = defineComponent({
7
+ ...{ name: "columnTree" },
8
+ __name: "index",
9
+ props: {
10
+ column_id: {},
11
+ tree: {},
12
+ height: {},
13
+ userInfo: {}
14
+ },
15
+ emits: ["update:column_id"],
16
+ setup(__props, { emit }) {
17
+ const props = __props;
18
+ const selectAlais = ref("");
19
+ const treeOptions = {
20
+ title: "alias",
21
+ isLeaf: "leaf"
22
+ };
23
+ watch(
24
+ () => props.column_id,
25
+ (val) => {
26
+ setSelectAlais(val);
27
+ }
28
+ );
29
+ const setSelectAlais = async (id) => {
30
+ if (id === "all") {
31
+ selectAlais.value = "\u5168\u90E8\u5185\u5BB9";
32
+ return;
33
+ }
34
+ const { code, message } = await getCategoryPath(props.userInfo.BASE_API, {
35
+ repo: props.userInfo.repository_id,
36
+ category: id
37
+ });
38
+ if (code === 0) {
39
+ const pathArr = [];
40
+ for (const i of message) {
41
+ pathArr.push(i.category_alias);
42
+ }
43
+ selectAlais.value = pathArr.join("/");
44
+ }
45
+ };
46
+ const AddColumnSelected = (selectedKeys, data) => {
47
+ emit("update:column_id", data.node.id);
48
+ };
49
+ return (_ctx, _cache) => {
50
+ return openBlock(), createElementBlock("div", _hoisted_1, [
51
+ createVNode(unref(Popover), {
52
+ position: "bottom",
53
+ "content-class": "column-selection-popover-content",
54
+ "content-style": { minWidth: "120px" },
55
+ trigger: "click"
56
+ }, {
57
+ content: withCtx(() => [
58
+ createElementVNode("div", {
59
+ class: "column-selection-main",
60
+ style: normalizeStyle({ minHeight: props.height + "px" })
61
+ }, [
62
+ createElementVNode("div", {
63
+ class: "column-v",
64
+ style: normalizeStyle({ height: props.height + "px" })
65
+ }, [
66
+ createVNode(unref(Scrollbar), {
67
+ "outer-class": "column-outer-scrollbar",
68
+ style: { "height": "100%", "overflow": "auto" }
69
+ }, {
70
+ default: withCtx(() => [
71
+ createVNode(unref(Tree), {
72
+ "block-node": "",
73
+ data: props.tree,
74
+ "check-strictly": "",
75
+ "default-expand-all": false,
76
+ "field-names": treeOptions,
77
+ onSelect: AddColumnSelected
78
+ }, null, 8, ["data"])
79
+ ]),
80
+ _: 1
81
+ })
82
+ ], 4)
83
+ ], 4)
84
+ ]),
85
+ default: withCtx(() => [
86
+ createVNode(unref(Button), { class: "button" }, {
87
+ default: withCtx(() => [
88
+ createVNode(unref(IconDragDotVertical)),
89
+ createTextVNode(toDisplayString(selectAlais.value), 1),
90
+ createVNode(unref(IconCaretRight))
91
+ ]),
92
+ _: 1
93
+ })
94
+ ]),
95
+ _: 1
96
+ })
97
+ ]);
98
+ };
99
+ }
100
+ });
101
+ export { _sfc_main as default };
@@ -0,0 +1,277 @@
1
+ import { defineComponent, ref, computed, watch, onMounted, openBlock, createElementBlock, createVNode, createElementVNode, unref, withCtx, withModifiers, createBlock, toDisplayString, renderSlot, withDirectives, vShow } from "vue";
2
+ import { Table, Checkbox, Pagination, Message } from "@arco-design/web-vue";
3
+ import _sfc_main$2 from "../../../typeIcons/component.js";
4
+ import _sfc_main$1 from "./MediaFilter/index.js";
5
+ import useTableBatch from "../../../hooks/batch.js";
6
+ import { getCategoryMediaNew, checkCommitFulfillment, getCategoryCategoriesTree } from "../../script/api.js";
7
+ const _hoisted_1 = { class: "view-all-column-container" };
8
+ const _hoisted_2 = { class: "content-table-view" };
9
+ const _hoisted_3 = { class: "title-span" };
10
+ const _hoisted_4 = ["onClick"];
11
+ const _hoisted_5 = { class: "title" };
12
+ const _hoisted_6 = { class: "bottom-view" };
13
+ const _hoisted_7 = { class: "left" };
14
+ const _sfc_main = defineComponent({
15
+ ...{ name: "ViewAllColumn" },
16
+ __name: "index",
17
+ props: {
18
+ maxSelect: {},
19
+ defaultSelectedData: {},
20
+ typeData: {},
21
+ series: {},
22
+ banner: {},
23
+ userInfo: {}
24
+ },
25
+ emits: ["change"],
26
+ setup(__props, { emit }) {
27
+ const props = __props;
28
+ const _maxSelect = props.maxSelect || 100;
29
+ const selectedData = ref([]);
30
+ const tempSelectedData = computed(() => {
31
+ return props.defaultSelectedData || [];
32
+ });
33
+ watch(
34
+ () => tempSelectedData.value,
35
+ (val) => {
36
+ selectedData.value = val;
37
+ }
38
+ );
39
+ const importantBanner = computed(() => {
40
+ return props.banner !== "all";
41
+ });
42
+ const {
43
+ isItemChecked,
44
+ hoverBatchBox,
45
+ tableCellMouseEnter,
46
+ tableCellMouseLeave
47
+ } = useTableBatch();
48
+ const clickCheckbox = (e, record) => {
49
+ e.stopPropagation();
50
+ e.preventDefault();
51
+ selectData(record);
52
+ };
53
+ const selectTableCell = (record) => {
54
+ selectData(record);
55
+ };
56
+ const selectData = (record) => {
57
+ if (importantBanner.value) {
58
+ const {
59
+ cover: { banner }
60
+ } = record;
61
+ if (!banner) {
62
+ return Message.warning({ content: "\u8BE5\u5185\u5BB9\u4E0D\u5177\u5907\u72EC\u7ACB\u8F6E\u64AD\u56FE" });
63
+ }
64
+ }
65
+ addDataToSelectedList(record);
66
+ };
67
+ const addDataToSelectedList = async (record) => {
68
+ const index = selectedData.value.findIndex((v) => v.id === record.id);
69
+ if (selectedData.value.length < _maxSelect) {
70
+ if (index === -1) {
71
+ if (await checkCommitFulfillment(props.userInfo.BASE_API, record)) {
72
+ selectedData.value.push(record);
73
+ }
74
+ } else {
75
+ selectedData.value.splice(index, 1);
76
+ }
77
+ emitChange();
78
+ } else {
79
+ if (index === -1) {
80
+ selectedData.value.splice(selectedData.value.length - 1, 1);
81
+ selectedData.value.push(record);
82
+ } else {
83
+ selectedData.value.splice(index, 1);
84
+ }
85
+ emitChange();
86
+ }
87
+ };
88
+ const emitChange = () => {
89
+ emit("change", selectedData.value);
90
+ };
91
+ const group_id = ref(0);
92
+ const categoryCascaderData = ref([]);
93
+ const listMinHeight = ref(0);
94
+ const scrollPercent = { y: "100%" };
95
+ const search = () => {
96
+ };
97
+ const pageChangeHandle = (index) => {
98
+ page.value.index = index;
99
+ loadData();
100
+ };
101
+ watch(
102
+ () => group_id.value,
103
+ () => {
104
+ page.value.index = 1;
105
+ loadData();
106
+ }
107
+ );
108
+ const loadColumnTreeNode = async () => {
109
+ const { code, message } = await getCategoryCategoriesTree(
110
+ props.userInfo.BASE_API,
111
+ { repo_id: props.userInfo.repository_id }
112
+ );
113
+ if (code === 0) {
114
+ const arr = [
115
+ { id: "all", alias: "\u5168\u90E8\u5185\u5BB9", children: [], leaf: true }
116
+ ].concat(message || []);
117
+ if (arr[0]) {
118
+ group_id.value = arr[0].id;
119
+ }
120
+ const styleLength = arr.length > 10 ? 10 : arr.length;
121
+ listMinHeight.value = (styleLength + 1) * 32;
122
+ categoryCascaderData.value = arr;
123
+ }
124
+ };
125
+ const page = ref({
126
+ index: 1,
127
+ size: 30,
128
+ total: 0
129
+ });
130
+ const columns = [
131
+ {
132
+ title: "\u6807\u9898",
133
+ dataIndex: "title",
134
+ slotName: "title"
135
+ },
136
+ {
137
+ title: "\u7C7B\u578B",
138
+ dataIndex: "series",
139
+ slotName: "series"
140
+ },
141
+ {
142
+ title: "\u7F16\u8F91",
143
+ dataIndex: "duty_editor",
144
+ slotName: "duty_editor"
145
+ },
146
+ {
147
+ title: "\u53D1\u5E03\u65F6\u95F4",
148
+ dataIndex: "pub_time",
149
+ slotName: "pub_time"
150
+ }
151
+ ];
152
+ const mediaFileData = ref([]);
153
+ const filter = ref(null);
154
+ const importantSeries = computed(() => {
155
+ return props.series !== "all";
156
+ });
157
+ const dataLoading = ref(false);
158
+ const loadData = async () => {
159
+ const dir_id = group_id.value;
160
+ if (!dir_id)
161
+ return;
162
+ const params = {
163
+ limit: page.value.size,
164
+ offset: page.value.size * (page.value.index - 1),
165
+ where: ["state:15|19"]
166
+ };
167
+ if (importantSeries.value) {
168
+ params.where.push(`series:${props.series.replace(/,/g, "|")}`);
169
+ }
170
+ if (dir_id !== "all") {
171
+ params.where.push(`category:${dir_id}`);
172
+ }
173
+ if (filter.value) {
174
+ const _filter = filter.value;
175
+ params.order = _filter.order;
176
+ params.sort = _filter.sort;
177
+ if (_filter.where) {
178
+ params.where = [...params.where, ..._filter.where];
179
+ }
180
+ }
181
+ params.where = params.where.join(",");
182
+ dataLoading.value = true;
183
+ const { code, message } = await getCategoryMediaNew(
184
+ props.userInfo.BASE_API,
185
+ params
186
+ );
187
+ dataLoading.value = false;
188
+ if (code === 0) {
189
+ mediaFileData.value = message.data.map((v) => {
190
+ v.catalog = "doc";
191
+ v.target_id = v.id;
192
+ v.target_type = 3;
193
+ v.pub_time = v.created_at;
194
+ v.update_time = v.updated_at;
195
+ v.pub_user_alias = v.author_alias;
196
+ return v;
197
+ }) || [];
198
+ page.value.total = message.total || message.count;
199
+ }
200
+ };
201
+ onMounted(() => {
202
+ loadColumnTreeNode();
203
+ loadData();
204
+ });
205
+ return (_ctx, _cache) => {
206
+ return openBlock(), createElementBlock("div", _hoisted_1, [
207
+ createVNode(_sfc_main$1, {
208
+ group_id: group_id.value,
209
+ "onUpdate:group_id": _cache[0] || (_cache[0] = ($event) => group_id.value = $event),
210
+ tree: categoryCascaderData.value,
211
+ series: props.series,
212
+ banner: _ctx.banner,
213
+ height: listMinHeight.value,
214
+ "user-info": props.userInfo,
215
+ onSearch: search
216
+ }, null, 8, ["group_id", "tree", "series", "banner", "height", "user-info"]),
217
+ createElementVNode("div", _hoisted_2, [
218
+ createVNode(unref(Table), {
219
+ columns,
220
+ scroll: scrollPercent,
221
+ pagination: false,
222
+ bordered: false,
223
+ data: mediaFileData.value,
224
+ onCellMouseEnter: unref(tableCellMouseEnter),
225
+ onCellMouseLeave: unref(tableCellMouseLeave),
226
+ onRowClick: selectTableCell
227
+ }, {
228
+ title: withCtx(({ record }) => [
229
+ createElementVNode("span", _hoisted_3, [
230
+ unref(hoverBatchBox)(selectedData.value, record) ? (openBlock(), createElementBlock("span", {
231
+ key: 0,
232
+ onClick: withModifiers(($event) => clickCheckbox($event, record), ["stop"])
233
+ }, [
234
+ createVNode(unref(Checkbox), {
235
+ class: "icon",
236
+ "model-value": unref(isItemChecked)(selectedData.value, record)
237
+ }, null, 8, ["model-value"])
238
+ ], 8, _hoisted_4)) : (openBlock(), createBlock(_sfc_main$2, {
239
+ key: 1,
240
+ class: "icon",
241
+ doc: "",
242
+ type: record.series
243
+ }, null, 8, ["type"])),
244
+ createElementVNode("span", _hoisted_5, toDisplayString(record.title || record.alias || "--"), 1)
245
+ ])
246
+ ]),
247
+ series: withCtx(({ record }) => [
248
+ createElementVNode("span", null, toDisplayString(record.series), 1)
249
+ ]),
250
+ duty_editor: withCtx(({ record }) => [
251
+ createElementVNode("span", null, toDisplayString(record.duty_editor || "--"), 1)
252
+ ]),
253
+ pub_time: withCtx(({ record }) => [
254
+ createElementVNode("span", null, toDisplayString(record.pub_time), 1)
255
+ ]),
256
+ _: 1
257
+ }, 8, ["data", "onCellMouseEnter", "onCellMouseLeave"])
258
+ ]),
259
+ createElementVNode("div", _hoisted_6, [
260
+ createElementVNode("div", _hoisted_7, [
261
+ renderSlot(_ctx.$slots, "store"),
262
+ withDirectives(createVNode(unref(Pagination), {
263
+ current: page.value.index,
264
+ "page-size": page.value.size,
265
+ total: page.value.total,
266
+ onChange: pageChangeHandle
267
+ }, null, 8, ["current", "page-size", "total"]), [
268
+ [vShow, mediaFileData.value.length > 0]
269
+ ])
270
+ ]),
271
+ renderSlot(_ctx.$slots, "options")
272
+ ])
273
+ ]);
274
+ };
275
+ }
276
+ });
277
+ export { _sfc_main as default };
File without changes