dict.js 1.81 KB
import http from './interface'

// 根据字典类型查询字典数据信息
export const getDicts = (dictType) => {
	return http.request({
		url: '/system/dict/data/type/' + dictType,
		method: 'GET'
	})
}
// 查询入库类型字典数据信息
export const getReceiptType = () => {
	return http.request({
		url: '/config/mobile/getReceiptType',
		method: 'POST'
	})
}
// 查询出库类型字典数据信息
export const getShipmentType = () => {
	return http.request({
		url: '/config/shipmentType/list',
		method: 'GET'
	})
}
// 通过用户名获取可以用的仓库列表
export const getWarehouseByUserCode = (username) => {
	const data = {
		username
	}
	return http.request({
		url: '/system/warehouse/getWarehouseByUserCode',
		method: 'GET',
		data
	})
}

// 获取用户可操作货主
export const getCompaniesByToken = () => {
	return http.request({
		url: '/system/company/getCompaniesByToken',
		method: 'GET',
	})
}

// 查询字典数据列表
export const listDict = (data) => {
	return http.request({
		url: '/system/dict/data/list',
		method: 'get',
		data
	})
}

// 查询字典数据详细
export const getCurrDict = (dictCode) => {
	return http.request({
		url: '/system/dict/data/' + dictCode,
		method: 'GET'
	})
}

// 新增字典数据
export const addDict = (data) => {
	return http.request({
		url: '/system/dict/data',
		method: 'post',
		data: data
	})
}

// 修改字典数据
export const updateDict = (data) => {
	return http.request({
		url: '/system/dict/data',
		method: 'put',
		data: data
	})
}

// 删除字典数据
export const delDict = (dictCode) => {
	return http.request({
		url: '/system/dict/data/' + dictCode,
		method: 'DELETE'
	})
}

export default {
	getReceiptType,
	getWarehouseByUserCode,
	listDict,
	addDict,
	getDicts,
	delDict,
	getCurrDict,
	updateDict,
	getCompaniesByToken,
	getShipmentType
}