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

105 lines
2.6 KiB
Vue
Raw Normal View History

2026-04-24 17:46:41 +08:00
<template>
<div class="guoYuSheShiShuJuTianBao-search">
2026-05-07 08:35:20 +08:00
<BasicSearch ref="basicSearchRef" :searchList="searchList" :initial-values="initSearchData" :zhujianfujian="'zhu'"
2026-04-24 17:46:41 +08:00
@finish="onSearchFinish" @values-change="onValuesChange" @reset="handleReset">
2026-05-07 08:35:20 +08:00
<template #actions>
<a-tooltip title="批量审批">
<a-button :disabled="selectedCount === 0" @click="$emit('batch-approve')">
<template #icon>
<CheckSquareOutlined />
</template>
批量审批
</a-button>
</a-tooltip>
</template>
2026-04-24 17:46:41 +08:00
</BasicSearch>
</div>
</template>
<script lang="ts" setup>
import { ref, computed, onMounted } from "vue";
import BasicSearch from "@/components/BasicSearch/index.vue"; // 确保路径正确
import { getDictItemsByCode } from '@/api/dict';
2026-05-07 08:35:20 +08:00
import {
CheckSquareOutlined,
} from "@ant-design/icons-vue";
2026-04-24 17:46:41 +08:00
// --- Props & Emits ---
interface Props {
2026-05-07 08:35:20 +08:00
selectedCount?: number;
2026-04-24 17:46:41 +08:00
}
2026-05-07 08:35:20 +08:00
const props = withDefaults(defineProps<Props>(), {
selectedCount: 0
});
2026-04-24 17:46:41 +08:00
const emit = defineEmits<{
(e: "reset", values: any): void;
(e: "searchFinish", values: any): void;
2026-05-07 08:35:20 +08:00
(e: "batch-approve"): void;
2026-04-24 17:46:41 +08:00
}>();
// 模拟 initSearchData
const initSearchData = {
2026-05-07 08:35:20 +08:00
hbrvcd:'all',
stcd:'',
status: '',
2026-04-24 17:46:41 +08:00
};
const searchData = ref<any>({ ...initSearchData });
const searchList: any = computed(() => [
{
2026-05-07 08:35:20 +08:00
type: "waterStation",
name: "hbrvcd",
label: "流域",
2026-04-24 17:46:41 +08:00
fieldProps: {
allowClear: true,
},
options: [],
},
2026-05-07 08:35:20 +08:00
2026-04-24 17:46:41 +08:00
{
type: "Select",
name: "status",
label: "审批状态",
fieldProps: {
allowClear: true,
},
options: statusData.value,
},
]);
// --- Methods ---
// 2. 搜索表单逻辑
const onSearchFinish = (values: any) => {
console.log(values);
emit("searchFinish", values);
};
const handleReset = () => {
emit("reset", initSearchData);
};
const onValuesChange = (changedValues: any, allValues: any) => {
// 同步更新本地 searchData以便其他逻辑使用
searchData.value = { ...searchData.value, ...allValues };
};
// --- Lifecycle ---
onMounted(() => {
2026-05-07 08:35:20 +08:00
emit("searchFinish", initSearchData);
getstatusData()
2026-04-24 17:46:41 +08:00
});
const statusData = ref(false)
const getstatusData = () => {
2026-05-07 08:35:20 +08:00
getDictItemsByCode({ dictCode: "approvalStatus" }).then((res) => {
statusData.value = res.data;
});
2026-04-24 17:46:41 +08:00
};
</script>
2026-05-07 08:35:20 +08:00
<style lang="scss"></style>