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