feat: 新增多类功能并优化现有流程
1. 工序工位支持0号上线位,更新解析逻辑与注释 2. 物料清单模块重命名为产品物料清单并优化文案 3. WMS与工位端新增用户/角色详情抽屉组件 4. 工单模块新增自动生成工单号、工位分组选择器 5. 日排产支持批量生成与详情查看 6. 工单列表重构操作菜单与表单优化
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<el-drawer v-model="vis" :title="title" :size="size" destroy-on-close append-to-body>
|
||||
<el-descriptions v-if="data" :column="column" border size="small">
|
||||
<el-descriptions-item v-for="f in fields" :key="f.key" :label="f.label">
|
||||
<slot v-if="f.slot" :name="f.slot" :row="data" />
|
||||
<template v-else>{{ fmt(f, data) }}</template>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-empty v-else description="暂无数据" />
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
visible: { type: Boolean, default: false },
|
||||
title: { type: String, default: '详情' },
|
||||
fields: { type: Array, default: () => [] },
|
||||
data: { type: Object, default: null },
|
||||
size: { type: String, default: '480px' },
|
||||
column: { type: Number, default: 1 }
|
||||
})
|
||||
const emit = defineEmits(['update:visible'])
|
||||
const vis = computed({
|
||||
get: () => props.visible,
|
||||
set: (v) => emit('update:visible', v)
|
||||
})
|
||||
|
||||
function fmtTime(v) {
|
||||
if (v === null || v === undefined || v === '') return '-'
|
||||
let n = typeof v === 'string' ? Number(v) : v
|
||||
if (isNaN(n)) return v
|
||||
if (n > 1e12) n = Math.floor(n / 1000)
|
||||
if (n <= 0) return '-'
|
||||
const d = new Date(n * 1000)
|
||||
const p = (x) => String(x).padStart(2, '0')
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`
|
||||
}
|
||||
|
||||
function fmt(f, data) {
|
||||
if (!data) return '-'
|
||||
const v = data[f.key]
|
||||
if (f.format && typeof f.format === 'function') {
|
||||
const r = f.format(v, data)
|
||||
return r === null || r === undefined || r === '' ? '-' : r
|
||||
}
|
||||
let out = v
|
||||
if (f.type === 'time') out = fmtTime(v)
|
||||
else if (f.type === 'bool') out = v ? '是' : '否'
|
||||
else if (f.type === 'enum' && f.map) out = (f.map[v] ?? v)
|
||||
if (out === null || out === undefined || out === '') return '-'
|
||||
return out
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user