Browse Source

质量通知

master_hella_20240701
zhang_li 7 months ago
parent
commit
910f859b65
  1. 27
      src/api/qms/qualityNotice/index.ts
  2. 2
      src/utils/dict.ts
  3. 293
      src/views/qms/qualityNotice/addForm.vue
  4. 81
      src/views/qms/qualityNotice/components/notaicType.vue
  5. 375
      src/views/qms/qualityNotice/components/qualityBatch.vue
  6. 46
      src/views/qms/qualityNotice/components/qualityNotice.vue
  7. 106
      src/views/qms/qualityNotice/index.vue
  8. 10
      src/views/qms/qualityNotice/qualityNoticeMain.data.ts

27
src/api/qms/qualityNotice/index.ts

@ -0,0 +1,27 @@
import request from '@/config/axios'
// 列表
export const qualityNoticePage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return request.post({ url: '/basic/quality-notice/senior', data })
} else {
return await request.get({ url: `/basic/quality-notice/page`, params })
}
}
// 新增
export const qualityNoticeCreat = async (data) => {
return await request.post({ url: `/basic/quality-notice/create`,data})
}
// 编辑
export const qualityNoticeUpdate = async (data) => {
return await request.put({ url: `/basic/quality-notice/update`,data})
}
// 删除
export const qualityNoticeDelete = async (id) => {
return await request.delete({ url: `/basic/quality-notice/delete?id=`+id})
}
// 详情
export const qualityNoticeDetail = async (id) => {
return await request.get({ url: `/basic/quality-notice/get?id=`+id})
}

2
src/utils/dict.ts

