|
@@ -20733,6 +20733,7 @@ appFormly.controller("CustomformCtrl", [
|
20733
|
20733
|
"api_statistic",
|
20734
|
20734
|
"up_down_file",
|
20735
|
20735
|
"fileReader",
|
|
20736
|
+ "api_wechatfile",
|
20736
|
20737
|
function (
|
20737
|
20738
|
$rootScope,
|
20738
|
20739
|
$scope,
|
|
@@ -20760,7 +20761,8 @@ appFormly.controller("CustomformCtrl", [
|
20760
|
20761
|
api_user_data,
|
20761
|
20762
|
api_statistic,
|
20762
|
20763
|
up_down_file,
|
20763
|
|
- fileReader
|
|
20764
|
+ fileReader,
|
|
20765
|
+ api_wechatfile
|
20764
|
20766
|
) {
|
20765
|
20767
|
//console.log($parse('Restangular')($scope));
|
20766
|
20768
|
//console.log($injector.get('Restangular'));
|
|
@@ -21606,6 +21608,7 @@ appFormly.controller("CustomformCtrl", [
|
21606
|
21608
|
});
|
21607
|
21609
|
} else {
|
21608
|
21610
|
console.log($scope.formData.url, "zzzz");
|
|
21611
|
+ var integralMechanism = sessionStorage.getItem('integralMechanism');
|
21609
|
21612
|
switch ($scope.formData.url) {
|
21610
|
21613
|
case "start":
|
21611
|
21614
|
vm.model["initUser"] = $rootScope.user.id;
|
|
@@ -21675,13 +21678,6 @@ appFormly.controller("CustomformCtrl", [
|
21675
|
21678
|
//处理请求数据0327
|
21676
|
21679
|
var data0327 = JSON.parse(JSON.stringify(vm.model));
|
21677
|
21680
|
delete data0327.repairType;
|
21678
|
|
- // 增加地点的请求参数2020年4月24日10:44:36
|
21679
|
|
- // console.log($scope.$parent.$parent.$parent.$parent.$parent.$parent.selecthouseNumber,'2020年4月24日20:24:10');
|
21680
|
|
- // if($scope.$parent.$parent.$parent.$parent.$parent.$parent.selecthouseNumber){
|
21681
|
|
- // data0327.incident.place = {
|
21682
|
|
- // id:$scope.$parent.$parent.$parent.$parent.$parent.$parent.selecthouseNumber.id
|
21683
|
|
- // }
|
21684
|
|
- // }
|
21685
|
21681
|
if (data0327.start_code == "close") {
|
21686
|
21682
|
data0327.incident.directProcess = 1;
|
21687
|
21683
|
}
|
|
@@ -21693,10 +21689,94 @@ appFormly.controller("CustomformCtrl", [
|
21693
|
21689
|
data0327.incident.callID = paramsModel.model.incident.sockid;
|
21694
|
21690
|
}
|
21695
|
21691
|
}
|
21696
|
|
- api_bpm_domain
|
|
21692
|
+ // --------------------------- start----------------------------------------
|
|
21693
|
+ // 积分机制,直接处理
|
|
21694
|
+ if(vm.model.start_code == "close"&&(integralMechanism == 1 || (integralMechanism == 2 && $rootScope.user.userType.value == 2))){
|
|
21695
|
+ $modal.open({
|
|
21696
|
+ templateUrl: 'assets/views/incident/tpl/toIntegralMechanism.tpl.html',
|
|
21697
|
+ controller: function ($scope, $modalInstance, api_bpm_domain, incidentData, currentUserId, Alert, api_user_data,api_wechatfile,scope) {
|
|
21698
|
+ console.log(incidentData,currentUserId);
|
|
21699
|
+ $scope.flag = false;
|
|
21700
|
+ $scope.complexityConfirm = {complexity:null,updateReason:''};
|
|
21701
|
+ $scope.complexityFn = function(category){
|
|
21702
|
+ if(category.complexity){
|
|
21703
|
+ return category.complexity.value;
|
|
21704
|
+ }else if(category.parent){
|
|
21705
|
+ return $scope.complexityFn(category.parent);
|
|
21706
|
+ }else{
|
|
21707
|
+ return $scope.list[0]?$scope.list[0].value:1;
|
|
21708
|
+ }
|
|
21709
|
+ }
|
|
21710
|
+ $scope.list = [];
|
|
21711
|
+ api_wechatfile.getDictionary({"key":"incident_complexity","type":"list"}).then(function(res){
|
|
21712
|
+ $scope.list = res;
|
|
21713
|
+ $scope.complexity = $scope.complexityFn(incidentData.category);
|
|
21714
|
+ $scope.complexityConfirm.complexity = $scope.list.find(v=>v.value == $scope.complexity);
|
|
21715
|
+ })
|
|
21716
|
+ $scope.onChangeComplexity = function(item){
|
|
21717
|
+
|
|
21718
|
+ }
|
|
21719
|
+ $scope.ok = function () {
|
|
21720
|
+ if (!$scope.complexityConfirm.complexity){
|
|
21721
|
+ Alert.swal({
|
|
21722
|
+ title: "操作失败",
|
|
21723
|
+ text: "请选择工时!",
|
|
21724
|
+ type: "error"
|
|
21725
|
+ });
|
|
21726
|
+ return;
|
|
21727
|
+ }
|
|
21728
|
+ if ($scope.complexityConfirm.complexity.value != $scope.complexity&&!$scope.complexityConfirm.updateReason.trim()){
|
|
21729
|
+ Alert.swal({
|
|
21730
|
+ title: "操作失败",
|
|
21731
|
+ text: "请填写升级原因!",
|
|
21732
|
+ type: "error"
|
|
21733
|
+ });
|
|
21734
|
+ return;
|
|
21735
|
+ }
|
|
21736
|
+ $modalInstance.close('success');
|
|
21737
|
+ handlerStart();
|
|
21738
|
+ scope.complexity = $scope.complexity;
|
|
21739
|
+ scope.complexityConfirm = $scope.complexityConfirm;
|
|
21740
|
+ // 暂存--后面直接处理后调用积分接口
|
|
21741
|
+ }
|
|
21742
|
+ $scope.cancel = function () {
|
|
21743
|
+ scope.ldloading.expand_right = false;
|
|
21744
|
+ $modalInstance.dismiss('cancel');
|
|
21745
|
+ }
|
|
21746
|
+ },
|
|
21747
|
+ size: 'sm',
|
|
21748
|
+ resolve: {
|
|
21749
|
+ scope: function () {
|
|
21750
|
+ return $scope;
|
|
21751
|
+ },
|
|
21752
|
+ api_bpm: function () {
|
|
21753
|
+ return api_bpm;
|
|
21754
|
+ },
|
|
21755
|
+ incidentData: function () {
|
|
21756
|
+ return data0327.incident;
|
|
21757
|
+ },
|
|
21758
|
+ currentUserId: function () {
|
|
21759
|
+ return loginUser.id;
|
|
21760
|
+ },
|
|
21761
|
+ Alert: function () {
|
|
21762
|
+ return SweetAlert;
|
|
21763
|
+ },
|
|
21764
|
+ api_user_data: function () {
|
|
21765
|
+ return api_user_data;
|
|
21766
|
+ },
|
|
21767
|
+ api_wechatfile: function () {
|
|
21768
|
+ return api_wechatfile;
|
|
21769
|
+ }
|
|
21770
|
+ }
|
|
21771
|
+ });
|
|
21772
|
+ }else{
|
|
21773
|
+ handlerStart();
|
|
21774
|
+ }
|
|
21775
|
+ // -------------------------------end------------------------------------
|
|
21776
|
+ function handlerStart(){
|
|
21777
|
+ api_bpm_domain
|
21697
|
21778
|
.start(pdKey, data0327)
|
21698
|
21779
|
.then(function (response) {
|
21699
|
|
- // console.log("response="+JSON.stringify(response));
|
21700
|
21780
|
if (response) {
|
21701
|
21781
|
var resData = Restangular.stripRestangular(response);
|
21702
|
21782
|
if (resData) {
|
|
@@ -21729,27 +21809,76 @@ appFormly.controller("CustomformCtrl", [
|
21729
|
21809
|
}
|
21730
|
21810
|
}
|
21731
|
21811
|
}
|
21732
|
|
-
|
21733
|
|
- SweetAlert.swal(
|
21734
|
|
- {
|
21735
|
|
- title: "提交成功!",
|
21736
|
|
- type: "success",
|
21737
|
|
- confirmButtonColor: "#007AFF",
|
21738
|
|
- },
|
21739
|
|
- function () {
|
21740
|
|
- if (
|
21741
|
|
- vm.model.incident &&
|
21742
|
|
- vm.model.incident.callID &&
|
21743
|
|
- vm.model.incident.callID != ""
|
21744
|
|
- ) {
|
21745
|
|
- $rootScope.app.layout.isSidebarClosed = false;
|
21746
|
|
- if ($scope.login && !$rootScope.busy) {
|
21747
|
|
- $rootScope.setidle();
|
|
21812
|
+ if(vm.model.start_code == "close"&&(integralMechanism == 1 || (integralMechanism == 2 && $rootScope.user.userType.value == 2))){
|
|
21813
|
+ api_wechatfile.getDictionary({"key":"incident_integral_state","type":"list"}).then(function(res){
|
|
21814
|
+ var auditState = res.find(v=>v.value == 0);
|
|
21815
|
+ var postData = {
|
|
21816
|
+ incidentIntegral: {
|
|
21817
|
+ incidentId:resData.bussId,
|
|
21818
|
+ auditState:auditState,
|
|
21819
|
+ handlerUser:$rootScope.user.id,
|
|
21820
|
+ handlerUserName:$rootScope.user.name,
|
|
21821
|
+ sourceScore:$scope.complexity,
|
|
21822
|
+ currentScore:$scope.complexityConfirm.complexity.value,
|
|
21823
|
+ updateReason:$scope.complexityConfirm.updateReason.trim() || undefined,
|
21748
|
21824
|
}
|
21749
|
21825
|
}
|
21750
|
|
- $state.go($scope.formData.cancelUrl);
|
21751
|
|
- }
|
21752
|
|
- );
|
|
21826
|
+ console.log(postData)
|
|
21827
|
+ api_bpm_data.addData('incidentIntegral', postData).then(function (response) {
|
|
21828
|
+ console.log(response)
|
|
21829
|
+ if (response.status == 200) {
|
|
21830
|
+ SweetAlert.swal(
|
|
21831
|
+ {
|
|
21832
|
+ title: "提交成功!",
|
|
21833
|
+ type: "success",
|
|
21834
|
+ confirmButtonColor: "#007AFF",
|
|
21835
|
+ },
|
|
21836
|
+ function () {
|
|
21837
|
+ if (
|
|
21838
|
+ vm.model.incident &&
|
|
21839
|
+ vm.model.incident.callID &&
|
|
21840
|
+ vm.model.incident.callID != ""
|
|
21841
|
+ ) {
|
|
21842
|
+ $rootScope.app.layout.isSidebarClosed = false;
|
|
21843
|
+ if ($scope.login && !$rootScope.busy) {
|
|
21844
|
+ $rootScope.setidle();
|
|
21845
|
+ }
|
|
21846
|
+ }
|
|
21847
|
+ $state.go($scope.formData.cancelUrl);
|
|
21848
|
+ }
|
|
21849
|
+ );
|
|
21850
|
+ } else {
|
|
21851
|
+ Alert.swal({
|
|
21852
|
+ title: "操作失败",
|
|
21853
|
+ text: "操作失败, 请稍后再试!",
|
|
21854
|
+ type: "error"
|
|
21855
|
+ });
|
|
21856
|
+ }
|
|
21857
|
+ });
|
|
21858
|
+ })
|
|
21859
|
+ }else{
|
|
21860
|
+ SweetAlert.swal(
|
|
21861
|
+ {
|
|
21862
|
+ title: "提交成功!",
|
|
21863
|
+ type: "success",
|
|
21864
|
+ confirmButtonColor: "#007AFF",
|
|
21865
|
+ },
|
|
21866
|
+ function () {
|
|
21867
|
+ if (
|
|
21868
|
+ vm.model.incident &&
|
|
21869
|
+ vm.model.incident.callID &&
|
|
21870
|
+ vm.model.incident.callID != ""
|
|
21871
|
+ ) {
|
|
21872
|
+ $rootScope.app.layout.isSidebarClosed = false;
|
|
21873
|
+ if ($scope.login && !$rootScope.busy) {
|
|
21874
|
+ $rootScope.setidle();
|
|
21875
|
+ }
|
|
21876
|
+ }
|
|
21877
|
+ $state.go($scope.formData.cancelUrl);
|
|
21878
|
+ }
|
|
21879
|
+ );
|
|
21880
|
+ }
|
|
21881
|
+
|
21753
|
21882
|
} else {
|
21754
|
21883
|
SweetAlert.swal({
|
21755
|
21884
|
title: "系统错误",
|
|
@@ -21760,6 +21889,7 @@ appFormly.controller("CustomformCtrl", [
|
21760
|
21889
|
}
|
21761
|
21890
|
$scope.ldloading[style.replace("-", "_")] = false;
|
21762
|
21891
|
});
|
|
21892
|
+ }
|
21763
|
21893
|
break;
|
21764
|
21894
|
case "complete":
|
21765
|
21895
|
//api_bpm_domain.complete(pdKey, userId, vm.model).then(function(response){
|
|
@@ -21778,32 +21908,142 @@ appFormly.controller("CustomformCtrl", [
|
21778
|
21908
|
return;
|
21779
|
21909
|
}
|
21780
|
21910
|
console.log(vm);
|
21781
|
|
- //处理日志
|
21782
|
|
- // 处理日志不为空并且事件是处理中状态
|
21783
|
|
- if (vm.model.handlerLog && vm.model.handlerLog.trim() && vm.model.incident.state.value == 'handler') {
|
21784
|
|
- api_bpm_data.addData('operationLog', { operationLog: { opType: 'handlerLog', opValue: vm.model.handlerLog, extra1: vm.model.incident.id } }).then(function (result1) {
|
21785
|
|
- baseHandler();
|
21786
|
|
- })
|
21787
|
|
- } else {
|
21788
|
|
- if($stateParams.formUiEdit === 'inspection_LinHu_confirm'){
|
21789
|
|
- //巡检计划
|
21790
|
|
- if(vm.model.inspectionProcessActual.group&&vm.model.inspectionProcessActual.group.id){
|
21791
|
|
- api_bpm.assign({ids:$stateParams.dataId.toString(),userId:$rootScope.user.id}).then(function (response) {
|
21792
|
|
- if (response.status == 200) {
|
21793
|
|
- baseHandler();
|
21794
|
|
- } else {
|
21795
|
|
- Alert.swal({
|
21796
|
|
- title: "操作失败",
|
21797
|
|
- text: "操作失败, 请稍后再试!",
|
21798
|
|
- type: "error"
|
21799
|
|
- });
|
|
21911
|
+ // 积分机制,事件状态是“处理中”
|
|
21912
|
+ if($scope.formData.name === 'handlerform'&&(integralMechanism == 1 || (integralMechanism == 2 && $rootScope.user.userType.value == 2))){
|
|
21913
|
+ $modal.open({
|
|
21914
|
+ templateUrl: 'assets/views/incident/tpl/toIntegralMechanism.tpl.html',
|
|
21915
|
+ controller: function ($scope, $modalInstance, api_bpm_domain, incidentData, currentUserId, Alert, api_user_data,api_wechatfile,scope) {
|
|
21916
|
+ console.log(incidentData,currentUserId);
|
|
21917
|
+ $scope.flag = true;
|
|
21918
|
+ $scope.complexityConfirm = {complexity:null,updateReason:''};
|
|
21919
|
+ $scope.complexityFn = function(category){
|
|
21920
|
+ if(category.complexity){
|
|
21921
|
+ return category.complexity.value;
|
|
21922
|
+ }else if(category.parent){
|
|
21923
|
+ return $scope.complexityFn(category.parent);
|
|
21924
|
+ }else{
|
|
21925
|
+ return $scope.list[0]?$scope.list[0].value:1;
|
|
21926
|
+ }
|
21800
|
21927
|
}
|
21801
|
|
- });
|
|
21928
|
+ $scope.list = [];
|
|
21929
|
+ api_wechatfile.getDictionary({"key":"incident_complexity","type":"list"}).then(function(res){
|
|
21930
|
+ $scope.list = res;
|
|
21931
|
+ $scope.complexity = $scope.complexityFn(incidentData.category);
|
|
21932
|
+ $scope.complexityConfirm.complexity = $scope.list.find(v=>v.value == $scope.complexity);
|
|
21933
|
+ })
|
|
21934
|
+ $scope.onChangeComplexity = function(item){
|
|
21935
|
+ if($scope.complexityConfirm.complexity.value == $scope.complexity){
|
|
21936
|
+ $scope.complexityConfirm.updateReason = '';
|
|
21937
|
+ }
|
|
21938
|
+ }
|
|
21939
|
+ $scope.ok = function () {
|
|
21940
|
+ if (!$scope.complexityConfirm.complexity){
|
|
21941
|
+ Alert.swal({
|
|
21942
|
+ title: "操作失败",
|
|
21943
|
+ text: "请选择工时!",
|
|
21944
|
+ type: "error"
|
|
21945
|
+ });
|
|
21946
|
+ return;
|
|
21947
|
+ }
|
|
21948
|
+ if ($scope.complexityConfirm.complexity.value != $scope.complexity&&!$scope.complexityConfirm.updateReason.trim()){
|
|
21949
|
+ Alert.swal({
|
|
21950
|
+ title: "操作失败",
|
|
21951
|
+ text: "请填写升级原因!",
|
|
21952
|
+ type: "error"
|
|
21953
|
+ });
|
|
21954
|
+ return;
|
|
21955
|
+ }
|
|
21956
|
+ api_wechatfile.getDictionary({"key":"incident_integral_state","type":"list"}).then(function(res){
|
|
21957
|
+ var auditState = $scope.complexityConfirm.complexity.value == $scope.complexity?res.find(v=>v.value == 1):res.find(v=>v.value == 0);
|
|
21958
|
+ var postData = {
|
|
21959
|
+ incidentIntegral: {
|
|
21960
|
+ incidentId:incidentData.id,
|
|
21961
|
+ auditState:auditState,
|
|
21962
|
+ handlerUser:$rootScope.user.id,
|
|
21963
|
+ handlerUserName:$rootScope.user.name,
|
|
21964
|
+ sourceScore:$scope.complexity,
|
|
21965
|
+ currentScore:$scope.complexityConfirm.complexity.value,
|
|
21966
|
+ updateReason:$scope.complexityConfirm.updateReason.trim() || undefined,
|
|
21967
|
+ }
|
|
21968
|
+ }
|
|
21969
|
+ console.log(postData)
|
|
21970
|
+ api_bpm_data.addData('incidentIntegral', postData).then(function (response) {
|
|
21971
|
+ console.log(response)
|
|
21972
|
+ if (response.status == 200) {
|
|
21973
|
+ $modalInstance.close('success');
|
|
21974
|
+ handlerLogFn();
|
|
21975
|
+ } else {
|
|
21976
|
+ Alert.swal({
|
|
21977
|
+ title: "操作失败",
|
|
21978
|
+ text: "操作失败, 请稍后再试!",
|
|
21979
|
+ type: "error"
|
|
21980
|
+ });
|
|
21981
|
+ }
|
|
21982
|
+ });
|
|
21983
|
+ })
|
|
21984
|
+ }
|
|
21985
|
+ $scope.cancel = function () {
|
|
21986
|
+ scope.ldloading.expand_right = false;
|
|
21987
|
+ $modalInstance.dismiss('cancel');
|
|
21988
|
+ }
|
|
21989
|
+ },
|
|
21990
|
+ size: 'sm',
|
|
21991
|
+ resolve: {
|
|
21992
|
+ scope: function () {
|
|
21993
|
+ return $scope;
|
|
21994
|
+ },
|
|
21995
|
+ api_bpm: function () {
|
|
21996
|
+ return api_bpm;
|
|
21997
|
+ },
|
|
21998
|
+ incidentData: function () {
|
|
21999
|
+ return $scope.formData.model.incident;
|
|
22000
|
+ },
|
|
22001
|
+ currentUserId: function () {
|
|
22002
|
+ return loginUser.id;
|
|
22003
|
+ },
|
|
22004
|
+ Alert: function () {
|
|
22005
|
+ return SweetAlert;
|
|
22006
|
+ },
|
|
22007
|
+ api_user_data: function () {
|
|
22008
|
+ return api_user_data;
|
|
22009
|
+ },
|
|
22010
|
+ api_wechatfile: function () {
|
|
22011
|
+ return api_wechatfile;
|
|
22012
|
+ }
|
|
22013
|
+ }
|
|
22014
|
+ });
|
|
22015
|
+ }else{
|
|
22016
|
+ handlerLogFn();
|
|
22017
|
+ }
|
|
22018
|
+
|
|
22019
|
+ function handlerLogFn(){
|
|
22020
|
+ //处理日志
|
|
22021
|
+ // 处理日志不为空并且事件是处理中状态
|
|
22022
|
+ if (vm.model.handlerLog && vm.model.handlerLog.trim() && vm.model.incident.state.value == 'handler') {
|
|
22023
|
+ api_bpm_data.addData('operationLog', { operationLog: { opType: 'handlerLog', opValue: vm.model.handlerLog, extra1: vm.model.incident.id } }).then(function (result1) {
|
|
22024
|
+ baseHandler();
|
|
22025
|
+ })
|
|
22026
|
+ } else {
|
|
22027
|
+ if($stateParams.formUiEdit === 'inspection_LinHu_confirm'){
|
|
22028
|
+ //巡检计划
|
|
22029
|
+ if(vm.model.inspectionProcessActual.group&&vm.model.inspectionProcessActual.group.id){
|
|
22030
|
+ api_bpm.assign({ids:$stateParams.dataId.toString(),userId:$rootScope.user.id}).then(function (response) {
|
|
22031
|
+ if (response.status == 200) {
|
|
22032
|
+ baseHandler();
|
|
22033
|
+ } else {
|
|
22034
|
+ Alert.swal({
|
|
22035
|
+ title: "操作失败",
|
|
22036
|
+ text: "操作失败, 请稍后再试!",
|
|
22037
|
+ type: "error"
|
|
22038
|
+ });
|
|
22039
|
+ }
|
|
22040
|
+ });
|
|
22041
|
+ }else{
|
|
22042
|
+ baseHandler();
|
|
22043
|
+ }
|
21802
|
22044
|
}else{
|
21803
|
22045
|
baseHandler();
|
21804
|
22046
|
}
|
21805
|
|
- }else{
|
21806
|
|
- baseHandler();
|
21807
|
22047
|
}
|
21808
|
22048
|
}
|
21809
|
22049
|
// return;
|