9 changed files with 400 additions and 27 deletions
@ -0,0 +1,35 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface RecordsDetailsVO { |
||||
|
id: number |
||||
|
templateItemId: number |
||||
|
templateId: number |
||||
|
detectValue: number |
||||
|
result: string |
||||
|
saveStatus: string |
||||
|
remark: string |
||||
|
version: string |
||||
|
contents?:string |
||||
|
methods?:string |
||||
|
upLimit?:string |
||||
|
downLimit?:string |
||||
|
itemCode?:string |
||||
|
ProjectCode?:string |
||||
|
itemType?:string |
||||
|
|
||||
|
} |
||||
|
|
||||
|
// 查询不合格品检测记录列表
|
||||
|
export const getRecordsDetailsPage = async (params) => { |
||||
|
return await request.get({ url: `/detection/recordsdetails/selectUnqualifiedPage`, params }) |
||||
|
} |
||||
|
|
||||
|
// 删除检测记录详细
|
||||
|
export const deleteRecordsDetails = async (id: number) => { |
||||
|
return await request.delete({ url: `/detection/recordsdetails/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 删除检测记录详细
|
||||
|
export const batchDeleteRecordDetails = async (ids: Array<number>) => { |
||||
|
return await request.delete({ url: `/detection/recordsdetails/batchDelete?ids=` + ids}) |
||||
|
} |
@ -0,0 +1,203 @@ |
|||||
|
<template> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<ContentWrap> |
||||
|
<Search :schema="Unqualified.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Unqualified.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table |
||||
|
ref="tableid" |
||||
|
:columns="tableColumns" |
||||
|
:data="tableObject.tableList" |
||||
|
:selection="true" |
||||
|
:loading="tableObject.loading" |
||||
|
:pagination="{ |
||||
|
total: tableObject.total |
||||
|
}" |
||||
|
v-model:pageSize="tableObject.pageSize" |
||||
|
v-model:currentPage="tableObject.currentPage" |
||||
|
v-model:sort="tableObject.sort" |
||||
|
> |
||||
|
<!-- <template #templateId="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '检测记录明细', row.code)"> |
||||
|
<span>{{ row.templateId }}</span> |
||||
|
</el-button> |
||||
|
</template> --> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import {Unqualified } from './unqualified.data' |
||||
|
import * as UnqualifiedApi from '@/api/detection/unqualified' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import { any } from 'vue-types' |
||||
|
import dayjs from 'dayjs' |
||||
|
|
||||
|
defineOptions({ name: 'DetectionRecords' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Unqualified.allSchemas.tableColumns) |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 查询列表页面参数设置 |
||||
|
const searchTableParams = ref([ |
||||
|
//{ |
||||
|
// formField: 'productItemCode', |
||||
|
// searchTableTitle: '物料信息', |
||||
|
// searchTableAllSchemas: Itembasic.allSchemas, |
||||
|
// searchTablePage: ItembasicApi.getItembasicPage |
||||
|
//} |
||||
|
]) |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: UnqualifiedApi.getRecordsDetailsPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultBatchDeletionBtn(null), // 批量删除 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
// defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
const tableid=ref(); |
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
getList() |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else if(val == 'batch'){//批量删除 |
||||
|
let params = []; |
||||
|
let ids = tableid.value.selections; |
||||
|
if(ids.length > 0){ |
||||
|
for(let i = 0; i < ids.length; i++){ |
||||
|
params[i] = ids[i].id; |
||||
|
} |
||||
|
console.info(params); |
||||
|
handleBatchDelete(params); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
}else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
//defaultButtons.mainListEditBtn(null), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn(null), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
console.log("row",row) |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
||||
|
nextTick(() => { |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await UnqualifiedApi.deleteRecordsDetails(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
/*批量删除操作*/ |
||||
|
const handleBatchDelete = async (ids:any) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await UnqualifiedApi.batchDeleteRecordDetails(ids) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList(); |
||||
|
//importTemplateData.templateUrl = await RecordsApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,148 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import * as itembasicApi from '@/api/spc/itembasic/index' |
||||
|
import * as ProjectApi from '@/api/spc/project/index' |
||||
|
const itembasicList = await itembasicApi.getList({}); |
||||
|
const projectList = await ProjectApi.getList({}); |
||||
|
|
||||
|
|
||||
|
export const Unqualified = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '模版id', |
||||
|
field: 'templateId', |
||||
|
isSearch: false, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '项目编码', |
||||
|
field: 'projectCode', |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
show: true, |
||||
|
component: 'Select', |
||||
|
api: () => projectList, |
||||
|
componentProps: { |
||||
|
filterable:true, |
||||
|
optionsAlias: { |
||||
|
labelField: 'code', |
||||
|
valueField: 'code' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料编号', |
||||
|
field: 'itemCode', |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
show: true, |
||||
|
component: 'Select', |
||||
|
api: () => itembasicList, |
||||
|
componentProps: { |
||||
|
filterable:true, |
||||
|
optionsAlias: { |
||||
|
labelField: 'code', |
||||
|
valueField: 'code' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检测模版类型', |
||||
|
field: 'itemType', |
||||
|
dictType: DICT_TYPE.ITEMBASIC_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
isSearch:true, |
||||
|
search:{ |
||||
|
componentProps: { |
||||
|
filterable:true |
||||
|
|
||||
|
// inactiveValue: 'DISABLE',
|
||||
|
// activeValue: 'ENABLE',
|
||||
|
} |
||||
|
}, |
||||
|
// table: {
|
||||
|
// width: 100
|
||||
|
// } ,
|
||||
|
form: { |
||||
|
component: 'Select', |
||||
|
componentProps: { |
||||
|
filterable:true |
||||
|
|
||||
|
// inactiveValue: 'DISABLE',
|
||||
|
// activeValue: 'ENABLE',
|
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
label: '检测内容', |
||||
|
field: 'contents', |
||||
|
isSearch: true, |
||||
|
isTable:true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检测值', |
||||
|
field: 'detectValue', |
||||
|
isSearch: false, |
||||
|
isTable:true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '检测结果', |
||||
|
field: 'result', |
||||
|
isSearch: false, |
||||
|
isTable:true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '上限', |
||||
|
field: 'upLimit', |
||||
|
isSearch: false, |
||||
|
isTable:false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '下限', |
||||
|
field: 'downLimit', |
||||
|
isSearch: false, |
||||
|
isTable:false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '行号', |
||||
|
field: 'recodeLines', |
||||
|
isSearch: false, |
||||
|
isTable:true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '列号', |
||||
|
field: 'recodeColumns', |
||||
|
isSearch: false, |
||||
|
isTable:true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
formatter: dateFormatter, |
||||
|
isSearch: true, |
||||
|
search: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
type: 'daterange', |
||||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
||||
|
} |
||||
|
}, |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
Loading…
Reference in new issue