123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>TODO supply a title</title>
- {include file="../application/manage/view/commons/headers.html" }
- <script>
- // 编辑窗口
- var $editWin;
- var winHeight = $(window).height();
- var frameHeight = winHeight * 0.9;
- $(function() {
- $editWin = $('#edit-window').window({
- title: '关键词编辑',
- width: 800,
- height: frameHeight,
- top: ($(document).height() - frameHeight) / 2,
- left: ($(document).width() - 820) / 2,
- shadow: true,
- modal: true,
- iconCls: 'icon-edit',
- closed: true,
- minimizable: false,
- maximizable: false,
- collapsible: false
- });
- })
- function commandsFormatter(id, row) {
- var cmdEdit = "<a href='#' onclick=\"javascript:showEditWin('" + row.id + "');\" >编辑</a> ";
- cmdEdit += "<a href='#' onclick=\"javascript:deleteRow('" + row.id + "');\" >删除</a>";
- return cmdEdit;
- }
- $(function() {
- var height = $(document).height();
- $("#gd").height(height);
- getDatas();
- });
- //获取数据
- function getDatas() {
- var institution = $("#institution").val();
- $('#gd').datagrid({
- url: '/manage/device/getAll?institution=' + institution,
- idField: 'id', method: 'get', rownumbers: true,singleSelect:true,selectOnCheck:false,
- showFooter: true, toolbar: '#tb',
- columns: [
- [{
- field: 'id',
- title: 'ID',
- hidden: true
- }, {
- field: 'name',
- title: '名称',
- align: 'center'
- }, {
- field: 'ecName',
- title: '检查类别名称',
- align: 'center'
- }, {
- field: 'institutionName',
- title: '机构名称',
- align: 'center'
- }, {
- field: 'grid_commands',
- title: '操作',
- align: 'center',
- width: 100,
- formatter: commandsFormatter
- }, ]
- ],
- onDblClickRow: function(rowIndex, rowData) {
- showEditWin(rowData.id);
- },
- });
- }
- // 显示编辑窗口
- function showEditWin(id) {
- if ("undefined" == typeof id) {
- $editWin.window('open');
- $('#editFrame').attr('src', '/manage/device/goEdit');
- } else {
- $editWin.window('open');
- $('#editFrame').attr('src', '/manage/device/goEdit?id=' + id);
- }
- }
- function deleteRow(id) {
- $.messager.confirm('Confirm', '确定要删除这条记录吗?', function(r) {
- if (r) {
- $.ajax({
- url: "/manage/device/del",
- data: "id=" + id + "&t=" + new Date(),
- success: function(rs) {
- if (rs == "delete_ok") {
- alert("操作已成功!");
- document.location.reload();
- } else {
- alert("操作失败!");
- }
- }
- });
- }
- });
- }
- // 关闭编辑窗口
- function closeEditWin(isReload) {
- $editWin.window('close');
- if (isReload == "reload") {
- document.location.reload();
- }
- }
- </script>
- </head>
- <body>
- <div id="gd" class="easyui-datagrid" style="width:100%;height:auto;"></div>
- <div id="tb" class="editform" style="display: none; padding-top: 1px;">
- 机构:
- <select id="institution" style="width: 180px; ">
- <option value="">全部</option>
- {volist name="institutions" id="it"}
- <option value="{$it.id}">{$it.name}</option>
- {/volist}
- </select>
- <a id="submit" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width: 80px" onclick="javascript:getDatas()">查询</a>
- <a id="add" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="javascript:showEditWin()" style="width: 80px">添加</a>
- </div>
- <div id="edit-window" class="easyui-window" style="overflow: hidden"><iframe src="about:blank" id="editFrame" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe></div>
- </body>
- </html>
|