TicketDescriptionTemplates版本 5版本 6 间的差异


忽略:
时间戳:
2020-02-27T22:19:09+08:00 (5年 前)
作者:
huxy
评论:

--

图例:

未修改
增加
删除
修改
  • TicketDescriptionTemplates

    v5 v6  
    2121    .required-field-label {
    2222        color: red;
    23         font-size: 0.6em;
    2423    }
    2524    input.date-picker {
     
    8685            if (element.length != 0) {
    8786                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>:`);
    8988            }
    9089            $(`#${required_fields[i]}`).attr("class", "required-field");
     
    145144            if (found_empty_field) {
    146145                event.preventDefault();
    147                 alert('有必填项为空,请补充');
     146                alert('有必填项为空,请补充。带 * 的为必填项。');
    148147            }
    149148            let data = populateDescription();
     
    168167        let panel_info = [];
    169168        let description = "";
     169        let exchange_tags = []
    170170        $(".panel-row").each(function(index, element) {
    171171            let labels = $(element).find("th label");
     
    188188                for (let i = 0; i < labels.length; i++) {
    189189                    let label_name = $(labels.get(i)).text();
    190                     label_name = label_name.replace(/\s*\(必填\)/, '');
     190                    label_name = label_name.replace(/\s*\*/, '');
    191191                    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`;
    193205                    panel_info.push(input_val);
    194206                }
     
    196208            description += boundary + "\n";
    197209        });
     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        }
    198221        return {panel_info: JSON.stringify(panel_info), description: description};
    199222    }
     
    202225    <tbody>
    203226        <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>
    205228            <td colspan="5"><textarea class="required-field"></textarea></td>
    206229        </tr>
    207230        <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>
    209232            <td colspan="5"><textarea class="required-field"></textarea></td>
    210233        </tr>
    211234        <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>
    213236            <td colspan="5"><textarea class="required-field"></textarea></td>
    214237        </tr>
     
    222245        </tr>
    223246        <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>
    225248            <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>
    228251            <th style="display: none"><label>开发人员预期解决日期:</label></th>
    229252            <td style="display: none"><input type="text" id="developer-resolve-date"></td>
    230253        </tr>
    231254        <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>
    234257            <th><label>电话:</label></th>
    235258            <td><input type="text"></td>