const colWidth = [
  {
    label: '用户',
    width: 120,
    align: 'left'
  },
  {
    label: '名称',
    width: 150,
    align: 'left',
    sorter: (a, b) => {
      return a.name.localeCompare(b.name)
    },
    sortDirections: ['ascend', 'descend']
  },
  {
    label: '所属',
    width: 150,
    align: 'left'
  },
  {
    label: '类型',
    width: 120,
    align: 'left'
  },
  {
    label: 'ip',
    width: 120,
    align: 'left'
  },
  {
    label: '状态',
    width: 120,
    align: 'center'
  },
  {
    label: '是否',
    width: 120,
    align: 'center'
  },
  {
    label: '服务',
    width: 120,
    align: 'left'
  },
  {
    label: '手机号',
    width: 200,
    align: 'left'
  },
  {
    label: '时间',
    width: 200,
    align: 'center'
  },
  {
    label: '文件路径',
    width: 400
  },
  {
    label: '内容',
    width: 350
  },
  {
    label: '通知方式',
    width: 240,
    align: 'center'
  },
  {
    label: '操作',
    align: 'center',
    width: 200,
    // fixed: 'right',
    resizable: false
  }
]

function setWidth(val) {
  let info = {}
  const Item = colWidth.find((item) => val.title.search(item.label) !== -1) || null
  if (Item) {
    if (val.title == '操作') {
      info = { ...Item, ...val, resizable: true }
    } else {
      info = { ...val, ...Item, resizable: true, ellipsis: true }
    }
  } else {
    info = { ...val, align: 'left', ellipsis: true, resizable: true, width: 150 }
  }
  return info
}

export { colWidth, setWidth }
