<template>
    <pro-form label-width="120px" tabsProps="2">
        <pro-form-grid style="width: 700px" colNum="2">

            <!-- <AccLvlComponent :formItemProps="{ label: '层级编号', prop: 'levelKey' }"></AccLvlComponent> -->
            <pro-select :formItemProps="{ label: '启用标志111', prop: 'useYn' }" placeholder="请选择启用标志" v-model:value="useYn"
                :optionData="options" :allowClear="true" tableName="com_usertype_info" colName="use_yn">
            </pro-select>
            <pro-select :formItemProps="{ label: '启用标志', prop: 'useYn' }" placeholder="请选择启用标志" :allowClear="true"
                tableName="com_usertype_info" colName="use_yn">
            </pro-select>
            <pro-select :formItemProps="{ label: '启用标志', prop: 'useYn' }" placeholder="请选择启用标志" :allowClear="true"
                tableName="com_usertype_info" colName="use_yn">
            </pro-select>
            <pro-form-item>
                <pro-button id="queryBtn" @click="search" :icon="h(SearchOutlined)">查询</pro-button>
            </pro-form-item>
        </pro-form-grid>
    </pro-form>

</template>

<script setup>
import { ref, watch, h, computed, onMounted, nextTick, reactive, onBeforeUnmount, inject, defineEmits, defineProps } from 'vue';
import { DoubleRightOutlined, DoubleLeftOutlined, SearchOutlined } from "@ant-design/icons-vue";
const useYn = ref('Y');
const options = ref([
    {
        item_no: 'Y',
        item_name: '启用',
    },
    {
        item_no: 'N',
        item_name: '停用',
    }]);
// 声名接收参数数据
const props = defineProps({
    brNos: String
});

watch(() => props.brNos, (newVal, oldVal) => {
    // 2.当搜索框值发生变化时,重新获取搜索结果
    if (newVal != oldVal) {
        console.log("wyq-2.brNos发生变化", newVal, oldVal)
    }
});

// watch(() => props.brNos.values, (newValue, oldValue) => {
//     console.log("wyq-2.brNos发生变化", newValue, oldValue)

// });

// 从机构面板中组件中,注入getCheckedNodes方法
const getNodes = inject('getNodes');
const emit = defineEmits(['query-report']);
function queryReport () {
    let data = {
        name: 'zhangsan',
        age: '18',
        sex: '男'
    }

    console.log("wyq-1.触发查询")
    // 调用从 DepartPanelComponent 注入的方法
    if (getNodes) {
        const result = getNodes(data);
        console.log("wyq-2.触发机构面板中的方法获取节点", result)
    } else {
        console.error("未找到方法");
    }

    // 调用从 DepartPanelComponent 注入的方法
    // if (testProvide) {
    //     const result = testProvide(data);
    //     console.log("wyq-2.testProvide", result)

    // } else {
    //     console.error("aaa未找到方法");
    // }

    emit('query-report', data);

}

const form = ref(
    {
        formDate: null,
        periodType: null,
        accountSet: null,
        currency: null,
        subjectLevel: null,
    }
);

const periodTypes = ref(
    [
        { value: 'monthly', label: '月度' },
        { value: 'quarterly', label: '季度' },
        { value: 'yearly', label: '年度' },
    ]
);

const accountSets = ref([
    { value: 'account1', label: '账套1' },
    { value: 'account2', label: '账套2' },
]);

const subjectLevels = [
    { value: 'level1', label: '一级科目' },
    { value: 'level2', label: '二级科目' },
];
</script>

<style scoped>
/* optional: you can add your styles here */
</style>
