olp-table 5.3.7 → 5.5.1
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/{olp-table/olp-table.common.js → olp-table.common.js} +67 -67
- package/{olp-table/olp-table.umd.js → olp-table.umd.js} +67 -67
- package/{olp-table/olp-table.umd.min.js → olp-table.umd.min.js} +67 -67
- package/package.json +7 -87
- package/.env.build +0 -1
- package/.env.prod +0 -1
- package/README.md +0 -26
- package/babel.config.js +0 -5
- package/jsconfig.json +0 -22
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/rmMode.bat +0 -1
- package/src/App.vue +0 -199
- package/src/api/crud.js +0 -22
- package/src/api/dist.js +0 -6
- package/src/assets/iconfont/iconfont.css +0 -20
- package/src/assets/iconfont/iconfont.json +0 -16
- package/src/assets/iconfont/iconfont.ttf +0 -0
- package/src/assets/iconfont/iconfont.woff +0 -0
- package/src/assets/iconfont/iconfont.woff2 +0 -0
- package/src/assets/logo.png +0 -0
- package/src/components/auto-height/index.vue +0 -75
- package/src/components/codemirror-tag.vue +0 -100
- package/src/components/lazy-load-select.vue +0 -107
- package/src/components/ol-dialog-excel.vue +0 -112
- package/src/components/ol-dialog-import.vue +0 -304
- package/src/components/ol-dialog-json.vue +0 -83
- package/src/components/ol-dialog-table.vue +0 -81
- package/src/components/ol-dialog-upload-file.vue +0 -208
- package/src/components/ol-dict-tag.vue +0 -271
- package/src/components/ol-select-dom.vue +0 -71
- package/src/components/ol-table-filter.vue +0 -28
- package/src/components/ol-table-render.vue +0 -44
- package/src/components/ol-table-select.vue +0 -154
- package/src/components/pinia-init.vue +0 -18
- package/src/components/table/model/ModelMixins.js +0 -43
- package/src/components/table/model/model-index.vue +0 -124
- package/src/components/table/model/ot-left-right.vue +0 -18
- package/src/components/table/model/ot-left-tree-right-table.scss +0 -14
- package/src/components/table/model/ot-left-tree-right-table.vue +0 -41
- package/src/components/table/model/ot-top-1-bottom-2.vue +0 -39
- package/src/components/table/model/ot-top-2-bottom-1.vue +0 -38
- package/src/components/table/model/ot-top-2-bottom-2.vue +0 -38
- package/src/components/table/model/ot-top-bottom.vue +0 -18
- package/src/components/table/model/splitpanesModel.css +0 -22
- package/src/components/table/model/splitpanesModel.vue +0 -54
- package/src/components/table/ol-form/index.vue +0 -544
- package/src/components/table/ol-form-v3/index.vue +0 -455
- package/src/components/table/ol-main-form-sub-table/index.vue +0 -611
- package/src/components/table/ol-pager/index.vue +0 -46
- package/src/components/table/ol-table/components/ol-table-column-config/columnIndex.vue +0 -233
- package/src/components/table/ol-table/components/ol-table-column-config/index.vue +0 -145
- package/src/components/table/ol-table/components/ol-table-column-dict-color/index.vue +0 -88
- package/src/components/table/ol-table/index.vue +0 -232
- package/src/components/table/ol-table-operate/index.vue +0 -61
- package/src/components/table/ol-table-search/index.vue +0 -17
- package/src/components/table/ol-table-tool-btn/index.vue +0 -60
- package/src/components/tree/components/o-tree.vue +0 -289
- package/src/components/tree/index.vue +0 -46
- package/src/components/v-component/index.vue +0 -43
- package/src/config/dev-config.js +0 -5
- package/src/config/prod-config.js +0 -5
- package/src/config/shared-config.js +0 -20
- package/src/data.js +0 -9378
- package/src/directives/permission/hasPermi.js +0 -63
- package/src/directives/permission/hasRole.js +0 -30
- package/src/main.js +0 -55
- package/src/mixins/VTMixin/DefaultMethods.js +0 -821
- package/src/mixins/VTMixin/OTMixinBody.js +0 -105
- package/src/mixins/VTMixin/OTMixinBodyFooter.js +0 -93
- package/src/mixins/VTMixin/OTMixinBodyMethods.js +0 -421
- package/src/mixins/VTMixin/OTMixinColumnMethod.js +0 -454
- package/src/mixins/VTMixin/OTMixinInitMethod.js +0 -130
- package/src/mixins/VTMixin/OTMixinPager.js +0 -38
- package/src/mixins/VTMixin/OTMixinSortable.js +0 -43
- package/src/mixins/VTMixin/index.js +0 -18
- package/src/package/index.js +0 -20
- package/src/plugins/axios.js +0 -61
- package/src/store/dict.js +0 -76
- package/src/store/dictType.js +0 -52
- package/src/store/permi.js +0 -45
- package/src/styles/common.scss +0 -37
- package/src/styles/index.scss +0 -48
- package/src/styles/theme.scss +0 -32
- package/src/utils/AESCRUDUtils.js +0 -87
- package/src/utils/DateUtils.js +0 -35
- package/src/utils/ExcelUtil.js +0 -159
- package/src/utils/TableSortUtil.js +0 -91
- package/src/utils/columnProp.js +0 -3
- package/src/utils/groupCompute.js +0 -68
- package/src/utils/http/httpFactory.js +0 -92
- package/src/utils/http/httpFactory2.js +0 -79
- package/src/utils/http/httpUtil.js +0 -123
- package/src/utils/http/httpUtils.js +0 -38
- package/src/utils/loadStyle.js +0 -14
- package/src/utils/message.js +0 -56
- package/src/utils/object.js +0 -80
- package/src/utils/security/TokenUtil.js +0 -19
- package/src/utils/tree.js +0 -54
- package/src/utils/util.js +0 -127
- package/src/views/Test/index.vue +0 -77
- package/src/views/Test/index2.vue +0 -33
- package/src/views/components/btn-config/index.vue +0 -202
- package/src/views/components/option-config/index.vue +0 -192
- package/src/views/db/chineseToEnglish.vue +0 -127
- package/src/views/db/filed.vue +0 -395
- package/src/views/db/index.vue +0 -192
- package/src/views/db/preview/index.vue +0 -139
- package/src/views/db/preview/left.vue +0 -204
- package/src/views/db/preview/right.vue +0 -466
- package/src/views/groupTable/index.vue +0 -137
- package/src/views/groupTable/ol-table-column-config/columnIndex.vue +0 -194
- package/src/views/groupTable/ol-table-column-config/index.vue +0 -92
- package/src/views/table/add-or-edit/config/base-config/index.vue +0 -539
- package/src/views/table/add-or-edit/config/base-config/table-form.vue +0 -333
- package/src/views/table/add-or-edit/config/column-config/header-config.vue +0 -475
- package/src/views/table/add-or-edit/config/column-config/index.vue +0 -790
- package/src/views/table/add-or-edit/config/data/column.js +0 -218
- package/src/views/table/add-or-edit/config/data/crud.js +0 -122
- package/src/views/table/add-or-edit/config/data/events.js +0 -109
- package/src/views/table/add-or-edit/config/data/method.js +0 -127
- package/src/views/table/add-or-edit/config/data/option.js +0 -725
- package/src/views/table/add-or-edit/config/data/page.js +0 -79
- package/src/views/table/add-or-edit/config/field-config/filed-config-table.vue +0 -42
- package/src/views/table/add-or-edit/config/field-config/index.vue +0 -91
- package/src/views/table/add-or-edit/config/form-config/index.vue +0 -1180
- package/src/views/table/add-or-edit/config/index.vue +0 -377
- package/src/views/table/add-or-edit/config/initFormObject.js +0 -25
- package/src/views/table/add-or-edit/config/script-config/LeftMeun.vue +0 -71
- package/src/views/table/add-or-edit/config/script-config/index.vue +0 -70
- package/src/views/table/add-or-edit/config/table-config/btn-config.vue +0 -340
- package/src/views/table/add-or-edit/config/table-config/btn-sort.vue +0 -132
- package/src/views/table/add-or-edit/config/table-config/index.vue +0 -446
- package/src/views/table/add-or-edit/configOld/dataTags/filed-config-table-model.vue +0 -41
- package/src/views/table/add-or-edit/configOld/dataTags/filed-config.vue +0 -74
- package/src/views/table/add-or-edit/configOld/dataTags/index.vue +0 -439
- package/src/views/table/add-or-edit/configOld/dataTags/set-table-sql.vue +0 -79
- package/src/views/table/add-or-edit/configOld/dataTags/table-on-config.vue +0 -74
- package/src/views/table/add-or-edit/configOld/index.vue +0 -127
- package/src/views/table/add-or-edit/configOld/tableTags/columnConfig.js +0 -5
- package/src/views/table/add-or-edit/configOld/tableTags/index.vue +0 -353
- package/src/views/table/add-or-edit/configOld/tableTags/operation-but-config.vue +0 -75
- package/src/views/table/add-or-edit/configOld/tableTags/tool-but-config.vue +0 -92
- package/src/views/table/add-or-edit/index.vue +0 -201
- package/src/views/table/add-or-edit/themeModel/index.vue +0 -53
- package/src/views/table/add-or-edit/themeModel/init-model-table.vue +0 -48
- package/src/views/table/add-or-edit/themeModel/init-model.vue +0 -81
- package/src/views/table/add-or-edit/themeModel/left-right.vue +0 -24
- package/src/views/table/add-or-edit/themeModel/left-tree-right-table.vue +0 -75
- package/src/views/table/add-or-edit/themeModel/olTableSearchModelMixins.js +0 -42
- package/src/views/table/add-or-edit/themeModel/splitpanesThemeModel.vue +0 -49
- package/src/views/table/add-or-edit/themeModel/top-1-bottom-2.vue +0 -29
- package/src/views/table/add-or-edit/themeModel/top-2-bottom-1.vue +0 -32
- package/src/views/table/add-or-edit/themeModel/top-2-bottom-2.vue +0 -32
- package/src/views/table/add-or-edit/themeModel/top-bottom.vue +0 -14
- package/src/views/table/index.vue +0 -43
- package/src/views/table/index2.vue +0 -199
- package/src/views/table/preview/index.vue +0 -29
- package/src/views/tree/components/config-core-data.vue +0 -85
- package/src/views/tree/components/config-core-table.vue +0 -362
- package/src/views/tree/components/config-core-tree/data/events.js +0 -95
- package/src/views/tree/components/config-core-tree/data/option.js +0 -88
- package/src/views/tree/components/config-core-tree/data/prop.js +0 -28
- package/src/views/tree/components/config-core-tree/index.vue +0 -181
- package/src/views/tree/components/config-core.vue +0 -42
- package/src/views/tree/components/form-config/index.vue +0 -967
- package/src/views/tree/index.vue +0 -424
- package/vue.config.js +0 -44
- /package/{olp-table/demo.html → demo.html} +0 -0
- /package/{olp-table/fonts → fonts}/iconfont.1720006583309.7e4906d9.woff +0 -0
- /package/{olp-table/fonts → fonts}/iconfont.1720006583309.947a27f0.ttf +0 -0
|
@@ -1,967 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="header">
|
|
4
|
-
<el-form label-width="80">
|
|
5
|
-
<el-row>
|
|
6
|
-
<el-col :span="5">
|
|
7
|
-
<el-form-item label="表单类型">
|
|
8
|
-
<el-radio-group v-model="formType">
|
|
9
|
-
<el-radio :value="0" :label="0" size="large" style="font-size: 20px;">基础表单</el-radio>
|
|
10
|
-
<el-radio :value="1" :label="1" size="large">设计器表单</el-radio>
|
|
11
|
-
</el-radio-group>
|
|
12
|
-
</el-form-item>
|
|
13
|
-
</el-col>
|
|
14
|
-
<el-col :span="5" v-if="formType == 0">
|
|
15
|
-
<el-form-item label="表单设计">
|
|
16
|
-
<!-- 表单设计 -->
|
|
17
|
-
<el-radio-group v-model="formConfig" style="margin-left: 50px;">
|
|
18
|
-
<el-radio :value="0" :label="0" size="large" style="font-size: 20px;">快捷设计</el-radio>
|
|
19
|
-
<el-radio :value="1" :label="1" size="large">编码设计</el-radio>
|
|
20
|
-
</el-radio-group>
|
|
21
|
-
</el-form-item>
|
|
22
|
-
</el-col>
|
|
23
|
-
<el-col :span="4" v-if="formType == 1">
|
|
24
|
-
<el-form-item label="表单名称">
|
|
25
|
-
<olDictTag v-model="customForm" @change="onChangeForm" placeholder="请输入表单名称"
|
|
26
|
-
code="online,form_designer,description,id" like="desc_code"
|
|
27
|
-
></olDictTag>
|
|
28
|
-
</el-form-item>
|
|
29
|
-
</el-col>
|
|
30
|
-
<el-col :span="4" v-if="formType == 2">
|
|
31
|
-
<el-form-item label="表单文件路径">
|
|
32
|
-
<el-input style="margin-left: 20px;width:500px" v-model="customUrl" size="large"
|
|
33
|
-
placeholder="请输入表单文件路径:views/xxx">
|
|
34
|
-
<template #append>
|
|
35
|
-
<el-button :icon="Search" @click="$refs.vComponent.setComponent(customUrl,'init')"/>
|
|
36
|
-
</template>
|
|
37
|
-
</el-input>
|
|
38
|
-
</el-form-item>
|
|
39
|
-
</el-col>
|
|
40
|
-
|
|
41
|
-
<el-col :span="5">
|
|
42
|
-
<el-form-item label="保存路径">
|
|
43
|
-
<el-input v-model="form.saveUrl"
|
|
44
|
-
style="margin-left: 20px;"></el-input>
|
|
45
|
-
</el-form-item>
|
|
46
|
-
</el-col>
|
|
47
|
-
|
|
48
|
-
<el-col :span="4" v-if="type == 'edit' && formType == 0">
|
|
49
|
-
<el-form-item label="更新条件">
|
|
50
|
-
<el-input v-model="form.updateKey"
|
|
51
|
-
style="margin-left: 20px;"></el-input>
|
|
52
|
-
</el-form-item>
|
|
53
|
-
</el-col>
|
|
54
|
-
<el-col :span="4">
|
|
55
|
-
<el-button type="primary" style="margin-left: 40px" @click="showViewForm">表单弹框预览</el-button>
|
|
56
|
-
<vForm ref="vFormViewer" v-if="dialogTableVisible"></vForm>
|
|
57
|
-
</el-col>
|
|
58
|
-
</el-row>
|
|
59
|
-
</el-form>
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<el-row style="height:565px" :gutter="24">
|
|
64
|
-
|
|
65
|
-
<!-- 基础表单 -->
|
|
66
|
-
<el-col :span="12" v-if="formType == 0">
|
|
67
|
-
<el-card class="box-card">
|
|
68
|
-
<el-scrollbar max-height="500px">
|
|
69
|
-
<avue-form v-model="state.baseForm" :option="baseOption"></avue-form>
|
|
70
|
-
</el-scrollbar>
|
|
71
|
-
</el-card>
|
|
72
|
-
</el-col>
|
|
73
|
-
|
|
74
|
-
<!-- 表单设计 -->
|
|
75
|
-
<el-col :span="12" v-if="formType == 0">
|
|
76
|
-
<!-- 快捷设计 -->
|
|
77
|
-
<el-card class="box-card" v-show="formConfig == 0">
|
|
78
|
-
<!-- 表单 -->
|
|
79
|
-
<el-form :inline="true" :model="baseOption" class="demo-form-inline">
|
|
80
|
-
<el-row>
|
|
81
|
-
<el-col :span="12">
|
|
82
|
-
<el-form-item label="每行个数">
|
|
83
|
-
<el-input-number style="width: 240px" v-model="designForm.span" placeholder="请输入每行的个数"
|
|
84
|
-
@change="designFormChange"
|
|
85
|
-
:min="1" :max="4"/>
|
|
86
|
-
</el-form-item>
|
|
87
|
-
</el-col>
|
|
88
|
-
<el-col :span="12">
|
|
89
|
-
<el-form-item label="label宽度">
|
|
90
|
-
<el-input-number style="width: 240px" v-model="baseOption.labelWidth" placeholder="label宽度"
|
|
91
|
-
@change="designFormChange"
|
|
92
|
-
/>
|
|
93
|
-
</el-form-item>
|
|
94
|
-
</el-col>
|
|
95
|
-
<el-col :span="12">
|
|
96
|
-
<el-form-item label="弹窗宽度">
|
|
97
|
-
<el-input-number style="width: 240px" v-model="baseOption.diaLogWidth" placeholder="请输入弹窗宽度"
|
|
98
|
-
@change="designFormChange"
|
|
99
|
-
:min="100" :max="1920"/>
|
|
100
|
-
</el-form-item>
|
|
101
|
-
</el-col>
|
|
102
|
-
<el-col :span="12">
|
|
103
|
-
<el-form-item label="弹窗高度">
|
|
104
|
-
<el-input-number style="width: 240px" v-model="baseOption.diaLogHeight" placeholder="请输入弹窗高度"
|
|
105
|
-
@change="designFormChange"
|
|
106
|
-
:min="50" :max="1080"/>
|
|
107
|
-
</el-form-item>
|
|
108
|
-
</el-col>
|
|
109
|
-
</el-row>
|
|
110
|
-
|
|
111
|
-
</el-form>
|
|
112
|
-
|
|
113
|
-
<!-- 表格 -->
|
|
114
|
-
<vxe-grid
|
|
115
|
-
v-bind="gridOptions"
|
|
116
|
-
ref="vexGridRef"
|
|
117
|
-
:expand-config="{labelField: 'seq'}"
|
|
118
|
-
resizable
|
|
119
|
-
row-key
|
|
120
|
-
>
|
|
121
|
-
<!-- 通用弹窗 -->
|
|
122
|
-
<template #change="{column,row}">
|
|
123
|
-
<olCodemirrorTag v-model="row[column.field]" @confirm="codeMirrorChange(row)"/>
|
|
124
|
-
</template>
|
|
125
|
-
<!-- 通用输入框 -->
|
|
126
|
-
<template #input_default="{column,row}">
|
|
127
|
-
<el-input v-model="row[column.field]" @change="inputChange(row)"></el-input>
|
|
128
|
-
</template>
|
|
129
|
-
<!-- 通用多选框 -->
|
|
130
|
-
<template #checkedBox_header="{ column }">
|
|
131
|
-
<div style="display: flex;align-items: center;">
|
|
132
|
-
<el-checkbox v-model="column.params.all" @change="headerClick(column)"></el-checkbox>
|
|
133
|
-
<span style="margin-left: 5px;">{{ column.title }} </span>
|
|
134
|
-
|
|
135
|
-
</div>
|
|
136
|
-
</template>
|
|
137
|
-
<template #checkedBox_default="{ column, row }">
|
|
138
|
-
<el-checkbox v-model="row[column.field]" @change="checkBoxClick(column, row)" true-value="1"
|
|
139
|
-
:true-label="0" :false-label="1"
|
|
140
|
-
false-value="0"></el-checkbox>
|
|
141
|
-
</template>
|
|
142
|
-
<!-- 通用下拉框 -->
|
|
143
|
-
<template #select_default="{column,row}">
|
|
144
|
-
<olDictTag
|
|
145
|
-
code="select_dom"
|
|
146
|
-
v-model="row[column.field]"
|
|
147
|
-
@change="dictChange(row)"></olDictTag>
|
|
148
|
-
</template>
|
|
149
|
-
<!-- 展开行 -->
|
|
150
|
-
<template #seq="{ rowIndex}">
|
|
151
|
-
<span>{{ rowIndex + 1 }}</span>
|
|
152
|
-
</template>
|
|
153
|
-
<template #content="{ row }">
|
|
154
|
-
<div style="padding:30px 0 12px;display: flex;">
|
|
155
|
-
<avue-form ref="formRef"
|
|
156
|
-
:option="expandForm"
|
|
157
|
-
v-model="row.form"
|
|
158
|
-
@change="refreshForm()"
|
|
159
|
-
>
|
|
160
|
-
<!-- 通用弹窗 -->
|
|
161
|
-
<template #change1>
|
|
162
|
-
<olCodemirrorTag v-model="row.form.change"/>
|
|
163
|
-
</template>
|
|
164
|
-
</avue-form>
|
|
165
|
-
</div>
|
|
166
|
-
</template>
|
|
167
|
-
<template #operate="{ row }">
|
|
168
|
-
<el-button @click="removeRowEvent(row)" type="danger" circle plain>
|
|
169
|
-
<el-icon>
|
|
170
|
-
<Delete/>
|
|
171
|
-
</el-icon>
|
|
172
|
-
</el-button>
|
|
173
|
-
</template>
|
|
174
|
-
</vxe-grid>
|
|
175
|
-
</el-card>
|
|
176
|
-
|
|
177
|
-
<!-- 编码设计 -->
|
|
178
|
-
<div style="width:100%;height:calc(100% - 40px);position: relative;" v-show="formConfig == 1">
|
|
179
|
-
<codemirror
|
|
180
|
-
ref="mycode"
|
|
181
|
-
style="height: 92%;max-height: 510px;text-align: left;"
|
|
182
|
-
v-model="codeForm"
|
|
183
|
-
:autofocus="true"
|
|
184
|
-
:lint="true"
|
|
185
|
-
:indent-with-tab="true"
|
|
186
|
-
:lineWrapping="true"
|
|
187
|
-
:tabSize="2"
|
|
188
|
-
:extensions="state.extensions"
|
|
189
|
-
/>
|
|
190
|
-
<el-button @click="codeToData" type="primary" style="height:40px;width: 100%;">生成</el-button>
|
|
191
|
-
</div>
|
|
192
|
-
|
|
193
|
-
</el-col>
|
|
194
|
-
|
|
195
|
-
<!-- 自定义表单 -->
|
|
196
|
-
<el-col :span="24" v-if="formType == 1 || formType == 2" style="height: 100%;">
|
|
197
|
-
<el-card class="box-card">
|
|
198
|
-
<el-scrollbar max-height="500px">
|
|
199
|
-
<VFormRender v-if="formType == 1" :key="formKey" :form-json="formJson" :form-data="formData"
|
|
200
|
-
:option-data="optionData"
|
|
201
|
-
ref="vFormRef">
|
|
202
|
-
</VFormRender>
|
|
203
|
-
<vComponent ref="vComponent" v-if="formType == 2"/>
|
|
204
|
-
</el-scrollbar>
|
|
205
|
-
</el-card>
|
|
206
|
-
</el-col>
|
|
207
|
-
</el-row>
|
|
208
|
-
|
|
209
|
-
</div>
|
|
210
|
-
</template>
|
|
211
|
-
|
|
212
|
-
<script>
|
|
213
|
-
import vForm from "@/components/table/ol-form"
|
|
214
|
-
import {Delete, Search} from '@element-plus/icons-vue'
|
|
215
|
-
import {reactive, ref, defineExpose, defineEmits, nextTick, onMounted, defineProps, inject} from "vue";
|
|
216
|
-
import vComponent from "@/components/v-component/index.vue";
|
|
217
|
-
import {Codemirror} from "vue-codemirror";
|
|
218
|
-
import {javascript} from "@codemirror/lang-javascript";
|
|
219
|
-
import {oneDark} from "@codemirror/theme-one-dark";
|
|
220
|
-
import {useMessage} from "@/utils/message";
|
|
221
|
-
import {get} from "@/utils/http/httpUtils";
|
|
222
|
-
import Sortable from "sortablejs";
|
|
223
|
-
import {storeDictType} from "@/store/dictType";
|
|
224
|
-
import {storeDict} from "@/store/dict";
|
|
225
|
-
import VXETable from "vxe-table";
|
|
226
|
-
|
|
227
|
-
export default {
|
|
228
|
-
name: 'FormConfig',
|
|
229
|
-
components: {},
|
|
230
|
-
props: {
|
|
231
|
-
type: {}
|
|
232
|
-
},
|
|
233
|
-
inject: ['treeConfigAll', 'addOrEditRootData', 'http'],
|
|
234
|
-
data() {
|
|
235
|
-
return {
|
|
236
|
-
data: [
|
|
237
|
-
{index: "t1", type: "主表", joinTable: "", joinFiled: "/", deleteWhere: 'id=${id}'}
|
|
238
|
-
],
|
|
239
|
-
isHovering: false,
|
|
240
|
-
dict: storeDict(),
|
|
241
|
-
dictType: storeDictType(),
|
|
242
|
-
customUrl: '',
|
|
243
|
-
vexGridRef: '',
|
|
244
|
-
vFormViewer: '',
|
|
245
|
-
dialogTableVisible: false,
|
|
246
|
-
events: ['change'],
|
|
247
|
-
// 基础表单
|
|
248
|
-
baseOption: {
|
|
249
|
-
submitBtn: false,
|
|
250
|
-
emptyBtn: false,
|
|
251
|
-
labelWidth: 125,
|
|
252
|
-
column: []
|
|
253
|
-
},
|
|
254
|
-
//编码设计
|
|
255
|
-
codeForm: {},
|
|
256
|
-
form: {
|
|
257
|
-
updateKey: '',
|
|
258
|
-
saveUrl: '',
|
|
259
|
-
},
|
|
260
|
-
state: {
|
|
261
|
-
show: false,
|
|
262
|
-
extensions: [javascript(), oneDark],
|
|
263
|
-
values: null,
|
|
264
|
-
err: false,
|
|
265
|
-
baseForm: {},
|
|
266
|
-
baseFormRender: {},
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
formMap: {},
|
|
270
|
-
update: true,
|
|
271
|
-
//表单类型
|
|
272
|
-
formType: 0,
|
|
273
|
-
//表单设计
|
|
274
|
-
formConfig: 0,
|
|
275
|
-
//快捷设计表单
|
|
276
|
-
designForm: {
|
|
277
|
-
span: 2,
|
|
278
|
-
},
|
|
279
|
-
//快捷设计表格
|
|
280
|
-
gridOptions: {
|
|
281
|
-
border: true,
|
|
282
|
-
resizable: true,
|
|
283
|
-
showOverflow: true,
|
|
284
|
-
height: 400,
|
|
285
|
-
columns: [
|
|
286
|
-
{
|
|
287
|
-
type: "expand",
|
|
288
|
-
width: 61,
|
|
289
|
-
title: "序号",
|
|
290
|
-
fixed: "left",
|
|
291
|
-
slots: {
|
|
292
|
-
content: 'content',
|
|
293
|
-
default: 'seq'
|
|
294
|
-
},
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
field: 'prop',
|
|
298
|
-
width: 80,
|
|
299
|
-
className: 'move',
|
|
300
|
-
title: "字段名"
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
title: '必填',
|
|
304
|
-
field: 'required',
|
|
305
|
-
params: {
|
|
306
|
-
all: null
|
|
307
|
-
},
|
|
308
|
-
slots: {
|
|
309
|
-
header: 'checkedBox_header',
|
|
310
|
-
default: 'checkedBox_default'
|
|
311
|
-
},
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
field: 'title',
|
|
315
|
-
title: "标题"
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
field: 'showName',
|
|
319
|
-
title: "label",
|
|
320
|
-
slots: {
|
|
321
|
-
default: 'input_default'
|
|
322
|
-
},
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
title: '控件类型',
|
|
326
|
-
field: 'selectDom',
|
|
327
|
-
width: 200,
|
|
328
|
-
slots: {
|
|
329
|
-
default: 'select_default'
|
|
330
|
-
},
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
title: '更新回调',
|
|
334
|
-
field: 'change',
|
|
335
|
-
width: 100,
|
|
336
|
-
slots: {
|
|
337
|
-
default: 'change'
|
|
338
|
-
},
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
title: '操作',
|
|
342
|
-
width: 60,
|
|
343
|
-
fixed: 'right',
|
|
344
|
-
slots: {
|
|
345
|
-
default: 'operate'
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
],
|
|
349
|
-
data: []
|
|
350
|
-
},
|
|
351
|
-
//展开行表单
|
|
352
|
-
expandForm: {
|
|
353
|
-
submitBtn: false,
|
|
354
|
-
emptyBtn: false,
|
|
355
|
-
span: 8,
|
|
356
|
-
column: [
|
|
357
|
-
{
|
|
358
|
-
label: '禁用',
|
|
359
|
-
prop: 'disabled',
|
|
360
|
-
type: 'switch',
|
|
361
|
-
dicData: [{
|
|
362
|
-
label: '关',
|
|
363
|
-
value: 0
|
|
364
|
-
}, {
|
|
365
|
-
label: '开',
|
|
366
|
-
value: 1
|
|
367
|
-
}]
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
label: '标题宽度',
|
|
371
|
-
prop: 'labelWidth',
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
label: '数据字典',
|
|
375
|
-
prop: 'dictCode',
|
|
376
|
-
type: 'select',
|
|
377
|
-
allowCreate: true,
|
|
378
|
-
filterable: true,
|
|
379
|
-
//数据字典属性的配置对象
|
|
380
|
-
props: {
|
|
381
|
-
label: 'dictLabel',
|
|
382
|
-
value: 'dictValue'
|
|
383
|
-
},
|
|
384
|
-
dicData: [],
|
|
385
|
-
},
|
|
386
|
-
{
|
|
387
|
-
label: '默认值',
|
|
388
|
-
prop: 'value',
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
label: '输入框提示',
|
|
392
|
-
prop: 'placeholder',
|
|
393
|
-
},
|
|
394
|
-
{
|
|
395
|
-
label: '数据字典表',
|
|
396
|
-
prop: 'dictTable',
|
|
397
|
-
},
|
|
398
|
-
]
|
|
399
|
-
},
|
|
400
|
-
//自定义表单值
|
|
401
|
-
formJson: {},
|
|
402
|
-
formData: {},
|
|
403
|
-
formKey: 0,
|
|
404
|
-
optionData: {},
|
|
405
|
-
vFormRef: null,
|
|
406
|
-
customForm: "",
|
|
407
|
-
customOptions: [],
|
|
408
|
-
}
|
|
409
|
-
},
|
|
410
|
-
created() {
|
|
411
|
-
this.initConfigDict()
|
|
412
|
-
},
|
|
413
|
-
methods: {
|
|
414
|
-
initConfigDict() {
|
|
415
|
-
for (const col of this.expandForm.column) {
|
|
416
|
-
if (col.prop == 'dictCode') {
|
|
417
|
-
col.dicData = this.dictType.val()
|
|
418
|
-
break
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
},
|
|
422
|
-
showViewForm() {
|
|
423
|
-
this.dialogTableVisible = true;
|
|
424
|
-
this.$nextTick(() => {
|
|
425
|
-
let data = {
|
|
426
|
-
type: this.formType,
|
|
427
|
-
title: "新增",
|
|
428
|
-
theme: 't1'
|
|
429
|
-
}
|
|
430
|
-
data.form = data.type == 0 ? this.baseOption : this.formJson
|
|
431
|
-
this.$ref.vFormViewer.init(data)
|
|
432
|
-
})
|
|
433
|
-
},
|
|
434
|
-
//表头全选框更新
|
|
435
|
-
headerClick(column) {
|
|
436
|
-
this.gridOptions.data.forEach(item => {
|
|
437
|
-
if (column.params.all) {
|
|
438
|
-
item.rules = [{
|
|
439
|
-
required: true,
|
|
440
|
-
message: '请输入' + item.title,
|
|
441
|
-
trigger: 'blur'
|
|
442
|
-
}]
|
|
443
|
-
item[column.field] = '1'
|
|
444
|
-
} else {
|
|
445
|
-
item[column.field] = '0'
|
|
446
|
-
item.rules = null
|
|
447
|
-
}
|
|
448
|
-
this.checkBoxChange(item)
|
|
449
|
-
})
|
|
450
|
-
},
|
|
451
|
-
//表格多选框更新
|
|
452
|
-
checkBoxClick(column, row) {
|
|
453
|
-
if (row.required == '1') {
|
|
454
|
-
row.rules = [{
|
|
455
|
-
required: true,
|
|
456
|
-
message: '请输入' + row.title,
|
|
457
|
-
trigger: 'blur'
|
|
458
|
-
}]
|
|
459
|
-
}
|
|
460
|
-
if (row.required == '0') {
|
|
461
|
-
row.rules = null
|
|
462
|
-
}
|
|
463
|
-
this.checkBoxChange(row)
|
|
464
|
-
},
|
|
465
|
-
|
|
466
|
-
checkBoxChange(row) {
|
|
467
|
-
this.$nextTick(() => {
|
|
468
|
-
this.baseOption.column.forEach(item => {
|
|
469
|
-
if (item.prop == row.prop) {
|
|
470
|
-
item.rules = row.rules
|
|
471
|
-
this.codeForm = this.jsonFormat(this.baseOption)
|
|
472
|
-
return
|
|
473
|
-
}
|
|
474
|
-
})
|
|
475
|
-
})
|
|
476
|
-
},
|
|
477
|
-
//获取数据
|
|
478
|
-
setData(data) {
|
|
479
|
-
if (!data) return
|
|
480
|
-
this.formType = parseInt(data.formMain.designer)
|
|
481
|
-
this.form.updateKey = data.formMain.updateKey
|
|
482
|
-
this.form.saveUrl = data.formMain.saveUrl
|
|
483
|
-
this.customForm = data.formMain.customForm
|
|
484
|
-
//基础表单
|
|
485
|
-
//JSON字符串
|
|
486
|
-
if (data.formJson.optionJson) {
|
|
487
|
-
this.codeForm = data.formJson.optionJson
|
|
488
|
-
this.codeToData()
|
|
489
|
-
}
|
|
490
|
-
if (data.formJson.customJson) {
|
|
491
|
-
//自定义表单
|
|
492
|
-
this.formJson = JSON.parse(data.formJson.customJson)
|
|
493
|
-
}
|
|
494
|
-
},
|
|
495
|
-
codeToData() {
|
|
496
|
-
try {
|
|
497
|
-
this.getFormatter();
|
|
498
|
-
let value = JSON.parse(this.codeForm);
|
|
499
|
-
|
|
500
|
-
this.setSort(value);
|
|
501
|
-
this.codeForm = this.jsonFormat(value)
|
|
502
|
-
//更新快捷设计表格的数据
|
|
503
|
-
this.setTableData(value)
|
|
504
|
-
if (!value.labelWidth) value.labelWidth = 125
|
|
505
|
-
this.baseOption = value;
|
|
506
|
-
this.setBaseOption(value.column);
|
|
507
|
-
value.span = value.span ? value.span : 12
|
|
508
|
-
//计算表单每行个数
|
|
509
|
-
this.designForm.span = this.parseInt(24 / value.span)
|
|
510
|
-
} catch (e) {
|
|
511
|
-
console.error(e)
|
|
512
|
-
const msg = useMessage() // 消息弹窗
|
|
513
|
-
msg.error('生成失败,请检查对象格式是否正确' + e)
|
|
514
|
-
}
|
|
515
|
-
},
|
|
516
|
-
getFormatter() {
|
|
517
|
-
//正则表达式替换字符串的值
|
|
518
|
-
let v = this.codeForm.replace(/,}/gi, "}").replace(/,]/gi, "]");
|
|
519
|
-
this.codeForm = JSON.stringify(JSON.parse(v), null, 4)
|
|
520
|
-
},
|
|
521
|
-
setSort(value) {
|
|
522
|
-
value.column.sort((a, b) => {
|
|
523
|
-
return a.sort - b.sort
|
|
524
|
-
})
|
|
525
|
-
for (let i = 0; i < value.column.length; i++) {
|
|
526
|
-
value.column.sort = i + 1
|
|
527
|
-
}
|
|
528
|
-
},
|
|
529
|
-
//JSON格式化
|
|
530
|
-
jsonFormat(val) {
|
|
531
|
-
return JSON.stringify(JSON.parse(JSON.stringify(val)), null, 4)
|
|
532
|
-
},
|
|
533
|
-
//编码设计生成后更新快捷设计表格数据
|
|
534
|
-
setTableData(value) {
|
|
535
|
-
let data = [];
|
|
536
|
-
for (let item of value.column) {
|
|
537
|
-
let tableObj = this.getTableObject(item);
|
|
538
|
-
data.push(tableObj);
|
|
539
|
-
}
|
|
540
|
-
this.$nextTick(() => {
|
|
541
|
-
this.gridOptions.data = data;
|
|
542
|
-
})
|
|
543
|
-
},
|
|
544
|
-
setBaseOption(columns) {
|
|
545
|
-
columns = JSON.parse(JSON.stringify(columns));
|
|
546
|
-
for (let column of columns) {
|
|
547
|
-
try {
|
|
548
|
-
if (column.disabled == 1) {
|
|
549
|
-
column.disabled = true;
|
|
550
|
-
}
|
|
551
|
-
this.setEvents(column);
|
|
552
|
-
this.setDictCode(column)
|
|
553
|
-
} catch (e) {
|
|
554
|
-
console.error(e)
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
this.baseOption.column = columns;
|
|
558
|
-
},
|
|
559
|
-
setDictCode(column) {
|
|
560
|
-
if (column.selectDom != 1 && column.dictCode) {
|
|
561
|
-
this.getDicData(column.dictCode, column)
|
|
562
|
-
}
|
|
563
|
-
},
|
|
564
|
-
setEvents(column) {
|
|
565
|
-
for (let event of this.events) {
|
|
566
|
-
if (column[event] != undefined && column[event] != '') {
|
|
567
|
-
try {
|
|
568
|
-
column[event] = eval("(params)=>{try{" + this.replaceDollarBraces(column[event]) + "}catch (e) {}}");
|
|
569
|
-
} catch (e) {
|
|
570
|
-
console.error(e)
|
|
571
|
-
}
|
|
572
|
-
} else {
|
|
573
|
-
delete column[event];
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
},
|
|
577
|
-
replaceDollarBraces(str) {
|
|
578
|
-
return str.replace(/\$\{?([^{}]+)\}?/g, function (match, innerContent) {
|
|
579
|
-
return innerContent ? `'${innerContent}'` : match;
|
|
580
|
-
});
|
|
581
|
-
},
|
|
582
|
-
getTableObject(item) {
|
|
583
|
-
let obj = {
|
|
584
|
-
prop: item.prop || item.field,
|
|
585
|
-
title: item.title || item.label,
|
|
586
|
-
showName: item.title ? item.label : "",
|
|
587
|
-
required: item.rules ? '1' : '0',
|
|
588
|
-
change: item.change ? item.change : null,
|
|
589
|
-
selectDom: this.getFormType({selectDom: item.type ? item.type : 'input'}),
|
|
590
|
-
//有字典值则赋值否则为空对象
|
|
591
|
-
form: {}
|
|
592
|
-
}
|
|
593
|
-
for (let key of Object.keys(item)) {
|
|
594
|
-
if (!obj[key]) {
|
|
595
|
-
obj.form[key] = item[key]
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
return obj
|
|
599
|
-
},
|
|
600
|
-
//控件类型转换
|
|
601
|
-
getFormType(row) {
|
|
602
|
-
let val = row.selectDom
|
|
603
|
-
if (val != '' || val != undefined || val) {
|
|
604
|
-
let type = ""
|
|
605
|
-
let map = {
|
|
606
|
-
input: '1',
|
|
607
|
-
select: '2',
|
|
608
|
-
time: '3',
|
|
609
|
-
radio: '4',
|
|
610
|
-
checkbox: '5',
|
|
611
|
-
date: '6',
|
|
612
|
-
number: '7',
|
|
613
|
-
}
|
|
614
|
-
if (isNaN(val)) {
|
|
615
|
-
//不是数字,通过健找值
|
|
616
|
-
type = map[val]
|
|
617
|
-
} else {
|
|
618
|
-
//是数字,通过值找健
|
|
619
|
-
// 使用 Object.values() 获取对象的所有值
|
|
620
|
-
const arr = Object.values(map);
|
|
621
|
-
// 使用 Array.prototype.indexOf() 查找指定值在数组中的索引位置
|
|
622
|
-
const index = arr.indexOf(val);
|
|
623
|
-
// 使用 Object.keys()[index] 获取对应索引位置的键名
|
|
624
|
-
type = Object.keys(map)[index];
|
|
625
|
-
|
|
626
|
-
if (type == "") {
|
|
627
|
-
type = 'input'
|
|
628
|
-
} else if (type == "select" || type == "checkbox" || type == "radio") {
|
|
629
|
-
this.getDicData(row.dictCode, row)
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
return type
|
|
633
|
-
}
|
|
634
|
-
},
|
|
635
|
-
//获取字典
|
|
636
|
-
getDicData(code, row) {
|
|
637
|
-
if (code == "" || !code) {
|
|
638
|
-
delete row.dicData
|
|
639
|
-
} else {
|
|
640
|
-
row.dicData = this.dict.val(code)
|
|
641
|
-
this.setDicData(row)
|
|
642
|
-
}
|
|
643
|
-
},
|
|
644
|
-
setDicData(row) {
|
|
645
|
-
this.baseOption.column.forEach(item => {
|
|
646
|
-
if (item.prop == row.prop) {
|
|
647
|
-
item.dicData = row.dicData
|
|
648
|
-
return
|
|
649
|
-
}
|
|
650
|
-
})
|
|
651
|
-
},
|
|
652
|
-
//初始化数据
|
|
653
|
-
init(data) {
|
|
654
|
-
//基础表单
|
|
655
|
-
const option = {
|
|
656
|
-
submitBtn: false,
|
|
657
|
-
emptyBtn: false,
|
|
658
|
-
span: 12,
|
|
659
|
-
labelWidth: 80,
|
|
660
|
-
column: []
|
|
661
|
-
}
|
|
662
|
-
//快捷设计表格
|
|
663
|
-
const tableData = []
|
|
664
|
-
let index = 0
|
|
665
|
-
|
|
666
|
-
//将列配置的新增赋值到表单和表格中
|
|
667
|
-
data.forEach(item => {
|
|
668
|
-
if (item[this.type + 'Display'] == 1) {
|
|
669
|
-
const formObj = {
|
|
670
|
-
label: item.label,
|
|
671
|
-
prop: item.field,
|
|
672
|
-
sort: index,
|
|
673
|
-
type: this.getFormType(item)
|
|
674
|
-
}
|
|
675
|
-
const tableObj = {
|
|
676
|
-
prop: item.field,
|
|
677
|
-
title: item.title,
|
|
678
|
-
sort: index,
|
|
679
|
-
//为空默认文本框
|
|
680
|
-
selectDom: item.selectDom ? item.selectDom : 1,
|
|
681
|
-
required: item.required,
|
|
682
|
-
//有字典值则赋值否则为空对象
|
|
683
|
-
form: {}
|
|
684
|
-
}
|
|
685
|
-
if (item.dictCode != '' || item.dictCode != null) {
|
|
686
|
-
tableObj.form = {dictCode: item.dictCode}
|
|
687
|
-
}
|
|
688
|
-
if (item.dictTable != '' || item.dictTable != null) {
|
|
689
|
-
tableObj.form = {dictTable: item.dictTable}
|
|
690
|
-
}
|
|
691
|
-
for (let key of Object.keys(item)) {
|
|
692
|
-
if (!tableObj[key]) {
|
|
693
|
-
tableObj.form[key] = item[key]
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
for (let event of this.events) {
|
|
697
|
-
if (item[event] != undefined && !(item[event] instanceof Function)) {
|
|
698
|
-
formObj[event] = eval("(params)=>{" + item[event] + "}")
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
index++;
|
|
702
|
-
option.column.push(formObj)
|
|
703
|
-
tableData.push(tableObj)
|
|
704
|
-
}
|
|
705
|
-
})
|
|
706
|
-
this.baseOption = option
|
|
707
|
-
this.gridOptions.data = tableData
|
|
708
|
-
//计算每行列数
|
|
709
|
-
this.designForm.span = 24 / this.baseOption.span
|
|
710
|
-
this.codeForm = this.jsonFormat(this.baseOption)
|
|
711
|
-
this.updateSort();
|
|
712
|
-
},
|
|
713
|
-
getColumn(item) {
|
|
714
|
-
let obj = {
|
|
715
|
-
prop: item.field,
|
|
716
|
-
title: item.title || item.label,
|
|
717
|
-
sort: this.gridOptions.data ? this.gridOptions.data.length : 0,
|
|
718
|
-
//为空默认文本框
|
|
719
|
-
selectDom: item.selectDom ? item.selectDom : 1,
|
|
720
|
-
//有字典值则赋值否则为空对象
|
|
721
|
-
form: item.dictCode != '' || item.dictCode ? {
|
|
722
|
-
dictCode: item.dictCode
|
|
723
|
-
} : {}
|
|
724
|
-
}
|
|
725
|
-
return obj;
|
|
726
|
-
},
|
|
727
|
-
//列配置新增多选更新
|
|
728
|
-
updateData(row, column) {
|
|
729
|
-
if (row[column.field] == '1') {
|
|
730
|
-
for (const item of this.gridOptions.data) {
|
|
731
|
-
if (item.prop == row.field) return
|
|
732
|
-
}
|
|
733
|
-
let tableObj = this.getColumn(row);
|
|
734
|
-
this.gridOptions.data.push(tableObj)
|
|
735
|
-
} else {
|
|
736
|
-
this.gridOptions.data = this.gridOptions.data.filter(item => item.prop != row.field)
|
|
737
|
-
}
|
|
738
|
-
this.reloadData();
|
|
739
|
-
this.refreshForm()
|
|
740
|
-
},
|
|
741
|
-
reloadData(data) {
|
|
742
|
-
if (data) {
|
|
743
|
-
this.gridOptions.data = data;
|
|
744
|
-
}
|
|
745
|
-
this.$ref.vexGridRef.reloadData(this.gridOptions.data)
|
|
746
|
-
},
|
|
747
|
-
//列配置新增全选与全不选
|
|
748
|
-
setAll({list, isAll}) {
|
|
749
|
-
let data = []
|
|
750
|
-
if (isAll) {
|
|
751
|
-
for (let item of list) {
|
|
752
|
-
data.push(this.getColumn(item));
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
this.reloadData(data);
|
|
756
|
-
this.refreshForm()
|
|
757
|
-
},
|
|
758
|
-
//基础表单 > 快捷设计表单更新
|
|
759
|
-
designFormChange() {
|
|
760
|
-
//行数转换为尺寸
|
|
761
|
-
this.baseOption.span = this.parseInt(24 / this.designForm.span)
|
|
762
|
-
//JSON格式化
|
|
763
|
-
this.codeForm = this.jsonFormat(this.baseOption)
|
|
764
|
-
},
|
|
765
|
-
codeMirrorChange(row) {
|
|
766
|
-
for (const row of this.gridOptions.data) {
|
|
767
|
-
this.setChange(row)
|
|
768
|
-
}
|
|
769
|
-
},
|
|
770
|
-
setChange(row) {
|
|
771
|
-
this.$nextTick(() => {
|
|
772
|
-
if (row.prop && row.change) {
|
|
773
|
-
for (let item of this.baseOption.column) {
|
|
774
|
-
if (item.prop == row.prop) {
|
|
775
|
-
item.change = row.change
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
this.codeForm = this.jsonFormat(this.baseOption)
|
|
780
|
-
})
|
|
781
|
-
},
|
|
782
|
-
//基础表单 > 快捷设计表格输入框更新
|
|
783
|
-
inputChange(row) {
|
|
784
|
-
this.$nextTick(() => {
|
|
785
|
-
if (row.prop != "") {
|
|
786
|
-
for (let item of this.baseOption.column) {
|
|
787
|
-
if (item.prop == row.prop) {
|
|
788
|
-
//将表格的label变成显示名或标题
|
|
789
|
-
if (row.showName != "") {
|
|
790
|
-
item.label = row.showName
|
|
791
|
-
item.title = row.title
|
|
792
|
-
} else {
|
|
793
|
-
item.label = row.title
|
|
794
|
-
delete item.title
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
break
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
this.codeForm = this.jsonFormat(this.baseOption)
|
|
801
|
-
})
|
|
802
|
-
},
|
|
803
|
-
//控件类型更新
|
|
804
|
-
dictChange(row) {
|
|
805
|
-
this.$nextTick(() => {
|
|
806
|
-
this.baseOption.column.forEach(item => {
|
|
807
|
-
if (item.prop == row.prop) {
|
|
808
|
-
item.type = this.getFormType(row)
|
|
809
|
-
this.codeForm = this.jsonFormat(this.baseOption)
|
|
810
|
-
return
|
|
811
|
-
}
|
|
812
|
-
})
|
|
813
|
-
})
|
|
814
|
-
},
|
|
815
|
-
refreshForm() {
|
|
816
|
-
if (this.update != true) {
|
|
817
|
-
setTimeout(() => {
|
|
818
|
-
this.refreshForm()
|
|
819
|
-
}, 200)
|
|
820
|
-
}
|
|
821
|
-
this.update = false;
|
|
822
|
-
let data = JSON.parse(JSON.stringify(this.gridOptions.data));
|
|
823
|
-
let columns = []
|
|
824
|
-
let index = 1;
|
|
825
|
-
for (let d of data) {
|
|
826
|
-
d.sort = index;
|
|
827
|
-
d.change = ''
|
|
828
|
-
columns.push(this.dataToCode(d));
|
|
829
|
-
index++;
|
|
830
|
-
}
|
|
831
|
-
columns.sort((a, b) => {
|
|
832
|
-
return a.sort - b.sort
|
|
833
|
-
})
|
|
834
|
-
|
|
835
|
-
this.setCodeForm(columns)
|
|
836
|
-
this.setBaseOption(columns);
|
|
837
|
-
this.update = true;
|
|
838
|
-
},
|
|
839
|
-
setCodeForm(columns) {
|
|
840
|
-
let option = JSON.parse(JSON.stringify(this.baseOption));
|
|
841
|
-
option.column = JSON.parse(JSON.stringify(columns));
|
|
842
|
-
this.codeForm = this.jsonFormat(option)
|
|
843
|
-
},
|
|
844
|
-
dataToCode({form, prop, selectDom, title}) {
|
|
845
|
-
let item = {prop: prop, selectDom: selectDom, label: form.showName ? form.showName : title};
|
|
846
|
-
if (selectDom != 1) {
|
|
847
|
-
item.type = this.getFormType({selectDom: selectDom})
|
|
848
|
-
}
|
|
849
|
-
for (let key of Object.keys(form)) {
|
|
850
|
-
if (form[key] != undefined && form[key] != '' && key.indexOf('$') == -1) {
|
|
851
|
-
item[key] = form[key];
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
return item;
|
|
855
|
-
},
|
|
856
|
-
//表格拖动更新
|
|
857
|
-
updateSort() {
|
|
858
|
-
this.$nextTick(() => {
|
|
859
|
-
//el绑定元素需要找到vxe的DOM下的tbody元素
|
|
860
|
-
let $vxeGrid = this.$refs.vexGridRef
|
|
861
|
-
let that = this
|
|
862
|
-
Sortable.create($vxeGrid.$el.querySelector('.body--wrapper>.vxe-table--body tbody'), {
|
|
863
|
-
animation: 150,//拖拽动画过渡时间
|
|
864
|
-
sort: true,
|
|
865
|
-
handle: '.move', //必须设置该属性,属性值为你要拖动的该单元格的样式名
|
|
866
|
-
// 元素被选中
|
|
867
|
-
onStart: function (/**Event*/evt) {
|
|
868
|
-
//关闭所有展开行
|
|
869
|
-
$vxeGrid?.clearRowExpand()
|
|
870
|
-
evt.oldIndex; // element index within parent
|
|
871
|
-
},
|
|
872
|
-
// 结束拖拽
|
|
873
|
-
onEnd: function (/**Event*/{oldIndex, newIndex}) {
|
|
874
|
-
const list = JSON.parse(JSON.stringify(that.gridOptions.data)) //保存旧数据
|
|
875
|
-
const targetRow = list.splice(oldIndex, 1)[0] //保存移动的元素并删除原列表中移动的元素
|
|
876
|
-
list.splice(newIndex, 0, targetRow) //插入到目标新索引中
|
|
877
|
-
const newsArr = JSON.parse(JSON.stringify(list)) //重新赋值数组
|
|
878
|
-
//将新表格数据重新排序
|
|
879
|
-
for (let i = 0; i < newsArr.length; i++) {
|
|
880
|
-
newsArr[i].sort = i
|
|
881
|
-
}
|
|
882
|
-
that.gridOptions.data = newsArr;
|
|
883
|
-
//把表单的排序号和表格的排序号保持一致
|
|
884
|
-
newsArr.forEach(tableItem => {
|
|
885
|
-
that.baseOption.column.forEach(formItem => {
|
|
886
|
-
if (tableItem.prop == formItem.prop) {
|
|
887
|
-
formItem.sort = tableItem.sort
|
|
888
|
-
}
|
|
889
|
-
})
|
|
890
|
-
})
|
|
891
|
-
//将表单重新排序
|
|
892
|
-
that.baseOption.column.sort((a, b) => {
|
|
893
|
-
return a.sort - b.sort
|
|
894
|
-
})
|
|
895
|
-
that.codeForm = that.jsonFormat(that.baseOption)
|
|
896
|
-
},
|
|
897
|
-
});
|
|
898
|
-
});
|
|
899
|
-
},
|
|
900
|
-
// 更换表单
|
|
901
|
-
onChangeForm(value) {
|
|
902
|
-
if (value) {
|
|
903
|
-
get(this.http, "/online/formDesigner/queryById", {
|
|
904
|
-
id: value
|
|
905
|
-
}).then((data) => {
|
|
906
|
-
this.formJson = JSON.parse(data.formJson)
|
|
907
|
-
this.formKey++
|
|
908
|
-
})
|
|
909
|
-
}
|
|
910
|
-
},
|
|
911
|
-
// 获取新增表单配置数据
|
|
912
|
-
getData() {
|
|
913
|
-
if (this.formType == 0 && this.gridOptions.data.length == 0) {
|
|
914
|
-
return undefined;
|
|
915
|
-
}
|
|
916
|
-
let obj = {
|
|
917
|
-
vexTable: this.gridOptions,
|
|
918
|
-
baseForm: this.baseOption,
|
|
919
|
-
codeForm: this.codeForm,
|
|
920
|
-
designer: this.formType,
|
|
921
|
-
updateKey: this.form.updateKey,
|
|
922
|
-
saveUrl: this.form.saveUrl,
|
|
923
|
-
customJson: this.formJson,
|
|
924
|
-
customForm: this.customForm
|
|
925
|
-
}
|
|
926
|
-
return obj
|
|
927
|
-
},
|
|
928
|
-
/**
|
|
929
|
-
* 右边字段配置删除行数据
|
|
930
|
-
* @param row
|
|
931
|
-
* @returns {Promise<void>}
|
|
932
|
-
*/
|
|
933
|
-
async removeRowEvent(row) {
|
|
934
|
-
const type = await VXETable.modal.confirm('您确定要删除该数据?')
|
|
935
|
-
const $grid = this.$ref.vexGridRef
|
|
936
|
-
if ($grid && type === 'confirm') {
|
|
937
|
-
await $grid.remove(row)
|
|
938
|
-
this.gridOptions.data = this.gridOptions.data.filter(item => item._X_ROW_KEY != row._X_ROW_KEY)
|
|
939
|
-
this.removeColumnEvent(row)
|
|
940
|
-
}
|
|
941
|
-
},
|
|
942
|
-
/**
|
|
943
|
-
* 删除表单属性(快捷设计属性)
|
|
944
|
-
* @param row
|
|
945
|
-
*/
|
|
946
|
-
removeColumnEvent(row) {
|
|
947
|
-
this.baseOption.column = this.baseOption.column.filter(item => item.prop != row.prop)
|
|
948
|
-
this.codeForm = this.jsonFormat(this.baseOption)
|
|
949
|
-
}
|
|
950
|
-
},
|
|
951
|
-
mounted() {
|
|
952
|
-
this.updateSort()
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
</script>
|
|
957
|
-
|
|
958
|
-
<style lang="scss" scoped>
|
|
959
|
-
.cm-editor {
|
|
960
|
-
height: 100%;
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
.box-card {
|
|
964
|
-
width: calc(100% - 24px);
|
|
965
|
-
height: calc(100% - 24px);
|
|
966
|
-
}
|
|
967
|
-
</style>
|