|
|
|
|
define(function (require, exports, module) {
|
|
|
|
|
|
|
|
|
|
//引入rhtService,用于调用插件
|
|
|
|
|
let rhtService = require('../base/rhtService');
|
|
|
|
|
|
|
|
|
|
function getRhtOptionValue(orgcode, section, sysoption, defaultvalue) {
|
|
|
|
|
if (Store.Cache.get('local_option')) {
|
|
|
|
|
let data = Store.Cache.getJSON('local_option')
|
|
|
|
|
let options = data.filter(item => item.optionCode === sysoption && item.orgCode === orgcode)
|
|
|
|
|
|
|
|
|
|
if (options.length === 0) {
|
|
|
|
|
options = data.filter(item => item.optionCode === sysoption && item.orgCode === '*')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return options.length > 0 ? options[0].optionValue : defaultvalue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.getRhtOptionValue',{
|
|
|
|
|
orgcode:orgcode,
|
|
|
|
|
section:section,
|
|
|
|
|
sysoption:sysoption,
|
|
|
|
|
defaultvalue:defaultvalue});
|
|
|
|
|
return ret.data.optionvalue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取核算部门长度
|
|
|
|
|
function getOptionOrgAccLevel(){
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.getOptionOrgAccLevel',{});
|
|
|
|
|
return ret.data.accLength;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取产品类型
|
|
|
|
|
function getProductClass(){
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.getProductClass',{});
|
|
|
|
|
return ret.data.Product_Class;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//记录操作日志
|
|
|
|
|
function MWriteOprLog(OrgCode,UserID,UserCode,UserName,Computer,ComputerInfo,LogPosition,LogContent){
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.MWriteOprLog',{
|
|
|
|
|
OrgCode:OrgCode,
|
|
|
|
|
UserID:UserID,
|
|
|
|
|
UserCode:UserCode,
|
|
|
|
|
UserName:UserName,
|
|
|
|
|
Computer:Computer,
|
|
|
|
|
ComputerInfo:ComputerInfo,
|
|
|
|
|
LogPosition:LogPosition,
|
|
|
|
|
LogContent:LogContent
|
|
|
|
|
});
|
|
|
|
|
if (ret.result !== 1){
|
|
|
|
|
Store.messager.warn('记录操作日志失败!')
|
|
|
|
|
}
|
|
|
|
|
return ret.result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//记录操作失败日志
|
|
|
|
|
function MWriteErrLog(OrgCode,UserID,UserCode,UserName,Computer,ComputerInfo,LogPosition,LogContent){
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.MWriteErrLog',{
|
|
|
|
|
OrgCode:OrgCode,
|
|
|
|
|
UserID:UserID,
|
|
|
|
|
UserCode:UserCode,
|
|
|
|
|
UserName:UserName,
|
|
|
|
|
Computer:Computer,
|
|
|
|
|
ComputerInfo:ComputerInfo,
|
|
|
|
|
LogPosition:LogPosition,
|
|
|
|
|
LogContent:LogContent
|
|
|
|
|
});
|
|
|
|
|
if (ret.result !== 1){
|
|
|
|
|
Store.messager.warn('记录操作失败日志失败!')
|
|
|
|
|
}
|
|
|
|
|
return ret.result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//记录其他操作日志
|
|
|
|
|
function MWriteOtherLog(OrgCode,UserID,UserCode,UserName,Computer,ComputerInfo,LogPosition,LogContent,LogType){
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.MWriteOtherLog',{
|
|
|
|
|
OrgCode:OrgCode,
|
|
|
|
|
UserID:UserID,
|
|
|
|
|
UserCode:UserCode,
|
|
|
|
|
UserName:UserName,
|
|
|
|
|
Computer:Computer,
|
|
|
|
|
ComputerInfo:ComputerInfo,
|
|
|
|
|
LogPosition:LogPosition,
|
|
|
|
|
LogContent:LogContent,
|
|
|
|
|
LogType:LogType
|
|
|
|
|
});
|
|
|
|
|
if (ret.result !== 1){
|
|
|
|
|
Store.messager.warn('记录其他操作日志失败!')
|
|
|
|
|
}
|
|
|
|
|
return ret.result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//以下六个函数都是根据字段OrgCode从tOrgManage表获取信息的,
|
|
|
|
|
//返回值ret.result != 1代表错误,此时ret.message是错误原因
|
|
|
|
|
//返回值ret.result == 1代表成功,此时ret.message是返回值(即查询结果)
|
|
|
|
|
|
|
|
|
|
//判断组织编码是否正确 返回值:'0'-否 '1'-是
|
|
|
|
|
function GetOrgCode(OrgCode) {
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.getOrgInf',{
|
|
|
|
|
OrgCode:OrgCode,
|
|
|
|
|
GetType:'GetOrgCode'});
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
//取得组织名称
|
|
|
|
|
function GetOrgName(OrgCode) {
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.getOrgInf',{
|
|
|
|
|
OrgCode:OrgCode,
|
|
|
|
|
GetType:'GetOrgName'});
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
//取得总部组织编码(业务控制组织)
|
|
|
|
|
function GetZbOrgCode(OrgCode) {
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.getOrgInf',{
|
|
|
|
|
OrgCode:OrgCode,
|
|
|
|
|
GetType:'GetZbOrgCode'});
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
//取得组织类型(组织职能)
|
|
|
|
|
function GetOrgType(OrgCode) {
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.getOrgInf',{
|
|
|
|
|
OrgCode:OrgCode,
|
|
|
|
|
GetType:'GetOrgType'});
|
|
|
|
|
return ret.message;
|
|
|
|
|
}
|
|
|
|
|
//取得财务组织编码(核算组织)
|
|
|
|
|
function GetFOrgCode(OrgCode) {
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.getOrgInf',{
|
|
|
|
|
OrgCode:OrgCode,
|
|
|
|
|
GetType:'GetFOrgCode'});
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
//取得内部组织编码
|
|
|
|
|
function GetInOrgCode(OrgCode) {
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.getOrgInf',{
|
|
|
|
|
OrgCode:OrgCode,
|
|
|
|
|
GetType:'GetInOrgCode'});
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
//取得ID序列号
|
|
|
|
|
function GetNextId(ClassID,ClassPropID,OrgCode) {
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.GetNextId',{
|
|
|
|
|
ClassID:ClassID,
|
|
|
|
|
ClassPropID:ClassPropID,
|
|
|
|
|
OrgCode:OrgCode,
|
|
|
|
|
GetType:'GetNextId'});
|
|
|
|
|
return ret.message;
|
|
|
|
|
}
|
|
|
|
|
//取得条码
|
|
|
|
|
function GetBarCode(PluCode,PluType) {
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.GetBarCode',{
|
|
|
|
|
PluCode:PluCode,
|
|
|
|
|
PluType:PluType,
|
|
|
|
|
GetType:'GetBarCode'});
|
|
|
|
|
return ret.message;
|
|
|
|
|
}
|
|
|
|
|
//取得当前服务器日期
|
|
|
|
|
function GetServerDate(Days) {
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.GetServerDate',{
|
|
|
|
|
Days:Days});
|
|
|
|
|
return ret.message;
|
|
|
|
|
}
|
|
|
|
|
//取得当前服务器日期时间
|
|
|
|
|
function GetServerDateTime(Days) {
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.GetServerDateTime',{
|
|
|
|
|
Days:Days});
|
|
|
|
|
return ret.message;
|
|
|
|
|
}
|
|
|
|
|
//取得唯一GUID
|
|
|
|
|
function GetGUID() {
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.getGUID',{
|
|
|
|
|
GetType:"GUID"});
|
|
|
|
|
return ret.message;
|
|
|
|
|
}
|
|
|
|
|
//插入数据到批量数据中间表
|
|
|
|
|
function InToBatchSelectData(Guid,GenDate,UDP1, UDP2, UDP3, UDP4, UDP5, UDP6, UDP7, UDP8, UDP9){
|
|
|
|
|
let ret = rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.InToBatchSelectData',{
|
|
|
|
|
Guid:Guid,
|
|
|
|
|
GenDate:GenDate,
|
|
|
|
|
UDP1:UDP1,
|
|
|
|
|
UDP2:UDP2,
|
|
|
|
|
UDP3:UDP3,
|
|
|
|
|
UDP4:UDP4,
|
|
|
|
|
UDP5:UDP5,
|
|
|
|
|
UDP6:UDP6,
|
|
|
|
|
UDP7:UDP7,
|
|
|
|
|
UDP8:UDP8,
|
|
|
|
|
UDP9:UDP9
|
|
|
|
|
});
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
// 操作日期yyyy-mm-dd 天数偏移量默认为0,正数表示增加,负数表示减少
|
|
|
|
|
function DateChangeDays(days = 0, date = false) {
|
|
|
|
|
if (!date) {
|
|
|
|
|
date = new Date();//没有传入值时,默认是当前日期
|
|
|
|
|
date = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
|
|
|
|
|
}
|
|
|
|
|
date += " 00:00:00";//设置为当天凌晨12点
|
|
|
|
|
date = Date.parse(new Date(date))/1000;//转换为时间戳
|
|
|
|
|
date += (86400) * days;//修改后的时间戳
|
|
|
|
|
let newDate = new Date(parseInt(date) * 1000);//转换为时间
|
|
|
|
|
return newDate.getFullYear() + '-' + (newDate.getMonth() + 1 < 10 ? '0'+(newDate.getMonth() + 1) : newDate.getMonth() + 1) + '-' + (newDate.getDate() < 10 ? ('0' + newDate.getDate()) : newDate.getDate());
|
|
|
|
|
}
|
|
|
|
|
//校验打印权限
|
|
|
|
|
function CheckPrintRight(PrimaryKey){
|
|
|
|
|
return rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.pubsysBaseBL',{
|
|
|
|
|
ps_OpType:"CheckPrintRight",
|
|
|
|
|
ps_InPutJson:{"PrimaryKey":PrimaryKey}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//记录打印信息
|
|
|
|
|
function SavePrintInfor(PrimaryKey,TableName){
|
|
|
|
|
return rhtService.doPlugin('cn.qdhezheng.rht.app.comm.plugins.sys.pubsysBaseBL',{
|
|
|
|
|
ps_OpType:"SavePrintInfor",
|
|
|
|
|
ps_InPutJson:{"PrimaryKey":PrimaryKey,"TableName":TableName}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
"getRhtOptionValue": getRhtOptionValue,
|
|
|
|
|
"getOptionOrgAccLevel":getOptionOrgAccLevel,
|
|
|
|
|
"getProductClass":getProductClass,
|
|
|
|
|
"MWriteOprLog":MWriteOprLog,
|
|
|
|
|
"MWriteErrLog":MWriteErrLog,
|
|
|
|
|
"MWriteOtherLog":MWriteOtherLog,
|
|
|
|
|
"GetInOrgCode":GetInOrgCode,
|
|
|
|
|
"GetOrgCode":GetOrgCode,
|
|
|
|
|
"GetOrgName":GetOrgName,
|
|
|
|
|
"GetZbOrgCode":GetZbOrgCode,
|
|
|
|
|
"GetOrgType":GetOrgType,
|
|
|
|
|
"GetFOrgCode":GetFOrgCode,
|
|
|
|
|
"GetNextId":GetNextId,
|
|
|
|
|
"GetBarCode":GetBarCode,
|
|
|
|
|
"GetServerDate":GetServerDate,
|
|
|
|
|
"GetServerDateTime":GetServerDateTime,
|
|
|
|
|
"GetGUID":GetGUID,
|
|
|
|
|
"InToBatchSelectData":InToBatchSelectData,
|
|
|
|
|
"DateChangeDays":DateChangeDays,
|
|
|
|
|
"CheckPrintRight":CheckPrintRight,
|
|
|
|
|
"SavePrintInfor":SavePrintInfor
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
});
|