import {
  startStatus,
  WaybillStatus
} from '@/assets/js/blockSort'
export const employee = () => {
  return [{
    field: 'selection',
    label: '多选',
    align: 'center',
  }, {
    field: 'waybillNo',
    label: '运单号',
    align: 'center',
    colWidth: '180px',
  }, {
    field: 'orderNo',
    label: '订单号',
    align: 'center',
    colWidth: '180px',
  }, {
    field: 'status',
    label: '订单状态',
    align: 'center',
    options: WaybillStatus(),
    colWidth: '130px',
  }, {
    field: 'deliveryType',
    label: '配送类型',
    align: 'center',
    colWidth: '130px',
  }, {
    field: 'consigneeAddressName',
    label: '患者名称',
    align: 'center',
    colWidth: '180px',
  }, {
    field: 'consigneeAddressPhone',
    label: '患者手机号',
    align: 'center',
    colWidth: '180px',
  }, {
    field: 'consigneeAddressDetails',
    label: '收货地址',
    align: 'center',
    colWidth: '180px',
  }, {
    field: 'askForTime',
    label: '患者要求送达时间',
    align: 'center',
    colWidth: '180px',
  }, {
    field: 'admin_audit_remark',
    label: '审核备注',
    align: 'center',
  }, {
    field: 'auditRemark',
    label: '驳回原因',
    align: 'center',
  }, {
    field: 'unpackBtn',
    label: '操作',
    colWidth: '340px',
    align: 'center',
    labelButton: []
  }]
}
export const formRules = () => {
  return [{
    field: 'deliveryType',
    label: '配送类型',
    placeholder: '配送类型',
    type: 'select',
    colWidth: 12,
    options: [{
      label: '现在配送',
      value: '现在配送',
    }],
    rules: [{
      required: false,
      message: '配送类型',
      trigger: 'blur'
    }]
  }, {
    field: 'askForTime',
    label: '患者要求送达时间',
    placeholder: '患者要求送达时间',
    type: 'datetime',
    colWidth: 12,
    rules: [{
      required: false,
      message: '患者要求送达时间',
      trigger: 'blur'
    }]
  }, {
    field: 'is_secondary_distribution',
    label: '二次分配',
    placeholder: '是否二次分配',
    type: 'switch',
    colWidth: 6,
    rules: [{
      required: true,
      message: '是否二次分配',
      trigger: 'blur'
    }]
  }, {
    field: 'drugCode',
    label: '扫码药品条形码',
    placeholder: '请扫码药品条形码',
    type: 'tracingCode',
    colWidth: 18,
    labelWidth: '125px',
    rules: [{
      required: false,
      message: '请扫码药品条形码',
      trigger: 'blur'
    }]
  }, {
    field: 'divider',
    label: '订购商品信息',
    colWidth: 24,
  }, {
    field: 'tamperProofLabelImg',
    label: '防拆标签图片',
    placeholder: '请上传防拆标签图片',
    type: 'upload',
    colWidth: 24,
    crosswise: true,
    rules: [{
      required: false,
      message: '请上传防拆标签图片',
      trigger: 'blur,change'
    }]
  }, {
    field: 'tamperProofLabel',
    label: '区块链防拆标签码',
    placeholder: '请输入区块链防拆标签码',
    type: 'input',
    colWidth: 24,
    rules: [{
      required: false,
      message: '请输入区块链防拆标签码',
      trigger: 'blur'
    }]
  }, {
    field: 'remark',
    label: '备注',
    placeholder: '备注',
    type: 'textarea',
    colWidth: 24,
  }, ]
}

