Browse Source

检验模块添加

master_hella_20240701
parent
commit
ac8ccd6cc4
  1. 65
      src/api/qms/inspectionJob/inspectionJobDetail/index.ts
  2. 65
      src/api/qms/inspectionJob/inspectionJobMain/index.ts
  3. 65
      src/api/qms/inspectionRequest/index.ts
  4. 289
      src/views/qms/inspection/inspectionJob/index.vue
  5. 329
      src/views/qms/inspection/inspectionJob/inspectionJobMain.data.ts
  6. 244
      src/views/qms/inspection/inspectionRequest/index.vue
  7. 239
      src/views/qms/inspection/inspectionRequest/inspectionMain.data.ts

65
src/api/qms/inspectionJob/inspectionJobDetail/index.ts

@ -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' })
}

65
src/api/qms/inspectionJob/inspectionJobMain/index.ts

@ -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' })
}

65
src/api/qms/inspectionRequest/index.ts

@ -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' })
}

289
src/views/qms/inspection/inspectionJob/index.vue

@ -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>

329
src/views/qms/inspection/inspectionJob/inspectionJobMain.data.ts

@ -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],
})

244
src/views/qms/inspection/inspectionRequest/index.vue

@ -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>

239
src/views/qms/inspection/inspectionRequest/inspectionMain.data.ts

@ -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…
Cancel
Save