yqform-edit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +20 -0
- package/LICENSE +21 -0
- package/README.md +27 -0
- package/dist/demo.html +10 -0
- package/dist/fonts/element-icons.535877f5.woff +0 -0
- package/dist/fonts/element-icons.732389de.ttf +0 -0
- package/dist/yqform-edit.common.js +73796 -0
- package/dist/yqform-edit.css +1 -0
- package/dist/yqform-edit.umd.js +73806 -0
- package/dist/yqform-edit.umd.min.js +23 -0
- package/package.json +59 -0
- package/src/App.vue +126 -0
- package/src/assets/global.scss +12 -0
- package/src/assets/images/content/add.png +0 -0
- package/src/assets/images/content/arrow-left.png +0 -0
- package/src/assets/images/content/arrow-right.png +0 -0
- package/src/assets/images/content/delete.png +0 -0
- package/src/assets/images/content/edit.png +0 -0
- package/src/assets/images/content/electricity.png +0 -0
- package/src/assets/images/content/item_plus.png +0 -0
- package/src/assets/images/content/radio_checked.png +0 -0
- package/src/assets/images/content/radio_uncheck.png +0 -0
- package/src/assets/images/content/slider_btn.png +0 -0
- package/src/assets/images/content/wifi.png +0 -0
- package/src/assets/logo.png +0 -0
- package/src/components/common/content/components/form-item/components/Picker.vue +144 -0
- package/src/components/common/content/components/form-item/form-item.vue +829 -0
- package/src/components/common/content/components/form-item/index.js +5 -0
- package/src/components/common/content/components/input-box/input-box.vue +29 -0
- package/src/components/common/content/content.vue +504 -0
- package/src/components/common/content/index.js +5 -0
- package/src/components/common/rightConfig/formConfig.vue +319 -0
- package/src/components/dynamic-form/components/component-content.vue +530 -0
- package/src/components/dynamic-form/components/component-options.vue +1112 -0
- package/src/components/dynamic-form/components/component-type.vue +588 -0
- package/src/components/dynamic-form/dynamic-form.vue +120 -0
- package/src/components/dynamic-form/index.js +40 -0
- package/src/index.js +69 -0
- package/src/main.js +62 -0
- package/src/store/e7ingForm.js +10 -0
- package/src/store/getters.js +22 -0
- package/src/store/index.js +10 -0
- package/src/store/mutations.js +106 -0
- package/src/store/state.js +321 -0
- package/src/utils/index.js +23 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import DynamicForm from './dynamic-form'
|
|
2
|
+
// import store from '../../store/index'
|
|
3
|
+
import 'element-ui/lib/theme-chalk/index.css'
|
|
4
|
+
|
|
5
|
+
const components = [DynamicForm]
|
|
6
|
+
|
|
7
|
+
/* DynamicForm.install = (Vue) => {
|
|
8
|
+
Vue.component(DynamicForm.name, DynamicForm)
|
|
9
|
+
} */
|
|
10
|
+
|
|
11
|
+
/* const install = function (Vue) {
|
|
12
|
+
// 全局注册所有的组件
|
|
13
|
+
components.forEach(item => { Vue.component(item.name, item) })
|
|
14
|
+
}
|
|
15
|
+
if (typeof window !== 'undefined' && window.Vue) {
|
|
16
|
+
install(window.Vue)
|
|
17
|
+
} */
|
|
18
|
+
|
|
19
|
+
// 这一步判断window.Vue是否存在,因为直接引用vue.min.js, 它会把Vue绑到Window上,我们直接引用打包好的js才能正常跑起来。
|
|
20
|
+
if (typeof window !== "undefined" && window.Vue) {
|
|
21
|
+
window.Vue.component("v-drawer", components);
|
|
22
|
+
}
|
|
23
|
+
// opts是用户传入的store
|
|
24
|
+
const install = function(Vue) {
|
|
25
|
+
/* if (!opts.store) {
|
|
26
|
+
console.log("Please provide a store!");
|
|
27
|
+
}
|
|
28
|
+
// 动态注册store
|
|
29
|
+
opts.registerModule("store", store); */
|
|
30
|
+
|
|
31
|
+
components.map(component => {
|
|
32
|
+
Vue.component(component.name, component);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
if (typeof window !== "undefined" && window.Vue) {
|
|
37
|
+
install(window.Vue);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default { install, DynamicForm }
|
package/src/index.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import E7ingForm from './App.vue'
|
|
3
|
+
import formStore from './store/e7ingForm.js'
|
|
4
|
+
import 'vant/lib/index.css'
|
|
5
|
+
import 'element-ui/lib/theme-chalk/index.css'
|
|
6
|
+
import './assets/global.scss'
|
|
7
|
+
import '@vant/touch-emulator'
|
|
8
|
+
import {
|
|
9
|
+
Area,
|
|
10
|
+
Button,
|
|
11
|
+
Checkbox,
|
|
12
|
+
CheckboxGroup,
|
|
13
|
+
DatetimePicker,
|
|
14
|
+
CellGroup,
|
|
15
|
+
Field,
|
|
16
|
+
Icon,
|
|
17
|
+
Picker,
|
|
18
|
+
Popup,
|
|
19
|
+
Radio,
|
|
20
|
+
RadioGroup,
|
|
21
|
+
Rate,
|
|
22
|
+
Slider,
|
|
23
|
+
Switch,
|
|
24
|
+
Uploader,
|
|
25
|
+
Calendar,
|
|
26
|
+
Image as VanImage,
|
|
27
|
+
DropdownMenu,
|
|
28
|
+
DropdownItem
|
|
29
|
+
} from 'vant'
|
|
30
|
+
import {
|
|
31
|
+
DatePicker,
|
|
32
|
+
Dialog,
|
|
33
|
+
Tooltip,
|
|
34
|
+
TimePicker,
|
|
35
|
+
Cascader,
|
|
36
|
+
Upload,
|
|
37
|
+
Select,
|
|
38
|
+
Option,
|
|
39
|
+
Popover,
|
|
40
|
+
Input
|
|
41
|
+
} from 'element-ui'
|
|
42
|
+
|
|
43
|
+
const vantComponents = [Button, Field, Icon, Switch, Picker, Popup, RadioGroup,
|
|
44
|
+
Radio, Checkbox, CheckboxGroup, DatetimePicker, Uploader, Rate, Slider, Area,
|
|
45
|
+
CellGroup, Calendar, VanImage, DropdownMenu, DropdownItem]
|
|
46
|
+
const elementComponent = [DatePicker, Dialog, Tooltip, TimePicker, Cascader, Upload, Select, Option, Popover, Input]
|
|
47
|
+
vantComponents.forEach(item => Vue.use(item))
|
|
48
|
+
elementComponent.forEach(item => Vue.use(item))
|
|
49
|
+
|
|
50
|
+
Vue.config.productionTip = false
|
|
51
|
+
|
|
52
|
+
const components = [E7ingForm]
|
|
53
|
+
|
|
54
|
+
const install = function(Vue, opts = {}) {
|
|
55
|
+
if (!opts.store) {
|
|
56
|
+
console.log("请为组件传入一个store!", opts);
|
|
57
|
+
}
|
|
58
|
+
components.map(component => {
|
|
59
|
+
Vue.component(component.name, component);
|
|
60
|
+
});
|
|
61
|
+
// 将表单组件中的store注册到父组件中
|
|
62
|
+
opts.store?.registerModule("e7ingForm", formStore);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
if (typeof window !== "undefined" && window.Vue) {
|
|
66
|
+
install(window.Vue);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default { install, E7ingForm }
|
package/src/main.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import E7ingForm from './App.vue'
|
|
3
|
+
import store from './store'
|
|
4
|
+
import 'vant/lib/index.css'
|
|
5
|
+
import 'element-ui/lib/theme-chalk/index.css'
|
|
6
|
+
import './assets/global.scss'
|
|
7
|
+
import '@vant/touch-emulator'
|
|
8
|
+
import {
|
|
9
|
+
Area,
|
|
10
|
+
Button,
|
|
11
|
+
Checkbox,
|
|
12
|
+
CheckboxGroup,
|
|
13
|
+
DatetimePicker,
|
|
14
|
+
CellGroup,
|
|
15
|
+
Field,
|
|
16
|
+
Icon,
|
|
17
|
+
Picker,
|
|
18
|
+
Popup,
|
|
19
|
+
Radio,
|
|
20
|
+
RadioGroup,
|
|
21
|
+
Rate,
|
|
22
|
+
Slider,
|
|
23
|
+
Switch,
|
|
24
|
+
Uploader,
|
|
25
|
+
Calendar,
|
|
26
|
+
Image as VanImage,
|
|
27
|
+
DropdownMenu,
|
|
28
|
+
DropdownItem,
|
|
29
|
+
} from 'vant'
|
|
30
|
+
import { DatePicker, Dialog, Tooltip, TimePicker, Cascader, Upload, Select, Option, Popover, Input } from 'element-ui'
|
|
31
|
+
|
|
32
|
+
const vantComponents = [
|
|
33
|
+
Button,
|
|
34
|
+
Field,
|
|
35
|
+
Icon,
|
|
36
|
+
Switch,
|
|
37
|
+
Picker,
|
|
38
|
+
Popup,
|
|
39
|
+
RadioGroup,
|
|
40
|
+
Radio,
|
|
41
|
+
Checkbox,
|
|
42
|
+
CheckboxGroup,
|
|
43
|
+
DatetimePicker,
|
|
44
|
+
Uploader,
|
|
45
|
+
Rate,
|
|
46
|
+
Slider,
|
|
47
|
+
Area,
|
|
48
|
+
CellGroup,
|
|
49
|
+
Calendar,
|
|
50
|
+
VanImage,
|
|
51
|
+
DropdownMenu,
|
|
52
|
+
DropdownItem,
|
|
53
|
+
]
|
|
54
|
+
const elementComponent = [DatePicker, Dialog, Tooltip, TimePicker, Cascader, Upload, Select, Option, Popover, Input]
|
|
55
|
+
vantComponents.forEach((item) => Vue.use(item))
|
|
56
|
+
elementComponent.forEach((item) => Vue.use(item))
|
|
57
|
+
|
|
58
|
+
Vue.config.productionTip = false
|
|
59
|
+
new Vue({
|
|
60
|
+
store,
|
|
61
|
+
render: (h) => h(E7ingForm),
|
|
62
|
+
}).$mount('#app')
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
// 当前页数据
|
|
3
|
+
// currentPage: (state) => {
|
|
4
|
+
// return state.form.groups[state.currentPageIndex]
|
|
5
|
+
// },
|
|
6
|
+
// // 当前表单的信息
|
|
7
|
+
// currentFormSpec: (state) => {
|
|
8
|
+
// return state.form.spec
|
|
9
|
+
// },
|
|
10
|
+
// // 当前分组信息
|
|
11
|
+
// currentSpec: (state) => {
|
|
12
|
+
// return state.form.groups[state.currentPageIndex].spec
|
|
13
|
+
// },
|
|
14
|
+
// // 当前选中的表单项
|
|
15
|
+
// currentItem: (state) => {
|
|
16
|
+
// return state.form.groups[state.currentPageIndex].items.find((item) => item.key === state.currentItemKey)
|
|
17
|
+
// },
|
|
18
|
+
// // 总页数
|
|
19
|
+
// totalPage: (state) => {
|
|
20
|
+
// return state.form.groups.length
|
|
21
|
+
// }
|
|
22
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// import { generateGid } from '@/utils'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
// 页码归位
|
|
5
|
+
// resetPage(state) {
|
|
6
|
+
// state.currentPageIndex = 0
|
|
7
|
+
// state.currentItemKey = ''
|
|
8
|
+
// },
|
|
9
|
+
// // 跳转到指定页
|
|
10
|
+
// goPage(state, value) {
|
|
11
|
+
// state.currentPageIndex = value
|
|
12
|
+
// },
|
|
13
|
+
// /** 下一页 */
|
|
14
|
+
// nextPage(state) {
|
|
15
|
+
// state.currentPageIndex++
|
|
16
|
+
// state.currentItemKey = ''
|
|
17
|
+
// },
|
|
18
|
+
// /** 上一页 */
|
|
19
|
+
// prevPage(state) {
|
|
20
|
+
// state.currentPageIndex--
|
|
21
|
+
// state.currentItemKey = ''
|
|
22
|
+
// },
|
|
23
|
+
// /** 删除页面 */
|
|
24
|
+
// removePage(state) {
|
|
25
|
+
// state.form.groups.splice(state.currentPageIndex, 1)
|
|
26
|
+
// if (state.currentPageIndex === state.form.groups.length) {
|
|
27
|
+
// state.currentPageIndex--
|
|
28
|
+
// }
|
|
29
|
+
// },
|
|
30
|
+
// /** 前移页面 */
|
|
31
|
+
// forwardPage(state) {
|
|
32
|
+
// let data = state.form.groups[state.currentPageIndex - 1]
|
|
33
|
+
// state.form.groups[state.currentPageIndex - 1] = state.form.groups[state.currentPageIndex]
|
|
34
|
+
// state.form.groups[state.currentPageIndex] = data
|
|
35
|
+
// state.movePage++
|
|
36
|
+
// },
|
|
37
|
+
// /** 后移页面 */
|
|
38
|
+
// backwardsPage(state) {
|
|
39
|
+
// let data = state.form.groups[state.currentPageIndex + 1]
|
|
40
|
+
// state.form.groups[state.currentPageIndex + 1] = state.form.groups[state.currentPageIndex]
|
|
41
|
+
// state.form.groups[state.currentPageIndex] = data
|
|
42
|
+
// state.movePage++
|
|
43
|
+
// },
|
|
44
|
+
// /** 创建页面 */
|
|
45
|
+
// createPage(state) {
|
|
46
|
+
// state.form.groups.push({
|
|
47
|
+
// gid: generateGid(),
|
|
48
|
+
// spec: {
|
|
49
|
+
// title: '',
|
|
50
|
+
// subtitle: '',
|
|
51
|
+
// unit: '页',
|
|
52
|
+
// },
|
|
53
|
+
// items: [],
|
|
54
|
+
// })
|
|
55
|
+
// state.currentPageIndex = state.form.groups.length - 1
|
|
56
|
+
// state.currentItemKey = ''
|
|
57
|
+
// },
|
|
58
|
+
// /** 请求回来的表单 */
|
|
59
|
+
// setCurrentForm(state, value) {
|
|
60
|
+
// state.form = value
|
|
61
|
+
// },
|
|
62
|
+
// /** 设置当前选中表单项 */
|
|
63
|
+
// setCurrentItemKey(state, value) {
|
|
64
|
+
// state.currentItemKey = value
|
|
65
|
+
// },
|
|
66
|
+
// /** 删除表单项 */
|
|
67
|
+
// removeItem(state, value) {
|
|
68
|
+
// const index = state.form.groups[state.currentPageIndex].items.findIndex((item) => item.key === value)
|
|
69
|
+
// state.form.groups[state.currentPageIndex].items.splice(index, 1)
|
|
70
|
+
// state.currentItemKey = ''
|
|
71
|
+
// },
|
|
72
|
+
// /** 更新表单信息 */
|
|
73
|
+
// updateFormSpec(state, value) {
|
|
74
|
+
// state.form.spec = value
|
|
75
|
+
// },
|
|
76
|
+
// /** 更新分组信息 */
|
|
77
|
+
// updateGroupSpec(state, value) {
|
|
78
|
+
// state.form.groups[state.currentPageIndex].spec = value
|
|
79
|
+
// },
|
|
80
|
+
// /** 更新选项信息 */
|
|
81
|
+
// updataGroupItem(state, value) {
|
|
82
|
+
// const index = state.form.groups[state.currentPageIndex].items.findIndex((item) => item.key === state.currentItemKey)
|
|
83
|
+
// state.form.groups[state.currentPageIndex].items[index] = value
|
|
84
|
+
// },
|
|
85
|
+
// /* 向当前页添加指定数量的题目 */
|
|
86
|
+
// addItemsToCurrentPage(state, value) {
|
|
87
|
+
// state.form.groups[state.currentPageIndex].items.push(value)
|
|
88
|
+
// },
|
|
89
|
+
// /** 记录依赖项 */
|
|
90
|
+
// setDependValue(state, value) {
|
|
91
|
+
// const index = state.dependValues.findIndex((item) => item.key === value.key)
|
|
92
|
+
// index >= 0 ? state.dependValues.splice(index, 1, value) : state.dependValues.push(value)
|
|
93
|
+
// },
|
|
94
|
+
// // 清空依赖项
|
|
95
|
+
// clearDepends(state) {
|
|
96
|
+
// state.dependValues = []
|
|
97
|
+
// },
|
|
98
|
+
// // 标记已经粘贴过内容了
|
|
99
|
+
// hasCopyed(state) {
|
|
100
|
+
// state.isAleadyCopy = true
|
|
101
|
+
// },
|
|
102
|
+
// // 标记粘贴题目弹窗的打开
|
|
103
|
+
// modalShow(state) {
|
|
104
|
+
// state.pasteModalShow = !state.pasteModalShow
|
|
105
|
+
// },
|
|
106
|
+
}
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { generateGid } from '@/utils'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
// 基本类型
|
|
5
|
+
baseTypes: [
|
|
6
|
+
// 开关
|
|
7
|
+
{
|
|
8
|
+
label: '开关',
|
|
9
|
+
key: '', // 表单项的ID
|
|
10
|
+
type: 'switch', // 表单项类型ID
|
|
11
|
+
title: '请输入题目名称',
|
|
12
|
+
subtitle: '',
|
|
13
|
+
placeholder: '',
|
|
14
|
+
required: true,
|
|
15
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
16
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
17
|
+
// 依赖的其他表单项:当依赖项满足条件时,才会显示当前项
|
|
18
|
+
depends: [],
|
|
19
|
+
options: [
|
|
20
|
+
{
|
|
21
|
+
id: '1',
|
|
22
|
+
content: true,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: '2',
|
|
26
|
+
content: false,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
// 下拉
|
|
31
|
+
{
|
|
32
|
+
label: '下拉',
|
|
33
|
+
key: '', // 表单项的ID
|
|
34
|
+
type: 'picker', // 表单项类型ID
|
|
35
|
+
title: '请输入题目名称',
|
|
36
|
+
subtitle: '',
|
|
37
|
+
placeholder: '请选择',
|
|
38
|
+
required: true,
|
|
39
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
40
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
41
|
+
// 依赖的其他表单项:当依赖项满足条件时,才会显示当前项
|
|
42
|
+
depends: [],
|
|
43
|
+
options: [
|
|
44
|
+
{
|
|
45
|
+
id: generateGid(),
|
|
46
|
+
content: '选项1',
|
|
47
|
+
default: true,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
// 文字
|
|
52
|
+
{
|
|
53
|
+
label: '文字',
|
|
54
|
+
key: '', // 表单项的ID
|
|
55
|
+
type: 'text', // 表单项类型ID
|
|
56
|
+
title: '请输入题目名称',
|
|
57
|
+
subtitle: '',
|
|
58
|
+
placeholder: '',
|
|
59
|
+
required: true,
|
|
60
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
61
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
62
|
+
depends: [],
|
|
63
|
+
range: {
|
|
64
|
+
min: '',
|
|
65
|
+
max: '',
|
|
66
|
+
},
|
|
67
|
+
limit: '',
|
|
68
|
+
},
|
|
69
|
+
// 单选框
|
|
70
|
+
{
|
|
71
|
+
label: '单选项',
|
|
72
|
+
key: '', // 表单项的ID
|
|
73
|
+
type: 'radio', // 表单项类型ID
|
|
74
|
+
title: '请输入题目名称',
|
|
75
|
+
subtitle: '',
|
|
76
|
+
placeholder: '',
|
|
77
|
+
required: true,
|
|
78
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
79
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
80
|
+
depends: [],
|
|
81
|
+
options: [
|
|
82
|
+
{
|
|
83
|
+
id: generateGid(),
|
|
84
|
+
content: '选项1',
|
|
85
|
+
default: true,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
// 多选框
|
|
90
|
+
{
|
|
91
|
+
label: '多选项',
|
|
92
|
+
key: '', // 表单项的ID
|
|
93
|
+
type: 'checkbox', // 表单项类型ID
|
|
94
|
+
title: '请输入题目名称',
|
|
95
|
+
subtitle: '',
|
|
96
|
+
placeholder: '',
|
|
97
|
+
required: true,
|
|
98
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
99
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
100
|
+
depends: [],
|
|
101
|
+
options: [
|
|
102
|
+
{
|
|
103
|
+
id: generateGid(),
|
|
104
|
+
content: '选项1',
|
|
105
|
+
default: true,
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
// 整数
|
|
110
|
+
{
|
|
111
|
+
label: '整数',
|
|
112
|
+
key: '', // 表单项的ID
|
|
113
|
+
type: 'integer', // 表单项类型ID
|
|
114
|
+
title: '请输入题目名称',
|
|
115
|
+
subtitle: '',
|
|
116
|
+
placeholder: '',
|
|
117
|
+
required: true,
|
|
118
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
119
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
120
|
+
depends: [],
|
|
121
|
+
range: {
|
|
122
|
+
min: '',
|
|
123
|
+
max: '',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
// 小数
|
|
127
|
+
{
|
|
128
|
+
label: '小数',
|
|
129
|
+
key: '', // 表单项的ID
|
|
130
|
+
type: 'float', // 表单项类型ID
|
|
131
|
+
title: '请输入题目名称',
|
|
132
|
+
subtitle: '',
|
|
133
|
+
placeholder: '',
|
|
134
|
+
required: true,
|
|
135
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
136
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
137
|
+
depends: [],
|
|
138
|
+
range: {
|
|
139
|
+
min: '',
|
|
140
|
+
max: '',
|
|
141
|
+
},
|
|
142
|
+
digits: 1,
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
// 时间相关
|
|
146
|
+
timeTypes: [
|
|
147
|
+
// 时间点
|
|
148
|
+
{
|
|
149
|
+
label: '时间点',
|
|
150
|
+
key: '', // 表单项的ID
|
|
151
|
+
type: 'instant', // 表单项类型ID
|
|
152
|
+
title: '请输入题目名称',
|
|
153
|
+
subtitle: '',
|
|
154
|
+
placeholder: '',
|
|
155
|
+
required: true,
|
|
156
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
157
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
158
|
+
depends: [],
|
|
159
|
+
range: {
|
|
160
|
+
min: '',
|
|
161
|
+
max: '',
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
// 时间段
|
|
165
|
+
{
|
|
166
|
+
label: '时间段',
|
|
167
|
+
key: '', // 表单项的ID
|
|
168
|
+
type: 'period', // 表单项类型ID
|
|
169
|
+
title: '请输入题目名称',
|
|
170
|
+
subtitle: '',
|
|
171
|
+
placeholder: '',
|
|
172
|
+
required: true,
|
|
173
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
174
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
175
|
+
depends: [],
|
|
176
|
+
range: {
|
|
177
|
+
min: '',
|
|
178
|
+
max: '',
|
|
179
|
+
},
|
|
180
|
+
limit: '',
|
|
181
|
+
},
|
|
182
|
+
// 文件
|
|
183
|
+
{
|
|
184
|
+
label: '文件',
|
|
185
|
+
key: '', // 表单项的ID
|
|
186
|
+
type: 'file', // 表单项类型ID
|
|
187
|
+
title: '请输入题目名称',
|
|
188
|
+
subtitle: '',
|
|
189
|
+
placeholder: '',
|
|
190
|
+
required: true,
|
|
191
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
192
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
193
|
+
depends: [],
|
|
194
|
+
limit: '1',
|
|
195
|
+
size: '2', // 评分、文件、图片大小
|
|
196
|
+
accept: '.docx,.xlsx,.pptx,.pdf,.txt', // 文件类型
|
|
197
|
+
uploadTip: '',
|
|
198
|
+
},
|
|
199
|
+
// 图片
|
|
200
|
+
{
|
|
201
|
+
label: '图片',
|
|
202
|
+
key: '', // 表单项的ID
|
|
203
|
+
type: 'image', // 表单项类型ID
|
|
204
|
+
title: '请输入题目名称',
|
|
205
|
+
subtitle: '',
|
|
206
|
+
placeholder: '',
|
|
207
|
+
required: true,
|
|
208
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
209
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
210
|
+
depends: [],
|
|
211
|
+
limit: '1',
|
|
212
|
+
size: '2', // 评分、文件、图片大小
|
|
213
|
+
accept: 'image/jpeg,image/png,image/gif', // 文件类型
|
|
214
|
+
uploadTip: '',
|
|
215
|
+
},
|
|
216
|
+
// 手机号
|
|
217
|
+
{
|
|
218
|
+
label: '手机号',
|
|
219
|
+
key: '', // 表单项的ID
|
|
220
|
+
type: 'phone', // 表单项类型ID
|
|
221
|
+
title: '请输入题目名称',
|
|
222
|
+
subtitle: '',
|
|
223
|
+
placeholder: '',
|
|
224
|
+
required: true,
|
|
225
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
226
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
227
|
+
depends: [],
|
|
228
|
+
},
|
|
229
|
+
// 密码
|
|
230
|
+
{
|
|
231
|
+
label: '密码',
|
|
232
|
+
key: '', // 表单项的ID
|
|
233
|
+
type: 'password', // 表单项类型ID
|
|
234
|
+
title: '请输入题目名称',
|
|
235
|
+
subtitle: '',
|
|
236
|
+
placeholder: '',
|
|
237
|
+
required: true,
|
|
238
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
239
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
240
|
+
depends: [],
|
|
241
|
+
range: {
|
|
242
|
+
min: '',
|
|
243
|
+
max: '',
|
|
244
|
+
},
|
|
245
|
+
limit: '',
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
// 其他类型
|
|
249
|
+
otherTypes: [
|
|
250
|
+
// 评分
|
|
251
|
+
{
|
|
252
|
+
label: '评分',
|
|
253
|
+
key: '', // 表单项的ID
|
|
254
|
+
type: 'rate', // 表单项类型ID
|
|
255
|
+
title: '请输入题目名称',
|
|
256
|
+
subtitle: '',
|
|
257
|
+
placeholder: '',
|
|
258
|
+
required: true,
|
|
259
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
260
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
261
|
+
depends: [],
|
|
262
|
+
size: 5, // 评分、文件、图片大小
|
|
263
|
+
options: [
|
|
264
|
+
{
|
|
265
|
+
id: '0',
|
|
266
|
+
content: '0分',
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
id: '1',
|
|
270
|
+
content: '1分',
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
id: '2',
|
|
274
|
+
content: '2分',
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
id: '3',
|
|
278
|
+
content: '3分',
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
id: '4',
|
|
282
|
+
content: '4分',
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: '5',
|
|
286
|
+
content: '5分',
|
|
287
|
+
},
|
|
288
|
+
],
|
|
289
|
+
},
|
|
290
|
+
// 滑块
|
|
291
|
+
{
|
|
292
|
+
label: '滑块',
|
|
293
|
+
key: '', // 表单项的ID
|
|
294
|
+
type: 'slider', // 表单项类型ID
|
|
295
|
+
title: '请输入题目名称',
|
|
296
|
+
subtitle: '',
|
|
297
|
+
placeholder: '',
|
|
298
|
+
required: true,
|
|
299
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
300
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
301
|
+
depends: [],
|
|
302
|
+
range: {
|
|
303
|
+
min: 5,
|
|
304
|
+
max: 10,
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
// 省市县
|
|
308
|
+
{
|
|
309
|
+
label: '省市县',
|
|
310
|
+
key: '', // 表单项的ID
|
|
311
|
+
type: 'area', // 表单项类型ID
|
|
312
|
+
title: '请输入题目名称',
|
|
313
|
+
subtitle: '',
|
|
314
|
+
placeholder: '',
|
|
315
|
+
required: true,
|
|
316
|
+
emsg: '当前题目答案不能为空', // 必填项未填写时的提示信息
|
|
317
|
+
weight: false, // 主要信息将予以展示,非主要信息将只会展示在详情中。若不设置,则列表会展示所有项目,不利于查看。
|
|
318
|
+
depends: [],
|
|
319
|
+
},
|
|
320
|
+
],
|
|
321
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 随机生成6位 id 包含数字、大小写字母
|
|
3
|
+
* @returns {string}
|
|
4
|
+
*/
|
|
5
|
+
export function randomIdFactory () {
|
|
6
|
+
return Math.random().toString(36).substr(2, 6)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 生成组id
|
|
11
|
+
* @returns {string}
|
|
12
|
+
*/
|
|
13
|
+
export function generateGid () {
|
|
14
|
+
return 'g' + randomIdFactory()
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 生成表单项key
|
|
19
|
+
* @returns {string}
|
|
20
|
+
*/
|
|
21
|
+
export function generateKey () {
|
|
22
|
+
return 'key' + randomIdFactory()
|
|
23
|
+
}
|