<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp" %>
<html>
<head>
    <title>过程控制类型管理</title>
    <meta name="decorator" content="default"/>
    <style>
        body{
            background-color:transparent;
            filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFFFFF, endColorstr=#26FFFFFF);
            color:#ffffff;
            background-color:rgba(255,255,255,0);
            height:100%;
        }
    </style>
</head>
<body>
<div class="wrapper wrapper-content">
    <sys:message content="${message}"/>
    <div class="layui-row">
        <div class="full-width fl">
            <div class="layui-row" id="queryDiv">
                <form:form id="searchForm" modelAttribute="workProcessDetail"
                           action="${ctx}/workprocesstype/workProcessDetail/" method="post" class="form-inline">
                    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                    <table:sortColumn id="orderBy" name="orderBy" value="${page.orderBy}"
                                      callback="sortOrRefresh();"/><!-- 支持排序 -->
                </form:form>
            </div>
        </div>
        <div class="full-width fl">
            <div class="contentShadow layui-form contentDetails">
                <div class="nav-btns">
                    <div style="clear: both;"></div>
                </div>
                <table class="oa-table layui-table" id="contentTable"></table>
                <!-- 分页代码 -->
                <table:page page="${page}"></table:page>
                <div style="clear: both;"></div>
            </div>
        </div>
    </div>
</div>
<script src="${ctxStatic}/layer-v2.3/layui/layui.all.js" charset="utf-8"></script>
<script>
    layui.use('table', function () {
        layui.table.render({
            limit:${ page.pageSize }
            , elem: '#contentTable'
            , page: false
            , cols: [[
                // {checkbox: true, fixed: true},
                {
                    field: 'processNumber',
                    align: 'center',
                    width: 120,
                    title: '表格编号'
                },
                {
                    field: 'processName',
                    align: 'center',
                    title: '表格名称'
                },
                {
                    field: 'stateStr',
                    align: 'center',
                    title: '状态',
                    width: 200
                },
                {
                    align: 'center', title: "操作", width: 200, templet: function (d) {
                        ////对操作进行初始化
                        var xml = "";
                        if(d.state == "0" || !d.state){
                            xml+='<a class="op-btn op-btn-trace" href="${ctx}/workprocesstype/workProcessType/saveState?id='+d.typeId+'&state=1&stateId='+d.stateId+'"><i class="fa fa-trash"></i> 移除</a>';
                        }else{
                            xml+='<a class="op-btn op-btn-submit" href="${ctx}/workprocesstype/workProcessType/saveState?id='+d.typeId+'&state=0&stateId='+d.stateId+'"><i class="fa fa-undo"></i> 恢复</a>'
                        }
                        if (d.processNumber == "01")
                            xml += '<a href="#" onclick="openDialogView(\'设备询价记录\', \'${ctx}/workdevicerecord/workDeviceXjRecord/form?view=view\',\'95%\', \'95%\')" class="op-btn op-btn-edit"><i class="fa fa-search-plus"></i> 查看</a>';
                        if (d.processNumber == "02")
                            xml += '<a href="#" onclick="openDialogView(\'补充资料清单\', \'${ctx}/workinfolist/workInfoList/form?view=view\',\'95%\', \'95%\')" class="op-btn op-btn-edit"><i class="fa fa-search-plus"></i> 查看</a>';
                        if (d.processNumber == "03")
                            xml += '<a href="#" onclick="openDialogView(\'现场踏勘记录\', \'${ctx}/workexplore/workExplore/form?view=view\',\'95%\', \'95%\')" class="op-btn op-btn-edit"><i class="fa fa-search-plus"></i> 查看</a>';
                        if (d.processNumber == "04")
                            xml += '<a href="#" onclick="openDialogView(\'沟通记录表\', \'${ctx}/workcommunicaterecord/workCommunicateRecord/form?view=view\',\'95%\', \'95%\')" class="op-btn op-btn-edit"><i class="fa fa-search-plus"></i> 查看</a>';
                        if (d.processNumber == "05")
                            xml += '<a href="#" onclick="openDialogView(\'工程量计算底稿\', \'${ctx}/workprojectcalc/workProjectCalcDecor/form?view=view\',\'95%\', \'95%\')" class="op-btn op-btn-edit"><i class="fa fa-search-plus"></i> 查看</a>';
                        if (d.processNumber == "06")
                            xml += '<a href="#" onclick="openDialogView(\'交接单\', \'${ctx}/workhandbill/workHandBill/form?view=view\',\'95%\', \'95%\')" class="op-btn op-btn-edit"><i class="fa fa-search-plus"></i> 查看</a>';
                        return xml;
                    }
                }
            ]]
            , data: [
                <c:if test="${ not empty page.list}">
                <c:forEach items="${page.list}" var="workProcessDetail" varStatus="index">
                <c:if test="${index.index != 0}">, </c:if>
                {
                    "stateId":"${workProcessDetail.id}",
                    "typeId":"${workProcessDetail.typeId}",
                    "processNumber": "${workProcessDetail.processNumber}",
                    "processName": "${workProcessDetail.processName}",
                    "state": "${workProcessDetail.state}",
                    "stateStr": "<c:choose><c:when test="${workProcessDetail.state==null or workProcessDetail.state=='0'}">启用</c:when><c:otherwise>禁用</c:otherwise></c:choose>"
                }
                </c:forEach>
                </c:if>
            ]
            // ,even: true
            // ,height: 315
        });

    })

</script>
<script>
    resizeListWindow3();
    $(window).resize(function(){
        resizeListWindow3();
    });
</script>
</body>
</html>