@ -303,6 +303,8 @@ export enum DICT_TYPE {
USAGE_DECISION = "usage_decision", // 使用决策 USAGE_DECISION = "usage_decision", // 使用决策
INSPECTION_BATCH_SOURCE = "inspection_batch_source", // 检验批来源 INSPECTION_BATCH_SOURCE = "inspection_batch_source", // 检验批来源
QUALITY_NOTIFICATION_TYPE = "quality_notification_type", // 质量通知类型 QUALITY_NOTIFICATION_TYPE = "quality_notification_type", // 质量通知类型
QUALITY_NOTICE_STATUS = "quality_notice_status", // 质量通知状态
QUALITY_TASK_STATUS = "quality_task_status", // 质量通知任务状态
// ========== 业务 - mes -gaojs ========== // ========== 业务 - mes -gaojs ==========
QUALIFY_STATUS = 'qualify_status',//质检状态 QUALIFY_STATUS = 'qualify_status',//质检状态

293
src/views/qms/qualityNotice/addForm.vue

@ -13,9 +13,9 @@
<el-step title="质量通知" /> <el-step title="质量通知" />
<el-step title="质量物料批次" /> <el-step title="质量物料批次" />
</el-steps> </el-steps>
<NotaicType v-show="active == 0" ref="notaicTypeFrom" /> <NotaicType v-show="active == 0" ref="notaicTypeFrom" :data='data' />
<qualityNotice v-show="active == 1" ref="qualityNoticeFrom" :type="notaicTypeFrom.type"/> <qualityNotice v-show="active == 1" ref="qualityNoticeFrom" :data='data' :type="notaicTypeFrom?.type||1"/>
<qualityBatch v-show="active == 2" ref="qualityBatchFrom" /> <qualityBatch v-show="active == 2" ref="qualityBatchFrom" :subListData='data.subList'/>
</div> </div>
<template #footer> <template #footer>
<el-button @click="prov" type="primary" v-if="active != 0">上一步</el-button> <el-button @click="prov" type="primary" v-if="active != 0">上一步</el-button>
@ -29,6 +29,7 @@
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { getCurrentInstance } from 'vue' import { getCurrentInstance } from 'vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as qualityNoticeApi from '@/api/qms/qualityNotice'
import NotaicType from './components/notaicType.vue' import NotaicType from './components/notaicType.vue'
import qualityNotice from './components/qualityNotice.vue' import qualityNotice from './components/qualityNotice.vue'
import qualityBatch from './components/qualityBatch.vue' import qualityBatch from './components/qualityBatch.vue'
@ -94,7 +95,7 @@ const props = defineProps({
}) })
const { t } = useI18n() // const { t } = useI18n() //
const dialogVisible = ref(true) // const dialogVisible = ref(false) //
const dialogTitle = ref('') // const dialogTitle = ref('') //
const formLoading = ref(false) // 12 const formLoading = ref(false) // 12
const formType = ref('') // create - update - const formType = ref('') // create - update -
@ -103,17 +104,7 @@ const formMainRef = ref()
const formFeaturesRef = ref() const formFeaturesRef = ref()
const data = ref({ const data = ref({
code: '', type:1,
itemCode: '',
version: '',
testTypeCode: '',
programmeTemplateCode: '',
splitRule: '',
aql: '',
inspectionLevel: '',
effectiveDate: '',
expirationDate: '',
available: 'TRUE',
subList: [] subList: []
}) })
const active = ref(0) const active = ref(0)
@ -137,7 +128,6 @@ const rules = ref({
}) })
/** 打开弹窗 */ /** 打开弹窗 */
let tabIndex = 1
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => { const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => {
if (titleName) { if (titleName) {
dialogTitle.value = t('action.' + titleName) dialogTitle.value = t('action.' + titleName)
@ -145,106 +135,21 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)
} }
formType.value = type formType.value = type
active.value =0
if (row) { if (row) {
data.value = JSON.parse(JSON.stringify(row)) data.value = JSON.parse(JSON.stringify(row))
data.value = await qualityNoticeApi.qualityNoticeDetail(row.id)
dialogVisible.value = true dialogVisible.value = true
nextTick(() => {
formMainRef.value.setValues(row)
})
} else { } else {
data.value = { data.value = {
code: '', type:1,
itemCode: '',
version: '',
testTypeCode: '',
programmeTemplateCode: '',
splitRule: '',
aql: '',
inspectionLevel: '',
effectiveDate: '',
expirationDate: '',
available: 'TRUE',
subList: [] subList: []
} }
} }
dialogVisible.value = true dialogVisible.value = true
tabIndex = data.value.subList.length + 1
} }
defineExpose({ open, dialogVisible, formLoading }) // open defineExpose({ open, dialogVisible, formLoading }) // open
import type { TabPaneName } from 'element-plus'
const editableTabsValue = ref('1')
// const editableTabs = ref([])
const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' | 'add') => {
if (action === 'add') {
nameForm.value.name = ''
dialogVisibleName.value = true
} else if (action === 'remove') {
const tabs = data.value.subList
let activeName = editableTabsValue.value
if (activeName === targetName) {
tabs.forEach((tab, index) => {
if (tab.name === targetName) {
const nextTab = tabs[index + 1] || tabs[index - 1]
if (nextTab) {
activeName = nextTab.name
}
}
})
}
editableTabsValue.value = activeName
data.value.subList = tabs.filter((tab) => tab.name !== targetName)
}
}
/** 修改名称时间 */
const buttonBaseClick1 = (val) => {
//
if (val == 'save') {
if (!nameRef.value) return
nameRef.value.validate((valid, fields) => {
if (valid) {
const newTabName = `${++tabIndex}`
data.value.subList.push({
description: nameForm.value.name,
name: newTabName,
inspectionCode: '',
sequenceCode: '',
inspectionCharCode: '',
inspectionJobCharacteristicsUpdateReqVO: {
describe: '',
inspectionMethodCode: '',
dynamicUpdateCode: '',
inspectionMethod: '',
isCanUpdate: '',
isDestructionInspection: '',
resultEntryMethod: '',
featureType: '',
quantifyIsCapping: '',
quantifyIsLowlimit: '',
quantifyIsTarget: '',
quantifyTarget: '',
quantifyCapping: '',
quantifyLowlimit: '',
quantifyUom: '',
quantifyDecimal: '',
quantifyQuantifyCode: ''
}
})
console.log(data.value.subList)
editableTabsValue.value = newTabName
dialogVisibleName.value = false
} else {
console.log('error submit!')
return false
}
})
}
//
else if (val == 'close') {
dialogVisibleName.value = false
}
}
const buttonBaseClick = (val) => { const buttonBaseClick = (val) => {
// //
if (val == 'save') { if (val == 'save') {
@ -255,6 +160,8 @@ const buttonBaseClick = (val) => {
dialogVisible.value = false dialogVisible.value = false
} }
} }
//
// //
const emit = defineEmits(['submitForm', 'searchTableSuccess']) const emit = defineEmits(['submitForm', 'searchTableSuccess'])
const validateForm = (formRef) => { const validateForm = (formRef) => {
@ -268,113 +175,42 @@ const validateForm = (formRef) => {
return false return false
}) })
} }
const tableFormRef = ref() const tableFormRef = ref()
const submitForm = async () => { const submitForm = async () => {
try { // qualityBatchFrom.value.qualityBatchFrom
console.log(data.value.subList) if(data.value.type == 1){
const elForm = unref(formMainRef)?.getElFormRef() data.value.q1 = notaicTypeFrom.value.q1
// delete data.value.q2
if (!elForm) return delete data.value.q3
const valid = await elForm.validate() }else if(data.value.type == 2){
if (!valid) return data.value.q2 = notaicTypeFrom.value.q2
// delete data.value.q1
delete data.value.q3
console.log(11, data.value.packageList) }else if(data.value.type == 3){
if (data.value.packageList?.length > 0) { data.value.q3 = notaicTypeFrom.value.q3
const validateForm1 = await tableFormRef.value.validateForm() delete data.value.q1
if (!validateForm1) return delete data.value.q2
let number = 0
data.value.packageList.forEach((cur) => {
number += parseFloat(cur.sampleAmount)
})
if (number != data.value.sampleTotalAmount) {
message.error(`采样数量之和不等于总数量`)
return
}
}
const bol2 = await validateForm(formFeaturesRef.value) }
if (!bol2) {
message.error(`模板中有检验工序和检验特性未填写完全`) console.log(data.value)
return data.value.subList = qualityBatchFrom.value.subList
} if(data.value.subList.length==0){
// message.error('请填写质量物料批次')
let arrBol = [] return;
let isOutweigh = [] // }
let numberList = [] // const validateForm1 = await validateForm(qualityBatchFrom.value.qualityBatchFrom)
data.value.subList.forEach((item, index) => { console.log(validateForm1)
if (item.inspectionJobCharacteristicsUpdateReqVO.resultEntryMethod == 1) { const isBol = data.value.subList.some(cur=>{
arrBol.push( return cur.packageList.length == 0 || cur.taskList.length == 0|| cur.defectList.length == 0
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some( })
(cur, key) => { if(isBol){
return !cur.qualifiedQuantity || !cur.unqualifiedQuantity message.error('物料批次中包装,任务,缺陷没有填写完全')
} return;
) }
) try {
}
// if (item.samplingProcessRespVO.evaluationMode == 1) {
// arrBol.push(
// item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some(
// (cur, key) => {
// return !cur.estimateCode
// }
// )
// )
// }
if (item.inspectionJobCharacteristicsUpdateReqVO.featureType == 0) {
arrBol.push(
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some(
(cur, key) => {
return !cur.inspectionValue
}
)
)
}
if (item.inspectionJobCharacteristicsUpdateReqVO.featureType == 1) {
arrBol.push(
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some(
(cur, key) => {
return !cur.qualitativeCode
}
)
)
}
//
if (
item.inspectionJobCharacteristicsUpdateReqVO.inspectionStartTime >
item.inspectionJobCharacteristicsUpdateReqVO.inspectionEndTime
) {
isOutweigh.push(item.inspectionJobCharacteristicsUpdateReqVO.inspectionStartTime)
}
//
if (item.inspectionJobCharacteristicsUpdateReqVO.resultEntryMethod == 1) {
numberList.push(
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some(
(cur, key) => {
return (
parseFloat(cur.qualifiedQuantity) + parseFloat(cur.unqualifiedQuantity) !=
data.value.sampleTotalAmount
)
}
)
)
}
})
let isEmpty1 = arrBol.some((item) => item == true)
let isEmptyNumberList = numberList.some((item) => item == true)
if (isEmpty1) {
message.error('检验工序和检验特性有字段未填写完全')
return
}
if (isOutweigh?.length > 0) {
message.error('检验特性中有开始时间大于结束时间')
return
}
console.log(44, numberList)
if (isEmptyNumberList) {
message.error('合格数量和不合格数量之和不等于总数量')
return
}
if (formType.value == 'create') { if (formType.value == 'create') {
// //
emit('submitForm', formType.value, data.value) emit('submitForm', formType.value, data.value)
@ -392,7 +228,6 @@ if (props.footButttondata) {
Butttondata = props.footButttondata Butttondata = props.footButttondata
} else { } else {
Butttondata = [ Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) // defaultButtons.formCloseBtn(null) //
] ]
} }
@ -522,15 +357,13 @@ const searchTableSuccess = async (formField, searchField, val, type, row) => {
// emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row) // emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row)
} }
//
const next = () => { const next = () => {
if (active.value == 2) return if (active.value == 2) return
if (active.value == 0) { if (active.value == 0) {
if (notaicTypeFrom.value.type == 1) { if (notaicTypeFrom.value.type == 1) {
notaicTypeFrom.value.formRef1.validate((valid) => { notaicTypeFrom.value.formRef1.validate((valid) => {
if (valid) { if (valid) {
console.log('submit!')
console.log(notaicTypeFrom.value.formRef1)
active.value++ active.value++
} else { } else {
console.log('error submit!') console.log('error submit!')
@ -540,19 +373,14 @@ const next = () => {
} else if (notaicTypeFrom.value.type == 2) { } else if (notaicTypeFrom.value.type == 2) {
notaicTypeFrom.value.formRef2.validate((valid) => { notaicTypeFrom.value.formRef2.validate((valid) => {
if (valid) { if (valid) {
console.log('submit!')
console.log(notaicTypeFrom.value.formRef1)
active.value++ active.value++
} else { } else {
console.log('error submit!')
return false return false
} }
}) })
} else if (notaicTypeFrom.value.type == 3) { } else if (notaicTypeFrom.value.type == 3) {
notaicTypeFrom.value.formRef3.validate((valid) => { notaicTypeFrom.value.formRef3.validate((valid) => {
if (valid) { if (valid) {
console.log('submit!')
console.log(notaicTypeFrom.value.formRef1)
active.value++ active.value++
} else { } else {
console.log('error submit!') console.log('error submit!')
@ -560,11 +388,25 @@ const next = () => {
} }
}) })
} }
console.log(notaicTypeFrom.value.form)
}else if (active.value == 1) { }else if (active.value == 1) {
qualityNoticeFrom.value.formRef.validate((valid) => { qualityNoticeFrom.value.formRef.validate((valid) => {
if (valid) { if (valid) {
console.log(qualityNoticeFrom.value.form) //
if (qualityNoticeFrom.value.form.requestStartTime > qualityNoticeFrom.value.form.requestEndTime) {
message.error('要求开始时间应小于要求结束时间')
return;
}
//
if (qualityNoticeFrom.value.form.whetherCausesMachineHalt) {
if (qualityNoticeFrom.value.form.machineHaltStartTime > qualityNoticeFrom.value.form.machineHaltEndTime) {
message.error('停机开始时间应小于停机结束时间')
return;
}
}
data.value = {
...data.value,
...qualityNoticeFrom.value.form
}
active.value++ active.value++
} else { } else {
console.log('error submit!') console.log('error submit!')
@ -578,6 +420,21 @@ const prov = () => {
if (active.value == 0) return if (active.value == 0) return
active.value-- active.value--
} }
watch(
() => active.value,
(val) => {
if(val == 2){
Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) //
]
}else{
Butttondata = [
defaultButtons.formCloseBtn(null) //
]
}
}
)
</script> </script>
<style scoped> <style scoped>
.small-title { .small-title {

81
src/views/qms/qualityNotice/components/notaicType.vue

@ -12,7 +12,7 @@
</div> </div>
<el-form <el-form
:model="form1" :model="q1"
label-width="120px" label-width="120px"
ref="formRef1" ref="formRef1"
v-show="type == 1" v-show="type == 1"
@ -22,38 +22,38 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="客户编码" prop="customerCode"> <el-form-item label="客户编码" prop="customerCode">
<el-input v-model="form1.customerCode" placeholder="请选择客户"/> <el-input v-model="q1.customerCode" placeholder="请选择客户"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="销售订单号" prop="soNumber"> <el-form-item label="销售订单号" prop="soNumber">
<el-input v-model="form1.soNumber" placeholder="请输入销售订单号"/> <el-input v-model="q1.soNumber" placeholder="请输入销售订单号"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="销售订单行" prop="soLine"> <el-form-item label="销售订单行" prop="soLine">
<el-input v-model="form1.soLine" placeholder="请输入销售订单号"/> <el-input v-model="q1.soLine" placeholder="请输入销售订单号"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="发货单号" prop="asnNumber"> <el-form-item label="发货单号" prop="asnNumber">
<el-input v-model="form1.asnNumber" placeholder="请输入发货单号"/> <el-input v-model="q1.asnNumber" placeholder="请输入发货单号"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="发货单行" prop="asnLine"> <el-form-item label="发货单行" prop="asnLine">
<el-input v-model="form1.asnLine" placeholder="请输入发货单行"/> <el-input v-model="q1.asnLine" placeholder="请输入发货单行"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="客户联系人" prop="customerContact"> <el-form-item label="客户联系人" prop="customerContact">
<el-input v-model="form1.customerContact" placeholder="请输入客户联系人"/> <el-input v-model="q1.customerContact" placeholder="请输入客户联系人"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-form <el-form
:model="form2" :model="q2"
label-width="120px" label-width="120px"
ref="formRef2" ref="formRef2"
:rules="rules2" :rules="rules2"
@ -63,38 +63,38 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="供应商编码" prop="supplierCode"> <el-form-item label="供应商编码" prop="supplierCode">
<el-input v-model="form2.supplierCode" placeholder="请选择供应商"/> <el-input v-model="q2.supplierCode" placeholder="请选择供应商"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="采购订单号" prop="poNumber"> <el-form-item label="采购订单号" prop="poNumber">
<el-input v-model="form2.poNumber" placeholder="请输入采购订单号"/> <el-input v-model="q2.poNumber" placeholder="请输入采购订单号"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="采购订单行" prop="poLine"> <el-form-item label="采购订单行" prop="poLine">
<el-input v-model="form2.poLine" placeholder="请输入采购订单行"/> <el-input v-model="q2.poLine" placeholder="请输入采购订单行"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="收货单号" prop="recordNumber"> <el-form-item label="收货单号" prop="recordNumber">
<el-input v-model="form2.recordNumber" placeholder="请输入收货单号"/> <el-input v-model="q2.recordNumber" placeholder="请输入收货单号"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="收货单行" prop="recordLine"> <el-form-item label="收货单行" prop="recordLine">
<el-input v-model="form2.recordLine" placeholder="请输入收货单行"/> <el-input v-model="q2.recordLine" placeholder="请输入收货单行"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="供应商联系人" prop="customerContact"> <el-form-item label="供应商联系人" prop="customerContact">
<el-input v-model="form2.customerContact" placeholder="请输入供应商联系人"/> <el-input v-model="q2.customerContact" placeholder="请输入供应商联系人"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-form <el-form
:model="form3" :model="q3"
label-width="120px" label-width="120px"
ref="formRef3" ref="formRef3"
:rules="rules3" :rules="rules3"
@ -104,37 +104,37 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="部门编码" prop="deptCode"> <el-form-item label="部门编码" prop="deptCode">
<el-input v-model="form3.deptCode" placeholder="请选择部门"/> <el-input v-model="q3.deptCode" placeholder="请选择部门"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="生产线编码" prop="productionLineCode"> <el-form-item label="生产线编码" prop="productionLineCode">
<el-input v-model="form3.productionLineCode" placeholder="请输入生产线编码"/> <el-input v-model="q3.productionLineCode" placeholder="请输入生产线编码"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="工作中心编码" prop="workCenterCode"> <el-form-item label="工作中心编码" prop="workCenterCode">
<el-input v-model="form3.workCenterCode" placeholder="请输入工作中心编码"/> <el-input v-model="q3.workCenterCode" placeholder="请输入工作中心编码"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="设备编码" prop="deviceCode"> <el-form-item label="设备编码" prop="deviceCode">
<el-input v-model="form3.deviceCode" placeholder="请输入设备编码"/> <el-input v-model="q3.deviceCode" placeholder="请输入设备编码"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="生产订单号" prop="woNumber"> <el-form-item label="生产订单号" prop="woNumber">
<el-input v-model="form3.woNumber" placeholder="请输入生产订单号"/> <el-input v-model="q3.woNumber" placeholder="请输入生产订单号"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="生产订单行" prop="woLine"> <el-form-item label="生产订单行" prop="woLine">
<el-input v-model="form3.woLine" placeholder="请输入收货单行"/> <el-input v-model="q3.woLine" placeholder="请输入收货单行"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="生产联系人" prop="woContact"> <el-form-item label="生产联系人" prop="woContact">
<el-input v-model="form3.woContact" placeholder="请输入生产联系人"/> <el-input v-model="q3.woContact" placeholder="请输入生产联系人"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -146,13 +146,26 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
const type = ref(1)// const type = ref(1)//
// //
const form1 = ref({}) const q1 = ref({})
const form2 = ref({}) const q2 = ref({})
const form3 = ref({}) const q3 = ref({})
const form = ref({}) // const form = ref(q1.value)
const formRef1 = ref() const formRef1 = ref()
const formRef2 = ref() const formRef2 = ref()
const formRef3 = ref() const formRef3 = ref()
const props = defineProps({
//
data: {
type: Object,
default: null
}
})
type.vlaue = props.data?.type ? props.data.type : 1
//
type.value = parseInt(props.data.type)
q1.value = props.data?.q1 ? props.data?.q1 :{}
q2.value = props.data?.q2 ? props.data?.q2 :{}
q3.value = props.data?.q3 ? props.data?.q3 :{}
// //
const rules1 =ref({ const rules1 =ref({
customerCode: [required], customerCode: [required],
@ -167,15 +180,15 @@ const rules3 =ref({
woContact: [required], woContact: [required],
}) })
const changeType =(e)=>{ const changeType =(e)=>{
if(e == 1){ // if(e == 1){
form.value = form1.value // form.value = q1.value
}else if(e == 2){ // }else if(e == 2){
form.value = form2.value // form.value = form2.value
}else if(e == 2){ // }else if(e == 3){
form.value = form3.value // form.value = form3.value
} // }
} }
defineExpose({type,formRef1,formRef2,formRef3,form}) defineExpose({type,formRef1,formRef2,formRef3,q1,q2,q3})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.content{ .content{

375
src/views/qms/qualityNotice/components/qualityBatch.vue

@ -10,21 +10,21 @@
:stretch="false" :stretch="false"
> >
<el-tab-pane <el-tab-pane
v-for="item in data.process" v-for="item in subList"
:key="item.name" :key="item.name"
:label="item.description" :label="item.sequenceCode"
:name="item.name" :name="item.name"
> >
<el-form :model="item" label-width="auto" :rules="qualityBatchRules" ref="qualityBatchFormRef"> <el-form :model="item" label-width="auto" :rules="qualityBatchRules" ref="qualityBatchFormRef">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <!-- <el-col :span="12">
<el-form-item label="质量通知单号" prop="qualityNoticeNumber"> <el-form-item label="质量通知单号" prop="qualityNoticeNumber">
<el-input v-model="item.qualityNoticeNumber" placeholder="请输入质量通知单号" /> <el-input v-model="item.qualityNoticeNumber" placeholder="请输入质量通知单号" />
</el-form-item> </el-form-item>
</el-col> </el-col> -->
<el-col :span="12"> <el-col :span="12">
<el-form-item label="顺序号" prop="sequenceCode"> <el-form-item label="顺序号" prop="sequenceCode">
<el-input v-model="item.sequenceCode" placeholder="请输入顺序号" /> <el-input v-model="item.sequenceCode" placeholder="请输入顺序号" type="number" disabled/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -49,7 +49,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="总数量" prop="totalAmount"> <el-form-item label="总数量" prop="totalAmount">
<el-input v-model="item.totalAmount" placeholder="请输入总数量" /> <el-input v-model="item.totalAmount" placeholder="请输入总数量" type="number"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -61,24 +61,34 @@
</el-form> </el-form>
<div class="title-btn"> <div class="title-btn">
<div class="title">质量通知包装</div> <div class="title">质量通知包装</div>
<el-button type="primary" plain @click="handleAdd('package')">添加包装</el-button> <el-button type="primary" plain @click="handleAdd('package',item)">添加包装</el-button>
</div> </div>
<el-table :data="tableData" style="width: 100%" border> <el-table :data="item.packageList" style="width: 100%" border>
<el-table-column prop="qualityNoticeNumber" label="质量通知单号" align="center"/> <!-- <el-table-column prop="qualityNoticeNumber" label="质量通知单号" align="center"/>-->
<el-table-column prop="packageCode" label="包装编码" align="center"/> <el-table-column label="" width="60" align="center">
<el-table-column prop="sequenceCode" label="顺序号" align="center"/> <template #default="scope">
<el-table-column prop="amount" label="数量" align="center"/> <Icon icon="ep:remove" @click="det(scope.$index,item.packageList)" size='24' style="cursor: pointer;"/>
</template>
</el-table-column>
<el-table-column prop="packageCode" label="包装编码" align="center"/>
<el-table-column prop="sequenceCode" label="顺序号" align="center" type="number"/>
<el-table-column prop="amount" label="数量" align="center" type="number"/>
<el-table-column prop="uom" label="计量单位" align="center"/> <el-table-column prop="uom" label="计量单位" align="center"/>
<el-table-column prop="packUnit" label="包装规格" align="center"/> <el-table-column prop="packUnit" label="包装规格" align="center"/>
</el-table> </el-table>
<div class="title-btn"> <div class="title-btn">
<div class="title">质量通知任务</div> <div class="title">质量通知任务</div>
<el-button type="primary" plain @click="handleAdd('task')">添加任务</el-button> <el-button type="primary" plain @click="handleAdd('task',item)">添加任务</el-button>
</div> </div>
<el-table :data="tableData" style="width: 100%" border> <el-table :data="item.taskList" style="width: 100%" border>
<el-table-column prop="qualityNoticeNumber" label="质量通知单号" align="center" width="150"/> <!-- <el-table-column prop="qualityNoticeNumber" label="质量通知单号" align="center" width="150"/>
<el-table-column prop="code" label="编码" align="center" width="150"/> <el-table-column prop="code" label="编码" align="center" width="150"/> -->
<el-table-column prop="sequenceCode" label="顺序号" align="center" width="150"/> <el-table-column label="" width="60" align="center">
<template #default="scope">
<Icon icon="ep:remove" @click="det(scope.$index,item.taskList)" size='24' style="cursor: pointer;"/>
</template>
</el-table-column>
<el-table-column prop="sequenceCode" label="顺序号" align="center" width="150" type="number"/>
<el-table-column prop="status" label="状态" align="center" width="150"/> <el-table-column prop="status" label="状态" align="center" width="150"/>
<el-table-column prop="type" label="类型" align="center" width="150"/> <el-table-column prop="type" label="类型" align="center" width="150"/>
<el-table-column prop="taskGroupCode" label="任务代码组" align="center" width="150"/> <el-table-column prop="taskGroupCode" label="任务代码组" align="center" width="150"/>
@ -94,14 +104,19 @@
</el-table> </el-table>
<div class="title-btn"> <div class="title-btn">
<div class="title">质量通知缺陷</div> <div class="title">质量通知缺陷</div>
<el-button type="primary" plain @click="handleAdd('defect')">添加缺陷</el-button> <el-button type="primary" plain @click="handleAdd('defect',item)">添加缺陷</el-button>
</div> </div>
<el-table :data="tableData" style="width: 100%" border> <el-table :data="item.defectList" style="width: 100%" border>
<el-table-column prop="qualityNoticeNumber" label="质量通知单号" align="center" width="150"/> <el-table-column label="" width="60" align="center">
<el-table-column prop="sequenceCode" label="顺序号" align="center" width="150"/> <template #default="scope">
<Icon icon="ep:remove" @click="det(scope.$index,item.defectList)" size='24' style="cursor: pointer;"/>
</template>
</el-table-column>
<!-- <el-table-column prop="qualityNoticeNumber" label="质量通知单号" align="center" width="150"/> -->
<el-table-column prop="sequenceCode" label="顺序号" align="center" width="150" type="number"/>
<el-table-column prop="defectLocationCodeGroup" label="缺陷位置代码组" align="center" width="150"/> <el-table-column prop="defectLocationCodeGroup" label="缺陷位置代码组" align="center" width="150"/>
<el-table-column prop="defectLocationCode" label="缺陷位置代码" align="center" width="150"/> <el-table-column prop="defectLocationCode" label="缺陷位置代码" align="center" width="150"/>
<el-table-column prop="defecTypeCodeGroup" label="缺陷类型代码组" align="center" width="150"/> <el-table-column prop="defectTypeCodeGroup" label="缺陷类型代码组" align="center" width="150"/>
<el-table-column prop="defectTypeCode" label="缺陷类型代码" align="center" width="150"/> <el-table-column prop="defectTypeCode" label="缺陷类型代码" align="center" width="150"/>
<el-table-column prop="defectDesc" label="缺陷描述" align="center" width="150"/> <el-table-column prop="defectDesc" label="缺陷描述" align="center" width="150"/>
<el-table-column prop="defectSonItemCode" label="缺陷子物料代码" align="center" width="150"/> <el-table-column prop="defectSonItemCode" label="缺陷子物料代码" align="center" width="150"/>
@ -125,11 +140,11 @@
<!-- 包装弹窗 --> <!-- 包装弹窗 -->
<el-form ref="packageFormRef" label-width="100px" :model="packageForm" :rules="packageRules" v-if="source == 'package'"> <el-form ref="packageFormRef" label-width="100px" :model="packageForm" :rules="packageRules" v-if="source == 'package'">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <!-- <el-col :span="12">
<el-form-item prop="qualityNoticeNumber" label="质量通知单号" > <el-form-item prop="qualityNoticeNumber" label="质量通知单号" >
<el-input v-model="packageForm.qualityNoticeNumber" placeholder="请输入包装编码" /> <el-input v-model="packageForm.qualityNoticeNumber" placeholder="请输入包装编码" />
</el-form-item> </el-form-item>
</el-col> </el-col>-->
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="packageCode" label="包装编码" > <el-form-item prop="packageCode" label="包装编码" >
<el-input v-model="packageForm.packageCode" placeholder="请输入包装编码" /> <el-input v-model="packageForm.packageCode" placeholder="请输入包装编码" />
@ -137,179 +152,187 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="sequenceCode" label="顺序号" > <el-form-item prop="sequenceCode" label="顺序号" >
<el-input v-model="packageForm.sequenceCode" placeholder="请输入包装编码" /> <el-input v-model="packageForm.sequenceCode" placeholder="请输入顺序号" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="amount" label="数量" > <el-form-item prop="amount" label="数量" >
<el-input v-model="packageForm.amount" placeholder="请输入包装编码" /> <el-input v-model="packageForm.amount" placeholder="请输入数量" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="uom" label="计量单位" > <el-form-item prop="uom" label="计量单位" >
<el-input v-model="packageForm.uom" placeholder="请输入包装编码" /> <el-input v-model="packageForm.uom" placeholder="请输入计量单位" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="packUnit" label="包装规格" > <el-form-item prop="packUnit" label="包装规格" >
<el-input v-model="packageForm.packUnit" placeholder="请输入包装编码" /> <el-input v-model="packageForm.packUnit" placeholder="请输入包装规格" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<!-- 任务弹窗 --> <!-- 任务弹窗 -->
<el-form ref="taskFormRef" label-width="100px" :model="taskForm" :rules="taskRules" v-else-if="source == 'task'"> <el-form ref="taskFormRef" label-width="120px" :model="taskForm" :rules="taskRules" v-else-if="source == 'task'">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <!-- <el-col :span="12">
<el-form-item prop="qualityNoticeNumber" label="质量通知单号" > <el-form-item prop="qualityNoticeNumber" label="质量通知单号" >
<el-input v-model="taskFormRef.qualityNoticeNumber" placeholder="请输入包装编码" /> <el-input v-model="taskFormRef.qualityNoticeNumber" placeholder="请输入质量通知单号" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="code" label="编码" > <el-form-item prop="code" label="包装编码" >
<el-input v-model="taskFormRef.code" placeholder="请输入包装编码" /> <el-input v-model="taskFormRef.code" placeholder="请输入包装编码" />
</el-form-item> </el-form-item>
</el-col> </el-col>-->
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="sequenceCode" label="顺序号" > <el-form-item prop="sequenceCode" label="顺序号" >
<el-input v-model="taskFormRef.sequenceCode" placeholder="请输入顺序号" /> <el-input v-model="taskForm.sequenceCode" placeholder="请输入顺序号" type="number"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="status" label="状态" > <el-form-item prop="status" label="状态" >
<el-input v-model="taskFormRef.status" placeholder="请输入状态" /> <!-- <el-input v-model="taskForm.status" placeholder="请输入状态" /> -->
<el-select v-model="taskForm.status" placeholder="请选择状态">
<el-option v-for="item in getIntDictOptions(DICT_TYPE.QUALITY_TASK_STATUS)" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="type" label="类型" > <el-form-item prop="type" label="类型" >
<el-input v-model="taskFormRef.type" placeholder="请输入类型" /> <el-input v-model="taskForm.type" placeholder="请输入类型" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="taskGroupCode" label="任务代码组" > <el-form-item prop="taskGroupCode" label="任务代码组" >
<el-input v-model="taskFormRef.taskGroupCode" placeholder="请输入任务代码组" /> <el-input v-model="taskForm.taskGroupCode" placeholder="请输入任务代码组" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="taskCode" label="任务代码" > <el-form-item prop="taskCode" label="任务代码" >
<el-input v-model="taskFormRef.taskCode" placeholder="请输入任务代码" /> <el-input v-model="taskForm.taskCode" placeholder="请输入任务代码" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="taskDesc" label="任务描述" > <el-form-item prop="taskDesc" label="任务描述" >
<el-input v-model="taskFormRef.taskDesc" placeholder="请输入任务描述" /> <el-input v-model="taskForm.taskDesc" placeholder="请输入任务描述" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="taskDetail" label="任务详情" > <el-form-item prop="taskDetail" label="任务详情" >
<el-input v-model="taskFormRef.taskDetail" placeholder="请输入任务详情" /> <el-input v-model="taskForm.taskDetail" placeholder="请输入任务详情" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="leaderType" label="负责人类型" > <el-form-item prop="leaderType" label="负责人类型" >
<el-input v-model="taskFormRef.leaderType" placeholder="请输入负责人类型" /> <el-input v-model="taskForm.leaderType" placeholder="请输入负责人类型" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="leader" label="负责人" > <el-form-item prop="leader" label="负责人" >
<el-input v-model="taskFormRef.leader" placeholder="请输入负责人" /> <el-input v-model="taskForm.leader" placeholder="请输入负责人" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="planStartTime" label="计划开始时间" > <el-form-item prop="planStartTime" label="计划开始时间" >
<el-input v-model="taskFormRef.planStartTime" placeholder="请选择计划开始时间" /> <el-date-picker v-model="taskForm.planStartTime" type="datetime" placeholder="请选择计划开始时间" style="width: 100%;" value-format="x"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="planEndTime" label="计划结束时间" > <el-form-item prop="planEndTime" label="计划结束时间" >
<el-input v-model="taskFormRef.planEndTime" placeholder="请选择计划结束时间" /> <el-date-picker v-model="taskForm.planEndTime" type="datetime" placeholder="请选择计划结束时间" style="width: 100%;" value-format="x"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="finishTime" label="完成时间" > <el-form-item prop="finishTime" label="完成时间" >
<el-input v-model="taskFormRef.finishTime" placeholder="请输入完成时间" /> <el-date-picker v-model="taskForm.finishTime" type="datetime" placeholder="请输入完成时间" style="width: 100%;" value-format="x"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="finishNumber" label="完成单据号" > <el-form-item prop="finishNumber" label="完成单据号" >
<el-input v-model="taskFormRef.finishNumber" placeholder="请输入完成单据号" /> <el-input v-model="taskForm.finishNumber" placeholder="请输入完成单据号" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<!-- 缺陷弹窗 --> <!-- 缺陷弹窗 -->
<el-form ref="defectFormRef" label-width="100px" :model="defectForm" :rules="defectRules" v-else-if="source == 'defect'"> <el-form ref="defectFormRef" label-width="140px" :model="defectForm" :rules="defectRules" v-else-if="source == 'defect'">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <!-- <el-col :span="12">
<el-form-item prop="qualityNoticeNumber" label="质量通知单号" > <el-form-item prop="qualityNoticeNumber" label="质量通知单号" >
<el-input v-model="defectFormRef.qualityNoticeNumber" placeholder="请输入包装编码" /> <el-input v-model="defectForm.qualityNoticeNumber" placeholder="请输入包装编码" />
</el-form-item> </el-form-item>
</el-col> </el-col> -->
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="sequenceCode" label="顺序号" > <el-form-item prop="sequenceCode" label="顺序号" >
<el-input v-model="defectFormRef.sequenceCode" placeholder="请输入顺序号" /> <el-input v-model="defectForm.sequenceCode" placeholder="请输入顺序号" type="number"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="defectLocationCodeGroup" label="缺陷位置代码组" > <el-form-item prop="defectLocationCodeGroup" label="缺陷位置代码组" >
<el-input v-model="defectFormRef.defectLocationCodeGroup" placeholder="请输入缺陷位置代码组" /> <el-input v-model="defectForm.defectLocationCodeGroup" placeholder="请输入缺陷位置代码组" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="defectLocationCode" label="缺陷位置代码" > <el-form-item prop="defectLocationCode" label="缺陷位置代码" >
<el-input v-model="defectFormRef.defectLocationCode" placeholder="请输入缺陷位置代码" /> <el-input v-model="defectForm.defectLocationCode" placeholder="请输入缺陷位置代码" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="defecTypeCodeGroup" label="缺陷类型代码组" > <el-form-item prop="defectTypeCodeGroup" label="缺陷类型代码组" >
<el-input v-model="defectFormRef.defecTypeCodeGroup" placeholder="请输入缺陷类型代码组" /> <el-input v-model="defectForm.defectTypeCodeGroup" placeholder="请输入缺陷类型代码组" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="defectTypeCode" label="缺陷类型代码" >
<el-input v-model="defectForm.defectTypeCode" placeholder="请输入缺陷类型代码" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="defectDesc" label="缺陷描述" > <el-form-item prop="defectDesc" label="缺陷描述" >
<el-input v-model="defectFormRef.defectDesc" placeholder="请输入缺陷描述" /> <el-input v-model="defectForm.defectDesc" placeholder="请输入缺陷描述" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="defectSonItemCode" label="缺陷子物料代码" > <el-form-item prop="defectSonItemCode" label="缺陷子物料代码" >
<el-input v-model="defectFormRef.defectSonItemCode" placeholder="请输入缺陷子物料代码" /> <el-input v-model="defectForm.defectSonItemCode" placeholder="请输入缺陷子物料代码" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="defectCount" label="缺陷数量" > <el-form-item prop="defectCount" label="缺陷数量" >
<el-input v-model="defectFormRef.defectCount" placeholder="请输入缺陷数量" /> <el-input v-model="defectForm.defectCount" placeholder="请输入缺陷数量" type="number"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="defectLevel" label="缺陷级别" > <el-form-item prop="defectLevel" label="缺陷级别" >
<el-input v-model="defectFormRef.defectLevel" placeholder="请输入缺陷级别" /> <el-input v-model="defectForm.defectLevel" placeholder="请输入缺陷级别" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="sampleNumber" label="样本编号" > <el-form-item prop="sampleNumber" label="样本编号" >
<el-input v-model="defectFormRef.sampleNumber" placeholder="请输入样本编号" /> <el-input v-model="defectForm.sampleNumber" placeholder="请输入样本编号" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="inspectionRecordNumber" label="检验记录编号" > <el-form-item prop="inspectionRecordNumber" label="检验记录编号" >
<el-input v-model="defectFormRef.inspectionRecordNumber" placeholder="请输入检验记录编号" /> <el-input v-model="defectForm.inspectionRecordNumber" placeholder="请输入检验记录编号" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="reasonCodeGroup" label="原因代码组" > <el-form-item prop="reasonCodeGroup" label="原因代码组" >
<el-input v-model="defectFormRef.reasonCodeGroup" placeholder="请输入原因代码组" /> <el-input v-model="defectForm.reasonCodeGroup" placeholder="请输入原因代码组" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="reasonCodeGroup" label="原因代码" > <el-form-item prop="reasonCode" label="原因代码" >
<el-input v-model="defectFormRef.reasonCodeGroup" placeholder="请输入原因代码" /> <el-input v-model="defectForm.reasonCode" placeholder="请输入原因代码" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item prop="reasonDesc" label="原因描述" > <el-form-item prop="reasonDesc" label="原因描述" >
<el-input v-model="defectFormRef.reasonDesc" placeholder="请输入原因描述" /> <el-input v-model="defectForm.reasonDesc" placeholder="请输入原因描述" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -330,38 +353,119 @@
<script setup lang="ts"> <script setup lang="ts">
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { validateInteger,validateTwoNum } from '@/utils/validator'
const message = useMessage() //
const props = defineProps({
//
subListData: {
type: Array,
default: null
}
})
const editableTabsValue = ref('1') const editableTabsValue = ref('1')
const dialogVisible = ref(false)// const dialogVisible = ref(false)//
const dialogTitle = ref('')// const dialogTitle = ref('')//
const nameRef = ref(false) const nameRef = ref(false)
// //
const qualityBatchFormRef = ref() const qualityBatchFormRef = ref(null)
const qualityBatchRules = ref({}) const qualityBatchRules = ref({
sequenceCode: [
required,
{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}
],
itemCode: [required],
batch: [required],
totalAmount: [
required,
{ validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}
],
uom: [required],
})
const nameForm = ref({ const nameForm = ref({
name: '' name: ''
})// })//
const data = ref({ const subList = ref([])
process:[] //
nextTick(()=>{
subList.value =props.subListData
subList.value.forEach((item,index)=>{
editableTabsValue.value = index + 1
item.name = index + 1
})
}) })
// //
const packageFormRef = ref() const packageFormRef = ref()
const packageRules = ref({}) const packageRules = ref({
const packageForm = ref({ sequenceCode: [
packageCode:'' required,
{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}
],
packageCode: [required],
amount: [
required,
{ validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}
],
uom: [required],
}) })
const packageForm = ref({})
// //
const taskFormRef = ref() const taskFormRef = ref()
const taskRules = ref({}) const taskRules = ref({
const taskForm = ref() sequenceCode: [
required,
{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}
],
status: [required],
type: [required],
taskGroupCode: [required],
taskCode: [required],
leaderType: [required],
leader: [required],
planStartTime: [required],
planEndTime: [required],
})
const taskForm = ref({})
// //
const defectFormRef = ref() const defectFormRef = ref()
const defectRules = ref({}) const defectRules = ref({
const defectForm = ref() sequenceCode: [
required,
{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}
],
defectLocationCodeGroup: [required],
defectLocationCode: [required],
defectTypeCodeGroup: [required],
defectTypeCode: [required],
defectCount: [
required,
{ validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}
],
defectLevel: [required],
reasonCodeGroup: [required],
reasonCode: [required],
})
const defectForm = ref({})
const source = ref('')// const source = ref('')//
const sourceItem = ref('')//
const tableData = ref([]) const tableData = ref([])
//
const itemBatch = ref({
itemCode:'',
batch:'',
inspectionBatch:'',
itemDesc:'',
totalAmount:'',
uom:'',
packageList:[],
taskList:[],
defectList:[],
})
/** 弹窗按钮 */ /** 弹窗按钮 */
let Butttondata: any = [] let Butttondata: any = []
Butttondata = [ Butttondata = [
@ -372,10 +476,11 @@ Butttondata = [
const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' | 'add') => { const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' | 'add') => {
if (action === 'add') { if (action === 'add') {
nameForm.value.name = '' nameForm.value.name = ''
source.value = ''
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = '添加物料批次名称' dialogTitle.value = '添加物料批次名称'
} else if (action === 'remove') { } else if (action === 'remove') {
const tabs = data.value.process const tabs =subList.value
let activeName = editableTabsValue.value let activeName = editableTabsValue.value
if (activeName === targetName) { if (activeName === targetName) {
tabs.forEach((tab, index) => { tabs.forEach((tab, index) => {
@ -388,18 +493,22 @@ const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' |
}) })
} }
editableTabsValue.value = activeName editableTabsValue.value = activeName
data.value.process = tabs.filter((tab) => tab.name !== targetName) subList.value = tabs.filter((tab) => tab.name !== targetName)
} }
} }
// //
const handleAdd=(sourceArg)=>{ const handleAdd=(sourceArg,item)=>{
source.value = sourceArg source.value = sourceArg
sourceItem.value = item
if(sourceArg == 'package'){ if(sourceArg == 'package'){
dialogTitle.value = '添加包装' dialogTitle.value = '添加包装'
packageForm.value = {}
}else if(sourceArg == 'task'){ }else if(sourceArg == 'task'){
dialogTitle.value = '添加任务' dialogTitle.value = '添加任务'
}else if(sourceArg == 'defec'){ taskForm.value = {}
}else if(sourceArg == 'defect'){
dialogTitle.value = '添加缺陷' dialogTitle.value = '添加缺陷'
defectForm.value = {}
} }
dialogVisible.value = true dialogVisible.value = true
} }
@ -408,35 +517,86 @@ let tabIndex = 1
const buttonBaseClick1 = (val) => { const buttonBaseClick1 = (val) => {
// //
if (val == 'save') { if (val == 'save') {
//
if(source.value == 'package'){
packageFormRef.value.validate((valid, fields) => {
if (valid) {
for(let i =0;i<subList.value.length;i++){
if(subList.value[i].sequenceCode == sourceItem.value.sequenceCode){
const isRepeat = subList.value[i].packageList.some(cur=>cur.sequenceCode==packageForm.value.sequenceCode)
if(isRepeat){
message.error('列表中已存在该顺序号')
return;
}
subList.value[i].packageList.push(packageForm.value)
}
}
dialogVisible.value = false
} else {
console.log('error submit!')
return false
}
})
}else if(source.value == 'task'){
taskFormRef.value.validate((valid, fields) => {
if (valid) {
if (taskForm.value.planStartTime > taskForm.value.planEndTime) {
message.error('计划开始时间应小于计划结束时间')
return;
}
for(let i =0;i<subList.value.length;i++){
if(subList.value[i].sequenceCode == sourceItem.value.sequenceCode){
// if(data.value.subList[i].packageList)
const isRepeat = subList.value[i].taskList.some(cur=>cur.sequenceCode==taskForm.value.sequenceCode)
if(isRepeat){
message.error('列表中已存在该顺序号')
return;
}
subList.value[i].taskList.push(taskForm.value)
}
}
dialogVisible.value = false
} else {
console.log('error submit!')
return false
}
})
}else if(source.value == 'defect'){
defectFormRef.value.validate((valid, fields) => {
if (valid) {
for(let i =0;i<subList.value.length;i++){
if(subList.value[i].sequenceCode == sourceItem.value.sequenceCode){
// if(data.value.subList[i].packageList)
const isRepeat = subList.value[i].defectList.some(cur=>cur.sequenceCode==defectForm.value.sequenceCode)
if(isRepeat){
message.error('列表中已存在该顺序号')
return;
}
subList.value[i].defectList.push(defectForm.value)
}
}
dialogVisible.value = false
} else {
console.log('error submit!')
return false
}
})
}
if (!nameRef.value) return if (!nameRef.value) return
nameRef.value.validate((valid, fields) => { nameRef.value.validate((valid, fields) => {
if (valid) { if (valid) {
console.log(subList.value)
console.log(nameForm.value.name)
const isRepeat = subList.value.some(item=>item.sequenceCode == nameForm.value.name)
if(isRepeat){
message.error('列表中已存在该顺序号')
return;
}
const newTabName = `${++tabIndex}` const newTabName = `${++tabIndex}`
data.value.process.push({ subList.value.push({
description: nameForm.value.name, sequenceCode: nameForm.value.name,
name: newTabName, name: newTabName,
inspectionCode: '', ...itemBatch.value
dynamicUpdateCode:'',
sequenceCode: '',
inspectionCharCode: '',
inspectionCharacteristicsBaseVO: {
describe: '',
inspectionMethodCode: '',
samplingProcessCode: '',
isCanUpdate: '',
isDestructionInspection: '',
resultEntryMethod: '',
featureType: '',
quantifyIsCapping: false,
quantifyIsLowlimit: false,
quantifyIsTarget: false,
quantifyTarget: '',
quantifyCapping: '',
quantifyLowlimit: '',
quantifyUom: '',
quantifyDecimal: '',
quantifyQuantifyCode: ''
}
}) })
editableTabsValue.value = newTabName editableTabsValue.value = newTabName
@ -452,6 +612,11 @@ const buttonBaseClick1 = (val) => {
dialogVisible.value = false dialogVisible.value = false
} }
} }
//
const det = (index,array)=>{
array.splice(index,1)
}
defineExpose({qualityBatchFormRef, subList})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.content { .content {

46
src/views/qms/qualityNotice/components/qualityNotice.vue

@ -8,11 +8,11 @@
> >
<!-- 质量通知表单 --> <!-- 质量通知表单 -->
<el-row :gutter="20"> <el-row :gutter="20">
<!-- <el-col :span="12"> <el-col :span="12" v-if="form.number">
<el-form-item label="编码" prop="number"> <el-form-item label="编码" prop="number">
<el-input v-model="form.number" placeholder="请选择编码"/> <el-input v-model="form.number" placeholder="请选择编码" disabled/>
</el-form-item> </el-form-item>
</el-col> --> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="类型" prop="type"> <el-form-item label="类型" prop="type">
<!-- <el-input v-model="form.type" placeholder="请选择类型"/> --> <!-- <el-input v-model="form.type" placeholder="请选择类型"/> -->
@ -38,7 +38,10 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-input v-model="form.status" placeholder="请选择状态"/> <!-- <el-input v-model="form.status" placeholder="请选择状态"/> -->
<el-select v-model="form.status" placeholder="请选择状态">
<el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -108,7 +111,7 @@ const form = ref({
detail:'', detail:'',
type:1, type:1,
priority:0, priority:0,
status:'', status:1,
reporter:'', reporter:'',
reportTime:'', reportTime:'',
requestStartTime:"", requestStartTime:"",
@ -136,22 +139,39 @@ const rules = ref({
}) })
const props = defineProps({ const props = defineProps({
// //
type: { type: {
type: Number, type: Number,
default: 0 default: 0
},
//
data: {
type: Object,
default: null
}
})
const statusList = ref()
//
nextTick(()=>{
form.value = props.data ? props.data: {}
if(form.value.number){
statusList.value = getIntDictOptions(DICT_TYPE.QUALITY_NOTICE_STATUS)
}else{
statusList.value =getIntDictOptions(DICT_TYPE.QUALITY_NOTICE_STATUS).filter(item=>item.value == 1)
} }
form.value.status = parseInt(form.value.status)
}) })
// //
const changeHalt= (e)=>{ const changeHalt= (e)=>{
console.log(rules.value.machineHaltStartTime[0]) console.log(rules.value.machineHaltStartTime[0])
if(e){ if(e){
rules.value.machineHaltStartTime[0].required = true rules.value.machineHaltStartTime[0].required = true
rules.value.machineHaltEndTime[0].required = true rules.value.machineHaltEndTime[0].required = true
}else{ }else{
rules.value.machineHaltStartTime[0].required = false rules.value.machineHaltStartTime[0].required = false
rules.value.machineHaltEndTime[0].required = false rules.value.machineHaltEndTime[0].required = false
} }
} }
watch( watch(
() => props.type, () => props.type,

106
src/views/qms/qualityNotice/index.vue

@ -51,8 +51,7 @@
import download from '@/utils/download' import download from '@/utils/download'
import { QualityNoticeMain} from './qualityNoticeMain.data' import { QualityNoticeMain} from './qualityNoticeMain.data'
import * as InspectionJobMainApi from '@/api/qms/inspectionJob/inspectionJobMain' import * as qualityNoticeApi from '@/api/qms/qualityNotice'
import * as InspectionJobDetailApi from '@/api/qms/inspectionJob/inspectionJobDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import ListTable from '@/components/ListTable/src/ListTable.vue' import ListTable from '@/components/ListTable/src/ListTable.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
@ -111,7 +110,7 @@
// //
const Echo = [] const Echo = []
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: InspectionJobMainApi.getInspectionJobMainPage // getListApi: qualityNoticeApi.qualityNoticePage //
}) })
// //
@ -149,40 +148,32 @@
return true return true
} }
} }
// - // -
const butttondata = (row) => { const butttondata = (row) => {
return [ return [
defaultButtons.mainListJobAccBtn({hide:isShowMainButton(row,['1']),hasPermi:'qms:inspection-job-main:accept'}), // defaultButtons.mainListEditBtn({hasPermi:'qms:quality-notice:edit'}), //
defaultButtons.mainListJobCloBtn({hide:isShowMainButton(row,['1']),hasPermi:'qms:inspection-job-main:close'}), // // defaultButtons.mainListEditBtn({hasPermi:'qms:quality-notice:delete'}), //
defaultButtons.mainListJobAbaBtn({hide:isShowMainButton(row,['2']),hasPermi:'qms:inspection-job-main:abandon'}), // defaultButtons.mainListOrderPubBtn({ hide: isShowMainButton(row,'pub'),hasPermi:'qms:quality-notice:pub'}), //
defaultButtons.mainListJobExeBtn({hide:isShowMainButton(row,['2']),hasPermi:'qms:inspection-job-main:execute'}), // // defaultButtons.mainListJobCloBtn({hide:isShowMainButton(row,['1']),hasPermi:'qms:inspection-job-main:close'}), //
defaultButtons.mainListPackageBtn(null), // // 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.mainListPackageBtn(null), //
] ]
} }
const listTableRef = ref() const listTableRef = ref()
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'mainJobExe') { // if (val == 'edit') { //
execute('execute', row) openForm('update', row)
}else if (val == 'mainPackage') { // } else if (val == 'delete') { //
const list = await InspectionJobMainApi.getInspectionJobPackageList(row.id) handleDelete(row.id)
listTableRef.value.openPackage(row,'包装信息',QualityNoticeMain.allSchemas.tableColumns,list) } else if(val == 'agree'){
}else if (val == 'mainJobAba') { // handleAgree(row.id)
console.log('列表-操作按钮事件-放弃')
handleAbandon(row.id)
} else if (val == 'mainJobClo') { //
handleClose(row.id)
} else if (val == 'mainJobAcc') { //
console.log('列表-操作按钮事件-承接')
handleAccept(row.id)
} }
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()
const openForm = async (type : string, row ?: number) => { const openForm = async (type : string, row ?: number) => {
tableData.value = [] //
formRef.value.open(type, row) formRef.value.open(type, row)
} }
@ -192,75 +183,17 @@ const listTableRef = ref()
detailRef.value.openDetail(row, titleName, titleValue, 'basicInspectionJobMain') detailRef.value.openDetail(row, titleName, titleValue, 'basicInspectionJobMain')
} }
/** 关闭按钮操作 */
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 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 tableData = ref([])
// //
const submitForm = async (formType, data) => { const submitForm = async (formType, data) => {
console.log(data) console.log(data)
// return // return
try { try {
if (formType === 'create') { if (formType === 'create') {
await InspectionJobMainApi.createInspectionJobMain(data) await qualityNoticeApi.qualityNoticeCreat(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else if(formType === 'execute') { } else if(formType === 'update') {
await InspectionJobMainApi.executeInspectionJobMain(data) await qualityNoticeApi.qualityNoticeUpdate(data)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
formRef.value.dialogVisible = false formRef.value.dialogVisible = false
@ -290,6 +223,5 @@ const listTableRef = ref()
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()
// importTemplateData.templateUrl = await InspectionJobMainApi.importTemplate()
}) })
</script> </script>

10
src/views/qms/qualityNotice/qualityNoticeMain.data.ts

@ -203,6 +203,16 @@ export const QualityNoticeMain = useCrudSchemas(reactive<CrudSchema[]>([
width: 150 width: 150
} }
}, },
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 200,
fixed: 'right'
}
}
])) ]))
//表单校验 //表单校验

Loading…
Cancel
Save