<template>
    <el-card shadow="always" class="search_header_top_row1">

        <el-form :inline="true" :model="filterForm" class="demo-form-inline">
            <!-- <el-form-item label="关键字">
                <el-input v-model.trim="filterForm.keyword" placeholder="请输入关键字" clearable />
            </el-form-item> -->

            <el-form-item label="编码">
                <el-input v-model.trim="filterForm.code" placeholder="请输入编码" clearable />
            </el-form-item>
            <el-form-item label="装备名称">
                <el-input v-model.trim="filterForm.name" placeholder="请输入装备名称" clearable />
            </el-form-item>
            <el-form-item label="企业名称">
                <el-input v-model.trim="filterForm.companyName" placeholder="请输入企业名称" clearable />
            </el-form-item>
            <el-form-item label="装备类型">
                <el-cascader :options="treeList" filterable v-model.trim="filterForm.typeId" clearable :props="{
                    label: 'name',
                    value: 'id'

                }" />
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="serachFn">查询</el-button>
                <el-button type="plain" @click="resetFn">重置</el-button>

            </el-form-item>
            <el-form-item>
                <el-button type="primary" :disabled="props.selectItemList.length == 0" @click="auditBatchFn">批量审批</el-button>
                <!-- <el-button type="primary" :disabled="props.selectItemList.length==0"  @click="deleteBatchFn">批量下架</el-button> -->
                <el-button type="primary" @click="exportFn">导出</el-button>
            </el-form-item>



        </el-form>

    </el-card>
</template>

<script lang="ts" setup>
const emits = defineEmits(['search', 'reset', 'auditBatch', 'export', 'deleteBatch'])
import { typeTreeSelect } from "http/api/equip"
const props = defineProps({
    selectItemList: {
        type: Array,
        default: []
    }
})
const filterForm = reactive({
    code: "",
    name: '',
    companyName: "",
    typeId: []
})

const treeList = ref([])

const serachFn = () => {
    emits('search', filterForm)
}

const resetFn = () => {
    filterForm.code = ""
    filterForm.name = ''
    filterForm.companyName = ""
    filterForm.typeId = []

    emits('reset', filterForm)
}

const exportFn = () => {
    emits('export')
}
const auditBatchFn = () => {
    emits('auditBatch')
}
const deleteBatchFn = () => {
    emits('deleteBatch')
}

const initTreeData = async () => {
    const res: any = await typeTreeSelect({})
    console.log("RES", res)
    treeList.value = res.data
}

onMounted(() => {
    initTreeData()
})
</script>

<style scoped lang="scss"></style>
