Commit 56bce0bb by zhangtw

入库

parent 4a8990bf
......@@ -71,3 +71,12 @@ export const getInboundById = (param) => {
data: param
})
}
// 归还详情
export const getPendingReturnById = (param) => {
return axios.request({
url: '/api/ac/jilinsscgsdp/keyDmInbound/getPendingReturnById',
method: 'post',
data: param
})
}
......@@ -27,10 +27,10 @@
placeholder="请选择审批状态"
class="form-input"
>
<Option :value= "0">待提交</Option>
<Option :value= "1">审核中</Option>
<Option :value= "9">审核通过</Option>
<Option :value= "-1">驳回</Option>
<Option :value='0'>待提交</Option>
<Option :value='1'>审核中</Option>
<Option :value='9'>审核通过</Option>
<Option :value='-1'>驳回</Option>
</Select>
</FormItem>
<FormItem class="form-item-actions">
......@@ -220,6 +220,7 @@ export default {
editingCellField: '',
// 审批状态映射字典
approvalStatusMap: { '0': '待提交', '1': '审核中', '9': '审核通过', '-1': '驳回' },
opTypeMap: { '1': '入库', '2': '出库' },
activeTab: 'apply',
filters: {
apply: { application_no: '', applicant_name: '', approval_status: null },
......@@ -234,8 +235,32 @@ export default {
{ title: '申请人', key: 'applicant_name', align: 'center' },
{ title: '部门', key: 'department_name', align: 'center' },
{ title: '审评用途', key: 'borrow_purpose', align: 'center' },
{ title: '起止时间', key: 'start_time', align: 'center' },
{ title: '时长', key: 'duration', align: 'center' },
{
title: '起止时间',
key: 'start_time',
align: 'center',
width: '300px',
render: (h, { row }) => {
return h('span', (this.formatDateTime(row.create_time) || row.create_time || '-') + '--' + (this.formatDateTime(row.approval_time) || row.approval_time || '-'))
}
},
{
title: '时长',
key: 'duration',
align: 'center',
render: (h, { row }) => {
const createTime = Number(row.create_time) || 0
const approvalTime = Number(row.approval_time) || 0
let duration = null
if (createTime !== 0 && approvalTime !== 0) {
const diffMs = Math.abs(approvalTime - createTime)
duration = this.formatDuration(diffMs)
} else {
duration = this.formatDuration('')
}
return h('span', duration)
}
},
{
title: '状态',
key: 'approval_status',
......@@ -273,7 +298,14 @@ export default {
return h('span', this.approvalStatusMap[row.approval_status + ''] || row.approval_status || '-')
}
},
{ title: '审批完成时间', key: 'approval_complete_time', align: 'center' },
{
title: '审批完成时间',
key: 'approval_time',
align: 'center',
render: (h, { row }) => {
return h('span', this.formatDateTime(row.approval_time) || row.approval_time || '-')
}
},
{ title: '操作', slot: 'action', width: 100, align: 'center' }
],
// 模态窗口内表格列定义
......@@ -369,9 +401,23 @@ export default {
{ title: '已归还', key: 'returned_quantity' }
],
detailLogsColumns: [
{ title: '操作类型', key: 'op_type' },
{ title: '物料名称', key: 'material_name' },
{
title: '操作类型',
key: 'op_type',
render: (h, { row }) => {
return h('span', this.opTypeMap[row.op_type] || row.op_type || '-')
}
},
{ title: '数量', key: 'quantity' },
{ title: '时间', key: 'create_time' },
{
title: '时间',
key: 'create_time',
width: '150px',
render: (h, { row }) => {
return h('span', this.formatDateTime(row.create_time) || row.create_time || '-')
}
},
{ title: '操作人', key: 'create_by' }
],
// 选择器控制与已选明细
......@@ -392,6 +438,28 @@ export default {
const day = String(today.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
},
// 格式化毫秒差值为易读的时长
formatDuration (diffMs) {
// 无有效差值时返回兜底值
if (diffMs <= 0) return '--'
// 时间单位换算(毫秒)
const oneSecond = 1000
const oneMinute = oneSecond * 60
const oneHour = oneMinute * 60
const oneDay = oneHour * 24
// 计算各单位的数值
const days = Math.floor(diffMs / oneDay)
const hours = Math.floor((diffMs % oneDay) / oneHour)
const minutes = Math.floor((diffMs % oneHour) / oneMinute)
const seconds = Math.floor((diffMs % oneMinute) / oneSecond)
// 拼接时长字符串(按需显示非零单位,避免冗余)
let duration = ''
if (days > 0) duration += `${days}天`
if (hours > 0 || duration) duration += `${hours}时`
if (minutes > 0 || duration) duration += `${minutes}分`
duration += `${seconds}秒`
return duration
},
// 处理单元格点击编辑
handleCellEdit (row, column, index, field) {
if (field === 'apply_quantity') {
......@@ -415,6 +483,26 @@ export default {
const d = new Date(Number(timestamp))
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`
},
// 转换时间戳为yyyy-MM-dd hh-mm-ss
formatDateTime (timestamp) {
// 空值/非数字处理:返回空字符串
if (!timestamp || isNaN(Number(timestamp))) return ''
const d = new Date(Number(timestamp))
// 年
const year = d.getFullYear()
// 月(补0)
const month = String(d.getMonth() + 1).padStart(2, '0')
// 日(补0)
const day = String(d.getDate()).padStart(2, '0')
// 时(24小时制,补0)
const hour = String(d.getHours()).padStart(2, '0')
// 分(补0)
const minute = String(d.getMinutes()).padStart(2, '0')
// 秒(补0)
const second = String(d.getSeconds()).padStart(2, '0')
// 拼接为 yyyy-MM-dd HH:mm:ss
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
},
handleTabChange (name) {
this.activeTab = name
if (name === 'pending') this.fetchList('pending')
......@@ -495,6 +583,7 @@ export default {
exist.apply_quantity = Number(exist.apply_quantity || 0) + 1
} else {
this.applyModal.details.push({
material_id: sel.id,
material_code: sel.material_code,
material_name: sel.material_name,
apply_quantity: 1,
......
......@@ -103,7 +103,7 @@ export default {
visible: false,
saving: false,
form: {}
},
}
// leader / office state 已移除
}
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论