|
@@ -15,18 +15,18 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="panel-body">
|
|
<div class="panel-body">
|
|
|
- <el-table :data="copDataModel" ref="elTable" :header-cell-style="{ color: '#000', 'font-size': '14px', padding: '4px 0' }" :row-class-name="tableRowClassName" :show-summary="showSummary" :sum-text="sumText" :summary-method="hasSummaryMethod ? summaryMethod : null" border @selection-change="handleSelectionChange">
|
|
|
|
|
|
|
+ <el-table ref="elTable" :data="copDataModel" :header-cell-style="{ color: '#000', 'font-size': '14px', padding: '4px 0' }" :row-class-name="tableRowClassName" :show-summary="showSummary" :sum-text="sumText" :summary-method="hasSummaryMethod ? summaryMethod : null" border @selection-change="handleSelectionChange">
|
|
|
<el-table-column v-if="!tableReadonly" type="selection" width="50" />
|
|
<el-table-column v-if="!tableReadonly" type="selection" width="50" />
|
|
|
<el-table-column v-if="field.field_options.index" type="index" :label="field.field_options.index_name ? field.field_options.index_name : '序号'" :width="field.field_options.index_width ? field.field_options.index_width : 50" />
|
|
<el-table-column v-if="field.field_options.index" type="index" :label="field.field_options.index_name ? field.field_options.index_name : '序号'" :width="field.field_options.index_width ? field.field_options.index_width : 50" />
|
|
|
<template v-for="(column, j) in displayColumns">
|
|
<template v-for="(column, j) in displayColumns">
|
|
|
- <el-table-column show-overflow-tooltip v-if="!columnHidden(column) && column.field_type != 'desc' && column.label != ''" :key="j" :prop="column.name" :width="column.field_options.custom_class || null">
|
|
|
|
|
|
|
+ <el-table-column v-if="!columnHidden(column) && column.field_type != 'desc' && column.label != ''" :key="j" show-overflow-tooltip :prop="column.name" :width="column.field_options.custom_class || null">
|
|
|
<template slot="header">
|
|
<template slot="header">
|
|
|
{{ $utils.isNotEmpty(column.field_options.units) ? column.label + '(' + column.field_options.units + ')' : column.label }}
|
|
{{ $utils.isNotEmpty(column.field_options.units) ? column.label + '(' + column.field_options.units + ')' : column.label }}
|
|
|
<ibps-help v-if="column && column.desc && descPosition === 'lableIcon'" type="tooltip" :content="$utils.formatText(column.desc)" />
|
|
<ibps-help v-if="column && column.desc && descPosition === 'lableIcon'" type="tooltip" :content="$utils.formatText(column.desc)" />
|
|
|
</template>
|
|
</template>
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<template v-if="copDataModelCont && copDataModelCont.length > 0 && dynamicShow">
|
|
<template v-if="copDataModelCont && copDataModelCont.length > 0 && dynamicShow">
|
|
|
- <ibps-dynamic-form-table-item :ref="'formItem' + column.name" :key="scope.$index + j" :models.sync="copDataModelCont[scope.$index + (currentPage * 10 - 10)]" :rights.sync="columnsRights" :form-data="models" :field="column" :main-code="mainCode" :code="code" :row="scope.$index" :mode="mode" :params="params" :currPage="currentPage" @updateModel="updateModel" v-on="listeners" />
|
|
|
|
|
|
|
+ <ibps-dynamic-form-table-item :ref="'formItem' + column.name" :key="scope.$index + j" :models.sync="copDataModelCont[scope.$index + (currentPage * 10 - 10)]" :rights.sync="columnsRights" :form-data="models" :field="column" :main-code="mainCode" :code="code" :row="scope.$index" :mode="mode" :params="params" :curr-page="currentPage" @updateModel="updateModel" v-on="listeners" />
|
|
|
</template>
|
|
</template>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -41,7 +41,7 @@
|
|
|
</el-dropdown>
|
|
</el-dropdown>
|
|
|
<template v-else>
|
|
<template v-else>
|
|
|
<template v-for="(button, index) in manageButtons">
|
|
<template v-for="(button, index) in manageButtons">
|
|
|
- <el-link :icon="button.icon" :key="index" :type="button.type" :underline="false" @click="handleActionEvent(button, scope.$index)">{{ button.label }}</el-link>
|
|
|
|
|
|
|
+ <el-link :key="index" :icon="button.icon" :type="button.type" :underline="false" @click="handleActionEvent(button, scope.$index)">{{ button.label }}</el-link>
|
|
|
<!-- <el-button plain size="mini" :key="index" :type="button.type" @click="handleActionEvent(button, scope.$index)">
|
|
<!-- <el-button plain size="mini" :key="index" :type="button.type" @click="handleActionEvent(button, scope.$index)">
|
|
|
{{ button.label }}
|
|
{{ button.label }}
|
|
|
</el-button> -->
|
|
</el-button> -->
|
|
@@ -53,7 +53,7 @@
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
<!-- 分页 -->
|
|
<!-- 分页 -->
|
|
|
- <el-pagination v-if="mode === 'dialog' || mode === 'inner'" @current-change="handleCurrentChange" :page-size="10" layout="total, prev, pager, next" :total="pageSize"> </el-pagination>
|
|
|
|
|
|
|
+ <el-pagination v-if="mode === 'dialog' || mode === 'inner'" :current-page="currentPage" :page-size="10" layout="total, prev, pager, next" :total="pageSize" @current-change="handleCurrentChange" />
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<!--================表内和弹窗模式end=================================-->
|
|
<!--================表内和弹窗模式end=================================-->
|
|
@@ -94,7 +94,7 @@
|
|
|
|
|
|
|
|
<import-table :visible="importTableDialogVisible" :title="field.label" @close="(visible) => (importTableDialogVisible = visible)" @action-event="handleImportTableActionEvent" />
|
|
<import-table :visible="importTableDialogVisible" :title="field.label" @close="(visible) => (importTableDialogVisible = visible)" @action-event="handleImportTableActionEvent" />
|
|
|
<component :is="dialogTemplate" v-if="dialogTemplate" ref="dialogTemplate" v-bind="dialogTemplateAtts" />
|
|
<component :is="dialogTemplate" v-if="dialogTemplate" ref="dialogTemplate" v-bind="dialogTemplateAtts" />
|
|
|
- <formrender-dialog ref="jyxtEdit" :visible="formDialogVisible" :title="field.label" :form-def="dialogFormDef" :data="dialogFormData" :mode="mode" :editFromType="editFromType" custom-class="ibps-dialog-80" @close="(visible) => (formDialogVisible = visible)" @action-event="handleFormDialogActionEvent" />
|
|
|
|
|
|
|
+ <formrender-dialog ref="jyxtEdit" :visible="formDialogVisible" :title="field.label" :form-def="dialogFormDef" :data="dialogFormData" :mode="mode" :edit-from-type="editFromType" custom-class="ibps-dialog-80" @close="(visible) => (formDialogVisible = visible)" @action-event="handleFormDialogActionEvent" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
@@ -149,9 +149,9 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
- let val = [],
|
|
|
|
|
- tableType = '',
|
|
|
|
|
- copVal = []
|
|
|
|
|
|
|
+ let val = []
|
|
|
|
|
+ let tableType = ''
|
|
|
|
|
+ let copVal = []
|
|
|
if (this.$utils.isNotEmpty(this.value)) {
|
|
if (this.$utils.isNotEmpty(this.value)) {
|
|
|
val = this.value || []
|
|
val = this.value || []
|
|
|
copVal = tableType === 'dialog' || 'inner' ? JSON.parse(JSON.stringify(val)).slice(0, 10) : val
|
|
copVal = tableType === 'dialog' || 'inner' ? JSON.parse(JSON.stringify(val)).slice(0, 10) : val
|
|
@@ -159,11 +159,11 @@ export default {
|
|
|
tableType = this.field.field_options.mode || 'inner'
|
|
tableType = this.field.field_options.mode || 'inner'
|
|
|
/* 由于内容遍历卡顿问题,需再建个中间对象进行渲染.*/
|
|
/* 由于内容遍历卡顿问题,需再建个中间对象进行渲染.*/
|
|
|
return {
|
|
return {
|
|
|
- editFromType: 'add', //列表编辑弹出框类型
|
|
|
|
|
|
|
+ editFromType: 'add', // 列表编辑弹出框类型
|
|
|
npmDialogFormVisible: false, // 弹窗
|
|
npmDialogFormVisible: false, // 弹窗
|
|
|
defId: '', // 编辑dialog需要使用
|
|
defId: '', // 编辑dialog需要使用
|
|
|
currentPage: 1,
|
|
currentPage: 1,
|
|
|
- dataPage: 0, //当前条数
|
|
|
|
|
|
|
+ dataPage: 0, // 当前条数
|
|
|
pageSize: val.length,
|
|
pageSize: val.length,
|
|
|
dataModel: val,
|
|
dataModel: val,
|
|
|
copDataModel: copVal,
|
|
copDataModel: copVal,
|
|
@@ -191,7 +191,9 @@ export default {
|
|
|
|
|
|
|
|
importTableDialogVisible: false,
|
|
importTableDialogVisible: false,
|
|
|
dialogTemplate: null,
|
|
dialogTemplate: null,
|
|
|
- dialogTemplateAtts: {}
|
|
|
|
|
|
|
+ dialogTemplateAtts: {},
|
|
|
|
|
+
|
|
|
|
|
+ oldList: []
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -305,11 +307,6 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- beforeDestroy() {
|
|
|
|
|
- this.dynamicShow = false
|
|
|
|
|
- // 注销当前表格保存在window[this.mainCode+'TableRefs']的this
|
|
|
|
|
- this.destoryTable()
|
|
|
|
|
- },
|
|
|
|
|
watch: {
|
|
watch: {
|
|
|
value: {
|
|
value: {
|
|
|
handler(val, oldVal) {
|
|
handler(val, oldVal) {
|
|
@@ -322,9 +319,11 @@ export default {
|
|
|
},
|
|
},
|
|
|
dataModel: {
|
|
dataModel: {
|
|
|
handler(val, oldVal) {
|
|
handler(val, oldVal) {
|
|
|
- //进行分页操作
|
|
|
|
|
|
|
+ // 进行分页操作
|
|
|
|
|
+ console.log(val, oldVal)
|
|
|
this.pageOperation(val, oldVal)
|
|
this.pageOperation(val, oldVal)
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ deep: true
|
|
|
},
|
|
},
|
|
|
rights: {
|
|
rights: {
|
|
|
handler(val, oldVal) {
|
|
handler(val, oldVal) {
|
|
@@ -352,6 +351,11 @@ export default {
|
|
|
immediate: true
|
|
immediate: true
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ beforeDestroy() {
|
|
|
|
|
+ this.dynamicShow = false
|
|
|
|
|
+ // 注销当前表格保存在window[this.mainCode+'TableRefs']的this
|
|
|
|
|
+ this.destoryTable()
|
|
|
|
|
+ },
|
|
|
mounted() {
|
|
mounted() {
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
if (this.$refs.elTable) {
|
|
if (this.$refs.elTable) {
|
|
@@ -368,25 +372,26 @@ export default {
|
|
|
/* 分页操作及数据操作内容*/
|
|
/* 分页操作及数据操作内容*/
|
|
|
pageOperation(val, oldVal) {
|
|
pageOperation(val, oldVal) {
|
|
|
let page = this.currentPage * 10 - 10
|
|
let page = this.currentPage * 10 - 10
|
|
|
- let size = val.length
|
|
|
|
|
- if (size >= 10 && this.pageSize % 10 == 1) {
|
|
|
|
|
|
|
+ const size = val.length
|
|
|
|
|
+ if ((this.dataModel < this.oldList) && size >= 10 && this.pageSize % 10 == 0) {
|
|
|
//删除了一个参数 ,如果当前总条数小于页数,则退一页。
|
|
//删除了一个参数 ,如果当前总条数小于页数,则退一页。
|
|
|
if (this.currentPage > 1) this.currentPage = this.currentPage - 1
|
|
if (this.currentPage > 1) this.currentPage = this.currentPage - 1
|
|
|
page = this.currentPage * 10 - 10
|
|
page = this.currentPage * 10 - 10
|
|
|
if (page != 0) page - 10
|
|
if (page != 0) page - 10
|
|
|
}
|
|
}
|
|
|
this.pageSize = size
|
|
this.pageSize = size
|
|
|
- //具体操作
|
|
|
|
|
|
|
+ this.oldList = JSON.parse(JSON.stringify(this.dataModel))
|
|
|
|
|
+ // 具体操作
|
|
|
if (this.mode === 'dialog' || this.mode === 'inner') {
|
|
if (this.mode === 'dialog' || this.mode === 'inner') {
|
|
|
this.copDataModel = JSON.parse(JSON.stringify(val)).slice(page, page + 10)
|
|
this.copDataModel = JSON.parse(JSON.stringify(val)).slice(page, page + 10)
|
|
|
}
|
|
}
|
|
|
this.$emit('update:value', val)
|
|
this.$emit('update:value', val)
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- //简单的分页 usnin
|
|
|
|
|
|
|
+ // 简单的分页 usnin
|
|
|
handleCurrentChange(val) {
|
|
handleCurrentChange(val) {
|
|
|
this.dataPage = val * 10 - 10
|
|
this.dataPage = val * 10 - 10
|
|
|
- //深度克隆主要数据
|
|
|
|
|
|
|
+ // 深度克隆主要数据
|
|
|
this.copDataModel = JSON.parse(JSON.stringify(this.dataModel)).slice(this.dataPage, this.dataPage + 10)
|
|
this.copDataModel = JSON.parse(JSON.stringify(this.dataModel)).slice(this.dataPage, this.dataPage + 10)
|
|
|
this.currentPage = val
|
|
this.currentPage = val
|
|
|
},
|
|
},
|
|
@@ -477,7 +482,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
handleActionEvent(button, buttonIndex) {
|
|
handleActionEvent(button, buttonIndex) {
|
|
|
// 起始下标
|
|
// 起始下标
|
|
|
- let index = this.currentPage * 10 - 10 + buttonIndex
|
|
|
|
|
|
|
+ const index = this.currentPage * 10 - 10 + buttonIndex
|
|
|
this.actionCode = button.key === 'custom' ? button.code || button.key + index : button.key
|
|
this.actionCode = button.key === 'custom' ? button.code || button.key + index : button.key
|
|
|
this.actionPosition = button.position || 'toolbar'
|
|
this.actionPosition = button.position || 'toolbar'
|
|
|
// 前置事件
|
|
// 前置事件
|
|
@@ -560,7 +565,7 @@ export default {
|
|
|
const selection = []
|
|
const selection = []
|
|
|
if (position === 'toolbar' && this.mode !== 'block') {
|
|
if (position === 'toolbar' && this.mode !== 'block') {
|
|
|
if (this.multipleSelection && this.multipleSelection.length > 0) {
|
|
if (this.multipleSelection && this.multipleSelection.length > 0) {
|
|
|
- let startIndex = this.currentPage * 10 - 10
|
|
|
|
|
|
|
+ const startIndex = this.currentPage * 10 - 10
|
|
|
this.multipleSelection.forEach((row) => {
|
|
this.multipleSelection.forEach((row) => {
|
|
|
selection.push(row.$index + startIndex)
|
|
selection.push(row.$index + startIndex)
|
|
|
})
|
|
})
|
|
@@ -580,6 +585,7 @@ export default {
|
|
|
this.dataModel.splice(i, 1)
|
|
this.dataModel.splice(i, 1)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ this.pageSize = this.dataModel.length
|
|
|
// 后置事件
|
|
// 后置事件
|
|
|
this.afterScript(this.actionCode, position, {
|
|
this.afterScript(this.actionCode, position, {
|
|
|
selection: selection,
|
|
selection: selection,
|
|
@@ -621,7 +627,7 @@ export default {
|
|
|
ActionUtils.success('导入成功')
|
|
ActionUtils.success('导入成功')
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- //数据导出
|
|
|
|
|
|
|
+ // 数据导出
|
|
|
getIbpsExport(columns, data, title, message, nameKey = 'name') {
|
|
getIbpsExport(columns, data, title, message, nameKey = 'name') {
|
|
|
IbpsExport.excel({
|
|
IbpsExport.excel({
|
|
|
columns: columns,
|
|
columns: columns,
|
|
@@ -629,7 +635,7 @@ export default {
|
|
|
nameKey: nameKey,
|
|
nameKey: nameKey,
|
|
|
title: title
|
|
title: title
|
|
|
}).then(() => {
|
|
}).then(() => {
|
|
|
- const msg = message ? message : '导出成功'
|
|
|
|
|
|
|
+ const msg = message || '导出成功'
|
|
|
ActionUtils.success(msg)
|
|
ActionUtils.success(msg)
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
@@ -820,12 +826,12 @@ export default {
|
|
|
*/
|
|
*/
|
|
|
judgeData(index) {
|
|
judgeData(index) {
|
|
|
if (index >= 0 && this.handleCout) {
|
|
if (index >= 0 && this.handleCout) {
|
|
|
- //第一次进入时,不做更新判断。
|
|
|
|
|
|
|
+ // 第一次进入时,不做更新判断。
|
|
|
this.$refs.jyxtEdit.loadFormData()
|
|
this.$refs.jyxtEdit.loadFormData()
|
|
|
} else if (index == undefined && this.handleCout == '编辑') {
|
|
} else if (index == undefined && this.handleCout == '编辑') {
|
|
|
this.$refs.jyxtEdit.loadFormData()
|
|
this.$refs.jyxtEdit.loadFormData()
|
|
|
}
|
|
}
|
|
|
- this.handleCout = index >= 0 ? '编辑' : '新增' //记录
|
|
|
|
|
|
|
+ this.handleCout = index >= 0 ? '编辑' : '新增' // 记录
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
// =====================对话框模式数据处理= 原====================
|
|
// =====================对话框模式数据处理= 原====================
|
|
@@ -1064,5 +1070,4 @@ export default {
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
</style>
|
|
</style>
|