owl-cli 7.42.0 → 7.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//#import Util.js
|
|
2
|
+
//#import login.js
|
|
3
|
+
//#import user.js
|
|
4
|
+
//#import base64.js
|
|
5
|
+
//#import HttpUtil.js
|
|
6
|
+
//#import session.js
|
|
7
|
+
//#import $@projectCode:services/modelService.jsx
|
|
8
|
+
//#import @handlers/include/checklogin.jsx
|
|
9
|
+
(function(){
|
|
10
|
+
var spec = @spec;
|
|
11
|
+
var env = checklogin();
|
|
12
|
+
if(!env){
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
var shopId = env.shopId;
|
|
16
|
+
var warehouseId = env.warehouseId;
|
|
17
|
+
var m = shopId;
|
|
18
|
+
var orgId = env.orgId;
|
|
19
|
+
var orgIds = env.orgIds;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
///////////////////////////////
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
var modelObject = JSON.parse( $body );
|
|
26
|
+
|
|
27
|
+
//判断是add还是update
|
|
28
|
+
var id = modelObject.id;
|
|
29
|
+
var action = $.params.action;
|
|
30
|
+
var oldObj = @projectCodeService.get(id);
|
|
31
|
+
var roleId = env.roleId
|
|
32
|
+
if(orgId && oldObj && oldObj._orgIds){
|
|
33
|
+
//检查是否有权限修改
|
|
34
|
+
if(roleId!=='internal' && roleId!='0' && orgId!='0' && oldObj._orgIds.indexOf(orgId)===-1){
|
|
35
|
+
var ret = {
|
|
36
|
+
state:'err',
|
|
37
|
+
code: 'no permission',
|
|
38
|
+
msg: '没有权限'
|
|
39
|
+
}
|
|
40
|
+
out.print(JSON.stringify(ret));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
var diffResult =[];
|
|
45
|
+
var tableId = 'owl_' + spec._t;
|
|
46
|
+
var permissions = getPermissions(roleId,tableId);
|
|
47
|
+
//如果检查不通过,则会抛出异常
|
|
48
|
+
if(roleId!=='internal' && roleId!='0'){
|
|
49
|
+
checkPermission(modelObject,permissions,orgId,"add");
|
|
50
|
+
}
|
|
51
|
+
var id = @projectCodeService.getId(modelObject);
|
|
52
|
+
var ret = {
|
|
53
|
+
state: 'ok',
|
|
54
|
+
id: id
|
|
55
|
+
};
|
|
56
|
+
out.print( JSON.stringify( ret ) );
|
|
57
|
+
} catch ( e ) {
|
|
58
|
+
var ret = {
|
|
59
|
+
state: 'err',
|
|
60
|
+
msg: getErrorMsg(e)
|
|
61
|
+
};
|
|
62
|
+
out.print( JSON.stringify( ret ) );
|
|
63
|
+
}
|
|
64
|
+
})();
|
|
65
|
+
|
|
66
|
+
function getErrorMsg(e){
|
|
67
|
+
if(typeof e === 'string'){
|
|
68
|
+
return e;
|
|
69
|
+
}
|
|
70
|
+
var msg = e.msg || e.message || e.toString();
|
|
71
|
+
var beginIdx = msg.indexOf(':');
|
|
72
|
+
if(beginIdx===-1){
|
|
73
|
+
return msg;
|
|
74
|
+
}
|
|
75
|
+
var endIdx = msg.indexOf('(',beginIdx);
|
|
76
|
+
if(endIdx===-1){
|
|
77
|
+
return msg;
|
|
78
|
+
}
|
|
79
|
+
return msg.substring(beginIdx+1,endIdx);
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
@@ -130,7 +130,7 @@ function buildSort(sort){
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
var sr = @projectCodeService.search(mfilters, searchArgs, keyword,from, pageSize, effectiveSort, dataSource ,isRecycleBin );
|
|
133
|
-
var count = @projectCodeService.count(mfilters, searchArgs, keyword ,isRecycleBin);
|
|
133
|
+
var count = @projectCodeService.count(mfilters, searchArgs, keyword ,dataSource,isRecycleBin);
|
|
134
134
|
|
|
135
135
|
|
|
136
136
|
if(sr.state=='ok'){
|
|
@@ -1285,9 +1285,7 @@ var @projectCodeService = (function (pigeon) {
|
|
|
1285
1285
|
|
|
1286
1286
|
search: function(mfilters, searchArgs, keyword,from, pageSize, sort, dataSource,isRecycleBin,meta_fields){
|
|
1287
1287
|
var query = f.buildQuery(mfilters,searchArgs,keyword,isRecycleBin,meta_fields);
|
|
1288
|
-
|
|
1289
|
-
var effectiveSort = [];
|
|
1290
|
-
var effectiveSort = [{owl_createTime:{order:"desc"}}];
|
|
1288
|
+
var effectiveSort = [{owl_createTime:{order:"desc"}}];
|
|
1291
1289
|
if(sort){
|
|
1292
1290
|
effectiveSort = sort;
|
|
1293
1291
|
}
|