[update] 企标:企业标准代号选了Q,企业名称代号只能选ZZ\ZR,选了TS,名称代号只能选ZZ

This commit is contained in:
lideqin
2024-03-05 14:41:36 +08:00
parent 765f60a99a
commit b730e79599
8 changed files with 297 additions and 36 deletions
+50 -4
View File
@@ -91,7 +91,7 @@
:type="'select'"
:triggerChange="false"
:options="optionsData[item.dbFieldName]"
:dictCode="item.fieldHref ? null : item.dictField" />
:dictCode="item.fieldHref || dictNotCodes.includes(item.dbFieldName) ? null : item.dictField" />
<!-- 11, 下拉多选数据字典 -->
<j-multi-select-tag v-else-if="item.fieldShowType === FieldType.OPTION_MORE.value"
class="box-input"
@@ -164,12 +164,12 @@ import {
IsTrial,
EnterpriseStandardStatus,
StandardSource,
StandardStatus
StandardStatus, EnterpriseStandardCode, EnterpriseNameCode
} from '../../enums/commonEnums'
import JMultipleDatePicker from '../JMultipleDatePicker'
import UserSelection from '../selection/UserSelection'
import { getAction } from '../../api/manage.js'
import { getFormDictTreeList } from '../../api/api.js'
import { ajaxGetDictItems, getDictByCode, getFormDictTreeList } from '../../api/api.js'
import TreeSelection from '../selection/TreeSelection'
import { getStandardGradeClassification } from '../../api/enterpriseStandardLibraryApi'
import STreeSelect from '../STreeSelect'
@@ -332,7 +332,8 @@ export default {
innerDisabledField: [], // 内部不可编辑字段
departSelectRange: [], // 选择部门的选择范围,传了就只能从这些里面选,不传就都能选
isEditSetData: false, // 正在编辑回显数据
oldMainDraftingUnit: '' // 上一次的主起草单位
oldMainDraftingUnit: '', // 上一次的主起草单位
dictNotCodes: ['name_code'] // 用到字典的字段不传dictCode的字段
}
},
watch: {
@@ -500,6 +501,34 @@ export default {
}
// 起草、征求依据、报批、废止状态时发布日期、实施日期不必填
this.handleRequiredByState(val)
},
// 企标:企业标准代号选Q,企业名称代号只能选ZZ\ZR;标准代号选TS,企业名称代号只能选ZZ
'formInline.standard_code' (val) {
if (this.flag === StandardSource.ENTERPRISE.value && !this.isEditSetData) {
if (val === EnterpriseStandardCode.Q.value) {
// 选的Q,企业名称代号只能选ZZ\ZR
this.optionsData.name_code.map(item => {
if (![EnterpriseNameCode.ZZ.value, EnterpriseNameCode.ZR.value].includes(item.value)) {
item.disabled = true
} else {
item.disabled = false
}
})
} else if (val === EnterpriseStandardCode.TS.value) {
// 选的TS,企业名称代号只能选ZZ
this.optionsData.name_code.map(item => {
if (![EnterpriseNameCode.ZZ.value].includes(item.value)) {
item.disabled = true
} else {
item.disabled = false
}
})
}
if (this.formInline.name_code !== EnterpriseNameCode.ZZ.value) {
this.formInline.name_code = undefined
this.formInline = Object.assign({}, this.formInline)
}
}
}
},
methods: {
@@ -646,6 +675,23 @@ export default {
this.$set(this.optionsData, item.dbFieldName, res.result)
}
})
} else if (item.fieldShowType === FieldType.OPTION_SINGLE.value && this.dictNotCodes.includes(item.dbFieldName)) {
ajaxGetDictItems(item.dictField).then(res => {
if (res.success) {
const result = JSON.parse(JSON.stringify(res.result))
if (item.dbFieldName === 'name_code') {
for (const dictItem of result) {
if ([EnterpriseNameCode.WQ.value, EnterpriseNameCode.JC.value, EnterpriseNameCode.JHK.value].includes(dictItem.value)) {
dictItem.disabled = true
} else {
dictItem.disabled = false
}
}
}
console.log('获取企业名称代号下拉框数据成功了', result)
this.$set(this.optionsData, item.dbFieldName, result)
}
})
}
})
},