Browse Source

首件检验记录

hella_online_20240829
zhang_li 4 months ago
parent
commit
fdb8e3085e
  1. 29
      src/views/qms/inspectionRecord/index.vue
  2. 90
      src/views/qms/inspectionRecordFirst/addForm.vue
  3. 390
      src/views/qms/inspectionRecordFirst/detail.vue
  4. 270
      src/views/qms/inspectionRecordFirst/index.vue
  5. 467
      src/views/qms/inspectionRecordFirst/inspectionRecordFirstMain.data.ts
  6. 312
      src/views/qms/inspectionRecordFirst/useAddForm.vue

29
src/views/qms/inspectionRecord/index.vue

@ -36,16 +36,7 @@
:formAllSchemas="InspectionRecordMain.allSchemas" :formAllSchemas="InspectionRecordMain.allSchemas"
@submitForm="submitForm" @submitForm="submitForm"
/> />
<!-- 新增 -->
<AddForm
ref="basicFormRef"
basicFormWidth="80"
:formAllSchemasFeatures="InspectionTemplateFeatures.allSchemas"
:formAllSchemasProcess="InspectionTemplateProcess.allSchemas"
:formAllSchemasMain="InspectionTemplateMain.allSchemas"
:rules="InspectionTemplateRules"
@submitForm="submitForm"
/>
<Detail <Detail
ref="detailRef" :isBasic="false" :allSchemas="InspectionRecordMain.allSchemas" ref="detailRef" :isBasic="false" :allSchemas="InspectionRecordMain.allSchemas"
@ -72,7 +63,6 @@
import ListTable from '@/components/ListTable/src/ListTable.vue' import ListTable from '@/components/ListTable/src/ListTable.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import UseAddForm from './useAddForm.vue' import UseAddForm from './useAddForm.vue'
import AddForm from './addForm.vue'
import Detail from './detail.vue' import Detail from './detail.vue'
import { InspectionTemplateMain,InspectionTemplateProcess,InspectionTemplateFeatures,InspectionTemplateRules } from '../inspectionTemplate/inspectionTemplate.data' import { InspectionTemplateMain,InspectionTemplateProcess,InspectionTemplateFeatures,InspectionTemplateRules } from '../inspectionTemplate/inspectionTemplate.data'
@ -116,26 +106,13 @@ import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
const { getList, setSearchParams } = tableMethods const { getList, setSearchParams } = tableMethods
// //
let HeadButttondata = [] let HeadButttondata = [
//
if (routeName.value == 'inspectionRecordMain') {
// [
HeadButttondata = [
// defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
]
}else if (routeName.value == 'inspectionRecordMainFirst') {
// [
HeadButttondata = [
defaultButtons.defaultAddBtn(null), //
// defaultButtons.defaultExportBtn(null), // // defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
] ]
}
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {

90
src/views/qms/inspectionRecord/addForm.vue → src/views/qms/inspectionRecordFirst/addForm.vue

@ -570,8 +570,7 @@ import { getCurrentInstance } from 'vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as InspectionJobDetailApi from '@/api/qms/inspectionJob/inspectionJobDetail' import * as InspectionJobDetailApi from '@/api/qms/inspectionJob/inspectionJobDetail'
import { SearchTable } from '@/components/SearchTable' import { SearchTable } from '@/components/SearchTable'
import * as InspectionJobMainApi from '@/api/qms/inspectionJob/inspectionJobMain' import * as InspectionRecordDetail from '@/api/qms/inspectionRecord/inspectionRecordDetail'
import * as InspectionJobPackageApi from '@/api/qms/inspectionJob/InspectionJobPackage/InspectionJobPackage'
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
@ -730,9 +729,11 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
allSamplePieceSize.value = 0 //0 allSamplePieceSize.value = 0 //0
if (row) { if (row) {
data.value = JSON.parse(JSON.stringify(row)) data.value = JSON.parse(JSON.stringify(row))
nextTick(() => { // nextTick(() => {
formMainRef.value.setValues(row) // formMainRef.value.setValues(row)
}) // })
let list = await InspectionRecordDetail.getInspectionRecordDetailList(data.value.id)
await processList( data.value,list)
} else { } else {
data.value = { data.value = {
code: '', code: '',
@ -751,6 +752,85 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
dialogVisible.value = true dialogVisible.value = true
tabIndex = data.value.subList.length + 1 tabIndex = data.value.subList.length + 1
} }
//
const processList =async (InspectionSchemeObj,list) => {
editableTabsValue.value = 1
list.forEach((item, index) => {
item.name = index + 1
item.inspectionJobCharacteristicsUpdateReqVO = item.inspectionJobCharacteristicsRespVO
item.isPass = '' //
//
allSamplePieceSize.value += parseFloat(
(
parseFloat(item.samplingProcessRespVO.sampleQty) *
parseFloat(InspectionSchemeObj.samplePieceSize)
).toFixed(6)
)
rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyCapping'][0].required = true
if (!item?.inspectionJobCharacteristicsUpdateReqVO?.recordInspectionQuantifyList) {
//
if (item?.inspectionJobCharacteristicsUpdateReqVO?.resultEntryMethod == 2) {
// rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyCapping'][0].required = true
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList = []
for (
let i = 0;
i < parseInt(item.samplingProcessRespVO.sampleQty);
i++
) {
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.push({
inspectionValue: '', //
qualitativeCode: '', //
defectLevel: '', //
qualifiedQuantity: '', //
unqualifiedQuantity: '' //
})
}
} else {
//
console.log(2333,item.inspectionJobCharacteristicsUpdateReqVO)
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList = []
rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyCapping'][0].required = false
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.push({
inspectionValue: '', //
qualitativeCode: '', //
defectLevel: '', //
qualifiedQuantity: parseFloat(
(
parseFloat(item.samplingProcessRespVO.sampleQty) *
parseFloat(InspectionSchemeObj.samplePieceSize)
).toFixed(6)
), //
unqualifiedQuantity: '0' //
})
}
}
//
if (item.inspectionJobCharacteristicsUpdateReqVO.quantifyIsCapping) {
rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyCapping'][0].required = true
} else {
rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyCapping'][0].required = false
}
if (item.inspectionJobCharacteristicsUpdateReqVO.quantifyIsLowlimit) {
rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyLowlimit'][0].required = true
} else {
rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyLowlimit'][0].required = false
}
if (item.inspectionJobCharacteristicsUpdateReqVO.quantifyIsTarget) {
rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyTarget'][0].required = true
} else {
rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyTarget'][0].required = false
}
if (item.samplingProcessRespVO.evaluationMode == 1) {
rules.value['inspectionJobCharacteristicsUpdateReqVO.estimateCode'][0].required = true
} else {
rules.value['inspectionJobCharacteristicsUpdateReqVO.estimateCode'][0].required = false
}
})
data.value.subList = list
}
defineExpose({ open, dialogVisible, formLoading }) // open defineExpose({ open, dialogVisible, formLoading }) // open
import type { TabPaneName } from 'element-plus' import type { TabPaneName } from 'element-plus'

390
src/views/qms/inspectionRecordFirst/detail.vue

@ -0,0 +1,390 @@
<template>
<div>
<el-drawer
v-model="isShowDrawer"
title="详情"
direction="rtl"
size="80%"
v-loading="detailLoading"
>
<template #header>
<div class="font-size-18px">
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span>
</div>
</template>
<ContentWrap v-if="!isBasic">
<Descriptions
:data="data"
labelClassName="label-class-name"
label-align="left"
direction="vertical"
:column="8"
:schema="allSchemas.detailSchema"
:columns="2"
width="200px"
/>
</ContentWrap>
<ContentWrap>
<el-tabs
v-model="editableTabsValue"
class="demo-tabs"
type="border-card"
tab-position="left"
:stretch="false"
>
<el-tab-pane
v-for="item in data.subList"
:key="item.name"
:label="item.processDescribe"
:name="item.name"
>
<div class="small-title">检验工序</div>
<el-form :model="item" label-width="auto" ref="formProcessRef">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="编码" prop="processCode">
<el-input v-model="item.processCode" placeholder="根据系统生成" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述" prop="processDescribe">
<el-input v-model="item.processDescribe" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="顺序号" prop="sequenceCode">
<el-input v-model="item.sequenceCode" :disabled="true" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="small-title">检验特性</div>
<el-form :model="item" label-width="auto" ref="formFeaturesRef">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="编码">
<el-input
v-model="item.inspectionRecordCharacteristicsRespVO.number"
placeholder="根据系统生成"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述" prop="inspectionRecordCharacteristicsRespVO.description">
<el-input v-model="item.inspectionRecordCharacteristicsRespVO.description" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="检验方法"
prop="inspectionRecordCharacteristicsRespVO.inspectionMethodCode"
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionRecordCharacteristicsRespVO.inspectionMethodName"
disabled
placeholder="请输入检验方法"
/>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="采样过程"
prop="inspectionRecordCharacteristicsRespVO.inspectionMethod"
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionRecordCharacteristicsRespVO.samplingProcessName"
disabled
placeholder="请输入采样过程"
/>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="采样过程编码" prop="inspectionRecordCharacteristicsRespVO.samplingProcessCode">
<div style="display: flex; width: 100%">
<el-input v-model="item.inspectionRecordCharacteristicsRespVO.samplingProcessName" disabled placeholder="请选择采样过程编码" />
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="样品份数" prop="inspectionRecordCharacteristicsRespVO.sampleQty">
<div style="display: flex; width: 100%">
<el-input v-model="item.inspectionRecordCharacteristicsRespVO.sampleQty" disabled placeholder="请输入样品份数" />
</div>
</el-form-item>
</el-col>
<!-- <el-col :span="12">
<el-form-item
label="动态修改规则编码"
prop="inspectionRecordCharacteristicsRespVO.dynamicUpdateCode"
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionRecordCharacteristicsRespVO.dynamicUpdateName"
disabled
placeholder="请输入动态修改规则编码"
/>
</div>
</el-form-item>
</el-col> -->
<el-col :span="12">
<el-form-item
label="是否允许修改特征值"
prop="inspectionRecordCharacteristicsRespVO.isCanUpdate"
>
<el-switch
v-model="item.inspectionRecordCharacteristicsRespVO.isCanUpdate"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="结果录入方式"
prop="inspectionRecordCharacteristicsRespVO.resultEntryMethod"
>
<el-select
v-model="item.inspectionRecordCharacteristicsRespVO.resultEntryMethod"
placeholder="请选择结果录入方式"
@change="resultEntryMethodChange($event,item)"
disabled
>
<el-option
v-for="dict in getStrDictOptions(
DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY
)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="特征类型" prop="inspectionRecordCharacteristicsRespVO.featureType">
<el-select
v-model="item.inspectionRecordCharacteristicsRespVO.featureType"
placeholder="请选择特征类型"
@change="changeFeatureType"
disabled
>
<el-option v-for="dict in getStrDictOptions( DICT_TYPE.INSPECTION_CHARACTERISTICS_FEATURE_TYPE )"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="开始时间" prop="inspectionRecordCharacteristicsRespVO.inspectionStartTime">
<el-date-picker
v-model="item.inspectionRecordCharacteristicsRespVO.inspectionStartTime"
type="datetime"
placeholder="请选择开始时间"
style="width: 100%"
value-format="x"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="结束时间" prop="inspectionRecordCharacteristicsRespVO.inspectionEndTime">
<el-date-picker
v-model="item.inspectionRecordCharacteristicsRespVO.inspectionEndTime"
type="datetime"
placeholder="请选择结束时间"
style="width: 100%"
value-format="x"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计量单位" prop="inspectionRecordCharacteristicsRespVO.quantifyUom" v-if="item.inspectionRecordCharacteristicsRespVO.featureType == 0" >
<el-select v-model="item.inspectionRecordCharacteristicsRespVO.quantifyUom" placeholder="请选择计量单位" disabled >
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.UOM)"
:key="dict.value"
:label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="小数位" prop="inspectionRecordCharacteristicsRespVO.quantifyDecimal" v-if="item.inspectionRecordCharacteristicsRespVO.featureType == 0" >
<el-input v-model="item.inspectionRecordCharacteristicsRespVO.quantifyDecimal" disabled/>
</el-form-item>
</el-col>
<el-col :span="12" v-if="item.inspectionRecordCharacteristicsRespVO.featureType == 0">
<el-form-item label="是否设定上限" prop="inspectionCharacteristicsBaseVO.quantifyIsCapping" >
<el-switch v-model="item.inspectionRecordCharacteristicsRespVO.quantifyIsCapping" disabled/>
</el-form-item>
</el-col>
<el-col :span="12" v-if="item.inspectionRecordCharacteristicsRespVO.featureType == 0">
<el-form-item prop="inspectionRecordCharacteristicsRespVO.quantifyIsLowlimit" label="是否设定下限" >
<el-switch v-model="item.inspectionRecordCharacteristicsRespVO.quantifyIsLowlimit" disabled/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="inspectionRecordCharacteristicsRespVO.quantifyIsTarget" label="是否设定目标值" v-if="item.inspectionRecordCharacteristicsRespVO.featureType == 0" >
<el-switch v-model="item.inspectionRecordCharacteristicsRespVO.quantifyIsTarget" disabled/>
</el-form-item>
</el-col>
<el-col :span="12" v-if="item.inspectionRecordCharacteristicsRespVO.featureType == 0 && item.inspectionRecordCharacteristicsRespVO.quantifyIsCapping">
<el-form-item label="上限值" prop="inspectionRecordCharacteristicsRespVO.quantifyCapping" >
<el-input v-model="item.inspectionRecordCharacteristicsRespVO.quantifyCapping" type="number" disabled/>
</el-form-item>
</el-col>
<el-col :span="12" v-if="item.inspectionRecordCharacteristicsRespVO.featureType == 0 && item.inspectionRecordCharacteristicsRespVO.quantifyIsLowlimit">
<el-form-item label="下限值" prop="inspectionRecordCharacteristicsRespVO.quantifyLowlimit" >
<el-input v-model="item.inspectionRecordCharacteristicsRespVO.quantifyLowlimit" type="number" disabled/>
</el-form-item>
</el-col>
<el-col :span="12" v-if="item.inspectionRecordCharacteristicsRespVO.featureType == 0 && item.inspectionRecordCharacteristicsRespVO.quantifyIsTarget">
<el-form-item label="目标值" prop="inspectionRecordCharacteristicsRespVO.quantifyTarget" >
<el-input v-model="item.inspectionRecordCharacteristicsRespVO.quantifyTarget" type="number" disabled/>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="评估代码">
<el-select v-model="item.inspectionRecordCharacteristicsRespVO.estimateCode" placeholder="请选择评估代码" disabled>
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.EVALUATION_CODE)" :key="dict.value" :label="dict.label" :value="dict.value" disabled/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" v-for="(cur, i) in item.inspectionRecordCharacteristicsRespVO.quantifyRespVOList" :key="i" style="border: 1px solid #dedede; border-radius: 4px; padding-top: 16px; margin-bottom: 10px;">
<el-row>
<!-- 汇总录入的时候显示 -->
<el-col :span="12" v-if="item.inspectionRecordCharacteristicsRespVO.resultEntryMethod == 1">
<el-form-item label="合格数量">
<el-input v-model="cur.qualifiedQuantity" placeholder="请输入合格数量" type="number" disabled/>
</el-form-item>
</el-col>
<el-col :span="12" v-if="item.inspectionRecordCharacteristicsRespVO.resultEntryMethod == 1">
<el-form-item label="不合格数量">
<el-input v-model="cur.unqualifiedQuantity" type="number" placeholder="请输入不合格数量" disabled/>
</el-form-item>
</el-col>
<el-col :span="12" v-if="item.inspectionRecordCharacteristicsRespVO.featureType == '0'">
<el-form-item label="检验值">
<el-input v-model="cur.inspectionValue" placeholder="请输入检验值" type="number" disabled/>
</el-form-item>
</el-col>
<el-col :span="12" v-if="item.inspectionRecordCharacteristicsRespVO.featureType == '1'">
<el-form-item label="选定集">
<el-input v-model="cur.number" placeholder="" type="number" disabled/>
</el-form-item>
</el-col>
<el-col :span="12" v-if="item.inspectionRecordCharacteristicsRespVO.featureType == '1'" >
<el-form-item label="缺陷级别">
<el-select v-model="cur.defectLevel" placeholder="请选择缺陷级别" disabled>
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.DEFECT_LEVEL)" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
</el-tabs>
</ContentWrap>
</el-drawer>
</div>
</template>
<script lang="ts" setup>
import * as InspectionRecordDetailPageApi from '@/api/qms/inspectionRecord/inspectionRecordDetail'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
defineOptions({ name: 'InspectionRecordDetail' })
const editableTabsValue = ref('1')
const message = useMessage() //
const { t } = useI18n() //
const updateKey = ref(0)
const props = defineProps({
//
allSchemas: {
type: Object,
required: true,
default: null
},
//
detailAllSchemas: {
type: Object,
required: true,
default: null
},
//
buttondataTable: {
type: Array,
required: false,
default: ()=>{
return []
}
},
})
const isShowDrawer = ref(false)
const detailLoading = ref(false)
const data = ref({
code: '',
itemCode: '',
version: '',
testTypeCode: '',
programmeTemplateCode: '',
splitRule: '',
aql: '',
inspectionLevel: '',
effectiveDate: '',
expirationDate: '',
available: 'TRUE',
subList: []
})
/** 打开弹窗 */
const formRef = ref()
const titleNameRef = ref()
const titleValueRef = ref()
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => {
titleNameRef.value = titleName
titleValueRef.value = titleValue
isShowDrawer.value = true
if (row) {
detailLoading.value = true
try {
data.value = row
let list = []
list = await InspectionRecordDetailPageApi.getInspectionRecordDetailList(row.id)
list.forEach((item, index) => {
editableTabsValue.value = index + 1
item.name = index + 1
})
data.value.subList = list
} finally {
detailLoading.value = false
}
}
}
defineExpose({ openDetail }) // open
</script>
<style lang="scss">
.el-drawer__body {
background: #f5f5f5 !important;
}
::v-deep(.label-class-name) {
color: #dedede;
}
</style>
<style scoped lang="scss"></style>

