Commit b16335ad by qinjianhui

Merge branch 'dev' into 'master'

Dev

See merge request !117
parents 6fabe5c7 6855c54a
......@@ -161,7 +161,8 @@
<template #image="{ row }">
<div style="display: flex; flex-wrap: nowrap">
<div
v-for="img in row.productMark !== 'normal'
v-for="img in row.productMark !== 'normal' &&
row.productMark !== 'custom_normal'
? row.previewImgs
: [{ url: row.variantImage }]"
:key="img"
......
......@@ -112,11 +112,12 @@
@row-click="handleRowClick"
>
<template #image="{ row }">
<div
style="display: flex; flex-wrap: nowrap"
>
<div style="display: flex; flex-wrap: nowrap">
<div
v-for="img in row.productMark!=='normal'?row.previewImgs:[{url:row.variantImage}]"
v-for="img in row.productMark !== 'normal' &&
row.productMark !== 'custom_normal'
? row.previewImgs
: [{ url: row.variantImage }]"
:key="img"
style="cursor: pointer; margin-right: 5px; flex: 1"
@click.stop="handleCurrentChange(img.url)"
......@@ -124,15 +125,13 @@
<img v-if="img.url" :src="img.url" alt="" />
</div>
</div>
</template>
<template #verifyResult="{ row }">
<el-icon
v-if="row.power"
style="color: #00cc00; font-size: 24px; font-weight: 900"
>
<Check
/>
<Check />
</el-icon>
</template>
</TableView>
......@@ -187,19 +186,12 @@
<ElButton
type="primary"
@click="podOrderDetailsData && print(podOrderDetailsData, true)"
>手动打印
</ElButton
>
<ElButton
type="primary"
@click="printNormal"
>普货拣货
</ElButton
>
>手动打印
</ElButton>
<ElButton type="primary" @click="printNormal">普货拣货 </ElButton>
<ElButton type="success" @click="handlePrintFinish"
>打单完成
</ElButton
>
>打单完成
</ElButton>
<ElButton type="danger" @click="handleClearBox">清空箱子</ElButton>
</div>
<div
......@@ -225,7 +217,7 @@
:class="{
active: item.box && boxIndex == item.box,
isNull: !item.data,
badge: handleProduct(item.data || {}),
// badge: handleProduct(item.data || {}),
}"
@click="handleBoxClick(item)"
>
......@@ -235,6 +227,19 @@
<span v-if="item.data" class="number">
{{ item.data.pickingNumber }}/{{ item.data.purchaseNumber }}
</span>
<div
v-if="
item.data &&
item.data.productList?.some(
(e) =>
e.productMark === 'custom_normal' ||
e.productMark === 'normal',
)
"
class="cb-product-mark"
>
<div class="red-circle"></div>
</div>
</div>
</div>
</div>
......@@ -259,7 +264,8 @@ import {
getPackingCnDataApi,
clearBoxApi,
getPodBoxListApi,
submitInspectionApi, printNormalPdf,
submitInspectionApi,
printNormalPdf,
} from '@/api/podCnOrder'
import useUserStore from '@/store/user'
import { Check } from '@element-plus/icons-vue'
......@@ -306,33 +312,28 @@ const podOrderDetailsColumns = computed(() => [
{
label: '生产单号',
prop: 'podJomallCnNo',
showOverflowTooltip:true,
showOverflowTooltip: true,
width: 150,
align: 'center',
},
// {
// label: 'base SKU',
// prop: 'baseSku',
// width: 140,
// align: 'center',
// },
{
{
label: '库存SKU',
prop: 'thirdSkuCode',
showOverflowTooltip:true,
showOverflowTooltip: true,
width: 180,
align: 'center',
},
{
label: 'variant SKU',
prop: 'variantSku',
showOverflowTooltip:true,
showOverflowTooltip: true,
width: 150,
align: 'center',
},
{
label: '商品名称',
showOverflowTooltip:true,
showOverflowTooltip: true,
width: 200,
prop: 'productName',
},
......@@ -380,6 +381,7 @@ watch(visible, async (value: boolean) => {
const hit = props.warehouseList.find((w) => w.id === localId)
warehouseId.value = hit ? localId : props.warehouseList[0].id
_warehouseId.value = hit ? localId : props.warehouseList[0].id
if (userStore.user?.factory.id) {
try {
await socket.init(
......@@ -501,8 +503,8 @@ const renderItemBox = (bool: boolean) => {
parts.length > 3 && parts[3].startsWith('CNPSC')
? parts[3]
: parts.length > 1
? parts[1]
: parts[0]
? parts[1]
: parts[0]
for (const product of productList) {
if (product.podJomallCnNo === currentCode) {
coverImage.value = product.previewImgs?.[0]?.url || ''
......@@ -552,12 +554,15 @@ const setPodBoxList = (data: WebSocketMessage) => {
}
const printNormal = async () => {
const arr: (number | undefined)[] = [];
(podBoxList.value || []).forEach((item: PodMakeOrderData) => {
const arr: (number | undefined)[] = []
;(podBoxList.value || []).forEach((item: PodMakeOrderData) => {
if (item.data) {
if (item.data.productList && item.data.productList.length > 0) {
const flag = item.data.productList.some((item1) => {
return item1.productMark == 'normal'
return (
item1.productMark == 'normal' ||
item1.productMark == 'custom_normal'
)
})
if (flag) {
arr?.push(item.data?.id)
......@@ -589,15 +594,15 @@ const initPrintDevice = () => {
sheetPrinter.value = lodop.GET_PRINTER_NAME(0)
printDeviceList.value = arr
}
const handleProduct = (val: OrderData) => {
if (val && val.productList && val.productList.length > 0) {
return val.productList?.some((item) => {
return item.productMark == 'normal'
})
} else {
return false
}
}
// const handleProduct = (val: OrderData) => {
// if (val && val.productList && val.productList.length > 0) {
// return val.productList?.some((item) => {
// return item.productMark == 'normal'
// })
// } else {
// return false
// }
// }
const handleSearch = () => {
const code = productionOrder.value
if (!code) {
......@@ -733,9 +738,9 @@ const initOrderDetailBox = async () => {
return
}
console.log(res.data)
res.data.forEach(r=>{
r.data?.productList?.forEach(d=>{
if (d.productMark === 'normal') {
res.data.forEach((r) => {
r.data?.productList?.forEach((d) => {
if (d.productMark === 'normal' || d.productMark === 'custom_normal') {
d.previewImgs = [{ url: d.variantImage || '' }]
} else {
if (!d.previewImgs) d.previewImgs = JSON.parse(d.imageAry || '[]')
......@@ -779,7 +784,7 @@ const initOrderDetailBox = async () => {
if (
podOrderDetailsData.value &&
podOrderDetailsData.value.pickingNumber ===
podOrderDetailsData.value.purchaseNumber
podOrderDetailsData.value.purchaseNumber
) {
podOrderDetailsData.value.printResult = 'notPrintSuccess'
}
......@@ -998,8 +1003,11 @@ const print = (data: OrderData, forcePrint = false, callback?: () => void) => {
// }
const handleRowClick = (row: ProductList) => {
console.log(907, row)
const previewImages = row.productMark!=='normal'?row.previewImgs:[{url:row.variantImage}]
coverImage.value =previewImages?.[0]?.url || ''
const previewImages =
row.productMark !== 'normal' && row.productMark !== 'custom_normal'
? row.previewImgs
: [{ url: row.variantImage }]
coverImage.value = previewImages?.[0]?.url || ''
productionOrderRef.value.focus()
}
const handleCurrentChange = (url: string) => {
......@@ -1231,6 +1239,17 @@ const handleWarehouseChange = (value: string | number) => {
color: #ddd;
}
}
.cb-product-mark {
position: absolute;
top: 0;
right: 0;
.red-circle {
width: 8px;
height: 8px;
border-radius: 50%;
background-color: red;
}
}
</style>
<style lang="scss">
.pod-make-order-dialog {
......
......@@ -1001,32 +1001,50 @@
class="goods-item-img"
style="display: flex; flex-direction: column"
>
<div
v-for="img in item.productMark !== 'normal' &&
item.productMark !== 'custom_normal'
? item.previewImgs
: [{ url: item.variantImage }]"
:key="img"
style="text-align: center"
>
<template v-if="item.previewImgs?.length">
<div
v-for="img in item.previewImgs"
:key="img"
style="text-align: center"
>
<img
:src="img.url"
alt="商品图片"
style="cursor: pointer"
@click="handlePictureCardPreview(img.url)"
/>
<div
v-if="item.customizedQuantity"
class="triangle-box"
:title="`类型:${getQuantityText(
item.customizedQuantity,
)}面`"
>
<div class="multi-text">
{{ getQuantityText(item.customizedQuantity) }}
</div>
</div>
</div>
</template>
<template v-else>
<img
:src="img.url"
alt="商品图片222"
:src="item.variantImage"
alt="商品图片"
style="cursor: pointer"
@click="handlePictureCardPreview(img.url)"
@click="handlePictureCardPreview(item.variantImage)"
/>
<div
v-if="item.customizedQuantity"
class="triangle-box"
:title="`类型:${getQuantityText(
item.customizedQuantity,
)}面`"
>
<div class="multi-text">
{{ getQuantityText(item.customizedQuantity) }}
<div class="triangle-container-wrap">
<div class="triangle-container">
<div class="triangle-marker"></div>
<div
class="content"
:title="handleMark(item.productMark).label"
>
{{ handleMark(item.productMark).name }}
</div>
</div>
</div>
</div>
</template>
</div>
<div class="goods-item-info">
<div class="goods-item-info-item">
......@@ -5023,14 +5041,16 @@ const openDetail = async (id: number) => {
try {
const res = await getOrderDetailById(id)
if (res.code == 200) {
const item = res.data
if(item.imageAry){
if(item.imageAry.startsWith('http')){
item.imageAry = JSON.stringify(item.imageAry.split(',').map(e=>{
return {
url:e
}
}))
const item = res.data
if (item.imageAry) {
if (item.imageAry.startsWith('http')) {
item.imageAry = JSON.stringify(
item.imageAry.split(',').map((e) => {
return {
url: e,
}
}),
)
}
}
if (item.imageAry) {
......@@ -5178,25 +5198,34 @@ watch(
(newData) => {
if (!newData?.length) return
newData.forEach((order) => {
const item = order as ProductList
if(item.imageAry){
if(item.imageAry.startsWith('http')){
item.imageAry = JSON.stringify(item.imageAry.split(',').map(e=>{
return {
url:e
}
}))
const item = order as ProductList
if (item.imageAry) {
if (item.imageAry.startsWith('http')) {
item.imageAry = JSON.stringify(
item.imageAry.split(',').map((e) => {
return {
url: e,
}
}),
)
}
}
if(order.productList){
if (order.productList) {
// 使用可选链和空值合并简化判断
order.productList?.forEach((product) => {
if (!product.previewImgs && product.imageAry) {
try {
product.previewImgs =
JSON.parse(product.imageAry)?.filter(
(el: { title: string }) => el.title,
) || []
if (
product.productMark === 'custom_normal' ||
product.productMark === 'normal'
) {
product.previewImgs = []
} else {
product.previewImgs =
JSON.parse(product.imageAry)?.filter(
(el: { title: string }) => el.title,
) || []
}
} catch (error) {
console.error('JSON解析失败:', error)
product.previewImgs = []
......@@ -5204,7 +5233,6 @@ watch(
}
})
}
})
},
{ deep: true, immediate: true }, // 添加immediate确保初始化时执行
......@@ -5384,6 +5412,59 @@ function getQuantityText(qty: number) {
return Math.floor(qty) === 1 ? '单' : '多'
}
const handleMark = (mark: string) => {
switch (mark) {
case 'virtual':
return {
name: 'VIR',
color: '#ff9900',
label: '虚拟商品',
}
case 'normal':
return {
name: 'G',
color: '#67C23A',
label: '普通商品',
}
case 'pod':
return {
name: 'P',
color: '#F56C6C',
label: 'pod商品',
}
case 'custom':
return {
name: 'C',
color: '#6d9eeb',
label: '一件定制商品',
}
case 'custom_part':
return {
name: 'CP',
color: '#6d9eeb',
label: '一件定制局部印商品',
}
case 'custom_full':
return {
name: 'CF',
color: '#6d9eeb',
label: '一件定制满印商品',
}
case 'custom_normal':
return {
name: 'CB',
color: '#67C23A',
label: '胚衣',
}
default:
return {
name: '',
color: '#FFFFFF',
width: '0',
}
}
}
const dialogVisible = ref(false)
const dialogImageUrl = ref('')
const handlePictureCardPreview = (fileUrl: string) => {
......@@ -5499,9 +5580,9 @@ useEnterKeyTrigger({
// height: 100px;
position: relative;
img {
width: 65%;
}
// img {
// width: 65%;
// }
}
&:not(:last-child) {
......@@ -5813,6 +5894,34 @@ useEnterKeyTrigger({
}
}
}
.triangle-container-wrap {
position: absolute;
top: 0;
right: 0;
}
.triangle-container {
position: relative;
.triangle-marker {
width: 0;
height: 0;
border: 18px solid transparent;
border-right: 18px solid #e74c3c;
border-top: 18px solid #e74c3c;
}
.content {
position: absolute;
top: 0;
left: 18px;
transform: rotate(45deg);
color: white;
text-align: center;
font-weight: bold;
font-size: 12px;
}
}
</style>
<style lang="scss">
.customize-select-style {
......
......@@ -201,7 +201,6 @@
:class="{
active: item.box && boxIndex == item.box,
isNull: !item.data,
badge: handleProduct(item.data || {}),
}"
@click="handleBoxClick(item)"
>
......@@ -215,7 +214,9 @@
v-if="
item.data &&
item.data.productList?.some(
(e) => e.productMark === 'custom_normal',
(e) =>
e.productMark === 'custom_normal' ||
e.productMark === 'normal',
)
"
class="cb-product-mark"
......@@ -350,8 +351,12 @@ watch(visible, async (value: boolean) => {
if (value) {
podOrderDetailsData.value = {}
currentCode = ''
warehouseId.value = props.warehouseList[0].id
_warehouseId.value = props.warehouseList[0].id
const localRaw = sessionStorage.getItem('locaclCnWarehouseId')
const localId = localRaw ? JSON.parse(localRaw) : ''
/* 先找一次,确认本地值是否存在于列表 */
const hit = props.warehouseList.find((w) => w.id === localId)
warehouseId.value = hit ? localId : props.warehouseList[0].id
_warehouseId.value = hit ? localId : props.warehouseList[0].id
if (userStore.user?.factory.id) {
try {
......@@ -378,6 +383,7 @@ watch(visible, async (value: boolean) => {
const locaclWarehouseId = localStorage.getItem('locaclWarehouseId')
if (locaclPrinter) sheetPrinter.value = JSON.parse(locaclPrinter)
if (locaclWarehouseId) warehouseId.value = JSON.parse(locaclWarehouseId)
emit('set-printer', sheetPrinter.value)
} else {
if (userStore.user?.factory.id) {
socket.send({
......@@ -453,7 +459,7 @@ const renderItemBox = (bool: boolean) => {
const { data } = boxItem
data?.productList?.forEach((el) => {
if (!el.previewImgs) {
if (el.productMark === 'custom_normal') {
if (el.productMark === 'custom_normal' || el.productMark === 'normal') {
el.previewImgs = [{ url: el.variantImage || '' }]
} else {
el.previewImgs = JSON.parse(el.imageAry)
......@@ -552,15 +558,15 @@ const initPrintDevice = () => {
sheetPrinter.value = lodop.GET_PRINTER_NAME(0)
printDeviceList.value = arr
}
const handleProduct = (val: OrderData) => {
if (val && val.productList && val.productList.length > 0) {
return val.productList?.some((item) => {
return item.productMark == 'normal'
})
} else {
return false
}
}
// const handleProduct = (val: OrderData) => {
// if (val && val.productList && val.productList.length > 0) {
// return val.productList?.some((item) => {
// return item.productMark == 'normal'
// })
// } else {
// return false
// }
// }
const handleSearch = () => {
const code = productionOrder.value
if (!code) {
......@@ -723,7 +729,7 @@ const initOrderDetailBox = async () => {
podOrderDetailsData.value?.productList?.forEach((el) => {
if (!el.previewImgs) {
if (el.productMark === 'custom_normal') {
if (el.productMark === 'custom_normal' || el.productMark === 'normal') {
el.previewImgs = [{ url: el.variantImage || '' }]
} else {
el.previewImgs = el.imageAry
......
......@@ -836,14 +836,12 @@
</span>
</ElFormItem>
<ElFormItem v-if="status === 'WAIT_SHIPMENT'">
<span class="item">
<span class="item">
<ElButton type="warning" @click="showPrintSku"
>打印库存sku标签</ElButton
>打印库存sku标签</ElButton
>
</span>
</ElFormItem>
</ElForm>
</div>
<div class="header-filter-tab">
......@@ -1793,7 +1791,7 @@
underline="never"
type="success"
@click="uploadFile(row)"
>上传PRN</el-link
>上传PRN</el-link
>
<el-icon
v-if="row.isUpload"
......@@ -1809,12 +1807,12 @@
:title="fileName(row)"
type="success"
@click="downloadRowProFile(row)"
>下载PRN
>下载PRN
</el-link>
<el-icon
v-if="row.prnDownloadStatus"
class="download-icon"
style="position:relative;right: 7px"
style="position: relative; right: 7px"
>
<CircleCheckFilled />
</el-icon>
......@@ -1856,7 +1854,6 @@
/></el-icon>
</span>
<span class="operate-item">
<ElButton
:disabled="!row.url && !row.tiffUrl"
link
......@@ -1866,7 +1863,7 @@
下载素材
</ElButton>
<el-icon v-if="row.downloadStatus" class="download-icon"
><CircleCheckFilled
><CircleCheckFilled
/></el-icon>
</span>
<span class="operate-item">
......@@ -3137,13 +3134,15 @@ const updateTrackingNumber = async (row: PodUsOrderListData) => {
}
const showPrintSku = async () => {
if(!selection.value.length) {
if (!selection.value.length) {
return ElMessage.warning('请选择数据')
}
await printWarehouseSkuDialogRef.value?.open(2,selection.value.map((item) => item.id).join(','))
await printWarehouseSkuDialogRef.value?.open(
2,
selection.value.map((item) => item.id).join(','),
)
}
const exportData = () => {
exportVisible.value = true
}
......@@ -3990,13 +3989,13 @@ watch(
if (!newData?.length) return
newData.forEach((order) => {
// console.log(3690, order)
// 使用可选链和空值合并简化判断
order.productList?.forEach((product) => {
if (!product.previewImgs && product.imageAry) {
try {
if (product.productMark === 'custom_normal') {
if (
product.productMark === 'custom_normal' ||
product.productMark === 'normal'
) {
product.previewImgs = []
} else {
product.previewImgs =
......@@ -4212,11 +4211,15 @@ const uploadFile = (row: PodUsOrderListData) => {
input.onchange = async function () {
try {
if (input.files && input.files.length) {
if(!input.files[0].name.startsWith(row.batchArrangeNumber || '')) {
await ElMessageBox.confirm(`文件名不是以批次号开头是否继续上传?`, '提示', {
confirmButtonText: '确定',
type: 'warning',
})
if (!input.files[0].name.startsWith(row.batchArrangeNumber || '')) {
await ElMessageBox.confirm(
`文件名不是以批次号开头是否继续上传?`,
'提示',
{
confirmButtonText: '确定',
type: 'warning',
},
)
}
row.isUpload = true
uploadList.value.push(row)
......@@ -4956,7 +4959,14 @@ const downloadMaterial = async () => {
try {
const res = await downloadMaterialApi(selectedIds)
if (res.code !== 200) return
window.open(filePath + res.message)
// window.open(filePath + res.message)
const a = document.createElement('a')
a.href = filePath + res.message
a.download = res.message!
a.target = '_blank'
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
} catch (e) {
// showError(e)
console.error(e)
......@@ -6949,7 +6959,7 @@ const printNormal = async () => {
.operate-item {
position: relative;
}
.download-icon{
.download-icon {
color: var(--el-color-success);
}
.check-icon {
......
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