export const addressBook = () => {
  return [{
    field: 'name',
    label: '姓名',
    align: 'center',
  }, {
    field: 'phone',
    label: '电话',
    align: 'center',
  }, {
    field: 'address',
    label: '详细地址',
    align: 'center',
  }, ]
}
export const sendList = () => {
  return [{
    field: 'deliveryId',
    type: 'searchSelect',
    label: '配送员',
    placeholder: '请选择配送员',
    colWidth: 12,
    multiple: false,
    rules: [{
      required: true,
      message: '请选择配送员',
      trigger: 'blur,change'
    }],
    options: [],
  }, {
    field: 'coolerBoxId',
    type: 'searchSelect',
    label: '保温箱',
    placeholder: '请选择保温箱',
    colWidth: 12,
    multiple: false,
    rules: [{
      required: true,
      message: '请选择保温箱',
      trigger: 'blur,change'
    }],
    options: [],
  }, {
    field: 'code',
    label: '冰排编号',
    placeholder: '请输入冰排编号',
    type: 'scan',
    colWidth: 12,
    rules: [{
      required: true,
      message: '请输入冰排编号',
      trigger: 'blur'
    }]
  }, {
    field: 'tamperProofLabelImg',
    label: '防拆标签图片',
    placeholder: '请上传防拆标签图片',
    type: 'upload',
    colWidth: 12,
    crosswise: true,
    rules: [{
      required: false,
      message: '请上传防拆标签图片',
      trigger: 'blur,change'
    }]
  }, {
    field: 'tamperProofLabel',
    label: '区块链防拆标签码',
    placeholder: '请输入区块链防拆标签码',
    type: 'input',
    colWidth: 24,
    rules: [{
      required: false,
      message: '请输入区块链防拆标签码',
      trigger: 'blur'
    }]
  }, {
    field: 'remark',
    label: '备注',
    placeholder: '备注',
    type: 'textarea',
    colWidth: 24,
  }, ]
}

function validatePassword(rule, value, callback) {
  // 假设正确的密码是 '123456'
  if (value === 3 || value === 4) {
    callback(); // 验证通过
  } else {
    callback('请选择签收状态'); // 验证不通过
  }
}

export const signList = () => {
  return [{
      field: 'deptId',
      type: 'searchSelect',
      label: '门店',
      placeholder: '请选择门店',
      colWidth: 24,
      multiple: false,
      rules: [{
        required: true,
        message: '请选择门店',
        trigger: 'blur,change'
      }],
      options: [],
    },
    // {
    //   field: 'rejectionReason',
    //   label: '原因',
    //   placeholder: '请输入原因',
    //   type: 'textarea',
    //   colWidth: 24,
    // },
  ]
}
export const auditList = () => {
  return [{
    field: 'confirmer',
    label: '确认人姓名',
    placeholder: '请输入确认人姓名',
    type: 'input',
    colWidth: 12,
    disabled: true,
    rules: [{
      required: false,
      message: '请输入确认人姓名',
      trigger: 'blur'
    }]
  }, {
    field: 'confirmerPhone',
    label: '确认人手机号',
    placeholder: '请输入确认人手机号',
    type: 'input',
    colWidth: 12,
    disabled: true,
    rules: [{
      required: false,
      message: '请输入确认人手机号',
      trigger: 'blur'
    }]
  }, {
    field: 'orderNo',
    label: '订单编号',
    placeholder: '请输入订单编号',
    type: 'input',
    colWidth: 12,
    disabled: true,
    rules: [{
      required: false,
      message: '请输入订单编号',
      trigger: 'blur'
    }]
  }, {
    field: 'deliveryType',
    label: '配送类型',
    placeholder: '配送类型',
    type: 'select',
    options: [{
      label: '现在配送',
      value: '现在配送',
    }],
    colWidth: 12,
    disabled: true,
    rules: [{
      required: false,
      message: '配送类型',
      trigger: 'blur'
    }]
  }, {
    field: 'askForTime',
    label: '患者要求送达时间',
    placeholder: '患者要求送达时间',
    type: 'datetime',
    colWidth: 12,
    disabled: true,
    rules: [{
      required: false,
      message: '患者要求送达时间',
      trigger: 'blur'
    }]
  }, {
    field: 'remark',
    label: '备注',
    placeholder: '备注',
    type: 'input',
    colWidth: 12,
    disabled: true,
    rules: [{
      required: false,
      message: '备注',
      trigger: 'blur'
    }]
  }, {
    field: 'consigneeAddressName',
    label: '患者姓名',
    placeholder: '请输入患者姓名',
    type: 'input',
    colWidth: 12,
    disabled: true,
    rules: [{
      required: false,
      message: '请输入患者姓名',
      trigger: 'blur'
    }]
  }, {
    field: 'consigneeAddressPhone',
    label: '患者手机号',
    placeholder: '请输入患者手机号',
    type: 'input',
    colWidth: 12,
    disabled: true,
    rules: [{
      required: false,
      message: '请输入患者手机号',
      trigger: 'blur'
    }]
  }, {
    field: 'consigneeAddressDetails',
    label: '收货地址',
    placeholder: '请输入收货地址',
    type: 'input',
    colWidth: 12,
    disabled: true,
    rules: [{
      required: false,
      message: '请输入收货地址',
      trigger: 'blur'
    }]
  }, {
    field: 'is_secondary_distribution',
    label: '二次分配',
    placeholder: '是否二次分配',
    type: 'switch',
    colWidth: 6,
    disabled: true,
    rules: [{
      required: true,
      message: '是否二次分配',
      trigger: 'blur'
    }]
  }, {
    field: 'divider',
    label: '订购商品信息',
    colWidth: 24,
  }, {
    field: 'tamperProofLabelImg',
    label: '处方图片',
    placeholder: '处方图片',
    type: 'picture',
    colWidth: 24,
    disabled: true,
    urlList: [],
    crosswise: true,
    rules: [{
      required: false,
      message: '请上传处方图片',
      trigger: 'blur,change'
    }]
  }]
}

