123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095 |
- '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")
- // });
- // 来源
- $scope.sourceTypes = [
- {name:'事件生成',value:'pcIncident'},
- {name:'自主报修',value:'wechatRequesterIncident'}
- ]
- //修改来源
- $scope.seiminObj = {
- sourceType: null
- };
- $scope.changeSourceType = function(item){
- console.log(item);
- $scope.fileData.wxincident.sourceType = item.value;
- }
- 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;
- };
- //处理图标与文字
- $scope.transfertip = function (item) {
- var tip = "";
- if (item.operationLog) {
- tip = item.operationLog.userName;
- }
- return tip;
- }
- $scope.transferColor = function (item) {
- var color = "";
- if (item.operationLog) {
- if (item.operationLog.opValue == 1) {
- color = "dash dash-lock redfont";
- } else {
- color = "dash dash-unlock greenfont";
- }
- } else {
- color = "dash dash-unlock greenfont";
- }
- return color;
- }
- //表格列表显示
- if ($scope.repairMain.valueconfig == 1) {//报修主体为报修人
- $scope.gridOptions.columnDefs = [
- {
- name: 'id',
- displayName: '',
- width: 35,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" tooltip={{grid.appScope.transfertip(row.entity)}} tooltip-placement="right"><i style="font-size: 18px !important;" class="{{grid.appScope.transferColor(row.entity)}}"></i></div></div>' +
- '</div>'
- },
- {
- 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: 300,
- 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: 300,
- 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) {
- 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;
- delete $scope.fileData.wxincident.sourceType;
- $scope.seiminObj = null;
- $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;
- //科室列表选中数据,请求参数判断
- if ($scope.repairMain.valueconfig == 2 && $scope.ksModel != '') {//报修科室且不是空字符
- $scope.fileData.wxincident.departmentDTO = {
- dept: $scope.ksModel
- }
- }
- // 根据权限查询
- if($rootScope.user.duty){
- // 当前的所属责任科室
- filterData.wxincident.duty = $rootScope.user.duty;
- }else if($rootScope.user.branch){
- // 当前的所属院区
- filterData.wxincident.branch = $rootScope.user.branch.id;
- }
- sessionStorage['searchchart'] = angular.copy(JSON.stringify(filterData));
- //搜索接口
- 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;
- // 根据权限查询
- if($rootScope.user.duty){
- // 当前的所属责任科室
- filterData.wxincident.duty = $rootScope.user.duty;
- }else if($rootScope.user.branch){
- // 当前的所属院区
- filterData.wxincident.branch = $rootScope.user.branch.id;
- }
- 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', 'api_user_data', function ($rootScope, $http, $scope, $modal, api_user_data) {
- $scope.handle = false;
- $scope.see = false;
- $scope.toHandle = false;
- var loginUser = $rootScope.user;
- // 是否是服务台经理
- $scope.isFuwutaijingli = loginUser.role.filter(v => v.rolecode == 'call center admin').length > 0;
- // 是否显示解除锁定
- $scope.isUnLock = false;
- console.log($scope.item)
- if ($scope.item.operationLog) {
- $scope.isUnLock = ($scope.item.operationLog.userId == loginUser.id) && ($scope.item.operationLog.opValue == 1);
- } else {
- $scope.isUnLock = false;
- }
- // 是否显示处理--锁定相关的操作
- $scope.isChuli = false;
- if ($scope.isFuwutaijingli) {
- //如果有服务台经理角色
- $scope.isChuli = true;
- } else {
- //如果没有服务台经理角色
- if ($scope.item.operationLog) {
- if ($scope.item.operationLog.opValue == 1) {
- //如果锁定
- $scope.isChuli = $scope.item.operationLog.userId == loginUser.id;
- } else {
- //如果没锁定
- $scope.isChuli = true;
- }
- } else {
- $scope.isChuli = true;
- }
- }
- $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 () {
- console.log($scope.item)
- // $scope.colobject.grid.appScope.toHandleFunction($scope.item);
- //是否包含服务台经理角色
- var isFuwutaijingli = loginUser.role.filter(v => v.rolecode == 'call center admin').length > 0;
- if (!isFuwutaijingli) {
- if ($scope.item.operationLog) {
- //有锁定操作记录的
- var p1 = {
- idx: 0,
- sum: 1000,
- operationLog: {
- id: $scope.item.operationLog.id,
- extra1: $scope.item.id,
- opType: 'wxincidentLock'
- }
- };
- api_user_data.fetchDataList('operationLog', p1).then(function (result) {
- if (result.status == 200) {
- var opValue = result.list[0].opValue;//查询锁定状态
- var userName = result.list[0].userName;//查询锁定人
- var userId = result.list[0].userId;//查询锁定人ID
- if (opValue == 1&&userId!=loginUser.id) {
- //如果锁定了,并不是锁定人操作
- $modal.open({
- templateUrl: 'assets/views/delete.html',
- controller: function ($scope, scope, $modalInstance, api_user_data, SweetAlert) {
- $scope.title = '提示';
- $scope.connect = '该报修已被【' + userName + '】锁定!';
- $scope.yesFlag = true;
- //选择“取消”或“确定”
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- scope.$parent.$parent.$parent.$parent.$parent.$parent.$parent.$parent.refreshData('expand-right', $scope.fileData);
- };
- },
- size: 'sm',
- resolve: {
- scope: function () {
- return $scope;
- }
- }
- });
- } else if(opValue == 1&&userId==loginUser.id){
- //如果锁定了,并是锁定人操作
- $scope.colobject.grid.appScope.toHandleFunction($scope.item);
- }else{
- //如果没有锁定
- $scope.operateUnLock($scope.item.operationLog.id)
- }
- }
- })
- } else {
- //没有锁定记录的
- $scope.operateUnLock();
- }
- } else {
- $scope.colobject.grid.appScope.toHandleFunction($scope.item);
- }
- // $scope.doEdit($scope.item.id);
- }
- //是否锁定,id是日志ID,有是修改,没有是新增
- $scope.operateUnLock = function (id) {
- $modal.open({
- templateUrl: 'assets/views/delete.html',
- controller: function ($scope, scope, $modalInstance, api_user_data, SweetAlert) {
- $scope.title = '提示';
- $scope.connect = '是否锁定?锁定后其他人(服务台经理除外)无法操作此报修!';
- $scope.noFlag = true;
- //选择“是”
- $scope.yes = function () {
- if (scope.item) {
- var postData = {
- operationLog: {
- extra1: scope.item.id,
- userId: loginUser.id,
- userName: loginUser.name,
- opType: 'wxincidentLock',
- opValue: '1'
- }
- };
- if(id){
- postData.operationLog.id = id;
- }
- api_user_data.addData('operationLog', postData).then(function (response) {
- if (response.data) {
- $modalInstance.dismiss('cancel');
- SweetAlert.swal({
- title: "锁定成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- }, function () {
- scope.colobject.grid.appScope.toHandleFunction(scope.item);
- });
- } else {
- SweetAlert.swal({
- title: "操作异常!",
- text: "系统异常,请稍后重试,或者联系管理员!",
- type: "error"
- });
- }
- })
- }
- };
- //选择“取消”
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- //选择“否”
- $scope.no = function () {
- $modalInstance.dismiss('cancel');
- scope.colobject.grid.appScope.toHandleFunction(scope.item);
- };
- },
- size: 'sm',
- resolve: {
- scope: function () {
- return $scope;
- }
- }
- });
- }
- //解锁
- $scope.unLock = function(){
- $modal.open({
- templateUrl: 'assets/views/delete.html',
- controller: function ($scope, scope, $modalInstance, api_user_data, SweetAlert) {
- $scope.title = '提示';
- $scope.connect = '是否解锁?';
- $scope.noFlag = true;
- //选择“是”
- $scope.yes = function () {
- if (scope.item) {
- var postData = {
- operationLog: {
- id:scope.item.operationLog.id,
- extra1: scope.item.id,
- userId: loginUser.id,
- userName: loginUser.name,
- opType: 'wxincidentLock',
- opValue: '0'
- }
- };
- api_user_data.addData('operationLog', postData).then(function (response) {
- if (response.data) {
- $modalInstance.dismiss('cancel');
- SweetAlert.swal({
- title: "解锁成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- }, function () {
- scope.$parent.$parent.$parent.$parent.$parent.$parent.$parent.$parent.refreshData('expand-right', $scope.fileData);
- });
- } else {
- SweetAlert.swal({
- title: "操作异常!",
- text: "系统异常,请稍后重试,或者联系管理员!",
- type: "error"
- });
- }
- })
- }
- };
- //选择“取消”
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- //选择“否”
- $scope.no = function () {
- $modalInstance.dismiss('cancel');
- };
- },
- size: 'sm',
- resolve: {
- scope: function () {
- return $scope;
- }
- }
- });
- }
- //查看事件
- $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)&&isChuli}}" class="bianjifont">处理</a>' +
- '<a ng-click="unLock()" ng-show="{{isUnLock}}" 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;
- // };
- // })
|