|
@@ -65,20 +65,8 @@ function initTenderTree () {
|
|
|
}
|
|
|
return tenderCategory;
|
|
|
}
|
|
|
- function calculateTender(tender) {
|
|
|
- if (tender.lastStage) {
|
|
|
- tender.gather_tp = ZhCalc.add(tender.lastStage.contract_tp, tender.lastStage.qc_tp);
|
|
|
- tender.end_contract_tp = ZhCalc.add(tender.lastStage.pre_contract_tp, tender.lastStage.contract_tp);
|
|
|
- tender.end_qc_tp = ZhCalc.add(tender.lastStage.pre_qc_tp, tender.lastStage.qc_tp);
|
|
|
- tender.end_gather_tp = ZhCalc.add(tender.end_contract_tp, tender.end_qc_tp);
|
|
|
- tender.pre_gather_tp = ZhCalc.add(tender.lastStage.pre_contract_tp, tender.lastStage.pre_qc_tp);
|
|
|
- tender.yf_tp = ZhCalc.add(tender.lastStage.yf_tp);
|
|
|
- tender.end_yf_tp = ZhCalc.add(tender.lastStage.pre_yf_tp, tender.yf_tp);
|
|
|
- }
|
|
|
- }
|
|
|
tenderTree.splice(0, tenderTree.length);
|
|
|
for (const t of tenders) {
|
|
|
- calculateTender(t);
|
|
|
t.valid = true;
|
|
|
delete t.level;
|
|
|
if (t.category && levelCategory.length > 0) {
|
|
@@ -96,8 +84,6 @@ function initTenderTree () {
|
|
|
}
|
|
|
function recursiveGetTenderNodeHtml (node, arr, pid) {
|
|
|
// console.log(node, tender)
|
|
|
- if (node.id === tender.id) return ''
|
|
|
- if (node.user_id && parseInt(node.user_id) !== cur_uid) return ''
|
|
|
const html = [];
|
|
|
html.push('<tr pid="' + pid + '">');
|
|
|
// 名称
|
|
@@ -116,7 +102,7 @@ function recursiveGetTenderNodeHtml (node, arr, pid) {
|
|
|
html.push('<td>');
|
|
|
if (!node.cid) {
|
|
|
// html.push('<input data-tid="'+ node.id +'" type="radio"> '+ (node.copy_id === tender.copy_id ? 'checked' : '') + '/>');
|
|
|
- html.push(`<input data-tid=${node.id} type="radio" ${node.id === tender.copy_id ? 'checked' : ''}>`);
|
|
|
+ html.push(`<input data-tid=${node.id} type="checkbox" ${_.findIndex(dcTenders, { tid: node.id }) === -1 ? 'checked' : ''}>`);
|
|
|
}
|
|
|
html.push('</td>');
|
|
|
html.push('</tr>');
|
|
@@ -148,38 +134,33 @@ function getTenderTreeHtml () {
|
|
|
}
|
|
|
$(document).ready(function () {
|
|
|
initTenderTree();
|
|
|
+ console.log(tenderTree);
|
|
|
const html = getTenderTreeHtml();
|
|
|
$('#copyModalContent').html(html);
|
|
|
- // $('#copyBtn').click(() => {
|
|
|
- // const html = getTenderTreeHtml();
|
|
|
- // $('#copyModalContent').html(html);
|
|
|
- // $('#bd-set-8').modal('show');
|
|
|
- // });
|
|
|
- //
|
|
|
- // $('#copyModalContent').on('click', 'input[type="radio"]', function() {
|
|
|
- // $('#copyModalContent tbody').children().each(function () {
|
|
|
- // $(this).find('input:radio').prop("checked", false);
|
|
|
- // })
|
|
|
- // $(this).prop("checked", true);
|
|
|
- // });
|
|
|
- //
|
|
|
- // $('#setting-custom').on('click', '.custom-checkbox', function () {
|
|
|
- // const isChecked = $(this).find('input').prop("checked");
|
|
|
- // $(this).find('input').prop("checked", !isChecked);
|
|
|
- // })
|
|
|
- // $('#copy_comfirm_btn').click(function() {
|
|
|
- // const type = []
|
|
|
- // $('#setting-custom').find('input:checked').each(function() {
|
|
|
- // type.push($(this).data('type'))
|
|
|
- // })
|
|
|
- // if (!type.length) {
|
|
|
- // return toastr.error('请勾选需要拷贝的属性')
|
|
|
- // }
|
|
|
- // const id = $('#copyModalContent').find('input:checked').data('tid');
|
|
|
- // if (id) {
|
|
|
- // postData(window.location.pathname + '/copy-setting', { id, type }, function() {
|
|
|
- // window.location.reload()
|
|
|
- // })
|
|
|
- // }
|
|
|
- // });
|
|
|
-})
|
|
|
+
|
|
|
+ $('#tender_dataCollect_btn').click(function () {
|
|
|
+ // 获取是否新增展示到决策大屏
|
|
|
+ const add_datacollect = $('input[name="add_datacollect"]:checked').val();
|
|
|
+ const noTidList = [];
|
|
|
+ $("#copyModalContent input[type='checkbox']:not(:checked)").each(function () {
|
|
|
+ noTidList.push($(this).data('tid'));
|
|
|
+ });
|
|
|
+ const dcTidList = _.map(dcTenders, 'tid');
|
|
|
+ let is_list_update = true;
|
|
|
+ let is_collect_update = true;
|
|
|
+ if (_.isEqual(_.sortBy(dcTidList), _.sortBy(noTidList))) {
|
|
|
+ is_list_update = false;
|
|
|
+ }
|
|
|
+ if (parseInt(add_datacollect) === addDataCollect) {
|
|
|
+ is_collect_update = false;
|
|
|
+ }
|
|
|
+ if (is_list_update || is_collect_update) {
|
|
|
+ postData('/setting/datacollect/save', { type: 'tender', add_datacollect: parseInt(add_datacollect), tids: noTidList }, function (result) {
|
|
|
+ addDataCollect = result.addDataCollect;
|
|
|
+ dcTenders = result.dcTenders;
|
|
|
+ toastr.success('修改成功');
|
|
|
+ })
|
|
|
+ }
|
|
|
+ $('#sort').modal('hide');
|
|
|
+ });
|
|
|
+});
|