Browse Source

表格优化提交

main
likunming 10 months ago
parent
commit
7b0adb48a1
  1. 36
      io.sc.platform.core.frontend/src/platform/components/form/WForm.vue
  2. 4
      io.sc.platform.core.frontend/src/platform/components/form/elements/WCron.vue
  3. 5
      io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue
  4. 10
      io.sc.platform.core.frontend/src/platform/components/toolbar/WToolbar.vue

36
io.sc.platform.core.frontend/src/platform/components/form/WForm.vue

@ -1,8 +1,8 @@
<template>
<div>
<q-form ref="formRef" :autofocus="false" :greedy="true" v-bind="attrs">
<div v-if="fieldsComputed.value.length > 0" class="grid" :class="formLayoutComputed">
<template v-for="(field, index) in fieldsComputed.value as any" :key="String(index)">
<div v-if="fieldsComputed.length > 0" class="grid" :class="formLayoutComputed">
<template v-for="(field, index) in fieldsComputed as any" :key="String(index)">
<component
:is="fiedType[field.type] || field.type"
v-if="field.name"
@ -131,27 +131,35 @@ watch(
},
);
// eventBus.on('localeChanged', (local) => {
// eventBus.on('onLocaleChanged', (local) => {
// console.info('localeChanged====0----');
// nextTick(() => {
// console.info('props.fields====', props.fields);
// console.info('localeChanged====1----', props.fields);
// fields_ = ref([...props.fields]);
// for (const field of fields_.value as any) {
// if (field.name) {
// formFields[field.name] = field;
// }
// }
// localFlag.value = !localFlag.value;
// console.info('localeChanged====2----', fields_.value);
// });
// });
const fieldsComputed = computed(() => {
localFlag.value;
return fields_;
});
onUpdated(() => {
nextTick(() => {
localFlag.value = !localFlag.value;
watch(
() => props.fields.map((item) => item['label']),
(newVal, oldVal) => {
fields_ = ref([...props.fields]);
for (const field of fields_.value as any) {
if (field.name) {
formModel[field.name] = defaultValueHandler(field);
formFields[field.name] = field;
}
}
});
localFlag.value = !localFlag.value;
},
);
const fieldsComputed = computed(() => {
localFlag.value;
return fields_.value;
});
for (const field of fields_.value as any) {

4
io.sc.platform.core.frontend/src/platform/components/form/elements/WCron.vue

@ -190,13 +190,13 @@ const valueChanged = () => {
const result = Tools.join(values, ' ');
valueRef.value = result;
emit('update:modelValue', result, props.form);
emit('update:modelValue', result);
changeValue(result);
};
const updateModelValue = (value) => {
valueRef.value = value;
emit('update:modelValue', value, props.form);
emit('update:modelValue', value);
};
const changeValue = (value) => {
emit('change', {

5
io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue

@ -479,9 +479,9 @@ watch(
);
eventBus.on('onLocaleChanged', (local) => {
nextTick(() => {
table.columns = extractTableColumns.value;
handlerQueryFormShowField();
localFlag.value = !localFlag.value;
table.columns = extractTableColumns.value;
// label
Object.keys(buttonObj).forEach((btn) => {
if (typeof buttonObj[btn] === 'object' && buttonObj[btn].labelI18nKey) {
@ -574,7 +574,6 @@ const remove = () => {
})
.catch((error) => {
console.error(error);
NotifyManager.error(t('tip.operationFailed'));
});
};
const resetDefaultValues = () => {
@ -589,7 +588,6 @@ const resetDefaultValues = () => {
})
.catch((error) => {
console.error(error);
NotifyManager.error(t('tip.operationFailed'));
});
};
const buttonObj = reactive({
@ -1510,7 +1508,6 @@ const save = async () => {
.catch((error) => {
console.info('error====', error);
dialog.dialogButtons[0].loading = false;
NotifyManager.error(t('tip.operationFailed'));
});
} else {
dialog.dialogButtons[0].loading = false;

10
io.sc.platform.core.frontend/src/platform/components/toolbar/WToolbar.vue

@ -317,10 +317,14 @@ const onResize = (size) => {
isActionWidthInitializedRef.value = true;
}
reset(size.width);
};
const reset = (currentWidth) => {
const _baseActions = <any>[];
const _moreActions = <any>[];
const length = buttons_.length;
let availableWidth = size.width;
let availableWidth = currentWidth;
let width = 0;
let index = 0;
for (; index < length; index++) {
@ -366,8 +370,10 @@ eventBus.on('onLocaleChanged', () => {
extractButton(props.buttons);
handleButtons();
baseActions.value = buttons_;
localFlag.value = !localFlag.value;
isActionWidthInitializedRef.value = false;
if (!Tools.isUndefinedOrNull(containerRef.value)) {
reset(containerRef.value.offsetWidth);
}
});
});
// onUpdated(() => {

Loading…
Cancel
Save