yuang-framework-ui-pc 1.1.62 → 1.1.64
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/utils/menu-util.js
CHANGED
|
@@ -13,7 +13,7 @@ function getRoutePath(path) {
|
|
|
13
13
|
if (!path || !path.includes("?")) {
|
|
14
14
|
return path;
|
|
15
15
|
}
|
|
16
|
-
return path;
|
|
16
|
+
return path.substring(0, path.indexOf("?"));
|
|
17
17
|
}
|
|
18
18
|
function getRouteComponent(menu, name, func) {
|
|
19
19
|
if (!menu.component || !isExternalLink(menu.component)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, mergeModels, ref, useModel, onMounted, resolveComponent, createBlock, openBlock } from "vue";
|
|
1
|
+
import { defineComponent, mergeModels, ref, useModel, onMounted, watch, resolveComponent, createBlock, openBlock } from "vue";
|
|
2
2
|
import { ElMessageBox } from "element-plus/es";
|
|
3
3
|
import { EleMessage } from "../utils/message";
|
|
4
4
|
import { http } from "yuang-framework-ui-common/lib/config/httpConfig";
|
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
87
|
+
fileList.value.push({ ...uploadItem });
|
|
75
88
|
}
|
|
76
|
-
const item =
|
|
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 =
|
|
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
|
-
|
|
164
|
+
fileList.value.splice(fileList.value.indexOf(uploadItem), 1);
|
|
152
165
|
emitChange();
|
|
153
166
|
});
|
|
154
167
|
});
|
|
@@ -156,13 +169,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
156
169
|
const handleRetryUpload = (uploadItem) => {
|
|
157
170
|
handleUpload(uploadItem, true);
|
|
158
171
|
};
|
|
172
|
+
watch(
|
|
173
|
+
() => props.modelValue,
|
|
174
|
+
() => {
|
|
175
|
+
init();
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
watch(
|
|
179
|
+
() => props.param,
|
|
180
|
+
() => {
|
|
181
|
+
init();
|
|
182
|
+
},
|
|
183
|
+
{ deep: true }
|
|
184
|
+
);
|
|
159
185
|
return (_ctx, _cache) => {
|
|
160
186
|
const _component_ele_upload_list = resolveComponent("ele-upload-list");
|
|
161
187
|
return openBlock(), createBlock(_component_ele_upload_list, {
|
|
162
188
|
drag: true,
|
|
163
189
|
tools: true,
|
|
164
|
-
modelValue:
|
|
165
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) =>
|
|
190
|
+
modelValue: fileList.value,
|
|
191
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => fileList.value = $event),
|
|
166
192
|
limit: _ctx.param.maxCount,
|
|
167
193
|
listType: listType.value,
|
|
168
194
|
accept: accept.value,
|
package/lib/utils/menu-util.cjs
CHANGED
|
@@ -15,7 +15,7 @@ function getRoutePath(path) {
|
|
|
15
15
|
if (!path || !path.includes("?")) {
|
|
16
16
|
return path;
|
|
17
17
|
}
|
|
18
|
-
return path;
|
|
18
|
+
return path.substring(0, path.indexOf("?"));
|
|
19
19
|
}
|
|
20
20
|
function getRouteComponent(menu, name, func) {
|
|
21
21
|
if (!menu.component || !core.isExternalLink(menu.component)) {
|
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
88
|
+
fileList.value.push({ ...uploadItem });
|
|
76
89
|
}
|
|
77
|
-
const item =
|
|
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 =
|
|
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
|
-
|
|
165
|
+
fileList.value.splice(fileList.value.indexOf(uploadItem), 1);
|
|
153
166
|
emitChange();
|
|
154
167
|
});
|
|
155
168
|
});
|
|
@@ -157,13 +170,26 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
157
170
|
const handleRetryUpload = (uploadItem) => {
|
|
158
171
|
handleUpload(uploadItem, true);
|
|
159
172
|
};
|
|
173
|
+
vue.watch(
|
|
174
|
+
() => props.modelValue,
|
|
175
|
+
() => {
|
|
176
|
+
init();
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
vue.watch(
|
|
180
|
+
() => props.param,
|
|
181
|
+
() => {
|
|
182
|
+
init();
|
|
183
|
+
},
|
|
184
|
+
{ deep: true }
|
|
185
|
+
);
|
|
160
186
|
return (_ctx, _cache) => {
|
|
161
187
|
const _component_ele_upload_list = vue.resolveComponent("ele-upload-list");
|
|
162
188
|
return vue.openBlock(), vue.createBlock(_component_ele_upload_list, {
|
|
163
189
|
drag: true,
|
|
164
190
|
tools: true,
|
|
165
|
-
modelValue:
|
|
166
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) =>
|
|
191
|
+
modelValue: fileList.value,
|
|
192
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => fileList.value = $event),
|
|
167
193
|
limit: _ctx.param.maxCount,
|
|
168
194
|
listType: listType.value,
|
|
169
195
|
accept: accept.value,
|