Browse Source

表格组件查询按钮及扩展单选组件优化

main
likunming 4 weeks ago
parent
commit
416cc6438c
  1. 6
      io.sc.platform.core.frontend/src/platform/components/dialog/WDialog.vue
  2. 11
      io.sc.platform.core.frontend/src/platform/components/form/WForm.vue
  3. 12
      io.sc.platform.core.frontend/src/platform/components/grid/Top.vue
  4. 4
      io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue
  5. 6
      io.sc.platform.core.frontend/src/platform/components/radio/WExtRadio.vue

6
io.sc.platform.core.frontend/src/platform/components/dialog/WDialog.vue

@ -17,12 +17,14 @@
>
<q-card :style="generateDialogStyle">
<q-card-section style="height: 59px">
<div class="flex justify-between">
<div class="flex">
<div class="flex-1">
<div v-if="title" class="text-h6">{{ titleRef }}</div>
<template v-else>
<slot name="title"></slot>
</template>
<div class="flex justify-end gap-4">
</div>
<div class="flex-none flex gap-4">
<template v-if="buttons && buttons.length > 0">
<template v-for="(btn, index) in buttons as any" :key="index">
<q-btn

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

@ -1,12 +1,14 @@
<template>
<div>
<q-form ref="formRef" :autofocus="false" :greedy="true" v-bind="attrs">
<q-form ref="formRef" :autofocus="false" :greedy="true" v-bind="attrs" @submit.prevent="handleSubmit">
<div v-if="form.fieldArray.value.length > 0" class="grid" :style="form.cm.formLayoutStyleComputed.value">
<template v-for="(field, index) in form.fieldArray.value as any" :key="String(index)">
<FormElement :field="field"></FormElement>
</template>
</div>
<slot></slot>
<!-- 隐藏的提交按钮用于捕获回车事件 -->
<button type="submit" style="display: none"></button>
</q-form>
</div>
</template>
@ -39,10 +41,17 @@ const props = defineProps({
});
const emit = defineEmits<{
(e: 'updateValue', args: object): void;
(e: 'submit', args: object): void;
}>();
const getFormRef = () => {
return formRef.value;
};
const handleSubmit = (submitEvent: any) => {
emit('submit', {
form: instance,
value: toRaw(form.data),
});
};
const updateModelValue = (name: string, value: any) => {
if (
(form.fields[name] && (form.fields[name]['type'] !== 'w-number' || Number.isFinite(value)) && form.fields[name]['type'] !== 'w-integer') ||

12
io.sc.platform.core.frontend/src/platform/components/grid/Top.vue

@ -6,7 +6,13 @@
</template>
<template v-else>
<!-- 普通查询form -->
<w-form ref="formRef" v-bind="tools.props.queryFormAttrs" :fields="queryFormFieldsComputed" :cols-num="tools.props.queryFormColsNum"></w-form>
<w-form
ref="formRef"
v-bind="tools.props.queryFormAttrs"
:fields="queryFormFieldsComputed"
:cols-num="tools.props.queryFormColsNum"
@submit="querySubmit"
></w-form>
</template>
<!-- 标题与按钮 -->
@ -95,6 +101,10 @@ const queryFormColsNumComputed = computed(() => {
return screenCols[$q.screen.name];
});
const querySubmit = () => {
tools.apiFM.button.query();
};
// form
const handleQueryFormShowField = () => {
tools.table.queryFormDisplayFields = [];

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

@ -191,10 +191,10 @@ onMounted(async () => {
tools.opFM.resetStyleVariableValue();
}
tools.opFM.setStripe();
window.addEventListener('keydown', handleGlobalEnter);
// window.addEventListener('keydown', handleGlobalEnter);
});
onUnmounted(() => {
window.removeEventListener('keydown', handleGlobalEnter);
// window.removeEventListener('keydown', handleGlobalEnter);
});
//
onActivated(() => {

6
io.sc.platform.core.frontend/src/platform/components/radio/WExtRadio.vue

@ -123,10 +123,10 @@ const expandOptions = () => {
};
const lightLabelComputed = computed(() => {
if (props.lightNotHideOptionsLabel && !props.hideOptions) {
//if (props.lightNotHideOptionsLabel && !props.hideOptions) {
// return true;
//}
return true;
}
return false;
});
defineExpose({

Loading…
Cancel
Save