// @ts-ignore: 忽略
import type { FormSchemaGetter } from '#/adapter/form';
// @ts-ignore: 忽略
import type { VxeGridProps } from '#/adapter/vxe-table';

// 抽屉表单配置
export const drawerFormSchema: any | FormSchemaGetter = () => [
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入本站策略',
      type: 'textarea',
      rows: 4,
    },
    fieldName: 'siteStrategy',
    label: '本站策略',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入本站变化',
      type: 'textarea',
      rows: 4,
    },
    fieldName: 'siteChange',
    label: '本站变化',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入竞对策略',
      type: 'textarea',
      rows: 4,
    },
    fieldName: 'competitorStrategy',
    label: '竞对策略',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入竞对变化',
      type: 'textarea',
      rows: 4,
    },
    fieldName: 'competitorChange',
    label: '竞对变化',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入商圈变化',
      width: '100%',
    },
    fieldName: 'businessDistrictChange',
    label: '商圈变化',
  },
  {
    component: 'SectionTitle',
    fieldName: '_section_title',
    hideLabel: true,
    componentProps: {
      title: '内在因素评估',
    },
  },
  {
    fieldName: 'internalFactorsTable',
    label: '内在因素评估',
    hideLabel: true,
    renderComponentContent: () => {
      return {
        default: () => [],
      };
    },
  },
  {
    component: 'SectionTitle',
    fieldName: '_section_title',
    hideLabel: true,
    componentProps: {
      title: '外在因素评估',
    },
  },
  {
    fieldName: 'externalFactorsTable',
    label: '外在因素评估',
    hideLabel: true,
    renderComponentContent: () => {
      return {
        default: () => [],
      };
    },
  },
];

// 内在因素评估表格列配置
export const internalFactorsColumns: VxeGridProps['columns'] = [
  {
    field: 'item',
    title: '项目',
    width: 120,
    fixed: 'left',
  },
  {
    field: 'example',
    title: '举例',
    width: 350,
  },
  {
    field: 'disadvantage',
    title: '劣势',
    width: 300,
    editRender: { name: 'textarea' },
  },
  {
    field: 'advantage',
    title: '优势',
    width: 300,
    editRender: { name: 'textarea' },
  },
];

// 外在因素评估表格列配置
export const externalFactorsColumns: VxeGridProps['columns'] = [
  {
    field: 'item',
    title: '项目',
    width: 120,
    fixed: 'left',
  },
  {
    field: 'example',
    title: '举例',
    width: 350,
  },
  {
    field: 'threat',
    title: '威胁',
    width: 300,
    editRender: { name: 'textarea' },
  },
  {
    field: 'opportunity',
    title: '机遇',
    width: 300,
    editRender: { name: 'textarea' },
  },
];

// 默认内在因素数据
export const defaultInternalFactors = [
  {
    item: '位置',
    example: '道路商圈、可见度、易进度',
    disadvantage: '',
    advantage: '',
  },
  {
    item: '配置',
    example: '油站形象包装、加油设备、便利店设备',
    disadvantage: '',
    advantage: '',
  },
  {
    item: '商品服务',
    example: '价格、型号、品类、促销、供应稳定性、质量、销售时间性特点',
    disadvantage: '',
    advantage: '',
  },
  {
    item: '人员',
    example: '人手、服务、执行力、销售效率',
    disadvantage: '',
    advantage: '',
  },
  {
    item: '其它',
    example: '流程、政策、品牌等',
    disadvantage: '',
    advantage: '',
  },
];

// 默认外在因素数据
export const defaultExternalFactors = [
  { item: '位置', example: '潜在道路商圈规划', threat: '', opportunity: '' },
  {
    item: '竞争',
    example: '新油站/商超便利店、现有对手的变化/促销',
    threat: '',
    opportunity: '',
  },
  {
    item: '顾客',
    example: '需求变化、对油品/非油品的质量顾虑',
    threat: '',
    opportunity: '',
  },
  { item: '其它', example: '', threat: '', opportunity: '' },
];

