<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="../../../common/common-meta-include.jsp"></jsp:include>
    <jsp:include page="../../../common/common-js-include.jsp"></jsp:include>
    <jsp:include page="../../../common/common-css-include.jsp"></jsp:include>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style type="text/css">
        .layui-table-view .layui-table td {
            border-right: 1px solid #DDD !important;
        }

        .layui-table-body .layui-table-cell {
            padding: 5px !important;
        }

        .layui-table-header .layui-table-cell {
            height: 42px !important;
        }

        .qianse {
            color: #666666;
        }

        .lanse {
            color: #1869F6;
        }

        .shense {
            color: #111111;
        }

        .no-wrap {
            white-space: nowrap;
        }

        .lanse-first {
            color: #1C56A3;
            font-size: 12px;
            font-family: "Times New Roman", Times, serif;
        }

        .layui-table-col-special .layui-table-cell {
            display: flex;
            justify-content: space-between;
        }

        .queryTimeType {
            margin-top: -4px;
            position: absolute;
        }

        .hiddenParam,
        .hiddenParams {
            display: none;
        }

        .morePan {
            position: absolute;
            margin-left: 11px;
        }

        .morePan a {
            color: #2C6EC6;
        }

        .table_box .table_process {
            height: fit-content;
            max-height: 60vh;
            overflow-x: scroll;
            overflow-y: scroll;
        }

        .layui-table-body::-webkit-scrollbar {
            width: 0px;
            /*height: 10px;*/
        }

        .table_box,
        .table_box .table_process {
            overflow: visible;
        }

        .layui-form-select dl {
            height: 230px;
        }
        /* 针对特定 select 的样式 */
        .custom-select + .layui-form-select dl {
            height: auto; /* 恢复默认高度 */
            max-height: 150px; /* 设置一个合适的高度 */
        }
        .layui-table-cell .cut {
            display: -webkit-box; /* 使用旧版的弹性盒子布局 */
            -webkit-box-orient: vertical; /* 设置为垂直方向排列 */
            overflow: hidden; /* 隐藏溢出内容 */
            text-overflow: ellipsis; /* 使用省略号表示溢出内容 */
            -webkit-line-clamp: 2; /* 显示的行数 */
        }
    </style>
</head>
<body>
<div id="app"></div>
<template id="template">
    <div class="layui-layout layui-layout-admin pd0">
        <!-- 内容区域 -->
        <div class="right_title">
            <div class="txt">储备项目库 <div class="top-breadcrumb"></div></div>
            <div class="layui-collapse search_form">
                <div class="layui-colla-item">
                    <div class="layui-colla-content layui-show">
                        <form class="layui-form" lay-filter="searchForm" id="searchForm">
                            <input type="hidden" name="queryType" value="1">
                            <div class="layui-row">
                                <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label label-longers required">项目名称</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="subName" placeholder="请输入" autocomplete="off"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label required label-longers">项目属地</label>
                                        <div class="layui-input-block">
                                            <select name="subjectId">
                                                <option value="">请选择</option>
                                                <c:forEach items="${JSDD }" var="hy">
                                                    <option value="${hy.code }">${hy.title }</option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label required label-longers">行业类别</label>
                                        <div class="layui-input-block">
                                            <%-- <div id="indusKind"></div>--%>
                                            <select name="indusKind">
                                                <option value="">请选择</option>
                                                <c:forEach items="${HYFL }" var="hy">
                                                    <option value="${hy.code }">${hy.title}
                                                    <c:forEach items="${hy.children }" var="hy2">
                                                        <option value="${hy2.code }">&ensp;&ensp;${hy2.title}
                                                    </c:forEach>
                                                    </option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-xs3 layui-col-sm3 layui-col-md3 hiddenParam">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label required label-longers" style="width: 100px;">项目总投资(亿元)</label>
                                        <div class="layui-input-block time_box">
                                            <input type="number" name="startAmt" placeholder="请输入最小金额"
                                                   autocomplete="off"
                                                   class="layui-input">
                                            <span class="split_txt">至</span>
                                            <input type="number" name="endAmt" placeholder="请输入最大金额" autocomplete="off"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-xs3 layui-col-sm3 layui-col-md3 hiddenParam">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label label-longers">项目单位</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="sbdw" placeholder="请输入项目项目单位名称"
                                                   autocomplete="off"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-xs3 layui-col-sm3 layui-col-md3 hiddenParams">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label"></label>
                                        <div class="layui-input-block">
                                            <button type="button" class="layui-btn layui-btn-normal" @click="search">查询
                                            </button>
                                            <span class="morePan" @click="showMore"><a v-if="!showMoreFlag">更多  <ion-icon
                                                    name="chevron-forward-outline"></ion-icon></a><a
                                                    v-if="showMoreFlag">收起 V</a></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div>
            <div class="layui-row class_ls">
