陈薪名
4 months ago
50 changed files with 1953 additions and 289 deletions
@ -0,0 +1,407 @@ |
|||||
|
<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.recordInspectionQuantifyList" :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-select |
||||
|
v-model="cur.qualitativeCode" |
||||
|
placeholder="请选择选定集" |
||||
|
disabled |
||||
|
> |
||||
|
<el-option |
||||
|
v-for="dict in item.selectedProjectRespVOList" |
||||
|
:key="dict.dictionaryValue" |
||||
|
:label="dict.dictionaryLabel" |
||||
|
:value="dict.dictionaryValue" |
||||
|
/> |
||||
|
</el-select> |
||||
|
</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-col :span="12"> |
||||
|
<el-form-item label="备注"> |
||||
|
<el-input v-model="cur.remark" placeholder="" type="number" disabled/> |
||||
|
</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 |
||||
|
item.inspectionRecordCharacteristicsRespVO.recordInspectionQuantifyList = item.inspectionRecordCharacteristicsRespVO.featureType == 1 ? item.inspectionRecordCharacteristicsRespVO.qualitativeRespVOList : item.inspectionRecordCharacteristicsRespVO.quantifyRespVOList |
||||
|
}) |
||||
|
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> |
@ -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')) |
||||
|
} |
||||
|
basicFormRef.value.dialogVisible = false |
||||
|
// 刷新当前列表 |
||||
|
getList() |
||||
|
} finally { |
||||
|
basicFormRef.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> |
@ -0,0 +1,456 @@ |
|||||
|
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: 'inspectionTime', |
||||
|
sort: 'custom', |
||||
|
isDetail: true, |
||||
|
isForm: 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: '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'} |
||||
|
], |
||||
|
}) |
@ -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) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
||||
|
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…
Reference in new issue