// 业绩提升计划表格列配置
export const performancePlanColumns: VxeGridProps['columns'] = [
  {
    field: 'actionPlan',
    title: '行动计划',
    width: 200,
    editRender: { name: 'textarea' },
  },
  {
    field: 'executor',
    title: '执行人',
    width: 100,
    editRender: { name: 'input' },
  },
  {
    field: 'measurementStandard',
    title: '衡量标准',
    width: 200,
    editRender: { name: 'input' },
  },
  {
    field: 'requiredResources',
    title: '需要的资源',
    width: 200,
    editRender: { name: 'input' },
  },
  {
    field: 'startDate',
    title: '开始时间',
    width: 150,
    editRender: { name: 'inpt', props: { type: 'date' } },
  },
  {
    field: 'endDate',
    title: '结束时间',
    width: 150,
    editRender: { name: 'inpt', props: { type: 'date' } },
    slots: {
      // default: ,
    },
  },
];

// 业绩提升计划默认数据
export const defaultPerformancePlanData = [
  {
    actionPlan: '',
    executor: '',
    measurementStandard: '',
    requiredResources: '',
    startDate: '',
    endDate: '',
  },
];

// 油品销量提升表单配置
export const oilSalesPlanSchema = () => [
  {
    component: 'SectionTitle',
    fieldName: '_section_title',
    hideLabel: true,
    componentProps: {
      title: '油品销量提升',
    },
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入可能的障碍',
      type: 'textarea',
      rows: 3,
    },
    fieldName: 'oilPossibleObstacle',
    label: '可能的障碍',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入何时或如何',
      type: 'textarea',
      rows: 3,
    },
    fieldName: 'oilActionPlan',
    label: '何时或如何',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入应变计划',
      type: 'textarea',
      rows: 3,
    },
    fieldName: 'oilContingencyPlan',
    label: '应变计划',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入执行人',
    },
    fieldName: 'oilExecutor',
    label: '执行人',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入衡量的标准',
      type: 'textarea',
      rows: 2,
    },
    fieldName: 'oilMeasurementStandard',
    label: '衡量的标准',
  },
  {
    fieldName: 'oilPerformancePlanTable',
    label: '油品销量提升何时或如何表',
    hideLabel: true,
    renderComponentContent: () => {
      return {
        default: () => [],
      };
    },
  },
];

// 非油品销量提升表单配置
export const nonOilSalesPlanSchema = () => [
  {
    component: 'SectionTitle',
    fieldName: '_section_title',
    hideLabel: true,
    componentProps: {
      title: '非油品销量提升',
    },
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入可能的障碍',
      type: 'textarea',
      rows: 3,
    },
    fieldName: 'nonOilPossibleObstacle',
    label: '可能的障碍',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入何时或如何',
      type: 'textarea',
      rows: 3,
    },
    fieldName: 'nonOilActionPlan',
    label: '何时或如何',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入应变计划',
      type: 'textarea',
      rows: 3,
    },
    fieldName: 'nonOilContingencyPlan',
    label: '应变计划',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入执行人',
    },
    fieldName: 'nonOilExecutor',
    label: '执行人',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入衡量的标准',
      type: 'textarea',
      rows: 2,
    },
    fieldName: 'nonOilMeasurementStandard',
    label: '衡量的标准',
  },
  {
    fieldName: 'nonOilPerformancePlanTable',
    label: '非油品销量提升何时或如何表',
    hideLabel: true,
    renderComponentContent: () => {
      return {
        default: () => [],
      };
    },
  },
];

// 业绩提升计划表单配置
export const performancePlanSchema = () => {
  return [...oilSalesPlanSchema(), ...nonOilSalesPlanSchema()];
};

// 默认表格列配置（保留兼容）
export const defautTableColumns: VxeGridProps['columns'] = [];
