Browse Source

质量通知新增

master_hella_20240701
zhang_li 8 months ago
parent
commit
d950ba5158
  1. 2
      src/utils/dict.ts
  2. 538
      src/views/qms/qualityNotice/addForm.vue
  3. 142
      src/views/qms/qualityNotice/components/notaicType.vue
  4. 149
      src/views/qms/qualityNotice/components/qualityBatch.vue
  5. 114
      src/views/qms/qualityNotice/components/qualityNotice.vue
  6. 296
      src/views/qms/qualityNotice/index.vue
  7. 211
      src/views/qms/qualityNotice/qualityNoticeMain.data.ts

2
src/utils/dict.ts

@ -302,6 +302,8 @@ export enum DICT_TYPE {
DICTIONARY_CLASS = "dictionary_class", // 字典分类
USAGE_DECISION = "usage_decision", // 使用决策
INSPECTION_BATCH_SOURCE = "inspection_batch_source", // 检验批来源
QUALITY_NOTIFICATION_TYPE = "quality_notification_type", // 质量通知类型
// ========== 业务 - mes -gaojs ==========
QUALIFY_STATUS = 'qualify_status',//质检状态
QUALIFY_ITEM_DATA_TYPE='qualify_item_data_type',//质检项目数据类型

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

@ -0,0 +1,538 @@
<template>
<div>
<Dialog
:title="dialogTitle"
v-model="dialogVisible"
:width="dialogWidth"
:close-on-click-modal="false"
:vLoading="formLoading"
>
<div style="max-height: 80vh; overflow-y: auto; padding: 0px 20px">
<el-steps style="width: 100%;" :active="active" align-center>
<el-step title="选择质量通知类型"/>
<el-step title="质量通知"/>
<el-step title="质量物料批次" />
</el-steps>
<NotaicType v-show="active == 0"/>
<qualityNotice v-show="active == 1"/>
<qualityBatch v-show="active == 2"/>
<el-button style="margin-top: 12px" @click="prov" type="primary">上一步</el-button>
<el-button style="margin-top: 12px" @click="next" type="primary">下一步</el-button>
</div>
<template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
</template>
</Dialog>
</div>
</template>
<script setup lang="ts">
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { getCurrentInstance } from 'vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import NotaicType from './components/notaicType.vue'
import qualityNotice from './components/qualityNotice.vue'
import qualityBatch from './components/qualityBatch.vue'
const { proxy } = getCurrentInstance()
const message = useMessage() //
const props = defineProps({
//
basicFormWidth: {
type: String,
default: ''
},
//
formAllSchemasFeatures: {
type: Object,
required: true,
default: null
},
//
formAllSchemasProcess: {
type: Object,
required: true,
default: null
},
//
formAllSchemasMain: {
type: Object,
required: true,
default: null
},
//
footButttondata: {
type: Array,
required: false,
default: null
},
//
formAllSchemas: {
type: Object,
required: true,
default: null
},
// rules
rules: {
type: Object,
required: true,
default: null
},
//
tableAllSchemas: {
type: Array,
required: true,
default: null
},
tableFormRules: {
type: Array,
required: true,
default: null
},
})
const { t } = useI18n() //
const dialogVisible = ref(true) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const dialogWidth = ref()
const formMainRef = ref()
const formFeaturesRef = ref()
const data = ref({
code: '',
itemCode: '',
version: '',
testTypeCode: '',
programmeTemplateCode: '',
splitRule: '',
aql: '',
inspectionLevel: '',
effectiveDate: '',
expirationDate: '',
available: 'TRUE',
subList: []
})
const active = ref(2)
const next = () => {
if (active.value++ > 2) return
console.log(active.value)
}
const prov = () => {
if (active.value-- < 0 ) return
}
const dialogVisibleName = ref(false)
const nameForm = ref({
name: ''
})
const nameRef = ref()
if (props.basicFormWidth) {
dialogWidth.value = props.basicFormWidth + '%'
} else {
dialogWidth.value = props.isBusiness ? '60%' : '40%'
}
const rules = ref({
...props.rules
})
/** 打开弹窗 */
let tabIndex = 1
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => {
if (titleName) {
dialogTitle.value = t('action.' + titleName)
} else {
dialogTitle.value = t('action.' + type)
}
formType.value = type
if (row) {
data.value = JSON.parse(JSON.stringify(row))
dialogVisible.value = true
nextTick(() => {
formMainRef.value.setValues(row)
})
} else {
data.value = {
code: '',
itemCode: '',
version: '',
testTypeCode: '',
programmeTemplateCode: '',
splitRule: '',
aql: '',
inspectionLevel: '',
effectiveDate: '',
expirationDate: '',
available: 'TRUE',
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') {
submitForm()
}
//
else if (val == 'close') {
dialogVisible.value = false
}
}
//
const emit = defineEmits(['submitForm', 'searchTableSuccess'])
const validateForm = (formRef) => {
// console.log(TableBaseForm_Ref.value)
let _lists = formRef?.map((v) => v.validate())
return Promise.all(_lists)
.then(() => {
return true
})
.catch(() => {
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
//
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
}
}
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;
}
if (formType.value == 'create') {
//
emit('submitForm', formType.value, data.value)
} else {
// /
emit('submitForm', formType.value, data.value)
}
} catch {
console.log(111)
}
}
/** 弹窗按钮 */
let Butttondata: any = []
if (props.footButttondata) {
Butttondata = props.footButttondata
} else {
Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) //
]
}
const searchTableRef = ref()
const opensearchTable = (
formField,
searchField,
searchTitle,
searchAllSchemas,
searchPage,
searchCondition,
multiple,
type,
row
) => {
const _searchCondition = {}
//
if (searchCondition && searchCondition.length > 0) {
//
let filters: any[] = []
for (var i = 0; i < searchCondition.length; i++) {
// searchCondition.forEach((item) => {
// row
if (searchCondition[i].isMainValue) {
_searchCondition[searchCondition[i].key] = formRef.value.formModel[searchCondition[i].value]
? formRef.value.formModel[searchCondition[i].value]
: props.detailData
? props.detailData[searchCondition[i].value]
: row
? row[searchCondition[i].value]
: ''
//
let isNull = false
if (
_searchCondition[searchCondition[i].key] == '' ||
_searchCondition[searchCondition[i].key] == undefined
) {
isNull = true
}
if (isNull) {
message.warning(
searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!'
)
return
}
} else {
//
if (searchCondition[i].isSearch) {
filters.push({
action: searchCondition[i].action,
column: searchCondition[i].key,
value: searchCondition[i].value
})
} else {
_searchCondition[searchCondition[i].key] = searchCondition[i].value
}
}
}
if (filters.length > 0) {
_searchCondition.isSearch = true
_searchCondition.filters = filters
}
}
const _searchTableTitle = searchTitle
const _searchTableAllSchemas = searchAllSchemas
const _searchTablePage = searchPage
searchTableRef.value.open(
_searchTableTitle,
_searchTableAllSchemas,
_searchTablePage,
formField,
searchField,
multiple,
type,
row,
_searchCondition
)
}
//
// val row
const searchTableSuccess = async (formField, searchField, val, type, row) => {
if (type == 'features') {
row.inspectionJobCharacteristicsUpdateReqVO[formField] = val[0].code
if (formField == 'inspectionMethodCode') {
row.inspectionJobCharacteristicsUpdateReqVO.inspectionMethodName = val[0].description
} else if (formField == 'dynamicUpdateCode') {
row.inspectionJobCharacteristicsUpdateReqVO.dynamicUpdateName = val[0].description
} else if (formField == 'inspectionMethod') {
row.inspectionJobCharacteristicsUpdateReqVO.inspectionName = val[0].description
}
} else if (type == 'main') {
data.value[formField] = val[0].code
if (formField == 'itemCode') {
data.value.itemName = val[0].name
} else if (formField == 'testTypeCode') {
data.value.testTypeName = val[0].description
} else if (formField == 'programmeTemplateCode') {
data.value.programmeTemplateName = val[0].description
}
if (formField == 'programmeTemplateCode') {
let list = await InspectionProcessPageApi.getListByTempleteCode(val[0].code)
list.forEach((item, index) => {
editableTabsValue.value = index + 1
item.name = index + 1
//
if (item.inspectionJobCharacteristicsUpdateReqVO.quantifyIsCapping) {
rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyCapping'][0].required = true
} else {
rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyCapping'][0].required = false
}
if (item.inspectionJobCharacteristicsUpdateReqVO.quantifyIsLowlimit) {
rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyLowlimit'][0].required = true
} else {
rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyLowlimit'][0].required =
false
}
if (item.inspectionJobCharacteristicsUpdateReqVO.quantifyIsTarget) {
rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyTarget'][0].required = true
} else {
rules.value['inspectionJobCharacteristicsUpdateReqVO.quantifyTarget'][0].required = false
}
})
data.value.subList = list
}
}
// emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row)
}
</script>
<style scoped>
.small-title {
font-weight: bold;
padding: 0px 10px 10px;
color: #1a8bfc;
font-size: 16px;
}
</style>
<style>
.el-tabs--left .el-tabs__header.is-left {
min-height: 700px !important;
min-width: 150px !important;
}
.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left {
min-width: 120px !important;
}
</style>

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

