|
@@ -1,5 +1,7 @@
|
|
|
// 地区表
|
|
|
const AREA_BOOK = (() => {
|
|
|
+ // 地区表格锁
|
|
|
+ let areaLocked = true;
|
|
|
const cache = areaList;
|
|
|
const setting = {
|
|
|
header: [
|
|
@@ -9,7 +11,7 @@ const AREA_BOOK = (() => {
|
|
|
};
|
|
|
// 初始化表格
|
|
|
const workBook = initSheet($('#area-spread')[0], setting);
|
|
|
- lockUtil.lockSpreads([workBook], locked);
|
|
|
+ lockUtil.lockSpreads([workBook], locked || areaLocked);
|
|
|
workBook.options.allowExtendPasteRange = false;
|
|
|
workBook.options.allowUserDragDrop = false;
|
|
|
workBook.options.allowUserDragFill = false;
|
|
@@ -55,13 +57,26 @@ const AREA_BOOK = (() => {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- sheet.bind(GC.Spread.Sheets.Events.ValueChanged, function (e, info) {
|
|
|
+
|
|
|
+ const bindEdit = () => {
|
|
|
+ sheet.bind(GC.Spread.Sheets.Events.ValueChanged, function (e, info) {
|
|
|
+ const changedCells = [{ row: info.row, col: info.col }];
|
|
|
+ handleEdit(changedCells);
|
|
|
+ });
|
|
|
+ sheet.bind(GC.Spread.Sheets.Events.RangeChanged, function (e, info) {
|
|
|
+ handleEdit(info.changedCells);
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ bindEdit();
|
|
|
+
|
|
|
+ /* sheet.bind(GC.Spread.Sheets.Events.ValueChanged, function (e, info) {
|
|
|
const changedCells = [{ row: info.row, col: info.col }];
|
|
|
handleEdit(changedCells);
|
|
|
});
|
|
|
sheet.bind(GC.Spread.Sheets.Events.RangeChanged, function (e, info) {
|
|
|
handleEdit(info.changedCells);
|
|
|
- });
|
|
|
+ }); */
|
|
|
|
|
|
const curArea = { ID: null, name: '' };
|
|
|
// 焦点变更处理
|
|
@@ -139,11 +154,27 @@ const AREA_BOOK = (() => {
|
|
|
}
|
|
|
return {
|
|
|
items: {
|
|
|
+ lock: {
|
|
|
+ name: areaLocked ? '解锁' : '锁定',
|
|
|
+ icon: areaLocked ? "fa-unlock" : 'fa-lock',
|
|
|
+ disabled: function () {
|
|
|
+ return locked;
|
|
|
+ },
|
|
|
+ callback: function (key, opt) {
|
|
|
+ areaLocked = !areaLocked;
|
|
|
+ if (locked || areaLocked) {
|
|
|
+ lockUtil.lockSpreads([workBook], locked || areaLocked);
|
|
|
+ } else {
|
|
|
+ lockUtil.unLockSpreads([workBook]);
|
|
|
+ bindEdit();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
insert: {
|
|
|
name: '新增',
|
|
|
icon: "fa-arrow-left",
|
|
|
disabled: function () {
|
|
|
- return locked;
|
|
|
+ return locked || areaLocked;
|
|
|
},
|
|
|
callback: function (key, opt) {
|
|
|
insert();
|
|
@@ -153,7 +184,7 @@ const AREA_BOOK = (() => {
|
|
|
name: '删除',
|
|
|
icon: "fa-arrow-left",
|
|
|
disabled: function () {
|
|
|
- return locked || !cache[target.row];
|
|
|
+ return locked || areaLocked || !cache[target.row];
|
|
|
},
|
|
|
callback: function (key, opt) {
|
|
|
del();
|