123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- import BaseWidget = require('core/BaseWidget.class');
- import AjaxSend = require("common/AjaxSend.class");
- import MapSet = require("common/MapSet.class");
- import VerificationHelper = require("common/VerificationHelper.class");
- import GraphicsLayer = require("esri/layers/GraphicsLayer");
- import Graphic = require("esri/graphic");
- import Point = require("esri/geometry/Point");
- import Polyline = require('esri/geometry/Polyline');
- import { data } from 'jquery';
- enum operation {
- create, destroy, clear
- }
- export = HiddenTroubleTransAudit;
- class HiddenTroubleTransAudit extends BaseWidget {
- baseClass = "widget-HiddenTroubleTransAudit";
- preLayerId = 'HalfPanel' + this.baseClass;
- clusters = this.preLayerId + 'Clusters';
- popClass = this.baseClass + 'PopClass';
- map = null;
- toast = null;
- popup = null;
- loadWait = null;
- ajaxSend = null;
- fristSearch = true;
- dataTable = null;
- searchInfo = null;
- verificationHelper = null;
- selectTableGraphic = null;
- selectTablePoint = null;
- selectTableLine = null;
- mapSet = null;
-
- startup() {
- this.configure();
- this.initHtml();
- this.initEvent();
- this.getInfoList();
- this.getAllInfo();
- this.getGroup();
- }
-
- initHtml() {
- var html = _.template(this.template.split('$$')[0] + "</div>")();
- this.setHtml(html);
- this.ready();
- }
- configure() {
- this.toast = this.AppX.runtimeConfig.toast;
- this.popup = this.AppX.runtimeConfig.popup;
- this.map = this.AppX.runtimeConfig.map;
- this.ajaxSend = new AjaxSend();
- this.loadWait = this.AppX.runtimeConfig.loadWait;
- this.verificationHelper = new VerificationHelper();
- this.mapSet = new MapSet();
-
- this.selectTablePoint = this.mapSet.setGraphSymbol("point");
- this.selectTableLine = this.mapSet.setGraphSymbol("polyline");
- }
-
- initSelectTableGraphic(action) {
- if (action == operation.destroy && this.selectTableGraphic) {
- this.map.removeLayer(this.selectTableGraphic);
- this.selectTableGraphic = null;
- }
- if (action == operation.create && !this.selectTableGraphic) {
- this.selectTableGraphic = new GraphicsLayer();
- this.selectTableGraphic.id = this.preLayerId + "selectTableGraphic";
- this.map.addLayer(this.selectTableGraphic);
- }
- if (action == operation.clear && this.selectTableGraphic) {
- this.selectTableGraphic.clear();
- }
- }
-
- initEvent() {
- this.initSelectTableGraphic(operation.create);
- this.domObj.find(".btn_search").off().click(e => {
- this.getInfoList();
- });
-
- this.domObj.find('.department').on("change", function () {
- this.getUser( this.domObj.find(".department").val());
- }.bind(this));
- }
-
- initPage(dataInfo) {
- this.popup.setSize(1000, 730);
- var Obj = this.popup.Show("隐患转派", this.template.split('$$')[1]);
- let getHtml = this.AppX.runtimeConfig.hiddenPageInfo;
- let dataState=[];
- dataState.push(getHtml.state.hiddenReport);
- if(dataInfo.isDiscretionId != '1'){
- dataState.push(getHtml.state.dispatchAudit);
- }
- dataState.push(getHtml.state.transfer)
- getHtml.getLinkHtml(this, Obj.conObj.find('.widget-HiddenTroubleTransAudit-pop'), dataState, getHtml.state.transfer, dataInfo);
- getHtml.setDepartmentAndUser(this, Obj.conObj.find('.transDepartment'), Obj.conObj.find('.transferHandleUser'));
- Obj.submitObj.off("click").on("click", function () {
- let data = this.getWriteInfo(Obj.conObj);
- let sendData= new FormData();
- sendData.append("isTransfer",'1');
- sendData.append("id",this.dataTable.aExtentData.currentTableData.id);
- sendData.append("troubleTransfer.transferHandleUser",data.transferHandleUser);
- sendData.append("troubleTransfer.transferReason",data.transferReason);
- sendData.append("troubleTransfer.troubleId",this.dataTable.aExtentData.currentTableData.id);
- this.ajaxSend.sendFileAjax(this, sendData, this.config.backTrouble, this.ajaxSend.type.post, this.HiddenReport.bind(this));
- }.bind(this))
-
- }
-
- HiddenReport(results) {
- if (this.ajaxSend.checkResults(this, results)) {
- this.popup.close();
- this.toast.show("处理成功");
- this.getInfoList();
- }
- }
-
- getWriteInfo(obj) {
- let data = new Object();
-
- let dataDom = obj.find('.form-group.form-inline input:not([readonly])')
- for (var i = 0; i < dataDom.length; i++) {
- if (dataDom[i].type != 'file') {
- Object.defineProperty(data, dataDom[i].name, {
- configurable: true,
- writable: true,
- enumerable: true,
- value: dataDom[i].value
- })
- } else {
- Object.defineProperty(data, dataDom[i].name, {
- configurable: true,
- writable: true,
- enumerable: true,
- value: dataDom[i].dataInfomation
- });
- }
- };
-
- dataDom = obj.find('.form-group.form-inline textarea:not([readonly])')
- for (var i = 0; i < dataDom.length; i++) {
- Object.defineProperty(data, dataDom[i].name, {
- configurable: true,
- writable: true,
- enumerable: true,
- value: dataDom[i].value
- })
- };
- dataDom = obj.find('.form-group.form-inline select')
- for (var i = 0; i < dataDom.length; i++) {
- let optionDom = $(dataDom[i]).find("option:selected");
- let value = [];
- for (var i2 = 0; i2 < optionDom.length; i2++) {
- value.push(optionDom[i2]['value'])
- };
- Object.defineProperty(data, dataDom[i].name, {
- configurable: true,
- writable: true,
- enumerable: true,
- value: value.join(',')
- })
- };
- return data;
- }
-
- getAllInfo() {
- let data = {
- current: 1,
- size: 10000,
-
- processId: '2',
- }
- this.ajaxSend.sendAjax(this, data, this.config.troubleInfo, this.ajaxSend.type.get, function (results) {
- if (this.ajaxSend.checkResults(this, results)) {
- this.allList = results.result.records;
- this.renderPoint(this.allList);
- }
- }.bind(this));
- }
-
- renderPoint(data) {
- this.AppX.runtimeConfig.hiddenPageInfo.addClusters(data, this.clusters, this.popClass, '审核');
- $('.body').off('click', '.' + this.popClass + " .hiddenPageInfoPopInfoLook").on('click', '.' + this.popClass + " .hiddenPageInfoPopInfoLook", function (e) {
- let index = parseInt($(e.currentTarget).attr('index'));
- this.AppX.runtimeConfig.hiddenPageInfo.getInfoByid(data[index].id, this.initPage.bind(this))
- }.bind(this));
- }
-
- getSearchInfo() {
- this.searchInfo = {
-
- processId: '2',
- troubleName: this.domObj.find(".troubleTypeName").val(),
- address: this.domObj.find(".address").val(),
- userId: this.domObj.find(".users").val(),
- findUserDeptId: this.domObj.find(".department").val(),
- "orders[0].asc":false,
- "orders[0].column":"report_time"
- }
- }
-
- showTrouble() {
- this.initSelectTableGraphic(operation.clear);
- let data = this.dataTable.aExtentData.currentTableData;
- if (data) {
- if (data.pipeInfos) {
- for (var item of data.pipeInfos) {
- let graphic = new Graphic(new Polyline(JSON.parse(item.geometry)), this.selectTableLine);
- this.selectTableGraphic.add(graphic);
- }
- }
- if (data.deviceInfos) {
- for (var item of data.deviceInfos) {
- let graphic = new Graphic(new Point(JSON.parse(item.geometry)), this.selectTablePoint);
- this.selectTableGraphic.add(graphic);
- }
- }
- }
- }
-
- getInfoList() {
- this.loadWait.show("正在查询数据,请耐心等待...", this.domObj);
- let that = this;
- this.getSearchInfo();
- this.initSelectTableGraphic(operation.clear);
- if (that.dataTable) {
- that.dataTable.ajax.reload();
- return;
- };
- let option = {
- that: this,
- dataTable: that.dataTable,
- elementId: "HiddenTroubleTransAuditinfodata",
- url: that.config.troubleInfo,
- isCheck: false,
- searchInfo: that.searchInfo,
-
- displayTitle: ["隐患名称", "所属单位", "隐患地址", "上报人", "详情"],
- displayField: ["troubleName", "unitName", "address", "findUserName", "troubleInfo"],
- extentDisplayTitle: ['转派'],
-
- extentDisplayContent: [{
- field: "infoWrite",
- fieldContent: "<a class='infoWrite opreationName'>转派</a>"
- }],
- beforeTrClickEvent: undefined,
- afterTrClickEvent: function () {
- this.domObj.off('click', '#HiddenTroubleTransAuditinfodata tr').on('click', "#HiddenTroubleTransAuditinfodata tr", e => {
- this.showTrouble();
- this.AppX.runtimeConfig.hiddenPageInfo.goPoint(this.dataTable.aExtentData.currentTableData);
- })
- }.bind(this),
- drawEvent: function () {
- this.domObj.off('click', '.infoWrite').on('click', ".infoWrite", e => {
- this.AppX.runtimeConfig.hiddenPageInfo.getInfoByid(this.dataTable.aExtentData.currentTableData.id, this.initPage.bind(this))
- });
- this.loadWait.hide();
- }.bind(this),
- serachCallBack: function (results) {
- if (this.fristSearch) {
- this.fristSearch = false
- } else {
- if (results.result.records) {
- this.renderPoint(results.result.records);
- }
- }
- }.bind(this),
- errmassage: "隐患信息查询失败",
- nullmessage: undefined,
- exportTitle: "隐患信息"
- }
- that.dataTable = this.ajaxSend.DataTables_check(option);
- }
-
- getGroup() {
- let data = {
-
- current: 1,
- size: 10000
- }
- this.ajaxSend.sendAjax(this, data, this.config.getGroupList, this.ajaxSend.type.get, this.getGroupListCallback.bind(this,));
- }
- getGroupListCallback(results) {
- if (results.code != 1) {
- this.toast.Show(results.message);
- return;
- }
- let strdepartment = ("<option selected='selected' value=''>全部</option>");
- $.each(results.result.records, function (index, item) {
- strdepartment += "<option value='" + item.id + "'>" + item.name + "</option>";
- }.bind(this));
- this.domObj.find(".department").empty().append(strdepartment);
-
- }
-
- getUser(companyid) {
- if(!companyid){
- this.domObj.find(".users").empty();
- return
- }
- let data = {
- "current": 1,
- "size": 1000,
- "departmentId": companyid
- }
- this.ajaxSend.sendAjax(this, data, this.config.getUserList, this.ajaxSend.type.get, function (results) {
- var that = this;
- if (results.code != 1) {
- that.toast.Show(results.message);
- return;
- }
- let strusers = "<option selected value=''>全部</option>";
- if (results.result.records.length == 0) {
- strusers = "<option selected value=''>暂无巡检人员</option>"
- } else {
- $.each(results.result.records, function (index, item) {
- strusers += "<option value='" + item.id + "'>" + item.realName + "</option>";
- }.bind(this));
- }
- this.domObj.find(".users").empty().append(strusers);
- }.bind(this));
- }
-
- destroy() {
- this.AppX.runtimeConfig.hiddenPageInfo.clearClusters(this.clusters);
- this.initSelectTableGraphic(operation.destroy);
- this.domObj.remove();
- this.afterDestroy();
- }
- }
|