<%--                <div style="display: flex;margin-bottom: 3px">--%>
<%--                    <label class="juli">--%>
<%--                        储备项目总数--%>
<%--                        <span class="info-icon" title="A类项目:成熟类项目,可研或初设已编制并完成初审,达到项目等资金的进度"></span>--%>
<%--                        <span class="lanse-first">{{beginRate.num}}</span>--%>
<%--                    </label>--%>
<%--                    <label class="juli" onclick="levelList('abcs','A类','A')">--%>
<%--                        A类项目数--%>
<%--                        <span class="info-icon" title="A类项目:成熟类项目,可研或初设已编制并完成初审,达到项目等资金的进度"></span>--%>
<%--                        <span class="lanse-first">{{beginRate.anum}}</span>--%>
<%--                    </label>--%>
<%--                    <label class="juli">--%>
<%--                        B类项目数--%>
<%--                        <span class="info-icon" title="B类项目:推进类项目,正在抓紧推进前期手续,预计6-12个月可开工项目"></span>--%>
<%--                        <span class="lanse-first" onclick="levelList('abcs','B类','B')" style="color: #FFAD0D">{{beginRate.bnum}}</span>--%>
<%--                    </label>--%>
<%--                    <label class="juli" onclick="levelList('abcs','C类','C')">--%>
<%--                        C类项目数--%>
<%--                        <span class="info-icon" title="C类项目:意向类项目,还处于谋划论证阶段项目"></span>--%>
<%--                        <span class="lanse-first" style="color: #E0534E">{{beginRate.cnum}}</span>--%>
<%--                    </label>--%>
<%--                    <label class="juli" onclick="levelList('abcs','D类','D')">--%>
<%--                        D类项目数--%>
<%--                        <span class="info-icon" title="D类项目"></span>--%>
<%--                        <span class="lanse-first" style="color: #405dee">{{beginRate.dnum}}</span>--%>
<%--                    </label>--%>
<%--                    <label class="juli" onclick="levelList('abcs','其它类','UNKNOWN_CATEGORY')">--%>
<%--                        其它项目数--%>
<%--                        <span class="info-icon" title="其它类项目"></span>--%>
<%--                        <span class="lanse-first" style="color: #ba22ec">{{beginRate.nnum}}</span>--%>
<%--                    </label>--%>
<%--                </div>--%>
                <div style="display: flex;margin-bottom: 3px">
                    <label class="juli">
                        储备项目总数
                        <span class="info-icon" title="储备项目总数"></span>
                        <span class="lanse-first">{{beginRate.num}}</span>
                    </label>
                    <label class="juli" onclick="levelList('cbStatus','正在谋划','1')">
                        正在谋划
                        <span class="info-icon" title="正在谋划"></span>
                        <span class="lanse-first">{{beginRate.bePlanningNum}}</span>
                    </label>
                    <label class="juli" onclick="levelList('cbStatus','正在洽谈','2')">
                        正在洽谈
                        <span class="info-icon" title="正在洽谈"></span>
                        <span class="lanse-first">{{beginRate.negotiationNum}}</span>
                    </label>
                    <label class="juli" onclick="levelList('cbStatus','已签约','3')">
                        已签约
                        <span class="info-icon" title="已签约"></span>
                        <span class="lanse-first" style="color: #FFAD0D">{{beginRate.signedNum}}</span>
                    </label>
                    <label class="juli" onclick="levelList('cbStatus','已备案/已核准','4')">
                        已备案/已核准
                        <span class="info-icon" title="已备案/已核准"></span>
                        <span class="lanse-first" style="color: #E0534E">{{beginRate.recordAndApproveNum}}</span>
                    </label>
                </div>
                <div style="display: flex;margin-bottom: 3px">
                    <label class="juli"
                           @click="levelList('subjects',item.name,item.code)"
                           v-for="(item, index) in beginRate.jsddList" :key="index">
                        {{item.name}} <span class="lanse-first">{{item.num}}</span>
                    </label>
                </div>
                <div class="second_line" style="margin-bottom: 3px">
                    <label class="juli"
                           @click="levelList('indusKinds',item.name?item.name:item.code,item.code)"
                           v-for="(item, index) in beginRate.hyflList" :key="index">
                        {{item.name?item.name:item.code}}
                        <span class="lanse-first">{{item.num}}</span>
                    </label>
                </div>
            </div>
        </div>
        <div class="table_box" style="padding-top: 0;">
            <div class="table_process" style="position: relative">
                <div style="position: relative; display: inline-block" @mouseover="openExport" @mouseout="choseExport">
                    <div class="export">
                        <img src="${WebSite.asset}/css/images/left/export.svg"/>
                        <span>导出</span>
                    </div>
                    <div class="export-item" v-if="showExport" :style="{ top: '-93px' }">
                        <button type="button" class="" @click="exportDetailExcel">导出明细</button>
                        <button type="button" class="" @click="exportTotalExcel">导出总表</button>
                        <button type="button" class="" @click="exportMoreExcel">自定义导出</button>
                    </div>
                </div>
                <table id="table1" lay-filter="test"></table>
                <div class="pagination-box" id="pagination"></div>
            </div>
        </div>
        <div style="height: 20px;"></div>
    </div>
