123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847 |
- 'use strict';
- app.controller('chartCtrl', ["$scope", "i18nService", "$rootScope", "$state", "$timeout", "$interval", "$modal", "SweetAlert", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_data", "api_text", "api_user_data", "api_wechatfile", "api_search_ks", function ($scope, i18nService, $rootScope, $state, $timeout, $interval, $modal, SweetAlert, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_data, api_text, api_user_data, api_wechatfile, api_search_ks) {
- $scope.langs = i18nService.getAllLangs();
- $scope.lang = 'zh-cn';
- i18nService.setCurrentLang($scope.lang);
- // $(window).resize(function() {
- // // console.log("1111")
- // });
- var loginUser = $rootScope.user;
- //保存报修主体
- $scope.repairMain = JSON.parse(sessionStorage.getItem("repair_main"));
- $scope.wxIncidentWithCmdb = JSON.parse(sessionStorage.getItem("wxIncidentWithCmdb"));//资产
- $scope.incidentWithConsumable = JSON.parse(sessionStorage.getItem("incidentWithConsumable"));//耗材
- // ----------------分割线 start-----------------
- // 报修科室下拉
- $scope.ks_pageNum = 0; //科室下拉列表分页
- $scope.ks_len = 0; //科室所有数据列表数量
- $scope.ks_arr = [];//科室所有数据
- $scope.ksFlag = false;//默认下拉框列表隐藏
- $scope.ksModel = '';//科室输入内容
- //点击文本框
- $scope.ksClickHandle = function () {
- $scope.ks_arr = [];
- $scope.ks_pageNum = 0;
- $scope.getDepartmentList($scope.ks_pageNum);
- angular.element('#bx_ks_ul').scrollTop(0);
- }
- //修改文字,实时监听
- $scope.ksChangeHandle = _.debounce(function () {
- $scope.ks_arr = [];
- $scope.ks_pageNum = 0;
- $scope.getDepartmentList($scope.ks_pageNum);
- angular.element('#bx_ks_ul').scrollTop(0);
- }, 500)
- //滚动加载
- $scope.ksScrollHandle = function () {
- var itemLen = $scope.ks_arr.length;
- $scope.ks_pageNum++;
- if ($scope.ks_len != itemLen) {
- $scope.ks_len = itemLen;
- $scope.getDepartmentList($scope.ks_pageNum);
- }
- }
- //获取科室列表seimin
- $scope.getDepartmentList = function (idx) {
- api_search_ks.getKsList({ "idx": idx, "sum": 50, "department": { "dept": $scope.ksModel } })
- .then(res => {
- if (res.status == 200) {
- //添加分页数据,汇总
- $scope.ks_arr = $scope.ks_arr.concat(res.list);
- $scope.ksFlag = true;//显示
- }
- })
- .catch(err => {
- console.log(err);
- })
- }
- //下拉框列表选中
- $scope.ksItemClick = function (obj) {
- $scope.ksModel = obj.dept;//文本框赋值
- $scope.ksFlag = false;//隐藏
- }
- //点击空白处隐藏
- angular.element(document).on('click', function (e) {
- if (e.target !== angular.element('#bx_ks').get(0)) {
- $scope.ksFlag = false;//隐藏
- //模拟placeholder
- // if ($('#bx_ks').val() == '') {
- // $('#bx_ks').val('请选择报修科室');
- // }
- }
- })
- // -----------------分割线 end----------------
- // 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;
- };
- //表格列表显示
- if ($scope.repairMain.valueconfig == 1) {//报修主体为报修人
- $scope.gridOptions.columnDefs = [{
- name: 'item',
- displayName: '序号',
- width:50,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">{{row.entity.item}}</div>' +
- '</div>'
- },{
- name: 'bxcode',
- displayName: '报修单号',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">{{row.entity.bxcode}}</div>' +
- '</div>'
- }, {
- name: 'incidentDescription',
- displayName: '事件描述',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.incidentDescription}}</div>' +
- '</div>'
- },
- // {
- // name: 'incidentDescription1',
- // displayName: '报修科室',
- // width: '12%',
- // cellTemplate: '<div>' +
- // '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.incidentDescription1}}</div>' +
- // '</div>'
- // },
- {
- name: 'address',
- displayName: '故障地点',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.place.place||""}} {{row.entity.address}}</div>' +
- '</div>'
- }, {
- name: 'contacts',
- displayName: '联系人',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.contacts}}</div>' +
- '</div>'
- },{
- name: 'requester.account',
- displayName: '学工号',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.requester.account}}</div>' +
- '</div>'
- }, {
- name: 'contactsInformation',
- displayName: '联系电话',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.contactsInformation}}</div>' +
- '</div>'
- },{
- name: 'incident.acceptUser.name',
- displayName: '受理人',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" ng-if="row.entity.incident&&row.entity.incident.acceptUser">{{row.entity.incident.acceptUser.name||""}}</div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" ng-if="row.entity.rejectUser">{{row.entity.rejectUser.name||""}}</div>' +
- '</div>'
- },
- // {
- // name: 'requester.name',
- // displayName: '报修人',
- // width: '10%',
- // cellTemplate: '<div>' +
- // '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.requester.name}}</div>' +
- // '</div>'
- // },
- {
- name: 'serviceState.name',
- displayName: '状态',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.serviceState.name}}</div>' +
- '</div>'
- }, {
- name: 'createTime',
- displayName: '报修时间',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center">{{grid.appScope.transferTime(row.entity.createTime)}}</div>' +
- '</div>'
- // },
- // {
- // name: '生成事件',
- // width: 80,
- // cellTemplate: '<div class="links cl-effect-1">' +
- // '<a ng-click="grid.appScope.selectRowFunction(row.entity)" tooltip="新建事件" tooltip-placement="left"><i class="fa fa-pencil-square-o"></i></a>' +
- // '</div>'
- },
- {
- name: '操作',
- width:200,
- cellTemplate: '<wechatoperator item="row.entity" colobject="col">',
- enableFiltering: false
- }
- ];
- // 是否展示资产
- if($scope.wxIncidentWithCmdb == 1){
- let index = $scope.gridOptions.columnDefs.findIndex(v=>v.name == 'address');
- $scope.gridOptions.columnDefs.splice(index,0,{
- name: 'assetId',
- displayName: '资产',
- width:150
- })
- }
- } else if ($scope.repairMain.valueconfig == 2) {//报修主体为科室
- $scope.gridOptions.columnDefs = [{
- name: 'item',
- displayName: '序号',
- width: 50,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">{{row.entity.item}}</div>' +
- '</div>'
- },{
- name: 'bxcode',
- displayName: '报修单号',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">{{row.entity.bxcode}}</div>' +
- '</div>'
- }, {
- name: 'incidentDescription',
- displayName: '事件描述',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.incidentDescription}}</div>' +
- '</div>'
- },
- // {
- // name: 'incidentDescription1',
- // displayName: '报修科室',
- // width: '12%',
- // cellTemplate: '<div>' +
- // '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.incidentDescription1}}</div>' +
- // '</div>'
- // },
- {
- name: 'address',
- displayName: '故障地点',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.place.place||""}} {{row.entity.address}}</div>' +
- '</div>'
- }, {
- name: 'departmentDTO.dept',
- displayName: '报修科室',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.departmentDTO.dept}}</div>' +
- '</div>'
- }, {
- name: 'contacts',
- displayName: '联系人',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.contacts}}</div>' +
- '</div>'
- }, {
- name: 'contactsInformation',
- displayName: '联系电话',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.contactsInformation}}</div>' +
- '</div>'
- },
- // {
- // name: 'requester.name',
- // displayName: '报修人',
- // width: '10%',
- // cellTemplate: '<div>' +
- // '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.requester.name}}</div>' +
- // '</div>'
- // },
- {
- name: 'serviceState.name',
- displayName: '状态',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.serviceState.name}}</div>' +
- '</div>'
- }, {
- name: 'createTime',
- displayName: '报修时间',
- width:150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center">{{grid.appScope.transferTime(row.entity.createTime)}}</div>' +
- '</div>'
- // },
- // {
- // name: '生成事件',
- // width: 80,
- // cellTemplate: '<div class="links cl-effect-1">' +
- // '<a ng-click="grid.appScope.selectRowFunction(row.entity)" tooltip="新建事件" tooltip-placement="left"><i class="fa fa-pencil-square-o"></i></a>' +
- // '</div>'
- },
- {
- name: '操作',
- width:200,
- cellTemplate: '<wechatoperator item="row.entity" colobject="col">',
- enableFiltering: false
- }
- ];
- }
- $scope.value = 10;
- $scope.decrement = function () {
- $scope.value = $scope.value - 1;
- };
- $scope.searchkeys = {};
- //点击切换
- $scope.onChange = function (searchType) {
- $scope.searchstate = searchType;
- // defaultFilterData = $scope.memoryfilterData;
- if (searchType) {
- $scope.fileData.wxincident.serviceState = { "id": searchType };
- } else {
- delete $scope.fileData.wxincident.serviceState
- }
- // sessionStorage.searchchart.state = searchType;
- $scope.refreshData('expand-right', $scope.fileData);
- }
- $scope.record = function () {
- api_text.record($rootScope.takes).then(function (data) {
- if (data.errno == 0) {
- $scope.busy = false;
- }
- })
- };
- $scope.transferTime = function (time) {
- return moment(time).format('YYYY-MM-DD HH:mm');
- }
- $scope.parameters = null;
- $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;
- };
- var getUser = function (fieldatas) {
- api_user_data.fetchDataList('requester', fieldatas).then(function (data) {
- $scope.requester = data.list;
- });
- }
- $scope.onChangehandling = function (key) {
- var filuser = {
- "idx": 0,
- "sum": 10,
- "requester": {
- "name": key
- }
- }
- getUser(filuser);
- }
- getUser({
- "idx": 0,
- "sum": 10
- });
- //搜索
- $scope.chiceIncident = function (item) {
- // var fildata = {};
- // if (sessionStorage.searchincident) {
- // fildata = JSON.parse(sessionStorage.getItem("searchchart"));
- // $scope.gridOptions.paginationCurrentPage = 1;
- // fildata.idx = 0;
- // } else {
- // fildata = defaultFilterData;
- // }
- // if (!fildata.incident) {
- // fildata['wxincident'] = {};
- // }
- // if (item.createTime) {
- // item.createTime = moment(item.createTime).format('YYYY-MM-DD HH:mm:ss');
- // }
- // if (item.createTimeEnd) {
- // item.createTimeEnd = moment(new Date(item.createTimeEnd).getTime() + 86399999).format('YYYY-MM-DD HH:mm:ss');
- // }
- // angular.extend(fildata.wxincident, item)
- // sessionStorage['searchchart'] = angular.copy(JSON.stringify(fildata));
- // $scope.memoryfilterData = fildata;
- if ($scope.fileData.wxincident.createTime) {
- $scope.fileData.wxincident.createTime = moment($scope.fileData.wxincident.createTime).format('YYYY-MM-DD HH:mm:ss');
- }
- if ($scope.fileData.wxincident.createTimeEnd) {
- $scope.fileData.wxincident.createTimeEnd = moment($scope.fileData.wxincident.createTimeEnd).format('YYYY-MM-DD HH:mm:ss');
- }
- $scope.refreshData('expand-right', $scope.fileData);
- }
- $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.fileData.idx = newPage - 1;
- $scope.fileData.sum = pageSize;
- $scope.refreshData('expand-right', $scope.fileData);
- // if (JSON.parse(sessionStorage.getItem("searchchart")).idx != filtersData.idx) {
- // $scope.refreshData('expand-right', filtersData);
- // }
- // $scope.refreshData('expand-right', filtersData);
- });
- $scope.selected = {
- items: []
- }
- };
- $scope.memoryfilterData = defaultFilterData = {
- // "assignee":$rootScope.user.id,
- // "candidateGroups":$rootScope.user.group[0].id,
- "idx": 0,
- "wxincident": {
- "serviceState": { "id": 1650 }
- },
- "sum": mun
- };
- //收集搜索数据
- $scope.fileData = {
- "idx": 0,
- "wxincident": {
- "serviceState": { "id": 1650 }
- },
- "sum": 10
- }
- $scope.selectRowFunction = function (data) {
- var formdata = {
- 'model': {
- 'incident': {
- 'requester': data.requester,
- 'area': data.place.area,
- 'place': data.place,
- 'houseNumber': data.address,
- 'contacts': data.contacts,
- 'contactsInformation': data.contactsInformation,
- // 'category': data.wxIncidentClassifyDTO.category,
- 'description': data.incidentDescription,
- 'source': {
- 'id': 1549
- },
- 'sourceType': data.sourceType,
- 'fileUrl': data.fileUrl
- },
- 'requestershow': data.requester,
- 'flow': data.id
- }
- }
- // if (data.requester.requesterTypeDTO && data.requester.requesterTypeDTO.id == 2) {
- // angular.extend(formdata.model.incident, { 'priority': { 'id': 2 } });
- // }
- $state.go('app.incident.chart', {
- 'model': JSON.stringify(formdata)
- });
- };
- $scope.lookFunction = function (data) {
- // // var data = row.entity;
- // var formdata = {
- // 'model': {
- // 'incident': {
- // 'requester': data.requester,
- // 'area': data.place.area.area,
- // 'place': data.place.place,
- // 'houseNumber': data.address,
- // 'contacts': data.contacts,
- // 'contactsInformation': data.contactsInformation,
- // // 'category': data.wxIncidentClassifyDTO.category,
- // 'incidentState':data.incidentState,
- // 'description': data.incidentDescription,
- // 'source': {
- // 'id': 1549
- // },
- // 'sourceType': data.sourceType,
- // 'fileUrl': data.fileUrl
- // },
- // 'requestershow': data.requester,
- // 'flow': data.id
- // }
- // }
- // var modelfile = {
- // model: {
- // incident: data
- // }
- // };
- // if (data.incidentState.name == "未受理") {
- // angular.extend(modelfile.model, {
- // 'gourl': 'app.incident.chart',
- // 'state_model': formdata
- // })
- // 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)
- // });
- $state.go('app.desk.detail', {
- model: JSON.stringify(data)
- });
- };
- $scope.toHandleFunction = function (data) {
- // var data = row.entity;
- console.log(data)
- var formdata = {
- 'model': {
- 'incident': {
- 'requester': data.requester,
- // 'area': data.place.area.area,
- // 'place': data.place.place,
- 'houseNumber': data.address,
- 'contacts': data.contacts,
- 'contactsInformation': data.contactsInformation,
- // 'category': data.wxIncidentClassifyDTO.category,
- 'incidentState': data.incidentState,
- 'description': data.incidentDescription,
- 'source': {
- 'id': 1549
- },
- 'sourceType': data.sourceType,
- 'fileUrl': data.fileUrl
- },
- 'requestershow': data.requester,
- 'flow': data.id,
- 'retractReason': data.retractReason
- }
- }
- var modelfile = {
- model: {
- incident: data
- }
- };
- // if (data.incidentState.name == "未受理") {
- angular.extend(modelfile.model, {
- 'gourl': 'app.incident.chart',
- 'state_model': formdata
- })
- 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.seeIncidentFunction = function (data) {
- // console.log(data);
- $state.go('app.incident.detail', {
- formKey: 'incident_back',
- pdKey: 'incident',
- dataId: data.incident.id,
- taskId: data.incident.taskId,
- processInstanceId: data.incident.processInstanceId,
- isChart: "ok"
- });
- }
- //重置
- $scope.cleanItem = function () {
- delete $scope.fileData.wxincident.contacts;
- delete $scope.fileData.wxincident.contactsInformation;
- delete $scope.fileData.wxincident.createTime;
- delete $scope.fileData.wxincident.createTimeEnd;
- delete $scope.fileData.wxincident.departmentDTO;
- $scope.ksModel = '';
- $scope.refreshData('expand-right', $scope.fileData);
- }
- // $scope.followFunction = function(data){
- // //console.log('data='+JSON.stringify(data));
- // $state.go('app.detail', { formKey:'statusform', pdKey:'incident', dataId: data.id,processInstanceId: data.processInstanceId});
- // };
- // $scope.onDblClick = function (row) {
- // var data = row.entity;
- // var formdata = {
- // 'model': {
- // 'incident': {
- // 'requester': data.requester,
- // 'area': data.area,
- // 'place': data.place,
- // 'houseNumber': data.address,
- // 'contacts': data.contacts,
- // 'contactsInformation': data.contactsInformation,
- // // 'category': data.wxIncidentClassifyDTO.category,
- // 'description': data.incidentDescription,
- // 'source': {
- // 'id': 4
- // },
- // 'sourceType': data.sourceType,
- // 'fileUrl': data.fileUrl
- // },
- // 'requestershow': data.requester,
- // 'flow': data.id
- // }
- // }
- // var modelfile = {
- // model: {
- // incident: row.entity
- // }
- // };
- // if (row.entity.state == "未受理") {
- // angular.extend(modelfile.model, {
- // 'gourl': 'app.incident.chart',
- // 'state_model': formdata
- // })
- // 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)
- // });
- // };
- var defaultFilterData = {
- // "assignee":$rootScope.user.id,
- // "candidateGroups":$rootScope.user.group[0].id,
- "idx": 0,
- "wxincident": {
- "serviceState": { "id": 1650 }
- },
- "sum": mun
- };
- $scope.ldloading = {};
- $scope.refreshData = function (style, filterData) {
- $scope.ldloading[style.replace('-', '_')] = true;
- // if (angular.isUndefined(filterData)) {
- // filterData = defaultFilterData;
- // }
- if (angular.isUndefined(filterData)) {
- // if (sessionStorage.searchchart) {
- // filterData = JSON.parse(sessionStorage.getItem("searchchart"));
- // $scope.searchkeys = filterData.wxincident;
- // // $scope.searchstate = filterData.state;
- // $scope.gridOptions.paginationCurrentPage = 1 + filterData.idx;
- // $scope.searchstate = filterData.wxincident.searchType;
- // } else {
- filterData = defaultFilterData;
- // }
- }
- $scope.myData = [];
- $scope.gridOptions['sum'] = filterData.sum;
- sessionStorage['searchchart'] = angular.copy(JSON.stringify(filterData));
- //科室列表选中数据,请求参数判断
- if ($scope.repairMain.valueconfig == 2 && $scope.ksModel != '') {//报修科室且不是空字符
- $scope.fileData.wxincident.departmentDTO = {
- dept: $scope.ksModel
- }
- }
- //搜索接口
- api_bpm_data.fetchDataList("wxincident", filterData).then(function (data) {
- // console.log(filterData)
- var myData = Restangular.stripRestangular(data);
- for (var i = 0; i < myData.list.length; i++) {
- myData.list[i].createTime = moment(myData.list[i].createTime).format('YYYY-MM-DD HH:mm:ss')
- }
- $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
- }
- // 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;
- // }
- if (angular.isUndefined(filterData)) {
- // if (sessionStorage.searchchart) {
- // filterData = JSON.parse(sessionStorage.getItem("searchchart"));
- // $scope.searchkeys = filterData.wxincident;
- // // $scope.searchstate = filterData.state;
- // $scope.gridOptions.paginationCurrentPage = 1 + filterData.idx;
- // $scope.searchstate = filterData.wxincident.searchType;
- // } else {
- filterData = defaultFilterData;
- // }
- }
- // $scope.myData = [];
- $scope.gridOptions['sum'] = filterData.sum;
- sessionStorage['searchchart'] = angular.copy(JSON.stringify(filterData));
- api_bpm_data.fetchDataList("wxincident", filterData).then(function (data) {
- console.log(222)
- var myData = Restangular.stripRestangular(data);
- for (var i = 0; i < myData.list.length; i++) {
- myData.list[i].createTime = moment(myData.list[i].createTime).format('YYYY-MM-DD HH:mm:ss')
- }
- $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
- }
- // console.log($scope.myData)
- $scope.ldloading[style.replace('-', '_')] = false;
- }, function () {
- $scope.ldloading[style.replace('-', '_')] = false;
- });
- };
- $scope.timer = $interval(function () {
- $scope.refreshData2('expand-right', $scope.fileData);
- }, $rootScope.refreshTime);
-
- console.log($state.params);
- if($state.params.tab){
- if($state.params.tab == '-1'){
- $scope.searchstate = '';
- $scope.fileData.wxincident = {};
- }else{
- $scope.searchstate = $state.params.tab;
- $scope.fileData.wxincident.serviceState.id = $scope.searchstate;
- }
- }else{
- //默认未转换
- $scope.searchstate = 1650;
- if (sessionStorage.getItem('jry_data')) {
- $scope.searchstate = sessionStorage.getItem('jry_data');
- $scope.fileData.wxincident.serviceState.id = sessionStorage.getItem('jry_data');
- }
- }
- $scope.$on('$destroy', function () {
- sessionStorage.setItem('jry_data', $scope.searchstate);
- $interval.cancel($scope.timer)
- });
- $scope.refreshData('expand-right', $scope.fileData);
- }]);
- app.controller('Wechatoperator', ['$rootScope', '$http', '$scope', '$modal', function ($rootScope, $http, $scope, $modal) {
- $scope.handle = false;
- $scope.see = false;
- $scope.toHandle = false;
- var loginUser = $rootScope.user;
- $scope.chuli = false;
- for (var i = 0; i < loginUser.menu.length; i++) {
- if (loginUser.menu[i].link == "weixinbaozhang_chuli") {
- $scope.chuli = true
- }
- }
- if ($scope.item.serviceState.name == "已转换") {
- $scope.toHandle = true;
- } else {
- $scope.toHandle = false;
- }
- if ($scope.item.serviceState.name == "未转换") {
- $scope.handle = true;
- } else {
- $scope.handle = false;
- }
- if ($scope.item.serviceState.name == "已转换" || $scope.item.serviceState.name == "不受理" || $scope.item.serviceState.name == "未转换") {
- $scope.see = true;
- } else {
- $scope.see = false;
- }
- $scope.edit = function () {
- $scope.colobject.grid.appScope.selectRowFunction($scope.item);
- // $scope.doEdit($scope.item.id);
- }
- //查看,查看详情
- $scope.look = function () {
- $scope.colobject.grid.appScope.lookFunction($scope.item);
- // $scope.doEdit($scope.item.id);
- }
- //处理
- $scope.handleFn = function () {
- $scope.colobject.grid.appScope.toHandleFunction($scope.item);
- // $scope.doEdit($scope.item.id);
- }
- //查看事件
- $scope.seeIncident = function () {
- $scope.colobject.grid.appScope.seeIncidentFunction($scope.item);
- // $scope.doEdit($scope.item.id);
- }
- }]);
- app.directive('wechatoperator', function () {
- return {
- restrict: 'E',
- scope: {
- item: '=',
- colobject: '='
- },
- controller: 'Wechatoperator',
- template: '<div class="links cl-effect-1 ui-grid-cell-contents pull-left" >' +
- // '<a ng-click="edit()" ng-show="{{handle}}" tooltip="生成事件" tooltip-placement="left">生成事件</a>' +
- // '<a ng-click="edit()" class="bianjifont">生成事件</a>' +
- '<a ng-click="handleFn()" ng-show="{{handle&&chuli}}" class="bianjifont">处理</a>' +
- '<a ng-click="look()" ng-show="{{see}}" class="bianjifont">查看</a>' +
- // '<a ng-click="look()" ng-show="{{toHandle}}" class="bianjifont">查看详情</a>' +
- '<a ng-click="seeIncident()" ng-show="{{toHandle}}" class="bianjifont">查看事件</a>' +
- // '<a ng-click="look()" ng-show="{{handle}}" tooltip="查看" tooltip-placement="right"><i class="ti-eye"></i></a>' +
- '</div>'
- };
- });
- // app.factory('myFactory', function() {
- // //定义factory返回对象
- // var myServices = {};
- // //定义参数对象
- // var myObject = {};
- // var _set = function(data) {
- // myObject = data;
- // };
- // })
|