@cmstops/pro-compo 0.1.26 → 0.1.29

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 (97) hide show
  1. package/dist/index.css +100 -65
  2. package/dist/index.min.css +1 -1
  3. package/es/contentDetailList/components/Content/DocItem/index.js +1 -1
  4. package/es/contentDetailList/components/Content/DocMpItem/index.js +1 -1
  5. package/es/contentDetailList/components/Content/KongoNavItem/index.js +3 -3
  6. package/es/contentDetailList/components/Content/MaccountItem/index.js +30 -23
  7. package/es/contentDetailList/style/ComoItem.less +4 -0
  8. package/es/contentDetailList/style/ContentListItem.less +4 -0
  9. package/es/contentDetailList/style/DocItem.less +4 -6
  10. package/es/contentDetailList/style/DocMpItem.less +4 -6
  11. package/es/contentDetailList/style/KongoNavItem.less +4 -0
  12. package/es/contentDetailList/style/LiveItem.less +4 -0
  13. package/es/contentDetailList/style/MaccountItem.less +4 -0
  14. package/es/contentDetailList/style/index.css +28 -58
  15. package/es/contentDetailList/style/index.less +0 -1
  16. package/es/contentModal/component.js +165 -5
  17. package/es/contentModal/components/CompoList/index.js +13 -6
  18. package/es/contentModal/components/ContentList/MediaFilter/index.js +112 -0
  19. package/es/contentModal/components/ContentList/index.d.ts +0 -0
  20. package/es/contentModal/components/ContentList/index.js +269 -0
  21. package/es/contentModal/components/LiveList/MediaFilter/index.d.ts +0 -0
  22. package/es/contentModal/components/LiveList/MediaFilter/index.js +74 -0
  23. package/es/contentModal/components/LiveList/index.d.ts +0 -0
  24. package/es/contentModal/components/LiveList/index.js +227 -0
  25. package/es/contentModal/components/MpAccountList/MpAccountFilter/index.d.ts +0 -0
  26. package/es/contentModal/components/MpAccountList/MpAccountFilter/index.js +62 -0
  27. package/es/contentModal/components/MpAccountList/index.d.ts +0 -0
  28. package/es/contentModal/components/MpAccountList/index.js +222 -0
  29. package/es/contentModal/components/MpContentList/MediaFilter/index.d.ts +0 -0
  30. package/es/contentModal/components/MpContentList/MediaFilter/index.js +85 -0
  31. package/es/contentModal/components/MpContentList/index.d.ts +0 -0
  32. package/es/contentModal/components/MpContentList/index.js +214 -0
  33. package/es/contentModal/components/ViewAllColumn/MediaFilter/index.js +176 -12
  34. package/es/contentModal/components/ViewAllColumn/index.js +33 -14
  35. package/es/contentModal/images/user.js +2 -0
  36. package/es/contentModal/script/api.d.ts +3 -0
  37. package/es/contentModal/script/api.js +22 -1
  38. package/es/contentModal/style/ViewAllColumn.less +51 -31
  39. package/es/contentModal/style/index.css +21 -7
  40. package/es/dataTags/component.d.ts +0 -0
  41. package/es/{contentDetailList/components/DocTags/index.js → dataTags/component.js} +10 -8
  42. package/es/dataTags/index.d.ts +2 -0
  43. package/es/dataTags/index.js +7 -0
  44. package/es/dataTags/style/css.js +1 -0
  45. package/es/dataTags/style/index.css +51 -0
  46. package/es/dataTags/style/index.d.ts +1 -0
  47. package/es/dataTags/style/index.js +1 -0
  48. package/{lib/contentDetailList/style/DocTags.less → es/dataTags/style/index.less} +12 -8
  49. package/es/emptyData/component.js +5 -5
  50. package/es/index.css +100 -65
  51. package/es/index.d.ts +1 -0
  52. package/es/index.js +1 -0
  53. package/es/index.less +1 -0
  54. package/es/utils/typeMap.d.ts +6 -15
  55. package/es/utils/typeMap.js +21 -1
  56. package/lib/contentDetailList/components/Content/DocItem/index.js +4 -4
  57. package/lib/contentDetailList/components/Content/DocMpItem/index.js +2 -2
  58. package/lib/contentDetailList/components/Content/KongoNavItem/index.js +4 -4
  59. package/lib/contentDetailList/components/Content/MaccountItem/index.js +30 -23
  60. package/lib/contentDetailList/style/ComoItem.less +4 -0
  61. package/lib/contentDetailList/style/ContentListItem.less +4 -0
  62. package/lib/contentDetailList/style/DocItem.less +4 -6
  63. package/lib/contentDetailList/style/DocMpItem.less +4 -6
  64. package/lib/contentDetailList/style/KongoNavItem.less +4 -0
  65. package/lib/contentDetailList/style/LiveItem.less +4 -0
  66. package/lib/contentDetailList/style/MaccountItem.less +4 -0
  67. package/lib/contentDetailList/style/index.css +28 -58
  68. package/lib/contentDetailList/style/index.less +0 -1
  69. package/lib/contentModal/component.js +165 -5
  70. package/lib/contentModal/components/CompoList/index.js +15 -8
  71. package/lib/contentModal/components/ContentList/MediaFilter/index.js +113 -0
  72. package/lib/contentModal/components/ContentList/index.js +270 -0
  73. package/lib/contentModal/components/LiveList/MediaFilter/index.js +75 -0
  74. package/lib/contentModal/components/LiveList/index.js +228 -0
  75. package/lib/contentModal/components/MpAccountList/MpAccountFilter/index.js +63 -0
  76. package/lib/contentModal/components/MpAccountList/index.js +223 -0
  77. package/lib/contentModal/components/MpContentList/MediaFilter/index.js +86 -0
  78. package/lib/contentModal/components/MpContentList/index.js +215 -0
  79. package/lib/contentModal/components/ViewAllColumn/MediaFilter/index.js +175 -11
  80. package/lib/contentModal/components/ViewAllColumn/index.js +33 -14
  81. package/lib/contentModal/images/user.js +3 -0
  82. package/lib/contentModal/script/api.js +24 -0
  83. package/lib/contentModal/style/ViewAllColumn.less +51 -31
  84. package/lib/contentModal/style/index.css +21 -7
  85. package/lib/{contentDetailList/components/DocTags/index.js → dataTags/component.js} +10 -8
  86. package/lib/dataTags/index.js +8 -0
  87. package/lib/dataTags/style/css.js +2 -0
  88. package/lib/dataTags/style/index.css +51 -0
  89. package/lib/dataTags/style/index.js +2 -0
  90. package/{es/contentDetailList/style/DocTags.less → lib/dataTags/style/index.less} +12 -8
  91. package/lib/emptyData/component.js +4 -4
  92. package/lib/index.css +100 -65
  93. package/lib/index.js +2 -0
  94. package/lib/index.less +1 -0
  95. package/lib/utils/typeMap.js +22 -0
  96. package/package.json +1 -1
  97. /package/es/{contentDetailList/components/DocTags → contentModal/components/ContentList/MediaFilter}/index.d.ts +0 -0