270
src/views/qms/inspectionRecordFirst/index.vue

@ -0,0 +1,270 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="InspectionRecordMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
:allSchemas="InspectionRecordMain.allSchemas" />
<!-- 列表 -->
<ContentWrap>
<Table v-clientTable :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>
<!-- 新增 -->
<AddForm
ref="basicFormRef"
basicFormWidth="80"
:formAllSchemasFeatures="InspectionTemplateFeatures.allSchemas"
:formAllSchemasProcess="InspectionTemplateProcess.allSchemas"
:formAllSchemasMain="InspectionTemplateMain.allSchemas"
:rules="InspectionTemplateRules"
@submitForm="submitForm"
/>
<Detail
ref="detailRef" :isBasic="false" :allSchemas="InspectionRecordMain.allSchemas"
:detailAllSchemas="InspectionRecordDetail.allSchemas" :detailAllSchemasRules="InspectionRecordDetailRules"
:apiCreate="InspectionRecordDetailApi.createInspectionRecordDetail"
:apiUpdate="InspectionRecordDetailApi.updateInspectionRecordDetail"
:apiPage="InspectionRecordDetailApi.getInspectionRecordDetailPage"
:apiDelete="InspectionRecordDetailApi.deleteInspectionRecordDetail" @searchTableSuccessDetail="searchTableSuccessDetail"
:isShowAddBtn="false" :detailButtonIsShow="true"
/>
<!-- 包装信息 --> <ListTable ref="listTableRef" titleName="包装信息" :allSchemas="InspectionRecordMain.allSchemas"
:detailAllSchemas="InspectionRecordPackage.allSchemas" :detailAllSchemasRules="InspectionRecordPackageRules"
:list="list"/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { InspectionRecordMain, InspectionRecordMainRules, InspectionRecordDetail, InspectionRecordDetailRules,InspectionRecordPackage, InspectionRecordPackageRules} from './inspectionRecordFirstMain.data'
// import { InspectionJobPackage,InspectionJobPackageRules} from '../inspectionJob/inspectionJobMain.data'
import * as InspectionRecordMainApi from '@/api/qms/inspectionRecord/inspectionRecordMain'
import * as InspectionRecordDetailApi from '@/api/qms/inspectionRecord/inspectionRecordDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import ListTable from '@/components/ListTable/src/ListTable.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import AddForm from './addForm.vue'
import Detail from './detail.vue'
import { InspectionTemplateMain,InspectionTemplateProcess,InspectionTemplateFeatures,InspectionTemplateRules } from '../inspectionTemplate/inspectionTemplate.data'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
//
defineOptions({ name: 'InspectionRecordMain' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(InspectionRecordMain.allSchemas.tableColumns)
if(routeName.value=='InspectRecordMain'){
tableColumns.value = tableColumns.value.filter(item=>{
return item.label!='操作'
})
}
//
const updataTableColumns = (val) => {
if(routeName.value=='InspectRecordMain'){
tableColumns.value = val.filter(item=>{
return item.label!='操作'
})
}else{
tableColumns.value = val
}
}
//
const { tableObject, tableMethods } = useTable({
getListApi: InspectionRecordMainApi.getInspectionRecordMainPage //
})
//
const { getList, setSearchParams } = tableMethods
//
let HeadButttondata = [
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
]
//
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(!row.callbackRequestNumber) {//callbackRequestNumber使
return true;
}
if(row.useDecision) {
return row.isPublished
} else {
return val ? true : false
}
}
// -
const butttondata = (row) => {
return [
defaultButtons.mainListEditBtn({hasPermi: 'wms:inspection-recode-first-main:update' }), //
defaultButtons.mainListDeleteBtn({hasPermi: 'wms:inspection-recode-first-main:delete' }), //
defaultButtons.mainListOrderPubBtn({ hide: isShowMainButton(row, 'publish'), hasPermi:'qms:inspection-recode-first-main:pub'}), //
]
}
const listTableRef = ref()
const list = ref([])
const useDecisionList = getStrDictOptions(DICT_TYPE.USAGE_DECISION)
// const useDecisionList = InspectionRecordMain.allSchemas.formSchema.filter(item=>item.field == "useDecision")
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
}else if (val == 'delete') { //
handleDelete(row.id)
}else if (val == 'mainOrderPub') { //
handleOrderPub(row)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = async (type : string, row ?: number) => {
tableData.value = [] //
basicFormRef.value.open(type, row)
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row : any, titleName : any, titleValue : any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicInspectionRecordMain')
}
/** 删除按钮操作 */
const handleDelete = async (id : number) => {
try {
//
await message.delConfirm()
//
await InspectionRecordMainApi.deleteInspectionRecordMain(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch { }
}
/** 发布按钮操作 */
const handleOrderPub = async (row : object) => {
try {
//
await message.confirm(t('common.confirmPublish'))
//
await InspectionRecordMainApi.publishInspectionRecordMain(row.id)
message.success(t('common.publishSuccess'))
//
await getList()
} catch { }
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await InspectionRecordMainApi.exportInspectionRecordMain(tableObject.params)
download.excel(data, '备件申领记录主.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/**
* tableForm方法
*/
const tableFormKeys = {}
InspectionRecordDetail.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
// //
const submitForm = async (formType, data) => {
// data.subList = tableData.value //
try {
if (formType === 'create') {
await InspectionRecordMainApi.createInspectionRecordMain(data)
message.success(t('common.createSuccess'))
}else {
await InspectionRecordMainApi.updateInspectionRecordMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
}
}
//
const searchFormClick = (searchData) => {
searchData.filters.push({
action: "==",
column: "firstInspectionAdded",
value: "TRUE"
})
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
tableObject.params = {
available: true,
firstInspectionAdded:'TRUE'
}
getList()
})
</script>

467
src/views/qms/inspectionRecordFirst/inspectionRecordFirstMain.data.ts

@ -0,0 +1,467 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter2 } from '@/utils/formatTime'
import { validateHanset, validateEmail } from '@/utils/validator'
import { dateFormatter } from '@/utils/formatTime'
import { validateTwoNum, validateSixNum } from '@/utils/validator'
const { t } = useI18n() // 国际化
/**
* @returns {Array}
*/
export const InspectionRecordMain = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '记录编码',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
table: {
width: 200,
fixed: 'left'
}
},
{
label: '物料编码',
field: 'itemCode',
sort: 'custom',
isSearch: false,
isForm: false,
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
isSearch: false,
isForm: false,
table: {
width: 200
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '批次',
field: 'batch',
sort: 'custom',
isSearch: false,
isForm: false,
table: {
width: 150
}
},
{
label: '检验批次',
field: 'inspectionBatch',
sort: 'custom',
isSearch: false,
isForm: false,
table: {
width: 150
}
},
{
label: '检验批数量',
field: 'inspectionBatchAmount',
sort: 'custom',
isSearch: false,
isForm: false,
table: {
width: 150
}
},
{
label: '检验方案编码',
field: 'inspectionSchemeCode',
sort: 'custom',
isSearch: false,
isForm: false,
table: {
width: 200
}
},
{
label: '检验人',
field: 'creator',
table: {
width: 130
},
isForm: false,
isTable: true
},
{
label: '检验时间',
field: 'updateTime',
sort: 'custom',
isDetail: true,
isForm: false,
isTable: false,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
}
},
{
label: '最后更新者',
field: 'updater',
isDetail: true,
isForm: false,
isTable: false,
table: {
width: 150
}
},
{
label: '操作',
field: 'action',
isForm: false,
isDetail: false,
table: {
width: 200,
fixed: 'right'
}
}
])
)
//表单校验
export const InspectionRecordMainRules = reactive({
useDecision: [required],
})
/**
* @returns {Array}
*/
export const InspectionRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isTable: false,
isSearch: false,
isForm: false,
},
{
label: '记录编码',
field: 'recordCode',
sort: 'custom',
isSearch: false,
},
{
label: '工序编码',
field: 'processCode',
sort: 'custom',
isSearch: false,
},
{
label: '工序描述',
field: 'processDescribe',
sort: 'custom',
isSearch: false,
},
{
label: '顺序号',
field: 'sequenceCode',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '是否破坏性检验',
field: 'isDestroyInspection',
sort: 'custom',
isSearch: false,
form: {
component: 'Radio'
},
},
{
label: '检验开始时间',
field: 'inspectionStartTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
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: 'inspectionEndTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
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: 'inspectionOperator',
sort: 'custom',
isSearch: false,
},
{
label: '检验特性编码',
field: 'inspectionFeaturesCode',
sort: 'custom',
isSearch: false,
},
// {
// label: '是否可用',
// field: 'available',
// sort: 'custom',
// isSearch: false,
// },
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
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',
isDetail: false,
isForm: false,
table: {
width: 150,
fixed: 'right'
},
isTableForm: false,
}
]))
//表单校验
export const InspectionRecordDetailRules = reactive({
recordCode: [required],
processCode: [required],
sequenceCode: [required],
isDestroyInspection: [required],
available: [required],
})
/**
* @returns {Array}
*/
export const InspectionRecordPackage = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编码',
field: 'number',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:200
},
table:{
width:150
}
},
{
label: '包装号',
field: 'packageCode',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:160
},
table:{
width:150
}
},
{
label: '包装规格',
field: 'packageSpecificationCode',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:150
},
table:{
width:150
}
},
{
label: '数量',
field: 'amount',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
tableForm:{
disabled:true,
width:120
},
table:{
width:150
}
},
{
label: '计量单位',
field: 'measuringUnit',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:120
},
table:{
width:150
}
},
{
label: '采样数量',
field: 'sampleAmount',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:100
},
table:{
width:150
}
},
{
label: '合格数量',
field: 'qualifiedAmount',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:100
},
table:{
width:150
}
},
{
label: '不合格数量',
field: 'noQualifiedAmount',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:100
},
table:{
width:150
}
},
{
label: '破坏数量',
field: 'destroyAmount',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:100
},
table:{
width:150
}
},
{
label: '冻结数量',
field: 'frozenAmount',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:100
},
table:{
width:150
}
}
]))
//表单校验
export const InspectionRecordPackageRules = reactive({
qualifiedAmount: [
required,
{ validator:validateSixNum, message: '小数点后最多6位', trigger: 'blur'}
],
frozenAmount: [
required,
{ validator:validateSixNum, message: '小数点后最多6位', trigger: 'blur'}
],
destroyAmount: [
required,
{ validator:validateSixNum, message: '小数点后最多6位', trigger: 'blur'}
],
noQualifiedAmount: [
required,
{ validator:validateSixNum, message: '小数点后最多6位', trigger: 'blur'}
],
})

