/* * 版 本 PIT-ADMS V7.0.3 敏捷开发框架
 * Copyright (c) 2013-2018 Hexagon PPM
 * 创建人：超级管理员
 * 日  期：2022-03-07 13:45
 * 描  述：工程数据图元
 */
var refreshGirdData;
var DrawingCatalogueID = "";
var ProjectId = request('ProjectId');
var EngineDataID = request('EngineDataID');
var bootstrap = function ($, learun) {
    "use strict";
    var page = {
        init: function () {
            page.initGird();
            page.bind();
        },
        bind: function () {
            // 初始化左侧树形数据
            $('#dataTree').lrtree({
                url: top.$.rootUrl + '/ZZDT_EC/ec_drawing_catalogue/GetTreeData',
                param: { ProjectId: ProjectId, EngineDataID: EngineDataID },
                nodeClick: function (item) {
                    $("#titleinfo").html(item.text);
                    DrawingCatalogueID = item.value;
                    page.search();
                }
            });

            //查询
            $('#btn_Search').on('click', function () {
                page.search();
            });

            // 刷新
            $('#lr_refresh').on('click', function () {
                location.reload();
            });
        },
        // 初始化列表
        initGird: function () {
            $('#gridtable').jfGrid({
                url: top.$.rootUrl + '/ZZDT_EC/ec_drawing_file/GetPageList',
                headData: [
                    { label: "图纸文件名称", name: "DrawingFileName", width: 300, align: "left", sort: false },
                    { label: '图元编码', name: 'PixelCode', width: 300, align: "left", sort: false },
                    { name: "", width: 1, sort: false }
                ],
                mainId: 'DrawingFileID',
                sidx: "CreateTime",
                sord: "DESC",
                isPage: true
            });
            page.search();
        },
        search: function (param) {
            param = param || {};
            param.DrawingCatalogueID = DrawingCatalogueID;
            param.ProjectId = ProjectId;
            param.DrawingFileName = $("#DrawingFileName").val();
            $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param), engineDataID: EngineDataID });
        }
    };
    refreshGirdData = function () {
        $('#gridtable').jfGridSet('reload');
    };
    page.init();
}
