<!-- API 日志 范围删除 -->
<template>
    <div class="vue-box submit-box--dialog" style="width: 500px">
        <!-- ------- 内容部分 ------- -->
        <div class="c-card">
            <el-form v-if="state.model" label-width="8em">
                <!-- no字段： m.id - id -->
                <in-input name="开始日期：" v-model="state.model.startTime" type="datetime"></in-input>
                <in-input name="结束日期：" v-model="state.model.endTime" type="datetime"></in-input>
                <in-item name="已选范围：">
                    <span style="color: red;">{{ sa.forDate(state.model.startTime, 2) }}</span> 
                    &nbsp; - &nbsp;
                    <span style="color: red;">{{ sa.forDate(state.model.endTime, 2) }} </span>
                </in-item>
                <in-item name="操作注意：">
                    <span style="color: red;">日志删除后不可恢复，请谨慎操作</span>
                </in-item>
            </el-form>
        </div>
    </div>
</template>

<script setup name="apilog-list-delete">
import {reactive} from "vue";

// ------------------ 数据 ------------------
const state = reactive({
    model: {
        startTime: '',
        endTime: '',
    }
})

// ------------------ 函数 ------------------
// 提交数据
const ok = function(){
    if (sa.isNull(state.model.startTime) || sa.isNull(state.model.endTime)) {
        return sa.error('请选择一个时间范围')
    }
    // 开始删除
    sa.ajax('/SgApilog/deleteByStartEnd', state.model, function(res){
        sa.alert('操作成功, 共删除 ' + res.data + ' 条请求记录', function() {
            sa.currView().f5();
            sa.closeModel();
        });
    });
};
defineExpose({ok})

</script>

<style scoped>

</style>
