<template>
    <div class="root">
        <div class="search-box">
            <el-date-picker v-model="script.filterData.timeRange" type="datetimerange" start-placeholder="值班开始时间"
                end-placeholder="值班结束时间" style="width: 400px; margin-right: 10px" size="large"
                format="YYYY-MM-DD HH:mm:ss" date-format="YYYY/MM/DD" time-format="hh:mm:ss"
                value-format="YYYY-MM-DD HH:mm:ss" />
        </div>
        <div class="event-box">
            <el-button type="primary" @click="script.openAddDialog">立即排班</el-button>
            <!-- <el-button type="primary" @click="script.gotoLedgerPage">驻地台账</el-button> -->
            <!-- <el-button type="primary" @click="script.openAddDialog">上报项目</el-button> -->
        </div>
        <DynamicTable :dataSource="script.tableData.value" :columns="script.columns" :autoHeight="true"
            :pagination="script.pagination">

        </DynamicTable>
        <div class="model-box">
            <MyDialog v-model="script.modelVisible.value" :title="script.model?.title"
                :dynamicComponent="script.model?.content" :component-props="script.model?.props"
                :onConfirm="script.model?.onConfirm" :onCancel="script.model?.onCancel" ref="dialogRef"
                :width="script.model?.width">
            </MyDialog>
            <MyDrawer v-model="script.drawerVisible.value" :title="script.drawer?.title"
                :dynamicComponent="script.drawer?.content" :component-props="script.drawer?.props"
                :onConfirm="script.drawer?.onConfirm" :onCancel="script.drawer?.onCancel" ref="drawerRef"
                :direction="script.drawer?.direction" :size="script.drawer?.size">
            </MyDrawer>
        </div>
    </div>
</template>

<script setup>
import DynamicTable from "@/component/DynamicTable/index.js";
import { Search, ArrowDown } from "@element-plus/icons-vue";
import MyDialog from "@/component/MyDialog/index.js";
import MyDrawer from "@/component/MyDrawer/index.js";
import scriptFn from "./index.js";
const script = scriptFn();
const { dialogRef, drawerRef } = script;
</script>

<style scoped>
.root {
    height: 100%;
    padding: 25px;
}

.event-box {
    margin: 20px 0;
    display: flex;
    justify-content: flex-end;
}
</style>