import {
  factorySelect,
  shopSelectByFactory,
  storeselectionBox,
  sectionSelectByShops,
  userSelect,
  departmentTree,
  roleSelect,
} from "@/services/system";
import { doFetch } from "@/utils/doFetch";
export default {
  // accountName: {
  //   value: null,
  //   type: "input",
  //   title: "用户名",
  //   name: ["accountName"],
  //   required: true,
  // },
  // userName: {
  //   value: null,
  //   type: "input",
  //   title: "姓名",
  //   name: ["userName"],
  //   required: true,
  // },
  userName: {
    type: "autocompleteinput",
    title: "用户名-姓名-联系电话-邮箱",
    name: ["userName"],
    required: true,
    requestOptions: {
      url: "/ngic-auth/sysUser/queryLikeIotUsername",
      params: "userName",
    },
  },
  // telephone: {
  //   value: null,
  //   type: "input",
  //   title: "联系电话",
  //   name: ["telephone"],
  //   required: false,
  // },
  departmentId: {
    value: null,
    type: "treeselect",
    title: "组织",
    name: ["departmentId"],
    required: true,
    options: {
      database: departmentTree,
      params: {},
    },
  },
  factoryIdList: {
    value: null,
    type: "select",
    title: "工厂",
    name: ["factoryIdList"],
    required: true,
    options: {
      database: factorySelect,
      params: {},
    },
    linked: true,
    multiple: true,
  },

  storeIdList: {
    value: null,
    type: "select",
    title: "负责仓库",
    name: ["storeIdList"],
    required: false,
    belinked: {
      options: {
        database: (params) =>
          doFetch({
            url: "/ngic-auth/sysStore/selectionBox",
            params: { ...params },
          }),
        params: {
          factoryIdList: "linked",
        },
      },
    },
    multiple: true,
  },
  roleIdList: {
    value: null,
    type: "select",
    title: "角色配置",
    name: ["roleIdList"],
    required: false,
    belinked: {
      options: {
        database: roleSelect,
        params: {},
      },
    },
    multiple: true,
  },
  parentId: {
    value: null,
    type: "select",
    title: "直属领导",
    name: ["parentId"],
    required: false,
    belinked: {
      options: {
        database: userSelect,
        params: {},
      },
    },
  },
  // mailNo: {
  //   value: null,
  //   type: "input",
  //   title: "邮箱",
  //   name: ["mailNo"],
  //   required: false,
  //   col: {
  //     span: 12,
  //   },
  // },
  remark: {
    value: null,
    type: "textarea",
    title: "备注",
    name: ["remark"],
    required: false,
    col: {
      span: 24,
    },
  },
};
