|
@@ -0,0 +1,745 @@
|
|
|
+import BaseWidget = require('core/BaseWidget.class');
|
|
|
+import VerificationHelper = require("common/VerificationHelper.class");
|
|
|
+import dataRerecords = require('./dataRerecords');
|
|
|
+
|
|
|
+
|
|
|
+ * PBS工程结构树全景展示
|
|
|
+ */
|
|
|
+class DataRerecords extends BaseWidget {
|
|
|
+ baseClass = "widget-DataRerecords";
|
|
|
+ widgetClass = ".widget-DataRerecords "
|
|
|
+ ztree: any;
|
|
|
+ opeartionItme = [];
|
|
|
+ retable: any;
|
|
|
+ reset = "";
|
|
|
+ currentTarget = null;
|
|
|
+ localWindow = null;
|
|
|
+ treeDatas = [];
|
|
|
+ pbsSearchInputID = "pbsSearchInput";
|
|
|
+ searchBtnID = "searchBtn";
|
|
|
+ searchTypeSelID = "searchTypeSel";
|
|
|
+ photoLayoutID = "photoLayout";
|
|
|
+ picPaginatorID = "picPaginator";
|
|
|
+ verificationHelper = new VerificationHelper();
|
|
|
+ _viewer = undefined;
|
|
|
+ _searchData = {
|
|
|
+ "orders[0].asc": false,
|
|
|
+ "orders[0].column": "create_time",
|
|
|
+ userName: "",
|
|
|
+ photoType: '',
|
|
|
+ code: "",
|
|
|
+ departmentId: "",
|
|
|
+ beginDate: "",
|
|
|
+ endDate: "",
|
|
|
+ size: 15,
|
|
|
+ current: 1
|
|
|
+ }
|
|
|
+ treeNodes = [];
|
|
|
+ ztreetemp: any;
|
|
|
+ tempCode = "";
|
|
|
+ setting = null;
|
|
|
+ dateRange = {
|
|
|
+ startDate: "",
|
|
|
+ endDate: ""
|
|
|
+ };
|
|
|
+ _apiUrls = {
|
|
|
+ getUnitPid: "/tofly-sxgk/structure/getPidByPbsNew",
|
|
|
+ pipeScanRecord: "/tofly-sxgk/newpspipe/page",
|
|
|
+ pointScanRecord: "/tofly-sxgk/newpsnode/page",
|
|
|
+ downLoad: "/base/file/loadImg",
|
|
|
+ pipeAndNodePic: "/tofly-sxgk/newPipeAndNodeScan/getPictureList",
|
|
|
+
|
|
|
+ departMentInfo: "/base/department/pageFilterPrj",
|
|
|
+ getUnitNew: "/tofly-sxgk/contract/getContructDepartment",
|
|
|
+
|
|
|
+ getPbsTreeApi: "/tofly-sxgk/structure/list",
|
|
|
+ sjfw: "",
|
|
|
+ pointDesign: "/tofly-sxgk/psnode/getNodeInfo",
|
|
|
+ pipeDesign: "/tofly-sxgk/pspipe/getPipeInfo",
|
|
|
+
|
|
|
+ }
|
|
|
+ dataRerecordsHandler = null
|
|
|
+
|
|
|
+ * 启动
|
|
|
+ */
|
|
|
+ startup() {
|
|
|
+ this.initHtml();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 页面初始化
|
|
|
+ */
|
|
|
+ initHtml() {
|
|
|
+ this.setHtml(this.template);
|
|
|
+ this.domEvent();
|
|
|
+ this.loadPbsTree();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 获取pbs结构树
|
|
|
+ */
|
|
|
+ loadPbsTree() {
|
|
|
+ var url = this.config.getPbsTreeApi;
|
|
|
+ this.sendAjax({}, url, "GET", this.getPbsTreeCallback.bind(this), 0);
|
|
|
+ }
|
|
|
+ domEvent() {
|
|
|
+ this.domObj.find("#queryBtn").off('click').on('click', (e) => {
|
|
|
+ const scanUser = this.domObj.find("#userNameInp").val() ? this.domObj.find("#userNameInp").val().toString() : "";
|
|
|
+ const departmentID = this.domObj.find("#departMentSel").val() ? this.domObj.find("#departMentSel").val().toString() : "";
|
|
|
+
|
|
|
+ this._searchData.departmentId = departmentID;
|
|
|
+ this._searchData.userName = scanUser;
|
|
|
+ this._searchData.beginDate = this.dateRange.startDate;
|
|
|
+ this._searchData.endDate = this.dateRange.endDate;
|
|
|
+ this._searchData.current = 1;
|
|
|
+
|
|
|
+ this.showScanPhotos(true);
|
|
|
+ })
|
|
|
+ this.domObj.find("#picresetBtn").off('click').on('click', (e) => {
|
|
|
+ this.domObj.find("#departMentSel").val(null);
|
|
|
+ this.domObj.find("#departMentSel").trigger('change');
|
|
|
+ this.domObj.find("#userNameInp").val('');
|
|
|
+ this.domObj.find("#photoType").val('');
|
|
|
+ this.initDatePicker();
|
|
|
+ })
|
|
|
+
|
|
|
+ this.dataRerecordsHandler = new dataRerecords(this);
|
|
|
+ this.domObj.find("#dataRerecords").off('click').on('click', (e) => {
|
|
|
+ this._apiUrls.sjfw = this.AppX.appConfig.gisResource.tiplayers.config["sjfw"].url
|
|
|
+ this.dataRerecordsHandler.showModuleContent(this._searchData.code)
|
|
|
+ })
|
|
|
+ this.domObj.find("#photoType").off('change').on('change', (e) => {
|
|
|
+ const photoType = this.domObj.find("#photoType").val().toString();
|
|
|
+
|
|
|
+ this._searchData.photoType = photoType;
|
|
|
+ this._searchData.current = 1;
|
|
|
+ this.showScanPhotos(true);
|
|
|
+ })
|
|
|
+ this.initDatePicker()
|
|
|
+ this.departMentInit();
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ initDatePicker() {
|
|
|
+
|
|
|
+ this.dateRange.startDate = "";
|
|
|
+ this.dateRange.endDate = "";
|
|
|
+ this.domObj.find('#scanDate').val('');
|
|
|
+ this.domObj.find('#scanDate').daterangepicker({
|
|
|
+ ranges: {
|
|
|
+ '今天': [moment(), moment()],
|
|
|
+ '近7天': [moment().subtract(6, 'days'), moment()],
|
|
|
+ '本月': [moment().startOf('month'), moment().endOf('month')],
|
|
|
+ '今年': [moment().startOf('year'), moment().endOf('year')]
|
|
|
+ },
|
|
|
+ opens: "left",
|
|
|
+ startDate: moment().hours(0).minutes(0).seconds(0),
|
|
|
+ endDate: moment(new Date()),
|
|
|
+ maxDate: moment(new Date()),
|
|
|
+ autoUpdateInput: false,
|
|
|
+ showWeekNumbers: true,
|
|
|
+ locale: {
|
|
|
+ format: "YYYY-MM-DD",
|
|
|
+ applyLabel: '确定',
|
|
|
+ cancelLabel: '取消',
|
|
|
+ customRangeLabel: '自定义',
|
|
|
+ daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
|
|
|
+ monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
|
|
|
+ '七月', '八月', '九月', '十月', '十一月', '十二月'
|
|
|
+ ],
|
|
|
+ firstDay: 1
|
|
|
+ }
|
|
|
+ },
|
|
|
+ function (start, end) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }.bind(this)
|
|
|
+ ).on('apply.daterangepicker', function (ev, picker) {
|
|
|
+ this.domObj.find('#scanDate').val(picker.startDate.format('YYYY/MM/DD') + ' - ' + picker.endDate.format('YYYY/MM/DD'));
|
|
|
+ this.dateRange.startDate = picker.startDate.format('YYYY-MM-DD');
|
|
|
+ this.dateRange.endDate = picker.endDate.format('YYYY-MM-DD');
|
|
|
+ }.bind(this));
|
|
|
+ }
|
|
|
+
|
|
|
+ * 该方法用于单位信息初始化
|
|
|
+ */
|
|
|
+ departMentInit() {
|
|
|
+ const that = this;
|
|
|
+
|
|
|
+ var data = {
|
|
|
+ current: 1,
|
|
|
+ size: 10,
|
|
|
+ }
|
|
|
+ var url = this.apiRoot + this._apiUrls.getUnitNew;
|
|
|
+
|
|
|
+ this.domObj.find("#departMentSel").select2({
|
|
|
+ language: "zh-CN",
|
|
|
+ width: "220px",
|
|
|
+ ajax: {
|
|
|
+ headers: that.header,
|
|
|
+ delay: 250,
|
|
|
+ url: url,
|
|
|
+
|
|
|
+ type: "GET",
|
|
|
+ contentType: "application/json;charset=utf-8",
|
|
|
+ data: (params) => {
|
|
|
+ var query = {
|
|
|
+
|
|
|
+
|
|
|
+ name: params.term,
|
|
|
+ prjId: that.AppX.appConfig.currentPrj
|
|
|
+ }
|
|
|
+ return query;
|
|
|
+ },
|
|
|
+ processResults: (data) => {
|
|
|
+ let nodes = [];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ nodes = data.result.map(item => {
|
|
|
+ return { id: item.id, text: item.name };
|
|
|
+ })
|
|
|
+ return {
|
|
|
+ results: nodes,
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ * pbs结构树信息集合
|
|
|
+ * @param results pbs结构树集合
|
|
|
+ */
|
|
|
+ getPbsTreeCallback(results) {
|
|
|
+ let dep = 0;
|
|
|
+ let curPid = [];
|
|
|
+ function arr2tree(data, parent) {
|
|
|
+ let tree = [];
|
|
|
+ let temp = [];
|
|
|
+ const usedParent = _.find(curPid, function (item) { return item.pid === parent })
|
|
|
+ if (!usedParent) {
|
|
|
+ dep += 1;
|
|
|
+ curPid.push({ pid: parent, dep: dep });
|
|
|
+ }
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
+ if (data[i].pid == parent) {
|
|
|
+ let obj = data[i];
|
|
|
+ obj.originname = obj.name;
|
|
|
+ obj.name = `${obj.name}_${obj.code}`;
|
|
|
+ obj.prjId = obj.prjid;
|
|
|
+ obj.prjName = obj.prjname;
|
|
|
+ const curparent = _.find(curPid, function (item) { return item.pid === parent });
|
|
|
+ let open = true;
|
|
|
+ if (curparent) {
|
|
|
+ dep = curparent.dep;
|
|
|
+ if (curparent.dep >= 2) open = false;
|
|
|
+ }
|
|
|
+ if (obj.levelname !== "部件类型") {
|
|
|
+ temp = arr2tree(data, data[i].id);
|
|
|
+ }
|
|
|
+ if (temp.length > 0) {
|
|
|
+ obj.children = temp;
|
|
|
+ obj.open = open;
|
|
|
+ } else {
|
|
|
+ obj.children = [];
|
|
|
+ }
|
|
|
+ tree.push(obj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return tree;
|
|
|
+ }
|
|
|
+ let zNodes = arr2tree(results.result[0].structures, null);
|
|
|
+
|
|
|
+ this.initZtree(zNodes);
|
|
|
+ this.treeNodes = zNodes;
|
|
|
+ this.initTempTree(zNodes);
|
|
|
+ this.loadMask.hide();
|
|
|
+ }
|
|
|
+ initTempTree(zNodes) {
|
|
|
+ if (this.ztree) {
|
|
|
+ this.ztree.destroy("pbsTreeDivId");
|
|
|
+ this.ztree = null;
|
|
|
+ }
|
|
|
+ var that = this;
|
|
|
+ var setting = {
|
|
|
+ async: {
|
|
|
+ enable: true
|
|
|
+ },
|
|
|
+ check: {
|
|
|
+ enable: false
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ simpleData: {
|
|
|
+ enable: true,
|
|
|
+ idKey: "id",
|
|
|
+ pIdKey: "pid",
|
|
|
+ rootPId: null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ view: {
|
|
|
+ showLine: true,
|
|
|
+ showIcon: false
|
|
|
+ }
|
|
|
+ };
|
|
|
+ this.ztreetemp = $.fn.zTree.init($("#pbstempTree"), setting, zNodes);
|
|
|
+ }
|
|
|
+
|
|
|
+ * 构建 ztree
|
|
|
+ * @param datas
|
|
|
+ */
|
|
|
+ initZtree(zNodes) {
|
|
|
+ if (this.ztree) {
|
|
|
+ this.ztree.destroy("pbsTreeDivId");
|
|
|
+ this.ztree = null;
|
|
|
+ }
|
|
|
+ var that = this;
|
|
|
+ var setting = {
|
|
|
+ async: {
|
|
|
+ enable: true
|
|
|
+ },
|
|
|
+ check: {
|
|
|
+ enable: false
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ simpleData: {
|
|
|
+ enable: true,
|
|
|
+ idKey: "id",
|
|
|
+ pIdKey: "pid",
|
|
|
+ rootPId: null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ view: {
|
|
|
+ showLine: true,
|
|
|
+ showIcon: false,
|
|
|
+ fontCss: (treeId, treeNode) => {
|
|
|
+ if (treeNode.pressureType === "1") {
|
|
|
+ return { color: "#000000" };
|
|
|
+ } else if (treeNode.pressureType === "2") {
|
|
|
+ return { color: "#0076FF" };
|
|
|
+ } else if (treeNode.pressureType === "3") {
|
|
|
+ return { color: "#009100" };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ callback: {
|
|
|
+ onClick: function (event, treeId, treeNode) {
|
|
|
+
|
|
|
+ that._searchData.code = treeNode.code;
|
|
|
+ that.showScanPhotos(true);
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ onExpand: (event, treeId, treeNode) => {
|
|
|
+ const tree = $.fn.zTree.getZTreeObj("pbsTreeDivId")
|
|
|
+ if (treeNode.levelname == "部件类型") {
|
|
|
+ this.sendAjax({ id: treeNode.id }, this.config.getPbsBjApi, "GET", res => {
|
|
|
+ res.result.forEach(item => {
|
|
|
+ item.value = item.code,
|
|
|
+ item.pipeId = item.pipeId,
|
|
|
+ item.layerName = item.layerName
|
|
|
+ item.name = `${item.code}(${item.pipeId})`
|
|
|
+ tree.addNodes(treeNode, item);
|
|
|
+ });
|
|
|
+ }, 1, true)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onRightClick: (event, treeId, treeNode) => {
|
|
|
+ const exsitBtn = $(".exportQRcodeBtn");
|
|
|
+ if (treeNode !== null && treeNode.levelname === "部件类型") {
|
|
|
+ if (exsitBtn.length !== 0) {
|
|
|
+ exsitBtn.remove();
|
|
|
+ }
|
|
|
+ const url = "/tofly-sxgk/structure/createPdfByType";
|
|
|
+ const downloadUrl = "/tofly-sxgk/commonFile/download";
|
|
|
+ const data = { stdId: treeNode.id };
|
|
|
+ const btn = `<button class="btn btn-info exportQRcodeBtn">导出二维码</button>`;
|
|
|
+ const target = event.target;
|
|
|
+ $(target).append(btn);
|
|
|
+ $(target).css("position", "relative");
|
|
|
+ const scanBtn = $(".exportQRcodeBtn");
|
|
|
+ scanBtn.css({ "top": event.offsetY, "left": event.offsetX });
|
|
|
+ scanBtn.on("click", (e) => {
|
|
|
+ e.stopPropagation();
|
|
|
+ this.sendAjax(data, url, "GET", res => {
|
|
|
+ scanBtn.remove();
|
|
|
+ if (res.code === -1) {
|
|
|
+ this.toast.show(res.message);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const pdf = this.apiRoot + downloadUrl + "?fileName=" + res.result + "&access_token=" + this.userToken;
|
|
|
+ window.open(pdf);
|
|
|
+ }, 1);
|
|
|
+ });
|
|
|
+ this.domObj.on("click", () => {
|
|
|
+ const exsitBtn = $(".exportQRcodeBtn");
|
|
|
+ exsitBtn.remove();
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ this.setting = setting;
|
|
|
+ $(document).ready(function () {
|
|
|
+ this.ztree = $.fn.zTree.init($("#pbsTreeDivId"), setting, zNodes);
|
|
|
+
|
|
|
+
|
|
|
+ var node = this.ztree.getNodes()[0];
|
|
|
+
|
|
|
+ this.ztree.selectNode(node);
|
|
|
+ setting.callback.onClick(null, this.ztree.setting.treeId, node);
|
|
|
+ this.initTreeCheck("puchatree");
|
|
|
+ this.initTreeCheck("shigongtree");
|
|
|
+ this.initTreeCheck("shejitree");
|
|
|
+ this.initTreeCheck("chengguotree");
|
|
|
+ }.bind(this));
|
|
|
+
|
|
|
+
|
|
|
+ this.domObj.find("#pbsTreeDivId").on("click", "a", function (e) {
|
|
|
+ if (this.domObj.find("#pbsTreeDivId a").find(".active").length > 1) {
|
|
|
+ this.domObj.find("#pbsTreeDivId a").find(".active").removeClass("active")
|
|
|
+ }
|
|
|
+ $(e.currentTarget).find(".diy").addClass("active");
|
|
|
+ that.currentTarget = $(that.domObj.find("#pbsTreeDivId .diy.active")[1]).find(".btn_files").attr("value");
|
|
|
+
|
|
|
+ }.bind(this));
|
|
|
+ this.domObj.find("#" + this.searchTypeSelID).off('change').on('change', function () {
|
|
|
+ this.domObj.find("#" + this.pbsSearchInputID).val('');
|
|
|
+ }.bind(this))
|
|
|
+ this.domObj.find("#resetBtn").off("click").on("click", () => {
|
|
|
+ this.tempCode = "";
|
|
|
+ this.domObj.find("#pbsSearchInput").val("");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $.fn.zTree.init($("#pbsTreeDivId"), this.setting, this.treeNodes);
|
|
|
+ });
|
|
|
+ this.domObj.find('#' + this.searchBtnID).off('click').on('click', function () {
|
|
|
+ this.searchOperation();
|
|
|
+ }.bind(this))
|
|
|
+ this.domObj.find("#" + this.pbsSearchInputID).keyup(function (e) {
|
|
|
+ if (e.keyCode === 13) {
|
|
|
+ this.searchOperation();
|
|
|
+ }
|
|
|
+ }.bind(this));
|
|
|
+ }
|
|
|
+
|
|
|
+ * 该方法用于初始化分页
|
|
|
+ */
|
|
|
+ initPaginator(pages) {
|
|
|
+ const that = this;
|
|
|
+ $('#' + this.picPaginatorID).pagination({
|
|
|
+ pages: pages,
|
|
|
+ edges: 2,
|
|
|
+ cssStyle: 'pagination',
|
|
|
+ displayedPages: 5,
|
|
|
+ onPageClick: function (pageNumber, event) {
|
|
|
+ that._searchData.current = pageNumber;
|
|
|
+ that.showScanPhotos();
|
|
|
+ },
|
|
|
+ onInit: function (getid) {
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ * 该方法用于根据部件ID查询照片
|
|
|
+ * @param treeNode 树节点
|
|
|
+ */
|
|
|
+ showScanPhotos(clickEvt: boolean = false) {
|
|
|
+
|
|
|
+
|
|
|
+ const url = this._apiUrls.pipeAndNodePic;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (!this._searchData.code) {
|
|
|
+ this.toast.show("请选择工程");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const options = this._searchData;
|
|
|
+ const that = this;
|
|
|
+ const panelHeight = this.domObj.find('.picListPanel').height();
|
|
|
+ options.size = Math.ceil(panelHeight / 244) * 5;
|
|
|
+ this.baseAjaxSend.sendAjax(that, options, url, 'GET', function (data) {
|
|
|
+ if (data.code !== 1 || !data.result) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const records = data.result.records;
|
|
|
+
|
|
|
+ let tableHtml = "";
|
|
|
+
|
|
|
+ let pictureHtml = "";
|
|
|
+ if (records && records.length) {
|
|
|
+ let index = 0;
|
|
|
+ records.forEach((item, index) => {
|
|
|
+
|
|
|
+ index++;
|
|
|
+ let gxStr = "";
|
|
|
+ gxStr = item.pdName;
|
|
|
+ let user = this.verificationHelper.setNullAndUndefined(item.realName) + "(" + (item.dataType === "CON" ? "施工" : "监理") + ")";
|
|
|
+ let gx = this.verificationHelper.setNullAndUndefined(gxStr);
|
|
|
+ const pipeName = item.typeName + "(" + item.partCode + ")";
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let time = "/";
|
|
|
+ if (item.createTime) {
|
|
|
+ time = this.verificationHelper.setNullAndUndefined(item.createTime);
|
|
|
+
|
|
|
+ }
|
|
|
+ const nodeINDEX = (item.filePath as string).lastIndexOf('/');
|
|
|
+ const newFilePath = item.filePath.slice(0, nodeINDEX) + "/thumbnail-" + item.filePath.slice(nodeINDEX + 1);
|
|
|
+ const picurlOrigin = that.apiRoot + that._apiUrls.downLoad + "?remotePath=" + item.filePath + "&access_token=" + that.userToken;
|
|
|
+ let picurl = that.apiRoot + that._apiUrls.downLoad + "?remotePath=" + newFilePath + "&access_token=" + that.userToken;
|
|
|
+
|
|
|
+ pictureHtml += ("<li class='picItem'><img class='imgItem' data-original=" + picurlOrigin + " src='" + picurl + "' />"
|
|
|
+ + "<div class='pipeDiv'>" + pipeName + "</div>"
|
|
|
+ + "<div class='timeDiv'>" + time + "</div>"
|
|
|
+ + "<div class='divItem'>"
|
|
|
+ + "<span class='picUser'>" + user + "</span>"
|
|
|
+ + "<span class='picgx'>" + gx + "</span>"
|
|
|
+ + "</div></li>")
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+ this.domObj.find('#' + this.photoLayoutID).viewer('destroy');
|
|
|
+ this.domObj.find('#' + this.photoLayoutID).empty().append(pictureHtml);
|
|
|
+
|
|
|
+
|
|
|
+ this._viewer = this.domObj.find('#' + this.photoLayoutID).viewer({
|
|
|
+ navbar: true,
|
|
|
+ url: "data-original"
|
|
|
+ });
|
|
|
+ if (clickEvt) {
|
|
|
+ that.initPaginator(data.result.pages);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.domObj.find('#' + this.photoLayoutID).viewer('destroy');
|
|
|
+ this.domObj.find('#' + this.photoLayoutID).empty().append("");
|
|
|
+ that.clearPictureOptions();
|
|
|
+ that.toast.show('无扫码记录');
|
|
|
+ };
|
|
|
+
|
|
|
+ }, function (err) {
|
|
|
+ console.log(err);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ clearPictureOptions() {
|
|
|
+ $('#' + this.picPaginatorID).pagination('destroy');
|
|
|
+ $("#departMentSel").val('');
|
|
|
+ $("#userNameInp").val('');
|
|
|
+ $("#photoType").val('');
|
|
|
+ }
|
|
|
+ searchOperation() {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const code = this.domObj.find("#" + this.pbsSearchInputID).val().toString().trim();
|
|
|
+ if (code.trim() === "") return;
|
|
|
+
|
|
|
+ if (this.baseAjaxSend.isXSS(code)) {
|
|
|
+ this.toast.show('非法输入');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const searchType = this.domObj.find("#" + this.searchTypeSelID).val().toString();
|
|
|
+
|
|
|
+ if (code !== "" && this.tempCode === code) return
|
|
|
+ this.tempCode = code;
|
|
|
+ switch (searchType) {
|
|
|
+ case "0":
|
|
|
+ this.searchDynamic(code);
|
|
|
+ break;
|
|
|
+ case "1":
|
|
|
+ this.searchDynamic(code);
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ this.searchStatic("originname", code, true);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ initTreeCheck(id) {
|
|
|
+ var setting = {
|
|
|
+ async: {
|
|
|
+ enable: true
|
|
|
+ },
|
|
|
+ check: {
|
|
|
+ enable: true
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ simpleData: {
|
|
|
+ enable: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ view: {
|
|
|
+ showLine: true,
|
|
|
+ showIcon: false
|
|
|
+ },
|
|
|
+ callback: {
|
|
|
+ onClick: function (event, treeId, treeNode) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $.fn.zTree.init($("#" + id), setting, this.config.nodedatas);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ * 该方法用后台接口搜索部件
|
|
|
+ * @param value pbs编码或部件标识码
|
|
|
+ */
|
|
|
+ searchDynamic(value: string) {
|
|
|
+ if (!value) return;
|
|
|
+ const that = this;
|
|
|
+ const ztreeObj = this.ztree;
|
|
|
+ const url = this._apiUrls.getUnitPid;
|
|
|
+ const size = 50;
|
|
|
+ this.sendAjax({ pbs: value, pageSize: size }, url, 'GET', function (result) {
|
|
|
+ if (result.code === 1 && result.result) {
|
|
|
+ if (result.result.length >= size) {
|
|
|
+ that.AppX.runtimeConfig.toast.show("查询结果过多!当前显示匹配的50条记录")
|
|
|
+ }
|
|
|
+ const nodes = result.result.map((item) => {
|
|
|
+ const targetNode = item;
|
|
|
+ targetNode.pid = null;
|
|
|
+ targetNode.value = targetNode.code;
|
|
|
+ targetNode.pipeId = targetNode.pipeId;
|
|
|
+ targetNode.layerName = targetNode.layerName;
|
|
|
+ targetNode.name = `${targetNode.code}(${targetNode.pipeId})`;
|
|
|
+ return targetNode;
|
|
|
+ })
|
|
|
+ $.fn.zTree.init($("#pbsTreeDivId"), this.setting, nodes);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }, 1)
|
|
|
+ }
|
|
|
+
|
|
|
+ * 该方法用于搜索PBS工程结构树的静态数据
|
|
|
+ * @param {string} key ztree模糊查询关键值
|
|
|
+ * @param {string} code 模糊查询字符串
|
|
|
+ * @param {boolean} isLike 是否模糊查询
|
|
|
+ */
|
|
|
+ searchStatic(key: string, code: string, isLike: boolean) {
|
|
|
+
|
|
|
+ const ztreeObj = this.ztree;
|
|
|
+ const ztreetemp = this.ztreetemp;
|
|
|
+
|
|
|
+
|
|
|
+ let nodes = [];
|
|
|
+ if (isLike) {
|
|
|
+
|
|
|
+ const resNodes = ztreetemp.getNodesByParamFuzzy(key, code, null);
|
|
|
+ for (let i = 0; i < resNodes.length; i++) {
|
|
|
+ const item = resNodes[i];
|
|
|
+ const parentNode = _.find(resNodes, (node: any) => { return node.id === item.pid; });
|
|
|
+ if (!parentNode) {
|
|
|
+ nodes.push(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ nodes = ztreetemp.getNodesByParam(key, code, null);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $.fn.zTree.init($("#pbsTreeDivId"), this.setting, nodes);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ * 检查返回的数据集合是否正确
|
|
|
+ * @param results 用户信息集合
|
|
|
+ * @returns 返回true或者false(true正常,false返回数据异常)
|
|
|
+ */
|
|
|
+ checkRsults(results, colsepopup) {
|
|
|
+ this.loadMask.hide();
|
|
|
+ if (results.code != 1) {
|
|
|
+ console.error(results.message);
|
|
|
+ this.toast.show(results.message);
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 后台请求
|
|
|
+ */
|
|
|
+ sendAjax(data, url, ajaxtype, callBack?, type?, isasync?) {
|
|
|
+
|
|
|
+ let sendtype = "";
|
|
|
+ let senddata = null;
|
|
|
+ let contentType = "application/json;charset=utf-8";
|
|
|
+ if (ajaxtype == "POST" || ajaxtype == "PUT") {
|
|
|
+ senddata = JSON.stringify(data);
|
|
|
+ } else if (ajaxtype == "DELETE") {
|
|
|
+ contentType = "application/x-www-form-urlencoded";
|
|
|
+ senddata = {
|
|
|
+ ids: _.join(data.ids, ',')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ senddata = data;
|
|
|
+ }
|
|
|
+ if (type != 1) {
|
|
|
+ this.loadMask.show("正在加载中,请耐心等待...");
|
|
|
+ }
|
|
|
+ $.ajax({
|
|
|
+ headers: this.header,
|
|
|
+ async: isasync,
|
|
|
+ type: ajaxtype,
|
|
|
+ url: this.apiRoot + url,
|
|
|
+ contentType: contentType,
|
|
|
+ data: senddata,
|
|
|
+ success: callBack.bind(this),
|
|
|
+ error: function (data) {
|
|
|
+ console.error(data);
|
|
|
+
|
|
|
+ this.loadMask.hide();
|
|
|
+ this.toast.show("服务端ajax出错,获取数据失败!");
|
|
|
+ }.bind(this),
|
|
|
+ dataType: "json",
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 销毁对象
|
|
|
+ */
|
|
|
+ destroy() {
|
|
|
+ if (this.localWindow && this.localWindow.infoWindow) {
|
|
|
+ this.localWindow.infoWindow.remove();
|
|
|
+ this.AppX.appConfig.infowindow = null;
|
|
|
+ this.localWindow = null;
|
|
|
+ }
|
|
|
+ this.domObj.remove();
|
|
|
+ this.afterDestroy();
|
|
|
+ }
|
|
|
+}
|
|
|
+export = DataRerecords;
|