Commit 43f9f19b by qinjianhui

feat: 添加订单延期时间

parent 334b94ea
...@@ -182,7 +182,7 @@ export function archiveOrderApi(ids: (number | string)) { ...@@ -182,7 +182,7 @@ export function archiveOrderApi(ids: (number | string)) {
export function printPickOrderApi(ids: (number | string)[]) { export function printPickOrderApi(ids: (number | string)[]) {
return axios.post<never, BaseRespData<void>>( return axios.post<never, BaseRespData<void>>(
'factory/podOrderOperation/printPickPdf', 'factory/podOrderOperation/printPickPdf',
{ ids }, { ids: ids.join(',') },
) )
} }
......
...@@ -213,6 +213,14 @@ ...@@ -213,6 +213,14 @@
<span class="info-label">状态:</span> <span class="info-label">状态:</span>
<span class="info-value">{{ item.statusName }}</span> <span class="info-value">{{ item.statusName }}</span>
</div> </div>
<div class="card-info-row full delay-time-row">
<span
class="delay-time-value"
:title="`订单延期:${getOrderDelayText(item.createTime as string)}`"
>
{{ getOrderDelayText(item.createTime as string) }}
</span>
</div>
</div> </div>
</template> </template>
</CommonCard> </CommonCard>
...@@ -268,6 +276,7 @@ ...@@ -268,6 +276,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import dayjs from 'dayjs'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { import {
getCardLayoutListApi, getCardLayoutListApi,
...@@ -410,6 +419,15 @@ const getPlatformImg = (code: string) => { ...@@ -410,6 +419,15 @@ const getPlatformImg = (code: string) => {
return '' return ''
} }
const getOrderDelayText = (createTime?: string | null) => {
if (!createTime) return '--'
const createAt = dayjs(createTime)
if (!createAt.isValid()) return '--'
const diffSeconds = Math.max(0, dayjs().diff(createAt, 'second'))
const hours = Math.floor(diffSeconds / (60 * 60))
return `${hours}h`
}
defineExpose({ clearSelection, getSelectedIds, refresh }) defineExpose({ clearSelection, getSelectedIds, refresh })
</script> </script>
...@@ -498,6 +516,16 @@ defineExpose({ clearSelection, getSelectedIds, refresh }) ...@@ -498,6 +516,16 @@ defineExpose({ clearSelection, getSelectedIds, refresh })
overflow: hidden; overflow: hidden;
} }
.delay-time-row {
justify-content: flex-end;
margin-top: 2px;
}
.delay-time-value {
color: red;
font-weight: 600;
}
.info-label { .info-label {
flex-shrink: 0; flex-shrink: 0;
color: #909399; color: #909399;
......
...@@ -208,6 +208,14 @@ ...@@ -208,6 +208,14 @@
<span class="info-label">状态:</span> <span class="info-label">状态:</span>
<span class="info-value ellipsis">{{ item.statusName }}</span> <span class="info-value ellipsis">{{ item.statusName }}</span>
</div> </div>
<div class="card-info-row full delay-time-row">
<span
class="delay-time-value"
:title="`订单延期:${getOrderDelayText(item.createTime as string)}`"
>
{{ getOrderDelayText(item.createTime as string) }}
</span>
</div>
</div> </div>
</template> </template>
</CommonCard> </CommonCard>
...@@ -230,6 +238,7 @@ ...@@ -230,6 +238,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import dayjs from 'dayjs'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import CommonCard from '@/components/CommonCard.vue' import CommonCard from '@/components/CommonCard.vue'
import { import {
...@@ -314,6 +323,15 @@ const getPlatformImg = (code: string) => { ...@@ -314,6 +323,15 @@ const getPlatformImg = (code: string) => {
return '' return ''
} }
const getOrderDelayText = (createTime?: string | null) => {
if (!createTime) return '--'
const createAt = dayjs(createTime)
if (!createAt.isValid()) return '--'
const diffSeconds = Math.max(0, dayjs().diff(createAt, 'second'))
const hours = Math.floor(diffSeconds / (60 * 60))
return `${hours}h`
}
const handleConfirm = async () => { const handleConfirm = async () => {
if (!selectedItems.value.length) { if (!selectedItems.value.length) {
return ElMessage.warning('请选择操作单') return ElMessage.warning('请选择操作单')
...@@ -405,6 +423,16 @@ defineExpose({ open }) ...@@ -405,6 +423,16 @@ defineExpose({ open })
overflow: hidden; overflow: hidden;
} }
.delay-time-row {
justify-content: flex-end;
margin-top: 2px;
}
.delay-time-value {
color: red;
font-weight: 600;
}
.info-label { .info-label {
flex-shrink: 0; flex-shrink: 0;
color: #909399; color: #909399;
......
...@@ -513,7 +513,7 @@ ...@@ -513,7 +513,7 @@
</span> </span>
<span v-if="status === 'PENDING_PICK'" class="item"> <span v-if="status === 'PENDING_PICK'" class="item">
<ElButton type="warning" @click="handlePrintPickOrder" <ElButton type="warning" @click="handlePrintPickOrder"
>打印拣</ElButton >打印拣</ElButton
> >
</span> </span>
<span v-if="status === 'PENDING_PICK'" class="item"> <span v-if="status === 'PENDING_PICK'" class="item">
...@@ -1298,6 +1298,9 @@ const baseProductColumns = computed(() => [ ...@@ -1298,6 +1298,9 @@ const baseProductColumns = computed(() => [
minWidth: 100, minWidth: 100,
align: 'right', align: 'right',
showColumn: showProductInventoryColumns.value, showColumn: showProductInventoryColumns.value,
render: (row: ProductListData) => {
return <span>{row.inventory || 0}</span>
},
}, },
{ {
prop: 'occupyInventory', prop: 'occupyInventory',
...@@ -1305,6 +1308,19 @@ const baseProductColumns = computed(() => [ ...@@ -1305,6 +1308,19 @@ const baseProductColumns = computed(() => [
minWidth: 100, minWidth: 100,
align: 'right', align: 'right',
showColumn: showProductInventoryColumns.value, showColumn: showProductInventoryColumns.value,
render: (row: ProductListData) => {
return <span>{row.occupyInventory || 0}</span>
},
},
{
prop: 'freezeInventory',
label: '冻结数量',
minWidth: 100,
align: 'right',
showColumn: showProductInventoryColumns.value,
render: (row: ProductListData) => {
return <span>{row.freezeInventory || 0}</span>
},
}, },
{ {
prop: 'customsNameEnglish', prop: 'customsNameEnglish',
...@@ -1743,11 +1759,15 @@ const handlePrintProductionOrder = async () => { ...@@ -1743,11 +1759,15 @@ const handlePrintProductionOrder = async () => {
} }
} }
const handlePrintPickOrder = async () => { const handlePrintPickOrder = async () => {
await executeBatchAction({ if (!ensureSelection()) return
getIds: getSelectedIds, const ids = getSelectedIds()
api: printPickOrderApi, try {
successText: '打印拣胚单成功', const res = await printPickOrderApi(ids as number[])
}) if (res.code !== 200) return
window.open(filePath + res.message, '_blank')
} catch (e) {
console.error(e)
}
} }
const handlePickComplete = () => { const handlePickComplete = () => {
if (!ensureSelection()) return if (!ensureSelection()) return
......
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