export const examineList = () => {
  var validateValueIsNotZero = (rule, value, callback) => {
    if (value === 1) {
      callback(new Error(rule.message));
    } else {
      callback();
    }
  };
  return [{
    field: 'prescriptionIssue',
    label: '处方是否审核',
    placeholder: '处方是否审核',
    type: 'radio',
    colWidth: 24,
    rules: [{
      required: false,
      message: '请审核处方',
      trigger: 'blur,change'
    }],
    options: [{
      label: '已审核',
      value: 0,
    }, {
      label: '未审核',
      value: 1,
    }]
  }, {
    field: 'invoiceIssue',
    label: '发票/销售小票是否审核',
    placeholder: '发票/销售小票是否审核',
    type: 'radio',
    colWidth: 24,
    rules: [{
      required: true,
      message: '请审核发票/销售小票',
      trigger: 'blur,change',
      validator: validateValueIsNotZero
    }],
    options: [{
      label: '已审核',
      value: 0,
    }, {
      label: '未审核',
      value: 1,
    }]
  }, {
    field: 'inspectionReportIssue',
    label: '检验报告单是否审核',
    placeholder: '检验报告单是否审核',
    type: 'radio',
    colWidth: 24,
    rules: [{
      required: false,
      message: '请审核检验报告单',
      trigger: 'blur,change'
    }],
    options: [{
      label: '已审核',
      value: 0,
    }, {
      label: '未审核',
      value: 1,
    }]
  }, {
    field: 'dispensingMedicinesIssue',
    label: '调配药品信息是否审核',
    placeholder: '调配药品信息是否审核',
    type: 'radio',
    colWidth: 24,
    rules: [{
      required: true,
      message: '请审核调配药品信息',
      trigger: 'blur,change',
      validator: validateValueIsNotZero
    }],
    options: [{
      label: '已审核',
      value: 0,
    }, {
      label: '未审核',
      value: 1,
    }]
  }, {
    field: 'isCold',
    label: '是否为冷链药品',
    placeholder: '是否为冷链药品',
    type: 'radio',
    colWidth: 24,
    rules: [{
      required: true,
      message: '请选择是否审核',
      trigger: 'blur,change'
    }],
    options: [{
      label: '是',
      value: 0,
    }, {
      label: '否',
      value: 1,
    }]
  }]
}
