import { WeaLocaleProvider } from "ecCom";
import { dataTypeOptions, patternOptions, roundingModeOptions } from "./options";

const getLabel = WeaLocaleProvider.getLabel;


export const salaryItemConditions = [
  {
    items: [
      {
        conditionType: "INPUT",
        domkey: ["name"],
        fieldcol: 14,
        label: "名称",
        lanId: 111,
        labelcol: 8,
        value: "",
        rules: "required|string",
        viewAttr: 3
      },
      {
        conditionType: "SWITCH",
        domkey: ["useDefault"],
        fieldcol: 14,
        label: "默认使用",
        lanId: 111,
        labelcol: 8,
        value: "0",
        rules: "required|string",
        tipLanId: 111,
        tip: "提示：开启后，每个薪资方案都有该薪资项目，可在具体薪资方案中删除",
        viewAttr: 3
      },
      {
        conditionType: "SWITCH",
        domkey: ["hideDefault"],
        fieldcol: 14,
        label: "核算时隐藏",
        lanId: 111,
        labelcol: 8,
        value: "0",
        rules: "required|string",
        tipLanId: 111,
        tip: "提示：开启后，在薪资账套中添加该项目时，默认勾选隐藏且在核算时隐藏该薪资项目，可在具体薪资账套中设置是否隐藏",
        viewAttr: 3
      },
      {
        conditionType: "SELECT",
        domkey: ["sharedType"],
        fieldcol: 14,
        label: "可见性",
        lanId: 111,
        labelcol: 8,
        value: "",
        options: [],
        rules: "required|string",
        viewAttr: 3
      },
      {
        conditionType: "SELECT",
        domkey: ["taxAgentIds"],
        fieldcol: 14,
        label: "可见性范围",
        lanId: 111,
        labelcol: 8,
        value: "",
        options: [],
        multiple: true,
        rules: "",
        viewAttr: 2,
        hide: true
      },
      {
        conditionType: "SELECT",
        domkey: ["dataType"],
        fieldcol: 14,
        label: "字段类型",
        lanId: 111,
        labelcol: 8,
        value: "",
        options: [
          { key: "number", showname: "数值", lanId: 111, selected: true },
          { key: "string", showname: "字符", lanId: 111, selected: false }
        ],
        rules: "required|string",
        viewAttr: 3
      },
      {
        conditionType: "SELECT",
        domkey: ["roundingMode"],
        fieldcol: 14,
        label: "舍入规则",
        lanId: 111,
        labelcol: 8,
        value: "",
        options: [
          { key: "1", selected: true, showname: "原始数据", lanId: 111 },
          { key: "2", selected: false, showname: "四舍五入", lanId: 111 },
          { key: "3", selected: false, showname: "向上舍入", lanId: 111 },
          { key: "4", selected: false, showname: "向下舍入", lanId: 111 },
          { key: "5", selected: false, showname: "见分进角", lanId: 111 }
        ],
        rules: "required|string",
        viewAttr: 3
      },
      {
        conditionType: "SELECT",
        domkey: ["pattern"],
        fieldcol: 14,
        label: "保留小数位",
        lanId: 111,
        labelcol: 8,
        value: "2",
        options: [
          { key: "0", selected: false, showname: "0" },
          { key: "1", selected: false, showname: "1" },
          { key: "2", selected: true, showname: "2" },
          { key: "3", selected: false, showname: "3" },
          { key: "4", selected: false, showname: "4" },
          { key: "5", selected: false, showname: "5" },
          { key: "6", selected: false, showname: "6" },
          { key: "7", selected: false, showname: "7" },
          { key: "8", selected: false, showname: "8" },
          { key: "9", selected: false, showname: "9" },
          { key: "10", selected: false, showname: "10" }
        ],
        rules: "required|string",
        viewAttr: 3
      },
      {
        conditionType: "SELECT",
        domkey: ["valueType"],
        fieldcol: 14,
        label: "取值方式",
        lanId: 111,
        labelcol: 8,
        value: "",
        otherParams: { detailtype: 3 },
        options: [
          { key: "1", showname: "输入", selected: true, lanId: 111 },
          { key: "2", showname: "公式", selected: false, lanId: 111 },
          { key: "3", showname: "SQL", selected: false, lanId: 111 }
        ],
        rules: "required|string",
        viewAttr: 3
      },
      {
        conditionType: "INPUTNUMBER",
        domkey: ["defaultValue"],
        fieldcol: 14,
        label: "默认值",
        lanId: 111,
        labelcol: 8,
        value: "",
        otherParams: { precision: 2 },
        viewAttr: 2
      },
      {
        conditionType: "INPUT",
        domkey: ["formulaContent"],
        fieldcol: 14,
        label: "公式",
        lanId: 111,
        labelcol: 8,
        value: "",
        viewAttr: 3,
        hide: true
      },
      {
        conditionType: "INPUT",
        domkey: ["formulaId"],
        fieldcol: 14,
        label: "公式",
        lanId: 111,
        labelcol: 8,
        value: "",
        viewAttr: 3,
        hide: true
      },
      {
        conditionType: "INPUTNUMBER",
        domkey: ["sortedIndex"],
        fieldcol: 14,
        label: "显示顺序",
        lanId: 111,
        labelcol: 8,
        value: "",
        viewAttr: 2
      },
      {
        conditionType: "INPUTNUMBER",
        domkey: ["width"],
        fieldcol: 14,
        label: "显示宽度",
        lanId: 111,
        labelcol: 8,
        value: "",
        viewAttr: 2
      },
      {
        conditionType: "TEXTAREA",
        domkey: ["description"],
        fieldcol: 14,
        label: "备注",
        lanId: 111,
        labelcol: 8,
        value: "",
        viewAttr: 2,
        otherParams: { minRows: 3 }
      },
      {
        conditionType: "SWITCH",
        domkey: ["useInEmployeeSalary"],
        fieldcol: 14,
        label: "薪资档案引用",
        lanId: 111,
        labelcol: 8,
        value: "0",
        viewAttr: 2,
        tipLanId: 111,
        tip: "提示：开启后，该薪资项目不可删除或设为无效，取值方式会默认置为输入",
        hide: true
      },
      {

        conditionType: "SWITCH",
        domkey: ["systemType"],
        fieldcol: 14,
        label: "是否系统默认",
        lanId: 111,
        labelcol: 8,
        value: "0",
        viewAttr: 2,
        hide: true
      }
    ],
    title: "",
    defaultshow: true
  }
];
export const salaryItemFields = [
  {
    key: "name",
    label: "名称",
    type: "INPUT",
    viewAttr: 3,
    tip: ""
  },
  // {
  //   key: 'useInEmployeeSalary',
  //   label: '薪资档案引用',
  //   type: 'SWITCH',
  //   viewAttr: 2,
  //   tip: '提示：开启后，该薪资项目不可删除或设为无效，取值方式会默认置为输入'
  // },
  {
    key: "useDefault",
    label: "默认使用",
    type: "SWITCH",
    viewAttr: 2,
    tip: "提示：开启后，每个薪资方案都有该薪资项目，可在具体薪资方案中删除"
  },
  {
    key: "hideDefault",
    label: getLabel(111, "核算时隐藏"),
    type: "SWITCH",
    viewAttr: 2,
    tip: getLabel(111, "提示：开启后，在薪资账套中添加该项目时，默认勾选隐藏且在核算时隐藏该薪资项目，可在具体薪资账套中设置是否隐藏")
  },
  {
    key: "sharedType",
    label: "可见性",
    type: "SELECT",
    viewAttr: 2,
    tip: ""
  },
  {
    key: "taxAgentIds",
    label: "可见性范围",
    type: "SELECT",
    viewAttr: 3,
    tip: ""
  },
  {
    key: "dataType",
    label: "字段类型",
    type: "SELECT",
    viewAttr: 3,
    options: dataTypeOptions,
    tip: ""
  },
  {
    key: "roundingMode",
    label: "舍入规则",
    type: "SELECT",
    viewAttr: 2,
    options: roundingModeOptions,
    tip: ""
  },
  {
    key: "pattern",
    label: "保留小数位",
    type: "SELECT",
    viewAttr: 2,
    options: patternOptions,
    tip: ""
  },
  {
    key: "valueType",
    label: "取值方式",
    type: "RADIO",
    viewAttr: 2,
    tip: ""
  },
  {
    key: "defaultValue",
    label: "默认值",
    type: "INPUT",
    viewAttr: 2,
    precision: 2,
    tip: ""
  },
  {
    key: "formulaContent",
    label: "公式",
    type: "INPUT",
    viewAttr: 2,
    tip: ""
  },
  {
    key: "sortedIndex",
    label: "显示顺序",
    type: "INPUTNUMBER",
    viewAttr: 2,
    tip: ""
  },
  {
    key: "width",
    label: "显示宽度",
    lanId: 111,
    type: "INPUTNUMBER",
    viewAttr: 2,
    tip: ""
  },
  {
    key: "description",
    label: "备注",
    type: "TEXTAREA",
    viewAttr: 2,
    tip: ""
  }
];
export const valTakeOptions = [
  { key: "1", showname: "输入" },
  { key: "2", showname: "公式" },
  { key: "3", showname: "SQL" }
];
export const salarySetConditions = [
  {
    items: [{
      colSpan: 1,
      checkbox: false,
      checkboxValue: false,
      conditionType: "SELECT",
      domkey: ["salarySobIds"],
      fieldcol: 14,
      label: "薪资账套",
      lanId: 538010,
      labelcol: 6,
      options: [],
      rules: "required|string",
      multiple: true,
      viewAttr: 3
    }],
    title: "",
    defaultshow: true
  }
];




