TicketDescriptionTemplates版本 2版本 3 间的差异


忽略:
时间戳:
2020-02-20T22:45:32+08:00 (5年 前)
作者:
huxy
评论:

--

图例:

未修改
增加
删除
修改
  • TicketDescriptionTemplates

    v2 v3  
    1111}}}
    1212
    13 == 问题描述模板
     13== 补丁申请模板(html)
    1414{{{
    15 == 问题现象
     15<!-- html template -->
     16<style type="text/css">
     17    #panel textarea {
     18        margin: 2px;
     19        height: 85px;
     20    }
     21    #panel th {
     22        width: 58px;
     23        text-align: right;
     24        vertical-align: top;
     25        padding: 0.4em;
     26    }
     27</style>
     28<script type="text/javascript">
     29    function clearDescriptionCookie() {
     30        $.cookie("description_panel", "");
     31    }
     32
     33    function getDescriptionCookie() {
     34        return $.cookie("description_panel");
     35    }
     36
     37    function setDescriptionCookie(value) {
     38        $.cookie("description_panel", value);
     39    }
    1640
    1741
    18 == 问题场景
    19 === 硬件环境
    2042
     43    function createDescriptionPanel() {
     44        let template = '<fieldset id="panel">' + $("#panel").html() + "</fieldset>";
     45        $("#panel").remove();
     46        let description_element = $("label#field-description-help").parent();
     47        $(description_element).children().css("display", "none");
     48        $(description_element).css("display", "");
     49        $(description_element).prepend(template);
    2150
    22 == 复现步骤
     51        $(".date-picker").datepicker({
     52            changeMonth: true,
     53            changeYear: true
     54        });
     55        $(".date-picker").datepicker("option", "dateFormat", "yy-mm-dd");
    2356
     57        if (window.location.href.split(window.location.host)[1] != $("#propertyform").attr("action")) {
     58            clearDescriptionCookie();
     59        }
    2460
    25 == 出错信息
    26 {{{
    27 串口打印
     61        $("#developer-resolve-date").val("[=#developer-resolve-date]");
     62
     63        let description_panel = getDescriptionCookie();
     64        if (description_panel != undefined && description_panel != "") {
     65            let panel_info = JSON.parse(description_panel);
     66            $("#panel table label").each(function(index, element) {
     67                let text_element = $(element).parent().next("td").find("input:text")[0];
     68                if (text_element == undefined) {
     69                    text_element = $(element).parent().next("td").find("textarea")[0];
     70                }
     71                if ($(text_element).attr("class") != undefined && $(text_element).attr("class").match(/date-picker/) != null)
     72                    $(text_element).datepicker("setDate", panel_info[index]);
     73                else
     74                    $(text_element).val(panel_info[index]);
     75            });
     76        }
     77
     78        function updateDescriptionForServer() {
     79            let data = populateDescription();
     80            if (data != null) {
     81                setDescriptionCookie(data.panel_info);
     82                $("#field-description").val(data.description);
     83            }
     84        }
     85
     86        $("input:submit[name='preview']").click(function() {
     87            updateDescriptionForServer();
     88        });
     89
     90        $("input:submit[name='submit']").click(function() {
     91            updateDescriptionForServer();
     92        });
     93    }
     94
     95    function populateDescription() {
     96        let boundary = "|------";
     97
     98        let panel_info = [];
     99        let description = "";
     100        $("#panel tr").each(function(index, element) {
     101            let labels = $(element).find("th label");
     102            let row_data = [];
     103            let title = $(element).attr("title");
     104            description += "== " + title + "\n";
     105
     106            if (labels.length == 1) {
     107                let value = $(element).find("td").children("input:text").val();
     108                if (value == undefined) {
     109                    value = $(element).find("td").children("textarea").val();
     110                }
     111                if (title == "出错日志")
     112                    description += "{{{\n" + value + "\n}}}\n";
     113                else
     114                    description += value + "\n";
     115                panel_info.push(value);
     116            } else {
     117                let values = $(element).find("td input:text");
     118                for (let i = 0; i < labels.length; i++) {
     119                    let input_val = $(values.get(i)).val();
     120                    description += "- " + $(labels.get(i)).text() + input_val + "\n";
     121                    panel_info.push(input_val);
     122                }
     123            }
     124            description += boundary + "\n";
     125        });
     126        return {panel_info: JSON.stringify(panel_info), description: description};
     127    }
     128</script>
     129<fieldset id="panel">
     130    <table>
     131        <tbody>
     132            <tr title="问题描述">
     133                <th><label>问题描述:</label></th>
     134                <td colspan="5"><textarea style=""></textarea></td>
     135            </tr>
     136            <tr title="问题场景">
     137                <th><label>问题场景:</label></th>
     138                <td colspan="5"><textarea></textarea></td>
     139            </tr>
     140            <tr title="复现步骤">
     141                <th><label>复现步骤:</label></th>
     142                <td colspan="5"><textarea></textarea></td>
     143            </tr>
     144            <tr title="出错日志">
     145                <th><label>出错日志:</label></th>
     146                <td colspan="5"><textarea></textarea></td>
     147            </tr>
     148            <tr title="初步定位">
     149                <th><label>初步定位:</label></th>
     150                <td colspan="5"><textarea></textarea></td>
     151            </tr>
     152            <tr title="问题处理时间段">
     153                <th><label>发现日期:</label></th>
     154                <td><input type="text" id="issue-occur-date" class="date-picker"></td>
     155                <th style="width: 85px;padding-left: 10px;"><label>期望解决日期:</label></th>
     156                <td><input type="text" id="issue-resolve-date" class="date-picker"></td>
     157                <th style="display: none"><label>开发人员预期解决日期:</label></th>
     158                <td style="display: none"><input type="text" id="developer-resolve-date"></td>
     159            </tr>
     160            <tr title="联系人信息">
     161                <th style="width: 72px;"><label>沟通联系人:</label></th>
     162                <td><input type="text"></td>
     163                <th><label>电话:</label></th>
     164                <td><input type="text"></td>
     165                <th><label>邮箱:</label></th>
     166                <td><input type="text"></td>
     167            </tr>
     168        </tbody>
     169    </table>
     170</fieldset>
    28171}}}
    29 
    30 == 初步定位
    31 1. xxx
    32 1. xxx
    33 1. xxx
    34 
    35 }}}