/*
 * @Company: 沈阳信诚科技
 * @Email: html_venustar@163.com
 * @Author: Liuqiming
 * @Description: 铸坯追溯配置
 * @LastEditors: Liuqiming
 * @LastEditTime: 2024-03-25 11:40:48
 * @Date: 2024-02-26 14:16:09
 */
const sectionFn = ref(null)
const timeSearchFn = ref(null)

export const init = ({
  section,
  timeSearch,
}) => {
  timeSearchFn.value = timeSearch
  sectionFn.value = section

  const searchList = ref([
    {
      label: '炉号',
      field: 'lfHeatNo',
      clearable: true,
      width: '340px',
      placeholder: '请输入炉号',
    },
    {
      label: '铸坯编号',
      field: 'prdNo',
      width: '340px',
      clearable: true,
      placeholder: '请输入铸坯编号',
    }
  ])
  const btnList = ref([])
  const columns = ref([
    {
      label: "铸坯编号",
      prop: "prdNo",
      minWidth: 120
    },
    {
      label: "炉号",
      prop: "lfHeatNo",
      minWidth: 100
    },
    {
      label: "钢种",
      prop: "steelGrade",
      minWidth: 100
    },
    {
      label: "班组",
      prop: "teamIds",
      minWidth: 120
    },
    {
      label: "生产开始时间",
      prop: "prdStartTime",
      sort: true,
      minWidth: 160
    },
    {
      label: "生产结束时间",
      prop: "prdEndTime",
      sort: true,
      minWidth: 160
    },
    {
      label: "操作",
      minWidth: 200,
      fixed:'right',
      slots: (row) => {
        return <>
          <el-button type="primary" link onClick={() => sectionFn.value(row)}>切片查询</el-button>
          <el-button type="primary" link onClick={() => timeSearchFn.value(row)}>时间查询</el-button>
        </>
      }
    },
  ])
  const pageSet = ref({
    pageNum: 1,
    pageSize: 10,
    total:0
  })

  // 表格表单公共配置
  const tableOption = ref({
    checkbox: false, // 是否展示多选框
    index: true, // 是否展示序号
    fixed: "left", // 是否将多选框及序号列固定在最左侧
    stripe: true, // 是否斑马纹表格
    border: false, // 是否表格边框
    pageHidden: false, // 是否隐藏分页
    maxHeight: '58vh',
    rowKey: 'id'
  })
  return {
    searchList,
    btnList,
    columns,
    pageSet,
    tableOption,
  }
}
