Browse Source

2026-06-29

lab优化
master
fengyuan_yang 1 month ago
parent
commit
0d015c143e
  1. 243
      src/views/modules/lab/labRecord.vue

243
src/views/modules/lab/labRecord.vue

@ -137,9 +137,9 @@
:close-on-click-modal="false"
:showClose="false">
<el-tabs tab-position="left" type="border-card" v-model="activeName" style="width: 100%;height: 730px;">
<el-tabs tab-position="left" type="border-card" v-model="activeName" style="width: 100%;height: 770px;">
<el-tab-pane label="基本信息" name="basicInfo">
<div style="height: 715px; overflow-y: auto;">
<div style="height: 755px; overflow-y: auto;">
<el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
<el-form-item>
<span style="cursor: pointer" v-if="!isLabFieldDisabled('applicant')" slot="label" @click="getBaseList(103, 1)"><a herf="#">申请人</a></span>
@ -230,7 +230,25 @@
<el-input v-model="modalData.applicationSurface" :disabled="isLabFieldDisabled('applicationSurface')" style="width: 533px"></el-input>
</el-form-item>
<el-form-item label="Test Lab">
<dict-data-select v-model="modalData.testLab" clearable :disabled="isLabFieldDisabled('testLab')" style="width: 225px" dict-type="lab_test_lab"></dict-data-select>
<dict-data-select v-model="modalData.testLab" clearable :disabled="isLabFieldDisabled('testLab')" style="width: 225px" dict-type="lab_test_lab" @change="handleTestLabChange"></dict-data-select>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item>
<span style="cursor: pointer" v-if="!isLabFieldDisabled('labApprover')" slot="label" @click="openLabApproverChooseModal"><a herf="#">实验室审批人</a></span>
<span v-else slot="label">实验室审批人</span>
<el-input
v-model="modalData.labApproverName"
readonly
clearable
:disabled="isLabFieldDisabled('labApprover')"
style="width: 780px"
@focus="openLabApproverChooseModal">
<span slot="suffix" v-show="modalData.labApproverName && !isLabFieldDisabled('labApprover')" @click.stop="clearLabApproverSelection">
<i class="el-icon-circle-close"></i>
</span>
</el-input>
</el-form-item>
</el-form>
@ -562,6 +580,43 @@
</el-footer>
</el-dialog>
<el-dialog title="实验室审批人选择" @open="openLabApproverDialog" @close="closeLabApproverDialog" v-drag
:visible.sync="labApproverFlag" width="40vw" :close-on-click-modal="false">
<el-form :inline="true" label-position="top" :model="labApproverSearchData">
<el-form-item label="编码">
<el-input v-model="labApproverSearchData.operatorId" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="名称">
<el-input v-model="labApproverSearchData.operatorName" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="filterLabApproverOptions">查询</el-button>
</el-form-item>
</el-form>
<el-table v-if="labApproverFlag"
:height="300"
:data="labApproverDisplayList"
@selection-change="handleLabApproverSelectionChange"
@row-click="(row,column,event) => handleTesterTableClick(row,column,event,'labApproverTable')"
ref="labApproverTable"
border row-key="operatorId"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
:reserve-selection="true"
width="50">
</el-table-column>
<el-table-column label="编码" property="operatorId" align="left" header-align="center"/>
<el-table-column label="名称" property="operatorName" align="left" header-align="center"/>
</el-table>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="saveLabApproverChooseModal">确定</el-button>
<el-button type="primary" @click="labApproverFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<el-dialog title="选择-项目" :close-on-click-modal="false" @close="closeProjectInfoDialog"
@open="searchProjectInfoList" :visible.sync="chooseProjectListFlag" width="35%">
<el-form label-position="top" :model="searchProjectData" ref="closeProjectInfoForm">
@ -667,6 +722,12 @@
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentDetail" style="margin-top: -8px">
<el-form-item label="实验室审批人" style="display: block;">
<el-input :value="currentDetail.labApproverName || currentDetail.labApprover || ''" disabled style="width: 780px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentDetail">
<el-form-item label="测试规范附件" style="display: block;">
<div class="judge-criteria-box" style="cursor: default;">
@ -956,6 +1017,14 @@ export default {
testerSearchData: {
operatorId: '',
operatorName: ''
},
labApproverOptionList: [],
labApproverDisplayList: [],
labApproverSelectionCache: [],
labApproverFlag: false,
labApproverSearchData: {
operatorId: '',
operatorName: ''
}
}
},
@ -1039,6 +1108,10 @@ export default {
returnSample: '',
applicationSurface: '',
testLab: '',
labApprover: '',
labApproverName: '',
labApproverCodeList: [],
labApproverList: [],
attention: '',
testStartDate: '',
completedDate: '',
@ -1104,6 +1177,7 @@ export default {
operatorId: '',
operatorName: ''
}
this.resetLabApproverOptionState()
this.modalData.customerId = ''
this.modalData.customerName = ''
this.modalData.projectId = ''
@ -1113,11 +1187,36 @@ export default {
this.$set(this.modalData, 'testerList', [])
this.$set(this.modalData, 'tester', '')
this.$set(this.modalData, 'testerName', '')
this.clearLabApproverFieldData()
this.$set(this.modalData, 'propertyItemList', [])
this.judgeCriteriaFileList = []
this.testReportFileList = []
this.searchProjectData.site = site
},
resetLabApproverOptionState () {
this.labApproverFlag = false
this.labApproverOptionList = []
this.labApproverDisplayList = []
this.labApproverSelectionCache = []
this.labApproverSearchData = {
operatorId: '',
operatorName: ''
}
},
clearLabApproverFieldData () {
this.$set(this.modalData, 'labApproverCodeList', [])
this.$set(this.modalData, 'labApproverList', [])
this.$set(this.modalData, 'labApprover', '')
this.$set(this.modalData, 'labApproverName', '')
},
handleTestLabChange (value) {
if (!this.modalData || this.showModalFlag || this.isLabFieldDisabled('testLab')) {
return
}
this.$set(this.modalData, 'testLab', value || '')
this.resetLabApproverOptionState()
this.clearLabApproverFieldData()
},
loadNodeAuthority (site, stepId) {
if (!site || stepId === null || stepId === undefined || !this.menuId) {
this.plmLabAuthorityArr = []
@ -1541,6 +1640,9 @@ export default {
if (fieldId === 'tester') {
return this.modalData.testerCodeList
}
if (fieldId === 'labApprover') {
return this.modalData.labApproverCodeList
}
return this.modalData[fieldId]
},
isSubmitFieldEmpty (value) {
@ -1615,6 +1717,21 @@ export default {
this.$set(this.modalData, 'tester', testerList.join(';'))
this.$set(this.modalData, 'testerName', testerList.map(item => this.resolveTesterNameById(item)).join(';'))
},
resolveLabApproverNameById (operatorId) {
const normalizedId = String(operatorId || '').trim()
if (!normalizedId) {
return ''
}
const target = (this.labApproverOptionList || []).find(item => String(item.operatorId || '').trim() === normalizedId)
return target ? String(target.operatorName || '').trim() : normalizedId
},
syncLabApproverField () {
const labApproverList = this.normalizeTesterList(this.modalData.labApproverCodeList || this.modalData.labApproverList || this.modalData.labApprover)
this.$set(this.modalData, 'labApproverCodeList', labApproverList)
this.$set(this.modalData, 'labApproverList', labApproverList)
this.$set(this.modalData, 'labApprover', labApproverList.join(';'))
this.$set(this.modalData, 'labApproverName', labApproverList.map(item => this.resolveLabApproverNameById(item)).join(';'))
},
filterTesterOptions () {
const operatorIdKeyword = String(this.testerSearchData.operatorId || '').trim().toUpperCase()
const operatorNameKeyword = String(this.testerSearchData.operatorName || '').trim().toUpperCase()
@ -1726,6 +1843,110 @@ export default {
this.$set(this.modalData, 'testerCodeList', [])
this.syncTesterField()
},
filterLabApproverOptions () {
const operatorIdKeyword = String(this.labApproverSearchData.operatorId || '').trim().toUpperCase()
const operatorNameKeyword = String(this.labApproverSearchData.operatorName || '').trim().toUpperCase()
this.labApproverDisplayList = (this.labApproverOptionList || []).filter(item => {
const operatorId = String(item.operatorId || '').toUpperCase()
const operatorName = String(item.operatorName || '').toUpperCase()
const matchOperatorId = !operatorIdKeyword || operatorId.includes(operatorIdKeyword)
const matchOperatorName = !operatorNameKeyword || operatorName.includes(operatorNameKeyword)
return matchOperatorId && matchOperatorName
})
},
loadLabApproverOptions () {
if (!this.modalData || !this.modalData.site || !this.modalData.testLab) {
this.resetLabApproverOptionState()
return Promise.resolve()
}
const params = {
site: this.modalData.site,
roleNo: this.modalData.testLab,
active: 'Y'
}
return searchUserListForRole(params).then(({data}) => {
if (data && data.code === 0) {
const roleUserSet = new Set(
(Array.isArray(data.searchUserListForRole) ? data.searchUserListForRole : [])
.map(item => String(item || '').trim())
.filter(item => !!item)
)
const userList = (Array.isArray(data.userList) ? data.userList : []).filter(item => {
const username = String(item.username || item.userName || '').trim()
return !!username && roleUserSet.has(username)
})
this.labApproverOptionList = this.normalizeTesterOptionList(userList)
this.filterLabApproverOptions()
this.labApproverSelectionCache = []
this.syncLabApproverField()
} else {
this.resetLabApproverOptionState()
}
}).catch(() => {
this.resetLabApproverOptionState()
})
},
openLabApproverChooseModal () {
if (this.isLabFieldDisabled('labApprover')) {
return
}
if (!this.modalData || !String(this.modalData.site || '').trim()) {
this.$message.warning('请先选择工厂')
return
}
if (!this.modalData.testLab) {
this.$message.warning('请先选择Test Lab')
return
}
this.loadLabApproverOptions().then(() => {
if (!this.labApproverOptionList || this.labApproverOptionList.length === 0) {
this.$message.warning('未查询到可选实验室审批人')
return
}
this.labApproverFlag = true
})
},
openLabApproverDialog () {
this.labApproverSearchData = {
operatorId: '',
operatorName: ''
}
this.filterLabApproverOptions()
const selectedOperatorSet = new Set(
(this.modalData.labApproverCodeList || [])
.map(item => String(item || '').trim())
.filter(item => !!item)
)
const selectedRows = (this.labApproverOptionList || []).filter(item => selectedOperatorSet.has(String(item.operatorId || '').trim()))
this.labApproverSelectionCache = JSON.parse(JSON.stringify(selectedRows))
this.$nextTick(() => {
if (!this.$refs.labApproverTable) {
return
}
this.$refs.labApproverTable.clearSelection()
selectedRows.forEach(item => {
this.$refs.labApproverTable.toggleRowSelection(item, true)
})
})
},
closeLabApproverDialog () {
this.labApproverSelectionCache = []
},
handleLabApproverSelectionChange (rows) {
this.labApproverSelectionCache = rows || []
},
saveLabApproverChooseModal () {
const selectedCodes = (this.labApproverSelectionCache || [])
.map(item => String(item.operatorId || '').trim())
.filter(item => !!item)
this.$set(this.modalData, 'labApproverCodeList', selectedCodes)
this.syncLabApproverField()
this.labApproverFlag = false
},
clearLabApproverSelection () {
this.$set(this.modalData, 'labApproverCodeList', [])
this.syncLabApproverField()
},
isCurrentApprover () {
return this.superAdmin || (this.modalData.createBy2 && this.modalData.createBy2.split(';').includes(this.createBy2))
},
@ -1823,6 +2044,7 @@ export default {
this.fillDisplayFields(mergedDetail, row || {})
this.$set(mergedDetail, 'propertyItemList', (detail.propertyItemList || []).map(item => this.normalizePropertyItem(item)))
this.$set(mergedDetail, 'testerList', this.normalizeTesterList(mergedDetail.tester))
this.$set(mergedDetail, 'labApproverList', this.normalizeTesterList(mergedDetail.labApprover))
this.currentDetail = mergedDetail
} else {
const fallbackDetail = {
@ -2058,6 +2280,7 @@ export default {
operatorId: '',
operatorName: ''
}
this.resetLabApproverOptionState()
this.plmLabAuthorityArr = []
this.nodeAuthorityLoaded = !row
this.isEditMode = !!row
@ -2077,6 +2300,8 @@ export default {
this.$set(this.modalData, 'propertyItemList', (detail.propertyItemList || []).map(item => this.normalizePropertyItem(item)))
this.$set(this.modalData, 'testerCodeList', this.normalizeTesterList(this.modalData.tester))
this.$set(this.modalData, 'testerList', this.modalData.testerCodeList || [])
this.$set(this.modalData, 'labApproverCodeList', this.normalizeTesterList(this.modalData.labApprover))
this.$set(this.modalData, 'labApproverList', this.modalData.labApproverCodeList || [])
this.$set(this.modalData, 'customerIdFlag', true)
this.$set(this.modalData, 'projectIdFlag', true)
this.$set(this.modalData, 'createBy2', '')
@ -2084,7 +2309,9 @@ export default {
this.$set(this.modalData, 'tpProcessControl', 'N')
this.$set(this.modalData, 'csProcessControl', 'N')
this.$set(this.modalData, 'testerName', this.modalData.testerName || this.modalData.tester || '')
this.$set(this.modalData, 'labApproverName', this.modalData.labApproverName || this.modalData.labApprover || '')
this.loadTesterOptions()
this.loadLabApproverOptions()
this.loadModalButtonCondition()
this.loadNodeAuthority(this.modalData.site || row.site, this.modalData.stepId !== null && this.modalData.stepId !== undefined ? this.modalData.stepId : 10)
this.refreshJudgeCriteriaFileList()
@ -2119,6 +2346,9 @@ export default {
this.$set(this.modalData, 'testerCodeList', [])
this.$set(this.modalData, 'testerList', [])
this.$set(this.modalData, 'testerName', '')
this.$set(this.modalData, 'labApproverCodeList', [])
this.$set(this.modalData, 'labApproverList', [])
this.$set(this.modalData, 'labApproverName', '')
this.judgeCriteriaFileList = []
this.testReportFileList = []
this.searchProjectData.site = defaultSite
@ -2153,6 +2383,7 @@ export default {
this.testSpecDialogVisible = false
this.testReportDialogVisible = false
this.testerFlag = false
this.labApproverFlag = false
this.modalFlag = false
},
buildLabPayload (source) {
@ -2160,7 +2391,7 @@ export default {
'site', 'referenceNo', 'applicant', 'applicationDate', 'applyDepartment', 'requestedDate',
'projectId', 'customerId', 'sampleName', 'sampleModel', 'sampleQty', 'testPurpose',
'productStage', 'testType', 'reportDocument', 'returnSample', 'applicationSurface', 'testLab',
'attention', 'testStartDate', 'completedDate', 'unnormalSymptomAndDescription', 'testNumber',
'labApprover', 'attention', 'testStartDate', 'completedDate', 'unnormalSymptomAndDescription', 'testNumber',
'testerComments', 'departmentManagerComments', 'labComments', 'tester', 'propertyItemList', 'status', 'stepId',
'rejectFlag', 'rejectStepId', 'createDate', 'createBy', 'updateDate', 'updateBy'
]
@ -2176,6 +2407,7 @@ export default {
return
}
this.syncTesterField()
this.syncLabApproverField()
this.syncPropertyItemList()
const payload = this.buildLabPayload(this.modalData)
const submitMethod = this.modalTitle === 'Lab 新增' ? api.saveLab : api.updateLab
@ -2231,6 +2463,7 @@ export default {
return
}
this.syncTesterField()
this.syncLabApproverField()
this.syncPropertyItemList()
if (!this.nodeAuthorityLoaded) {
this.$message.warning('节点权限加载中,请稍后重试')
@ -2365,7 +2598,7 @@ export default {
if (val === 102) {
if (type === 1) {
strVal = this.modalData.customerId
conSql = " order by Customer_no "
conSql = ' order by Customer_no '
}
}
if (val === 103) {

Loading…
Cancel
Save