From 90044289b992e5df6506c70b1e9bb299df321869 Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期三, 21 五月 2025 16:22:20 +0800
Subject: [PATCH] 1、全局加载名称调整为MDC智慧车间 2、消息确认页面调整设备异常反馈功能
---
src/components/jeecg/JVxeTable/components/JVxeTable.js | 310 +++++++++++++++++++++++++++++----------------------
1 files changed, 177 insertions(+), 133 deletions(-)
diff --git a/src/components/jeecg/JVxeTable/components/JVxeTable.js b/src/components/jeecg/JVxeTable/components/JVxeTable.js
index c1a1859..7d60fbb 100644
--- a/src/components/jeecg/JVxeTable/components/JVxeTable.js
+++ b/src/components/jeecg/JVxeTable/components/JVxeTable.js
@@ -23,7 +23,7 @@
}
},
mixins: [VxeWebSocketMixins],
- components: {JVxeToolbar, JVxeSubPopover, JVxeDetailsModal, JVxePagination},
+ components: { JVxeToolbar, JVxeSubPopover, JVxeDetailsModal, JVxePagination },
props: {
rowKey: PropTypes.string.def('id'),
// 鍒椾俊鎭�
@@ -48,7 +48,7 @@
// prefix 鍓嶇紑锛泂uffix 鍚庣紑锛�
slots: ['prefix', 'suffix'],
// add 鏂板鎸夐挳锛況emove 鍒犻櫎鎸夐挳锛沜learSelection 娓呯┖閫夋嫨鎸夐挳锛沜ollapse 灞曞紑鏀惰捣
- btns: ['add', 'remove', 'clearSelection'],
+ btns: ['add', 'remove', 'clearSelection']
})),
// 鏄惁鏄剧ず琛屽彿
rowNumber: PropTypes.bool.def(false),
@@ -66,7 +66,7 @@
// 鏈�澶ч珮搴�
maxHeight: {
type: Number,
- default: () => null,
+ default: () => null
},
// 瑕佺鐢ㄧ殑琛� TODO 鏈疄鐜�
disabledRows: PropTypes.object.def(() => ({})),
@@ -99,7 +99,7 @@
// 娉細璇ュ弬鏁颁笉鑳藉姩鎬佷慨鏀癸紱濡傛灉琛屻�佸垪瀛楁澶氱殑鎯呭喌涓嬶紝浼氭牴鎹満鍣ㄦ�ц兘閫犳垚涓嶅悓绋嬪害鐨勫崱椤裤��
alwaysEdit: PropTypes.bool.def(false),
// 鑱斿姩閰嶇疆锛屾暟缁勶紝璇︽儏閰嶇疆瑙佹枃妗�
- linkageConfig: PropTypes.array.def(() => []),
+ linkageConfig: PropTypes.array.def(() => [])
},
data() {
return {
@@ -107,11 +107,11 @@
// caseId锛岃〃鏍煎敮涓�鏍囪瘑
caseId: `_j-vxe-${randomString(8)}_`,
// 鍐呯疆columns
- _innerColumns: [],
+ innerColumns: [],
// 鍐呯疆 EditRules
- _innerEditRules: [],
+ innerEditRules: [],
// 璁板綍婊氬姩鏉′綅缃�
- scroll: {top: 0, left: 0},
+ scroll: { top: 0, left: 0 },
// 褰撳墠鏄惁姝e湪婊氬姩
scrolling: false,
// vxe 榛樿閰嶇疆
@@ -125,7 +125,7 @@
'show-header-overflow': true,
'show-footer-overflow': true,
// 鍙紪杈戦厤缃�
- 'edit-config': {trigger: 'click', mode: 'cell', showStatus: true},
+ 'edit-config': { trigger: 'click', mode: 'cell', showStatus: true },
'expand-config': {
iconClose: 'ant-table-row-expand-icon ant-table-row-collapsed',
iconOpen: 'ant-table-row-expand-icon ant-table-row-expanded'
@@ -137,8 +137,8 @@
// 'scroll-x': {
// gt: 15
// },
- 'radio-config': {highlight: true},
- 'checkbox-config': {highlight: true},
+ 'radio-config': { highlight: true },
+ 'checkbox-config': { highlight: true }
},
// 缁戝畾宸︿晶閫夋嫨妗�
selectedRows: [],
@@ -148,22 +148,22 @@
statistics: {
has: false,
sum: [],
- average: [],
+ average: []
},
// 鍏佽鎵ц鍒锋柊鐗规晥鐨勮ID
reloadEffectRowKeysMap: {},
//閰嶇疆浜嗕絾鏄病鏈夋巿鏉冪殑鎸夐挳鍜屽垪 闆嗗悎
- excludeCode:[],
+ excludeCode: [],
// 鑱斿姩涓嬫媺閫夐」锛堢敤浜庨殧绂讳笉鍚岀殑涓嬫媺閫夐」锛�
// 鍐呴儴鑱斿姩閰嶇疆锛宮ap
- _innerLinkageConfig: null,
+ innerLinkageConfig: null
}
},
computed: {
// vxe 鏈�缁� columns
vxeColumns() {
- this._innerColumns.forEach(column => {
+ this.innerColumns.forEach(column => {
let renderOptions = {
caseId: this.caseId,
bordered: this.bordered,
@@ -171,7 +171,7 @@
scrolling: this.scrolling,
reloadEffect: this.reloadEffect,
reloadEffectRowKeysMap: this.reloadEffectRowKeysMap,
- listeners: this.cellListeners,
+ listeners: this.cellListeners
}
if (column.$type === JVXETypes.rowDragSort) {
renderOptions.dragSortKey = this.dragSortKey
@@ -184,14 +184,14 @@
}
}
// 澶勭悊鑱斿姩鍒楋紝鑱斿姩鍒楀彧鑳戒綔鐢ㄤ簬 select 缁勪欢
- if (column.$type === JVXETypes.select && this._innerLinkageConfig != null) {
+ if (column.$type === JVXETypes.select && this.innerLinkageConfig != null) {
// 鍒ゆ柇褰撳墠鍒楁槸鍚︽槸鑱斿姩鍒�
- if (this._innerLinkageConfig.has(column.key)) {
+ if (this.innerLinkageConfig.has(column.key)) {
renderOptions.linkage = {
- config: this._innerLinkageConfig.get(column.key),
+ config: this.innerLinkageConfig.get(column.key),
getLinkageOptionsSibling: this.getLinkageOptionsSibling,
getLinkageOptionsAsync: this.getLinkageOptionsAsync,
- linkageSelectChange: this.linkageSelectChange,
+ linkageSelectChange: this.linkageSelectChange
}
}
}
@@ -204,38 +204,38 @@
// 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 銆愭柊琛岀紪杈戙�戝垪琛ㄤ笂甯︽寜閽殑閬尅闂
// update--begin--autor:lvdandan-----date:20201211------for:JT-118 銆恛nline銆� 鏃ユ湡銆佹椂闂存帶浠堕暱搴﹁緝灏�
if (column.$type === JVXETypes.datetime || column.$type === JVXETypes.userSelect || column.$type === JVXETypes.departSelect) {
- let width = column.width && column.width.endsWith('px')?Number.parseInt(column.width.substr(0,column.width.length-2)):0;
- if(width <= 190){
+ let width = column.width && column.width.endsWith('px') ? Number.parseInt(column.width.substr(0, column.width.length - 2)) : 0
+ if (width <= 190) {
column.width = '190px'
}
}
if (column.$type === JVXETypes.date) {
- let width = column.width && column.width.endsWith('px')?Number.parseInt(column.width.substr(0,column.width.length-2)):0;
- if(width <= 135){
+ let width = column.width && column.width.endsWith('px') ? Number.parseInt(column.width.substr(0, column.width.length - 2)) : 0
+ if (width <= 135) {
column.width = '135px'
}
}
// update--end--autor:lvdandan-----date:20201211------for:JT-118 銆恛nline銆� 鏃ユ湡銆佹椂闂存帶浠堕暱搴﹁緝灏�
})
- return this._innerColumns
+ return this.innerColumns
},
// vxe 鏈�缁� editRules
vxeEditRules() {
- return Object.assign({}, this.editRules, this._innerEditRules)
+ return Object.assign({}, this.editRules, this.innerEditRules)
},
// vxe 鏈�缁� props
vxeProps() {
let expandConfig = Object.assign({}, this.defaultVxeProps['expand-config'], this.expandConfig)
return Object.assign({}, this.defaultVxeProps, {
- showFooter: this.statistics.has,
+ showFooter: this.statistics.has
}, this.$attrs, {
loading: this.loading,
columns: this.vxeColumns,
@@ -245,7 +245,7 @@
maxHeight: this.maxHeight,
border: this.bordered,
expandConfig: expandConfig,
- footerMethod: this.handleFooterMethod,
+ footerMethod: this.handleFooterMethod
// footerSpanMethod: this.handleFooterSpanMethod,
})
},
@@ -259,7 +259,7 @@
'edit-actived': this.handleEditActived,
'radio-change': this.handleVxeRadioChange,
'checkbox-all': this.handleVxeCheckboxAll,
- 'checkbox-change': this.handleVxeCheckboxChange,
+ 'checkbox-change': this.handleVxeCheckboxChange
}
// 鐢ㄦ埛浼犻�掔殑浜嬩欢锛岃繘琛屽悎骞舵搷浣�
Object.keys(this.$listeners).forEach(key => {
@@ -285,9 +285,9 @@
/** 褰撳墠琛屽悜涓嬬Щ涓�浣� */
rowMoveDown: rowIndex => this.rowResort(rowIndex, rowIndex + 1),
/** 鍦ㄥ綋鍓嶈涓嬮潰鎻掑叆涓�琛� */
- rowInsertDown: rowIndex => this.insertRows({}, rowIndex + 1),
+ rowInsertDown: rowIndex => this.insertRows({}, rowIndex + 1)
}
- },
+ }
},
watch: {
dataSource: {
@@ -302,8 +302,8 @@
this.$set(data, this.dragSortKey, idx + 1)
}
// 澶勭悊鑱斿姩鍥炴樉鏁版嵁
- if (this._innerLinkageConfig != null) {
- for (let configItem of this._innerLinkageConfig.values()) {
+ if (this.innerLinkageConfig != null) {
+ for (let configItem of this.innerLinkageConfig.values()) {
this.autoSetLinkageOptionsByData(data, '', configItem, 0)
}
}
@@ -334,16 +334,16 @@
// }
// }
// })
- },
+ }
},
columns: {
immediate: true,
handler(columns) {
//鑾峰彇涓嶉渶瑕佹樉绀哄垪
this.loadExcludeCode()
- let _innerColumns = []
- let _innerEditRules = {}
- let {rowNumber, rowSelection, rowExpand, dragSort} = this
+ let innerColumns = []
+ let innerEditRules = {}
+ let { rowNumber, rowSelection, rowExpand, dragSort } = this
let expandColumn, seqColumn, checkboxColumn, radioColumn, dragSortColumn
if (Array.isArray(columns)) {
this.statistics.has = false
@@ -352,11 +352,11 @@
// 澶勭悊鎴恦xe鍙瘑鍒殑columns
columns.forEach(column => {
- if(this.excludeCode.indexOf(column.key)>=0){
+ if (this.excludeCode.indexOf(column.key) >= 0) {
return false
}
- let col = {...column}
- let {type} = col
+ let col = { ...column }
+ let { type } = col
const enhanced = getEnhancedMixins(type)
if (type === JVXETypes.rowNumber) {
seqColumn = col
@@ -373,7 +373,7 @@
// 闃叉鍜寁xeTable鑷甫鐨則ype璧峰啿绐�
col.$type = col.type
delete col.type
- let renderName = 'cellRender', renderOptions = {name: JVXETypes._prefix + type}
+ let renderName = 'cellRender', renderOptions = { name: JVXETypes._prefix + type }
if (type) {
// hidden 鏄壒娈婄殑缁勪欢
if (type === JVXETypes.hidden) {
@@ -422,7 +422,7 @@
rules.push(Object.assign({}, rule, replace))
}
}
- _innerEditRules[col.key] = rules
+ innerEditRules[col.key] = rules
}
// 澶勭悊缁熻鍒�
// sum = 姹傚拰銆乤verage = 骞冲潎鍊�
@@ -435,17 +435,17 @@
}
})
}
- _innerColumns.push(col)
+ innerColumns.push(col)
}
})
}
// 鍒ゆ柇鏄惁寮�鍚簡搴忓彿
if (rowNumber) {
- let col = {type: 'seq', title: '#', width: 60, fixed: 'left', align: 'center'}
+ let col = { type: 'seq', title: '#', width: 60, fixed: 'left', align: 'center' }
if (seqColumn) {
- col = Object.assign(col, seqColumn, {type: 'seq'})
+ col = Object.assign(col, seqColumn, { type: 'seq' })
}
- _innerColumns.unshift(col)
+ innerColumns.unshift(col)
}
// 鍒ゆ柇鏄惁寮�鍚簡鍙�夋嫨琛�
if (rowSelection) {
@@ -453,16 +453,16 @@
if (this.statistics.has && !rowExpand && !dragSort) {
width = 60
}
- let col = {type: this.rowSelectionType, width, fixed: 'left', align: 'center'}
+ let col = { type: this.rowSelectionType, width, fixed: 'left', align: 'center' }
// radio
if (this.rowSelectionType === 'radio' && radioColumn) {
- col = Object.assign(col, radioColumn, {type: 'radio'})
+ col = Object.assign(col, radioColumn, { type: 'radio' })
}
// checkbox
if (this.rowSelectionType === 'checkbox' && checkboxColumn) {
- col = Object.assign(col, checkboxColumn, {type: 'checkbox'})
+ col = Object.assign(col, checkboxColumn, { type: 'checkbox' })
}
- _innerColumns.unshift(col)
+ innerColumns.unshift(col)
}
// 鏄惁鍙睍寮�琛�
if (rowExpand) {
@@ -470,11 +470,18 @@
if (this.statistics.has && !dragSort) {
width = 60
}
- let col = {type: 'expand', title: '', width, fixed: 'left', align: 'center', slots: {content: 'expandContent'}}
- if (expandColumn) {
- col = Object.assign(col, expandColumn, {type: 'expand'})
+ let col = {
+ type: 'expand',
+ title: '',
+ width,
+ fixed: 'left',
+ align: 'center',
+ slots: { content: 'expandContent' }
}
- _innerColumns.unshift(col)
+ if (expandColumn) {
+ col = Object.assign(col, expandColumn, { type: 'expand' })
+ }
+ innerColumns.unshift(col)
}
// 鏄惁鍙嫋鍔ㄦ帓搴�
if (dragSort) {
@@ -482,15 +489,22 @@
if (this.statistics.has) {
width = 60
}
- 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})
+ let col = {
+ type: JVXETypes.rowDragSort,
+ title: '',
+ width,
+ fixed: 'left',
+ align: 'center',
+ cellRender: { name: JVXETypes._prefix + JVXETypes.rowDragSort }
}
- _innerColumns.unshift(col)
+ if (dragSortColumn) {
+ col = Object.assign(col, dragSortColumn, { type: JVXETypes.rowDragSort })
+ }
+ innerColumns.unshift(col)
}
- this._innerColumns = _innerColumns
- this._innerEditRules = _innerEditRules
+ this.innerColumns = innerColumns
+ this.innerEditRules = innerEditRules
}
},
// watch linkageConfig
@@ -501,7 +515,7 @@
if (Array.isArray(this.linkageConfig) && this.linkageConfig.length > 0) {
// 鑾峰彇鑱斿姩鐨刱ey椤哄簭
let getLcKeys = (key, arr) => {
- let col = this._innerColumns.find(col => col.key === key)
+ let col = this.innerColumns.find(col => col.key === key)
if (col) {
arr.push(col.key)
if (col.linkageKey) {
@@ -520,12 +534,12 @@
}
keys.forEach(k => configMap.set(k, configItem))
})
- this._innerLinkageConfig = configMap
+ this.innerLinkageConfig = configMap
} else {
- this._innerLinkageConfig = null
+ this.innerLinkageConfig = null
}
}
- },
+ }
},
created() {
},
@@ -559,7 +573,7 @@
},
handleVxeScroll(event) {
- let {$refs, scroll} = this
+ let { $refs, scroll } = this
// 璁板綍婊氬姩鏉$殑浣嶇疆
scroll.top = event.scrollTop
@@ -609,8 +623,8 @@
// 鐐瑰嚮鍗曞厓鏍兼椂瑙﹀彂鐨勪簨浠�
handleCellClick(event) {
- let {row, column, $event, $table} = event
- let {$refs} = this
+ let { row, column, $event, $table } = event
+ let { $refs } = this
// 鐐瑰嚮浜嗗彲缂栬緫鐨�
if (column.editRender) {
@@ -651,20 +665,20 @@
},
// 鍗曞厓鏍肩紪杈戠姸鎬佷笅琚叧闂椂浼氳Е鍙戣浜嬩欢
- handleEditClosed({column}) {
+ handleEditClosed({ column }) {
// 鎵ц澧炲己
getEnhancedMixins(column.own.$type, 'aopEvents').editClosed.apply(this, arguments)
},
// 鍗曞厓鏍艰婵�娲荤紪杈戞椂浼氳Е鍙戣浜嬩欢
- handleEditActived({column}) {
+ handleEditActived({ column }) {
// 鎵ц澧炲己
getEnhancedMixins(column.own.$type, 'aopEvents').editActived.apply(this, arguments)
},
/** 琛ㄥ熬鏁版嵁澶勭悊鏂规硶锛岀敤浜庢樉绀虹粺璁′俊鎭� */
- handleFooterMethod({columns, data}) {
- const {statistics} = this
+ handleFooterMethod({ columns, data }) {
+ const { statistics } = this
let footers = []
if (statistics.has) {
if (statistics.sum.length > 0) {
@@ -687,7 +701,7 @@
return footers
},
- getFooterStatisticsMap({columns, title, checks, method}) {
+ getFooterStatisticsMap({ columns, title, checks, method }) {
return columns.map((column, columnIndex) => {
if (columnIndex === 0) {
return title
@@ -702,7 +716,7 @@
/** 琛ㄥ熬鍗曞厓鏍煎悎骞舵柟娉� */
handleFooterSpanMethod(event) {
if (event.columnIndex === 0) {
- return {colspan: 2}
+ return { colspan: 2 }
}
},
@@ -715,7 +729,12 @@
resetScrollTop(top) {
this.scrollTo(null, (top == null || top === '') ? this.scroll.top : top)
},
-
+ clearAllData() {
+ let { xTable } = this.$refs.vxe.$refs
+ // issues/2784
+ // 鍏堟竻绌烘墍鏈夋暟鎹�
+ xTable.loadData([])
+ },
/**
* 鍔犺浇鏂版暟鎹紝鍜� loadData 涓嶅悓鐨勬槸锛岀敤璇ユ柟娉曞姞杞界殑鏁版嵁閮芥槸鐩稿綋浜庣偣鏂板鎸夐挳鏂板鐨勬暟鎹��
* 閫傜敤浜庝笉鏄暟鎹簱閲屾煡鍑烘潵鐨勬病鏈塱d鐨勪复鏃舵暟鎹�
@@ -723,7 +742,7 @@
*/
async loadNewData(dataSource) {
if (Array.isArray(dataSource)) {
- let {xTable} = this.$refs.vxe.$refs
+ let { xTable } = this.$refs.vxe.$refs
// issues/2784
// 鍏堟竻绌烘墍鏈夋暟鎹�
xTable.loadData([])
@@ -734,8 +753,8 @@
this.$set(data, this.dragSortKey, idx + 1)
}
// 澶勭悊鑱斿姩鍥炴樉鏁版嵁
- if (this._innerLinkageConfig != null) {
- for (let configItem of this._innerLinkageConfig.values()) {
+ if (this.innerLinkageConfig != null) {
+ for (let configItem of this.innerLinkageConfig.values()) {
this.autoSetLinkageOptionsByData(data, '', configItem, 0)
}
}
@@ -763,9 +782,11 @@
console.warn(`JVxeTable.setValues锛氬繀椤讳紶閫掓暟缁刞)
return
}
+ // 鏄惁鏇存柊浜嗘暟鎹�
+ let updated = false
values.forEach((item, idx) => {
- let {rowKey, values: record} = item
- let {row} = this.getIfRowById(rowKey)
+ let { rowKey, values: record } = item
+ let { row } = this.getIfRowById(rowKey)
if (!row) {
return
}
@@ -775,6 +796,7 @@
let oldValue = row[colKey]
let newValue = record[colKey]
if (newValue !== oldValue) {
+ updated = true
this.$set(row, colKey, newValue)
// 瑙﹀彂 valueChange 浜嬩欢
this.trigger('valueChange', {
@@ -783,7 +805,7 @@
oldValue: oldValue,
col: column.own,
column: column,
- isSetValues: true,
+ isSetValues: true
})
}
} else {
@@ -791,6 +813,14 @@
}
})
})
+ // 銆恑ssues/3828銆戞暟鎹洿鏂板悗锛岄噸鏂拌绠楃粺璁″垪
+ if (updated && this.statistics.has) {
+ this.$nextTick(async () => {
+ let { xTable } = this.$refs.vxe.$refs
+ await xTable.updateCache(true)
+ await xTable.updateData()
+ })
+ }
},
/** 鑾峰彇鎵�鏈夌殑鏁版嵁锛屽寘鎷瑅alues銆乨eleteIds */
@@ -802,18 +832,18 @@
},
/** 鑾峰彇琛ㄦ牸琛ㄥ崟閲岀殑鍊� */
getValues(callback, rowIds) {
- let tableData = this.getTableData({rowIds: rowIds})
+ let tableData = this.getTableData({ rowIds: rowIds })
callback('', tableData)
},
/** 鑾峰彇琛ㄦ牸鏁版嵁 */
getTableData(options = {}) {
- let {rowIds} = options
+ let { rowIds } = options
let tableData
// 浠呮煡璇㈡寚瀹歩d鐨勮
if (Array.isArray(rowIds) && rowIds.length > 0) {
tableData = []
rowIds.forEach(rowId => {
- let {row} = this.getIfRowById(rowId)
+ let { row } = this.getIfRowById(rowId)
if (row) {
tableData.push(row)
}
@@ -842,11 +872,11 @@
row = this.getNewRowById(id)
if (!row) {
console.warn(`JVxeTable.getIfRowById锛氭病鏈夋壘鍒癷d涓�"${id}"鐨勮`)
- return {row: null}
+ return { row: null }
}
isNew = true
}
- return {row, isNew}
+ return { row, isNew }
},
/** 閫氳繃涓存椂ID鑾峰彇鏂板鐨勮 */
getNewRowById(id) {
@@ -894,8 +924,8 @@
* @param options.setActive 鏄惁婵�娲绘渶鍚庝竴琛岀殑缂栬緫妯″紡
*/
async pushRows(rows = {}, options = {}) {
- let {xTable} = this.$refs.vxe.$refs
- let {setActive, index} = options
+ let { xTable } = this.$refs.vxe.$refs
+ let { setActive, index } = options
setActive = setActive == null ? false : !!setActive
index = index == null ? -1 : index
index = index === -1 ? index : xTable.tableFullData[index]
@@ -911,7 +941,7 @@
/** 娓呯┖閫夋嫨琛� */
clearSelection() {
- let event = {$table: this.$refs.vxe, target: this}
+ let event = { $table: this.$refs.vxe, target: this }
if (this.rowSelectionType === JVXETypes.rowRadio) {
this.$refs.vxe.clearRadioRow()
this.handleVxeRadioChange(event)
@@ -937,7 +967,7 @@
rowIds = [rowId]
}
let rows = rowIds.map((id) => {
- let {row} = this.getIfRowById(id)
+ let { row } = this.getIfRowById(id)
if (!row) {
return
}
@@ -1045,7 +1075,7 @@
values[config.keys[i]] = ''
}
// 娓呯┖鍚庡嚑鍒楃殑鏁版嵁
- this.setValues([{rowKey: row.id, values}])
+ this.setValues([{ rowKey: row.id, values }])
}
},
@@ -1068,12 +1098,12 @@
})
},
//options鑷畾涔夎祴鍊� 鍒锋柊
- virtualRefresh(){
+ virtualRefresh() {
this.scrolling = true
this.closeScrolling()
},
// 璁剧疆 this.scrolling 闃叉姈妯″紡
- closeScrolling: simpleDebounce(function () {
+ closeScrolling: simpleDebounce(function() {
this.scrolling = false
}, 100),
@@ -1089,7 +1119,7 @@
for (let row of rows) {
let item = cloneObject(row)
if (insertRecords.includes(row)) {
- handler ? handler({item, row, insertRecords}) : null
+ handler ? handler({ item, row, insertRecords }) : null
if (remove) {
continue
@@ -1118,9 +1148,19 @@
_remove(rows) {
const xTable = this.$refs.vxe.$refs.xTable
- const {afterFullData, tableFullData, tableSourceData, editStore, treeConfig, checkboxOpts, selection, isInsertByRow, scrollYLoad} = xTable
- const {actived, removeList, insertList} = editStore
- const {checkField: property} = checkboxOpts
+ const {
+ afterFullData,
+ tableFullData,
+ tableSourceData,
+ editStore,
+ treeConfig,
+ checkboxOpts,
+ selection,
+ isInsertByRow,
+ scrollYLoad
+ } = xTable
+ const { actived, removeList, insertList } = editStore
+ const { checkField: property } = checkboxOpts
let rest = []
const nowData = afterFullData
if (treeConfig) {
@@ -1171,7 +1211,7 @@
}
return xTable.$nextTick().then(() => {
xTable.recalculate()
- return {row: rest.length ? rest[rest.length - 1] : null, rows: rest}
+ return { row: rest.length ? rest[rest.length - 1] : null, rows: rest }
})
},
@@ -1204,7 +1244,7 @@
},
async _addOrInsert(rows = {}, index, triggerName, isOnlJs) {
- let {xTable} = this.$refs.vxe.$refs
+ let { xTable } = this.$refs.vxe.$refs
let records
if (Array.isArray(rows)) {
records = rows
@@ -1213,7 +1253,7 @@
}
// 閬嶅巻娣诲姞榛樿鍊�
records.forEach(record => this._createRow(record))
- let result = await this.pushRows(records, {index: index, setActive: true})
+ let result = await this.pushRows(records, { index: index, setActive: true })
// 閬嶅巻鎻掑叆鐨勮
// update--begin--autor:lvdandan-----date:20201117------for:LOWCOD-987 銆愭柊琛岀紪杈戙�慾s澧炲己闄勮〃鍐呯疆鏂规硶璋冪敤闂 #1819
// online js澧炲己鏃朵互浼犺繃鏉ュ�间负鍑嗭紝涓嶅啀璧嬮粯璁ゅ��
@@ -1223,7 +1263,7 @@
this.trigger(triggerName, {
row: row,
$table: xTable,
- target: this,
+ target: this
})
}
}
@@ -1232,20 +1272,20 @@
},
// 鍒涘缓鏂拌锛岃嚜鍔ㄦ坊鍔犻粯璁ゅ��
_createRow(record = {}) {
- let {xTable} = this.$refs.vxe.$refs
+ let { xTable } = this.$refs.vxe.$refs
// 娣诲姞榛樿鍊�
xTable.tableFullColumn.forEach(column => {
let col = column.own
if (col.key && (record[col.key] == null || record[col.key] === '')) {
// 璁剧疆榛樿鍊�
let createValue = getEnhancedMixins(col.$type || col.type, 'createValue')
- record[col.key] = createValue({row: record, column, $table: xTable})
+ record[col.key] = createValue({ row: record, column, $table: xTable })
}
// update-begin--author:sunjianlei---date:20210819------for: 澶勭悊鑱斿姩鍒楋紝鑱斿姩鍒楀彧鑳戒綔鐢ㄤ簬 select 缁勪欢
- if (col.$type === JVXETypes.select && this._innerLinkageConfig != null) {
+ if (col.$type === JVXETypes.select && this.innerLinkageConfig != null) {
// 鍒ゆ柇褰撳墠鍒楁槸鍚︽槸鑱斿姩鍒�
- if (this._innerLinkageConfig.has(col.key)) {
- let configItem = this._innerLinkageConfig.get(col.key)
+ if (this.innerLinkageConfig.has(col.key)) {
+ let configItem = this.innerLinkageConfig.get(col.key)
this.getLinkageOptionsAsync(configItem, '')
}
}
@@ -1264,7 +1304,7 @@
props: this.vxeProps,
on: this.vxeEvents,
// 浣滅敤鍩熸彃妲界殑鏍煎紡涓�
- scopedSlots: this.$scopedSlots,
+ scopedSlots: this.$scopedSlots
})
},
// 娓叉煋宸ュ叿鏍�
@@ -1277,7 +1317,7 @@
size: this.size,
disabled: this.disabled,
disabledRows: this.disabledRows,
- selectedRowIds: this.selectedRowIds,
+ selectedRowIds: this.selectedRowIds
},
on: {
// 鏂板浜嬩欢
@@ -1285,7 +1325,7 @@
// 淇濆瓨浜嬩欢
save: () => this.trigger('save', {
$table: this.$refs.vxe,
- target: this,
+ target: this
}),
// 鍒犻櫎浜嬩欢
remove: () => {
@@ -1293,7 +1333,7 @@
let deleteRows = this.filterNewRows(this.selectedRows)
// 瑙﹀彂鍒犻櫎浜嬩欢
if (deleteRows.length > 0) {
- let removeEvent = {deleteRows, $table, target: this}
+ let removeEvent = { deleteRows, $table, target: this }
if (this.asyncRemove) {
// 纭鍒犻櫎锛屽彧鏈夎皟鐢ㄨ繖涓柟娉曟墠浼氱湡鍒犻櫎
removeEvent.confirmRemove = () => this.removeSelection()
@@ -1310,8 +1350,8 @@
},
scopedSlots: {
toolbarPrefix: this.$scopedSlots.toolbarPrefix,
- toolbarSuffix: this.$scopedSlots.toolbarSuffix,
- },
+ toolbarSuffix: this.$scopedSlots.toolbarSuffix
+ }
})
}
return null
@@ -1329,7 +1369,7 @@
return h('j-vxe-sub-popover', {
ref: 'subPopover',
scopedSlots: {
- subForm: this.$scopedSlots.subForm,
+ subForm: this.$scopedSlots.subForm
}
})
}
@@ -1358,17 +1398,17 @@
},
on: {
change: (e) => this.trigger('pageChange', e)
- },
+ }
})
}
return null
},
- loadExcludeCode(){
- if(!this.authPre || this.authPre.length==0){
+ loadExcludeCode() {
+ if (!this.authPre || this.authPre.length == 0) {
this.excludeCode = []
- }else{
+ } else {
let pre = this.authPre
- if(!pre.endsWith(':')){
+ if (!pre.endsWith(':')) {
pre += ':'
}
this.excludeCode = getNoAuthCols(pre)
@@ -1385,7 +1425,7 @@
this.renderToolbar(h),
this.renderToolbarAfterSlot(),
this.renderVxeGrid(h),
- this.renderPagination(h),
+ this.renderPagination(h)
])
},
beforeDestroy() {
@@ -1395,23 +1435,27 @@
// 鍏煎 online 鐨勮鍒�
const fooPatterns = [
- {title: '闈炵┖', value: '*', pattern: /^.+$/},
- {title: '6鍒�16浣嶆暟瀛�', value: 'n6-16', pattern: /^\d{6,16}$/},
- {title: '6鍒�16浣嶄换鎰忓瓧绗�', value: '*6-16', pattern: /^.{6,16}$/},
- {title: '6鍒�18浣嶅瓧姣�', value: 's6-18', pattern: /^[a-z|A-Z]{6,18}$/},
- {title: '缃戝潃', value: 'url', pattern: /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/},
- {title: '鐢靛瓙閭欢', value: 'e', pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/},
- {title: '鎵嬫満鍙风爜', value: 'm', pattern: /^1[3456789]\d{9}$/},
- {title: '閭斂缂栫爜', value: 'p', pattern: /^[1-9]\d{5}$/},
- {title: '瀛楁瘝', value: 's', pattern: /^[A-Z|a-z]+$/},
- {title: '鏁板瓧', value: 'n', pattern: /^-?\d+(\.?\d+|\d?)$/},
- {title: '鏁存暟', value: 'z', pattern: /^-?\d+$/},
- {title: '閲戦', value: 'money', pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/},
+ { title: '闈炵┖', value: '*', pattern: /^.+$/ },
+ { title: '6鍒�16浣嶆暟瀛�', value: 'n6-16', pattern: /^\d{6,16}$/ },
+ { title: '6鍒�16浣嶄换鎰忓瓧绗�', value: '*6-16', pattern: /^.{6,16}$/ },
+ { title: '6鍒�18浣嶅瓧姣�', value: 's6-18', pattern: /^[a-z|A-Z]{6,18}$/ },
+ {
+ title: '缃戝潃',
+ value: 'url',
+ pattern: /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/
+ },
+ { title: '鐢靛瓙閭欢', value: 'e', pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/ },
+ { title: '鎵嬫満鍙风爜', value: 'm', pattern: /^1[3456789]\d{9}$/ },
+ { title: '閭斂缂栫爜', value: 'p', pattern: /^[0-9]{6}$/ },
+ { title: '瀛楁瘝', value: 's', pattern: /^[A-Z|a-z]+$/ },
+ { title: '鏁板瓧', value: 'n', pattern: /^-?\d+(\.?\d+|\d?)$/ },
+ { title: '鏁存暟', value: 'z', pattern: /^-?\d+$/ },
+ { title: '閲戦', value: 'money', pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,5}))$/ }
]
/** 鏃х増handler杞负鏂扮増Validator */
function handlerConvertToValidator(event) {
- const {column, rule} = event
+ const { column, rule } = event
return new Promise((resolve, reject) => {
rule.handler(event, (flag, msg) => {
let message = rule.message
@@ -1431,7 +1475,7 @@
/** 鍞竴鏍¢獙鍣� */
function uniqueValidator(event) {
- const {cellValue, column, rule} = event
+ const { cellValue, column, rule } = event
let tableData = this.getTableData()
let findCount = 0
for (let rowData of tableData) {
@@ -1442,4 +1486,4 @@
}
}
return Promise.resolve()
-}
\ No newline at end of file
+}
--
Gitblit v1.9.3