123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938 |
- "use strict";
- app.controller("recordCtrl", [
- "$scope",
- "i18nService",
- "$rootScope",
- "$state",
- "$timeout",
- "$interval",
- "$modal",
- "SweetAlert",
- "uiGridConstants",
- "uiGridGroupingConstants",
- "Restangular",
- "api_bpm_data",
- "api_text",
- "api_user_data",
- function (
- $scope,
- i18nService,
- $rootScope,
- $state,
- $timeout,
- $interval,
- $modal,
- SweetAlert,
- uiGridConstants,
- uiGridGroupingConstants,
- Restangular,
- api_bpm_data,
- api_text,
- api_user_data
- ) {
- $scope.langs = i18nService.getAllLangs();
- $scope.lang = "zh-cn";
- i18nService.setCurrentLang($scope.lang);
- // $(window).resize(function() {
- // // console.log("1111")
- // });
- var loginUser = $rootScope.user;
- // var voiceurl=$rootScope.audioiIp;
- // delete $rootScope.user.authority;
- var pdKey = $state.current.pdKey;
- $scope.gridOptions = {};
- $scope.gridOptions.data = "myData";
- $scope.gridOptions.enableColumnResizing = true;
- $scope.gridOptions.enableFiltering = false;
- $scope.gridOptions.enableGridMenu = true;
- $scope.gridOptions.enableRowSelection = true;
- $scope.gridOptions.showGridFooter = true;
- $scope.gridOptions.showColumnFooter = false;
- $scope.gridOptions.fastWatch = true;
- // $scope.gridOptions.useExternalFiltering=true;
- $scope.gridOptions.useExternalPagination = true;
- $scope.gridOptions.paginationPageSizes = [10, 20, 50, 100];
- $scope.gridOptions.paginationPageSize = 10;
- $scope.gridOptions.multiSelect = true;
- var mun = $scope.gridOptions.paginationPageSize;
- // $scope.gridOptions.rowTemplate = "<div ng-click=\"lookFunction(row)\" ng-repeat=\"(colRenderIndex, col) in colContainer.renderedColumns track by col.uid\" ui-grid-one-bind-id-grid=\"rowRenderIndex + '-' + col.uid + '-cell'\" class=\"ui-grid-cell\" ng-class=\"{ 'ui-grid-row-header-cell': col.isRowHeader }\" role=\"{{col.isRowHeader ? 'rowheader' : 'gridcell'}}\" ui-grid-cell></div>";
- $scope.gridOptions.rowIdentity = function (row) {
- return row.id;
- };
- $scope.gridOptions.getRowIdentity = function (row) {
- return row.id;
- };
- $scope.transferstate = function (item) {
- // var handstate = "未受理";
- if (item.isExcute == 1) {
- return "已受理";
- } else if (item.isExcute == 2) {
- return "不受理";
- } else {
- return "未受理";
- }
- };
- $scope.bushouli = function (item) {
- // console.log(item)
- SweetAlert.swal(
- {
- title: "确认不受理?",
- text: "确认不受理后,将无法转换为事件工单!",
- type: "warning",
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- closeOnConfirm: false,
- closeOnCancel: false,
- },
- function (isConfirm) {
- if (isConfirm) {
- item.isExcute = 2;
- delete item.item;
- api_bpm_data
- .updData("hjzxRecord", { hjzxRecord: item })
- .then(function (res) {
- if (res.status == 200) {
- SweetAlert.swal(
- {
- title: "操作成功!",
- type: "success",
- confirmButtonColor: "#007AFF",
- },
- function () {
- $scope.refreshData("expand-right", $scope.filData);
- }
- );
- } else {
- SweetAlert.swal({
- title: "系统错误",
- text: "系统错误,请稍后重试!",
- type: "error",
- confirmButtonColor: "#DD6B55",
- });
- }
- });
- } else {
- SweetAlert.swal("操作取消", "数据安全", "error");
- }
- }
- );
- };
- $scope.transfersucc = function (item) {
- var handstate = "有效";
- if (item.isValid) {
- //未处理
- handstate = "无效";
- }
- return handstate;
- };
- $scope.transferTime = function (time) {
- return moment(time).format("YYYY-MM-DD HH:mm");
- };
- $scope.gridOptions.columnDefs = [
- {
- name: "item",
- displayName: "序号",
- width: 50,
- cellTemplate:
- "<div>" +
- '<div class="ui-grid-cell-contents"}">{{row.entity.item}}</div>' +
- "</div>",
- },
- {
- name: "recTime",
- displayName: "留言时间",
- width: "23%",
- cellTemplate:
- "<div>" +
- '<div class="ui-grid-cell-contents"}">{{grid.appScope.transferTime(row.entity.recTime)}}</div>' +
- "</div>",
- },
- {
- name: "ano",
- displayName: "来电号码",
- width: "20%",
- cellTemplate:
- "<div>" +
- '<div class="ui-grid-cell-contents"}">{{row.entity.ano}}</div>' +
- "</div>",
- },
- // {
- // name: 'isValid',
- // displayName: '有效状态',
- // width: '10%',
- // cellTemplate: '<div>' +
- // '<div class="ui-grid-cell-contents"}">{{grid.appScope.transfersucc(row.entity)}}</div>' +
- // '</div>'
- // },
- {
- name: "isExcute",
- displayName: "处理状态",
- width: "13%",
- cellTemplate:
- "<div>" +
- '<div class="ui-grid-cell-contents"}">{{grid.appScope.transferstate(row.entity)}}</div>',
- },
- {
- name: "操作",
- cellTemplate: '<recordoperator item="row.entity" colobject="col">',
- },
- ];
- $scope.value = 10;
- $scope.decrement = function () {
- $scope.value = $scope.value - 1;
- };
- $scope.gridOptions.onRegisterApi = function (gridApi) {
- $scope.gridApi = gridApi;
- gridApi.pagination.on.paginationChanged(
- $scope,
- function (newPage, pageSize) {
- var filtersData = $scope.memoryfilterData;
- filtersData.idx = newPage - 1;
- filtersData.sum = pageSize;
- $scope.refreshData("expand-right", filtersData);
- }
- );
- $scope.selected = {
- items: [],
- };
- };
- $scope.memoryfilterData = defaultFilterData = {
- idx: 0,
- sum: mun,
- };
- /*--------- new incident --------- */
- $scope.selectRowFunction = function (recorddata) {
- var filterData = {
- idx: 0,
- sum: 10,
- requester: {
- mphone: recorddata.ano,
- telephone: recorddata.ano,
- selectType: 1,
- },
- };
- api_user_data
- .fetchDataList("requester", filterData)
- .then(function (data) {
- var myData = Restangular.stripRestangular(data);
- // $rootScope.phone="";
- // $rootScope.setbusy();
- if (myData.list.length == 0) {
- var modalInstance = $modal.open({
- templateUrl:
- "assets/views/customform/tpl/modal-add-callrequester.html",
- controller: function (
- $scope,
- $modalInstance,
- api_user_data,
- api_wechatfile
- ) {
- $scope.title = "新增报修人";
- $scope.requester = {};
- $scope.areas = [];
- $scope.places = [];
- $scope.networktypes = [];
- $scope.onChangeadd = function (searchData) {
- $scope.searchKey = searchData.account;
- var requesdata = angular.copy(searchData);
- if (requesdata.telephone) {
- delete requesdata.telephone;
- }
- angular.extend($scope.requester, requesdata);
- };
- $scope.refreshUseradd = function (searchKey) {
- //请求人搜索
- $scope.requester.account = searchKey;
- $scope.searchData = searchKey;
- serchdataadd(searchKey);
- };
- $scope.getMydata = function (x) {
- var reqestdatap = JSON.parse(x[0]);
- if ($scope.requester.telephone) {
- delete reqestdatap.telephone;
- }
- $scope.searchField = JSON.parse(x[0]).account;
- angular.extend($scope.requester, reqestdatap);
- };
- $scope.getMydataone = function (x) {
- $scope.searchField = x;
- $scope.requester.account = x;
- };
- serchdataadd();
- function serchdataadd(searchKey) {
- if (searchKey) {
- var filterData = {
- requester: {
- searchKey: searchKey,
- },
- idx: 0,
- sum: 10,
- };
- } else {
- var filterData = {
- idx: 0,
- sum: 10,
- };
- }
- api_user_data
- .fetchDataList("requester", filterData)
- .then(function (response) {
- var myData = response;
- $scope.myData = myData.list;
- });
- }
- api_user_data
- .fetchDataList("area", {
- idx: 0,
- sum: 1000,
- })
- .then(function (response) {
- if (response.status == 200) {
- $scope.areas = response.list;
- }
- });
- api_wechatfile
- .getDictionary(
- {
- key: "requester_type",
- type: "list",
- },
- {
- idx: 0,
- sum: 100,
- }
- )
- .then(function (response) {
- if (response) {
- $scope.networktypes = response;
- }
- });
- $scope.requesterAreaid = "";
- $scope.onChange = function (item) {
- $scope.requesterAreaid = item.id;
- api_user_data
- .fetchDataList("place", {
- place: {
- area: {
- id: item.id,
- },
- },
- idx: 0,
- sum: 1000,
- })
- .then(function (response) {
- if (response.status == 200) {
- $scope.places = response.list;
- // $scope.requester.place = {};
- }
- });
- };
- $scope.refresh = function (searchVal) {
- var faildata = {};
- if ($scope.requesterAreaid) {
- faildata = {
- idx: 0,
- sum: 1000,
- place: {
- areaId: $scope.requesterAreaid,
- place: searchVal,
- selectType: "pinyin_qs",
- },
- };
- } else {
- faildata = {
- idx: 0,
- sum: 1000,
- place: {
- place: searchVal,
- selectType: "pinyin_qs",
- },
- };
- }
- api_user_data
- .fetchDataList("place", faildata)
- .then(function (response) {
- $scope.places = response.list;
- // $scope.requester.place = {};
- });
- };
- $scope.requester = { telephone: recorddata.ano };
- $scope.ok = function () {
- $modalInstance.close($scope.requester);
- };
- $scope.cancel = function () {
- $modalInstance.dismiss("cancel");
- };
- },
- });
- modalInstance.result.then(function (selectedItem) {
- if (selectedItem) {
- if (selectedItem.telephone && !selectedItem.mphone) {
- selectedItem.telephone = angular.copy(selectedItem.mphone);
- delete selectedItem.mphone;
- }
- var data = {
- requester: selectedItem,
- };
- api_user_data
- .addData("requester", data)
- .then(function (response) {
- if (response.status == 200) {
- var data = {
- model: {
- requestershow: response.data,
- recordId: recorddata.id,
- incident: {
- requester: response.data,
- houseNumber: response.data.houseNumber,
- contactsInformation: response.data.mphone,
- source: { id: 1548 },
- },
- },
- };
- if (response.data.place) {
- data.model.incident.area = response.data.place.area;
- data.model.incident.place = response.data.place;
- }
- $state.go("app.incident.title", {
- model: JSON.stringify(data),
- });
- }
- });
- }
- });
- } else if (myData.list.length == 1) {
- var data = {
- model: {
- requestershow: myData.list[0],
- recordId: recorddata.id,
- incident: {
- requester: myData.list[0],
- houseNumber: myData.list[0].houseNumber,
- contactsInformation: myData.list[0].mphone,
- source: { id: 1548 },
- },
- },
- };
- if (myData.list[0].place) {
- data.model.incident.area = myData.list[0].place.area;
- data.model.incident.place = myData.list[0].place;
- }
- $state.go("app.incident.title", { model: JSON.stringify(data) });
- } else {
- var modalInstance = $modal.open({
- templateUrl: "assets/views/createincident.html",
- controller: function (
- $scope,
- datas,
- $modalInstance,
- api_user_data
- ) {
- $scope.title = "请确定报修人";
- $scope.requester = myData.list;
- $scope.choice = function (requester) {
- $modalInstance.dismiss("cancel");
- var data = {
- model: {
- requestershow: requester,
- recordId: recorddata.id,
- incident: {
- requester: requester,
- houseNumber: requester.houseNumber,
- contactsInformation: requester.mphone,
- source: { id: 1548 },
- },
- },
- };
- if (requester.place) {
- data.model.incident.area = requester.place.area;
- data.model.incident.place = requester.place;
- }
- $state.go("app.incident.title", {
- model: JSON.stringify(data),
- });
- };
- $scope.cancel = function () {
- $modalInstance.dismiss("cancel");
- };
- },
- resolve: {
- datas: function () {
- return recorddata;
- },
- },
- size: "lg",
- });
- }
- });
- // var formdata = {
- // 'model': {
- // 'incident': {
- // 'source': { 'id': 1 },
- // },
- // 'recordId': data.id
- // }
- // }
- // $state.go('app.incident.chart', { 'model': JSON.stringify(formdata) });
- };
- /*--------- Recordings --------- */
- // $scope.recordcall = function(data) {
- // $scope.oldRecord(data);
- // var modalInstance = $modal.open({
- // templateUrl: 'assets/views/incident/tpl/audio.html',
- // controller: function($rootScope, $scope, $modalInstance, $sce) {
- // $scope.data = {
- // "name": "视频",
- // "url": callIp + "/recording/recording?recordId=" + data.id
- // };
- // $rootScope.setbusy();
- // $scope.data.url = $sce.trustAsResourceUrl($scope.data.url);
- // $scope.cancel = function() {
- // $modalInstance.dismiss('cancel');
- // // $rootScope.setidle();
- // };
- // $modalInstance.close();
- // }
- // });
- // modalInstance.result.then(function(result) {
- // // $rootScope.setidle();
- // }, function(reason) {
- // $rootScope.setidle();
- // });
- // };
- //录音
- $scope.recordcall = function (data) {
- var modalInstance = $modal.open({
- backdrop: "static",
- templateUrl: "assets/views/incident/tpl/audio.html",
- controller: function (
- $rootScope,
- $scope,
- $modalInstance,
- $sce,
- $http,
- api_playservice
- ) {
- $scope.audioUrl = $sce.trustAsResourceUrl(callIp + data.recFileName);
- // $rootScope.setbusy();
- // $scope.datasurl = "";
- // $http({
- // url: callIp + "/recording/recording?recordId=" + data.id,
- // method: 'GET',
- // headers: {},
- // }).success(function(data, status, headers, config) {
- // $scope.data = {
- // "name": "视频",
- // "url": $sce.trustAsResourceUrl("http://" + data.rrpath)
- // };
- // $scope.datasurl = data.rrpath;
- // }).error(function(data, status, headers, config) {});
- // $scope.download = function(contentId, filename) {
- // $http({
- // url: "http://" + $scope.datasurl,
- // method: 'GET',
- // headers: {
- // 'Content-type': 'application/octet-stream',
- // },
- // responseType: 'arraybuffer'
- // }).success(function(data, status, headers, config) {
- // var file = new Blob([data], {
- // type: 'application/octet-stream'
- // });
- // //trick to download store a file having its URL
- // var fileURL = URL.createObjectURL(file);
- // var a = document.createElement('a');
- // a.href = fileURL;
- // a.target = '_blank';
- // a.download = filename;
- // document.body.appendChild(a);
- // a.click();
- // }).error(function(data, status, headers, config) {
- // // console.log(data);
- // });
- // }
- $scope.cancel = function () {
- $modalInstance.dismiss("cancel");
- };
- $modalInstance.close();
- },
- });
- modalInstance.result.then(
- function (result) {
- // $rootScope.setidle();
- },
- function (reason) {
- $rootScope.setidle();
- }
- );
- };
- /*--------- call --------- */
- $scope.recordcallid = function (data) {
- // var telephone = '9' + data.ano;
- $rootScope.callout = 2;
- // if ($rootScope.takes) {
- // api_text.dialout($rootScope.takes, "@0", telephone).then(function(data) {
- // if (data.errno == 0) {
- // $rootScope.status = 6;
- // $scope.oldRecord(data);
- // }
- // })
- // } else {
- // SweetAlert.swal({
- // title: "呼叫失败",
- // text: "请先签入呼叫中心!",
- // type: "error",
- // confirmButtonColor: "#DD6B55"
- // });
- // }
- if (localStorage.getItem("fenjiNumber")) {
- // var caller = localStorage.getItem('phoneNumber');//呼叫人
- // console.log(sessionStorage.getItem('phones'))
- // var phones = JSON.parse(sessionStorage.getItem('phones'));
- // var isHuajihao = phones.length?phones.some(v=>v == data.ano):false;
- // console.log(isHuajihao)
- // if(isHuajihao){
- // tlwsa.tlaCallagc(data.ano);//呼叫坐席
- // }else{
- // tlwsa.tlaCallout(data.ano, caller, 0);//呼叫外线
- // }
- // var caller = localStorage.getItem('fenjiNumber');//呼叫人
- // tlwsa.tlaCallout(data.ano, caller, 0);
- $rootScope.toggle("off-sidebar");
- }else if(localStorage.getItem('hk_phone')){
- var gid = "@0"
- var telephone = '9' + teleno
- $rootScope.callout = 2;
- if ($rootScope.takes) {
- api_text.dialout($rootScope.takes, gid, telephone).then(function (data) {
- if (data.errno == 0) {
- $rootScope.status = 6;
- }
- })
- } else {
- SweetAlert.swal({
- title: "呼叫失败",
- text: "请先签入呼叫中心!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- }
- } else {
- SweetAlert.swal({
- title: "呼叫失败",
- text: "请先签入呼叫中心!",
- type: "error",
- confirmButtonColor: "#DD6B55",
- });
- }
- };
- /*--------- old record --------- */
- $scope.oldRecord = function (data) {
- api_bpm_data
- .updData("hjzxRecord", {
- id: data.id,
- field1: "1",
- isValid: data.isValid,
- isExcute: data.isExcute,
- })
- .then(function (data) {
- if (data.status) {
- $scope.refreshData("expand-right", defaultFilterData);
- }
- });
- };
- /*--------- record status translate --------- */
- $scope.record = function (data) {
- var keydata = 0;
- if (data.isValid == 1) {
- keydata = 0;
- } else {
- keydata = 1;
- }
- api_bpm_data
- .updData("hjzxRecord", {
- id: data.id,
- isValid: keydata,
- isExcute: 1,
- field1: "1",
- })
- .then(
- function (data) {
- if (data.status) {
- SweetAlert.swal(
- {
- title: "提交成功!",
- text: "有效状态转换成功!",
- type: "success",
- },
- function () {
- $scope.refreshData("expand-right", defaultFilterData);
- }
- );
- } else {
- SweetAlert.swal({
- title: "提交失败!",
- text: "有效状态转换失败,请重试!",
- type: "error",
- });
- }
- },
- function () {
- $scope.ldloading[style.replace("-", "_")] = false;
- }
- );
- };
- /*--------- double click --------- */
- // $scope.onDblClick = function(row) {
- // var modelfile = { model: { incident: row.entity } };
- // if (row.entity.state == "未受理") {
- // angular.extend(modelfile.model.incident, { status: 1 })
- // } else {
- // angular.extend(modelfile.model.incident, { status: 0 })
- // }
- // $state.go('app.desk.form_editor', { formKey: 'desk_detail', service: 'api_user_data', model: JSON.stringify(modelfile) });
- // };
- $scope.open = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.opened = !$scope.opened;
- };
- $scope.endOpen = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.startOpened = false;
- $scope.endOpened = !$scope.endOpened;
- };
- $scope.startOpen = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.endOpened = false;
- $scope.startOpened = !$scope.startOpened;
- };
- /*--------- get zhe list data--------- */
- var defaultFilterData = {
- idx: 0,
- sum: mun,
- };
- $scope.filData = {
- idx: 0,
- sum: 10,
- hjzxRecord: {
- isExcute: 0,
- },
- };
- $scope.searchstate = "weishouli";
- $scope.toIncident = function (data) {
- $state.go("app.incident.detail", {
- formKey: "incident_back",
- pdKey: "incident",
- dataId: data.incidentDTO.id,
- taskId: data.incidentDTO.taskId,
- processInstanceId: data.incidentDTO.processInstanceId,
- isRecord: "ok",
- });
- };
- $scope.onChange = function (data) {
- var toData = "";
- if (data == "weishouli") {
- toData = 0;
- } else if (data == "yishouli") {
- toData = 1;
- } else if (data == "bushouli") {
- toData = 2;
- }
- $scope.filData.hjzxRecord.isExcute = toData;
- $scope.searchstate = data;
- $scope.refreshData("expand-right", $scope.filData);
- };
- // 搜索
- $scope.search = function () {
- if ($scope.filData.hjzxRecord.startTime) {
- $scope.filData.hjzxRecord.startTime = moment(
- $scope.filData.hjzxRecord.startTime
- ).format("YYYY-MM-DD HH:mm:ss");
- }
- if ($scope.filData.hjzxRecord.endTime) {
- $scope.filData.hjzxRecord.endTime = moment(
- $scope.filData.hjzxRecord.endTime
- ).format("YYYY-MM-DD HH:mm:ss");
- }
- $scope.refreshData("expand-right", $scope.filData);
- };
- // 清空
- $scope.cleanItem = function () {
- delete $scope.filData.hjzxRecord.startTime;
- delete $scope.filData.hjzxRecord.endTime;
- $scope.refreshData("expand-right", $scope.filData);
- };
- $scope.ldloading = {};
- $scope.refreshData = function (style, filterData) {
- $scope.ldloading[style.replace("-", "_")] = true;
- if (angular.isUndefined(filterData)) {
- filterData = defaultFilterData;
- }
- $scope.myData = [];
- $scope.gridOptions["sum"] = filterData.sum;
- api_bpm_data.fetchDataList("hjzxRecord", filterData).then(
- function (data) {
- var myData = Restangular.stripRestangular(data);
- $scope.gridOptions["totalItems"] = myData.totalNum;
- $scope.myData = myData.list;
- for (var i = 0; i < $scope.myData.length; i++) {
- $scope.myData[i]["item"] = i + 1 + filterData.idx * filterData.sum;
- if (!$scope.myData[i]["id"]) {
- $scope.myData[i]["id"] = i;
- }
- }
- // console.log($scope.myData)
- $scope.ldloading[style.replace("-", "_")] = false;
- },
- function () {
- $scope.ldloading[style.replace("-", "_")] = false;
- }
- );
- };
- $scope.refreshData2 = function (style, filterData) {
- $scope.ldloading[style.replace("-", "_")] = true;
- if (angular.isUndefined(filterData)) {
- filterData = defaultFilterData;
- }
- // $scope.myData = [];
- $scope.gridOptions["sum"] = filterData.sum;
- api_bpm_data.fetchDataList("hjzxRecord", filterData).then(
- function (data) {
- var myData = Restangular.stripRestangular(data);
- $scope.gridOptions["totalItems"] = myData.totalNum;
- $scope.myData = myData.list;
- for (var i = 0; i < $scope.myData.length; i++) {
- $scope.myData[i]["item"] = i + 1 + filterData.idx * filterData.sum;
- if (!$scope.myData[i]["id"]) {
- $scope.myData[i]["id"] = i;
- }
- }
- // console.log($scope.myData)
- $scope.ldloading[style.replace("-", "_")] = false;
- },
- function () {
- $scope.ldloading[style.replace("-", "_")] = false;
- }
- );
- };
- $scope.refreshData("expand-right", $scope.filData);
- $scope.timer = $interval(function () {
- $scope.refreshData2("expand-right", $scope.filData);
- }, $rootScope.refreshTime);
- $scope.$on("$destroy", function () {
- $interval.cancel($scope.timer);
- });
- },
- ]);
- /*--------- operation --------- */
- app.controller("Recordoperator", [
- "$rootScope",
- "$http",
- "$scope",
- "$modal",
- function ($rootScope, $http, $scope, $modal) {
- // $scope.handle = false;
- // $scope.isvalid = false;
- // $scope.novalid = false;
- // console.log($scope.item);
- // if (!$scope.item.isExcute && !$scope.item.isValid) {
- // $scope.handle = true;
- // } else { $scope.handle = false; }
- // if (!$scope.item.isExcute) {
- // if ($scope.item.isValid) {
- // $scope.isvalid = true;
- // $scope.novalid = false;
- // } else {
- // $scope.isvalid = false;
- // $scope.novalid = true;
- // }
- // } else {
- // $scope.isvalid = false;
- // }
- $scope.isHuibo = (function () {
- var phones = JSON.parse(sessionStorage.getItem("phones"));
- console.log(phones, $scope.item.ano);
- var isHuajihao = phones && phones.length
- ? phones.some((v) => v == $scope.item.ano)
- : false;
- return !isHuajihao;
- })();
- $scope.weishouli = false;
- $scope.yishouli = false;
- $scope.bushouli = false;
- var loginUser = $rootScope.user;
- $scope.chuli = false;
- for (var i = 0; i < loginUser.menu.length; i++) {
- if (loginUser.menu[i].link == "liuyanliebiao_chuli") {
- $scope.chuli = true;
- }
- }
- if ($scope.item.isExcute == 1) {
- $scope.yishouli = true;
- } else if ($scope.item.isExcute == 2) {
- $scope.bushouli = true;
- } else {
- $scope.weishouli = true;
- }
- $scope.edit = function () {
- $scope.colobject.grid.appScope.selectRowFunction($scope.item);
- // $scope.doEdit($scope.item.id);
- };
- $scope.record = function () {
- $scope.colobject.grid.appScope.record($scope.item);
- // $scope.doEdit($scope.item.id);
- };
- $scope.recordcall = function () {
- $scope.colobject.grid.appScope.recordcall($scope.item);
- // $scope.doEdit($scope.item.id);
- };
- $scope.recordcallid = function () {
- $scope.colobject.grid.appScope.recordcallid($scope.item);
- // $scope.doEdit($scope.item.id);
- };
- $scope.bushouli = function () {
- $scope.colobject.grid.appScope.bushouli($scope.item);
- };
- $scope.toIncident = function () {
- $scope.colobject.grid.appScope.toIncident($scope.item);
- };
- },
- ]);
- app.directive("recordoperator", function () {
- return {
- restrict: "E",
- scope: {
- item: "=",
- colobject: "=",
- },
- controller: "Recordoperator",
- template:
- '<div class="links cl-effect-1 ui-grid-cell-contents pull-left" >' +
- '<a ng-click="edit()" ng-show="weishouli&&chuli" class="bianjifont">新建事件</a>' +
- '<a ng-click="bushouli()" ng-show="weishouli&&chuli" class="bianjifont">不受理</a>' +
- // '<a ng-click="record()" ng-show="{{isvalid}}&&{{handle}}" class="luyinfont">有效</a>' +
- // '<a ng-click="record()" ng-show="{{novalid}}&&{{handle}}" class="luyinfont">无效</a>' +
- '<a ng-click="recordcall()" ng-show="(weishouli||yishouli)&&chuli" class="bianjifont">回放</a>' +
- '<a ng-click="recordcallid()" ng-show="(weishouli||yishouli)&&chuli&&isHuibo" class="bianjifont">回拨</a>' +
- '<a ng-click="toIncident()" ng-show="yishouli" class="bianjifont">查看事件</a>' +
- "</div>",
- };
- });
|