天天看点

Django 搭建CMDB系统完整[14](运维记录)templates/add_yunweijilu.htmltemplates/edit_yunweijilu.html

templates/search_yunweijilu.html

{% extends 'base.html' %}

{% block title %}

<script type="text/javascript" src="/static/scripts/jquery/jquery-1.7.1.js"></script>

<link href="/static/style/authority/basic_layout.css" rel="stylesheet" type="text/css">

<link href="/static/style/authority/common_style.css" rel="stylesheet" type="text/css">

<script type="text/javascript" src="/static/scripts/authority/commonAll.js"></script>

<script type="text/javascript" src="/static/scripts/fancybox/jquery.fancybox-1.3.4.js"></script>

<script type="text/javascript" src="/static/scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>

<link rel="stylesheet" type="text/css" href="/static/style/authority/jquery.fancybox-1.3.4.css" media="screen"></link>

<script type="text/javascript" src="/static/scripts/artDialog/artDialog.js?skin=default"></script>

<script src="/static/scripts/datetime/jquery-ui-1.12.1/jquery-ui.min.js"></script>

<link href="/static/scripts/datetime/jquery-ui-1.12.1/jquery-ui.min.css" rel="stylesheet" />

<script src="/static/scripts/datetime/jQuery-Timepicker/dist/jquery-ui-timepicker-addon.min.js"></script>

<script type="text/javascript" src="/static/scripts/datetime/jQuery-Timepicker/dist/i18n/jquery-ui-timepicker-zh-CN.js"></script>

<link href="/static/scripts/datetime/jQuery-Timepicker/dist/jquery-ui-timepicker-addon.min.css" rel="stylesheet" />

<script type="text/javascript">

(function($) {

$(function() {
                $.datepicker.regional['zh-CN'] = {
                    changeMonth: true,
                    changeYear: true,
                    clearText: '清除',
                    clearStatus: '清除已选日期',
                    closeText: '关闭',
                    closeStatus: '不改变当前选择',
                    prevText: '<上月',
                    prevStatus: '显示上月',
                    prevBigText: '<<',
                    prevBigStatus: '显示上一年',
                    nextText: '下月>',
                    nextStatus: '显示下月',
                    nextBigText: '>>',
                    nextBigStatus: '显示下一年',
                    currentText: '今天',
                    currentStatus: '显示本月',
                    monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
                    monthNamesShort: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
                    monthStatus: '选择月份',
                    yearStatus: '选择年份',
                    weekHeader: '周',
                    weekStatus: '年内周次',
                    dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
                    dayNamesShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
                    dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
                    dayStatus: '设置 DD 为一周起始',
                    dateStatus: '选择 m月 d日, DD',
                    dateFormat: 'yy-mm-dd',
                    firstDay: 1,
                    initStatus: '请选择日期',
                    isRTL: false
                };

            });

            $(function() {
                $.datepicker.setDefaults($.datepicker.regional['zh-CN']);
                
                $("#kssj").datetimepicker();
                $("#jssj").datetimepicker();
            });
            
            
        }(jQuery));
    </script>
           

<div id="container">

<div class="ui_content">

<div class="ui_text_indent">

<div id="box_border">

<div id="box_top">搜索</div>

 问题描述 <input type="text" id="wtms" name="wtms" value="{{ wtms }}" class="ui_input_txt03" />

 问题来源 <input type="text" id="wtly" name="wtly" value="{{ wtly }}" class="ui_input_txt03" style="width:50px" />

 处理人 <input type="text" id="clr" name="clr" value="{{ clr }}" class="ui_input_txt03" style="width:50px" />

 开始时间 <input type="text" id="kssj" name="kssj" value="{{ kssj|date:"Y-m-d H:i" }}" class="ui_input_txt03" style="width:70px" />

 结束时间 <input type="text" id="jssj" name="jssj" value="{{ jssj|date:"Y-m-d H:i" }}" class="ui_input_txt03" style="width:70px" />

 类型 

<select id="type" name="type" class="ui_select02">

<option value=100 selected = "selected">所有</option>

<option value=0 {% if type == 0 %} selected = "selected" {% endif %}>日常巡检</option>

<option value=1 {% if type == 1 %} selected = "selected" {% endif %}>网络设备配置</option>

