Commit 27281878 by zhuzhequan

Merge remote-tracking branch 'origin/dev' into dev

parents a2ecf5a7 0f011c9a
......@@ -2,6 +2,8 @@ import router from '@/router'
import Axios from 'axios'
import { showError } from '@/utils/ui.ts'
import { v4 as uuidv4 } from 'uuid'
import dayjs from 'dayjs'
import {findRequestItemByUUID,deleteRequestByUUID,addRequestItem,getTimeDifferenceInMilliseconds} from './requestLog.ts'
const axios = Axios.create({
baseURL: import.meta.env.VITE_API_BASE,
timeout: 60 * 60 * 1000, //半小时
......@@ -22,9 +24,15 @@ axios.interceptors.request.use(
const token = getToken()
if (token) {
config.headers['jwt-token'] = token
config.headers.timestamp = new Date().getTime()
config.headers.uuid = uuidv4().replace(/-/g, '')
}
config.headers.timestamp = new Date().getTime()
config.headers.uuid = uuidv4().replace(/-/g, '')
addRequestItem({
url: config.url || '',
method: config.method || '',
startTime: dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss'),
uuid: config.headers.uuid
})
return config
},
(error) => {
......@@ -35,7 +43,23 @@ axios.interceptors.response.use(
(response) => {
// 1. 判断响应码
const data = response.data
const uuid = response.config?.headers?.uuid
const item = findRequestItemByUUID(uuid)
item.url = `${import.meta.env.VITE_API_BASE}${response.config?.url}`
const fm = new FormData()
const processTime = response.headers['processtime']
const endTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')
const clientResponseTime = getTimeDifferenceInMilliseconds(item.startTime, endTime)
console.log(item)
if((clientResponseTime as number)>=3000){
fm.append('processTime', processTime)
fm.append('url', item.url)
fm.append('method', item.method)
fm.append('requestId', response.data.requestId)
fm.append('clientResponseTime', String(clientResponseTime)+'ms')
navigator.sendBeacon(`${import.meta.env.VITE_API_BASE}/factory/ops/report-data`, fm)
}
deleteRequestByUUID(uuid)
if (data && typeof data === 'object' && typeof data.code === 'number') {
// token 过期
if (data.code === 403) {
......
export interface ApiRequestItem {
url: string;
method: string;
startTime: string;
uuid: string;
}
const apiRequestKey = 'apiRequestStorage'
export const getRequestData = () => {
return JSON.parse(localStorage.getItem(apiRequestKey) || '[]')
}
export const getTimeDifferenceInMilliseconds = (time1:string, time2:string): number | null => {
const date1 = new Date(time1);
const date2 = new Date(time2);
// 检查日期是否有效
if (isNaN(date1.getTime()) || isNaN(date2.getTime())) {
return null; // 返回 null 或者其他你想要的错误处理
}
return date2.getTime() - date1.getTime();
}
export const findRequestItemByUUID = (uuid: string) => {
const data = getRequestData()
return data.find((d: ApiRequestItem) => d.uuid === uuid)
}
export const deleteRequestByUUID = (uuid: string) => {
let data = getRequestData()
data= data.filter((d: ApiRequestItem) => d.uuid !== uuid)
localStorage.setItem(apiRequestKey,JSON.stringify(data))
}
export const addRequestItem = (item?:ApiRequestItem) => {
const data = getRequestData()
data.push(item)
localStorage.setItem(apiRequestKey,JSON.stringify(data))
return data
}
......@@ -15,6 +15,8 @@ export interface ExportParams extends SearchForm {
}
export interface SearchForm {
timeType?: number | null
newStandard?: number | string
standardDesignImage?:0 | 1 | 2 | null
shopNumber?: string
productMark?: string
shipmentType?: string | number
......@@ -57,7 +59,6 @@ export interface SearchForm {
blocking?: boolean
outOfStock?: boolean
receiverCountry?: string
standardDesignImage?: boolean
}
export interface PodCnOrderListData {
id: number
......
......@@ -102,7 +102,7 @@
<div>{{ getStatus(row.orderStatus) }}</div>
</template>
<template #shipmentType="{ row }">
{{ ['自有物流', '工厂物流'][row.shipmentType] }}
{{ ['自有物流', '九猫统筹物流'][row.shipmentType] }}
</template>
<template #shippingAge="{ row }">
{{ getShippingAge(row) }}
......
......@@ -879,7 +879,7 @@ onMounted(() => {
style="width: 150px"
>
<ElOption
v-for="(item, index) in ['自有物流', '工厂物流']"
v-for="(item, index) in ['自有物流', '九猫统筹物流']"
:key="index"
:value="index"
:label="item"
......@@ -1175,7 +1175,7 @@ onMounted(() => {
<div>{{ getStatus(row.status) }}</div>
</template>
<template #shipmentType="{ row }">
{{ ['自有物流', '工厂物流'][row.shipmentType] }}
{{ ['自有物流', '九猫统筹物流'][row.shipmentType] }}
</template>
</TableView>
</div>
......
......@@ -1156,7 +1156,7 @@ onMounted(() => {
<ElOption
v-for="(item, index) in searchForm.replaceShipment === 0
? ['自提', '快递']
: ['自有物流', '工厂物流']"
: ['自有物流', '九猫统筹物流']"
:key="index"
:value="index"
:label="item"
......@@ -1267,7 +1267,7 @@ onMounted(() => {
{{
(row.replaceShipment === 0
? ['自提', '快递']
: ['自有物流', '工厂物流'])[row.shipmentType]
: ['自有物流', '九猫统筹物流'])[row.shipmentType]
}}
</template>
<template #replaceShipment="{ row }">
......
......@@ -221,7 +221,7 @@ const historyData = ref<HistoryDataItem[]>([])
const placeholderText = ref('')
const sendNum = ref(0)
const isDownloadImage = ref(false)
const isAutoSure = ref(false)
const isAutoSure = ref(true)
const detail = ref<PodOrderRes>({
id: -1,
podJomallOrderCnId: -1,
......@@ -290,7 +290,7 @@ watch(
trackingNumberRef.value && trackingNumberRef.value.focus()
TrackingNumber.value = ''
isAutoSure.value = false
isAutoSure.value = true
sendNum.value = 0
}
},
......
......@@ -194,7 +194,7 @@
<div class="box-top-item-btn">
<ElButton
type="primary"
@click="podOrderDetailsData && print(podOrderDetailsData, true)"
@click="manualPrint"
>手动打印
</ElButton>
<ElButton type="primary" @click="printNormal">普货拣货 </ElButton>
......@@ -603,6 +603,14 @@ const messageChange = (data: WebSocketMessage) => {
setPodBoxList(more)
}
}
const manualPrint = ()=>{
if(podOrderDetailsData.value){
print(podOrderDetailsData.value, true )
productionOrderRef.value.focus()
}
}
const setPodBoxList = (data: WebSocketMessage) => {
const obj = data.txt
if (obj && typeof obj === 'string') {
......@@ -634,7 +642,9 @@ const printNormal = async () => {
}
const res = await printNormalPdf(arr.join())
ElMessage.success('操作成功')
productionOrderRef.value.focus()
window.open(filePath + res.message)
}
const initPrintDevice = () => {
const lodop = getCLodop(null, null)
......
......@@ -186,6 +186,23 @@
style="width: 150px"
/>
</ElFormItem>
<ElFormItem v-if="status === 'BATCH_DOWNLOAD'" label="规范素材">
<ElSelect
v-model="searchForm.standardDesignImage"
placeholder="请选择"
clearable
filterable
:teleported="false"
style="width: 150px"
>
<ElOption
v-for="(_, index) in ['否', '是','混合']"
:key="index"
:value="index"
:label="['否', '是','混合'][index]"
></ElOption>
</ElSelect>
</ElFormItem>
<ElFormItem v-if="status !== 'BATCH_DOWNLOAD'" label="生产单号">
<ElInput
v-model.trim="searchForm.factorySubOrderNumber"
......@@ -458,7 +475,7 @@
style="width: 150px"
>
<ElOption
v-for="(item, index) in ['自有物流', '工厂物流']"
v-for="(item, index) in ['自有物流', '九猫统筹物流']"
:key="index"
:value="index"
:label="item"
......@@ -574,19 +591,22 @@
></ElOption>
</ElSelect>
</ElFormItem>
<ElFormItem label="规范素材">
<ElFormItem
label="规范素材"
>
<ElSelect
v-model="searchForm.standardDesignImage"
v-model="searchForm.newStandard"
placeholder="请选择"
clearable
filterable
:teleported="false"
style="width: 150px"
>
<ElOption
v-for="(_, index) in ['否', '是']"
:key="index"
:value="!!index"
:label="index === 0 ? '否' : '是'"
:value="index"
:label="['否', '是'][index]"
></ElOption>
</ElSelect>
</ElFormItem>
......@@ -786,7 +806,7 @@
>
</ElDropdownMenu>
</template> -->
<!-- 代发:0.自有物流 1.工厂物流; 不代发: 0.自提 1.快递-->
<!-- 代发:0.自有物流 1.九猫统筹物流; 不代发: 0.自提 1.快递-->
<template
v-if="
status === 'CREATE_LOGISTICS' || status === 'WAIT_SHIPMENT'
......@@ -1624,7 +1644,7 @@
>
{{
row.replaceShipment === 1
? ['自有物流', '工厂物流'][row.shipmentType]
? ['自有物流', '九猫统筹物流'][row.shipmentType]
: ['自提', '快递'][row.shipmentType]
}}
</span>
......@@ -3214,6 +3234,7 @@ const detailData = ref({})
const [searchForm, resetSearchForm] = useValue<SearchForm>({
timeType: 1,
shopNumber: '',
newStandard: '',
replaceShipment: '',
productMark: '',
shipmentType: '',
......@@ -3952,12 +3973,11 @@ const tableColumns = computed(() => {
},
{
label: '规范素材',
minWidth: 180,
minWidth: 130,
prop: 'standardDesignImage',
slot: 'standardDesignImage',
align: 'center',
},
{
},{
label: '失败原因',
minWidth: 250,
prop: 'failReason',
......@@ -4209,6 +4229,7 @@ const {
baseparams.tagsIdArr && delete baseparams.tagsIdArr
// 批量下载
if (status.value === 'BATCH_DOWNLOAD') {
delete baseparams.newStandard
return batchDownloadApi(
{
...baseparams,
......
......@@ -425,7 +425,7 @@
shipmentList=['自提','快递']
searchForm.shipmentType=0
}else{
shipmentList=['自有物流', '工厂物流']
shipmentList=['自有物流', '九猫统筹物流']
searchForm.shipmentType=''
}
}
......@@ -1695,7 +1695,7 @@
{{
row.shipmentType == 0 && row.replaceShipment == 0
? '自提'
: ['自有物流', '工厂物流'][row.shipmentType]
: ['自有物流', '九猫统筹物流'][row.shipmentType]
}}
</span>
</div>
......@@ -3759,7 +3759,7 @@ const handleBatchDelete = async (type: string, id?: string) => {
}
}
const shipmentList = ref(['自有物流', '工厂物流'])
const shipmentList = ref(['自有物流', '九猫统筹物流'])
// 批量下载 重新排版
const handleReComposingDesign = async () => {
......
......@@ -777,7 +777,7 @@
>
<template #default="{ row }">
<span v-if="row.order">{{
row.order.shipment_type == 1 ? '工厂物流' : '自我物流'
row.order.shipment_type == 1 ? '九猫统筹物流' : '自我物流'
}}</span>
</template>
</el-table-column>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment