|
|
@@ -4,7 +4,11 @@
|
|
|
const locked = lockUtil.getLocked();
|
|
|
$(document).ready(function () {
|
|
|
feeItemObj.buildSheet();
|
|
|
- const lockedSpreads = [feeItemObj.workBook, sectionObj.workBook, feeRuleObj.workBook];
|
|
|
+ const lockedSpreads = [
|
|
|
+ feeItemObj.workBook,
|
|
|
+ sectionObj.workBook,
|
|
|
+ feeRuleObj.workBook,
|
|
|
+ ];
|
|
|
lockUtil.lockSpreads(lockedSpreads, locked);
|
|
|
$("#sectionTreeModal").on("shown.bs.modal", function (e) {
|
|
|
batchSectionObj.workBook.refresh();
|
|
|
@@ -31,10 +35,16 @@ $(document).ready(function () {
|
|
|
let feeItem = me.cache[row];
|
|
|
//有数据,删除数据
|
|
|
if (me.isDef(feeItem)) {
|
|
|
- fiPostData.push({ updateType: me.updateType.update, updateData: { ID: feeItem.ID, deleted: true } });
|
|
|
+ fiPostData.push({
|
|
|
+ updateType: me.updateType.update,
|
|
|
+ updateData: { ID: feeItem.ID, deleted: true },
|
|
|
+ });
|
|
|
//delete feeItem section
|
|
|
for (let section of feeItem.section) {
|
|
|
- sePostData.push({ updateType: me.updateType.update, updateData: { ID: section.ID, deleted: true } });
|
|
|
+ sePostData.push({
|
|
|
+ updateType: me.updateType.update,
|
|
|
+ updateData: { ID: section.ID, deleted: true },
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -70,17 +80,26 @@ $(document).ready(function () {
|
|
|
let sel = sels[i];
|
|
|
//delete
|
|
|
// if (sel.colCount === me.setting.header.length) {
|
|
|
- for (let j = 0, jLen = sel.rowCount; j < jLen; j++) {
|
|
|
- let row = sel.row + j;
|
|
|
- let section = me.cache[row];
|
|
|
- //有数据,删除数据
|
|
|
- if (me.isDef(section)) {
|
|
|
- sePostData.push({ updateType: me.updateType.del, updateData: { ID: section.ID, deleted: true } });
|
|
|
- fiPostData.push({ updateType: me.updateType.update, updateData: { ID: fi.currentFeeItem.ID, $pull: { section: { ID: section.ID } } } });
|
|
|
- }
|
|
|
+ for (let j = 0, jLen = sel.rowCount; j < jLen; j++) {
|
|
|
+ let row = sel.row + j;
|
|
|
+ let section = me.cache[row];
|
|
|
+ //有数据,删除数据
|
|
|
+ if (me.isDef(section)) {
|
|
|
+ sePostData.push({
|
|
|
+ updateType: me.updateType.del,
|
|
|
+ updateData: { ID: section.ID, deleted: true },
|
|
|
+ });
|
|
|
+ fiPostData.push({
|
|
|
+ updateType: me.updateType.update,
|
|
|
+ updateData: {
|
|
|
+ ID: fi.currentFeeItem.ID,
|
|
|
+ $pull: { section: { ID: section.ID } },
|
|
|
+ },
|
|
|
+ });
|
|
|
}
|
|
|
- //front delete
|
|
|
- me.cache.splice(sel.row, sel.rowCount);
|
|
|
+ }
|
|
|
+ //front delete
|
|
|
+ me.cache.splice(sel.row, sel.rowCount);
|
|
|
// }
|
|
|
}
|
|
|
//update currentSection
|
|
|
@@ -115,10 +134,73 @@ let feeItemObj = {
|
|
|
deleteType: "feeItem",
|
|
|
setting: {
|
|
|
header: [
|
|
|
- { headerName: "费用项", headerWidth: 200, dataCode: "feeItem", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center" },
|
|
|
- { headerName: "费用类型", headerWidth: 80, dataCode: "feeType", dataType: "String", hAlign: "center", vAlign: "center" },
|
|
|
- { headerName: "记取位置", headerWidth: 100, dataCode: "position", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center" },
|
|
|
- { headerName: "序号", headerWidth: 50, dataCode: "seq", dataType: "Number", hAlign: "center", vAlign: "center" },
|
|
|
+ {
|
|
|
+ headerName: "费用项",
|
|
|
+ headerWidth: 200,
|
|
|
+ dataCode: "feeItem",
|
|
|
+ dataType: "String",
|
|
|
+ formatter: "@",
|
|
|
+ hAlign: "left",
|
|
|
+ vAlign: "center",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ headerName: "费用类型",
|
|
|
+ headerWidth: 80,
|
|
|
+ dataCode: "feeType",
|
|
|
+ dataType: "String",
|
|
|
+ hAlign: "center",
|
|
|
+ vAlign: "center",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ headerName: "记取位置",
|
|
|
+ headerWidth: 100,
|
|
|
+ dataCode: "position",
|
|
|
+ dataType: "String",
|
|
|
+ formatter: "@",
|
|
|
+ hAlign: "left",
|
|
|
+ vAlign: "center",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ headerName: "序号",
|
|
|
+ headerWidth: 50,
|
|
|
+ dataCode: "seq",
|
|
|
+ dataType: "Number",
|
|
|
+ hAlign: "center",
|
|
|
+ vAlign: "center",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ headerName: "降效比例(%)",
|
|
|
+ headerWidth: 100,
|
|
|
+ dataCode: "reductionRate",
|
|
|
+ dataType: "Number",
|
|
|
+ hAlign: "right",
|
|
|
+ vAlign: "center",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ headerName: "措施比例(%)",
|
|
|
+ headerWidth: 100,
|
|
|
+ dataCode: "measureRate",
|
|
|
+ dataType: "Number",
|
|
|
+ hAlign: "right",
|
|
|
+ vAlign: "center",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ headerName: "24记取位置",
|
|
|
+ headerWidth: 100,
|
|
|
+ dataCode: "position24",
|
|
|
+ dataType: "String",
|
|
|
+ formatter: "@",
|
|
|
+ hAlign: "left",
|
|
|
+ vAlign: "center",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ headerName: "24显示",
|
|
|
+ headerWidth: 50,
|
|
|
+ dataCode: "showIn24",
|
|
|
+ dataType: "CheckBox",
|
|
|
+ hAlign: "center",
|
|
|
+ vAlign: "center",
|
|
|
+ },
|
|
|
],
|
|
|
view: { lockColumns: [] },
|
|
|
comboItems: { feeType: ["子目费用", "分项费用", "措施费用"] },
|
|
|
@@ -155,15 +237,30 @@ let feeItemObj = {
|
|
|
fr = feeRuleObj,
|
|
|
bs = batchSectionObj;
|
|
|
if (!this.isDef(this.workBook)) {
|
|
|
- this.workBook = sheetCommonObj.buildSheet($("#feeItemSpread")[0], this.setting, 10);
|
|
|
+ this.workBook = sheetCommonObj.buildSheet(
|
|
|
+ $("#feeItemSpread")[0],
|
|
|
+ this.setting,
|
|
|
+ 10
|
|
|
+ );
|
|
|
this.sheet = this.workBook.getActiveSheet();
|
|
|
- sheetCommonObj.bindEscKey(this.workBook, [{ sheet: this.sheet, editStarting: me.onEditStarting, editEnded: me.onEditEnded }]);
|
|
|
+ sheetCommonObj.bindEscKey(this.workBook, [
|
|
|
+ {
|
|
|
+ sheet: this.sheet,
|
|
|
+ editStarting: me.onEditStarting,
|
|
|
+ editEnded: me.onEditEnded,
|
|
|
+ },
|
|
|
+ ]);
|
|
|
this.setOptions(this.workBook, this.setting.options);
|
|
|
- this.sheet.options.clipBoardOptions = GC.Spread.Sheets.ClipboardPasteOptions.values;
|
|
|
+ this.sheet.options.clipBoardOptions =
|
|
|
+ GC.Spread.Sheets.ClipboardPasteOptions.values;
|
|
|
this.bindEvents(this.sheet);
|
|
|
this.rationRepId = parseInt(getQueryString("repository"));
|
|
|
//init combo
|
|
|
this.setCombo(this.sheet, 1, this.setting.comboItems.feeType);
|
|
|
+
|
|
|
+ let checkBox = new GC.Spread.Sheets.CellTypes.CheckBox();
|
|
|
+ this.sheet.getRange(-1, 7, -1, 1).cellType(checkBox);
|
|
|
+ this.workBook.bind(GC.Spread.Sheets.Events.ButtonClicked, me.onEditEnded); //复选框点击事件
|
|
|
//init sectionSpread
|
|
|
se.buildSheet();
|
|
|
//init feeRuleSpread
|
|
|
@@ -213,7 +310,11 @@ let feeItemObj = {
|
|
|
},
|
|
|
onSelectionChanged: function (sender, info) {
|
|
|
let me = feeItemObj;
|
|
|
- if (!info.oldSelections || (info.oldSelections.length === 0 && info.newSelections.length > 0) || info.oldSelections[0].row !== info.newSelections[0].row) {
|
|
|
+ if (
|
|
|
+ !info.oldSelections ||
|
|
|
+ (info.oldSelections.length === 0 && info.newSelections.length > 0) ||
|
|
|
+ info.oldSelections[0].row !== info.newSelections[0].row
|
|
|
+ ) {
|
|
|
let row = info.newSelections[0].row;
|
|
|
let node = me.cache[row];
|
|
|
me.initSelection(node);
|
|
|
@@ -227,25 +328,49 @@ let feeItemObj = {
|
|
|
let me = feeItemObj;
|
|
|
//费用类型为子目时,记取位置不可编辑
|
|
|
let feeItem = me.cache[args.row];
|
|
|
- if (me.isDef(feeItem) && (feeItem.feeType === me.feeType.ZM || !me.isDef(feeItem.feeType) || feeItem.feeType == "") && args.col === 2) {
|
|
|
+ if (
|
|
|
+ me.isDef(feeItem) &&
|
|
|
+ (feeItem.feeType === me.feeType.ZM ||
|
|
|
+ !me.isDef(feeItem.feeType) ||
|
|
|
+ feeItem.feeType == "") &&
|
|
|
+ args.col === 2
|
|
|
+ ) {
|
|
|
args.cancel = true;
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
onEditEnded: function (sender, args) {
|
|
|
debugger;
|
|
|
let me = feeItemObj,
|
|
|
se = sectionObj;
|
|
|
- let v = me.isDef(args.editingText) ? args.editingText.toString().trim() : "";
|
|
|
+ let v = me.isDef(args.editingText)
|
|
|
+ ? args.editingText.toString().trim()
|
|
|
+ : "";
|
|
|
let feeItem = me.cache[args.row];
|
|
|
let updateObj = { updateType: "", updateData: {} };
|
|
|
+ let field = me.setting.header[args.col]["dataCode"];
|
|
|
+ if (field === "showIn24") {
|
|
|
+ v = args.sheet.getValue(args.row, args.col) || false;
|
|
|
+ }
|
|
|
+
|
|
|
//update
|
|
|
if (me.isDef(feeItem)) {
|
|
|
- feeItem[me.setting.header[args.col]["dataCode"]] = !me.isDef(feeItem[me.setting.header[args.col]["dataCode"]])
|
|
|
- ? ""
|
|
|
- : feeItem[me.setting.header[args.col]["dataCode"]];
|
|
|
- if (v == feeItem[me.setting.header[args.col]["dataCode"]]) {
|
|
|
+ feeItem[field] = !me.isDef(feeItem[field]) ? "" : feeItem[field];
|
|
|
+ if (v == feeItem[field]) {
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ let orgV = feeItem[field] || "";
|
|
|
+ if (field === "reductionRate" || field === "measureRate") {
|
|
|
+ if (isNaN(v)) {
|
|
|
+ alert("只能输入数值");
|
|
|
+ me.sheet.setValue(args.row, args.col, orgV);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ v = parseFloat(v).toDecimal(2);
|
|
|
+ me.sheet.setValue(args.row, args.col, v);
|
|
|
+ }
|
|
|
+
|
|
|
updateObj.updateType = me.updateType.update;
|
|
|
//当费用类型切换为子目费用时,自动清空记取位置
|
|
|
if (args.col === 1 && v === me.feeType.ZM) {
|
|
|
@@ -278,7 +403,10 @@ let feeItemObj = {
|
|
|
},
|
|
|
onClipboardPasting: function (sender, info) {
|
|
|
let me = feeItemObj;
|
|
|
- if (info.cellRange.col + info.cellRange.colCount > me.setting.header.length) {
|
|
|
+ if (
|
|
|
+ info.cellRange.col + info.cellRange.colCount >
|
|
|
+ me.setting.header.length
|
|
|
+ ) {
|
|
|
info.cancel = true;
|
|
|
}
|
|
|
},
|
|
|
@@ -337,8 +465,26 @@ let feeItemObj = {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
|
|
|
- me.workBook.commandManager().setShortcutKey("feeItemDel", GC.Spread.Commands.Key.del, false, false, false, false);
|
|
|
+ me.workBook
|
|
|
+ .commandManager()
|
|
|
+ .setShortcutKey(
|
|
|
+ null,
|
|
|
+ GC.Spread.Commands.Key.del,
|
|
|
+ false,
|
|
|
+ false,
|
|
|
+ false,
|
|
|
+ false
|
|
|
+ );
|
|
|
+ me.workBook
|
|
|
+ .commandManager()
|
|
|
+ .setShortcutKey(
|
|
|
+ "feeItemDel",
|
|
|
+ GC.Spread.Commands.Key.del,
|
|
|
+ false,
|
|
|
+ false,
|
|
|
+ false,
|
|
|
+ false
|
|
|
+ );
|
|
|
},
|
|
|
getUpdateObj: function (updateType, data) {
|
|
|
let rst = { updateType: "", updateData: {} };
|
|
|
@@ -354,7 +500,11 @@ let feeItemObj = {
|
|
|
return false;
|
|
|
}
|
|
|
//费用类型为子目时,不可有记取位置
|
|
|
- if (pasteData.feeType === this.feeType.ZM && this.isDef(pasteData.position) && pasteData.position !== "") {
|
|
|
+ if (
|
|
|
+ pasteData.feeType === this.feeType.ZM &&
|
|
|
+ this.isDef(pasteData.position) &&
|
|
|
+ pasteData.position !== ""
|
|
|
+ ) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
@@ -362,29 +512,37 @@ let feeItemObj = {
|
|
|
},
|
|
|
getInstallation: function (rationRepId, callback) {
|
|
|
let me = this;
|
|
|
- CommonAjax.post("/rationRepository/api/getInstallation", { rationRepId: rationRepId }, function (rstData) {
|
|
|
- // 数据排序 CSL
|
|
|
- console.log(rstData);
|
|
|
- rstData.sort((a, b) => a.seq - b.seq);
|
|
|
- for (const item of rstData) {
|
|
|
- const section = item.section;
|
|
|
- section.sort((a, b) => a.seq - b.seq);
|
|
|
- }
|
|
|
- console.log(rstData);
|
|
|
+ CommonAjax.post(
|
|
|
+ "/rationRepository/api/getInstallation",
|
|
|
+ { rationRepId: rationRepId },
|
|
|
+ function (rstData) {
|
|
|
+ // 数据排序 CSL
|
|
|
+ console.log(rstData);
|
|
|
+ rstData.sort((a, b) => a.seq - b.seq);
|
|
|
+ for (const item of rstData) {
|
|
|
+ const section = item.section;
|
|
|
+ section.sort((a, b) => a.seq - b.seq);
|
|
|
+ }
|
|
|
+ console.log(rstData);
|
|
|
|
|
|
- me.cache = rstData;
|
|
|
- if (callback) {
|
|
|
- callback(rstData);
|
|
|
+ me.cache = rstData;
|
|
|
+ if (callback) {
|
|
|
+ callback(rstData);
|
|
|
+ }
|
|
|
}
|
|
|
- });
|
|
|
+ );
|
|
|
},
|
|
|
updateFeeItem: function (updateData, callback) {
|
|
|
let me = this;
|
|
|
- CommonAjax.post("/rationRepository/api/updateFeeItem", { updateData: updateData }, function (rstData) {
|
|
|
- if (callback) {
|
|
|
- callback();
|
|
|
+ CommonAjax.post(
|
|
|
+ "/rationRepository/api/updateFeeItem",
|
|
|
+ { updateData: updateData },
|
|
|
+ function (rstData) {
|
|
|
+ if (callback) {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
}
|
|
|
- });
|
|
|
+ );
|
|
|
},
|
|
|
};
|
|
|
|
|
|
@@ -394,12 +552,27 @@ let sectionObj = {
|
|
|
sheet: null,
|
|
|
cache: [],
|
|
|
currentSection: null,
|
|
|
- updateType: { update: "update", new: "new", del: 'delete' },
|
|
|
+ updateType: { update: "update", new: "new", del: "delete" },
|
|
|
deleteType: "section",
|
|
|
setting: {
|
|
|
header: [
|
|
|
- { headerName: "分册章节", headerWidth: 330, dataCode: "name", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center" },
|
|
|
- { headerName: "序号", headerWidth: 50, dataCode: "seq", dataType: "Number", hAlign: "center", vAlign: "center" },
|
|
|
+ {
|
|
|
+ headerName: "分册章节",
|
|
|
+ headerWidth: 330,
|
|
|
+ dataCode: "name",
|
|
|
+ dataType: "String",
|
|
|
+ formatter: "@",
|
|
|
+ hAlign: "left",
|
|
|
+ vAlign: "center",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ headerName: "序号",
|
|
|
+ headerWidth: 50,
|
|
|
+ dataCode: "seq",
|
|
|
+ dataType: "Number",
|
|
|
+ hAlign: "center",
|
|
|
+ vAlign: "center",
|
|
|
+ },
|
|
|
],
|
|
|
view: { lockColumns: [] },
|
|
|
options: {
|
|
|
@@ -431,11 +604,22 @@ let sectionObj = {
|
|
|
},
|
|
|
buildSheet: function () {
|
|
|
if (!this.isDef(this.workBook)) {
|
|
|
- this.workBook = sheetCommonObj.buildSheet($("#instSectionSpread")[0], this.setting, 10);
|
|
|
+ this.workBook = sheetCommonObj.buildSheet(
|
|
|
+ $("#instSectionSpread")[0],
|
|
|
+ this.setting,
|
|
|
+ 10
|
|
|
+ );
|
|
|
this.sheet = this.workBook.getActiveSheet();
|
|
|
- sheetCommonObj.bindEscKey(this.workBook, [{ sheet: this.sheet, editStarting: this.onEditStarting, editEnded: this.onEditEnded }]);
|
|
|
+ sheetCommonObj.bindEscKey(this.workBook, [
|
|
|
+ {
|
|
|
+ sheet: this.sheet,
|
|
|
+ editStarting: this.onEditStarting,
|
|
|
+ editEnded: this.onEditEnded,
|
|
|
+ },
|
|
|
+ ]);
|
|
|
this.setOptions(this.workBook, this.setting.options);
|
|
|
- this.sheet.options.clipBoardOptions = GC.Spread.Sheets.ClipboardPasteOptions.values;
|
|
|
+ this.sheet.options.clipBoardOptions =
|
|
|
+ GC.Spread.Sheets.ClipboardPasteOptions.values;
|
|
|
this.bindEvents(this.sheet);
|
|
|
}
|
|
|
},
|
|
|
@@ -477,7 +661,11 @@ let sectionObj = {
|
|
|
x = e.pageX - offset.left,
|
|
|
y = e.pageY - offset.top;
|
|
|
let target = sheet.hitTest(x, y);
|
|
|
- if (target.hitTestType === 3 && me.isDef(target.row) && me.isDef(target.col)) {
|
|
|
+ if (
|
|
|
+ target.hitTestType === 3 &&
|
|
|
+ me.isDef(target.row) &&
|
|
|
+ me.isDef(target.col)
|
|
|
+ ) {
|
|
|
//在表格内
|
|
|
sheet.setActiveCell(target.row, target.col);
|
|
|
me.initSelection(me.cache[target.row]);
|
|
|
@@ -487,7 +675,9 @@ let sectionObj = {
|
|
|
ref: {
|
|
|
name: "批量关联至定额",
|
|
|
disabled: function () {
|
|
|
- const inValidCell = !commonUtil.isDef(target.row) || !commonUtil.isDef(target.col);
|
|
|
+ const inValidCell =
|
|
|
+ !commonUtil.isDef(target.row) ||
|
|
|
+ !commonUtil.isDef(target.col);
|
|
|
const inValidData = target.row >= me.cache.length;
|
|
|
return locked || inValidCell || inValidData;
|
|
|
},
|
|
|
@@ -499,7 +689,9 @@ let sectionObj = {
|
|
|
del: {
|
|
|
name: "删除章节",
|
|
|
disabled: function () {
|
|
|
- const inValidCell = !commonUtil.isDef(target.row) || !commonUtil.isDef(target.col);
|
|
|
+ const inValidCell =
|
|
|
+ !commonUtil.isDef(target.row) ||
|
|
|
+ !commonUtil.isDef(target.col);
|
|
|
const inValidData = target.row >= me.cache.length;
|
|
|
return locked || inValidCell || inValidData;
|
|
|
},
|
|
|
@@ -519,7 +711,12 @@ let sectionObj = {
|
|
|
},
|
|
|
onSelectionChanged: function (sender, info) {
|
|
|
let me = sectionObj;
|
|
|
- if ((info.oldSelections && info.oldSelections.length === 0 && info.newSelections.length > 0) || info.oldSelections[0].row !== info.newSelections[0].row) {
|
|
|
+ if (
|
|
|
+ (info.oldSelections &&
|
|
|
+ info.oldSelections.length === 0 &&
|
|
|
+ info.newSelections.length > 0) ||
|
|
|
+ info.oldSelections[0].row !== info.newSelections[0].row
|
|
|
+ ) {
|
|
|
let row = info.newSelections[0].row;
|
|
|
let section = me.cache[row];
|
|
|
me.initSelection(section);
|
|
|
@@ -536,7 +733,9 @@ let sectionObj = {
|
|
|
let me = sectionObj,
|
|
|
fi = feeItemObj,
|
|
|
fr = feeRuleObj;
|
|
|
- let v = me.isDef(args.editingText) ? args.editingText.toString().trim() : "";
|
|
|
+ let v = me.isDef(args.editingText)
|
|
|
+ ? args.editingText.toString().trim()
|
|
|
+ : "";
|
|
|
let section = me.cache[args.row];
|
|
|
let updateObj = { updateType: "", updateData: {} };
|
|
|
//update
|
|
|
@@ -587,12 +786,23 @@ let sectionObj = {
|
|
|
me.sheet.setRowCount(me.cache.length + 5);
|
|
|
sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
|
me.updateSection([updateObj]);
|
|
|
- fi.updateFeeItem([{ updateType: fi.updateType.update, updateData: { ID: fi.currentFeeItem.ID, $addToSet: { section: { ID: updateObj.updateData.ID } } } }]);
|
|
|
+ fi.updateFeeItem([
|
|
|
+ {
|
|
|
+ updateType: fi.updateType.update,
|
|
|
+ updateData: {
|
|
|
+ ID: fi.currentFeeItem.ID,
|
|
|
+ $addToSet: { section: { ID: updateObj.updateData.ID } },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ]);
|
|
|
},
|
|
|
onClipboardPasting: function (sender, info) {
|
|
|
let me = sectionObj,
|
|
|
fi = feeItemObj;
|
|
|
- if (info.cellRange.col + info.cellRange.colCount > me.setting.header.length || !me.isDef(fi.currentFeeItem)) {
|
|
|
+ if (
|
|
|
+ info.cellRange.col + info.cellRange.colCount > me.setting.header.length ||
|
|
|
+ !me.isDef(fi.currentFeeItem)
|
|
|
+ ) {
|
|
|
info.cancel = true;
|
|
|
}
|
|
|
},
|
|
|
@@ -610,20 +820,32 @@ let sectionObj = {
|
|
|
//update
|
|
|
if (me.isDef(section)) {
|
|
|
section.name = items[i].name;
|
|
|
- let updateObj = { updateType: me.updateType.update, updateData: { ID: section.ID, name: items[i].name } };
|
|
|
+ let updateObj = {
|
|
|
+ updateType: me.updateType.update,
|
|
|
+ updateData: { ID: section.ID, name: items[i].name },
|
|
|
+ };
|
|
|
sePostData.push(updateObj);
|
|
|
}
|
|
|
//insert
|
|
|
else {
|
|
|
let updateObj = {
|
|
|
updateType: me.updateType.new,
|
|
|
- updateData: { ID: uuid.v1(), rationRepId: fi.rationRepId, name: items[i].name, feeItemId: fi.currentFeeItem.ID, feeRule: [] },
|
|
|
+ updateData: {
|
|
|
+ ID: uuid.v1(),
|
|
|
+ rationRepId: fi.rationRepId,
|
|
|
+ name: items[i].name,
|
|
|
+ feeItemId: fi.currentFeeItem.ID,
|
|
|
+ feeRule: [],
|
|
|
+ },
|
|
|
};
|
|
|
sePostData.push(updateObj);
|
|
|
me.cache.push(updateObj.updateData);
|
|
|
fiPostData.push({
|
|
|
updateType: fi.updateType.update,
|
|
|
- updateData: { ID: fi.currentFeeItem.ID, $addToSet: { section: { ID: updateObj.updateData.ID } } },
|
|
|
+ updateData: {
|
|
|
+ ID: fi.currentFeeItem.ID,
|
|
|
+ $addToSet: { section: { ID: updateObj.updateData.ID } },
|
|
|
+ },
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -656,15 +878,37 @@ let sectionObj = {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
|
|
|
- me.workBook.commandManager().setShortcutKey("sectionDel", GC.Spread.Commands.Key.del, false, false, false, false);
|
|
|
+ me.workBook
|
|
|
+ .commandManager()
|
|
|
+ .setShortcutKey(
|
|
|
+ null,
|
|
|
+ GC.Spread.Commands.Key.del,
|
|
|
+ false,
|
|
|
+ false,
|
|
|
+ false,
|
|
|
+ false
|
|
|
+ );
|
|
|
+ me.workBook
|
|
|
+ .commandManager()
|
|
|
+ .setShortcutKey(
|
|
|
+ "sectionDel",
|
|
|
+ GC.Spread.Commands.Key.del,
|
|
|
+ false,
|
|
|
+ false,
|
|
|
+ false,
|
|
|
+ false
|
|
|
+ );
|
|
|
},
|
|
|
updateSection: function (updateData, callback) {
|
|
|
- CommonAjax.post("/rationRepository/api/updateSection", { updateData: updateData, libID: feeItemObj.rationRepId }, function (rstData) {
|
|
|
- if (callback) {
|
|
|
- callback();
|
|
|
+ CommonAjax.post(
|
|
|
+ "/rationRepository/api/updateSection",
|
|
|
+ { updateData: updateData, libID: feeItemObj.rationRepId },
|
|
|
+ function (rstData) {
|
|
|
+ if (callback) {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
}
|
|
|
- });
|
|
|
+ );
|
|
|
},
|
|
|
};
|
|
|
|
|
|
@@ -780,7 +1024,13 @@ let feeRuleObj = {
|
|
|
this.sheet.setRowCount(2, ch);
|
|
|
for (let i = 0; i < this.setting.header.length; i++) {
|
|
|
let header = this.setting.header[i];
|
|
|
- this.sheet.addSpan(header.span.row, i, header.span.rowCount, header.span.colCount, ch);
|
|
|
+ this.sheet.addSpan(
|
|
|
+ header.span.row,
|
|
|
+ i,
|
|
|
+ header.span.rowCount,
|
|
|
+ header.span.colCount,
|
|
|
+ ch
|
|
|
+ );
|
|
|
this.sheet.setValue(header.span.row, i, header.headerName, ch);
|
|
|
if (header.dataCode === "feeRate") {
|
|
|
this.sheet.addSpan(header.span.row, i + 1, 1, 3, ch);
|
|
|
@@ -793,15 +1043,26 @@ let feeRuleObj = {
|
|
|
buildSheet: function () {
|
|
|
let fi = feeItemObj;
|
|
|
if (!this.isDef(this.workBook)) {
|
|
|
- this.workBook = sheetCommonObj.buildSheet($("#instFeeRuleSpread")[0], this.setting, 10);
|
|
|
+ this.workBook = sheetCommonObj.buildSheet(
|
|
|
+ $("#instFeeRuleSpread")[0],
|
|
|
+ this.setting,
|
|
|
+ 10
|
|
|
+ );
|
|
|
this.sheet = this.workBook.getActiveSheet();
|
|
|
this.buildHeader();
|
|
|
this.sheet.setRowCount();
|
|
|
|
|
|
this.sheet.options.allowCellOverflow = false;
|
|
|
- sheetCommonObj.bindEscKey(this.workBook, [{ sheet: this.sheet, editStarting: this.onEditStarting, editEnded: this.onEditEnded }]);
|
|
|
+ sheetCommonObj.bindEscKey(this.workBook, [
|
|
|
+ {
|
|
|
+ sheet: this.sheet,
|
|
|
+ editStarting: this.onEditStarting,
|
|
|
+ editEnded: this.onEditEnded,
|
|
|
+ },
|
|
|
+ ]);
|
|
|
this.setOptions(this.workBook, this.setting.options);
|
|
|
- this.sheet.options.clipBoardOptions = GC.Spread.Sheets.ClipboardPasteOptions.values;
|
|
|
+ this.sheet.options.clipBoardOptions =
|
|
|
+ GC.Spread.Sheets.ClipboardPasteOptions.values;
|
|
|
this.bindEvents(this.sheet);
|
|
|
//init combo
|
|
|
fi.setCombo(this.sheet, 2, this.setting.comboItems.base);
|
|
|
@@ -819,14 +1080,23 @@ let feeRuleObj = {
|
|
|
me.feeRuleDelOpr();
|
|
|
},
|
|
|
canSave: function (addObj) {
|
|
|
- return this.isDef(addObj.code) && addObj.code !== "" && !this.hasCode(addObj) && this.validRCJ(addObj);
|
|
|
+ return (
|
|
|
+ this.isDef(addObj.code) &&
|
|
|
+ addObj.code !== "" &&
|
|
|
+ !this.hasCode(addObj) &&
|
|
|
+ this.validRCJ(addObj)
|
|
|
+ );
|
|
|
},
|
|
|
hasCode: function (obj) {
|
|
|
let fi = feeItemObj;
|
|
|
for (let feeItem of fi.cache) {
|
|
|
for (let section of feeItem.section) {
|
|
|
for (let feeRule of section.feeRule) {
|
|
|
- if (obj.code == feeRule.code && ((this.isDef(obj.ID) && obj.ID !== feeRule.ID) || !this.isDef(obj.ID))) {
|
|
|
+ if (
|
|
|
+ obj.code == feeRule.code &&
|
|
|
+ ((this.isDef(obj.ID) && obj.ID !== feeRule.ID) ||
|
|
|
+ !this.isDef(obj.ID))
|
|
|
+ ) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
@@ -863,7 +1133,10 @@ let feeRuleObj = {
|
|
|
return false;
|
|
|
}
|
|
|
//基数要合法
|
|
|
- if (this.isDef(data.base) && this.setting.comboItems.base.indexOf(data.base) < 0) {
|
|
|
+ if (
|
|
|
+ this.isDef(data.base) &&
|
|
|
+ this.setting.comboItems.base.indexOf(data.base) < 0
|
|
|
+ ) {
|
|
|
alert("基数不正确!");
|
|
|
return false;
|
|
|
}
|
|
|
@@ -885,12 +1158,21 @@ let feeRuleObj = {
|
|
|
return false;
|
|
|
}
|
|
|
//基数为分别按人材机时,费率须为空
|
|
|
- if (this.isDef(data.base) && data.base === this.base.RCJ && this.isDef(data.feeRate) && data.feeRate !== "") {
|
|
|
+ if (
|
|
|
+ this.isDef(data.base) &&
|
|
|
+ data.base === this.base.RCJ &&
|
|
|
+ this.isDef(data.feeRate) &&
|
|
|
+ data.feeRate !== ""
|
|
|
+ ) {
|
|
|
alert("基数为分别按人材机时,费率须为空!");
|
|
|
return false;
|
|
|
}
|
|
|
//基数为 人工、材料、机械时 三者之和须为100
|
|
|
- if (this.isDef(data.base) && data.base !== this.base.RCJ && this.validRCJ(data)) {
|
|
|
+ if (
|
|
|
+ this.isDef(data.base) &&
|
|
|
+ data.base !== this.base.RCJ &&
|
|
|
+ this.validRCJ(data)
|
|
|
+ ) {
|
|
|
alert("基数为 人工、材料、机械时 三者之和须为100");
|
|
|
return false;
|
|
|
}
|
|
|
@@ -911,13 +1193,28 @@ let feeRuleObj = {
|
|
|
}
|
|
|
},
|
|
|
getFocusToCol: function (feeRule) {
|
|
|
- if (!this.isDef(feeRule.labour) || feeRule.labour === "" || feeRule.labour > 100 || feeRule.labour == 0) {
|
|
|
+ if (
|
|
|
+ !this.isDef(feeRule.labour) ||
|
|
|
+ feeRule.labour === "" ||
|
|
|
+ feeRule.labour > 100 ||
|
|
|
+ feeRule.labour == 0
|
|
|
+ ) {
|
|
|
return 4;
|
|
|
}
|
|
|
- if (!this.isDef(feeRule.material) || feeRule.material === "" || feeRule.material > 100 || feeRule.material == 0) {
|
|
|
+ if (
|
|
|
+ !this.isDef(feeRule.material) ||
|
|
|
+ feeRule.material === "" ||
|
|
|
+ feeRule.material > 100 ||
|
|
|
+ feeRule.material == 0
|
|
|
+ ) {
|
|
|
return 5;
|
|
|
}
|
|
|
- if (!this.isDef(feeRule.machine) || feeRule.machine === "" || feeRule.machine > 100 || feeRule.machine == 0) {
|
|
|
+ if (
|
|
|
+ !this.isDef(feeRule.machine) ||
|
|
|
+ feeRule.machine === "" ||
|
|
|
+ feeRule.machine > 100 ||
|
|
|
+ feeRule.machine == 0
|
|
|
+ ) {
|
|
|
return 6;
|
|
|
}
|
|
|
return 4;
|
|
|
@@ -925,7 +1222,12 @@ let feeRuleObj = {
|
|
|
onSelectionChanged: function (sender, info) {
|
|
|
let me = feeRuleObj,
|
|
|
se = sectionObj;
|
|
|
- if ((info.oldSelections && info.oldSelections.length === 0 && info.newSelections.length > 0) || info.oldSelections[0].row !== info.newSelections[0].row) {
|
|
|
+ if (
|
|
|
+ (info.oldSelections &&
|
|
|
+ info.oldSelections.length === 0 &&
|
|
|
+ info.newSelections.length > 0) ||
|
|
|
+ info.oldSelections[0].row !== info.newSelections[0].row
|
|
|
+ ) {
|
|
|
if (me.isDef(me.updateObj) && !me.validRCJ(me.updateObj)) {
|
|
|
$("#rcjAlert").modal("show");
|
|
|
$("#aleCanceBtn").bind("click", function () {
|
|
|
@@ -935,11 +1237,16 @@ let feeRuleObj = {
|
|
|
me.updateObj.machine = 0;
|
|
|
me.sheet.setRowCount(me.cache.length + 5);
|
|
|
sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
|
- se.updateSection([{ updateType: se.updateType.update, updateData: se.currentSection }]);
|
|
|
+ se.updateSection([
|
|
|
+ { updateType: se.updateType.update, updateData: se.currentSection },
|
|
|
+ ]);
|
|
|
$(this).unbind();
|
|
|
});
|
|
|
$("#aleConfBtn").bind("click", function () {
|
|
|
- me.sheet.setActiveCell(me.avtiveCell.row, me.getFocusToCol(me.updateObj));
|
|
|
+ me.sheet.setActiveCell(
|
|
|
+ me.avtiveCell.row,
|
|
|
+ me.getFocusToCol(me.updateObj)
|
|
|
+ );
|
|
|
$(this).unbind();
|
|
|
});
|
|
|
}
|
|
|
@@ -995,7 +1302,10 @@ let feeRuleObj = {
|
|
|
$(this).unbind();
|
|
|
});
|
|
|
$("#aleConfBtn").bind("click", function () {
|
|
|
- me.sheet.setActiveCell(me.avtiveCell.row, me.getFocusToCol(me.addObj));
|
|
|
+ me.sheet.setActiveCell(
|
|
|
+ me.avtiveCell.row,
|
|
|
+ me.getFocusToCol(me.addObj)
|
|
|
+ );
|
|
|
$(this).unbind();
|
|
|
});
|
|
|
}
|
|
|
@@ -1014,7 +1324,12 @@ let feeRuleObj = {
|
|
|
if (!me.isDef(se.currentSection)) {
|
|
|
args.cancel = true;
|
|
|
}
|
|
|
- if (me.isDef(feeRule) && me.isDef(feeRule.base) && feeRule.base === me.base.RCJ && args.col === 3) {
|
|
|
+ if (
|
|
|
+ me.isDef(feeRule) &&
|
|
|
+ me.isDef(feeRule.base) &&
|
|
|
+ feeRule.base === me.base.RCJ &&
|
|
|
+ args.col === 3
|
|
|
+ ) {
|
|
|
args.cancel = true;
|
|
|
} else if (!me.isDef(feeRule) && rcjCols.indexOf(args.col) > 0) {
|
|
|
args.cancel = true;
|
|
|
@@ -1023,11 +1338,14 @@ let feeRuleObj = {
|
|
|
onEditEnded: function (sender, args) {
|
|
|
let me = feeRuleObj,
|
|
|
se = sectionObj;
|
|
|
- let v = me.isDef(args.editingText) ? args.editingText.toString().trim() : "";
|
|
|
+ let v = me.isDef(args.editingText)
|
|
|
+ ? args.editingText.toString().trim()
|
|
|
+ : "";
|
|
|
let updateObj = { updateType: "", updateData: {} };
|
|
|
let feeRule = me.cache[args.row];
|
|
|
let field = me.setting.header[args.col]["dataCode"];
|
|
|
- let orgV = me.isDef(feeRule) && me.isDef(feeRule[field]) ? feeRule[field] : "";
|
|
|
+ let orgV =
|
|
|
+ me.isDef(feeRule) && me.isDef(feeRule[field]) ? feeRule[field] : "";
|
|
|
me.updateObj = feeRule;
|
|
|
me.avtiveCell.row = args.row;
|
|
|
me.avtiveCell.col = args.col;
|
|
|
@@ -1041,14 +1359,22 @@ let feeRuleObj = {
|
|
|
//基数为人材机时,费率清空
|
|
|
feeRule.feeRate = "";
|
|
|
me.sheet.setValue(args.row, 3, "");
|
|
|
- } else if (field === "base" && (v === me.base.RG || v === me.base.CL || v === me.base.JX)) {
|
|
|
+ } else if (
|
|
|
+ field === "base" &&
|
|
|
+ (v === me.base.RG || v === me.base.CL || v === me.base.JX)
|
|
|
+ ) {
|
|
|
if (!me.validRCJ(feeRule)) {
|
|
|
//基数变为人工、材料、机械时,若人材机之和不为100,则清空
|
|
|
feeRule.labour = 0;
|
|
|
feeRule.material = 0;
|
|
|
feeRule.machine = 0;
|
|
|
}
|
|
|
- } else if (field === "labour" || field === "material" || field === "machine" || field === "feeRate") {
|
|
|
+ } else if (
|
|
|
+ field === "labour" ||
|
|
|
+ field === "material" ||
|
|
|
+ field === "machine" ||
|
|
|
+ field === "feeRate"
|
|
|
+ ) {
|
|
|
if (isNaN(v)) {
|
|
|
alert("只能输入数值");
|
|
|
me.sheet.setValue(args.row, args.col, orgV);
|
|
|
@@ -1088,7 +1414,9 @@ let feeRuleObj = {
|
|
|
updateObj.updateData.ID = se.currentSection.ID;
|
|
|
updateObj.updateData.feeRule = me.cache;
|
|
|
me.updateObj = null;
|
|
|
- se.updateSection([{ updateType: se.updateType.update, updateData: se.currentSection }]);
|
|
|
+ se.updateSection([
|
|
|
+ { updateType: se.updateType.update, updateData: se.currentSection },
|
|
|
+ ]);
|
|
|
}
|
|
|
//insert
|
|
|
else {
|
|
|
@@ -1107,7 +1435,9 @@ let feeRuleObj = {
|
|
|
updateObj.updateData.feeRule = me.cache;
|
|
|
me.sheet.setRowCount(me.cache.length + 5);
|
|
|
sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
|
- se.updateSection([{ updateType: se.updateType.update, updateData: se.currentSection }]);
|
|
|
+ se.updateSection([
|
|
|
+ { updateType: se.updateType.update, updateData: se.currentSection },
|
|
|
+ ]);
|
|
|
me.addObj = null;
|
|
|
}
|
|
|
}
|
|
|
@@ -1115,7 +1445,10 @@ let feeRuleObj = {
|
|
|
onClipboardPasting: function (sender, info) {
|
|
|
let me = feeRuleObj,
|
|
|
se = sectionObj;
|
|
|
- if (info.cellRange.col + info.cellRange.colCount > me.setting.header.length) {
|
|
|
+ if (
|
|
|
+ info.cellRange.col + info.cellRange.colCount >
|
|
|
+ me.setting.header.length
|
|
|
+ ) {
|
|
|
info.cancel = true;
|
|
|
}
|
|
|
if (!me.isDef(se.currentSection)) {
|
|
|
@@ -1160,7 +1493,9 @@ let feeRuleObj = {
|
|
|
me.sheet.setRowCount(me.cache.length + 5);
|
|
|
sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
|
if (me.toUpdate) {
|
|
|
- se.updateSection([{ updateType: se.updateType.update, updateData: se.currentSection }]);
|
|
|
+ se.updateSection([
|
|
|
+ { updateType: se.updateType.update, updateData: se.currentSection },
|
|
|
+ ]);
|
|
|
}
|
|
|
},
|
|
|
feeRuleDelOpr: function () {
|
|
|
@@ -1189,14 +1524,35 @@ let feeRuleObj = {
|
|
|
}
|
|
|
}
|
|
|
if (me.toUpdate) {
|
|
|
- se.updateSection([{ updateType: se.updateType.update, updateData: se.currentSection }], function () {
|
|
|
- me.sheet.setRowCount(me.cache.length + 5);
|
|
|
- sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
|
- });
|
|
|
+ se.updateSection(
|
|
|
+ [{ updateType: se.updateType.update, updateData: se.currentSection }],
|
|
|
+ function () {
|
|
|
+ me.sheet.setRowCount(me.cache.length + 5);
|
|
|
+ sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
|
+ }
|
|
|
+ );
|
|
|
}
|
|
|
});
|
|
|
- me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
|
|
|
- me.workBook.commandManager().setShortcutKey("feeRuleDel", GC.Spread.Commands.Key.del, false, false, false, false);
|
|
|
+ me.workBook
|
|
|
+ .commandManager()
|
|
|
+ .setShortcutKey(
|
|
|
+ null,
|
|
|
+ GC.Spread.Commands.Key.del,
|
|
|
+ false,
|
|
|
+ false,
|
|
|
+ false,
|
|
|
+ false
|
|
|
+ );
|
|
|
+ me.workBook
|
|
|
+ .commandManager()
|
|
|
+ .setShortcutKey(
|
|
|
+ "feeRuleDel",
|
|
|
+ GC.Spread.Commands.Key.del,
|
|
|
+ false,
|
|
|
+ false,
|
|
|
+ false,
|
|
|
+ false
|
|
|
+ );
|
|
|
},
|
|
|
};
|
|
|
|
|
|
@@ -1284,7 +1640,10 @@ let batchSectionObj = {
|
|
|
},
|
|
|
buildSheet: function () {
|
|
|
if (!this.isDef(this.workBook)) {
|
|
|
- this.workBook = new GC.Spread.Sheets.Workbook($("#batchSectionSpread")[0], { sheetCount: 1 });
|
|
|
+ this.workBook = new GC.Spread.Sheets.Workbook(
|
|
|
+ $("#batchSectionSpread")[0],
|
|
|
+ { sheetCount: 1 }
|
|
|
+ );
|
|
|
this.sheet = this.workBook.getActiveSheet();
|
|
|
this.setOptions(this.workBook, this.setting.options);
|
|
|
this.bindEvents(this.sheet);
|
|
|
@@ -1314,7 +1673,9 @@ let batchSectionObj = {
|
|
|
//init checkBox
|
|
|
let checkBox = new GC.Spread.Sheets.CellTypes.CheckBox();
|
|
|
me.sheet.getRange(-1, 0, -1, 1).cellType(checkBox);
|
|
|
- me.sheet.getRange(-1, 0, -1, 1).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
|
|
|
+ me.sheet
|
|
|
+ .getRange(-1, 0, -1, 1)
|
|
|
+ .hAlign(GC.Spread.Sheets.HorizontalAlign.center);
|
|
|
};
|
|
|
let errFunc = function () {};
|
|
|
CommonAjax.post(url, postData, sucFunc, errFunc);
|
|
|
@@ -1386,7 +1747,13 @@ let batchSectionObj = {
|
|
|
for (let i = 0, len = rowCount; i < len; i++) {
|
|
|
let checked = sheet.getValue(i, 0);
|
|
|
//只返回叶子节点
|
|
|
- if (this.isDef(checked) && checked == true && this.isDef(this.cache[i]) && this.isDef(this.cache[i].data.ID) && this.cache[i].children.length === 0) {
|
|
|
+ if (
|
|
|
+ this.isDef(checked) &&
|
|
|
+ checked == true &&
|
|
|
+ this.isDef(this.cache[i]) &&
|
|
|
+ this.isDef(this.cache[i].data.ID) &&
|
|
|
+ this.cache[i].children.length === 0
|
|
|
+ ) {
|
|
|
rst.push(this.cache[i].data.ID);
|
|
|
}
|
|
|
}
|
|
|
@@ -1417,7 +1784,10 @@ let batchSectionObj = {
|
|
|
batchUpdate: function (feeItemId, sectionId, rationSection) {
|
|
|
CommonAjax.post(
|
|
|
"/rationRepository/api/batchUpdateInst",
|
|
|
- { inst: { feeItemId: feeItemId, sectionId: sectionId }, rationSection: rationSection },
|
|
|
+ {
|
|
|
+ inst: { feeItemId: feeItemId, sectionId: sectionId },
|
|
|
+ rationSection: rationSection,
|
|
|
+ },
|
|
|
function (rstData) {
|
|
|
$("#sectionTreeModal").modal("hide");
|
|
|
}
|