diff --git a/src/api/submitLog.ts b/src/api/submitLog.ts index 74bdf87..2bfbcf7 100644 --- a/src/api/submitLog.ts +++ b/src/api/submitLog.ts @@ -71,5 +71,11 @@ export const submitLogApi = { //汇报统计 statistics(params?: {time?:string; type?:string}){ return request({url:'/mes/report/statistics',method:'get',params}) + }, + + + //按派工单id查询汇报 + getByDispatch(dispatchId:number){ + return request({url:`/mes/report/bydispatch/${dispatchId}`,method:"get"}) } } diff --git a/src/views/biz/submitLog/index.vue b/src/views/biz/submitLog/index.vue index d9049dd..e69142b 100644 --- a/src/views/biz/submitLog/index.vue +++ b/src/views/biz/submitLog/index.vue @@ -243,6 +243,21 @@ const formRules = { // 表格列 const columns: DataTableColumns = [ { type: 'selection' }, + { title: '物料名称', key: 'materialName',align: 'center', + render(rowData, rowIndex) { + return rowData.materialName? rowData.materialName: '-' + }, + }, + { title: '物料编码', key: 'materialCode',align: 'center', + render(rowData, rowIndex) { + return rowData.materialCode? rowData.materialCode: '-' + }, + }, + { title: '物料数量', key: 'materialQty',align: 'center', + render(rowData, rowIndex) { + return rowData.materialQty? rowData.materialQty: '-' + }, + }, { title: '工序名称', key: 'processName',align: 'center' }, { title: '工序编号', key: 'processCode',align: 'center' }, { title: '派工编号', key: 'assingCode',align: 'center' }, diff --git a/src/views/production/dispatchwork/index.vue b/src/views/production/dispatchwork/index.vue index 303e8e0..3d62f2a 100644 --- a/src/views/production/dispatchwork/index.vue +++ b/src/views/production/dispatchwork/index.vue @@ -259,6 +259,76 @@ + + + + + + + + + {{ formatDisplayValue(item.key, item.value) }} + + + + +
+ 暂无质检单据数据 +
+ + + + + {{formatDisplayValue("resourceType",item.resourceType) }} + {{formatDisplayValue("status",item.qcStatus) }} + {{ item.totalQty }} + + + + + + + + + + + + + + + +
+
+ @@ -273,6 +343,7 @@ import { import { NButton, + NDropdown, NIcon, NSpace, NPagination, @@ -283,14 +354,12 @@ import { //useDialog, type FormInst, } from 'naive-ui' - -import { - SearchOutline, - RefreshOutline +import { + SearchOutline, RefreshOutline, AddOutline, TrashOutline, CreateOutline, CloudUploadOutline, DownloadOutline, + EllipsisHorizontalOutline, ArrowDownOutline, ArrowUpOutline } from '@vicons/ionicons5' - import { useUserStore } from '@/stores/user' - +import { dictDataApi } from '@/api/org' import { disworlist, editdiswor, @@ -299,6 +368,9 @@ import { //workload } from '@/api/production' +import { submitLogApi } from '@/api/submitLog' +import { an } from 'vue-router/dist/router-CWoNjPRp.mjs' + //const dialog = useDialog() const message = useMessage() @@ -308,6 +380,40 @@ const userStore = useUserStore() // 权限检查 const hasPermission = (permission: string) => userStore.hasPermission(permission) +//判定状态字典 +const qcResultTypeOptions = ref<{ label: string; value: any }[]>([]) +//业务来源字典 +const qcSourceTypeOptions = ref<{ label: string; value: any }[]>([]) +//质检状态字典 +const qcStatusOptions = ref<{ label: string; value: any }[]>([]) +//派工状态字典 +const qcAssingStatusOptions = ref<{ label: string; value: any }[]>([]) + +//汇报详情 + +const infoIsCollapse = ref(false) + +const reportDetailVisible = ref(false) +const reportDetailTitle = ref('') + +const mappedInfoList = ref>([]) +const qualityTestings = ref([]) + +const submitColumns = ref([ + { title: "提交人", key: "sumbitUser" }, + { title: "提交时间", key: "submitCreateTime" }, + { title: "提交数量", key: "quantity" }, + { title: "单据状态", key: "submitStatus", + render: (row) => { + const val = row.submitStatus + 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 }) + } + } +]) + // ==================== 搜索表单 ==================== const searchForm = reactive({ @@ -491,52 +597,79 @@ const columns = [ width: 200, fixed: 'right', render(row:any) { - const buttons:any = [ - - // h(NButton, { - // size: 'small', - // type:'warning', - // ghost:true, - // onClick: () => handleEdit(row) }, - // //{ default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' 暂停' ]} - // { default: () => '暂停'} - // ) - ] + return h('div',{ style: { display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'nowrap' } },[ + h(NButton, { size: 'small', quaternary: true, onClick: () => handleEdit(row) }, { + default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' 编辑'] + }), + h(NDropdown, { + trigger:'click', + options:[ + {label:"改派",key:'transfer'}, + {type: 'divider' }, // 分割线 + {label:'暂停',key:'pauseResume'}, + {type: 'divider' }, // 分割线 + {label:'查看汇报',key:'view'}, + ], + onSelect:(key:string)=>{ + switch(key) { + case "transfer": + handlreass(row) + break + case "pauseResume": + handlpause(row) + break + case "view": + handleViewReport(row.id) + break + + } + } + },{ + // 下拉触发按钮:三点图标 / 更多文字 + default: () => h(NButton, { size: 'small', quaternary: true }, { + default: () => [h(NIcon, null, { default: () => h(EllipsisHorizontalOutline) })] + }) + }) + ]) + + + // const buttons:any = [ + // ] - if(hasPermission('biz:assingWork:edit')){ - buttons.push(h(NButton, { - size: 'small', - type:'primary', - ghost:true, - onClick: () => { handleEdit(row) } }, - //{ default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' 编辑' ]} - { default: () => '编辑'} - )) - } - if(hasPermission('biz:assingWork:transfer')){ - buttons.push(h(NButton, { - size: 'small', - type:'success', - ghost:true, - onClick: () => { handlreass(row) } }, - { default: () => '改派'} - )) - } - if(hasPermission('biz:assingWork:pauseResume')){ - buttons.push(h(NButton, { - size: 'small', - type:'warning', - ghost:true, - onClick:()=>{ handlpause(row) } - }, - { default: () => '暂停'} - )) - } + // if(hasPermission('biz:assingWork:edit')){ + // buttons.push(h(NButton, { + // size: 'small', + // type:'primary', + // ghost:true, + // onClick: () => { handleEdit(row) } }, + // //{ default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' 编辑' ]} + // { default: () => '编辑'} + // )) + // } + // if(hasPermission('biz:assingWork:transfer')){ + // buttons.push(h(NButton, { + // size: 'small', + // type:'success', + // ghost:true, + // onClick: () => { handlreass(row) } }, + // { default: () => '改派'} + // )) + // } + // if(hasPermission('biz:assingWork:pauseResume')){ + // buttons.push(h(NButton, { + // size: 'small', + // type:'warning', + // ghost:true, + // onClick:()=>{ handlpause(row) } + // }, + // { default: () => '暂停'} + // )) + // } // buttons.push( // ) - return buttons.length > 0 ? h(NSpace, {justify:'center'}, { default: () => buttons }) : '-' + // return buttons.length > 0 ? h(NSpace, {justify:'center'}, { default: () => buttons }) : '-' } } ] @@ -747,23 +880,80 @@ function pauseSubmit() { }) } -// function zantqy(row:any) { -// dialog.warning({ -// title: '温馨提示', -// content: `确定要暂停"${row.processName}"吗?`, -// positiveText: '确定', -// negativeText: '取消', -// onPositiveClick: () => { -// pauseresume({}).then(() => { -// message.success('操作成功!') -// getlist() -// }) -// } -// }) -// } +async function handleViewReport(id:number) { + reportDetailTitle.value='汇报详情' + reportDetailVisible.value = true + + const res = await submitLogApi.getByDispatch(id); + + mappedInfoList.value = [ + {key:"materialCode",label:"物料编码",value:res.materialCode}, + {key:"materialName",label:"物料名称",value:res.materialName}, + {key:"materialQty",label:"物料数量",value:res.materialQty}, + {key:"processCode",label:"工序编号",value:res.processCode}, + {key:"processName",label:"工序名称",value:res.processName}, + {key:"processQty",label:"生产总数",value:res.processQty}, + {key:"assingCode",label:"派工编号",value:res.assingCode}, + {key:"workerName",label:"派工人",value:res.workerName}, + {key:"assingQty",label:"派工数量",value:res.assingQty} + ] + qualityTestings.value = res.qualityTestings + + +} + + +function formatDisplayValue(key: string, value: any): string { + if (value === null || value === undefined) return '-' + + // 根据字段类型格式化 + switch (key) { + case 'resourceType': { + const sourceOpt = qcSourceTypeOptions.value.find(o => o.value === value || String(o.value) === String(value)) + return sourceOpt ? sourceOpt.label : String(value) + } + case 'status': { + const statusOpt = qcStatusOptions.value.find(o => o.value === value || String(o.value) === String(value)) + return statusOpt ? statusOpt.label : String(value) + } + + case 'qcNo': + return value ? new Date(value).toLocaleString('zh-CN') : '-' + case 'inspectTime': + case 'createTime': + case 'updateTime': + return value ? new Date(value).toLocaleString('zh-CN') : '-' + default: + return String(value) + } +} + + + +// 加载字典选项 +async function loadDictOptions() { + 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('source_type') + qcSourceTypeOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class:d.listClass })) + }catch {} + try { + const data = await dictDataApi.listByType('qc_status') + qcStatusOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class:d.listClass })) + }catch {} + try { + const data = await dictDataApi.listByType('assing_status') + qcAssingStatusOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class:d.listClass })) + }catch {} +} + onMounted(() => { getlist() + loadDictOptions() //workload() })