feat:(还差数据字典映射)数据结构已完成百分之90
parent
6c92193ba3
commit
ac0da3ae3e
|
@ -124,6 +124,17 @@ export function statistics() {
|
|||
|
||||
|
||||
|
||||
// 修改字段数据
|
||||
export function updateAssetModel(data) {
|
||||
return request({
|
||||
url: '/kvt/model/UpdateAssetModel',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -84,6 +84,8 @@
|
|||
<script>
|
||||
|
||||
import { parseTime } from '@/utils/muyu'
|
||||
import {listDept} from "@/api/system/dept";
|
||||
import {listUser} from "@/api/system/user";
|
||||
|
||||
export default {
|
||||
props:{
|
||||
|
@ -105,6 +107,13 @@ export default {
|
|||
systemName: "云计算系统",
|
||||
databaseName: "yunjisuan",
|
||||
},
|
||||
|
||||
// 用户查询参数
|
||||
userQueryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
},
|
||||
// 部门列表
|
||||
deptList: [],
|
||||
// 用户列表
|
||||
|
@ -115,8 +124,30 @@ export default {
|
|||
this.loading = true;
|
||||
setTimeout(() => this.loading = false, 200)
|
||||
this.init()
|
||||
this.getList()
|
||||
this.getUserList()
|
||||
},
|
||||
methods: {
|
||||
|
||||
|
||||
/** 查询部门列表 */
|
||||
getList() {
|
||||
listDept(this.queryParams).then(response => {
|
||||
console.log(response.data)
|
||||
this.deptList = this.handleTree(response.data, "deptId");
|
||||
console.log(this.deptList)
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 查询用户列表 */
|
||||
getUserList() {
|
||||
listUser(this.addDateRange(this.userQueryParams, [])).then(response => {
|
||||
this.userList = response.data.rows;
|
||||
this.userQueryParams.total = response.data.total;
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
parseTime,
|
||||
init(){
|
||||
let response = {
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<el-table
|
||||
v-loading="loading"
|
||||
:data="deptList"
|
||||
:default-expand-all="isExpandAll"
|
||||
:default-expand-all="true"
|
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||
row-key="deptId"
|
||||
>
|
||||
|
@ -67,7 +67,15 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-show="total> 0" :limit.sync="pageSize" :page.sync="pageNum" :total="total"/>
|
||||
<!-- <el-pagination-->
|
||||
<!-- @size-change="handleSizeChange"-->
|
||||
<!-- @current-change="handleCurrentChange"-->
|
||||
<!-- :current-page="queryParams.pageNum"-->
|
||||
<!-- :page-sizes="[10, 20, 30, 40]"-->
|
||||
<!-- :page-size="queryParams.pageSize"-->
|
||||
<!-- :total="total"-->
|
||||
<!-- layout="total, sizes, prev, pager, next, jumper"-->
|
||||
<!-- />-->
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="用户授权" name="user">
|
||||
<el-table ref="table" v-loading="loading" :data="userList">
|
||||
|
@ -90,7 +98,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-show="total> 0" :limit.sync="pageSize" :page.sync="pageNum" :total="total"/>
|
||||
<pagination v-show="userQueryParams.total> 0" :limit.sync="userQueryParams.pageSize" :page.sync="userQueryParams.pageNum" :total="userQueryParams.total"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
@ -100,6 +108,7 @@
|
|||
|
||||
import { parseTime } from '@/utils/muyu'
|
||||
import {listDept} from "@/api/system/dept";
|
||||
import {listUser} from "@/api/system/user";
|
||||
|
||||
|
||||
export default {
|
||||
|
@ -120,13 +129,20 @@ export default {
|
|||
// 部门列表
|
||||
deptList: [],
|
||||
// 用户列表
|
||||
userList: []
|
||||
userList: [],
|
||||
// 用户查询参数
|
||||
userQueryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.loading = true;
|
||||
setTimeout(() => this.loading = false, 200)
|
||||
this.getList()
|
||||
this.getUserList()
|
||||
},
|
||||
methods: {
|
||||
/** 查询部门列表 */
|
||||
|
@ -138,6 +154,16 @@ export default {
|
|||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
/** 查询用户列表 */
|
||||
getUserList() {
|
||||
listUser(this.addDateRange(this.userQueryParams, [])).then(response => {
|
||||
this.userList = response.data.rows;
|
||||
this.userQueryParams.total = response.data.total;
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
parseTime,
|
||||
init(){
|
||||
// this.deptList = this.handleTree(response.data, "deptId");
|
||||
|
|
|
@ -131,7 +131,7 @@ export default {
|
|||
dataModuleSum: 0,
|
||||
dataSourceSum: 0
|
||||
}
|
||||
listSource(this.queryParams).then(response => {
|
||||
listSource({}).then(response => {
|
||||
this.sourceList = response.data.rows;
|
||||
console.log(this.sourceList)
|
||||
this.sourceList.forEach(source => {
|
||||
|
|
|
@ -55,13 +55,9 @@
|
|||
placement="left"
|
||||
width="200"
|
||||
trigger="hover">
|
||||
<el-table :data="[
|
||||
{ label: '男', value: '1' },
|
||||
{ label: '女', value: '2' },
|
||||
{ label: '未知', value: '0' },
|
||||
]">
|
||||
<el-table :data="scope.row.dictionaryDatas">
|
||||
<el-table-column property="label" label="字典标签"/>
|
||||
<el-table-column property="value" label="字典值"/>
|
||||
<el-table-column property="val" label="字典值"/>
|
||||
</el-table>
|
||||
<el-tag slot="reference">{{scope.row.dictKey}}</el-tag>
|
||||
</el-popover>
|
||||
|
@ -69,29 +65,134 @@
|
|||
</el-table-column>
|
||||
<el-table-column prop="id" label="操作" >
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text">编辑</el-button>
|
||||
<el-button type="text" @click="update(scope.row)">编辑</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<el-dialog title="资产结构修改" width="80%" :visible.sync="formStatus">
|
||||
<el-form :model="form" label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="名称">
|
||||
<el-input v-model="form.name" readonly autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="注释">
|
||||
<el-input v-model="form.comment" readonly autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否主键">
|
||||
<el-tag size="small" :type="form.isPrimaryKey === 'Y' ? 'success' : 'danger'">
|
||||
{{form.isPrimaryKey}}
|
||||
</el-tag>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="数据类型">
|
||||
<el-input v-model="form.type" readonly autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="数据长度">
|
||||
<el-input v-model="form.length" readonly autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="小数位">
|
||||
<el-input v-model="form.decimalPlaces" readonly autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否为空">
|
||||
<el-tag size="small" :type="form.isNull === 'Y' ? 'success' : 'danger'">
|
||||
{{form.isNull}}
|
||||
</el-tag>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="默认值">
|
||||
<el-input v-model="form.defaultValue" readonly autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="映射字段">
|
||||
<el-input v-model="form.mappingType" readonly autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否字典">
|
||||
<el-switch
|
||||
v-model="form.isDict"
|
||||
active-value="Y"
|
||||
inactive-value="N"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="form.isDict === 'Y'">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="字典">
|
||||
<el-select v-model="form.dictKey">
|
||||
<el-option v-for="dict in dictMap" :key="dict.id" :label="dict.dictionaryName+'('+dict.dictionaryKey+')'" :value="dict.dictionaryKey"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item>
|
||||
<el-table :data="dictionaryDataList" striped border>
|
||||
<el-table-column property="label" label="字典标签"/>
|
||||
<el-table-column property="val" label="字典值"/>
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="formStatus = false">取 消</el-button>
|
||||
<el-button type="primary" @click="updDict(row)">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
|
||||
import {assetModelList } from "@/api/kvt/jdbc";
|
||||
import {getDictionaryList} from "@/api/kvt/dictionary";
|
||||
import {updateAccredit} from "@/api/kvt/assetAccerdit";
|
||||
|
||||
|
||||
export default {
|
||||
name: 'overallAssetStructure',
|
||||
watch:{
|
||||
'title': {
|
||||
handler(val) {
|
||||
console.log(val)
|
||||
assetModelList(val).then(res => {
|
||||
this.tableData = res.data
|
||||
})
|
||||
this.getDictionaryList()
|
||||
this.assetModelList()
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
'form.dictKey':{
|
||||
handler(val) {
|
||||
this.dictMap.forEach(dict => {
|
||||
if (dict.dictionaryKey === val){
|
||||
console.log(val)
|
||||
this.dictionaryDataList = dict.dictionaryDataList
|
||||
this.form.dictionaryId = dict.id
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -100,75 +201,44 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
tableData: [
|
||||
{
|
||||
id: 1,
|
||||
name: "id",
|
||||
comment: "主键",
|
||||
isPrimaryKey: "Y",
|
||||
type: "bigint",
|
||||
mappingType: "Long",
|
||||
length: "-",
|
||||
decimalPlaces: "-",
|
||||
isNull: "N",
|
||||
defaultValue: "-",
|
||||
isDict: "N",
|
||||
dictKey: "-",
|
||||
}, {
|
||||
id: 2,
|
||||
name: "name",
|
||||
comment: "姓名",
|
||||
isPrimaryKey: "N",
|
||||
type: "varchar",
|
||||
mappingType: "String",
|
||||
length: "64",
|
||||
decimalPlaces: "-",
|
||||
isNull: "N",
|
||||
defaultValue: "-",
|
||||
isDict: "N",
|
||||
dictKey: "-",
|
||||
}, {
|
||||
id: 3,
|
||||
name: "sex",
|
||||
comment: "性别",
|
||||
isPrimaryKey: "N",
|
||||
type: "char",
|
||||
mappingType: "String",
|
||||
length: "1",
|
||||
decimalPlaces: "-",
|
||||
isNull: "N",
|
||||
defaultValue: "-",
|
||||
isDict: "Y",
|
||||
dictKey: "system_sex",
|
||||
}, {
|
||||
id: 4,
|
||||
name: "price",
|
||||
comment: "金额",
|
||||
isPrimaryKey: "N",
|
||||
type: "double",
|
||||
mappingType: "BigDecimal",
|
||||
length: "10",
|
||||
decimalPlaces: "2",
|
||||
isNull: "N",
|
||||
defaultValue: "0.00",
|
||||
isDict: "N",
|
||||
dictKey: "-",
|
||||
}, {
|
||||
id: 5,
|
||||
name: "create_time",
|
||||
comment: "创建时间",
|
||||
isPrimaryKey: "N",
|
||||
type: "datetime",
|
||||
mappingType: "Date",
|
||||
length: "-",
|
||||
decimalPlaces: "-",
|
||||
isNull: "Y",
|
||||
defaultValue: "-",
|
||||
isDict: "N",
|
||||
dictKey: "-",
|
||||
}, ]
|
||||
dictionaryDataList:[],
|
||||
form:{},
|
||||
formStatus: false,
|
||||
tableData: [],
|
||||
dictMap: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
assetModelList(){
|
||||
assetModelList(this.title).then(res => {
|
||||
this.tableData = res.data
|
||||
this.formStatus = false
|
||||
console.log(this.tableData)
|
||||
})
|
||||
},
|
||||
updDict(){
|
||||
console.log(this.form)
|
||||
updateAccredit(this.form).then(res => {
|
||||
console.log(res)
|
||||
this.assetModelList()
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
getDictionaryList() {
|
||||
getDictionaryList(this.title.dataSourceId).then(res => {
|
||||
this.dictMap = res.data
|
||||
console.log(this.dictMap)
|
||||
})
|
||||
},
|
||||
async update(row) {
|
||||
await this.getDictionaryList()
|
||||
this.form = row;
|
||||
this.formStatus = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
|
|
@ -29,10 +29,82 @@
|
|||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>基础字典</span>
|
||||
<el-popover
|
||||
placement="top-start"
|
||||
title="基础字典"
|
||||
width="200"
|
||||
trigger="hover"
|
||||
content="这个字典是数据资产项目当中的字典内容,而不是本项目当中的字典内容。主要作用为数据清洗过程中数据字典映射作用">
|
||||
<i class="el-icon-question" slot="reference"></i>
|
||||
</el-popover>
|
||||
<el-popover
|
||||
placement="right"
|
||||
width="200px"
|
||||
trigger="click">
|
||||
|
||||
<el-form :inline="true" :model="dictInfo" class="demo-form-inline">
|
||||
<el-form-item label="字典名称:">
|
||||
<el-input v-model="dictInfo.dictionaryName" style="width: 150px"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="字典Key:">
|
||||
<el-input v-model="dictInfo.dictionaryKey" style="width: 150px"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="addDict">确定</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-button style="float: right; padding: 3px 0" type="text" slot="reference">新增字典</el-button>
|
||||
</el-popover>
|
||||
</div>
|
||||
<el-row :gutter="20">
|
||||
<el-col v-for="dict in dictMap" :md="8" :sm="24" :xs="12">
|
||||
<el-card class="box-card" style="height: 300px">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>{{dict.dictionaryName+'('+dict.dictionaryKey+')'}}</span>
|
||||
<el-button style="float: right; padding: 3px 0"
|
||||
type="text"
|
||||
@click="deleteDictionary(dict.id)"
|
||||
>删除</el-button>
|
||||
<el-button style="float: right; padding: 3px 0;margin-right: 8px"
|
||||
type="text"
|
||||
@click="dict.dictionaryDataList.push({ label: null, val: null, edit: true })"
|
||||
>新增</el-button>
|
||||
</div>
|
||||
<el-table :data="dict.dictionaryDataList" style="width: 100%" height="280px">
|
||||
<el-table-column prop="label" label="标签">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="!scope.row.edit">{{scope.row.label}}</span>
|
||||
<el-input v-if="scope.row.edit" v-model="scope.row.label" size="mini"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="val" label="值">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="!scope.row.edit">{{scope.row.val}}</span>
|
||||
<el-input v-if="scope.row.edit" v-model="scope.row.val" size="mini"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="val" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="!scope.row.edit" size="mini" type="text" icon="el-icon-edit" @click="scope.row.edit = true">修改</el-button>
|
||||
<el-button v-if="scope.row.edit" @click="editConfirm(dict,scope.row)" size="mini" type="text" icon="el-icon-finished">确定</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-tabs v-model="activeName" type="border-card">
|
||||
<el-tab-pane v-for="tableAsset in title.tableList" :label="tableAsset.tableName+'('+tableAsset.tableComment+')'" :name="tableAsset.tableName">
|
||||
<overall-asset-structure v-if="activeName == tableAsset.tableName" :title="tableAsset"/>
|
||||
<overall-asset-structure ref="assetStru" v-if="activeName == tableAsset.tableName" :title="tableAsset"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-col>
|
||||
|
@ -44,11 +116,15 @@
|
|||
import CountTo from 'vue-count-to'
|
||||
import overallAssetStructure from "@/views/kvt/assets/overallAssetStructure.vue";
|
||||
|
||||
import {addDictionary, deleteDictionary, getDictionaryList} from "@/api/kvt/dictionary";
|
||||
import {addData, updateData} from "@/api/kvt/data";
|
||||
|
||||
|
||||
export default {
|
||||
watch:{
|
||||
'title':{
|
||||
handler(val){
|
||||
console.log(val)
|
||||
this.getDictionaryList()
|
||||
this.activeName = val.tableList[0].tableName
|
||||
this.assetModel = 0
|
||||
this.dataModel = 0
|
||||
|
@ -60,16 +136,21 @@ export default {
|
|||
this.assetModel = parseInt(this.assetModel) + parseInt(table.fields);
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
title:{
|
||||
tableName: '',
|
||||
}
|
||||
title:{}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dictInfo: {
|
||||
dictionaryName: null,
|
||||
dictionaryKey: null,
|
||||
dataSourceId: null
|
||||
},
|
||||
dictMap: {},
|
||||
activeName: '',
|
||||
assetModel: 0,
|
||||
dataModel: 0
|
||||
|
@ -80,6 +161,61 @@ export default {
|
|||
CountTo
|
||||
},
|
||||
methods: {
|
||||
deleteDictionary(id) {
|
||||
deleteDictionary(id).then(res => {
|
||||
this.getDictionaryList()
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
getDictionaryList() {
|
||||
getDictionaryList(this.title.id).then(res => {
|
||||
this.dictMap = res.data
|
||||
})
|
||||
},
|
||||
editConfirm(dict,row){
|
||||
console.log(row)
|
||||
if (!row.label || !row.val) {
|
||||
this.$message.error('字典标签或字典值,不可为空');
|
||||
return;
|
||||
}
|
||||
if (row.id) {
|
||||
console.log('修改')
|
||||
updateData(row).then(res => {
|
||||
row.edit = false;
|
||||
this.getDictionaryList()
|
||||
})
|
||||
}else{
|
||||
console.log('添加')
|
||||
row.dictionaryId=dict.id
|
||||
addData(row).then(res => {
|
||||
row.edit = false;
|
||||
this.getDictionaryList()
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
addDict(){
|
||||
if (!this.dictInfo.dictionaryName){
|
||||
this.$message.error('字典名称,不可为空');
|
||||
return;
|
||||
}
|
||||
if (!this.dictInfo.dictionaryKey){
|
||||
this.$message.error('字典Key,不可为空');
|
||||
return;
|
||||
}
|
||||
this.dictInfo.dataSourceId = this.title.id
|
||||
addDictionary(this.dictInfo).then(res => {
|
||||
this.dictInfo = {
|
||||
dictionaryName: null,
|
||||
dictionaryKey: null,
|
||||
dataSourceId: null
|
||||
}
|
||||
this.getDictionaryList()
|
||||
})
|
||||
|
||||
},
|
||||
handleSetLineChartData(type) {
|
||||
this.$emit('handleSetLineChartData', type)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue