添砖-JAVA\Administrator
8 months ago
7 changed files with 1296 additions and 0 deletions
@ -0,0 +1,65 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface InspectionJobDetailVO { |
|||
number: string |
|||
applicationDate: localdate |
|||
applicationTime: Date |
|||
requestStartTime: Date |
|||
requestEndTime: Date |
|||
finishTime: Date |
|||
supplierCode: string |
|||
materialCode: string |
|||
batch: string |
|||
requestInspectionNum: number |
|||
referenceOrderCode: string |
|||
referenceOrderRow: number |
|||
referenceCertificateCode: string |
|||
referenceCertificateRow: number |
|||
inspectionSchemeCode: string |
|||
inspectionStageCode: string |
|||
applicationPackageCode: string |
|||
inspectionLevel: string |
|||
aqlValue: number |
|||
available: string |
|||
} |
|||
|
|||
// 查询检验申请列表
|
|||
export const getInspectionJobDetailPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/inspection/inspection-job-detail/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/inspection/inspection-job-detail/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询检验申请详情
|
|||
export const getInspectionJobDetail = async (id: number) => { |
|||
return await request.get({ url: `/inspection/inspection-job-detail/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增检验申请
|
|||
export const createInspectionJobDetail = async (data: InspectionJobDetailVO) => { |
|||
return await request.post({ url: `/inspection/inspection-job-detail/create`, data }) |
|||
} |
|||
|
|||
// 修改检验申请
|
|||
export const updateInspectionJobDetail = async (data: InspectionJobDetailVO) => { |
|||
return await request.put({ url: `/inspection/inspection-job-detail/update`, data }) |
|||
} |
|||
|
|||
// 删除检验申请
|
|||
export const deleteInspectionJobDetail = async (id: number) => { |
|||
return await request.delete({ url: `/inspection/inspection-job-detail/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出检验申请 Excel
|
|||
export const exportInspectionJobDetail = async (params) => { |
|||
return await request.download({ url: `/inspection/inspection-job-detail/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/inspection/inspection-job-detail/get-import-template' }) |
|||
} |
@ -0,0 +1,65 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface InspectionJobMainVO { |
|||
number: string |
|||
applicationDate: localdate |
|||
applicationTime: Date |
|||
requestStartTime: Date |
|||
requestEndTime: Date |
|||
finishTime: Date |
|||
supplierCode: string |
|||
materialCode: string |
|||
batch: string |
|||
requestInspectionNum: number |
|||
referenceOrderCode: string |
|||
referenceOrderRow: number |
|||
referenceCertificateCode: string |
|||
referenceCertificateRow: number |
|||
inspectionSchemeCode: string |
|||
inspectionStageCode: string |
|||
applicationPackageCode: string |
|||
inspectionLevel: string |
|||
aqlValue: number |
|||
available: string |
|||
} |
|||
|
|||
// 查询检验申请列表
|
|||
export const getInspectionJobMainPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/inspection/inspection-job-main/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/inspection/inspection-job-main/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询检验申请详情
|
|||
export const getInspectionJobMain = async (id: number) => { |
|||
return await request.get({ url: `/inspection/inspection-job-main/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增检验申请
|
|||
export const createInspectionJobMain = async (data: InspectionJobMainVO) => { |
|||
return await request.post({ url: `/inspection/inspection-job-main/create`, data }) |
|||
} |
|||
|
|||
// 修改检验申请
|
|||
export const updateInspectionJobMain = async (data: InspectionJobMainVO) => { |
|||
return await request.put({ url: `/inspection/inspection-job-main/update`, data }) |
|||
} |
|||
|
|||
// 删除检验申请
|
|||
export const deleteInspectionJobMain = async (id: number) => { |
|||
return await request.delete({ url: `/inspection/inspection-job-main/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出检验申请 Excel
|
|||
export const exportInspectionJobMain = async (params) => { |
|||
return await request.download({ url: `/inspection/inspection-job-main/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/inspection/inspection-job-main/get-import-template' }) |
|||
} |
@ -0,0 +1,65 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface InspectionMainVO { |
|||
number: string |
|||
applicationDate: localdate |
|||
applicationTime: Date |
|||
requestStartTime: Date |
|||
requestEndTime: Date |
|||
finishTime: Date |
|||
supplierCode: string |
|||
materialCode: string |
|||
batch: string |
|||
requestInspectionNum: number |
|||
referenceOrderCode: string |
|||
referenceOrderRow: number |
|||
referenceCertificateCode: string |
|||
referenceCertificateRow: number |
|||
inspectionSchemeCode: string |
|||
inspectionStageCode: string |
|||
applicationPackageCode: string |
|||
inspectionLevel: string |
|||
aqlValue: number |
|||
available: string |
|||
} |
|||
|
|||
// 查询检验申请列表
|
|||
export const getInspectionMainPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/inspection/inspection-main/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/inspection/inspection-main/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询检验申请详情
|
|||
export const getInspectionMain = async (id: number) => { |
|||
return await request.get({ url: `/inspection/inspection-main/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增检验申请
|
|||
export const createInspectionMain = async (data: InspectionMainVO) => { |
|||
return await request.post({ url: `/inspection/inspection-main/create`, data }) |
|||
} |
|||
|
|||
// 修改检验申请
|
|||
export const updateInspectionMain = async (data: InspectionMainVO) => { |
|||
return await request.put({ url: `/inspection/inspection-main/update`, data }) |
|||
} |
|||
|
|||
// 删除检验申请
|
|||
export const deleteInspectionMain = async (id: number) => { |
|||
return await request.delete({ url: `/inspection/inspection-main/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出检验申请 Excel
|
|||
export const exportInspectionMain = async (params) => { |
|||
return await request.download({ url: `/inspection/inspection-main/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/inspection/inspection-main/get-import-template' }) |
|||
} |
@ -0,0 +1,289 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="InspectionJobMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" |
|||
:allSchemas="InspectionJobMain.allSchemas" /> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{ |
|||
total: tableObject.total |
|||
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort"> |
|||
<template #number="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> |
|||
<span>{{ row.number }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm ref="formRef" @success="getList" :rules="InspectionJobMainRules" |
|||
:formAllSchemas="InspectionJobMain.allSchemas" :tableAllSchemas="InspectionJobDetail.allSchemas" |
|||
:tableFormRules="InspectionJobDetailRules" :tableData="tableData" |
|||
:apiUpdate="InspectionJobMainApi.updateInspectionJobMain" :apiCreate="InspectionJobMainApi.createInspectionJobMain" |
|||
:isBusiness="true" @handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable" |
|||
@searchTableSuccess="searchTableSuccess" @submitForm="submitForm" /> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="false" :allSchemas="InspectionJobMain.allSchemas" |
|||
:detailAllSchemas="InspectionJobDetail.allSchemas" :detailAllSchemasRules="InspectionJobDetailRules" |
|||
:apiCreate="InspectionJobDetailApi.createInspectionJobDetail" |
|||
:apiUpdate="InspectionJobDetailApi.updateInspectionJobDetail" |
|||
:apiPage="InspectionJobDetailApi.getInspectionJobDetailPage" |
|||
:apiDelete="InspectionJobDetailApi.deleteInspectionJobDetail" @searchTableSuccessDetail="searchTableSuccessDetail" |
|||
:isShowAddBtn="false" :detailButtonIsShow="true" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/wms/purchase-main/import" :importTemplateData="importTemplateData" |
|||
@success="importSuccess" :isShowOut="true" :updateIsDisable="true" :coverIsDisable="true" :mode="2" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { InspectionJobMain, InspectionJobMainRules, InspectionJobDetail, InspectionJobDetailRules } from './inspectionJobMain.data' |
|||
import * as InspectionJobMainApi from '@/api/qms/inspectionJob/inspectionJobMain' |
|||
import * as InspectionJobDetailApi from '@/api/qms/inspectionJob/inspectionJobDetail' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
|
|||
// 采购订单 |
|||
defineOptions({ name: 'InspectionJobMain' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(InspectionJobMain.allSchemas.tableColumns) |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|||
nextTick(async () => { |
|||
if (type == 'tableForm') { |
|||
// 明细查询页赋值 |
|||
row[formField] = val[0][searchField] |
|||
row['itemNumber'] = val[0]['number'] |
|||
row['itemName'] = val[0]['name'] |
|||
row['uom'] = val[0]['uom'] |
|||
row['isRadeIn'] = val[0]['isRadeIn'] |
|||
row['available'] = val[0]['available'] |
|||
} else { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
} |
|||
}) |
|||
} |
|||
// 查询页面返回——详情 |
|||
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|||
nextTick(async () => { |
|||
const setV = {} |
|||
// if(formField == 'itemCode'){ |
|||
// await ItembasicApi.getItembasicPage({ |
|||
// code: setV['itemCode'] |
|||
// }).then(res => { |
|||
// setV['uom'] = res.list[0].uom |
|||
// setV[formField] = val[0][searchField] |
|||
// }) |
|||
// } |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 子表新增的时候选择表格之后需要会显得字段 |
|||
const Echo = [] |
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: InspectionJobMainApi.getInspectionJobMainPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn(null), // 新增 |
|||
// defaultButtons.defaultExportBtn(null), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
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 { // 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
|
|||
// 根据状态返回该按钮是否显示 |
|||
const isShowMainButton = (row, val) => { |
|||
if (val.indexOf(row.status) > -1) { |
|||
return false |
|||
} else { |
|||
return true |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = (row) => { |
|||
return [ |
|||
// defaultButtons.mainListOrderCOMPLETEBtn({ hide: isShowMainButton(row, ['INCOMPLETE']) }), // 完成 |
|||
// defaultButtons.mainListEditBtn(null), // 编辑 |
|||
// defaultButtons.mainListDeleteBtn(null), // 删除 |
|||
] |
|||
} |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} |
|||
else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const formRef = ref() |
|||
const openForm = async (type : string, row ?: number) => { |
|||
tableData.value = [] // 重置明细数据 |
|||
formRef.value.open(type, row) |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row : any, titleName : any, titleValue : any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicInspectionJobMain') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id : number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await InspectionJobMainApi.deleteInspectionJobMain(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch { } |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await InspectionJobMainApi.exportInspectionJobMain(tableObject.params) |
|||
download.excel(data, '备件申领记录主.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* tableForm方法 |
|||
*/ |
|||
const tableFormKeys = {} |
|||
InspectionJobDetail.allSchemas.tableFormColumns.forEach(item => { |
|||
tableFormKeys[item.field] = item.default ? item.default : '' |
|||
}) |
|||
const tableData = ref([]) |
|||
|
|||
// 添加明细 |
|||
const handleAddTable = () => { |
|||
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) |
|||
} |
|||
// 删除明细 |
|||
const handleDeleteTable = (item, index) => { |
|||
tableData.value.splice(index, 1) |
|||
} |
|||
|
|||
// 主子数据 提交 |
|||
const submitForm = async (formType, data) => { |
|||
data.subList = tableData.value // 拼接子表数据参数 |
|||
try { |
|||
if (formType === 'create') { |
|||
await InspectionJobMainApi.createInspectionJobMain(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await InspectionJobMainApi.updateInspectionJobMain(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
formRef.value.dialogVisible = false |
|||
// 刷新当前列表 |
|||
getList() |
|||
} finally { |
|||
formRef.value.formLoading = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
|
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '采购订单主导入模版.xlsx' |
|||
}) |
|||
|
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await InspectionJobMainApi.importTemplate() |
|||
}) |
|||
</script> |
@ -0,0 +1,329 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter2 } from '@/utils/formatTime' |
|||
import { validateHanset, validateEmail } from '@/utils/validator' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
const { t } = useI18n() // 国际化
|
|||
|
|||
/** |
|||
* @returns {Array} 备件申请主表 |
|||
*/ |
|||
export const InspectionJobMain = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '编码', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '申请编码', |
|||
field: 'inspectionCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '供应商编码', |
|||
field: 'supplierCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '物料编码', |
|||
field: 'materialCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '物料批次', |
|||
field: 'materialBatch', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '订单号', |
|||
field: 'orderCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '订单行', |
|||
field: 'orderRow', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '凭证号', |
|||
field: 'certificateCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '凭证行', |
|||
field: 'certificateRow', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '检验方案编码', |
|||
field: 'inspectionSchemeCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '检验方案Json', |
|||
field: 'inspectionSchemeJson', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '检验批次', |
|||
field: 'inspectionBatch', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '检验批数量', |
|||
field: 'inspectionBatchAmount', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '采样总数量', |
|||
field: 'sampleTatalAmount', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '检验类型', |
|||
field: 'inspectionType', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'SelectV2' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '检验批来源', |
|||
field: 'inspectionBatchSource', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '检验阶段', |
|||
field: 'inspectionStage', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '检验严格性', |
|||
field: 'inspectionStringency', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '检验任务包装列表', |
|||
field: 'inspectionTaskPackageCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '检验任务工序列表', |
|||
field: 'inspectionTaskProcessCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '计划开始时间', |
|||
field: 'planStartTime', |
|||
sort: 'custom', |
|||
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')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '计划结束时间', |
|||
field: 'planEndTime', |
|||
sort: 'custom', |
|||
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')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '检验水平', |
|||
field: 'inspectionLevel', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: 'AQL值', |
|||
field: 'aqlValue', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isDetail: false, |
|||
isForm: false, |
|||
table: { |
|||
width: 200, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
|||
|
|||
//表单校验
|
|||
export const InspectionJobMainRules = reactive({ |
|||
number: [required], |
|||
inspectionCode: [required], |
|||
supplierCode: [required], |
|||
materialCode: [required], |
|||
materialBatch: [required], |
|||
orderCode: [required], |
|||
certificateRow: [required], |
|||
inspectionSchemeCode: [required], |
|||
inspectionSchemeJson: [required], |
|||
inspectionBatch: [required], |
|||
inspectionBatchAmount: [required], |
|||
sampleTatalAmount: [required], |
|||
inspectionType: [required], |
|||
inspectionBatchSource: [required], |
|||
inspectionStage: [required], |
|||
inspectionStringency: [required], |
|||
inspectionLevel: [required], |
|||
available: [required], |
|||
}) |
|||
|
|||
/** |
|||
* @returns {Array} 备件申请子表 |
|||
*/ |
|||
export const InspectionJobDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isTable: false, |
|||
isSearch: true, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '单据号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '主表ID', |
|||
field: 'masterId', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '任务编码', |
|||
field: 'taskCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '工序编码', |
|||
field: 'processCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '工序描述', |
|||
field: 'processDescribe', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '顺序号', |
|||
field: 'sequenceCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '检验特性编号', |
|||
field: 'inspectionFeatureCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isDetail: false, |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
}, |
|||
isTableForm: false, |
|||
} |
|||
])) |
|||
|
|||
//表单校验
|
|||
export const InspectionJobDetailRules = reactive({ |
|||
taskCode: [required], |
|||
processCode: [required], |
|||
sequenceCode: [required], |
|||
available: [required], |
|||
}) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="InspectionMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="InspectionMain.allSchemas" |
|||
/> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table |
|||
:columns="tableColumns" |
|||
:data="tableObject.tableList" |
|||
:loading="tableObject.loading" |
|||
:pagination="{ |
|||
total: tableObject.total |
|||
}" |
|||
v-model:pageSize="tableObject.pageSize" |
|||
v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort" |
|||
> |
|||
<template #code="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|||
<span>{{ row.code }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="InspectionMainRules" |
|||
:formAllSchemas="InspectionMain.allSchemas" |
|||
:apiUpdate="InspectionMainApi.updateInspectionMain" |
|||
:apiCreate="InspectionMainApi.createInspectionMain" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="InspectionMain.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/request/inspection-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { InspectionMain,InspectionMainRules } from './inspectionMain.data' |
|||
import * as InspectionMainApi from '@/api/qms/inspectionRequest' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'InspectionMain' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(InspectionMain.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: InspectionMainApi.getInspectionMainPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'wms:inspectionMain:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'wms:inspectionMain:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'wms:inspectionMain:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
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 { // 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'wms:inspectionMain:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'wms:inspectionMain:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, 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) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =InspectionMain.allSchemas.formSchema.some(function (item) { |
|||
return item.field === 'activeTime' || item.field === 'expireTime'; |
|||
}); |
|||
if(isHave){ |
|||
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|||
message.error('失效时间要大于生效时间') |
|||
return; |
|||
} |
|||
} |
|||
if(data.activeTime==0)data.activeTime = null; |
|||
if(data.expireTime==0)data.expireTime = null; |
|||
if (formType === 'create') { |
|||
await InspectionMainApi.createInspectionMain(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await InspectionMainApi.updateInspectionMain(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicInspectionMain') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await InspectionMainApi.deleteInspectionMain(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await InspectionMainApi.exportInspectionMain(tableObject.params) |
|||
download.excel(data, '检验申请.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '检验申请导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await InspectionMainApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,239 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const InspectionMainRules = reactive({ |
|||
number: [required], |
|||
applicationDate: [required], |
|||
applicationTime: [required], |
|||
supplierCode: [required], |
|||
materialCode: [required], |
|||
batch: [required], |
|||
referenceOrderCode: [required], |
|||
referenceOrderRow: [required], |
|||
inspectionSchemeCode: [required], |
|||
inspectionStageCode: [required], |
|||
inspectionLevel: [required], |
|||
available: [required], |
|||
}) |
|||
|
|||
export const InspectionMain = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
|
|||
{ |
|||
label: '编码', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '申请日期', |
|||
field: 'applicationDate', |
|||
sort: 'custom', |
|||
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')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '申请时间', |
|||
field: 'applicationTime', |
|||
sort: 'custom', |
|||
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')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '要求开始时间', |
|||
field: 'requestStartTime', |
|||
sort: 'custom', |
|||
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')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '要求结束时间', |
|||
field: 'requestEndTime', |
|||
sort: 'custom', |
|||
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')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '完成时间', |
|||
field: 'finishTime', |
|||
sort: 'custom', |
|||
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')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '供应商编码', |
|||
field: 'supplierCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '物料编码', |
|||
field: 'materialCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '批次', |
|||
field: 'batch', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '待检数量', |
|||
field: 'requestInspectionNum', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '参考订单号', |
|||
field: 'referenceOrderCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '参考订单行', |
|||
field: 'referenceOrderRow', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '参考凭证号', |
|||
field: 'referenceCertificateCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '参考凭证行', |
|||
field: 'referenceCertificateRow', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '检验方案编码', |
|||
field: 'inspectionSchemeCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '检验阶段', |
|||
field: 'inspectionStageCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '检验申请包装列表', |
|||
field: 'applicationPackageCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '检验水平', |
|||
field: 'inspectionLevel', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: 'AQL值', |
|||
field: 'aqlValue', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
Loading…
Reference in new issue