let arr=[{
amount: 1
chapter: ""
children: undefined
code: "0101-01-01"
comment: null
contractListId: null
createdAt: "2021-07-19 10:58:55"
createdBy: null
deviceCode: "ff"
deviceName: ""
deviceType: ""
deviceUnit: ""
itemMetaId: 12
measureUnit: ""
name: ""
parentCode: "0101-01"
price: 500
secondCode: ""
section: ""
sumList: null
type: "DEVICE"
updatedAt: "2021-07-19 10:58:55"
updatedBy: null
worth: null
}];
let columnList=[{
{name:'itemMetaId', displayName:'', size:0},
{name:'code',displayName:'清单标号',size:150,formatter:'0'},
{name:'secondCode',displayName:'清单编码',size:150,formatter:'0'},
{name:'chapter',displayName:'章',size:30,formatter:'0'},
{name:'section',displayName:'节',size:30,formatter:'0'},
{name:'name',displayName:'名称',size:200,formatter:'0'},
}]
let spread= this.spread
sheet = this.spread.getSheet(0);
let that = this;
sheet.autoGenerateColumns = true;
sheet.setDataSource(arr);
sheet.bindColumns(columnList);
//锁定所有单元格
let table = sheet.tables.all()[0];
debugger;
let thinBorder = new GC.Spread.Sheets.LineBorder("#d3d6db", GC.Spread.Sheets.LineStyle.thin);
let tableStyleInfo = new GC.Spread.Sheets.Tables.TableStyle("#f5f7fa", "#666", "normal 10pt arial", thinBorder, thinBorder, thinBorder, thinBorder, thinBorder, thinBorder);
let tableStyle = new GC.Spread.Sheets.Tables.TableTheme();
tableStyle.name('tableStyle');
tableStyle.wholeTableStyle(tableStyleInfo);
table.style(tableStyle);
sheet.options.protectionOptions = {
allowSelectLockedCells: true,
allowSelectUnlockedCells: true,
allowFilter: true,
allowSort: true,
allowResizeRows: true,
allowResizeColumns: true,
allowEditObjects: false,
allowDragInsertRows: false,
allowDragInsertColumns: false,
allowInsertRows: false,
allowInsertColumns: false,
allowDeleteRows: false,
allowDeleteColumns: false,
allowOutlineColumns: false,
allowOutlineRows: false
};
sheet.options.isProtected = true; |