simple-frame-unit 1.0.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/.env.dev +14 -0
- package/CHANGELOG.md +9 -0
- package/README.md +24 -0
- package/dist/ed-frame-vue.common.1.js +11046 -0
- package/dist/ed-frame-vue.common.1.js.map +1 -0
- package/dist/ed-frame-vue.common.2.js +1715 -0
- package/dist/ed-frame-vue.common.2.js.map +1 -0
- package/dist/ed-frame-vue.common.js +53427 -0
- package/dist/ed-frame-vue.common.js.map +1 -0
- package/dist/ed-frame-vue.umd.1.js +11046 -0
- package/dist/ed-frame-vue.umd.1.js.map +1 -0
- package/dist/ed-frame-vue.umd.2.js +1715 -0
- package/dist/ed-frame-vue.umd.2.js.map +1 -0
- package/dist/ed-frame-vue.umd.js +53437 -0
- package/dist/ed-frame-vue.umd.js.map +1 -0
- package/dist/ed-frame-vue.umd.min.1.js +17 -0
- package/dist/ed-frame-vue.umd.min.1.js.map +1 -0
- package/dist/ed-frame-vue.umd.min.2.js +4 -0
- package/dist/ed-frame-vue.umd.min.2.js.map +1 -0
- package/dist/ed-frame-vue.umd.min.js +470 -0
- package/dist/ed-frame-vue.umd.min.js.map +1 -0
- package/import.easydata.js +46 -0
- package/lib/CHANGELOG.md +18 -0
- package/lib/README.md +27 -0
- package/lib/api/ds/index.js +124 -0
- package/lib/api/easyData.js +90 -0
- package/lib/api/easyform/easyForm.js +32 -0
- package/lib/api/index.js +61 -0
- package/lib/api/interface/index.js +32 -0
- package/lib/api/system.js +20 -0
- package/lib/index.js +80 -0
- package/lib/packages/BasicTemplate/EasyDataTemplate.vue +189 -0
- package/lib/packages/BasicTemplate/Props.js +64 -0
- package/lib/packages/BasicTemplate/components/TemplateComp.vue +263 -0
- package/lib/packages/BasicTemplate/components/TemplateViews.vue +292 -0
- package/lib/packages/BasicTemplate/hooks/business.js +74 -0
- package/lib/packages/BasicTemplate/hooks/getFormData.js +89 -0
- package/lib/packages/BasicTemplate/hooks/queryFormData.js +194 -0
- package/lib/packages/BasicTemplate/hooks/submitForm.js +53 -0
- package/lib/packages/BasicTemplate/hooks/useEmits.js +15 -0
- package/lib/packages/BasicTemplate/hooks/validate.js +42 -0
- package/lib/packages/EasyDataForm/EasyDataForm.vue +597 -0
- package/lib/packages/EasyDataForm/Props.js +22 -0
- package/lib/packages/EasyDataForm/components/FormItem.vue +228 -0
- package/lib/packages/EasyDataForm/hooks/useChosePopup.js +85 -0
- package/lib/packages/EasyDataForm/hooks/useEmits.js +19 -0
- package/lib/packages/EasyDataForm/hooks/useForm.js +169 -0
- package/lib/packages/EasyDataForm/hooks/useUpload.js +168 -0
- package/lib/packages/EasyDataList/EasyDataList.vue +348 -0
- package/lib/packages/EasyDataList/Props.js +116 -0
- package/lib/packages/EasyDataList/components/BasicModal.vue +150 -0
- package/lib/packages/EasyDataList/components/FormAction.vue +63 -0
- package/lib/packages/EasyDataList/hooks/useEmits.js +30 -0
- package/lib/packages/EasyDataList/hooks/useForm.js +62 -0
- package/lib/packages/EasyDataList/hooks/useTable.js +314 -0
- package/lib/packages/EasyDataTable/EasyDataTable.vue +233 -0
- package/lib/packages/EasyDataView/EasyDataView.vue +105 -0
- package/lib/packages/EdRichPreview/index.js +32 -0
- package/lib/packages/EdRichText/index.vue +167 -0
- package/lib/packages/EdRichText/replaceUrl.js +49 -0
- package/lib/packages/components/FileView.vue +97 -0
- package/lib/packages/index.js +11 -0
- package/lib/packages/mixins/EasyDataMixins.js +133 -0
- package/lib/packages/mixins/useTable.jsx +130 -0
- package/lib/pages/DataSource/index.js +8 -0
- package/lib/pages/DataSource/src/components/ControlViews/BaseProps.js +103 -0
- package/lib/pages/DataSource/src/components/ControlViews/control.js +1089 -0
- package/lib/pages/DataSource/src/components/ControlViews/index.vue +301 -0
- package/lib/pages/DataSource/src/components/TableOperationModal.vue +225 -0
- package/lib/pages/DataSource/src/components/TablePropsModal.vue +367 -0
- package/lib/pages/DataSource/src/components/ViewPropsModal.vue +737 -0
- package/lib/pages/DataSource/src/components/modal/ChooseDict.vue +119 -0
- package/lib/pages/DataSource/src/hooks/useTable.js +138 -0
- package/lib/pages/DataSource/src/index.vue +431 -0
- package/lib/pages/Interface/index.js +8 -0
- package/lib/pages/Interface/src/components/InterfaceCall.vue +73 -0
- package/lib/pages/Interface/src/components/InterfaceDepend.vue +299 -0
- package/lib/pages/Interface/src/components/InterfaceFee.vue +131 -0
- package/lib/pages/Interface/src/components/InterfaceMessage.vue +878 -0
- package/lib/pages/Interface/src/components/InterfaceMock.vue +203 -0
- package/lib/pages/Interface/src/components/InterfaceParam.vue +308 -0
- package/lib/pages/Interface/src/components/InterfaceRepeat.vue +281 -0
- package/lib/pages/Interface/src/components/InterfaceVariable.vue +31 -0
- package/lib/pages/Interface/src/index.vue +216 -0
- package/lib/pages/Template/index.js +8 -0
- package/lib/pages/Template/src/components/DefineModal.vue +524 -0
- package/lib/pages/Template/src/components/TemplatePreview.vue +109 -0
- package/lib/pages/Template/src/components/model/AddDialog.vue +60 -0
- package/lib/pages/Template/src/components/model/TemplatePreview2.vue +101 -0
- package/lib/pages/Template/src/hooks/index.js +3 -0
- package/lib/pages/Template/src/hooks/useEmits.js +64 -0
- package/lib/pages/Template/src/index.vue +124 -0
- package/lib/popup/index.js +8 -0
- package/lib/popup/src/DataSourceChoose.vue +44 -0
- package/lib/popup/src/DataSourceViewIdChoose.vue +67 -0
- package/lib/popup/src/DictChoose.vue +104 -0
- package/lib/popup/src/InterfaceChoose.vue +46 -0
- package/lib/popup/src/OrgChoose.vue +121 -0
- package/lib/popup/src/RoleChoose.vue +101 -0
- package/lib/popup/src/TemplateChoose.vue +43 -0
- package/lib/popup/src/UserChoose.vue +161 -0
- package/lib/popup//347/273/204/344/273/266/345/274/200/345/217/221/350/247/204/350/214/203.md +25 -0
- package/lib/style/custom.scss +126 -0
- package/lib/style/deep.scss +109 -0
- package/lib/style/index.scss +4 -0
- package/lib/utils/MapLoader.js +48 -0
- package/lib/utils/dateUtils.js +58 -0
- package/lib/utils/index.js +8 -0
- package/lib/utils/setting.js +25 -0
- package/lib/utils/sortable/index.js +3784 -0
- package/lib/utils/useBusiness.js +212 -0
- package/lib/utils/utils.js +588 -0
- package/package.json +77 -0
- package/src/App.vue +12 -0
- package/src/assets/Vue.png +0 -0
- package/src/assets/avatar.png +0 -0
- package/src/assets/images/bg.png +0 -0
- package/src/assets/images/logo-bills.png +0 -0
- package/src/assets/images/pic.png +0 -0
- package/src/assets/images/weplus-logo.png +0 -0
- package/src/assets/marker.png +0 -0
- package/src/assets/styles/common.scss +359 -0
- package/src/assets/styles/ele-docs.css +3278 -0
- package/src/assets/styles/fonts/icomoon.eot +0 -0
- package/src/assets/styles/fonts/icomoon.svg +14 -0
- package/src/assets/styles/fonts/icomoon.ttf +0 -0
- package/src/assets/styles/fonts/icomoon.woff +0 -0
- package/src/assets/styles/fonts/style.css +39 -0
- package/src/assets/styles/higtlightEle.css +84 -0
- package/src/assets/svg/code.svg +7 -0
- package/src/assets/svg/password.svg +1 -0
- package/src/components/Popups/DiyCompDictChoose.vue +112 -0
- package/src/components/Popups/index.js +28 -0
- package/src/components/ed-base-vue/global/variable.js +8 -0
- package/src/components/ed-base-vue/index.js +81 -0
- package/src/components/ed-base-vue/package/EdCard/index.js +7 -0
- package/src/components/ed-base-vue/package/EdCard/src/index.vue +87 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/index.js +8 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/AceEditor/AceConfig.js +71 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/AceEditor/Editor.vue +137 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/AceEditor/Toolbar.vue +68 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/AceEditor/index.vue +119 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/AceEditor/webpack-resolver.js +51 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/Codemirror/Toolbar.vue +57 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/Codemirror/config.js +64 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/Codemirror/index.vue +309 -0
- package/src/components/ed-base-vue/package/EdCodeEditor/src/EdCodeEditor.vue +238 -0
- package/src/components/ed-base-vue/package/EdDate/index.js +8 -0
- package/src/components/ed-base-vue/package/EdDate/src/index.js +50 -0
- package/src/components/ed-base-vue/package/EdDescriptions/index.js +8 -0
- package/src/components/ed-base-vue/package/EdDescriptions/src/EdDescriptions.vue +46 -0
- package/src/components/ed-base-vue/package/EdDescriptions/src/EdDescriptionsItem.js +20 -0
- package/src/components/ed-base-vue/package/EdDescriptions/src/Props.js +20 -0
- package/src/components/ed-base-vue/package/EdDialog/index.js +8 -0
- package/src/components/ed-base-vue/package/EdDialog/src/EdDialog.vue +138 -0
- package/src/components/ed-base-vue/package/EdDialog/src/Props.js +91 -0
- package/src/components/ed-base-vue/package/EdDialog/src/components/DialogFooter.vue +42 -0
- package/src/components/ed-base-vue/package/EdDialog/src/components/DialogWrapper.vue +53 -0
- package/src/components/ed-base-vue/package/EdDrawer/index.js +8 -0
- package/src/components/ed-base-vue/package/EdDrawer/src/DrawerFooter.vue +41 -0
- package/src/components/ed-base-vue/package/EdDrawer/src/EdDrawer.vue +150 -0
- package/src/components/ed-base-vue/package/EdDrawer/src/props.js +71 -0
- package/src/components/ed-base-vue/package/EdFlow/index.js +8 -0
- package/src/components/ed-base-vue/package/EdFlow/src/EdFlowItem.vue +733 -0
- package/src/components/ed-base-vue/package/EdFlow/src/index.vue +148 -0
- package/src/components/ed-base-vue/package/EdForm/index.js +8 -0
- package/src/components/ed-base-vue/package/EdForm/src/EdForm.vue +172 -0
- package/src/components/ed-base-vue/package/EdForm/src/Props.js +33 -0
- package/src/components/ed-base-vue/package/EdForm/src/components/EdFormItem.vue +34 -0
- package/src/components/ed-base-vue/package/EdIcons/index.js +8 -0
- package/src/components/ed-base-vue/package/EdIcons/src/hooks/Icons.js +406 -0
- package/src/components/ed-base-vue/package/EdIcons/src/hooks/Icons1.js +830 -0
- package/src/components/ed-base-vue/package/EdIcons/src/index.vue +13 -0
- package/src/components/ed-base-vue/package/EdImage/index.js +8 -0
- package/src/components/ed-base-vue/package/EdImage/src/index.vue +28 -0
- package/src/components/ed-base-vue/package/EdInputArray/index.js +8 -0
- package/src/components/ed-base-vue/package/EdInputArray/src/Props.js +26 -0
- package/src/components/ed-base-vue/package/EdInputArray/src/index.vue +97 -0
- package/src/components/ed-base-vue/package/EdInputColor/index.js +8 -0
- package/src/components/ed-base-vue/package/EdInputColor/src/InputColor.vue +81 -0
- package/src/components/ed-base-vue/package/EdInputMap/index.js +9 -0
- package/src/components/ed-base-vue/package/EdInputMap/src/EdInputMap.vue +246 -0
- package/src/components/ed-base-vue/package/EdInputMap/src/EdInputMapProps.js +6 -0
- package/src/components/ed-base-vue/package/EdInputPop/index.js +13 -0
- package/src/components/ed-base-vue/package/EdInputPop/src/EdInputPop.vue +144 -0
- package/src/components/ed-base-vue/package/EdInputPop/src/Props.js +48 -0
- package/src/components/ed-base-vue/package/EdInputTable/index.js +8 -0
- package/src/components/ed-base-vue/package/EdInputTable/src/EdInputTable.vue +368 -0
- package/src/components/ed-base-vue/package/EdInputTable/src/Fetch.js +40 -0
- package/src/components/ed-base-vue/package/EdJsonEditor/index.js +13 -0
- package/src/components/ed-base-vue/package/EdJsonEditor/src/EdJsonEditor.vue +198 -0
- package/src/components/ed-base-vue/package/EdJsonEditor/src/assets/img/jsoneditor-icons.svg +749 -0
- package/src/components/ed-base-vue/package/EdJsonEditor/src/assets/jsoneditor.css +2031 -0
- package/src/components/ed-base-vue/package/EdJsonEditor/src/assets/plus.svg +1 -0
- package/src/components/ed-base-vue/package/EdJsonEditor/src/hooks.js +63 -0
- package/src/components/ed-base-vue/package/EdJsonViewer/index.js +8 -0
- package/src/components/ed-base-vue/package/EdJsonViewer/src/EdJsonViewer.vue +44 -0
- package/src/components/ed-base-vue/package/EdLable/index.js +8 -0
- package/src/components/ed-base-vue/package/EdLable/src/index.vue +34 -0
- package/src/components/ed-base-vue/package/EdLink/index.js +8 -0
- package/src/components/ed-base-vue/package/EdLink/src/index.vue +43 -0
- package/src/components/ed-base-vue/package/EdMarkEditor/index.js +15 -0
- package/src/components/ed-base-vue/package/EdMarkEditor/src/EdMarkEditor.vue +368 -0
- package/src/components/ed-base-vue/package/EdMarkEditor/src/extra-function.js +538 -0
- package/src/components/ed-base-vue/package/EdMarkEditor/src/highlight.js +95 -0
- package/src/components/ed-base-vue/package/EdTable/index.js +8 -0
- package/src/components/ed-base-vue/package/EdTable/src/EdTable.vue +240 -0
- package/src/components/ed-base-vue/package/EdTable/src/Props.js +97 -0
- package/src/components/ed-base-vue/package/EdTable/src/components/TableColumnItem.js +24 -0
- package/src/components/ed-base-vue/package/EdTable/src/components/TablePagination.vue +73 -0
- package/src/components/ed-base-vue/package/EdTableEditor/index.js +8 -0
- package/src/components/ed-base-vue/package/EdTableEditor/src/EdTableEditor.vue +282 -0
- package/src/components/ed-base-vue/package/EdTableEditor/src/Props.js +107 -0
- package/src/components/ed-base-vue/package/EdTableEditor/src/hooks/validate.js +90 -0
- package/src/components/ed-base-vue/package/EdUpload/index.js +8 -0
- package/src/components/ed-base-vue/package/EdUpload/src/Props.js +90 -0
- package/src/components/ed-base-vue/package/EdUpload/src/index.vue +88 -0
- package/src/components/ed-base-vue/package/EdViewer/index.js +8 -0
- package/src/components/ed-base-vue/package/EdViewer/src/EdViewer.vue +310 -0
- package/src/components/ed-base-vue/package/EdWangEditor/index.js +14 -0
- package/src/components/ed-base-vue/package/EdWangEditor/src/EdWangEditor.vue +127 -0
- package/src/components/ed-base-vue/package/ExtendSlot.js +12 -0
- package/src/components/ed-base-vue/package/OptionSlot.js +65 -0
- package/src/components/ed-base-vue/plugin/Message/index.js +2 -0
- package/src/components/ed-base-vue/plugin/Message/src/main.js +91 -0
- package/src/components/ed-base-vue/plugin/Message/src/main.vue +253 -0
- package/src/components/ed-base-vue/plugin/print/index.js +156 -0
- package/src/components/ed-base-vue/plugin/sortable/index.js +3784 -0
- package/src/components/ed-base-vue/style/custom.scss +107 -0
- package/src/components/ed-base-vue/style/deep.scss +100 -0
- package/src/components/ed-base-vue/style/index.scss +4 -0
- package/src/components/ed-base-vue/tools/date-format.js +315 -0
- package/src/components/ed-base-vue/tools/utils.js +124 -0
- package/src/layouts/components/AppMain.vue +17 -0
- package/src/layouts/components/Header.vue +256 -0
- package/src/layouts/components/Logo.vue +56 -0
- package/src/layouts/components/Navbar.vue +169 -0
- package/src/layouts/components/SideBar.vue +107 -0
- package/src/layouts/components/index.js +5 -0
- package/src/layouts/index.vue +57 -0
- package/src/main.js +42 -0
- package/src/request/config.js +6 -0
- package/src/request/index.js +85 -0
- package/src/request/request.js +147 -0
- package/src/router/index.js +65 -0
- package/src/router/modules/baseRouter.js +43 -0
- package/src/router/modules/easydata.js +49 -0
- package/src/views/base/BaseRichPreview.vue +23 -0
- package/src/views/base/BaseRichText.vue +28 -0
- package/src/views/base/EdFormView.vue +54 -0
- package/src/views/base/EdTable.vue +98 -0
- package/src/views/base/inputTable.vue +103 -0
- package/src/views/easydata/Interface.vue +3 -0
- package/src/views/easydata/dataSource.vue +13 -0
- package/src/views/easydata/dataSourceView.vue +71 -0
- package/src/views/easydata/templateDemo.vue +89 -0
- package/src/views/easydata/templateInfo.vue +13 -0
- package/src/views/index.vue +17 -0
- package/src/views/login.vue +208 -0
- package/src/views/redirect.vue +15 -0
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ed-dialog v-model="dialogVisible" :close-on-press-escape="true" :fullscreen="fullscreen" :showFooter="false"
|
|
3
|
+
title="表属性管理">
|
|
4
|
+
<el-form ref="tableInfoForm" :inline="true" :model="tableInfoForm" :rules="rules" class="demo-form-inline">
|
|
5
|
+
<el-card class="es-box-card">
|
|
6
|
+
<div slot="header" class="es-box-card--header">
|
|
7
|
+
<span>表信息</span>
|
|
8
|
+
<div class="es-card-header-operate">
|
|
9
|
+
<el-button :loading="loading" icon="el-icon-document-add" type="primary" @click="saveTableInfo">保存
|
|
10
|
+
</el-button>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<el-form-item :rules="[{required: true, message: '请输入表名称', trigger: 'blur'}]" label="表名称" prop="tableName">
|
|
15
|
+
<el-input v-model="tableInfoForm.tableName" :disabled="isExistTable" placeholder="表名称"
|
|
16
|
+
style="width:300px"></el-input>
|
|
17
|
+
</el-form-item>
|
|
18
|
+
<el-form-item label="表备注" label-width="300px" prop="remark">
|
|
19
|
+
<el-input v-model="tableInfoForm.remark" placeholder="表备注" style="width:300px"></el-input>
|
|
20
|
+
</el-form-item>
|
|
21
|
+
</el-card>
|
|
22
|
+
|
|
23
|
+
<el-card class="es-box-card es-box-card--top">
|
|
24
|
+
<div slot="header" class="es-box-card--header">
|
|
25
|
+
<span>虚拟列信息</span>
|
|
26
|
+
<div>
|
|
27
|
+
<el-button :loading="loading" icon="el-icon-plus" plain type="primary" @click="addVirtualColumns">添加
|
|
28
|
+
</el-button>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<el-table ref="virtualTable" :data="tableInfoForm.tableData" :height="350" :loading="loading" row-key="id" style="width: 100%">
|
|
32
|
+
<el-table-column label="#" type="index" key="index"></el-table-column>
|
|
33
|
+
|
|
34
|
+
<el-table-column v-for="(column, index) in tableColumns" :key="index" :label="column.label"
|
|
35
|
+
:prop="column.prop">
|
|
36
|
+
<template v-slot:default="{row, $index}">
|
|
37
|
+
<el-form-item :prop="`tableData[${$index}].${column.prop}`" :rules="rules[column.prop]">
|
|
38
|
+
<template v-if="column.slots === 'operate'">
|
|
39
|
+
<el-button style="color: red" type="text" @click="deleteRow(row, $index)">删除</el-button>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<component :is="column.tags" v-else v-model="row[column.prop]" :placeholder="column.placeholder"
|
|
43
|
+
v-on="column.on">
|
|
44
|
+
<template v-if="column.hasOwnProperty('options')">
|
|
45
|
+
<el-option
|
|
46
|
+
v-for="(item, index) in column.options"
|
|
47
|
+
:key="index"
|
|
48
|
+
:label="item.label"
|
|
49
|
+
:value="item.value"></el-option>
|
|
50
|
+
</template>
|
|
51
|
+
</component>
|
|
52
|
+
</el-form-item>
|
|
53
|
+
</template>
|
|
54
|
+
</el-table-column>
|
|
55
|
+
</el-table>
|
|
56
|
+
</el-card>
|
|
57
|
+
|
|
58
|
+
<el-card class="es-box-card es-box-card--top" style="margin-top: 15px">
|
|
59
|
+
<div slot="header" class="es-box-card--header">
|
|
60
|
+
<span>表SQL信息</span>
|
|
61
|
+
<div>
|
|
62
|
+
<el-button :loading="loading" icon="el-icon-plus" plain type="primary"
|
|
63
|
+
@click="tableInfoForm.sqlData.push({})">
|
|
64
|
+
添加
|
|
65
|
+
</el-button>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
<el-table v-loading="loading" :data="tableInfoForm.sqlData" :loading="loading" row-key="id" style="width: 100%">
|
|
69
|
+
<el-table-column label="#" type="index"></el-table-column>
|
|
70
|
+
<el-table-column label="sqlId" prop="sqlId">
|
|
71
|
+
<template slot-scope="scope">
|
|
72
|
+
<el-form-item :prop="`sqlData[${scope.$index}].sqlId`" :rules="rules.sqlId" style="margin-top: 3px">
|
|
73
|
+
<el-input v-model="scope.row.sqlId" placeholder="sqlId"></el-input>
|
|
74
|
+
</el-form-item>
|
|
75
|
+
</template>
|
|
76
|
+
</el-table-column>
|
|
77
|
+
<el-table-column label="sql内容" prop="sqlId">
|
|
78
|
+
<template slot-scope="scope">
|
|
79
|
+
<el-form-item :prop="`sqlData[${scope.$index}].sqlContent`" :rules="rules.sqlContent"
|
|
80
|
+
style="margin-top: 3px">
|
|
81
|
+
<el-input v-model="scope.row.sqlContent" autosize placeholder="sql内容" style="width:300px"
|
|
82
|
+
type="textarea"></el-input>
|
|
83
|
+
</el-form-item>
|
|
84
|
+
</template>
|
|
85
|
+
</el-table-column>
|
|
86
|
+
<el-table-column label="操作" prop="action">
|
|
87
|
+
<template slot-scope="scope">
|
|
88
|
+
<el-button slot="reference" style="color: red" type="text" @click="deleteSqlRow(scope)">删除</el-button>
|
|
89
|
+
</template>
|
|
90
|
+
</el-table-column>
|
|
91
|
+
</el-table>
|
|
92
|
+
</el-card>
|
|
93
|
+
</el-form>
|
|
94
|
+
</ed-dialog>
|
|
95
|
+
</template>
|
|
96
|
+
|
|
97
|
+
<script>
|
|
98
|
+
import ds from '../../../../api/ds'
|
|
99
|
+
export default {
|
|
100
|
+
name: "TablePropsModal",
|
|
101
|
+
data() {
|
|
102
|
+
const validateFieldName = (rule, value, callback) => {
|
|
103
|
+
if (!value) {
|
|
104
|
+
return callback(new Error('必填'));
|
|
105
|
+
}
|
|
106
|
+
let arr = ['id', 'key_info', 'data_info', 'create_time', 'update_time', 'insert_user', 'insert_user_name', 'insert_org', 'select', 'insert', 'update', 'orgCode', 'updater', 'creator']
|
|
107
|
+
let index = arr.indexOf(value)
|
|
108
|
+
if (index > -1) {
|
|
109
|
+
this.$message.error(`不能使用 ${value} 作为字段名称`)
|
|
110
|
+
return callback(new Error(`不能使用 ${value}' 作为字段名称`));
|
|
111
|
+
}
|
|
112
|
+
callback();
|
|
113
|
+
};
|
|
114
|
+
return {
|
|
115
|
+
dialogVisible: false,
|
|
116
|
+
loading: false,
|
|
117
|
+
isExistTable: false,
|
|
118
|
+
fullscreen: true,
|
|
119
|
+
deleteIds: [],
|
|
120
|
+
deleteSqlIds: [],
|
|
121
|
+
dataSourceId: '',
|
|
122
|
+
isGeneralColumn: 0,
|
|
123
|
+
|
|
124
|
+
tableInfoForm: {id: '', tableData: [], sqlData: []},
|
|
125
|
+
rules: {
|
|
126
|
+
fieldName: [
|
|
127
|
+
{validator: validateFieldName, trigger: 'blur'}
|
|
128
|
+
],
|
|
129
|
+
remark: [
|
|
130
|
+
{required: true, message: '必填', trigger: 'blur'},
|
|
131
|
+
],
|
|
132
|
+
length: [
|
|
133
|
+
{required: true, message: '必填', trigger: 'blur'},
|
|
134
|
+
],
|
|
135
|
+
dataType: [
|
|
136
|
+
{required: true, message: '必选', trigger: 'change'},
|
|
137
|
+
],
|
|
138
|
+
sqlId: [
|
|
139
|
+
{required: true, message: '必填', trigger: 'blur'},
|
|
140
|
+
],
|
|
141
|
+
sqlContent: [
|
|
142
|
+
{required: true, message: '必填', trigger: 'blur'},
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
options: [ // 下拉选项
|
|
146
|
+
{label: 'varchar', value: 'VARCHAR'},
|
|
147
|
+
{label: 'integer', value: 'INTEGER'},
|
|
148
|
+
{label: 'bigint', value: 'BIGINT'},
|
|
149
|
+
{label: 'jsontext', value: 'JSONTEXT'},
|
|
150
|
+
{label: 'longtext', value: 'LONGTEXT'},
|
|
151
|
+
{label: 'datetime', value: 'DATETIME'},
|
|
152
|
+
],
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
computed: {
|
|
156
|
+
tableColumns() {
|
|
157
|
+
let columns = [
|
|
158
|
+
{
|
|
159
|
+
label: "字段名称",
|
|
160
|
+
prop: 'fieldName',
|
|
161
|
+
tags: 'EdInputPop',
|
|
162
|
+
placeholder: '字段名称'
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
label: "长度",
|
|
166
|
+
prop: 'length',
|
|
167
|
+
tags: 'el-input',
|
|
168
|
+
placeholder: '长度',
|
|
169
|
+
on: {
|
|
170
|
+
input: (value) => value.replace(/[^0-9]/g, '')
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
label: "字段类型",
|
|
175
|
+
prop: 'dataType',
|
|
176
|
+
tags: 'el-select',
|
|
177
|
+
placeholder: '字段类型',
|
|
178
|
+
options: [ // 下拉选项
|
|
179
|
+
{label: 'varchar', value: 'VARCHAR'},
|
|
180
|
+
{label: 'integer', value: 'INTEGER'},
|
|
181
|
+
{label: 'bigint', value: 'BIGINT'},
|
|
182
|
+
{label: 'jsontext', value: 'JSONTEXT'},
|
|
183
|
+
{label: 'longtext', value: 'LONGTEXT'},
|
|
184
|
+
{label: 'datetime', value: 'DATETIME'},
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
label: "备注",
|
|
189
|
+
prop: 'remark',
|
|
190
|
+
tags: 'EdInputPop',
|
|
191
|
+
placeholder: '备注'
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
label: "虚拟列表达式",
|
|
195
|
+
prop: 'expression',
|
|
196
|
+
tags: 'EdInputPop',
|
|
197
|
+
placeholder: '虚拟列表达式',
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
label: "是否唯一",
|
|
201
|
+
prop: 'isUnique',
|
|
202
|
+
tags: 'el-switch'
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
label: "组合唯一索引",
|
|
206
|
+
prop: 'isAllUnique',
|
|
207
|
+
tags: 'el-switch'
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
label: "是否索引",
|
|
211
|
+
prop: 'isIndex',
|
|
212
|
+
tags: 'el-switch'
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
label: "启用存储模式",
|
|
216
|
+
prop: 'isStored',
|
|
217
|
+
tags: 'el-switch'
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
label: "操作",
|
|
221
|
+
prop: 'isIndex',
|
|
222
|
+
slots: "operate",
|
|
223
|
+
},
|
|
224
|
+
]
|
|
225
|
+
if(this.isGeneralColumn == 1) {
|
|
226
|
+
columns.splice(4,1)
|
|
227
|
+
columns.splice(7,1)
|
|
228
|
+
}
|
|
229
|
+
return columns
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
methods: {
|
|
233
|
+
showModal(record) {
|
|
234
|
+
this.tableInfoForm = {tableData: [], sqlData: []}
|
|
235
|
+
this.dataSourceId = record.id
|
|
236
|
+
this.isGeneralColumn = record.isGeneralColumn
|
|
237
|
+
|
|
238
|
+
this.isExistTable = false
|
|
239
|
+
const param = {dataSourceId: record.id}
|
|
240
|
+
ds.getTableInfoByDsId(param).then((resp) => {
|
|
241
|
+
if (resp.success) {
|
|
242
|
+
if (resp.data) {
|
|
243
|
+
this.tableInfoForm = Object.assign({}, this.tableInfoForm, resp.data)
|
|
244
|
+
this.isExistTable = resp.data.isExistTable
|
|
245
|
+
this.getFieldListByDsId(param)
|
|
246
|
+
this.getSqlIdList(param)
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}).finally(() => {
|
|
250
|
+
this.dialogVisible = true
|
|
251
|
+
})
|
|
252
|
+
|
|
253
|
+
},
|
|
254
|
+
saveTableInfo() {
|
|
255
|
+
this.$refs['tableInfoForm'].validate((valid) => {
|
|
256
|
+
if (valid) {
|
|
257
|
+
const tableData = this.tableInfoForm.tableData
|
|
258
|
+
if (tableData) {
|
|
259
|
+
let names = tableData.map(item => item["fieldName"]);
|
|
260
|
+
let nameSet = new Set(names);
|
|
261
|
+
if (nameSet.size !== names.length) {
|
|
262
|
+
this.$message.error("存在重复字段名称,请检查!")
|
|
263
|
+
return
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
this.loading = true
|
|
267
|
+
let params = Object.assign({dataSourceId: this.dataSourceId}, this.tableInfoForm);
|
|
268
|
+
ds.addTableInfo(params).then(async (resp) => {
|
|
269
|
+
this.tableInfoForm.id = resp.data.id
|
|
270
|
+
if (resp.success) {
|
|
271
|
+
let formData = {
|
|
272
|
+
fieldInfos: this.tableInfoForm.tableData,
|
|
273
|
+
deleteIds: this.deleteIds,
|
|
274
|
+
dataSourceId: this.dataSourceId
|
|
275
|
+
}
|
|
276
|
+
const resp = await ds.addFieldModel(formData)
|
|
277
|
+
if (resp.success) {
|
|
278
|
+
await this.getFieldListByDsId({dataSourceId: this.dataSourceId})
|
|
279
|
+
let formData = {
|
|
280
|
+
tableSqls: this.tableInfoForm.sqlData,
|
|
281
|
+
deleteIds: this.deleteSqlIds,
|
|
282
|
+
dataSourceId: this.dataSourceId
|
|
283
|
+
}
|
|
284
|
+
ds.addSqlIdInfo(formData).then((resp) => {
|
|
285
|
+
if (resp.success) {
|
|
286
|
+
this.getSqlIdList({dataSourceId: this.dataSourceId})
|
|
287
|
+
this.$message.success(resp.msg || "操作成功!")
|
|
288
|
+
}
|
|
289
|
+
}).finally(() => {
|
|
290
|
+
this.loading = false
|
|
291
|
+
})
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}).catch(() => {
|
|
295
|
+
this.loading = false
|
|
296
|
+
})
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
},
|
|
300
|
+
deleteRow(row, $index) {
|
|
301
|
+
if (row.id) {
|
|
302
|
+
this.deleteIds.push(row.id)
|
|
303
|
+
}
|
|
304
|
+
this.tableInfoForm.tableData.splice($index, 1)
|
|
305
|
+
},
|
|
306
|
+
deleteSqlRow(data) {
|
|
307
|
+
if (data.row.id) {
|
|
308
|
+
this.deleteSqlIds.push(data.row.id)
|
|
309
|
+
}
|
|
310
|
+
this.tableInfoForm.sqlData.splice(data.$index, 1)
|
|
311
|
+
},
|
|
312
|
+
async getFieldListByDsId(param) {
|
|
313
|
+
const resp = await ds.getFieldListByDsId(param)
|
|
314
|
+
if (resp.success) {
|
|
315
|
+
if (resp.data) {
|
|
316
|
+
this.tableInfoForm.tableData = resp.data
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
async getSqlIdList(param) {
|
|
321
|
+
const resp = await ds.getSqlIdList(param)
|
|
322
|
+
if (resp.success) {
|
|
323
|
+
if (resp.data) {
|
|
324
|
+
this.tableInfoForm.sqlData = resp.data
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
// 添加虚拟列
|
|
329
|
+
addVirtualColumns() {
|
|
330
|
+
this.tableInfoForm.tableData.push({
|
|
331
|
+
length: 100,
|
|
332
|
+
dataType: 'VARCHAR',
|
|
333
|
+
isUnique: false,
|
|
334
|
+
isStored: false,
|
|
335
|
+
isIndex: false,
|
|
336
|
+
isAllUnique: false
|
|
337
|
+
})
|
|
338
|
+
|
|
339
|
+
this.searchMember()
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
//跳转表格指定位置
|
|
343
|
+
searchMember() {
|
|
344
|
+
let length = this.tableInfoForm.tableData.length
|
|
345
|
+
let scrollTop = this.$refs.virtualTable.bodyWrapper.scrollTop
|
|
346
|
+
let top = Math.floor(scrollTop / 52)
|
|
347
|
+
// 实现滚动效果
|
|
348
|
+
const timeTop = setInterval(() => {
|
|
349
|
+
top++;
|
|
350
|
+
this.$refs.virtualTable.bodyWrapper.scrollTop = 52 * top;
|
|
351
|
+
if (top >= length) {
|
|
352
|
+
clearInterval(timeTop)
|
|
353
|
+
}
|
|
354
|
+
}, 10)
|
|
355
|
+
},
|
|
356
|
+
validateFieldName() {
|
|
357
|
+
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
</script>
|
|
362
|
+
|
|
363
|
+
<style lang="scss" scoped>
|
|
364
|
+
.el-form-item {
|
|
365
|
+
margin-bottom: 3px;
|
|
366
|
+
}
|
|
367
|
+
</style>
|