<option value=2 {% if type == 2 %} selected = "selected" {% endif %}>安全设备配置</option>

<option value=3 {% if type == 3 %} selected = "selected" {% endif %}>系统部署</option>

<option value=4 {% if type == 4 %} selected = "selected" {% endif %}>安全运维</option>

<option value=5 {% if type == 5 %} selected = "selected" {% endif %}>系统更新/维护</option>

<option value=6 {% if type == 6 %} selected = "selected" {% endif %}>系统重启</option>

<option value=7 {% if type == 7 %} selected = "selected" {% endif %}>系统迁移</option>

<option value=8 {% if type == 8 %} selected = "selected" {% endif %}>系统扩容</option>

<option value=9 {% if type == 9 %} selected = "selected" {% endif %}>技术支持</option>

</select>

 机房 <select id="machinaroom" name="machinaroom" class="ui_select02" >

{% for mr in machinaroomlist %}

<option value={{ mr.id }} {% if mr.id == machinaroom %} selected = "selected" {% endif %}>{{ mr.name }}</option>

{% endfor %}

</div>

<div id="box_bottom">

<div class="pagination">

<span class="current">

{% if yunweijilulist.has_previous %}

<a href="javascript:void(0)" onclick="search_yunweijilu({{ yunweijilulist.previous_page_number }});">上一页</a>

{% endif %}

<span class="current">
        Page {{ yunweijilulist.number }} of {{ yunweijilulist.paginator.num_pages }}.
    </span>

    {% if yunweijilulist.has_next %}
        <a href="javascript:void(0)" onclick="search_yunweijilu({{ yunweijilulist.next_page_number }});">下一页</a>
    {% endif %}
</span>
           

<input type="button" value="查询" class="ui_input_btn01" onclick="search_yunweijilu(1);"/>

<input type="button" value="新增" class="ui_input_btn01" onclick="add_yunweijilu();" />

<input type="button" value="删除" class="ui_input_btn01" onclick="batdel_yunweijilu();" />

<input type="button" value="导出EXCEL" class="ui_input_btn01" onclick="excel_yunweijilu();" />

</form>

{% endblock %}

{% block content %}

<div class="ui_tb">

<table class="table1" cellspacing="0" cellpadding="0" width="100%" align="center" border="0">

<tr>

<th width="30"><input type="checkbox" id="id" name="id" />

</th>

<th>类型</th>

<th>问题描述</th>

<th>问题来源</th>

<th>接收时间</th>

<th>处理人</th>

<th>开始时间</th>

<th>结束时间</th>

<th>处理办法</th>

<th>备注</th>

<th>机房</th>

<th>操作</th>

</tr>

{% for s in yunweijilulist.object_list %}

<td><input type="checkbox" name="idcheck" value={{ s.id }} class="acb" /></td>

<td>

{% if s.type == 0 %}

日常巡检

{% elif s.type == 1 %}

网络设备配置

{% elif s.type == 2 %}

安全设备配置

{% elif s.type == 3 %}

系统部署

{% elif s.type == 4 %}

安全运维

{% elif s.type == 5 %}

系统更新/维护

{% elif s.type == 6 %}

系统重启

{% elif s.type == 7 %}

系统迁移

{% elif s.type == 8 %}

系统扩容

{% elif s.type == 9 %}

技术支持

</td>

<td title="{{ s.wtms }}">{{ s.wtms|truncatechars:"8" }}</td>

<td title="{{ s.wtly }}">{{ s.wtly|truncatechars:"8" }}</td>

<td title="{{ s.wtjssj|date:"Y-m-d H:i" }}">{{ s.wtjssj|date:"Y-m-d" }}</td>

<td title="{{ s.clr }}">{{ s.clr|truncatechars:"8" }}</td>

<td title="{{ s.kssj|date:"Y-m-d H:i" }}">{{ s.kssj|date:"Y-m-d" }}</td>

<td title="{{ s.jssj|date:"Y-m-d H:i" }}">{{ s.jssj|date:"Y-m-d" }}</td>

<td title="{{ s.clbf }}">{{ s.clbf|truncatechars:"8" }}</td>

<td title="{{ s.memo }}">{{ s.memo|truncatechars:"6"}}</td>

<td title="{{ s.machinaroom.name }}">{{ s.machinaroom.name|truncatechars:"8"}}</td>

