api.js 12.2 KB
import { getAction, deleteAction, putAction, postAction, httpAction } from '@/api/manage'
import Vue from 'vue'
import {UI_CACHE_DB_DICT_DATA } from "@/store/mutation-types"

//角色管理
const addRole = (params)=>postAction("/sys/role/add",params);
const editRole = (params)=>putAction("/sys/role/edit",params);
const checkRoleCode = (params)=>getAction("/sys/role/checkRoleCode",params);
const queryall = (params)=>getAction("/sys/role/queryall",params);

//用户管理
const addUser = (params)=>postAction("/sys/user/add",params);
const editUser = (params)=>putAction("/sys/user/edit",params);
const queryUserRole = (params)=>getAction("/sys/user/queryUserRole",params);
const getUserList = (params)=>getAction("/sys/user/list",params);
const frozenBatch = (params)=>putAction("/sys/user/frozenBatch",params);
//验证用户是否存在
const checkOnlyUser = (params)=>getAction("/sys/user/checkOnlyUser",params);
//改变密码
const changePassword = (params)=>putAction("/sys/user/changePassword",params);

//权限管理
const addPermission= (params)=>postAction("/sys/permission/add",params);
const editPermission= (params)=>putAction("/sys/permission/edit",params);
const getPermissionList = (params)=>getAction("/sys/permission/list",params);
const getSystemMenuList = (params)=>getAction("/sys/permission/getSystemMenuList",params);
const getSystemSubmenu = (params)=>getAction("/sys/permission/getSystemSubmenu",params);
const getSystemSubmenuBatch = (params) => getAction('/sys/permission/getSystemSubmenuBatch', params)
const queryTreeList = (params)=>getAction("/sys/permission/queryTreeList",params);
const queryTreeListForRole = (params)=>getAction("/sys/role/queryTreeList",params);
const queryListAsync = (params)=>getAction("/sys/permission/queryListAsync",params);
const queryRolePermission = (params)=>getAction("/sys/permission/queryRolePermission",params);
const saveRolePermission = (params)=>postAction("/sys/permission/saveRolePermission",params);
const queryPermissionsByUser = ()=>getAction("/sys/permission/getUserPermissionByToken");
const loadAllRoleIds = (params)=>getAction("/sys/permission/loadAllRoleIds",params);
const getPermissionRuleList = (params)=>getAction("/sys/permission/getPermRuleListByPermId",params);
const queryPermissionRule = (params)=>getAction("/sys/permission/queryPermissionRule",params);

// 部门管理
const queryDepartTreeList = (params)=>getAction("/sys/sysDepart/queryTreeList",params);
const queryDepartTreeSync = (params)=>getAction("/sys/sysDepart/queryDepartTreeSync",params);
const queryIdTree = (params)=>getAction("/sys/sysDepart/queryIdTree",params);
const queryParentName   = (params)=>getAction("/sys/sysDepart/queryParentName",params);
const searchByKeywords   = (params)=>getAction("/sys/sysDepart/searchBy",params);
const deleteByDepartId   = (params)=>deleteAction("/sys/sysDepart/delete",params);



//二级部门管理
const queryDepartPermission = (params)=>getAction("/sys/permission/queryDepartPermission",params);
const saveDepartPermission = (params)=>postAction("/sys/permission/saveDepartPermission",params);
const queryTreeListForDeptRole = (params)=>getAction("/sys/sysDepartPermission/queryTreeListForDeptRole",params);
const queryDeptRolePermission = (params)=>getAction("/sys/sysDepartPermission/queryDeptRolePermission",params);
const saveDeptRolePermission = (params)=>postAction("/sys/sysDepartPermission/saveDeptRolePermission",params);
const queryMyDepartTreeList = (params)=>getAction("/sys/sysDepart/queryMyDeptTreeList",params);

//日志管理
const deleteLog = (params)=>deleteAction("/sys/log/delete",params);
const deleteLogList = (params)=>deleteAction("/sys/log/deleteBatch",params);

//数据字典
const addDict = (params)=>postAction("/sys/dict/add",params);
const editDict = (params)=>putAction("/sys/dict/edit",params);
const treeList = (params)=>getAction("/sys/dict/treeList",params);
const addDictItem = (params)=>postAction("/sys/dictItem/add",params);
const editDictItem = (params)=>putAction("/sys/dictItem/edit",params);

