popupCallback(value,others,id,row,col,rowIndex)"/>
@@ -353,34 +391,42 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ {{ file.status }}
+
-
-
- handleClickDelFile(id)"/>
-
-
+
+
+ {{ getEllipsisWord(file.name,5) }}
+
-
+
+
+ {{ getEllipsisWord(file.name,5) }}
+
+
+
+
+
+
+
+
+
+
+ 下载
+
+
+ 删除
+
+
+ 更多
+
+
+
+
+
@@ -407,7 +453,7 @@
v-bind="buildProps(row,col)"
@change="(v)=>handleChangeUpload(v,id,row,col)"
>
-
{{ col.placeholder }}
+
上传文件
@@ -418,7 +464,15 @@
-
+
+
+
+
+
+
+
+
+
@@ -432,13 +486,26 @@
-
- handleClickDelFile(id)"/>
-
+
+
+
+
+
+
+
+ 下载
+
+
+ 删除
+
+
+ 更多
+
+
+
@@ -468,7 +535,7 @@
v-bind="buildProps(row,col)"
@change="(v)=>handleChangeUpload(v,id,row,col)"
>
- 请上传图片
+ 上传图片
@@ -599,7 +666,7 @@
:text="slotValues[id]"
:value="slotValues[id]"
:column="col"
- :rowId="removeCaseId(row.id)"
+ :rowId="getCleanId(row.id)"
:getValue="()=>_getValueForSlot(row.id)"
:caseId="caseId"
:allValues="_getAllValuesForSlot()"
@@ -621,8 +688,45 @@
+
+
+
+
+
+
+ 统计
+
+
+ 统计
+
+
+
+
+
+ {{statisticsColumns[col.key]}}
+
+
+
+
+
+
@@ -632,17 +736,25 @@
import Draggable from 'vuedraggable'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { FormTypes, VALIDATE_NO_PASSED } from '@/utils/JEditableTableUtil'
- import { cloneObject, randomString } from '@/utils/util'
+ import { cloneObject, randomString, randomNumber } from '@/utils/util'
import JDate from '@/components/jeecg/JDate'
import { initDictOptions } from '@/components/dict/JDictSelectUtil'
-
+ import { getFileAccessHttpUrl } from '@/api/manage';
+ import JInputPop from '@/components/jeecg/minipop/JInputPop'
+ import JFilePop from '@/components/jeecg/minipop/JFilePop'
// 行高,需要在实例加载完成前用到
let rowHeight = 61
export default {
name: 'JEditableTable',
- components: { JDate, Draggable },
+ components: { JDate, Draggable, JInputPop, JFilePop },
+ provide() {
+ return {
+ parentIsJEditableTable: true,
+ getDestroyCleanGroupRequest: () => this.destroyCleanGroupRequest,
+ }
+ },
props: {
// 列信息
columns: {
@@ -704,8 +816,15 @@
},
data() {
return {
+ // 是否首次运行
+ isFirst: true,
+ // 当前实例是否是行编辑
+ isJEditableTable: true,
// caseId,用于防止有多个实例的时候会冲突
+ caseIdPrefix: '_jet-',
caseId: `_jet-${randomString(6)}-`,
+ // 临时ID标识,凡是以该标识结尾的ID都是临时ID,不添加到数据库中
+ tempId: `_tid-${randomString(6)}`,
// 存储document element 对象
el: {
inputTable: null,
@@ -733,6 +852,8 @@
checkboxValues: {},
// 绑定 jdate 的值
jdateValues: {},
+ // 绑定jinputpop
+ jInputPopValues:{},
// 绑定插槽数据
slotValues: {},
// file 信息
@@ -751,7 +872,15 @@
// 存储显示tooltip的信息
tooltips: {},
// 存储没有通过验证的inputId
- notPassedIds: []
+ notPassedIds: [],
+
+ // 当前是否正在拖拽排序
+ dragging: false,
+ // 是否有统计列
+ hasStatisticsColumn: false,
+ statisticsColumns: {},
+ // 只有在行编辑被销毁时才主动清空GroupRequest的内存
+ destroyCleanGroupRequest: false,
}
},
created() {
@@ -764,7 +893,15 @@
computed: {
// expandHeight = rows.length * rowHeight
getExpandHeight() {
- return this.rows.length * this.rowHeight
+ let length = this.rows.length * this.rowHeight
+ if (this.showStatisticsRow) {
+ length += 34
+ }
+ return length
+ },
+ // 是否显示统计行
+ showStatisticsRow() {
+ return this.hasStatisticsColumn && this.rows.length > 0
},
// 获取是否选择了部分
getSelectIndeterminate() {
@@ -792,6 +929,7 @@
return Vue.ls.get(ACCESS_TOKEN)
},
realTrWidth() {
+ let splice = ' + '
let calcWidth = 'calc('
this.columns.forEach((column, i) => {
let { type, width } = column
@@ -804,12 +942,12 @@
} else {
calcWidth += '120px'
}
-
- if (i < this.columns.length - 1) {
- calcWidth += ' + '
- }
+ calcWidth += splice
}
})
+ if (calcWidth.endsWith(splice)) {
+ calcWidth = calcWidth.substring(0, calcWidth.length - splice.length)
+ }
calcWidth += ')'
// console.log('calcWidth: ', calcWidth)
return calcWidth
@@ -836,125 +974,8 @@
handler: function (newValue) {
// 兼容IE
this.getElementPromise('tbody').then(() => {
-
this.initialize()
-
- let rows = []
- let checkboxValues = {}
- let selectValues = {}
- let jdateValues = {}
- let slotValues = {}
- let uploadValues = {}
- let popupValues = {}
- let radioValues = {}
- let multiSelectValues = {}
- let searchSelectValues = {}
-
- // 禁用行的id
- let disabledRowIds = (this.disabledRowIds || [])
- newValue.forEach((data, newValueIndex) => {
- // 判断源数据是否带有id
- if (data.id == null || data.id === '') {
- data.id = this.removeCaseId(this.generateId() + newValueIndex)
- }
-
- 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
- }
-
- // 解析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.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()
- })
+ this._pushByDataSource(newValue)
})
}
},
@@ -988,7 +1009,7 @@
},
// 当selectRowIds改变时触发事件
selectedRowIds(newValue) {
- this.$emit('selectRowChange', cloneObject(newValue).map(i => this.removeCaseId(i)))
+ this.$emit('selectRowChange', cloneObject(newValue).map(i => this.getCleanId(i)))
}
},
mounted() {
@@ -1008,8 +1029,6 @@
thead.scrollLeft = event.target.scrollLeft
- // vm.recalcTrHiddenItem(event.target.scrollTop)
-
vm.recalcTrHiddenItem(event.target.scrollTop)
}
@@ -1038,36 +1057,42 @@
/** 初始化列表 */
initialize() {
- // inputValues:用来存储input表单的值
- // 数组里的每项都是一个对象,对象里每个key都是input的rowKey,值就是input的值,其中有个id的字段来区分
- // 示例:
- // [{
- // id: "_jet-4sp0iu-15541771111770"
- // dbDefaultVal: "aaa",
- // dbFieldName: "bbb",
- // dbFieldTxt: "ccc",
- // dbLength: 32
- // }]
- this.inputValues = []
this.visibleTrEls = []
- this.rows = []
- this.deleteIds = []
- this.selectValues = {}
- this.checkboxValues = {}
- this.jdateValues = {}
- this.slotValues = {}
- this.selectedRowIds = []
- this.tooltips = {}
- this.notPassedIds = []
- this.uploadValues = []
- this.popupValues = []
- this.radioValues = []
- this.multiSelectValues = []
- this.searchSelectValues = []
- this.scrollTop = 0
- this.$nextTick(() => {
- this.getElement('tbody').scrollTop = 0
- })
+ // 判断是否是首次进入该方法,如果是就不清空行,防止删除了预添加的数据
+ if (!this.isFirst) {
+ // inputValues:用来存储input表单的值
+ // 数组里的每项都是一个对象,对象里每个key都是input的rowKey,值就是input的值,其中有个id的字段来区分
+ // 示例:
+ // [{
+ // id: "_jet-4sp0iu-15541771111770"
+ // dbDefaultVal: "aaa",
+ // dbFieldName: "bbb",
+ // dbFieldTxt: "ccc",
+ // dbLength: 32
+ // }]
+ this.inputValues = []
+ this.rows = []
+ this.deleteIds = []
+ this.selectValues = {}
+ this.checkboxValues = {}
+ this.jdateValues = {}
+ this.jInputPopValues = {}
+ this.slotValues = {}
+ this.selectedRowIds = []
+ this.tooltips = {}
+ this.notPassedIds = []
+ this.uploadValues = []
+ this.popupValues = []
+ this.radioValues = []
+ this.multiSelectValues = []
+ this.searchSelectValues = []
+ this.scrollTop = 0
+ this.$nextTick(() => {
+ this.getElement('tbody').scrollTop = 0
+ })
+ } else {
+ this.isFirst = false
+ }
},
/** 同步滚动条状态 */
@@ -1105,94 +1130,212 @@
rows = this.rows || []
}
let timestamp = new Date().getTime()
- return `${this.caseId}${timestamp}${rows.length}`
+ return `${this.caseId}${timestamp}${rows.length}${randomNumber(6)}${this.tempId}`
},
/** push 一条数据 */
- push(record, update = true, rows, insertIndex = null) {
+ push(record, update = true, rows, insertIndex = null, setDefaultValue = true) {
+ return this._pushByDataSource([record], [insertIndex], update, rows, setDefaultValue)
+ },
+
+ /**
+ * push 数据
+ *
+ * @param dataSource 数据源
+ * @param insertIndexes 行插入位置,和dataSource的下标一一对应
+ * @param update 是否更新
+ * @param rows 若不传就使用 this.rows
+ * @param setDefaultValue 是否填充默认值
+ *
+ */
+ _pushByDataSource(dataSource, insertIndexes = null, update = true, rows = null, setDefaultValue = false) {
if (!(rows instanceof Array)) {
- rows = cloneObject(this.rows) || []
- }
-
- if (record.id == null) {
- record.id = this.generateId(rows)
- // let timestamp = new Date().getTime()
- // record.id = `${this.caseId}${timestamp}${rows.length}`
- }
- if (record.id.indexOf(this.caseId) === -1) {
- record.id = this.caseId + record.id
- }
- let row = { id: record.id }
- let value = { id: row.id }
- let checkboxValues = Object.assign({}, this.checkboxValues)
- let selectValues = Object.assign({}, this.selectValues)
- let jdateValues = Object.assign({}, this.jdateValues)
- let slotValues = Object.assign({}, this.slotValues)
- this.columns.forEach(column => {
- let key = column.key
- let inputId = key + row.id
- // record中是否有该列的值
- let recordHasValue = record[key] != null
- if (column.type === FormTypes.input) {
- value[key] = recordHasValue ? record[key] : (column.defaultValue || (column.defaultValue === 0 ? 0 : ''))
-
- } else if (column.type === FormTypes.inputNumber) {
- // 判断是否是排序字段,如果是就赋最大值
- if (column.isOrder === true) {
- value[key] = this.getInputNumberMaxValue(column) + 1
- } else {
- value[key] = recordHasValue ? record[key] : (column.defaultValue || (column.defaultValue === 0 ? 0 : ''))
- }
+ rows = [...this.rows] || []
+ }
+ let checkboxValues = { ...this.checkboxValues }
+ let selectValues = { ...this.selectValues }
+ let jdateValues = { ...this.jdateValues }
+ let jInputPopValues = { ...this.jInputPopValues }
+ let slotValues = { ...this.slotValues }
+ let uploadValues = { ...this.uploadValues }
+ let popupValues = { ...this.popupValues }
+ let radioValues = { ...this.radioValues }
+ let multiSelectValues = { ...this.multiSelectValues }
+ let searchSelectValues = { ...this.searchSelectValues }
+ // 禁用行的id
+ let disabledRowIds = (this.disabledRowIds || [])
+ dataSource.forEach((data, newValueIndex) => {
+ // 不能直接更改数据源的id
+ let dataId = data.id
+ // 判断源数据是否带有id
+ if (dataId == null || dataId === '') {
+ dataId = this.generateId(rows)
+ } else if(!this.hasCaseId(dataId)) {
+ dataId = this.caseId + dataId
+ }
+ let row = { id: dataId }
+ let value = { id: dataId }
+ let disabled = false
+ this.columns.forEach(column => {
+ let inputId = column.key + value.id
+ let sourceValue = (data[column.key] == null ? '' : data[column.key]).toString()
- } else if (column.type === FormTypes.checkbox) {
- checkboxValues[inputId] = recordHasValue ? record[key] : column.defaultChecked
+ let defaultValue = null;
+ if (setDefaultValue) {
+ defaultValue = column.defaultValue || (column.defaultValue === 0 ? 0 : '')
+ if (defaultValue instanceof Array) {
+ defaultValue = defaultValue.join(',')
+ }
- } else if (column.type === FormTypes.select) {
- let selected = column.defaultValue
- if (selected !== 0 && !selected) {
- selected = undefined
+ sourceValue = (typeof sourceValue === 'number' || sourceValue) ? sourceValue : defaultValue
}
- // 判断多选
- if (typeof selected === 'string' && (column.props || {})['mode'] === 'multiple') {
- selected = selected.split(',')
- }
- selectValues[inputId] = recordHasValue ? record[key] : selected
+ let sourceValueIsEmpty = (sourceValue == null || sourceValue === '')
- } else if (column.type === FormTypes.date || column.type === FormTypes.datetime) {
- jdateValues[inputId] = recordHasValue ? record[key] : column.defaultValue
+ if (column.type === FormTypes.inputNumber) {
+ // 判断是否是排序字段,如果是就赋最大值
+ if (column.isOrder === true) {
+ value[column.key] = this.getInputNumberMaxValue(column) + 1
+ } else {
+ value[column.key] = sourceValue
+ }
+ // 判断是否是统计列
+ if (column.statistics) {
+ this.hasStatisticsColumn = true
+ if (!this.statisticsColumns[column.key]) {
+ this.$set(this.statisticsColumns, column.key, 0)
+ }
+ }
- } else if (column.type === FormTypes.slot) {
- slotValues[inputId] = recordHasValue ? record[key] : (column.defaultValue || '')
+ } else if (column.type === FormTypes.checkbox) {
+ // 判断是否设定了customValue(自定义值)
+ if (column.customValue instanceof Array) {
+ let customValue = (column.customValue[0] || '').toString()
+ if (sourceValueIsEmpty && setDefaultValue) {
+ sourceValue = column.defaultChecked ? customValue : sourceValue
+ }
+ checkboxValues[inputId] = (sourceValue === customValue)
+ } else {
+ if (sourceValueIsEmpty && setDefaultValue) {
+ checkboxValues[inputId] = !!column.defaultChecked
+ } else {
+ checkboxValues[inputId] = sourceValue
+ }
+ }
- } else {
- value[key] = recordHasValue ? record[key] : ''
+ } else if (column.type === FormTypes.select) {
+ if (!sourceValueIsEmpty) {
+ // 判断是否是多选
+ if (typeof sourceValue === 'string' && (column.props || {})['mode'] === 'multiple') {
+ sourceValue = sourceValue.split(',')
+ }
+ selectValues[inputId] = sourceValue
+ } else {
+ selectValues[inputId] = undefined
+ }
+
+ } else if (column.type === FormTypes.date || column.type === FormTypes.datetime) {
+ jdateValues[inputId] = sourceValue
+
+ } else if (column.type === FormTypes.slot) {
+ slotValues[inputId] = sourceValue
+
+ } else if (column.type === FormTypes.popup) {
+ popupValues[inputId] = sourceValue
+ } else if (column.type === FormTypes.input_pop) {
+ jInputPopValues[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 (typeof sourceValue === 'string' && 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 = ''
+ if (sourceValue.indexOf(',') > 0) {
+ let sourceValue2 = sourceValue.split(',')[0]
+ fileName = sourceValue2.substring(sourceValue2.lastIndexOf('/') + 1)
+ } else {
+ fileName = sourceValue.substring(sourceValue.lastIndexOf('/') + 1)
+ }
+ uploadValues[inputId] = {
+ name: fileName,
+ status: 'done',
+ path: sourceValue
+ }
+ }
+ } 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)
+ }
+ }
+ }
+ }
+ })
+ // 插入行而不是添加到最后
+ let added = false
+ if (insertIndexes instanceof Array) {
+ let insertIndex = insertIndexes[newValueIndex]
+ if (typeof insertIndex === 'number') {
+ added = true
+ rows.splice(insertIndex, 0, row)
+ this.inputValues.splice(insertIndex, 0, value)
+ }
+ }
+ if (!added) {
+ rows.push(row)
+ this.inputValues.push(value)
}
})
- if (typeof insertIndex === 'number') {
- rows.splice(insertIndex, 0, row)
- this.inputValues.splice(insertIndex, 0, value)
- } else {
- rows.push(row)
- this.inputValues.push(value)
- }
- this.checkboxValues = checkboxValues
- this.selectValues = selectValues
- this.jdateValues = jdateValues
- this.slotValues = slotValues
-
+ // 启用了拖动排序,就重新计算排序编号
if (this.dragSort) {
this.inputValues.forEach((item, index) => {
item[this.dragSortKey] = (index + 1)
})
}
-
+ this.disabledRowIds = disabledRowIds
+ this.checkboxValues = checkboxValues
+ this.selectValues = selectValues
+ this.jdateValues = jdateValues
+ this.jInputPopValues = jInputPopValues
+ this.slotValues = slotValues
+ this.uploadValues = uploadValues
+ this.popupValues = popupValues
+ this.radioValues = radioValues
+ this.multiSelectValues = multiSelectValues
+ this.searchSelectValues = searchSelectValues
+ // 重新计算所有统计列
+ this.recalcAllStatisticsColumns()
+ // 更新到 dom
if (update) {
this.rows = rows
+
+ // 更新form表单的值
this.$nextTick(() => {
this.updateFormValues()
})
}
return rows
},
+
/** 获取某一数字输入框列中的最大的值 */
getInputNumberMaxValue(column) {
let maxNum = 0
@@ -1219,9 +1362,8 @@
let rows = this.rows
let row
for (let i = 0; i < num; i++) {
- // row = { id: `${this.caseId}${timestamp}${rows.length}` }
- row = { id: this.generateId(rows) }
- rows = this.push(row, false, rows)
+ rows = this.push({}, false, rows)
+ row = rows[rows.length - 1]
}
this.rows = rows
@@ -1232,7 +1374,7 @@
this.$emit('added', {
row: (() => {
let r = Object.assign({}, row)
- r.id = this.removeCaseId(r.id)
+ r.id = this.getCleanId(r.id)
return r
})(),
target: this
@@ -1275,7 +1417,7 @@
this.$emit('inserted', {
rows: newRows.map(row => {
let r = cloneObject(row)
- r.id = this.removeCaseId(r.id)
+ r.id = this.getCleanId(r.id)
return r
}),
num, insertIndex,
@@ -1300,10 +1442,12 @@
let rows = cloneObject(this.rows)
ids.forEach(removeId => {
+ removeId = this.getCleanId(removeId)
// 找到每个id对应的真实index并删除
const findAndDelete = (arr) => {
for (let i = 0; i < arr.length; i++) {
- if (arr[i].id === removeId || arr[i].id === this.caseId + removeId) {
+ let currentId = this.getCleanId(arr[i].id)
+ if (currentId === removeId) {
arr.splice(i, 1)
return true
}
@@ -1314,7 +1458,7 @@
// 找到values对应的index,并删除
findAndDelete(this.inputValues)
// 将caseId去除
- let id = this.removeCaseId(removeId)
+ let id = this.getCleanId(removeId)
this.deleteIds.push(id)
}
})
@@ -1323,15 +1467,19 @@
this.$nextTick(() => {
// 更新formValues
this.updateFormValues()
+ // 重新计算统计
+ this.recalcAllStatisticsColumns()
})
return true
},
/** 获取表格表单里的值(异步版) */
getValuesAsync(options = {}, callback) {
- let { validate, rowIds } = options
+ let { validate, rowIds, deleteTempId } = options
if (typeof validate !== 'boolean') validate = true
if (!(rowIds instanceof Array)) rowIds = null
+ // 是否删除临时ID,默认为 false
+ if (typeof deleteTempId !== 'boolean') deleteTempId = false
// console.log('options:', { validate, rowIds })
let asyncCount = 0
@@ -1349,7 +1497,7 @@
rowIdsFlag = true
} else {
for (let rowId of rowIds) {
- if (rowId === value.id || `${this.caseId}${rowId}` === value.id) {
+ if (this.getCleanId(rowId) === this.getCleanId(value.id)) {
rowIdsFlag = true
break
}
@@ -1379,6 +1527,9 @@
} else if (column.type === FormTypes.date || column.type === FormTypes.datetime) {
value[column.key] = this.jdateValues[inputId]
+ } else if (column.type === FormTypes.input_pop) {
+ value[column.key] = this.jInputPopValues[inputId]
+
} else if (column.type === FormTypes.upload) {
value[column.key] = cloneObject(this.uploadValues[inputId] || null)
@@ -1432,10 +1583,14 @@
handleValidateOneInput(results)
}
})
- // 将caseId去除
- value.id = this.removeCaseId(value.id)
- values.push(value)
+ // 删除 tempId
+ if (deleteTempId && this.isTempId(value.id)) {
+ delete value.id
+ } else {
+ value.id = this.getCleanId(value.id)
+ }
+ values.push(value)
}
if (validate === true) {
@@ -1450,7 +1605,7 @@
callback({ error, values })
}
}
- }, 50)
+ }, 10)
return { error, values }
},
@@ -1469,9 +1624,9 @@
})
},
/** getValues的Promise版 */
- getValuesPromise(validate = true, rowIds) {
+ getValuesPromise(validate = true, rowIds, deleteTempId) {
return new Promise((resolve, reject) => {
- this.getValuesAsync({ validate, rowIds }, ({ error, values }) => {
+ this.getValuesAsync({ validate, rowIds, deleteTempId }, ({ error, values }) => {
if (error === 0) {
resolve(values)
} else {
@@ -1485,10 +1640,10 @@
return cloneObject(this.deleteIds)
},
/** 获取所有的数据,包括values、deleteIds */
- getAll(validate) {
+ getAll(validate, deleteTempId) {
return new Promise((resolve, reject) => {
let deleteIds = this.getDeleteIds()
- this.getValuesPromise(validate).then((values) => {
+ this.getValuesPromise(validate, null, deleteTempId).then((values) => {
resolve({ values, deleteIds })
}).catch(error => {
reject(error)
@@ -1496,8 +1651,8 @@
})
},
/** Sync 获取所有的数据,包括values、deleteIds */
- getAllSync(validate, rowIds) {
- let result = this.getValuesSync({ validate, rowIds })
+ getAllSync(validate, rowIds, deleteTempId) {
+ let result = this.getValuesSync({ validate, rowIds, deleteTempId })
result.deleteIds = this.getDeleteIds()
return result
},
@@ -1511,6 +1666,7 @@
selectValues: this.selectValues,
checkboxValues: this.checkboxValues,
jdateValues: this.jdateValues,
+ jInputPopValues: this.jInputPopValues,
slotValues: this.slotValues,
uploadValues: this.uploadValues,
popupValues: this.popupValues,
@@ -1524,13 +1680,14 @@
values.forEach(item => {
let { rowKey, values: newValues } = item
+ rowKey = this.getCleanId(rowKey)
for (let newValueKey in newValues) {
if (newValues.hasOwnProperty(newValueKey)) {
let newValue = newValues[newValueKey]
let edited = false // 已被修改
this.inputValues.forEach(value => {
// 在inputValues中找到了该字段
- if (`${this.caseId}${rowKey}` === value.id) {
+ if (rowKey === this.getCleanId(value.id)) {
if (value.hasOwnProperty(newValueKey)) {
edited = true
value[newValueKey] = newValue
@@ -1539,28 +1696,48 @@
})
let modelKey = `${newValueKey}${this.caseId}${rowKey}`
// 在 selectValues 中寻找值
- if (!edited && this.selectValues.hasOwnProperty(modelKey)) {
+ if (!edited) {
if (newValue !== 0 && !newValue) {
- this.selectValues[modelKey] = undefined
+ edited = this.setOneValue(this.selectValues, modelKey, undefined)
} else {
- this.selectValues[modelKey] = newValue
+ edited = this.setOneValue(this.selectValues, modelKey, newValue)
}
- edited = true
}
// 在 checkboxValues 中寻找值
- if (!edited && this.checkboxValues.hasOwnProperty(modelKey)) {
- this.checkboxValues[modelKey] = newValue
- edited = true
+ if (!edited) {
+ edited = this.setOneValue(this.checkboxValues, modelKey, newValue)
}
// 在 jdateValues 中寻找值
- if (!edited && this.jdateValues.hasOwnProperty(modelKey)) {
- this.jdateValues[modelKey] = newValue
- edited = true
+ if (!edited) {
+ edited = this.setOneValue(this.jdateValues, modelKey, newValue)
+ }
+ // 在 jInputPopValues 中寻找值
+ if (!edited) {
+ edited = this.setOneValue(this.jInputPopValues, modelKey, newValue)
}
// 在 slotValues 中寻找值
- if (!edited && this.slotValues.hasOwnProperty(modelKey)) {
- this.slotValues[modelKey] = newValue
- edited = true
+ if (!edited) {
+ edited = this.setOneValue(this.slotValues, modelKey, newValue)
+ }
+ // 在 uploadValues 中寻找值
+ if (!edited) {
+ edited = this.setOneValue(this.uploadValues, modelKey, newValue)
+ }
+ // 在 popupValues 中寻找值
+ if (!edited) {
+ edited = this.setOneValue(this.popupValues, modelKey, newValue)
+ }
+ // 在 radioValues 中寻找值
+ if (!edited) {
+ edited = this.setOneValue(this.radioValues, modelKey, newValue)
+ }
+ // 在 multiSelectValues 中寻找值
+ if (!edited) {
+ edited = this.setOneValue(this.multiSelectValues, modelKey, newValue)
+ }
+ // 在 searchSelectValues 中寻找值
+ if (!edited) {
+ edited = this.setOneValue(this.searchSelectValues, modelKey, newValue)
}
}
}
@@ -1568,6 +1745,24 @@
// 强制更新formValues
this.forceUpdateFormValues()
},
+ setOneValue(valuesObject, modelKey, value) {
+ let key = this.valuesHasOwnProperty(valuesObject, modelKey)
+ if (key) {
+ this.$set(valuesObject, key, value)
+ return true
+ }
+ return false
+ },
+ valuesHasOwnProperty(values, ownProperty) {
+ let key = ownProperty
+ if (values.hasOwnProperty(key)) {
+ return key
+ }
+ if (values.hasOwnProperty(key + this.tempId)) {
+ return key + this.tempId
+ }
+ return null
+ },
/** 跳转到指定位置 */
// jumpToId(id, element) {
@@ -1602,44 +1797,40 @@
const nextThen = res => {
let [passed, message] = res
- if (passed == null) {
- // debugger
- }
- if (passed == null && tooltips[inputId].visible != null) {
- return
- }
- passed = passed == null ? true : passed
- tooltips[inputId].visible = !passed
- tooltips[inputId].passed = passed
- let index = notPassedIds.indexOf(inputId)
- let borderColor = null, boxShadow = null
- if (!passed) {
- tooltips[inputId].title = this.replaceProps(column, message)
- borderColor = 'red'
- boxShadow = `0 0 0 2px rgba(255, 0, 0, 0.2)`
- if (index === -1) notPassedIds.push(inputId)
- } else {
- if (index !== -1) notPassedIds.splice(index, 1)
- }
-
- let element = document.getElementById(inputId)
- if (element != null) {
- // select 在 .ant-select-selection 上设置 border-color
- if (column.type === FormTypes.select) {
- element = element.getElementsByClassName('ant-select-selection')[0]
- }
- // jdate 在 input 上设置 border-color
- 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]
+ // !(passed == null && tooltips[inputId].visible != null)
+ if (passed != null) {
+ tooltips[inputId].visible = !passed
+ tooltips[inputId].passed = passed
+ let index = notPassedIds.indexOf(inputId)
+ let borderColor = null, boxShadow = null
+ if (!passed) {
+ tooltips[inputId].title = this.replaceProps(column, message)
+ borderColor = 'red'
+ boxShadow = `0 0 0 2px rgba(255, 0, 0, 0.2)`
+ if (index === -1) notPassedIds.push(inputId)
+ } else {
+ if (index !== -1) notPassedIds.splice(index, 1)
}
- element.style.borderColor = borderColor
- element.style.boxShadow = boxShadow
- if (element.tagName === 'SPAN') {
- element.style.display = 'block'
+
+ let element = document.getElementById(inputId)
+ if (element != null) {
+ // select 在 .ant-select-selection 上设置 border-color
+ if (column.type === FormTypes.select) {
+ element = element.getElementsByClassName('ant-select-selection')[0]
+ }
+ // jdate 在 input 上设置 border-color
+ 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') {
+ element.style.display = 'block'
+ }
}
}
// 是否更新到data
@@ -1656,16 +1847,16 @@
if (typeof passed === 'function') {
let executed = false
- passed(validType, value, row, column, (flag, msg) => {
+ passed(validType, value, { id: this.getCleanId(row.id) }, { ...column }, (flag, msg) => {
if (executed) return
executed = true
if (typeof msg === 'string') {
message = msg
}
- if (flag == null || flag === true) {
- nextThen([true, message])
+ if (flag == null) {
+ nextThen([null, message])
} else {
- nextThen([false, message])
+ nextThen([!!flag, message])
}
}, this)
} else {
@@ -1710,17 +1901,17 @@
// 兼容 online 的规则
let foo = [
- { title: '6到16位数字', value: 'n6-16', pattern: /\d{6,18}/ },
+ { title: '6到16位数字', value: 'n6-16', pattern: /^\d{6,18}$/ },
{ 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*$/ },
+ { title: '数字', value: 'n', pattern: /^-?\d+(\.?\d+|\d?)$/ },
{ title: '整数', value: 'z', pattern: /^-?\d+$/ },
{ title: '非空', value: '*', pattern: /^.+$/ },
- { title: '6到18位字符串', value: 's6-18', pattern: /^.{6,18}$/ },
{ title: '金额', value: 'money', pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/ },
]
let flag = false
@@ -1793,6 +1984,43 @@
this.updateFormValues()
},
+ // 重新计算所有统计列
+ recalcAllStatisticsColumns() {
+ if (this.hasStatisticsColumn) {
+ Object.keys(this.statisticsColumns).forEach(key => this.recalcOneStatisticsColumn(key))
+ }
+ },
+ // 重新计算单个统计列
+ recalcOneStatisticsColumn(key) {
+ if (this.hasStatisticsColumn) {
+ if (this.statisticsColumns.hasOwnProperty(key)) {
+ // 计算合计值
+ let count = 0
+ this.inputValues.forEach(item => {
+ let value = item[key]
+ if (value && count !== '-') {
+ try {
+ count += Number.parseInt(value)
+ } catch (e) {
+ count = '-'
+ }
+ }
+ })
+ this.statisticsColumns[key] = count
+ }
+ }
+ },
+
+ /** 获取某个统计字段的值 */
+ getStatisticsValue(key) {
+ if (this.hasStatisticsColumn) {
+ if (this.statisticsColumns.hasOwnProperty(key)) {
+ return this.statisticsColumns[key]
+ }
+ }
+ return null
+ },
+
/** 全选或取消全选 */
handleChangeCheckedAll() {
let selectedRowIds = []
@@ -1835,7 +2063,7 @@
},
/** 用于搜索下拉框中的内容 */
handleSelectFilterOption(input, option, column) {
- if (column.allowSearch === true) {
+ if (column.allowSearch === true || column.allowInput === true) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
return true
@@ -1879,6 +2107,8 @@
}
}
+ // 做单个表单验证
+ this.validateOneInput(value, row, col, this.notPassedIds, true, 'blur')
},
/** 触发已拖动事件 */
@@ -1886,8 +2116,16 @@
this.$emit('dragged', { oldIndex, newIndex, target: this })
},
+ handleDragMoveStart(event) {
+ this.dragging = true
+ this.$refs.scrollView.style.overflow = 'hidden'
+ },
+
/** 拖动结束,交换inputValue中的值 */
handleDragMoveEnd(event) {
+ this.dragging = false
+ this.$refs.scrollView.style.overflow = 'auto'
+
let { oldIndex, newIndex, item: { dataset: { idx: dataIdx } } } = event
// 由于动态显示隐藏行导致index有误差,需要算出真实的index
@@ -1965,16 +2203,17 @@
},
/** input事件 */
handleInputCommono(target, index, row, column) {
+ let oldValue = this.inputValues[index][column.key] || ''
let { value, dataset, selectionStart } = target
let type = FormTypes.input
let change = true
if (`${dataset.inputNumber}` === 'true') {
type = FormTypes.inputNumber
- let replace = value.replace(/[^0-9]/g, '')
- if (value !== replace) {
+ // 判断输入的值是否匹配数字正则表达式,不匹配就还原
+ if (!/^-?\d+\.?\d*$/.test(value) && (value !== '' && value !== '-')) {
change = false
- value = replace
- target.value = replace
+ value = oldValue
+ target.value = value
if (typeof selectionStart === 'number') {
target.selectionStart = selectionStart - 1
target.selectionEnd = selectionStart - 1
@@ -1986,6 +2225,10 @@
// 做单个表单验证
this.validateOneInput(value, row, column, this.notPassedIds, true, 'input')
+ if (type === FormTypes.inputNumber) {
+ this.recalcOneStatisticsColumn(column.key)
+ }
+
// 触发valueChange 事件
if (change) {
this.elemValueChange(type, row, column, value)
@@ -2000,7 +2243,16 @@
this.elemValueChange(FormTypes.slot, row, column, value)
},
handleBlurCommono(target, index, row, column) {
- let { value } = target
+ let { value, dataset } = target
+ if (dataset && `${dataset.inputNumber}` === 'true') {
+ // 判断输入的值是否匹配数字正则表达式,不匹配就置空
+ if (!/^-?\d+\.?\d*$/.test(value)) {
+ value = ''
+ } else {
+ value = Number.parseFloat(value)
+ }
+ target.value = value
+ }
// 做单个表单验证
this.validateOneInput(value, row, column, this.notPassedIds, true, 'blur')
},
@@ -2030,6 +2282,13 @@
this.elemValueChange(FormTypes.date, row, column, value)
}
},
+ handleChangeJInputPopCommon(value, id, row, column){
+ this.jInputPopValues = this.bindValuesChange(value, id, 'jInputPopValues')
+ // 做单个表单验证
+ this.validateOneInput(value, row, column, this.notPassedIds, true, 'change')
+ // 触发valueChange 事件
+ this.elemValueChange(FormTypes.input_pop, row, column, value)
+ },
handleChangeUpload(info, id, row, column) {
let { file } = info
let value = {
@@ -2042,11 +2301,26 @@
if (column.responseName && file.response) {
value['responseName'] = file.response[column.responseName]
}
- if (file.status == 'done') {
+ if (file.status === 'done') {
value['path'] = file.response[column.responseName]
+ } else if (file.status === 'error') {
+ value['message'] = file.response.message || '未知错误'
}
this.uploadValues = this.bindValuesChange(value, id, 'uploadValues')
},
+ handleMoreOperation(id,flag){
+ //console.log("this.uploadValues[id]",this.uploadValues[id])
+ let path = ''
+ if(this.uploadValues && this.uploadValues[id]){
+ path = this.uploadValues[id].path
+ }
+ this.$refs.filePop.show(id,path,flag)
+ },
+ handleFileSuccess(obj){
+ if(obj.id){
+ this.uploadValues = this.bindValuesChange(obj, obj.id, 'uploadValues')
+ }
+ },
/** 记录用到数据绑定的组件的值 */
bindValuesChange(value, id, key) {
// let values = Object.assign({}, this[key])
@@ -2074,7 +2348,7 @@
let column = Object.assign({}, columnSource)
// 将caseId去除
let row = Object.assign({}, rowSource)
- row.id = this.removeCaseId(row.id)
+ row.id = this.getCleanId(row.id)
// 获取整行的数据
let { values } = this.getValuesSync({ validate: false, rowIds: [row.id] })
if (values.length > 0) {
@@ -2083,10 +2357,37 @@
this.$emit('valueChange', { type, row, column, value, target: this })
},
+ /** 获取干净的ID(不包含任何杂质的ID) */
+ getCleanId(id) {
+ id = this.removeCaseId(id)
+ id = this.removeTempId(id)
+ return id
+ },
+
+ /** 判断某个ID是否包含了caseId */
+ hasCaseId(id) {
+ return id && id.startsWith(this.caseId)
+ },
+
/** 将caseId去除 */
removeCaseId(id) {
- let remove = id.split(this.caseId)[1]
- return remove ? remove : id
+ if (this.hasCaseId(id)) {
+ return id.substring(this.caseId.length, id.length)
+ }
+ return id
+ },
+
+ // 判断 id 是否是临时Id
+ isTempId(id) {
+ return (id || '').endsWith(this.tempId)
+ },
+
+ /** 将tempId去除 */
+ removeTempId(id) {
+ if (this.isTempId(id)) {
+ return id.substring(0, id.length - this.tempId.length)
+ }
+ return id;
},
handleClickDelFile(id) {
@@ -2095,10 +2396,28 @@
handleClickDownloadFile(id) {
let { path } = this.uploadValues[id] || {}
if (path) {
- let url = window._CONFIG['staticDomainURL'] + '/' + path
+ let url = getFileAccessHttpUrl(path)
+ window.open(url)
+ }
+ },
+ handleClickDownFileByUrl(id){
+ let { url,path } = this.uploadValues[id] || {}
+ if (!url || url.length===0) {
+ if(path && path.length>0){
+ url = getFileAccessHttpUrl(path.split(',')[0])
+ }
+ }
+ if(url){
window.open(url)
}
},
+ handleClickShowImageError(id) {
+ let currUploadObj = this.uploadValues[id] || null
+ if (currUploadObj && currUploadObj['message']) {
+ this.$error({ title: '上传出错', content: '错误信息:' + currUploadObj['message'], maskClosable: true })
+ }
+ },
+
/** 加载数据字典并合并到 options */
_loadDictConcatToOptions(column) {
initDictOptions(column.dictCode).then((res) => {
@@ -2122,7 +2441,11 @@
/* --- 以下是辅助方法,多用于动态构造页面中的数据 --- */
/** 辅助方法:打印日志 */
- log: console.log,
+ log() {
+ if (this.$attrs.logger) {
+ console.log.apply(null, arguments)
+ }
+ },
getVM() {
return this
@@ -2265,11 +2588,15 @@
/** 预览图片地址 */
getCellImageView(id) {
let currUploadObj = this.uploadValues[id] || null
- if (currUploadObj && currUploadObj['path']) {
- return window._CONFIG['staticDomainURL'] + '/' + currUploadObj['path']
- } else {
- return ''
+ if (currUploadObj) {
+ if(currUploadObj['url']){
+ return currUploadObj['url'];
+ }else if(currUploadObj['path']){
+ let readpath = currUploadObj['path'].split(',')[0]
+ return getFileAccessHttpUrl(readpath)
+ }
}
+ return ''
},
/** popup回调 */
popupCallback(value, others, id, row, column, index) {
@@ -2277,7 +2604,18 @@
this.popupValues[id] = value
if (others) {
Object.keys(others).map((key) => {
- this.inputValues[index][key] = others[key]
+ this.columns.map(k=>{
+ if(k.key === key){
+ let tempId = id.substring(id.indexOf(this.caseIdPrefix))
+ if(k.type === 'date'){
+ this.handleChangeJDateCommon(others[key], key+tempId, {id:tempId}, k, false)
+ }else if(k.type === 'datetime'){
+ this.handleChangeJDateCommon(others[key], key+tempId, {id:tempId}, k, true)
+ }else{
+ this.inputValues[index][key] = others[key]
+ }
+ }
+ })
})
}
// 做单个表单验证
@@ -2315,9 +2653,20 @@
filterOption(input, option) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
+ getEllipsisWord(content, len){
+ if(!content || content.length==0){
+ return ''
+ }
+ if(content.length>len){
+ return content.substr(0,len)
+ }
+ return content;
+ }
-
- }
+ },
+ beforeDestroy() {
+ this.destroyCleanGroupRequest = true
+ },
}
@@ -2538,6 +2887,21 @@
}
+ .j-editable-image {
+ height: 32px;
+ max-width: 100px !important;
+ cursor: pointer;
+
+ &:hover {
+ opacity: 0.8;
+ }
+
+ &:active {
+ opacity: 0.6;
+ }
+
+ }
+
}
}
diff --git a/ant-design-vue-jeecg/src/components/jeecg/JEditor.vue b/ant-design-vue-jeecg/src/components/jeecg/JEditor.vue
index 1c752a26ce0c654c809b3d045b31cfa8c7d83363..b77b24a66f271c4f28fbc1dece6d8226e96ab379 100644
--- a/ant-design-vue-jeecg/src/components/jeecg/JEditor.vue
+++ b/ant-design-vue-jeecg/src/components/jeecg/JEditor.vue
@@ -23,6 +23,7 @@
import 'tinymce/plugins/colorpicker'
import 'tinymce/plugins/textcolor'
import 'tinymce/plugins/fullscreen'
+ import { uploadAction,getFileAccessHttpUrl } from '@/api/manage'
export default {
components: {
Editor
@@ -65,8 +66,21 @@
menubar: false,
toolbar_drawer: false,
images_upload_handler: (blobInfo, success) => {
- const img = 'data:image/jpeg;base64,' + blobInfo.base64()
- success(img)
+ let formData = new FormData()
+ formData.append('file', blobInfo.blob(), blobInfo.filename());
+ formData.append('biz', "jeditor");
+ formData.append("jeditor","1");
+ uploadAction(window._CONFIG['domianURL']+"/sys/common/upload", formData).then((res) => {
+ if (res.success) {
+ if(res.message == 'local'){
+ const img = 'data:image/jpeg;base64,' + blobInfo.base64()
+ success(img)
+ }else{
+ let img = getFileAccessHttpUrl(res.message)
+ success(img)
+ }
+ }
+ })
}
},
myValue: this.value
diff --git a/ant-design-vue-jeecg/src/components/jeecg/JFormContainer.vue b/ant-design-vue-jeecg/src/components/jeecg/JFormContainer.vue
index c0df77db89f71e28bfb1092b3a5d3427bb5aedbd..c941ed3d272e9c9b31877d9256c22932175c11a2 100644
--- a/ant-design-vue-jeecg/src/components/jeecg/JFormContainer.vue
+++ b/ant-design-vue-jeecg/src/components/jeecg/JFormContainer.vue
@@ -1,6 +1,6 @@
-
diff --git a/ant-design-vue-jeecg/src/views/system/DataLogList.vue b/ant-design-vue-jeecg/src/views/system/DataLogList.vue
index 15e319eef658ed7b6b5946f100dbc16ec6c789bd..98351e25808c3e42407bf1b0da3599596fb7de34 100644
--- a/ant-design-vue-jeecg/src/views/system/DataLogList.vue
+++ b/ant-design-vue-jeecg/src/views/system/DataLogList.vue
@@ -79,26 +79,30 @@
{
title: '表名',
align: 'center',
- dataIndex: 'dataTable'
+ dataIndex: 'dataTable',
+ width: "120"
}, {
title: '数据ID',
align: 'center',
- dataIndex: 'dataId'
+ dataIndex: 'dataId',
+ width: "120"
}, {
title: '版本号',
align: 'center',
- dataIndex: 'dataVersion'
+ dataIndex: 'dataVersion',
+ width: "50"
}, {
title: '数据内容',
align: 'center',
dataIndex: 'dataContent',
- width: "120px",
+ width: "150",
scopedSlots: {customRender: 'dataContent'},
}, {
title: '创建人',
align: 'center',
- dataIndex: 'createBy'
- }
+ dataIndex: 'createBy',
+ width: "100"
+ },
],
url: {
list: "/sys/dataLog/list",
diff --git a/ant-design-vue-jeecg/src/views/system/DepartList.vue b/ant-design-vue-jeecg/src/views/system/DepartList.vue
index cd4dd547f25143f766eff380f30345905a23c4b8..95597b0929b9d5b1f73f20e47199688771cc64a4 100644
--- a/ant-design-vue-jeecg/src/views/system/DepartList.vue
+++ b/ant-design-vue-jeecg/src/views/system/DepartList.vue
@@ -5,8 +5,8 @@
- 添加子部门
- 添加一级部门
+ 添加部门
+ 添加下级
导出
导入
@@ -73,7 +73,7 @@
-
+
+
+
+ 请先选择一个部门!
+
+
@@ -224,6 +229,7 @@
visible: false,
departTree: [],
rightClickSelectedKey: '',
+ rightClickSelectedOrgCode: '',
hiding: true,
model: {},
dropTrigger: '',
@@ -282,6 +288,8 @@
that.departTree = []
queryDepartTreeList().then((res) => {
if (res.success) {
+ //部门全选后,再添加部门,选中数量增多
+ this.allTreeKeys = [];
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i]
that.treeData.push(temp)
@@ -311,6 +319,7 @@
this.dropTrigger = 'contextmenu'
console.log(node.node.eventKey)
this.rightClickSelectedKey = node.node.eventKey
+ this.rightClickSelectedOrgCode = node.node.dataRef.orgCode
},
onExpand(expandedKeys) {
console.log('onExpand', expandedKeys)
@@ -422,8 +431,10 @@
}else{
this.orgCategoryDisabled = false;
}
- this.form.getFieldDecorator('fax', {initialValue: ''})
- this.form.setFieldsValue(pick(record, 'departName','orgCategory', 'orgCode', 'departOrder', 'mobile', 'fax', 'address', 'memo'))
+ this.$nextTick(() => {
+ this.form.getFieldDecorator('fax', {initialValue: ''})
+ this.form.setFieldsValue(pick(record, 'departName','orgCategory', 'orgCode', 'departOrder', 'mobile', 'fax', 'address', 'memo'))
+ })
},
getCurrSelectedTitle() {
return !this.currSelected.title ? '' : this.currSelected.title
@@ -486,7 +497,7 @@
} else if (num == 2) {
let key = this.currSelected.key
if (!key) {
- this.$message.warning('请先选中一条记录!')
+ this.$message.warning('请先点击选中上级部门!')
return false
}
this.$refs.departModal.add(this.selectedKeys)
@@ -497,12 +508,26 @@
}
},
handleDelete() {
- deleteByDepartId({id: this.rightClickSelectedKey}).then((resp) => {
- if (resp.success) {
- this.$message.success('删除成功!')
- this.loadTree()
- } else {
- this.$message.warning('删除失败!')
+ var that = this
+ this.$confirm({
+ title: '确认删除',
+ content: '确定要删除此部门以及子节点数据吗?',
+ onOk: function () {
+ deleteByDepartId({id: that.rightClickSelectedKey}).then((resp) => {
+ if (resp.success) {
+ //删除成功后,去除已选中中的数据
+ that.checkedKeys.splice(that.checkedKeys.findIndex(key => key === that.rightClickSelectedKey), 1);
+ that.$message.success('删除成功!')
+ that.loadTree()
+ //删除后同步清空右侧基本信息内容
+ let orgCode=that.form.getFieldValue("orgCode");
+ if(orgCode && orgCode === that.rightClickSelectedOrgCode){
+ that.onClearSelected()
+ }
+ } else {
+ that.$message.warning('删除失败!')
+ }
+ })
}
})
},
diff --git a/ant-design-vue-jeecg/src/views/system/DepartUserList.vue b/ant-design-vue-jeecg/src/views/system/DepartUserList.vue
index 9bb72b2c2bf397e12bf401bb8402d7aa09d89b66..96352f8e424c5a28444f50410da1de88575cc39c 100644
--- a/ant-design-vue-jeecg/src/views/system/DepartUserList.vue
+++ b/ant-design-vue-jeecg/src/views/system/DepartUserList.vue
@@ -17,6 +17,8 @@
:dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
:treeData="departTree"
:autoExpandParent="autoExpandParent"
+ :expandedKeys="iExpandedKeys"
+ @expand="onExpand"
/>
@@ -99,7 +101,7 @@
},
methods: {
callback(key) {
- console.log(key)
+ //console.log(key)
},
loadData() {
this.refresh();
@@ -130,11 +132,15 @@
})
},
setThisExpandedKeys(node) {
+ //只展开一级目录
if (node.children && node.children.length > 0) {
this.iExpandedKeys.push(node.key)
+ //下方代码放开注释则默认展开所有节点
+ /**
for (let a = 0; a < node.children.length; a++) {
this.setThisExpandedKeys(node.children[a])
}
+ */
}
},
refresh() {
@@ -153,7 +159,7 @@
onSearch(value) {
let that = this
if (value) {
- searchByKeywords({keyWord: value}).then((res) => {
+ searchByKeywords({keyWord: value,myDeptSearch:'1'}).then((res) => {
if (res.success) {
that.departTree = []
for (let i = 0; i < res.result.length; i++) {
diff --git a/ant-design-vue-jeecg/src/views/system/DictDeleteList.vue b/ant-design-vue-jeecg/src/views/system/DictDeleteList.vue
index c59b03c4cf51b92e27a28a76ab3ad12046142373..d0334805665a7217e49fe9e34b51f5aae7431278 100644
--- a/ant-design-vue-jeecg/src/views/system/DictDeleteList.vue
+++ b/ant-design-vue-jeecg/src/views/system/DictDeleteList.vue
@@ -79,6 +79,8 @@
methods: {
handleCancel(){
this.visible = false
+ //回收站字典列表刷新
+ this.$emit("refresh")
},
show(){
this.visible = true
@@ -106,14 +108,25 @@
})
},
handleDelete(id){
- deleteAction("/sys/dict/deletePhysic/"+id).then(res=>{
- if(res.success){
- this.$message.success(res.message)
- this.loadData();
- }else{
- this.$message.warning(res.message)
- }
- })
+ this.$confirm({
+ title: '彻底删除字典',
+ content: (
+
您确定要彻底删除这个字典项吗?
+
注意:彻底删除后将无法恢复,请谨慎操作!
+
),
+ centered: false,
+ onOk: () => {
+ var that = this;
+ deleteAction("/sys/dict/deletePhysic/"+id).then((res) => {
+ if (res.success) {
+ this.$message.success(res.message)
+ this.loadData();
+ } else {
+ that.$message.warning(res.message);
+ }
+ });
+ },
+ })
}
}
diff --git a/ant-design-vue-jeecg/src/views/system/DictItemList.vue b/ant-design-vue-jeecg/src/views/system/DictItemList.vue
index 54eaef8189f8bea0cbaf6f7d2b4da48d5598f1af..dd2f6bca7c2e35ee6fbc6894318219ff57cacd66 100644
--- a/ant-design-vue-jeecg/src/views/system/DictItemList.vue
+++ b/ant-design-vue-jeecg/src/views/system/DictItemList.vue
@@ -171,6 +171,10 @@
param.field = this.getQueryField();
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
+ if (this.superQueryParams) {
+ param['superQueryParams'] = encodeURI(this.superQueryParams)
+ param['superQueryMatchType'] = this.superQueryMatchType
+ }
return filterObj(param);
},
diff --git a/ant-design-vue-jeecg/src/views/system/DictList.vue b/ant-design-vue-jeecg/src/views/system/DictList.vue
index 482c28e02659cd889324e70959fbb7e46a932248..30fc051db28d0003815beecd3515ec7b74661119 100644
--- a/ant-design-vue-jeecg/src/views/system/DictList.vue
+++ b/ant-design-vue-jeecg/src/views/system/DictList.vue
@@ -61,7 +61,7 @@