@cmstops/pro-compo 0.3.44 → 0.3.45
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/es/hooks/useLocalStorage.js +31 -0
- package/es/hooks/useUpload.js +6 -2
- package/es/selectResourceModal/component.js +176 -43
- package/es/selectResourceModal/components/ListTabs/index.js +61 -0
- package/es/selectResourceModal/scripts/useResourceSelect.d.ts +7 -0
- package/es/selectResourceModal/scripts/useResourceSelect.js +25 -0
- package/lib/hooks/useLocalStorage.js +34 -0
- package/lib/hooks/useUpload.js +5 -1
- package/lib/selectResourceModal/component.js +174 -41
- package/lib/selectResourceModal/components/ListTabs/index.js +62 -0
- package/lib/selectResourceModal/scripts/useResourceSelect.js +27 -0
- package/package.json +1 -1
- package/es/selectResourceModal/components/Main/index.js +0 -215
- package/lib/selectResourceModal/components/Main/index.js +0 -216
- /package/es/selectResourceModal/components/{Main → ListTabs}/index.d.ts +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const LOCALSTORAGE_KEYS = {
|
|
2
|
+
LOCAL_RESOURCES: "cmstop-local-resources"
|
|
3
|
+
};
|
|
4
|
+
function useLocalstorage(key) {
|
|
5
|
+
function get() {
|
|
6
|
+
const ret = localStorage.getItem(LOCALSTORAGE_KEYS[key]);
|
|
7
|
+
try {
|
|
8
|
+
if (typeof ret !== "string")
|
|
9
|
+
return ret;
|
|
10
|
+
return JSON.parse(ret);
|
|
11
|
+
} catch (e) {
|
|
12
|
+
return ret;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function set(value) {
|
|
16
|
+
if (typeof value === "object") {
|
|
17
|
+
localStorage.setItem(LOCALSTORAGE_KEYS[key], JSON.stringify(value));
|
|
18
|
+
} else {
|
|
19
|
+
localStorage.setItem(LOCALSTORAGE_KEYS[key], value);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function remove() {
|
|
23
|
+
localStorage.removeItem(LOCALSTORAGE_KEYS[key]);
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
get,
|
|
27
|
+
set,
|
|
28
|
+
remove
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export { LOCALSTORAGE_KEYS, useLocalstorage as default };
|
package/es/hooks/useUpload.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
1
|
+
import { ref, watch } from "vue";
|
|
2
2
|
import { generateUUID } from "../utils/index.js";
|
|
3
3
|
import { TusUploadTask } from "../utils/tusUpload.js";
|
|
4
4
|
import request from "../utils/request.js";
|
|
5
5
|
import { TranscodingTask } from "../utils/transcodeMedia.js";
|
|
6
|
+
import useLocalstorage from "./useLocalStorage.js";
|
|
6
7
|
function addMedia(BASE_API, params) {
|
|
7
8
|
return request(BASE_API, {
|
|
8
9
|
url: "/poplar/v2/media/add",
|
|
@@ -11,7 +12,8 @@ function addMedia(BASE_API, params) {
|
|
|
11
12
|
});
|
|
12
13
|
}
|
|
13
14
|
function useUpload() {
|
|
14
|
-
const
|
|
15
|
+
const { get, set, remove } = useLocalstorage("LOCAL_RESOURCES");
|
|
16
|
+
const list = ref(get() || []);
|
|
15
17
|
function uploadSuccess(file) {
|
|
16
18
|
const originList = list.value;
|
|
17
19
|
const taskIndex = originList.findIndex(
|
|
@@ -111,6 +113,8 @@ function useUpload() {
|
|
|
111
113
|
recordTaskStatusChange({ ...item, status: 2, msg: "\u8F6C\u7801\u5931\u8D25" }, -1);
|
|
112
114
|
});
|
|
113
115
|
};
|
|
116
|
+
watch(() => list.value, set, { deep: true });
|
|
117
|
+
window.onbeforeunload = remove;
|
|
114
118
|
return {
|
|
115
119
|
list,
|
|
116
120
|
uploadFile,
|
|
@@ -1,7 +1,31 @@
|
|
|
1
|
-
import { defineComponent, ref, openBlock, createElementBlock, createBlock, unref, withCtx,
|
|
2
|
-
import { Drawer, Modal } from "@arco-design/web-vue";
|
|
3
|
-
import
|
|
1
|
+
import { defineComponent, computed, ref, provide, openBlock, createElementBlock, createBlock, resolveDynamicComponent, unref, mergeProps, withCtx, createElementVNode, createCommentVNode, createVNode, withDirectives, vShow, createTextVNode } from "vue";
|
|
2
|
+
import { Drawer, Modal, Scrollbar, Pagination, Button } from "@arco-design/web-vue";
|
|
3
|
+
import emptyData from "../emptyData/index.js";
|
|
4
|
+
import _sfc_main$1 from "./components/ListTabs/index.js";
|
|
5
|
+
import _sfc_main$2 from "./components/ListFilter/index.js";
|
|
6
|
+
import _sfc_main$3 from "./components/ListContent/index.js";
|
|
7
|
+
import _sfc_main$5 from "./components/ListSelected/index.js";
|
|
8
|
+
import _sfc_main$4 from "./components/ListContentLocal/index.js";
|
|
9
|
+
import useAttachement from "../hooks/useAttachement.js";
|
|
10
|
+
import { DEFAULT_BASE_API } from "../config.js";
|
|
11
|
+
import { useResourceSelect } from "./scripts/useResourceSelect.js";
|
|
4
12
|
const _hoisted_1 = { class: "resource-select-wrap" };
|
|
13
|
+
const _hoisted_2 = { class: "resource-select-main" };
|
|
14
|
+
const _hoisted_3 = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "resource-select-container"
|
|
17
|
+
};
|
|
18
|
+
const _hoisted_4 = {
|
|
19
|
+
key: 0,
|
|
20
|
+
class: "resource-select-filter"
|
|
21
|
+
};
|
|
22
|
+
const _hoisted_5 = { class: "resource-select-content" };
|
|
23
|
+
const _hoisted_6 = { class: "resource-select-footer" };
|
|
24
|
+
const _hoisted_7 = { class: "footer-left" };
|
|
25
|
+
const _hoisted_8 = {
|
|
26
|
+
key: 0,
|
|
27
|
+
class: "footer-right"
|
|
28
|
+
};
|
|
5
29
|
const _sfc_main = defineComponent({
|
|
6
30
|
...{ name: "selectResourceModal" },
|
|
7
31
|
__name: "component",
|
|
@@ -17,55 +41,164 @@ const _sfc_main = defineComponent({
|
|
|
17
41
|
setup(__props, { emit: __emit }) {
|
|
18
42
|
const props = __props;
|
|
19
43
|
const emits = __emit;
|
|
20
|
-
const
|
|
21
|
-
const
|
|
44
|
+
const BASE_API = props.BASE_API || DEFAULT_BASE_API;
|
|
45
|
+
const wrapProps = computed(() => {
|
|
46
|
+
if (props.wrap === "drawer") {
|
|
47
|
+
return {
|
|
48
|
+
class: "resource-select-drawer",
|
|
49
|
+
header: false,
|
|
50
|
+
width: "1024px",
|
|
51
|
+
footer: false
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
bodyClass: "resource-select-modal-body",
|
|
56
|
+
width: "986px",
|
|
57
|
+
closable: false,
|
|
58
|
+
hideTitle: false,
|
|
59
|
+
footer: false
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
const activeKey = ref("all");
|
|
63
|
+
provide("userInfo", computed(() => props.userInfo));
|
|
64
|
+
provide("baseAPI", BASE_API);
|
|
65
|
+
const {
|
|
66
|
+
list,
|
|
67
|
+
total,
|
|
68
|
+
limit,
|
|
69
|
+
loading,
|
|
70
|
+
changeKey,
|
|
71
|
+
changeFilter,
|
|
72
|
+
changePage,
|
|
73
|
+
changeSize
|
|
74
|
+
} = useAttachement({ key: "all", BASE_API });
|
|
75
|
+
const {
|
|
76
|
+
selected,
|
|
77
|
+
selectedKeys,
|
|
78
|
+
disableSelect,
|
|
79
|
+
handleSelect,
|
|
80
|
+
handleClear
|
|
81
|
+
} = useResourceSelect(props);
|
|
82
|
+
function handleClose() {
|
|
83
|
+
handleClear();
|
|
22
84
|
emits("update:visible", false);
|
|
23
|
-
}
|
|
85
|
+
}
|
|
24
86
|
const handleSubmit = (data) => {
|
|
25
87
|
emits("submit", JSON.parse(JSON.stringify(data)));
|
|
26
88
|
};
|
|
89
|
+
const handleSelectOne = (params) => {
|
|
90
|
+
if (Array.isArray(params))
|
|
91
|
+
handleSubmit(params);
|
|
92
|
+
else
|
|
93
|
+
handleSubmit([params]);
|
|
94
|
+
handleClose();
|
|
95
|
+
};
|
|
96
|
+
function handleConfirm() {
|
|
97
|
+
handleSelectOne(selected.value);
|
|
98
|
+
}
|
|
99
|
+
function handleToUpload() {
|
|
100
|
+
changeKey("local");
|
|
101
|
+
activeKey.value = "local";
|
|
102
|
+
}
|
|
27
103
|
return (_ctx, _cache) => {
|
|
28
104
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
29
|
-
|
|
30
|
-
key: 0,
|
|
31
|
-
visible: _ctx.visible,
|
|
32
|
-
width: "1024px",
|
|
33
|
-
header: false,
|
|
34
|
-
footer: false,
|
|
35
|
-
class: "resource-select-drawer"
|
|
36
|
-
}, {
|
|
37
|
-
default: withCtx(() => [
|
|
38
|
-
createVNode(_sfc_main$1, {
|
|
39
|
-
BASE_API: _ctx.BASE_API,
|
|
40
|
-
userInfo: _ctx.userInfo,
|
|
41
|
-
maxcount: _ctx.maxcount,
|
|
42
|
-
filterOptions: _ctx.filterOptions,
|
|
43
|
-
onClose: handleClose,
|
|
44
|
-
onSubmit: handleSubmit
|
|
45
|
-
}, null, 8, ["BASE_API", "userInfo", "maxcount", "filterOptions"])
|
|
46
|
-
]),
|
|
47
|
-
_: 1
|
|
48
|
-
}, 8, ["visible"])) : wrapMode.value === "modal" ? (openBlock(), createBlock(unref(Modal), {
|
|
49
|
-
key: 1,
|
|
50
|
-
visible: _ctx.visible,
|
|
51
|
-
width: "986px",
|
|
52
|
-
"body-class": "resource-select-modal-body",
|
|
53
|
-
"hide-title": false,
|
|
54
|
-
closable: false,
|
|
55
|
-
footer: false
|
|
56
|
-
}, {
|
|
105
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.wrap === "drawer" ? unref(Drawer) : unref(Modal)), mergeProps({ visible: _ctx.visible }, wrapProps.value), {
|
|
57
106
|
default: withCtx(() => [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
107
|
+
createElementVNode("div", _hoisted_2, [
|
|
108
|
+
_ctx.userInfo ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
109
|
+
createCommentVNode(" \u5934\u90E8 "),
|
|
110
|
+
createVNode(_sfc_main$1, {
|
|
111
|
+
"model-value": activeKey.value,
|
|
112
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeKey.value = $event),
|
|
113
|
+
onChange: unref(changeKey),
|
|
114
|
+
onClose: handleClose
|
|
115
|
+
}, null, 8, ["model-value", "onChange"]),
|
|
116
|
+
createCommentVNode(" \u7B5B\u9009 "),
|
|
117
|
+
activeKey.value !== "local" ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
118
|
+
createVNode(_sfc_main$2, {
|
|
119
|
+
"disable-upload-by": !["all", "remind"].includes(activeKey.value),
|
|
120
|
+
filterOptions: _ctx.filterOptions,
|
|
121
|
+
onChange: unref(changeFilter),
|
|
122
|
+
onUpload: handleToUpload
|
|
123
|
+
}, null, 8, ["disable-upload-by", "filterOptions", "onChange"])
|
|
124
|
+
])) : createCommentVNode("v-if", true),
|
|
125
|
+
createCommentVNode(" \u5217\u8868\u90E8\u5206 "),
|
|
126
|
+
createElementVNode("div", _hoisted_5, [
|
|
127
|
+
createVNode(unref(Scrollbar), {
|
|
128
|
+
"outer-style": { height: "100%" },
|
|
129
|
+
style: { "height": "100%", "overflow": "auto" }
|
|
130
|
+
}, {
|
|
131
|
+
default: withCtx(() => [
|
|
132
|
+
withDirectives(createVNode(_sfc_main$3, {
|
|
133
|
+
loading: unref(loading),
|
|
134
|
+
list: unref(list),
|
|
135
|
+
disable: unref(disableSelect),
|
|
136
|
+
"select-keys": unref(selectedKeys),
|
|
137
|
+
onSelect: unref(handleSelect),
|
|
138
|
+
onSelectOne: handleSelectOne
|
|
139
|
+
}, null, 8, ["loading", "list", "disable", "select-keys", "onSelect"]), [
|
|
140
|
+
[vShow, activeKey.value !== "local"]
|
|
141
|
+
]),
|
|
142
|
+
withDirectives(createVNode(_sfc_main$4, {
|
|
143
|
+
disable: unref(disableSelect),
|
|
144
|
+
"select-keys": unref(selectedKeys),
|
|
145
|
+
onSelect: unref(handleSelect),
|
|
146
|
+
onSelectOne: handleSelectOne
|
|
147
|
+
}, null, 8, ["disable", "select-keys", "onSelect"]), [
|
|
148
|
+
[vShow, activeKey.value === "local"]
|
|
149
|
+
])
|
|
150
|
+
]),
|
|
151
|
+
_: 1
|
|
152
|
+
})
|
|
153
|
+
]),
|
|
154
|
+
createCommentVNode(" \u5E95\u90E8 "),
|
|
155
|
+
createElementVNode("div", _hoisted_6, [
|
|
156
|
+
createElementVNode("div", _hoisted_7, [
|
|
157
|
+
activeKey.value !== "local" ? (openBlock(), createBlock(unref(Pagination), {
|
|
158
|
+
key: 0,
|
|
159
|
+
total: unref(total),
|
|
160
|
+
"page-size": unref(limit),
|
|
161
|
+
"show-total": "",
|
|
162
|
+
"show-page-size": "",
|
|
163
|
+
"base-size": 3,
|
|
164
|
+
"buffer-size": 1,
|
|
165
|
+
onChange: _cache[1] || (_cache[1] = (e) => unref(changePage)((e - 1) * unref(limit))),
|
|
166
|
+
onPageSizeChange: unref(changeSize)
|
|
167
|
+
}, null, 8, ["total", "page-size", "onPageSizeChange"])) : createCommentVNode("v-if", true)
|
|
168
|
+
]),
|
|
169
|
+
unref(selected).length ? (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
170
|
+
createVNode(_sfc_main$5, {
|
|
171
|
+
maxcount: _ctx.maxcount,
|
|
172
|
+
selected: unref(selected),
|
|
173
|
+
onRemove: unref(handleSelect),
|
|
174
|
+
onClear: unref(handleClear)
|
|
175
|
+
}, null, 8, ["maxcount", "selected", "onRemove", "onClear"]),
|
|
176
|
+
createVNode(unref(Button), { onClick: handleClose }, {
|
|
177
|
+
default: withCtx(() => [
|
|
178
|
+
createTextVNode("\u53D6\u6D88")
|
|
179
|
+
]),
|
|
180
|
+
_: 1
|
|
181
|
+
}),
|
|
182
|
+
createVNode(unref(Button), {
|
|
183
|
+
type: "primary",
|
|
184
|
+
onClick: handleConfirm
|
|
185
|
+
}, {
|
|
186
|
+
default: withCtx(() => [
|
|
187
|
+
createTextVNode("\u786E\u5B9A")
|
|
188
|
+
]),
|
|
189
|
+
_: 1
|
|
190
|
+
})
|
|
191
|
+
])) : createCommentVNode("v-if", true)
|
|
192
|
+
])
|
|
193
|
+
])) : (openBlock(), createBlock(unref(emptyData), {
|
|
194
|
+
key: 1,
|
|
195
|
+
type: "empty",
|
|
196
|
+
customTip: "\u6682\u65E0\u6743\u9650"
|
|
197
|
+
}))
|
|
198
|
+
])
|
|
66
199
|
]),
|
|
67
200
|
_: 1
|
|
68
|
-
},
|
|
201
|
+
}, 16, ["visible"]))
|
|
69
202
|
]);
|
|
70
203
|
};
|
|
71
204
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, createVNode, unref, withCtx } from "vue";
|
|
2
|
+
import { IconClose } from "@arco-design/web-vue/es/icon";
|
|
3
|
+
import { Tabs, Button, TabPane } from "@arco-design/web-vue";
|
|
4
|
+
const _hoisted_1 = { class: "resource-select-header" };
|
|
5
|
+
const _sfc_main = defineComponent({
|
|
6
|
+
__name: "index",
|
|
7
|
+
props: {
|
|
8
|
+
modelValue: {}
|
|
9
|
+
},
|
|
10
|
+
emits: ["update:model-value", "change", "close"],
|
|
11
|
+
setup(__props, { emit: __emit }) {
|
|
12
|
+
const props = __props;
|
|
13
|
+
const emits = __emit;
|
|
14
|
+
const activeKey = computed({
|
|
15
|
+
get: () => props.modelValue,
|
|
16
|
+
set: (value) => emits("update:model-value", value)
|
|
17
|
+
});
|
|
18
|
+
return (_ctx, _cache) => {
|
|
19
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
20
|
+
createVNode(unref(Tabs), {
|
|
21
|
+
"active-key": activeKey.value,
|
|
22
|
+
"onUpdate:activeKey": _cache[1] || (_cache[1] = ($event) => activeKey.value = $event),
|
|
23
|
+
onChange: _cache[2] || (_cache[2] = (e) => emits("change", e))
|
|
24
|
+
}, {
|
|
25
|
+
extra: withCtx(() => [
|
|
26
|
+
createVNode(unref(Button), {
|
|
27
|
+
type: "secondary",
|
|
28
|
+
shape: "round",
|
|
29
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emits("close"))
|
|
30
|
+
}, {
|
|
31
|
+
icon: withCtx(() => [
|
|
32
|
+
createVNode(unref(IconClose))
|
|
33
|
+
]),
|
|
34
|
+
_: 1
|
|
35
|
+
})
|
|
36
|
+
]),
|
|
37
|
+
default: withCtx(() => [
|
|
38
|
+
createVNode(unref(TabPane), {
|
|
39
|
+
key: "all",
|
|
40
|
+
title: "\u5168\u90E8\u7D20\u6750"
|
|
41
|
+
}),
|
|
42
|
+
createVNode(unref(TabPane), {
|
|
43
|
+
key: "my",
|
|
44
|
+
title: "\u6211\u7684\u7D20\u6750"
|
|
45
|
+
}),
|
|
46
|
+
createVNode(unref(TabPane), {
|
|
47
|
+
key: "remind",
|
|
48
|
+
title: "\u63D0\u9192\u6211\u7684"
|
|
49
|
+
}),
|
|
50
|
+
createVNode(unref(TabPane), {
|
|
51
|
+
key: "local",
|
|
52
|
+
title: "\u672C\u5730\u7D20\u6750"
|
|
53
|
+
})
|
|
54
|
+
]),
|
|
55
|
+
_: 1
|
|
56
|
+
}, 8, ["active-key"])
|
|
57
|
+
]);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ref, computed } from "vue";
|
|
2
|
+
function useResourceSelect(props) {
|
|
3
|
+
const selected = ref([]);
|
|
4
|
+
const selectedKeys = computed(() => selected.value.map((item) => item.id));
|
|
5
|
+
const disableSelect = computed(() => props.maxcount && selected.value.length >= props.maxcount);
|
|
6
|
+
function handleSelect(params) {
|
|
7
|
+
const { id } = params;
|
|
8
|
+
const index = selected.value.findIndex((item) => item.id === id);
|
|
9
|
+
if (index > -1)
|
|
10
|
+
selected.value.splice(index, 1);
|
|
11
|
+
else
|
|
12
|
+
selected.value.push(params);
|
|
13
|
+
}
|
|
14
|
+
function handleClear() {
|
|
15
|
+
selected.value = [];
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
selected,
|
|
19
|
+
selectedKeys,
|
|
20
|
+
disableSelect,
|
|
21
|
+
handleSelect,
|
|
22
|
+
handleClear
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export { useResourceSelect };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const LOCALSTORAGE_KEYS = {
|
|
4
|
+
LOCAL_RESOURCES: "cmstop-local-resources"
|
|
5
|
+
};
|
|
6
|
+
function useLocalstorage(key) {
|
|
7
|
+
function get() {
|
|
8
|
+
const ret = localStorage.getItem(LOCALSTORAGE_KEYS[key]);
|
|
9
|
+
try {
|
|
10
|
+
if (typeof ret !== "string")
|
|
11
|
+
return ret;
|
|
12
|
+
return JSON.parse(ret);
|
|
13
|
+
} catch (e) {
|
|
14
|
+
return ret;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function set(value) {
|
|
18
|
+
if (typeof value === "object") {
|
|
19
|
+
localStorage.setItem(LOCALSTORAGE_KEYS[key], JSON.stringify(value));
|
|
20
|
+
} else {
|
|
21
|
+
localStorage.setItem(LOCALSTORAGE_KEYS[key], value);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function remove() {
|
|
25
|
+
localStorage.removeItem(LOCALSTORAGE_KEYS[key]);
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
get,
|
|
29
|
+
set,
|
|
30
|
+
remove
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
exports.LOCALSTORAGE_KEYS = LOCALSTORAGE_KEYS;
|
|
34
|
+
exports["default"] = useLocalstorage;
|
package/lib/hooks/useUpload.js
CHANGED
|
@@ -5,6 +5,7 @@ var index = require("../utils/index.js");
|
|
|
5
5
|
var tusUpload = require("../utils/tusUpload.js");
|
|
6
6
|
var request = require("../utils/request.js");
|
|
7
7
|
var transcodeMedia = require("../utils/transcodeMedia.js");
|
|
8
|
+
var useLocalStorage = require("./useLocalStorage.js");
|
|
8
9
|
function addMedia(BASE_API, params) {
|
|
9
10
|
return request(BASE_API, {
|
|
10
11
|
url: "/poplar/v2/media/add",
|
|
@@ -13,7 +14,8 @@ function addMedia(BASE_API, params) {
|
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
16
|
function useUpload() {
|
|
16
|
-
const
|
|
17
|
+
const { get, set, remove } = useLocalStorage["default"]("LOCAL_RESOURCES");
|
|
18
|
+
const list = vue.ref(get() || []);
|
|
17
19
|
function uploadSuccess(file) {
|
|
18
20
|
const originList = list.value;
|
|
19
21
|
const taskIndex = originList.findIndex(
|
|
@@ -113,6 +115,8 @@ function useUpload() {
|
|
|
113
115
|
recordTaskStatusChange({ ...item, status: 2, msg: "\u8F6C\u7801\u5931\u8D25" }, -1);
|
|
114
116
|
});
|
|
115
117
|
};
|
|
118
|
+
vue.watch(() => list.value, set, { deep: true });
|
|
119
|
+
window.onbeforeunload = remove;
|
|
116
120
|
return {
|
|
117
121
|
list,
|
|
118
122
|
uploadFile,
|
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var vue = require("vue");
|
|
3
3
|
var webVue = require("@arco-design/web-vue");
|
|
4
|
-
var index = require("
|
|
4
|
+
var index$5 = require("../emptyData/index.js");
|
|
5
|
+
var index = require("./components/ListTabs/index.js");
|
|
6
|
+
var index$1 = require("./components/ListFilter/index.js");
|
|
7
|
+
var index$2 = require("./components/ListContent/index.js");
|
|
8
|
+
var index$4 = require("./components/ListSelected/index.js");
|
|
9
|
+
var index$3 = require("./components/ListContentLocal/index.js");
|
|
10
|
+
var useAttachement = require("../hooks/useAttachement.js");
|
|
11
|
+
var config = require("../config.js");
|
|
12
|
+
var useResourceSelect = require("./scripts/useResourceSelect.js");
|
|
5
13
|
const _hoisted_1 = { class: "resource-select-wrap" };
|
|
14
|
+
const _hoisted_2 = { class: "resource-select-main" };
|
|
15
|
+
const _hoisted_3 = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "resource-select-container"
|
|
18
|
+
};
|
|
19
|
+
const _hoisted_4 = {
|
|
20
|
+
key: 0,
|
|
21
|
+
class: "resource-select-filter"
|
|
22
|
+
};
|
|
23
|
+
const _hoisted_5 = { class: "resource-select-content" };
|
|
24
|
+
const _hoisted_6 = { class: "resource-select-footer" };
|
|
25
|
+
const _hoisted_7 = { class: "footer-left" };
|
|
26
|
+
const _hoisted_8 = {
|
|
27
|
+
key: 0,
|
|
28
|
+
class: "footer-right"
|
|
29
|
+
};
|
|
6
30
|
const _sfc_main = vue.defineComponent({
|
|
7
31
|
...{ name: "selectResourceModal" },
|
|
8
32
|
__name: "component",
|
|
@@ -18,55 +42,164 @@ const _sfc_main = vue.defineComponent({
|
|
|
18
42
|
setup(__props, { emit: __emit }) {
|
|
19
43
|
const props = __props;
|
|
20
44
|
const emits = __emit;
|
|
21
|
-
const
|
|
22
|
-
const
|
|
45
|
+
const BASE_API = props.BASE_API || config.DEFAULT_BASE_API;
|
|
46
|
+
const wrapProps = vue.computed(() => {
|
|
47
|
+
if (props.wrap === "drawer") {
|
|
48
|
+
return {
|
|
49
|
+
class: "resource-select-drawer",
|
|
50
|
+
header: false,
|
|
51
|
+
width: "1024px",
|
|
52
|
+
footer: false
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
bodyClass: "resource-select-modal-body",
|
|
57
|
+
width: "986px",
|
|
58
|
+
closable: false,
|
|
59
|
+
hideTitle: false,
|
|
60
|
+
footer: false
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
const activeKey = vue.ref("all");
|
|
64
|
+
vue.provide("userInfo", vue.computed(() => props.userInfo));
|
|
65
|
+
vue.provide("baseAPI", BASE_API);
|
|
66
|
+
const {
|
|
67
|
+
list,
|
|
68
|
+
total,
|
|
69
|
+
limit,
|
|
70
|
+
loading,
|
|
71
|
+
changeKey,
|
|
72
|
+
changeFilter,
|
|
73
|
+
changePage,
|
|
74
|
+
changeSize
|
|
75
|
+
} = useAttachement["default"]({ key: "all", BASE_API });
|
|
76
|
+
const {
|
|
77
|
+
selected,
|
|
78
|
+
selectedKeys,
|
|
79
|
+
disableSelect,
|
|
80
|
+
handleSelect,
|
|
81
|
+
handleClear
|
|
82
|
+
} = useResourceSelect.useResourceSelect(props);
|
|
83
|
+
function handleClose() {
|
|
84
|
+
handleClear();
|
|
23
85
|
emits("update:visible", false);
|
|
24
|
-
}
|
|
86
|
+
}
|
|
25
87
|
const handleSubmit = (data) => {
|
|
26
88
|
emits("submit", JSON.parse(JSON.stringify(data)));
|
|
27
89
|
};
|
|
90
|
+
const handleSelectOne = (params) => {
|
|
91
|
+
if (Array.isArray(params))
|
|
92
|
+
handleSubmit(params);
|
|
93
|
+
else
|
|
94
|
+
handleSubmit([params]);
|
|
95
|
+
handleClose();
|
|
96
|
+
};
|
|
97
|
+
function handleConfirm() {
|
|
98
|
+
handleSelectOne(selected.value);
|
|
99
|
+
}
|
|
100
|
+
function handleToUpload() {
|
|
101
|
+
changeKey("local");
|
|
102
|
+
activeKey.value = "local";
|
|
103
|
+
}
|
|
28
104
|
return (_ctx, _cache) => {
|
|
29
105
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
30
|
-
|
|
31
|
-
key: 0,
|
|
32
|
-
visible: _ctx.visible,
|
|
33
|
-
width: "1024px",
|
|
34
|
-
header: false,
|
|
35
|
-
footer: false,
|
|
36
|
-
class: "resource-select-drawer"
|
|
37
|
-
}, {
|
|
38
|
-
default: vue.withCtx(() => [
|
|
39
|
-
vue.createVNode(index, {
|
|
40
|
-
BASE_API: _ctx.BASE_API,
|
|
41
|
-
userInfo: _ctx.userInfo,
|
|
42
|
-
maxcount: _ctx.maxcount,
|
|
43
|
-
filterOptions: _ctx.filterOptions,
|
|
44
|
-
onClose: handleClose,
|
|
45
|
-
onSubmit: handleSubmit
|
|
46
|
-
}, null, 8, ["BASE_API", "userInfo", "maxcount", "filterOptions"])
|
|
47
|
-
]),
|
|
48
|
-
_: 1
|
|
49
|
-
}, 8, ["visible"])) : wrapMode.value === "modal" ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.Modal), {
|
|
50
|
-
key: 1,
|
|
51
|
-
visible: _ctx.visible,
|
|
52
|
-
width: "986px",
|
|
53
|
-
"body-class": "resource-select-modal-body",
|
|
54
|
-
"hide-title": false,
|
|
55
|
-
closable: false,
|
|
56
|
-
footer: false
|
|
57
|
-
}, {
|
|
106
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.wrap === "drawer" ? vue.unref(webVue.Drawer) : vue.unref(webVue.Modal)), vue.mergeProps({ visible: _ctx.visible }, wrapProps.value), {
|
|
58
107
|
default: vue.withCtx(() => [
|
|
59
|
-
vue.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
108
|
+
vue.createElementVNode("div", _hoisted_2, [
|
|
109
|
+
_ctx.userInfo ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, [
|
|
110
|
+
vue.createCommentVNode(" \u5934\u90E8 "),
|
|
111
|
+
vue.createVNode(index, {
|
|
112
|
+
"model-value": activeKey.value,
|
|
113
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeKey.value = $event),
|
|
114
|
+
onChange: vue.unref(changeKey),
|
|
115
|
+
onClose: handleClose
|
|
116
|
+
}, null, 8, ["model-value", "onChange"]),
|
|
117
|
+
vue.createCommentVNode(" \u7B5B\u9009 "),
|
|
118
|
+
activeKey.value !== "local" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [
|
|
119
|
+
vue.createVNode(index$1, {
|
|
120
|
+
"disable-upload-by": !["all", "remind"].includes(activeKey.value),
|
|
121
|
+
filterOptions: _ctx.filterOptions,
|
|
122
|
+
onChange: vue.unref(changeFilter),
|
|
123
|
+
onUpload: handleToUpload
|
|
124
|
+
}, null, 8, ["disable-upload-by", "filterOptions", "onChange"])
|
|
125
|
+
])) : vue.createCommentVNode("v-if", true),
|
|
126
|
+
vue.createCommentVNode(" \u5217\u8868\u90E8\u5206 "),
|
|
127
|
+
vue.createElementVNode("div", _hoisted_5, [
|
|
128
|
+
vue.createVNode(vue.unref(webVue.Scrollbar), {
|
|
129
|
+
"outer-style": { height: "100%" },
|
|
130
|
+
style: { "height": "100%", "overflow": "auto" }
|
|
131
|
+
}, {
|
|
132
|
+
default: vue.withCtx(() => [
|
|
133
|
+
vue.withDirectives(vue.createVNode(index$2, {
|
|
134
|
+
loading: vue.unref(loading),
|
|
135
|
+
list: vue.unref(list),
|
|
136
|
+
disable: vue.unref(disableSelect),
|
|
137
|
+
"select-keys": vue.unref(selectedKeys),
|
|
138
|
+
onSelect: vue.unref(handleSelect),
|
|
139
|
+
onSelectOne: handleSelectOne
|
|
140
|
+
}, null, 8, ["loading", "list", "disable", "select-keys", "onSelect"]), [
|
|
141
|
+
[vue.vShow, activeKey.value !== "local"]
|
|
142
|
+
]),
|
|
143
|
+
vue.withDirectives(vue.createVNode(index$3, {
|
|
144
|
+
disable: vue.unref(disableSelect),
|
|
145
|
+
"select-keys": vue.unref(selectedKeys),
|
|
146
|
+
onSelect: vue.unref(handleSelect),
|
|
147
|
+
onSelectOne: handleSelectOne
|
|
148
|
+
}, null, 8, ["disable", "select-keys", "onSelect"]), [
|
|
149
|
+
[vue.vShow, activeKey.value === "local"]
|
|
150
|
+
])
|
|
151
|
+
]),
|
|
152
|
+
_: 1
|
|
153
|
+
})
|
|
154
|
+
]),
|
|
155
|
+
vue.createCommentVNode(" \u5E95\u90E8 "),
|
|
156
|
+
vue.createElementVNode("div", _hoisted_6, [
|
|
157
|
+
vue.createElementVNode("div", _hoisted_7, [
|
|
158
|
+
activeKey.value !== "local" ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.Pagination), {
|
|
159
|
+
key: 0,
|
|
160
|
+
total: vue.unref(total),
|
|
161
|
+
"page-size": vue.unref(limit),
|
|
162
|
+
"show-total": "",
|
|
163
|
+
"show-page-size": "",
|
|
164
|
+
"base-size": 3,
|
|
165
|
+
"buffer-size": 1,
|
|
166
|
+
onChange: _cache[1] || (_cache[1] = (e) => vue.unref(changePage)((e - 1) * vue.unref(limit))),
|
|
167
|
+
onPageSizeChange: vue.unref(changeSize)
|
|
168
|
+
}, null, 8, ["total", "page-size", "onPageSizeChange"])) : vue.createCommentVNode("v-if", true)
|
|
169
|
+
]),
|
|
170
|
+
vue.unref(selected).length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
|
|
171
|
+
vue.createVNode(index$4, {
|
|
172
|
+
maxcount: _ctx.maxcount,
|
|
173
|
+
selected: vue.unref(selected),
|
|
174
|
+
onRemove: vue.unref(handleSelect),
|
|
175
|
+
onClear: vue.unref(handleClear)
|
|
176
|
+
}, null, 8, ["maxcount", "selected", "onRemove", "onClear"]),
|
|
177
|
+
vue.createVNode(vue.unref(webVue.Button), { onClick: handleClose }, {
|
|
178
|
+
default: vue.withCtx(() => [
|
|
179
|
+
vue.createTextVNode("\u53D6\u6D88")
|
|
180
|
+
]),
|
|
181
|
+
_: 1
|
|
182
|
+
}),
|
|
183
|
+
vue.createVNode(vue.unref(webVue.Button), {
|
|
184
|
+
type: "primary",
|
|
185
|
+
onClick: handleConfirm
|
|
186
|
+
}, {
|
|
187
|
+
default: vue.withCtx(() => [
|
|
188
|
+
vue.createTextVNode("\u786E\u5B9A")
|
|
189
|
+
]),
|
|
190
|
+
_: 1
|
|
191
|
+
})
|
|
192
|
+
])) : vue.createCommentVNode("v-if", true)
|
|
193
|
+
])
|
|
194
|
+
])) : (vue.openBlock(), vue.createBlock(vue.unref(index$5), {
|
|
195
|
+
key: 1,
|
|
196
|
+
type: "empty",
|
|
197
|
+
customTip: "\u6682\u65E0\u6743\u9650"
|
|
198
|
+
}))
|
|
199
|
+
])
|
|
67
200
|
]),
|
|
68
201
|
_: 1
|
|
69
|
-
},
|
|
202
|
+
}, 16, ["visible"]))
|
|
70
203
|
]);
|
|
71
204
|
};
|
|
72
205
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var vue = require("vue");
|
|
3
|
+
var icon = require("@arco-design/web-vue/es/icon");
|
|
4
|
+
var webVue = require("@arco-design/web-vue");
|
|
5
|
+
const _hoisted_1 = { class: "resource-select-header" };
|
|
6
|
+
const _sfc_main = vue.defineComponent({
|
|
7
|
+
__name: "index",
|
|
8
|
+
props: {
|
|
9
|
+
modelValue: {}
|
|
10
|
+
},
|
|
11
|
+
emits: ["update:model-value", "change", "close"],
|
|
12
|
+
setup(__props, { emit: __emit }) {
|
|
13
|
+
const props = __props;
|
|
14
|
+
const emits = __emit;
|
|
15
|
+
const activeKey = vue.computed({
|
|
16
|
+
get: () => props.modelValue,
|
|
17
|
+
set: (value) => emits("update:model-value", value)
|
|
18
|
+
});
|
|
19
|
+
return (_ctx, _cache) => {
|
|
20
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
21
|
+
vue.createVNode(vue.unref(webVue.Tabs), {
|
|
22
|
+
"active-key": activeKey.value,
|
|
23
|
+
"onUpdate:activeKey": _cache[1] || (_cache[1] = ($event) => activeKey.value = $event),
|
|
24
|
+
onChange: _cache[2] || (_cache[2] = (e) => emits("change", e))
|
|
25
|
+
}, {
|
|
26
|
+
extra: vue.withCtx(() => [
|
|
27
|
+
vue.createVNode(vue.unref(webVue.Button), {
|
|
28
|
+
type: "secondary",
|
|
29
|
+
shape: "round",
|
|
30
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emits("close"))
|
|
31
|
+
}, {
|
|
32
|
+
icon: vue.withCtx(() => [
|
|
33
|
+
vue.createVNode(vue.unref(icon.IconClose))
|
|
34
|
+
]),
|
|
35
|
+
_: 1
|
|
36
|
+
})
|
|
37
|
+
]),
|
|
38
|
+
default: vue.withCtx(() => [
|
|
39
|
+
vue.createVNode(vue.unref(webVue.TabPane), {
|
|
40
|
+
key: "all",
|
|
41
|
+
title: "\u5168\u90E8\u7D20\u6750"
|
|
42
|
+
}),
|
|
43
|
+
vue.createVNode(vue.unref(webVue.TabPane), {
|
|
44
|
+
key: "my",
|
|
45
|
+
title: "\u6211\u7684\u7D20\u6750"
|
|
46
|
+
}),
|
|
47
|
+
vue.createVNode(vue.unref(webVue.TabPane), {
|
|
48
|
+
key: "remind",
|
|
49
|
+
title: "\u63D0\u9192\u6211\u7684"
|
|
50
|
+
}),
|
|
51
|
+
vue.createVNode(vue.unref(webVue.TabPane), {
|
|
52
|
+
key: "local",
|
|
53
|
+
title: "\u672C\u5730\u7D20\u6750"
|
|
54
|
+
})
|
|
55
|
+
]),
|
|
56
|
+
_: 1
|
|
57
|
+
}, 8, ["active-key"])
|
|
58
|
+
]);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
module.exports = _sfc_main;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
var vue = require("vue");
|
|
4
|
+
function useResourceSelect(props) {
|
|
5
|
+
const selected = vue.ref([]);
|
|
6
|
+
const selectedKeys = vue.computed(() => selected.value.map((item) => item.id));
|
|
7
|
+
const disableSelect = vue.computed(() => props.maxcount && selected.value.length >= props.maxcount);
|
|
8
|
+
function handleSelect(params) {
|
|
9
|
+
const { id } = params;
|
|
10
|
+
const index = selected.value.findIndex((item) => item.id === id);
|
|
11
|
+
if (index > -1)
|
|
12
|
+
selected.value.splice(index, 1);
|
|
13
|
+
else
|
|
14
|
+
selected.value.push(params);
|
|
15
|
+
}
|
|
16
|
+
function handleClear() {
|
|
17
|
+
selected.value = [];
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
selected,
|
|
21
|
+
selectedKeys,
|
|
22
|
+
disableSelect,
|
|
23
|
+
handleSelect,
|
|
24
|
+
handleClear
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
exports.useResourceSelect = useResourceSelect;
|
package/package.json
CHANGED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref, provide, computed, openBlock, createElementBlock, createCommentVNode, createElementVNode, createVNode, unref, withCtx, withDirectives, vShow, createBlock, createTextVNode } from "vue";
|
|
2
|
-
import { Tabs, Button, TabPane, Scrollbar, Pagination } from "@arco-design/web-vue";
|
|
3
|
-
import { IconClose } from "@arco-design/web-vue/es/icon";
|
|
4
|
-
import emptyData from "../../../emptyData/index.js";
|
|
5
|
-
import _sfc_main$1 from "../ListFilter/index.js";
|
|
6
|
-
import _sfc_main$2 from "../ListContent/index.js";
|
|
7
|
-
import _sfc_main$4 from "../ListSelected/index.js";
|
|
8
|
-
import _sfc_main$3 from "../ListContentLocal/index.js";
|
|
9
|
-
import useAttachement from "../../../hooks/useAttachement.js";
|
|
10
|
-
import { DEFAULT_BASE_API } from "../../../config.js";
|
|
11
|
-
const _hoisted_1 = { class: "resource-select-main" };
|
|
12
|
-
const _hoisted_2 = {
|
|
13
|
-
key: 0,
|
|
14
|
-
class: "resource-select-container"
|
|
15
|
-
};
|
|
16
|
-
const _hoisted_3 = { class: "resource-select-header" };
|
|
17
|
-
const _hoisted_4 = {
|
|
18
|
-
key: 0,
|
|
19
|
-
class: "resource-select-filter"
|
|
20
|
-
};
|
|
21
|
-
const _hoisted_5 = { class: "resource-select-content" };
|
|
22
|
-
const _hoisted_6 = { class: "resource-select-footer" };
|
|
23
|
-
const _hoisted_7 = { class: "footer-left" };
|
|
24
|
-
const _hoisted_8 = {
|
|
25
|
-
key: 0,
|
|
26
|
-
class: "footer-right"
|
|
27
|
-
};
|
|
28
|
-
const _sfc_main = defineComponent({
|
|
29
|
-
__name: "index",
|
|
30
|
-
props: {
|
|
31
|
-
BASE_API: {},
|
|
32
|
-
userInfo: {},
|
|
33
|
-
maxcount: {},
|
|
34
|
-
filterOptions: {}
|
|
35
|
-
},
|
|
36
|
-
emits: ["close", "submit"],
|
|
37
|
-
setup(__props, { emit: __emit }) {
|
|
38
|
-
const props = __props;
|
|
39
|
-
const emits = __emit;
|
|
40
|
-
const BASE_API = props.BASE_API || DEFAULT_BASE_API;
|
|
41
|
-
const activeKey = ref("all");
|
|
42
|
-
provide("userInfo", computed(() => props.userInfo));
|
|
43
|
-
provide("baseAPI", BASE_API);
|
|
44
|
-
const {
|
|
45
|
-
list,
|
|
46
|
-
total,
|
|
47
|
-
limit,
|
|
48
|
-
loading,
|
|
49
|
-
changeKey,
|
|
50
|
-
changeFilter,
|
|
51
|
-
changePage,
|
|
52
|
-
changeSize
|
|
53
|
-
} = useAttachement({ key: "all", BASE_API });
|
|
54
|
-
const selected = ref([]);
|
|
55
|
-
const selectedKeys = computed(() => selected.value.map((item) => item.id));
|
|
56
|
-
const disableSelect = computed(() => props.maxcount && selected.value.length >= props.maxcount);
|
|
57
|
-
function handleSelect(params) {
|
|
58
|
-
const { id } = params;
|
|
59
|
-
const index = selected.value.findIndex((item) => item.id === id);
|
|
60
|
-
if (index > -1)
|
|
61
|
-
selected.value.splice(index, 1);
|
|
62
|
-
else
|
|
63
|
-
selected.value.push(params);
|
|
64
|
-
}
|
|
65
|
-
function handleClear() {
|
|
66
|
-
selected.value = [];
|
|
67
|
-
}
|
|
68
|
-
function handleClose() {
|
|
69
|
-
handleClear();
|
|
70
|
-
emits("close");
|
|
71
|
-
}
|
|
72
|
-
const handleSelectOne = (params) => {
|
|
73
|
-
if (Array.isArray(params))
|
|
74
|
-
emits("submit", params);
|
|
75
|
-
else
|
|
76
|
-
emits("submit", [params]);
|
|
77
|
-
handleClose();
|
|
78
|
-
};
|
|
79
|
-
function handleConfirm() {
|
|
80
|
-
handleSelectOne(selected.value);
|
|
81
|
-
}
|
|
82
|
-
function handleToUpload() {
|
|
83
|
-
changeKey("local");
|
|
84
|
-
activeKey.value = "local";
|
|
85
|
-
}
|
|
86
|
-
return (_ctx, _cache) => {
|
|
87
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
88
|
-
_ctx.userInfo ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
89
|
-
createCommentVNode(" \u5934\u90E8 "),
|
|
90
|
-
createElementVNode("div", _hoisted_3, [
|
|
91
|
-
createVNode(unref(Tabs), {
|
|
92
|
-
"active-key": activeKey.value,
|
|
93
|
-
"onUpdate:activeKey": _cache[0] || (_cache[0] = ($event) => activeKey.value = $event),
|
|
94
|
-
onChange: unref(changeKey)
|
|
95
|
-
}, {
|
|
96
|
-
extra: withCtx(() => [
|
|
97
|
-
createVNode(unref(Button), {
|
|
98
|
-
type: "secondary",
|
|
99
|
-
shape: "round",
|
|
100
|
-
onClick: handleClose
|
|
101
|
-
}, {
|
|
102
|
-
icon: withCtx(() => [
|
|
103
|
-
createVNode(unref(IconClose))
|
|
104
|
-
]),
|
|
105
|
-
_: 1
|
|
106
|
-
})
|
|
107
|
-
]),
|
|
108
|
-
default: withCtx(() => [
|
|
109
|
-
createVNode(unref(TabPane), {
|
|
110
|
-
key: "all",
|
|
111
|
-
title: "\u5168\u90E8\u7D20\u6750"
|
|
112
|
-
}),
|
|
113
|
-
createVNode(unref(TabPane), {
|
|
114
|
-
key: "my",
|
|
115
|
-
title: "\u6211\u7684\u7D20\u6750"
|
|
116
|
-
}),
|
|
117
|
-
createVNode(unref(TabPane), {
|
|
118
|
-
key: "remind",
|
|
119
|
-
title: "\u63D0\u9192\u6211\u7684"
|
|
120
|
-
}),
|
|
121
|
-
createVNode(unref(TabPane), {
|
|
122
|
-
key: "local",
|
|
123
|
-
title: "\u672C\u5730\u7D20\u6750"
|
|
124
|
-
})
|
|
125
|
-
]),
|
|
126
|
-
_: 1
|
|
127
|
-
}, 8, ["active-key", "onChange"])
|
|
128
|
-
]),
|
|
129
|
-
createCommentVNode(" \u7B5B\u9009 "),
|
|
130
|
-
activeKey.value !== "local" ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
131
|
-
createVNode(_sfc_main$1, {
|
|
132
|
-
"disable-upload-by": !["all", "remind"].includes(activeKey.value),
|
|
133
|
-
filterOptions: _ctx.filterOptions,
|
|
134
|
-
onChange: unref(changeFilter),
|
|
135
|
-
onUpload: handleToUpload
|
|
136
|
-
}, null, 8, ["disable-upload-by", "filterOptions", "onChange"])
|
|
137
|
-
])) : createCommentVNode("v-if", true),
|
|
138
|
-
createCommentVNode(" \u5217\u8868\u90E8\u5206 "),
|
|
139
|
-
createElementVNode("div", _hoisted_5, [
|
|
140
|
-
createVNode(unref(Scrollbar), {
|
|
141
|
-
"outer-style": { height: "100%" },
|
|
142
|
-
style: { "height": "100%", "overflow": "auto" }
|
|
143
|
-
}, {
|
|
144
|
-
default: withCtx(() => [
|
|
145
|
-
withDirectives(createVNode(_sfc_main$2, {
|
|
146
|
-
loading: unref(loading),
|
|
147
|
-
list: unref(list),
|
|
148
|
-
disable: disableSelect.value,
|
|
149
|
-
"select-keys": selectedKeys.value,
|
|
150
|
-
onSelect: handleSelect,
|
|
151
|
-
onSelectOne: handleSelectOne
|
|
152
|
-
}, null, 8, ["loading", "list", "disable", "select-keys"]), [
|
|
153
|
-
[vShow, activeKey.value !== "local"]
|
|
154
|
-
]),
|
|
155
|
-
withDirectives(createVNode(_sfc_main$3, {
|
|
156
|
-
disable: disableSelect.value,
|
|
157
|
-
"select-keys": selectedKeys.value,
|
|
158
|
-
onSelect: handleSelect,
|
|
159
|
-
onSelectOne: handleSelectOne
|
|
160
|
-
}, null, 8, ["disable", "select-keys"]), [
|
|
161
|
-
[vShow, activeKey.value === "local"]
|
|
162
|
-
])
|
|
163
|
-
]),
|
|
164
|
-
_: 1
|
|
165
|
-
})
|
|
166
|
-
]),
|
|
167
|
-
createCommentVNode(" \u5E95\u90E8 "),
|
|
168
|
-
createElementVNode("div", _hoisted_6, [
|
|
169
|
-
createElementVNode("div", _hoisted_7, [
|
|
170
|
-
activeKey.value !== "local" ? (openBlock(), createBlock(unref(Pagination), {
|
|
171
|
-
key: 0,
|
|
172
|
-
total: unref(total),
|
|
173
|
-
"page-size": unref(limit),
|
|
174
|
-
"show-total": "",
|
|
175
|
-
"show-page-size": "",
|
|
176
|
-
"base-size": 3,
|
|
177
|
-
"buffer-size": 1,
|
|
178
|
-
onChange: _cache[1] || (_cache[1] = (e) => unref(changePage)((e - 1) * unref(limit))),
|
|
179
|
-
onPageSizeChange: unref(changeSize)
|
|
180
|
-
}, null, 8, ["total", "page-size", "onPageSizeChange"])) : createCommentVNode("v-if", true)
|
|
181
|
-
]),
|
|
182
|
-
selected.value.length ? (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
183
|
-
createVNode(_sfc_main$4, {
|
|
184
|
-
maxcount: _ctx.maxcount,
|
|
185
|
-
selected: selected.value,
|
|
186
|
-
onRemove: handleSelect,
|
|
187
|
-
onClear: handleClear
|
|
188
|
-
}, null, 8, ["maxcount", "selected"]),
|
|
189
|
-
createVNode(unref(Button), { onClick: handleClose }, {
|
|
190
|
-
default: withCtx(() => [
|
|
191
|
-
createTextVNode("\u53D6\u6D88")
|
|
192
|
-
]),
|
|
193
|
-
_: 1
|
|
194
|
-
}),
|
|
195
|
-
createVNode(unref(Button), {
|
|
196
|
-
type: "primary",
|
|
197
|
-
onClick: handleConfirm
|
|
198
|
-
}, {
|
|
199
|
-
default: withCtx(() => [
|
|
200
|
-
createTextVNode("\u786E\u5B9A")
|
|
201
|
-
]),
|
|
202
|
-
_: 1
|
|
203
|
-
})
|
|
204
|
-
])) : createCommentVNode("v-if", true)
|
|
205
|
-
])
|
|
206
|
-
])) : (openBlock(), createBlock(unref(emptyData), {
|
|
207
|
-
key: 1,
|
|
208
|
-
type: "empty",
|
|
209
|
-
customTip: "\u6682\u65E0\u6743\u9650"
|
|
210
|
-
}))
|
|
211
|
-
]);
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
export { _sfc_main as default };
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var vue = require("vue");
|
|
3
|
-
var webVue = require("@arco-design/web-vue");
|
|
4
|
-
var icon = require("@arco-design/web-vue/es/icon");
|
|
5
|
-
var index$4 = require("../../../emptyData/index.js");
|
|
6
|
-
var index = require("../ListFilter/index.js");
|
|
7
|
-
var index$1 = require("../ListContent/index.js");
|
|
8
|
-
var index$3 = require("../ListSelected/index.js");
|
|
9
|
-
var index$2 = require("../ListContentLocal/index.js");
|
|
10
|
-
var useAttachement = require("../../../hooks/useAttachement.js");
|
|
11
|
-
var config = require("../../../config.js");
|
|
12
|
-
const _hoisted_1 = { class: "resource-select-main" };
|
|
13
|
-
const _hoisted_2 = {
|
|
14
|
-
key: 0,
|
|
15
|
-
class: "resource-select-container"
|
|
16
|
-
};
|
|
17
|
-
const _hoisted_3 = { class: "resource-select-header" };
|
|
18
|
-
const _hoisted_4 = {
|
|
19
|
-
key: 0,
|
|
20
|
-
class: "resource-select-filter"
|
|
21
|
-
};
|
|
22
|
-
const _hoisted_5 = { class: "resource-select-content" };
|
|
23
|
-
const _hoisted_6 = { class: "resource-select-footer" };
|
|
24
|
-
const _hoisted_7 = { class: "footer-left" };
|
|
25
|
-
const _hoisted_8 = {
|
|
26
|
-
key: 0,
|
|
27
|
-
class: "footer-right"
|
|
28
|
-
};
|
|
29
|
-
const _sfc_main = vue.defineComponent({
|
|
30
|
-
__name: "index",
|
|
31
|
-
props: {
|
|
32
|
-
BASE_API: {},
|
|
33
|
-
userInfo: {},
|
|
34
|
-
maxcount: {},
|
|
35
|
-
filterOptions: {}
|
|
36
|
-
},
|
|
37
|
-
emits: ["close", "submit"],
|
|
38
|
-
setup(__props, { emit: __emit }) {
|
|
39
|
-
const props = __props;
|
|
40
|
-
const emits = __emit;
|
|
41
|
-
const BASE_API = props.BASE_API || config.DEFAULT_BASE_API;
|
|
42
|
-
const activeKey = vue.ref("all");
|
|
43
|
-
vue.provide("userInfo", vue.computed(() => props.userInfo));
|
|
44
|
-
vue.provide("baseAPI", BASE_API);
|
|
45
|
-
const {
|
|
46
|
-
list,
|
|
47
|
-
total,
|
|
48
|
-
limit,
|
|
49
|
-
loading,
|
|
50
|
-
changeKey,
|
|
51
|
-
changeFilter,
|
|
52
|
-
changePage,
|
|
53
|
-
changeSize
|
|
54
|
-
} = useAttachement["default"]({ key: "all", BASE_API });
|
|
55
|
-
const selected = vue.ref([]);
|
|
56
|
-
const selectedKeys = vue.computed(() => selected.value.map((item) => item.id));
|
|
57
|
-
const disableSelect = vue.computed(() => props.maxcount && selected.value.length >= props.maxcount);
|
|
58
|
-
function handleSelect(params) {
|
|
59
|
-
const { id } = params;
|
|
60
|
-
const index2 = selected.value.findIndex((item) => item.id === id);
|
|
61
|
-
if (index2 > -1)
|
|
62
|
-
selected.value.splice(index2, 1);
|
|
63
|
-
else
|
|
64
|
-
selected.value.push(params);
|
|
65
|
-
}
|
|
66
|
-
function handleClear() {
|
|
67
|
-
selected.value = [];
|
|
68
|
-
}
|
|
69
|
-
function handleClose() {
|
|
70
|
-
handleClear();
|
|
71
|
-
emits("close");
|
|
72
|
-
}
|
|
73
|
-
const handleSelectOne = (params) => {
|
|
74
|
-
if (Array.isArray(params))
|
|
75
|
-
emits("submit", params);
|
|
76
|
-
else
|
|
77
|
-
emits("submit", [params]);
|
|
78
|
-
handleClose();
|
|
79
|
-
};
|
|
80
|
-
function handleConfirm() {
|
|
81
|
-
handleSelectOne(selected.value);
|
|
82
|
-
}
|
|
83
|
-
function handleToUpload() {
|
|
84
|
-
changeKey("local");
|
|
85
|
-
activeKey.value = "local";
|
|
86
|
-
}
|
|
87
|
-
return (_ctx, _cache) => {
|
|
88
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
89
|
-
_ctx.userInfo ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
|
|
90
|
-
vue.createCommentVNode(" \u5934\u90E8 "),
|
|
91
|
-
vue.createElementVNode("div", _hoisted_3, [
|
|
92
|
-
vue.createVNode(vue.unref(webVue.Tabs), {
|
|
93
|
-
"active-key": activeKey.value,
|
|
94
|
-
"onUpdate:activeKey": _cache[0] || (_cache[0] = ($event) => activeKey.value = $event),
|
|
95
|
-
onChange: vue.unref(changeKey)
|
|
96
|
-
}, {
|
|
97
|
-
extra: vue.withCtx(() => [
|
|
98
|
-
vue.createVNode(vue.unref(webVue.Button), {
|
|
99
|
-
type: "secondary",
|
|
100
|
-
shape: "round",
|
|
101
|
-
onClick: handleClose
|
|
102
|
-
}, {
|
|
103
|
-
icon: vue.withCtx(() => [
|
|
104
|
-
vue.createVNode(vue.unref(icon.IconClose))
|
|
105
|
-
]),
|
|
106
|
-
_: 1
|
|
107
|
-
})
|
|
108
|
-
]),
|
|
109
|
-
default: vue.withCtx(() => [
|
|
110
|
-
vue.createVNode(vue.unref(webVue.TabPane), {
|
|
111
|
-
key: "all",
|
|
112
|
-
title: "\u5168\u90E8\u7D20\u6750"
|
|
113
|
-
}),
|
|
114
|
-
vue.createVNode(vue.unref(webVue.TabPane), {
|
|
115
|
-
key: "my",
|
|
116
|
-
title: "\u6211\u7684\u7D20\u6750"
|
|
117
|
-
}),
|
|
118
|
-
vue.createVNode(vue.unref(webVue.TabPane), {
|
|
119
|
-
key: "remind",
|
|
120
|
-
title: "\u63D0\u9192\u6211\u7684"
|
|
121
|
-
}),
|
|
122
|
-
vue.createVNode(vue.unref(webVue.TabPane), {
|
|
123
|
-
key: "local",
|
|
124
|
-
title: "\u672C\u5730\u7D20\u6750"
|
|
125
|
-
})
|
|
126
|
-
]),
|
|
127
|
-
_: 1
|
|
128
|
-
}, 8, ["active-key", "onChange"])
|
|
129
|
-
]),
|
|
130
|
-
vue.createCommentVNode(" \u7B5B\u9009 "),
|
|
131
|
-
activeKey.value !== "local" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [
|
|
132
|
-
vue.createVNode(index, {
|
|
133
|
-
"disable-upload-by": !["all", "remind"].includes(activeKey.value),
|
|
134
|
-
filterOptions: _ctx.filterOptions,
|
|
135
|
-
onChange: vue.unref(changeFilter),
|
|
136
|
-
onUpload: handleToUpload
|
|
137
|
-
}, null, 8, ["disable-upload-by", "filterOptions", "onChange"])
|
|
138
|
-
])) : vue.createCommentVNode("v-if", true),
|
|
139
|
-
vue.createCommentVNode(" \u5217\u8868\u90E8\u5206 "),
|
|
140
|
-
vue.createElementVNode("div", _hoisted_5, [
|
|
141
|
-
vue.createVNode(vue.unref(webVue.Scrollbar), {
|
|
142
|
-
"outer-style": { height: "100%" },
|
|
143
|
-
style: { "height": "100%", "overflow": "auto" }
|
|
144
|
-
}, {
|
|
145
|
-
default: vue.withCtx(() => [
|
|
146
|
-
vue.withDirectives(vue.createVNode(index$1, {
|
|
147
|
-
loading: vue.unref(loading),
|
|
148
|
-
list: vue.unref(list),
|
|
149
|
-
disable: disableSelect.value,
|
|
150
|
-
"select-keys": selectedKeys.value,
|
|
151
|
-
onSelect: handleSelect,
|
|
152
|
-
onSelectOne: handleSelectOne
|
|
153
|
-
}, null, 8, ["loading", "list", "disable", "select-keys"]), [
|
|
154
|
-
[vue.vShow, activeKey.value !== "local"]
|
|
155
|
-
]),
|
|
156
|
-
vue.withDirectives(vue.createVNode(index$2, {
|
|
157
|
-
disable: disableSelect.value,
|
|
158
|
-
"select-keys": selectedKeys.value,
|
|
159
|
-
onSelect: handleSelect,
|
|
160
|
-
onSelectOne: handleSelectOne
|
|
161
|
-
}, null, 8, ["disable", "select-keys"]), [
|
|
162
|
-
[vue.vShow, activeKey.value === "local"]
|
|
163
|
-
])
|
|
164
|
-
]),
|
|
165
|
-
_: 1
|
|
166
|
-
})
|
|
167
|
-
]),
|
|
168
|
-
vue.createCommentVNode(" \u5E95\u90E8 "),
|
|
169
|
-
vue.createElementVNode("div", _hoisted_6, [
|
|
170
|
-
vue.createElementVNode("div", _hoisted_7, [
|
|
171
|
-
activeKey.value !== "local" ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.Pagination), {
|
|
172
|
-
key: 0,
|
|
173
|
-
total: vue.unref(total),
|
|
174
|
-
"page-size": vue.unref(limit),
|
|
175
|
-
"show-total": "",
|
|
176
|
-
"show-page-size": "",
|
|
177
|
-
"base-size": 3,
|
|
178
|
-
"buffer-size": 1,
|
|
179
|
-
onChange: _cache[1] || (_cache[1] = (e) => vue.unref(changePage)((e - 1) * vue.unref(limit))),
|
|
180
|
-
onPageSizeChange: vue.unref(changeSize)
|
|
181
|
-
}, null, 8, ["total", "page-size", "onPageSizeChange"])) : vue.createCommentVNode("v-if", true)
|
|
182
|
-
]),
|
|
183
|
-
selected.value.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
|
|
184
|
-
vue.createVNode(index$3, {
|
|
185
|
-
maxcount: _ctx.maxcount,
|
|
186
|
-
selected: selected.value,
|
|
187
|
-
onRemove: handleSelect,
|
|
188
|
-
onClear: handleClear
|
|
189
|
-
}, null, 8, ["maxcount", "selected"]),
|
|
190
|
-
vue.createVNode(vue.unref(webVue.Button), { onClick: handleClose }, {
|
|
191
|
-
default: vue.withCtx(() => [
|
|
192
|
-
vue.createTextVNode("\u53D6\u6D88")
|
|
193
|
-
]),
|
|
194
|
-
_: 1
|
|
195
|
-
}),
|
|
196
|
-
vue.createVNode(vue.unref(webVue.Button), {
|
|
197
|
-
type: "primary",
|
|
198
|
-
onClick: handleConfirm
|
|
199
|
-
}, {
|
|
200
|
-
default: vue.withCtx(() => [
|
|
201
|
-
vue.createTextVNode("\u786E\u5B9A")
|
|
202
|
-
]),
|
|
203
|
-
_: 1
|
|
204
|
-
})
|
|
205
|
-
])) : vue.createCommentVNode("v-if", true)
|
|
206
|
-
])
|
|
207
|
-
])) : (vue.openBlock(), vue.createBlock(vue.unref(index$4), {
|
|
208
|
-
key: 1,
|
|
209
|
-
type: "empty",
|
|
210
|
-
customTip: "\u6682\u65E0\u6743\u9650"
|
|
211
|
-
}))
|
|
212
|
-
]);
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
module.exports = _sfc_main;
|
|
File without changes
|