WholeProcessPlatform/frontend/src/views/shuJuTianBao/shengPiJiLu/approvalDetailSearch.vue

110 lines
2.6 KiB
Vue
Raw Normal View History

2026-05-07 08:35:20 +08:00
<template>
<div class="approval-detail-search">
<BasicSearch ref="basicSearchRef" :searchList="searchList" :initial-values="initSearchData" :zhujianfujian="'fu'" @reset="handleReset"
@finish="onSearchFinish" @values-change="onValuesChange">
<template #ftp="{ onChange }">
<fishSearch v-model="localTypeDate" width="200px" @update:modelValue="onChange" />
</template>
</BasicSearch>
</div>
</template>
<script lang="ts" setup>
import { ref, computed, onMounted, watch } from "vue";
import dayjs from "dayjs";
import BasicSearch from "@/components/BasicSearch/index.vue";
import { DateSetting } from "@/utils/enumeration";
import fishSearch from "@/components/fishSearch/index.vue";
import { useShuJuTianBaoStore } from "@/store/modules/shuJuTianBao";
interface Props {
direction: any[];
guoyuStatus: any[];
}
const props = defineProps<Props>();
const emit = defineEmits<{
(e: "reset", values: any): void;
(e: "search-finish", values: any): void;
}>();
const shuJuTianBaoStore = useShuJuTianBaoStore();
const localTypeDate = ref<string>(null);
const basicSearchRef = ref<any>();
const initSearchData = {
hbrvcd: "all",
stcd: null,
rstcd: null,
ftp: null,
direction: null,
strdt: [
2026-05-07 08:35:52 +08:00
dayjs().subtract(1, "month").startOf("month").format("YYYY-MM-DD"),
dayjs().endOf("day").format("YYYY-MM-DD"),
2026-05-07 08:35:20 +08:00
],
};
const searchData = ref<any>({ ...initSearchData });
const searchList: any = computed(() => [
{
type: "waterStation",
name: "hbrvcd",
label: "流域",
fieldProps: {
allowClear: true,
},
options: [],
},
{
span: 12,
type: "RangePicker",
name: "strdt",
label: "过鱼时间",
picker: "month",
2026-05-07 08:35:20 +08:00
fieldProps: {
format: "YYYY-MM",
valueFormat: "YYYY-MM",
2026-05-07 08:35:20 +08:00
allowClear: false,
},
presets: DateSetting.RangeButton.month,
2026-05-07 08:35:20 +08:00
},
]);
const onSearchFinish = (values: any) => {
emit("search-finish", values);
};
const onValuesChange = (changedValues: any, allValues: any) => {
searchData.value = { ...searchData.value, ...allValues };
if (
Object.keys(changedValues)[0] == "rstcd" ||
Object.keys(changedValues)[0] == "hbrvcd"
) {
const formInstance = basicSearchRef.value?.formData;
formInstance.stcd = null;
}
};
const handleReset = () => {
localTypeDate.value = null;
emit("reset", initSearchData);
};
watch(
() => initSearchData.ftp,
(newVal) => {
localTypeDate.value = newVal || "";
},
{ immediate: true }
);
onMounted(() => {
emit("search-finish", initSearchData);
shuJuTianBaoStore.getFpssOption("", "");
});
</script>
<style lang="scss"></style>