free-fe-core-modules 0.0.51 → 0.0.53
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.
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
:key="index"
|
|
19
19
|
clickable
|
|
20
20
|
v-close-popup
|
|
21
|
-
@click="
|
|
21
|
+
@click="setTheme(tm)"
|
|
22
22
|
:active="theme === tm"
|
|
23
23
|
>
|
|
24
24
|
<q-item-section>{{$t(tm)}}</q-item-section>
|
|
@@ -39,6 +39,7 @@ export default defineComponent({
|
|
|
39
39
|
icon: { type: String, default: 'fas fa-palette' },
|
|
40
40
|
dense: { type: Boolean, default: true },
|
|
41
41
|
hide: { type: Boolean, default: false },
|
|
42
|
+
reload: { type: Boolean, default: false },
|
|
42
43
|
},
|
|
43
44
|
data() {
|
|
44
45
|
return {
|
|
@@ -102,6 +103,17 @@ export default defineComponent({
|
|
|
102
103
|
const appStore = useAppStore();
|
|
103
104
|
this.theme = appStore.theme || this.ctx.config.defaultTheme || (this.themes && (this.themes.length > 0) && this.themes[0]);
|
|
104
105
|
},
|
|
106
|
+
methods: {
|
|
107
|
+
setTheme(tm) {
|
|
108
|
+
if (!tm || this.theme === tm) return;
|
|
109
|
+
|
|
110
|
+
this.theme = tm;
|
|
111
|
+
|
|
112
|
+
if (this.reload) {
|
|
113
|
+
window.location.reload();
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
},
|
|
105
117
|
});
|
|
106
118
|
</script>
|
|
107
119
|
|
|
@@ -282,8 +282,8 @@ export default defineComponent({
|
|
|
282
282
|
|
|
283
283
|
const selfValidate = () => {
|
|
284
284
|
if (props.Field?.Required) {
|
|
285
|
-
hasError.value = fieldData.value?.
|
|
286
|
-
return fieldData.value?.
|
|
285
|
+
hasError.value = !!fieldData.value?.id;
|
|
286
|
+
return !!fieldData.value?.id;
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
const rules = Array.isArray(typeof props.Field.Rules) ? props.Field.Rules : [props.Field.Rules];
|
|
@@ -309,42 +309,41 @@ export default defineComponent({
|
|
|
309
309
|
};
|
|
310
310
|
|
|
311
311
|
const uploaded = (info) => {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
const file = info.files[i];
|
|
312
|
+
// File组件只允许一个文件
|
|
313
|
+
const file = info.files[0];
|
|
315
314
|
|
|
316
|
-
|
|
317
|
-
let res;
|
|
318
|
-
if (xhr && xhr.response) {
|
|
319
|
-
if (typeof xhr.response === 'string') {
|
|
320
|
-
//
|
|
321
|
-
res = JSON.parse(xhr.response);
|
|
322
|
-
} else if (typeof xhr.response === 'object') {
|
|
323
|
-
//
|
|
324
|
-
res = xhr.response;
|
|
325
|
-
} else {
|
|
326
|
-
//
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
315
|
+
if (!file) return;
|
|
329
316
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
uploadedFiles.push(file);
|
|
317
|
+
const { xhr } = file;
|
|
318
|
+
let res;
|
|
319
|
+
if (xhr && xhr.response) {
|
|
320
|
+
if (typeof xhr.response === 'string') {
|
|
321
|
+
//
|
|
322
|
+
res = JSON.parse(xhr.response);
|
|
323
|
+
} else if (typeof xhr.response === 'object') {
|
|
324
|
+
//
|
|
325
|
+
res = xhr.response;
|
|
326
|
+
} else {
|
|
327
|
+
//
|
|
328
|
+
return;
|
|
343
329
|
}
|
|
344
|
-
}
|
|
345
330
|
|
|
346
|
-
|
|
347
|
-
|
|
331
|
+
if (res && res.msg === 'OK') {
|
|
332
|
+
setFieldData({
|
|
333
|
+
id: res.data.id,
|
|
334
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
335
|
+
sizeLabel: file.__sizeLabel,
|
|
336
|
+
name: file.name,
|
|
337
|
+
size: file.size,
|
|
338
|
+
type: file.type,
|
|
339
|
+
}, emit);
|
|
340
|
+
selfValidate();
|
|
341
|
+
}
|
|
342
|
+
} else if (file.id) {
|
|
343
|
+
// old files
|
|
344
|
+
setFieldData(file, emit);
|
|
345
|
+
selfValidate();
|
|
346
|
+
}
|
|
348
347
|
}
|
|
349
348
|
|
|
350
349
|
const { validate } = useFormValidator();
|
|
@@ -108,8 +108,8 @@
|
|
|
108
108
|
flat
|
|
109
109
|
class="file-list-item"
|
|
110
110
|
v-for="(file, index) in fieldData.value" :key="index">
|
|
111
|
-
<e-icon class="file-image"
|
|
112
|
-
:name="fileThumb(file)"
|
|
111
|
+
<e-icon class="file-image"
|
|
112
|
+
:name="fileThumb(file)"
|
|
113
113
|
:thumb="!Field?.Options?.NoThumb"
|
|
114
114
|
:relative="filePreviewType(file) !== 'image'"
|
|
115
115
|
@click="preview(file)">
|
|
@@ -249,8 +249,8 @@ export default defineComponent({
|
|
|
249
249
|
|
|
250
250
|
const selfValidate = () => {
|
|
251
251
|
if (props.Field?.Required) {
|
|
252
|
-
hasError.value = fieldData.value?.
|
|
253
|
-
return fieldData.value?.
|
|
252
|
+
hasError.value = !!fieldData.value?.id;
|
|
253
|
+
return !!fieldData.value?.id;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
const rules = Array.isArray(typeof props.Field.Rules) ? props.Field.Rules : [props.Field.Rules];
|
|
@@ -276,42 +276,41 @@ export default defineComponent({
|
|
|
276
276
|
};
|
|
277
277
|
|
|
278
278
|
const uploaded = (info) => {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
const file = info.files[i];
|
|
279
|
+
// Image组件只允许一个图片
|
|
280
|
+
const file = info.files[0];
|
|
282
281
|
|
|
283
|
-
|
|
284
|
-
let res;
|
|
285
|
-
if (xhr && xhr.response) {
|
|
286
|
-
if (typeof xhr.response === 'string') {
|
|
287
|
-
//
|
|
288
|
-
res = JSON.parse(xhr.response);
|
|
289
|
-
} else if (typeof xhr.response === 'object') {
|
|
290
|
-
//
|
|
291
|
-
res = xhr.response;
|
|
292
|
-
} else {
|
|
293
|
-
//
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
282
|
+
if (!file) return;
|
|
296
283
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
uploadedFiles.push(file);
|
|
284
|
+
const { xhr } = file;
|
|
285
|
+
let res;
|
|
286
|
+
if (xhr && xhr.response) {
|
|
287
|
+
if (typeof xhr.response === 'string') {
|
|
288
|
+
//
|
|
289
|
+
res = JSON.parse(xhr.response);
|
|
290
|
+
} else if (typeof xhr.response === 'object') {
|
|
291
|
+
//
|
|
292
|
+
res = xhr.response;
|
|
293
|
+
} else {
|
|
294
|
+
//
|
|
295
|
+
return;
|
|
310
296
|
}
|
|
311
|
-
}
|
|
312
297
|
|
|
313
|
-
|
|
314
|
-
|
|
298
|
+
if (res && res.msg === 'OK') {
|
|
299
|
+
setFieldData({
|
|
300
|
+
id: res.data.id,
|
|
301
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
302
|
+
sizeLabel: file.__sizeLabel,
|
|
303
|
+
name: file.name,
|
|
304
|
+
size: file.size,
|
|
305
|
+
type: file.type,
|
|
306
|
+
}, emit);
|
|
307
|
+
selfValidate();
|
|
308
|
+
}
|
|
309
|
+
} else if (file.id) {
|
|
310
|
+
// old files
|
|
311
|
+
setFieldData(file, emit);
|
|
312
|
+
selfValidate();
|
|
313
|
+
}
|
|
315
314
|
}
|
|
316
315
|
|
|
317
316
|
const { validate } = useFormValidator();
|
|
@@ -157,7 +157,7 @@ export default defineComponent({
|
|
|
157
157
|
|
|
158
158
|
const inputNode = computed(() => h(QInput, {
|
|
159
159
|
type: mask.value ? 'text' : 'number',
|
|
160
|
-
mask,
|
|
160
|
+
mask: mask.value,
|
|
161
161
|
maxlength: props.Field.Options?.MaxLength,
|
|
162
162
|
autocomplete: 'off',
|
|
163
163
|
// bottomSlots: true,
|
|
@@ -166,10 +166,10 @@
|
|
|
166
166
|
{{$t(option.opt.Tooltip) || ''}}
|
|
167
167
|
</q-tooltip>
|
|
168
168
|
<div class="option-inner-extra" v-if="option.InnerExtra?.length">
|
|
169
|
-
<
|
|
169
|
+
<free-field
|
|
170
170
|
v-for="(fld, idx) in option.InnerExtra || []" :key="idx"
|
|
171
171
|
:Field="fld"
|
|
172
|
-
:values="data"></
|
|
172
|
+
:values="data"></free-field>
|
|
173
173
|
</div>
|
|
174
174
|
</q-checkbox>
|
|
175
175
|
</div>
|