4d8b44b8 by zhaoqian

字典管理数据联调

1 parent 5afbf597
......@@ -43,3 +43,25 @@ export function addDdicNode(data) {
data: data,
})
}
/**
* 删除字典节点
*/
export function deleteDdicNode(data) {
return request({
url: '/system/dictionary/deleteDdicNode',
method: 'post',
data: data,
})
}
/**
* 添加字典节点
*/
export function editDdicNode(data) {
return request({
url: '/system/dictionary/editDdicNode',
method: 'post',
data: data,
})
}
\ No newline at end of file
......
......@@ -2,14 +2,7 @@
<div class="log-content">
<div class="log-search">
字典名称:
<el-date-picker
v-model="startValue"
type="datetime"
placeholder="选择日期时间"
align="right"
value-format="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions">
</el-date-picker>
<el-input v-model="searchKey" style="border: 1px solid #C0C4CC;width: 230px;border-radius: 4px" placeholder="请输入内容"></el-input>
<el-button type="primary" @click="query">查询</el-button>
<el-button type="warning" @click="reset">重置</el-button>
</div>
......@@ -34,9 +27,8 @@
:style="{ left: menuleft + 'px', top: menutop + 'px' }"
class="contextmenu"
>
<li @click="editNode">编辑</li>
<li @click="addNode(zdType,0)">添加</li>
<li @click="deleteNode">删除</li>
<li @click="deleteNode(zdType,0)">删除</li>
</ul>
<div class="log-table">
<el-table
......@@ -56,15 +48,15 @@
</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" @click="editNode(scope.row)">编辑</el-button>
<el-button type="text" class="operatorBtn" @click="deleteNode(scope.row,1)">删除</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">
<el-dialog v-dialogDrag :title="isAdd ? '添加字典':'编辑字典'" width="69%" :visible.sync="outerVisible">
<div style="height: 240px">
<div style="width: 100%;border: 1px solid #a8adad;">
......@@ -103,16 +95,20 @@
</tr>
<tr height="30">
<td colspan="2" align="center" >字典类型</td>
<td colspan="10" >
<td colspan="4" >
<el-input v-model="form.zdType"></el-input>
</td>
<td colspan="2" align="center" >顺序号</td>
<td colspan="4" >
<el-input v-model="form.sxh"></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 creat" @click="saveDdicNode">保存</el-button>
<el-button type="primary" class="w98 cancel" @click="outerVisible = false">取消</el-button>
</div>
</div>
......@@ -123,7 +119,7 @@
</template>
<script>
import {getAllDdic,addDdicNode} from "@api/manage";
import {getAllDdic,addDdicNode,deleteDdicNode,editDdicNode} from "@api/manage";
export default {
name: "index",
data(){
......@@ -137,11 +133,14 @@
qtmc:'',
bz:'',
zdType:'',
sxh:'',
},
searchKey:'',
isAdd:true,
tableData:[],
errorLog:[],
concreteDic:'',
concreteDic:[],
zdType:'',
menuvisible:false,
......@@ -180,19 +179,35 @@
},
methods:{
insertDdicNode(){
saveDdicNode(){
if(this.isAdd){
addDdicNode(this.form).then((res)=>{
if(res.code === 200){
this.$message.success("添加成功!");
this.outerVisible = false;
this.removeStorage();
this.getData();
}
});
}else {
editDdicNode(this.form).then((res)=>{
if(res.code === 200){
this.$message.success("修改成功!");
this.outerVisible = false;
this.removeStorage();
this.getData();
}
});
}
},
editNode(){
editNode(data){
this.isAdd = false;
this.form = data;
this.outerVisible = true
},
addNode(data,source){
this.isAdd = true;
this.form={
mc:'',
jc:'',
......@@ -203,23 +218,45 @@
zdType:'',
pbsm:'',
bsm:'',
sxh:'',
};
// alert(JSON.stringify(data))
if(source === 0){
this.form.zdType = data;
}else if(source === 1){
this.form = data;
this.form.zdType = data.zdType;
this.form.pbsm = data.bsm;
}
this.outerVisible = true
},
deleteNode(){
deleteNode(data,source){
this.$confirm('是否确定删除该'+name+'?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then((res)=>{
let params = {
"bsm": "",
"zdType": ""
};
if(source === 0){
params.zdType = data;
}else if(source === 1){
params.bsm = data.bsm;
}
deleteDdicNode(params).then((res)=>{
if(res.code === 200){
this.$message.success("删除完成!");
}
this.removeStorage();
this.getData();
})
});
},
getData(){
let data={
"mc": "",
"mc": this.searchKey,
"pbsm": ""
};
getAllDdic(data).then((res)=>{
......@@ -235,17 +272,19 @@
},
query(){
let data={
"mc": "",
"mc": this.searchKey,
"pbsm": ""
};
getAllDdic(data).then((res)=>{
console.log(res.result);
this.tableData = res.result;
if(this.tableData.length>0){
this.concreteDic = this.tableData[0].value;
}
})
},
reset(){
this.startValue = "";
this.endValue = "";
this.searchKey = "";
},
openMenu(e,item){
// alert(JSON.stringify(item));
......@@ -261,6 +300,9 @@
closeMenu(){
this.menuvisible = false;
},
removeStorage(){
sessionStorage.removeItem("state");
},
},
mounted() {
this.getData();
......