diff --git a/src/views/modules/lab/labRecord.vue b/src/views/modules/lab/labRecord.vue
index b1ef53b..ddce11c 100644
--- a/src/views/modules/lab/labRecord.vue
+++ b/src/views/modules/lab/labRecord.vue
@@ -74,7 +74,11 @@
{{ normalizeDateOnly(scope.row.applicationDate) }}
-
+
+
+ {{ resolveLabApplyDepartmentDisplay(scope.row.applyDepartment) }}
+
+
{{ normalizeDateOnly(scope.row.requestedDate) }}
@@ -168,7 +172,15 @@
-
+
+
@@ -667,7 +679,7 @@
-
+
@@ -1025,6 +1037,9 @@ export default {
operatorId: '',
operatorName: ''
},
+ labApplyDepartmentDictRows: [],
+ labApplyDepartmentValueLabelMap: {},
+ labApplyDepartmentLabelValueMap: {},
labTestLabDictRows: [],
labTestLabValueLabelMap: {},
labTestLabLabelValueMap: {},
@@ -1043,6 +1058,7 @@ export default {
this.getButtonAuthData()
this.checkSuperAdmin()
this.loadSiteOptions()
+ this.loadLabApplyDepartmentDictOptions()
this.loadLabTestLabDictOptions()
},
mounted () {
@@ -1150,6 +1166,7 @@ export default {
applicantName: '',
applicationDate: '',
applyDepartment: '',
+ applyDepartmentLabel: '',
requestedDate: '',
customerId: '',
customerName: '',
@@ -1223,10 +1240,114 @@ export default {
this.nodeOptions = []
})
},
- getLabTestLabDictSite () {
- // Keep consistent with current Test Lab dict source configuration.
+ getLabFixedDictSite () {
+ // Keep consistent with current Lab fixed dictionary source configuration.
return '41'
},
+ getLabApplyDepartmentDictSite () {
+ return this.getLabFixedDictSite()
+ },
+ buildLabApplyDepartmentDictMaps (rows) {
+ const valueLabelMap = {}
+ const labelValueMap = {}
+ ;(rows || []).forEach(item => {
+ const value = String((item && item.dictValue) || '').trim()
+ const label = String((item && item.dictLabel) || '').trim()
+ const status = String((item && item.status) || '').trim().toUpperCase()
+ if (!value || !label || status === 'N') {
+ return
+ }
+ valueLabelMap[value] = label
+ if (!labelValueMap[label]) {
+ labelValueMap[label] = value
+ }
+ })
+ this.labApplyDepartmentValueLabelMap = valueLabelMap
+ this.labApplyDepartmentLabelValueMap = labelValueMap
+ },
+ loadLabApplyDepartmentDictOptions (forceRefresh = false) {
+ if (!forceRefresh && this.labApplyDepartmentDictRows && this.labApplyDepartmentDictRows.length > 0) {
+ return Promise.resolve(this.labApplyDepartmentDictRows)
+ }
+ const params = {
+ site: this.getLabApplyDepartmentDictSite(),
+ dictType: 'lab_apply_department'
+ }
+ return selectDictDataList(params).then(({ data }) => {
+ if (data && data.code === 0 && Array.isArray(data.rows)) {
+ this.labApplyDepartmentDictRows = data.rows
+ this.buildLabApplyDepartmentDictMaps(data.rows)
+ } else {
+ this.labApplyDepartmentDictRows = []
+ this.labApplyDepartmentValueLabelMap = {}
+ this.labApplyDepartmentLabelValueMap = {}
+ }
+ return this.labApplyDepartmentDictRows
+ }).catch(() => {
+ this.labApplyDepartmentDictRows = []
+ this.labApplyDepartmentValueLabelMap = {}
+ this.labApplyDepartmentLabelValueMap = {}
+ return []
+ })
+ },
+ resolveLabApplyDepartmentPair (rawValue) {
+ const rawText = String(rawValue || '').trim()
+ if (!rawText) {
+ return {
+ key: '',
+ label: ''
+ }
+ }
+ const labelByValue = this.labApplyDepartmentValueLabelMap[rawText]
+ if (labelByValue) {
+ return {
+ key: rawText,
+ label: labelByValue
+ }
+ }
+ const valueByLabel = this.labApplyDepartmentLabelValueMap[rawText]
+ if (valueByLabel) {
+ return {
+ key: valueByLabel,
+ label: rawText
+ }
+ }
+ return {
+ key: rawText,
+ label: rawText
+ }
+ },
+ applyLabApplyDepartmentPairToModalData (rawValue) {
+ if (!this.modalData) {
+ return
+ }
+ const pair = this.resolveLabApplyDepartmentPair(rawValue)
+ this.$set(this.modalData, 'applyDepartment', pair.key)
+ this.$set(this.modalData, 'applyDepartmentLabel', pair.label)
+ },
+ resolveLabApplyDepartmentValueForSubmit (source) {
+ const sourceValue = String((source && source.applyDepartment) || '').trim()
+ if (!sourceValue) {
+ return ''
+ }
+ const pair = this.resolveLabApplyDepartmentPair(sourceValue)
+ return String(pair.key || sourceValue).trim()
+ },
+ resolveLabApplyDepartmentDisplay (rawValue) {
+ const pair = this.resolveLabApplyDepartmentPair(rawValue)
+ return String(pair.label || pair.key || '').trim()
+ },
+ handleApplyDepartmentChange (value) {
+ if (!this.modalData || this.showModalFlag || this.isLabFieldDisabled('applyDepartment')) {
+ return
+ }
+ const pair = this.resolveLabApplyDepartmentPair(value || '')
+ this.$set(this.modalData, 'applyDepartment', pair.key)
+ this.$set(this.modalData, 'applyDepartmentLabel', pair.label)
+ },
+ getLabTestLabDictSite () {
+ return this.getLabFixedDictSite()
+ },
buildLabTestLabDictMaps (rows) {
const valueLabelMap = {}
const labelValueMap = {}
@@ -2185,7 +2306,7 @@ export default {
checkSuperAdmin () {
checkSuperAdmin().then(({data}) => {
if (data && data.code === 0) {
- this.superAdmin = !!data.flag
+ this.superAdmin = !!(data.superAdmin !== undefined ? data.superAdmin : data.flag)
}
})
},
@@ -2598,10 +2719,15 @@ export default {
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.loadLabTestLabDictOptions().then(() => {
+ Promise.all([
+ this.loadLabApplyDepartmentDictOptions(),
+ this.loadLabTestLabDictOptions()
+ ]).then(() => {
+ this.applyLabApplyDepartmentPairToModalData(this.modalData.applyDepartment)
this.applyLabTestLabPairToModalData(this.modalData.testLab)
this.loadTesterOptions()
}).catch(() => {
+ this.applyLabApplyDepartmentPairToModalData(this.modalData.applyDepartment)
this.applyLabTestLabPairToModalData(this.modalData.testLab)
this.loadTesterOptions()
})
@@ -2641,6 +2767,8 @@ export default {
this.$set(this.modalData, 'testerCodeList', [])
this.$set(this.modalData, 'testerList', [])
this.$set(this.modalData, 'testerName', '')
+ this.$set(this.modalData, 'applyDepartment', '')
+ this.$set(this.modalData, 'applyDepartmentLabel', '')
this.$set(this.modalData, 'testLab', '')
this.$set(this.modalData, 'testLabLabel', '')
this.$set(this.modalData, 'labApproverCodeList', [])
@@ -2694,6 +2822,7 @@ export default {
fields.forEach(field => {
payload[field] = source[field]
})
+ payload.applyDepartment = this.resolveLabApplyDepartmentValueForSubmit(source)
payload.testLab = this.resolveLabTestLabLabelForSubmit(source)
return payload
},
@@ -2836,6 +2965,16 @@ export default {
this.$message.warning('仅草稿状态的单据允许删除,当前勾选包含非草稿单据:' + previewText + suffix)
return
}
+ const currentUserName = String((this.$store.state.user && this.$store.state.user.name) || this.createBy2 || '').trim()
+ const unauthorizedRows = this.superAdmin
+ ? []
+ : selectedRows.filter(item => String((item && item.applicant) || '').trim() !== currentUserName)
+ if (unauthorizedRows.length) {
+ const previewText = unauthorizedRows.slice(0, 3).map(item => item.referenceNo).join('、')
+ const suffix = unauthorizedRows.length > 3 ? (' 等' + unauthorizedRows.length + '条') : ''
+ this.$message.warning('删除仅允许申请人本人或超级管理员操作,当前勾选包含不可删除单据:' + previewText + suffix)
+ return
+ }
this.$confirm('确认删除选中的' + selectedRows.length + '条Lab单据?删除后会同步删除属性和附件数据。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',