import { serviceTags, serviceTypes, checkStatus, EPSGCodes, sysCoors, secrets, respDept, collectDept, ApplProcesses, versionList } from '../sysDic'
export const columns = [
  {
    title: '文件编号',
    dataIndex: 'serviceid',
    width: 100,
  },
  {
    title: '文件名称',
    dataIndex: 'servicename',
    width: 240,
  },
  {
    title: '类型',
    dataIndex: 'typename',
    width: 90,
  },
  {
    title: '资源标签',
    dataIndex: 'keywords',
    slots: { customRender: 'keywords' },
    width: 200,
  },
  {
    title: '发布人',
    dataIndex: 'publisher',
    width: 90,
  },
  {
    title: '发布时间',
    dataIndex: 'publishdate',
    width: 200,
    slots: { customRender: 'pdate' },
  },
  {
    title: '当前环节',
    dataIndex: 'nodename',
    slots: { customRender: 'nodename' },
    width: 90,
  },
  {
    title: '当前处理人',
    dataIndex: 'checkname',
    slots: { customRender: 'checkname' },
    width: 100,
  },
  {
    title: '审核状态',
    dataIndex: 'status',
    width: 110,
    slots: { customRender: 'status' },
  },
  {
    title: '审核时间',
    dataIndex: 'checktime',
    slots: { customRender: 'checktime' },
    width: 170,
  },
];

export const searchFormSchema = [
  {
    field: 'tagValue',
    label: '资源标签',
    component: 'Select',
    componentProps: {
      options: serviceTags
    },
    colProps: { span: 6 },
  },
  {
    field: 'filterValue',
    label: '资源名称',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      maxLength: 255,
    },
  },
  {
    field: 'status',
    label: '审核状态',
    component: 'Select',
    componentProps: {
      options: checkStatus
    },
    colProps: { span: 6 },
  },
]

// 新增表单配置---用的这个
export const accountFormSchema = [
  {
    field: 'title',
    label: '',
    slot: 'title',
    component: 'Input',
  },
  {
    field: 'id',
    label: 'id',
    component: 'Input',
    show: false,
    componentProps: {
      maxLength: 36,
    },
  },
  {
    field: 'servicetype',
    label: '服务类型',
    required: true,
    component: 'Select',
    colProps: { span: 12 },
    componentProps: {
      replaceFields: {
        title: 'name',
        key: 'id',
        value: 'id',
      },
      maxTagCount: 10,
      options: serviceTypes
    },
  },
  {
    field: 'keywords',
    label: '资源标签',
    required: true,
    component: 'Select',
    colProps: { span: 12 },
    slot: 'roleSlot',
    componentProps: {
      replaceFields: {
        title: 'label',
        key: 'value',
        value: 'value',
      },
      maxTagCount: 10,
      options: serviceTags
    },
  },


  // {
  //   label: '角色',
  //   field: 'userjs',
  //   component: 'Select',
  //   colProps: { span: 24 },
  //   slot: 'roleSlot',
  //   rules: [
  //     {
  //       required: true,
  //       message: '请选择角色',
  //       type: 'array',
  //     },
  //   ],
  // },




  {
    field: 'serviceversion',
    label: '数据版本',
    component: 'Input',
    colProps: { span: 12 },
    componentProps: {
      placeholder: '请输入',
    },
  },

  {
    field: 'description',
    label: '资源描述',
    component: 'Input',
    colProps: { span: 12 },
    componentProps: {
      placeholder: '请输入',
    },
  },
  {
    field: 'keepingunit',
    label: '保管部门',
    component: 'Select',
    colProps: { span: 12 },
    componentProps: {
      replaceFields: {
        title: 'label',
        key: 'value',
        value: 'value',
      },
      maxTagCount: 10,
      options: collectDept
    },
  },
  {
    field: 'rboffice',
    label: '责任科室',
    // required: true,
    component: 'Select',
    colProps: { span: 12 },
    componentProps: {
      replaceFields: {
        title: 'name',
        key: 'code',
        value: 'code',
      },
      maxTagCount: 10,
      options: respDept
    },
  },
  {
    field: 'secretlevel',
    label: '密级',
    component: 'Select',
    colProps: { span: 12 },
    componentProps: {
      replaceFields: {
        title: 'name',
        key: 'code',
        value: 'code',
      },
      maxTagCount: 10,
      options: secrets
    },
  }, {
    field: 'crs',
    label: '坐标系',
    component: 'Select',
    colProps: { span: 12 },
    componentProps: {
      replaceFields: {
        title: 'label',
        key: 'value',
        value: 'value',
      },
      maxTagCount: 10,
      options: sysCoors
    },
  },
  {
    field: 'dataScope',
    label: '数据范围',
    component: 'Input',
    colProps: { span: 12 },
    componentProps: {
      placeholder: '请输入',
    },
  },
  {
    field: 'source',
    label: '数据来源',
    component: 'Input',
    colProps: { span: 12 },
    componentProps: {
      placeholder: '请输入',
    },
  },
  {
    field: 'epsgCode',
    label: 'EPSC CODE',
    // required: true,
    component: 'Select',
    colProps: { span: 12 },
    componentProps: {
      placeholder: '请输入EPSC CODE',
      replaceFields: {
        title: 'name',
        key: 'code',
        value: 'code',
      },
      maxTagCount: 10,
      options: EPSGCodes
    },
  },
  // {
  //   field: 'shsqlc',
  //   label: '适合申请流程',
  //   required: false,
  //   component: 'Select',
  //   colProps: { span: 12 },
  //   componentProps: {
  //     replaceFields: {
  //       title: 'label',
  //       key: 'value',
  //       value: 'value',
  //     },
  //     maxTagCount: 10,
  //     options: ApplProcesses
  //   },
  // },
  {
    field: 'bz',
    label: '备注:',
    component: 'InputTextArea',
    colProps: { span: 24 },
    componentProps: {
      maxLength: 255,
      placeholder: '请输入备注',
    },
  },

  {
    field: 'runtimestatus',
    label: '运行状态',
    component: 'RadioButtonGroup',
    colProps: { span: 6 },
    defaultValue: 0,
    componentProps: {
      options: [
        { label: "启用", value: 1 },
        { label: "禁用", value: 0 },
      ],
    },
  },

  {
    field: 'ispublic',
    label: "是否公开", //状态
    component: 'RadioButtonGroup',
    colProps: { span: 6 },
    defaultValue: '1',
    componentProps: {
      options: [
        { label: "是", value: '1' }, //启用
        { label: "否", value: '0' }, //禁用
      ],
    },
  },

  {
    field: 'searched',
    label: "是否共享", //状态
    component: 'RadioButtonGroup',
    colProps: { span: 6 },
    defaultValue: '0',
    componentProps: {
      options: [
        { label: "是", value: '1' }, //启用
        { label: "否", value: '0' }, //禁用
      ],
    },
  },

  {
    field: 'isShow',
    label: "是否展示", //状态
    component: 'RadioButtonGroup',
    colProps: { span: 6 },
    defaultValue: '1',
    componentProps: {
      options: [
        { label: "是", value: '1' }, //启用
        { label: "否", value: '0' }, //禁用
      ],
    },
  },
  {
    field: 'file',
    label: '上传附件',
    slot: 'upload',
    required: false,
    component: 'Input',
    // componentProps: {
    //   maxLength: 255,
    // },
  },

  {
    field: 'fileList',
    label: '',
    slot: 'upload-table',
    required: false,
    component: 'Input',
  },
  {
    field: 'vid',
    label: '版本',
    component: 'Select',
    colProps: { span: 8 },
    componentProps: {
      maxTagCount: 10,
      options: versionList,
    },
  },
  {
    field: 'versionNum',
    label: '版本号',
    component: 'Input',
    colProps: { span: 8 },
    componentProps: {
      placeholder: '请输入版本号',
    },
  },
  {
    field: 'isnew',
    label: "是否最新版本", //状态
    component: 'RadioButtonGroup',
    colProps: { span: 8 },
    defaultValue: '0',
    componentProps: {
      options: [
        { label: "是", value: '1' },
        { label: "否", value: '0' },
      ],
    },
  },
]


