|
@@ -3,8 +3,12 @@ $(function () {
|
|
|
|
|
|
// 全选报表
|
|
|
$('#select_all_rpt_checkbox').click(function () {
|
|
|
- $('#rpt_table input[name="rptId[]"]').prop('checked', true);
|
|
|
$(this).prop('checked', false);
|
|
|
+ $('#rpt_table input[name="rptId[]"]').each(function () {
|
|
|
+ if (parseInt($(this).val()) !== -1) {
|
|
|
+ $(this).prop('checked', true);
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
$('#add_rpt_btn').click(function () {
|
|
@@ -350,5 +354,37 @@ $(function () {
|
|
|
' </span>\n' +
|
|
|
' </li>';
|
|
|
return html;
|
|
|
+ };
|
|
|
+
|
|
|
+ $('#add-rpt').on('show.bs.modal', function () {
|
|
|
+ $('#rpt-table').find('input:checked:not(:disabled)').prop('checked', false);
|
|
|
+ $('#rpt-table').find('input:not(:disabled)').each(function () {
|
|
|
+ if (_.findIndex(tenderRptList, { rpt_id: parseInt($(this).val()) }) !== -1) {
|
|
|
+ $(this).prop('checked', true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#rpt_table input').on('click', function () {
|
|
|
+ if ($(this).is(':checked') && parseInt($(this).val()) === -1) {
|
|
|
+ $(this).prop('checked', false);
|
|
|
+ const index = $("#rpt_table input").index(this);
|
|
|
+ console.log(rptProjectList[index]);
|
|
|
+ // 循环选中当前子项值
|
|
|
+ checkedRptProjectList(rptProjectList[index].items);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ function checkedRptProjectList(items) {
|
|
|
+ if (items && items.length > 0) {
|
|
|
+ for (const item of items) {
|
|
|
+ if (item.ID !== -1 && item.items === null) {
|
|
|
+ console.log(item);
|
|
|
+ $('#rpt_table input').eq(item.index).prop('checked', true);
|
|
|
+ } else {
|
|
|
+ checkedRptProjectList(item.items);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
});
|