<!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" id="app">
        <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"/>
                                <input type="hidden" name="useId" th:value="*{useId}"/>
                            </li>
                            <li>
                                <label>资产种类：</label>
                                <select name="propertyType" th:with="type=${@dict.getType('sys_sm_property')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>使用人：</label>
                                <input type="text" name="username"/>
                            </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-success" onclick="hanldAdd()" shiro:hasPermission="system:property:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:property:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:property:export">
                    <i class="fa fa-download"></i> 导出
                </a>
                <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:property:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:property:remove')}]];
        var detailFlag = [[${@permission.hasPermi('system:property:detail')}]]
        var propertyNetstyleDatas = [[${@dict.getType('sys_file_miji')}]];
        var propertyTypeDatas = [[${@dict.getType('sys_sm_property')}]];
        var propertyMijiDatas = [[${@dict.getType('sys_file_miji')}]];
        var isCurcialDatas = [[${@dict.getType('sys_yes_no')}]];
        var isSoftwareDatas = [[${@dict.getType('sys_yes_no')}]];
        var shemichengduDatas = [[${@dict.getType('sys_user_shemi')}]];
        var prefix = ctx + "system/property/data";
        var obj = {useId:''};
        obj.useId = [[${useId}]] + ''
        // 添加信息
        function hanldAdd() {
            table.set();
            $.modal.open("添加" + table.options.modalName, $.operate.addUrl(obj.useId));
        };
        $(function() {
            var options = {
                url: prefix + "/list",
                queryParams:obj,
                createUrl: prefix + "/add/{id}",
                updateUrl: prefix + "/edit/{id}",
                detailUrl: prefix + "/detail/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                queryParams: queryParams,
                modalName: "资产管理",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '登记编号'
                },
                // {
                //     field: 'useId',
                //     title: '资产编号'
                // },
                {
                    field: 'propertyBrand',
                    title: '设备品牌'
                },
                {
                    field: 'propertyType',
                    title: '资产种类',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(propertyTypeDatas, value);
                    }
                },
                {
                    field: 'propertyMac',
                    title: '设备mac'
                },
                {
                    field: 'propertyNo',
                    title: '资产型号'
                },
                {
                    field: 'propertySn',
                    title: '设备SN'
                },
                {
                    field: 'propertyName',
                    title: '资产名称'
                },
                {
                    field: 'part',
                    title: '部门'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-detail"></i>详情</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + 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;
        }
    </script>
</body>
</html>
