/*
 * @Company: 沈阳信诚科技
 * @Email: html_venustar@163.com
 * @Author: Liuqiming
 * @Description: 铸坯报告配置
 * @LastEditors: Liuqiming
 * @LastEditTime: 2024-03-18 14:53:19
 * @Date: 2024-02-26 12:28:19
 */

const viewFn = ref(null)

export const init = ({view}) => {
  viewFn.value = view

  const searchList = ref([
    {
      label: '铸坯编号',
      field: 'prdNo',
      width: '340px',
      clearable: true,
      placeholder: '请输入铸坯编号',
    },
    {
      label: '报告时间',
      field: 'reportTimes',
      width: '340px',
      type: 'date',
      enum: 'daterange', // 其他类型枚举 week, month, year, date, daterange
      placeholder: '开始日期-结束日期' // 若选择框枚举类型为daterange， 此值接受 a-b 式截取提示内容展示
    }
  ])
  const btnList = ref([])
  const columns = ref([
    {
      label: "铸坯编号",
      prop: "prdNo",
      minWidth: 120
    },
    {
      label: "班组",
      prop: "teamIds",
      minWidth: 120
    },
    {
      label: "生产开始时间",
      sort: true,
      prop: "prdStartTime",
      minWidth: 110
    },
    {
      label: "生产结束时间",
      prop: "prdEndTime",
      sort: true,
      minWidth: 120
    },
    {
      label: "状态",
      prop: "status",
      sort: true,
      minWidth: 120,
      slots: (row) => {
        return <span>{ row.status === '0' ? '待发布' : '已发布' }</span>
      }
    },
    {
      label: "报告时间",
      prop: "reportTime",
      sort: true,
      minWidth: 120
    },
    {
      label: "操作",
      minWidth: 150,
      fixed:'right',
      slots: (row) => {
        if(row.status !== '0'){
          return <el-button type="primary" link onClick={() => viewFn.value(row)}>查看报告</el-button>
        }else{
          return <el-button type="primary" link onClick={() => viewFn.value(row)} v-hasPermi={['system:report:check']}>查看报告</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'
  })
  return {
    searchList,
    btnList,
    columns,
    pageSet,
    tableOption,
  }
}
