@cmstops/pro-compo 3.9.1-rc.0 → 3.9.1-rc.1

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.
@@ -1,4 +1,3 @@
1
- import { Ref } from 'vue';
2
1
  export declare function getAttachmentsAll(BASE_API: string, query?: any): Promise<import("axios").AxiosResponse<any, any>>;
3
2
  export declare function getAttachmentsMy(BASE_API: string, query?: any): Promise<import("axios").AxiosResponse<any, any>>;
4
3
  export declare function getAttachmentsMyMessage(BASE_API: string, query: any): Promise<import("axios").AxiosResponse<any, any>>;
@@ -7,12 +6,12 @@ declare type OptionsType = {
7
6
  BASE_API: string;
8
7
  };
9
8
  export default function useAttachement(options: OptionsType): {
10
- list: Ref<any[], any[]>;
11
- total: Ref<number, number>;
12
- limit: Ref<number, number>;
13
- offset: Ref<number, number>;
9
+ list: import("vue").Ref<any[], any[]>;
10
+ total: import("vue").Ref<number, number>;
11
+ limit: import("vue").Ref<number, number>;
12
+ offset: import("vue").Ref<number, number>;
14
13
  pageIdx: import("vue").ComputedRef<number>;
15
- loading: Ref<boolean, boolean>;
14
+ loading: import("vue").Ref<boolean, boolean>;
16
15
  changeFilter: (f: any) => void;
17
16
  changeKey: (k: string) => void;
18
17
  changePage: (o: number) => void;
@@ -20,7 +19,7 @@ export default function useAttachement(options: OptionsType): {
20
19
  loadData: () => Promise<void>;
21
20
  };
22
21
  export declare function useLocalRecource(): {
23
- localList: Ref<any[], any[]>;
22
+ localList: import("vue").Ref<any[], any[]>;
24
23
  initLocalList: () => void;
25
24
  setLocalList: (list: any[]) => void;
26
25
  };
@@ -31,4 +30,24 @@ export declare const mediaUseEnum: {
31
30
  export declare function getSysRsByTag(BASE_API: string, params: any): Promise<import("axios").AxiosResponse<any, any>>;
32
31
  export declare function getSysRsClassifyList(BASE_API: string, sys_tag: number): Promise<import("axios").AxiosResponse<any, any>>;
33
32
  export declare function getSysRsPage(BASE_API: string, params: any): Promise<import("axios").AxiosResponse<any, any>>;
33
+ export declare function getDirectory(BASE_API: string, params: any): Promise<import("axios").AxiosResponse<any, any>>;
34
+ /**
35
+ * 数据结构:
36
+ * Array<{
37
+ * "id": {dirid},
38
+ * "alias": {dirname},
39
+ * "parent_id": {parent_dirid},
40
+ * "children": [],
41
+ * ...
42
+ * }>
43
+ */
44
+ declare type DirOptionsType = {
45
+ key?: string;
46
+ BASE_API: string;
47
+ };
48
+ export declare function useDirectory(options: DirOptionsType): {
49
+ tree: import("vue").Ref<any[], any[]>;
50
+ init: () => Promise<void>;
51
+ loadMore: (target: any) => Promise<void>;
52
+ };
34
53
  export {};
@@ -1,4 +1,4 @@
1
- import { ref, computed } from "vue";
1
+ import { ref, computed, onMounted } from "vue";
2
2
  import request from "../utils/request.js";
3
3
  function getAttachmentsAll(BASE_API, query) {
4
4
  return request(BASE_API, {
@@ -108,4 +108,51 @@ function getSysRsPage(BASE_API, params) {
108
108
  params
109
109
  });
110
110
  }
111
- export { useAttachement as default, getAttachmentsAll, getAttachmentsMy, getAttachmentsMyMessage, getSysRsByTag, getSysRsPage };
111
+ function getDirectory(BASE_API, params) {
112
+ return request(BASE_API, {
113
+ url: "/poplar/v3/directories",
114
+ method: "get",
115
+ params
116
+ });
117
+ }
118
+ function useDirectory(options) {
119
+ const tree = ref([]);
120
+ async function loadDirTree(parent_id) {
121
+ const params = parent_id ? { parent_id } : {};
122
+ const { code, message } = await getDirectory(options.BASE_API, params);
123
+ if (code === 0) {
124
+ if (!Array.isArray(message.data))
125
+ return [];
126
+ return message.data.map(({ alias, id }) => {
127
+ return {
128
+ title: alias,
129
+ key: id,
130
+ isLeaf: false,
131
+ children: []
132
+ };
133
+ });
134
+ }
135
+ return [];
136
+ }
137
+ async function init() {
138
+ const result = await loadDirTree();
139
+ if (!Array.isArray(result))
140
+ return;
141
+ tree.value = result;
142
+ }
143
+ async function loadMore(target) {
144
+ const children = await loadDirTree(target.key);
145
+ target.children = children;
146
+ if (children.length === 0)
147
+ target.isLeaf = true;
148
+ }
149
+ onMounted(() => {
150
+ init();
151
+ });
152
+ return {
153
+ tree,
154
+ init,
155
+ loadMore
156
+ };
157
+ }
158
+ export { useAttachement as default, getAttachmentsAll, getAttachmentsMy, getAttachmentsMyMessage, getDirectory, getSysRsByTag, getSysRsPage, useDirectory };
@@ -1,7 +1,8 @@
1
1
  import { defineComponent, inject, computed, ref, watch, onMounted, openBlock, createElementBlock, createElementVNode, createCommentVNode, createVNode, unref, withCtx, createTextVNode, toDisplayString, Fragment, renderList, createBlock, normalizeClass } from "vue";
2
- import { Input, Dropdown, Doption, Button, Select, Option, RangePicker } from "@arco-design/web-vue";
2
+ import { Input, Dropdown, Doption, Button, Select, Option, TreeSelect, RangePicker } from "@arco-design/web-vue";
3
3
  import { IconUpload } from "@arco-design/web-vue/es/icon";
4
4
  import useSelection from "../../../../hooks/useSelection.js";
5
+ import { useDirectory } from "../../../../hooks/useAttachement.js";
5
6
  import { RESOURCE_SOURCE_OPTIONS, RESOURCE_CATALOG_OPTIONS } from "../../../../utils/typeMap.js";
6
7
  import { getAccountList } from "../../../scripts/selectionApis.js";
7
8
  import { keywordsSelection } from "../../../../utils/resource.js";
@@ -56,6 +57,9 @@ const _sfc_main = defineComponent({
56
57
  });
57
58
  const resourceSource = RESOURCE_SOURCE_OPTIONS;
58
59
  const resourceCatalog = RESOURCE_CATALOG_OPTIONS;
60
+ const { tree, loadMore: loadDirMore } = useDirectory({
61
+ BASE_API: baseAPI
62
+ });
59
63
  const originFilter = {
60
64
  catalog: [],
61
65
  source: "",
@@ -64,7 +68,8 @@ const _sfc_main = defineComponent({
64
68
  keyword: "",
65
69
  precise_keyword: "",
66
70
  upload_by: null,
67
- sf: ""
71
+ sf: "",
72
+ directory_id: void 0
68
73
  };
69
74
  const filter = ref(JSON.parse(JSON.stringify(originFilter)));
70
75
  const handleReset = () => {
@@ -180,13 +185,13 @@ const _sfc_main = defineComponent({
180
185
  }, {
181
186
  content: withCtx(() => [
182
187
  createVNode(unref(Doption), { value: 0 }, {
183
- default: withCtx(() => _cache[7] || (_cache[7] = [
188
+ default: withCtx(() => _cache[8] || (_cache[8] = [
184
189
  createTextVNode("\u7CBE\u51C6\u641C")
185
190
  ])),
186
191
  _: 1
187
192
  }),
188
193
  createVNode(unref(Doption), { value: 1 }, {
189
- default: withCtx(() => _cache[8] || (_cache[8] = [
194
+ default: withCtx(() => _cache[9] || (_cache[9] = [
190
195
  createTextVNode("\u6A21\u7CCA\u641C")
191
196
  ])),
192
197
  _: 1
@@ -228,10 +233,20 @@ const _sfc_main = defineComponent({
228
233
  _: 1
229
234
  }, 8, ["modelValue", "disabled"])
230
235
  ]),
236
+ createCommentVNode(" \u76EE\u5F55 "),
237
+ createVNode(unref(TreeSelect), {
238
+ modelValue: filter.value.directory_id,
239
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => filter.value.directory_id = $event),
240
+ data: unref(tree),
241
+ "load-more": unref(loadDirMore),
242
+ placeholder: "\u8BF7\u9009\u62E9\u76EE\u5F55",
243
+ style: { "width": "180px" },
244
+ "allow-clear": ""
245
+ }, null, 8, ["modelValue", "data", "load-more"]),
231
246
  createCommentVNode(" \u65F6\u95F4\u8303\u56F4 "),
232
247
  createVNode(unref(RangePicker), {
233
248
  modelValue: rangeTime.value,
234
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => rangeTime.value = $event),
249
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => rangeTime.value = $event),
235
250
  "allow-clear": "",
236
251
  style: { "width": "240px" }
237
252
  }, null, 8, ["modelValue"]),
@@ -239,7 +254,7 @@ const _sfc_main = defineComponent({
239
254
  createElementVNode("div", _hoisted_6, [
240
255
  createVNode(unref(Select), {
241
256
  modelValue: filter.value.source,
242
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => filter.value.source = $event),
257
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => filter.value.source = $event),
243
258
  "allow-clear": "",
244
259
  placeholder: "\u6765\u6E90"
245
260
  }, {
@@ -259,7 +274,7 @@ const _sfc_main = defineComponent({
259
274
  !_ctx.disableUploadBy ? (openBlock(), createElementBlock("div", _hoisted_7, [
260
275
  createVNode(unref(Select), {
261
276
  modelValue: filter.value.upload_by,
262
- "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => filter.value.upload_by = $event),
277
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => filter.value.upload_by = $event),
263
278
  "allow-clear": "",
264
279
  placeholder: "\u4E0A\u4F20\u4EBA",
265
280
  loading: unref(loading),
@@ -284,7 +299,7 @@ const _sfc_main = defineComponent({
284
299
  type: "text",
285
300
  onClick: handleReset
286
301
  }, {
287
- default: withCtx(() => _cache[9] || (_cache[9] = [
302
+ default: withCtx(() => _cache[10] || (_cache[10] = [
288
303
  createTextVNode(" \u91CD\u7F6E ")
289
304
  ])),
290
305
  _: 1
@@ -293,13 +308,13 @@ const _sfc_main = defineComponent({
293
308
  createElementVNode("div", _hoisted_8, [
294
309
  createVNode(unref(Button), {
295
310
  type: "primary",
296
- onClick: _cache[6] || (_cache[6] = ($event) => emits("upload"))
311
+ onClick: _cache[7] || (_cache[7] = ($event) => emits("upload"))
297
312
  }, {
298
313
  icon: withCtx(() => [
299
314
  createVNode(unref(IconUpload))
300
315
  ]),
301
316
  default: withCtx(() => [
302
- _cache[10] || (_cache[10] = createTextVNode(" \u4E0A\u4F20 "))
317
+ _cache[11] || (_cache[11] = createTextVNode(" \u4E0A\u4F20 "))
303
318
  ]),
304
319
  _: 1
305
320
  })
@@ -110,9 +110,58 @@ function getSysRsPage(BASE_API, params) {
110
110
  params
111
111
  });
112
112
  }
113
+ function getDirectory(BASE_API, params) {
114
+ return request(BASE_API, {
115
+ url: "/poplar/v3/directories",
116
+ method: "get",
117
+ params
118
+ });
119
+ }
120
+ function useDirectory(options) {
121
+ const tree = vue.ref([]);
122
+ async function loadDirTree(parent_id) {
123
+ const params = parent_id ? { parent_id } : {};
124
+ const { code, message } = await getDirectory(options.BASE_API, params);
125
+ if (code === 0) {
126
+ if (!Array.isArray(message.data))
127
+ return [];
128
+ return message.data.map(({ alias, id }) => {
129
+ return {
130
+ title: alias,
131
+ key: id,
132
+ isLeaf: false,
133
+ children: []
134
+ };
135
+ });
136
+ }
137
+ return [];
138
+ }
139
+ async function init() {
140
+ const result = await loadDirTree();
141
+ if (!Array.isArray(result))
142
+ return;
143
+ tree.value = result;
144
+ }
145
+ async function loadMore(target) {
146
+ const children = await loadDirTree(target.key);
147
+ target.children = children;
148
+ if (children.length === 0)
149
+ target.isLeaf = true;
150
+ }
151
+ vue.onMounted(() => {
152
+ init();
153
+ });
154
+ return {
155
+ tree,
156
+ init,
157
+ loadMore
158
+ };
159
+ }
113
160
  exports["default"] = useAttachement;
114
161
  exports.getAttachmentsAll = getAttachmentsAll;
115
162
  exports.getAttachmentsMy = getAttachmentsMy;
116
163
  exports.getAttachmentsMyMessage = getAttachmentsMyMessage;
164
+ exports.getDirectory = getDirectory;
117
165
  exports.getSysRsByTag = getSysRsByTag;
118
166
  exports.getSysRsPage = getSysRsPage;
167
+ exports.useDirectory = useDirectory;
@@ -3,6 +3,7 @@ var vue = require("vue");
3
3
  var webVue = require("@arco-design/web-vue");
4
4
  var icon = require("@arco-design/web-vue/es/icon");
5
5
  var useSelection = require("../../../../hooks/useSelection.js");
6
+ var useAttachement = require("../../../../hooks/useAttachement.js");
6
7
  var typeMap = require("../../../../utils/typeMap.js");
7
8
  var selectionApis = require("../../../scripts/selectionApis.js");
8
9
  var resource = require("../../../../utils/resource.js");
@@ -57,6 +58,9 @@ const _sfc_main = vue.defineComponent({
57
58
  });
58
59
  const resourceSource = typeMap.RESOURCE_SOURCE_OPTIONS;
59
60
  const resourceCatalog = typeMap.RESOURCE_CATALOG_OPTIONS;
61
+ const { tree, loadMore: loadDirMore } = useAttachement.useDirectory({
62
+ BASE_API: baseAPI
63
+ });
60
64
  const originFilter = {
61
65
  catalog: [],
62
66
  source: "",
@@ -65,7 +69,8 @@ const _sfc_main = vue.defineComponent({
65
69
  keyword: "",
66
70
  precise_keyword: "",
67
71
  upload_by: null,
68
- sf: ""
72
+ sf: "",
73
+ directory_id: void 0
69
74
  };
70
75
  const filter = vue.ref(JSON.parse(JSON.stringify(originFilter)));
71
76
  const handleReset = () => {
@@ -181,13 +186,13 @@ const _sfc_main = vue.defineComponent({
181
186
  }, {
182
187
  content: vue.withCtx(() => [
183
188
  vue.createVNode(vue.unref(webVue.Doption), { value: 0 }, {
184
- default: vue.withCtx(() => _cache[7] || (_cache[7] = [
189
+ default: vue.withCtx(() => _cache[8] || (_cache[8] = [
185
190
  vue.createTextVNode("\u7CBE\u51C6\u641C")
186
191
  ])),
187
192
  _: 1
188
193
  }),
189
194
  vue.createVNode(vue.unref(webVue.Doption), { value: 1 }, {
190
- default: vue.withCtx(() => _cache[8] || (_cache[8] = [
195
+ default: vue.withCtx(() => _cache[9] || (_cache[9] = [
191
196
  vue.createTextVNode("\u6A21\u7CCA\u641C")
192
197
  ])),
193
198
  _: 1
@@ -229,10 +234,20 @@ const _sfc_main = vue.defineComponent({
229
234
  _: 1
230
235
  }, 8, ["modelValue", "disabled"])
231
236
  ]),
237
+ vue.createCommentVNode(" \u76EE\u5F55 "),
238
+ vue.createVNode(vue.unref(webVue.TreeSelect), {
239
+ modelValue: filter.value.directory_id,
240
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => filter.value.directory_id = $event),
241
+ data: vue.unref(tree),
242
+ "load-more": vue.unref(loadDirMore),
243
+ placeholder: "\u8BF7\u9009\u62E9\u76EE\u5F55",
244
+ style: { "width": "180px" },
245
+ "allow-clear": ""
246
+ }, null, 8, ["modelValue", "data", "load-more"]),
232
247
  vue.createCommentVNode(" \u65F6\u95F4\u8303\u56F4 "),
233
248
  vue.createVNode(vue.unref(webVue.RangePicker), {
234
249
  modelValue: rangeTime.value,
235
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => rangeTime.value = $event),
250
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => rangeTime.value = $event),
236
251
  "allow-clear": "",
237
252
  style: { "width": "240px" }
238
253
  }, null, 8, ["modelValue"]),
@@ -240,7 +255,7 @@ const _sfc_main = vue.defineComponent({
240
255
  vue.createElementVNode("div", _hoisted_6, [
241
256
  vue.createVNode(vue.unref(webVue.Select), {
242
257
  modelValue: filter.value.source,
243
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => filter.value.source = $event),
258
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => filter.value.source = $event),
244
259
  "allow-clear": "",
245
260
  placeholder: "\u6765\u6E90"
246
261
  }, {
@@ -260,7 +275,7 @@ const _sfc_main = vue.defineComponent({
260
275
  !_ctx.disableUploadBy ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
261
276
  vue.createVNode(vue.unref(webVue.Select), {
262
277
  modelValue: filter.value.upload_by,
263
- "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => filter.value.upload_by = $event),
278
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => filter.value.upload_by = $event),
264
279
  "allow-clear": "",
265
280
  placeholder: "\u4E0A\u4F20\u4EBA",
266
281
  loading: vue.unref(loading),
@@ -285,7 +300,7 @@ const _sfc_main = vue.defineComponent({
285
300
  type: "text",
286
301
  onClick: handleReset
287
302
  }, {
288
- default: vue.withCtx(() => _cache[9] || (_cache[9] = [
303
+ default: vue.withCtx(() => _cache[10] || (_cache[10] = [
289
304
  vue.createTextVNode(" \u91CD\u7F6E ")
290
305
  ])),
291
306
  _: 1
@@ -294,13 +309,13 @@ const _sfc_main = vue.defineComponent({
294
309
  vue.createElementVNode("div", _hoisted_8, [
295
310
  vue.createVNode(vue.unref(webVue.Button), {
296
311
  type: "primary",
297
- onClick: _cache[6] || (_cache[6] = ($event) => emits("upload"))
312
+ onClick: _cache[7] || (_cache[7] = ($event) => emits("upload"))
298
313
  }, {
299
314
  icon: vue.withCtx(() => [
300
315
  vue.createVNode(vue.unref(icon.IconUpload))
301
316
  ]),
302
317
  default: vue.withCtx(() => [
303
- _cache[10] || (_cache[10] = vue.createTextVNode(" \u4E0A\u4F20 "))
318
+ _cache[11] || (_cache[11] = vue.createTextVNode(" \u4E0A\u4F20 "))
304
319
  ]),
305
320
  _: 1
306
321
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmstops/pro-compo",
3
- "version": "3.9.1-rc.0",
3
+ "version": "3.9.1-rc.1",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vue",