| | |
| | | // import request from "@/common/untils/request.js" |
| | | import axios from "axios" |
| | | import request from "@/common/untils/request"; |
| | | |
| | | // 查询公司列表 |
| | | export const getCompanyList = async (data) => { |
| | | return await axios.get(`/api-wms/v1/company/company`, { |
| | | export const getCompanyList = (data) => { |
| | | return request({ |
| | | url: "/api-wms/v1/company/company", |
| | | method: "get", |
| | | params: data |
| | | }) |
| | | } |
| | |
| | | import request from "@/common/untils/request.js" |
| | | import axios from "axios" |
| | | |
| | | // 查询业务类型列表 |
| | | export const getOperationType = async (data) => { |
| | | return await axios.get(`/api-wms/v1/operationType/operationType`, { |
| | | export const getOperationType = (data) => { |
| | | return request({ |
| | | url: "/api-wms/v1/operationType/operationType", |
| | | method: "get", |
| | | params: data |
| | | }) |
| | | } |
| | | // 查询业务类型列表--内部调拨 |
| | | export const getListTransfer = async (data) => { |
| | | return await axios.get(`/api-wms/v1/operationType/listTransfer`, { |
| | | export const getListTransfer = (data) => { |
| | | return request({ |
| | | url: "/api-wms/v1/operationType/listTransfer", |
| | | method: "get", |
| | | params: data |
| | | }) |
| | | } |
| | |
| | | // 库存报表 |
| | | import request from "@/common/untils/request.js" |
| | | import axios from "axios" |
| | | |
| | | |
| | | // 获取库存报表 |
| | |
| | | } |
| | | |
| | | // 仓库类型列表 |
| | | export const getWarehouseList = async (data) => { |
| | | return await axios.get(`/api-wms/v1/warehouse/warehouse`, { |
| | | export const getWarehouseList = (data) => { |
| | | return request({ |
| | | url: "/api-wms/v1/warehouse/warehouse", |
| | | method: "get", |
| | | params: data |
| | | }) |
| | | } |
| | |
| | | import request from "@/common/untils/request.js" |
| | | import axios from "axios" |
| | | |
| | | // 仓库列表 |
| | | export const getWarehouseList = async (data) => { |
| | | return await axios.get(`/api-wms/v1/warehouse/warehouse`, { |
| | | export const getWarehouseList = (data) => { |
| | | return request({ |
| | | url: "/api-wms/v1/warehouse/warehouse", |
| | | method: "get", |
| | | params: data |
| | | }) |
| | | } |
| | |
| | | }) |
| | | } |
| | | // 业务类型 列表 |
| | | export const getOperationTypeList = async (data) => { |
| | | return await axios.get(`/api-wms/v1/operationType/operationType`, { |
| | | export const getOperationTypeList = (data) => { |
| | | return request({ |
| | | url: "/api-wms/v1/operationType/operationType", |
| | | method: "get", |
| | | params: data |
| | | }) |
| | | } |
| | |
| | | |
| | | // import router from '@/router' |
| | | |
| | | // 开发环境下将自己的token复制到这里, 也可以在浏览器中手动添加token到cookie中,cookie中的token优先 |
| | | const DEV_TOKEN = '' |
| | | function environmentType(){ |
| | | let type |
| | | if (location.href.includes('192.168.20.119')) { |
| | | type = 'test' |
| | | } else if (location.href.includes('192.168') || location.href.includes('localhost')) { |
| | | type = 'dev' |
| | | } else { |
| | | type = 'prod' |
| | | } |
| | | |
| | | return type |
| | | } |
| | | const isDev = environmentType() === 'dev' |
| | | |
| | | const getApsPage = () => { |
| | | // 首页部署在各个环境的端口 |
| | | const loginPathMap = { |
| | | prod:`//${window.location.hostname}:9080`, |
| | | test:`//192.168.20.119:9080`, |
| | | // 想跳到本地启动的登录页的话需要把dev改成你本地项目路径 |
| | | dev: `//192.168.20.124:8081` |
| | | } |
| | | |
| | | return loginPathMap[environmentType()] |
| | | } |
| | | |
| | | |
| | | const Axios = axios.create({ |
| | | responseType: "json", |
| | | withCredentials: true // 是否允许带cookie这些 |
| | |
| | | /* //POST传参序列化(添加请求拦截器) */ |
| | | Axios.interceptors.request.use( |
| | | (config) => { |
| | | // 若是有做鉴权token , 就给头部带上token |
| | | // let token = util.cookies.get("token"); |
| | | // if (token != undefined) { |
| | | // config.headers.Authorization = "Bearer " + token; |
| | | // } |
| | | let token = document.cookie.replace( |
| | | /(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, |
| | | "$1", |
| | | ); |
| | | if (isDev){ |
| | | token = token || DEV_TOKEN |
| | | } |
| | | if (token) { |
| | | config.headers.Authorization = "Bearer " + token; |
| | | } |
| | | |
| | | return config |
| | | }, |
| | |
| | | /* //对响应数据做些事 */ |
| | | if (res.data.code === 200) { |
| | | return res.data ? res.data : {} |
| | | }else if([2012,2013,2014,2015].includes(res.data.code)){ |
| | | if (isDev){ |
| | | alert("JWT失效") |
| | | }else { |
| | | // JWT鉴权失效 跳转到登录页 |
| | | window.location = getApsPage()+'/login' |
| | | } |
| | | return Promise.reject(res.data) |
| | | } else { |
| | | Message({ |
| | | message: res.data.msg, |
| | |
| | | } |
| | | }, |
| | | (error) => { |
| | | if (error.response.status === 401){ |
| | | if (isDev){ |
| | | alert("JWT失效") |
| | | }else { |
| | | // JWT鉴权失效 跳转到登录页 |
| | | window.location = getApsPage()+'/login' |
| | | } |
| | | } |
| | | |
| | | let { message } = error |
| | | if (message === "Network Error") { |
| | | message = "后端接口连接异常" |
| | |
| | | async getCompanyList() { |
| | | await getCompanyList().then((res) => { |
| | | console.log(res) |
| | | if (res.data.code === 200) { |
| | | this.companyOptions = res.data.data |
| | | if (res.code === 200) { |
| | | this.companyOptions = res.data |
| | | } |
| | | }) |
| | | }, |
| | |
| | | async getCompanyList() { |
| | | await getCompanyList().then((res) => { |
| | | console.log(res) |
| | | if (res.data.code === 200) { |
| | | this.companyOptions = res.data.data |
| | | if (res.code === 200) { |
| | | this.companyOptions = res.data |
| | | } |
| | | }) |
| | | }, |
| | |
| | | page: 0, |
| | | pageSize: 0 |
| | | }).then((res) => { |
| | | console.log(res.data.data) |
| | | if (res.data.code === 200) { |
| | | const list = res.data.data.map((item) => { |
| | | console.log(res.data) |
| | | if (res.code === 200) { |
| | | const list = res.data.map((item) => { |
| | | return { |
| | | name: item.name, |
| | | id: item.id |
| | |
| | | page: this.pagerOptions.currPage, |
| | | pageSize: this.pagerOptions.pageSize |
| | | }).then((res) => { |
| | | console.log(res.data.data) |
| | | if (res.data.code === 200) { |
| | | const list = res.data.data.map((item) => { |
| | | console.log(res.data) |
| | | if (res.code === 200) { |
| | | const list = res.data.map((item) => { |
| | | return { |
| | | ...item |
| | | } |
| | | }) |
| | | this.tableList = list || [] |
| | | this.pagerOptions.totalCount = res.data.total |
| | | this.pagerOptions.totalCount = res.total |
| | | } |
| | | }) |
| | | }, |
| | |
| | | page: this.pagerOptions.currPage, |
| | | pageSize: this.pagerOptions.pageSize |
| | | }).then((res) => { |
| | | if (res.data.code === 200) { |
| | | this.warehouseList = res.data.data |
| | | if (res.code === 200) { |
| | | this.warehouseList = res.data |
| | | } |
| | | }) |
| | | } |
| | |
| | | page: 0, |
| | | pageSize: 0 |
| | | }).then((res) => { |
| | | if (res.data.code == 200) { |
| | | this.warehouseList = res.data.data ? res.data.data : [] |
| | | if (res.code == 200) { |
| | | this.warehouseList = res.data ? res.data : [] |
| | | } |
| | | }) |
| | | }, |
| | |
| | | page: this.pagerOptions.currPage, |
| | | pageSize: this.pagerOptions.pageSize |
| | | }).then((res) => { |
| | | if (res.data.code === 200) { |
| | | const list = res.data.data |
| | | if (res.code === 200) { |
| | | const list = res.data |
| | | this.tableList.tableInfomation = list || [] |
| | | this.pagerOptions.totalCount = res.data.data.total |
| | | this.pagerOptions.totalCount = res.total |
| | | } |
| | | }) |
| | | }, |
| | |
| | | page: this.pagerOptions.currPage, |
| | | pageSize: this.pagerOptions.pageSize |
| | | }).then((res) => { |
| | | if (res.data.code == 200) { |
| | | const list = res.data.data?res.data.data:[] |
| | | if (res.code == 200) { |
| | | const list = res.data?res.data:[] |
| | | this.tableList.tableInfomation = list |
| | | this.pagerOptions.totalCount = res.data.total |
| | | this.pagerOptions.totalCount = res.total |
| | | } |
| | | }) |
| | | }, |