<script setup>
import { reactive } from 'vue'
import { iengineerlogList, iengineerlogAdd, iengineerlogUpdate, iengineerlogDelete, iengineerlogGetById, iproductionplanList, iwarnlist } from './api'
import { baseModelOptions, baseFilterOptions } from './options'

const { proxy } = getCurrentInstance();

const state = reactive({
  baseModelOptions: baseModelOptions(),
  baseFilterOptions: baseFilterOptions(),
  title: "工程日志管理",
  baseModelName: '工程日志信息',
  addBtnName: '新增工程日志',
  editBtnName: '',
  delBtnName: '',
  primaryKey: 'id',
  getTableFn: iwarnlist,
  addFn: iengineerlogAdd,
  editFn: iengineerlogUpdate,
  deleteFn: iengineerlogDelete,
  detailFn: iengineerlogGetById,
  showEditBtn: false,
  showDeleteBtn: false,
  showAddBtn: false,
  columnCount: 1,
  // rowControl: {
  //   showEditBtn: false,
  //   showDelBtn: false
  // },
  permission: {//菜单管理中添加权限
    add: 'progressAlert:page:list',
    edit: 'progressAlert:page:list',
    delete: 'progressAlert:page:list',
    detail: 'progressAlert:page:list',
  },
  // baseQuery: { day: "" },
  hideselection: true,
  pageInfo: { total: 0, base: { limit: 8, current: 1 } },
  autoQuery: false,
})
const table = ref()
onMounted(async () => {
  proxy.$getsystemdict('purpose_expenses').then(async (res) => {
    if (res.length > 0) {
      await iengineerlogList({ day: res[0].value })
      const {
        getTableData, //查询表格数据执行的函数
      } = table.value;
      await getTableData();
    }
  })
})
</script>

<template>
  <div class="app-container">
    <BaseTablePage :tableOptions="state" ref="table">
      <template v-slot:column>
        <el-table-column type="index" align="center" label="序号" width="70" />
        <el-table-column label="预警事件" align="center" prop="planName" />
        <el-table-column label="预警时间" align="center" prop="createTime" />
      </template>
      <template #control="baseScope">
        <el-table-column label="操作" align="center" width="200" fixed="right">
          <template #default="scope">
            <!-- <el-button v-hasPermi="['progressAlert:page:edit']" type="text" icon="EditPen"
              @click="baseScope.handleEdit(scope.$index, scope.row)">
              修改
            </el-button> -->
            <el-button v-hasPermi="['progressAlert:page:remove']" type="text" icon="Delete"
              @click="baseScope.deleteTableData(scope.$index, scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </template>
    </BaseTablePage>
  </div>
</template>

<style scoped></style>