@ -0,0 +1,142 @@
<template>
<div class="content">
<div class="type">
<el-radio-group v-model="type">
<el-radio
:label="cur.value"
v-for="cur in getIntDictOptions(DICT_TYPE.QUALITY_NOTIFICATION_TYPE)"
:key="cur.value"
>{{ cur.label }}</el-radio
>
</el-radio-group>
</div>
<el-form
:model="form"
label-width="120px"
:rules="rules"
ref="formRef"
>
<!-- Q1客户投诉表单 -->
<el-row :gutter="20" v-if="type == 1">
<el-col :span="12">
<el-form-item label="客户编码" prop="customerCode">
<el-input v-model="form.customerCode" placeholder="请选择客户"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="销售订单号" prop="soNumber">
<el-input v-model="form.soNumber" placeholder="请输入销售订单号"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="销售订单行" prop="soLine">
<el-input v-model="form.soLine" placeholder="请输入销售订单号"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="发货单号" prop="asnNumber">
<el-input v-model="form.asnNumber" placeholder="请输入发货单号"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="发货单行" prop="asnLine">
<el-input v-model="form.asnLine" placeholder="请输入发货单行"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="客户联系人" prop="customerContact">
<el-input v-model="form.customerContact" placeholder="请输入客户联系人"/>
</el-form-item>
</el-col>
</el-row>
<!-- Q2供应商投诉表单 -->
<el-row :gutter="20" v-if="type == 2">
<el-col :span="12">
<el-form-item label="供应商编码" prop="supplierCode">
<el-input v-model="form.supplierCode" placeholder="请选择供应商"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="采购订单号" prop="poNumber">
<el-input v-model="form.poNumber" placeholder="请输入采购订单号"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="采购订单行" prop="poLine">
<el-input v-model="form.poLine" placeholder="请输入采购订单行"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="收货单号" prop="recordNumber">
<el-input v-model="form.recordNumber" placeholder="请输入收货单号"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="收货单行" prop="recordLine">
<el-input v-model="form.recordLine" placeholder="请输入收货单行"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商联系人" prop="customerContact">
<el-input v-model="form.customerContact" placeholder="请输入供应商联系人"/>
</el-form-item>
</el-col>
</el-row>
<!-- Q3内部质量参考通知 -->
<el-row :gutter="20" v-if="type == 3">
<el-col :span="12">
<el-form-item label="部门编码" prop="deptCode">
<el-input v-model="form.deptCode" placeholder="请选择部门"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="生产线编码" prop="productionLineCode">
<el-input v-model="form.productionLineCode" placeholder="请输入生产线编码"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工作中心编码" prop="workCenterCode">
<el-input v-model="form.workCenterCode" placeholder="请输入工作中心编码"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备编码" prop="deviceCode">
<el-input v-model="form.deviceCode" placeholder="请输入设备编码"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="生产订单号" prop="woNumber">
<el-input v-model="form.woNumber" placeholder="请输入生产订单号"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="生产订单行" prop="woLine">
<el-input v-model="form.woLine" placeholder="请输入收货单行"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="生产联系人" prop="woContact">
<el-input v-model="form.woContact" placeholder="请输入生产联系人"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script setup lang="ts">
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
const type = ref(1)//
//
const form = ref({})
const formRef = ref()
//
const rules = ref({})
</script>
<style scoped lang="scss">
.content{
padding: 20px;
.type{
padding: 0px 20px 20px;}
}
</style>

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

