国标新增页面,选择代替标准号后自动带出所需标准

# Conflicts:
#	src/components/customField/AddForm.vue
This commit is contained in:
Xia Zekun
2024-08-02 17:11:53 +08:00
committed by lideqin
parent 986f2810a4
commit 8ffe1d6c0e
4 changed files with 83 additions and 4 deletions
+6 -2
View File
@@ -37,11 +37,15 @@ export default {
},
watch: {
value: {
handler () {
handler (val) {
// console.log('watch value:',val)
// this.value = val
if (typeof this.value !== 'string' && this.value) {
this.treeValue = JSON.parse(JSON.stringify(this.value))
// console.log('typeof this.value !== \'string\' this.treeValue:',this.treeValue)
} else {
this.treeValue = this.value
// console.log('typeof this.value === \'string\' this.treeValue:',this.treeValue)
}
},
immediate: true
@@ -93,4 +97,4 @@ export default {
/deep/ .ant-select-tree-dropdown {
max-height: 50vh !important;
}
</style>
</style>
+72 -1
View File
@@ -58,7 +58,8 @@
:disabledSourceSearch="!selectStandardCanUpdateTypeField.includes(item.dbFieldName)"
:disabled="disabled || disabledFieldList.includes(item.dbFieldName)"
:exclude-standard-numbers="excludeStandardFields.includes(item.dbFieldName) ? excludeStandardNumbers : null"
v-model="formInline[item.dbFieldName]" />
v-model="formInline[item.dbFieldName]"
@listChange="standardSelectionListChange(item.dbFieldName, $event)"/>
<!-- 7, 多选组织机构 -->
<j-select-depart v-else-if="item.fieldShowType === FieldType.ORGAN_MORE.value"
v-model="formInline[item.dbFieldName]"
@@ -176,6 +177,7 @@ import { ajaxGetDictItems, getDictByCode, getFormDictTreeList } from '../../api/
import TreeSelection from '../selection/TreeSelection'
import { getStandardGradeClassification } from '../../api/enterpriseStandardLibraryApi'
import STreeSelect from '../STreeSelect'
import { getDomesticStandardDetail } from '../../api/standardRegulationLibraryApi';
// 本系统限制可以上传的文件格式
const CAN_UPLOAD_FILE_TYPE = 'pdf,docx,doc,xlsx,xls,ppt,pptx,rar,zip,jpg,jpeg,png,avi,wmv,mov,rm,mp4,cad'
@@ -781,6 +783,75 @@ export default {
this.formInline = { ...this.formInline }
}
},
async standardSelectionListChange(fieldName, selectedRowList){
// console.log('standardSelectionListChange fieldName',fieldName)
// console.log('standardSelectionListChange selectedRowList',selectedRowList)
if(fieldName !== 'substitute_standard_number'){
console.log('不是选取代替标准号,不执行自动带入信息')
return
}
// 获取该代替标准号的所有信息
if(selectedRowList.length === 0) return;
var request = await getDomesticStandardDetail({id: selectedRowList[0].id, type: 1})
if(request.code !== 200){
console.log('获取该代替标准号的所有信息失败')
return
}
var substituteStandard = request.result
console.log('substituteStandard', substituteStandard)
// 将需要的该代替标准号的信息带入
/* 标准体系 standard_system
标准类别 standard_class
标准性质 standard_property
适用范围部分(除企业参与情况外)
归口管理部门 centralized_management_departments
分标委 bidding_committee
责任部门 responsible_department
责任部门负责人 responsible_department_user
零部件分类 part_name
适用认证 applicable_certification
适用车型 applicable_vehicle
动力类型 dynamic_type
关联海外标准 associated_foreign_standards
*/
this.formInline = {
...this.formInline,
standard_system: substituteStandard.standard_system,
standard_system_dictText: substituteStandard.standard_system_dictText,
standard_class: substituteStandard.standard_class,
standard_property: substituteStandard.standard_property,
centralized_management_departments: substituteStandard.centralized_management_departments,
bidding_committee: substituteStandard.bidding_committee,
responsible_department: substituteStandard.responsible_department,
responsible_department_dictText: substituteStandard.responsible_department_dictText,
responsible_department_user: substituteStandard.responsible_department_user,
responsible_department_user_dictText: substituteStandard.responsible_department_user_dictText,
part_name: substituteStandard.part_name,
part_name_dictText: substituteStandard.part_name_dictText,
applicable_certification: substituteStandard.applicable_certification,
applicable_vehicle: substituteStandard.applicable_vehicle,
dynamic_type: substituteStandard.dynamic_type,
associated_foreign_standards: substituteStandard.associated_foreign_standards
}
// 处理树结构多选回显
const formList = Object.values(this.dataList).reduce((acc, cur) => acc.concat(cur), [])
const treeMultipleField = formList.filter(tt => tt.fieldShowType === FieldType.TREE.value)
treeMultipleField.forEach(field => {
const valueArr = []
if (this.formInline[field.dbFieldName]) {
const values = this.formInline[field.dbFieldName].split(',')
for (let i = 0; i < values.length; i++) {
valueArr[i] = {
value: values[i]
}
}
this.formInline[field.dbFieldName] = valueArr
console.log(this.formInline[field.dbFieldName])
} else {
this.formInline[field.dbFieldName] = undefined
}
})
},
// 选择用户得到用户名
userSelectNameChange (value, fieldName) {
this.formInline[fieldName + '_dictText'] = value
@@ -20,7 +20,8 @@
:value="value"
@change="modalInput"
@nameChange="modalNameChange"
@listChange="modalListChange"></standard-selection-modal>
@listChange="modalListChange">
</standard-selection-modal>
</div>
</template>
@@ -301,6 +301,9 @@ export default {
serialNumber.push(res.standardNumber)
serialNameArr.push(res.standardName)
})
// console.log('this.selectedRowKeys', this.selectedRowKeys)
// console.log('serialNameArr', serialNameArr)
// console.log('this.selectedRowList', this.selectedRowList)
this.$emit('change', this.selectedRowKeys.join(','))
this.$emit('nameChange', serialNameArr.join(','))
this.$emit('listChange', this.selectedRowList)