[update] 属性类型增加树形弹框(带出子集和单线父级)

This commit is contained in:
lideqin
2024-07-29 10:13:22 +08:00
parent 489f85687f
commit a26b0fb7a9
3 changed files with 56 additions and 12 deletions
+16 -9
View File
@@ -130,7 +130,7 @@
:label-in-value="false"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt" />
<!--16树形弹框选择-->
<tree-selection v-else-if="item.fieldShowType === FieldType.TREE_MODAL_SELECT.value"
<tree-selection v-else-if="item.fieldShowType === FieldType.TREE_MODAL_SELECT.value || item.fieldShowType === FieldType.TREE_MODAL_SELECT_SEARCH_DIFF.value"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt"
v-model="formInline[item.dbFieldName]"
@nameChange="treeSelectNameChange"
@@ -145,7 +145,8 @@
</template>
</div>
</div>
<upload-file ref="uploadFile" @change="uploadFileChange" :return-url="false"></upload-file>
<upload-file ref="uploadFile" @change="uploadFileChange" :return-url="false"
:is-download="fileIsDownload"></upload-file>
</a-form-model>
</a-spin>
</template>
@@ -168,6 +169,7 @@ import { getAction } from '../../api/manage.js'
import { ajaxGetDictItems, getFormDictTreeList } from '../../api/api.js'
import TreeSelection from '../selection/TreeSelection'
import STreeSelect from '../STreeSelect'
import { isHasPermission } from '../../utils/hasPermission'
export default {
name: 'AddForm',
@@ -275,12 +277,6 @@ export default {
return []
}
},
// 是否需要进行国内标准的特殊校验
domesticSpecialCheck: {
type: Boolean,
required: false,
default: false
},
// 选择标准字段和选择来源的对应关系
flagByField: {
type: Object,
@@ -318,7 +314,10 @@ export default {
departSelectRange: [], // 选择部门的选择范围,传了就只能从这些里面选,不传就都能选
isEditSetData: false, // 正在编辑回显数据
oldMainDraftingUnit: '', // 上一次的主起草单位
dictNotCodes: ['name_code'] // 用到字典的字段不传dictCode的字段
dictNotCodes: ['name_code'], // 用到字典的字段不传dictCode的字段
filePerm: { // 上传文件根据权限控制只能查看
associated_file: 'enterpriseStandard:associatedFile:look' // 关联文件
}
}
},
watch: {
@@ -349,7 +348,15 @@ export default {
}
}
},
computed: {
fileIsDownload () { // 文件是否可下载
// const isDisabled
// return Object.keys(filePerm).includes(uploadName) ? isHasPermission(filePerm[uploadName]) :
return true
}
},
methods: {
isHasPermission,
add () {
this.formInline = Object.assign({}, this.defaultValue)
this.$forceUpdate()
+38 -2
View File
@@ -131,6 +131,24 @@
:placeholder="$t('pleaseSelect')+item.dbFieldTxt" />
</a-form-item>
</template>
<!-- 树形弹框(带出子集和单线父级) -->
<template v-if="item.fieldShowType === FieldType.TREE_MODAL_SELECT_SEARCH_DIFF.value">
<a-form-item :label="item.dbFieldTxt" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-tree-select
tree-node-filter-prop="title"
v-model="queryParam[item.dbFieldName]"
:maxTagCount="1"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
:tree-data="optionsData[item.dbFieldName]"
:replaceFields="{key: 'id', value: 'id', title: 'name', children: 'childPartNameList'}"
tree-checkable
show-search
allowClear
:filterTreeNode="filterTreeOption"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt"
/>
</a-form-item>
</template>
</a-col>
<template v-if="searchList.length > minLength && toggleSearchStatus">
<a-col :md="(24 / (minLength + 1))"
@@ -256,6 +274,24 @@
:placeholder="$t('pleaseSelect')+item.dbFieldTxt" />
</a-form-item>
</template>
<!-- 树形弹框(带出子集和单线父级) -->
<template v-if="item.fieldShowType === FieldType.TREE_MODAL_SELECT_SEARCH_DIFF.value">
<a-form-item :label="item.dbFieldTxt" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-tree-select
tree-node-filter-prop="title"
v-model="queryParam[item.dbFieldName]"
:maxTagCount="1"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
:tree-data="optionsData[item.dbFieldName]"
:replaceFields="{key: 'id', value: 'id', title: 'name', children: 'childPartNameList'}"
tree-checkable
show-search
allowClear
:filterTreeNode="filterTreeOption"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt"
/>
</a-form-item>
</template>
</a-col>
</template>
<div style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
@@ -407,12 +443,12 @@ export default {
getOptionsData () {
const formList = Object.values(this.searchList).reduce((acc, cur) => acc.concat(cur), [])
formList.forEach(item => {
if (item.fieldShowType === FieldType.TREE.value || item.fieldShowType === FieldType.TREE_SINGLE.value) {
if (item.fieldShowType === FieldType.TREE.value || item.fieldShowType === FieldType.TREE_SINGLE.value || item.fieldShowType === FieldType.TREE_MODAL_SELECT_SEARCH_DIFF.value) {
// 展示类型是树选择,且有接口的
if (item.fieldHref) {
getAction(item.fieldHref).then(res => {
if (res.success) {
this.$set(this.optionsData, item.dbFieldName, res.result)
this.$set(this.optionsData, item.dbFieldName, res.result.records || res.result)
}
})
} else if (item.dictId) {
+2 -1
View File
@@ -28,7 +28,8 @@ export const FieldType = {
// TEXT_LINK: { text: '输入框(链接)', value: '13' },
YEAR_PICKER: { text: '年份选择', value: '14' },
TREE_SINGLE: { text: '树形结构(单选)', value: '15' },
TREE_MODAL_SELECT: { text: '树形弹框', value: '16' }
TREE_MODAL_SELECT: { text: '树形弹框', value: '16' },
TREE_MODAL_SELECT_SEARCH_DIFF: { text: '树形弹框(带出子集和单线父级)', value: '17' }
}
export const TagsTypeEnums = new EsEnums({