|
|
@@ -3,31 +3,19 @@
|
|
|
<template v-if="columns && columns.length > 0">
|
|
|
<!--================表内和弹窗模式=================================-->
|
|
|
<div v-if="mode === 'inner' || mode === 'dialog'" class="dynamic-form-table__inner panel panel-info">
|
|
|
- <div class="panel-heading ibps-clearfix" >
|
|
|
- <div v-if="!formDialogVisible" class="ibps-fl dynamic-form-table__label table-tetle-style">{{ field.label }}</div>
|
|
|
+ <div class="panel-heading ibps-clearfix">
|
|
|
+ <div v-if="!formDialogVisible" class="ibps-fl dynamic-form-table__label table-tetle-style">{{ field.label }}
|
|
|
+ </div>
|
|
|
<!--弹窗模式对话框-->
|
|
|
- <formrender-dialog
|
|
|
- ref="jyxtEdit"
|
|
|
- v-if="formDialogVisible"
|
|
|
- :title="field.label"
|
|
|
- :form-def="dialogFormDef"
|
|
|
- :data="dialogFormData"
|
|
|
- :mode="mode"
|
|
|
- :editFromType="editFromType"
|
|
|
- @close="deleteEdit()"
|
|
|
- @action-event="handleFormDialogActionEvent"
|
|
|
- />
|
|
|
- <div v-if=" toolbarButtons && toolbarButtons.length >0" class="ibps-fr hidden-print">
|
|
|
- <!-- :visible="formDialogVisible"-->
|
|
|
+ <formrender-dialog ref="jyxtEdit" v-if="formDialogVisible" :title="field.label" :form-def="dialogFormDef"
|
|
|
+ :data="dialogFormData" :mode="mode" :editFromType="editFromType" @close="deleteEdit()"
|
|
|
+ @action-event="handleFormDialogActionEvent" />
|
|
|
+ <div v-if="toolbarButtons && toolbarButtons.length > 0" class="ibps-fr hidden-print">
|
|
|
+ <!-- :visible="formDialogVisible"-->
|
|
|
|
|
|
<el-button-group>
|
|
|
- <el-button
|
|
|
- v-for="(button,index) in toolbarButtons"
|
|
|
- :key="index"
|
|
|
- :type="button.type"
|
|
|
- :icon="button.icon"
|
|
|
- @click="handleActionEvent(button,index)"
|
|
|
- >
|
|
|
+ <el-button v-for="(button, index) in toolbarButtons" :key="index" :type="button.type" :icon="button.icon"
|
|
|
+ @click="handleActionEvent(button, index)">
|
|
|
{{ button.label }}
|
|
|
</el-button>
|
|
|
</el-button-group>
|
|
|
@@ -35,138 +23,90 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<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-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"
|
|
|
- />
|
|
|
- <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"
|
|
|
- >
|
|
|
- <!-- :width="column.field_options.is_label_width ?column.field_options.label_width + (column.field_options.label_width_unit || 'px') :null"-->
|
|
|
+ <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-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" />
|
|
|
+ <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">
|
|
|
+ <!-- :width="column.field_options.is_label_width ?column.field_options.label_width + (column.field_options.label_width_unit || 'px') :null"-->
|
|
|
<template slot="header">
|
|
|
- {{ $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)" />
|
|
|
+ {{ $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)" />
|
|
|
</template>
|
|
|
<template slot-scope="scope">
|
|
|
- <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"
|
|
|
- />
|
|
|
+ <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" />
|
|
|
</template>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</template>
|
|
|
- <el-table-column
|
|
|
- v-if="manageButtons && manageButtons.length >0"
|
|
|
- align="center"
|
|
|
- fixed="right"
|
|
|
- class-name="hidden-print"
|
|
|
- label="操作栏目"
|
|
|
- width="160"
|
|
|
- >
|
|
|
+ <el-table-column v-if="manageButtons && manageButtons.length > 0" align="center" fixed="right"
|
|
|
+ class-name="hidden-print" label="操作栏目" width="160">
|
|
|
|
|
|
<template slot-scope="scope">
|
|
|
- <el-dropdown v-if="manageButtons.length>3">
|
|
|
- <ibps-icon name="chevron-circle-down" size="28" class="hidden-print"/>
|
|
|
+ <el-dropdown v-if="manageButtons.length > 3">
|
|
|
+ <ibps-icon name="chevron-circle-down" size="28" class="hidden-print" />
|
|
|
<el-dropdown-menu slot="dropdown" class="ibps-table-dropdown-menu" style="margin-top: 0.02rem">
|
|
|
- <ibps-toolbar
|
|
|
- :actions="manageButtons"
|
|
|
- :socpe="thatSocpe"
|
|
|
- :data="scope.row"
|
|
|
- position="manage"
|
|
|
- class="hidden-print"
|
|
|
- @action-event="(action)=>handleActionEvent(action, scope.$index)"
|
|
|
- />
|
|
|
+ <ibps-toolbar :actions="manageButtons" :socpe="thatSocpe" :data="scope.row" position="manage"
|
|
|
+ class="hidden-print" @action-event="(action) => handleActionEvent(action, scope.$index)" />
|
|
|
</el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
|
<template v-else>
|
|
|
- <template v-for="(button,index) in manageButtons">
|
|
|
- <el-button
|
|
|
- plain
|
|
|
- size="mini"
|
|
|
- :key="index"
|
|
|
- :type="button.type"
|
|
|
- @click="handleActionEvent(button,scope.$index)"
|
|
|
- >
|
|
|
+ <template v-for="(button, index) in manageButtons">
|
|
|
+ <el-button plain size="mini" :key="index" :type="button.type"
|
|
|
+ @click="handleActionEvent(button, scope.$index)">
|
|
|
{{ button.label }}
|
|
|
</el-button>
|
|
|
- <el-divider v-if="manageButtons.length===3 && index===0 || index===1" :key="index" direction="vertical" />
|
|
|
+ <el-divider v-if="manageButtons.length === 3 && index === 0 || index === 1" :key="index"
|
|
|
+ direction="vertical" />
|
|
|
|
|
|
</template>
|
|
|
</template>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</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-change="handleCurrentChange"
|
|
|
+ :page-size="10" layout="total, prev, pager, next" :total="pageSize">
|
|
|
+ </el-pagination>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!--================表内和弹窗模式end=================================-->
|
|
|
<!--================块模式=================================-->
|
|
|
<template v-else-if="mode === 'block'">
|
|
|
- <template v-if="dataModel && dataModel.length >0">
|
|
|
- <template v-for="(data,index) in dataModel ">
|
|
|
+ <template v-if="dataModel && dataModel.length > 0">
|
|
|
+ <template v-for="(data, index) in dataModel ">
|
|
|
|
|
|
<div :key="index" class="dynamic-form-table__block panel panel-info">
|
|
|
|
|
|
<div class="panel-heading ibps-clearfix">
|
|
|
<!--块模式:工具栏-->
|
|
|
<div class="ibps-fl dynamic-form-table__label">
|
|
|
- <el-badge v-if="field.field_options.index" :value="index+1 " type="primary" style="top: 0.3em;" />{{ field.label }}
|
|
|
+ <el-badge v-if="field.field_options.index" :value="index + 1" type="primary" style="top: 0.3em;" />{{
|
|
|
+ field.label
|
|
|
+ }}
|
|
|
</div>
|
|
|
- <div v-if="toolbarButtons && toolbarButtons.length >0" class="ibps-fr">
|
|
|
+ <div v-if="toolbarButtons && toolbarButtons.length > 0" class="ibps-fr">
|
|
|
|
|
|
<el-button-group>
|
|
|
- <template v-for="(button,b) in toolbarButtons ">
|
|
|
- <template v-if="!(button.key === 'remove' && dataModel.length===1) ">
|
|
|
- <el-button
|
|
|
- :key="b"
|
|
|
- :type="button.type"
|
|
|
- :icon="button.icon"
|
|
|
- @click="handleActionEvent(button,b)"
|
|
|
- >
|
|
|
+ <template v-for="(button, b) in toolbarButtons ">
|
|
|
+ <template v-if="!(button.key === 'remove' && dataModel.length === 1)">
|
|
|
+ <el-button :key="b" :type="button.type" :icon="button.icon"
|
|
|
+ @click="handleActionEvent(button, b)">
|
|
|
{{ button.label }}
|
|
|
</el-button>
|
|
|
</template>
|
|
|
@@ -177,20 +117,9 @@
|
|
|
|
|
|
<!--块模式:表单-->
|
|
|
<div class="panel-body">
|
|
|
- <ibps-dynamic-form-table-block
|
|
|
- v-for="(column,j) in columns"
|
|
|
- :ref="'formItem'+column.name"
|
|
|
- :key="index+j"
|
|
|
- :models.sync="dataModel[index]"
|
|
|
- :rights.sync="columnsRights"
|
|
|
- :form-data="models"
|
|
|
- :field="column"
|
|
|
- :main-code="mainCode"
|
|
|
- :code="code"
|
|
|
- :row="index"
|
|
|
- :params="params"
|
|
|
- v-on="listeners"
|
|
|
- />
|
|
|
+ <ibps-dynamic-form-table-block v-for="(column, j) in columns" :ref="'formItem' + column.name"
|
|
|
+ :key="index + j" :models.sync="dataModel[index]" :rights.sync="columnsRights" :form-data="models"
|
|
|
+ :field="column" :main-code="mainCode" :code="code" :row="index" :params="params" v-on="listeners" />
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -199,34 +128,15 @@
|
|
|
</template>
|
|
|
</template>
|
|
|
|
|
|
- <el-table
|
|
|
- v-else
|
|
|
- :data="[]"
|
|
|
- empty-text="您尚未创建任何字段。请在表单中添加字段。"
|
|
|
- border
|
|
|
- />
|
|
|
+ <el-table v-else :data="[]" empty-text="您尚未创建任何字段。请在表单中添加字段。" border />
|
|
|
<!--按钮支持自定义对话框-->
|
|
|
- <custom-dialog
|
|
|
- :visible="customDialogVisible"
|
|
|
- :value="[]"
|
|
|
- :template-key="customDialogKey"
|
|
|
- :dynamic-params="customDialogDynamicParams"
|
|
|
- @close="visible=>customDialogVisible =visible"
|
|
|
- @action-event="handleCustomDialogActionEvent"
|
|
|
- />
|
|
|
+ <custom-dialog :visible="customDialogVisible" :value="[]" :template-key="customDialogKey"
|
|
|
+ :dynamic-params="customDialogDynamicParams" @close="visible => customDialogVisible = visible"
|
|
|
+ @action-event="handleCustomDialogActionEvent" />
|
|
|
|
|
|
- <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"
|
|
|
- />
|
|
|
+ <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" />
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
@@ -280,39 +190,39 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
- let val = [] , tableType = '',copVal = []
|
|
|
+ let val = [], tableType = '', copVal = []
|
|
|
if (this.$utils.isNotEmpty(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
|
|
|
}
|
|
|
- tableType = this.field.field_options.mode || 'inner'
|
|
|
+ tableType = this.field.field_options.mode || 'inner'
|
|
|
/* 由于内容遍历卡顿问题,需再建个中间对象进行渲染.*/
|
|
|
return {
|
|
|
editFromType: 'add', //列表编辑弹出框类型
|
|
|
npmDialogFormVisible: false, // 弹窗
|
|
|
defId: '', // 编辑dialog需要使用
|
|
|
- currentPage:1,
|
|
|
- dataPage:0,//当前条数
|
|
|
- pageSize:val.length,
|
|
|
+ currentPage: 1,
|
|
|
+ dataPage: 0,//当前条数
|
|
|
+ pageSize: val.length,
|
|
|
dataModel: val,
|
|
|
- copDataModel:copVal,
|
|
|
+ copDataModel: copVal,
|
|
|
multipleSelection: '',
|
|
|
- countNumber:0,
|
|
|
+ countNumber: 0,
|
|
|
fieldRights: {}, // 子表配置权限
|
|
|
tableRights: FormOptions.t.PERMISSIONS.EDIT, // 子表权限
|
|
|
columnsRights: {}, // 子表字段权限
|
|
|
buttonsRights: {}, // 子表按钮权限
|
|
|
actionCode: '',
|
|
|
actionPosition: 'toolbar',
|
|
|
- handleCout:'',
|
|
|
- dynamicShow:true,
|
|
|
+ handleCout: '',
|
|
|
+ dynamicShow: true,
|
|
|
|
|
|
customDialogVisible: false,
|
|
|
customDialogKey: '',
|
|
|
customDialogDynamicParams: {},
|
|
|
customDialogCustom: {},
|
|
|
|
|
|
- formEditVisible:false,
|
|
|
+ formEditVisible: false,
|
|
|
formDialogVisible: false,
|
|
|
dialogFormDef: {},
|
|
|
dialogFormData: {},
|
|
|
@@ -422,8 +332,8 @@ export default {
|
|
|
linkages() {
|
|
|
return this.params.responseLinkages
|
|
|
},
|
|
|
- copDataModelCont(){/* 进行参数替换,提高子表性能 */
|
|
|
- return JSON.parse(JSON.stringify(this.dataModel))
|
|
|
+ copDataModelCont() {/* 进行参数替换,提高子表性能 */
|
|
|
+ return JSON.parse(JSON.stringify(this.dataModel))
|
|
|
},
|
|
|
listeners() {
|
|
|
return {
|
|
|
@@ -447,24 +357,24 @@ export default {
|
|
|
this.dialogTemplate = null
|
|
|
this.dialogTemplateAtts = null
|
|
|
this.handleCout = null */
|
|
|
- this.dynamicShow = false
|
|
|
+ this.dynamicShow = false
|
|
|
// 注销当前表格保存在window[this.mainCode+'TableRefs']的this
|
|
|
this.destoryTable()
|
|
|
},
|
|
|
watch: {
|
|
|
- value: {
|
|
|
+ value: {
|
|
|
handler(val, oldVal) {
|
|
|
- if(!val) return
|
|
|
+ if (!val) return
|
|
|
this.dataModel = val
|
|
|
- /* if (!valueEquals(val, oldVal)) {
|
|
|
- this.dispatch('ElFormItem', 'el.form.change', val)
|
|
|
- } */
|
|
|
+ /* if (!valueEquals(val, oldVal)) {
|
|
|
+ this.dispatch('ElFormItem', 'el.form.change', val)
|
|
|
+ } */
|
|
|
}
|
|
|
},
|
|
|
- dataModel: {
|
|
|
+ dataModel: {
|
|
|
handler(val, oldVal) {
|
|
|
//进行分页操作
|
|
|
- this.pageOperation(val,oldVal)
|
|
|
+ this.pageOperation(val, oldVal)
|
|
|
}
|
|
|
},
|
|
|
rights: {
|
|
|
@@ -502,32 +412,32 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
/* 更新后的参数*/ // 定义删除、增加 不做操作。修改时才做更新 ,分页修改时,根据页表修改。
|
|
|
- updateModel(key,val,index,page){
|
|
|
- this.dataModel[page * 10 - 10+ index][key] =val
|
|
|
- this.$emit('change-data', key, val)
|
|
|
- },
|
|
|
+ updateModel(key, val, index, page) {
|
|
|
+ this.dataModel[page * 10 - 10 + index][key] = val
|
|
|
+ this.$emit('change-data', key, val)
|
|
|
+ },
|
|
|
/* 分页操作及数据操作内容*/
|
|
|
- pageOperation(val,oldVal){
|
|
|
+ pageOperation(val, oldVal) {
|
|
|
let page = this.currentPage * 10 - 10
|
|
|
let size = val.length
|
|
|
- if(size>=10 && (this.pageSize%10)==1 ){ //删除了一个参数 ,如果当前总条数小于页数,则退一页。
|
|
|
- if(this.currentPage >1) this.currentPage = this.currentPage -1
|
|
|
+ if (size >= 10 && (this.pageSize % 10) == 1) { //删除了一个参数 ,如果当前总条数小于页数,则退一页。
|
|
|
+ if (this.currentPage > 1) this.currentPage = this.currentPage - 1
|
|
|
page = this.currentPage * 10 - 10
|
|
|
- if( page != 0) page -10
|
|
|
+ if (page != 0) page - 10
|
|
|
+ }
|
|
|
+ this.pageSize = size
|
|
|
+ //具体操作
|
|
|
+ if (this.mode === 'dialog' || this.mode === 'inner') {
|
|
|
+ this.copDataModel = JSON.parse(JSON.stringify(val)).slice(page, page + 10)
|
|
|
}
|
|
|
- this.pageSize = size
|
|
|
- //具体操作
|
|
|
- if(this.mode === 'dialog' ||this.mode === 'inner'){
|
|
|
- this.copDataModel =JSON.parse(JSON.stringify(val)).slice(page,page+10)
|
|
|
- }
|
|
|
this.$emit('update:value', val)
|
|
|
},
|
|
|
|
|
|
- //简单的分页 usnin
|
|
|
+ //简单的分页 usnin
|
|
|
handleCurrentChange(val) {
|
|
|
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
|
|
|
},
|
|
|
|
|
|
@@ -586,8 +496,8 @@ export default {
|
|
|
const bs = []
|
|
|
this.buttons.forEach(button => {
|
|
|
if (hasPermission(button.key, position) && // 有位置权限
|
|
|
- (!button.position || button.position === 'all' || button.position === position) &&// 有位置权限
|
|
|
- (this.$utils.isEmpty(this.buttonsRights[button.key]) || this.buttonsRights[button.key] !== FormOptions.t.PERMISSIONS.HIDE) // 有按钮权限
|
|
|
+ (!button.position || button.position === 'all' || button.position === position) &&// 有位置权限
|
|
|
+ (this.$utils.isEmpty(this.buttonsRights[button.key]) || this.buttonsRights[button.key] !== FormOptions.t.PERMISSIONS.HIDE) // 有按钮权限
|
|
|
) {
|
|
|
const b = JSON.parse(JSON.stringify(button))
|
|
|
b.position = position
|
|
|
@@ -600,9 +510,9 @@ export default {
|
|
|
const bs = []
|
|
|
this.buttons.forEach(button => {
|
|
|
if (hasPermission(button.key, position) && // 有位置权限
|
|
|
- (!button.position || button.position === 'all' || button.position === position) &&// 有位置权限
|
|
|
- (this.$utils.isEmpty(this.buttonsRights[button.key]) || this.buttonsRights[button.key] !== FormOptions.t.PERMISSIONS.HIDE) && // 有按钮权限
|
|
|
- this.$utils.toBoolean(button.enabledDetail)
|
|
|
+ (!button.position || button.position === 'all' || button.position === position) &&// 有位置权限
|
|
|
+ (this.$utils.isEmpty(this.buttonsRights[button.key]) || this.buttonsRights[button.key] !== FormOptions.t.PERMISSIONS.HIDE) && // 有按钮权限
|
|
|
+ this.$utils.toBoolean(button.enabledDetail)
|
|
|
) {
|
|
|
const b = JSON.parse(JSON.stringify(button))
|
|
|
b.position = position
|
|
|
@@ -612,7 +522,7 @@ export default {
|
|
|
return bs
|
|
|
},
|
|
|
handleActionEvent(button, buttonIndex) {
|
|
|
- // 起始下标
|
|
|
+ // 起始下标
|
|
|
let index = this.currentPage * 10 - 10 + buttonIndex
|
|
|
this.actionCode = button.key === 'custom' ? (button.code || button.key + index) : button.key
|
|
|
this.actionPosition = button.position || 'toolbar'
|
|
|
@@ -658,7 +568,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- destoryTable() {
|
|
|
+ destoryTable() {
|
|
|
if (this.$utils.isNotEmpty(window[this.mainCode + 'TableRefs']) && this.$utils.isNotEmpty(window[this.mainCode + 'TableRefs'][this.code])) {
|
|
|
window[this.mainCode + 'TableRefs'][this.code] = null
|
|
|
delete window[this.mainCode + 'TableRefs'][this.code]
|
|
|
@@ -681,12 +591,12 @@ export default {
|
|
|
addData(data) {
|
|
|
this.dataModel.unshift(data)
|
|
|
// 初始化运行公式计算 unshift
|
|
|
- this.initRunCalFormula(this.dataModel.length - 1)
|
|
|
+ this.initRunCalFormula(this.dataModel.length - 1)
|
|
|
// 后置事件
|
|
|
this.afterScript(this.actionCode, this.actionPosition)
|
|
|
- /* if (this.$refs.elTable) {
|
|
|
- this.$refs.elTable.doLayout()
|
|
|
- } */
|
|
|
+ /* if (this.$refs.elTable) {
|
|
|
+ this.$refs.elTable.doLayout()
|
|
|
+ } */
|
|
|
},
|
|
|
/**
|
|
|
* 获取选择的记录
|
|
|
@@ -695,7 +605,7 @@ export default {
|
|
|
const selection = []
|
|
|
if (position === 'toolbar' && this.mode !== 'block') {
|
|
|
if (this.multipleSelection && this.multipleSelection.length > 0) {
|
|
|
- let startIndex = this.currentPage * 10 - 10
|
|
|
+ let startIndex = this.currentPage * 10 - 10
|
|
|
this.multipleSelection.forEach(row => {
|
|
|
selection.push(row.$index + startIndex)
|
|
|
})
|
|
|
@@ -719,7 +629,7 @@ export default {
|
|
|
selection: selection,
|
|
|
index: index
|
|
|
})
|
|
|
- }).catch(() => {})
|
|
|
+ }).catch(() => { })
|
|
|
},
|
|
|
// 初始化运行公式计算
|
|
|
initRunCalFormula(row) {
|
|
|
@@ -758,12 +668,12 @@ export default {
|
|
|
handleExport(button, index) {
|
|
|
const position = button.position
|
|
|
const selection = this.getSelection(position, index)
|
|
|
- if(selection.length>1){
|
|
|
+ if (selection.length > 1) {
|
|
|
ActionUtils.selectedMultiRecord(selection).then((ids) => {
|
|
|
this.exportData(ids)
|
|
|
- }).catch(() => {})
|
|
|
- }else{
|
|
|
- this.exportData()
|
|
|
+ }).catch(() => { })
|
|
|
+ } else {
|
|
|
+ this.exportData()
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
@@ -772,6 +682,8 @@ export default {
|
|
|
exportData(ids) {
|
|
|
const columnMap = {}
|
|
|
const columns = []
|
|
|
+ console.log("11111")
|
|
|
+
|
|
|
this.nameColumns.forEach(column => {
|
|
|
if (!this.columnHidden(column)) {
|
|
|
columns.push(column)
|
|
|
@@ -780,9 +692,10 @@ export default {
|
|
|
})
|
|
|
const exportData = JSON.parse(JSON.stringify(this.dataModel))
|
|
|
|
|
|
- const data =ids? exportData.filter((d, i) => {
|
|
|
+ const data = ids ? exportData.filter((d, i) => {
|
|
|
return ids.includes(i)
|
|
|
- }) : ''
|
|
|
+ }) : exportData
|
|
|
+
|
|
|
// TODO: 需要格式化展示的数据
|
|
|
this.convertExportData(data, columnMap).then((data) => {
|
|
|
IbpsExport.excel({
|
|
|
@@ -799,7 +712,7 @@ export default {
|
|
|
async convertExportData(data, columnMap) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
const result = []
|
|
|
- data? data.forEach(d => {
|
|
|
+ data ? data.forEach(d => {
|
|
|
const o = d
|
|
|
for (const name in d) {
|
|
|
const column = columnMap[name]
|
|
|
@@ -891,7 +804,7 @@ export default {
|
|
|
})
|
|
|
return res.join(',')
|
|
|
},
|
|
|
- deleteEdit(){
|
|
|
+ deleteEdit() {
|
|
|
this.formDialogVisible = false
|
|
|
this.handleCout = null
|
|
|
},
|
|
|
@@ -936,8 +849,8 @@ export default {
|
|
|
fields: this.columns
|
|
|
}
|
|
|
// 表单
|
|
|
- this.formDialogVisible = true
|
|
|
- this.judgeData(index)
|
|
|
+ this.formDialogVisible = true
|
|
|
+ this.judgeData(index)
|
|
|
},
|
|
|
/* 第一次进入时,不做更新判断。
|
|
|
并记录当前进入时的操作, index>=0 则为修改。否则为新增。
|
|
|
@@ -945,69 +858,69 @@ export default {
|
|
|
如果上次为修改,则刷新重置添加。
|
|
|
如果上次为新增,则不做变化。
|
|
|
*/
|
|
|
- judgeData(index){
|
|
|
- if(index>=0 && this.handleCout){//第一次进入时,不做更新判断。
|
|
|
+ judgeData(index) {
|
|
|
+ if (index >= 0 && this.handleCout) {//第一次进入时,不做更新判断。
|
|
|
this.$refs.jyxtEdit.loadFormData();
|
|
|
- }else if(index == undefined && this.handleCout =='编辑'){
|
|
|
+ } else if (index == undefined && this.handleCout == '编辑') {
|
|
|
this.$refs.jyxtEdit.loadFormData();
|
|
|
- }
|
|
|
- this.handleCout = index >=0 ? '编辑' : '新增' //记录
|
|
|
- },
|
|
|
+ }
|
|
|
+ this.handleCout = index >= 0 ? '编辑' : '新增' //记录
|
|
|
+ },
|
|
|
|
|
|
// =====================对话框模式数据处理= 原====================
|
|
|
|
|
|
handleEditMode(index) {
|
|
|
- const data = this.$utils.isNotEmpty(index) ? this.dataModel[index] : {}
|
|
|
- this.dialogFormData = {
|
|
|
- responses: JSON.parse(JSON.stringify(data)),
|
|
|
- // 表单字段权限
|
|
|
- permissions: {
|
|
|
- fields: this.columnsRights
|
|
|
+ const data = this.$utils.isNotEmpty(index) ? this.dataModel[index] : {}
|
|
|
+ this.dialogFormData = {
|
|
|
+ responses: JSON.parse(JSON.stringify(data)),
|
|
|
+ // 表单字段权限
|
|
|
+ permissions: {
|
|
|
+ fields: this.columnsRights
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- const attrs = {
|
|
|
- hide_name: true
|
|
|
- }
|
|
|
- if (this.params.formAttrs) {
|
|
|
- const formAttrs = this.params.formAttrs
|
|
|
- const allowAttrs = ['inline',
|
|
|
- 'labelPosition',
|
|
|
- 'labelWidth',
|
|
|
- 'labelWidthUnit',
|
|
|
- 'size',
|
|
|
- 'statusIcon',
|
|
|
- 'descPosition',
|
|
|
- 'read_style',
|
|
|
- 'colon',
|
|
|
- 'labelSuffix'
|
|
|
- ]
|
|
|
- for (const key in formAttrs) {
|
|
|
- if (allowAttrs.indexOf(key) > -1) {
|
|
|
- const val = formAttrs[key]
|
|
|
- attrs[key] = val
|
|
|
+ const attrs = {
|
|
|
+ hide_name: true
|
|
|
+ }
|
|
|
+ if (this.params.formAttrs) {
|
|
|
+ const formAttrs = this.params.formAttrs
|
|
|
+ const allowAttrs = ['inline',
|
|
|
+ 'labelPosition',
|
|
|
+ 'labelWidth',
|
|
|
+ 'labelWidthUnit',
|
|
|
+ 'size',
|
|
|
+ 'statusIcon',
|
|
|
+ 'descPosition',
|
|
|
+ 'read_style',
|
|
|
+ 'colon',
|
|
|
+ 'labelSuffix'
|
|
|
+ ]
|
|
|
+ for (const key in formAttrs) {
|
|
|
+ if (allowAttrs.indexOf(key) > -1) {
|
|
|
+ const val = formAttrs[key]
|
|
|
+ attrs[key] = val
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- this.dialogFormIndex = this.$utils.isNotEmpty(index) ? index : -1
|
|
|
- this.dialogFormDef = {
|
|
|
- code: this.field.name,
|
|
|
- attrs: attrs,
|
|
|
- fields: this.columns
|
|
|
- }
|
|
|
- // 表单
|
|
|
- this.formEditVisible = true
|
|
|
+ this.dialogFormIndex = this.$utils.isNotEmpty(index) ? index : -1
|
|
|
+ this.dialogFormDef = {
|
|
|
+ code: this.field.name,
|
|
|
+ attrs: attrs,
|
|
|
+ fields: this.columns
|
|
|
+ }
|
|
|
+ // 表单
|
|
|
+ this.formEditVisible = true
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 对话框模式表单返回值
|
|
|
*/
|
|
|
handleFormDialogActionEvent(key, data) {
|
|
|
- this.$message({
|
|
|
- showClose: true,
|
|
|
- message: '操作成功!',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '操作成功!',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
if (this.dialogFormIndex > -1) {
|
|
|
this.dataModel.splice(this.dialogFormIndex, 1, data)
|
|
|
// 后置事件
|
|
|
@@ -1071,7 +984,7 @@ export default {
|
|
|
index: index
|
|
|
}
|
|
|
if (!callback) {
|
|
|
- callback = () => {}
|
|
|
+ callback = () => { }
|
|
|
}
|
|
|
JForm._beforeSubButton(this, this.actionCode, button.position, params, callback)
|
|
|
},
|
|
|
@@ -1089,7 +1002,7 @@ export default {
|
|
|
}
|
|
|
params.button = this.getButtonByKey(action)
|
|
|
if (!callback) {
|
|
|
- callback = () => {}
|
|
|
+ callback = () => { }
|
|
|
}
|
|
|
JForm._afterSubButton(this, action, position, params, callback)
|
|
|
},
|
|
|
@@ -1128,68 +1041,76 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss">
|
|
|
-
|
|
|
-.dynamic-form-table{
|
|
|
- .panel-heading{
|
|
|
+.dynamic-form-table {
|
|
|
+ .panel-heading {
|
|
|
color: #000;
|
|
|
- border-bottom:0;
|
|
|
- padding:0px 0px 0px 15px;
|
|
|
+ border-bottom: 0;
|
|
|
+ padding: 0px 0px 0px 15px;
|
|
|
background: #F0FFFF;
|
|
|
}
|
|
|
- .dynamic-form-table__inner{
|
|
|
- .panel-body{
|
|
|
- padding: 0;
|
|
|
+
|
|
|
+ .dynamic-form-table__inner {
|
|
|
+ .panel-body {
|
|
|
+ padding: 0;
|
|
|
}
|
|
|
}
|
|
|
- .dynamic-form-table__block{
|
|
|
- padding-bottom:10px;
|
|
|
- .panel-body{
|
|
|
+
|
|
|
+ .dynamic-form-table__block {
|
|
|
+ padding-bottom: 10px;
|
|
|
+
|
|
|
+ .panel-body {
|
|
|
border: 0px;
|
|
|
}
|
|
|
}
|
|
|
- .el-rate{
|
|
|
+
|
|
|
+ .el-rate {
|
|
|
position: relative;
|
|
|
display: inline-block;
|
|
|
}
|
|
|
}
|
|
|
-.is-error{
|
|
|
- .dynamic-form-table{
|
|
|
+
|
|
|
+.is-error {
|
|
|
+ .dynamic-form-table {
|
|
|
border: 1px solid #F56C6C;
|
|
|
}
|
|
|
}
|
|
|
-.is-required:not(.is-no-asterisk){
|
|
|
- .dynamic-form-table__label:before {
|
|
|
- content: '*';
|
|
|
- color: #F56C6C;
|
|
|
- margin-right: 4px;
|
|
|
- }
|
|
|
+
|
|
|
+.is-required:not(.is-no-asterisk) {
|
|
|
+ .dynamic-form-table__label:before {
|
|
|
+ content: '*';
|
|
|
+ color: #F56C6C;
|
|
|
+ margin-right: 4px;
|
|
|
+ }
|
|
|
}
|
|
|
-.table-tetle-style{
|
|
|
+
|
|
|
+.table-tetle-style {
|
|
|
font-weight: bold;
|
|
|
font-size: 12px;
|
|
|
color: #999999;
|
|
|
}
|
|
|
- .dynamic-form-table .el-table th{
|
|
|
- background-color:#A7D6F8 !important;
|
|
|
- font-size: 12px;
|
|
|
- font-weight: bold;
|
|
|
- border: 0px;
|
|
|
- }
|
|
|
- .dynamic-form-table .el-table td{
|
|
|
- font-size:12px;
|
|
|
- padding: 0px 0 !important;
|
|
|
- }
|
|
|
|
|
|
- .dynamic-form-table .el-table .warning-row {
|
|
|
- background: #D3EBFC;
|
|
|
- color: #000000;
|
|
|
- }
|
|
|
+.dynamic-form-table .el-table th {
|
|
|
+ background-color: #A7D6F8 !important;
|
|
|
+ font-size: 12px;
|
|
|
+ font-weight: bold;
|
|
|
+ border: 0px;
|
|
|
+}
|
|
|
|
|
|
- .dynamic-form-table .el-table .success-row {
|
|
|
- background: #F9FFFF;
|
|
|
- color: #000000;
|
|
|
- }
|
|
|
- </style>
|
|
|
+.dynamic-form-table .el-table td {
|
|
|
+ font-size: 12px;
|
|
|
+ padding: 0px 0 !important;
|
|
|
+}
|
|
|
+
|
|
|
+.dynamic-form-table .el-table .warning-row {
|
|
|
+ background: #D3EBFC;
|
|
|
+ color: #000000;
|
|
|
+}
|
|
|
+
|
|
|
+.dynamic-form-table .el-table .success-row {
|
|
|
+ background: #F9FFFF;
|
|
|
+ color: #000000;
|
|
|
+}
|
|
|
+</style>
|
|
|
|
|
|
|
|
|
</style>
|