feat(web-admin): add production waste-output read-only list page.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-08-18 11:32:39 +08:00
1 parent c78d02a348
commit f42f78f134
1 file changed
+237
@@ -0,0 +1,237 @@
<!-- 生产废弃物列表 -->
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">废弃物列表</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input v-model="searchForm.keyword" placeholder="产出名称/条码" clearable />
</el-form-item>
<el-form-item label="登记时间">
<el-date-picker
v-model="createTimeRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</div>
<div class="filter-actions-row">
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset">
<el-icon><RefreshLeft /></el-icon>重置
</el-button>
<el-button class="btn-main" type="primary" @click="handleSearch">
<el-icon><Search /></el-icon>搜索
</el-button>
</div>
</div>
</el-form>
</div>
<div class="list-body list-wrap">
<el-table class="list-table" :data="tableData" v-loading="loading" stripe row-key="id">
<el-table-column
prop="outputName"
label="产出名称"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ displayCell(row.outputName) }}</template>
</el-table-column>
<el-table-column
prop="outputBarcode"
label="条码"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ displayCell(row.outputBarcode) }}</template>
</el-table-column>
<el-table-column
prop="processName"
label="工序/步骤"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ displayCell(row.processName) }}</template>
</el-table-column>
<el-table-column
prop="taskNo"
label="任务号"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ displayCell(row.taskNo) }}</template>
</el-table-column>
<el-table-column
prop="workOrderNo"
label="工单号"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ displayCell(row.workOrderNo) }}</template>
</el-table-column>
<el-table-column
prop="sampleCode"
label="样本编码"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ displayCell(row.sampleCode) }}</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ displayCell(row.remark) }}</template>
</el-table-column>
<el-table-column
prop="createTime"
label="登记时间"
min-width="170"
align="center"
header-align="center"
>
<template #default="{ row }">{{ displayCell(row.createTime) }}</template>
</el-table-column>
<el-table-column
label="操作"
min-width="120"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<div style="display: flex; justify-content: center; gap: 8px">
<el-button class="btn-op-item" :disabled="!hasTaskId(row)" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
</div>
</template>
</el-table-column>
<template #empty>
<el-empty description="暂无废弃物登记" />
</template>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
:current-page="pagination.page"
:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="(val) => ((pagination.page = 1), (pagination.pageSize = val), loadData())"
@current-change="(val) => ((pagination.page = val), loadData())"
/>
</div>
</div>
<TaskExecutionDialog
v-model:visible="executionDialogVisible"
:task-id="executionTaskId"
:task-name="executionTaskName"
:readonly="true"
append-to-body
/>
</section>
</div>
</template>
<script setup lang="ts">
import { RefreshLeft, Search, View } from '@element-plus/icons-vue'
import {
fetchProductionWasteOutputList,
type ProductionWasteOutputItem
} from '@/api/production-waste-output'
import { formatDisplayOrDash } from '@/utils/datetime-display'
import TaskExecutionDialog from '../production-work-order/TaskExecutionDialog.vue'
defineOptions({ name: 'ProductionWasteOutput' })
const searchForm = reactive({ keyword: '' })
const createTimeRange = ref<[string, string] | null>(null)
const tableData = ref<ProductionWasteOutputItem[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const executionDialogVisible = ref(false)
const executionTaskId = ref('')
const executionTaskName = ref('')
function displayCell(value: unknown) {
return formatDisplayOrDash(value)
}
function hasTaskId(row: ProductionWasteOutputItem) {
return Boolean(String(row.taskId || '').trim())
}
async function loadData() {
loading.value = true
try {
const res = await fetchProductionWasteOutputList({
page: pagination.page,
pageSize: pagination.pageSize,
keyword: searchForm.keyword.trim() || undefined,
createTimeStart: createTimeRange.value?.[0] || undefined,
createTimeEnd: createTimeRange.value?.[1] || undefined
})
tableData.value = res.list || []
pagination.total = res.total ?? 0
} finally {
loading.value = false
}
}
function handleSearch() {
pagination.page = 1
loadData()
}
function handleReset() {
searchForm.keyword = ''
createTimeRange.value = null
pagination.page = 1
loadData()
}
function handleView(row: ProductionWasteOutputItem) {
const taskId = String(row.taskId || '').trim()
if (!taskId) {
ElMessage.warning('关联任务不可用')
return
}
executionTaskId.value = taskId
executionTaskName.value = String(row.taskNo || row.processName || row.outputName || '').trim()
executionDialogVisible.value = true
}
onMounted(() => {
loadData()
})
</script>