mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-22 13:56:38 +08:00
Jeecg-Boot 2.1.4 版本发布 | 重构较大,较多新功能
This commit is contained in:
@ -32,6 +32,8 @@
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<slot name="actionButtonAfter" :target="getVM()"/>
|
||||
|
||||
<div :id="`${caseId}inputTable`" class="input-table">
|
||||
<!-- 渲染表头 -->
|
||||
<div class="thead" ref="thead">
|
||||
@ -142,7 +144,9 @@
|
||||
placement="top"
|
||||
:title="(tooltips[id] || {}).title"
|
||||
:visible="(tooltips[id] || {}).visible || false"
|
||||
:autoAdjustOverflow="true">
|
||||
:autoAdjustOverflow="true"
|
||||
:getPopupContainer="getParentContainer"
|
||||
>
|
||||
|
||||
<input
|
||||
:id="id"
|
||||
@ -175,7 +179,9 @@
|
||||
placement="top"
|
||||
:title="(tooltips[id] || {}).title"
|
||||
:visible="(tooltips[id] || {}).visible || false"
|
||||
:autoAdjustOverflow="true">
|
||||
:autoAdjustOverflow="true"
|
||||
:getPopupContainer="getParentContainer"
|
||||
>
|
||||
|
||||
<span
|
||||
@mouseover="()=>{handleMouseoverCommono(row,col)}"
|
||||
@ -211,7 +217,9 @@
|
||||
placement="top"
|
||||
:title="(tooltips[id] || {}).title"
|
||||
:visible="(tooltips[id] || {}).visible || false"
|
||||
:autoAdjustOverflow="true">
|
||||
:autoAdjustOverflow="true"
|
||||
:getPopupContainer="getParentContainer"
|
||||
>
|
||||
|
||||
<span
|
||||
@mouseover="()=>{handleMouseoverCommono(row,col)}"
|
||||
@ -278,19 +286,33 @@
|
||||
</template>
|
||||
|
||||
<div :hidden="uploadValues[id] != null">
|
||||
|
||||
<a-upload
|
||||
name="file"
|
||||
:data="{'isup':1}"
|
||||
:multiple="false"
|
||||
:action="col.action"
|
||||
:headers="uploadGetHeaders(row,col)"
|
||||
:showUploadList="false"
|
||||
v-bind="buildProps(row,col)"
|
||||
@change="(v)=>handleChangeUpload(v,id,row,col)"
|
||||
<a-tooltip
|
||||
:key="i"
|
||||
:id="id"
|
||||
placement="top"
|
||||
:title="(tooltips[id] || {}).title"
|
||||
:visible="(tooltips[id] || {}).visible || false"
|
||||
:autoAdjustOverflow="true"
|
||||
:getPopupContainer="getParentContainer"
|
||||
>
|
||||
<a-button icon="upload">{{ col.placeholder }}</a-button>
|
||||
</a-upload>
|
||||
|
||||
<span
|
||||
@mouseover="()=>{handleMouseoverCommono(row,col)}"
|
||||
@mouseout="()=>{handleMouseoutCommono(row,col)}">
|
||||
<a-upload
|
||||
name="file"
|
||||
:data="{'isup':1}"
|
||||
:multiple="false"
|
||||
:action="col.action"
|
||||
:headers="uploadGetHeaders(row,col)"
|
||||
:showUploadList="false"
|
||||
v-bind="buildProps(row,col)"
|
||||
@change="(v)=>handleChangeUpload(v,id,row,col)"
|
||||
>
|
||||
<a-button icon="upload">{{ col.placeholder }}</a-button>
|
||||
</a-upload>
|
||||
</span>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -303,7 +325,10 @@
|
||||
placement="top"
|
||||
:title="(tooltips[id] || {}).title"
|
||||
:visible="(tooltips[id] || {}).visible || false"
|
||||
:autoAdjustOverflow="true">
|
||||
:autoAdjustOverflow="true"
|
||||
:getPopupContainer="getParentContainer"
|
||||
>
|
||||
|
||||
<span
|
||||
@mouseover="()=>{handleMouseoverCommono(row,col)}"
|
||||
@mouseout="()=>{handleMouseoutCommono(row,col)}">
|
||||
@ -359,19 +384,33 @@
|
||||
</template>
|
||||
|
||||
<div :hidden="uploadValues[id] != null">
|
||||
|
||||
<a-upload
|
||||
name="file"
|
||||
:data="{'isup':1}"
|
||||
:multiple="false"
|
||||
:action="getUploadAction(col.action)"
|
||||
:headers="uploadGetHeaders(row,col)"
|
||||
:showUploadList="false"
|
||||
v-bind="buildProps(row,col)"
|
||||
@change="(v)=>handleChangeUpload(v,id,row,col)"
|
||||
<a-tooltip
|
||||
:key="i"
|
||||
:id="id"
|
||||
placement="top"
|
||||
:title="(tooltips[id] || {}).title"
|
||||
:visible="(tooltips[id] || {}).visible || false"
|
||||
:autoAdjustOverflow="true"
|
||||
:getPopupContainer="getParentContainer"
|
||||
>
|
||||
<a-button icon="upload">{{ col.placeholder }}</a-button>
|
||||
</a-upload>
|
||||
|
||||
<span
|
||||
@mouseover="()=>{handleMouseoverCommono(row,col)}"
|
||||
@mouseout="()=>{handleMouseoutCommono(row,col)}">
|
||||
<a-upload
|
||||
name="file"
|
||||
:data="{'isup':1}"
|
||||
:multiple="false"
|
||||
:action="getUploadAction(col.action)"
|
||||
:headers="uploadGetHeaders(row,col)"
|
||||
:showUploadList="false"
|
||||
v-bind="buildProps(row,col)"
|
||||
@change="(v)=>handleChangeUpload(v,id,row,col)"
|
||||
>
|
||||
<a-button icon="upload">{{ col.placeholder }}</a-button>
|
||||
</a-upload>
|
||||
</span>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -406,19 +445,33 @@
|
||||
</template>
|
||||
|
||||
<div :hidden="uploadValues[id] != null">
|
||||
|
||||
<a-upload
|
||||
name="file"
|
||||
:data="{'isup':1}"
|
||||
:multiple="false"
|
||||
:action="getUploadAction(col.action)"
|
||||
:headers="uploadGetHeaders(row,col)"
|
||||
:showUploadList="false"
|
||||
v-bind="buildProps(row,col)"
|
||||
@change="(v)=>handleChangeUpload(v,id,row,col)"
|
||||
<a-tooltip
|
||||
:key="i"
|
||||
:id="id"
|
||||
placement="top"
|
||||
:title="(tooltips[id] || {}).title"
|
||||
:visible="(tooltips[id] || {}).visible || false"
|
||||
:autoAdjustOverflow="true"
|
||||
:getPopupContainer="getParentContainer"
|
||||
>
|
||||
<a-button icon="upload">请上传图片</a-button>
|
||||
</a-upload>
|
||||
|
||||
<span
|
||||
@mouseover="()=>{handleMouseoverCommono(row,col)}"
|
||||
@mouseout="()=>{handleMouseoutCommono(row,col)}">
|
||||
<a-upload
|
||||
name="file"
|
||||
:data="{'isup':1}"
|
||||
:multiple="false"
|
||||
:action="getUploadAction(col.action)"
|
||||
:headers="uploadGetHeaders(row,col)"
|
||||
:showUploadList="false"
|
||||
v-bind="buildProps(row,col)"
|
||||
@change="(v)=>handleChangeUpload(v,id,row,col)"
|
||||
>
|
||||
<a-button icon="upload">请上传图片</a-button>
|
||||
</a-upload>
|
||||
</span>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -433,7 +486,10 @@
|
||||
placement="top"
|
||||
:title="(tooltips[id] || {}).title"
|
||||
:visible="(tooltips[id] || {}).visible || false"
|
||||
:autoAdjustOverflow="true">
|
||||
:autoAdjustOverflow="true"
|
||||
:getPopupContainer="getParentContainer"
|
||||
>
|
||||
|
||||
<span
|
||||
@mouseover="()=>{handleMouseoverCommono(row,col)}"
|
||||
@mouseout="()=>{handleMouseoutCommono(row,col)}">
|
||||
@ -459,7 +515,9 @@
|
||||
placement="top"
|
||||
:title="(tooltips[id] || {}).title"
|
||||
:visible="(tooltips[id] || {}).visible || false"
|
||||
:autoAdjustOverflow="true">
|
||||
:autoAdjustOverflow="true"
|
||||
:getPopupContainer="getParentContainer"
|
||||
>
|
||||
|
||||
<span
|
||||
@mouseover="()=>{handleMouseoverCommono(row,col)}"
|
||||
@ -492,7 +550,9 @@
|
||||
placement="top"
|
||||
:title="(tooltips[id] || {}).title"
|
||||
:visible="(tooltips[id] || {}).visible || false"
|
||||
:autoAdjustOverflow="true">
|
||||
:autoAdjustOverflow="true"
|
||||
:getPopupContainer="getParentContainer"
|
||||
>
|
||||
|
||||
<span
|
||||
@mouseover="()=>{handleMouseoverCommono(row,col)}"
|
||||
@ -526,7 +586,9 @@
|
||||
placement="top"
|
||||
:title="(tooltips[id] || {}).title"
|
||||
:visible="(tooltips[id] || {}).visible || false"
|
||||
:autoAdjustOverflow="true">
|
||||
:autoAdjustOverflow="true"
|
||||
:getPopupContainer="getParentContainer"
|
||||
>
|
||||
|
||||
<span
|
||||
@mouseover="()=>{handleMouseoverCommono(row,col)}"
|
||||
@ -693,6 +755,7 @@
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.inputValues = []
|
||||
// 当前显示的tr
|
||||
this.visibleTrEls = []
|
||||
this.disabledRowIds = (this.disabledRowIds || [])
|
||||
@ -771,149 +834,155 @@
|
||||
dataSource: {
|
||||
immediate: true,
|
||||
handler: function (newValue) {
|
||||
this.initialize()
|
||||
// 兼容IE
|
||||
this.getElementPromise('tbody').then(() => {
|
||||
|
||||
let rows = []
|
||||
let checkboxValues = {}
|
||||
let selectValues = {}
|
||||
let jdateValues = {}
|
||||
let slotValues = {}
|
||||
let uploadValues = {}
|
||||
let popupValues = {}
|
||||
let radioValues = {}
|
||||
let multiSelectValues = {}
|
||||
let searchSelectValues = {}
|
||||
this.initialize()
|
||||
|
||||
// 禁用行的id
|
||||
let disabledRowIds = (this.disabledRowIds || [])
|
||||
newValue.forEach((data, newValueIndex) => {
|
||||
// 判断源数据是否带有id
|
||||
if (data.id == null || data.id === '') {
|
||||
data.id = this.removeCaseId(this.generateId() + newValueIndex)
|
||||
}
|
||||
let rows = []
|
||||
let checkboxValues = {}
|
||||
let selectValues = {}
|
||||
let jdateValues = {}
|
||||
let slotValues = {}
|
||||
let uploadValues = {}
|
||||
let popupValues = {}
|
||||
let radioValues = {}
|
||||
let multiSelectValues = {}
|
||||
let searchSelectValues = {}
|
||||
|
||||
let value = { id: this.caseId + data.id }
|
||||
let row = { id: value.id }
|
||||
let disabled = false
|
||||
this.columns.forEach(column => {
|
||||
let inputId = column.key + value.id
|
||||
let sourceValue = (data[column.key] == null ? '' : data[column.key]).toString()
|
||||
if (column.type === FormTypes.checkbox) {
|
||||
|
||||
// 判断是否设定了customValue(自定义值)
|
||||
if (column.customValue instanceof Array) {
|
||||
let customValue = (column.customValue[0] || '').toString()
|
||||
checkboxValues[inputId] = (sourceValue === customValue)
|
||||
} else {
|
||||
checkboxValues[inputId] = sourceValue
|
||||
}
|
||||
|
||||
} else if (column.type === FormTypes.select) {
|
||||
if (sourceValue) {
|
||||
// 判断是否是多选
|
||||
selectValues[inputId] = (column.props || {})['mode'] === 'multiple' ? sourceValue.split(',') : sourceValue
|
||||
} else {
|
||||
selectValues[inputId] = undefined
|
||||
}
|
||||
|
||||
} else if (column.type === FormTypes.date || column.type === FormTypes.datetime) {
|
||||
jdateValues[inputId] = sourceValue
|
||||
|
||||
} else if (column.type === FormTypes.slot) {
|
||||
if (sourceValue !== 0 && !sourceValue) {
|
||||
slotValues[inputId] = column.defaultValue
|
||||
} else {
|
||||
slotValues[inputId] = sourceValue
|
||||
}
|
||||
|
||||
} else if (column.type === FormTypes.popup) {
|
||||
popupValues[inputId] = sourceValue
|
||||
} else if (column.type === FormTypes.radio) {
|
||||
radioValues[inputId] = sourceValue
|
||||
} else if (column.type === FormTypes.sel_search) {
|
||||
searchSelectValues[inputId] = sourceValue
|
||||
} else if (column.type === FormTypes.list_multi) {
|
||||
if (sourceValue.length > 0) {
|
||||
multiSelectValues[inputId] = sourceValue.split(',')
|
||||
} else {
|
||||
multiSelectValues[inputId] = []
|
||||
}
|
||||
} else if (column.type === FormTypes.upload || column.type === FormTypes.file || column.type === FormTypes.image) {
|
||||
if (sourceValue) {
|
||||
let fileName = sourceValue.substring(sourceValue.lastIndexOf('/') + 1)
|
||||
uploadValues[inputId] = {
|
||||
name: fileName,
|
||||
status: 'done',
|
||||
path: sourceValue
|
||||
}
|
||||
}
|
||||
} else {
|
||||
value[column.key] = sourceValue
|
||||
// 禁用行的id
|
||||
let disabledRowIds = (this.disabledRowIds || [])
|
||||
newValue.forEach((data, newValueIndex) => {
|
||||
// 判断源数据是否带有id
|
||||
if (data.id == null || data.id === '') {
|
||||
data.id = this.removeCaseId(this.generateId() + newValueIndex)
|
||||
}
|
||||
|
||||
// 解析disabledRows
|
||||
for (let columnKey in this.disabledRows) {
|
||||
// 判断是否有该属性
|
||||
if (this.disabledRows.hasOwnProperty(columnKey) && data.hasOwnProperty(columnKey)) {
|
||||
if (disabled !== true) {
|
||||
let temp = this.disabledRows[columnKey]
|
||||
// 禁用规则可以是一个数组
|
||||
if (temp instanceof Array) {
|
||||
disabled = temp.includes(data[columnKey])
|
||||
} else {
|
||||
disabled = (temp === data[columnKey])
|
||||
let value = { id: this.caseId + data.id }
|
||||
let row = { id: value.id }
|
||||
let disabled = false
|
||||
this.columns.forEach(column => {
|
||||
let inputId = column.key + value.id
|
||||
let sourceValue = (data[column.key] == null ? '' : data[column.key]).toString()
|
||||
if (column.type === FormTypes.checkbox) {
|
||||
|
||||
// 判断是否设定了customValue(自定义值)
|
||||
if (column.customValue instanceof Array) {
|
||||
let customValue = (column.customValue[0] || '').toString()
|
||||
checkboxValues[inputId] = (sourceValue === customValue)
|
||||
} else {
|
||||
checkboxValues[inputId] = sourceValue
|
||||
}
|
||||
|
||||
} else if (column.type === FormTypes.select) {
|
||||
if (sourceValue) {
|
||||
// 判断是否是多选
|
||||
selectValues[inputId] = (column.props || {})['mode'] === 'multiple' ? sourceValue.split(',') : sourceValue
|
||||
} else {
|
||||
selectValues[inputId] = undefined
|
||||
}
|
||||
|
||||
} else if (column.type === FormTypes.date || column.type === FormTypes.datetime) {
|
||||
jdateValues[inputId] = sourceValue
|
||||
|
||||
} else if (column.type === FormTypes.slot) {
|
||||
if (sourceValue !== 0 && !sourceValue) {
|
||||
slotValues[inputId] = column.defaultValue
|
||||
} else {
|
||||
slotValues[inputId] = sourceValue
|
||||
}
|
||||
|
||||
} else if (column.type === FormTypes.popup) {
|
||||
popupValues[inputId] = sourceValue
|
||||
} else if (column.type === FormTypes.radio) {
|
||||
radioValues[inputId] = sourceValue
|
||||
} else if (column.type === FormTypes.sel_search) {
|
||||
searchSelectValues[inputId] = sourceValue
|
||||
} else if (column.type === FormTypes.list_multi) {
|
||||
if (sourceValue.length > 0) {
|
||||
multiSelectValues[inputId] = sourceValue.split(',')
|
||||
} else {
|
||||
multiSelectValues[inputId] = []
|
||||
}
|
||||
} else if (column.type === FormTypes.upload || column.type === FormTypes.file || column.type === FormTypes.image) {
|
||||
if (sourceValue) {
|
||||
let fileName = sourceValue.substring(sourceValue.lastIndexOf('/') + 1)
|
||||
uploadValues[inputId] = {
|
||||
name: fileName,
|
||||
status: 'done',
|
||||
path: sourceValue
|
||||
}
|
||||
if (disabled) {
|
||||
disabledRowIds.push(row.id)
|
||||
}
|
||||
} else {
|
||||
value[column.key] = sourceValue
|
||||
}
|
||||
|
||||
// 解析disabledRows
|
||||
for (let columnKey in this.disabledRows) {
|
||||
// 判断是否有该属性
|
||||
if (this.disabledRows.hasOwnProperty(columnKey) && data.hasOwnProperty(columnKey)) {
|
||||
if (disabled !== true) {
|
||||
let temp = this.disabledRows[columnKey]
|
||||
// 禁用规则可以是一个数组
|
||||
if (temp instanceof Array) {
|
||||
disabled = temp.includes(data[columnKey])
|
||||
} else {
|
||||
disabled = (temp === data[columnKey])
|
||||
}
|
||||
if (disabled) {
|
||||
disabledRowIds.push(row.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
this.inputValues.push(value)
|
||||
rows.push(row)
|
||||
})
|
||||
this.inputValues.push(value)
|
||||
rows.push(row)
|
||||
})
|
||||
this.disabledRowIds = disabledRowIds
|
||||
this.checkboxValues = checkboxValues
|
||||
this.selectValues = selectValues
|
||||
this.jdateValues = jdateValues
|
||||
this.slotValues = slotValues
|
||||
this.rows = rows
|
||||
this.uploadValues = uploadValues
|
||||
this.popupValues = popupValues
|
||||
this.radioValues = radioValues
|
||||
this.multiSelectValues = multiSelectValues
|
||||
this.searchSelectValues = searchSelectValues
|
||||
this.disabledRowIds = disabledRowIds
|
||||
this.checkboxValues = checkboxValues
|
||||
this.selectValues = selectValues
|
||||
this.jdateValues = jdateValues
|
||||
this.slotValues = slotValues
|
||||
this.rows = rows
|
||||
this.uploadValues = uploadValues
|
||||
this.popupValues = popupValues
|
||||
this.radioValues = radioValues
|
||||
this.multiSelectValues = multiSelectValues
|
||||
this.searchSelectValues = searchSelectValues
|
||||
|
||||
// 更新form表单的值
|
||||
this.$nextTick(() => {
|
||||
this.updateFormValues()
|
||||
// 更新form表单的值
|
||||
this.$nextTick(() => {
|
||||
this.updateFormValues()
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
columns: {
|
||||
immediate: true,
|
||||
handler(columns) {
|
||||
columns.forEach(column => {
|
||||
if (column.type === FormTypes.select || column.type === FormTypes.list_multi || column.type === FormTypes.sel_search) {
|
||||
// 兼容 旧版本 options
|
||||
if (column.options instanceof Array) {
|
||||
column.options = column.options.map(item => {
|
||||
if (item) {
|
||||
return {
|
||||
...item,
|
||||
text: item.text || item.title,
|
||||
title: item.text || item.title
|
||||
// 兼容IE
|
||||
this.getElementPromise('tbody').then(() => {
|
||||
columns.forEach(column => {
|
||||
if (column.type === FormTypes.select || column.type === FormTypes.list_multi || column.type === FormTypes.sel_search) {
|
||||
// 兼容 旧版本 options
|
||||
if (column.options instanceof Array) {
|
||||
column.options = column.options.map(item => {
|
||||
if (item) {
|
||||
return {
|
||||
...item,
|
||||
text: item.text || item.title,
|
||||
title: item.text || item.title
|
||||
}
|
||||
}
|
||||
}
|
||||
return {}
|
||||
})
|
||||
return {}
|
||||
})
|
||||
}
|
||||
if (column.dictCode) {
|
||||
this._loadDictConcatToOptions(column)
|
||||
}
|
||||
}
|
||||
if (column.dictCode) {
|
||||
this._loadDictConcatToOptions(column)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
@ -923,19 +992,12 @@
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 获取document element对象
|
||||
let elements = {};
|
||||
['inputTable', 'tbody'].forEach(id => {
|
||||
elements[id] = document.getElementById(this.caseId + id)
|
||||
})
|
||||
this.el = elements
|
||||
|
||||
let vm = this
|
||||
/** 监听滚动条事件 */
|
||||
this.el.inputTable.onscroll = function (event) {
|
||||
this.getElement('inputTable').onscroll = function (event) {
|
||||
vm.syncScrollBar(event.target.scrollLeft)
|
||||
}
|
||||
this.el.tbody.onscroll = function (event) {
|
||||
this.getElement('tbody').onscroll = function (event) {
|
||||
// vm.recalcTrHiddenItem(event.target.scrollTop)
|
||||
}
|
||||
|
||||
@ -955,6 +1017,25 @@
|
||||
},
|
||||
methods: {
|
||||
|
||||
getElement(id, noCaseId = false) {
|
||||
if (!this.el[id]) {
|
||||
this.el[id] = document.getElementById((noCaseId ? '' : this.caseId) + id)
|
||||
}
|
||||
return this.el[id]
|
||||
},
|
||||
|
||||
getElementPromise(id, noCaseId = false) {
|
||||
return new Promise((resolve) => {
|
||||
let timer = setInterval(() => {
|
||||
let element = this.getElement(id, noCaseId)
|
||||
if (element) {
|
||||
clearInterval(timer)
|
||||
resolve(element)
|
||||
}
|
||||
}, 10)
|
||||
})
|
||||
},
|
||||
|
||||
/** 初始化列表 */
|
||||
initialize() {
|
||||
// inputValues:用来存储input表单的值
|
||||
@ -985,14 +1066,14 @@
|
||||
this.searchSelectValues = []
|
||||
this.scrollTop = 0
|
||||
this.$nextTick(() => {
|
||||
this.el.tbody.scrollTop = 0
|
||||
this.getElement('tbody').scrollTop = 0
|
||||
})
|
||||
},
|
||||
|
||||
/** 同步滚动条状态 */
|
||||
syncScrollBar(scrollLeft) {
|
||||
// this.style.tbody.left = `${scrollLeft}px`
|
||||
// this.el.tbody.scrollLeft = scrollLeft
|
||||
// this.getElement('tbody').scrollLeft = scrollLeft
|
||||
},
|
||||
/** 重置滚动条位置,参数留空则滚动到上次记录的位置 */
|
||||
resetScrollTop(top) {
|
||||
@ -1157,7 +1238,7 @@
|
||||
target: this
|
||||
})
|
||||
// 设置滚动条位置
|
||||
let tbody = this.el.tbody
|
||||
let tbody = this.getElement('tbody')
|
||||
let offsetHeight = tbody.offsetHeight
|
||||
let realScrollTop = tbody.scrollTop + offsetHeight
|
||||
if (forceScrollToBottom === false) {
|
||||
@ -1245,13 +1326,14 @@
|
||||
return true
|
||||
},
|
||||
|
||||
/** 获取表格表单里的值(同步版) */
|
||||
getValuesSync(options = {}) {
|
||||
/** 获取表格表单里的值(异步版) */
|
||||
getValuesAsync(options = {}, callback) {
|
||||
let { validate, rowIds } = options
|
||||
if (typeof validate !== 'boolean') validate = true
|
||||
if (!(rowIds instanceof Array)) rowIds = null
|
||||
// console.log('options:', { validate, rowIds })
|
||||
|
||||
let asyncCount = 0
|
||||
let error = 0
|
||||
let inputValues = cloneObject(this.inputValues)
|
||||
let tooltips = Object.assign({}, this.tooltips)
|
||||
@ -1314,7 +1396,7 @@
|
||||
} else if (column.type === FormTypes.sel_search) {
|
||||
value[column.key] = this.searchSelectValues[inputId]
|
||||
} else if (column.type === FormTypes.list_multi) {
|
||||
if (!this.multiSelectValues[inputId] || this.multiSelectValues[inputId].length == 0) {
|
||||
if (!this.multiSelectValues[inputId] || this.multiSelectValues[inputId].length === 0) {
|
||||
value[column.key] = ''
|
||||
} else {
|
||||
value[column.key] = this.multiSelectValues[inputId].join(',')
|
||||
@ -1326,20 +1408,27 @@
|
||||
|
||||
// 检查表单验证
|
||||
if (validate === true) {
|
||||
let results = this.validateOneInput(value[column.key], value, column, notPassedIds, false, 'getValues')
|
||||
tooltips[inputId] = results[0]
|
||||
if (tooltips[inputId].passed === false) {
|
||||
error++
|
||||
// if (error++ === 0) {
|
||||
// let element = document.getElementById(inputId)
|
||||
// while (element.className !== 'tr') {
|
||||
// element = element.parentElement
|
||||
// }
|
||||
// this.jumpToId(inputId, element)
|
||||
// }
|
||||
const handleValidateOneInput = (results) => {
|
||||
tooltips[inputId] = results[0]
|
||||
if (tooltips[inputId].passed === false) {
|
||||
error++
|
||||
// if (error++ === 0) {
|
||||
// let element = document.getElementById(inputId)
|
||||
// while (element.className !== 'tr') {
|
||||
// element = element.parentElement
|
||||
// }
|
||||
// this.jumpToId(inputId, element)
|
||||
// }
|
||||
}
|
||||
tooltips[inputId].visible = false
|
||||
notPassedIds = results[1]
|
||||
}
|
||||
tooltips[inputId].visible = false
|
||||
notPassedIds = results[1]
|
||||
asyncCount++
|
||||
let results = this.validateOneInputAsync(value[column.key], value, column, notPassedIds, false, 'getValues', (results) => {
|
||||
handleValidateOneInput(results)
|
||||
asyncCount--
|
||||
})
|
||||
handleValidateOneInput(results)
|
||||
}
|
||||
})
|
||||
// 将caseId去除
|
||||
@ -1352,25 +1441,42 @@
|
||||
this.tooltips = tooltips
|
||||
this.notPassedIds = notPassedIds
|
||||
}
|
||||
|
||||
const timer = setInterval(() => {
|
||||
if (asyncCount === 0) {
|
||||
clearInterval(timer)
|
||||
if (typeof callback === 'function') {
|
||||
callback({ error, values })
|
||||
}
|
||||
}
|
||||
}, 50)
|
||||
|
||||
return { error, values }
|
||||
},
|
||||
|
||||
/** 获取表格表单里的值(同步版) */
|
||||
getValuesSync(options = {}) {
|
||||
return this.getValuesAsync(options)
|
||||
},
|
||||
|
||||
/** 获取表格表单里的值 */
|
||||
getValues(callback, validate = true, rowIds) {
|
||||
let result = this.getValuesSync({ validate, rowIds })
|
||||
if (typeof callback === 'function') {
|
||||
callback(result.error, result.values)
|
||||
}
|
||||
this.getValuesAsync({ validate, rowIds }, ({ error, values }) => {
|
||||
if (typeof callback === 'function') {
|
||||
callback(error, values)
|
||||
}
|
||||
})
|
||||
},
|
||||
/** getValues的Promise版 */
|
||||
getValuesPromise(validate = true, rowIds) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let { error, values } = this.getValuesSync({ validate, rowIds })
|
||||
if (error === 0) {
|
||||
resolve(values)
|
||||
} else {
|
||||
reject(VALIDATE_NO_PASSED)
|
||||
}
|
||||
this.getValuesAsync({ validate, rowIds }, ({ error, values }) => {
|
||||
if (error === 0) {
|
||||
resolve(values)
|
||||
} else {
|
||||
reject(VALIDATE_NO_PASSED)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
/** 获取被删除项的id */
|
||||
@ -1468,14 +1574,24 @@
|
||||
// element = document.getElementById(id)
|
||||
// }
|
||||
// if (element != null) {
|
||||
// console.log(this.el.tbody.scrollTop, element.offsetTop)
|
||||
// this.el.tbody.scrollTop = element.offsetTop
|
||||
// console.log(this.el.tbody.scrollTop, element.offsetTop)
|
||||
// console.log(this.getElement('tbody').scrollTop, element.offsetTop)
|
||||
// this.getElement('tbody').scrollTop = element.offsetTop
|
||||
// console.log(this.getElement('tbody').scrollTop, element.offsetTop)
|
||||
// }
|
||||
// },
|
||||
|
||||
/** 验证单个表单 */
|
||||
validateOneInput(value, row, column, notPassedIds, update = false, validType = 'input') {
|
||||
/**
|
||||
* 验证单个表单,异步版
|
||||
*
|
||||
* @param value 校验的值
|
||||
* @param row 校验的行
|
||||
* @param column 校验的列
|
||||
* @param notPassedIds 没有通过校验的 id
|
||||
* @param update 是否更新到vue中
|
||||
* @param validType 校验触发的方式(input、blur等)
|
||||
* @param callback
|
||||
*/
|
||||
validateOneInputAsync(value, row, column, notPassedIds, update = false, validType = 'input', callback) {
|
||||
let tooltips = Object.assign({}, this.tooltips)
|
||||
// let notPassedIds = cloneObject(this.notPassedIds)
|
||||
let inputId = column.key + row.id
|
||||
@ -1515,6 +1631,10 @@
|
||||
if (column.type === FormTypes.date || column.type === FormTypes.datetime) {
|
||||
element = element.getElementsByTagName('input')[0]
|
||||
}
|
||||
// upload 在 .ant-upload .ant-btn 上设置 border-color
|
||||
if (column.type === FormTypes.upload || column.type === FormTypes.file || column.type === FormTypes.image) {
|
||||
element = element.getElementsByClassName('ant-upload')[0].getElementsByClassName('ant-btn')[0]
|
||||
}
|
||||
element.style.borderColor = borderColor
|
||||
element.style.boxShadow = boxShadow
|
||||
if (element.tagName === 'SPAN') {
|
||||
@ -1527,6 +1647,10 @@
|
||||
this.notPassedIds = notPassedIds
|
||||
}
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
callback([tooltips[inputId], notPassedIds])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (typeof passed === 'function') {
|
||||
@ -1547,9 +1671,13 @@
|
||||
nextThen([passed, message])
|
||||
}
|
||||
|
||||
|
||||
return [tooltips[inputId], notPassedIds]
|
||||
},
|
||||
|
||||
/** 验证单个表单 */
|
||||
validateOneInput(value, row, column, notPassedIds, update = false, validType = 'input') {
|
||||
return this.validateOneInputAsync(value, row, column, notPassedIds, update, validType)
|
||||
},
|
||||
/** 通过规则验证值是否正确 */
|
||||
validateValue(column, value) {
|
||||
let rules = column.validateRules
|
||||
@ -1620,7 +1748,7 @@
|
||||
|
||||
/** 动态更新表单的值 */
|
||||
updateFormValues() {
|
||||
let trs = this.el.tbody.getElementsByClassName('tr')
|
||||
let trs = this.getElement('tbody').getElementsByClassName('tr')
|
||||
let trEls = []
|
||||
for (let tr of trs) {
|
||||
trEls.push(tr)
|
||||
@ -1959,7 +2087,7 @@
|
||||
handleClickDownloadFile(id) {
|
||||
let { path } = this.uploadValues[id] || {}
|
||||
if (path) {
|
||||
let url = window._CONFIG['downloadUrl'] + '/' + path
|
||||
let url = window._CONFIG['staticDomainURL'] + '/' + path
|
||||
window.open(url)
|
||||
}
|
||||
},
|
||||
@ -2130,7 +2258,7 @@
|
||||
getCellImageView(id) {
|
||||
let currUploadObj = this.uploadValues[id] || null
|
||||
if (currUploadObj && currUploadObj['path']) {
|
||||
return window._CONFIG['domianURL'] + '/sys/common/view/' + currUploadObj['path']
|
||||
return window._CONFIG['staticDomainURL'] + '/' + currUploadObj['path']
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
@ -2340,7 +2468,7 @@
|
||||
|
||||
.td {
|
||||
/*flex: 1;*/
|
||||
padding: 14px 0 14px @spacing;
|
||||
padding: 14px @spacing 14px 0;
|
||||
justify-content: center;
|
||||
|
||||
&:last-child {
|
||||
|
||||
@ -150,7 +150,7 @@
|
||||
console.log("aaaaa",res)
|
||||
if(res.success){
|
||||
this.checkKey = res.result.key
|
||||
this.code = res.result.code
|
||||
this.code = window.atob(res.result.code)
|
||||
resolve();
|
||||
}else{
|
||||
this.$message.error("生成验证码错误,请联系系统管理员")
|
||||
|
||||
202
ant-design-vue-jeecg/src/components/jeecg/JImageUpload.vue
Normal file
202
ant-design-vue-jeecg/src/components/jeecg/JImageUpload.vue
Normal file
@ -0,0 +1,202 @@
|
||||
<template>
|
||||
<a-upload
|
||||
name="file"
|
||||
listType="picture-card"
|
||||
:multiple="isMultiple"
|
||||
:action="uploadAction"
|
||||
:headers="headers"
|
||||
:data="{biz:bizPath}"
|
||||
:fileList="fileList"
|
||||
:beforeUpload="beforeUpload"
|
||||
:disabled="disabled"
|
||||
:isMultiple="isMultiple"
|
||||
:showUploadList="isMultiple"
|
||||
@change="handleChange"
|
||||
@preview="handlePreview">
|
||||
<img v-if="!isMultiple && picUrl" :src="getAvatarView()" style="height:104px;max-width:300px"/>
|
||||
<div v-else >
|
||||
<a-icon :type="uploadLoading ? 'loading' : 'plus'" />
|
||||
<div class="ant-upload-text">{{ text }}</div>
|
||||
</div>
|
||||
<a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel()">
|
||||
<img alt="example" style="width: 100%" :src="previewImage"/>
|
||||
</a-modal>
|
||||
</a-upload>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from 'vue'
|
||||
import { ACCESS_TOKEN } from "@/store/mutation-types"
|
||||
import { getFileAccessHttpUrl } from '@/api/manage'
|
||||
|
||||
const uidGenerator=()=>{
|
||||
return '-'+parseInt(Math.random()*10000+1,10);
|
||||
}
|
||||
const getFileName=(path)=>{
|
||||
if(path.lastIndexOf("\\")>=0){
|
||||
let reg=new RegExp("\\\\","g");
|
||||
path = path.replace(reg,"/");
|
||||
}
|
||||
return path.substring(path.lastIndexOf("/")+1);
|
||||
}
|
||||
export default {
|
||||
name: 'JImageUpload',
|
||||
data(){
|
||||
return {
|
||||
uploadAction:window._CONFIG['domianURL']+"/sys/common/upload",
|
||||
urlView:window._CONFIG['staticDomainURL'],
|
||||
uploadLoading:false,
|
||||
picUrl:false,
|
||||
headers:{},
|
||||
fileList: [],
|
||||
previewImage:"",
|
||||
previewVisible: false,
|
||||
}
|
||||
},
|
||||
props:{
|
||||
text:{
|
||||
type:String,
|
||||
required:false,
|
||||
default:"上传"
|
||||
},
|
||||
/*这个属性用于控制文件上传的业务路径*/
|
||||
bizPath:{
|
||||
type:String,
|
||||
required:false,
|
||||
default:"temp"
|
||||
},
|
||||
value:{
|
||||
type:[String,Array],
|
||||
required:false
|
||||
},
|
||||
disabled:{
|
||||
type:Boolean,
|
||||
required:false,
|
||||
default: false
|
||||
},
|
||||
isMultiple:{
|
||||
type:Boolean,
|
||||
required:false,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
value(val){
|
||||
if (val instanceof Array) {
|
||||
this.initFileList(val.join(','))
|
||||
} else {
|
||||
this.initFileList(val)
|
||||
}
|
||||
}
|
||||
},
|
||||
created(){
|
||||
const token = Vue.ls.get(ACCESS_TOKEN);
|
||||
this.headers = {"X-Access-Token":token}
|
||||
},
|
||||
methods:{
|
||||
initFileList(paths){
|
||||
if(!paths || paths.length==0){
|
||||
this.fileList = [];
|
||||
return;
|
||||
}
|
||||
this.picUrl = true;
|
||||
let fileList = [];
|
||||
let arr = paths.split(",")
|
||||
for(var a=0;a<arr.length;a++){
|
||||
let url = getFileAccessHttpUrl(arr[a],this.urlView,"http");
|
||||
fileList.push({
|
||||
uid: uidGenerator(),
|
||||
name: getFileName(arr[a]),
|
||||
status: 'done',
|
||||
url: url,
|
||||
response:{
|
||||
status:"history",
|
||||
message:arr[a]
|
||||
}
|
||||
})
|
||||
}
|
||||
this.fileList = fileList
|
||||
},
|
||||
beforeUpload: function(file){
|
||||
var fileType = file.type;
|
||||
if(fileType.indexOf('image')<0){
|
||||
this.$message.warning('请上传图片');
|
||||
return false;
|
||||
}
|
||||
},
|
||||
handleChange(info) {
|
||||
this.picUrl = false;
|
||||
let fileList = info.fileList
|
||||
if(info.file.status==='done'){
|
||||
if(info.file.response.success){
|
||||
this.picUrl = true;
|
||||
fileList = fileList.map((file) => {
|
||||
if (file.response) {
|
||||
file.url = file.response.message;
|
||||
}
|
||||
return file;
|
||||
});
|
||||
}
|
||||
//this.$message.success(`${info.file.name} 上传成功!`);
|
||||
}else if (info.file.status === 'error') {
|
||||
this.$message.error(`${info.file.name} 上传失败.`);
|
||||
}else if(info.file.status === 'removed'){
|
||||
this.handleDelete(info.file)
|
||||
}
|
||||
this.fileList = fileList
|
||||
if(info.file.status==='done' || info.file.status === 'removed'){
|
||||
this.handlePathChange()
|
||||
}
|
||||
},
|
||||
// 预览
|
||||
handlePreview (file) {
|
||||
this.previewImage = file.url || file.thumbUrl
|
||||
this.previewVisible = true
|
||||
},
|
||||
getAvatarView(){
|
||||
if(this.fileList.length>0){
|
||||
let url = this.fileList[0].url
|
||||
return getFileAccessHttpUrl(url,this.urlView,"http")
|
||||
}
|
||||
},
|
||||
handlePathChange(){
|
||||
let uploadFiles = this.fileList
|
||||
let path = ''
|
||||
if(!uploadFiles || uploadFiles.length==0){
|
||||
path = ''
|
||||
}
|
||||
let arr = [];
|
||||
if(!this.isMultiple){
|
||||
arr.push(uploadFiles[uploadFiles.length-1].response.message)
|
||||
}else{
|
||||
for(var a=0;a<uploadFiles.length;a++){
|
||||
arr.push(uploadFiles[a].response.message)
|
||||
}
|
||||
}
|
||||
if(arr.length>0){
|
||||
path = arr.join(",")
|
||||
}
|
||||
this.$emit('change', path);
|
||||
},
|
||||
handleDelete(file){
|
||||
//如有需要新增 删除逻辑
|
||||
console.log(file)
|
||||
},
|
||||
handleCancel() {
|
||||
this.close();
|
||||
this.previewVisible = false;
|
||||
},
|
||||
close () {
|
||||
|
||||
},
|
||||
},
|
||||
model: {
|
||||
prop: 'value',
|
||||
event: 'change'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@ -42,6 +42,11 @@
|
||||
type: String,
|
||||
default: '',
|
||||
required: false
|
||||
},
|
||||
biz:{
|
||||
type: String,
|
||||
default: '',
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data(){
|
||||
@ -49,7 +54,8 @@
|
||||
visible:false,
|
||||
uploading:false,
|
||||
fileList:[],
|
||||
uploadAction:''
|
||||
uploadAction:'',
|
||||
foreignKeys:''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -67,10 +73,11 @@
|
||||
handleClose(){
|
||||
this.visible=false
|
||||
},
|
||||
show(){
|
||||
show(arg){
|
||||
this.fileList = []
|
||||
this.uploading = false
|
||||
this.visible = true
|
||||
this.foreignKeys = arg;
|
||||
},
|
||||
handleRemove(file) {
|
||||
const index = this.fileList.indexOf(file);
|
||||
@ -85,6 +92,12 @@
|
||||
handleImport() {
|
||||
const { fileList } = this;
|
||||
const formData = new FormData();
|
||||
if(this.biz){
|
||||
formData.append('isSingleTableImport',this.biz);
|
||||
}
|
||||
if(this.foreignKeys && this.foreignKeys.length>0){
|
||||
formData.append('foreignKeys',this.foreignKeys);
|
||||
}
|
||||
fileList.forEach((file) => {
|
||||
formData.append('files[]', file);
|
||||
});
|
||||
|
||||
209
ant-design-vue-jeecg/src/components/jeecg/JModal/index.vue
Normal file
209
ant-design-vue-jeecg/src/components/jeecg/JModal/index.vue
Normal file
@ -0,0 +1,209 @@
|
||||
<template>
|
||||
<a-modal
|
||||
ref="modal"
|
||||
class="j-modal-box"
|
||||
:class="{'fullscreen':innerFullscreen,'no-title':isNoTitle,'no-footer':isNoFooter,}"
|
||||
:visible="visible"
|
||||
v-bind="_attrs"
|
||||
v-on="$listeners"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
|
||||
<slot></slot>
|
||||
|
||||
<template v-if="!isNoTitle" slot="title">
|
||||
<a-row class="j-modal-title-row" type="flex">
|
||||
<a-col class="left">
|
||||
<slot name="title">{{ title }}</slot>
|
||||
</a-col>
|
||||
<a-col v-if="switchFullscreen" class="right" @click="toggleFullscreen">
|
||||
<a-button class="ant-modal-close ant-modal-close-x" ghost type="link" :icon="fullscreenButtonIcon"/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<!-- 处理 scopedSlots -->
|
||||
<template v-for="slotName of scopedSlotsKeys" :slot="slotName">
|
||||
<slot :name="slotName"></slot>
|
||||
</template>
|
||||
|
||||
<!-- 处理 slots -->
|
||||
<template v-for="slotName of slotsKeys" v-slot:[slotName]>
|
||||
<slot :name="slotName"></slot>
|
||||
</template>
|
||||
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ACol from 'ant-design-vue/es/grid/Col'
|
||||
|
||||
export default {
|
||||
name: 'JModal',
|
||||
components: { ACol },
|
||||
props: {
|
||||
title: String,
|
||||
// 可使用 .sync 修饰符
|
||||
visible: Boolean,
|
||||
// 是否在弹出时禁止 body 滚动
|
||||
lockScroll: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 是否全屏弹窗,当全屏时无论如何都会禁止 body 滚动。可使用 .sync 修饰符
|
||||
fullscreen: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 是否允许切换全屏(允许后右上角会出现一个按钮)
|
||||
switchFullscreen: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 内部使用的 slots ,不再处理
|
||||
usedSlots: ['title'],
|
||||
|
||||
// 缓存 body 的 overflow
|
||||
bodyOverflowCache: '',
|
||||
innerFullscreen: this.fullscreen,
|
||||
fullscreenButtonIcon: 'fullscreen-exit',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 一些未处理的参数或特殊处理的参数绑定到 a-modal 上
|
||||
_attrs() {
|
||||
let attrs = { ...this.$attrs }
|
||||
// 如果全屏就将宽度设为 100%
|
||||
if (this.innerFullscreen) {
|
||||
attrs['width'] = '100%'
|
||||
}
|
||||
return attrs
|
||||
},
|
||||
isNoTitle() {
|
||||
return !this.title && !this.allSlotsKeys.includes('title')
|
||||
},
|
||||
isNoFooter() {
|
||||
return this._attrs['footer'] === null
|
||||
},
|
||||
slotsKeys() {
|
||||
return Object.keys(this.$slots).filter(key => !this.usedSlots.includes(key))
|
||||
},
|
||||
scopedSlotsKeys() {
|
||||
return Object.keys(this.$scopedSlots).filter(key => !this.usedSlots.includes(key))
|
||||
},
|
||||
allSlotsKeys() {
|
||||
return this.slotsKeys.concat(this.scopedSlotsKeys)
|
||||
},
|
||||
// 是否锁定body滚动
|
||||
lockBodyScroll() {
|
||||
return this.lockScroll || this.innerFullscreen
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
visible() {
|
||||
if (this.visible) {
|
||||
this.innerFullscreen = this.fullscreen
|
||||
}
|
||||
if (this.lockBodyScroll) {
|
||||
if (this.visible) {
|
||||
this.bodyOverflowCache = document.body.style.overflow
|
||||
document.body.style.overflow = 'hidden'
|
||||
} else {
|
||||
document.body.style.overflow = this.bodyOverflowCache
|
||||
}
|
||||
}
|
||||
},
|
||||
innerFullscreen(val) {
|
||||
this.$emit('update:fullscreen', val)
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
close() {
|
||||
this.$emit('update:visible', false)
|
||||
},
|
||||
|
||||
handleOk() {
|
||||
this.close()
|
||||
},
|
||||
handleCancel() {
|
||||
this.close()
|
||||
},
|
||||
|
||||
toggleFullscreen() {
|
||||
if (this.innerFullscreen) {
|
||||
this.fullscreenButtonIcon = 'fullscreen'
|
||||
} else {
|
||||
this.fullscreenButtonIcon = 'fullscreen-exit'
|
||||
}
|
||||
this.innerFullscreen = !this.innerFullscreen
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.j-modal-box {
|
||||
|
||||
&.fullscreen {
|
||||
top: 0;
|
||||
left: 0;
|
||||
padding: 0;
|
||||
|
||||
height: 100vh;
|
||||
|
||||
& .ant-modal-content {
|
||||
height: 100vh;
|
||||
border-radius: 0;
|
||||
|
||||
& .ant-modal-body {
|
||||
/* title 和 footer 各占 55px */
|
||||
height: calc(100% - 55px - 55px);
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
|
||||
&.no-title, &.no-footer {
|
||||
.ant-modal-body {
|
||||
height: calc(100% - 55px);
|
||||
}
|
||||
}
|
||||
|
||||
&.no-title.no-footer {
|
||||
.ant-modal-body {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.j-modal-title-row {
|
||||
.left {
|
||||
width: calc(100% - 56px - 56px);
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 56px;
|
||||
|
||||
.ant-modal-close {
|
||||
right: 56px;
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
|
||||
&:hover {
|
||||
color: rgba(0, 0, 0, 0.75);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/deep/ {
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,15 +1,22 @@
|
||||
<template>
|
||||
<div class="j-super-query-box">
|
||||
|
||||
<slot>
|
||||
<a-tooltip v-if="superQueryFlag" title="已有高级查询条件生效">
|
||||
<a-button type="primary" @click="visible=true">
|
||||
<a-icon type="appstore" theme="twoTone" :spin="true"></a-icon>
|
||||
<span>高级查询</span>
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
<a-button v-else type="primary" icon="filter" @click="visible=true">高级查询</a-button>
|
||||
</slot>
|
||||
<div @click="visible=true">
|
||||
<slot>
|
||||
<a-tooltip v-if="superQueryFlag" :mouseLeaveDelay="0.2">
|
||||
<template slot="title">
|
||||
<span>已有高级查询条件生效</span>
|
||||
<a-divider type="vertical"/>
|
||||
<a @click="handleReset">清空</a>
|
||||
</template>
|
||||
<a-button type="primary">
|
||||
<a-icon type="appstore" theme="twoTone" :spin="true"></a-icon>
|
||||
<span>高级查询</span>
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
<a-button v-else type="primary" icon="filter" @click="visible=true">高级查询</a-button>
|
||||
</slot>
|
||||
</div>
|
||||
|
||||
<a-modal
|
||||
title="高级查询构造器"
|
||||
|
||||
@ -4,11 +4,12 @@
|
||||
:multiple="true"
|
||||
:action="uploadAction"
|
||||
:headers="headers"
|
||||
:data="{'isup':1,'bizPath':bizPath}"
|
||||
:data="{'biz':bizPath}"
|
||||
:fileList="fileList"
|
||||
:beforeUpload="beforeUpload"
|
||||
@change="handleChange"
|
||||
:disabled="disabled">
|
||||
:disabled="disabled"
|
||||
:returnUrl="returnUrl">
|
||||
<a-button>
|
||||
<a-icon type="upload" />{{ text }}
|
||||
</a-button>
|
||||
@ -19,6 +20,7 @@
|
||||
|
||||
import Vue from 'vue'
|
||||
import { ACCESS_TOKEN } from "@/store/mutation-types"
|
||||
import { getFileAccessHttpUrl } from '@/api/manage';
|
||||
|
||||
const FILE_TYPE_ALL = "all"
|
||||
const FILE_TYPE_IMG = "image"
|
||||
@ -38,9 +40,10 @@
|
||||
data(){
|
||||
return {
|
||||
uploadAction:window._CONFIG['domianURL']+"/sys/common/upload",
|
||||
urlDownload:window._CONFIG['domianURL'] + "/sys/common/download/",
|
||||
urlDownload:window._CONFIG['staticDomainURL'],
|
||||
headers:{},
|
||||
fileList: []
|
||||
fileList: [],
|
||||
newFileList: [],
|
||||
}
|
||||
},
|
||||
props:{
|
||||
@ -77,11 +80,25 @@
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
/**
|
||||
* update -- author:lvdandan -- date:20190219 -- for:Jupload组件增加是否返回url,
|
||||
* true:仅返回url
|
||||
* false:返回fileName filePath fileSize
|
||||
*/
|
||||
returnUrl:{
|
||||
type:Boolean,
|
||||
required:false,
|
||||
default: true
|
||||
},
|
||||
},
|
||||
watch:{
|
||||
value(val){
|
||||
if (val instanceof Array) {
|
||||
this.initFileList(val.join(','))
|
||||
if(this.returnUrl){
|
||||
this.initFileList(val.join(','))
|
||||
}else{
|
||||
this.initFileListArr(val);
|
||||
}
|
||||
} else {
|
||||
this.initFileList(val)
|
||||
}
|
||||
@ -93,6 +110,26 @@
|
||||
},
|
||||
|
||||
methods:{
|
||||
initFileListArr(val){
|
||||
if(!val || val.length==0){
|
||||
this.fileList = [];
|
||||
return;
|
||||
}
|
||||
let fileList = [];
|
||||
for(var a=0;a<val.length;a++){
|
||||
fileList.push({
|
||||
uid:uidGenerator(),
|
||||
name:val[a].fileName,
|
||||
status: 'done',
|
||||
url: val[a].filePath,
|
||||
response:{
|
||||
status:"history",
|
||||
message:val[a].filePath
|
||||
}
|
||||
})
|
||||
}
|
||||
this.fileList = fileList
|
||||
},
|
||||
initFileList(paths){
|
||||
if(!paths || paths.length==0){
|
||||
//return [];
|
||||
@ -104,11 +141,12 @@
|
||||
let fileList = [];
|
||||
let arr = paths.split(",")
|
||||
for(var a=0;a<arr.length;a++){
|
||||
let url = getFileAccessHttpUrl(arr[a],this.urlDownload,"http");
|
||||
fileList.push({
|
||||
uid:uidGenerator(),
|
||||
name:getFileName(arr[a]),
|
||||
status: 'done',
|
||||
url: this.urlDownload+arr[a],
|
||||
url: url,
|
||||
response:{
|
||||
status:"history",
|
||||
message:arr[a]
|
||||
@ -156,12 +194,13 @@
|
||||
if(info.file.response.success){
|
||||
fileList = fileList.map((file) => {
|
||||
if (file.response) {
|
||||
file.url = this.urlDownload+file.response.message;
|
||||
let reUrl = file.response.message;
|
||||
file.url = getFileAccessHttpUrl(reUrl,this.urlDownload,"http");
|
||||
}
|
||||
return file;
|
||||
});
|
||||
}
|
||||
this.$message.success(`${info.file.name} 上传成功!`);
|
||||
//this.$message.success(`${info.file.name} 上传成功!`);
|
||||
}else if (info.file.status === 'error') {
|
||||
this.$message.error(`${info.file.name} 上传失败.`);
|
||||
}else if(info.file.status === 'removed'){
|
||||
@ -169,7 +208,26 @@
|
||||
}
|
||||
this.fileList = fileList
|
||||
if(info.file.status==='done' || info.file.status === 'removed'){
|
||||
this.handlePathChange()
|
||||
//returnUrl为true时仅返回文件路径
|
||||
if(this.returnUrl){
|
||||
this.handlePathChange()
|
||||
}else{
|
||||
//returnUrl为false时返回文件名称、文件路径及文件大小
|
||||
fileList = fileList.filter((file) => {
|
||||
if (file.response) {
|
||||
return file.response.success === true;
|
||||
}
|
||||
return false;
|
||||
}).map((file) => {
|
||||
var fileJson = {
|
||||
fileName:file.name,
|
||||
filePath:file.url,
|
||||
fileSize:file.size
|
||||
};
|
||||
this.newFileList.push(fileJson);
|
||||
this.$emit('change', this.newFileList);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
handleDelete(file){
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
import T from './JFormContainer.vue'
|
||||
let install = function (Vue) {
|
||||
Vue.component('JFormContainer',T);
|
||||
}
|
||||
export default { install };
|
||||
import JModal from './JModal'
|
||||
import JFormContainer from './JFormContainer.vue'
|
||||
|
||||
export default {
|
||||
install(Vue) {
|
||||
Vue.component('JFormContainer', JFormContainer)
|
||||
Vue.component(JModal.name, JModal)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user