修改代码

This commit is contained in:
shaoleiliu-netizen123 2026-08-13 15:54:02 +08:00
parent 1be9e0296c
commit 06cd922bd8
2 changed files with 149 additions and 6 deletions

View File

@ -46,13 +46,26 @@
:columns="columns" :columns="columns"
:data="tableData" :data="tableData"
:loading="loading" :loading="loading"
:pagination="pagination"
:row-key="(row) => row.id" :row-key="(row) => row.id"
:scroll-x="1200" :scroll-x="1200"
/>
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
<n-pagination
v-model:page="pagination.page"
v-model:page-size="pagination.pageSize"
:item-count="pagination.itemCount"
:page-sizes="[2,10, 20, 50, 100]"
show-size-picker
show-quick-jumper
@update:page="handlePageChange" @update:page="handlePageChange"
@update:page-size="handlePageSizeChange" @update:page-size="handlePageSizeChange"
@update:checked-row-keys="handleCheck" >
/> <template #prefix>
{{ pagination.itemCount }}
</template>
</n-pagination>
</div>
</n-card> </n-card>
<!-- 新增/编辑弹窗 --> <!-- 新增/编辑弹窗 -->

View File

@ -47,14 +47,42 @@
</template> </template>
</n-pagination> </n-pagination>
</div> </div>
<!--质检详情弹窗-->
<n-modal v-model:show="showAssingWorkDetail" title="派工详情" style="width: 1000px" >
<n-card hoverable>
<template #header>
<div style="display:flex;justify-content:space-between;align-items:center;width:100%">
<span>明细列表</span>
<n-button text @click="detailIsCollapse = !detailIsCollapse">
<n-icon :component="detailIsCollapse ? ArrowDownOutline : ArrowUpOutline" />
</n-button>
</div>
</template>
<n-data-table
v-show="!detailIsCollapse"
:columns="detailColumns"
:data="detailTableData"
:row-key="(row:any) => row.id"
:scroll-x="700"
max-height="320"
:pagination="{ pageSize:4 }"
/>
</n-card>
</n-modal>
</n-card> </n-card>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { NCard, NDataTable, NGi,NTag, NGrid,DataTableColumns} from "naive-ui"; import {NCard, NDataTable, NGi, NTag, NGrid, DataTableColumns, NIcon, NButton} from "naive-ui";
import {onMounted, ref, h, reactive} from "vue"; import {onMounted, ref, h, reactive} from "vue";
import { dictDataApi } from '@/api/org' import { dictDataApi } from '@/api/org'
import {QualityTesting,qualityTestingApi} from "@/api/qualityTesting.ts"; import {QualityTesting,qualityTestingApi} from "@/api/qualityTesting.ts";
import {ArrowDownOutline, ArrowUpOutline} from "@vicons/ionicons5";
import type {QcResultDetail} from "@/api/qcResultDetail.ts";
const props =defineProps( const props =defineProps(
{ {
@ -76,7 +104,27 @@ const qcStatusOptions = ref<{ label: string; value: any;class:any }[]>([])
// //
const reportRecordsColums:DataTableColumns<QualityTesting> = [ const reportRecordsColums:DataTableColumns<QualityTesting> = [
{ title: '质检编号', key: 'qcNo',align: 'center' }, { title: '质检编号', key: 'qcNo',align: 'center',
render(row:any) {
return h(
'a',
{
class:"route-code-link",
href: 'javascript:;',
style:{
color: '#2080f0',
textDecoration: 'underline',
cursor: 'pointer',
},
onClick: (e: MouseEvent) => {
viewQualityResultDetail(row)
}
},
row.qcNo
)
}
},
{ title: '来源类型', key: 'sourceType',align: 'center', { title: '来源类型', key: 'sourceType',align: 'center',
render(row) { render(row) {
const val = row.sourceType const val = row.sourceType
@ -109,6 +157,14 @@ async function loadDictOptions() {
const data = await dictDataApi.listByType('qc_status') const data = await dictDataApi.listByType('qc_status')
qcStatusOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class: d.listClass })) qcStatusOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class: d.listClass }))
}catch {} }catch {}
try {
const data = await dictDataApi.listByType('qc_result_type')
qcResultTypeOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class: d.listClass }))
}catch {}
try {
const data = await dictDataApi.listByType('qc_action_status')
qcActionStatusOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class: d.listClass }))
}catch {}
} }
@ -134,6 +190,80 @@ function handlePageSizeChange(pageSize: number) {
loadQualityTestingList() loadQualityTestingList()
} }
const showAssingWorkDetail = ref<Boolean>(false)
const detailIsCollapse = ref(false)
const detailColumns: DataTableColumns<QcResultDetail> = [
{
title: '判定类型',
key: 'resultType',
align: 'center',
width: 80,
render: (row) => {
const val = row.resultType
const opt = qcResultTypeOptions.value.find(o => o.value === val || String(o.value) === String(val))
if (!opt) return val ?? '-'
return h(NTag, { type: opt.class, size: 'small' }, { default: () => opt.label })
}
},
{
title: '判定数量',
key: 'qty',
align: 'center',
width: 80
},
{
title: '批次号',
key: 'traceCode',
width: 80,
align: 'center',
render: (row) => {
const val = row.traceCode
return val ?? '-'
}
},
{
title: '不良代码',
key: 'defectCode',
width: 80,
align: 'center',
render: (row) => {
const val = row.defectCode
return val ?? '-'
}
},
{
title: '后续动作',
key: 'handleAction',
width: 80,
align: 'center'
},
{
title: '动作执行状态',
key: 'actionStatus',
width: 80,
align: 'center',
render: (row) => {
const val = row.actionStatus
const opt = qcActionStatusOptions.value.find(o => o.value === val || String(o.value) === String(val))
if (!opt) return val ?? '-'
return h(NTag, { type: opt.class, size: 'small' }, { default: () => opt.label })
}
}
]
const detailTableData = ref<Object[]>([])
const qcResultTypeOptions = ref<{ label: string; value: any;class:any }[]>([])
//
const qcActionStatusOptions = ref<{ label: string; value: any;class:any }[]>([])
function viewQualityResultDetail(row) {
showAssingWorkDetail.value = true
detailTableData.value = row.qcResultDetailList
}
onMounted(()=>{ onMounted(()=>{
loadDictOptions() loadDictOptions()
loadQualityTestingList() loadQualityTestingList()