feat(): 数据资产详情修改

chao
chao 2024-04-29 15:21:42 +08:00
parent 4a2575c2e8
commit f25bfa0819
3 changed files with 49 additions and 93 deletions

View File

@ -15,3 +15,20 @@ export function selectAssetSouructureTableList(id) {
method: 'post' method: 'post'
}) })
} }
// 修改数据源信息
export function editAssetTableDetails(data) {
return request({
url: '/data/details',
method: 'put',
data: data
})
}
// 查询数据源信息详细
export function findByAssetStructureTableIdlist(assetStructureTableId) {
return request({
url: '/data/details/' + assetStructureTableId,
method: 'get'
})
}

View File

@ -20,6 +20,7 @@
<el-table <el-table
:data="assetTableDetailsList" :data="assetTableDetailsList"
style="width: 100%;"> style="width: 100%;">
<el-table-column prop="assetStructureTableId" label="资产表id" v-if="false"/>
<el-table-column prop="name" label="名称" /> <el-table-column prop="name" label="名称" />
<el-table-column prop="annotation" label="注释" /> <el-table-column prop="annotation" label="注释" />
<el-table-column prop="primaryOrNot" label="是否主键" > <el-table-column prop="primaryOrNot" label="是否主键" >
@ -43,15 +44,15 @@
<el-table-column prop="defaultValue" label="默认值" /> <el-table-column prop="defaultValue" label="默认值" />
<el-table-column prop="yesNoDictionary" label="是否字典" > <el-table-column prop="yesNoDictionary" label="是否字典" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.isDict === 'Y'" size="small" type="success"> <el-tag v-if="scope.row.yesNoDictionary === 'Y'" size="small" type="success">
{{scope.row.isDict}} {{scope.row.yesNoDictionary}}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="dictKey" label="映射字典" > <el-table-column prop="mappingDictionary" label="映射字典" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover <el-popover
v-if="scope.row.isDict === 'Y'" v-if="scope.row.yesNoDictionary === 'Y'"
placement="left" placement="left"
width="200" width="200"
trigger="hover"> trigger="hover">
@ -63,7 +64,7 @@
<el-table-column property="label" label="字典标签"/> <el-table-column property="label" label="字典标签"/>
<el-table-column property="value" label="字典值"/> <el-table-column property="value" label="字典值"/>
</el-table> </el-table>
<el-tag slot="reference">{{scope.row.dictKey}}</el-tag> <el-tag slot="reference">{{scope.row.mappingDictionary}}</el-tag>
</el-popover> </el-popover>
</template> </template>
</el-table-column> </el-table-column>
@ -137,7 +138,7 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="是否字典"> <el-form-item label="是否字典">
<el-switch <el-switch
v-model="form.isDict" v-model="form.yesNoDictionary"
active-value="Y" active-value="Y"
inactive-value="N" inactive-value="N"
active-color="#13ce66" active-color="#13ce66"
@ -146,19 +147,19 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-if="form.isDict === 'Y'"> <el-row v-if="form.yesNoDictionary === 'Y'">
<el-col :span="24"> <el-col :span="24">
<el-form-item label="字典"> <el-form-item label="字典">
<el-select v-model="form.dictKey"> <el-select v-model="form.mappingDictionary">
<el-option v-for="(value, key) in dictMap" :key="key" :label="key" :value="key"></el-option> <el-option v-for="item in dictionaryList" :key="item.name" :label="item.name" :value="item.name + '(' + item.type + ')'"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24" v-for="item in dictionaryList" v-if="form.mappingDictionary === item.name + '(' + item.type + ')'">
<el-form-item> <el-form-item>
<el-table :data="dictMap[form.dictKey]" striped border> <el-table :data="item.dataDictionaryTypeList" striped border>
<el-table-column property="label" label="字典标签"/> <el-table-column property="label" label="字典标签"/>
<el-table-column property="val" label="字典值"/> <el-table-column property="value" label="字典值"/>
</el-table> </el-table>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -166,108 +167,42 @@
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="formStatus = false"> </el-button> <el-button @click="formStatus = false"> </el-button>
<el-button type="primary" @click="formStatus = false"> </el-button> <el-button type="primary" @click="detailsUpdate"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {editAssetTableDetails, findByAssetStructureTableIdlist} from "@/api/data/structure";
export default { export default {
props: { props: {
tableName: null, tableName: null,
tableNameAnnotation: null, tableNameAnnotation: null,
tableDataCount: null, tableDataCount: null,
assetTableDetailsList: [] assetTableDetailsList: [],
dictionaryList: []
}, },
name: 'OverallAssetStructure', name: 'OverallAssetStructure',
data() { data() {
return { 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: "-",
}, ],
form: {}, form: {},
formStatus: false, formStatus: false,
dictMap: {
"system_sex": [
{ label: '男', val: '1', isEdit: false },
{ label: '女', val: '2', isEdit: false },
{ label: '未知', val: '0', isEdit: false },
],
"system_y_n": [
{ label: '是', val: '1', isEdit: false },
{ label: '否', val: '0', isEdit: false }
],
}
} }
}, },
methods: { methods: {
update(row) { update(row) {
console.log(row)
this.form = row; this.form = row;
this.formStatus = true; this.formStatus = true;
},
detailsUpdate() {
editAssetTableDetails(this.form).then(response => {
findByAssetStructureTableIdlist(this.form.assetStructureTableId).then(res => {
this.dictionaryList = res.data;
this.formStatus = false;
})
})
} }
} }
} }

View File

@ -114,7 +114,9 @@
<el-tabs v-model="activeName" type="border-card"> <el-tabs v-model="activeName" type="border-card">
<el-tab-pane v-for="(item,index) in structureTableDataCount.childrenList" <el-tab-pane v-for="(item,index) in structureTableDataCount.childrenList"
:label="item.tableName + '(' + item.tableNameAnnotation + ')'" :name="index"> :label="item.tableName + '(' + item.tableNameAnnotation + ')'" :name="index">
<overall-asset-structure :assetTableDetailsList="item.assetTableDetailsList" :tableName="item.tableName" <overall-asset-structure :assetTableDetailsList="item.assetTableDetailsList"
:dictionaryList="dictionaryList"
:tableName="item.tableName"
:tableNameAnnotation="item.tableNameAnnotation" :tableNameAnnotation="item.tableNameAnnotation"
:tableDataCount="item.tableDataCount"/> :tableDataCount="item.tableDataCount"/>
</el-tab-pane> </el-tab-pane>
@ -186,6 +188,8 @@ export default {
this.dictionaryList = response.data this.dictionaryList = response.data
}) })
}) })
this.name = null;
this.type = null;
}, },
controlsDictionaryType(row, id) { controlsDictionaryType(row, id) {
if (!row.label) { if (!row.label) {