From 910f859b65e83be7e891dec2fd71672a39aaa432 Mon Sep 17 00:00:00 2001
From: zhang_li <2235006734@qqq.com>
Date: Fri, 12 Apr 2024 16:47:06 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B4=A8=E9=87=8F=E9=80=9A=E7=9F=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/qms/qualityNotice/index.ts | 27 ++
src/utils/dict.ts | 2 +
src/views/qms/qualityNotice/addForm.vue | 293 ++++----------
.../qualityNotice/components/notaicType.vue | 81 ++--
.../qualityNotice/components/qualityBatch.vue | 375 +++++++++++++-----
.../components/qualityNotice.vue | 46 ++-
src/views/qms/qualityNotice/index.vue | 106 +----
.../qualityNotice/qualityNoticeMain.data.ts | 10 +
8 files changed, 483 insertions(+), 457 deletions(-)
create mode 100644 src/api/qms/qualityNotice/index.ts
diff --git a/src/api/qms/qualityNotice/index.ts b/src/api/qms/qualityNotice/index.ts
new file mode 100644
index 000000000..7f423b288
--- /dev/null
+++ b/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})
+}
\ No newline at end of file
diff --git a/src/utils/dict.ts b/src/utils/dict.ts
index c9ef25d70..ca6b004c2 100644
--- a/src/utils/dict.ts
+++ b/src/utils/dict.ts
@@ -303,6 +303,8 @@ export enum DICT_TYPE {
USAGE_DECISION = "usage_decision", // 使用决策
INSPECTION_BATCH_SOURCE = "inspection_batch_source", // 检验批来源
QUALITY_NOTIFICATION_TYPE = "quality_notification_type", // 质量通知类型
+ QUALITY_NOTICE_STATUS = "quality_notice_status", // 质量通知状态
+ QUALITY_TASK_STATUS = "quality_task_status", // 质量通知任务状态
// ========== 业务 - mes -gaojs ==========
QUALIFY_STATUS = 'qualify_status',//质检状态
diff --git a/src/views/qms/qualityNotice/addForm.vue b/src/views/qms/qualityNotice/addForm.vue
index 0e40a3371..b1700e470 100644
--- a/src/views/qms/qualityNotice/addForm.vue
+++ b/src/views/qms/qualityNotice/addForm.vue
@@ -13,9 +13,9 @@
-
-
-
+
+
+
上一步
@@ -29,6 +29,7 @@
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { getCurrentInstance } from 'vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
+import * as qualityNoticeApi from '@/api/qms/qualityNotice'
import NotaicType from './components/notaicType.vue'
import qualityNotice from './components/qualityNotice.vue'
import qualityBatch from './components/qualityBatch.vue'
@@ -94,7 +95,7 @@ const props = defineProps({
})
const { t } = useI18n() // 国际化
-const dialogVisible = ref(true) // 弹窗的是否展示
+const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const formType = ref('') // 表单的类型:create - 新增;update - 修改
@@ -103,17 +104,7 @@ const formMainRef = ref()
const formFeaturesRef = ref()
const data = ref({
- code: '',
- itemCode: '',
- version: '',
- testTypeCode: '',
- programmeTemplateCode: '',
- splitRule: '',
- aql: '',
- inspectionLevel: '',
- effectiveDate: '',
- expirationDate: '',
- available: 'TRUE',
+ type:1,
subList: []
})
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) => {
if (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)
}
formType.value = type
+ active.value =0
if (row) {
data.value = JSON.parse(JSON.stringify(row))
+ data.value = await qualityNoticeApi.qualityNoticeDetail(row.id)
dialogVisible.value = true
- nextTick(() => {
- formMainRef.value.setValues(row)
- })
} else {
data.value = {
- code: '',
- itemCode: '',
- version: '',
- testTypeCode: '',
- programmeTemplateCode: '',
- splitRule: '',
- aql: '',
- inspectionLevel: '',
- effectiveDate: '',
- expirationDate: '',
- available: 'TRUE',
+ type:1,
subList: []
}
}
dialogVisible.value = true
- tabIndex = data.value.subList.length + 1
}
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) => {
// 保存
if (val == 'save') {
@@ -255,6 +160,8 @@ const buttonBaseClick = (val) => {
dialogVisible.value = false
}
}
+// 下一步
+
// 传递给父类
const emit = defineEmits(['submitForm', 'searchTableSuccess'])
const validateForm = (formRef) => {
@@ -268,113 +175,42 @@ const validateForm = (formRef) => {
return false
})
}
+
const tableFormRef = ref()
const submitForm = async () => {
- try {
- console.log(data.value.subList)
- const elForm = unref(formMainRef)?.getElFormRef()
- // 校验表单
- if (!elForm) return
- const valid = await elForm.validate()
- if (!valid) return
- // 校验包装列表
+ // qualityBatchFrom.value.qualityBatchFrom
+ if(data.value.type == 1){
+ data.value.q1 = notaicTypeFrom.value.q1
+ delete data.value.q2
+ delete data.value.q3
+ }else if(data.value.type == 2){
+ data.value.q2 = notaicTypeFrom.value.q2
+ delete data.value.q1
+ delete data.value.q3
- console.log(11, data.value.packageList)
- if (data.value.packageList?.length > 0) {
- const validateForm1 = await tableFormRef.value.validateForm()
- if (!validateForm1) return
- let number = 0
- data.value.packageList.forEach((cur) => {
- number += parseFloat(cur.sampleAmount)
- })
- if (number != data.value.sampleTotalAmount) {
- message.error(`采样数量之和不等于总数量`)
- return
- }
- }
+ }else if(data.value.type == 3){
+ data.value.q3 = notaicTypeFrom.value.q3
+ delete data.value.q1
+ delete data.value.q2
- const bol2 = await validateForm(formFeaturesRef.value)
- if (!bol2) {
- message.error(`模板中有检验工序和检验特性未填写完全`)
- return
- }
- // 判断数组是否有未填的选项
- let arrBol = []
- let isOutweigh = [] //结束时间是否大于开始时间
- let numberList = [] //判断合格数量和不合格数量之和是否等于主表数量
- data.value.subList.forEach((item, index) => {
- if (item.inspectionJobCharacteristicsUpdateReqVO.resultEntryMethod == 1) {
- arrBol.push(
- item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some(
- (cur, key) => {
- return !cur.qualifiedQuantity || !cur.unqualifiedQuantity
- }
- )
- )
- }
- // 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
- }
+}
+
+console.log(data.value)
+ data.value.subList = qualityBatchFrom.value.subList
+ if(data.value.subList.length==0){
+ message.error('请填写质量物料批次')
+ return;
+ }
+ const validateForm1 = await validateForm(qualityBatchFrom.value.qualityBatchFrom)
+ console.log(validateForm1)
+ const isBol = data.value.subList.some(cur=>{
+ return cur.packageList.length == 0 || cur.taskList.length == 0|| cur.defectList.length == 0
+ })
+ if(isBol){
+ message.error('物料批次中包装,任务,缺陷没有填写完全')
+ return;
+ }
+ try {
if (formType.value == 'create') {
// 主子表——提交请求
emit('submitForm', formType.value, data.value)
@@ -392,7 +228,6 @@ if (props.footButttondata) {
Butttondata = props.footButttondata
} else {
Butttondata = [
- defaultButtons.formSaveBtn(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)
}
-// 下一步
+
const next = () => {
if (active.value == 2) return
if (active.value == 0) {
if (notaicTypeFrom.value.type == 1) {
notaicTypeFrom.value.formRef1.validate((valid) => {
if (valid) {
- console.log('submit!')
- console.log(notaicTypeFrom.value.formRef1)
active.value++
} else {
console.log('error submit!')
@@ -540,19 +373,14 @@ const next = () => {
} else if (notaicTypeFrom.value.type == 2) {
notaicTypeFrom.value.formRef2.validate((valid) => {
if (valid) {
- console.log('submit!')
- console.log(notaicTypeFrom.value.formRef1)
active.value++
} else {
- console.log('error submit!')
return false
}
})
} else if (notaicTypeFrom.value.type == 3) {
notaicTypeFrom.value.formRef3.validate((valid) => {
if (valid) {
- console.log('submit!')
- console.log(notaicTypeFrom.value.formRef1)
active.value++
} else {
console.log('error submit!')
@@ -560,11 +388,25 @@ const next = () => {
}
})
}
- console.log(notaicTypeFrom.value.form)
}else if (active.value == 1) {
qualityNoticeFrom.value.formRef.validate((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++
} else {
console.log('error submit!')
@@ -578,6 +420,21 @@ const prov = () => {
if (active.value == 0) return
active.value--
}
+watch(
+ () => active.value,
+ (val) => {
+ if(val == 2){
+ Butttondata = [
+ defaultButtons.formSaveBtn(null), // 保存
+ defaultButtons.formCloseBtn(null) // 关闭
+ ]
+ }else{
+ Butttondata = [
+ defaultButtons.formCloseBtn(null) // 关闭
+ ]
+ }
+ }
+)