Browse Source

检验任务

linshi20240813
zhaoyiran 1 month ago
parent
commit
bdf3aeaacf
  1. 1
      src/utils/dict.ts
  2. 15
      src/views/qms/inspectionJob/index.vue
  3. 2
      src/views/qms/inspectionJob/inspectionJobMain.data.ts
  4. 1551
      src/views/qms/inspectionJobProduction/addForm.vue
  5. 194
      src/views/qms/inspectionJobProduction/detail.vue
  6. 438
      src/views/qms/inspectionJobProduction/index.vue
  7. 864
      src/views/qms/inspectionJobProduction/inspectionJobMain.data.ts
  8. 1551
      src/views/qms/inspectionJobPurchase/addForm.vue
  9. 194
      src/views/qms/inspectionJobPurchase/detail.vue
  10. 438
      src/views/qms/inspectionJobPurchase/index.vue
  11. 864
      src/views/qms/inspectionJobPurchase/inspectionJobMain.data.ts

1
src/utils/dict.ts

@ -203,6 +203,7 @@ export enum DICT_TYPE {
CARRIER_TYPE = 'carrier_type', // 承运商类型
INSPECT_TYPE = 'inspect_type', // 检验类型
INSPECTION_TYPE = 'inspection_type', // 质量管理检验类型
INSPECTION_TYPE_NEW = 'inspection_type_new', // 质量管理检验类型
NEXT_ACTION = 'next_action', // 下一步检验动作
SAMPLE_METHOD = 'sample_method', // 抽检方式
WAREHOUSE_TYPE = 'warehouse_type', // 仓库类型

15
src/views/qms/inspectionJob/index.vue

@ -414,6 +414,14 @@ const handleImport = () => {
//
const searchFormClick = (searchData) => {
let isHave = searchData?.filters?.some((item) => item.column == 'inspectionType')
if (!isHave) {
searchData.filters.push({
action: 'notIn',
column: 'inspectionType',
value: '1,4'
})
}
tableObject.params = {
isSearch: true,
filters: searchData.filters
@ -423,9 +431,10 @@ const searchFormClick = (searchData) => {
/** 初始化 **/
onMounted(async () => {
  tableObject.params = {
    available: true
  }
tableObject.params = {
available: true,
excludeInspectionType: '1,4'
}
getList()
// importTemplateData.templateUrl = await InspectionJobMainApi.importTemplate()
})

2
src/views/qms/inspectionJob/inspectionJobMain.data.ts

@ -272,7 +272,7 @@ export const InspectionJobMain = useCrudSchemas(
label: '检验类型',
field: 'inspectionType',
sort: 'custom',
dictType: DICT_TYPE.INSPECTION_TYPE,
dictType: DICT_TYPE.INSPECTION_TYPE_NEW,
dictClass: 'string',
isSearch: true,
form: {

1551
src/views/qms/inspectionJobProduction/addForm.vue

File diff suppressed because it is too large

194
src/views/qms/inspectionJobProduction/detail.vue

@ -0,0 +1,194 @@
<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.inspectionJobCharacteristicsRespVO.number" placeholder="根据系统生成" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述" prop="inspectionJobCharacteristicsRespVO.description">
<el-input v-model="item.inspectionJobCharacteristicsRespVO.description" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检验方法" prop="inspectionJobCharacteristicsRespVO.inspectionMethodCode">
<div style="display: flex; width: 100%">
<el-input v-model="item.inspectionJobCharacteristicsRespVO.inspectionMethodName" disabled placeholder="请选择检验方法" />
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="采样过程编码" prop="inspectionJobCharacteristicsRespVO.samplingProcessCode">
<div style="display: flex; width: 100%">
<el-input v-model="item.inspectionJobCharacteristicsRespVO.samplingProcessName" disabled placeholder="请选择采样过程编码" />
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="样品份数" prop="inspectionJobCharacteristicsRespVO.sampleQty">
<div style="display: flex; width: 100%">
<el-input v-model="item.inspectionJobCharacteristicsRespVO.sampleQty" disabled placeholder="请输入样品份数" />
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="每份样品量" prop="inspectionJobCharacteristicsRespVO.samplePieceSize">
<div style="display: flex; width: 100%">
<el-input v-model="item.inspectionJobCharacteristicsRespVO.samplePieceSize" disabled placeholder="请输入每份样品量" />
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否允许修改特征值" prop="inspectionJobCharacteristicsRespVO.isCanUpdate">
<el-switch v-model="item.inspectionJobCharacteristicsRespVO.isCanUpdate" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="结果录入方式" prop="inspectionJobCharacteristicsRespVO.resultEntryMethod">
<el-select v-model="item.inspectionJobCharacteristicsRespVO.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="inspectionJobCharacteristicsRespVO.featureType">
<el-select v-model="item.inspectionJobCharacteristicsRespVO.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-row>
</el-form>
</el-tab-pane>
</el-tabs>
</ContentWrap>
</el-drawer>
</div>
</template>
<script lang="ts" setup>
import * as InspectionJobDetailPageApi from '@/api/qms/inspectionJob/inspectionJobDetail'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
defineOptions({ name: 'Detail' })
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 InspectionJobDetailPageApi.getInspectionJobDetailList(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>

438
src/views/qms/inspectionJobProduction/index.vue

@ -0,0 +1,438 @@
<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 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="formRef"
basicFormWidth="80"
:formAllSchemasFeatures="InspectionTemplateFeatures.allSchemas"
:formAllSchemasProcess="InspectionTemplateProcess.allSchemas"
:formAllSchemasMain="InspectionTemplateMain.allSchemas"
:tableAllSchemas="InspectionJobPackage.allSchemas"
:tableFormRules="InspectionJobPackageRules"
:rules="InspectionJobMainRules"
:formAllSchemas="InspectionJobMain.allSchemas"
@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"
/>
<!-- 包装信息 -->
<ListTable
ref="listTableRef"
titleName="包装信息"
:allSchemas="InspectionJobMain.allSchemas"
:detailAllSchemas="InspectionJobPackage.allSchemas"
:detailAllSchemasRules="InspectionJobPackageRules"
:list="list"
/>
<el-dialog
v-model="showQualityReport"
:title="t('质检明细')"
:append-to-body="false"
destroy-on-close
fullscreen
>
<iframe :height="reportHeight" width="100%" :src="qualityReport" frameborder="0"></iframe>
</el-dialog>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import {
InspectionJobMain,
InspectionJobMainRules,
InspectionJobDetail,
InspectionJobDetailRules,
InspectionJobPackage,
InspectionJobPackageRules
} from './inspectionJobMain.data'
import {
InspectionTemplateMain,
InspectionTemplateProcess,
InspectionTemplateFeatures,
InspectionTemplateRules
} from '../inspectionTemplate/inspectionTemplate.data'
import * as InspectionJobPackageApi from '@/api/qms/inspectionJob/InspectionJobPackage/InspectionJobPackage'
import * as InspectionJobMainApi from '@/api/qms/inspectionJob/inspectionJobMain'
import * as InspectionJobDetailApi from '@/api/qms/inspectionJob/inspectionJobDetail'
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 { getReportUrl } from '@/utils/systemParam'
//
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.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 (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
//
const isShowMainButton2 = (row, val) => {
if (val.indexOf(row.isStaging) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = (row) => {
return [
defaultButtons.mainListJobAccBtn({
hide: isShowMainButton(row, ['1']),
hasPermi: 'qms:inspection-job-main:accept'
}), //
defaultButtons.mainListJobCloBtn({
hide: isShowMainButton(row, ['1']),
hasPermi: 'qms:inspection-job-main:close'
}), //
defaultButtons.mainListJobAbaBtn({
hide: isShowMainButton(row, ['2']),
hasPermi: 'qms:inspection-job-main:abandon'
}), //
defaultButtons.mainListJobExeBtn({
hide: isShowMainButton(row, ['2']),
hasPermi: 'qms:inspection-job-main:execute'
}), //
defaultButtons.mainListOrderPubBtn({
hide: isShowMainButton2(row, ['TRUE']),
hasPermi: 'qms:inspection-job-main:execute'
}), //
defaultButtons.mainListPackageBtn(null), //
defaultButtons.mainListPlanCheckQualityReportBtn({}) //
]
}
const listTableRef = ref()
const list = ref([])
// -
const buttonTableClick = async (val, row) => {
if (val == 'mainJobExe') {
//
execute('execute', row)
} else if (val == 'mainPackage') {
//
list.value = await InspectionJobPackageApi.getInspectionJobPackageList(row.id)
// row.status = '1'
listTableRef.value.openPackage(row, '包装信息', InspectionJobPackage.allSchemas.tableColumns)
} else if (val == 'mainJobAba') {
//
handleAbandon(row.id)
} else if (val == 'mainJobClo') {
//
handleClose(row.id)
} else if (val == 'mainOrderPub') {
//
handleRelease(row.id)
} else if (val == 'mainPlanCheckQualityReport') {
//
checkQualityReport(row)
} else if (val == 'mainJobAcc') {
//
handleAccept(row.id)
}
}
//
//
const reportHeight = ref(window.innerHeight - 120)
const showQualityReport = ref(false)
const qualityReport = ref('')
const checkQualityReport = async (row) => {
showQualityReport.value = true
qualityReport.value = `${getReportUrl()}/purchasereceiptReport?asnNumber=${row.asnNumber}`
}
/** 添加/修改操作 */
// 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 formRef = ref()
const execute = async (type: string, row?: number) => {
formRef.value.open(type, row)
}
/** 关闭按钮操作 */
const handleClose = async (id: number) => {
try {
//
await message.confirm(t('common.confirmColse'))
//
await InspectionJobMainApi.closeInspectionJobMain(id)
message.success(t('common.closeSuccess'))
//
await getList()
} catch {}
}
/** 发布按钮操作 */
const handleRelease = async (id: number) => {
try {
//
await message.confirm('确认发布吗?')
//
await InspectionJobMainApi.releaseInspectionJobMain(id)
message.success('发布成功!')
//
await getList()
} catch {}
}
//
const handleAccept = async (id: number) => {
try {
//
await message.confirm(t('common.confirmAccept'))
//
await InspectionJobMainApi.acceptInspectionJobMain(id)
message.success(t('common.acceptSuccess'))
//
await getList()
} catch {}
}
//
const handleAbandon = async (id: number) => {
try {
//
await message.confirm(t('common.confirmGiveup'))
//
await InspectionJobMainApi.abandonInspectionJobMain(id)
message.success(t('common.giveupSuccess'))
//
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 submitForm = async (formType, data) => {
// return
try {
formRef.value.formLoading = true
if (formType === 'create') {
await InspectionJobMainApi.createInspectionJobMain(data)
message.success(t('common.createSuccess'))
} else if (formType === 'execute') {
await InspectionJobMainApi.executeInspectionJobMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
formRef.value.formLoading = false
//
getList()
} finally {
formRef.value.formLoading = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const searchFormClick = (searchData) => {
searchData.filters.push({
action: "==",
column: "inspectionType",
value: "4"
})
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
tableObject.params = {
available: true,
inspectionType: '4'
}
getList()
// importTemplateData.templateUrl = await InspectionJobMainApi.importTemplate()
})
</script>

864
src/views/qms/inspectionJobProduction/inspectionJobMain.data.ts

@ -0,0 +1,864 @@
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() // 国际化
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
const resultEntryMethodList = getStrDictOptions(DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY)
const featureTypeList = getStrDictOptions(DICT_TYPE.INSPECTION_CHARACTERISTICS_FEATURE_TYPE)
const isCanUpdateList = [
{
label: '是',
value: true
},
{
label: '否',
value: false
}
]
/**
* @returns {Array}
*/
export const InspectionJobMain = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '编码',
field: 'number',
sort: 'custom',
isSearch: true,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 200,
fixed: 'left'
}
},
{
label: '申请单号',
field: 'requestNumber',
sort: 'custom',
isSearch: true,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 200
}
},
{
label: '发货单号',
field: 'asnNumber',
sort: 'custom',
isSearch: true,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 180
}
},
{
label: '供应商编码',
field: 'supplierCode',
sort: 'custom',
isSearch: true,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 175
}
},
{
label: '供应商名称',
field: 'supplierName',
sort: 'custom',
isSearch: false,
table: {
width: 175
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '物料编码',
field: 'itemCode',
sort: 'custom',
isSearch: false,
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
isSearch: false,
table: {
width: 175
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '物料批次',
field: 'batch',
sort: 'custom',
isSearch: false,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '参考订单号',
field: 'referenceOrderCode',
sort: 'custom',
isSearch: false,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '参考订单行',
field: 'referenceOrderRow',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
value: 0,
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '参考凭证号',
field: 'referenceCertificateCode',
sort: 'custom',
isSearch: false,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '参考凭证行',
field: 'referenceCertificateRow',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
value: 0,
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '检验方案编码',
field: 'inspectionSchemeCode',
sort: 'custom',
isSearch: false,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 200
}
},
{
label: '批次',
field: 'inspectionBatch',
sort: 'custom',
isSearch: false,
isDetail: true,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '供应商批次',
field: 'supplierBatch',
sort: 'custom',
isSearch: false,
isDetail: true,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '检验批数量',
field: 'inspectionBatchAmount',
sort: 'custom',
isSearch: false,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
// {
// label: '采样总数量',
// field: 'sampleTotalAmount',
// sort: 'custom',
// isSearch: false,
// form: {
// componentProps:{
// disabled:true
// }
// },
// table: {
// width: 150
// }
// },
{
label: '检验类型',
field: 'inspectionType',
sort: 'custom',
dictType: DICT_TYPE.INSPECTION_TYPE,
dictClass: 'string',
isSearch: false,
form: {
component: 'Select',
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '完成人',
field: 'completeUser',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isTable: false,
isDetail: false,
isSearch: true,
isTableForm: false,
isForm: false
},
// {
// label: '检验批来源',
// field: 'inspectionBatchSource',
// sort: 'custom',
// isSearch: false,
// dictType: DICT_TYPE.INSPECTION_BATCH_SOURCE,
// dictClass: 'string',
// form:{
// componentProps:{
// disabled:true
// }
// },
// table: {
// width: 150
// }
// },
{
label: '检验阶段',
field: 'inspectionStage',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
value: 0,
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '检验严格性',
field: 'inspectionStringency',
sort: 'custom',
isSearch: false,
dictType: DICT_TYPE.INSPECTION_SEVERITY,
dictClass: 'string',
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '计划开始时间',
field: 'planStartTime',
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',
disabled: true
}
},
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 175
}
},
{
label: '计划结束时间',
field: 'planEndTime',
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',
disabled: true
}
},
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 175
}
},
{
label: '检验水平',
field: 'inspectionLevel',
sort: 'custom',
isSearch: false,
dictType: DICT_TYPE.INSPECTION_LEVEL,
dictClass: 'string',
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: 'AQL值',
field: 'aqlValue',
sort: 'custom',
isSearch: false,
dictType: DICT_TYPE.BASIC_AQL,
dictClass: 'string',
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
// {
// label: '使用决策',
// field: 'usageDecision',
// sort: 'custom',
// isSearch: false,
// dictType: DICT_TYPE.USAGE_DECISION,
// form:{
// componentProps:{
// }
// }
// },
// {
// label: '是否可用',
// field: 'available',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string',
// isTable: true,
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE',
// disabled:true
// }
// }
// },
{
label: '承接人',
field: 'acceptUserName',
table: {
width: 130
},
isForm: false,
isTable: false,
isDetail: true
},
{
label: '承接时间',
field: 'acceptTime',
isForm: false,
table: {
width: 180
},
isTable: false,
isDetail: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
}
},
{
label: '收货时间',
field: 'deliveryTime',
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'
}
},
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 175
}
},
{
label: '完成人',
field: 'completeUserName',
table: {
width: 130
},
isForm: false,
isTable: true,
isDetail: true
},
{
label: '完成时间',
field: 'completeTime',
isForm: false,
table: {
width: 180
},
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
}
},
{
label: '状态',
field: 'status',
dictType: DICT_TYPE.JOB_STATUS,
dictClass: 'string',
isForm: false,
isTable: true,
sort: 'custom',
table: {
width: 150
}
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
search: {
value: 'TRUE'
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
table: {
width: 110
}
},
{
label: '创建时间',
field: 'createTime',
isForm: false,
table: {
width: 180
},
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
}
},
{
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: 300,
fixed: 'right'
}
}
])
)
//表单校验
export const InspectionJobMainRules = reactive({
// usageDecision: [required],
})
/**
* @returns {Array}
*/
export const InspectionJobDetail = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '编码',
field: 'number',
sort: 'custom',
isSearch: true
},
{
label: '检验方案模板编码',
field: 'inspectionCode',
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: 'inspectionCharCode',
sort: 'custom',
isSearch: true
},
{
label: '检验特性编码',
field: 'inspectionJobCharacteristicsRespVO.number',
sort: 'custom'
},
{
label: '检验特性描述',
field: 'inspectionJobCharacteristicsRespVO.description',
sort: 'custom'
},
{
label: '检验方法',
field: 'inspectionJobCharacteristicsRespVO.inspectionMethodCode',
sort: 'custom'
},
{
label: '采样过程编码',
field: 'inspectionJobCharacteristicsRespVO.samplingProcessCode',
sort: 'custom'
},
{
label: '动态修改规则编码',
field: 'inspectionJobCharacteristicsRespVO.dynamicUpdateCode',
sort: 'custom'
},
{
label: '是否允许修改特征值',
field: 'inspectionJobCharacteristicsRespVO.isCanUpdate',
sort: 'custom',
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return isCanUpdateList.find((account) => account.value == cellValue)?.label
}
},
{
label: '结果录入方式',
field: 'inspectionJobCharacteristicsRespVO.resultEntryMethod',
sort: 'custom',
// dictType: DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY,
// dictClass: 'string',
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return resultEntryMethodList.find((account) => account.value == cellValue)?.label
}
},
{
label: '特征类型',
field: 'inspectionJobCharacteristicsRespVO.featureType',
sort: 'custom',
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return featureTypeList.find((account) => account.value == cellValue)?.label
}
}
])
)
//表单校验
export const InspectionJobDetailRules = reactive({
taskCode: [required],
processCode: [required],
sequenceCode: [required],
available: [required]
})
/**
* @returns {Array}
*/
export const InspectionJobPackage = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '编码',
field: 'number',
sort: 'custom',
isSearch: true,
tableForm: {
disabled: true
},
table: {
width: 200
}
},
{
label: '包装号',
field: 'packageCode',
sort: 'custom',
isSearch: true,
tableForm: {
disabled: true
},
table: {
width: 200
}
},
{
label: '包装规格',
field: 'packageSpecificationCode',
sort: 'custom',
isSearch: true,
tableForm: {
disabled: true
},
table: {
width: 180
}
},
{
label: '数量',
field: 'amount',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
tableForm: {
disabled: true
},
table: {
width: 150
}
},
{
label: '计量单位',
field: 'measuringUnit',
sort: 'custom',
isSearch: true,
tableForm: {
disabled: true
},
table: {
width: 150
}
},
{
label: '采样数量',
field: 'sampleAmount',
sort: 'custom',
isSearch: true,
isTable: false,
table: {
width: 150
}
}
])
)
//表单校验
export const InspectionJobPackageRules = reactive({
sampleAmount: [required, { validator: validateSixNum, trigger: 'blur' }]
})

