tianheng-ui 0.1.0 → 0.1.2
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/README.md +9 -18
- package/lib/039af9192b9bb277966ceb4e4ce29c41.js +16 -0
- package/lib/2d84c80112a372bc149cad3464e90fa3.js +1617 -0
- package/lib/5977b934a4c6b480790864ea01303173.js +10834 -0
- package/lib/7745f3e776488705a38e62f85adad54d.js +16 -0
- package/lib/de8dee841ffdaaede3a2254deef30376.js +15395 -0
- package/lib/e78eab250e7f8ccac3d918dfdb06ca10.js +8904 -0
- package/lib/theme-chalk/fonts/PingFang.ttf +0 -0
- package/lib/theme-chalk/fonts/bpmn.eot +0 -0
- package/lib/theme-chalk/fonts/bpmn.svg +224 -0
- package/lib/theme-chalk/fonts/bpmn.ttf +0 -0
- package/lib/theme-chalk/fonts/bpmn.woff +0 -0
- package/lib/theme-chalk/fonts/bpmn.woff2 +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.eot +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.svg +2671 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.ttf +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.woff +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.woff2 +0 -0
- package/lib/theme-chalk/fonts/iconfont.eot +0 -0
- package/lib/theme-chalk/fonts/iconfont.svg +155 -0
- package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff2 +0 -0
- package/lib/theme-chalk/images/notData.png +0 -0
- package/lib/theme-chalk/index.scss +31 -0
- package/lib/theme-chalk/js/Log.js +99 -0
- package/lib/theme-chalk/js/axios.js +86 -0
- package/lib/theme-chalk/js/store/getters.js +5 -0
- package/lib/theme-chalk/js/store/modules/makingForm.js +21 -0
- package/lib/theme-chalk/js/store/store.js +26 -0
- package/lib/theme-chalk/styles/button.scss +501 -0
- package/lib/theme-chalk/styles/card.scss +29 -0
- package/lib/theme-chalk/styles/cell.scss +54 -0
- package/lib/theme-chalk/styles/codeEditor.scss +9 -0
- package/lib/theme-chalk/styles/col.scss +151 -0
- package/lib/theme-chalk/styles/dialog.scss +56 -0
- package/lib/theme-chalk/styles/empty.scss +22 -0
- package/lib/theme-chalk/styles/feature.scss +46 -0
- package/lib/theme-chalk/styles/font.css +7 -0
- package/lib/theme-chalk/styles/grid.scss +41 -0
- package/lib/theme-chalk/styles/icon.css +1944 -0
- package/lib/theme-chalk/styles/imagePreview.scss +113 -0
- package/lib/theme-chalk/styles/img.scss +35 -0
- package/lib/theme-chalk/styles/reset.scss +17 -0
- package/lib/theme-chalk/styles/root.css +64 -0
- package/lib/theme-chalk/styles/row.scss +23 -0
- package/lib/theme-chalk/styles/upload.scss +744 -0
- package/lib/theme-chalk/styles/variable.scss +80 -0
- package/lib/tianheng-ui.js +116 -0
- package/package.json +86 -48
- package/packages/Button/index.js +8 -0
- package/packages/Button/index.vue +80 -0
- package/packages/Card/index.js +8 -0
- package/packages/Card/index.vue +37 -0
- package/packages/Cell/index.js +8 -0
- package/packages/Cell/index.vue +68 -0
- package/packages/CodeEditor/index.js +8 -0
- package/packages/CodeEditor/index.vue +177 -0
- package/packages/Col/index.js +8 -0
- package/packages/Col/index.vue +43 -0
- package/packages/Dialog/index.js +8 -0
- package/packages/Dialog/index.vue +129 -0
- package/packages/Empty/index.js +8 -0
- package/packages/Empty/index.vue +35 -0
- package/packages/FormMaking/FormConfig.vue +60 -0
- package/packages/FormMaking/GenerateForm.vue +308 -0
- package/packages/FormMaking/GenerateFormItem.vue +887 -0
- package/packages/FormMaking/GenerateFormItemH5.vue +825 -0
- package/packages/FormMaking/Upload/index.vue +572 -0
- package/packages/FormMaking/WidgetConfig.vue +472 -0
- package/packages/FormMaking/WidgetForm.vue +159 -0
- package/packages/FormMaking/WidgetFormItem.vue +187 -0
- package/packages/FormMaking/custom/config.js +762 -0
- package/packages/FormMaking/custom/configs/alliance.vue +0 -0
- package/packages/FormMaking/custom/configs/blank.vue +54 -0
- package/packages/FormMaking/custom/configs/button.vue +172 -0
- package/packages/FormMaking/custom/configs/cascader.vue +175 -0
- package/packages/FormMaking/custom/configs/cell.vue +81 -0
- package/packages/FormMaking/custom/configs/checkbox.vue +234 -0
- package/packages/FormMaking/custom/configs/color.vue +137 -0
- package/packages/FormMaking/custom/configs/date.vue +158 -0
- package/packages/FormMaking/custom/configs/divider.vue +61 -0
- package/packages/FormMaking/custom/configs/editor.vue +71 -0
- package/packages/FormMaking/custom/configs/filler.vue +57 -0
- package/packages/FormMaking/custom/configs/grid.vue +103 -0
- package/packages/FormMaking/custom/configs/image.vue +138 -0
- package/packages/FormMaking/custom/configs/input.vue +176 -0
- package/packages/FormMaking/custom/configs/number.vue +140 -0
- package/packages/FormMaking/custom/configs/radio.vue +211 -0
- package/packages/FormMaking/custom/configs/rate.vue +109 -0
- package/packages/FormMaking/custom/configs/select.vue +305 -0
- package/packages/FormMaking/custom/configs/slider.vue +142 -0
- package/packages/FormMaking/custom/configs/switch.vue +130 -0
- package/packages/FormMaking/custom/configs/table.vue +105 -0
- package/packages/FormMaking/custom/configs/table_h5.vue +102 -0
- package/packages/FormMaking/custom/configs/tabs.vue +175 -0
- package/packages/FormMaking/custom/configs/text.vue +71 -0
- package/packages/FormMaking/custom/configs/textarea.vue +167 -0
- package/packages/FormMaking/custom/configs/time.vue +153 -0
- package/packages/FormMaking/custom/configs/upload.vue +155 -0
- package/packages/FormMaking/custom/index.js +32 -0
- package/packages/FormMaking/custom/items/alliance.vue +132 -0
- package/packages/FormMaking/custom/items/blank.vue +16 -0
- package/packages/FormMaking/custom/items/button.vue +27 -0
- package/packages/FormMaking/custom/items/cascader.vue +29 -0
- package/packages/FormMaking/custom/items/cell.vue +18 -0
- package/packages/FormMaking/custom/items/checkbox.vue +46 -0
- package/packages/FormMaking/custom/items/color.vue +19 -0
- package/packages/FormMaking/custom/items/date.vue +29 -0
- package/packages/FormMaking/custom/items/divider.vue +14 -0
- package/packages/FormMaking/custom/items/editor.vue +22 -0
- package/packages/FormMaking/custom/items/filler.vue +17 -0
- package/packages/FormMaking/custom/items/grid.vue +130 -0
- package/packages/FormMaking/custom/items/image.vue +70 -0
- package/packages/FormMaking/custom/items/input.vue +33 -0
- package/packages/FormMaking/custom/items/login.vue +13 -0
- package/packages/FormMaking/custom/items/number.vue +24 -0
- package/packages/FormMaking/custom/items/radio.vue +44 -0
- package/packages/FormMaking/custom/items/rate.vue +20 -0
- package/packages/FormMaking/custom/items/select.vue +32 -0
- package/packages/FormMaking/custom/items/slider.vue +34 -0
- package/packages/FormMaking/custom/items/switch.vue +22 -0
- package/packages/FormMaking/custom/items/table.vue +106 -0
- package/packages/FormMaking/custom/items/table_h5.vue +126 -0
- package/packages/FormMaking/custom/items/tabs.vue +145 -0
- package/packages/FormMaking/custom/items/text.vue +18 -0
- package/packages/FormMaking/custom/items/textarea.vue +37 -0
- package/packages/FormMaking/custom/items/time.vue +32 -0
- package/packages/FormMaking/custom/items/upload.vue +102 -0
- package/packages/FormMaking/custom/mixins/index.js +61 -0
- package/packages/FormMaking/custom/register.js +18 -0
- package/packages/FormMaking/generate.js +5 -0
- package/packages/FormMaking/iconfont/demo.css +539 -0
- package/packages/FormMaking/iconfont/demo_index.html +1159 -0
- package/packages/FormMaking/iconfont/iconfont.css +189 -0
- package/packages/FormMaking/iconfont/iconfont.eot +0 -0
- package/packages/FormMaking/iconfont/iconfont.js +1 -0
- package/packages/FormMaking/iconfont/iconfont.svg +155 -0
- package/packages/FormMaking/iconfont/iconfont.ttf +0 -0
- package/packages/FormMaking/iconfont/iconfont.woff +0 -0
- package/packages/FormMaking/iconfont/iconfont.woff2 +0 -0
- package/packages/FormMaking/index.js +33 -0
- package/packages/FormMaking/index.vue +807 -0
- package/packages/FormMaking/lang/en-US.js +187 -0
- package/packages/FormMaking/lang/zh-CN.js +187 -0
- package/packages/FormMaking/making.js +9 -0
- package/packages/FormMaking/styles/cover.scss +41 -0
- package/packages/FormMaking/styles/index.scss +785 -0
- package/packages/FormMaking/util/generateCode.js +163 -0
- package/packages/FormMaking/util/index.js +33 -0
- package/packages/FormMaking/util/request.js +28 -0
- package/packages/Grid/index.js +8 -0
- package/packages/Grid/index.vue +21 -0
- package/packages/GridItem/index.js +8 -0
- package/packages/GridItem/index.vue +69 -0
- package/packages/Icons/index.js +8 -0
- package/packages/Icons/index.vue +377 -0
- package/packages/Image/index.js +8 -0
- package/packages/Image/index.vue +146 -0
- package/packages/ImagePreview/index.js +8 -0
- package/packages/ImagePreview/index.vue +386 -0
- package/packages/Row/index.js +8 -0
- package/packages/Row/index.vue +33 -0
- package/packages/Table/action.js +8 -0
- package/packages/Table/action.vue +168 -0
- package/packages/Table/column.vue +63 -0
- package/packages/Table/index.js +8 -0
- package/packages/Table/index.vue +327 -0
- package/packages/Table/search.js +8 -0
- package/packages/Table/search.vue +163 -0
- package/packages/Table/tools.js +8 -0
- package/packages/Table/tools.vue +49 -0
- package/packages/TableMaking/custom/configs/fieldSearch.vue +17 -0
- package/packages/TableMaking/custom/configs/fieldTable.vue +15 -0
- package/packages/TableMaking/custom/items/search/index.vue +158 -0
- package/packages/TableMaking/custom/items/tools/index.vue +49 -0
- package/packages/TableMaking/generate.js +5 -0
- package/packages/TableMaking/generateTable.vue +560 -0
- package/packages/TableMaking/index.vue +229 -0
- package/packages/TableMaking/making.js +5 -0
- package/packages/TableMaking/util/index.js +433 -0
- package/packages/TableMaking/widgetConfig.vue +390 -0
- package/packages/TableMaking/widgetTable.vue +305 -0
- package/packages/Upload/ajax.js +85 -0
- package/packages/Upload/index.js +8 -0
- package/packages/Upload/index.vue +325 -0
- package/packages/Upload/upload-dragger.vue +70 -0
- package/packages/Upload/upload-list.vue +121 -0
- package/packages/Upload/upload.vue +193 -0
- package/packages/VueEditor/index.js +8 -0
- package/packages/VueEditor/index.vue +38 -0
- package/packages/Workflow/Log.js +99 -0
- package/packages/Workflow/designer/ProcessDesigner.vue +628 -0
- package/packages/Workflow/designer/index.js +7 -0
- package/packages/Workflow/designer/plugins/content-pad/contentPadProvider.js +390 -0
- package/packages/Workflow/designer/plugins/content-pad/index.js +6 -0
- package/packages/Workflow/designer/plugins/defaultEmpty.js +24 -0
- package/packages/Workflow/designer/plugins/descriptor/activitiDescriptor.json +1071 -0
- package/packages/Workflow/designer/plugins/descriptor/camundaDescriptor.json +1087 -0
- package/packages/Workflow/designer/plugins/descriptor/flowableDescriptor.json +1215 -0
- package/packages/Workflow/designer/plugins/extension-moddle/activiti/activitiExtension.js +74 -0
- package/packages/Workflow/designer/plugins/extension-moddle/activiti/index.js +9 -0
- package/packages/Workflow/designer/plugins/extension-moddle/camunda/extension.js +148 -0
- package/packages/Workflow/designer/plugins/extension-moddle/camunda/index.js +6 -0
- package/packages/Workflow/designer/plugins/extension-moddle/flowable/flowableExtension.js +74 -0
- package/packages/Workflow/designer/plugins/extension-moddle/flowable/index.js +9 -0
- package/packages/Workflow/designer/plugins/palette/CustomPalette.js +156 -0
- package/packages/Workflow/designer/plugins/palette/index.js +6 -0
- package/packages/Workflow/designer/plugins/palette/paletteProvider.js +160 -0
- package/packages/Workflow/designer/plugins/translate/customTranslate.js +41 -0
- package/packages/Workflow/designer/plugins/translate/zh.js +238 -0
- package/packages/Workflow/highlight/index.js +5 -0
- package/packages/Workflow/index.js +34 -0
- package/packages/Workflow/index.vue +399 -0
- package/packages/Workflow/modules/auto-place/CustomAutoPlace.js +81 -0
- package/packages/Workflow/modules/auto-place/index.js +6 -0
- package/packages/Workflow/modules/custom-renderer/CustomRenderer.js +17 -0
- package/packages/Workflow/modules/custom-renderer/index.js +6 -0
- package/packages/Workflow/modules/rules/CustomRules.js +16 -0
- package/packages/Workflow/modules/rules/index.js +6 -0
- package/packages/Workflow/palette/ProcessPalette.vue +106 -0
- package/packages/Workflow/palette/index.js +7 -0
- package/packages/Workflow/penal/PropertiesPanel.vue +245 -0
- package/packages/Workflow/penal/base/ElementBaseInfo.vue +80 -0
- package/packages/Workflow/penal/flow-condition/FlowCondition.vue +142 -0
- package/packages/Workflow/penal/form/ElementForm.vue +367 -0
- package/packages/Workflow/penal/index.js +7 -0
- package/packages/Workflow/penal/listeners/ElementListeners.vue +299 -0
- package/packages/Workflow/penal/listeners/UserTaskListeners.vue +322 -0
- package/packages/Workflow/penal/listeners/template.js +178 -0
- package/packages/Workflow/penal/listeners/utilSelf.js +64 -0
- package/packages/Workflow/penal/multi-instance/ElementMultiInstance.vue +200 -0
- package/packages/Workflow/penal/other/ElementOtherConfig.vue +59 -0
- package/packages/Workflow/penal/properties/ElementProperties.vue +135 -0
- package/packages/Workflow/penal/signal-message/SignalAndMessage.vue +104 -0
- package/packages/Workflow/penal/task/ElementTask.vue +73 -0
- package/packages/Workflow/penal/task/task-components/ReceiveTask.vue +97 -0
- package/packages/Workflow/penal/task/task-components/ScriptTask.vue +85 -0
- package/packages/Workflow/penal/task/task-components/UserTask.vue +535 -0
- package/packages/Workflow/theme/element-variables.scss +70 -0
- package/packages/Workflow/theme/index.scss +2 -0
- package/packages/Workflow/theme/process-designer.scss +157 -0
- package/packages/Workflow/theme/process-panel.scss +107 -0
- package/packages/Workflow/translations.js +25 -0
- package/packages/Workflow/utils.js +71 -0
- package/packages/index.js +160 -0
- package/babel.config.js +0 -15
- package/index.js +0 -11
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/src/App.vue +0 -28
- package/src/assets/logo.png +0 -0
- package/src/components/HelloWorld.vue +0 -58
- package/src/main.js +0 -8
@@ -0,0 +1,560 @@
|
|
1
|
+
<template>
|
2
|
+
<div v-if="tableJson">
|
3
|
+
<!-- 搜索栏 -->
|
4
|
+
<search
|
5
|
+
v-if="searchConfig.show"
|
6
|
+
:data="searchData"
|
7
|
+
:options="searchConfig.options"
|
8
|
+
@on-search="requestListData"
|
9
|
+
@on-reset="requestListData"
|
10
|
+
/>
|
11
|
+
|
12
|
+
<!-- 菜单栏 -->
|
13
|
+
<tools
|
14
|
+
v-if="toolsConfig.show"
|
15
|
+
:options="toolsConfig.options"
|
16
|
+
:disabled="{
|
17
|
+
batchDelete: tableSelectionData.length === 0,
|
18
|
+
export: tableSelectionData.length === 0
|
19
|
+
}"
|
20
|
+
@on-click="handleToolsClick"
|
21
|
+
/>
|
22
|
+
|
23
|
+
<!-- 表格 -->
|
24
|
+
<th-table
|
25
|
+
v-if="tableConfig.options.length"
|
26
|
+
ref="tableRef"
|
27
|
+
:data="tableData"
|
28
|
+
:options="tableConfig.options"
|
29
|
+
:page-info="tableConfig.pageInfo.options"
|
30
|
+
:show-page="tableConfig.pageInfo.show"
|
31
|
+
:loading="tableConfig.loading.show"
|
32
|
+
:loading-text="tableConfig.loading.text"
|
33
|
+
:empty-text="tableConfig.empty.text"
|
34
|
+
select-type="single"
|
35
|
+
border
|
36
|
+
@selection-change="handleSelectionChange"
|
37
|
+
@pagination-change="handlePagingChange"
|
38
|
+
>
|
39
|
+
<template #action="{scope, option }">
|
40
|
+
<th-table-action
|
41
|
+
:actions="option.actions"
|
42
|
+
@on-click="
|
43
|
+
(action, callback) => {
|
44
|
+
handleActionClick(
|
45
|
+
scope.$index,
|
46
|
+
scope.row,
|
47
|
+
action,
|
48
|
+
callback,
|
49
|
+
option
|
50
|
+
);
|
51
|
+
}
|
52
|
+
"
|
53
|
+
>
|
54
|
+
</th-table-action>
|
55
|
+
</template>
|
56
|
+
</th-table>
|
57
|
+
|
58
|
+
<!-- 表单 -->
|
59
|
+
<th-dialog
|
60
|
+
v-model="dialog.show"
|
61
|
+
:title="dialog.action.name"
|
62
|
+
:modal-append-to-body="false"
|
63
|
+
@on-affirm="handleDialogAffirm"
|
64
|
+
@on-close="handleDialogClose"
|
65
|
+
>
|
66
|
+
<th-form-generate
|
67
|
+
v-if="formConfig"
|
68
|
+
:data="formConfig"
|
69
|
+
:value="dialog.data"
|
70
|
+
:remoteData="remoteData"
|
71
|
+
ref="formGenerate"
|
72
|
+
>
|
73
|
+
</th-form-generate>
|
74
|
+
</th-dialog>
|
75
|
+
</div>
|
76
|
+
<div v-else>
|
77
|
+
<slot v-if="$slots.empty" name="empty"></slot>
|
78
|
+
<th-empty
|
79
|
+
v-else
|
80
|
+
:image="require('@/assets/images/notData.png')"
|
81
|
+
:description="errorMessage || empty.description"
|
82
|
+
>
|
83
|
+
<th-button type="primary" @click="initConfig">刷新</th-button>
|
84
|
+
</th-empty>
|
85
|
+
</div>
|
86
|
+
</template>
|
87
|
+
|
88
|
+
<script>
|
89
|
+
import Search from "./custom/items/search";
|
90
|
+
import Tools from "./custom/items/tools";
|
91
|
+
import { toolsItemConfig } from "./util/index";
|
92
|
+
import * as Axios from "lib/theme-chalk/js/axios";
|
93
|
+
export default {
|
94
|
+
name: "thTableGenerate",
|
95
|
+
components: { Search, Tools },
|
96
|
+
props: {
|
97
|
+
oauthConfig: {
|
98
|
+
type: Object,
|
99
|
+
default: () => {
|
100
|
+
return {};
|
101
|
+
}
|
102
|
+
},
|
103
|
+
empty: {
|
104
|
+
type: Object,
|
105
|
+
default: () => {
|
106
|
+
return {
|
107
|
+
description: "暂无数据"
|
108
|
+
};
|
109
|
+
}
|
110
|
+
},
|
111
|
+
network: {
|
112
|
+
type: Object,
|
113
|
+
default: () => {
|
114
|
+
return {
|
115
|
+
page: {
|
116
|
+
url: "/preview/getViewManageDetailById",
|
117
|
+
method: "POST",
|
118
|
+
params: {}
|
119
|
+
},
|
120
|
+
form: {
|
121
|
+
url: "/formManage/getFormDetailById",
|
122
|
+
method: "POST",
|
123
|
+
params: {}
|
124
|
+
}
|
125
|
+
};
|
126
|
+
}
|
127
|
+
}
|
128
|
+
},
|
129
|
+
data() {
|
130
|
+
return {
|
131
|
+
id: "",
|
132
|
+
tableJson: {},
|
133
|
+
axios: null,
|
134
|
+
networkConfig: {},
|
135
|
+
searchConfig: { show: false, options: [] },
|
136
|
+
searchData: {},
|
137
|
+
toolsConfig: { show: false, options: [] },
|
138
|
+
tableConfig: { options: [], pageInfo: {} },
|
139
|
+
tableData: [],
|
140
|
+
tableSelectionData: [],
|
141
|
+
dialog: { show: false, data: {}, action: {} },
|
142
|
+
formConfig: null,
|
143
|
+
remoteData: {
|
144
|
+
projectTypeId: [
|
145
|
+
{
|
146
|
+
id: "1597785308467281921",
|
147
|
+
name: "自然资源",
|
148
|
+
sort: "1",
|
149
|
+
tenantId: "1514528042264793089",
|
150
|
+
createBy: "舒浪",
|
151
|
+
createTime: 1669776678000,
|
152
|
+
updateBy: "舒浪",
|
153
|
+
updateTime: 1669787428000
|
154
|
+
},
|
155
|
+
{
|
156
|
+
id: "1597785379552346114",
|
157
|
+
name: "智慧政务",
|
158
|
+
sort: "2",
|
159
|
+
tenantId: "1514528042264793089",
|
160
|
+
createBy: "舒浪",
|
161
|
+
createTime: 1669776695000,
|
162
|
+
updateBy: "舒浪",
|
163
|
+
updateTime: 1669776893000
|
164
|
+
},
|
165
|
+
{
|
166
|
+
id: "1597785424695640065",
|
167
|
+
name: "数字乡村",
|
168
|
+
sort: "3",
|
169
|
+
tenantId: "1514528042264793089",
|
170
|
+
createBy: "舒浪",
|
171
|
+
createTime: 1669776705000,
|
172
|
+
updateBy: null,
|
173
|
+
updateTime: null
|
174
|
+
},
|
175
|
+
{
|
176
|
+
id: "1597885800635691009",
|
177
|
+
name: "测试分类啊啊啊",
|
178
|
+
sort: "0",
|
179
|
+
tenantId: "1514528042264793089",
|
180
|
+
createBy: "舒浪",
|
181
|
+
createTime: 1669800637000,
|
182
|
+
updateBy: null,
|
183
|
+
updateTime: null
|
184
|
+
},
|
185
|
+
{
|
186
|
+
id: "1597886150885240833",
|
187
|
+
name: "123123123",
|
188
|
+
sort: "0",
|
189
|
+
tenantId: "1514528042264793089",
|
190
|
+
createBy: "舒浪",
|
191
|
+
createTime: 1669800720000,
|
192
|
+
updateBy: null,
|
193
|
+
updateTime: null
|
194
|
+
},
|
195
|
+
{
|
196
|
+
id: "1597886566523990017",
|
197
|
+
name: "2222",
|
198
|
+
sort: "0",
|
199
|
+
tenantId: "1514528042264793089",
|
200
|
+
createBy: "舒浪",
|
201
|
+
createTime: 1669800819000,
|
202
|
+
updateBy: null,
|
203
|
+
updateTime: null
|
204
|
+
}
|
205
|
+
]
|
206
|
+
},
|
207
|
+
errorMessage: ""
|
208
|
+
};
|
209
|
+
},
|
210
|
+
created() {
|
211
|
+
this.axios = Axios.init(this.oauthConfig);
|
212
|
+
const code = this.$route.path.split("/").pop();
|
213
|
+
this.id = code;
|
214
|
+
this.initConfig();
|
215
|
+
},
|
216
|
+
mounted() {},
|
217
|
+
methods: {
|
218
|
+
// 初始化组件配置
|
219
|
+
initConfig() {
|
220
|
+
this.initData();
|
221
|
+
|
222
|
+
if (this.oauthConfig.token) {
|
223
|
+
const oauthInfo = {
|
224
|
+
token: this.oauthConfig.token,
|
225
|
+
baseUrl: this.oauthConfig.baseUrl
|
226
|
+
};
|
227
|
+
sessionStorage.setItem("th_oauth_info", JSON.stringify(oauthInfo));
|
228
|
+
}
|
229
|
+
|
230
|
+
const info = sessionStorage.getItem("th_oauth_info");
|
231
|
+
if (info) {
|
232
|
+
this.requestConfigData();
|
233
|
+
} else if (this.oauthConfig.oauth) {
|
234
|
+
// 模拟授权认证流程
|
235
|
+
this.axios({
|
236
|
+
url: this.oauthConfig.oauth.url,
|
237
|
+
method: this.oauthConfig.oauth.method,
|
238
|
+
data: this.oauthConfig.oauth.params,
|
239
|
+
headers: this.oauthConfig.oauth.headers
|
240
|
+
}).then(res => {
|
241
|
+
const oauthInfo = {
|
242
|
+
token: res.data,
|
243
|
+
baseUrl: this.oauthConfig.baseUrl
|
244
|
+
};
|
245
|
+
sessionStorage.setItem("th_oauth_info", JSON.stringify(oauthInfo));
|
246
|
+
// this.axios.defaults.baseURL = this.oauthConfig.baseUrl;
|
247
|
+
this.requestConfigData();
|
248
|
+
});
|
249
|
+
} else {
|
250
|
+
this.requestConfigData();
|
251
|
+
}
|
252
|
+
},
|
253
|
+
initData() {
|
254
|
+
this.tableJson = {};
|
255
|
+
this.errorMessage = "";
|
256
|
+
},
|
257
|
+
// 获取配置信息
|
258
|
+
requestConfigData() {
|
259
|
+
this.axios({
|
260
|
+
url: this.network.page.url,
|
261
|
+
method: this.network.page.method,
|
262
|
+
headers: this.network.page.headers,
|
263
|
+
data: { ...this.network.page.params, moduleId: this.id }
|
264
|
+
})
|
265
|
+
.then(res => {
|
266
|
+
const resultData = res.data;
|
267
|
+
if (!resultData) {
|
268
|
+
this.tableJson = null;
|
269
|
+
return;
|
270
|
+
}
|
271
|
+
this.tableJson = JSON.parse(resultData.pageConfig);
|
272
|
+
// 网络请求
|
273
|
+
this.networkConfig = this.tableJson.network;
|
274
|
+
|
275
|
+
// 搜索栏
|
276
|
+
this.searchConfig = this.tableJson.search;
|
277
|
+
if (this.searchConfig.show) {
|
278
|
+
this.searchConfig.options.map(item => {
|
279
|
+
this.$set(this.searchData, item.prop, item.defaultValue || "");
|
280
|
+
});
|
281
|
+
}
|
282
|
+
|
283
|
+
// table
|
284
|
+
for (let i = 0; i < this.tableJson.table.options.length; i++) {
|
285
|
+
const element = this.tableJson.table.options[i];
|
286
|
+
delete element.type;
|
287
|
+
}
|
288
|
+
if (this.tableJson.table.sequence) {
|
289
|
+
this.tableJson.table.options.unshift({
|
290
|
+
type: "index",
|
291
|
+
label: "序号"
|
292
|
+
});
|
293
|
+
}
|
294
|
+
const action = {
|
295
|
+
label: "操作",
|
296
|
+
hide: true,
|
297
|
+
slot: "action",
|
298
|
+
fixed: "right",
|
299
|
+
actions: []
|
300
|
+
};
|
301
|
+
|
302
|
+
// 按position处理按钮,1:公共区,2:行内区
|
303
|
+
for (const key in this.tableJson.tools) {
|
304
|
+
if (Object.hasOwnProperty.call(this.tableJson.tools, key)) {
|
305
|
+
const element = this.tableJson.tools[key];
|
306
|
+
if (!element.show) continue;
|
307
|
+
if (key === "batchDelete") {
|
308
|
+
this.tableJson.table.options.unshift({
|
309
|
+
type: "selection"
|
310
|
+
});
|
311
|
+
}
|
312
|
+
const dic = toolsItemConfig(key, element);
|
313
|
+
dic.form = element.form;
|
314
|
+
if (element.position === 1) {
|
315
|
+
this.toolsConfig.show = true;
|
316
|
+
this.toolsConfig.options.push(dic);
|
317
|
+
} else if (element.position === 2) {
|
318
|
+
action.hide = false;
|
319
|
+
action.actions.push(dic);
|
320
|
+
}
|
321
|
+
}
|
322
|
+
}
|
323
|
+
action.width = action.actions.length * 60 + 20;
|
324
|
+
this.tableJson.table.options.push(action);
|
325
|
+
|
326
|
+
this.tableConfig = this.tableJson.table;
|
327
|
+
this.requestListData();
|
328
|
+
})
|
329
|
+
.catch(err => {
|
330
|
+
this.errorMessage = err.message;
|
331
|
+
this.tableJson = null;
|
332
|
+
this.$emit("error");
|
333
|
+
});
|
334
|
+
},
|
335
|
+
requestListData() {
|
336
|
+
if (!this.networkConfig.mounted) return;
|
337
|
+
this.tableConfig.loading.show = true;
|
338
|
+
const apiInfo = this.networkConfig.mounted;
|
339
|
+
const params = {
|
340
|
+
...this.searchData
|
341
|
+
};
|
342
|
+
if (this.tableConfig.pageInfo.show) {
|
343
|
+
params.current = this.tableConfig.pageInfo.options.currentPage;
|
344
|
+
params.size = this.tableConfig.pageInfo.options.pageSize;
|
345
|
+
}
|
346
|
+
this.axios({
|
347
|
+
url: apiInfo.api,
|
348
|
+
method: apiInfo.method,
|
349
|
+
headers: apiInfo.headers,
|
350
|
+
data: params
|
351
|
+
})
|
352
|
+
.then(res => {
|
353
|
+
this.tableConfig.loading.show = false;
|
354
|
+
let data = [];
|
355
|
+
if (this.tableConfig.pageInfo.show) {
|
356
|
+
data = res.records;
|
357
|
+
this.tableConfig.pageInfo.options.total = Number(res.total);
|
358
|
+
} else {
|
359
|
+
data = res;
|
360
|
+
}
|
361
|
+
this.tableData = data;
|
362
|
+
})
|
363
|
+
.catch(err => {
|
364
|
+
this.tableConfig.loading.show = false;
|
365
|
+
});
|
366
|
+
},
|
367
|
+
requestAddData(data) {
|
368
|
+
if (!this.networkConfig.add) return;
|
369
|
+
this.dialog.action.loading = true;
|
370
|
+
const apiInfo = this.networkConfig.add;
|
371
|
+
this.axios({
|
372
|
+
url: apiInfo.api,
|
373
|
+
method: apiInfo.method,
|
374
|
+
headers: apiInfo.headers,
|
375
|
+
data: { ...apiInfo.params, ...data }
|
376
|
+
})
|
377
|
+
.then(res => {
|
378
|
+
this.dialog.action.loading = false;
|
379
|
+
this.requestListData();
|
380
|
+
})
|
381
|
+
.catch(err => {
|
382
|
+
this.dialog.action.loading = false;
|
383
|
+
});
|
384
|
+
},
|
385
|
+
requestEditData(data) {
|
386
|
+
if (!this.networkConfig.edit) return;
|
387
|
+
this.dialog.action.loading = true;
|
388
|
+
const apiInfo = this.networkConfig.edit;
|
389
|
+
this.axios({
|
390
|
+
url: apiInfo.api,
|
391
|
+
method: apiInfo.method,
|
392
|
+
headers: apiInfo.headers,
|
393
|
+
data: { ...apiInfo.params, ...data }
|
394
|
+
})
|
395
|
+
.then(res => {
|
396
|
+
this.dialog.action.loading = false;
|
397
|
+
this.requestListData();
|
398
|
+
})
|
399
|
+
.catch(err => {
|
400
|
+
this.dialog.action.loading = false;
|
401
|
+
});
|
402
|
+
},
|
403
|
+
requestDeleteData(callback) {
|
404
|
+
if (!this.networkConfig.delete) return;
|
405
|
+
this.dialog.action.loading = true;
|
406
|
+
const apiInfo = this.networkConfig.delete;
|
407
|
+
this.axios({
|
408
|
+
url: apiInfo.api,
|
409
|
+
method: apiInfo.method,
|
410
|
+
headers: apiInfo.headers,
|
411
|
+
data: { ...apiInfo.params, ids: this.dialog.data.id }
|
412
|
+
})
|
413
|
+
.then(res => {
|
414
|
+
callback(true);
|
415
|
+
this.dialog.action.loading = false;
|
416
|
+
this.requestListData();
|
417
|
+
})
|
418
|
+
.catch(err => {
|
419
|
+
this.dialog.action.loading = false;
|
420
|
+
});
|
421
|
+
},
|
422
|
+
requestBatchDeleteData() {
|
423
|
+
if (!this.networkConfig.batchDelete) return;
|
424
|
+
this.$confirm("确认删除多条数据吗?", "操作提示", {
|
425
|
+
confirmButtonText: "删除",
|
426
|
+
cancelButtonText: "取消",
|
427
|
+
type: "warning"
|
428
|
+
})
|
429
|
+
.then(() => {
|
430
|
+
this.dialog.action.loading = true;
|
431
|
+
const data = [];
|
432
|
+
for (const item of this.tableSelectionData) {
|
433
|
+
data.push(item.id);
|
434
|
+
}
|
435
|
+
const apiInfo = this.networkConfig.batchDelete;
|
436
|
+
this.axios({
|
437
|
+
url: apiInfo.api,
|
438
|
+
method: apiInfo.method,
|
439
|
+
headers: apiInfo.headers,
|
440
|
+
data: { ...apiInfo.params, ...data }
|
441
|
+
})
|
442
|
+
.then(res => {
|
443
|
+
callback(true);
|
444
|
+
this.dialog.action.loading = false;
|
445
|
+
this.requestListData();
|
446
|
+
})
|
447
|
+
.catch(err => {
|
448
|
+
this.dialog.action.loading = false;
|
449
|
+
});
|
450
|
+
})
|
451
|
+
.catch(() => {});
|
452
|
+
},
|
453
|
+
requestFormConfigData(action) {
|
454
|
+
this.axios({
|
455
|
+
url: this.network.form.url,
|
456
|
+
method: this.network.form.method,
|
457
|
+
headers: this.network.form.headers,
|
458
|
+
// data: { id: action.form.id }
|
459
|
+
data: { ...this.network.page.params, id: this.id }
|
460
|
+
})
|
461
|
+
.then(res => {
|
462
|
+
const data = res.data;
|
463
|
+
data.forEach(item => {
|
464
|
+
if (item.type === "0" && action.act === "add") {
|
465
|
+
this.formConfig = JSON.parse(item.pageConfig);
|
466
|
+
return;
|
467
|
+
}
|
468
|
+
if (item.type === "1" && action.act === "edit") {
|
469
|
+
this.formConfig = JSON.parse(item.pageConfig);
|
470
|
+
return;
|
471
|
+
}
|
472
|
+
});
|
473
|
+
})
|
474
|
+
.catch(err => {});
|
475
|
+
},
|
476
|
+
handleSearchSubmit(val) {
|
477
|
+
this.requestListData();
|
478
|
+
},
|
479
|
+
handleSearchReset(val) {
|
480
|
+
this.requestListData();
|
481
|
+
},
|
482
|
+
handleToolsClick(action) {
|
483
|
+
console.log("handleToolsClick =>", action);
|
484
|
+
switch (action.act) {
|
485
|
+
case "add":
|
486
|
+
this.dialog = { show: true, data: {}, action: action };
|
487
|
+
this.requestFormConfigData(action);
|
488
|
+
break;
|
489
|
+
case "batchDelete":
|
490
|
+
this.dialog = { show: false, data: {}, action: action };
|
491
|
+
this.requestBatchDeleteData();
|
492
|
+
break;
|
493
|
+
case "export":
|
494
|
+
action.loading = true;
|
495
|
+
setTimeout(() => {
|
496
|
+
action.loading = false;
|
497
|
+
this.tableSelectionData = [];
|
498
|
+
this.$refs.tableRef.getTable().clearSelection();
|
499
|
+
}, 1000);
|
500
|
+
break;
|
501
|
+
case "import":
|
502
|
+
break;
|
503
|
+
|
504
|
+
default:
|
505
|
+
break;
|
506
|
+
}
|
507
|
+
},
|
508
|
+
handleActionClick(index, item, action, callback) {
|
509
|
+
console.log("handleActionClick =>", item, action);
|
510
|
+
switch (action.act) {
|
511
|
+
case "edit":
|
512
|
+
this.dialog = { show: true, data: item, action: action };
|
513
|
+
this.requestFormConfigData(action);
|
514
|
+
break;
|
515
|
+
case "detail":
|
516
|
+
this.dialog = { show: true, data: item, action: action };
|
517
|
+
this.requestFormConfigData(action);
|
518
|
+
break;
|
519
|
+
case "delete":
|
520
|
+
this.dialog = { show: false, data: item, action: action };
|
521
|
+
this.requestDeleteData(callback);
|
522
|
+
break;
|
523
|
+
|
524
|
+
default:
|
525
|
+
break;
|
526
|
+
}
|
527
|
+
},
|
528
|
+
handleDialogAffirm(val) {
|
529
|
+
this.$refs.formGenerate.getData().then(data => {
|
530
|
+
console.log("handleDialogAffirm =>", data);
|
531
|
+
switch (this.dialog.action.act) {
|
532
|
+
case "add":
|
533
|
+
this.requestAddData(data);
|
534
|
+
break;
|
535
|
+
case "edit":
|
536
|
+
this.dialog.data = Object.assign(this.dialog.data, data);
|
537
|
+
this.requestEditData(this.dialog.data);
|
538
|
+
break;
|
539
|
+
|
540
|
+
default:
|
541
|
+
break;
|
542
|
+
}
|
543
|
+
this.formConfig = null;
|
544
|
+
this.dialog.show = false;
|
545
|
+
});
|
546
|
+
},
|
547
|
+
handleDialogClose() {
|
548
|
+
this.formConfig = null;
|
549
|
+
},
|
550
|
+
handlePagingChange(val) {
|
551
|
+
this.requestListData();
|
552
|
+
},
|
553
|
+
handleSelectionChange(val) {
|
554
|
+
this.tableSelectionData = val;
|
555
|
+
}
|
556
|
+
}
|
557
|
+
};
|
558
|
+
</script>
|
559
|
+
|
560
|
+
<style lang="scss" scoped></style>
|