45 lines
2.2 KiB
Vue
45 lines
2.2 KiB
Vue
<template>
|
|
<BasicSearch ref="basicSearchRef" :searchList="searchList" :initial-values="initSearchData" :zhujianfujian="'fu'" @reset="handleReset" @finish="onSearchFinish">
|
|
<template #actions>
|
|
<a-button @click="hideBtn">{{ isHide ? '展开' : '隐藏' }}</a-button>
|
|
<a-button type="primary" @click="handleAdd">新增</a-button>
|
|
<a-button type="primary" @click="seeEdit">查看修改</a-button>
|
|
</template>
|
|
</BasicSearch>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref, computed, onMounted } from 'vue';
|
|
import BasicSearch from '@/components/BasicSearch/index.vue';
|
|
import { sttpGetKendoList } from '@/api/system/map/ConfigManagement';
|
|
|
|
const emit = defineEmits<{ (e: 'search-finish', values: any): void; (e: 'reset', values: any): void; (e: 'add'): void; (e: 'seeEdit'): void }>();
|
|
const basicSearchRef = ref();
|
|
const isHide = ref(false);
|
|
const sttpOption = ref([]);
|
|
|
|
const initSearchData = { baseId: 'all', rstcd: null, stnm: null, sttp: null };
|
|
|
|
const searchList: any = computed(() => [
|
|
{ type: 'jidiData', name: 'baseId', label: '水电基地', placeholder: '请输入水电基地名称', fieldProps: { allowClear: true }, options: [] },
|
|
{ type: 'Input', name: 'stnm', label: '植物园名称', placeholder: '请输入植物园名称', width: 160, fieldProps: { allowClear: true } },
|
|
{ col: isHide.value ? 0 : null, type: 'Select', name: 'sttp', label: '测站类型', width: 160, fieldProps: { allowClear: true, placeholder: '请选择测站类型' }, options: sttpOption.value }
|
|
]);
|
|
|
|
const getBaseList = async () => {
|
|
const res = await sttpGetKendoList({
|
|
filter: { logic: 'and', filters: [{ field: 'sttpCode', operator: 'in', dataType: 'string', value: ['VP', 'AI_VP_GRAZE', 'AI_VP_WATER'] }] }
|
|
});
|
|
sttpOption.value = res.data.data.map(item => ({ label: item.sttpName, value: item.sttpCode }));
|
|
};
|
|
|
|
const onSearchFinish = (values: any) => emit('search-finish', { ...values });
|
|
const hideBtn = () => { isHide.value = !isHide.value; };
|
|
const handleReset = () => emit('reset', initSearchData);
|
|
const handleAdd = () => emit('add');
|
|
const seeEdit = () => emit('seeEdit');
|
|
|
|
onMounted(() => { getBaseList(); emit('search-finish', { ...initSearchData }); });
|
|
defineExpose({ basicSearchRef });
|
|
</script>
|