<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('设备登记列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>登记编号：</label>
                            <input type="text" name="id"/>
                        </li>
                        <li>
                            <label>设备品牌：</label>
                            <input type="text" name="propertyBrand"/>
                        </li>
                        <li>
                            <label>资产型号：</label>
                            <input type="text" name="propertyNo"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-danger" onclick="closeItem()">
                <i class="fa fa-reply-all"></i> 关闭
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:changeproperty:change')}]];
    var destoryFlag = [[${@permission.hasPermi('system:changeproperty:destory')}]];
    var removeFlag = [[${@permission.hasPermi('system:changeproperty:remove')}]];
    var propertyTypeDatas = [[${@dict.getType('sys_sm_property')}]];
    var prefix = ctx + "system/propertychange";

    $(function() {
        var options = {
            url: prefix + "/list",
            updateUrl: prefix + "/edit/{id}",
            destoryUrl: prefix + "/destory/{id}",
            queryParams: queryParams,
            modalName: "设备登记",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '登记编号'
                },
                {
                    field: 'propertyBrand',
                    title: '设备品牌'
                },
                {
                    field: 'propertyType',
                    title: '资产种类',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(propertyTypeDatas, value);
                    }
                },
                {
                    field: 'propertyNo',
                    title: '资产型号'
                },
                {
                    field: 'propertySn',
                    title: '资产SN码'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>变更</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + destoryFlag + '" href="javascript:void(0)" onclick="destory(\'' + row.id + '\')"><i class="fa fa-remove"></i>报废</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });


    function queryParams(params) {
        var search = $.table.queryParams(params);
        search.useId = [[${useId}]];
        return search;
    }

    function destory(id) {
        var url = prefix + '/destory/' + id;
        $.modal.open("销毁资产", url);
    }
</script>
</body>
</html>