821ce37a by zhaoqian

字典管理页面

1 parent b6185e12
......@@ -32,3 +32,14 @@ export function getAllDdic(data) {
data: data,
})
}
/**
* 添加字典节点
*/
export function addDdicNode(data) {
return request({
url: '/system/dictionary/addDdicNode',
method: 'post',
data: data,
})
}
\ No newline at end of file
......
......@@ -12,18 +12,33 @@
</el-date-picker>
<el-button type="primary" @click="query">查询</el-button>
<el-button type="warning" @click="reset">重置</el-button>
<el-button type="info" @click="getError">错误日志</el-button>
</div>
<div class="log-detail">
<div class="log-menu">
<div style="height: 40px">
<span class="menu-title">
字典名称
<el-button type="primary" size="mini" @click="addNode(zdType,-1)">添加</el-button>
</span>
</div>
<br>
<ul>
<li v-for="(it,index) in tableData" :key="index">
<span>{{index}}</span><el-button class="dicText" type="text" @click="showMessage(it.value)">{{it.name}}</el-button>
<span>{{index+1}}</span><el-button class="dicText" type="text" @click="showMessage(it.value)"
@contextmenu.prevent.native="openMenu($event,it)">{{it.name}}</el-button>
</li>
</ul>
</div>
<ul
v-show="menuvisible"
:style="{ left: menuleft + 'px', top: menutop + 'px' }"
class="contextmenu"
>
<li @click="editNode">编辑</li>
<li @click="addNode(zdType,0)">添加</li>
<li @click="deleteNode">删除</li>
</ul>
<div class="log-table">
<!-- <el-table :data="concreteDic">-->
<el-table
:data="concreteDic"
style="width: 100%;margin-bottom: 20px;"
......@@ -40,25 +55,98 @@
<el-table-column prop="bz" align="center" label="备注">
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button type="text" class="operatorBtn">编辑</el-button>
<el-button type="text" class="operatorBtn">删除</el-button>
<el-button type="text" class="operatorBtn">添加</el-button>
<el-button type="text" class="operatorBtn" @click="addNode(scope.row,1)">添加</el-button>
</template>
</el-table-column>
</el-table>
</div>
<el-dialog v-dialogDrag title="添加字典" width="69%" :visible.sync="outerVisible">
<div style="height: 240px">
<div style="width: 100%;border: 1px solid #a8adad;">
<el-form :model="form" ref="form" label-width="110px" size="small">
<table border="1" width="100%" cellspacing="0" cellpadding="0" class="hTable">
<tbody>
<tr height="30">
<td colspan="2" align="center" >名称</td>
<td colspan="4" >
<el-input v-model="form.mc"></el-input>
</td>
<td colspan="2" align="center" >简称</td>
<td colspan="4" >
<el-input v-model="form.jc"></el-input>
</td>
</tr>
<tr height="30">
<td colspan="2" align="center" >代码</td>
<td colspan="4" >
<el-input v-model="form.dm"></el-input>
</td>
<td colspan="2" align="center" >其他代码</td>
<td colspan="4" >
<el-input v-model="form.qtdm"></el-input>
</td>
</tr>
<tr height="30">
<td colspan="2" align="center" >其他名称</td>
<td colspan="4" >
<el-input v-model="form.qtmc"></el-input>
</td>
<td colspan="2" align="center" >备注</td>
<td colspan="4" >
<el-input v-model="form.bz"></el-input>
</td>
</tr>
<tr height="30">
<td colspan="2" align="center" >字典类型</td>
<td colspan="10" >
<el-input v-model="form.zdType"></el-input>
</td>
</tr>
</tbody>
</table>
</el-form>
</div>
<div class="handleBtn">
<el-button type="primary" class="w98 creat" @click="insertDdicNode">保存</el-button>
<el-button type="primary" class="w98 cancel" @click="outerVisible = false">取消</el-button>
</div>
</div>
</el-dialog>
</div>
</div>
</template>
<script>
import {getAllDdic} from "@api/manage";
import {getAllDdic,addDdicNode} from "@api/manage";
export default {
name: "index",
data(){
return{
form:{
mc:'',
jc:'',
dm:'',
qtdm:'',
qtmc:'',
bz:'',
zdType:'',
},
tableData:[],
errorLog:[],
concreteDic:'',
zdType:'',
menuvisible:false,
menutop: 0,
menuleft: 0,
outerVisible: false,
innerVisible: false,
......@@ -91,6 +179,44 @@
}
},
methods:{
insertDdicNode(){
addDdicNode(this.form).then((res)=>{
if(res.code === 200){
this.$message.success("添加成功!");
this.outerVisible = false;
}
});
},
editNode(){
},
addNode(data,source){
this.form={
mc:'',
jc:'',
dm:'',
qtdm:'',
qtmc:'',
bz:'',
zdType:'',
pbsm:'',
bsm:'',
};
// alert(JSON.stringify(data))
if(source === 0){
this.form.zdType = data;
}else if(source === 1){
this.form = data;
this.form.pbsm = data.bsm;
}
this.outerVisible = true
},
deleteNode(){
},
getData(){
let data={
"mc": "",
......@@ -120,10 +246,33 @@
reset(){
this.startValue = "";
this.endValue = "";
}
},
openMenu(e,item){
// alert(JSON.stringify(item));
this.menuleft = e.pageX;
this.menutop = e.pageY;
this.zdType = item.name;
this.changemenuVisible(true);
},
changemenuVisible(data) {
this.menuvisible = data;
},
//关闭右键菜单
closeMenu(){
this.menuvisible = false;
},
},
mounted() {
this.getData();
},
watch:{
menuvisible(value) {
if (value) {
document.body.addEventListener("click", this.closeMenu);
} else {
document.body.removeEventListener("click", this.closeMenu);
}
},
}
}
</script>
......@@ -170,6 +319,14 @@
width: 100px;
margin-left: 15px;
}
.menu-title{
font-weight: bold;
font-size: 20px;
margin-top: 20px;
margin-left: 5px;
float: left;
width: 100%
}
ul{
list-style-type: circle;
......@@ -187,5 +344,23 @@
width: 20px;
}
/deep/.el-input__inner{
width: 100%;
border:0;
}
table{
background: #fff;
table-layout: fixed;
}
.handleBtn{
width: 314px;
position: absolute;
left: 50%;
margin-left: -250px;
margin-top: 10px;
}
</style>
\ No newline at end of file
......