@@ -0,0 +1,62 @@
1
+ import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createVNode, unref, withCtx, Fragment, renderList, createBlock } from "vue";
2
+ import { Space, Select, Option, Input } from "@arco-design/web-vue";
3
+ import { mp_type_map } from "../../../../utils/typeMap.js";
4
+ const _hoisted_1 = { class: "media-filter-container" };
5
+ const _sfc_main = defineComponent({
6
+ ...{ name: "MpAccountFilter" },
7
+ __name: "index",
8
+ emits: ["search"],
9
+ setup(__props, { emit }) {
10
+ const filter = ref({ mp_name: "", mp_type: "" });
11
+ const typeOptions = computed(() => {
12
+ const arr = Object.keys(mp_type_map).map((key) => {
13
+ return {
14
+ label: mp_type_map[key],
15
+ value: key
16
+ };
17
+ });
18
+ return [{ value: "", label: "\u5168\u90E8\u7C7B\u578B" }, ...arr];
19
+ });
20
+ const handleSearch = () => {
21
+ emit("search", filter.value);
22
+ };
23
+ watch(filter.value, () => {
24
+ handleSearch();
25
+ });
26
+ return (_ctx, _cache) => {
27
+ return openBlock(), createElementBlock("div", _hoisted_1, [
28
+ createVNode(unref(Space), { size: "large" }, {
29
+ default: withCtx(() => [
30
+ createVNode(unref(Select), {
31
+ modelValue: filter.value.mp_type,
32
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filter.value.mp_type = $event),
33
+ class: "filter-item",
34
+ placeholder: "\u8D26\u53F7\u7C7B\u578B"
35
+ }, {
36
+ default: withCtx(() => [
37
+ (openBlock(true), createElementBlock(Fragment, null, renderList(typeOptions.value, (item) => {
38
+ return openBlock(), createBlock(unref(Option), {
39
+ key: item.value,
40
+ label: item.label,
41
+ value: item.value
42
+ }, null, 8, ["label", "value"]);
43
+ }), 128))
44
+ ]),
45
+ _: 1
46
+ }, 8, ["modelValue"]),
47
+ createVNode(unref(Input), {
48
+ modelValue: filter.value.mp_name,
49
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => filter.value.mp_name = $event),
50
+ class: "filter-item",
51
+ "allow-clear": "",
52
+ placeholder: "\u8BF7\u8F93\u5165\u516C\u4F17\u53F7\u540D\u79F0",
53
+ onPressEnter: handleSearch
54
+ }, null, 8, ["modelValue"])
55
+ ]),
56
+ _: 1
57
+ })
58
+ ]);
59
+ };
60
+ }
61
+ });
62
+ export { _sfc_main as default };
@@ -0,0 +1,222 @@
1
+ import { defineComponent, ref, computed, watch, onMounted, openBlock, createElementBlock, createVNode, createElementVNode, unref, withCtx, withModifiers, createBlock, toDisplayString, renderSlot } from "vue";
2
+ import _imports_0 from "../../images/user.js";
3
+ import { Table, Checkbox, Message } from "@arco-design/web-vue";
4
+ import _sfc_main$2 from "../../../typeIcons/component.js";
5
+ import _sfc_main$1 from "./MpAccountFilter/index.js";
6
+ import useTableBatch from "../../../hooks/batch.js";
7
+ import { searchMpaccount } from "../../script/api.js";
8
+ import { key_target_type_map, mp_type_map } from "../../../utils/typeMap.js";
9
+ const _hoisted_1 = { class: "view-all-column-container" };
10
+ const _hoisted_2 = { class: "content-table-view" };
11
+ const _hoisted_3 = { class: "mp_title-span" };
12
+ const _hoisted_4 = ["onClick"];
13
+ const _hoisted_5 = { class: "title" };
14
+ const _hoisted_6 = ["src"];
15
+ const _hoisted_7 = {
16
+ key: 1,
17
+ class: "user-avatar",
18
+ src: _imports_0
19
+ };
20
+ const _hoisted_8 = { class: "bottom-view" };
21
+ const _hoisted_9 = { class: "left" };
22
+ const _sfc_main = defineComponent({
23
+ ...{ name: "MpAccountList" },
24
+ __name: "index",
25
+ props: {
26
+ maxSelect: {},
27
+ userInfo: {},
28
+ outsideSelectData: {},
29
+ defaultSelectedData: {}
30
+ },
31
+ emits: ["change"],
32
+ setup(__props, { emit }) {
33
+ const props = __props;
34
+ const _maxSelect = props.maxSelect || 100;
35
+ const selectedData = ref([]);
36
+ const group_id = ref("all");
37
+ const mediaFileData = ref([]);
38
+ const dataLoading = ref(false);
39
+ const page = ref({
40
+ index: 1,
41
+ size: 100,
42
+ total: 0
43
+ });
44
+ const filter = ref(null);
45
+ const scrollPercent = { y: "100%" };
46
+ const columns = [
47
+ { title: "\u516C\u4F17\u53F7\u540D\u79F0", dataIndex: "mp_name", slotName: "mp_name" },
48
+ { title: "\u5934\u50CF", dataIndex: "mp_logo", slotName: "mp_logo" },
49
+ { title: "\u8D26\u53F7\u7C7B\u578B", dataIndex: "mp_type", slotName: "mp_type" },
50
+ { title: "\u8FD0\u8425\u8005", dataIndex: "mp_user_name", slotName: "mp_user_name" },
51
+ { title: "\u6240\u5C5E\u9886\u57DF", dataIndex: "catalog_alias", slotName: "catalog_alias" }
52
+ ];
53
+ const tempSelectedData = computed(() => {
54
+ return props.defaultSelectedData || [];
55
+ });
56
+ watch(
57
+ () => tempSelectedData.value,
58
+ (val) => {
59
+ selectedData.value = val;
60
+ }
61
+ );
62
+ watch(
63
+ () => group_id.value,
64
+ () => {
65
+ loadData();
66
+ }
67
+ );
68
+ const search = (_filter) => {
69
+ if (_filter.mp_name || _filter.mp_type) {
70
+ filter.value = { ..._filter };
71
+ } else {
72
+ filter.value = null;
73
+ }
74
+ page.value.index = 1;
75
+ loadData();
76
+ };
77
+ const loadData = async () => {
78
+ const gid = group_id.value;
79
+ if (!gid)
80
+ return;
81
+ let params = {
82
+ limit: page.value.size,
83
+ offset: page.value.size * (page.value.index - 1)
84
+ };
85
+ if (filter.value) {
86
+ params = { ...params, ...filter.value };
87
+ }
88
+ if (gid !== "all") {
89
+ params.gid = gid;
90
+ }
91
+ dataLoading.value = true;
92
+ const { code, data } = await searchMpaccount(props.userInfo.BASE_API, params);
93
+ dataLoading.value = false;
94
+ if (code === 0) {
95
+ if (!data.data) {
96
+ mediaFileData.value = [];
97
+ } else {
98
+ mediaFileData.value = data.data.map((v) => {
99
+ v.target_id = v.uid;
100
+ v.target_type = 14;
101
+ v.catalog = key_target_type_map[v.target_type];
102
+ return v;
103
+ }) || [];
104
+ }
105
+ }
106
+ };
107
+ const clickCheckbox = (e, record) => {
108
+ e.stopPropagation();
109
+ e.preventDefault();
110
+ selectData(record);
111
+ };
112
+ const selectTableCell = (record) => {
113
+ selectData(record);
114
+ };
115
+ const selectData = (record) => {
116
+ if (checkSameAdd(record)) {
117
+ Message.warning({ content: "\u8BF7\u52FF\u6DFB\u52A0\u91CD\u590D\u6570\u636E", duration: 3e3 });
118
+ return;
119
+ }
120
+ addDataToSelectedList(record);
121
+ };
122
+ const checkSameAdd = (record) => {
123
+ const selected = props.outsideSelectData;
124
+ if (!selected.length)
125
+ return false;
126
+ return selected.map((row) => row.id).includes(record.id);
127
+ };
128
+ const addDataToSelectedList = async (record) => {
129
+ const index = selectedData.value.findIndex((v) => v.id === record.id);
130
+ if (selectedData.value.length < _maxSelect) {
131
+ if (index === -1) {
132
+ selectedData.value.push(record);
133
+ } else {
134
+ selectedData.value.splice(index, 1);
135
+ }
136
+ emitChange();
137
+ } else {
138
+ if (index === -1) {
139
+ selectedData.value.splice(selectedData.value.length - 1, 1);
140
+ selectedData.value.push(record);
141
+ } else {
142
+ selectedData.value.splice(index, 1);
143
+ }
144
+ Message.warning({ content: "\u5DF2\u8FBE\u5230\u9009\u62E9\u6570\u91CF\u7684\u4E0A\u9650", duration: 3e3 });
145
+ emitChange();
146
+ }
147
+ };
148
+ const emitChange = () => {
149
+ emit("change", selectedData.value);
150
+ };
151
+ const {
152
+ isItemChecked,
153
+ hoverBatchBox,
154
+ tableCellMouseEnter,
155
+ tableCellMouseLeave
156
+ } = useTableBatch();
157
+ onMounted(() => {
158
+ loadData();
159
+ });
160
+ return (_ctx, _cache) => {
161
+ return openBlock(), createElementBlock("div", _hoisted_1, [
162
+ createVNode(_sfc_main$1, { onSearch: search }),
163
+ createElementVNode("div", _hoisted_2, [
164
+ createVNode(unref(Table), {
165
+ columns,
166
+ scroll: scrollPercent,
167
+ pagination: false,
168
+ bordered: false,
169
+ data: mediaFileData.value,
170
+ loading: dataLoading.value,
171
+ onCellMouseEnter: unref(tableCellMouseEnter),
172
+ onCellMouseLeave: unref(tableCellMouseLeave),
173
+ onRowClick: selectTableCell
174
+ }, {
175
+ mp_name: withCtx(({ record }) => [
176
+ createElementVNode("span", _hoisted_3, [
177
+ unref(hoverBatchBox)(selectedData.value, record) ? (openBlock(), createElementBlock("span", {
178
+ key: 0,
179
+ onClick: withModifiers(($event) => clickCheckbox($event, record), ["stop"])
180
+ }, [
181
+ createVNode(unref(Checkbox), {
182
+ class: "icon",
183
+ "model-value": unref(isItemChecked)(selectedData.value, record)
184
+ }, null, 8, ["model-value"])
185
+ ], 8, _hoisted_4)) : (openBlock(), createBlock(_sfc_main$2, {
186
+ key: 1,
187
+ class: "icon",
188
+ type: "mpdoc"
189
+ })),
190
+ createElementVNode("span", _hoisted_5, toDisplayString(record.mp_name || "--"), 1)
191
+ ])
192
+ ]),
193
+ mp_logo: withCtx(({ record }) => [
194
+ record.mp_logo ? (openBlock(), createElementBlock("img", {
195
+ key: 0,
196
+ class: "user-avatar",
197
+ src: record.mp_logo
198
+ }, null, 8, _hoisted_6)) : (openBlock(), createElementBlock("img", _hoisted_7))
199
+ ]),
200
+ mp_type: withCtx(({ record }) => [
201
+ createElementVNode("span", null, toDisplayString(unref(mp_type_map)[record.mp_type]), 1)
202
+ ]),
203
+ mp_user_name: withCtx(({ record }) => [
204
+ createElementVNode("span", null, toDisplayString(record.mp_user_name || "--"), 1)
205
+ ]),
206
+ catalog_alias: withCtx(({ record }) => [
207
+ createElementVNode("span", null, toDisplayString(record.catalog_alias), 1)
208
+ ]),
209
+ _: 1
210
+ }, 8, ["data", "loading", "onCellMouseEnter", "onCellMouseLeave"])
211
+ ]),
212
+ createElementVNode("div", _hoisted_8, [
213
+ createElementVNode("div", _hoisted_9, [
214
+ renderSlot(_ctx.$slots, "store")
215
+ ]),
216
+ renderSlot(_ctx.$slots, "options")
217
+ ])
218
+ ]);
219
+ };
220
+ }
221
+ });
222
+ export { _sfc_main as default };
@@ -0,0 +1,85 @@
1
+ import { defineComponent, ref, computed, watch, onMounted, openBlock, createElementBlock, createVNode, unref, withCtx, Fragment, renderList, createBlock } from "vue";
2
+ import { Space, Input, Select, Option } from "@arco-design/web-vue";
3
+ import { searchMpaccount } from "../../../script/api.js";
4
+ const _hoisted_1 = { class: "media-filter-container" };
5
+ const _sfc_main = defineComponent({
6
+ ...{ name: "MediaFilter" },
7
+ __name: "index",
8
+ props: {
9
+ group_id: {},
10
+ userInfo: {}
11
+ },
12
+ emits: ["update:group_id", "search"],
13
+ setup(__props, { emit }) {
14
+ const props = __props;
15
+ const filter = ref({ wd: "", account_uid: "", order: 1 });
16
+ const typeOptions = ref([{ mp_name: "\u5168\u90E8", uid: "all" }]);
17
+ const limit = ref(100);
18
+ computed({
19
+ get() {
20
+ return props.group_id;
21
+ },
22
+ set(val) {
23
+ emit("update:group_id", val);
24
+ }
25
+ });
26
+ const getTypeData = async () => {
27
+ const query = {
28
+ limit: limit.value,
29
+ offset: typeOptions.value.length
30
+ };
31
+ const { code, data } = await searchMpaccount(props.userInfo.BASE_API, query);
32
+ if (code !== 0)
33
+ return;
34
+ typeOptions.value = typeOptions.value.concat(data.data || []);
35
+ };
36
+ const handleSearch = () => {
37
+ emit("search", filter.value);
38
+ };
39
+ watch(filter.value, () => {
40
+ if (filter.value.account_uid === "all") {
41
+ filter.value.account_uid = "";
42
+ }
43
+ handleSearch();
44
+ });
45
+ onMounted(() => {
46
+ getTypeData();
47
+ });
48
+ return (_ctx, _cache) => {
49
+ return openBlock(), createElementBlock("div", _hoisted_1, [
50
+ createVNode(unref(Space), { size: "large" }, {
51
+ default: withCtx(() => [
52
+ createVNode(unref(Input), {
53
+ modelValue: filter.value.wd,
54
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filter.value.wd = $event),
55
+ class: "filter-item",
56
+ "allow-clear": "",
57
+ placeholder: "\u8F93\u5165\u5185\u5BB9\u6807\u9898",
58
+ onPressEnter: handleSearch
59
+ }, null, 8, ["modelValue"]),
60
+ createVNode(unref(Select), {
61
+ modelValue: filter.value.account_uid,
62
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => filter.value.account_uid = $event),
63
+ class: "filter-item",
64
+ placeholder: "\u516C\u4F17\u53F7",
65
+ "allow-search": ""
66
+ }, {
67
+ default: withCtx(() => [
68
+ (openBlock(true), createElementBlock(Fragment, null, renderList(typeOptions.value, (item) => {
69
+ return openBlock(), createBlock(unref(Option), {
70
+ key: item.uid,
71
+ label: item.mp_name,
72
+ value: item.uid
73
+ }, null, 8, ["label", "value"]);
74
+ }), 128))
75
+ ]),
76
+ _: 1
77
+ }, 8, ["modelValue"])
78
+ ]),
79
+ _: 1
80
+ })
81
+ ]);
82
+ };
83
+ }
84
+ });
85
+ export { _sfc_main as default };
@@ -0,0 +1,214 @@
1
+ import { defineComponent, ref, computed, watch, onMounted, openBlock, createElementBlock, createVNode, createElementVNode, unref, withCtx, withModifiers, createBlock, toDisplayString, renderSlot } from "vue";
2
+ import { Table, Checkbox, 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 { getMpContentList } 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: "LiveList" },
16
+ __name: "index",
17
+ props: {
18
+ maxSelect: {},
19
+ outsideSelectData: {},
20
+ defaultSelectedData: {},
21
+ userInfo: {}
22
+ },
23
+ emits: ["change"],
24
+ setup(__props, { emit }) {
25
+ const props = __props;
26
+ const _maxSelect = props.maxSelect || 100;
27
+ const selectedData = ref([]);
28
+ const group_id = ref("all");
29
+ const mediaFileData = ref([]);
30
+ const dataLoading = ref(false);
31
+ const page = ref({
32
+ index: 1,
33
+ size: 10,
34
+ total: 0
35
+ });
36
+ const filter = ref(null);
37
+ const columns = [
38
+ {
39
+ title: "\u6807\u9898",
40
+ dataIndex: "title",
41
+ slotName: "title"
42
+ },
43
+ {
44
+ title: "\u6240\u5C5E\u516C\u4F17\u53F7",
45
+ dataIndex: "account_name",
46
+ slotName: "account_name"
47
+ },
48
+ {
49
+ title: "\u53D1\u5E03\u65F6\u95F4",
50
+ dataIndex: "pub_time",
51
+ slotName: "pub_time"
52
+ }
53
+ ];
54
+ const scrollPercent = { y: "100%" };
55
+ const tempSelectedData = computed(() => {
56
+ return props.defaultSelectedData || [];
57
+ });
58
+ const search = (_filter) => {
59
+ if (_filter.account_uid || _filter.wd) {
60
+ filter.value = { ..._filter };
61
+ } else {
62
+ filter.value = null;
63
+ }
64
+ page.value.index = 1;
65
+ loadData();
66
+ };
67
+ const loadData = async () => {
68
+ let params = {
69
+ page: page.value.index,
70
+ page_size: page.value.size
71
+ };
72
+ if (filter.value) {
73
+ params = { ...params, ...filter.value };
74
+ }
75
+ dataLoading.value = true;
76
+ const { code, message } = await getMpContentList(
77
+ props.userInfo.BASE_API,
78
+ params
79
+ );
80
+ dataLoading.value = false;
81
+ if (code === 0) {
82
+ page.value.total = message.total;
83
+ mediaFileData.value = message.list.map((v) => {
84
+ v.catalog = "mp_content";
85
+ v.target_id = v.id;
86
+ v.target_type = 16;
87
+ v._type = 3;
88
+ return v;
89
+ }) || [];
90
+ }
91
+ };
92
+ const clickCheckbox = (e, record) => {
93
+ e.stopPropagation();
94
+ e.preventDefault();
95
+ selectData(record);
96
+ };
97
+ const selectTableCell = (record) => {
98
+ selectData(record);
99
+ };
100
+ const selectData = (record) => {
101
+ if (checkSameAdd(record)) {
102
+ Message.warning({ content: "\u8BF7\u52FF\u6DFB\u52A0\u91CD\u590D\u6570\u636E", duration: 3e3 });
103
+ return;
104
+ }
105
+ addDataToSelectedList(record);
106
+ };
107
+ const checkSameAdd = (record) => {
108
+ const selected = props.outsideSelectData;
109
+ if (!selected.length)
110
+ return false;
111
+ return selected.map((row) => row.id).includes(record.id);
112
+ };
113
+ const addDataToSelectedList = async (record) => {
114
+ const index = selectedData.value.findIndex((v) => v.id === record.id);
115
+ if (selectedData.value.length < _maxSelect) {
116
+ if (index === -1) {
117
+ selectedData.value.push(record);
118
+ } else {
119
+ selectedData.value.splice(index, 1);
120
+ }
121
+ emitChange();
122
+ } else {
123
+ if (index === -1) {
124
+ selectedData.value.splice(selectedData.value.length - 1, 1);
125
+ selectedData.value.push(record);
126
+ } else {
127
+ selectedData.value.splice(index, 1);
128
+ }
129
+ Message.warning({ content: "\u5DF2\u8FBE\u5230\u9009\u62E9\u6570\u91CF\u7684\u4E0A\u9650", duration: 3e3 });
130
+ emitChange();
131
+ }
132
+ };
133
+ const emitChange = () => {
134
+ emit("change", selectedData.value);
135
+ };
136
+ const {
137
+ isItemChecked,
138
+ hoverBatchBox,
139
+ tableCellMouseEnter,
140
+ tableCellMouseLeave
141
+ } = useTableBatch();
142
+ watch(
143
+ () => tempSelectedData.value,
144
+ (val) => {
145
+ selectedData.value = val;
146
+ }
147
+ );
148
+ watch(
149
+ () => group_id.value,
150
+ () => {
151
+ loadData();
152
+ }
153
+ );
154
+ onMounted(() => {
155
+ loadData();
156
+ });
157
+ return (_ctx, _cache) => {
158
+ return openBlock(), createElementBlock("div", _hoisted_1, [
159
+ createVNode(_sfc_main$1, {
160
+ group_id: group_id.value,
161
+ "onUpdate:group_id": _cache[0] || (_cache[0] = ($event) => group_id.value = $event),
162
+ "user-info": _ctx.userInfo,
163
+ onSearch: search
164
+ }, null, 8, ["group_id", "user-info"]),
165
+ createElementVNode("div", _hoisted_2, [
166
+ createVNode(unref(Table), {
167
+ columns,
168
+ scroll: scrollPercent,
169
+ pagination: false,
170
+ bordered: false,
171
+ data: mediaFileData.value,
172
+ loading: dataLoading.value,
173
+ onCellMouseEnter: unref(tableCellMouseEnter),
174
+ onCellMouseLeave: unref(tableCellMouseLeave),
175
+ onRowClick: selectTableCell
176
+ }, {
177
+ title: withCtx(({ record }) => [
178
+ createElementVNode("span", _hoisted_3, [
179
+ unref(hoverBatchBox)(selectedData.value, record) ? (openBlock(), createElementBlock("span", {
180
+ key: 0,
181
+ onClick: withModifiers(($event) => clickCheckbox($event, record), ["stop"])
182
+ }, [
183
+ createVNode(unref(Checkbox), {
184
+ class: "icon",
185
+ "model-value": unref(isItemChecked)(selectedData.value, record)
186
+ }, null, 8, ["model-value"])
187
+ ], 8, _hoisted_4)) : (openBlock(), createBlock(_sfc_main$2, {
188
+ key: 1,
189
+ class: "icon",
190
+ type: record.series
191
+ }, null, 8, ["type"])),
192
+ createElementVNode("span", _hoisted_5, toDisplayString(record.title || record.alias || "--"), 1)
193
+ ])
194
+ ]),
195
+ account_name: withCtx(({ record }) => [
196
+ createElementVNode("span", null, toDisplayString(record.account_name || record.mp_user_name), 1)
197
+ ]),
198
+ pub_time: withCtx(({ record }) => [
199
+ createElementVNode("span", null, toDisplayString(record.pub_time), 1)
200
+ ]),
201
+ _: 1
202
+ }, 8, ["data", "loading", "onCellMouseEnter", "onCellMouseLeave"])
203
+ ]),
204
+ createElementVNode("div", _hoisted_6, [
205
+ createElementVNode("div", _hoisted_7, [
206
+ renderSlot(_ctx.$slots, "store")
207
+ ]),
208
+ renderSlot(_ctx.$slots, "options")
209
+ ])
210
+ ]);
211
+ };
212
+ }
213
+ });
214
+ export { _sfc_main as default };