提交 c9f8a899 编写于 作者: ibizdev's avatar ibizdev

ibizdev提交

上级 54864a93
...@@ -7,58 +7,63 @@ ...@@ -7,58 +7,63 @@
<a-menu theme="dark" mode="inline" :defaultSelectedKeys="['0']" @click="handleClick"> <a-menu theme="dark" mode="inline" :defaultSelectedKeys="['0']" @click="handleClick">
<a-menu-item key="0"> <a-menu-item key="0">
<a-icon type="user" /> <a-icon type="user" />
<span>实体编辑视图</span> <span>表单4</span>
</a-menu-item> </a-menu-item>
<a-menu-item key="1"> <a-menu-item key="1">
<a-icon type="video-camera" /> <a-icon type="video-camera" />
<span>基础编辑器</span> <span>实体编辑视图</span>
</a-menu-item> </a-menu-item>
<a-menu-item key="2"> <a-menu-item key="2">
<a-icon type="upload" /> <a-icon type="upload" />
<span>基础表单项</span> <span>基础编辑器</span>
</a-menu-item> </a-menu-item>
<a-menu-item key="3"> <a-menu-item key="3">
<a-icon type="user" /> <a-icon type="user" />
<span>实体3编辑视图</span> <span>基础表单项</span>
</a-menu-item> </a-menu-item>
<a-menu-item key="4"> <a-menu-item key="4">
<a-icon type="video-camera" /> <a-icon type="video-camera" />
<span>实体4编辑视图</span> <span>实体3编辑视图</span>
</a-menu-item> </a-menu-item>
<a-menu-item key="5"> <a-menu-item key="5">
<a-icon type="upload" /> <a-icon type="upload" />
<span>实体5编辑视图</span> <span>实体4编辑视图</span>
</a-menu-item> </a-menu-item>
<a-menu-item key="6"> <a-menu-item key="6">
<a-icon type="user" /> <a-icon type="user" />
<span>表单项动态逻辑示例</span> <span>实体5编辑视图</span>
</a-menu-item> </a-menu-item>
<a-menu-item key="7"> <a-menu-item key="7">
<a-icon type="video-camera" /> <a-icon type="video-camera" />
<span>实体2编辑视图</span> <span>表单项动态逻辑示例</span>
</a-menu-item> </a-menu-item>
<a-menu-item key="8"> <a-menu-item key="8">
<a-icon type="upload" /> <a-icon type="upload" />
<span>DemoForm</span> <span>实体2编辑视图</span>
</a-menu-item> </a-menu-item>
<a-menu-item key="9"> <a-menu-item key="9">
<a-icon type="user" /> <a-icon type="user" />
<span>DemoForm</span>
</a-menu-item>
<a-menu-item key="10">
<a-icon type="video-camera" />
<span>表单3</span> <span>表单3</span>
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
</a-layout-sider> </a-layout-sider>
<a-layout> <a-layout>
<a-layout-content :style="{ margin: '24px 16px', padding: '24px', background: '#fff', minHeight: '280px' }"> <a-layout-content :style="{ margin: '24px 16px', padding: '24px', background: '#fff', minHeight: '280px' }">
<EntityEditView v-show="curSelected == '0'"/> <ExampleMain4EditView v-show="curSelected == '0'"/>
<ExampleEditorType v-show="curSelected == '1'"/> <EntityEditView v-show="curSelected == '1'"/>
<ExampleEditView v-show="curSelected == '2'"/> <ExampleEditorType v-show="curSelected == '2'"/>
<Entity3EditView v-show="curSelected == '3'"/> <ExampleEditView v-show="curSelected == '3'"/>
<Entity4EditView v-show="curSelected == '4'"/> <Entity3EditView v-show="curSelected == '4'"/>
<Entity5EditView v-show="curSelected == '5'"/> <Entity4EditView v-show="curSelected == '5'"/>
<ExampleDLFEditView v-show="curSelected == '6'"/> <Entity5EditView v-show="curSelected == '6'"/>
<Entity2EditView v-show="curSelected == '7'"/> <ExampleDLFEditView v-show="curSelected == '7'"/>
<ExampleMain2EditView v-show="curSelected == '8'"/> <Entity2EditView v-show="curSelected == '8'"/>
<ExampleMain3EditView v-show="curSelected == '9'"/> <ExampleMain2EditView v-show="curSelected == '9'"/>
<ExampleMain3EditView v-show="curSelected == '10'"/>
</a-layout-content> </a-layout-content>
</a-layout> </a-layout>
</a-layout> </a-layout>
...@@ -71,6 +76,7 @@ import zhCN from "ant-design-vue/lib/locale-provider/zh_CN"; ...@@ -71,6 +76,7 @@ import zhCN from "ant-design-vue/lib/locale-provider/zh_CN";
import enUS from "ant-design-vue/lib/locale-provider/en_US"; import enUS from "ant-design-vue/lib/locale-provider/en_US";
import AppService from "@service/AppService"; import AppService from "@service/AppService";
import ExampleMain4EditView from '@pages/exapmple/example-main4-edit-view/example-main4-edit-view.vue';
import EntityEditView from '@pages/module/entity-edit-view/entity-edit-view.vue'; import EntityEditView from '@pages/module/entity-edit-view/entity-edit-view.vue';
import ExampleEditorType from '@pages/exapmple/example-editor-type/example-editor-type.vue'; import ExampleEditorType from '@pages/exapmple/example-editor-type/example-editor-type.vue';
import ExampleEditView from '@pages/exapmple/example-edit-view/example-edit-view.vue'; import ExampleEditView from '@pages/exapmple/example-edit-view/example-edit-view.vue';
...@@ -85,6 +91,7 @@ import ExampleMain3EditView from '@pages/exapmple/example-main3-edit-view/exampl ...@@ -85,6 +91,7 @@ import ExampleMain3EditView from '@pages/exapmple/example-main3-edit-view/exampl
export default { export default {
name: "app", name: "app",
components: { components: {
ExampleMain4EditView,
EntityEditView, EntityEditView,
ExampleEditorType, ExampleEditorType,
ExampleEditView, ExampleEditView,
......
...@@ -2,8 +2,39 @@ ...@@ -2,8 +2,39 @@
<div class="app-form"> <div class="app-form">
<a-form class="" style=""> <a-form class="" style="">
<a-row> <a-row>
<a-tabs @change="formPageSelected">
</a-tabs> <a-col v-show="this.detailsModel.formitem.visible" style="" :lg="{ span: 24, offset: 0}">
<app-form-item :helpInfo="this.detailsModel.formitem.error" :required="this.detailsModel.formitem.required" :validateStatus="this.detailsModel.formitem.validateStatus" :labelName="''" :labelwidth="'130px'" :labelPosition="'LEFT'" :isShowCaption="true" :formItemStyle="{}" :isEmptyCaption="false" :formItemContentStyle="{}" class="app-form-item-formitem ">
<a-input v-model="data.formitem" :disabled="detailsModel.formitem.disabled" style="" @change="formItemChange('formitem',$event.target.value)"/>
</app-form-item>
</a-col>
<a-col v-show="this.detailsModel.formitem1.visible" style="" :lg="{ span: 24, offset: 0}">
<app-form-item :helpInfo="this.detailsModel.formitem1.error" :required="this.detailsModel.formitem1.required" :validateStatus="this.detailsModel.formitem1.validateStatus" :labelName="''" :labelwidth="'130px'" :labelPosition="'LEFT'" :isShowCaption="true" :formItemStyle="{}" :isEmptyCaption="false" :formItemContentStyle="{}" class="app-form-item-formitem1 ">
<a-input v-model="data.formitem1" type="password" :disabled="detailsModel.formitem1.disabled" style="" @change="formItemChange('formitem1',$event.target.value)"/>
</app-form-item>
</a-col>
<a-col v-show="this.detailsModel.formitem3.visible" style="" :lg="{ span: 24, offset: 0}">
<app-form-item :helpInfo="this.detailsModel.formitem3.error" :required="this.detailsModel.formitem3.required" :validateStatus="this.detailsModel.formitem3.validateStatus" :labelName="''" :labelwidth="'130px'" :labelPosition="'LEFT'" :isShowCaption="true" :formItemStyle="{}" :isEmptyCaption="false" :formItemContentStyle="{}" class="app-form-item-formitem3 ">
<a-textarea v-model="data.formitem3" :autosize="{ minRows: 3}" :disabled="detailsModel.formitem3.disabled" style="" @change="formItemChange('formitem3',$event.target.value)"/>
</app-form-item>
</a-col>
<a-col v-show="this.detailsModel.formitem4.visible" style="" :lg="{ span: 24, offset: 0}">
<app-form-item :helpInfo="this.detailsModel.formitem4.error" :required="this.detailsModel.formitem4.required" :validateStatus="this.detailsModel.formitem4.validateStatus" :labelName="''" :labelwidth="'130px'" :labelPosition="'LEFT'" :isShowCaption="true" :formItemStyle="{}" :isEmptyCaption="false" :formItemContentStyle="{}" class="app-form-item-formitem4 ">
<div style="">{{data.formitem4}}</div>
</app-form-item>
</a-col>
<a-col v-show="this.detailsModel.formitem5.visible" style="" :lg="{ span: 24, offset: 0}">
<app-form-item :helpInfo="this.detailsModel.formitem5.error" :required="this.detailsModel.formitem5.required" :validateStatus="this.detailsModel.formitem5.validateStatus" :labelName="''" :labelwidth="'130px'" :labelPosition="'LEFT'" :isShowCaption="true" :formItemStyle="{}" :isEmptyCaption="false" :formItemContentStyle="{}" class="app-form-item-formitem5 ">
<app-dropdown-list v-model="data.formitem5" :isauto="true" :disabled="detailsModel.formitem5.disabled" :codelist="codelistModel" placeholder="请选择..." style="" @change="formItemChange('formitem5',$event)"></app-dropdown-list>
</app-form-item>
</a-col>
</a-row> </a-row>
</a-form> </a-form>
</div> </div>
...@@ -58,6 +89,12 @@ export default { ...@@ -58,6 +89,12 @@ export default {
srfuf: null, srfuf: null,
srfdeid: null, srfdeid: null,
srfsourcekey: null, srfsourcekey: null,
formitem: null,
formitem1: null,
formitem2: null,
formitem3: null,
formitem4: null,
formitem5: null,
exampleid: null, exampleid: null,
}, },
...@@ -66,6 +103,8 @@ export default { ...@@ -66,6 +103,8 @@ export default {
* *
*/ */
detailsModel:{ detailsModel:{
formpage1: new FormPageModel({ caption: '表单分页', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
,
srfupdatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 }) srfupdatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
, ,
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 }) srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
...@@ -81,10 +120,21 @@ export default { ...@@ -81,10 +120,21 @@ export default {
srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 }) srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
, ,
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 }) srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
,
formitem: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'formitem', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
,
formitem1: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'formitem1', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
,
formitem2: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'formitem2', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
,
formitem3: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'formitem3', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
,
formitem4: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'formitem4', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
,
formitem5: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'formitem5', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
, ,
exampleid: new FormItemModel({ caption: '示例标识', detailType: 'FORMITEM', name: 'exampleid', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 }) exampleid: new FormItemModel({ caption: '示例标识', detailType: 'FORMITEM', name: 'exampleid', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
, ,
form: new FormTabPanelModel({ caption: 'form', detailType: 'TABPANEL', name: 'form', visible: true, isShowCaption: true, form: this, tabPages: [] }),
}, },
/** /**
...@@ -147,6 +197,36 @@ export default { ...@@ -147,6 +197,36 @@ export default {
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' }, { required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' }, { required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
], ],
formitem: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
formitem1: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
formitem2: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
formitem3: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
formitem4: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
formitem5: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
exampleid: [ exampleid: [
{ type: 'string', message: '示例标识 值必须为字符串类型', trigger: 'change' }, { type: 'string', message: '示例标识 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '示例标识 值不能为空', trigger: 'change' }, { required: false, type: 'string', message: '示例标识 值不能为空', trigger: 'change' },
...@@ -276,6 +356,13 @@ export default { ...@@ -276,6 +356,13 @@ export default {
}, },
onFormDataChanged(val,oldVal){ onFormDataChanged(val,oldVal){
......
<template> <template>
<div class="app-form"> <div class="app-form">
<a-form class="" style=""> <a-form class=" app-info-form" style="">
<a-row> <a-row>
<a-tabs @change="formPageSelected">
</a-tabs> <div style="height: 100%;display: flex;">
<div v-show="this.detailsModel.tabpanel1.visible" style="flex-grow:1;">
<a-tabs defaultActiveKey="tabpage1" v-show="this.detailsModel.tabpanel1.visible" class="" @change="formPageSelected">
<a-tab-pane key="tabpage1" class="app-form-page-panel " style="">
<span slot="tab">
分页面板
</span>
</a-tab-pane>
<a-tab-pane key="tabpage2" class="app-form-page-panel " style="">
<span slot="tab">
分页面板
</span>
</a-tab-pane>
</a-tabs>
</div>
<div v-show="this.detailsModel.grouppanel1.visible" style="flex-grow:1;width: 0px;">
<div class="app-form-group app-form-group-grouppanel1 app-info-form-group" style="">
<a-collapse v-model="activeGroup">
<a-collapse-panel key="grouppanel1">
<template slot="header">
分组面板
</template>
<div class="app-form-group-content" style="">
<div style="height: 100%;display: flex;">
</div>
</div>
</a-collapse-panel>
</a-collapse>
</div>
</div>
</div>
</a-row> </a-row>
</a-form> </a-form>
</div> </div>
...@@ -43,7 +82,7 @@ export default { ...@@ -43,7 +82,7 @@ export default {
* 激活分组 * 激活分组
* *
*/ */
activeGroup:[], activeGroup:["grouppanel1",],
/** /**
* 激活分组 * 激活分组
...@@ -66,6 +105,16 @@ export default { ...@@ -66,6 +105,16 @@ export default {
* *
*/ */
detailsModel:{ detailsModel:{
tabpage1: new FormTabPageModel({ caption: '分页面板', detailType: 'TABPAGE', name: 'tabpage1', visible: true, isShowCaption: true, form: this })
,
tabpage2: new FormTabPageModel({ caption: '分页面板', detailType: 'TABPAGE', name: 'tabpage2', visible: true, isShowCaption: true, form: this })
,
tabpanel1: new FormTabPanelModel({ caption: '', detailType: 'TABPANEL', name: 'tabpanel1', visible: true, isShowCaption: false, form: this, tabPages: [{ name: 'tabpage1', index: 0, visible: true }, { name: 'tabpage2', index: 1, visible: true }] })
,
grouppanel1: new FormGroupPanelModel({ caption: '分组面板', detailType: 'GROUPPANEL', name: 'grouppanel1', visible: true, isShowCaption: true, form: this, uiActionGroup: { caption: '', langbase: '', extractMode: 'ITEM', details: [] } })
,
formpage1: new FormPageModel({ caption: '表单分页', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
,
srfupdatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 }) srfupdatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
, ,
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 }) srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
...@@ -84,7 +133,6 @@ export default { ...@@ -84,7 +133,6 @@ export default {
, ,
exampleid: new FormItemModel({ caption: '示例标识', detailType: 'FORMITEM', name: 'exampleid', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 }) exampleid: new FormItemModel({ caption: '示例标识', detailType: 'FORMITEM', name: 'exampleid', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
, ,
form: new FormTabPanelModel({ caption: 'form', detailType: 'TABPANEL', name: 'form', visible: true, isShowCaption: true, form: this, tabPages: [] }),
}, },
/** /**
...@@ -276,6 +324,11 @@ export default { ...@@ -276,6 +324,11 @@ export default {
}, },
onFormDataChanged(val,oldVal){ onFormDataChanged(val,oldVal){
......
<template>
<div class="app-form">
<a-form class="" style="">
<a-row>
<a-tabs @change="formPageSelected">
</a-tabs>
</a-row>
</a-form>
</div>
</template>
<script>
import { FormButtonModel,FormDetailModel,FormItemModel,FormDRUIPartModel,FormGroupPanelModel,FormIFrameModel,FormPageModel,FormPartModel,FormRowItemModel,FormTabPageModel,FormTabPanelModel,FormUserControlModel} from "@models/index.js";
import Schema from "async-validator";
import ComUtil from '@utils/ComUtil';
import AppService from "@service/AppService";
export default {
name: "Main4form",
props:{
formData:Object
},
watch: {
'formData': {
handler: 'onFormDataChanged',
immediate: true,
deep: true
}
},
data() {
return {
/**
* 当前语言
*
*/
local:"",
/**
* 激活分组
*
*/
activeGroup:[],
/**
* 激活分组
*
*/
data:{
srfupdatedate: null,
srforikey: null,
srfkey: null,
srfmajortext: null,
srftempmode: null,
srfuf: null,
srfdeid: null,
srfsourcekey: null,
exampleid: null,
},
/**
* 表单模型
*
*/
detailsModel:{
srfupdatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
,
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
,
srfkey: new FormItemModel({ caption: '示例标识', detailType: 'FORMITEM', name: 'srfkey', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
,
srfmajortext: new FormItemModel({ caption: '示例名称', detailType: 'FORMITEM', name: 'srfmajortext', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
,
srftempmode: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srftempmode', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
,
srfuf: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfuf', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
,
srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
,
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
,
exampleid: new FormItemModel({ caption: '示例标识', detailType: 'FORMITEM', name: 'exampleid', visible: true, isShowCaption: true, form: this, disabled: false,validateStatus:"",error:"",required:false,enableCond: 3 })
,
form: new FormTabPanelModel({ caption: 'form', detailType: 'TABPANEL', name: 'form', visible: true, isShowCaption: true, form: this, tabPages: [] }),
},
/**
* 代码表模型
*
*/
codelistModel:{
},
/**
* 表单值规则
*
*/
formRules:{
},
/**
* 默认值规则
*
*/
rules:{
srfupdatedate: [
{ type: 'string', message: '更新时间 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '更新时间 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '更新时间 值不能为空', trigger: 'blur' },
],
srforikey: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfkey: [
{ type: 'string', message: '示例标识 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '示例标识 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '示例标识 值不能为空', trigger: 'blur' },
],
srfmajortext: [
{ type: 'string', message: '示例名称 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '示例名称 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '示例名称 值不能为空', trigger: 'blur' },
],
srftempmode: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfuf: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfdeid: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfsourcekey: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
exampleid: [
{ type: 'string', message: '示例标识 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '示例标识 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '示例标识 值不能为空', trigger: 'blur' },
],
}
};
},
created(){
this.initForm();
this.initlangu();
},
methods: {
/**
* 初始化表单
*
*/
initForm(){
if(Object.keys(this.data).length >0){
Object.keys(this.data).forEach((item) =>{
this.formItemChange(item,this.data[item],true);
})
}
},
/**
* 初始化语言
*
*/
initlangu(){
if (Object.is(window.localStorage.getItem("curLang"), "zh")) {
this.local ="zh_CN";
} else {
this.local ="en_GB";
}
AppService.getInstance().subject.subscribe(res => {
if (Object.is(res, "zh")) {
this.local ="zh_CN";
} else {
this.local ="en_GB";
}
});
},
/**
* 分页选中
*
*/
formPageSelected(key){
console.log("表单选中了"+key);
},
/**
* 按钮点击事件
*
*/
button_click($event,caption){
this.$message.success("点击了"+caption);
},
/**
* 表单项值变化
*
*/
formItemChange(name,value,isFirst){
this.formLogic(name,value);
if(!isFirst){
this.validateItem(name, value);
this.$emit('formItemChange',{name:name,value:value});
}
},
/**
* 校验单个表单项
* @param item
* @param value
*/
validateItem(item, value) {
// 做校验
// 1.获取数值和规则
const rule = this.rules[item];
// 2.创建校验规则
const schema = new Schema({ [item]: rule })
// 校验返回Promise
return schema.validate({ [item]: value },undefined,errors => {
if (errors) {
// 有错
this.detailsModel[item].setError(errors[0].message);
} else {
this.detailsModel[item].setError('');
}
})
},
/**
* 校验表单
*
* @memberof Main
*/
validateForm(callback) {
let tasks;
if (Object.keys(this.data).length > 0) {
tasks = Object.keys(this.data).map((item) => {
this.validateItem(item, this.data[item]);
})
}
Promise.all(tasks)
.then(() => callback(true))
.catch(() => callback(false))
},
/**
* 表单逻辑
*
*/
formLogic( name, newVal, oldVal) {
},
onFormDataChanged(val,oldVal){
if(val && val !== oldVal){
Object.keys(this.data).forEach(item =>{
this.data[item] = null;
})
Object.assign(this.data,val);
}
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<Main4form :formData="formData" @formItemChange="formItemChange"></Main4form></div>
</template>
<script>
import Main4form from '@forms/example/main4/main4.vue';
export default {
name: "ExampleMain4EditView",
components: {
Main4form
},
data(){
return {
formData:{
"bookname":"test1",
"input":"文本test",
"label":"标签test",
"group1":"书籍基本信息test",
"formpage1":"基本信息test",
"createman":"建立人test",
"createdate":"建立时间test",
"updateman":"更新人test",
"updatedate":"更新时间test",
"group2":"操作信息test",
"formpage2":"其它test"
}
}
},
methods:{
formItemChange(value){
console.log(value);
}
}
}
</script>
<style scoped>
</style>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册