<script setup>
import { reactive } from 'vue'
import { iproductionplanList, iproductionplanAdd, iproductionplanUpdate, iproductionplanDelete, iproductionplanGetById } from './api'
import { baseModelOptions, baseFilterOptions } from './options'

// const { proxy } = getCurrentInstance();

const state = reactive({
  baseModelOptions: baseModelOptions(),
  baseFilterOptions: baseFilterOptions(),
  title: "生产计划管理",
  baseModelName: '生产计划信息',
  editBtnName: '',
  delBtnName: '',
  primaryKey: 'id',
  getTableFn: iproductionplanList,
  addFn: iproductionplanAdd,
  editFn: iproductionplanUpdate,
  deleteFn: iproductionplanDelete,
  detailFn: iproductionplanGetById,
  showEditBtn: false,
  showDeleteBtn: false,
  columnCount: 1,
  addBtnName:"新增计划",
  // rowControl: {
  //   showEditBtn: false,
  //   showDelBtn: false
  // },
  permission: {//菜单管理中添加权限
    add: 'productionPlan:page:list',
    edit: 'productionPlan:page:list',
    delete: 'productionPlan:page:list',
    detail: 'productionPlan:page:list',
  },
  hideselection: true,
  pageInfo: { total: 0, base: { limit: 8, current: 1 } },
})

</script>

<template>
  <div class="app-container">
    <BaseTablePage :tableOptions="state">
      <template v-slot:column>
        <el-table-column label="计划名称" align="center" prop="planName" />
        <el-table-column label="项目阶段" align="center" prop="projectStage" />
        <el-table-column label="计划描述" align="center" prop="description" />
        <el-table-column label="计划开始时间" align="center" prop="startTime" />
        <el-table-column label="计划结束时间" align="center" prop="endTime" />
        <el-table-column label="总工期(天)" align="center" prop="duration" />
        <el-table-column label="关键节点时间" align="center" prop="keystageTime" />
        <el-table-column label="计划负责人" align="center" prop="principal" />
        <el-table-column label="创建人" align="center" prop="creator" />
        <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="['productionPlan:page:edit']" type="text" icon="EditPen"
              @click="baseScope.handleEdit(scope.$index, scope.row)">
              修改
            </el-button>
            <el-button v-hasPermi="['productionPlan: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>
