From d0048f4c5f95e626ce70c99916907862dc8a6f90 Mon Sep 17 00:00:00 2001 From: zhaoxiao Date: Mon, 6 Mar 2023 09:04:16 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=20ESLint=E3=80=91src/components/je?= =?UTF-8?q?ro/JVxeTable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jero-web/package.json | 1 + .../JVxeTable/components/JVxeSubPopover.vue | 2 +- .../jero/JVxeTable/components/JVxeTable.js | 52 +++++--- .../components/cells/JVxeDateCell.vue | 2 +- .../components/cells/JVxeDepartSelectCell.vue | 30 ++--- .../components/cells/JVxeDragSortCell.vue | 122 +++++++++--------- .../components/cells/JVxeSelectCell.vue | 62 ++++----- .../components/cells/JVxeUploadCell.vue | 80 ++++++------ .../components/cells/JVxeUserSelectCell.vue | 13 +- .../components/jero/JVxeTable/jvxeTypes.js | 1 - .../jero/JVxeTable/utils/vxeUtils.js | 15 ++- 11 files changed, 190 insertions(+), 190 deletions(-) diff --git a/jero-web/package.json b/jero-web/package.json index 4203720a..251cde0a 100644 --- a/jero-web/package.json +++ b/jero-web/package.json @@ -29,6 +29,7 @@ "lodash.get": "^4.4.2", "lodash.pick": "^4.4.0", "md5": "^2.2.1", + "moment": "^2.29.4", "nprogress": "^0.2.0", "tinymce": "5.4.1", "viser-vue": "^2.4.8", diff --git a/jero-web/src/components/jero/JVxeTable/components/JVxeSubPopover.vue b/jero-web/src/components/jero/JVxeTable/components/JVxeSubPopover.vue index f315e236..488683f9 100644 --- a/jero-web/src/components/jero/JVxeTable/components/JVxeSubPopover.vue +++ b/jero-web/src/components/jero/JVxeTable/components/JVxeSubPopover.vue @@ -89,7 +89,7 @@ export default { const clientHeight = tr.clientHeight this.$refs.div.style.width = clientWidth + 'px' this.$refs.div.style.height = clientHeight + 'px' - this.overlayStyle.width = Number.parseInt((clientWidth - clientWidth * 0.04)) + 'px' + this.overlayStyle.width = Number.parseInt((clientWidth - clientWidth * 0.04) + '') + 'px' this.overlayStyle.maxWidth = this.overlayStyle.width // update-begin-author:taoyan date:20200921 for: 子表弹出位置存在现实位置问题。 // let realTable = getParentNodeByTagName(tr, 'table') diff --git a/jero-web/src/components/jero/JVxeTable/components/JVxeTable.js b/jero-web/src/components/jero/JVxeTable/components/JVxeTable.js index 9772a9bf..e3d8b36e 100644 --- a/jero-web/src/components/jero/JVxeTable/components/JVxeTable.js +++ b/jero-web/src/components/jero/JVxeTable/components/JVxeTable.js @@ -204,7 +204,7 @@ export default { // update--begin--autor:lvdandan-----date:20201019------for:LOWCOD-882 【新行编辑】列表上带按钮的遮挡问题 if (column.$type === JVXETypes.file || column.$type === JVXETypes.image) { if (column.width && column.width.endsWith('px')) { - column.width = Number.parseInt(column.width.substr(0, column.width.length - 2)) + Number.parseInt(1) + 'px' + column.width = Number.parseInt(column.width.substr(0, column.width.length - 2)) + Number.parseInt('1') + 'px' } } // update--begin--autor:lvdandan-----date:20201019------for:LOWCOD-882 【新行编辑】列表上带按钮的遮挡问题 @@ -373,7 +373,8 @@ export default { // 防止和vxeTable自带的type起冲突 col.$type = col.type delete col.type - let renderName = 'cellRender'; const renderOptions = { name: JVXETypes._prefix + type } + let renderName = 'cellRender' + const renderOptions = { name: JVXETypes._prefix + type } if (type) { // hidden 是特殊的组件 if (type === JVXETypes.hidden) { @@ -482,7 +483,14 @@ export default { if (this.statistics.has) { width = 60 } - let col = { type: JVXETypes.rowDragSort, title: '', width, fixed: 'left', align: 'center', cellRender: { name: JVXETypes._prefix + JVXETypes.rowDragSort } } + let col = { + type: JVXETypes.rowDragSort, + title: '', + width, + fixed: 'left', + align: 'center', + cellRender: { name: JVXETypes._prefix + JVXETypes.rowDragSort } + } if (dragSortColumn) { col = Object.assign(col, dragSortColumn, { type: JVXETypes.rowDragSort }) } @@ -565,8 +573,9 @@ export default { // 记录滚动条的位置 scroll.top = event.scrollTop scroll.left = event.scrollLeft - - $refs.subPopover ? $refs.subPopover.close() : null + if ($refs.subPopover) { + $refs.subPopover.close() + } this.scrolling = true this.closeScrolling() }, @@ -615,15 +624,21 @@ export default { // 点击了可编辑的 if (column.editRender) { - $refs.subPopover ? $refs.subPopover.close() : null + if ($refs.subPopover) { + $refs.subPopover.close() + } return } // 显示详细信息 if (column.own.showDetails) { // 两个如果同时存在的话会出现死循环 - $refs.subPopover ? $refs.subPopover.close() : null - $refs.detailsModal ? $refs.detailsModal.open(event) : null + if ($refs.subPopover) { + $refs.subPopover.close() + } + if ($refs.detailsModal) { + $refs.detailsModal.open(event) + } } else if ($refs.subPopover) { $refs.subPopover.toggle(event) } else if (this.clickSelectRow) { @@ -764,7 +779,7 @@ export default { console.warn(`JVxeTable.setValues:必须传递数组`) return } - values.forEach((item, idx) => { + values.forEach((item) => { const { rowKey, values: record } = item const { row } = this.getIfRowById(rowKey) if (!row) { @@ -833,12 +848,12 @@ export default { }, /** 仅获取新增的数据,带有id */ getNewDataWithId () { - const newData = cloneObject(this.$refs.vxe.getInsertRecords()) - return newData + return cloneObject(this.$refs.vxe.getInsertRecords()) }, /** 根据ID获取行,新增的行也能查出来 */ getIfRowById (id) { - let row = this.getRowById(id); let isNew = false + let row = this.getRowById(id) + let isNew = false if (!row) { row = this.getNewRowById(id) if (!row) { @@ -1090,8 +1105,9 @@ export default { for (const row of rows) { const item = cloneObject(row) if (insertRecords.includes(row)) { - handler ? handler({ item, row, insertRecords }) : null - + if (handler) { + handler({ item, row, insertRecords }) + } if (remove) { continue } @@ -1198,7 +1214,9 @@ export default { async _recalcSortNumber () { const xTable = this.$refs.vxe.$refs.xTable if (this.dragSort) { - xTable.tableFullData.forEach((data, idx) => data[this.dragSortKey] = (idx + 1)) + xTable.tableFullData.forEach((data, idx) => { + data[this.dragSortKey] = (idx + 1) + }) } await xTable.updateCache(true) return await xTable.updateData() @@ -1218,7 +1236,7 @@ export default { // 遍历插入的行 // update--begin--autor:lvdandan-----date:20201117------for:LOWCOD-987 【新行编辑】js增强附表内置方法调用问题 #1819 // online js增强时以传过来值为准,不再赋默认值 - if (isOnlJs != true) { + if (isOnlJs !== true) { for (let i = 0; i < result.rows.length; i++) { const row = result.rows[i] this.trigger(triggerName, { @@ -1365,7 +1383,7 @@ export default { return null }, loadExcludeCode () { - if (!this.authPre || this.authPre.length == 0) { + if (!this.authPre || this.authPre.length === 0) { this.excludeCode = [] } else { let pre = this.authPre diff --git a/jero-web/src/components/jero/JVxeTable/components/cells/JVxeDateCell.vue b/jero-web/src/components/jero/JVxeTable/components/cells/JVxeDateCell.vue index 0e366bb4..14f4392b 100644 --- a/jero-web/src/components/jero/JVxeTable/components/cells/JVxeDateCell.vue +++ b/jero-web/src/components/jero/JVxeTable/components/cells/JVxeDateCell.vue @@ -14,7 +14,7 @@ diff --git a/jero-web/src/components/jero/JVxeTable/components/cells/JVxeDragSortCell.vue b/jero-web/src/components/jero/JVxeTable/components/cells/JVxeDragSortCell.vue index bbd918ee..c49ce432 100644 --- a/jero-web/src/components/jero/JVxeTable/components/cells/JVxeDragSortCell.vue +++ b/jero-web/src/components/jero/JVxeTable/components/cells/JVxeDragSortCell.vue @@ -1,8 +1,8 @@