You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
175 lines
6.2 KiB
175 lines
6.2 KiB
|
|
define(function (require, exports, module) {
|
|
//引入业务类基类
|
|
let BaseBiz = require('apps/rht/base/rhtBiz');
|
|
let service = require('./sys010105service');
|
|
let UApp = require('apps/rht/comm/UApp');
|
|
let selOrgs; //树状列表选中的组织
|
|
let autoOverOrg; // 自动结账组织表数据
|
|
|
|
/**
|
|
* 定义业务类对象
|
|
* @param vm 界面相关ViewModule
|
|
*/
|
|
function Biz(vm) {
|
|
//继承第一步,构造继承
|
|
BaseBiz.call(this, vm);
|
|
}
|
|
|
|
//继承第二步,方法继承
|
|
inherits(Biz, BaseBiz);
|
|
|
|
/**
|
|
* @description 点击【重置日结状态】按钮
|
|
*/
|
|
function btnReSetClick() {
|
|
//确认是否需要结账
|
|
Store.messager.confirm('确认要重置所有组织的日结状态吗?',
|
|
function (isOK) {
|
|
//点击【取消】跳出
|
|
if (!isOK) {
|
|
return;
|
|
} else { //点击【确定】重置
|
|
let ret = service.ResetAutoOverStatus();
|
|
if(ret.result != 1) {
|
|
Store.messager.err('重置失败!!' + ret.message);
|
|
return false;
|
|
}
|
|
Store.messager.tip('重置成功!');
|
|
return true;
|
|
}
|
|
})
|
|
};
|
|
|
|
/**
|
|
* @description 点击【确定】按钮
|
|
*/
|
|
function btnOkClick() {
|
|
//确认是否需要结账
|
|
Store.messager.confirm('确认要保存设置吗?',
|
|
function (isOK) {
|
|
//点击【取消】跳出
|
|
if (!isOK) {
|
|
return;
|
|
} else { //点击【确定】执行结账处理
|
|
//获取修改过勾选的节点信息
|
|
selOrgs = $.fn.zTree.getZTreeObj('tree_Org').getChangeCheckedNodes(true);
|
|
let ret = service.UpdateAutoOverOrg(selOrgs);
|
|
if(ret.result != 1) {
|
|
Store.messager.err('保存失败!!' + ret.message);
|
|
return false;
|
|
}
|
|
|
|
Store.messager.tip('保存成功!');
|
|
initTree($('#tree_Org'));
|
|
return true;
|
|
}
|
|
})
|
|
};
|
|
|
|
/**
|
|
* @description 点击树时
|
|
* @param {*} e
|
|
* @param {*} treeId 树ID
|
|
* @param {*} treeNode 节点ID
|
|
*/
|
|
function onNodeTreeClick(e, treeId, treeNode) {
|
|
//无处理
|
|
};
|
|
|
|
/**
|
|
* @description 节点checked或unchecked时
|
|
* @param {*} e
|
|
* @param {*} treeId 树ID
|
|
* @param {*} treeNode 节点ID
|
|
*/
|
|
function onNodeCheck(e, treeId, treeNode) {
|
|
|
|
};
|
|
|
|
/**
|
|
* @description 初始化树状列表
|
|
* @param {*} treeObj 树对象
|
|
*/
|
|
function initTree(treeObj) {
|
|
//树选项
|
|
let treeSetting = {
|
|
view: {
|
|
selectedMulti: false //允许多选
|
|
},
|
|
check: {
|
|
enable: true, //允许勾选
|
|
chkboxType: {
|
|
"Y": "s",
|
|
"N": "s"
|
|
} //父节点与子节点勾选关系
|
|
},
|
|
data: {
|
|
simpleData: {
|
|
enable: true //使用简单JSON构建树
|
|
}
|
|
},
|
|
callback: {
|
|
onClick: onNodeTreeClick, //单击时响应事件
|
|
onCheck: onNodeCheck //勾选时响应事件
|
|
}
|
|
};
|
|
|
|
// 获取自动结账组织信息
|
|
let ret = service.GetAutoOverOrg();
|
|
if(ret.result != 1) {
|
|
Store.messager.err('获取自动结账组织信息失败!!');
|
|
return false;
|
|
}
|
|
autoOverOrg = ret.data;
|
|
|
|
//调用插件获取组织信息并组装为树的节点信息
|
|
let OrgTreeInfo = service.GetOrgTree(Store.logOn.orgCode);
|
|
let zTreeNodes = [];
|
|
let orgCode;
|
|
let isCheck;
|
|
if (OrgTreeInfo.result != 1) {
|
|
Store.MESSAGER.err(OrgTreeInfo.message);
|
|
} else {
|
|
for (let i = 0, len = OrgTreeInfo.data.length; i <= len - 1; i++) {
|
|
isCheck = false;
|
|
orgCode = OrgTreeInfo.data[i].orgcode;
|
|
for (let j = 0; j < autoOverOrg.length; j++) {
|
|
if(orgCode == autoOverOrg[j].orgcode) {
|
|
isCheck = autoOverOrg[j].isautojob == '1' ? true : false;
|
|
break;
|
|
}
|
|
}
|
|
zTreeNodes.push({
|
|
id: OrgTreeInfo.data[i].id, //节点ID
|
|
pId: OrgTreeInfo.data[i].pid, //父节点ID
|
|
orgcode: OrgTreeInfo.data[i].orgcode, //组织编码
|
|
orgname: OrgTreeInfo.data[i].orgname, //组织名称
|
|
name: OrgTreeInfo.data[i].orgcode + '-' + OrgTreeInfo.data[i].orgname, //节点显示信息
|
|
open: true, //是否展开
|
|
checked: isCheck
|
|
});
|
|
};
|
|
};
|
|
|
|
//创建树
|
|
$.fn.zTree.init(treeObj, treeSetting, zTreeNodes);
|
|
};
|
|
|
|
/**
|
|
* @description 初始化完毕
|
|
*/
|
|
Biz.prototype.initCompleted = function () {
|
|
//对页面中的元素进行事件绑定
|
|
let btnReSet = document.getElementById('btnReSet');
|
|
btnReSet.addEventListener('click', btnReSetClick, false);
|
|
|
|
let btnOk = document.getElementById('btnOk');
|
|
btnOk.addEventListener('click', btnOkClick, false);
|
|
|
|
//初始化组织树
|
|
initTree($('#tree_Org'));
|
|
};
|
|
|
|
return Biz;
|
|
}); |