// import { itemHealthCategory } from "./selects";
import { genBranchAuthSearchModal, genCargoownerAuthSearchModal } from '@/views/kzyWMS/SearchModal'
import { upcloud_base_item } from "@/config/serviceSettings";
const baseUrl = upcloud_base_item;

let grid = {
    labelCol: { span: 8 },
    span: 8
  }
export const searchItems = [
    ...genCargoownerAuthSearchModal(1, true, false, null, null, grid),
    {
        type: 'input',
        name: 'itemCode',
        label: '商品编码',
        ...grid,
        value: ''
    },
    {
        type: 'input',
        name: 'itemName',
        label: '商品名称',
        ...grid,
        value: ''
    },
    // {
    //     type: 'input',
    //     name: 'cargoOwnerId',
    //     label: '货主名称',
    //     value: ''
    // },
    // {
    //     ...itemHealthCategory,
    //     done: function (data) {
    //         data.unshift({ value: '', label: '全部' });
    //         return data;
    //     }
    // }
];

export const tableUploadBtns = function (that) {
  return {
    label: "商品ABC属性导入",
    action: baseUrl + "/itemSync/qnUpdateAbc",
    handleChange(info) {
      console.log(info, "=============");
      if (info.file.status !== "uploading") {
        console.log(info.file, info.fileList);
      }
      if (info.file.status === "done" && info.file.response.success) {
        that.$message.success(`${info.file.name} 上传成功`);
        // this.remoteParams = { ...this.remoteParams };
      } else if (info.file.status === "error") {
        that.$message.error(`${info.file.name}上传失败.`);
        that.$exception(info.file.response);
      } else if (info.file.status === "done" && !info.file.response.success) {
        that.$message.error(`${info.file.name} 上传失败`);
        that.$exception(info.file.response);
      }
    },
  };
};
