- [code] designerInitialized() {
- this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
- if (typeof (item.name) === 'string') {
- return !(item.name.includes('pasteOptions'))
- }
- })
- this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
- if (typeof (item.name) === 'string') {
- return !(item.name.includes('pasteAll'))
- }
- })
- this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
- if (typeof (item.name) === 'string') {
- return !(item.name.includes('pasteFormula'))
- }
- })
- this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
- if (typeof (item.name) === 'string') {
- return !(item.name.includes('pasteFormatting'))
- }
- })
- this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
- if (typeof (item.name) === 'string') {
- return !(item.name.includes('pasteValues') && !item.name.includes('pasteValuesFormatting'))
- }
- })
- this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
- if (typeof (item.name) === 'string') {
- return !(item.name.includes('pasteFormulaFormatting'))
- }
- })
- this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
- if (typeof (item.name) === 'string') {
- return !(item.name.includes('insertSheet'))
- }
- })
- this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
- if (typeof (item.name) === 'string') {
- return !(item.name.includes('hideSheet'))
- }
- })
- this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
- if (typeof (item.name) === 'string') {
- return !(item.name.includes('deleteSheet'))
- }
- })
- // console.log('this.spread.contextMenu.menuData11', this.spread.contextMenu.menuData)
- this.spread.contextMenu.menuData.forEach(item => {
- if (item.name.includes('pasteValuesFormatting')) {
- item.text = '粘贴'
- }
- })
- var fbx = new GC.Spread.Sheets.FormulaTextBox.FormulaTextBox(document.getElementById('formulaBox'))
- new GC.Spread.Sheets.NameBox.NameBox('addressBox', this.spread)
- fbx.workbook(this.spread)
- // 阻止用户重命名sheet
- this.spread.options.tabEditable = false
- // 阻止用户添加表单
- this.spread.options.newTabVisible = false
- this.spread.options.scrollByPixel = true
- // 楷体
- registerServerFont('楷体', 'normal', './fonts_grapecity/simkai.ttf')
- registerServerFont('Calibri', 'normal', './fonts_grapecity/calibri.ttf')
- registerServerFont('Cambria', 'normal', './fonts_grapecity/cambriab.ttf')
- // 默认导出宋体
- registerFallbackFont('./fonts_grapecity/songti.ttf')
- this.spread.options.grayAreaBackColor = 'white'
- // 查询或报送管理 或财务三大报表跳转而来
- if (this.$route.query.pageId || this.$route.query.itype) {
- this.viewReport()
- } else {
- this.onloadGetdata()
- }
- this.spread.bind(GC.Spread.Sheets.Events.ColumnChanged, (e, info) => {
- this.isFileModified = true
- })
- this.spread.bind(GC.Spread.Sheets.Events.RowChanged, (e, info) => {
- this.isFileModified = true
- })
- // 去掉监测活动表单
- // this.spread.bind(GC.Spread.Sheets.Events.SheetChanged, (e, info) => {
- // this.isFileModified = true
- // })
- this.spread.bind(GC.Spread.Sheets.Events.RowHeightChanged, (e, info) => {
- this.isFileModified = true
- })
- this.spread.bind(GC.Spread.Sheets.Events.ColumnWidthChanged, (e, info) => {
- this.isFileModified = true
- })
- this.spread.bind(GC.Spread.Sheets.Events.ActiveSheetChanging, (sender, args) => {
- this.$refs.popbox.style.display = 'none'
- })
- this.spread.bind(GC.Spread.Sheets.Events.EditChange, (sender, args) => {
- this.cellValue = args.editingText
- })
- this.spread.bind(GC.Spread.Sheets.Events.TopRowChanged, (sender, args) => {
- this.$refs.popbox.style.display = 'none'
- })
- this.spread.bind(GC.Spread.Sheets.Events.LeftColumnChanged, (sender, args) => {
- this.$refs.popbox.style.display = 'none'
- })
- this.spread.bind(GC.Spread.Sheets.Events.EditStarting, (s, e) => {
- if (this.paramdatainput && this.paramdatainput === '1') {
- const sheet = e.sheet; const row = e.row; const col = e.col; const cell = sheet.getCell(row, col)
- const formula = cell.formula()
- if (formula) {
- // const tag = cell.tag() || {}
- // tag.formula = formula
- cell.formula(undefined)
- // cell.tag(tag)
- sheet.startEdit()
- }
- }
- })
- this.spread.bind(GC.Spread.Sheets.Events.ActiveSheetChanged, (s, e) => {
- this.cellValue = this.getActiveCellInfo(this.spread)
- })
- // 监听键盘上下左右 动态显示单元格值
- this.spread.bind(GC.Spread.Sheets.Events.SelectionChanged, async(e, info) => {
- console.log('SelectionChanged')
- const args = info.newSelections[0]
- const sheetnow = info.sheet
- const sheetname = info.sheetName
- this.cellValue = this.getActiveCellInfo(this.spread)
- var deletedCellFormula = ''
- this.workSheetAllFormulaCells.forEach(item => {
- if (item.irow === args.row && item.icol === args.col && item.csheetName === sheetname) {
- deletedCellFormula = item.cformula
- }
- })
- if (sheetnow.hasFormula(args.row, args.col) || deletedCellFormula) {
- const formula = sheetnow.getFormula(args.row, args.col) || deletedCellFormula
- this.formulatype = formula.slice(0, 4)
- var positionInfo = sheetnow.getCellRect(args.row, args.col)
- this.$refs.popbox.style.top = this.showBtn ? positionInfo.y + 98 + (positionInfo.height) / 2 + 'px' : positionInfo.y + 22 + (positionInfo.height) / 2 + 'px'
- this.$refs.popbox.style.left = positionInfo.x + positionInfo.width + 19 + 'px'
- var isShow = formula.includes('ACCT') || formula.includes('XJLL') || formula.includes('VOUCHERACCT') || formula.includes('REF')
- if (!isShow) {
- this.$refs.popbox.style.display = 'none'
- return
- }
- this.$refs.popbox.style.display = 'block'
- if (sheetnow.toJSON().names) {
- var names = sheetnow.toJSON().names
- // 获取单元格设置的名称管理器
- for (var i = 0; i < names.length; i++) {
- if (Number(names[i].row) === args.row && Number(names[i].col) === args.col) {
- this.cformulaname = names[i].name
- }
- }
- }
- const data = {
- corgnid: this.cjoborgnid,
- creportid: this.creportid,
- creporthistoryid: this.creporthistoryid,
- ctype: '1',
- cell: {
- csheetname: args.sheetName,
- cformulaname: this.cformulaname,
- cformula: sheetnow.getFormula(args.row, args.col) || deletedCellFormula
- },
- iperiodclass: this.iperiodclassUsedByipeiodchanged,
- iyear: this.yearValue,
- iperiod: Number(this.iperiod),
- iendperiod: Number(this.iendperiod),
- include: this.iincludeaccount ? 1 : 0,
- idigits: this.decimalNumber
- }
- this.fullscreenLoading_popbox = true
- await viewsourse(data).then(res => {
- if (this.cformulaname === data.cell.cformulaname) {
- this.fullscreenLoading_popbox = false
- this.sourcedata = res
- }
- })
- } else {
- this.$refs.popbox.style.display = 'none'
- }
- })
- },
复制代码 [/code]
|