TicketDescriptionTemplates 的 版本 5 与 版本 6 间的差异
- 时间戳:
- 2020-02-27T22:19:09+08:00 (5年 前)
图例:
- 未修改
- 增加
- 删除
- 修改
-
TicketDescriptionTemplates
v5 v6 21 21 .required-field-label { 22 22 color: red; 23 font-size: 0.6em;24 23 } 25 24 input.date-picker { … … 86 85 if (element.length != 0) { 87 86 let text = element.html().replace(':', ''); 88 element.html(`${text} <span class="required-field-label"> (必填)</span>:`);87 element.html(`${text} <span class="required-field-label">*</span>:`); 89 88 } 90 89 $(`#${required_fields[i]}`).attr("class", "required-field"); … … 145 144 if (found_empty_field) { 146 145 event.preventDefault(); 147 alert('有必填项为空,请补充 ');146 alert('有必填项为空,请补充。带 * 的为必填项。'); 148 147 } 149 148 let data = populateDescription(); … … 168 167 let panel_info = []; 169 168 let description = ""; 169 let exchange_tags = [] 170 170 $(".panel-row").each(function(index, element) { 171 171 let labels = $(element).find("th label"); … … 188 188 for (let i = 0; i < labels.length; i++) { 189 189 let label_name = $(labels.get(i)).text(); 190 label_name = label_name.replace(/\s*\ (必填\)/, '');190 label_name = label_name.replace(/\s*\*/, ''); 191 191 let input_val = $(values.get(i)).val(); 192 description += "- " + label_name + input_val + "\n"; 192 let label_class = $(labels.get(i)).attr("class"); 193 let tag = null; 194 if (label_class != undefined) { 195 let matched = label_class.match(/exchange-\d+/); 196 if (matched != null) { 197 tag = matched[0]; 198 exchange_tags.push(tag); 199 } 200 } 201 if (tag != null) 202 description += `- <${tag}>${label_name}${input_val}</${tag}>\n`; 203 else 204 description += `- ${label_name}${input_val}\n`; 193 205 panel_info.push(input_val); 194 206 } … … 196 208 description += boundary + "\n"; 197 209 }); 210 211 for (let i = 0; i < exchange_tags.length; i++) { 212 let tag = exchange_tags[i]; 213 let tag_pattern = new RegExp(`<${tag}>.*</${tag}>`, 'g'); 214 let content_pattern = new RegExp(`<${tag}>(.*)</${tag}>`); 215 let matched = description.match(tag_pattern); 216 if (matched != null) { 217 description = description.replace(matched[0], matched[1].match(content_pattern)[1]); 218 description = description.replace(matched[1], matched[0].match(content_pattern)[1]); 219 } 220 } 198 221 return {panel_info: JSON.stringify(panel_info), description: description}; 199 222 } … … 202 225 <tbody> 203 226 <tr title="问题描述" class="panel-row"> 204 <th><label>问题描述 <span class="required-field-label"> (必填)</span>:</label></th>227 <th><label>问题描述 <span class="required-field-label">*</span>:</label></th> 205 228 <td colspan="5"><textarea class="required-field"></textarea></td> 206 229 </tr> 207 230 <tr title="问题场景" class="panel-row"> 208 <th><label>问题场景 <span class="required-field-label"> (必填)</span>:</label></th>231 <th><label>问题场景 <span class="required-field-label">*</span>:</label></th> 209 232 <td colspan="5"><textarea class="required-field"></textarea></td> 210 233 </tr> 211 234 <tr title="复现步骤" class="panel-row"> 212 <th><label>复现步骤 <span class="required-field-label"> (必填)</span>:</label></th>235 <th><label>复现步骤 <span class="required-field-label">*</span>:</label></th> 213 236 <td colspan="5"><textarea class="required-field"></textarea></td> 214 237 </tr> … … 222 245 </tr> 223 246 <tr title="问题处理时间段" class="panel-row"> 224 <th><label>发现日期 <span class="required-field-label"> (必填)</span>:</label></th>247 <th><label>发现日期 <span class="required-field-label">*</span>:</label></th> 225 248 <td><input type="text" id="issue-occur-date" class="date-picker required-field"></td> 226 <th><label >期望解决日期 <span class="required-field-label">(必填)</span>:</label></th>227 <td><input type="text" id="issue-resolve-date" class="date-picker required-field"></td>249 <th><label class="exchange-1">沟通联系人:</label></th> 250 <td><input type="text"></td> 228 251 <th style="display: none"><label>开发人员预期解决日期:</label></th> 229 252 <td style="display: none"><input type="text" id="developer-resolve-date"></td> 230 253 </tr> 231 254 <tr title="联系人信息" class="panel-row"> 232 <th><label >沟通联系人:</label></th>233 <td><input type="text" ></td>255 <th><label class="exchange-1">期望解决日期 <span class="required-field-label">*</span>:</label></th> 256 <td><input type="text" id="issue-resolve-date" class="date-picker required-field"></td> 234 257 <th><label>电话:</label></th> 235 258 <td><input type="text"></td>