import { option as baseOption } from '../componentBase';
import { deepClone } from '@/utils/common';

export const permissionConstant = {
  ADMIN: 'admin',
  READ: 'read',
  WRITE: 'write',
};

// 系统模块
export const permissionDic = [
  {
    label: '管理',
    value: 'admin',
  },
  {
    label: '读',
    value: 'read',
  },
  {
    label: '写',
    value: 'write',
  },
];

export const option = deepClone(baseOption);
option.header = false;
option.addBtn = false;
option.menuWidth = 200;

const hideArr = ['name', 'componentClassify', 'publicStatus'];
const columnArr = [];
option.column.forEach((element) => {
  if (hideArr.includes(element.prop)) {
    element.align = 'center';
    columnArr.push(element);
  }
});

option.column = [
  ...columnArr,
  {
    label: '组件标识',
    prop: 'identifier',
    type: 'input',
    width: 150,
  },
  {
    label: '组件版本',
    prop: 'componentVersion',
    type: 'input',
    width: 120,
  },
  {
    label: '组件描述',
    prop: 'recommend',
    type: 'input',
    width: 150,
  },
  {
    label: '组件评分',
    prop: 'stars',
    type: 'input',
    width: 100,
  },
  {
    label: '审核结果',
    prop: 'reviewOpinion',
    type: 'input',
    width: 'auto',
  },
];
