|
|
@@ -410,10 +410,47 @@ Ext.define('saas.view.core.form.FormPanelController', {
|
|
|
caller = form.caller,
|
|
|
id = viewModel.get(form._idField);
|
|
|
|
|
|
- saas.util.BaseUtil.request({
|
|
|
- url: '/api/commons/jasperReport/printByDefault',
|
|
|
- // url: 'http://192.168.253.58:8920/jasperReport/printByDefault',
|
|
|
- method: 'POST',
|
|
|
+ me.beforePrint(caller).then(function(flag) {
|
|
|
+ if(!flag) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ saas.util.BaseUtil.request({
|
|
|
+ url: '/api/commons/jasperReport/printByDefault',
|
|
|
+ // url: 'http://192.168.253.58:8920/jasperReport/printByDefault',
|
|
|
+ method: 'POST',
|
|
|
+ headers: {
|
|
|
+ "Content-Type": 'application/x-www-form-urlencoded;charset=UTF-8'
|
|
|
+ },
|
|
|
+ params: {
|
|
|
+ caller: caller,
|
|
|
+ id: id
|
|
|
+ }
|
|
|
+ }).then(function(res) {
|
|
|
+ var data = res.data,
|
|
|
+ printurl = data.printurl,
|
|
|
+ printtype = data.printtype,
|
|
|
+ reportName = data.reportName,
|
|
|
+ title = data.title,
|
|
|
+ whereCondition = data.whereCondition,
|
|
|
+ companyId = saas.util.BaseUtil.getCurrentUser().companyId;
|
|
|
+
|
|
|
+ var url = printurl + '?' + 'reportName=' + reportName + '&' + 'companyId=' + companyId + '&whereCondition=' + whereCondition
|
|
|
+
|
|
|
+ window.open(url);
|
|
|
+ }).catch(function(res) {
|
|
|
+ console.error(res.message);
|
|
|
+ saas.util.BaseUtil.showErrorToast('获取打印报表错误:' + res.message);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 判断权限
|
|
|
+ */
|
|
|
+ beforePrint: function(caller) {
|
|
|
+ return saas.util.BaseUtil.request({
|
|
|
+ url: '/api/commons/' + caller + '/print',
|
|
|
+ method: 'GET',
|
|
|
headers: {
|
|
|
"Content-Type": 'application/x-www-form-urlencoded;charset=UTF-8'
|
|
|
},
|
|
|
@@ -422,17 +459,10 @@ Ext.define('saas.view.core.form.FormPanelController', {
|
|
|
id: id
|
|
|
}
|
|
|
}).then(function(res) {
|
|
|
- var data = res.data,
|
|
|
- printurl = data.printurl,
|
|
|
- printtype = data.printtype,
|
|
|
- reportName = data.reportName,
|
|
|
- title = data.title,
|
|
|
- whereCondition = data.whereCondition,
|
|
|
- companyId = saas.util.BaseUtil.getCurrentUser().companyId;
|
|
|
-
|
|
|
- var url = printurl + '?' + 'reportName=' + reportName + '&' + 'companyId=' + companyId + '&whereCondition=' + whereCondition
|
|
|
-
|
|
|
- window.open(url);
|
|
|
+ return res.success;
|
|
|
+ }).catch(function(res) {
|
|
|
+ console.error(res.message);
|
|
|
+ saas.util.BaseUtil.showErrorToast('未通过权限验证:' + res.message);
|
|
|
});
|
|
|
- },
|
|
|
+ }
|
|
|
});
|