yuang-framework-ui-pc 1.1.63 → 1.1.65

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.
@@ -23,7 +23,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23
23
  setup(__props, { emit: __emit }) {
24
24
  const props = __props;
25
25
  const emit = __emit;
26
- const images = ref([]);
26
+ const fileList = ref([]);
27
27
  const listType = ref(props.param.mode);
28
28
  const accept = ref("");
29
29
  if (props.param.mode == "file") {
@@ -48,15 +48,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
48
48
  };
49
49
  const model = useModel(__props, "modelValue");
50
50
  model.value = model.value ?? getShortUuid();
51
+ let isExecuting = false;
52
+ let pendingExecute = false;
51
53
  onMounted(() => {
52
54
  init();
53
55
  });
54
56
  const init = () => {
55
- images.value = [];
57
+ if (isExecuting) {
58
+ pendingExecute = true;
59
+ return;
60
+ }
61
+ isExecuting = true;
62
+ fileList.value = [];
56
63
  http.post(`${application.gatewayServerBaseUrl}/framework-api/core/framework-attachment/selectPage`, { codeForEqual: model.value, pageSize: 100 }).then((res) => {
57
64
  let attachemtList = res.data.data.records;
58
65
  for (let i = 0; i < attachemtList.length; i++) {
59
- images.value.push({
66
+ fileList.value.push({
60
67
  key: attachemtList[i].id,
61
68
  id: attachemtList[i].id,
62
69
  name: attachemtList[i].name,
@@ -64,6 +71,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
64
71
  status: "done"
65
72
  });
66
73
  }
74
+ }).finally(() => {
75
+ isExecuting = false;
76
+ if (pendingExecute) {
77
+ pendingExecute = false;
78
+ init();
79
+ }
67
80
  });
68
81
  };
69
82
  const handleUpload = (uploadItem, retry) => {
@@ -71,9 +84,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
71
84
  return;
72
85
  }
73
86
  if (!retry) {
74
- images.value.push({ ...uploadItem });
87
+ fileList.value.push({ ...uploadItem });
75
88
  }
76
- const item = images.value.find((t) => t.key === uploadItem.key);
89
+ const item = fileList.value.find((t) => t.key === uploadItem.key);
77
90
  console.log(JSON.parse(JSON.stringify(item)));
78
91
  if (!item) {
79
92
  return;
@@ -123,7 +136,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
123
136
  data: formData
124
137
  }).then((res) => {
125
138
  EleMessage.success(res.data.message);
126
- const oldItem = images.value.find((t) => t.key === item.key);
139
+ const oldItem = fileList.value.find((t) => t.key === item.key);
127
140
  if (oldItem) {
128
141
  oldItem.url = void 0;
129
142
  oldItem.name = newItem.name;
@@ -148,7 +161,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
148
161
  ElMessageBox.confirm("确定要删除吗?", "系统提示", { type: "warning", draggable: true }).then(() => {
149
162
  http.get(`${application.gatewayServerBaseUrl}/framework-api/core/framework-attachment/deleteInfo`, { params: { id } }).then((res) => {
150
163
  EleMessage.success(res.data.message);
151
- images.value.splice(images.value.indexOf(uploadItem), 1);
164
+ fileList.value.splice(fileList.value.indexOf(uploadItem), 1);
152
165
  emitChange();
153
166
  });
154
167
  });
@@ -174,8 +187,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
174
187
  return openBlock(), createBlock(_component_ele_upload_list, {
175
188
  drag: true,
176
189
  tools: true,
177
- modelValue: images.value,
178
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => images.value = $event),
190
+ modelValue: fileList.value,
191
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => fileList.value = $event),
179
192
  limit: _ctx.param.maxCount,
180
193
  listType: listType.value,
181
194
  accept: accept.value,
@@ -0,0 +1 @@
1
+ import "./index.scss";
@@ -24,7 +24,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
24
24
  setup(__props, { emit: __emit }) {
25
25
  const props = __props;
26
26
  const emit = __emit;
27
- const images = vue.ref([]);
27
+ const fileList = vue.ref([]);
28
28
  const listType = vue.ref(props.param.mode);
29
29
  const accept = vue.ref("");
30
30
  if (props.param.mode == "file") {
@@ -49,15 +49,22 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
49
49
  };
50
50
  const model = vue.useModel(__props, "modelValue");
51
51
  model.value = model.value ?? uuidUtils.getShortUuid();
52
+ let isExecuting = false;
53
+ let pendingExecute = false;
52
54
  vue.onMounted(() => {
53
55
  init();
54
56
  });
55
57
  const init = () => {
56
- images.value = [];
58
+ if (isExecuting) {
59
+ pendingExecute = true;
60
+ return;
61
+ }
62
+ isExecuting = true;
63
+ fileList.value = [];
57
64
  httpConfig.http.post(`${applicationConfig.application.gatewayServerBaseUrl}/framework-api/core/framework-attachment/selectPage`, { codeForEqual: model.value, pageSize: 100 }).then((res) => {
58
65
  let attachemtList = res.data.data.records;
59
66
  for (let i = 0; i < attachemtList.length; i++) {
60
- images.value.push({
67
+ fileList.value.push({
61
68
  key: attachemtList[i].id,
62
69
  id: attachemtList[i].id,
63
70
  name: attachemtList[i].name,
@@ -65,6 +72,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
65
72
  status: "done"
66
73
  });
67
74
  }
75
+ }).finally(() => {
76
+ isExecuting = false;
77
+ if (pendingExecute) {
78
+ pendingExecute = false;
79
+ init();
80
+ }
68
81
  });
69
82
  };
70
83
  const handleUpload = (uploadItem, retry) => {
@@ -72,9 +85,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
72
85
  return;
73
86
  }
74
87
  if (!retry) {
75
- images.value.push({ ...uploadItem });
88
+ fileList.value.push({ ...uploadItem });
76
89
  }
77
- const item = images.value.find((t) => t.key === uploadItem.key);
90
+ const item = fileList.value.find((t) => t.key === uploadItem.key);
78
91
  console.log(JSON.parse(JSON.stringify(item)));
79
92
  if (!item) {
80
93
  return;
@@ -124,7 +137,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
124
137
  data: formData
125
138
  }).then((res) => {
126
139
  message.EleMessage.success(res.data.message);
127
- const oldItem = images.value.find((t) => t.key === item.key);
140
+ const oldItem = fileList.value.find((t) => t.key === item.key);
128
141
  if (oldItem) {
129
142
  oldItem.url = void 0;
130
143
  oldItem.name = newItem.name;
@@ -149,7 +162,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
149
162
  es.ElMessageBox.confirm("确定要删除吗?", "系统提示", { type: "warning", draggable: true }).then(() => {
150
163
  httpConfig.http.get(`${applicationConfig.application.gatewayServerBaseUrl}/framework-api/core/framework-attachment/deleteInfo`, { params: { id } }).then((res) => {
151
164
  message.EleMessage.success(res.data.message);
152
- images.value.splice(images.value.indexOf(uploadItem), 1);
165
+ fileList.value.splice(fileList.value.indexOf(uploadItem), 1);
153
166
  emitChange();
154
167
  });
155
168
  });
@@ -175,8 +188,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
175
188
  return vue.openBlock(), vue.createBlock(_component_ele_upload_list, {
176
189
  drag: true,
177
190
  tools: true,
178
- modelValue: images.value,
179
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => images.value = $event),
191
+ modelValue: fileList.value,
192
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => fileList.value = $event),
180
193
  limit: _ctx.param.maxCount,
181
194
  listType: listType.value,
182
195
  accept: accept.value,
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ require("./index.scss");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuang-framework-ui-pc",
3
- "version": "1.1.63",
3
+ "version": "1.1.65",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite --host --config vite.global.ts --mode dev",