| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716 | /** * 标段相关js * * @author CaiAoLin * @date 2018/2/5 * @version */// 属性function loadCommonProperty () {    // 合同信息    $('#build-name').val(property.deal_info.buildName);    $('#deal-code').val(property.deal_info.dealCode);    $('#deal-name').val(property.deal_info.dealName);    // 参建单位    // 建设单位    $('#build-company').val(property.construction_unit.build.company);    $('#build-corporation').val(property.construction_unit.build.corporation);    $('#build-date').val(property.construction_unit.build.date);    // 承包单位1    $('#contract1-company').val(property.construction_unit.contract1.company);    $('#contract1-corporation').val(property.construction_unit.contract1.corporation);    $('#contract1-date').val(property.construction_unit.contract1.date);    // 承包单位2    $('#contract2-company').val(property.construction_unit.contract2.company);    $('#contract2-corporation').val(property.construction_unit.contract2.corporation);    $('#contract2-date').val(property.construction_unit.contract2.date);    // 监理单位1    $('#supervision1-company').val(property.construction_unit.supervision1.company);    $('#supervision1-corporation').val(property.construction_unit.supervision1.corporation);    $('#supervision1-date').val(property.construction_unit.supervision1.date);    // 监理单位2    $('#supervision2-company').val(property.construction_unit.supervision2.company);    $('#supervision2-corporation').val(property.construction_unit.supervision2.corporation);    $('#supervision2-date').val(property.construction_unit.supervision2.date);    // 技术参数    $('#loadLevel').val(property.tech_param.loadLevel);    $('#length').val(property.tech_param.loadLength);    $('#start-peg').val(property.tech_param.startPeg);    $('#end-peg').val(property.tech_param.endPeg);    $('#lane-count').val(property.tech_param.laneCount);    $('#deal-period').val(property.tech_param.dealPeriod);    $('#start-date').val(property.tech_param.startDate);    $('#plan-end-date').val(property.tech_param.planEndDate);}// 小数位数function loadCalculateProperty () {    $('#decimal-up').val(property.decimal.up);    $('#decimal-tp').val(property.decimal.tp);    $('#decimal-pay')[0].checked = property.decimal.pay;    $('#decimal-pay-tp').val(property.decimal.payTp);}// 显示设置function loadDisplayProperty () {    $('#ledger-dgn-qty')[0].checked = property.display.ledger.dgnQty;    $('#ledger-cl-qty')[0].checked = property.display.ledger.clQty;}// 设置某个div下全部的input、select是否只读function setReadOnly(obj, readOnly) {    if (readOnly) {        $('input', obj).attr('readonly', '');        $('select', obj).attr('disabled', '');        $('input[type=checkbox]', obj).attr('disabled', '');    } else {        $('input', obj).removeAttr('readonly');        $('select', obj).removeAttr('disabled');        $('input[type=checkbox]', obj).removeAttr('disabled');    }}// 根据Min Max限制Input输入function limitInputMinMax (obj) {    if (_.toNumber(obj.value) > _.toNumber(obj.max)) {        obj.value = obj.max;    }    if(_.toNumber(obj.value) < _.toNumber(obj.min)) {        obj.value = obj.min;    }}// 根据Maxlength限制input输入function limitMaxLength (obj) {    if (obj.value.length > obj.maxLength) {        obj.value = obj.value.substr(0, obj.maxLength);    }}// 根据正则限制输入function limitReg(obj, reg) {    obj.value = obj.value.replace(reg, '');}// 小数位数 input 输入限制function limitDecimal(obj) {    limitReg(obj, /[^\d]/g);    limitMaxLength(obj);    limitInputMinMax(obj);}function limitDealParamLength(obj) {    limitReg(obj, /[^\d\.]/g); // 过滤数字和.    limitReg(obj, /\.{2,}/g); // 过滤第二个.    limitInputMinMax(obj);}function checkNumberValid(obj) {    const value = _.toNumber(obj.value);    obj.value = value ? value : '';}$(document).ready(function() {    // 清单精度    const precisionObj = (function () {        const spread = SpreadJsObj.createNewSpread($('#precision-spread')[0]);        spread.options.showVerticalScrollbar = false;        spread.options.showHorizontalScrollbar = false;        const sheet = spread.getActiveSheet();        SpreadJsObj.protectedSheet(sheet);        sheet.options.rowHeaderVisible = false;        sheet.options.colHeaderVisible = false;        const vStyle = new spreadNS.Style();        vStyle.font = '12px 微软雅黑';        sheet.setDefaultStyle(vStyle, spreadNS.SheetArea.viewport);        SpreadJsObj.massOperationSheet(sheet, function () {            sheet.defaults.rowHeight = 25;            sheet.setColumnCount(3);            sheet.setRowCount(14);            sheet.setColumnWidth(0, 1);            sheet.setColumnWidth(1, 100);            sheet.setColumnWidth(2, 60);            sheet.setRowHeight(0, 1);            sheet.getRange(1, 1, 14, 1).vAlign(1).backColor('#e4e7ea').locked(true);            sheet.getRange(1, 2, 14, 1).vAlign(1).hAlign(2).locked(true);            sheet.setText(1, 1, 't');            sheet.setText(2, 1, 'km');            sheet.setText(3, 1, 'm');            sheet.setText(4, 1, 'm2');            sheet.setText(5, 1, 'm3');            sheet.setText(6, 1, 'kg');            sheet.setText(7, 1, '个');            sheet.setText(8, 1, '台');            sheet.setText(9, 1, '套');            sheet.setText(10, 1, '棵');            sheet.setText(11, 1, '组');            sheet.setText(12, 1, '系统');            sheet.setText(13, 1, '其他未列单位');            const lineBorder = new spreadNS.LineBorder('#6a696e', spreadNS.LineStyle.thin);            sheet.getRange(0, 0, 14, 3).setBorder(lineBorder, {all: true});            sheet.getRange(0, 0, 14, 3).formatter('@');            sheet.setSelection(1, 2, 1, 1);        });        spread.bind(spreadNS.Events.EditEnded, function (e, info) {            const value = _.toNumber(info.editingText);            if (!_.isInteger(value)) {                toastr.warning('请输入0-6的整数');                sheet.setText(info.row, info.col, '0');            } else if (value > 6) {                toastr.warning('请输入0-6的整数');                sheet.setText(info.row, info.col, '6');            } else if (value < 0) {                toastr.warning('请输入0-6的整数');                sheet.setText(info.row, info.col, '0');            }        });        SpreadJsObj.addDeleteBind(spread, function (sheet) {            const sel = sheet.getSelections()[0];            let calc = false;            if (sel) {                for (let iRow = sel.row, iRowLength = sel.row + sel.rowCount; iRow < iRowLength; iRow++) {                    if (iRow === 3) continue;                    for (let iCol = sel.col, iColLength = sel.col + sel.colCount; iCol < iColLength; iCol++) {                        if (iCol !== 2) continue;                        sheet.setText(iRow, iCol, '0');                        if (iRow === 1 || iRow === 2) calc = true;                    }                }            }            if (calc) calcHtjMinusZlj();        });        spread.bind(spreadNS.Events.ClipboardPasted, function (e, info) {            let bHint = false;            for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {                const curRow = info.cellRange.row + iRow;                for (let iCol = 0; iCol < info.cellRange.colCount; iCol++) {                    const curCol = info.cellRange.col + iCol;                    const value = _.toNumber(info.sheet.getText(curRow, curCol));                    if (_.isNaN(value) || !_.isInteger(value)) {                        bHint = true;                        info.sheet.setText(curRow, curCol, '0');                    } else if (value > 6) {                        bHint = true;                        info.sheet.setText(curRow, curCol, '6');                    } else if (value < 0) {                        bHint = true;                        info.sheet.setText(curRow, curCol, '0');                    }                }            }            if (bHint) {                toastr.warning('请输入0-6的整数');            }        });        function loadPrecisonProperty() {            $('#hint-3').hide();            sheet.setValue(1, 2, property.precision.t.value);            sheet.setValue(2, 2, property.precision.km.value);            sheet.setValue(3, 2, property.precision.m.value);            sheet.setValue(4, 2, property.precision.m2.value);            sheet.setValue(5, 2, property.precision.m3.value);            sheet.setValue(6, 2, property.precision.kg.value);            sheet.setValue(7, 2, property.precision.ge.value);            sheet.setValue(8, 2, property.precision.tai.value);            sheet.setValue(9, 2, property.precision.tao.value);            sheet.setValue(10, 2, property.precision.ke.value);            sheet.setValue(11, 2, property.precision.zu.value);            sheet.setValue(12, 2, property.precision.xitong.value);            sheet.setValue(13, 2, property.precision.other.value);        }        function setReadOnly(readOnly) {            sheet.getRange(1, 2, 14, 1).locked(readOnly);        }        function getNewPrecisionData() {            const precision = JSON.parse(JSON.stringify(property.precision));            precision.t.value = _.toNumber(sheet.getText(1, 2));            precision.km.value = _.toNumber(sheet.getText(2, 2));            precision.m.value = _.toNumber(sheet.getText(3, 2));            precision.m2.value = _.toNumber(sheet.getText(4, 2));            precision.m3.value = _.toNumber(sheet.getText(5, 2));            precision.kg.value = _.toNumber(sheet.getText(6, 2));            precision.ge.value = _.toNumber(sheet.getText(7, 2));            precision.tai.value = _.toNumber(sheet.getText(8, 2));            precision.tao.value = _.toNumber(sheet.getText(9, 2));            precision.ke.value = _.toNumber(sheet.getText(10, 2));            precision.zu.value = _.toNumber(sheet.getText(11, 2));            precision.xitong.value = _.toNumber(sheet.getText(12, 2));            precision.other.value = _.toNumber(sheet.getText(13, 2));            return precision;        }        function checkPrecisionMinLimit(precision, limit) {            for (const unit of precision) {                if (precision[unit].value < limit[unit].value) {                    if (precision[unit].unit) {                        toastr.warning('台账已审批通过,清单精度不可减少,单位为' + limit[unit].unit + '的清单的精度不可小于' + limit[unit].value);                    } else {                        toastr.warning('台账已审批通过,清单精度不可减少,其他清单的精度不可小于' + limit[unit].value);                    }                    return false;                }            }            return true;        };        return {loadPrecisonProperty, setReadOnly, getNewPrecisionData, checkPrecisionMinLimit};    })();    // 合同参数    const dealObj = (function () {        const spread = SpreadJsObj.createNewSpread($('#param-spread')[0]);        spread.options.showVerticalScrollbar = false;        spread.options.showHorizontalScrollbar = false;        const sheet = spread.getActiveSheet();        SpreadJsObj.protectedSheet(sheet);        const vStyle = new spreadNS.Style();        vStyle.font = '12px 微软雅黑';        sheet.setDefaultStyle(vStyle, spreadNS.SheetArea.viewport);        SpreadJsObj.massOperationSheet(sheet, function () {            sheet.options.rowHeaderVisible = false;            sheet.options.colHeaderVisible = false;            sheet.defaults.rowHeight = 25;            sheet.setColumnCount(3);            sheet.setRowCount(6);            sheet.setColumnWidth(0, 1);            sheet.setColumnWidth(1, 200);            sheet.setColumnWidth(2, 200);            sheet.setRowHeight(0, 1);            sheet.getRange(1, 1, 5, 1).vAlign(1).backColor('#e4e7ea').locked(true);            sheet.getRange(1, 2, 5, 1).vAlign(1).hAlign(2).locked(true);            sheet.setText(1, 1, '签约合同价');            sheet.setText(2, 1, '暂列金额');            sheet.setText(3, 1, '签约合同价(不含暂列金)');            sheet.setText(4, 1, '签约开工预付款');            sheet.setText(5, 1, '签约材料预付款');            const lineBorder = new spreadNS.LineBorder('#6a696e', spreadNS.LineStyle.thin);            sheet.getRange(0, 0, 6, 3).setBorder(lineBorder, {all: true});            sheet.getRange(0, 0, 6, 3).formatter('@');            sheet.setSelection(1, 2, 1, 1);        });        function calcHtjMinusZlj() {            const htj = _.toNumber(sheet.getText(1, 2));            const zlj = _.toNumber(sheet.getText(2, 2));            sheet.setValue(3, 2, accSub(zlj, htj));        }        spread.bind(spreadNS.Events.EditEnded, function (e, info) {            const value = _.toNumber(info.editingText);            if (_.isNaN(value)) {                toastr.warning('请输入不超过万亿的数字');                info.sheet.setText(info.row, info.col, '0');            } else if (value > Math.pow(10, 13)) {                toastr.warning('请输入不超过万亿的数字');                info.sheet.setText(info.row, info.col, '0');            }            if (info.row === 1 || info.row === 2) {                calcHtjMinusZlj();            }        });        SpreadJsObj.addDeleteBind(spread, function (sheet) {            const sel = sheet.getSelections()[0];            let calc = false;            if (sel) {                for (let iRow = sel.row, iRowLength = sel.row + sel.rowCount; iRow < iRowLength; iRow++) {                    if (iRow === 3) continue;                    for (let iCol = sel.col, iColLength = sel.col + sel.colCount; iCol < iColLength; iCol++) {                        if (iCol !== 2) continue;                        sheet.setText(iRow, iCol, '0');                        if (iRow === 1 || iRow === 2) calc = true;                    }                }            }            if (calc) calcHtjMinusZlj();        });        spread.bind(spreadNS.Events.ClipboardPasted, function (e, info) {            let bHint = false;            for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {                const curRow = info.cellRange.row + iRow;                for (let iCol = 0; iCol < info.cellRange.colCount; iCol++) {                    const curCol = info.cellRange.col + iCol;                    const value = _.toNumber(info.sheet.getText(curRow, curCol));                    if (_.isNaN(value) || value > Math.pow(10, 13)) {                        bHint = true;                        info.sheet.setText(curRow, curCol, '0');                    }                }            }            if (bHint) {                toastr.warning('请输入不超过万亿的数字');            }            calcHtjMinusZlj();        });        function loadDealProperty() {            $('#hint-4').hide();            sheet.setValue(1, 2, property.deal_param.contractPrice);            sheet.setValue(2, 2, property.deal_param.zanLiePrice);            sheet.setValue(3, 2, accSub(property.deal_param.zanLiePrice, property.deal_param.contractPrice));            sheet.setValue(4, 2, property.deal_param.startAdvance);            sheet.setValue(5, 2, property.deal_param.materialAdvance);        }        function setReadOnly (readOnly) {            sheet.getCell(1, 2).locked(readOnly);            sheet.getCell(2, 2).locked(readOnly);            sheet.getCell(4, 2).locked(readOnly);            sheet.getCell(5, 2).locked(readOnly);        }        function getNewDealData () {            const result = {};            result.contractPrice = _.toNumber(sheet.getText(1, 2));            result.zanLiePrice = _.toNumber(sheet.getText(2, 2));            result.startAdvance = _.toNumber(sheet.getText(4, 2));            result.materialAdvance = _.toNumber(sheet.getText(5, 2));            return result;        }        return { loadDealProperty, setReadOnly, getNewDealData, };    })();    // 章节设置    const chapterObj = (function () {        const spreadSetting = {            cols: [                {title: '章节', colSpan: '1', rowSpan: '1', field: 'code', hAlign: 0, width: 100, formatter: '@', readOnly: true},                {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 230, formatter: '@', readOnly: true},            ],            emptyRows: 0,            headRows: 1,            headRowHeight: [32],            defaultRowHeight: 21,            headerFont: '12px 微软雅黑',            font: '12px 微软雅黑',        };        const spread = SpreadJsObj.createNewSpread($('#chapter-spread')[0]);        spread.options.showVerticalScrollbar = false;        spread.options.showHorizontalScrollbar = false;        SpreadJsObj.initSheet(spread.getActiveSheet(), spreadSetting);        function checkSheetData(sheet) {            let hint = '';            for (let iRow = 0; iRow < sheet.getRowCount(); iRow++) {                const cell = sheet.getCell(iRow, 1);                const defaultStype = sheet.getDefaultStyle();                if (cell.text().length > 50) {                    cell.backColor('#f8d7da');                    hint = '章节名称的长度超出范围,请重新输入';                } else {                    cell.backColor(defaultStype.backColor);                }            }            if (hint === '') {                $('#hint-6').hide();            } else {                $('#hint-6').html('<i class="fa fa-smile-o mr-2"></i>' + hint).show();            }        }        spread.bind(spreadNS.Events.EditEnding, function (e, info) {            checkSheetData(info.sheet);        });        spread.bind(spreadNS.Events.ClipboardPasted, function (e, info) {            checkSheetData(info.sheet);        });        function loadChapterProperty() {            SpreadJsObj.loadSheetData(spread.getActiveSheet(), SpreadJsObj.DataType.Data, property.chapter);            $('#hint-6').hide();            const sheet = spread.getActiveSheet();            const defaultStype = sheet.getDefaultStyle();            sheet.getRange(0, 0, sheet.getRowCount(), sheet.getColumnCount()).backColor(defaultStype.backColor);        }        function setReadOnly(readOnly) {            SpreadJsObj.resetFieldReadOnly(spread.getActiveSheet(), 'name', readOnly);        }        function getNewChapterData() {            const result = [];            const sheet = spread.getActiveSheet();            for (let iRow = 0; iRow < sheet.getRowCount(); iRow++) {                const data = {};                for (let iCol = 0; iCol < sheet.getColumnCount(); iCol++) {                    const col = spreadSetting.cols[iCol];                    data[col.field] = sheet.getText(iRow, iCol);                    if (col.field === 'name') {                        if (data.name.length > 50) {                            return null;                        }                    }                }                result.push(data);            }            return result;        }        return { loadChapterProperty, setReadOnly, getNewChapterData, }    })();    // 标段属性    function loadTenderProperty() {        // 加载属性        loadCommonProperty();        loadCalculateProperty();        precisionObj.loadPrecisonProperty();        dealObj.loadDealProperty();        loadDisplayProperty();        chapterObj.loadChapterProperty();        // 设置只读        setReadOnly('#shuxing', true);    }    loadTenderProperty();    /**     * 属性     */    // 编辑    $('#edit-1').click(() => {        setReadOnly('#v-pills-1', false);        $('#post-1').parent().show();        $('#edit-1').parent().hide();    });    // 取消    $('#cancel-1').click(() => {        setReadOnly('#v-pills-1', true);        loadCommonProperty();        $('#post-1').parent().hide();        $('#edit-1').parent().show();    });    // 提交    $('#post-1').click(() => {        const prop = {            deal_info: {                buildName: $('#build-name').val(),                dealCode: $('#deal-code').val(),                dealName: $('#deal-name').val(),            },            construction_unit: {                build: {                    company: $('#build-company').val(),                    corporation: $('#build-corporation').val(),                    date: $('#build-date').val(),                },                contract1: {                    company: $('#contract1-company').val(),                    corporation: $('#contract1-corporation').val(),                    date: $('#contract1-date').val(),                },                contract2: {                    company: $('#contract2-company').val(),                    corporation: $('#contract2-corporation').val(),                    date: $('#contract2-date').val(),                },                supervision1: {                    company: $('#supervision1-company').val(),                    corporation: $('#supervision1-corporation').val(),                    date: $('#supervision1-date').val(),                },                supervision2: {                    company: $('#supervision2-company').val(),                    corporation: $('#supervision2-corporation').val(),                    date: $('#supervision2-date').val(),                },            },            tech_param: {                loadLevel: _.toNumber($('#loadLevel').val()),                loadLength: _.toNumber($('#length').val()),                startPeg: $('#start-peg').val(),                endPeg: $('#end-peg').val(),                laneCount: _.toNumber($('#lane-count').val()),                dealPeriod: $('#deal-period').val(),                startDate: $('#start-date').val(),                planEndDate: $('#plan-end-date').val(),            }        };        const tenderId = window.location.pathname.split('/')[2];        postData('/tender/' + tenderId + '/save', prop, function (data) {            setReadOnly('#v-pills-1', true);            property.deal_info = data.deal_info;            property.construction_unit = data.construction_unit;            property.tech_param = data.tech_param;            $('#post-1').parent().hide();            $('#edit-1').parent().show();        });    });    /**     * 计算参数      */    // 编辑    $('#edit-2').click(() => {        setReadOnly('#v-pills-2', false);        $('#post-2').parent().show();        $('#edit-2').parent().hide();    });    // 取消    $('#cancel-2').click(() => {        setReadOnly('#v-pills-2', true);        loadCalculateProperty();        $('#post-2').parent().hide();        $('#edit-2').parent().show();    });    // 提交    $('#post-2').click(() => {        const prop = {            decimal: {                up: _.toNumber($('#decimal-up').val()),                tp: _.toNumber($('#decimal-tp').val()),                pay: $('#decimal-pay')[0].checked,                payTp: _.toNumber($('#decimal-pay-tp').val()),            }        };        if (ledgerChecked) {            if (prop.decimal.up < property.decimal.up) {                toastr.warning('台账已审批完成,单价的小数位数,不可小于' + property.decimal.up);                return;            }            if (prop.decimal.tp < property.decimal.tp) {                toastr.warning('台账已审批完成,金额的小数位数,不可小于' + property.decimal.tp);                return;            }        }        if (firstStageChecked) {            if (property.decimal.pay) {                if (!prop.decimal.pay) {                    toastr.warning('第一期已审批完成,不可取消合同支付单独设置');                    return;                }                if (prop.decimal.payTp < property.decimal.payTp) {                    toastr.warning('第一期已审批完成,单独设置的合同支付小数位数,不可小于' + property.decimal.payTp);                    return;                }            } else {                if (prop.decimal.pay) {                    toastr.warning('第一期已审批完成,合同支付不可单独设置');                    return;                }            }        }        if (ledgerChecked && !precisionObj.checkPrecisionMinLimit(prop.decimal, property.decimal)) return;        const tenderId = window.location.pathname.split('/')[2];        postData('/tender/' + tenderId + '/save', prop, function (data) {            setReadOnly('#v-pills-2', true);            property.decimal = data.decimal;            $('#post-2').parent().hide();            $('#edit-2').parent().show();        }, null, true);    });    /**     * 清单精度     */    // 编辑    $('#edit-3').click(() => {        precisionObj.setReadOnly(false);        $('#post-3').parent().show();        $('#edit-3').parent().hide();    });    // 取消    $('#cancel-3').click(() => {        precisionObj.setReadOnly(true);        precisionObj.loadPrecisonProperty();        $('#post-3').parent().hide();        $('#edit-3').parent().show();    });    // 提交    $('#post-3').click(() => {        const prop = { precision: precisionObj.getNewPrecisionData() };        if (ledgerChecked && !precisionObj.checkPrecisionMinLimit(prop.precision, property.precision)) return;        const tenderId = window.location.pathname.split('/')[2];        postData('/tender/' + tenderId + '/save', prop, function (data) {            precisionObj.setReadOnly(true);            property.precision = data.precision;            $('#post-3').parent().hide();            $('#edit-3').parent().show();        }, null, true);    });    /**     * 合同参数     */    // 编辑    $('#edit-4').click(() => {        dealObj.setReadOnly(false);        $('#post-4').parent().show();        $('#edit-4').parent().hide();    });    // 取消    $('#cancel-4').click(() => {        dealObj.setReadOnly(true);        dealObj.loadDealProperty();        $('#post-4').parent().hide();        $('#edit-4').parent().show();    });    // 提交    $('#post-4').click(() => {        const prop = { deal_param: dealObj.getNewDealData() };        const tenderId = window.location.pathname.split('/')[2];        postData('/tender/' + tenderId + '/save', prop, function (data) {            dealObj.setReadOnly(true);            property.deal_param = data.deal_param;            $('#post-4').parent().hide();            $('#edit-4').parent().show();            dealObj.loadDealProperty();        });    });    /**     * 显示设置     */    // 编辑    $('#edit-5').click(() => {        setReadOnly('#v-pills-5', false);        $('#post-5').parent().show();        $('#edit-5').parent().hide();    });    // 取消    $('#cancel-5').click(() => {        setReadOnly('#v-pills-5', true);        loadDisplayProperty();        $('#post-5').parent().hide();        $('#edit-5').parent().show();    });    // 提交    $('#post-5').click(() => {        const prop = {            display: {                ledger: { dgnQty: $('#ledger-dgn-qty')[0].checked, clQty: $('#ledger-cl-qty')[0].checked, },            },        };        const tenderId = window.location.pathname.split('/')[2];        postData('/tender/' + tenderId + '/save', prop, function (data) {            setReadOnly('#v-pills-5', true);            property.display = data.display;            $('#post-5').parent().hide();            $('#edit-5').parent().show();        });    });    /**     * 章节设置     */    // 编辑    $('#edit-6').click(() => {        chapterObj.setReadOnly(false);        $('#post-6').parent().show();        $('#edit-6').parent().hide();    });    // 取消    $('#cancel-6').click(() => {        chapterObj.loadChapterProperty();        chapterObj.setReadOnly(true);        $('#hint-6').hide();        $('#post-6').parent().hide();        $('#edit-6').parent().show();    });    // 提交    $('#post-6').click(() => {        const chapter = chapterObj.getNewChapterData();        if (!chapter) { return; }        const tenderId = window.location.pathname.split('/')[2];        postData('/tender/' + tenderId + '/save', { chapter: chapter }, function (data) {            chapterObj.setReadOnly(true);            property.chapter = data.chapter;            $('#post-6').parent().hide();            $('#edit-6').parent().show();        });    });});
 |