//字典标签专用(通过code获取字典数组)
export const ajaxGetDictItems = (code, params)=>getAction(`/sys/dict/getDictItems/${code}`,params);
//从缓存中获取字典配置
function getDictItemsFromCache(dictCode) {
  if (Vue.ls.get(UI_CACHE_DB_DICT_DATA) && Vue.ls.get(UI_CACHE_DB_DICT_DATA)[dictCode]) {
    let dictItems = Vue.ls.get(UI_CACHE_DB_DICT_DATA)[dictCode];
    //console.log("-----------getDictItemsFromCache----------dictCode="+dictCode+"---- dictItems=",dictItems)
    return dictItems;
  }
}

//系统通告
const doReleaseData = (params)=>getAction("/sys/annountCement/doReleaseData",params);
const doReovkeData = (params)=>getAction("/sys/annountCement/doReovkeData",params);
//获取系统访问量
const getLoginfo = (params)=>getAction("/sys/loginfo",params);
const getVisitInfo = (params)=>getAction("/sys/visitInfo",params);

// 根据部门主键查询用户信息
const queryUserByDepId = (params)=>getAction("/sys/user/queryUserByDepId",params);

// 重复校验
const duplicateCheck = (params)=>getAction("/sys/duplicate/check",params);
// 加载分类字典
const loadCategoryData = (params)=>getAction("/sys/category/loadAllData",params);
const checkRuleByCode = (params) => getAction('/sys/checkRule/checkByCode', params)
//加载我的通告信息
const getUserNoticeInfo= (params)=>getAction("/sys/sysAnnouncementSend/getMyAnnouncementSend",params);
const getTransitURL = url => `/sys/common/transitRESTful?url=${encodeURIComponent(url)}`

