Browse Source

完善数据字典--数据映射

master
yunuo970428 3 years ago
parent
commit
55abd74963
  1. 8
      anrui-system-ui/src/api/system/dictType/index.js
  2. 40
      anrui-system-ui/src/views/dictManage/dictMap.vue

8
anrui-system-ui/src/api/system/dictType/index.js

@ -54,10 +54,12 @@ export function saveMappingList(data) {
} }
// 数据字段--映射管理保存 // 数据字段--映射管理保存
export function selectMappingListInfo(sid) { export function selectMappingListInfo(data) {
return request({ return request({
url: '/portal/v1/sysmapping/selectMappingListInfo/' + sid, url: '/portal/v1/sysmapping/selectMappingListInfo',
method: 'get', method: 'post',
data: data,
headers: { 'Content-Type': 'application/json', 'token': tokens }
}) })
} }

40
anrui-system-ui/src/views/dictManage/dictMap.vue

@ -11,12 +11,12 @@
</div> </div>
</div> </div>
<div class="listconadd"> <div class="listconadd">
<el-form ref="form_obj" class="formadd"> <el-form ref="form_obj" class="formadd" :model="formobj">
<div class="title"> <div class="title">
<div>[{{ dictionariesKey }}+{{dictionariesValue}}]映射列表</div> <div>[{{ dictionariesKey }}+{{dictionariesValue}}]映射列表</div>
<el-button type="primary" size="mini" @click="Add">添加</el-button> <el-button type="primary" size="mini" @click="Add">添加</el-button>
</div> </div>
<el-table :key="tableKey" :data="list" :index="index" border style="width: 100%"> <el-table :key="tableKey" :data="formobj.listDtos" :index="index" border style="width: 100%">
<el-table-column fixed width="80px" label="序号" type="index" :index="index + 1" align="center"/> <el-table-column fixed width="80px" label="序号" type="index" :index="index + 1" align="center"/>
<el-table-column fixed prop="name" label="操作" width="100px" align="center" header-align="center"> <el-table-column fixed prop="name" label="操作" width="100px" align="center" header-align="center">
<template slot-scope="scope"> <template slot-scope="scope">
@ -66,42 +66,43 @@ export default {
viewTitle: '数据字典-映射管理', viewTitle: '数据字典-映射管理',
tableKey: 0, tableKey: 0,
index: 0, index: 0,
dictSid: '',
dictionariesKey: '', dictionariesKey: '',
dictionariesValue: '', dictionariesValue: '',
list: [],
mappingsource_list: [], mappingsource_list: [],
formobj: {}, formobj: {
userSid: '',
dictSid: '',
listDtos: []
},
submitdisabled: false submitdisabled: false
} }
}, },
methods: { methods: {
showAdd(row) { showAdd(row) {
this.dictSid = row.sid this.formobj.dictSid = row.sid
this.dictionariesKey = row.dictType this.dictionariesKey = row.dictType
this.dictionariesValue = row.dictValue this.dictionariesValue = row.dictValue
this.formobj.userSid = window.sessionStorage.getItem('userSid')
typeValues({ type: 'sys_mappingsource' }).then((resp) => { typeValues({ type: 'sys_mappingsource' }).then((resp) => {
if (resp.success) { if (resp.success) {
this.mappingsource_list = resp.data this.mappingsource_list = resp.data
} }
}) })
selectMappingListInfo(row.sid).then((resp) => { selectMappingListInfo({ dictSid: row.sid }).then((resp) => {
if (resp.success) { if (resp.success) {
this.list = resp.data this.formobj.listDtos = resp.data
} }
}) })
}, },
Add() { Add() {
this.list.push({ this.formobj.listDtos.push({
dictSid: this.dictSid,
map_item: '', map_item: '',
map_itemKey: '', map_itemKey: '',
map_itemValue: '', map_itemValue: '',
map_object: '', map_object: '',
map_sourceKey: '', map_sourceKey: '',
map_sourceValue: '', map_sourceValue: '',
sid: '', sid: ''
userSid: window.sessionStorage.getItem('userSid')
}) })
}, },
changeSource(value, row) { changeSource(value, row) {
@ -117,10 +118,14 @@ export default {
row.map_sourceKey = bb.key row.map_sourceKey = bb.key
}, },
dataDelete(index) { dataDelete(index) {
this.list.splice(index, 1) this.formobj.listDtos.splice(index, 1)
}, },
save() { save() {
saveMappingList(this.list).then((res) => { if (this.formobj.listDtos.length === 0) {
this.$message({ showClose: true, type: 'error', message: '映射列表不能为空' })
return
}
saveMappingList(this.formobj).then((res) => {
if (res.success) { if (res.success) {
this.$message({ showClose: true, type: 'success', message: '保存成功' }) this.$message({ showClose: true, type: 'success', message: '保存成功' })
this.handleReturn() this.handleReturn()
@ -128,8 +133,11 @@ export default {
}) })
}, },
handleReturn() { handleReturn() {
this.list = [] this.formobj = {
this.dictSid = '' userSid: '',
dictSid: '',
listDtos: []
}
this.$emit('doback') this.$emit('doback')
} }
} }

Loading…
Cancel
Save