</template>

<script type="text/html" id="subName">
    <span lay-event="toDetail" title="{{d.subName}}">{{d.subName}}</span>
</script>

<script type="text/html" id="progress">
    <span title="{{d.progress}}">{{d.progress}}</span>
</script>
<script type="text/html" id="unitName">
    <span lay-event="toQcc" title="{{d.unitName}}">{{d.unitName}}</span>
</script>

<script type="text/html" id="date">
    <div title="">
        <div class="line"><span class="qianse">计划开工:</span> <span class="shense">{{d.beginDate}}</span>

        </div>
        <div class="line"><span class="qianse">计划竣工:</span> <span class="shense">{{d.endDate}}</span>

        </div>
    </div>
</script>


<script type="text/html" id="amtTotal">
    <div title="">
        <span class="qianse">总投资金额:</span><span class="lanse">{{d.amtTotal}}</span> 万元<br/>
    </div>
</script>

<%-- table操作按钮 --%>
<script type="text/html" id="toolBar">
    <div class="toolBar">
        <span title="项目查询" lay-event="toDetail" class="no-wrap">项目查询</span>
        {{# if("${currUser.edit}" == 'true'||( d.propKind == '3' && "${currUser.id}" == d.create_user_id )) { }}
        <span title="编辑" lay-event="toEditSubInfo" class="no-wrap">&nbsp;编辑</span>
        {{#} }}
        <span title="转库" lay-event="move" class="no-wrap">转库</span>
    </div>
</script>

<script type="text/html" id="moveForm">
    <div class="layui-form" style="padding: 20px;">
        <div class="layui-form-item" style="display: flex; align-items: center;">
            <label class="layui-form-label" style="text-align: right; width: 90px;">当前状态:</label>
            <div class="layui-input-block" style="flex: 1; max-width: calc(100% - 120px);">
                <input type="text" name="currentState" value="储备库" disabled class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" style="display: flex; align-items: center;">
            <label class="layui-form-label" style="text-align: right; width: 90px;">转库到:</label>
            <div class="layui-input-block" style="flex: 1; max-width: calc(100% - 120px);">
                <select class="custom-select" lay-filter="moveStatus" lay-verify="required">
                    <option value="">请选择</option>
                    <option value="2">新建</option>
                    <option value="3">在建</option>
                    <option value="9">投产</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item" style="display: flex; align-items: center;">
            <label class="layui-form-label" style="text-align: right; width: 90px;"></label>
            <div class="layui-input-block" style="flex: 1; max-width: calc(100% - 120px); text-align: right;">
                <button type="button" class="layui-btn layui-btn-primary layui-border" onclick="vm.closeAllLayers()">取消</button>
                <button type="button" class="layui-btn moveConfirm" onclick="vm.confirmMove()">确认转库</button>
            </div>
        </div>
    </div>
</script>

<script>
    layui.use('element', function () {
        let element = layui.element;
    });
    let vm = new Vue({
        el: "#app",
        template: "#template",
        data: {
            JSDD: [],
            HYFL: [],
            winH: 0,
            dataList: [],
            startDate: "",
            endDate: "",
            tableName: 'test',
            cacheName: 'TzQueryParam_cb_${currUser.id}',
            pageNo: 1,
            kind: {},
            beginRate: {},
            showMoreFlag: false,
            light: null,
            sort: {field: "abc", type: ""},
            pageSize: 10,
            showExport: false,
            moveDbParam: {
                status: "",
                id: "",
                statusName: ""
            }
        },
        mounted: function () {
            this.init()
        },
        methods: {
            closeAllLayers() {
                layui.layer.closeAll(); // 关闭所有弹框
            },
            confirmMove: function () {
                let param = this.moveDbParam
                // 数据验证
                if (!param || !param.status) {
                    App.msg.error("请选择转库状态");
                    return;
                }
                const statusMap = {
                    1: "储备",
                    2: "新建",
                    3: "在建",
                    9: "投产"
                };
                param.statusName = statusMap[param.status] || "未知状态";
                let self = this;
                self.closeAllLayers();
                App.msg.confirm(`是否转入` + param.statusName + `库?`, () => {
                    App.postJson("/api/subject/subInfo/moveDb", {id: param.id, status: param.status}, (res) => {
                        if (res.success) {
                            App.msg.success("转库成功");
                            self.getData()
                        } else {
                            App.msg.error(res.message || "转库失败,请重试");
                        }
                    })
                });
            },
            init: function () {
                let self = this;
                layui.form.on("select(moveStatus)", function (data) {
                    self.moveDbParam.status = data.value;
                });

                this.winH = document.body.clientHeight;
                var nowdate = new Date();
                nowdate.setMonth(nowdate.getMonth() + 1);
                var y = nowdate.getFullYear();
                var m = nowdate.getMonth() + 1;
                var d = nowdate.getDate();
                layui.laydate.render({
                    elem: '#startTime',
                    range: '~',
                    theme: layDateTheme,
                    /*     value: y + "-01-01 ~ " + y + "-12-31"*/
                });
                var formatwdate = y + '-' + m + '-' + d;
                layui.laydate.render({
                    elem: '#dateConfirm',
                    theme: layDateTheme,
                    value: formatwdate
                });
                /*  $("#month").val(new Date().getMonth() + 1);*/
                var xmlx = [];
                <c:forEach items="${XMLX}" var="xm">
                xmlx.push({value: "${xm.code}", name: "${xm.title}"});
                </c:forEach>


                <%--var indusKindData = [];--%>
                <%--<c:forEach items="${HYFL}" var="xm">--%>
                <%--    var childData = [];--%>
                <%--    <c:forEach items="${xm.children}" var="c">--%>
                <%--        childData.push({--%>
                <%--            value: "${c.code}",--%>
                <%--            name: "${c.title}",--%>
                <%--        })--%>
                <%--    </c:forEach>--%>
                <%--    indusKindData.push(--%>
                <%--    {--%>
                <%--        value: "${xm.code}",--%>
                <%--        name: "${xm.title}",--%>
                <%--        children: childData--%>
                <%--    });--%>
                <%--</c:forEach>--%>
                // this.indusKind = layui.xmSelect.render({
                //     el: "#indusKind",
                //     language: 'zn',
                //     data: indusKindData,
                // });


                layui.laydate.render({
                    elem: '#year',
                    type: 'year',
                    theme: layDateTheme,
                    /*                value: new Date().getFullYear()*/
                })
                var params = window.localStorage.getItem(this.cacheName);
                if (params) {
                    layui.form.val("searchForm", JSON.parse(params));
                }

                this.getData();
                window.addEventListener('message', this.receiveMessage, false);
                window.parent.postMessage('init loaded')
                window.toDetail = this.toDetail;
                window.levelList = this.levelList;
                $(".hiddenParams").show();
            },

            showMore: function () {
                this.showMoreFlag = !this.showMoreFlag;
                if (this.showMoreFlag) {
                    $(".hiddenParam").show();
                } else {
                    $(".hiddenParam").hide();
                }
            },
            getSearchParams: function () {
                var param = layui.form.getValue("searchForm");
                if (param.rangeDate) {
                    param.beginDate = param.rangeDate.split(" ~ ")[0];
                    param.endDate = param.rangeDate.split(" ~ ")[1];
                    param.rangeDate = null;
                }
                if (this.light) {
                    param.light = this.light.getValue("valueStr");
                }
                // if (this.indusKind) {
                //     param.indusKind = this.indusKind.getValue("valueStr");
                // }
                delete (param.select);
                /*     param.kind = this.kind.getValue("value").sort().join(",");*/
                return param;
            },
            getData: function () {
                var self = this;
                var param = this.getSearchParams();
                param.pageNo = this.pageNo;
                param.pageSize = this.pageSize;
                param.orderBy = this.sort.field;
                param.orderType = this.sort.type || "asc";

                // 表格分页数据
                param.status = 1;
                App.postJson("/api/subInfo/query/queryPage", param, function (res) {
                    self.dataList = res.rows;
                    self.loadPage(res.total);
                    self.loadTable();
                });

                // 统计数据
                App.postJson("/api/subInfo/query/statistics", param, function (res) {
                    if (res.success) {
                        self.beginRate = res.data;
                        self.beginRate.hyflList = self.beginRate.hyflData;
                        self.beginRate.jsddList = self.beginRate.jsddData;
                    }
                });
            },
            getStatusName: function (status) {
                const statusMap = {
                    '0': '暂存',
                    '1': '项目前期',
                    '6': '待开工',
                    '7': '施工中',
                    '8': '暂停施工',
                    'A': '已竣工'
                };
                return statusMap[status] || '未知状态';
            },
            adjustFrozenRowHeight: function () {
                $(".layui-table-body tr").each(function (index, val) {
                    const fixedRow = $(".layui-table-fixed .layui-table-body table tr")[index];
                    $(fixedRow).height($(val).height());
                });
            },
            loadTable: function () {
                // 状态名称映射
                // this.dataList.forEach(item => {
                //     item.statusName = this.getStatusName(item.status);
                // });

                const self = this;
                layui.table.render({
                    elem: '#table1',
                    even: true,
                    autoSort: false,
                    initSort: self.sort,
                    cols: [[
                        {type: 'numbers', align: 'center', width: 44, title: '序号', fixed: 'left'},
                        {field: 'subName', fixed: 'left', title: '项目名称', width: 200, templet: '#subName'},
                        {field: 'subjectName', title: '项目所在地', width: 100},
                        {field: 'content', title: '项目建设内容', minWidth: 300,
                            templet: function (row) {
                                // row.content = row.content.replace(/(\d+)/g, '<span class="new-roman">$1</span>');
                                return row.content ? '<span class="cut" title="' + row.content + '">' + row.content + '</span>' : '';
                            }},
                        {
                            field: 'amtTotal',
                            title: '计划总投资(亿元)',
                            width: 80,
                            templet: d => (d.amtTotal / 10000).toFixed(2) + "亿元"
                        },
                        {field: 'progress', title: '进展情况', minWidth: 300,
                            templet: function (row) {
                                return row.progress ? '<span class="cut" title="' + row.progress + '">' + row.progress + '</span>' : '';
                            }},
                        {field: 'remark', title: '备注', minWidth: 200},
                        {title: '操作', width: 150, toolbar: '#toolBar', fixed: 'right'},
                    ]],
                    fixed: true,
                    height: $(window).height() - $('#table1').offset().top - 50,
                    data: self.dataList,
                    done: function () {
                        self.adjustFrozenRowHeight();
                    }
                });

                layui.table.on('tool(' + this.tableName + ')', obj => {
                    const {event} = obj;
                    if (typeof self[event] === 'function') {
                        self[event](obj);
                    } else {
                        console.warn(`未定义的事件: ${event}`);
                    }
                });

                layui.table.on('sort(' + this.tableName + ')', function (obj) {
                    self.sort = obj;
                    self.getData();
                });
            },
            move(obj) {
                this.moveDbParam.id = obj.data.id
                const formTemplate = document.getElementById('moveForm').innerHTML;
                layer.open({
                    type: 1,
                    title: '转库',
                    content: formTemplate,
                    area: ['350px', '300px'],
                    success: function (layero, index) {
                        layui.form.render();
                    }
                });
            },
            loadPage: function (totalCount) {
                var self = this;
                layui.laypage.render({
                    elem: 'pagination',
                    count: totalCount,
                    curr: self.pageNo,
                    limit: self.pageSize,
                    layout: ['count', 'prev', 'page', 'next', 'skip'],
                    jump: function (obj, first) {
                        //首次不执行
                        if (!first) {
                            self.pageNo = obj.curr;
                            self.getData();
                        }
                    }
                });
            },
            exportExcel: function () {
                var param = this.getSearchParams();
                App.common.utils.downFile(App.getUrl("subInfoExport/exportSumExcel"), "POST", param, "项目情况表.xlsx", "导出失败");
            },
            exportTotalExcel: function () {
                var param = this.getSearchParams();
                param.status = '1'
                App.common.utils.downFile(App.getUrl("subInfoExport/exportTotalExcelByStatus"), "POST", param, "项目情况表(储备库).xlsx", "导出失败");
            },
            exportDetailExcel: function () {
                var param = this.getSearchParams();
                param.status = '1'
                App.common.utils.downFile(App.getUrl("subInfoExport/exportDetailExcel"), "POST", param, "项目明细(储备库).xlsx", "导出失败");
            },
            exportExcelByIndusKind: function () {
                var param = this.getSearchParams();
                App.common.utils.downFile(App.getUrl("subInfoExport/exportExcelByIndusKind"), "POST", param, "项目情况表(按所属行业统计).xlsx", "导出失败");
            },
            exportSchedulingExcel: function () {
                var param = this.getSearchParams();
                App.common.utils.downFile(App.getUrl("subInfoExport/exportSchedulingExcel"), "POST", param, "项目调度表.xlsx", "导出失败");
            },
            exportMoreExcel: function () {
                top.window.getSearchParams = this.getSearchParams;
                App.openLayer({
                    title: "自定义导出",
                    content: App.getUrl("/subInfoExport/index"),
                    height: "800",
                    width: "1000"
                })
            },
            toQcc: function (obj) {
                window.open('https://www.qcc.com/web/search?key=' + obj.data.unitName, '_blank')
            },
            toDetail: function (obj) {
                //详情
                var index = layer.open({
                    type: 2,
                    title: '',
                    area: ['1000px', '800px'],
                    content: App.getUrl("/subject/subInfo/detailView2?layer=true&subId=" + obj.data.id + "&lastUrl=" + window.location.href),
                });
                layui.layer.full(index);
            },
            levelList: function (field, title, val) {
                //详情
                var param = field + "," + title + "," + val
                var params = encodeURIComponent(JSON.stringify(this.getSearchParams()));
                var index = top.layer.open({
                    type: 2,
                    title: '',
                    area: ['90%', '90%'],
                    content: App.getUrl("/subject/subInfo/levelList?layer=true&type=" + this.getSearchParams().queryType + "&curParam=" + param + "&params=" + params),
                });
                //top.layer.full(index);
            },
            toEditSubInfo: function (obj) {
                window.location.href = App.getUrl("/subject/subInfo/editSubInfo2?subId=" + obj.data.id + "&queryType=3");
            },
            search: function () {
                var param = layui.form.getValue("searchForm");
                window.localStorage.setItem(this.cacheName, JSON.stringify(param));
                this.pageNo = 1;
                this.getData();
            },
            openExport: function () {
                this.showExport = true;
            },
            choseExport: function () {
                this.showExport = false;
            },
            receiveMessage (e) {
                console.log('cb receiveMessage: ', e.data)
                if (e.data.topBreadcrumb) {
                    $(".top-breadcrumb").html(e.data.topBreadcrumb)
                }
            },
        }
    });
</script>

</body>
</html>