import {
  serviceTypes,
  serviceTags,
  secrets,
  sysCoors,
  respDept,
  collectDept,
  EPSGCodes,
  ApplProcesses,
  checkStatus,
} from '../sysDic';

export const columns = [
  {
    title: '资源编号',
    dataIndex: 'serviceid',
    width: 100,
  },
  {
    title: '资源名称',
    dataIndex: 'servicename',
    width: 200,
  },
  {
    title: '资源类型',
    dataIndex: 'typename',
    width: 200,
  },
  {
    title: '资源标签',
    dataIndex: 'keywords',
    slots: { customRender: 'keywords' },
    width: 200,
  },
  {
    title: '发布人',
    dataIndex: 'publisher',
    width: 90,
  },
  {
    title: '发布时间',
    dataIndex: 'publisherdate',
    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',
    width: 170,
    slots: { customRender: 'checktime' },
  },
];

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: 'basicinfo',
    label: '',
    slot: 'basicinfo',
    component: 'Input',
  },
  {
    field: 'id',
    label: 'id',
    component: 'Input',
    show: false,
    componentProps: {
      maxLength: 36,
    },
  },
  // {
  //   field: 'serviceCode',
  //   label: '资源编码',
  //   component: 'Input',
  //   colProps: { span: 12 },
  //   componentProps: {
  //     placeholder: '请输入资源编码',
  //   },
  // },
  {
    field: 'servicename',
    label: '资源名称',
    required: true,
    component: 'Input',
    colProps: { span: 12 },
    componentProps: {
      placeholder: '请输入资源名称',
    },
  },
  {
    field: 'servicealiasname',
    label: '资源别名',
    required: true,
    component: 'Input',
    colProps: { span: 12 },
    componentProps: {
      placeholder: '请输入资源别名',
    },
  },
  // {
  //   field: 'parentId',
  //   label: '服务类型',
  //   required: true,
  //   component: 'TreeSelect',
  //   colProps: { span: 12 },
  //   componentProps: {
  //     replaceFields: {
  //       title: 'name',
  //       key: 'id',
  //       value: 'id',
  //     },
  //     maxTagCount: 10,
  //     getPopupContainer: () => document.body,
  //   },
  // },
  {
    field: 'keywords',
    label: '资源标签',
    required: true,
    component: 'Select',
    colProps: { span: 12 },
    slot: 'keywords',
  },
  {
    field: 'description',
    label: '资源描述',
    component: 'InputTextArea',
    colProps: { span: 24 },
    componentProps: {
      maxLength: 255,
      placeholder: '请输入资源描述',
    },
  },

  {
    field: 'thumbnail',
    label: '缩略图',
    slot: 'upload',
    component: 'Input',
    // componentProps: {
    //   maxLength: 255,
    // },
  },
  {
    field: 'descinfo',
    label: '',
    slot: 'descinfo',
    component: 'Input',
  },
  {
    field: 'servicetype',
    label: '资源类型',
    required: true,
    component: 'Select',
    colProps: { span: 12 },
    componentProps: {
      replaceFields: {
        title: 'label',
        key: 'value',
        value: 'value',
      },
      placeholder: '请选择资源类型',
      maxTagCount: 10,
      options: serviceTypes
    },
  },
  {
    field: 'crs',
    label: '坐标系',
    required: true,
    component: 'Select',
    colProps: { span: 12 },
    componentProps: {
      replaceFields: {
        title: 'label',
        key: 'value',
        value: 'value',
      },
      placeholder: '请选择坐标系',
      maxTagCount: 100,
      options: sysCoors
    },
  },
  {
    field: 'mapingurl',
    label: '服务地址',
    component: 'Input',
    colProps: { span: 24 },
    componentProps: {
      placeholder: '请输入服务地址',
    },
  },
  {
    field: 'dataType',
    label: '数据类型',
    required: false,
    component: 'Select',
    colProps: { span: 12 },
    componentProps: {
      replaceFields: {
        title: 'label',
        key: 'value',
        value: 'value',
      },
      placeholder: '请选择数据类型',
      maxTagCount: 100,
      options: [{ label: '二维', value: '2' }, { label: '三维', value: '3' }]
    },
  },
  {
    field: 'dataScope',
    label: '数据范围',
    component: 'Input',
    colProps: { span: 12 },
    componentProps: {
      placeholder: '请输入数据范围',
    },
  },
  {
    field: 'updateType',
    label: '更新方式',
    component: 'Input',
    colProps: { span: 12 },
    componentProps: {
      placeholder: '请输入更新方式',
    },
  },

  {
    field: 'source',
    label: '数据来源',
    component: 'Input',
    colProps: { span: 12 },
    componentProps: {
      placeholder: '请输入数据来源',
    },
  },
  // {
  //   field: 'formdatabase',
  //   label: '数据表',
  //   component: 'Input',
  //   colProps: { span: 12 },
  //   componentProps: {
  //     placeholder: '请输入数据表',
  //   },
  // },
  {
    field: 'secretlevel',
    label: '密级',
    component: 'Select',
    colProps: { span: 12 },
    componentProps: {
      replaceFields: {
        title: 'label',
        key: 'value',
        value: 'value',
      },
      placeholder: '请选择密级',
      maxTagCount: 10,
      options: secrets
    },
  },
  // {
  //   field: 'lymc',
  //   label: '数据表',
  //   component: 'Input',
  //   colProps: { span: 12 },
  //   componentProps: {
  //     placeholder: '请输入数据表',
  //   },
  // },
  {
    field: 'keepingunit',
    label: '管理部门',
    component: 'Select',
    colProps: { span: 12 },
    componentProps: {
      replaceFields: {
        title: 'label',
        key: 'value',
        value: 'value',
      },
      placeholder: '请选择管理部门',
      maxTagCount: 10,
      getPopupContainer: () => document.body,
      options: collectDept,
    },
  },
  {
    field: 'rboffice',
    label: '责任科室',
    // required: true,
    component: 'Select',
    colProps: { span: 12 },
    componentProps: {
      replaceFields: {
        title: 'label',
        key: 'value',
        value: 'value',
      },
      placeholder: '请选择责任科室',
      maxTagCount: 10,
      getPopupContainer: () => document.body,
      options: respDept
    },
  },
  {
    // field: 'publisherdate',//,publisherdate,publishdata,publisherdate
    field: 'publishdate',
    label: '发布日期',
    component: 'DatePicker',
    colProps: { span: 12 },
    dynamicDisabled: true,
    componentProps: {
      placeholder: '请输入',
    },
  },

  {
    field: 'publisher',
    label: '发布者',
    component: 'Input',
    colProps: { span: 12 },
    dynamicDisabled: true,
    componentProps: {
      placeholder: '请输入',
    },
  },
  {
    // field: 'publishdata',
    // field: 'publishdate',
    field: 'updatedate',
    label: '更新日期',
    component: 'DatePicker',
    colProps: { span: 12 },
    dynamicDisabled: true,
    componentProps: {
      placeholder: '请输入更新日期',
    },
  },

  {
    field: 'epsgCode',
    label: 'EPSC CODE',
    // required: true,
    component: 'Select',
    colProps: { span: 12 },
    componentProps: {
      placeholder: '请输入EPSC CODE',
      replaceFields: {
        title: 'label',
        key: 'value',
        value: 'value',
      },
      placeholder: '请选择EPSC CODE',
      maxTagCount: 99,
      options: EPSGCodes
    },
  },

  {
    field: 'ishistory',
    label: '是否历史版本',
    required: false,
    component: 'Select',
    colProps: { span: 12 },
    componentProps: {
      replaceFields: {
        title: 'label',
        key: 'value',
        value: 'value',
      },
      placeholder: '请选择是否历史版本',
      maxTagCount: 10,
      options: [{ label: '否', value: '0' }, { label: '是', value: '1' }]
    },
  },

  // {
  //   field: 'shsqlc',
  //   label: '适合申请流程',
  //   required: false,
  //   component: 'Select',
  //   colProps: { span: 12 },
  //   componentProps: {
  //     replaceFields: {
  //       title: 'label',
  //       key: 'value',
  //       value: 'value',
  //     },
  //     maxTagCount: 10,
  //     options: ApplProcesses
  //   },
  // },

  {
    field: 'runtimestatus',
    label: "运行状态", //状态
    component: 'RadioButtonGroup',
    colProps: { span: 12 },
    defaultValue: 1,
    componentProps: {
      options: [
        { label: "是", value: 1 }, //启用
        { label: "否", value: 0 }, //禁用
      ],
    },
  },
  {
    field: 'ispublic',
    label: "是否公开", //状态
    component: 'RadioButtonGroup',
    colProps: { span: 8 },
    defaultValue: '1',
    componentProps: {
      options: [
        { label: "是", value: '1' }, //启用
        { label: "否", value: '0' }, //禁用
      ],
    },
  },
  {
    field: 'searched',
    label: "是否共享", //状态
    component: 'RadioButtonGroup',
    colProps: { span: 8 },
    defaultValue: '1',
    componentProps: {
      options: [
        { label: "是", value: '1' }, //启用
        { label: "否", value: '0' }, //禁用
      ],
    },
  },

  {
    field: 'isShow',
    label: "是否展示", //状态
    component: 'RadioButtonGroup',
    colProps: { span: 8 },
    defaultValue: '1',
    componentProps: {
      options: [
        { label: "是", value: '1' }, //启用
        { label: "否", value: '0' }, //禁用
      ],
    },
  },
]