列表重置优化
This commit is contained in:
@ -46,7 +46,9 @@ export function useFormEvents({
|
|||||||
const isInput = schema?.component && defaultValueComponents.includes(schema.component);
|
const isInput = schema?.component && defaultValueComponents.includes(schema.component);
|
||||||
const isSubForm = schema?.component && arrayValueComponents.includes(schema.component);
|
const isSubForm = schema?.component && arrayValueComponents.includes(schema.component);
|
||||||
|
|
||||||
if (isSubForm) {
|
if (schema?.clearOnReset) {
|
||||||
|
formModel[key] = undefined;
|
||||||
|
} else if (isSubForm) {
|
||||||
formModel[key] = [];
|
formModel[key] = [];
|
||||||
} else if (isInput) {
|
} else if (isInput) {
|
||||||
formModel[key] = defaultValueRef.value[key] || '';
|
formModel[key] = defaultValueRef.value[key] || '';
|
||||||
|
|||||||
@ -171,6 +171,7 @@ export interface SubFormColumn extends ColumnProps {
|
|||||||
componentType?: ComponentType;
|
componentType?: ComponentType;
|
||||||
rules?: Rule[];
|
rules?: Rule[];
|
||||||
defaultValue?: any;
|
defaultValue?: any;
|
||||||
|
clearOnReset?: boolean;
|
||||||
fieldMapToTime?: FieldMapToTime; //RangerPick组件特有
|
fieldMapToTime?: FieldMapToTime; //RangerPick组件特有
|
||||||
// Render the content in the form-item tag
|
// Render the content in the form-item tag
|
||||||
render?: (renderCallbackParams: RenderCallbackParams) => VNode | VNode[] | string;
|
render?: (renderCallbackParams: RenderCallbackParams) => VNode | VNode[] | string;
|
||||||
|
|||||||
@ -128,7 +128,7 @@
|
|||||||
loadData()
|
loadData()
|
||||||
}
|
}
|
||||||
const onReset = () => {
|
const onReset = () => {
|
||||||
dateArr.value = [dayjs(props.defaultDate[0]), dayjs(props.defaultDate[1])]
|
dateArr.value = []
|
||||||
pagination.current = 1
|
pagination.current = 1
|
||||||
loadData()
|
loadData()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,7 +128,7 @@
|
|||||||
loadData()
|
loadData()
|
||||||
}
|
}
|
||||||
const onReset = () => {
|
const onReset = () => {
|
||||||
dateArr.value = [dayjs(props.defaultDate[0]), dayjs(props.defaultDate[1])]
|
dateArr.value = []
|
||||||
pagination.current = 1
|
pagination.current = 1
|
||||||
loadData()
|
loadData()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -130,7 +130,8 @@
|
|||||||
field: 'dateAppro',
|
field: 'dateAppro',
|
||||||
label: '拟稿日期',
|
label: '拟稿日期',
|
||||||
component: 'RangePicker',
|
component: 'RangePicker',
|
||||||
defaultValue: defaultDate.value,
|
defaultValue: defaultDate.value,
|
||||||
|
clearOnReset: true,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
format: 'YYYY-MM-DD',
|
format: 'YYYY-MM-DD',
|
||||||
style: { width: '100%' },
|
style: { width: '100%' },
|
||||||
|
|||||||
@ -134,7 +134,8 @@
|
|||||||
field: 'dateFrom',
|
field: 'dateFrom',
|
||||||
label: '有效期',
|
label: '有效期',
|
||||||
component: 'RangePicker',
|
component: 'RangePicker',
|
||||||
defaultValue: defaultDate.value,
|
defaultValue: defaultDate.value,
|
||||||
|
clearOnReset: true,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
format: 'YYYY-MM-DD',
|
format: 'YYYY-MM-DD',
|
||||||
style: { width: '100%' },
|
style: { width: '100%' },
|
||||||
|
|||||||
@ -124,7 +124,7 @@
|
|||||||
},
|
},
|
||||||
schemas: customSearchFormSchema,
|
schemas: customSearchFormSchema,
|
||||||
fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
|
fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
|
||||||
showResetButton: false,
|
showResetButton: true,
|
||||||
},
|
},
|
||||||
beforeFetch: (params) => {
|
beforeFetch: (params) => {
|
||||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page: params.limit};
|
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page: params.limit};
|
||||||
@ -527,4 +527,7 @@
|
|||||||
:deep(.ant-col-8:nth-child(5) .ant-select-selector) {
|
:deep(.ant-col-8:nth-child(5) .ant-select-selector) {
|
||||||
width: 172px !important;
|
width: 172px !important;
|
||||||
}
|
}
|
||||||
|
:deep(.ant-col-8:nth-child(3) .ant-form-item-label) {
|
||||||
|
width: 80px !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -29,9 +29,7 @@
|
|||||||
const logId = ref('')
|
const logId = ref('')
|
||||||
const logPath = ref('/contract/contractSalesPngPur/datalog');
|
const logPath = ref('/contract/contractSalesPngPur/datalog');
|
||||||
import { DataLog } from '/@/components/pcitc';
|
import { DataLog } from '/@/components/pcitc';
|
||||||
import { ref, computed, onMounted, onUnmounted,
|
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
||||||
|
|
||||||
} from 'vue';
|
|
||||||
|
|
||||||
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||||
import { getLngContractSalesPngPointPage, deleteLngContractSalesPngPoint} from '/@/api/contract/ContractSalesPngPur';
|
import { getLngContractSalesPngPointPage, deleteLngContractSalesPngPoint} from '/@/api/contract/ContractSalesPngPur';
|
||||||
@ -106,6 +104,7 @@
|
|||||||
label: '销售合同有效期',
|
label: '销售合同有效期',
|
||||||
component: 'RangePicker',
|
component: 'RangePicker',
|
||||||
defaultValue: defaultDate.value,
|
defaultValue: defaultDate.value,
|
||||||
|
clearOnReset: true,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
format: 'YYYY-MM-DD',
|
format: 'YYYY-MM-DD',
|
||||||
style: { width: '100%' },
|
style: { width: '100%' },
|
||||||
|
|||||||
@ -148,7 +148,8 @@
|
|||||||
field: 'datePlan',
|
field: 'datePlan',
|
||||||
label: '计划日期',
|
label: '计划日期',
|
||||||
component: 'RangePicker',
|
component: 'RangePicker',
|
||||||
defaultValue: defaultDate.value,
|
defaultValue: defaultDate.value,
|
||||||
|
clearOnReset: true,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
format: 'YYYY-MM-DD',
|
format: 'YYYY-MM-DD',
|
||||||
style: { width: '100%' },
|
style: { width: '100%' },
|
||||||
|
|||||||
@ -121,7 +121,8 @@
|
|||||||
field: 'datePlan',
|
field: 'datePlan',
|
||||||
label: '计划日期',
|
label: '计划日期',
|
||||||
component: 'RangePicker',
|
component: 'RangePicker',
|
||||||
defaultValue: defaultDate.value,
|
defaultValue: defaultDate.value,
|
||||||
|
clearOnReset: true,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
format: 'YYYY-MM-DD',
|
format: 'YYYY-MM-DD',
|
||||||
style: { width: '100%' },
|
style: { width: '100%' },
|
||||||
|
|||||||
@ -105,7 +105,8 @@
|
|||||||
field: 'dateMea',
|
field: 'dateMea',
|
||||||
label: '计量日期',
|
label: '计量日期',
|
||||||
component: 'RangePicker',
|
component: 'RangePicker',
|
||||||
defaultValue: defaultDate.value,
|
defaultValue: defaultDate.value,
|
||||||
|
clearOnReset: true,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
format: 'YYYY-MM-DD',
|
format: 'YYYY-MM-DD',
|
||||||
style: { width: '100%' },
|
style: { width: '100%' },
|
||||||
|
|||||||
@ -107,7 +107,8 @@
|
|||||||
field: 'dateEta',
|
field: 'dateEta',
|
||||||
label: '卸港ETA',
|
label: '卸港ETA',
|
||||||
component: 'RangePicker',
|
component: 'RangePicker',
|
||||||
defaultValue: defaultDate.value,
|
defaultValue: defaultDate.value,
|
||||||
|
clearOnReset: true,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
format: 'YYYY-MM-DD',
|
format: 'YYYY-MM-DD',
|
||||||
style: { width: '100%' },
|
style: { width: '100%' },
|
||||||
|
|||||||
@ -104,7 +104,8 @@
|
|||||||
field: 'dateEta',
|
field: 'dateEta',
|
||||||
label: '卸港ETA',
|
label: '卸港ETA',
|
||||||
component: 'RangePicker',
|
component: 'RangePicker',
|
||||||
defaultValue: defaultDate.value,
|
defaultValue: defaultDate.value,
|
||||||
|
clearOnReset: true,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
format: 'YYYY-MM-DD',
|
format: 'YYYY-MM-DD',
|
||||||
style: { width: '100%' },
|
style: { width: '100%' },
|
||||||
|
|||||||
@ -115,7 +115,8 @@
|
|||||||
field: 'dateEta',
|
field: 'dateEta',
|
||||||
label: '卸港ETA',
|
label: '卸港ETA',
|
||||||
component: 'RangePicker',
|
component: 'RangePicker',
|
||||||
defaultValue: defaultDate.value,
|
defaultValue: defaultDate.value,
|
||||||
|
clearOnReset: true,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
format: 'YYYY-MM-DD',
|
format: 'YYYY-MM-DD',
|
||||||
style: { width: '100%' },
|
style: { width: '100%' },
|
||||||
|
|||||||
Reference in New Issue
Block a user