//根据用户编码,获取仓库信息
export const getWarehouseByUserCode = (params)=>postAction('/sys/getWarehouseByUserCode', params);
//获取库区列表
export const getZoneList = (params)=>getAction('/config/zone/getZoneList', params);
//获取容器类型列表
export const getContainerTypeList = (params)=>getAction('/config/containerType/getContainerTypeList', params);
//获取库位类型列表
export const getLocationTypeList = (params)=>getAction('/config/locationType/getLocationTypeList', params);
//获取库位类高度列表
export const getLocationHighList = (params)=>postAction('/config/locationHigh/getLocationHighList', params);
//获取货主列表
export const getCompanyList = (params)=>getAction('/config/company/getCompanyList', params);
//获取承运商列表
export const getCarrierList = (params)=>getAction('/config/carrier/getCarrierList', params);
//获取客户列表
export const getCustomerList = (params)=>getAction('/config/customer/getCustomerList', params);
//获取供应商列表
export const getSupplierList = (params)=>getAction('/config/supplier/getSupplierList', params);
//获取入库类型列表
export const getReceiptTypeList = (params)=>getAction('/config/receiptType/getReceiptTypeList', params);
//获取出库类型列表
export const getShipmentTypeList = (params)=>getAction('/config/shipmentType/getShipmentTypeList', params);
//根据物料编码查询物料信息
export const searchMaterialByCode = (params)=>postAction('/config/material/searchMaterialByCode', params);
//根据入库单头ID查询入库单详情
export const listReceiveByReceiptId = (params)=>postAction('/receipt/receiveHeader/listReceiveByReceiptId', params);
//创建入库任务
export const createReceiptTask = (params)=>postAction('/receipt/receiptContainerHeader/createReceiptTask', params);
//完成WMS任务
export const completeTaskByWMS = (params)=>postAction('/task/taskHeader/completeTaskByWMS', params);
//下发任务给WCS
export const execute = (params)=>postAction('/task/taskHeader/execute', params);
//取消任务
export const cancelTask = (params)=>postAction('/task/taskHeader/cancelTask?ids=' + params, params);
//自动配盘
export const autoCombination = (params)=>postAction('/shipment/shipmentCombination/autoCombination', params);
//创建出库任务
export const createShipmentTask = (params)=>postAction('/shipment/shipmentCombination/createShipmentTask', params);
//选择出库分拣口
export const selectSortingPort = (params)=>postAction('/shipment/shipmentCombination/selectSortingPort', params);
//选择入库分拣口
export const selectSupplePort = (params)=>postAction('/receipt/receiptContainerHeader/selectSupplePort', params);
//创建空托盘入库任务
export const createEmptyIn = (params)=>postAction('/task/taskHeader/createEmptyIn', params);
//创建空托盘出库任务
export const createEmptyOut = (params)=>postAction('/task/taskHeader/createEmptyOut', params);
//选择出库整出口
export const selectOutPort = (params)=>postAction('/task/taskHeader/selectOutPort', params);
//选择出库分拣口
export const selectPickPort = (params)=>postAction('/task/taskHeader/selectPickPort', params);
//创建移库任务
export const createTransferTask = (params)=>postAction('/task/taskHeader/createTransferTask', params);
//创建出库查看任务
export const createCheckOutTask = (params)=>postAction('/task/taskHeader/createCheckOutTask', params);
//选择站台
export const selectPort = (params)=>postAction('/task/taskHeader/selectPort', params);
//创建跨站任务
export const createOverStationTask = (params)=>postAction('/task/taskHeader/createOverStationTask', params);
//创建空托盘组入库任务
export const createManyEmptyIn = (params)=>postAction('/task/taskHeader/createManyEmptyIn', params);
//创建空托盘组出库任务
export const createManyEmptyOut = (params)=>postAction('/task/taskHeader/createManyEmptyOut', params);
//获取容器打印数据
export const getPrintContainer = (params)=>postAction('/config/container/getPrintContent?ids=' + params, params);
//获取库位打印数据
export const getPrintLocation = (params)=>postAction('/config/location/getPrintContent?ids=' + params, params);
//获取物料打印数据
export const getMaterialLocation = (params)=>postAction('/config/material/getPrintContent?ids=' + params, params);
//根据出库单头ID查询出库单详情
export const listShipmentByShipmentDetailId = (params)=>postAction('/shipment/shipmentCombination/listShipmentByShipmentDetailId', params);
//根据出库单详情选取库存
export const getInventoryFromShipmentDetail = (params)=>postAction('/shipment/shipmentCombination/getInventoryFromShipmentDetail', params);
//配盘
export const combination = (params)=>postAction('/shipment/shipmentCombination/combination', params);
//回传入库单
export const backErpReceipt = (params)=>postAction('/receipt/receiptHeader/backErpReceipt', params);
//回传出库单
export const backErpShipment = (params)=>postAction('/shipment/shipmentHeader/backErpShipment', params);
//首页取值
export const deliveringAmount = (params)=>postAction("/sys/home/deliveringAmount",params);
export const inventoryUtilization = (params)=>postAction("/sys/home/inventoryUtilization",params);
export const inventoryStatus = (params)=>postAction("/sys/home/inventoryStatus",params);
export const inventoryOverview = (params)=>postAction("/sys/home/inventoryOverview",params);
export const getCommonData = (params)=>postAction("/sys/home/getCommonData",params);
// 中转HTTP请求
export const transitRESTful = {
  get: (url, parameter) => getAction(getTransitURL(url), parameter),
  post: (url, parameter) => postAction(getTransitURL(url), parameter),
  put: (url, parameter) => putAction(getTransitURL(url), parameter),
  http: (url, parameter) => httpAction(getTransitURL(url), parameter),
}

export {
  // imgView,
  // doMian,
  addRole,
  editRole,
  checkRoleCode,
  addUser,
  editUser,
  queryUserRole,
  getUserList,
  queryall,
  frozenBatch,
  checkOnlyUser,
  changePassword,
  getPermissionList,
  addPermission,
  editPermission,
  queryTreeList,
  queryListAsync,
  queryRolePermission,
  saveRolePermission,
  queryPermissionsByUser,
  loadAllRoleIds,
  getPermissionRuleList,
  queryPermissionRule,
  queryDepartTreeList,
  queryDepartTreeSync,
  queryIdTree,
  queryParentName,
  searchByKeywords,
  deleteByDepartId,
  deleteLog,
  deleteLogList,
  addDict,
  editDict,
  treeList,
  addDictItem,
  editDictItem,
  doReleaseData,
  doReovkeData,
  getLoginfo,
  getVisitInfo,
  queryUserByDepId,
  duplicateCheck,
  queryTreeListForRole,
  getSystemMenuList,
  getSystemSubmenu,
  getSystemSubmenuBatch,
  loadCategoryData,
  checkRuleByCode,
  queryDepartPermission,
  saveDepartPermission,
  queryTreeListForDeptRole,
  queryDeptRolePermission,
  saveDeptRolePermission,
  queryMyDepartTreeList,
  getUserNoticeInfo,
  getDictItemsFromCache
}