update 树形通过接口获取数据
This commit is contained in:
@@ -26,6 +26,10 @@ const configDomesticStandard = (params) => postAction('', params)
|
||||
const removeDomesticStandard = (params) => postAction('', params)
|
||||
// 国内标准-获取体系树
|
||||
const getDomesticStandardTree = (params) => getAction('/laws/standard/lawsTreeNode/domestic', params)
|
||||
// 国内标准-新增标准
|
||||
const addDomesticStandard = (params) => postAction('/laws/standard/domestic/commonAdd', params)
|
||||
// 国内标准-编辑标准
|
||||
const editDomesticStandard = (params) => postAction('/laws/standard/domestic/commonEdit', params)
|
||||
|
||||
// 海外标准-获取查询条件
|
||||
const getOverseasStandardSearchForm = (params) => getAction('/laws/standard/overseas/getQueryCondition', params)
|
||||
@@ -51,6 +55,8 @@ export {
|
||||
configDomesticStandard,
|
||||
removeDomesticStandard,
|
||||
getDomesticStandardTree,
|
||||
addDomesticStandard,
|
||||
editDomesticStandard,
|
||||
|
||||
// 海外标准
|
||||
getOverseasStandardSearchForm,
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
:nameStr="formInline[item.dbFieldName + '_name']"
|
||||
type="radio"
|
||||
:disabled="disabled" />
|
||||
<!-- <user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"-->
|
||||
<!-- v-model="formInline[item.dbFieldName]"-->
|
||||
<!-- type="radio"-->
|
||||
<!-- selectType="user"-->
|
||||
<!-- :disabled="disabled" />-->
|
||||
<!-- <user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"-->
|
||||
<!-- v-model="formInline[item.dbFieldName]"-->
|
||||
<!-- type="radio"-->
|
||||
<!-- selectType="user"-->
|
||||
<!-- :disabled="disabled" />-->
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
@@ -56,12 +56,13 @@
|
||||
<a-form-model-item class="item-model" :prop="item.dbFieldName">
|
||||
<j-select-depart
|
||||
v-model="formInline[item.dbFieldName]"
|
||||
:backDepart="true">></j-select-depart>
|
||||
<!-- <user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"-->
|
||||
<!-- v-model="formInline[item.dbFieldName]"-->
|
||||
<!-- selectType="organ"-->
|
||||
<!-- type="radio"-->
|
||||
<!-- :disabled="disabled" />-->
|
||||
:backDepart="true">>
|
||||
</j-select-depart>
|
||||
<!-- <user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"-->
|
||||
<!-- v-model="formInline[item.dbFieldName]"-->
|
||||
<!-- selectType="organ"-->
|
||||
<!-- type="radio"-->
|
||||
<!-- :disabled="disabled" />-->
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
@@ -74,7 +75,7 @@
|
||||
</div>
|
||||
<a-form-model-item class="item-model" :prop="item.dbFieldName">
|
||||
<j-multiple-date-picker class="box-input" v-model="formInline[item.dbFieldName]" :fieldName="item.dbFieldName"
|
||||
:disabled="disabled"/>
|
||||
:disabled="disabled" />
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
@@ -122,12 +123,13 @@
|
||||
v-model="formInline[item.dbFieldName]"
|
||||
:multi="true"
|
||||
:backDepart="true"
|
||||
:treeOpera="true">></j-select-depart>
|
||||
<!-- <user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"-->
|
||||
<!-- v-model="formInline[item.dbFieldName]"-->
|
||||
<!-- selectType="organ"-->
|
||||
<!-- type="checkbox"-->
|
||||
<!-- :disabled="disabled" />-->
|
||||
:treeOpera="true">>
|
||||
</j-select-depart>
|
||||
<!-- <user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"-->
|
||||
<!-- v-model="formInline[item.dbFieldName]"-->
|
||||
<!-- selectType="organ"-->
|
||||
<!-- type="checkbox"-->
|
||||
<!-- :disabled="disabled" />-->
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
@@ -204,17 +206,17 @@
|
||||
<div class="box-title-text" :title="item.dbFieldTxt">
|
||||
<div class="title-text">
|
||||
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
|
||||
<span class="title-text-text">{{item.dbFieldTxt}}</span>
|
||||
<span class="title-text-text">{{ item.dbFieldTxt }}</span>
|
||||
</div>
|
||||
<a-form-model-item class="item-model" :prop="item.dbFieldName">
|
||||
<a-tree-select
|
||||
tree-node-filter-prop="title"
|
||||
v-model="formInline[item.dbFieldName]"
|
||||
:maxTagCount="1"
|
||||
:getPopupContainer="triggerNode=> triggerNode.parentNode"
|
||||
style="width: 100%"
|
||||
:tree-data="item.tree"
|
||||
:tree-data="optionsData[item.dbFieldName]"
|
||||
tree-checkable
|
||||
treeCheckStrictly
|
||||
:placeholder="$t('pleaseSelect')+item.dbFieldTxt"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
@@ -234,15 +236,15 @@ import JMultiSelectTag from '../dict/JMultiSelectTag'
|
||||
import UploadFile from '../UploadFile'
|
||||
// 选择标准选择器
|
||||
import StandardSelection from '../selection/StandardSelection'
|
||||
// 选择用户或组织机构
|
||||
import UserOrOrganSelection from '../selection/UserOrOrganSelection'
|
||||
import { FieldType } from '../../enums/commonEnums'
|
||||
import JMultipleDatePicker from '../JMultipleDatePicker'
|
||||
import UserSelection from '../selection/UserSelection'
|
||||
import { getAction } from '../../api/manage.js'
|
||||
import { getDictTreeList } from '../../api/api.js'
|
||||
|
||||
export default {
|
||||
name: 'AddForm',
|
||||
components: { UserSelection, JMultipleDatePicker, StandardSelection, JDictSelectTag, JMultiSelectTag, UploadFile, UserOrOrganSelection },
|
||||
components: { UserSelection, JMultipleDatePicker, StandardSelection, JDictSelectTag, JMultiSelectTag, UploadFile },
|
||||
props: {
|
||||
url: {
|
||||
type: Object,
|
||||
@@ -294,7 +296,8 @@ export default {
|
||||
type: 'add',
|
||||
dataList: [],
|
||||
ruleList: [],
|
||||
uploadName: ''
|
||||
uploadName: '',
|
||||
optionsData: {} // 用接口获取到的下拉数据
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -302,80 +305,6 @@ export default {
|
||||
this.formInline = {}
|
||||
this.type = 'add'
|
||||
this.getForm()
|
||||
// this.dataList = [
|
||||
// {
|
||||
// 基本信息: [
|
||||
// {
|
||||
// area: '基本信息',
|
||||
// dbFieldName: 'serial_number',
|
||||
// dbFieldTxt: '编号',
|
||||
// db_length: 200,
|
||||
// dict_field: '',
|
||||
// fieldMustInput: '1',
|
||||
// fieldShowType: '1',
|
||||
// tree: []
|
||||
// },
|
||||
// {
|
||||
// area: '基本信息',
|
||||
// dbFieldName: 'state',
|
||||
// dbFieldTxt: '状态',
|
||||
// db_length: 36,
|
||||
// dict_field: 'state',
|
||||
// fieldMustInput: '1',
|
||||
// fieldShowType: '3',
|
||||
// tree: []
|
||||
// },
|
||||
// {
|
||||
// area: '基本信息',
|
||||
// dbFieldName: 'standard_system',
|
||||
// dbFieldTxt: '标准体系',
|
||||
// db_length: 100,
|
||||
// dict_field: 'standard_system',
|
||||
// fieldMustInput: '0',
|
||||
// fieldShowType: '3',
|
||||
// tree: []
|
||||
// },
|
||||
// {
|
||||
// area: '基本信息',
|
||||
// dbFieldName: 'corresponding_standard',
|
||||
// dbFieldTxt: '对应标准',
|
||||
// db_length: 200,
|
||||
// dict_field: '',
|
||||
// fieldMustInput: '0',
|
||||
// fieldShowType: '10',
|
||||
// tree: []
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// 文本信息: [
|
||||
// {
|
||||
// area: '文本信息',
|
||||
// dbFieldName: 'release_draft',
|
||||
// dbFieldTxt: '发言稿(必读)',
|
||||
// db_length: 3000,
|
||||
// dict_field: '',
|
||||
// fieldMustInput: '0',
|
||||
// fieldShowType: '7',
|
||||
// flag: 1,
|
||||
// tree: []
|
||||
// },
|
||||
// {
|
||||
// area: '文本信息',
|
||||
// dbFieldName: 'release_draft',
|
||||
// dbFieldTxt: '发言稿(必读)',
|
||||
// db_length: 3000,
|
||||
// dict_field: '',
|
||||
// fieldMustInput: '0',
|
||||
// fieldShowType: '7',
|
||||
// flag: 1,
|
||||
// tree: []
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// ]
|
||||
// this.ruleList = this.dataList
|
||||
// this.integrateData()
|
||||
},
|
||||
edit (item) {
|
||||
this.type = 'edit'
|
||||
@@ -387,7 +316,7 @@ export default {
|
||||
}
|
||||
this.getDocumentInfoFunc({ id: item.id }).then((res) => {
|
||||
if (res.success) {
|
||||
this.formInline = res.result[0]
|
||||
this.formInline = res.result
|
||||
this.loading = false
|
||||
} else {
|
||||
this.loading = false
|
||||
@@ -410,6 +339,8 @@ export default {
|
||||
this.dataList = res.result
|
||||
this.ruleList = res.result
|
||||
this.integrateData()
|
||||
console.log(JSON.parse(JSON.stringify(this.dataList)))
|
||||
this.getOptionsData() // 获取下拉数据
|
||||
callBack && callBack()
|
||||
}
|
||||
})
|
||||
@@ -470,6 +401,29 @@ export default {
|
||||
this.isFormInline = true
|
||||
this.confirmLoading = false
|
||||
},
|
||||
/**
|
||||
* 处理需要通过接口获取的下拉数据
|
||||
*/
|
||||
getOptionsData () {
|
||||
const formList = Object.values(this.dataList).reduce((acc, cur) => acc.concat(cur), [])
|
||||
formList.forEach(item => {
|
||||
// 展示类型是树选择,且有接口的
|
||||
if (item.fieldShowType === FieldType.TREE.value && item.fieldHref) {
|
||||
getAction(item.fieldHref).then(res => {
|
||||
if (res.success) {
|
||||
this.$set(this.optionsData, item.dbFieldName, res.result)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (item.fieldShowType === FieldType.TREE.value && item.dictId) {
|
||||
getDictTreeList({ dictId: item.dictId }).then(res => {
|
||||
if (res.success) {
|
||||
this.$set(this.optionsData, item.dbFieldName, res.result)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 点击点击上传按钮
|
||||
clickButtonToUpload (item) {
|
||||
this.$refs.uploadFile.open(this.formInline[item.dbFieldName])
|
||||
|
||||
@@ -18,27 +18,28 @@
|
||||
@click="handleSelectTreeNode(record)">
|
||||
<a-tooltip>
|
||||
<template #title>
|
||||
{{ record.nodeName }}
|
||||
{{ record.title }}
|
||||
</template>
|
||||
<span class="tree-node-custom-title">{{ record.nodeName }}</span>
|
||||
<span class="tree-node-custom-title">{{ record.title }}</span>
|
||||
</a-tooltip>
|
||||
<template v-if="record.key === mouseInNodeKey">
|
||||
<!-- 新增-->
|
||||
<a-button icon="plus"
|
||||
class="tree-operate-node-btn"
|
||||
@click.stop="handleAddTreeNode(record)"
|
||||
v-if="record.nodeType !== StandardSystemTreeNodeType.NOT_OPERATE_NODE.value"
|
||||
v-has="'domesticStandard:tree:add'"></a-button>
|
||||
<!-- 编辑,根节点不能编辑-->
|
||||
<a-button class="tree-operate-node-btn"
|
||||
@click.stop="handleEditTreeNode(record)"
|
||||
v-has="'domesticStandard:tree:edit'"
|
||||
v-if="record.nodeType !== StandardSystemTreeNodeType.ROOT_NODE.value">
|
||||
v-if="record.nodeType !== StandardSystemTreeNodeType.ROOT_NODE.value && record.nodeType !== StandardSystemTreeNodeType.NOT_OPERATE_NODE.value">
|
||||
<i class="iconfont icon-bianji" />
|
||||
</a-button>
|
||||
<!-- 删除,根节点不能删除-->
|
||||
<a-button class="tree-operate-node-btn"
|
||||
v-has="'domesticStandard:tree:delete'"
|
||||
v-if="record.nodeType !== StandardSystemTreeNodeType.ROOT_NODE.value"
|
||||
v-if="record.nodeType !== StandardSystemTreeNodeType.ROOT_NODE.value && record.nodeType !== StandardSystemTreeNodeType.NOT_OPERATE_NODE.value"
|
||||
@click.stop="handleDelTreeNode(record)">
|
||||
<i class="iconfont icon-shanchu_" />
|
||||
</a-button>
|
||||
|
||||
+17
-18
@@ -29,7 +29,12 @@
|
||||
<script>
|
||||
import AddForm from '../../../../components/customField/AddForm.vue'
|
||||
import { postAction } from '@api/manage'
|
||||
import { getDomesticStandardDocumentInfo, getDomesticStandardFormModal } from '../../../../api/standardRegulationLibraryApi'
|
||||
import {
|
||||
getDomesticStandardDocumentInfo,
|
||||
getDomesticStandardFormModal,
|
||||
addDomesticStandard,
|
||||
editDomesticStandard
|
||||
} from '../../../../api/standardRegulationLibraryApi'
|
||||
|
||||
export default {
|
||||
name: 'DomesticStandardModal',
|
||||
@@ -43,13 +48,7 @@ export default {
|
||||
form: {},
|
||||
confirmLoading: false,
|
||||
getFormFunc: getDomesticStandardFormModal,
|
||||
getDocumentInfoFunc: getDomesticStandardDocumentInfo,
|
||||
url: {
|
||||
getAddForm: '/laws/standard/domestic/getFormModel',
|
||||
getDocumentInfo: '/laws/standard/domestic/getByIdAndModule',
|
||||
add: '/laws/standard/domestic/commonAdd',
|
||||
edit: '/laws/standard/domestic/commonEdit'
|
||||
}
|
||||
getDocumentInfoFunc: getDomesticStandardDocumentInfo
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -61,6 +60,9 @@ export default {
|
||||
},
|
||||
edit (record) {
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addForm.edit(record)
|
||||
})
|
||||
},
|
||||
handleOk () {
|
||||
this.confirmLoading = true
|
||||
@@ -68,20 +70,17 @@ export default {
|
||||
},
|
||||
// 表单提交的回调,获取表单数据
|
||||
submitFormData (formInline) {
|
||||
let url = ''
|
||||
let submitFunc
|
||||
if (formInline.id) {
|
||||
url = this.url.edit
|
||||
submitFunc = editDomesticStandard
|
||||
} else {
|
||||
url = this.url.add
|
||||
submitFunc = addDomesticStandard
|
||||
}
|
||||
postAction(url, formInline).then((res) => {
|
||||
submitFunc(formInline).then((res) => {
|
||||
if (res.success) {
|
||||
this.$message.success(this.$t('operationSuccessful'))
|
||||
if (this.formInline.id) {
|
||||
this.$emit('ok')
|
||||
} else {
|
||||
this.$emit('ok')
|
||||
}
|
||||
this.$message.success(res.message)
|
||||
this.$emit('ok')
|
||||
this.close()
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user