@ -0,0 +1,149 @@
<template>
<div class="content">
<el-tabs
v-model="editableTabsValue"
editable
class="demo-tabs"
@edit="handleTabsEdit"
type="border-card"
tab-position="left"
:stretch="false"
>
<el-tab-pane
v-for="item in data.process"
:key="item.name"
:label="item.description"
:name="item.name"
>
<el-form :model="item" label-width="auto" :rules="qualityBatchRules" ref="qualityBatchFormRef">
<el-row :gutter="20">
<el-col :span="12" v-if="item.code">
<el-form-item label="编码" prop="code">
<el-input v-model="item.code" placeholder="根据系统生成" :disabled="true" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
</el-tabs>
<Dialog
title="修改名称"
v-model="dialogVisibleName"
width="500px"
:close-on-click-modal="false"
>
<div style="padding: 0px 20px">
<el-form ref="nameRef" :model="nameForm">
<el-form-item
:rules="[{ required: true, message: '请输入名称', trigger: 'blur' }]"
prop="name"
>
<el-input v-model="nameForm.name" style="width: 240px" placeholder="请输入名称" />
</el-form-item>
</el-form>
</div>
<template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick1" />
</template>
</Dialog>
</div>
</template>
<script setup lang="ts">
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
const editableTabsValue = ref('1')
const dialogVisibleName = ref(false)
const nameRef = ref(false)
const qualityBatchFormRef = ref()//
const qualityBatchRules = ref({})//
const nameForm = ref({
name: ''
})
const data = ref({
process:[]
})
/** 弹窗按钮 */
let Butttondata: any = []
Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) //
]
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.process
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.process = tabs.filter((tab) => tab.name !== targetName)
}
}
/** 修改名称时间 */
let tabIndex = 1
const buttonBaseClick1 = (val) => {
//
if (val == 'save') {
if (!nameRef.value) return
nameRef.value.validate((valid, fields) => {
if (valid) {
const newTabName = `${++tabIndex}`
data.value.process.push({
description: nameForm.value.name,
name: newTabName,
inspectionCode: '',
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
dialogVisibleName.value = false
} else {
console.log('error submit!')
return false
}
})
}
//
else if (val == 'close') {
dialogVisibleName.value = false
}
}
</script>
<style scoped lang="scss">
.content {
padding: 20px;
.type {
padding: 0px 20px 20px;
}
}
</style>

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

@ -0,0 +1,114 @@
<template>
<div class="content">
<el-form
:model="form"
label-width="120px"
:rules="rules"
ref="formRef"
>
<!-- 质量通知表单 -->
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="编码" prop="number">
<el-input v-model="form.number" placeholder="请选择编码"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="类型" prop="type">
<el-input v-model="form.type" placeholder="请选择类型"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述" prop="description">
<el-input v-model="form.description" placeholder="请输入描述"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="详情" prop="detail">
<el-input v-model="form.detail" placeholder="请输入详情"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="优先级" prop="priority">
<el-input v-model="form.priority" placeholder="请输入优先级"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态" prop="status">
<el-input v-model="form.status" placeholder="请选择状态"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报告人" prop="reporter">
<el-input v-model="form.reporter" placeholder="请输入报告人"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报告时间" prop="reportTime">
<el-input v-model="form.reportTime" placeholder="请选择报告时间"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="要求开始时间" prop="requestStartTime">
<el-input v-model="form.requestStartTime" placeholder="请选择要求开始时间"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="要求结束时间" prop="requestEndTime">
<el-input v-model="form.requestEndTime" placeholder="请选择要求结束时间"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否造成停机" prop="whetherCausesMachineHalt">
<el-input v-model="form.whetherCausesMachineHalt" placeholder="请选择是否造成停机"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="停机开始时间" prop="machineHaltStartTime">
<el-input v-model="form.machineHaltStartTime" placeholder="请选择停机开始时间"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="停机结束时间" prop="machineHaltEndTime">
<el-input v-model="form.machineHaltEndTime" placeholder="请选择停机结束时间"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="协调人" prop="coordinator">
<el-input v-model="form.coordinator" placeholder="请输入协调人"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务模板编号" prop="taskTemplateCode">
<el-input v-model="form.taskTemplateCode" placeholder="请输入任务模板编号"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="完成时间" prop="finishTime">
<el-input v-model="form.finishTime" placeholder="请选择完成时间"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参考通知编号" prop="referenceNoticeCode">
<el-input v-model="form.referenceNoticeCode" placeholder="请输入参考通知编号"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script setup lang="ts">
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
//
const form = ref({})
const formRef = ref()
//
const rules = ref({})
</script>
<style scoped lang="scss">
.content{
padding: 20px;
.type{
padding: 0px 20px 20px;}
}
</style>

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

@ -0,0 +1,296 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="QualityNoticeMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
:allSchemas="QualityNoticeMain.allSchemas" />
<!-- 列表 -->
<ContentWrap>
<Table :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"
@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="包装信息"/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { QualityNoticeMain} from './qualityNoticeMain.data'
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'
//
defineOptions({ name: 'QualityNoticeMain' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(QualityNoticeMain.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.defaultAddBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
//
const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -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.mainListPackageBtn(null), //
]
}
const listTableRef = ref()
// -
const buttonTableClick = async (val, row) => {
if (val == 'mainJobExe') { //
execute('execute', row)
}else if (val == 'mainPackage') { //
const list = await InspectionJobMainApi.getInspectionJobPackageList(row.id)
listTableRef.value.openPackage(row,'包装信息',QualityNoticeMain.allSchemas.tableColumns,list)
}else if (val == 'mainJobAba') { //
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 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 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) => {
console.log(data)
// return
try {
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
//
getList()
} finally {
formRef.value.formLoading = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
// importTemplateData.templateUrl = await InspectionJobMainApi.importTemplate()
})
</script>

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

@ -0,0 +1,211 @@
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 } from '@/utils/validator'
const { t } = useI18n() // 国际化
/**
* @returns {Array}
*/
export const QualityNoticeMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编码',
field: 'number',
sort: 'custom',
isSearch: true,
isForm:false,
table: {
width: 150,
fixed: 'left'
}
},
{
label: '类型',
field: 'type',
sort: 'custom',
isSearch: true,
isForm:false,
table: {
width: 150
}
},
{
label: '描述',
field: 'description',
sort: 'custom',
isSearch: false,
isForm:false,
table: {
width: 150
}
},
{
label: '详情',
field: 'detail',
sort: 'custom',
isSearch: false,
isForm:false,
table: {
width: 150
}
},{
label: '优先级',
field: 'priority',
sort: 'custom',
isSearch: false,
isForm:false,
table: {
width: 150
},
form: {
componentProps:{
disabled:true
}
},
},
{
label: '状态',
field: 'status',
sort: 'custom',
isSearch: false,
isForm:false,
table: {
width: 150
},
form: {
componentProps:{
disabled:true
}
},
},
{
label: '报告人',
field: 'reporter',
sort: 'custom',
isSearch: false,
isForm:false,
table: {
width: 150
},
form: {
componentProps:{
disabled:true
}
},
},
{
label: '报告时间',
field: 'reportTime',
sort: 'custom',
isSearch: false,
isForm:false,
table: {
width: 150
}
},
{
label: '要求开始时间',
field: 'requestStartTime',
sort: 'custom',
isSearch: false,
isForm:false,
table: {
width: 150
}
},
{
label: '要求结束时间',
field: 'requestEndTime',
sort: 'custom',
isSearch: false,
isForm:false,
table: {
width: 150
}
},
{
label: '是否造成停机',
field: 'whetherCausesMachineHalt',
sort: 'custom',
isSearch: false,
isForm:false,
table: {
width: 150
}
},
{
label: '停机开始时间',
field: 'machineHaltStartTime',
sort: 'custom',
isSearch: false,
isForm:false,
table: {
width: 150
}
},
{
label: '停机结束时间',
field: 'machineHaltEndTime',
dictType: DICT_TYPE.INSPECTION_TYPE,
sort: 'custom',
isSearch: false,
isForm:false,
form: {
component: 'Select'
},
table: {
width: 150
}
},
{
label: '协调人',
field: 'coordinator',
sort: 'custom',
isSearch: false,
isForm:false,
table: {
width: 150
}
},
{
label: '任务模板编号',
field: 'taskTemplateCode',
sort: 'custom',
isSearch: false,
isForm:false,
table: {
width: 150
}
},
{
label: '完成时间',
field: 'finishTime',
sort: 'custom',
isSearch: false,
isForm:false,
table: {
width: 150
}
},
{
// reference_certificate_row
label: '参考通知编号',
field: 'referenceNoticeCode',
sort: 'custom',
isSearch: false,
isForm:false,
form: {
component: 'InputNumber',
value: 0
},
table: {
width: 150
}
},
]))
//表单校验
export const QualityNoticeMainRules = reactive({
useDecision: [required],
})
Loading…
Cancel
Save