<a href="javascript:void(0)" onclick="edit_yunweijilu('{{ s.id }}')" class="edit">编辑</a>

<a href="javascript:void(0)" onclick="del_yunweijilu({{ s.id }},{{ yunweijilulist.number }});">删除</a>

</table>

function search_yunweijilu(page){

var wtms = document.getElementById("wtms").value;

var wtly = document.getElementById("wtly").value;

var clr= document.getElementById("clr").value;

var kssj= document.getElementById("kssj").value;

var jssj = document.getElementById("jssj").value;

var type = document.getElementById("type").value;

var machinaroom = document.getElementById("machinaroom").value;

var myurl="search_yunweijilu.html"+"?"+"wtms="+wtms+"&&wtly="+wtly+"&&clr="+clr+"&&kssj="+kssj+"&&jssj="+jssj+"&&type="+type+"&&machinaroom="+machinaroom+"&&page="+page;

window.location.assign(encodeURI(myurl))

}

function add_yunweijilu(){

var width = 400;

var height = 500;

var left = parseInt((screen.availWidth/2) - (width/2));//屏幕居中

var top = parseInt((screen.availHeight/2) - (height/2));

var windowFeatures = "width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;

newWindow = window.open("add_yunweijilu.html", "subWind", windowFeatures);

function edit_yunweijilu(id){

newWindow = window.open("edit_yunweijilu.html?id="+id, "subWind", windowFeatures);

function del_yunweijilu(id,page){

if(window.confirm('确定要删除该记录吗?')){

var myurl="del_yunweijilu.html"+"?"+"id="+id+"&&wtms="+wtms+"&&wtly="+wtly+"&&clr="+clr+"&&kssj="+kssj+"&&jssj="+jssj+"&&type="+type+"&&machinaroom="+machinaroom+"&&page="+page;

return true;

}else{

//alert("取消");

return false;

function batdel_yunweijilu(){

if(window.confirm('确定要删除记录吗?')){

obj = document.getElementsByName("idcheck");

check_val = [];

for(k in obj){

if(obj[k].checked)

check_val.push(obj[k].value);

var myurl="batdel_yunweijilu.html"+"?"+"ids="+check_val+"&&wtms="+wtms+"&&wtly="+wtly+"&&clr="+clr+"&&kssj="+kssj+"&&jssj="+jssj+"&&type="+type+"&&machinaroom="+machinaroom;

function excel_yunweijilu(){

var myurl="excel_yunweijilu.html"+"?"+"wtms="+wtms+"&&wtly="+wtly+"&&clr="+clr+"&&kssj="+kssj+"&&jssj="+jssj+"&&type="+type+"&&machinaroom="+machinaroom;

</script>

templates/add_yunweijilu.html

<!DOCTYPE html>

<html>

<head>

<title>CMDB</title>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

</head>

<body>

<script src="/static/scripts/My97DatePicker/WdatePicker.js" type="text/javascript" defer="defer"></script>

$(function() {
            $.datepicker.regional['zh-CN'] = {
                changeMonth: true,
                changeYear: true,
                clearText: '清除',
                clearStatus: '清除已选日期',
                closeText: '关闭',
                closeStatus: '不改变当前选择',
                prevText: '<上月',
                prevStatus: '显示上月',
                prevBigText: '<<',
                prevBigStatus: '显示上一年',
                nextText: '下月>',
                nextStatus: '显示下月',
                nextBigText: '>>',
                nextBigStatus: '显示下一年',
                currentText: '今天',
                currentStatus: '显示本月',
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
                monthNamesShort: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
                monthStatus: '选择月份',
                yearStatus: '选择年份',
                weekHeader: '周',
                weekStatus: '年内周次',
                dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
                dayNamesShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
                dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
                dayStatus: '设置 DD 为一周起始',
                dateStatus: '选择 m月 d日, DD',
                dateFormat: 'yy-mm-dd',
                firstDay: 1,
                initStatus: '请选择日期',
                isRTL: false
            };

        });

        $(function() {
            $.datepicker.setDefaults($.datepicker.regional['zh-CN']);

            $("#yunweijiluwtjssj").datetimepicker();
            $("#yunweijilukssj").datetimepicker();
            $("#yunweijilujssj").datetimepicker();
        });


    }(jQuery));
           

<form id="addyunweijiluform" name="addyunweijiluform" action="add_yunweijilu.html" method="post">

<div id="nav_links">

当前位置:运维管理 > <span style="color: #1A5CC6;">新增运维记录</span>

<div id="page_close">

<a href="javascript:parent.$.fancybox.close();">

<img src="/static/images/common/page_close.png" width="20" height="20" style="vertical-align: text-top;"/>

</a>

<table cellspacing="0" cellpadding="0" width="100%" align="left" border="0">

<td class="ui_text_rt">类型:</td>

<td class="ui_text_lt">

<select name="yunweijilutype" id="yunweijilutype" class="ui_select01" >

<option value=0>日常巡检</option>

<option value=1>网络设备配置</option>

<option value=2>安全设备配置</option>

<option value=3>系统部署</option>

<option value=4>安全运维</option>

<option value=5>系统更新/维护</option>

<option value=6>系统重启</option>

<option value=7>系统迁移</option>

<option value=8>系统扩容</option>

<option value=9>技术支持</option>

<td class="ui_text_rt">问题描述:</td>

<input type="text" id="yunweijiluwtms" name="yunweijiluwtms" value="" class="ui_input_txt02" />

<td class="ui_text_rt">问题来源:</td>

<input type="text" id="yunweijiluwtly" name="yunweijiluwtly" value="" class="ui_input_txt02" />

<td class="ui_text_rt">问题接收时间:</td>

<input type="text" id="yunweijiluwtjssj" name="yunweijiluwtjssj" value="" class="ui_input_txt02" />

<tr>
                                    <td class="ui_text_rt">处理人:</td>
                                    <td class="ui_text_lt">
                                            <input type="text" id="yunweijiluclr" name="yunweijiluclr"  value="" class="ui_input_txt02" />
                                    </td>
                            </tr>

                                                            <tr>
                                    <td class="ui_text_rt">开始时间:</td>
                                    <td class="ui_text_lt">
                                            <input type="text" id="yunweijilukssj" name="yunweijilukssj"  value="" class="ui_input_txt02" />
                                    </td>
                            </tr>

                                                            <tr>
                                    <td class="ui_text_rt">结束时间:</td>
                                    <td class="ui_text_lt">
                                            <input type="text" id="yunweijilujssj" name="yunweijilujssj"  value="" class="ui_input_txt02" />
                                    </td>
                            </tr>
                            <tr>
           

<td class="ui_text_rt">处理办法:</td>

<input type="text" id="yunweijiluclbf" name="yunweijiluclbf" value="" class="ui_input_txt02" />

<td class="ui_text_rt">备注:</td>

<input type="text" id="yunweijilumemo" name="yunweijilumemo" value="" class="ui_input_txt02" />

<td class="ui_text_rt">机房:</td>

<select name="yunweijilumachinaroom" id="yunweijilumachinaroom" class="ui_select01" >

{% for mr in machinaroomlist %}

<option value={{ mr.id }}>{{ mr.name }}</option>

<tr>
                                    <td>&nbsp;</td>
                                    <td class="ui_text_lt">
                                            &nbsp;<input id="submitbutton" type="submit" value="提交" class="ui_input_btn01"/>
                                            &nbsp;<input id="cancelbutton" type="cancel" value="取消" class="ui_input_btn01"/>
                                    </td>
                            </tr>

                    </table>
            </div>
    </div>
           

</body>

</html>

templates/edit_yunweijilu.html

$(function() {
            $.datepicker.regional['zh-CN'] = {
                changeMonth: true,
                changeYear: true,
                clearText: '清除',
                clearStatus: '清除已选日期',
                closeText: '关闭',
                closeStatus: '不改变当前选择',
                prevText: '<上月',
                prevStatus: '显示上月',
                prevBigText: '<<',
                prevBigStatus: '显示上一年',
                nextText: '下月>',
                nextStatus: '显示下月',
                nextBigText: '>>',
                nextBigStatus: '显示下一年',
                currentText: '今天',
                currentStatus: '显示本月',
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
                monthNamesShort: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
                monthStatus: '选择月份',
                yearStatus: '选择年份',
                weekHeader: '周',
                weekStatus: '年内周次',
                dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
                dayNamesShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
                dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
                dayStatus: '设置 DD 为一周起始',
                dateStatus: '选择 m月 d日, DD',
                dateFormat: 'yy-mm-dd',
                firstDay: 1,
                initStatus: '请选择日期',
                isRTL: false
            };

        });

        $(function() {
            $.datepicker.setDefaults($.datepicker.regional['zh-CN']);

            $("#yunweijiluwtjssj").datetimepicker();
            $("#yunweijilukssj").datetimepicker();
            $("#yunweijilujssj").datetimepicker();
        });


    }(jQuery));
           

<form id="edityunweijiluform" name="edityunweijiluform" action="edit_yunweijilu.html" method="post">

当前位置:配置管理 > <span style="color: #1A5CC6;">编辑运维记录</span>

<div class="ui_content"><input style="visibility:hidden" value={{ yunweijilu.id }} type="text" name="id" id="id" />

<option value=0 {% if yunweijilu.type == 0 %} selected="selected" {% endif %}>日常巡检</option>

<option value=1 {% if yunweijilu.type == 1 %} selected="selected" {% endif %}>网络设备配置</option>

<option value=2 {% if yunweijilu.type == 2 %} selected="selected" {% endif %}>安全设备配置</option>

<option value=3 {% if yunweijilu.type == 3 %} selected="selected" {% endif %}>系统部署</option>

<option value=4 {% if yunweijilu.type == 4 %} selected="selected" {% endif %}>安全运维</option>

<option value=5 {% if yunweijilu.type == 5 %} selected="selected" {% endif %}>系统更新/维护</option>

<option value=6 {% if yunweijilu.type == 6 %} selected="selected" {% endif %}>系统重启</option>

<option value=7 {% if yunweijilu.type == 7 %} selected="selected" {% endif %}>系统迁移</option>

<option value=8 {% if yunweijilu.type == 8 %} selected="selected" {% endif %}>系统扩容</option>

<option value=9 {% if yunweijilu.type == 9 %} selected="selected" {% endif %}>技术支持</option>

<input type="text" id="yunweijiluwtms" name="yunweijiluwtms" value="{{ yunweijilu.wtms }}" class="ui_input_txt02" />

<input type="text" id="yunweijiluwtly" name="yunweijiluwtly" value="{{ yunweijilu.wtly }}" class="ui_input_txt02" />

<input type="text" id="yunweijiluwtjssj" name="yunweijiluwtjssj" value="{{ yunweijilu.wtjssj|date:"Y-m-d H:i" }}" class="ui_input_txt02" />

<tr>
                                    <td class="ui_text_rt">处理人:</td>
                                    <td class="ui_text_lt">
                                            <input type="text" id="yunweijiluclr" name="yunweijiluclr"  value="{{ yunweijilu.clr }}" class="ui_input_txt02" />
                                    </td>
                            </tr>

                                                            <tr>
                                    <td class="ui_text_rt">开始时间:</td>
                                    <td class="ui_text_lt">
                                            <input type="text" id="yunweijilukssj" name="yunweijilukssj"  value="{{ yunweijilu.kssj|date:"Y-m-d H:i" }}" class="ui_input_txt02" />
                                    </td>
                            </tr>

                                                            <tr>
                                    <td class="ui_text_rt">结束时间:</td>
                                    <td class="ui_text_lt">
                                            <input type="text" id="yunweijilujssj" name="yunweijilujssj"  value="{{ yunweijilu.jssj|date:"Y-m-d H:i" }}" class="ui_input_txt02" />
                                    </td>
                            </tr>
                            <tr>
           

<input type="text" id="yunweijiluclbf" name="yunweijiluclbf" value="{{ yunweijilu.clbf }}" class="ui_input_txt02" />

<input type="text" id="yunweijilumemo" name="yunweijilumemo" value="{{ yunweijilu.memo }}" class="ui_input_txt02" />

<option value={{ mr.id }} {% if yunweijilu.machinaroom.id == mr.id %} selected="selected" {% endif %}>{{ mr.name }}</option>

<tr>
                                    <td>&nbsp;</td>
                                    <td class="ui_text_lt">
                                            &nbsp;<input id="submitbutton" type="submit" value="提交" class="ui_input_btn01"/>
                                            &nbsp;<input id="cancelbutton" type="cancel" value="取消" class="ui_input_btn01"/>
                                    </td>
                            </tr>

                    </table>        
    </div>
    </div>