|
@@ -2,22 +2,11 @@
|
|
|
<div v-if="!tableHidden && dynamicShow" class="dynamic-form-table">
|
|
<div v-if="!tableHidden && dynamicShow" class="dynamic-form-table">
|
|
|
<template v-if="columns && columns.length > 0">
|
|
<template v-if="columns && columns.length > 0">
|
|
|
<!--================表内和弹窗模式=================================-->
|
|
<!--================表内和弹窗模式=================================-->
|
|
|
- <div
|
|
|
|
|
- v-if="mode === 'inner' || mode === 'dialog'"
|
|
|
|
|
- class="dynamic-form-table__inner panel panel-info"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <div v-if="mode === 'inner' || mode === 'dialog'" class="dynamic-form-table__inner panel panel-info">
|
|
|
<div class="panel-heading ibps-clearfix">
|
|
<div class="panel-heading ibps-clearfix">
|
|
|
- <div
|
|
|
|
|
- v-if="!formDialogVisible"
|
|
|
|
|
- class="ibps-fl dynamic-form-table__label table-tetle-style"
|
|
|
|
|
- >
|
|
|
|
|
- {{ field.label }}
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div v-if="!formDialogVisible" class="ibps-fl dynamic-form-table__label table-tetle-style">{{ field.label }}</div>
|
|
|
<!--弹窗模式对话框-->
|
|
<!--弹窗模式对话框-->
|
|
|
- <div
|
|
|
|
|
- v-if="toolbarButtons && toolbarButtons.length > 0"
|
|
|
|
|
- class="ibps-fr hidden-print"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <div v-if="toolbarButtons && toolbarButtons.length > 0" class="ibps-fr hidden-print">
|
|
|
<el-button-group>
|
|
<el-button-group>
|
|
|
<el-button
|
|
<el-button
|
|
|
v-for="(button, index) in toolbarButtons"
|
|
v-for="(button, index) in toolbarButtons"
|
|
@@ -35,95 +24,40 @@
|
|
|
<el-table
|
|
<el-table
|
|
|
ref="elTable"
|
|
ref="elTable"
|
|
|
:data="copDataModel"
|
|
:data="copDataModel"
|
|
|
- :header-cell-style="{
|
|
|
|
|
- color: '#000',
|
|
|
|
|
- 'font-size': '14px',
|
|
|
|
|
- padding: '4px 0',
|
|
|
|
|
- }"
|
|
|
|
|
|
|
+ :header-cell-style="{ color: '#000', 'font-size': '14px', padding: '4px 0' }"
|
|
|
:row-class-name="tableRowClassName"
|
|
:row-class-name="tableRowClassName"
|
|
|
:show-summary="showSummary"
|
|
:show-summary="showSummary"
|
|
|
:sum-text="sumText"
|
|
:sum-text="sumText"
|
|
|
- :summary-method="
|
|
|
|
|
- hasSummaryMethod ? summaryMethod : null
|
|
|
|
|
- "
|
|
|
|
|
|
|
+ :summary-method="hasSummaryMethod ? summaryMethod : null"
|
|
|
border
|
|
border
|
|
|
@selection-change="handleSelectionChange"
|
|
@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
|
|
<el-table-column
|
|
|
v-if="field.field_options.index"
|
|
v-if="field.field_options.index"
|
|
|
type="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
|
|
|
|
|
- "
|
|
|
|
|
|
|
+ :label="field.field_options.index_name ? field.field_options.index_name : '序号'"
|
|
|
|
|
+ :width="field.field_options.index_width ? field.field_options.index_width : 50"
|
|
|
:index="indexMethod"
|
|
:index="indexMethod"
|
|
|
/>
|
|
/>
|
|
|
<template v-for="(column, j) in displayColumns">
|
|
<template v-for="(column, j) in displayColumns">
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- v-if="
|
|
|
|
|
- !columnHidden(column) &&
|
|
|
|
|
- column.field_type != 'desc' &&
|
|
|
|
|
- column.label != ''
|
|
|
|
|
- "
|
|
|
|
|
|
|
+ v-if="!columnHidden(column) && column.field_type != 'desc' && column.label != ''"
|
|
|
:key="j"
|
|
:key="j"
|
|
|
show-overflow-tooltip
|
|
show-overflow-tooltip
|
|
|
:prop="column.name"
|
|
:prop="column.name"
|
|
|
- :width="
|
|
|
|
|
- column.field_options.custom_class || null
|
|
|
|
|
- "
|
|
|
|
|
|
|
+ :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
|
|
|
|
|
- }}
|
|
|
|
|
- <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>
|
|
|
<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
|
|
<ibps-dynamic-form-table-item
|
|
|
:ref="'formItem' + column.name"
|
|
:ref="'formItem' + column.name"
|
|
|
:key="scope.$index + j"
|
|
:key="scope.$index + j"
|
|
|
- :models.sync="
|
|
|
|
|
- copDataModelCont[
|
|
|
|
|
- scope.$index +
|
|
|
|
|
- (currentPage - 1) *
|
|
|
|
|
- pageSize
|
|
|
|
|
- ]
|
|
|
|
|
- "
|
|
|
|
|
|
|
+ :models.sync="copDataModelCont[scope.$index + (currentPage - 1) * pageSize]"
|
|
|
:rights.sync="columnsRights"
|
|
:rights.sync="columnsRights"
|
|
|
:form-data="models"
|
|
:form-data="models"
|
|
|
:field="column"
|
|
:field="column"
|
|
@@ -146,70 +80,36 @@
|
|
|
fixed="right"
|
|
fixed="right"
|
|
|
class-name="hidden-print"
|
|
class-name="hidden-print"
|
|
|
label="操作栏目"
|
|
label="操作栏目"
|
|
|
- :width="
|
|
|
|
|
- colWidth
|
|
|
|
|
- ? colWidth
|
|
|
|
|
- : manageButtons.length == 1
|
|
|
|
|
- ? '85'
|
|
|
|
|
- : '160'
|
|
|
|
|
- "
|
|
|
|
|
|
|
+ :width="colWidth ? colWidth : (manageButtons.length == 1 ? '85' : '160')"
|
|
|
>
|
|
>
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<el-dropdown v-if="manageButtons.length > 3">
|
|
<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-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
|
|
<ibps-toolbar
|
|
|
:actions="manageButtons"
|
|
:actions="manageButtons"
|
|
|
:socpe="thatSocpe"
|
|
:socpe="thatSocpe"
|
|
|
:data="scope.row"
|
|
:data="scope.row"
|
|
|
position="manage"
|
|
position="manage"
|
|
|
class="hidden-print"
|
|
class="hidden-print"
|
|
|
- @action-event="
|
|
|
|
|
- (action) =>
|
|
|
|
|
- handleActionEvent(
|
|
|
|
|
- action,
|
|
|
|
|
- scope.$index
|
|
|
|
|
- )
|
|
|
|
|
- "
|
|
|
|
|
|
|
+ @action-event="(action) => handleActionEvent(action, scope.$index)"
|
|
|
/>
|
|
/>
|
|
|
</el-dropdown-menu>
|
|
</el-dropdown-menu>
|
|
|
</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
|
|
<el-link
|
|
|
:key="index"
|
|
:key="index"
|
|
|
:icon="button.icon"
|
|
:icon="button.icon"
|
|
|
:type="button.type"
|
|
:type="button.type"
|
|
|
:underline="false"
|
|
:underline="false"
|
|
|
- @click="
|
|
|
|
|
- handleActionEvent(
|
|
|
|
|
- button,
|
|
|
|
|
- scope.$index
|
|
|
|
|
- )
|
|
|
|
|
- "
|
|
|
|
|
|
|
+ @click="handleActionEvent(button, scope.$index)"
|
|
|
>{{ button.label }}</el-link>
|
|
>{{ 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> -->
|
|
|
<!-- (manageButtons.length === 3 && index === 0) || index === 1 -->
|
|
<!-- (manageButtons.length === 3 && index === 0) || index === 1 -->
|
|
|
- <el-divider
|
|
|
|
|
- v-if="
|
|
|
|
|
- index !==
|
|
|
|
|
- manageButtons.length - 1
|
|
|
|
|
- "
|
|
|
|
|
- :key="index"
|
|
|
|
|
- direction="vertical"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <el-divider v-if="index !== manageButtons.length - 1" :key="index" direction="vertical" />
|
|
|
</template>
|
|
</template>
|
|
|
</template>
|
|
</template>
|
|
|
</template>
|
|
</template>
|
|
@@ -217,10 +117,7 @@
|
|
|
</el-table>
|
|
</el-table>
|
|
|
<!-- 分页 -->
|
|
<!-- 分页 -->
|
|
|
<el-pagination
|
|
<el-pagination
|
|
|
- v-if="
|
|
|
|
|
- needPage !== 'N' &&
|
|
|
|
|
- (mode === 'dialog' || mode === 'inner')
|
|
|
|
|
- "
|
|
|
|
|
|
|
+ v-if="needPage !== 'N' && (mode === 'dialog' || mode === 'inner')"
|
|
|
:current-page="currentPage"
|
|
:current-page="currentPage"
|
|
|
:page-size="pageSize"
|
|
:page-size="pageSize"
|
|
|
:page-sizes="pageSizeOptions"
|
|
:page-sizes="pageSizeOptions"
|
|
@@ -236,53 +133,15 @@
|
|
|
<template v-else-if="mode === 'block'">
|
|
<template v-else-if="mode === 'block'">
|
|
|
<template v-if="dataModel && dataModel.length > 0">
|
|
<template v-if="dataModel && dataModel.length > 0">
|
|
|
<template v-for="(data, index) in dataModel">
|
|
<template v-for="(data, index) in dataModel">
|
|
|
- <div
|
|
|
|
|
- :key="index"
|
|
|
|
|
- class="dynamic-form-table__block panel panel-info"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <div :key="index" class="dynamic-form-table__block panel panel-info">
|
|
|
<div class="panel-heading ibps-clearfix">
|
|
<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 }}
|
|
|
|
|
- </div>
|
|
|
|
|
- <div
|
|
|
|
|
- v-if="
|
|
|
|
|
- toolbarButtons &&
|
|
|
|
|
- toolbarButtons.length > 0
|
|
|
|
|
- "
|
|
|
|
|
- class="ibps-fr"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <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 }}</div>
|
|
|
|
|
+ <div v-if="toolbarButtons && toolbarButtons.length > 0" class="ibps-fr">
|
|
|
<el-button-group>
|
|
<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 }}
|
|
{{ button.label }}
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</template>
|
|
</template>
|
|
@@ -314,12 +173,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
- <el-table
|
|
|
|
|
- v-else
|
|
|
|
|
- :data="[]"
|
|
|
|
|
- empty-text="您尚未创建任何字段。请在表单中添加字段。"
|
|
|
|
|
- border
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <el-table v-else :data="[]" empty-text="您尚未创建任何字段。请在表单中添加字段。" border />
|
|
|
<!--按钮支持自定义对话框-->
|
|
<!--按钮支持自定义对话框-->
|
|
|
<custom-dialog
|
|
<custom-dialog
|
|
|
:visible="customDialogVisible"
|
|
:visible="customDialogVisible"
|
|
@@ -366,10 +220,7 @@ import FormUtils from '../../utils/formUtil'
|
|
|
import FormFieldUtil from '../../utils/formFieldUtil'
|
|
import FormFieldUtil from '../../utils/formFieldUtil'
|
|
|
|
|
|
|
|
import { hasPermission } from '@/business/platform/form/constants/tableButtonTypes'
|
|
import { hasPermission } from '@/business/platform/form/constants/tableButtonTypes'
|
|
|
-import {
|
|
|
|
|
- defaultPageSize,
|
|
|
|
|
- pageSizeOptions
|
|
|
|
|
-} from '@/business/platform/form/constants/fieldOptions'
|
|
|
|
|
|
|
+import { defaultPageSize, pageSizeOptions } from '@/business/platform/form/constants/fieldOptions'
|
|
|
|
|
|
|
|
import CustomDialog from '@/business/platform/data/templaterender/custom-dialog/dialog'
|
|
import CustomDialog from '@/business/platform/data/templaterender/custom-dialog/dialog'
|
|
|
import FormrenderDialog from '@/business/platform/form/formrender/dialog'
|
|
import FormrenderDialog from '@/business/platform/form/formrender/dialog'
|
|
@@ -380,12 +231,7 @@ import IbpsImport from '@/plugins/import'
|
|
|
const JForm = window.JForm
|
|
const JForm = window.JForm
|
|
|
// 获取子表展示数据
|
|
// 获取子表展示数据
|
|
|
const getShowData = (data, current = 1, size = defaultPageSize) => {
|
|
const getShowData = (data, current = 1, size = defaultPageSize) => {
|
|
|
- return data && data.length
|
|
|
|
|
- ? JSON.parse(JSON.stringify(data)).slice(
|
|
|
|
|
- (current - 1) * size,
|
|
|
|
|
- current * size
|
|
|
|
|
- )
|
|
|
|
|
- : []
|
|
|
|
|
|
|
+ return data && data.length ? JSON.parse(JSON.stringify(data)).slice((current - 1) * size, current * size) : []
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
@@ -422,12 +268,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
data () {
|
|
data () {
|
|
|
- const {
|
|
|
|
|
- page,
|
|
|
|
|
- pageSize = defaultPageSize,
|
|
|
|
|
- mode = 'inner',
|
|
|
|
|
- colWidth
|
|
|
|
|
- } = this.field.field_options || {}
|
|
|
|
|
|
|
+ const { page, pageSize = defaultPageSize, mode = 'inner', colWidth } = this.field.field_options || {}
|
|
|
let initData = []
|
|
let initData = []
|
|
|
if (page === 'N' || mode === 'block' || !this.value) {
|
|
if (page === 'N' || mode === 'block' || !this.value) {
|
|
|
initData = this.value || []
|
|
initData = this.value || []
|
|
@@ -486,8 +327,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
fieldOptions () {
|
|
fieldOptions () {
|
|
|
const fieldOptions = this.field.field_options || {}
|
|
const fieldOptions = this.field.field_options || {}
|
|
|
- fieldOptions.default_value_type =
|
|
|
|
|
- fieldOptions.default_value_type || 'fixed'
|
|
|
|
|
|
|
+ fieldOptions.default_value_type = fieldOptions.default_value_type || 'fixed'
|
|
|
return fieldOptions
|
|
return fieldOptions
|
|
|
},
|
|
},
|
|
|
toolbarButtons () {
|
|
toolbarButtons () {
|
|
@@ -497,10 +337,7 @@ export default {
|
|
|
return this.filterButtons('manage')
|
|
return this.filterButtons('manage')
|
|
|
},
|
|
},
|
|
|
manageButtonWidth () {
|
|
manageButtonWidth () {
|
|
|
- return this.manageButtons.length > 2 ||
|
|
|
|
|
- this.manageButtons.length === 1
|
|
|
|
|
- ? 70
|
|
|
|
|
- : 150
|
|
|
|
|
|
|
+ return this.manageButtons.length > 2 || this.manageButtons.length === 1 ? 70 : 150
|
|
|
},
|
|
},
|
|
|
mode () {
|
|
mode () {
|
|
|
return this.field.field_options.mode || 'inner'
|
|
return this.field.field_options.mode || 'inner'
|
|
@@ -548,12 +385,7 @@ export default {
|
|
|
traverse(child.fields)
|
|
traverse(child.fields)
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
- if (
|
|
|
|
|
- this.$utils.toBoolean(
|
|
|
|
|
- field.field_options.display,
|
|
|
|
|
- true
|
|
|
|
|
- )
|
|
|
|
|
- ) {
|
|
|
|
|
|
|
+ if (this.$utils.toBoolean(field.field_options.display, true)) {
|
|
|
displayColumns.push(field)
|
|
displayColumns.push(field)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -576,9 +408,7 @@ export default {
|
|
|
return bs
|
|
return bs
|
|
|
},
|
|
},
|
|
|
tableReadonly () {
|
|
tableReadonly () {
|
|
|
- return this.readonlyRights
|
|
|
|
|
- ? true
|
|
|
|
|
- : this.tableRights === FormOptions.t.PERMISSIONS.READ
|
|
|
|
|
|
|
+ return this.readonlyRights ? true : this.tableRights === FormOptions.t.PERMISSIONS.READ
|
|
|
},
|
|
},
|
|
|
tableHidden () {
|
|
tableHidden () {
|
|
|
return this.tableRights === FormOptions.t.PERMISSIONS.HIDE
|
|
return this.tableRights === FormOptions.t.PERMISSIONS.HIDE
|
|
@@ -647,19 +477,10 @@ export default {
|
|
|
// 字段权限
|
|
// 字段权限
|
|
|
fieldRights: {
|
|
fieldRights: {
|
|
|
handler (fieldRights) {
|
|
handler (fieldRights) {
|
|
|
- if (
|
|
|
|
|
- this.$utils.isNotEmpty(fieldRights) &&
|
|
|
|
|
- this.$utils.isPlainObject(fieldRights)
|
|
|
|
|
- ) {
|
|
|
|
|
- this.tableRights = this.getRealRights(
|
|
|
|
|
- fieldRights['rights'] || FormOptions.t.PERMISSIONS.EDIT
|
|
|
|
|
- )
|
|
|
|
|
- this.columnsRights = this.getColumnsRights(
|
|
|
|
|
- fieldRights['columns']
|
|
|
|
|
- )
|
|
|
|
|
- this.buttonsRights = this.getButtonsRights(
|
|
|
|
|
- fieldRights['buttons']
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ if (this.$utils.isNotEmpty(fieldRights) && this.$utils.isPlainObject(fieldRights)) {
|
|
|
|
|
+ this.tableRights = this.getRealRights(fieldRights['rights'] || FormOptions.t.PERMISSIONS.EDIT)
|
|
|
|
|
+ this.columnsRights = this.getColumnsRights(fieldRights['columns'])
|
|
|
|
|
+ this.buttonsRights = this.getButtonsRights(fieldRights['buttons'])
|
|
|
} else {
|
|
} else {
|
|
|
this.tableRights = FormOptions.t.PERMISSIONS.EDIT
|
|
this.tableRights = FormOptions.t.PERMISSIONS.EDIT
|
|
|
this.columnsRights = this.getColumnsRights({})
|
|
this.columnsRights = this.getColumnsRights({})
|
|
@@ -688,7 +509,7 @@ export default {
|
|
|
return (this.currentPage - 1) * this.pageSize + index + 1
|
|
return (this.currentPage - 1) * this.pageSize + index + 1
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
- * 定义删除、增加 不做操作。修改时才做更新 ,分页修改时,根据页表修改。
|
|
|
|
|
|
|
+ * 定义删除、增加 不做操作。修改时才做更新,分页修改时,根据页表修改。
|
|
|
*/
|
|
*/
|
|
|
updateModel (key, val, index, page) {
|
|
updateModel (key, val, index, page) {
|
|
|
this.dataModel[(page - 1) * this.pageSize + index][key] = val
|
|
this.dataModel[(page - 1) * this.pageSize + index][key] = val
|
|
@@ -707,52 +528,33 @@ export default {
|
|
|
this.currentPage = 1
|
|
this.currentPage = 1
|
|
|
} else {
|
|
} else {
|
|
|
// 其余逻辑(编辑、删除、整表赋值):操作后当前页大于总页数,替换为总页数,否则留在当前页
|
|
// 其余逻辑(编辑、删除、整表赋值):操作后当前页大于总页数,替换为总页数,否则留在当前页
|
|
|
- this.currentPage =
|
|
|
|
|
- this.currentPage > pageCount ? pageCount : this.currentPage
|
|
|
|
|
|
|
+ this.currentPage = this.currentPage > pageCount ? pageCount : this.currentPage
|
|
|
}
|
|
}
|
|
|
- this.copDataModel = this.getShowData(
|
|
|
|
|
- val,
|
|
|
|
|
- this.currentPage,
|
|
|
|
|
- this.pageSize
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ this.copDataModel = this.getShowData(val, this.currentPage, this.pageSize)
|
|
|
this.editFromType = ''
|
|
this.editFromType = ''
|
|
|
this.$emit('update:value', val)
|
|
this.$emit('update:value', val)
|
|
|
},
|
|
},
|
|
|
// 处理切换分页
|
|
// 处理切换分页
|
|
|
handleCurrentChange (val) {
|
|
handleCurrentChange (val) {
|
|
|
this.currentPage = val
|
|
this.currentPage = val
|
|
|
- this.copDataModel = this.getShowData(
|
|
|
|
|
- this.dataModel,
|
|
|
|
|
- this.currentPage,
|
|
|
|
|
- this.pageSize
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ this.copDataModel = this.getShowData(this.dataModel, this.currentPage, this.pageSize)
|
|
|
},
|
|
},
|
|
|
// 处理切换分页大小
|
|
// 处理切换分页大小
|
|
|
handleSizeChange (val) {
|
|
handleSizeChange (val) {
|
|
|
this.pageSize = val
|
|
this.pageSize = val
|
|
|
this.currentPage = 1
|
|
this.currentPage = 1
|
|
|
- this.copDataModel = this.getShowData(
|
|
|
|
|
- this.dataModel,
|
|
|
|
|
- this.currentPage,
|
|
|
|
|
- this.pageSize
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ this.copDataModel = this.getShowData(this.dataModel, this.currentPage, this.pageSize)
|
|
|
},
|
|
},
|
|
|
columnHidden (column) {
|
|
columnHidden (column) {
|
|
|
// 是否隐藏
|
|
// 是否隐藏
|
|
|
- return (
|
|
|
|
|
- this.columnsRights[column.name] ===
|
|
|
|
|
- FormOptions.t.PERMISSIONS.HIDE ||
|
|
|
|
|
- column.field_type === 'hidden'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ return this.columnsRights[column.name] === FormOptions.t.PERMISSIONS.HIDE || column.field_type === 'hidden'
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
* 获取真实的权限
|
|
* 获取真实的权限
|
|
|
*/
|
|
*/
|
|
|
getRealRights (rights) {
|
|
getRealRights (rights) {
|
|
|
if (this.tableReadonly) {
|
|
if (this.tableReadonly) {
|
|
|
- return rights === FormOptions.t.PERMISSIONS.HIDE
|
|
|
|
|
- ? rights
|
|
|
|
|
- : FormOptions.t.PERMISSIONS.READ
|
|
|
|
|
|
|
+ return rights === FormOptions.t.PERMISSIONS.HIDE ? rights : FormOptions.t.PERMISSIONS.READ
|
|
|
} else {
|
|
} else {
|
|
|
return rights
|
|
return rights
|
|
|
}
|
|
}
|
|
@@ -761,10 +563,7 @@ export default {
|
|
|
const columnsRights = {}
|
|
const columnsRights = {}
|
|
|
if (this.nameColumns && this.nameColumns.length > 0) {
|
|
if (this.nameColumns && this.nameColumns.length > 0) {
|
|
|
this.nameColumns.forEach((column) => {
|
|
this.nameColumns.forEach((column) => {
|
|
|
- columnsRights[column.name] = this.getRealRights(
|
|
|
|
|
- rights[column.name] ||
|
|
|
|
|
- FormUtils.getDefaultRigths(column)
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ columnsRights[column.name] = this.getRealRights(rights[column.name] || FormUtils.getDefaultRigths(column))
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
return columnsRights
|
|
return columnsRights
|
|
@@ -774,8 +573,7 @@ export default {
|
|
|
const buttonsRights = {}
|
|
const buttonsRights = {}
|
|
|
if (this.$utils.isNotEmpty(this.buttons)) {
|
|
if (this.$utils.isNotEmpty(this.buttons)) {
|
|
|
this.buttons.forEach((button) => {
|
|
this.buttons.forEach((button) => {
|
|
|
- buttonsRights[button.key] =
|
|
|
|
|
- FormOptions.t.PERMISSIONS.SHOW
|
|
|
|
|
|
|
+ buttonsRights[button.key] = FormOptions.t.PERMISSIONS.SHOW
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
return buttonsRights
|
|
return buttonsRights
|
|
@@ -803,12 +601,8 @@ export default {
|
|
|
this.buttons.forEach((button) => {
|
|
this.buttons.forEach((button) => {
|
|
|
if (
|
|
if (
|
|
|
hasPermission(button.key, position) && // 有位置权限
|
|
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))
|
|
const b = JSON.parse(JSON.stringify(button))
|
|
|
b.position = position
|
|
b.position = position
|
|
@@ -822,12 +616,8 @@ export default {
|
|
|
this.buttons.forEach((button) => {
|
|
this.buttons.forEach((button) => {
|
|
|
if (
|
|
if (
|
|
|
hasPermission(button.key, position) && // 有位置权限
|
|
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) && // 有按钮权限
|
|
|
button.key === 'consult'
|
|
button.key === 'consult'
|
|
|
) {
|
|
) {
|
|
|
// 原按钮权限限制 改为开放查阅按钮 modified by 林总
|
|
// 原按钮权限限制 改为开放查阅按钮 modified by 林总
|
|
@@ -842,10 +632,7 @@ export default {
|
|
|
handleActionEvent (button, buttonIndex) {
|
|
handleActionEvent (button, buttonIndex) {
|
|
|
// 起始下标
|
|
// 起始下标
|
|
|
const index = (this.currentPage - 1) * this.pageSize + buttonIndex
|
|
const index = (this.currentPage - 1) * this.pageSize + 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'
|
|
|
this.actionButton = button
|
|
this.actionButton = button
|
|
|
// 前置事件
|
|
// 前置事件
|
|
@@ -863,9 +650,9 @@ export default {
|
|
|
this.handleAdd()
|
|
this.handleAdd()
|
|
|
}
|
|
}
|
|
|
break
|
|
break
|
|
|
- case 'copyAdd':
|
|
|
|
|
- // 复制添加数据,需要先选择数据,往最后添加数据
|
|
|
|
|
- this.handleCopyAddData(button, index)
|
|
|
|
|
|
|
+ case 'copy':
|
|
|
|
|
+ // 复制已有数据(尾部插入)
|
|
|
|
|
+ this.handleCopyData(button, index)
|
|
|
break
|
|
break
|
|
|
case 'edit':
|
|
case 'edit':
|
|
|
this.handleDialogMode(index)
|
|
this.handleDialogMode(index)
|
|
@@ -895,19 +682,11 @@ export default {
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
destoryTable () {
|
|
destoryTable () {
|
|
|
- if (
|
|
|
|
|
- this.$utils.isNotEmpty(window[this.mainCode + 'TableRefs']) &&
|
|
|
|
|
- this.$utils.isNotEmpty(
|
|
|
|
|
- window[this.mainCode + 'TableRefs'][this.code]
|
|
|
|
|
- )
|
|
|
|
|
- ) {
|
|
|
|
|
|
|
+ if (this.$utils.isNotEmpty(window[this.mainCode + 'TableRefs']) && this.$utils.isNotEmpty(window[this.mainCode + 'TableRefs'][this.code])) {
|
|
|
window[this.mainCode + 'TableRefs'][this.code] = null
|
|
window[this.mainCode + 'TableRefs'][this.code] = null
|
|
|
delete window[this.mainCode + 'TableRefs'][this.code]
|
|
delete window[this.mainCode + 'TableRefs'][this.code]
|
|
|
}
|
|
}
|
|
|
- if (
|
|
|
|
|
- this.$utils.isObject(window[this.mainCode + 'TableRefs']) &&
|
|
|
|
|
- this.$utils.isEmpty(window[this.mainCode + 'TableRefs'])
|
|
|
|
|
- ) {
|
|
|
|
|
|
|
+ if (this.$utils.isObject(window[this.mainCode + 'TableRefs']) && this.$utils.isEmpty(window[this.mainCode + 'TableRefs'])) {
|
|
|
window[this.mainCode + 'TableRefs'] = null
|
|
window[this.mainCode + 'TableRefs'] = null
|
|
|
delete window[this.mainCode + 'TableRefs']
|
|
delete window[this.mainCode + 'TableRefs']
|
|
|
}
|
|
}
|
|
@@ -917,9 +696,7 @@ export default {
|
|
|
if (this.mode === 'dialog') {
|
|
if (this.mode === 'dialog') {
|
|
|
this.handleDialogMode()
|
|
this.handleDialogMode()
|
|
|
} else {
|
|
} else {
|
|
|
- const defaultValue = await FormUtils.getTableDefaultData(
|
|
|
|
|
- this.field
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ const defaultValue = await FormUtils.getTableDefaultData(this.field)
|
|
|
await this.addData(JSON.parse(JSON.stringify(defaultValue)))
|
|
await this.addData(JSON.parse(JSON.stringify(defaultValue)))
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -935,29 +712,25 @@ export default {
|
|
|
this.$refs.elTable.doLayout()
|
|
this.$refs.elTable.doLayout()
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- // 新增所选择的数据
|
|
|
|
|
- handleCopyAddData (button, index) {
|
|
|
|
|
|
|
+ // 复制已有数据
|
|
|
|
|
+ handleCopyData (button, index) {
|
|
|
const position = button.position
|
|
const position = button.position
|
|
|
const selection = this.getSelection(position, index)
|
|
const selection = this.getSelection(position, index)
|
|
|
- ActionUtils.selectedMultiRecord(selection)
|
|
|
|
|
- .then((ids) => {
|
|
|
|
|
- var addDatas = []
|
|
|
|
|
- for (const i of selection) {
|
|
|
|
|
- const object = this.dataModel[i]
|
|
|
|
|
- delete object.$index
|
|
|
|
|
- delete object.id
|
|
|
|
|
- addDatas.push(object)
|
|
|
|
|
- }
|
|
|
|
|
- this.dataModel = JSON.parse(JSON.stringify([...this.dataModel, ...addDatas]))
|
|
|
|
|
- // 初始化运行公式计算
|
|
|
|
|
- this.initRunCalFormula(this.dataModel.length - 1)
|
|
|
|
|
- // 后置事件
|
|
|
|
|
- this.afterScript(this.actionCode, this.actionPosition)
|
|
|
|
|
- if (this.$refs.elTable) {
|
|
|
|
|
- this.$refs.elTable.doLayout()
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ActionUtils.selectedMultiRecord(selection).then((ids) => {
|
|
|
|
|
+ selection.forEach(i => {
|
|
|
|
|
+ const obj = this.dataModel[i]
|
|
|
|
|
+ delete obj.$index
|
|
|
|
|
+ delete obj.id
|
|
|
|
|
+ this.dataModel.push(obj)
|
|
|
})
|
|
})
|
|
|
- .catch(() => {})
|
|
|
|
|
|
|
+ // 初始化运行公式计算
|
|
|
|
|
+ this.initRunCalFormula(this.dataModel.length - 1)
|
|
|
|
|
+ // 后置事件
|
|
|
|
|
+ this.afterScript(this.actionCode, this.actionPosition)
|
|
|
|
|
+ if (this.$refs.elTable) {
|
|
|
|
|
+ this.$refs.elTable.doLayout()
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(() => {})
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
* 获取选择的记录
|
|
* 获取选择的记录
|
|
@@ -965,10 +738,7 @@ export default {
|
|
|
getSelection (position, index) {
|
|
getSelection (position, index) {
|
|
|
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) {
|
|
|
const startIndex = (this.currentPage - 1) * this.pageSize
|
|
const startIndex = (this.currentPage - 1) * this.pageSize
|
|
|
this.multipleSelection.forEach((row) => {
|
|
this.multipleSelection.forEach((row) => {
|
|
|
selection.push(row.$index + startIndex)
|
|
selection.push(row.$index + startIndex)
|
|
@@ -982,31 +752,24 @@ export default {
|
|
|
handleRemove (button, index) {
|
|
handleRemove (button, index) {
|
|
|
const position = button.position
|
|
const position = button.position
|
|
|
const selection = this.getSelection(position, index)
|
|
const selection = this.getSelection(position, index)
|
|
|
- ActionUtils.removeRecord(selection, '确定删除当前数据?', true)
|
|
|
|
|
- .then((ids) => {
|
|
|
|
|
- for (let i = this.dataModel.length - 1; i >= 0; i--) {
|
|
|
|
|
- if (ids.indexOf(i) > -1) {
|
|
|
|
|
- this.dataModel.splice(i, 1)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ActionUtils.removeRecord(selection, '确定删除当前数据?', true).then((ids) => {
|
|
|
|
|
+ for (let i = this.dataModel.length - 1; i >= 0; i--) {
|
|
|
|
|
+ if (ids.indexOf(i) > -1) {
|
|
|
|
|
+ this.dataModel.splice(i, 1)
|
|
|
}
|
|
}
|
|
|
- this.totalCount = this.dataModel.length
|
|
|
|
|
- // 后置事件
|
|
|
|
|
- this.afterScript(this.actionCode, position, {
|
|
|
|
|
- selection: selection,
|
|
|
|
|
- index: index
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ this.totalCount = this.dataModel.length
|
|
|
|
|
+ // 后置事件
|
|
|
|
|
+ this.afterScript(this.actionCode, position, {
|
|
|
|
|
+ selection: selection,
|
|
|
|
|
+ index: index
|
|
|
})
|
|
})
|
|
|
- .catch(() => {})
|
|
|
|
|
|
|
+ }).catch(() => {})
|
|
|
},
|
|
},
|
|
|
// 初始化运行公式计算
|
|
// 初始化运行公式计算
|
|
|
initRunCalFormula (row) {
|
|
initRunCalFormula (row) {
|
|
|
// 不需要字段的进行公式计算 比如获取但其当前时间,随机数
|
|
// 不需要字段的进行公式计算 比如获取但其当前时间,随机数
|
|
|
- FormUtils.runCalFormula(
|
|
|
|
|
- this,
|
|
|
|
|
- this.formula[FormUtils.NOT_NEED_FIELD],
|
|
|
|
|
- this.mainCode,
|
|
|
|
|
- row
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ FormUtils.runCalFormula(this, this.formula[FormUtils.NOT_NEED_FIELD], this.mainCode, row)
|
|
|
},
|
|
},
|
|
|
handleImport () {
|
|
handleImport () {
|
|
|
this.importTableDialogVisible = true
|
|
this.importTableDialogVisible = true
|
|
@@ -1052,9 +815,7 @@ export default {
|
|
|
ActionUtils.success('导入成功')
|
|
ActionUtils.success('导入成功')
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
- const formData = FormUtils.getTableDefaultColumnData(
|
|
|
|
|
- this.field
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ const formData = FormUtils.getTableDefaultColumnData(this.field)
|
|
|
IbpsImport.xlsx(file, options).then(({ header, results }) => {
|
|
IbpsImport.xlsx(file, options).then(({ header, results }) => {
|
|
|
const columnMap = {}
|
|
const columnMap = {}
|
|
|
this.nameColumns.forEach((column) => {
|
|
this.nameColumns.forEach((column) => {
|
|
@@ -1066,10 +827,7 @@ export default {
|
|
|
if (columnMap[key]) {
|
|
if (columnMap[key]) {
|
|
|
const column = columnMap[key]
|
|
const column = columnMap[key]
|
|
|
const name = column.name
|
|
const name = column.name
|
|
|
- const value = this.importDataFormatter(
|
|
|
|
|
- result[key],
|
|
|
|
|
- column
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ const value = this.importDataFormatter(result[key], column)
|
|
|
data[name] = value
|
|
data[name] = value
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1197,20 +955,10 @@ export default {
|
|
|
case 'select': // 下拉,单选,多选
|
|
case 'select': // 下拉,单选,多选
|
|
|
case 'radio':
|
|
case 'radio':
|
|
|
case 'checkbox':
|
|
case 'checkbox':
|
|
|
- result = this.formatterOptions(
|
|
|
|
|
- value,
|
|
|
|
|
- fieldOptions['options'],
|
|
|
|
|
- 'label',
|
|
|
|
|
- 'val'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ result = this.formatterOptions(value, fieldOptions['options'], 'label', 'val')
|
|
|
break
|
|
break
|
|
|
case 'switch': //
|
|
case 'switch': //
|
|
|
- result = this.formatterOptions(
|
|
|
|
|
- value,
|
|
|
|
|
- FormUtils.getSwitchOptions(this.field.field_options),
|
|
|
|
|
- 'label',
|
|
|
|
|
- 'val'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ result = this.formatterOptions(value, FormUtils.getSwitchOptions(this.field.field_options), 'label', 'val')
|
|
|
break
|
|
break
|
|
|
default:
|
|
default:
|
|
|
result = value
|
|
result = value
|
|
@@ -1240,18 +988,10 @@ export default {
|
|
|
case 'select': // 下拉,单选,多选
|
|
case 'select': // 下拉,单选,多选
|
|
|
case 'radio':
|
|
case 'radio':
|
|
|
case 'checkbox':
|
|
case 'checkbox':
|
|
|
- result = this.formatterOptions(
|
|
|
|
|
- value,
|
|
|
|
|
- fieldOptions['options'],
|
|
|
|
|
- 'val'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ result = this.formatterOptions(value, fieldOptions['options'], 'val')
|
|
|
break
|
|
break
|
|
|
case 'switch': //
|
|
case 'switch': //
|
|
|
- result = this.formatterOptions(
|
|
|
|
|
- value,
|
|
|
|
|
- FormUtils.getSwitchOptions(fieldOptions),
|
|
|
|
|
- 'val'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ result = this.formatterOptions(value, FormUtils.getSwitchOptions(fieldOptions), 'val')
|
|
|
break
|
|
break
|
|
|
default:
|
|
default:
|
|
|
result = value
|
|
result = value
|
|
@@ -1262,12 +1002,7 @@ export default {
|
|
|
/**
|
|
/**
|
|
|
* 格式化选项
|
|
* 格式化选项
|
|
|
*/
|
|
*/
|
|
|
- formatterOptions (
|
|
|
|
|
- value,
|
|
|
|
|
- options,
|
|
|
|
|
- valueKey = 'value',
|
|
|
|
|
- labelKey = 'label'
|
|
|
|
|
- ) {
|
|
|
|
|
|
|
+ formatterOptions (value, options, valueKey = 'value', labelKey = 'label') {
|
|
|
const optionObj = {}
|
|
const optionObj = {}
|
|
|
options.map((option) => {
|
|
options.map((option) => {
|
|
|
optionObj[option[valueKey]] = option[labelKey]
|
|
optionObj[option[valueKey]] = option[labelKey]
|
|
@@ -1284,9 +1019,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
// =====================对话框模式数据处理 金源信通改=====================
|
|
// =====================对话框模式数据处理 金源信通改=====================
|
|
|
handleDialogMode (index) {
|
|
handleDialogMode (index) {
|
|
|
- const data = this.$utils.isNotEmpty(index)
|
|
|
|
|
- ? this.dataModel[index]
|
|
|
|
|
- : {}
|
|
|
|
|
|
|
+ const data = this.$utils.isNotEmpty(index) ? this.dataModel[index] : {}
|
|
|
this.dialogFormData = {
|
|
this.dialogFormData = {
|
|
|
responses: JSON.parse(JSON.stringify(data)),
|
|
responses: JSON.parse(JSON.stringify(data)),
|
|
|
// 表单字段权限
|
|
// 表单字段权限
|
|
@@ -1299,18 +1032,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
if (this.params.formAttrs) {
|
|
if (this.params.formAttrs) {
|
|
|
const formAttrs = this.params.formAttrs
|
|
const formAttrs = this.params.formAttrs
|
|
|
- const allowAttrs = [
|
|
|
|
|
- 'inline',
|
|
|
|
|
- 'labelPosition',
|
|
|
|
|
- 'labelWidth',
|
|
|
|
|
- 'labelWidthUnit',
|
|
|
|
|
- 'size',
|
|
|
|
|
- 'statusIcon',
|
|
|
|
|
- 'descPosition',
|
|
|
|
|
- 'read_style',
|
|
|
|
|
- 'colon',
|
|
|
|
|
- 'labelSuffix'
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ const allowAttrs = ['inline', 'labelPosition', 'labelWidth', 'labelWidthUnit', 'size', 'statusIcon', 'descPosition', 'read_style', 'colon', 'labelSuffix']
|
|
|
for (const key in formAttrs) {
|
|
for (const key in formAttrs) {
|
|
|
if (allowAttrs.indexOf(key) > -1) {
|
|
if (allowAttrs.indexOf(key) > -1) {
|
|
|
const val = formAttrs[key]
|
|
const val = formAttrs[key]
|
|
@@ -1346,9 +1068,7 @@ export default {
|
|
|
// =====================对话框模式数据处理= 原====================
|
|
// =====================对话框模式数据处理= 原====================
|
|
|
|
|
|
|
|
handleEditMode (index) {
|
|
handleEditMode (index) {
|
|
|
- const data = this.$utils.isNotEmpty(index)
|
|
|
|
|
- ? this.dataModel[index]
|
|
|
|
|
- : {}
|
|
|
|
|
|
|
+ const data = this.$utils.isNotEmpty(index) ? this.dataModel[index] : {}
|
|
|
this.dialogFormData = {
|
|
this.dialogFormData = {
|
|
|
responses: JSON.parse(JSON.stringify(data)),
|
|
responses: JSON.parse(JSON.stringify(data)),
|
|
|
// 表单字段权限
|
|
// 表单字段权限
|
|
@@ -1361,18 +1081,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
if (this.params.formAttrs) {
|
|
if (this.params.formAttrs) {
|
|
|
const formAttrs = this.params.formAttrs
|
|
const formAttrs = this.params.formAttrs
|
|
|
- const allowAttrs = [
|
|
|
|
|
- 'inline',
|
|
|
|
|
- 'labelPosition',
|
|
|
|
|
- 'labelWidth',
|
|
|
|
|
- 'labelWidthUnit',
|
|
|
|
|
- 'size',
|
|
|
|
|
- 'statusIcon',
|
|
|
|
|
- 'descPosition',
|
|
|
|
|
- 'read_style',
|
|
|
|
|
- 'colon',
|
|
|
|
|
- 'labelSuffix'
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ const allowAttrs = ['inline', 'labelPosition', 'labelWidth', 'labelWidthUnit', 'size', 'statusIcon', 'descPosition', 'read_style', 'colon', 'labelSuffix']
|
|
|
for (const key in formAttrs) {
|
|
for (const key in formAttrs) {
|
|
|
if (allowAttrs.indexOf(key) > -1) {
|
|
if (allowAttrs.indexOf(key) > -1) {
|
|
|
const val = formAttrs[key]
|
|
const val = formAttrs[key]
|
|
@@ -1415,11 +1124,7 @@ export default {
|
|
|
|
|
|
|
|
async handleAddCustomDialog (button) {
|
|
async handleAddCustomDialog (button) {
|
|
|
this.customDialogKey = button.dialog
|
|
this.customDialogKey = button.dialog
|
|
|
- this.customDialogDynamicParams =
|
|
|
|
|
- await FormUtils.getLinkDynamicParams(
|
|
|
|
|
- button.custom,
|
|
|
|
|
- this.formData
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ this.customDialogDynamicParams = await FormUtils.getLinkDynamicParams(button.custom, this.formData)
|
|
|
this.customDialogCustom = button.custom
|
|
this.customDialogCustom = button.custom
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
this.customDialogVisible = true
|
|
this.customDialogVisible = true
|
|
@@ -1430,9 +1135,7 @@ export default {
|
|
|
if (this.$utils.isEmpty(linkLinkage)) {
|
|
if (this.$utils.isEmpty(linkLinkage)) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- const defaultValue = await FormUtils.getTableDefaultData(
|
|
|
|
|
- this.field
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ const defaultValue = await FormUtils.getTableDefaultData(this.field)
|
|
|
for (let i = 0; i < datas.length; i++) {
|
|
for (let i = 0; i < datas.length; i++) {
|
|
|
const data = datas[i]
|
|
const data = datas[i]
|
|
|
const model = JSON.parse(JSON.stringify(defaultValue))
|
|
const model = JSON.parse(JSON.stringify(defaultValue))
|
|
@@ -1472,13 +1175,7 @@ export default {
|
|
|
if (!callback) {
|
|
if (!callback) {
|
|
|
callback = () => {}
|
|
callback = () => {}
|
|
|
}
|
|
}
|
|
|
- JForm._beforeSubButton(
|
|
|
|
|
- this,
|
|
|
|
|
- this.actionCode,
|
|
|
|
|
- button.position,
|
|
|
|
|
- params,
|
|
|
|
|
- callback
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ JForm._beforeSubButton(this, this.actionCode, button.position, params, callback)
|
|
|
},
|
|
},
|
|
|
// 后置脚本
|
|
// 后置脚本
|
|
|
afterScript (action, position, params, callback) {
|
|
afterScript (action, position, params, callback) {
|
|
@@ -1590,7 +1287,7 @@ export default {
|
|
|
|
|
|
|
|
.is-required:not(.is-no-asterisk) {
|
|
.is-required:not(.is-no-asterisk) {
|
|
|
.dynamic-form-table__label:before {
|
|
.dynamic-form-table__label:before {
|
|
|
- content: "*";
|
|
|
|
|
|
|
+ content: '*';
|
|
|
color: #f56c6c;
|
|
color: #f56c6c;
|
|
|
margin-right: 4px;
|
|
margin-right: 4px;
|
|
|
}
|
|
}
|