312
src/views/qms/inspectionRecordFirst/useAddForm.vue

@ -0,0 +1,312 @@
<template>
<div>
<Dialog
:title="dialogTitle"
v-model="dialogVisible"
:width="dialogWidth"
:close-on-click-modal="false"
:vLoading="formLoading"
>
<div style="max-height: 80vh; overflow-y: auto; padding: 0px 20px">
<Form
ref="formMainRef"
:rules="rules"
:schema="formSchema"
:is-col="true"
@onChange="onChange"
/>
<div class="small-title">包装列表</div>
<div style="border:1px solid #dedede;margin-bottom:20px;display: flex;">
<TableForm
ref="tableFormRef"
style="width:100%;"
:maxHeight = "490"
:tableFields="tableSchemas.tableFormColumns"
:tableFormRules="tableFormRules"
:tableData="data.packageList"
:isShowButton="false"
:isShowReduceButton="false"
@inputStringBlur="tableFormBlur"
/>
</div>
</div>
<template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
</template>
</Dialog>
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" />
</div>
</template>
<script setup lang="ts">44
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { getCurrentInstance } from 'vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import { SearchTable } from '@/components/SearchTable'
import * as InspectionRecordMainApi from '@/api/qms/inspectionRecord/inspectionRecordMain'
import * as InspectionRecordPackageApi from '@/api/qms/inspectionRecord/InspectionRecordPackage/InspectionRecordPackage'
const { proxy } = getCurrentInstance()
const message = useMessage() //
const props = defineProps({
//
basicFormWidth: {
type: String,
default: ''
},
//
footButttondata: {
type: Array,
required: false,
default: null
},
//
formAllSchemas: {
type: Object,
required: true,
default: null
},
// rules
rules: {
type: Object,
required: true,
default: null
},
//
tableAllSchemas: {
type: Array,
required: true,
default: null
},
tableFormRules: {
type: Array,
required: true,
default: null
},
})
const { t } = useI18n() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const dialogWidth = ref()
const formSchema = ref(props.formAllSchemas?.formSchema)
const tableSchemas = ref(props.tableAllSchemas)
const tableFormRules = ref(props.tableFormRules)
const formMainRef = ref()
const data = ref({
code: '',
itemCode: '',
version: '',
testTypeCode: '',
programmeTemplateCode: '',
splitRule: '',
aql: '',
inspectionLevel: '',
effectiveDate: '',
expirationDate: '',
available: 'TRUE',
subList: []
})
if (props.basicFormWidth) {
dialogWidth.value = props.basicFormWidth + '%'
} else {
dialogWidth.value = props.isBusiness ? '60%' : '40%'
}
/** 打开弹窗 */
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => {
dialogTitle.value = t('action.applyDecision')
formType.value = type
if (row) {
data.value = JSON.parse(JSON.stringify(row))
data.value.packageList = await InspectionRecordPackageApi.getInspectionRecordPackageList(row.id)
data.value.packageList.forEach(item=>{
item.qualifiedAmount = item.qualifiedAmount?item.qualifiedAmount:0
item.noQualifiedAmount = item.noQualifiedAmount?item.noQualifiedAmount:0
item.destroyAmount = item.destroyAmount?item.destroyAmount:0
item.frozenAmount = item.frozenAmount?item.frozenAmount:0
})
dialogVisible.value = true
tableSchemas.value.tableFormColumns.map(item=>{
item.tableForm.disabled = true
})
// 1使
if(row.estimateCode == 1){
data.value.useDecision = '1'
}else{
data.value.useDecision =''
}
// ==
if(data.value.useDecision == 1){
data.value.packageList.forEach(item=>{
item.qualifiedAmount = item.amount
})
}
//
else if(data.value.useDecision == 2 || data.value.useDecision == 6){
tableSchemas.value.tableFormColumns.map(item=>{
if(item.field == 'noQualifiedAmount'){
item.tableForm.disabled = false
}else{
item.tableForm.disabled = true
}
})
}
//
else if(data.value.useDecision == 3){
data.value.packageList.forEach(item=>{
item.noQualifiedAmount = item.amount
})
}
else if(data.value.useDecision == 4){
data.value.packageList.forEach(item=>{
item.frozenAmount = item.amount
})
}
nextTick(() => {
formMainRef.value.setValues( data.value)
})
}
dialogVisible.value = true
}
defineExpose({ open, dialogVisible, formLoading }) // open
// console.log(11,tableAllSchemas.value.tableFormColumns)
//
const emit = defineEmits([
'onChange',
'submitForm'
])
/** 弹窗按钮 */
let Butttondata: any = []
if (props.footButttondata) {
Butttondata = props.footButttondata
} else {
Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) //
]
}
const onChange = (field, cur)=>{
if(field=='useDecision'){
tableSchemas.value.tableFormColumns.map(item=>{
item.tableForm.disabled = true
})
data.value.packageList.forEach(item=>{
item.qualifiedAmount =0
item.noQualifiedAmount =0
item.destroyAmount =0
item.frozenAmount =0
})
// ==
if(cur == 1){
data.value.packageList.forEach(item=>{
item.qualifiedAmount = item.amount
})
}
//
else if(cur == 2 || cur == 6){
data.value.packageList.forEach(item=>{
item.qualifiedAmount = item.amount
})
tableSchemas.value.tableFormColumns.map(item=>{
if(item.field == 'noQualifiedAmount'){
item.tableForm.disabled = false
}else{
item.tableForm.disabled = true
}
})
}
//
else if(cur == 3){
data.value.packageList.forEach(item=>{
item.noQualifiedAmount = item.amount
})
}
else if(cur == 4){
data.value.packageList.forEach(item=>{
item.frozenAmount = item.amount
})
}
}
}
//
const tableFormBlur = (field, val,row)=>{
if( row.amount < val){
row.noQualifiedAmount = row.amount
row.qualifiedAmount = 0
}else{
row.qualifiedAmount = row.amount - val
row.qualifiedAmount = row.qualifiedAmount.toFixed(6)
}
}
const buttonBaseClick = (val) => {
//
if (val == 'save') {
submitForm()
}
//
else if (val == 'close') {
dialogVisible.value = false
}
}
const tableFormRef = ref()
const submitForm = async () => {
try {
const elForm = unref(formMainRef)?.getElFormRef()
//
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
//
const validateForm1 = await tableFormRef.value.validateForm()
if (!validateForm1) return
const data1 = unref(formMainRef)?.formModel
data.value.useDecision = data1.useDecision
if(data1.useDecision == 2 || data1.useDecision == 6){
if(data.value.packageList.length>0){
let isBol = data.value.packageList.filter(cur=>parseFloat(cur.qualifiedAmount)+parseFloat(cur.noQualifiedAmount)!=parseFloat(cur.amount))
console.log(isBol)
if(isBol&&isBol.length>0){
message.error(`合格数量和不合格数量总和不等于数量`)
return
}
}
}
if (formType.value == 'create') {
//
emit('submitForm', formType.value, data.value)
} else {
// /
emit('submitForm', formType.value, data.value)
}
} catch {
console.log(111)
}
}
</script>
<style scoped>
.small-title {
font-weight: bold;
padding: 0px 10px 10px;
color: #1a8bfc;
font-size: 16px;
}
</style>
<style>
.el-tabs--left .el-tabs__header.is-left {
min-height: 700px !important;
min-width: 150px !important;
}
.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left {
min-width: 120px !important;
}
</style>
Loading…
Cancel
Save