1551
src/views/qms/inspectionJobPurchase/addForm.vue

File diff suppressed because it is too large

194
src/views/qms/inspectionJobPurchase/detail.vue

@ -0,0 +1,194 @@
<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.inspectionJobCharacteristicsRespVO.number" placeholder="根据系统生成" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述" prop="inspectionJobCharacteristicsRespVO.description">
<el-input v-model="item.inspectionJobCharacteristicsRespVO.description" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检验方法" prop="inspectionJobCharacteristicsRespVO.inspectionMethodCode">
<div style="display: flex; width: 100%">
<el-input v-model="item.inspectionJobCharacteristicsRespVO.inspectionMethodName" disabled placeholder="请选择检验方法" />
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="采样过程编码" prop="inspectionJobCharacteristicsRespVO.samplingProcessCode">
<div style="display: flex; width: 100%">
<el-input v-model="item.inspectionJobCharacteristicsRespVO.samplingProcessName" disabled placeholder="请选择采样过程编码" />
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="样品份数" prop="inspectionJobCharacteristicsRespVO.sampleQty">
<div style="display: flex; width: 100%">
<el-input v-model="item.inspectionJobCharacteristicsRespVO.sampleQty" disabled placeholder="请输入样品份数" />
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="每份样品量" prop="inspectionJobCharacteristicsRespVO.samplePieceSize">
<div style="display: flex; width: 100%">
<el-input v-model="item.inspectionJobCharacteristicsRespVO.samplePieceSize" disabled placeholder="请输入每份样品量" />
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否允许修改特征值" prop="inspectionJobCharacteristicsRespVO.isCanUpdate">
<el-switch v-model="item.inspectionJobCharacteristicsRespVO.isCanUpdate" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="结果录入方式" prop="inspectionJobCharacteristicsRespVO.resultEntryMethod">
<el-select v-model="item.inspectionJobCharacteristicsRespVO.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="inspectionJobCharacteristicsRespVO.featureType">
<el-select v-model="item.inspectionJobCharacteristicsRespVO.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-row>
</el-form>
</el-tab-pane>
</el-tabs>
</ContentWrap>
</el-drawer>
</div>
</template>
<script lang="ts" setup>
import * as InspectionJobDetailPageApi from '@/api/qms/inspectionJob/inspectionJobDetail'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
defineOptions({ name: 'Detail' })
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 InspectionJobDetailPageApi.getInspectionJobDetailList(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>

438
src/views/qms/inspectionJobPurchase/index.vue

@ -0,0 +1,438 @@
<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 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="formRef"
basicFormWidth="80"
:formAllSchemasFeatures="InspectionTemplateFeatures.allSchemas"
:formAllSchemasProcess="InspectionTemplateProcess.allSchemas"
:formAllSchemasMain="InspectionTemplateMain.allSchemas"
:tableAllSchemas="InspectionJobPackage.allSchemas"
:tableFormRules="InspectionJobPackageRules"
:rules="InspectionJobMainRules"
:formAllSchemas="InspectionJobMain.allSchemas"
@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"
/>
<!-- 包装信息 -->
<ListTable
ref="listTableRef"
titleName="包装信息"
:allSchemas="InspectionJobMain.allSchemas"
:detailAllSchemas="InspectionJobPackage.allSchemas"
:detailAllSchemasRules="InspectionJobPackageRules"
:list="list"
/>
<el-dialog
v-model="showQualityReport"
:title="t('质检明细')"
:append-to-body="false"
destroy-on-close
fullscreen
>
<iframe :height="reportHeight" width="100%" :src="qualityReport" frameborder="0"></iframe>
</el-dialog>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import {
InspectionJobMain,
InspectionJobMainRules,
InspectionJobDetail,
InspectionJobDetailRules,
InspectionJobPackage,
InspectionJobPackageRules
} from './inspectionJobMain.data'
import {
InspectionTemplateMain,
InspectionTemplateProcess,
InspectionTemplateFeatures,
InspectionTemplateRules
} from '../inspectionTemplate/inspectionTemplate.data'
import * as InspectionJobPackageApi from '@/api/qms/inspectionJob/InspectionJobPackage/InspectionJobPackage'
import * as InspectionJobMainApi from '@/api/qms/inspectionJob/inspectionJobMain'
import * as InspectionJobDetailApi from '@/api/qms/inspectionJob/inspectionJobDetail'
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 { getReportUrl } from '@/utils/systemParam'
//
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.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 (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
//
const isShowMainButton2 = (row, val) => {
if (val.indexOf(row.isStaging) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = (row) => {
return [
defaultButtons.mainListJobAccBtn({
hide: isShowMainButton(row, ['1']),
hasPermi: 'qms:inspection-job-main:accept'
}), //
defaultButtons.mainListJobCloBtn({
hide: isShowMainButton(row, ['1']),
hasPermi: 'qms:inspection-job-main:close'
}), //
defaultButtons.mainListJobAbaBtn({
hide: isShowMainButton(row, ['2']),
hasPermi: 'qms:inspection-job-main:abandon'
}), //
defaultButtons.mainListJobExeBtn({
hide: isShowMainButton(row, ['2']),
hasPermi: 'qms:inspection-job-main:execute'
}), //
defaultButtons.mainListOrderPubBtn({
hide: isShowMainButton2(row, ['TRUE']),
hasPermi: 'qms:inspection-job-main:execute'
}), //
defaultButtons.mainListPackageBtn(null), //
defaultButtons.mainListPlanCheckQualityReportBtn({}) //
]
}
const listTableRef = ref()
const list = ref([])
// -
const buttonTableClick = async (val, row) => {
if (val == 'mainJobExe') {
//
execute('execute', row)
} else if (val == 'mainPackage') {
//
list.value = await InspectionJobPackageApi.getInspectionJobPackageList(row.id)
// row.status = '1'
listTableRef.value.openPackage(row, '包装信息', InspectionJobPackage.allSchemas.tableColumns)
} else if (val == 'mainJobAba') {
//
handleAbandon(row.id)
} else if (val == 'mainJobClo') {
//
handleClose(row.id)
} else if (val == 'mainOrderPub') {
//
handleRelease(row.id)
} else if (val == 'mainPlanCheckQualityReport') {
//
checkQualityReport(row)
} else if (val == 'mainJobAcc') {
//
handleAccept(row.id)
}
}
//
//
const reportHeight = ref(window.innerHeight - 120)
const showQualityReport = ref(false)
const qualityReport = ref('')
const checkQualityReport = async (row) => {
showQualityReport.value = true
qualityReport.value = `${getReportUrl()}/purchasereceiptReport?asnNumber=${row.asnNumber}`
}
/** 添加/修改操作 */
// 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 formRef = ref()
const execute = async (type: string, row?: number) => {
formRef.value.open(type, row)
}
/** 关闭按钮操作 */
const handleClose = async (id: number) => {
try {
//
await message.confirm(t('common.confirmColse'))
//
await InspectionJobMainApi.closeInspectionJobMain(id)
message.success(t('common.closeSuccess'))
//
await getList()
} catch {}
}
/** 发布按钮操作 */
const handleRelease = async (id: number) => {
try {
//
await message.confirm('确认发布吗?')
//
await InspectionJobMainApi.releaseInspectionJobMain(id)
message.success('发布成功!')
//
await getList()
} catch {}
}
//
const handleAccept = async (id: number) => {
try {
//
await message.confirm(t('common.confirmAccept'))
//
await InspectionJobMainApi.acceptInspectionJobMain(id)
message.success(t('common.acceptSuccess'))
//
await getList()
} catch {}
}
//
const handleAbandon = async (id: number) => {
try {
//
await message.confirm(t('common.confirmGiveup'))
//
await InspectionJobMainApi.abandonInspectionJobMain(id)
message.success(t('common.giveupSuccess'))
//
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 submitForm = async (formType, data) => {
// return
try {
formRef.value.formLoading = true
if (formType === 'create') {
await InspectionJobMainApi.createInspectionJobMain(data)
message.success(t('common.createSuccess'))
} else if (formType === 'execute') {
await InspectionJobMainApi.executeInspectionJobMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
formRef.value.formLoading = false
//
getList()
} finally {
formRef.value.formLoading = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const searchFormClick = (searchData) => {
searchData.filters.push({
action: "==",
column: "inspectionType",
value: "1"
})
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
tableObject.params = {
available: true,
inspectionType: '1'
}
getList()
// importTemplateData.templateUrl = await InspectionJobMainApi.importTemplate()
})
</script>

864
src/views/qms/inspectionJobPurchase/inspectionJobMain.data.ts

@ -0,0 +1,864 @@
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() // 国际化
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
const resultEntryMethodList = getStrDictOptions(DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY)
const featureTypeList = getStrDictOptions(DICT_TYPE.INSPECTION_CHARACTERISTICS_FEATURE_TYPE)
const isCanUpdateList = [
{
label: '是',
value: true
},
{
label: '否',
value: false
}
]
/**
* @returns {Array}
*/
export const InspectionJobMain = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '编码',
field: 'number',
sort: 'custom',
isSearch: true,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 200,
fixed: 'left'
}
},
{
label: '申请单号',
field: 'requestNumber',
sort: 'custom',
isSearch: true,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 200
}
},
{
label: '发货单号',
field: 'asnNumber',
sort: 'custom',
isSearch: true,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 180
}
},
{
label: '供应商编码',
field: 'supplierCode',
sort: 'custom',
isSearch: true,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 175
}
},
{
label: '供应商名称',
field: 'supplierName',
sort: 'custom',
isSearch: false,
table: {
width: 175
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '物料编码',
field: 'itemCode',
sort: 'custom',
isSearch: false,
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
isSearch: false,
table: {
width: 175
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '物料批次',
field: 'batch',
sort: 'custom',
isSearch: false,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '参考订单号',
field: 'referenceOrderCode',
sort: 'custom',
isSearch: false,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '参考订单行',
field: 'referenceOrderRow',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
value: 0,
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '参考凭证号',
field: 'referenceCertificateCode',
sort: 'custom',
isSearch: false,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '参考凭证行',
field: 'referenceCertificateRow',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
value: 0,
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '检验方案编码',
field: 'inspectionSchemeCode',
sort: 'custom',
isSearch: false,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 200
}
},
{
label: '批次',
field: 'inspectionBatch',
sort: 'custom',
isSearch: false,
isDetail: true,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '供应商批次',
field: 'supplierBatch',
sort: 'custom',
isSearch: false,
isDetail: true,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '检验批数量',
field: 'inspectionBatchAmount',
sort: 'custom',
isSearch: false,
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
// {
// label: '采样总数量',
// field: 'sampleTotalAmount',
// sort: 'custom',
// isSearch: false,
// form: {
// componentProps:{
// disabled:true
// }
// },
// table: {
// width: 150
// }
// },
{
label: '检验类型',
field: 'inspectionType',
sort: 'custom',
dictType: DICT_TYPE.INSPECTION_TYPE,
dictClass: 'string',
isSearch: false,
form: {
component: 'Select',
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '完成人',
field: 'completeUser',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isTable: false,
isDetail: false,
isSearch: true,
isTableForm: false,
isForm: false
},
// {
// label: '检验批来源',
// field: 'inspectionBatchSource',
// sort: 'custom',
// isSearch: false,
// dictType: DICT_TYPE.INSPECTION_BATCH_SOURCE,
// dictClass: 'string',
// form:{
// componentProps:{
// disabled:true
// }
// },
// table: {
// width: 150
// }
// },
{
label: '检验阶段',
field: 'inspectionStage',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
value: 0,
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '检验严格性',
field: 'inspectionStringency',
sort: 'custom',
isSearch: false,
dictType: DICT_TYPE.INSPECTION_SEVERITY,
dictClass: 'string',
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: '计划开始时间',
field: 'planStartTime',
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',
disabled: true
}
},
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 175
}
},
{
label: '计划结束时间',
field: 'planEndTime',
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',
disabled: true
}
},
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 175
}
},
{
label: '检验水平',
field: 'inspectionLevel',
sort: 'custom',
isSearch: false,
dictType: DICT_TYPE.INSPECTION_LEVEL,
dictClass: 'string',
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
{
label: 'AQL值',
field: 'aqlValue',
sort: 'custom',
isSearch: false,
dictType: DICT_TYPE.BASIC_AQL,
dictClass: 'string',
form: {
componentProps: {
disabled: true
}
},
table: {
width: 150
}
},
// {
// label: '使用决策',
// field: 'usageDecision',
// sort: 'custom',
// isSearch: false,
// dictType: DICT_TYPE.USAGE_DECISION,
// form:{
// componentProps:{
// }
// }
// },
// {
// label: '是否可用',
// field: 'available',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string',
// isTable: true,
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE',
// disabled:true
// }
// }
// },
{
label: '承接人',
field: 'acceptUserName',
table: {
width: 130
},
isForm: false,
isTable: false,
isDetail: true
},
{
label: '承接时间',
field: 'acceptTime',
isForm: false,
table: {
width: 180
},
isTable: false,
isDetail: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
}
},
{
label: '收货时间',
field: 'deliveryTime',
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'
}
},
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 175
}
},
{
label: '完成人',
field: 'completeUserName',
table: {
width: 130
},
isForm: false,
isTable: true,
isDetail: true
},
{
label: '完成时间',
field: 'completeTime',
isForm: false,
table: {
width: 180
},
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
}
},
{
label: '状态',
field: 'status',
dictType: DICT_TYPE.JOB_STATUS,
dictClass: 'string',
isForm: false,
isTable: true,
sort: 'custom',
table: {
width: 150
}
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
search: {
value: 'TRUE'
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
table: {
width: 110
}
},
{
label: '创建时间',
field: 'createTime',
isForm: false,
table: {
width: 180
},
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
}
},
{
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: 300,
fixed: 'right'
}
}
])
)
//表单校验
export const InspectionJobMainRules = reactive({
// usageDecision: [required],
})
/**
* @returns {Array}
*/
export const InspectionJobDetail = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '编码',
field: 'number',
sort: 'custom',
isSearch: true
},
{
label: '检验方案模板编码',
field: 'inspectionCode',
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: 'inspectionCharCode',
sort: 'custom',
isSearch: true
},
{
label: '检验特性编码',
field: 'inspectionJobCharacteristicsRespVO.number',
sort: 'custom'
},
{
label: '检验特性描述',
field: 'inspectionJobCharacteristicsRespVO.description',
sort: 'custom'
},
{
label: '检验方法',
field: 'inspectionJobCharacteristicsRespVO.inspectionMethodCode',
sort: 'custom'
},
{
label: '采样过程编码',
field: 'inspectionJobCharacteristicsRespVO.samplingProcessCode',
sort: 'custom'
},
{
label: '动态修改规则编码',
field: 'inspectionJobCharacteristicsRespVO.dynamicUpdateCode',
sort: 'custom'
},
{
label: '是否允许修改特征值',
field: 'inspectionJobCharacteristicsRespVO.isCanUpdate',
sort: 'custom',
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return isCanUpdateList.find((account) => account.value == cellValue)?.label
}
},
{
label: '结果录入方式',
field: 'inspectionJobCharacteristicsRespVO.resultEntryMethod',
sort: 'custom',
// dictType: DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY,
// dictClass: 'string',
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return resultEntryMethodList.find((account) => account.value == cellValue)?.label
}
},
{
label: '特征类型',
field: 'inspectionJobCharacteristicsRespVO.featureType',
sort: 'custom',
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return featureTypeList.find((account) => account.value == cellValue)?.label
}
}
])
)
//表单校验
export const InspectionJobDetailRules = reactive({
taskCode: [required],
processCode: [required],
sequenceCode: [required],
available: [required]
})
/**
* @returns {Array}
*/
export const InspectionJobPackage = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '编码',
field: 'number',
sort: 'custom',
isSearch: true,
tableForm: {
disabled: true
},
table: {
width: 200
}
},
{
label: '包装号',
field: 'packageCode',
sort: 'custom',
isSearch: true,
tableForm: {
disabled: true
},
table: {
width: 200
}
},
{
label: '包装规格',
field: 'packageSpecificationCode',
sort: 'custom',
isSearch: true,
tableForm: {
disabled: true
},
table: {
width: 180
}
},
{
label: '数量',
field: 'amount',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
tableForm: {
disabled: true
},
table: {
width: 150
}
},
{
label: '计量单位',
field: 'measuringUnit',
sort: 'custom',
isSearch: true,
tableForm: {
disabled: true
},
table: {
width: 150
}
},
{
label: '采样数量',
field: 'sampleAmount',
sort: 'custom',
isSearch: true,
isTable: false,
table: {
width: 150
}
}
])
)
//表单校验
export const InspectionJobPackageRules = reactive({
sampleAmount: [required, { validator: validateSixNum, trigger: 'blur' }]
})
Loading…
Cancel
Save