fileFolder.js 1.9 KB
Newer Older
doc_wei's avatar
doc_wei 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

layui.config({
	base: basePath, 
	version: skyeyeVersion
}).extend({
    window: 'js/winui.window'
}).define(['window', 'jquery', 'winui', 'fsCommon', 'fsTree'], function (exports) {
	winui.renderColor();
	layui.use(['form'], function (form) {
		var index = parent.layer.getFrameIndex(window.name);
		var $ = layui.$
			fsTree = layui.fsTree,
			fsCommon = layui.fsCommon;
		
		/********* tree 处理   start *************/
		var ztree = null;
		fsTree.render({
			id: "treeDemo",
doc_wei's avatar
doc_wei 已提交
19
			url: reqBasePath + "fileconsole001?loginPCIp=" + returnCitySN["cip"],
doc_wei's avatar
doc_wei 已提交
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
			checkEnable: true,
			loadEnable: true,//异步加载
			showLine: false,
			chkStyle: 'radio',
			showIcon: true,
			onDblClick: function(){
			},
			onAsyncSuccess: function(id){
			}
		}, function(id){
			ztree = $.fn.zTree.getZTreeObj(id);
		});
		
		matchingLanguage();
		var saveBtn = true;
		//保存
		$("body").on("click", "#saveBtn", function(){
			if(saveBtn){
				var node = ztree.getCheckedNodes();
				if(isNull(node)){//如果节点为空
					winui.window.msg("请选择目录。", {icon: 2,time: 2000});
				}else{
					var jsonStr = JSON.stringify(parent.chooseSaveIds);
					var folderId = node[0].id;
					var params = {
						folderId: folderId,
						jsonStr: jsonStr
					};
					saveBtn = false;
					winui.window.msg("文件正在保存,期间请勿进行其他操作。", {icon: 7,time: 4000});
doc_wei's avatar
doc_wei 已提交
50
					AjaxPostUtil.request({url:reqBasePath + "fileconsole023", params: params, type: 'json', callback: function(json){
doc_wei's avatar
doc_wei 已提交
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
						saveBtn = true;
						if(json.returnCode == 0){
							parent.layer.close(index);
							parent.refreshCode = '0';
						}else{
							winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
						}
					}});
				}
			}else{
				winui.window.msg("文件正在保存,期间请勿进行其他操作。", {icon: 7,time: 4000});
			}
		});
		
		/********* tree 处理   end *************/
		
	});
});