import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';


export const querySchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    fieldName: 'deptName',
    label: '部门名称',
  },
  {
    component: 'Input',
    fieldName: 'policeName',
    label: '人员姓名',
  },
  {
    fieldName: 'salaryYearMonth',
    label: '工资月份',
    component: 'DatePicker',
    componentProps : {
      picker: 'month',
      valueFormat: 'YYYY-MM',
    }
  },
];

// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
  { type: 'checkbox', width: 60 },
  
  {
    title: '人员姓名',
    field: 'policeName',
  },
  {
    title: '身份证号',
    field: 'idcard',
  },
  {
    title: '银行卡号',
    field: 'bankCard',
  },
  {
    title: '部门名称',
    field: 'deptName',
  },
  {
    title: '工资月份',
    field: 'salaryYearMonth',
  },
  {
    title: '公务交通补助',
    field: 'trafficAllowance',
    cellRender: { name: 'CellAmount' }
  },
  {
    title: '增发',
    field: 'increasePay',
    cellRender: { name: 'CellAmount' }
  },
  {
    title: '减发',
    field: 'reducePay',
    cellRender: { name: 'CellMinusAmount' }
  },
  {
    title: '实发',
    field: 'actualSalary',
    cellRender: { name: 'CellAmount' }
  },
  // {
  //   title: '备注',
  //   field: 'remark',
  // },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 180,
  },
];

export const modalSchema: FormSchemaGetter = () => [
  {
    label: 'ID',
    fieldName: 'id',
    component: 'Input',
    dependencies: {
      show: () => false,
      triggerFields: [''],
    },
  },
  {
    label: '部门名称',
    fieldName: 'deptName',
    component: 'Input',
    componentProps:{
      readonly: true,
	  bordered: false
    }
  },
  {
    label: '人员姓名',
    fieldName: 'policeName',
    component: 'Input',
    componentProps:{
      readonly: true,
	  bordered: false
    }
  },
  {
    label: '身份证号',
    fieldName: 'idcard',
    component: 'Input',
    componentProps:{
      readonly: true,
	  bordered: false
    }
  },
  {
    label: '银行卡号',
    fieldName: 'bankCard',
    component: 'Input',
  },
  {
    label: '工资月份',
    fieldName: 'salaryYearMonth',
    component: 'DatePicker',
    componentProps : {
      picker: 'month',
      valueFormat: 'YYYY-MM',
    }
  },
  {
    label: '公务交通补助',
    fieldName: 'trafficAllowance',
    component: 'Input',
  },
  {
    label: '增发',
    fieldName: 'increasePay',
    component: 'Input',
  },
  {
    label: '减发',
    fieldName: 'reducePay',
    component: 'Input',
  },
  {
    label: '实发',
    fieldName: 'actualSalary',
    component: 'Input',
  },
  {
    label: '备注',
    fieldName: 'remark',
    component: 'Textarea',
  },
];
