123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846 |
- '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", "api_flow", 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, api_flow) {
- $scope.langs = i18nService.getAllLangs();
- $scope.lang = 'zh-cn';
- i18nService.setCurrentLang($scope.lang);
- var loginUser = $rootScope.user;
- $scope.tabs = [
- {key: 'all', value: '全部', num: ''},
- {key: 'accept', value: '待受理', num: ''},
- {key: 'accepted', value: '已受理', num: ''},
- {key: 'reject', value: '不受理', num: ''},
- ]
- //保存报修主体
- $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;//隐藏
- }
- })
- // -----------------分割线 end----------------
- var pdKey = $state.current.pdKey;
- $scope.gridOptions = {};
- $scope.gridOptions.data = 'myData';
- $scope.gridOptions.rowHeight = 54;
- $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;
- }
- //表格列表显示
- $scope.gridOptions.columnDefs = [{
- name: 'item',
- displayName: '序号',
- width: 50,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">{{row.entity.item}}</div>' +
- '</div>'
- }, {
- name: 'startDate',
- displayName: '申请时间',
- width: 150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">{{row.entity.startDate | date:"yyyy-MM-dd HH:mm" }}</div>' +
- '</div>'
- }, {
- name: 'description',
- displayName: '故障描述',
- width: '20%',
- cellTemplate: '<div style="width: 100%;">' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.description}}</div>' +
- '</div>'
- },
- {
- name: 'row4',
- displayName: '科室/地址',
- width: '20%',
- cellTemplate: '<div style="width: 100%;">' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.department ? row.entity.department.dept : "无"}}<br><span ng-bind-html="grid.appScope.areaplace(row.entity)"></span></div>' +
- '</div>'
- }, {
- name: 'row5',
- displayName: '联系人/联系电话',
- width: 150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.contacts}}<br>{{row.entity.contactsInformation}}</div>' +
- '</div>'
- },
- {
- name: 'state.name',
- displayName: '状态',
- width: 150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center">{{row.entity.state.name}}</div>' +
- '</div>'
- },
- {
- name: 'reqAttachment',
- displayName: '图片',
- width: 150,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" ng-if="row.entity.reqAttachment" ng-click="grid.appScope.clickImgs(row.entity)"><span class="newicon newicon-a-11111"></span></div>' +
- '</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.searchstate = 'accept';
- $scope.onChange = function (searchstate) {
- $scope.searchstate = searchstate;
- $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.areaplace = function (data) {
- var str = '';
- str += '<strong>' + data.branchName + '</strong>';
- str += (data.place ? (data.place.area ? data.place.area.area : '') : '');
- str += (data.place ? (data.place.place ? data.place.place : '') : '');
- str += (data.houseNumber ? data.houseNumber : '');
- return str || '无';
- }
- $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('user', fieldatas).then(function (data) {
- $scope.requester = data.list;
- });
- }
- $scope.onChangehandling = function (key) {
- var filuser = {
- "idx": 0,
- "sum": 10,
- "user": {
- "name": key,
- selectType: "pinyin_all",
- engineer: undefined,
- }
- }
- getUser(filuser);
- }
- getUser({
- "idx": 0,
- "sum": 10,
- user: {engineer: undefined,}
- });
- //搜索
- $scope.chiceIncident = function (item) {
- if ($scope.fileData.incident.startDate_start) {
- $scope.fileData.incident.startDate_start = moment($scope.fileData.incident.startDate_start).format('YYYY-MM-DD HH:mm:ss');
- }
- if ($scope.fileData.incident.startDate_end) {
- $scope.fileData.incident.startDate_end = moment($scope.fileData.incident.startDate_end).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);
- });
- $scope.selected = {
- items: []
- }
- };
- $scope.memoryfilterData = defaultFilterData = {
- "idx": 0,
- "incident": {
- source:{'value':'im'}
- },
- "sum": mun
- };
- //收集搜索数据
- $scope.fileData = {
- "idx": 0,
- "incident": {
- source:{'value':'im'}
- },
- "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,
- 'description': data.incidentDescription,
- 'source': {
- 'id': 1549
- },
- 'fileUrl': data.fileUrl
- },
- 'requestershow': data.requester,
- 'flow': data.id
- }
- }
- $state.go('app.incident.chart', {
- 'model': JSON.stringify(formdata)
- });
- };
- $scope.lookFunction = function (data) {
- $state.go('app.desk.detail', {
- model: JSON.stringify(data)
- });
- };
- $scope.toHandleFunction = function (data) {
- console.log(data)
- var formdata = {
- 'model': {
- 'incident': {
- 'requester': data.requester,
- 'houseNumber': data.address,
- 'contacts': data.contacts,
- 'contactsInformation': data.contactsInformation,
- 'incidentState': data.incidentState,
- 'description': data.incidentDescription,
- 'source': {
- 'id': 1549
- },
- 'fileUrl': data.fileUrl
- },
- 'requestershow': data.requester,
- 'flow': data.id,
- 'retractReason': data.retractReason
- }
- }
- var modelfile = {
- model: {
- incident: data
- }
- };
- angular.extend(modelfile.model, {
- 'gourl': 'app.incident.chart',
- 'state_model': formdata
- })
- angular.extend(modelfile.model.incident, {
- status: 1
- })
- $state.go('app.desk.form_editor', {
- formKey: 'desk_detail',
- service: 'api_user_data',
- model: JSON.stringify(modelfile)
- });
- };
- $scope.seeIncidentFunction = function (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.clickImgs = function (item) {
- console.log(item)
- $modal.open({
- templateUrl: 'assets/views/showPictrueList.html',
- controller: function ($rootScope, $scope, scope, $modalInstance, api_user_data, SweetAlert) {
- $scope.title = '提示';
- $scope.content = '您申请的报修图片如下,请查看。';
- $scope.repairImgs = [];
- // 获取报修图片
- $scope.getRepairImgs = function() {
- $rootScope.isMask =true;
- api_wechatfile.listAttachment("wechatRequesterIncident", item.id).then(function (res) {
- $rootScope.isMask = false;
- res.data = res.data || [];
- res.data.forEach(v => {
- v.previewUrl = location.origin + "/file" + v.relativeFilePath;
- })
- $scope.repairImgs = res.data;
- });
- }
- //展示图片
- $scope.preview = function (url, idx) {
- var title = $scope.repairImgs[idx].title;
- $modal.open({
- backdrop: false,
- templateUrl: "assets/views/customform/tpl/ui-showimage.html",
- controller: function ($scope, $rootScope, scope, $modalInstance) {
- $scope.title = title;
- $scope.imageurl = $rootScope.attachmentAddressSplicing(url);
- $scope.cancel = function () {
- $modalInstance.dismiss("cancel");
- };
- },
- resolve: {
- scope: function () {
- return $scope;
- },
- },
- });
- };
- $scope.getRepairImgs();
- //选择“取消”或“确定”
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- },
- size: 'sm',
- resolve: {
- scope: function () {
- return $scope;
- }
- }
- });
- }
- //不受理
- $scope.rejectFn = function (model) {
- console.log(model)
- var modalInstance = $modal.open({
- backdrop: false,
- templateUrl: 'assets/views/incident/tpl/reject.tpl.html',
- controller: function ($scope,$rootScope, $modalInstance, api_bpm_domain, modelData, currentUserId, Alert, api_user_data,api_category) {
- console.log(model,loginUser);
- $scope.model = model;
- $scope.postData = {
- rejectRemark: '',
- }
- // 初始化
- $scope.ok = function () {
- if (!$scope.postData.rejectRemark){
- Alert.swal({
- title: "操作失败",
- text: "请填写不受理原因!",
- type: "error"
- });
- return;
- }
- let postData = {incident: {...model, ...{
- rejectRemark: $scope.postData.rejectRemark,
- }}};
- $rootScope.isMask = true;
- api_flow.accept("reject", postData).then(function (response) {
- console.log(response)
- $rootScope.isMask = false;
- if (response.state == 200) {
- Alert.swal({
- title: "操作成功!",
- confirmButtonColor: "#007AFF",
- type: "success"
- });
- $modalInstance.close('success');
- } else {
- Alert.swal({
- title: "操作失败",
- text: "操作失败, 请稍后再试!",
- type: "error"
- });
- }
- });
- }
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- }
- },
- size: 'sm',
- resolve: {
- modelData: function () {
- return model;
- },
- currentUserId: function () {
- return loginUser.id;
- },
- Alert: function () {
- return SweetAlert;
- },
- api_user_data: function () {
- return api_user_data;
- }
- }
- });
- modalInstance.result.then(function (selectedItem) {
- if (selectedItem == 'success') {
- $scope.refreshData('expand-right', defaultFilterData);
- }
- });
- };
- // 生成工单
- $scope.buildFn = function(model){
- $rootScope.newOrder({incident: model});
- }
- //重置
- $scope.cleanItem = function () {
- delete $scope.fileData.incident.contacts;
- delete $scope.fileData.incident.contactsInformation;
- delete $scope.fileData.incident.startDate_start;
- delete $scope.fileData.incident.startDate_end;
- delete $scope.fileData.incident.department;
- $scope.seiminObj = null;
- $scope.ksModel = '';
- $scope.refreshData('expand-right', $scope.fileData);
- }
- var defaultFilterData = {
- "idx": 0,
- "incident": {
- "serviceState": { "id": 1650 }
- },
- "sum": mun
- };
- $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;
- if ($scope.searchstate === 'all') {
- delete filterData.incident.notStatus;
- delete filterData.incident.state;
- } else if ($scope.searchstate === 'accept' || $scope.searchstate === 'reject') {
- delete filterData.incident.notStatus;
- filterData.incident.state = $scope.state.find(v => v.value == $scope.searchstate);
- } else if ($scope.searchstate === 'accepted') {
- delete filterData.incident.state;
- filterData.incident.notStatus = 'accept,reject,cancel';
- }
- //科室列表选中数据,请求参数判断
- if ($scope.repairMain.valueconfig == 2 && $scope.ksModel != '') {//报修科室且不是空字符
- $scope.fileData.incident.department = {
- dept: $scope.ksModel
- }
- }
- //搜索接口
- api_bpm_data.fetchDataList("incident", 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
- }
- $scope.ldloading[style.replace('-', '_')] = false;
- }, function () {
- $scope.ldloading[style.replace('-', '_')] = false;
- });
- };
- $scope.timer = $interval(function () {
- $scope.refreshData('expand-right', $scope.fileData);
- }, $rootScope.refreshTime);
- console.log($state.params);
- if ($state.params.tab) {
- if ($state.params.tab == '-1') {
- $scope.searchstate = 'all';
- $scope.fileData.incident = {};
- } else {
- // $scope.searchstate = $state.params.tab;
- // $scope.fileData.incident.serviceState.id = $scope.searchstate;
- $scope.searchstate = 'accept';
- }
- } else {
- //默认未受理
- $scope.searchstate = 'accept';
- }
- $scope.$on('$destroy', function () {
- $interval.cancel($scope.timer)
- });
- //状态
- $scope.state = [];
- $scope.getIncidentStatus = function(){
- api_wechatfile.getDictionary({
- "type": "list",
- "key": "incident_status"
- }).then(function (response) {
- $scope.state = response || [];
- $scope.refreshData('expand-right', $scope.fileData);
- })
- }
- // 进入页面时
- $scope.getIncidentStatus();
- }]);
- app.controller('Wechatoperator', ['$rootScope', '$http', '$scope', '$modal', 'api_user_data', function ($rootScope, $http, $scope, $modal, api_user_data) {
- var loginUser = $rootScope.user;
- console.log($scope.item)
- $scope.weixinbaozhang_bushouli = false;
- $scope.weixinbaozhang_build = false;
- for (var i = 0; i < loginUser.menu.length; i++) {
- if (loginUser.menu[i].link == "weixinbaozhang_bushouli") {
- $scope.weixinbaozhang_bushouli = true
- }
- if (loginUser.menu[i].link == "weixinbaozhang_build") {
- $scope.weixinbaozhang_build = true
- }
- }
- $scope.edit = function () {
- $scope.colobject.grid.appScope.selectRowFunction($scope.item);
- }
- //查看,查看详情
- $scope.look = function () {
- $scope.colobject.grid.appScope.lookFunction($scope.item);
- }
- //处理
- $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);
- }
- // 不受理
- $scope.rejectFn = function () {
- $scope.colobject.grid.appScope.rejectFn($scope.item);
- }
- // 生成工单
- $scope.buildFn = function () {
- $scope.colobject.grid.appScope.buildFn($scope.item);
- }
- //是否锁定,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="rejectFn()" ng-show="{{item.state.value == \'accept\' && weixinbaozhang_bushouli}}" class="bianjifont">不受理</a>' +
- '<a ng-click="buildFn()" ng-show="{{item.state.value == \'accept\' && weixinbaozhang_build}}" 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="seeIncident()" ng-show="{{toHandle}}" class="bianjifont">查看事件</a>' +
- '</div>'
- };
- });
- // app.factory('myFactory', function() {
- // //定义factory返回对象
- // var myServices = {};
- // //定义参数对象
- // var myObject = {};
- // var _set = function(data) {
- // myObject = data;
- // };
- // })
|