瀏覽代碼

数据字典

zhangshuangnan 8 年之前
父節點
當前提交
a6044d5abb

+ 2 - 2
WebUI/CallCenterWeb.UI/SystemManager/css/shuJuZiDian.css

@@ -21,14 +21,14 @@
21 21
 			.inpBox {
22 22
 				border: 1px solid #a9a9a9;
23 23
 				height: 27px;
24
-				width: 55%;;
24
+				width: 37%;;
25 25
 				display: inline-block;
26 26
 				position: relative;
27 27
 				vertical-align: middle;
28 28
 			}
29 29
 			
30 30
 			.inps1,
31
-			.inps4 ,.inps5,.inps6{
31
+			.inps4{
32 32
 				width: 100%;
33 33
 				height: 24px;
34 34
 				outline: none;

+ 344 - 86
WebUI/CallCenterWeb.UI/SystemManager/js/shuJuZiDian.js

@@ -1,87 +1,345 @@
1
+	var tps = $('.tps');
2
+	var id = ''; //当前节点id
3
+	var name=''; //当前节点name
4
+	var pid; //当前节点父ID
5
+	var pidName;//
6
+	var xlName; //添加弹出框内下拉框内节点name
1 7
 	var token = $.cookie("token");
2
-	var tree;
3
-var setting = {
4
-    data: {
5
-        key: {
6
-            name: "text"
7
-        },
8
-//      simpleData: {
9
-//          enable: true,
10
-//          idKey: "F_DeptId",
11
-//          pIdKey: "F_PartentId",
12
-//          rootPId: -1
13
-//      }
14
-    }
15
-};
16
-$(document).ready(function () {
17
-    bind();
18
-    $(".add").click(function () {
19
-        layer.open({
20
-            type: 2,
21
-            content: "ziDianEdit.html", //iframe的url,no代表不显示滚动条
22
-            title: '新增字典标志',
23
-            area: ['40%', '50%'], //宽高
24
-        });
25
-    })
26
-    $(".change").click(function () {
27
-        var nodes = tree.getSelectedNodes();
28
-        if (nodes.length != 1) {
29
-            layer.confirm('请选择一条记录!', {
30
-                btn: ['确定']
31
-            });
32
-            return;
33
-        }
34
-        else {
35
-            layer.open({
36
-                type: 2,
37
-                content: "ziDianEdit.html?id=" + nodes[0].id, //iframe的url,no代表不显示滚动条
38
-                title: '修改字典标志',
39
-                area: ['40%', '50%'], //宽高
40
-            });
41
-        }
42
-    })
43
-    $(".del").click(function () {
44
-        var nodes = tree.getSelectedNodes();
45
-        if (nodes.length != 1) {
46
-            layer.confirm('请选择一条记录!', {
47
-                btn: ['确定']
48
-            });
49
-            return;
50
-        }
51
-        else {
52
-            node = nodes[0];
53
-            $('.delModel').css('display', 'block');
54
-            $('.delName').html(node.text);
55
-        }
56
-    })
57
-
58
-    //关闭按钮
59
-    $('.delBtr').click(function () {
60
-        $('.delModel').css('display', 'none');
61
-    })
62
-    //取消按钮
63
-    $('.return').click(function () {
64
-        $('.delModel').css('display', 'none');
65
-    })
66
-
67
-    //确定删除按钮
68
-    $('.sure').click(function () {
69
-        var nodes = tree.getSelectedNodes();
70
-        $.post(huayi.config.callcenter_url + "Dictionary/DelDicValue", { id: nodes[0].id, "token": $.cookie("token") }, function (result) {
71
-            result = JSON.parse(result);
72
-            if (result.state.toLowerCase() == "success") {
73
-                layer.msg(result.message);
74
-                $('.delModel').css('display', 'none');
75
-                bind();
76
-            }
77
-        })
78
-    })
79
-})
80
-
81
-function bind() {
82
-    $.getJSON(huayi.config.callcenter_url + "Dictionary/GetZTreeList", { "token": $.cookie("token") }, function (result) {
83
-        if (result.state.toLowerCase() == "success") {
84
-            tree = $.fn.zTree.init($("#treeDemo"), setting, result.data);
85
-        }
86
-    })
87
-}
8
+	tree();
9
+
10
+	function tree() {
11
+		$.get(huayi.config.callcenter_url + 'Dictionary/GetZTreeList', {
12
+			"token": $.cookie("token"),
13
+//			"pid": pid
14
+		}, function(result) {
15
+			result = $.parseJSON(result);
16
+			$.fn.zTree.init($("#treeDemo"), setting1, result.data); //实例化树形图
17
+		});
18
+	}
19
+
20
+	var setting1 = {
21
+		data: {
22
+			key: {
23
+				name: "text"
24
+			},
25
+			simpleData: {
26
+				enable: true,
27
+				idKey: "id",
28
+				rootPId: 0
29
+			}
30
+		},
31
+		callback: {
32
+			onClick: zTreeOnClick
33
+		}
34
+	};
35
+
36
+	function zTreeOnClick(event, treeId, treeNode) {
37
+		id = treeNode.id;
38
+		name = treeNode.text;
39
+		var pidnode = treeNode.getParentNode();
40
+		if(pidnode) {
41
+			pidName = pidnode.text;
42
+			pid = pidnode.id;
43
+		} else {
44
+			pidName = "顶级分类";
45
+			pid =0;
46
+		}
47
+	};
48
+	var setting2 = {
49
+		data: {
50
+			key: {
51
+				name: "text"
52
+			},
53
+			simpleData: {
54
+				enable: true,
55
+				idKey: "id",
56
+				rootPId: 0
57
+			}
58
+		},
59
+		callback: {
60
+			onClick: addTreeClick
61
+		}
62
+	}
63
+
64
+	function addTreeClick(event, treeId, treeNode) {
65
+		addPid = treeNode.id;
66
+		console.log(addPid);
67
+		xlName = treeNode.text;
68
+		$('.inps1').val(xlName);
69
+
70
+	};
71
+	//删除按钮
72
+	$('.del').click(function() {
73
+		if(id == 'null' || id == '') {
74
+			layer.confirm('没有要删除的分类!', {
75
+				btn: ['确定']
76
+			});
77
+			return
78
+		} else {
79
+			$('.delModel').css('display', 'block');
80
+			$('.delName').html(name);
81
+		}
82
+	})
83
+	//关闭按钮
84
+	$('.delBtr').click(function() {
85
+		$('.delModel').css('display', 'none');
86
+	})
87
+	//确定删除按钮
88
+	$('.sure').click(function() {
89
+		$.ajax({
90
+			type: "post",
91
+			url: huayi.config.callcenter_url + "Dictionary/DelDicValue",
92
+			async: true,
93
+			dataType: 'json',
94
+			data: {
95
+				ids: id,
96
+				token: token
97
+			},
98
+			success: function(data) {
99
+				if(data.state == "success") {
100
+					layer.msg("删除成功!");
101
+					tree();
102
+				}
103
+			}
104
+		});
105
+		$('.delModel').css('display', 'none');
106
+
107
+	})
108
+	//取消删除按钮
109
+	$('.return').click(function() {
110
+		$('.delModel').css('display', 'none');
111
+	})
112
+
113
+	//添加按钮
114
+	$('.add').click(function() {
115
+		$('.addModel').css('display', 'block');
116
+		if(name) {
117
+			tps.html(name);
118
+			$('.inps1').val(name);
119
+			addPid = id;
120
+		} else {
121
+			tps.html('顶级分类');
122
+			$('.inps1').val('顶级分类');
123
+			addPid = 0;
124
+		}
125
+		treeCont();
126
+
127
+	})
128
+	//添加关闭按钮
129
+	$('.addBtr').click(function() {
130
+		$('.addModel').css('display', 'none');
131
+	})
132
+	//添加内容下拉
133
+	$('.inps1').click(function() {
134
+		$('.xlAdd').css('display', 'block')
135
+	})
136
+	$('.xl_one').click(function() {
137
+		if($('.xlAdd').css('display') == 'block') {
138
+			$('.xlAdd').css('display', 'none')
139
+		} else {
140
+			$('.xlAdd').css('display', 'block')
141
+		}
142
+	})
143
+	$('.addTree').mouseleave(function() {
144
+		$(this).css('display', 'none')
145
+	})
146
+	//保存添加按钮
147
+	var addPid, addDeptname, addSort;
148
+	//添加弹出框内 所属部门下拉框内数据
149
+	function treeCont() {
150
+		$.get(huayi.config.callcenter_url + 'Dictionary/GetZTreeList', {
151
+			"token": $.cookie("token"),
152
+//			"pid": pid
153
+		}, function(result) {
154
+			result = $.parseJSON(result);
155
+			$.fn.zTree.init($("#addTreeDemo"), setting2, result.data); //实例化树形图
156
+		});
157
+
158
+	}
159
+	$('.addCun').click(function() {
160
+						console.log(addPid);
161
+		if($('.inps2').val() == "") {
162
+		    if (addPid.length <= 0) {
163
+				layer.confirm('所添加内容不能为空!', {
164
+					btn: ['确定']
165
+				});
166
+				return;
167
+			}
168
+		} else {
169
+			addDeptname = $('.inps2').val();
170
+			$('.addModel').css('display', 'none');
171
+			$.ajax({
172
+				type: "post",
173
+				url: huayi.config.callcenter_url + "Dictionary/AddDicValue",
174
+				dataType: 'json',
175
+				async: true,
176
+				data: {
177
+					pid: addPid, //当前选择节点ID
178
+					name: addDeptname, //部门名称
179
+					token: token
180
+				},
181
+				success: function(data) {
182
+					//					console.log(data)
183
+					//					console.log(data.state);
184
+					if(data.state == "success") {
185
+						layer.msg("添加成功!");
186
+						tree();
187
+						$('.inps1').val('');
188
+						$('.inps2').val('');
189
+						$('.inps3').val('');
190
+
191
+					}
192
+				}
193
+
194
+			});
195
+
196
+		}
197
+	})
198
+
199
+	//修改按钮
200
+	var chanPid, //修改弹出框内 下拉框父节点ID
201
+		chanId, //修改弹出框内 下拉框当前节点ID
202
+		changeName, //修改弹出框内 下拉框当前节点name
203
+		chbcName, //保存的部门名称
204
+		chbcSort, //保存的排序号
205
+		chbcPid; //保存的所属部门ID
206
+	$('.change').click(function() {
207
+		if(id == 'null' || id == '') {
208
+			layer.confirm('没有选择要修改的项!', {
209
+				btn: ['确定']
210
+			})
211
+			return
212
+		} else {
213
+			changeAjax(id);
214
+			$('.changeModel').css('display', 'block');
215
+			$('.chtps').html(name);
216
+//			console.log(pidName);
217
+//			console.log(pid);
218
+			$('.inps4').val(pidName);
219
+			chbcPid=pid;
220
+			changeTreeCont();
221
+		}
222
+
223
+	});
224
+	//关闭按钮
225
+	$('.changeBtr').click(function() {
226
+		$('.changeModel').css('display', 'none');
227
+	}) ;
228
+	$('.inps4').click(function() {
229
+		$('.xlChange').css('display', 'block')
230
+	})
231
+	//下拉按钮功能
232
+	$('.xl_two').click(function() {
233
+		if($('.xlChange').css('display') == 'block') {
234
+			$('.xlChange').css('display', 'none')
235
+		} else {
236
+			$('.xlChange').css('display', 'block')
237
+		}
238
+	})
239
+	//修改弹出框内 下拉树形图参数配置项
240
+	var setting3 = {
241
+		data: {
242
+			key: {
243
+				name: "text"
244
+			},
245
+			simpleData: {
246
+				enable: true,
247
+				idKey: "id",
248
+				rootPId: 0
249
+			}
250
+		},
251
+		callback: {
252
+			onClick: changeTreeClick
253
+		}
254
+	}
255
+
256
+	function changeTreeClick(event, treeId, treeNode) {
257
+//		chanPid = treeNode.pId;
258
+		chanId = treeNode.id;
259
+		changeName = treeNode.text;
260
+		$('.inps4').val(changeName);
261
+		var pidnode = treeNode.getParentNode();
262
+		if(pidnode) {
263
+			chanPid = pidnode.id;
264
+		} else {
265
+			chanPid =0;
266
+		}
267
+		chbcPid=chanId;
268
+	};
269
+
270
+	//修改弹出框内 所属部门下拉框内数据
271
+	function changeTreeCont() {
272
+		$.get(huayi.config.callcenter_url + 'Dictionary/GetZTreeList', {
273
+			"token": $.cookie("token"),
274
+//			"pid": pid
275
+		}, function(result) {
276
+			result = $.parseJSON(result);
277
+			$.fn.zTree.init($("#changeTreeDemo"), setting3, result.data); //实例化树形图
278
+		});
279
+	}
280
+
281
+	function changeAjax(id) {
282
+		$.ajax({
283
+			type: "get",
284
+			url: huayi.config.callcenter_url + "Dictionary/GetDicValue",
285
+			dataType: 'json',
286
+			async: true,
287
+			data: {
288
+				id: id,
289
+				token: token
290
+			},
291
+			success: function(data) {
292
+				var chanCon = data.data;
293
+				if(pid == 0) {
294
+					$('.inps4').val('顶级分类');
295
+					chbcPid =pid;
296
+				} else {
297
+					$('.inps4').val(pidName);
298
+					chbcPid=pid;
299
+				}
300
+				$('.inps5').val(chanCon.F_Value);
301
+//				$('.inps6').val(chanCon.sort);
302
+//				chbcSort = chanCon.sort;
303
+				chbcName = chanCon.F_Value;
304
+			}
305
+		});
306
+	}
307
+	//修改的保存按钮功能
308
+	function changeBaoCunAjax(id, chbcPid, chbcName) {
309
+		$.ajax({
310
+			type: "post",
311
+			url: huayi.config.callcenter_url + "Dictionary/AddDicValue",
312
+			async: true,
313
+			dataType: 'json',
314
+			data: {
315
+				id: id,
316
+				pid: chbcPid,
317
+				name: chbcName,
318
+				token: token
319
+			},
320
+			success: function(data) {
321
+				if(data.state == "success") {
322
+					layer.msg("修改成功!");
323
+					tree();
324
+				}
325
+			}
326
+		});
327
+	}
328
+
329
+	$('.changeCun').click(function() {
330
+		if($('.inps4').val() == "" || $('.inps5').val() == "") {
331
+			layer.confirm('所修改内容不允许为空!', {
332
+				btn: ['确定']
333
+			});
334
+			return;
335
+		} else {
336
+			$('.changeModel').css('display', 'none');
337
+			console.log('部门id'+id +'所属部门id' + chbcPid +'部门名称'+chbcName+'排序'+chbcSort);
338
+			chbcPid;
339
+			chbcName = $('.inps5').val();
340
+//			chbcSort = $('.inps6').val();
341
+			changeBaoCunAjax(id, chbcPid, chbcName);
342
+		}
343
+
344
+	})
345
+

+ 68 - 17
WebUI/CallCenterWeb.UI/SystemManager/shuJuZiDian.html

@@ -31,25 +31,76 @@
31 31
         </div>
32 32
 
33 33
     </div>
34
-    <!--删除弹出内容-->
35
-    <div class="model delModel">
36
-        <div class="box">
37
-            <div class="btop clearfix">
38
-                <p class="btl"><span>删除提示</span></p>
39
-                <p class="btr delBtr" title="关闭">X</p>
40
-            </div>
41
-            <div class="boxCon" style="height: 150px;">
42
-                您确定删除&nbsp;&lfloor;&nbsp;&nbsp;<span class="delName" style="color: red;"></span>&nbsp;&nbsp;&rceil;&nbsp;?
34
+ <!--添加弹出内容-->
35
+		<div class="model addModel">
36
+			<div class="box">
37
+				<div class="btop clearfix">
38
+					<p class="btl"><span>添加</span>&nbsp;&lfloor;&nbsp;&nbsp;<span class="tps" style="color: red;"></span>&nbsp;&nbsp;&rceil;&nbsp;分类</p>
39
+					<p class="btr addBtr" title="关闭">X</p>
40
+				</div>
41
+				<div class="boxCon">
42
+					<div>所属分类:
43
+						<div class="inpBox">
44
+							<input type="text" class="inps inps1" />
45
+							<i class="xl xl_one"></i>
46
+							<div class="addTree xlAdd">
47
+								<ul id="addTreeDemo" class="ztree">
48
+									
49
+								</ul>
50
+							</div>
51
+						</div>
52
+					</div>
53
+					<div>分类名称:<input class="inps inps2" type="text" /></div>
54
+					<!--<div>排列序号:<input class="inps inps3" type="text" /></div>-->
55
+					<div><button class="btns addCun">保存</button></div>
56
+				</div>
57
+			</div>
43 58
 
44
-                <p style="margin-top: 30px;">
45
-                    <button class="btns sure">确定</button>
46
-                    <button class="btns return">取消</button>
47
-                </p>
48
-                <p style="color: red;">注:该级别下的部门会一并删除</p>
49
-            </div>
59
+		</div>
60
+		<!--删除弹出内容-->
61
+		<div class="model delModel">
62
+			<div class="box">
63
+				<div class="btop clearfix">
64
+					<p class="btl"><span>删除提示</span></p>
65
+					<p class="btr delBtr" title="关闭">X</p>
66
+				</div>
67
+				<div class="boxCon" style="height: 150px;">
68
+					您确定删除&nbsp;&lfloor;&nbsp;&nbsp;<span class="delName" style="color: red;"></span>&nbsp;&nbsp;&rceil;&nbsp;?
50 69
 
51
-        </div>
52
-    </div>
70
+					<p style="margin-top: 30px;"><button class="btns sure">确定</button>
71
+						<button class="btns return">取消</button></p>
72
+					<!--<p style="color: red;">注:若该分类下包含知识库内容会一并删除</p>-->
73
+				</div>
74
+
75
+			</div>
76
+
77
+		</div>
78
+		<!--修改弹出内容-->
79
+		<div class="model changeModel">
80
+			<div class="box">
81
+				<div class="btop clearfix">
82
+					<p class="btl"><span>修改</span>&nbsp;&lfloor;&nbsp;&nbsp;<span class="tps chtps" style="color: red;"></span>&nbsp;&nbsp;&rceil;&nbsp;分类</p>
83
+					<p class="btr changeBtr" title="关闭">X</p>
84
+				</div>
85
+				<div class="boxCon">
86
+					<div>所属分类:
87
+						<div class="inpBox">
88
+							<input type="text" class="inps inps4" />
89
+							<i class="xl xl_two"></i>
90
+							<div class="addTree xlChange">
91
+								<ul id="changeTreeDemo" class="ztree">
92
+									
93
+								</ul>
94
+							</div>
95
+						</div>
96
+					</div>
97
+					<div>分类名称:<input class="inps inps5" type="text" /></div>
98
+					<div><button class="btns changeCun">保存</button></div>
99
+				</div>
100
+			</div>
101
+
102
+		</div>
103
+	
53 104
 
54 105
     <script src="../js/zTree/jquery.ztree.core.js"></script>
55 106
     <script src="../css/layer/layer.js"></script>

+ 2 - 0
WebUI/CallCenterWeb.UI/SystemManager/ziDianEdit.html

@@ -70,6 +70,7 @@
70 70
                                 </div>
71 71
                             </td>
72 72
                         </tr>
73
+                        
73 74
                         <tr>
74 75
                             <th>字典标志:</th>
75 76
                             <td>
@@ -100,6 +101,7 @@
100 101
             $(".seldept").mouseleave(function () {
101 102
                 $(".seldept").hide();
102 103
             })
104
+            
103 105
 
104 106
             if (id) {
105 107
                 $.getJSON(huayi.config.callcenter_url + 'Dictionary/GetDicValue', {