|
@@ -109,17 +109,6 @@ function setReadOnly(obj, readOnly) {
|
|
|
$('input[type=checkbox]', obj).removeAttr('disabled');
|
|
|
}
|
|
|
}
|
|
|
-// 标段属性
|
|
|
-function loadTenderProperty() {
|
|
|
- // 加载属性
|
|
|
- loadCommonProperty();
|
|
|
- loadCalculateProperty();
|
|
|
- loadPrecisionProperty();
|
|
|
- loadDealProperty();
|
|
|
- loadDisplayProperty();
|
|
|
- // 设置只读
|
|
|
- setReadOnly('#shuxing', true);
|
|
|
-}
|
|
|
// 获取当前合同支付应该使用的小数位数
|
|
|
function getDealTpDecimal() {
|
|
|
const spec = $('#decimal-pay')[0].checked;
|
|
@@ -181,6 +170,59 @@ function checkNumberValid(obj) {
|
|
|
}
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
+ // 章节设置
|
|
|
+ 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: [40],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ };
|
|
|
+ const spread = SpreadJsObj.createNewSpread($('#chapter-spread')[0]);
|
|
|
+ spread.options.showVerticalScrollbar = false;
|
|
|
+ spread.options.showHorizontalScrollbar = false;
|
|
|
+ SpreadJsObj.initSheet(spread.getActiveSheet(), spreadSetting);
|
|
|
+
|
|
|
+ function loadChapterProperty() {
|
|
|
+ SpreadJsObj.loadSheetData(spread.getActiveSheet(), SpreadJsObj.DataType.Data, property.chapter);
|
|
|
+ }
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ result.push(data);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ return { loadChapterProperty, setReadOnly, getNewChapterData, }
|
|
|
+ })();
|
|
|
+ // 标段属性
|
|
|
+ function loadTenderProperty() {
|
|
|
+ // 加载属性
|
|
|
+ loadCommonProperty();
|
|
|
+ loadCalculateProperty();
|
|
|
+ loadPrecisionProperty();
|
|
|
+ loadDealProperty();
|
|
|
+ loadDisplayProperty();
|
|
|
+ chapterObj.loadChapterProperty();
|
|
|
+ // 设置只读
|
|
|
+ setReadOnly('#shuxing', true);
|
|
|
+ }
|
|
|
loadTenderProperty();
|
|
|
|
|
|
/**
|
|
@@ -400,6 +442,37 @@ $(document).ready(function() {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ /**
|
|
|
+ * 章节设置
|
|
|
+ */
|
|
|
+ // 编辑
|
|
|
+ $('#edit-6').click(() => {
|
|
|
+ chapterObj.setReadOnly(false);
|
|
|
+ $('#post-6').parent().show();
|
|
|
+ $('#edit-6').parent().hide();
|
|
|
+ });
|
|
|
+ // 取消
|
|
|
+ $('#cancel-6').click(() => {
|
|
|
+ chapterObj.loadChapterProperty();
|
|
|
+ chapterObj.setReadOnly(true);
|
|
|
+ $('#post-6').parent().hide();
|
|
|
+ $('#edit-6').parent().show();
|
|
|
+ });
|
|
|
+ // 提交
|
|
|
+ $('#post-6').click(() => {
|
|
|
+ const prop = {
|
|
|
+ chapter: chapterObj.getNewChapterData(),
|
|
|
+ };
|
|
|
+ const tenderId = window.location.pathname.split('/')[2];
|
|
|
+ console.log(prop);
|
|
|
+ postData('/tender/' + tenderId + '/save', prop, function (data) {
|
|
|
+ chapterObj.setReadOnly(true);
|
|
|
+ property.chapter = data.chapter;
|
|
|
+ $('#post-6').parent().hide();
|
|
|
+ $('#edit-6').parent().show();
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
//标段类型选择
|
|
|
$('#tender_type_select').change(function () {
|
|
|
const type = $(this).val() != 0 ? '/?type='+$(this).val() : '';
|