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> |