<script setup lang="ts">
|
import { toRaw } from 'vue';
|
import { jsonClone } from '@sa/utils';
|
import { useNaiveForm } from '@/hooks/common/form';
|
import { $t } from '@/locales';
|
|
defineOptions({
|
name: 'FeedMatchSearch'
|
});
|
|
interface Emits {
|
(e: 'search'): void;
|
}
|
|
const emit = defineEmits<Emits>();
|
|
const { formRef, validate, restoreValidation } = useNaiveForm();
|
|
const model = defineModel<Api.Analy.FeedMatchSearchParams>('model', { required: true });
|
|
const defaultModel = jsonClone(toRaw(model.value));
|
|
function resetModel() {
|
Object.assign(model.value, defaultModel);
|
}
|
|
async function reset() {
|
await restoreValidation();
|
resetModel();
|
emit('search');
|
}
|
|
async function search() {
|
await validate();
|
emit('search');
|
}
|
</script>
|
|
<template>
|
<NCard :bordered="false" size="small" class="card-wrapper">
|
<NCollapse>
|
<NCollapseItem :title="$t('common.search')" name="analy-feed-match-search">
|
<NForm ref="formRef" :model="model" label-placement="left" :label-width="80">
|
<NGrid responsive="screen" item-responsive>
|
<NFormItemGi span="24 s:12 m:6" label="时间戳" label-width="auto" path="time" class="pr-24px">
|
<NDatePicker
|
v-model:formatted-value="model.time"
|
type="datetime"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
clearable
|
/>
|
</NFormItemGi>
|
<NFormItemGi span="24 s:12 m:6" label="班次+机台" label-width="auto" path="key" class="pr-24px">
|
<NInput v-model:value="model.key" placeholder="请输入班次+机台" />
|
</NFormItemGi>
|
<NFormItemGi :show-feedback="false" span="24" class="pr-24px">
|
<NSpace class="w-full" justify="end">
|
<NButton @click="reset">
|
<template #icon>
|
<icon-ic-round-refresh class="text-icon" />
|
</template>
|
{{ $t('common.reset') }}
|
</NButton>
|
<NButton type="primary" ghost @click="search">
|
<template #icon>
|
<icon-ic-round-search class="text-icon" />
|
</template>
|
{{ $t('common.search') }}
|
</NButton>
|
</NSpace>
|
</NFormItemGi>
|
</NGrid>
|
</NForm>
|
</NCollapseItem>
|
</NCollapse>
|
</NCard>
|
</template>
|
|
<style scoped></style>
|