|
@@ -2,24 +2,17 @@
|
|
|
<div class='add-legend'>
|
|
|
<el-dialog :title='title' :visible.sync='dialogVisible'>
|
|
|
<!-- <add-list v-show='title=="" && GraphCategoryId' ref='searchList' :GraphCategoryId='GraphCategoryId' @mesg='mesg'></add-list> -->
|
|
|
- <!--
|
|
|
- <Transfer
|
|
|
- :data='treeData3'
|
|
|
- :linkage='false'
|
|
|
- :lastStage='true'
|
|
|
- @confirm='treeConfirm3'
|
|
|
- v-if='title=="" && GraphCategoryId'
|
|
|
- ref='searchList'
|
|
|
- />-->
|
|
|
- <!-- <template v-else> -->
|
|
|
+
|
|
|
<add-form ref='add' :ruleForm='info' @addSuccess='addSuccess' @updateSuccess='updateSuccess' :title='title'></add-form>
|
|
|
<span slot='footer' class='dialog-footer'>
|
|
|
<el-button @click='dialogVisible = false,cancal()' size='small'>取 消</el-button>
|
|
|
<el-button type='primary' @click='save' size='small'>确 定</el-button>
|
|
|
</span>
|
|
|
- <!-- </template> -->
|
|
|
</el-dialog>
|
|
|
<TransferSelectModal
|
|
|
+ defaultExpandAll
|
|
|
+ default-expand-all
|
|
|
+ v-if='treeData.length'
|
|
|
:modalShow='modalShow4'
|
|
|
placeholder='搜索'
|
|
|
:linkage='false'
|
|
@@ -34,18 +27,8 @@
|
|
|
<script>
|
|
|
import addForm from './addForm'
|
|
|
import addList from '../legendRules/addList'
|
|
|
-import { groupByCategory } from '@/api/legendLibrary.js'
|
|
|
-import func from '../../../vue-temp/vue-editor-bridge'
|
|
|
+import { groupByCategory, updateRelation } from '@/api/legendLibrary.js'
|
|
|
|
|
|
-// function getTree(data) {
|
|
|
-// data.id = data.Id
|
|
|
-// data.name = data.Name
|
|
|
-// for (var i = 0; i < data.Children.length; i++) {
|
|
|
-// if (data.Children[i] && data.Children[i].length > 0) {
|
|
|
-// getTree(data.Children[i])
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -74,8 +57,7 @@ export default {
|
|
|
if (GraphCategoryId) {
|
|
|
groupByCategory({}).then(res => {
|
|
|
this.treeData = []
|
|
|
- res.Data.forEach(i => {})
|
|
|
- // console.log(getTree(this.treeData))
|
|
|
+ this.treeData = res.Data.map(i => this.getTree(i))
|
|
|
})
|
|
|
//treeSelect
|
|
|
this.modalShow4 = true
|
|
@@ -104,6 +86,13 @@ export default {
|
|
|
this.$refs.searchList.queryAll()
|
|
|
}
|
|
|
},
|
|
|
+ getTree(data) {
|
|
|
+ return {
|
|
|
+ id: data.Id,
|
|
|
+ name: data.Name,
|
|
|
+ children: data.Children && data.Children.length > 0 ? data.Children.map(i => this.getTree(i)) : []
|
|
|
+ }
|
|
|
+ },
|
|
|
cancal() {
|
|
|
this.info = {
|
|
|
Name: '',
|
|
@@ -139,6 +128,16 @@ export default {
|
|
|
treeConfirm(ids, dataObj) {
|
|
|
console.log('确定:::', ids)
|
|
|
console.log('确定:::', dataObj)
|
|
|
+ let postParams = {
|
|
|
+ GraphCategoryId: this.GraphCategoryId,
|
|
|
+ GraphElementIds: ids
|
|
|
+ }
|
|
|
+ updateRelation({ postParams }).then(res => {
|
|
|
+ if (res.Result == 'success') {
|
|
|
+ this.$message.success('添加成功!')
|
|
|
+ this.$emit('mesg')
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
treeCancel() {
|
|
|
this.modalShow4 = false
|