配置跨域代理
This commit is contained in:
parent
bee7f0c342
commit
95077acc77
|
|
@ -1,23 +1,268 @@
|
|||
<template>
|
||||
<!-- 领料出库 -->
|
||||
<view class="page-common"> </view>
|
||||
<!-- <view class="accept page-common">
|
||||
|
||||
</view> -->
|
||||
|
||||
<view class="complete-btn">
|
||||
<view class="btn" @click="changeTab(1)">
|
||||
<span>已完成</span>
|
||||
<div v-if="active == 1" class="bt-line"></div>
|
||||
</view>
|
||||
<view class="btn" style="margin-left: 120rpx" @click="changeTab(2)">
|
||||
<span>未完成</span>
|
||||
<div v-if="active == 2" class="bt-line"></div>
|
||||
</view>
|
||||
</view>
|
||||
<uni-row :gutter="24" class="search-form">
|
||||
<uni-col :span="10">
|
||||
<uni-col :span="12">
|
||||
<view>
|
||||
<uni-datetime-picker type="date" placeholder="请选择日期" :clear-icon="false" />
|
||||
<uni-datetime-picker
|
||||
v-model="dateArray"
|
||||
type="daterange"
|
||||
@maskClick="maskClick"
|
||||
@change="onChangeDate"
|
||||
placeholder="选择日期范围"
|
||||
/>
|
||||
</view>
|
||||
</uni-col>
|
||||
<uni-col :span="10">
|
||||
<uni-col :span="8">
|
||||
<view>
|
||||
<uni-easyinput placeholder="请输入项目名称" />
|
||||
<uni-easyinput placeholder="请输入内容" v-model="queryParams.keyWord" />
|
||||
</view>
|
||||
</uni-col>
|
||||
<uni-col :span="4">
|
||||
<view class="search" @click="getTableList()">搜索</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
<scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container">
|
||||
<div
|
||||
class="table-list-item"
|
||||
v-for="(item, index) in tableList"
|
||||
:key="index"
|
||||
@click="handleItem(item)"
|
||||
>
|
||||
<div class="title">
|
||||
<span style="font-size: 15px; font-weight: 800">新购验收</span>
|
||||
<span :style="{ color: item.status == 1 ? '#ff4d4f' : '#3784fb' }">{{
|
||||
item.taskStatus == 2 ? '未完成' : '已完成'
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">到货时间:</uni-col>
|
||||
<uni-col :span="18"
|
||||
><div class="cont">{{ item.arrivalTime }}</div></uni-col
|
||||
>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">采购单号:</uni-col>
|
||||
<uni-col :span="18"
|
||||
><div class="cont">{{ item.code }}</div></uni-col
|
||||
>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">采购物资:</uni-col>
|
||||
<uni-col :span="18"
|
||||
><div class="cont">{{ item.purchaseMaTypeName }}</div></uni-col
|
||||
>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">到货数量:</uni-col>
|
||||
<uni-col :span="18"
|
||||
><div class="cont">{{ item.purchaseMaNumber }}</div></uni-col
|
||||
>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">验收数量:</uni-col>
|
||||
<uni-col :span="18"><div class="cont"></div></uni-col>
|
||||
</uni-row>
|
||||
</div>
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
<script setup></script>
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import { getPickingOutboundListAPI } from '@/services/picking/outbound.js'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
const active = ref(1)
|
||||
const tableList = ref([])
|
||||
const statusList = ref(['3', '13', '4', '14', '19'])
|
||||
// 查询参数
|
||||
const queryParams = ref({
|
||||
startTime: '', // 开始时间
|
||||
endTime: '', // 结束时间
|
||||
keyWord: '',
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
})
|
||||
const dateArray = ref([]) //日期范围
|
||||
|
||||
<style></style>
|
||||
// 日期 change 事件
|
||||
const onChangeDate = (val) => {
|
||||
const [val_1, val_2] = val
|
||||
queryParams.value.startTime = val_1
|
||||
queryParams.value.endTime = val_2
|
||||
}
|
||||
|
||||
// 获取列表数据
|
||||
const getTableList = async () => {
|
||||
const res = await getPickingOutboundListAPI(queryParams)
|
||||
// console.log('res列表数据', res)
|
||||
tableList.value = res.rows
|
||||
}
|
||||
|
||||
// 滚动触底事件
|
||||
const onScrollTolower = () => {
|
||||
console.log('滚动触底--')
|
||||
}
|
||||
|
||||
const changeTab = (index) => {
|
||||
active.value = index
|
||||
if (index == 1) {
|
||||
statusList.value = ['3', '13', '4', '14', '19']
|
||||
getTableList()
|
||||
} else if (index == 2) {
|
||||
statusList.value = ['2', '12']
|
||||
getTableList()
|
||||
}
|
||||
}
|
||||
const maskClick = () => {}
|
||||
const handleItem = (item) => {
|
||||
console.log('🚀 ~ handleItem ~ item:', item)
|
||||
uni.navigateTo({ url: '/pages/new-purchase/accept/acceptDetails' })
|
||||
}
|
||||
onLoad((options) => {
|
||||
getTableList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
display: flex;
|
||||
padding: 0 15rpx;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
|
||||
.complete-btn {
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
.btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
font-size: 30rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
.bt-line {
|
||||
width: 80rpx;
|
||||
height: 4rpx;
|
||||
background-color: #3784fb;
|
||||
}
|
||||
}
|
||||
|
||||
.search-form {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.search {
|
||||
height: 65rpx;
|
||||
background-color: #3784fb;
|
||||
text-align: center;
|
||||
line-height: 65rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.scroll-container {
|
||||
flex: 1;
|
||||
|
||||
.table-list-item {
|
||||
margin: 20rpx 0;
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
min-height: 300rpx;
|
||||
border-radius: 10rpx;
|
||||
.title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.cont {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
line-height: 1.9;
|
||||
}
|
||||
.line {
|
||||
margin: 20rpx 0;
|
||||
height: 1px;
|
||||
background-color: #e8e8e8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// .accept {
|
||||
// height: 100%;
|
||||
// display: flex;
|
||||
// flex-direction: column;
|
||||
// word-break: break-all;
|
||||
|
||||
// .scroll-container {
|
||||
// flex: 1;
|
||||
// }
|
||||
// .complete-btn {
|
||||
// display: flex;
|
||||
// padding: 20rpx;
|
||||
// .btn {
|
||||
// display: flex;
|
||||
// flex-direction: column;
|
||||
// align-items: center;
|
||||
// font-size: 30rpx;
|
||||
// font-weight: 800;
|
||||
// }
|
||||
// .bt-line {
|
||||
// width: 80rpx;
|
||||
// height: 4rpx;
|
||||
// background-color: #3784fb;
|
||||
// }
|
||||
// }
|
||||
|
||||
// .search-form {
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
// box-sizing: content-box;
|
||||
// }
|
||||
|
||||
// .search {
|
||||
// height: 65rpx;
|
||||
// background-color: #3784fb;
|
||||
// text-align: center;
|
||||
// line-height: 65rpx;
|
||||
// color: #fff;
|
||||
// }
|
||||
// }
|
||||
// .table-list-item {
|
||||
// margin: 20rpx 0;
|
||||
// padding: 20rpx;
|
||||
// background-color: #fff;
|
||||
// min-height: 300rpx;
|
||||
// border-radius: 10rpx;
|
||||
// .title {
|
||||
// display: flex;
|
||||
// justify-content: space-between;
|
||||
// align-items: center;
|
||||
// }
|
||||
// .cont {
|
||||
// display: flex;
|
||||
// justify-content: flex-end;
|
||||
// line-height: 1.9;
|
||||
// }
|
||||
// .line {
|
||||
// margin: 20rpx 0;
|
||||
// height: 1px;
|
||||
// background-color: #e8e8e8;
|
||||
// }
|
||||
// }
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
import { http } from '@/utils/http'
|
||||
|
||||
/**
|
||||
* 领料出库 ---- 列表查询接口
|
||||
*/
|
||||
export const getPickingOutboundListAPI = (data) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/material/lease_apply_info/list',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@ import { useMemberStore } from '@/stores'
|
|||
* baseURL 设置请求ip地址和端口
|
||||
*/
|
||||
const ENV = process.env.NODE_ENV
|
||||
const baseURL = ENV === 'development' ? 'http://192.168.2.246:18080' : '***'
|
||||
const baseURL = ENV === 'development' ? '/api' : '***'
|
||||
|
||||
/**
|
||||
* httpInterceptor 分别拦截 request 和 uploadFile 请求
|
||||
|
|
@ -51,7 +51,22 @@ export const http = (options) => {
|
|||
success(res) {
|
||||
// 1. 判断是否请求成功
|
||||
if (res.statusCode >= 200 && res.statusCode < 300) {
|
||||
resolve(res.data)
|
||||
if (res.data.code >= 200 && res.data.code < 300) {
|
||||
resolve(res.data)
|
||||
} else if (res.data.code === 401) {
|
||||
// 2. 401 表示token过期 去往登录页重新登录
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: `${res.data.msg}`,
|
||||
})
|
||||
const memberStore = useMemberStore()
|
||||
memberStore.clearUserInfo()
|
||||
memberStore.clearToken()
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/index',
|
||||
})
|
||||
reject(res)
|
||||
}
|
||||
} else if (res.statusCode === 401) {
|
||||
// 2. 401 表示token过期 去往登录页重新登录
|
||||
const memberStore = useMemberStore()
|
||||
|
|
|
|||
|
|
@ -16,4 +16,16 @@ export default defineConfig({
|
|||
},
|
||||
},
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
// 在此处编写代理规则
|
||||
'/api': {
|
||||
target: 'http://192.168.2.246:18080',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => {
|
||||
return path.replace(/\/api/, '')
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue