|
|
@@ -174,6 +174,10 @@ define(function (require, exports, module) {
|
|
174
|
174
|
_initActionButtons: function () {
|
|
175
|
175
|
Hamster.Array.forEach(this.actions, function (name) {
|
|
176
|
176
|
var buttonConfig = ApprovalFormToolbar.getActionButtonConfig(name);
|
|
|
177
|
+ if (!buttonConfig) {
|
|
|
178
|
+ console.warn('Button config not found for:', name);
|
|
|
179
|
+ return;
|
|
|
180
|
+ }
|
|
177
|
181
|
var buttonOptions = {
|
|
178
|
182
|
appendToEl: this.el.target,
|
|
179
|
183
|
title: buttonConfig.title,
|
|
|
@@ -252,6 +256,10 @@ define(function (require, exports, module) {
|
|
252
|
256
|
_onActionButtonClick: function (button) {
|
|
253
|
257
|
var name = button.__name;
|
|
254
|
258
|
var config = this._action_button_config_map[name];
|
|
|
259
|
+ if (!config) {
|
|
|
260
|
+ console.warn('Button config not found for:', name);
|
|
|
261
|
+ return;
|
|
|
262
|
+ }
|
|
255
|
263
|
var handler = config.handler;
|
|
256
|
264
|
|
|
257
|
265
|
if (!Hamster.isFunction(handler)) {
|
|
|
@@ -265,7 +273,9 @@ define(function (require, exports, module) {
|
|
265
|
273
|
this.actions.push("btn-close");
|
|
266
|
274
|
Hamster.Object.each(this._action_button_map, function (name, button) {
|
|
267
|
275
|
var config = this._action_button_config_map[name];
|
|
268
|
|
- Hamster.isFunction(config.destroy) && config.destroy();
|
|
|
276
|
+ if (config && Hamster.isFunction(config.destroy)) {
|
|
|
277
|
+ config.destroy();
|
|
|
278
|
+ }
|
|
269
|
279
|
button.destroy();
|
|
270
|
280
|
}, this);
|
|
271
|
281
|
this._action_button_map = {};
|
|
|
@@ -941,6 +951,88 @@ define(function (require, exports, module) {
|
|
941
|
951
|
});
|
|
942
|
952
|
|
|
943
|
953
|
/**
|
|
|
954
|
+ * 转办操作按钮
|
|
|
955
|
+ * */
|
|
|
956
|
+ ApprovalFormToolbar.registerActionButton('btn-transfer-new', '转办', 'ui-icon-transfer', function (button, toolbar) {
|
|
|
957
|
+ console.log(button, toolbar);
|
|
|
958
|
+ var self = this;
|
|
|
959
|
+ var call = function (transferUser) {
|
|
|
960
|
+ var transferHttpAjax = new HttpAjax({
|
|
|
961
|
+ url: 'bill/flow/rest/transfer',
|
|
|
962
|
+ type: 'POST',
|
|
|
963
|
+ params: {
|
|
|
964
|
+ billId: toolbar.relevance.billId,
|
|
|
965
|
+ taskId: toolbar.relevance.taskId,
|
|
|
966
|
+ transferUserIds: transferUser,
|
|
|
967
|
+ remark: '转办'
|
|
|
968
|
+ }
|
|
|
969
|
+ });
|
|
|
970
|
+ transferHttpAjax.successHandler(function (result) {
|
|
|
971
|
+ layer.open({
|
|
|
972
|
+ title: '温馨提示',
|
|
|
973
|
+ content: '转办成功!',
|
|
|
974
|
+ icon: 1
|
|
|
975
|
+ });
|
|
|
976
|
+ self._employeeSelectDialog.close();
|
|
|
977
|
+ toolbar.fireEvent('approval-transferred', result);
|
|
|
978
|
+ });
|
|
|
979
|
+ transferHttpAjax.satusCodeHandler(400, function (xhr) {
|
|
|
980
|
+ var result = JSON.parse(xhr.responseText);
|
|
|
981
|
+ var message = '转办失败';
|
|
|
982
|
+ if (!Hamster.isEmpty(result.msg)) {
|
|
|
983
|
+ message = result.msg;
|
|
|
984
|
+ }
|
|
|
985
|
+ layer.open({
|
|
|
986
|
+ title: '温馨提示',
|
|
|
987
|
+ content: message,
|
|
|
988
|
+ icon: 2
|
|
|
989
|
+ });
|
|
|
990
|
+ });
|
|
|
991
|
+ transferHttpAjax.failureHandler(function (xhr) {
|
|
|
992
|
+ layer.open({
|
|
|
993
|
+ title: '温馨提示',
|
|
|
994
|
+ content: '转办失败,请重试',
|
|
|
995
|
+ icon: 2
|
|
|
996
|
+ });
|
|
|
997
|
+ });
|
|
|
998
|
+ transferHttpAjax.send();
|
|
|
999
|
+ }
|
|
|
1000
|
+ self._employeeSelectDialog = new Hamster.ui.Dialog({
|
|
|
1001
|
+ title: "请选择转办的审批人:",
|
|
|
1002
|
+ width: 1000,
|
|
|
1003
|
+ contentPadding: 20,
|
|
|
1004
|
+ height: 710,
|
|
|
1005
|
+ contentHtml: employeeDi._getContentElement(),
|
|
|
1006
|
+ btnItems: [{
|
|
|
1007
|
+ name: 'close', title: '关闭', handler: function () {
|
|
|
1008
|
+ self._employeeSelectDialog.close();
|
|
|
1009
|
+ }
|
|
|
1010
|
+ }, {
|
|
|
1011
|
+ name: 'confirm', title: '确定', handler: function () {
|
|
|
1012
|
+ if (Hamster.isEmpty(employeeDi.getSelected())) {
|
|
|
1013
|
+ layer.alert("请选择转办的审批人");
|
|
|
1014
|
+ return;
|
|
|
1015
|
+ }
|
|
|
1016
|
+ var nextAppr = employeeDi.getSelected();
|
|
|
1017
|
+ var userIds = [];
|
|
|
1018
|
+ $.each(nextAppr, function (idx, itm) {
|
|
|
1019
|
+ userIds.push(itm.id);
|
|
|
1020
|
+ })
|
|
|
1021
|
+ call(userIds.join(','));
|
|
|
1022
|
+ }
|
|
|
1023
|
+ }]
|
|
|
1024
|
+ });
|
|
|
1025
|
+ self._employeeSelectDialog.on('open', function () {
|
|
|
1026
|
+ employeeDi._init();
|
|
|
1027
|
+ });
|
|
|
1028
|
+ self._employeeSelectDialog.on('close', function () {
|
|
|
1029
|
+ self._employeeSelectDialog.destroy();
|
|
|
1030
|
+ self._employeeSelectDialog = null;
|
|
|
1031
|
+ });
|
|
|
1032
|
+ self._employeeSelectDialog.open();
|
|
|
1033
|
+ });
|
|
|
1034
|
+
|
|
|
1035
|
+ /**
|
|
944
|
1036
|
* 结束流程操作按钮
|
|
945
|
1037
|
* */
|
|
946
|
1038
|
ApprovalFormToolbar.registerActionButton('btn-end', '结束流程', 'ui-icon-save', function (button, toolbar) {
|