Commit e10551d7 by wusiyi

feat: 优化生产单查询

parent bc80f0a3
...@@ -10,18 +10,21 @@ import { filePath } from '@/api/axios.ts' ...@@ -10,18 +10,21 @@ import { filePath } from '@/api/axios.ts'
const { getCLodop } = useLodop() const { getCLodop } = useLodop()
const type = { const type = {
'A': '正面', A: '正面',
'B': '反面', B: '反面',
'C': '左边', C: '左边',
'D': '右边', D: '右边',
} }
const imageList = ref<{ const imageList = ref<
sort: number {
title?: 'A' | 'B' | 'C' | 'D' sort: number
url?: string title?: 'A' | 'B' | 'C' | 'D'
}[]>([]) url?: string
}[]
>([])
const detail = ref<SearchOrderRes>({ const detail = ref<SearchOrderRes>({
imgList: [], id: 0, imgList: [],
id: 0,
}) })
const printDevice = ref('') const printDevice = ref('')
const isPrint = ref(false) const isPrint = ref(false)
...@@ -80,14 +83,30 @@ const trackcodeInput = async () => { ...@@ -80,14 +83,30 @@ const trackcodeInput = async () => {
return return
} }
const user = JSON.parse(localStorage.getItem('user') || '{}') const user = JSON.parse(localStorage.getItem('user') || '{}')
const orderNumber = TrackingNumber.value
let orderNumber: string
const underscoreCount = (TrackingNumber.value.match(/_/g) || []).length
if (underscoreCount > 3) {
orderNumber = TrackingNumber.value.split('_')[3]
} else {
orderNumber = TrackingNumber.value
}
try { try {
const res = await getSubOrderBySubOrder(orderNumber, user.factory?.countryCode.toLowerCase()) const res = await getSubOrderBySubOrder(
orderNumber,
user.factory?.countryCode.toLowerCase(),
)
if (!res.data) { if (!res.data) {
return ElMessage.error('生产单不存在') return ElMessage.error('生产单不存在')
} }
if (printDevice.value && isPrint.value) { if (printDevice.value && isPrint.value) {
const data = await printProductionQrCode(res.data.id, user.factory?.countryCode.toLowerCase()) const data = await printProductionQrCode(
res.data.id,
user.factory?.countryCode.toLowerCase(),
)
// const path = 'http://10.168.1.209/local_files/factory' + data.message // const path = 'http://10.168.1.209/local_files/factory' + data.message
const path = filePath + data.message const path = filePath + data.message
print(path) print(path)
...@@ -108,7 +127,6 @@ const trackcodeInput = async () => { ...@@ -108,7 +127,6 @@ const trackcodeInput = async () => {
} }
detail.value = d detail.value = d
playAudio('weight_search_success') playAudio('weight_search_success')
nextTick(() => { nextTick(() => {
if (trackingNumberRef.value) { if (trackingNumberRef.value) {
...@@ -157,14 +175,13 @@ const lodopCall = async (fn: (lodop: LODOPObject) => string) => { ...@@ -157,14 +175,13 @@ const lodopCall = async (fn: (lodop: LODOPObject) => string) => {
window._lodop.On_Return_Remain = true window._lodop.On_Return_Remain = true
window._lodop.SET_PRINT_MODE('CATCH_PRINT_STATUS', true) window._lodop.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)
window._lodopCallback = {} window._lodopCallback = {}
window._lodop.On_Return = function(id, value) { window._lodop.On_Return = function (id, value) {
const cb = window._lodopCallback[id] const cb = window._lodopCallback[id]
if (!cb) return if (!cb) return
delete window._lodopCallback[id] delete window._lodopCallback[id]
cb(value) cb(value)
} }
} }
} }
return new Promise((resolve) => { return new Promise((resolve) => {
...@@ -239,13 +256,7 @@ const print = async (url: string) => { ...@@ -239,13 +256,7 @@ const print = async (url: string) => {
ElMessage.warning('设置面单打印机出错') ElMessage.warning('设置面单打印机出错')
return return
} }
lodop.ADD_PRINT_PDF( lodop.ADD_PRINT_PDF(0, 0, '100%', '100%', downloadPDF(url))
0,
0,
'100%',
'100%',
downloadPDF(url),
)
console.log(lodop) console.log(lodop)
if (lodop.CVERSION) { if (lodop.CVERSION) {
const startTime = Date.now() const startTime = Date.now()
...@@ -308,14 +319,12 @@ onMounted(() => { ...@@ -308,14 +319,12 @@ onMounted(() => {
<div v-if="imageList.length > 0" class="left-images"> <div v-if="imageList.length > 0" class="left-images">
<div v-for="(item, index) in imageList" :key="index" class="img-box"> <div v-for="(item, index) in imageList" :key="index" class="img-box">
<b v-if="item.title">{{ item.title }}({{ type[item.title] }})</b> <b v-if="item.title">{{ item.title }}({{ type[item.title] }})</b>
<img :src="item.url" alt=""> <img :src="item.url" alt="" />
</div> </div>
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<div <div class="input">
class="input"
>
<el-input <el-input
ref="trackingNumberRef" ref="trackingNumberRef"
v-model="TrackingNumber" v-model="TrackingNumber"
...@@ -324,32 +333,60 @@ onMounted(() => { ...@@ -324,32 +333,60 @@ onMounted(() => {
clearable clearable
@keydown.enter="trackcodeInput()" @keydown.enter="trackcodeInput()"
></el-input> ></el-input>
<el-button style="width: 138px;" type="primary" @click="trackcodeInput()"> <el-button
style="width: 138px"
type="primary"
@click="trackcodeInput()"
>
查询 查询
</el-button> </el-button>
</div> </div>
<div <div class="input">
class="input"
>
<el-select <el-select
v-model="printDevice" placeholder="请选择打印机" clearable filterable v-model="printDevice"
@change="handlePrinterChange"> placeholder="请选择打印机"
<el-option v-for="(item,i) in printList" :key="i" :label="item" :value="item"></el-option> clearable
filterable
@change="handlePrinterChange"
>
<el-option
v-for="(item, i) in printList"
:key="i"
:label="item"
:value="item"
></el-option>
</el-select> </el-select>
<el-checkbox v-model="isPrint" :disabled="!printDevice" style="margin-left: 10px">打印生产码</el-checkbox> <el-checkbox
v-model="isPrint"
:disabled="!printDevice"
style="margin-left: 10px"
>打印生产码</el-checkbox
>
</div> </div>
<div class="div-text"> <div class="div-text">
<b>生产单信息</b> <b>生产单信息</b>
<div class="div-content"> <div class="div-content">
<h2 style="text-align: center;color: black;font-size: 16px;width: 100%;">{{ detail.inputNum }}</h2> <h2
style="
text-align: center;
color: black;
font-size: 16px;
width: 100%;
"
>
{{ detail.inputNum }}
</h2>
<div :title="detail?.factorySubOrderNumber" class="div-item"> <div :title="detail?.factorySubOrderNumber" class="div-item">
<span>生产单号</span> <span>生产单号</span>
<p> <p>
{{ detail?.factorySubOrderNumber }} {{ detail?.factorySubOrderNumber }}
</p> </p>
<el-icon <el-icon
v-if="detail?.factorySubOrderNumber" class="copy" style="cursor:pointer;" v-if="detail?.factorySubOrderNumber"
@click="copyText(detail.factorySubOrderNumber)"> class="copy"
style="cursor: pointer"
@click="copyText(detail.factorySubOrderNumber)"
>
<DocumentCopy /> <DocumentCopy />
</el-icon> </el-icon>
</div> </div>
...@@ -357,8 +394,11 @@ onMounted(() => { ...@@ -357,8 +394,11 @@ onMounted(() => {
<span>店铺单号</span> <span>店铺单号</span>
<p>{{ detail?.shopNumber }}</p> <p>{{ detail?.shopNumber }}</p>
<el-icon <el-icon
v-if="detail?.shopNumber" class="copy" style="cursor:pointer;" v-if="detail?.shopNumber"
@click="copyText(detail.shopNumber)"> class="copy"
style="cursor: pointer"
@click="copyText(detail.shopNumber)"
>
<DocumentCopy /> <DocumentCopy />
</el-icon> </el-icon>
</div> </div>
...@@ -369,8 +409,10 @@ onMounted(() => { ...@@ -369,8 +409,10 @@ onMounted(() => {
</p> </p>
<el-icon <el-icon
v-if="detail?.thirdSubOrderNumber" v-if="detail?.thirdSubOrderNumber"
class="copy" style="cursor:pointer;" class="copy"
@click="copyText(detail.thirdSubOrderNumber)"> style="cursor: pointer"
@click="copyText(detail.thirdSubOrderNumber)"
>
<DocumentCopy /> <DocumentCopy />
</el-icon> </el-icon>
</div> </div>
...@@ -402,20 +444,23 @@ onMounted(() => { ...@@ -402,20 +444,23 @@ onMounted(() => {
<!-- </div>--> <!-- </div>-->
<div :title="String(detail?.faceCount)" class="div-item"> <div :title="String(detail?.faceCount)" class="div-item">
<span>打印面数</span> <span>打印面数</span>
<p v-if="detail?.num || imageList.length" style="color: red">{{ detail?.faceCount <p v-if="detail?.num || imageList.length" style="color: red">
}}({{ imageList.map(el => el.title).join('+') }})</p> {{ detail?.faceCount }}({{
imageList.map((el) => el.title).join('+')
}})
</p>
</div> </div>
</div> </div>
</div> </div>
<div <div
class="div-text" class="div-text"
style=" style="
flex: 1; flex: 1;
margin-top: 15px; margin-top: 15px;
flex-shrink: 0; flex-shrink: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
" "
> >
<div style="height: 100%" class="div-content"> <div style="height: 100%" class="div-content">
<b style="position: absolute; top: -12px">客户留言信息</b> <b style="position: absolute; top: -12px">客户留言信息</b>
......
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