// 新增表单配置
export const accountFormSchema2 = [
  {
    field: 'title',
    label: '',
    slot: 'title',
    component: 'Input',
  },
  {
    field: 'id',
    label: 'id',
    component: 'Input',
    show: false,
    componentProps: {
      maxLength: 36,
    },
  },
  {
    field: 'version',
    label: '版本',
    component: 'TreeSelect',
    colProps: { span: 24 },
    componentProps: {
      replaceFields: {
        title: 'name',
        key: 'id',
        value: 'id',
      },
      maxTagCount: 10,
      getPopupContainer: () => document.body,
    },
  },
  {
    field: 'versionCode',
    label: '版本号',
    component: 'Input',
    colProps: { span: 24 },
    componentProps: {
      placeholder: '请输入版本号',
    },
  },
  {
    field: 'isnew',
    label: "是否最新版本", //状态
    component: 'RadioButtonGroup',
    colProps: { span: 24 },
    defaultValue: '0',
    componentProps: {
      options: [
        { label: "是", value: '1' },
        { label: "否", value: '0' },
      ],
    },
  },
]


export const fileFields = [
  // {
  //   width: '10%',
  //   title: "序号",
  //   dataIndex: "key",
  //   key: "key",
  //   align: "center",
  //   customRender: (text, record, index) => `${index + 1}`,//此处为重点
  // },
  {
    title: "序号",
    dataIndex: "key",
    key: "key",
    align: "center",
    customRender: ({ index }) => `${index + 1}`,//此处为重点
  },
  {
    title: '资源名称',
    dataIndex: 'fileName',
    width: '20%',
    slots: { customRender: 'fileName' },
  },
  {
    title: '资源编码',
    dataIndex: 'fileCode',
    width: '20%',
    slots: { customRender: 'fileCode' },
    align: 'center'
  },
  {
    title: '格式',
    dataIndex: 'fileFormat',
    width: '10%',
    align: 'center'
  },
  {
    title: '缩略图',
    dataIndex: 'thumbnail',
    width: '20%',
    slots: { customRender: 'thumbnail' },
    align: 'center'
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: '10%',
    align: 'center'
  },
  {
    title: '操作',
    dataIndex: 'operation',
    width: '12%',
    slots: { customRender: 'operation' },
    align: 'center'
  },
];