|
|
|
@ -9,7 +9,7 @@ |
|
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }"> |
|
|
|
|
<span :title="node.label">{{ node.label }}</span> |
|
|
|
|
<span class="actions"> |
|
|
|
|
<i v-if="data.level != 3" class="el-icon-circle-plus-outline" @click.stop="addType(node)"></i> |
|
|
|
|
<i class="el-icon-circle-plus-outline" @click.stop="addType(node)" v-if="data.level != 6"></i> |
|
|
|
|
<i class="el-icon-edit" @click.stop="editType(node)"></i> |
|
|
|
|
<i class="el-icon-delete" @click.stop="delType(node)"></i> |
|
|
|
|
</span> |
|
|
|
@ -33,19 +33,27 @@ |
|
|
|
|
</el-form> |
|
|
|
|
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange"> |
|
|
|
|
<el-table-column type="selection" width="55" align="center"></el-table-column> |
|
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="showName" label="数据表名称" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="dataTotal" label="数据总量" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="dataSize" label="数据大小" align="center"> |
|
|
|
|
<el-table-column type="index" width="70" label="序号" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="tableComment" label="数据表名称" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="showName" label="产品表名称" align="center"></el-table-column> |
|
|
|
|
<el-table-column label="起止日期" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{scope.row.startTime + ' ~ ' + scope.row.endTime}} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="dataTotal" label="数据总量" width="100" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="dataSize" label="数据大小" width="100" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{scope.row.dataSize}}M |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="updateTime" label="更新时间" align="center"></el-table-column> |
|
|
|
|
<el-table-column label="操作" width="220" align="center"> |
|
|
|
|
<el-table-column prop="updateTime" label="更新时间" width="180" align="center"></el-table-column> |
|
|
|
|
<el-table-column label="操作" width="260" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-button type="text" @click="preview(scope.row)">预览</el-button> |
|
|
|
|
<el-button type="text" @click="delTable(scope.row)">删除</el-button> |
|
|
|
|
<el-button type="text" @click="editName(scope.row)">编辑产品表名</el-button> |
|
|
|
|
<el-button type="text" @click="editHead(scope.row)">编辑产品表头</el-button> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
@ -111,6 +119,32 @@ |
|
|
|
|
<el-table-column v-for="(item,index) in previewHead" :prop="item.field" :key="index" :label="item.comment" align="center"></el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<el-dialog title="编辑产品数据表名称" :visible.sync="nameVisible" width="24%" center :close-on-click-modal="false"> |
|
|
|
|
<el-input placeholder="请输入产品数据表名称" v-model="curRow.showName"></el-input> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button @click="nameVisible = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" @click="confirmName">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<el-dialog title="自定义表头" :visible.sync="headVisible" width="60%" center :close-on-click-modal="false"> |
|
|
|
|
<el-table :data="previewData" class="table" stripe header-align="center" row-key="id" :key="editIndex"> |
|
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
|
|
|
|
<el-table-column v-for="(item,index) in previewHead" :prop="item.field" :key="index" :label="item.oldComment" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<template v-if="scope.row.custom"> |
|
|
|
|
<el-input placeholder="请输入" :key="item.comment" v-model="item.comment"></el-input> |
|
|
|
|
</template> |
|
|
|
|
<template v-else>{{scope.row[item.field]}}</template> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button @click="headVisible = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" @click="confirmHead">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
@ -154,7 +188,11 @@ export default { |
|
|
|
|
previewData: [], |
|
|
|
|
submited: false, |
|
|
|
|
names: [], |
|
|
|
|
showNames: [] |
|
|
|
|
showNames: [], |
|
|
|
|
nameVisible: false, |
|
|
|
|
curRow: {}, |
|
|
|
|
headVisible: false, |
|
|
|
|
editIndex: 0 |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
@ -271,7 +309,7 @@ export default { |
|
|
|
|
this.levelId = 0 |
|
|
|
|
this.categoryName = '' |
|
|
|
|
}, |
|
|
|
|
preview(row){ |
|
|
|
|
preview(row, isEdit){ |
|
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { |
|
|
|
|
let comment = res.comment |
|
|
|
|
let previewHead = [] |
|
|
|
@ -281,14 +319,18 @@ export default { |
|
|
|
|
this.previewHead = previewHead |
|
|
|
|
|
|
|
|
|
let data = res.data |
|
|
|
|
isEdit && data.unshift({ |
|
|
|
|
custom: true |
|
|
|
|
}) |
|
|
|
|
data.map(n => { |
|
|
|
|
for(let i in n){ |
|
|
|
|
// 如果是以+0000结尾的,就表明这个是时间,则转化为正常的时间格式 |
|
|
|
|
if(typeof n[i] == 'string' && n[i].endsWith('+0000')) n[i] = this.formatDate('yyyy-MM-dd hh:mm:ss',new Date(n[i])) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
console.log(11, data) |
|
|
|
|
this.previewData = data |
|
|
|
|
this.previewVisible = true |
|
|
|
|
if (!isEdit) this.previewVisible = true |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
delTable(row){ |
|
|
|
@ -301,6 +343,35 @@ export default { |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
}, |
|
|
|
|
editName(row){ |
|
|
|
|
this.curRow = JSON.parse(JSON.stringify(row)) |
|
|
|
|
this.nameVisible = true |
|
|
|
|
}, |
|
|
|
|
confirmName(){ |
|
|
|
|
this.$post(this.api.editTableName, { |
|
|
|
|
id: this.curRow.id, |
|
|
|
|
showName: this.curRow.showName, |
|
|
|
|
}).then(res => { |
|
|
|
|
this.$message.success('修改成功') |
|
|
|
|
this.nameVisible = false |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
editHead(row){ |
|
|
|
|
this.curRow = JSON.parse(JSON.stringify(row)) |
|
|
|
|
this.preview(row, 1) |
|
|
|
|
this.editIndex++ |
|
|
|
|
this.headVisible = true |
|
|
|
|
}, |
|
|
|
|
confirmHead(){ |
|
|
|
|
let data = JSON.parse(JSON.stringify(this.previewHead)) |
|
|
|
|
// data.map(e => delete e.oldComment) |
|
|
|
|
this.$post(`${this.api.updateTableCommit}?tableName=${this.curRow.name}`, data).then(res => { |
|
|
|
|
this.$message.success('修改成功') |
|
|
|
|
this.nameVisible = false |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
handleSelectionChange(val) { |
|
|
|
|
this.multipleSelection = val |
|
|
|
|
}, |
|
|
|
|