12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <template>
- <div class='add-transfer'>
- <div>
- <el-input
- size='small'
- @keyup.enter.native='queryAll'
- prefix-icon='el-icon-search'
- v-model='keyword'
- style='width:192px;margin-right:12px;margin-top:20px;margin-bottom:12px'
- ></el-input>
- </div>
- <el-transfer v-model='value' :data='data' v-loading='loading' @change='transferChange'></el-transfer>
- </div>
- </template>
- <script>
- import { getTransfer, updateRelation, queryRelation } from '@/api/legendLibrary.js'
- export default {
- data() {
- return {
- data: [],
- value: [],
- keyword: '',
- multipleSelection: [],
- loading: false
- }
- },
- props: ['GraphCategoryId'],
- methods: {
- transferChange(value) {
- this.multipleSelection = value
- },
- queryAll() {
- let getParams = {
- keywords: this.keyword
- }
- this.data = []
- getTransfer({ getParams }).then(res => {
- //console.log(res)
- let content = res.Content
- content.forEach(el => {
- this.data.push({
- label: el.Name + '',
- key: el.Id
- })
- })
- })
- if (this.GraphCategoryId) {
- this.querySelectTab(this.GraphCategoryId)
- }
- },
- querySelectTab(GraphCategoryId) {
- let postParams = {}
- let data = {
- graphCategoryId: GraphCategoryId
- }
- queryRelation({ data, postParams }).then(res => {
- let content = res.data.Content
- content.forEach(el => {
- this.value.push(el.Id)
- })
- this.loading = false
- })
- },
- save() {
- this.loading = true
- let GraphElementIds = this.value.forEach
- let postParams = {
- GraphCategoryId: this.GraphCategoryId,
- GraphElementIds: this.value
- }
- updateRelation({ postParams }).then(res => {
- if (res.Result == 'success') {
- this.$message.success('添加成功!')
- this.$emit('mesg')
- }
- })
- }
- },
- mounted() {
- this.queryAll()
- }
- }
- </script>
- <style lang='less' scoped>
- .add-transfer {
- margin-top: 20px;
- margin-left: 20px;
- }
- </style>
|