Commit 19f9ba4c authored by 王纵's avatar 王纵

兼容vue3

parent a91c95ae
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12 * @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-15 14:29:52 * @LastEditTime: 2024-08-19 11:20:44
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 动态渲染-复选框组件 * @Description: 动态渲染-复选框组件
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -21,7 +21,9 @@ ...@@ -21,7 +21,9 @@
:name="name" :name="name"
:rules="[{ required, message: `请填写${label}` }]" :rules="[{ required, message: `请填写${label}` }]"
> >
<d-label :label="label" :help="help" slot="label" /> <template #label>
<d-label :label="label" :help="help" />
</template>
<template #input> <template #input>
<van-checkbox v-model="currentValue" @change="checked" :disabled="disabled" /> <van-checkbox v-model="currentValue" @change="checked" :disabled="disabled" />
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12 * @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-15 11:47:06 * @LastEditTime: 2024-08-19 11:20:34
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 动态渲染-文本框组件 * @Description: 动态渲染-文本框组件
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -24,7 +24,9 @@ ...@@ -24,7 +24,9 @@
:error="false" :error="false"
clear-trigger="always" clear-trigger="always"
> >
<d-label :label="label" :help="help" slot="label" /> <template #label>
<d-label :label="label" :help="help" />
</template>
</van-field> </van-field>
</div> </div>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12 * @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-15 17:01:36 * @LastEditTime: 2024-08-19 11:20:56
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 动态渲染-日期组件 * @Description: 动态渲染-日期组件
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -29,8 +29,11 @@ ...@@ -29,8 +29,11 @@
:rules="[{ required, message: `请选择${label}` }]" :rules="[{ required, message: `请选择${label}` }]"
:error="false" :error="false"
> >
<d-label :label="label" :help="help" slot="label" /> <template #label>
<template slot="right-icon"> <d-label :label="label" :help="help" />
</template>
<template #right-icon>
<van-icon name="clear" v-show="!disabled && clearable && currentValue" @click="clear"/> <van-icon name="clear" v-show="!disabled && clearable && currentValue" @click="clear"/>
<img src="../../../assets/date-icon.png" alt="" class="right-icon" v-show="!disabled"/> <img src="../../../assets/date-icon.png" alt="" class="right-icon" v-show="!disabled"/>
</template> </template>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12 * @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-15 12:09:45 * @LastEditTime: 2024-08-19 11:22:50
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 动态渲染-文本框组件 * @Description: 动态渲染-文本框组件
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -23,8 +23,13 @@ ...@@ -23,8 +23,13 @@
:class="type === 'TextArea' ? 'd-form-textarea' : ''" :class="type === 'TextArea' ? 'd-form-textarea' : ''"
clear-trigger="always" clear-trigger="always"
> >
<d-label :label="label" :help="help" slot="label" /> <template #label>
<span slot="extra" v-if="type === 'CentField'">%</span> <d-label :label="label" :help="help" />
</template>
<template #extra>
<span v-if="type === 'CentField'">%</span>
</template>
</van-field> </van-field>
</div> </div>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12 * @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-19 10:58:15 * @LastEditTime: 2024-08-19 11:21:18
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 动态渲染-Lov * @Description: 动态渲染-Lov
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -31,14 +31,17 @@ ...@@ -31,14 +31,17 @@
:required="required" :required="required"
:rules="[{ required, message: `请选择${label}` }]" :rules="[{ required, message: `请选择${label}` }]"
> >
<d-label :label="label" :help="help" slot="label" /> <template #label>
<d-label :label="label" :help="help" />
</template>
<template #input> <template #input>
<div @click="changeVisible(true)" class="cell-value"> <div @click="changeVisible(true)" class="cell-value">
<span v-if="!currentValue || currentValue.length === 0" class="placeholder">{{disabled ? '' : '请选择'}}</span> <span v-if="!currentValue || currentValue.length === 0" class="placeholder">{{disabled ? '' : '请选择'}}</span>
<span v-else>{{valueDisplay()}}</span> <span v-else>{{valueDisplay()}}</span>
</div> </div>
</template> </template>
<template slot="right-icon" > <template #right-icon >
<van-icon name="clear" v-show="!disabled && clearable && !(!currentValue || currentValue.length === 0)" @click="clear"/> <van-icon name="clear" v-show="!disabled && clearable && !(!currentValue || currentValue.length === 0)" @click="clear"/>
<van-icon name="arrow" v-show="!disabled" /> <van-icon name="arrow" v-show="!disabled" />
</template> </template>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12 * @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-19 11:01:14 * @LastEditTime: 2024-08-19 11:22:10
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 动态渲染-Select * @Description: 动态渲染-Select
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -29,14 +29,16 @@ ...@@ -29,14 +29,16 @@
:required="required" :required="required"
:rules="[{ required, message: `请选择${label}` }]" :rules="[{ required, message: `请选择${label}` }]"
> >
<d-label :label="label" :help="help" slot="label" /> <template #label>
<d-label :label="label" :help="help" />
</template>
<template #input> <template #input>
<div @click="showSelectOption(true)" class="cell-value"> <div @click="showSelectOption(true)" class="cell-value">
<span v-if="!(currentValue.length || currentValue.meaning)" class="placeholder">{{disabled ? '' : '请选择'}}</span> <span v-if="!(currentValue.length || currentValue.meaning)" class="placeholder">{{disabled ? '' : '请选择'}}</span>
<span v-else>{{valueDisplay()}}</span> <span v-else>{{valueDisplay()}}</span>
</div> </div>
</template> </template>
<template slot="right-icon" > <template #right-icon >
<van-icon name="clear" v-show="!disabled && clearable && (currentValue.length || currentValue.meaning)" @click="clear"/> <van-icon name="clear" v-show="!disabled && clearable && (currentValue.length || currentValue.meaning)" @click="clear"/>
<van-icon name="arrow" v-show="!disabled"/> <van-icon name="arrow" v-show="!disabled"/>
</template> </template>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12 * @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-15 14:31:20 * @LastEditTime: 2024-08-19 11:22:20
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 动态渲染-开关组件 * @Description: 动态渲染-开关组件
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -21,7 +21,9 @@ ...@@ -21,7 +21,9 @@
:required="required" :required="required"
:rules="[{ required, message: `请填写${label}` }]" :rules="[{ required, message: `请填写${label}` }]"
> >
<d-label :label="label" :help="help" slot="label" /> <template #label>
<d-label :label="label" :help="help" />
</template>
<template #input> <template #input>
<van-switch v-model="currentValue" @change="checked" :disabled="disabled" size="19" /> <van-switch v-model="currentValue" @change="checked" :disabled="disabled" size="19" />
</template> </template>
......
...@@ -2,14 +2,16 @@ ...@@ -2,14 +2,16 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12 * @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-16 15:27:59 * @LastEditTime: 2024-08-19 11:22:26
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 动态渲染-超链接组件 * @Description: 动态渲染-超链接组件
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
--> -->
<template> <template>
<van-cell center class="d-form-item d-url" :required="required"> <van-cell center class="d-form-item d-url" :required="required">
<d-label :label="label" :help="help" slot="title" /> <template #label>
<d-label :label="label" :help="help" />
</template>
<d-custom-render <d-custom-render
:getData="getCurrentRecord" :getData="getCurrentRecord"
:renderer="renderer" :renderer="renderer"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-07-30 09:41:54 * @Date: 2024-07-30 09:41:54
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-19 11:18:32 * @LastEditTime: 2024-08-19 11:46:32
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 表格列渲染 * @Description: 表格列渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -52,8 +52,7 @@ const DTableTd = { ...@@ -52,8 +52,7 @@ const DTableTd = {
render: function (h, context) { render: function (h, context) {
return this.tdRender ? return this.tdRender ?
this.tdRender(this.record, this.index) : this.tdRender(this.record, this.index) :
<span><slot>{this.columnValue() || '--'}</slot></span> <span>{this.$slots.default || (this.columnValue() || '--')}</span>
// <span>{this.$slots.default || (this.columnValue() || '--')}</span>
} }
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 10:51:56 * @Date: 2024-07-29 10:51:56
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-19 11:17:46 * @LastEditTime: 2024-08-19 14:48:59
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 表格渲染 * @Description: 表格渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
:index="pIndex" :index="pIndex"
:typeDisplay="column.validationTypeDisplay" :typeDisplay="column.validationTypeDisplay"
> >
<template #default> <template #default v-if="dateType[column.dataType] || booleanType.includes(column.validationTypeDisplay)">
<fragment v-if="booleanType.includes(column.validationTypeDisplay)" > <fragment v-if="booleanType.includes(column.validationTypeDisplay)" >
{{booleanDisplay[item[column.columnName]] || '--'}} {{booleanDisplay[item[column.columnName]] || '--'}}
</fragment> </fragment>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-08-02 15:32:36 * @Date: 2024-08-02 15:32:36
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-16 10:08:37 * @LastEditTime: 2024-08-19 14:48:45
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: 组件头部渲染 * @Description: 组件头部渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-07-30 09:41:54 * @Date: 2024-07-30 09:41:54
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-16 09:59:16 * @LastEditTime: 2024-08-19 14:40:12
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: * @Description:
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -128,7 +128,7 @@ const ConfigRenderComponent = { ...@@ -128,7 +128,7 @@ const ConfigRenderComponent = {
render: function (h, context) { render: function (h, context) {
// console.log('context', context, this.configInfo) // console.log('context', context, this.configInfo)
const { layoutCode, layoutTabs = [] } = this.configInfo; const { layoutCode, layoutTabs = [] } = this.configInfo;
return <div style="height: 100%">{layoutTabs.length ? this.getTabs(layoutTabs, this, layoutCode, h) : null}</div>; return <div style="height: 100%;display: flex; flex-direction: column">{layoutTabs.length ? this.getTabs(layoutTabs, this, layoutCode, h) : null}</div>;
} }
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 10:51:56 * @Date: 2024-07-29 10:51:56
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-16 11:39:59 * @LastEditTime: 2024-08-19 14:27:15
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: * @Description:
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -10,10 +10,13 @@ ...@@ -10,10 +10,13 @@
<template> <template>
<d-view> <d-view>
<d-header> <van-nav-bar
<i class="ion-ios-arrow-back" v-if="needBack" slot="left" @click.native="$routeGo()"/> v-if="showTitle"
<div slot="center">{{configDatas.description}}</div> :title="configDatas.description"
</d-header> left-arrow
@click-left="backClick"
safe-area-inset-top
/>
<d-content> <d-content>
<van-loading size="24px" vertical v-if="loading">加载中...</van-loading> <van-loading size="24px" vertical v-if="loading">加载中...</van-loading>
<config-render-component <config-render-component
...@@ -32,7 +35,7 @@ ...@@ -32,7 +35,7 @@
</template> </template>
<script> <script>
import {Loading} from 'vant'; import {NavBar, Loading} from 'vant';
import {DView, DHeader, DContent, DScroll} from './LayoutComponents'; import {DView, DHeader, DContent, DScroll} from './LayoutComponents';
import LayoutButtons from './LayoutButtons'; import LayoutButtons from './LayoutButtons';
import ConfigRenderComponent from './ConfigRenderComponent/index.jsx'; import ConfigRenderComponent from './ConfigRenderComponent/index.jsx';
...@@ -44,6 +47,7 @@ export default { ...@@ -44,6 +47,7 @@ export default {
name: 'Dynamic', name: 'Dynamic',
components: { components: {
[Loading.name]: Loading, [Loading.name]: Loading,
[NavBar.name]: NavBar,
LayoutButtons, LayoutButtons,
ConfigRenderComponent, ConfigRenderComponent,
DView, DView,
...@@ -60,6 +64,10 @@ export default { ...@@ -60,6 +64,10 @@ export default {
type: Boolean, type: Boolean,
default: true default: true
}, },
showTitle: { // 显示标题
type: Boolean,
default: true
},
componentRenderers: { // 组件渲染 componentRenderers: { // 组件渲染
type: Array, type: Array,
default: () => [] default: () => []
...@@ -109,7 +117,6 @@ export default { ...@@ -109,7 +117,6 @@ export default {
}; };
}, },
created() { created() {
window.localStorage.setItem('access_token', '4b20ae48-aeac-4811-be76-85fb07a346b1');
this.params = { this.params = {
...this.$route.params, ...this.$route.params,
...this.$route.query ...this.$route.query
...@@ -188,6 +195,13 @@ export default { ...@@ -188,6 +195,13 @@ export default {
EventBus: EventBus EventBus: EventBus
// componentRenderers: this.componentRenderers // 组件渲染内容 // componentRenderers: this.componentRenderers // 组件渲染内容
} }
},
backClick() {
if (this.$attrs['onGoBack']) {
this.$emit('goBack');
} else {
if (window.history.state.position > 0) return window.history.back();
}
} }
}, },
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com * @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 11:02:22 * @Date: 2024-07-29 11:02:22
* @LastEditors: zong.wang01@hand-china.com * @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-15 17:43:42 * @LastEditTime: 2024-08-19 14:27:09
* @Version: 1.0.0 * @Version: 1.0.0
* @Description: * @Description:
* @Copyright: Copyright (c) 2021, Hand-RongJing * @Copyright: Copyright (c) 2021, Hand-RongJing
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<template> <template>
<Dynamic <Dynamic
layoutCode="CN001" layoutCode="CN001"
:showTitle="true"
:componentRenderers="componentRenderers" :componentRenderers="componentRenderers"
:configLoadHandle="configLoadHandle" :configLoadHandle="configLoadHandle"
:dataLoadHandle="dataLoadHandle" :dataLoadHandle="dataLoadHandle"
...@@ -39,6 +40,9 @@ export default { ...@@ -39,6 +40,9 @@ export default {
] ]
} }
}, },
created() {
window.localStorage.setItem('access_token', '6cb71898-2af9-4c27-a042-b9887b0675f4');
},
methods: { methods: {
configLoadHandle(config) { // 查询配置信息之后的回调 configLoadHandle(config) { // 查询配置信息之后的回调
console.log('configLoadHandle', config) console.log('configLoadHandle', config)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment