821ce37a by zhaoqian

字典管理页面

1 parent b6185e12
...@@ -32,3 +32,14 @@ export function getAllDdic(data) { ...@@ -32,3 +32,14 @@ export function getAllDdic(data) {
32 data: data, 32 data: data,
33 }) 33 })
34 } 34 }
35
36 /**
37 * 添加字典节点
38 */
39 export function addDdicNode(data) {
40 return request({
41 url: '/system/dictionary/addDdicNode',
42 method: 'post',
43 data: data,
44 })
45 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -12,18 +12,33 @@ ...@@ -12,18 +12,33 @@
12 </el-date-picker> 12 </el-date-picker>
13 <el-button type="primary" @click="query">查询</el-button> 13 <el-button type="primary" @click="query">查询</el-button>
14 <el-button type="warning" @click="reset">重置</el-button> 14 <el-button type="warning" @click="reset">重置</el-button>
15 <el-button type="info" @click="getError">错误日志</el-button>
16 </div> 15 </div>
17 <div class="log-detail"> 16 <div class="log-detail">
18 <div class="log-menu"> 17 <div class="log-menu">
18 <div style="height: 40px">
19 <span class="menu-title">
20 字典名称
21 <el-button type="primary" size="mini" @click="addNode(zdType,-1)">添加</el-button>
22 </span>
23 </div>
24 <br>
19 <ul> 25 <ul>
20 <li v-for="(it,index) in tableData" :key="index"> 26 <li v-for="(it,index) in tableData" :key="index">
21 <span>{{index}}</span><el-button class="dicText" type="text" @click="showMessage(it.value)">{{it.name}}</el-button> 27 <span>{{index+1}}</span><el-button class="dicText" type="text" @click="showMessage(it.value)"
28 @contextmenu.prevent.native="openMenu($event,it)">{{it.name}}</el-button>
22 </li> 29 </li>
23 </ul> 30 </ul>
24 </div> 31 </div>
32 <ul
33 v-show="menuvisible"
34 :style="{ left: menuleft + 'px', top: menutop + 'px' }"
35 class="contextmenu"
36 >
37 <li @click="editNode">编辑</li>
38 <li @click="addNode(zdType,0)">添加</li>
39 <li @click="deleteNode">删除</li>
40 </ul>
25 <div class="log-table"> 41 <div class="log-table">
26 <!-- <el-table :data="concreteDic">-->
27 <el-table 42 <el-table
28 :data="concreteDic" 43 :data="concreteDic"
29 style="width: 100%;margin-bottom: 20px;" 44 style="width: 100%;margin-bottom: 20px;"
...@@ -40,25 +55,98 @@ ...@@ -40,25 +55,98 @@
40 <el-table-column prop="bz" align="center" label="备注"> 55 <el-table-column prop="bz" align="center" label="备注">
41 </el-table-column> 56 </el-table-column>
42 <el-table-column align="center" label="操作"> 57 <el-table-column align="center" label="操作">
58 <template slot-scope="scope">
43 <el-button type="text" class="operatorBtn">编辑</el-button> 59 <el-button type="text" class="operatorBtn">编辑</el-button>
44 <el-button type="text" class="operatorBtn">删除</el-button> 60 <el-button type="text" class="operatorBtn">删除</el-button>
45 <el-button type="text" class="operatorBtn">添加</el-button> 61 <el-button type="text" class="operatorBtn" @click="addNode(scope.row,1)">添加</el-button>
62 </template>
46 </el-table-column> 63 </el-table-column>
47 </el-table> 64 </el-table>
48 </div> 65 </div>
66
67 <el-dialog v-dialogDrag title="添加字典" width="69%" :visible.sync="outerVisible">
68 <div style="height: 240px">
69 <div style="width: 100%;border: 1px solid #a8adad;">
70
71 <el-form :model="form" ref="form" label-width="110px" size="small">
72 <table border="1" width="100%" cellspacing="0" cellpadding="0" class="hTable">
73 <tbody>
74 <tr height="30">
75 <td colspan="2" align="center" >名称</td>
76 <td colspan="4" >
77 <el-input v-model="form.mc"></el-input>
78 </td>
79 <td colspan="2" align="center" >简称</td>
80 <td colspan="4" >
81 <el-input v-model="form.jc"></el-input>
82 </td>
83 </tr>
84 <tr height="30">
85 <td colspan="2" align="center" >代码</td>
86 <td colspan="4" >
87 <el-input v-model="form.dm"></el-input>
88 </td>
89 <td colspan="2" align="center" >其他代码</td>
90 <td colspan="4" >
91 <el-input v-model="form.qtdm"></el-input>
92 </td>
93 </tr>
94 <tr height="30">
95 <td colspan="2" align="center" >其他名称</td>
96 <td colspan="4" >
97 <el-input v-model="form.qtmc"></el-input>
98 </td>
99 <td colspan="2" align="center" >备注</td>
100 <td colspan="4" >
101 <el-input v-model="form.bz"></el-input>
102 </td>
103 </tr>
104 <tr height="30">
105 <td colspan="2" align="center" >字典类型</td>
106 <td colspan="10" >
107 <el-input v-model="form.zdType"></el-input>
108 </td>
109 </tr>
110 </tbody>
111 </table>
112 </el-form>
113 </div>
114 <div class="handleBtn">
115 <el-button type="primary" class="w98 creat" @click="insertDdicNode">保存</el-button>
116 <el-button type="primary" class="w98 cancel" @click="outerVisible = false">取消</el-button>
117 </div>
118 </div>
119 </el-dialog>
120
49 </div> 121 </div>
50 </div> 122 </div>
51 </template> 123 </template>
52 124
53 <script> 125 <script>
54 import {getAllDdic} from "@api/manage"; 126 import {getAllDdic,addDdicNode} from "@api/manage";
55 export default { 127 export default {
56 name: "index", 128 name: "index",
57 data(){ 129 data(){
58 return{ 130 return{
131
132 form:{
133 mc:'',
134 jc:'',
135 dm:'',
136 qtdm:'',
137 qtmc:'',
138 bz:'',
139 zdType:'',
140 },
141
59 tableData:[], 142 tableData:[],
60 errorLog:[], 143 errorLog:[],
61 concreteDic:'', 144 concreteDic:'',
145 zdType:'',
146
147 menuvisible:false,
148 menutop: 0,
149 menuleft: 0,
62 150
63 outerVisible: false, 151 outerVisible: false,
64 innerVisible: false, 152 innerVisible: false,
...@@ -91,6 +179,44 @@ ...@@ -91,6 +179,44 @@
91 } 179 }
92 }, 180 },
93 methods:{ 181 methods:{
182
183 insertDdicNode(){
184 addDdicNode(this.form).then((res)=>{
185 if(res.code === 200){
186 this.$message.success("添加成功!");
187 this.outerVisible = false;
188 }
189 });
190 },
191
192 editNode(){
193
194 },
195 addNode(data,source){
196 this.form={
197 mc:'',
198 jc:'',
199 dm:'',
200 qtdm:'',
201 qtmc:'',
202 bz:'',
203 zdType:'',
204 pbsm:'',
205 bsm:'',
206 };
207 // alert(JSON.stringify(data))
208 if(source === 0){
209 this.form.zdType = data;
210 }else if(source === 1){
211 this.form = data;
212 this.form.pbsm = data.bsm;
213 }
214 this.outerVisible = true
215 },
216 deleteNode(){
217
218 },
219
94 getData(){ 220 getData(){
95 let data={ 221 let data={
96 "mc": "", 222 "mc": "",
...@@ -120,10 +246,33 @@ ...@@ -120,10 +246,33 @@
120 reset(){ 246 reset(){
121 this.startValue = ""; 247 this.startValue = "";
122 this.endValue = ""; 248 this.endValue = "";
123 } 249 },
250 openMenu(e,item){
251 // alert(JSON.stringify(item));
252 this.menuleft = e.pageX;
253 this.menutop = e.pageY;
254 this.zdType = item.name;
255 this.changemenuVisible(true);
256 },
257 changemenuVisible(data) {
258 this.menuvisible = data;
259 },
260 //关闭右键菜单
261 closeMenu(){
262 this.menuvisible = false;
263 },
124 }, 264 },
125 mounted() { 265 mounted() {
126 this.getData(); 266 this.getData();
267 },
268 watch:{
269 menuvisible(value) {
270 if (value) {
271 document.body.addEventListener("click", this.closeMenu);
272 } else {
273 document.body.removeEventListener("click", this.closeMenu);
274 }
275 },
127 } 276 }
128 } 277 }
129 </script> 278 </script>
...@@ -170,6 +319,14 @@ ...@@ -170,6 +319,14 @@
170 width: 100px; 319 width: 100px;
171 margin-left: 15px; 320 margin-left: 15px;
172 } 321 }
322 .menu-title{
323 font-weight: bold;
324 font-size: 20px;
325 margin-top: 20px;
326 margin-left: 5px;
327 float: left;
328 width: 100%
329 }
173 330
174 ul{ 331 ul{
175 list-style-type: circle; 332 list-style-type: circle;
...@@ -187,5 +344,23 @@ ...@@ -187,5 +344,23 @@
187 width: 20px; 344 width: 20px;
188 } 345 }
189 346
347 /deep/.el-input__inner{
348 width: 100%;
349 border:0;
350 }
351
352 table{
353 background: #fff;
354 table-layout: fixed;
355 }
356
357 .handleBtn{
358 width: 314px;
359 position: absolute;
360 left: 50%;
361 margin-left: -250px;
362 margin-top: 10px;
363 }
364
190 365
191 </style> 366 </style>
...\ No newline at end of file ...\ No newline at end of file
......