Blame view

pages/apply/dynamicModel/index.vue 1.87 KB
290144e9   易尊强   第一次
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  <template>
  	<view class="dynamicModel-v">
  		<template v-if="showPage">
  			<template v-if="webType==1">
  				<Form :config="config" :modelId="modelId" :isPreview="isPreview" />
  			</template>
  			<template v-if="webType==2||webType==3">
  				<List :config="config" :modelId="modelId" :isPreview="isPreview" :title="title" />
  			</template>
  			
  			<!-- <Form :config="config" :modelId="modelId" :isPreview="isPreview" /> -->
  		</template>
  	</view>
  </template>
  
  <script>
  	import Form from './components/form/index.vue'
  	import List from './components/list/index.vue'
  	import request from '@/utils/request.js'
  	import {
  		getConfigData
  	} from '@/api/apply/visualDev'
  	export default {
  		name: 'dynamicModel',
  		components: {
  			Form,
  			List
  		},
  		data() {
  			return {
  				webType: '',
  				showPage: false,
  				isPreview: '0',
  				modelId: '',
  				title: '',
  				config: {}
  			}
  		},
  		onLoad(option) {
  			this.modelId = option.id;
  			// this.modelId = 'e6d2b9f4b7364a11913e866ff3256d9c';
  			this.isPreview = option.isPreview || '0';
  			this.title = option.fullName || '';
  			this.getConfigData()
  		},
  		methods: {
  			getConfigData() {
  				request({
  					url: `/api/visualdev/Base/${this.modelId}`,
  					method: 'get',
  					data: {},
  				}).then(res => {
80d8fbe3   易尊强   2/29下午
53
  					console.log("表单",res)
290144e9   易尊强   第一次
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
  					if (res.code !== 200 || !res.data) {
  						uni.showToast({
  							title: '暂无此页面',
  							icon: 'none',
  							// complete: () => {
  							// 	setTimeout(() => {
  							// 		uni.navigateBack()
  							// 	}, 1500)
  							// }
  						})
  						return
  					}
  					this.config = res.data
  					this.webType = res.data.webType || '2'
  					this.title = this.title ? this.title : res.data.fullName
  					uni.setNavigationBarTitle({
  						title: this.title
  					})
  					this.showPage = true
  				})
  			}
  		}
  	}
  </script>
  
  <style lang="scss">
  	page {
  		background-color: #f0f2f6;
  	}
  
  	.dynamicModel-v {
  		height: 100%;
  	}
  </style>