【fix ESLint】src/components/jero/JVxeTable
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
"lodash.get": "^4.4.2",
|
"lodash.get": "^4.4.2",
|
||||||
"lodash.pick": "^4.4.0",
|
"lodash.pick": "^4.4.0",
|
||||||
"md5": "^2.2.1",
|
"md5": "^2.2.1",
|
||||||
|
"moment": "^2.29.4",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"tinymce": "5.4.1",
|
"tinymce": "5.4.1",
|
||||||
"viser-vue": "^2.4.8",
|
"viser-vue": "^2.4.8",
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ export default {
|
|||||||
const clientHeight = tr.clientHeight
|
const clientHeight = tr.clientHeight
|
||||||
this.$refs.div.style.width = clientWidth + 'px'
|
this.$refs.div.style.width = clientWidth + 'px'
|
||||||
this.$refs.div.style.height = clientHeight + '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
|
this.overlayStyle.maxWidth = this.overlayStyle.width
|
||||||
// update-begin-author:taoyan date:20200921 for: 子表弹出位置存在现实位置问题。
|
// update-begin-author:taoyan date:20200921 for: 子表弹出位置存在现实位置问题。
|
||||||
// let realTable = getParentNodeByTagName(tr, 'table')
|
// let realTable = getParentNodeByTagName(tr, 'table')
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ export default {
|
|||||||
// update--begin--autor:lvdandan-----date:20201019------for:LOWCOD-882 【新行编辑】列表上带按钮的遮挡问题
|
// update--begin--autor:lvdandan-----date:20201019------for:LOWCOD-882 【新行编辑】列表上带按钮的遮挡问题
|
||||||
if (column.$type === JVXETypes.file || column.$type === JVXETypes.image) {
|
if (column.$type === JVXETypes.file || column.$type === JVXETypes.image) {
|
||||||
if (column.width && column.width.endsWith('px')) {
|
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:20201019------for:LOWCOD-882 【新行编辑】列表上带按钮的遮挡问题
|
||||||
@@ -373,7 +373,8 @@ export default {
|
|||||||
// 防止和vxeTable自带的type起冲突
|
// 防止和vxeTable自带的type起冲突
|
||||||
col.$type = col.type
|
col.$type = col.type
|
||||||
delete 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) {
|
if (type) {
|
||||||
// hidden 是特殊的组件
|
// hidden 是特殊的组件
|
||||||
if (type === JVXETypes.hidden) {
|
if (type === JVXETypes.hidden) {
|
||||||
@@ -482,7 +483,14 @@ export default {
|
|||||||
if (this.statistics.has) {
|
if (this.statistics.has) {
|
||||||
width = 60
|
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) {
|
if (dragSortColumn) {
|
||||||
col = Object.assign(col, dragSortColumn, { type: JVXETypes.rowDragSort })
|
col = Object.assign(col, dragSortColumn, { type: JVXETypes.rowDragSort })
|
||||||
}
|
}
|
||||||
@@ -565,8 +573,9 @@ export default {
|
|||||||
// 记录滚动条的位置
|
// 记录滚动条的位置
|
||||||
scroll.top = event.scrollTop
|
scroll.top = event.scrollTop
|
||||||
scroll.left = event.scrollLeft
|
scroll.left = event.scrollLeft
|
||||||
|
if ($refs.subPopover) {
|
||||||
$refs.subPopover ? $refs.subPopover.close() : null
|
$refs.subPopover.close()
|
||||||
|
}
|
||||||
this.scrolling = true
|
this.scrolling = true
|
||||||
this.closeScrolling()
|
this.closeScrolling()
|
||||||
},
|
},
|
||||||
@@ -615,15 +624,21 @@ export default {
|
|||||||
|
|
||||||
// 点击了可编辑的
|
// 点击了可编辑的
|
||||||
if (column.editRender) {
|
if (column.editRender) {
|
||||||
$refs.subPopover ? $refs.subPopover.close() : null
|
if ($refs.subPopover) {
|
||||||
|
$refs.subPopover.close()
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 显示详细信息
|
// 显示详细信息
|
||||||
if (column.own.showDetails) {
|
if (column.own.showDetails) {
|
||||||
// 两个如果同时存在的话会出现死循环
|
// 两个如果同时存在的话会出现死循环
|
||||||
$refs.subPopover ? $refs.subPopover.close() : null
|
if ($refs.subPopover) {
|
||||||
$refs.detailsModal ? $refs.detailsModal.open(event) : null
|
$refs.subPopover.close()
|
||||||
|
}
|
||||||
|
if ($refs.detailsModal) {
|
||||||
|
$refs.detailsModal.open(event)
|
||||||
|
}
|
||||||
} else if ($refs.subPopover) {
|
} else if ($refs.subPopover) {
|
||||||
$refs.subPopover.toggle(event)
|
$refs.subPopover.toggle(event)
|
||||||
} else if (this.clickSelectRow) {
|
} else if (this.clickSelectRow) {
|
||||||
@@ -764,7 +779,7 @@ export default {
|
|||||||
console.warn(`JVxeTable.setValues:必须传递数组`)
|
console.warn(`JVxeTable.setValues:必须传递数组`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
values.forEach((item, idx) => {
|
values.forEach((item) => {
|
||||||
const { rowKey, values: record } = item
|
const { rowKey, values: record } = item
|
||||||
const { row } = this.getIfRowById(rowKey)
|
const { row } = this.getIfRowById(rowKey)
|
||||||
if (!row) {
|
if (!row) {
|
||||||
@@ -833,12 +848,12 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 仅获取新增的数据,带有id */
|
/** 仅获取新增的数据,带有id */
|
||||||
getNewDataWithId () {
|
getNewDataWithId () {
|
||||||
const newData = cloneObject(this.$refs.vxe.getInsertRecords())
|
return cloneObject(this.$refs.vxe.getInsertRecords())
|
||||||
return newData
|
|
||||||
},
|
},
|
||||||
/** 根据ID获取行,新增的行也能查出来 */
|
/** 根据ID获取行,新增的行也能查出来 */
|
||||||
getIfRowById (id) {
|
getIfRowById (id) {
|
||||||
let row = this.getRowById(id); let isNew = false
|
let row = this.getRowById(id)
|
||||||
|
let isNew = false
|
||||||
if (!row) {
|
if (!row) {
|
||||||
row = this.getNewRowById(id)
|
row = this.getNewRowById(id)
|
||||||
if (!row) {
|
if (!row) {
|
||||||
@@ -1090,8 +1105,9 @@ export default {
|
|||||||
for (const row of rows) {
|
for (const row of rows) {
|
||||||
const item = cloneObject(row)
|
const item = cloneObject(row)
|
||||||
if (insertRecords.includes(row)) {
|
if (insertRecords.includes(row)) {
|
||||||
handler ? handler({ item, row, insertRecords }) : null
|
if (handler) {
|
||||||
|
handler({ item, row, insertRecords })
|
||||||
|
}
|
||||||
if (remove) {
|
if (remove) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -1198,7 +1214,9 @@ export default {
|
|||||||
async _recalcSortNumber () {
|
async _recalcSortNumber () {
|
||||||
const xTable = this.$refs.vxe.$refs.xTable
|
const xTable = this.$refs.vxe.$refs.xTable
|
||||||
if (this.dragSort) {
|
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)
|
await xTable.updateCache(true)
|
||||||
return await xTable.updateData()
|
return await xTable.updateData()
|
||||||
@@ -1218,7 +1236,7 @@ export default {
|
|||||||
// 遍历插入的行
|
// 遍历插入的行
|
||||||
// update--begin--autor:lvdandan-----date:20201117------for:LOWCOD-987 【新行编辑】js增强附表内置方法调用问题 #1819
|
// update--begin--autor:lvdandan-----date:20201117------for:LOWCOD-987 【新行编辑】js增强附表内置方法调用问题 #1819
|
||||||
// online js增强时以传过来值为准,不再赋默认值
|
// online js增强时以传过来值为准,不再赋默认值
|
||||||
if (isOnlJs != true) {
|
if (isOnlJs !== true) {
|
||||||
for (let i = 0; i < result.rows.length; i++) {
|
for (let i = 0; i < result.rows.length; i++) {
|
||||||
const row = result.rows[i]
|
const row = result.rows[i]
|
||||||
this.trigger(triggerName, {
|
this.trigger(triggerName, {
|
||||||
@@ -1365,7 +1383,7 @@ export default {
|
|||||||
return null
|
return null
|
||||||
},
|
},
|
||||||
loadExcludeCode () {
|
loadExcludeCode () {
|
||||||
if (!this.authPre || this.authPre.length == 0) {
|
if (!this.authPre || this.authPre.length === 0) {
|
||||||
this.excludeCode = []
|
this.excludeCode = []
|
||||||
} else {
|
} else {
|
||||||
let pre = this.authPre
|
let pre = this.authPre
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import { JVXETypes } from '@/components/jero/JVxeTable/index'
|
import { JVXETypes } from '@comp/jero/JVxeTable'
|
||||||
import JVxeCellMixins, { dispatchEvent } from '@/components/jero/JVxeTable/mixins/JVxeCellMixins'
|
import JVxeCellMixins, { dispatchEvent } from '@/components/jero/JVxeTable/mixins/JVxeCellMixins'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import JVxeCellMixins, { dispatchEvent } from '@/components/jero/JVxeTable/mixins/JVxeCellMixins'
|
import JVxeCellMixins from '@/components/jero/JVxeTable/mixins/JVxeCellMixins'
|
||||||
import JSelectDepartModal from '@/components/jerobiz/modal/JSelectDepartModal'
|
import JSelectDepartModal from '@/components/jerobiz/modal/JSelectDepartModal'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -55,10 +55,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
componentDisabled () {
|
componentDisabled () {
|
||||||
if (this.cellProps.disabled == true) {
|
return this.cellProps.disabled === true
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
},
|
},
|
||||||
modalWidth () {
|
modalWidth () {
|
||||||
if (this.cellProps.modalWidth) {
|
if (this.cellProps.modalWidth) {
|
||||||
@@ -68,18 +65,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
multi () {
|
multi () {
|
||||||
if (this.cellProps.multi == false) {
|
console.log(this.cellProps)
|
||||||
return false
|
return this.cellProps.multi !== false
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
rootOpened () {
|
rootOpened () {
|
||||||
if (this.cellProps.open == false) {
|
return this.cellProps.open !== false
|
||||||
return false
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -102,12 +92,12 @@ export default {
|
|||||||
this.handleOK('')
|
this.handleOK('')
|
||||||
},
|
},
|
||||||
handleOK (rows, idstr) {
|
handleOK (rows, idstr) {
|
||||||
let value = ''
|
// let value = ''
|
||||||
if (!rows && rows.length <= 0) {
|
if (!rows && rows.length <= 0) {
|
||||||
this.departNames = ''
|
this.departNames = ''
|
||||||
this.departIds = ''
|
this.departIds = ''
|
||||||
} else {
|
} else {
|
||||||
value = rows.map(row => row[this.customReturnField]).join(',')
|
// value = rows.map(row => row[this.customReturnField]).join(',')
|
||||||
this.departNames = rows.map(row => row.departName).join(',')
|
this.departNames = rows.map(row => row.departName).join(',')
|
||||||
this.departIds = idstr
|
this.departIds = idstr
|
||||||
}
|
}
|
||||||
@@ -132,7 +122,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/deep/ .jvxe-select-input .ant-input{
|
/deep/ .jvxe-select-input .ant-input {
|
||||||
border: none !important;
|
border: none !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-dropdown :trigger="['click']">
|
<a-dropdown :trigger="['click']">
|
||||||
<div class="j-vxe-ds-icons">
|
<div class="j-vxe-ds-icons">
|
||||||
<a-icon type="align-left"/>
|
<a-icon type="align-left" />
|
||||||
<a-icon type="align-right"/>
|
<a-icon type="align-right" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="j-vxe-ds-btns">-->
|
<!-- <div class="j-vxe-ds-btns">-->
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<a-menu slot="overlay">
|
<a-menu slot="overlay">
|
||||||
<a-menu-item key="0" :disabled="disabledMoveUp" @click="handleRowMoveUp">向上移</a-menu-item>
|
<a-menu-item key="0" :disabled="disabledMoveUp" @click="handleRowMoveUp">向上移</a-menu-item>
|
||||||
<a-menu-item key="1" :disabled="disabledMoveDown" @click="handleRowMoveDown">向下移</a-menu-item>
|
<a-menu-item key="1" :disabled="disabledMoveDown" @click="handleRowMoveDown">向下移</a-menu-item>
|
||||||
<a-menu-divider/>
|
<a-menu-divider />
|
||||||
<a-menu-item key="3" @click="handleRowInsertDown">插入一行</a-menu-item>
|
<a-menu-item key="3" @click="handleRowInsertDown">插入一行</a-menu-item>
|
||||||
</a-menu>
|
</a-menu>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
@@ -39,14 +39,14 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 向上移 */
|
/** 向上移 */
|
||||||
handleRowMoveUp (event) {
|
handleRowMoveUp () {
|
||||||
// event.target.blur()
|
// event.target.blur()
|
||||||
if (!this.disabledMoveUp) {
|
if (!this.disabledMoveUp) {
|
||||||
this.trigger('rowMoveUp', this.rowIndex)
|
this.trigger('rowMoveUp', this.rowIndex)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/** 向下移 */
|
/** 向下移 */
|
||||||
handleRowMoveDown (event) {
|
handleRowMoveDown () {
|
||||||
// event.target.blur()
|
// event.target.blur()
|
||||||
if (!this.disabledMoveDown) {
|
if (!this.disabledMoveDown) {
|
||||||
this.trigger('rowMoveDown', this.rowIndex)
|
this.trigger('rowMoveDown', this.rowIndex)
|
||||||
@@ -68,71 +68,71 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
.j-vxe-ds-icons {
|
.j-vxe-ds-icons {
|
||||||
position: relative;
|
position: relative;
|
||||||
/*cursor: move;*/
|
/*cursor: move;*/
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: 14px;
|
width: 14px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
||||||
.anticon-align-left,
|
.anticon-align-left,
|
||||||
.anticon-align-right {
|
.anticon-align-right {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 30%;
|
top: 30%;
|
||||||
}
|
|
||||||
|
|
||||||
.anticon-align-left {
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.anticon-align-right {
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.j-vxe-ds-btns {
|
.anticon-align-left {
|
||||||
position: relative;
|
left: 0;
|
||||||
cursor: pointer;
|
}
|
||||||
width: 24px;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
flex-direction: column;
|
|
||||||
align-content: center;
|
|
||||||
|
|
||||||
.ant-btn {
|
.anticon-align-right {
|
||||||
border: none;
|
right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
z-index: 0;
|
.j-vxe-ds-btns {
|
||||||
padding: 0;
|
position: relative;
|
||||||
width: 100%;
|
cursor: pointer;
|
||||||
/*height: 30%;*/
|
width: 24px;
|
||||||
height: 40%;
|
height: 100%;
|
||||||
display: block;
|
display: flex;
|
||||||
border-radius: 0;
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
align-content: center;
|
||||||
|
|
||||||
&:hover {
|
.ant-btn {
|
||||||
z-index: 1;
|
border: none;
|
||||||
/* height: 40%;*/
|
|
||||||
|
|
||||||
/* & .anticon-caret-up,*/
|
z-index: 0;
|
||||||
/* & .anticon-caret-down {*/
|
padding: 0;
|
||||||
/* top: 2px;*/
|
width: 100%;
|
||||||
/* }*/
|
/*height: 30%;*/
|
||||||
}
|
height: 40%;
|
||||||
|
display: block;
|
||||||
|
border-radius: 0;
|
||||||
|
|
||||||
&:last-child {
|
&:hover {
|
||||||
margin-top: -1px;
|
z-index: 1;
|
||||||
}
|
/* height: 40%;*/
|
||||||
|
|
||||||
& .anticon-caret-up,
|
/* & .anticon-caret-up,*/
|
||||||
& .anticon-caret-down {
|
/* & .anticon-caret-down {*/
|
||||||
vertical-align: top;
|
/* top: 2px;*/
|
||||||
position: relative;
|
/* }*/
|
||||||
top: 0;
|
}
|
||||||
transition: top 0.3s;
|
|
||||||
}
|
&:last-child {
|
||||||
|
margin-top: -1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
& .anticon-caret-up,
|
||||||
|
& .anticon-caret-down {
|
||||||
|
vertical-align: top;
|
||||||
|
position: relative;
|
||||||
|
top: 0;
|
||||||
|
transition: top 0.3s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -12,13 +12,13 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<div v-if="loading" slot="notFoundContent">
|
<div v-if="loading" slot="notFoundContent">
|
||||||
<a-icon type="loading" />
|
<a-icon type="loading" />
|
||||||
<span> 加载中…</span>
|
<span> 加载中…</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template v-for="option of selectOptions">
|
<template v-for="option of selectOptions">
|
||||||
<a-select-option :key="option.value" :value="option.value" :disabled="option.disabled">
|
<a-select-option :key="option.value" :value="option.value" :disabled="option.disabled">
|
||||||
<span>{{option.text || option.label || option.title|| option.value}}</span>
|
<span>{{ option.text || option.label || option.title || option.value }}</span>
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import JVxeCellMixins, { dispatchEvent } from '@/components/jero/JVxeTable/mixins/JVxeCellMixins'
|
import JVxeCellMixins, { dispatchEvent } from '@/components/jero/JVxeTable/mixins/JVxeCellMixins'
|
||||||
import { JVXETypes } from '@comp/jero/JVxeTable/index'
|
import { JVXETypes } from '@comp/jero/JVxeTable'
|
||||||
import { filterDictText } from '@comp/dict/JDictSelectUtil'
|
import { filterDictText } from '@comp/dict/JDictSelectUtil'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -41,6 +41,17 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
selectOptions () {
|
||||||
|
if (this.asyncOptions) {
|
||||||
|
return this.asyncOptions
|
||||||
|
}
|
||||||
|
const { linkage } = this.renderOptions
|
||||||
|
if (linkage) {
|
||||||
|
this.handleComputedSelectOptions(linkage)
|
||||||
|
}
|
||||||
|
return this.originColumn.options
|
||||||
|
},
|
||||||
|
// 下拉选项
|
||||||
selectProps () {
|
selectProps () {
|
||||||
const props = { ...this.cellProps }
|
const props = { ...this.cellProps }
|
||||||
// 判断select是否允许输入
|
// 判断select是否允许输入
|
||||||
@@ -49,32 +60,6 @@ export default {
|
|||||||
props.showSearch = true
|
props.showSearch = true
|
||||||
}
|
}
|
||||||
return props
|
return props
|
||||||
},
|
|
||||||
// 下拉选项
|
|
||||||
selectOptions () {
|
|
||||||
if (this.asyncOptions) {
|
|
||||||
return this.asyncOptions
|
|
||||||
}
|
|
||||||
const { linkage } = this.renderOptions
|
|
||||||
if (linkage) {
|
|
||||||
const { getLinkageOptionsSibling, config } = linkage
|
|
||||||
const res = getLinkageOptionsSibling(this.row, this.originColumn, config, true)
|
|
||||||
// 当返回Promise时,说明是多级联动
|
|
||||||
if (res instanceof Promise) {
|
|
||||||
this.loading = true
|
|
||||||
res.then(opt => {
|
|
||||||
this.asyncOptions = opt
|
|
||||||
this.loading = false
|
|
||||||
}).catch(e => {
|
|
||||||
console.error(e)
|
|
||||||
this.loading = false
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.asyncOptions = null
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this.originColumn.options
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
@@ -155,8 +140,25 @@ export default {
|
|||||||
options.push({ title: value, value: value, searchAdd: true })
|
options.push({ title: value, value: value, searchAdd: true })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
handleComputedSelectOptions (linkage) {
|
||||||
|
const { getLinkageOptionsSibling, config } = linkage
|
||||||
|
const res = getLinkageOptionsSibling(this.row, this.originColumn, config, true)
|
||||||
|
// 当返回Promise时,说明是多级联动
|
||||||
|
if (res instanceof Promise) {
|
||||||
|
this.loading = true
|
||||||
|
res.then(opt => {
|
||||||
|
this.asyncOptions = opt
|
||||||
|
this.loading = false
|
||||||
|
}).catch(e => {
|
||||||
|
console.error(e)
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.asyncOptions = null
|
||||||
|
return res
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
// 【组件增强】注释详见:JVxeCellMixins.js
|
// 【组件增强】注释详见:JVxeCellMixins.js
|
||||||
enhanced: {
|
enhanced: {
|
||||||
|
|||||||
@@ -1,48 +1,44 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<template v-if="hasFile" v-for="(file, fileKey) of [innerFile || {}]">
|
<template v-if="hasFile">
|
||||||
<a-input
|
<template v-for="(file, fileKey) of [innerFile || {}]">
|
||||||
:key="fileKey"
|
<a-input :key="fileKey" :readOnly="true" :value="file.name">
|
||||||
:readOnly="true"
|
|
||||||
:value="file.name"
|
|
||||||
>
|
|
||||||
|
|
||||||
<template slot="addonBefore" style="width: 30px">
|
<template slot="addonBefore" style="width: 30px">
|
||||||
<a-tooltip v-if="file.status === 'uploading'" :title="`上传中(${Math.floor(file.percent)}%)`">
|
<a-tooltip v-if="file.status === 'uploading'" :title="`上传中(${Math.floor(file.percent)}%)`">
|
||||||
<a-icon type="loading"/>
|
<a-icon type="loading" />
|
||||||
</a-tooltip>
|
|
||||||
<a-tooltip v-else-if="file.status === 'done'" title="上传完成">
|
|
||||||
<a-icon type="check-circle" style="color:#00DB00;"/>
|
|
||||||
</a-tooltip>
|
|
||||||
<a-tooltip v-else :title="file.message||'上传失败'">
|
|
||||||
<a-icon type="exclamation-circle" style="color:red;"/>
|
|
||||||
</a-tooltip>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<span v-if="file.status === 'uploading'" slot="addonAfter">{{ Math.floor(file.percent) }}%</span>
|
|
||||||
<template v-else-if="originColumn.allowDownload !== false || originColumn.allowRemove !== false" slot="addonAfter">
|
|
||||||
<a-dropdown :trigger="['click']" placement="bottomRight">
|
|
||||||
<a-tooltip title="操作">
|
|
||||||
<a-icon
|
|
||||||
type="setting"
|
|
||||||
style="cursor: pointer;"/>
|
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
|
<a-tooltip v-else-if="file.status === 'done'" title="上传完成">
|
||||||
|
<a-icon type="check-circle" style="color:#00DB00;" />
|
||||||
|
</a-tooltip>
|
||||||
|
<a-tooltip v-else :title="file.message||'上传失败'">
|
||||||
|
<a-icon type="exclamation-circle" style="color:red;" />
|
||||||
|
</a-tooltip>
|
||||||
|
</template>
|
||||||
|
|
||||||
<a-menu slot="overlay">
|
<span v-if="file.status === 'uploading'" slot="addonAfter">{{ Math.floor(file.percent) }}%</span>
|
||||||
<!-- <a-menu-item @click="handleClickPreviewFile">-->
|
<template v-else-if="originColumn.allowDownload !== false || originColumn.allowRemove !== false" slot="addonAfter">
|
||||||
<!-- <span><a-icon type="eye"/> 预览</span>-->
|
<a-dropdown :trigger="['click']" placement="bottomRight">
|
||||||
<!-- </a-menu-item>-->
|
<a-tooltip title="操作">
|
||||||
<a-menu-item v-if="originColumn.allowDownload !== false" @click="handleClickDownloadFile">
|
<a-icon type="setting" style="cursor: pointer;" />
|
||||||
<span><a-icon type="download"/> 下载</span>
|
</a-tooltip>
|
||||||
</a-menu-item>
|
|
||||||
<a-menu-item v-if="originColumn.allowRemove !== false" @click="handleClickDeleteFile">
|
|
||||||
<span><a-icon type="delete"/> 删除</span>
|
|
||||||
</a-menu-item>
|
|
||||||
</a-menu>
|
|
||||||
</a-dropdown>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
</a-input>
|
<a-menu slot="overlay">
|
||||||
|
<!-- <a-menu-item @click="handleClickPreviewFile">-->
|
||||||
|
<!-- <span><a-icon type="eye"/> 预览</span>-->
|
||||||
|
<!-- </a-menu-item>-->
|
||||||
|
<a-menu-item v-if="originColumn.allowDownload !== false" @click="handleClickDownloadFile">
|
||||||
|
<span><a-icon type="download" /> 下载</span>
|
||||||
|
</a-menu-item>
|
||||||
|
<a-menu-item v-if="originColumn.allowRemove !== false" @click="handleClickDeleteFile">
|
||||||
|
<span><a-icon type="delete" /> 删除</span>
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</a-dropdown>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</a-input>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<a-upload
|
<a-upload
|
||||||
v-show="!hasFile"
|
v-show="!hasFile"
|
||||||
@@ -55,7 +51,7 @@
|
|||||||
v-bind="cellProps"
|
v-bind="cellProps"
|
||||||
@change="handleChangeUpload"
|
@change="handleChangeUpload"
|
||||||
>
|
>
|
||||||
<a-button icon="upload">{{originColumn.btnText || '点击上传'}}</a-button>
|
<a-button icon="upload">{{ originColumn.btnText || '点击上传' }}</a-button>
|
||||||
</a-upload>
|
</a-upload>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -105,7 +101,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
handleChangeUpload (info) {
|
handleChangeUpload (info) {
|
||||||
const { row, originColumn: col } = this
|
const { originColumn: col } = this
|
||||||
const { file } = info
|
const { file } = info
|
||||||
const value = {
|
const value = {
|
||||||
name: file.name,
|
name: file.name,
|
||||||
@@ -139,7 +135,7 @@ export default {
|
|||||||
// this.$message.info('尚未实现')
|
// this.$message.info('尚未实现')
|
||||||
// },
|
// },
|
||||||
|
|
||||||
handleClickDownloadFile (id) {
|
handleClickDownloadFile () {
|
||||||
const { path } = this.value || {}
|
const { path } = this.value || {}
|
||||||
if (path) {
|
if (path) {
|
||||||
const url = getFileAccessHttpUrl(path)
|
const url = getFileAccessHttpUrl(path)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import JVxeCellMixins, { dispatchEvent } from '@/components/jero/JVxeTable/mixins/JVxeCellMixins'
|
import JVxeCellMixins from '@/components/jero/JVxeTable/mixins/JVxeCellMixins'
|
||||||
import JSelectUserByDepModal from '@/components/jerobiz/modal/JSelectUserByDepModal'
|
import JSelectUserByDepModal from '@/components/jerobiz/modal/JSelectUserByDepModal'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -59,10 +59,7 @@ export default {
|
|||||||
},
|
},
|
||||||
componentDisabled () {
|
componentDisabled () {
|
||||||
console.log('333', this.cellProps)
|
console.log('333', this.cellProps)
|
||||||
if (this.cellProps.disabled == true) {
|
return this.cellProps.disabled === true
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
},
|
},
|
||||||
modalWidth () {
|
modalWidth () {
|
||||||
if (this.cellProps.modalWidth) {
|
if (this.cellProps.modalWidth) {
|
||||||
@@ -72,11 +69,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
multi () {
|
multi () {
|
||||||
if (this.cellProps.multi == false) {
|
return this.cellProps.multi !== false
|
||||||
return false
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// 组件类型
|
// 组件类型
|
||||||
export default JVXETypes
|
|
||||||
export const JVXETypes = {
|
export const JVXETypes = {
|
||||||
// 为了防止和 vxe 内置的类型冲突,所以加上一个前缀
|
// 为了防止和 vxe 内置的类型冲突,所以加上一个前缀
|
||||||
// 前缀是自动加的,代码中直接用就行(JVXETypes.input)
|
// 前缀是自动加的,代码中直接用就行(JVXETypes.input)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { getVmParentByName } from '@/utils/util'
|
import { getVmParentByName } from '@/utils/util'
|
||||||
import { JVXETypes } from '@comp/jero/JVxeTable/index'
|
import { JVXETypes } from '@comp/jero/JVxeTable'
|
||||||
|
|
||||||
export const VALIDATE_FAILED = Symbol()
|
export const VALIDATE_FAILED = Symbol()
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ export function getInputNumberMaxValue (col, rowsValues) {
|
|||||||
*
|
*
|
||||||
* @param dom 一级dom节点
|
* @param dom 一级dom节点
|
||||||
* @param tagName 标签名,不区分大小写
|
* @param tagName 标签名,不区分大小写
|
||||||
* @return {HTMLElement | NULL}
|
* @return {HTMLElement}
|
||||||
*/
|
*/
|
||||||
export function getParentNodeByTagName (dom, tagName = 'body') {
|
export function getParentNodeByTagName (dom, tagName = 'body') {
|
||||||
if (tagName === 'body') {
|
if (tagName === 'body') {
|
||||||
@@ -103,7 +103,7 @@ export function vxePackageToSuperQuery (columns, handler) {
|
|||||||
field.options = col.options
|
field.options = col.options
|
||||||
}
|
}
|
||||||
if (typeof handler === 'function') {
|
if (typeof handler === 'function') {
|
||||||
Object.assign(field, handler(col, idx))
|
Object.assign(field, handler(col))
|
||||||
}
|
}
|
||||||
fieldList.push(field)
|
fieldList.push(field)
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ export function vxePackageToSuperQuery (columns, handler) {
|
|||||||
*/
|
*/
|
||||||
export async function validateFormAndTables (form, cases, autoJumpTab) {
|
export async function validateFormAndTables (form, cases, autoJumpTab) {
|
||||||
if (!(form && typeof form.validateFields === 'function')) {
|
if (!(form && typeof form.validateFields === 'function')) {
|
||||||
throw `form 参数需要的是一个form对象,而传入的却是${typeof form}`
|
throw new Error(`form 参数需要的是一个form对象,而传入的却是${typeof form}`)
|
||||||
}
|
}
|
||||||
let dataMap = {}
|
let dataMap = {}
|
||||||
const values = await new Promise((resolve, reject) => {
|
const values = await new Promise((resolve, reject) => {
|
||||||
@@ -144,6 +144,7 @@ export async function validateFormAndTables (form, cases, autoJumpTab) {
|
|||||||
/**
|
/**
|
||||||
* 一次性验证主表单和所有的次表单
|
* 一次性验证主表单和所有的次表单
|
||||||
* @param form 主表单 form 对象
|
* @param form 主表单 form 对象
|
||||||
|
* @param formData
|
||||||
* @param cases 接收一个数组,每项都是一个JVxeTable实例
|
* @param cases 接收一个数组,每项都是一个JVxeTable实例
|
||||||
* @param autoJumpTab
|
* @param autoJumpTab
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
@@ -151,12 +152,12 @@ export async function validateFormAndTables (form, cases, autoJumpTab) {
|
|||||||
*/
|
*/
|
||||||
export async function validateFormModelAndTables (form, formData, cases, autoJumpTab) {
|
export async function validateFormModelAndTables (form, formData, cases, autoJumpTab) {
|
||||||
if (!(form && typeof form.validate === 'function')) {
|
if (!(form && typeof form.validate === 'function')) {
|
||||||
throw `form 参数需要的是一个form对象,而传入的却是${typeof form}`
|
throw new Error(`form 参数需要的是一个form对象,而传入的却是${typeof form}`)
|
||||||
}
|
}
|
||||||
let dataMap = {}
|
let dataMap = {}
|
||||||
const values = await new Promise((resolve, reject) => {
|
const values = await new Promise((resolve, reject) => {
|
||||||
// 验证主表表单
|
// 验证主表表单
|
||||||
form.validate((valid, obj) => {
|
form.validate((valid) => {
|
||||||
valid ? resolve(formData) : reject({ error: VALIDATE_FAILED, originError: valid })
|
valid ? resolve(formData) : reject({ error: VALIDATE_FAILED, originError: valid })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -176,7 +177,7 @@ export async function validateFormModelAndTables (form, formData, cases, autoJum
|
|||||||
*/
|
*/
|
||||||
export function validateTables (cases, autoJumpTab = true) {
|
export function validateTables (cases, autoJumpTab = true) {
|
||||||
if (!Array.isArray(cases)) {
|
if (!Array.isArray(cases)) {
|
||||||
throw `'validateTables'函数的'cases'参数需要的是一个数组,而传入的却是${typeof cases}`
|
throw new Error(`'validateTables'函数的'cases'参数需要的是一个数组,而传入的却是${typeof cases}`)
|
||||||
}
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const tablesData = []
|
const tablesData = []
|
||||||
|
|||||||
Reference in New Issue
Block a user