/** 服务资源列表页数据项配置 */
import { appRestApi } from '@/api/application';

// 搜索栏配置
const conditionForm = [
  {
    label: '服务资源名称',
    name: 'serviceName',
    op: 'like',
    value: '',
    component: 'ElInput',
    attr: {
      placeholder: '请输入服务资源名称'
    }
  },
  // {
  //   label: '服务提供方式',
  //   name: 'serviceProvideWay',
  //   op: '=',
  //   value: '',
  //   component: 'DgSelect',
  //   attr: {
  //     placeholder: '请选择服务提供方式',
  //     enum: 'ServiceProvideWayEnum'
  //   }
  // },
  {
    label: '服务提供应用系统名称',
    name: 'appName',
    op: 'like',
    value: '',
    component: 'SelectApp',
    apiUrl: appRestApi.table,
    valueName: "applyName",
    labelName: "applyName",
    placeholder: '请输入服务提供应用系统名称'
  }
];

// 页面操作
const pageOptList = ['新增', '导入', '同步'];

// 表头操作
const tableOptList = ['详情','修改', '删除'];

// 列表
const tableHeader = [
  {
    label: '服务资源标识符',
    prop: 'serviceCode'
  },
  {
    label: '服务资源名称',
    prop: 'serviceName'
  },
  {
    label: '服务类型',
    prop: 'serviceType',
    enum: 'ServiceResourceTypeEnum'
  },
  {
    label: '是否自用服务',
    prop: 'mustSelf',
    enum: 'BooleanEnum'
  },
  {
    label: '服务提供应用系统名称',
    prop: 'appName'
  }
];

// 表单配置
const editForm = [
  {
    label: '服务资源标识符',
    prop: 'serviceCode',
    component: 'ElInput',
    value: '',
    rules: [{ required: true, message: '请输入服务资源标识符', trigger: 'change' }],
  },
  {
    label: '服务类型',
    prop: 'serviceType',
    component: 'DgSelect',
    value: '',
    rules: [{ required: true, message: '请选择服务类型', trigger: 'change' }],
    enum: 'ServiceResourceTypeEnum',
    attr: {
      enum: 'ServiceResourceTypeEnum'
    }
  },
  {
    label: '是否自用服务',
    prop: 'mustSelf',
    component: 'DgSelect',
    enum: 'BooleanEnum',
    value: '',
    attr: {
      enum: 'BooleanEnum'
    }
  },
  {
    label: '服务资源名称',
    prop: 'serviceName',
    component: 'ElInput',
    value: '',
    rules: [{ required: true, message: '请输入服务资源名称', trigger: 'change' }]
  },
  {
    label: '服务提供方式',
    prop: 'serviceProvideWay',
    component: 'DgSelect',
    value: '',
    rules: [{ required: true, message: '请选择服务提供方式', trigger: 'change' }],
    enum: 'ServiceProvideWayEnum',
    attr: {
      enum: 'ServiceProvideWayEnum'
    }
  },
  {
    label: '服务访问地址',
    prop: 'serviceUrl',
    component: 'ElInput',
    value: '',
    rules: [{ required: true, message: '请输入服务访问地址', trigger: 'change' }],
    span: 24
  },
  {
    label: '服务提供应用系统名称',
    prop: 'appCode',
    component: 'DgSelect',
    value: '',
    rules: [{ required: true, message: '请选择服务提供应用系统名称', trigger: 'change' }],
    attr: {
      valueName: 'applyCode',
      labelName: 'applyName',
      filterable: true,
      url: "/appsvr/v2/allApps?applyStatus="
    },
    // custom: true,
    span: 24
  },
  {
    label: '应用系统事权单位代码',
    prop: 'orgCode',
    component: 'ElInput',
    value: ''
  },
  {
    label: '服务资源描述',
    prop: 'remark',
    component: 'ElInput',
    attr: {
      type: 'textarea',
      rows: 3,
    },
    value: '',
    span: 24
  }
];

export { conditionForm, pageOptList, tableOptList, tableHeader, editForm };
