@jeecg/online 1.0.1 → 3.4.3
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/AuthButtonConfig.js +15 -9
- package/AuthButtonTree.js +4 -7
- package/AuthDataConfig.js +10 -8
- package/AuthDataTree.js +4 -7
- package/AuthFieldConfig.js +16 -14
- package/AuthFieldTree.js +25 -20
- package/AuthManagerDrawer.js +2 -3
- package/AuthSetterModal.js +2 -2
- package/CgformCopyList.js +34 -24
- package/CgformModal.js +57 -50
- package/CgreportModal.js +32 -39
- package/CheckDictTable.js +146 -26
- package/CodeFileListModal.js +174 -0
- package/CodeFileViewModal.js +324 -0
- package/CodeGeneratorModal.js +42 -40
- package/CustomButtonList.js +19 -23
- package/DBAttributeTable.js +250 -14
- package/DbToOnlineModal.js +28 -27
- package/DetailForm.js +607 -0
- package/EnhanceJavaModal.js +12 -19
- package/EnhanceJsHistory.js +6 -8
- package/EnhanceJsModal.js +17 -18
- package/EnhanceSqlModal.js +12 -19
- package/ExtendConfigModal.js +26 -17
- package/FileSelectModal.js +1 -2
- package/ForeignKeyTable.js +6 -5
- package/FormSchemaFactory.js +163 -30
- package/IndexTable.js +8 -7
- package/JModalTip.js +54 -0
- package/LeftDepart.js +3 -3
- package/LeftRole.js +8 -6
- package/LeftUser.js +8 -6
- package/LinkTableConfigModal.js +288 -0
- package/LinkTableFieldConfigModal.js +217 -0
- package/LinkTableListPiece.js +36 -0
- package/ModalFormDemo.js +4 -4
- package/OnlCgReportList.js +34 -0
- package/OnlineAutoList.js +155 -58
- package/OnlineAutoModal.js +91 -132
- package/OnlineAutoTreeList.js +92 -54
- package/OnlineCustomModal.js +31 -17
- package/OnlineDetailModal.js +182 -0
- package/OnlineForm.js +272 -141
- package/OnlineFormDetail.js +324 -0
- package/OnlineQueryForm.js +72 -42
- package/OnlineSearchFormItem.js +28 -23
- package/OnlineSubFormDetail.js +165 -0
- package/OnlineSuperQuery.js +72 -76
- package/OnlineSuperQueryValComponent.js +1 -0
- package/OnlineSuperQueryValComponent.vue_vue_type_script_lang.js +1 -17
- package/PageAttributeTable.js +233 -31
- package/ProcessOnlineForm.js +41 -18
- package/QueryTable.js +6 -5
- package/README.md +3 -8
- package/_arrayPush.js +5 -3
- package/{cloneDeep.js → _baseClone.js} +5 -9
- package/_baseSlice.js +18 -0
- package/_commonjsHelpers.js +5 -0
- package/_flatRest.js +174 -0
- package/auth.data.js +1 -3
- package/cgform.data.js +18 -9
- package/enhance.api.js +27 -18
- package/index.js +358 -34
- package/index2.js +49 -48
- package/index3.js +29 -26
- package/isArray.js +1 -1
- package/main.index.js +3 -3
- package/omit.js +60 -0
- package/package.json +1 -1
- package/pick.js +3 -173
- package/style.css +1 -1
- package/toString.js +2 -2
- package/useAutoForm.js +3457 -3792
- package/useCgformList.js +44 -31
- package/{useTableColumns.js → useListButton.js} +218 -409
- package/useOnlineTest.js +5 -26827
- package/useSchemas.js +382 -234
- package/useTableSync.js +19 -7
- package/ChartAutoRender.js +0 -69
- package/ChartDoubleRender.js +0 -154
- package/ChartSingleRender.js +0 -132
- package/ChartTabsRender.js +0 -218
- package/ErrorTip.js +0 -21
- package/FieldTable.js +0 -185
- package/GraphreportAutoChart.js +0 -352
- package/GraphreportList.js +0 -239
- package/GraphreportModal.js +0 -559
- package/JOnlineSearchSelect.js +0 -107
- package/LICENSE +0 -7
- package/OnlineSelectCascade.js +0 -217
- package/OnlineSubForm.js +0 -200
- package/ParamsTable.js +0 -71
- package/graphreport.api.js +0 -23
- package/useChartRender.js +0 -405
- package/useMessageOnline.js +0 -71
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { ref, reactive, resolveComponent, openBlock, createElementBlock, Fragment, createVNode, withCtx, createTextVNode, createElementVNode, normalizeStyle, renderList, toDisplayString } from "vue";
|
|
22
|
+
import { defHttp } from "/@/utils/http/axios";
|
|
23
|
+
import "/@/components/Form";
|
|
24
|
+
import { BasicModal, useModalInner, useModal } from "/@/components/Modal";
|
|
25
|
+
import { InfoCircleTwoTone } from "@ant-design/icons-vue";
|
|
26
|
+
import CodeFileViewModal from "./CodeFileViewModal.js";
|
|
27
|
+
import { useMessage } from "/@/hooks/web/useMessage";
|
|
28
|
+
import { downloadByData } from "/@/utils/file/download";
|
|
29
|
+
import { _ as _export_sfc } from "./index.js";
|
|
30
|
+
import "ant-design-vue";
|
|
31
|
+
import "@vueuse/core";
|
|
32
|
+
const _sfc_main = {
|
|
33
|
+
name: "CodeFileListModal",
|
|
34
|
+
components: {
|
|
35
|
+
BasicModal,
|
|
36
|
+
InfoCircleTwoTone,
|
|
37
|
+
CodeFileViewModal
|
|
38
|
+
},
|
|
39
|
+
emits: ["register"],
|
|
40
|
+
setup() {
|
|
41
|
+
const { createMessage: $message } = useMessage();
|
|
42
|
+
const codeList = ref([]);
|
|
43
|
+
const height = window.innerHeight - 150;
|
|
44
|
+
const divStyle = reactive({
|
|
45
|
+
overflowY: "auto",
|
|
46
|
+
maxHeight: height + "px"
|
|
47
|
+
});
|
|
48
|
+
const loading = ref(false);
|
|
49
|
+
const tableName = ref("");
|
|
50
|
+
const pathKey = ref("");
|
|
51
|
+
const [registerModal, { closeModal }] = useModalInner((data) => __async(this, null, function* () {
|
|
52
|
+
codeList.value = data.codeList;
|
|
53
|
+
tableName.value = data.tableName;
|
|
54
|
+
pathKey.value = data.pathKey;
|
|
55
|
+
}));
|
|
56
|
+
function handleClose() {
|
|
57
|
+
closeModal();
|
|
58
|
+
}
|
|
59
|
+
function onDownloadGenerateCode() {
|
|
60
|
+
let codeFileList = codeList.value;
|
|
61
|
+
if (!codeFileList || codeFileList.length == 0) {
|
|
62
|
+
$message.warning("\u65E0\u4EE3\u7801\uFF01");
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
let temp = codeFileList.join(",");
|
|
66
|
+
return defHttp.post(
|
|
67
|
+
{
|
|
68
|
+
url: "/online/cgform/api/downGenerateCode",
|
|
69
|
+
params: {
|
|
70
|
+
fileList: encodeURI(temp),
|
|
71
|
+
pathKey: pathKey.value
|
|
72
|
+
},
|
|
73
|
+
responseType: "blob"
|
|
74
|
+
},
|
|
75
|
+
{ isTransformResponse: false }
|
|
76
|
+
).then((data) => {
|
|
77
|
+
if (!data || data.size == 0) {
|
|
78
|
+
$message.warning("\u5BFC\u51FA\u4EE3\u7801\u5931\u8D25\uFF01");
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
let fileName = "\u5BFC\u5230\u751F\u6210\u4EE3\u7801_" + tableName.value + "_" + new Date().getTime() + ".zip";
|
|
82
|
+
downloadByData(data, fileName, "application/zip");
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const [registerCodeViewModal, { openModal }] = useModal();
|
|
86
|
+
function handleView() {
|
|
87
|
+
let temp = codeList.value;
|
|
88
|
+
openModal(true, {
|
|
89
|
+
codeList: temp,
|
|
90
|
+
pathKey: pathKey.value
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
registerModal,
|
|
95
|
+
registerCodeViewModal,
|
|
96
|
+
divStyle,
|
|
97
|
+
codeList,
|
|
98
|
+
onDownloadGenerateCode,
|
|
99
|
+
handleClose,
|
|
100
|
+
handleView,
|
|
101
|
+
loading
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const _hoisted_1 = /* @__PURE__ */ createElementVNode("br", null, null, -1);
|
|
106
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
107
|
+
const _component_info_circle_two_tone = resolveComponent("info-circle-two-tone");
|
|
108
|
+
const _component_a_button = resolveComponent("a-button");
|
|
109
|
+
const _component_BasicModal = resolveComponent("BasicModal");
|
|
110
|
+
const _component_code_file_view_modal = resolveComponent("code-file-view-modal");
|
|
111
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
112
|
+
createVNode(_component_BasicModal, {
|
|
113
|
+
onRegister: $setup.registerModal,
|
|
114
|
+
width: 1200,
|
|
115
|
+
defaultFullscreen: false,
|
|
116
|
+
canFullscreen: false
|
|
117
|
+
}, {
|
|
118
|
+
title: withCtx(() => [
|
|
119
|
+
createVNode(_component_info_circle_two_tone),
|
|
120
|
+
createTextVNode(" \u4EE3\u7801\u751F\u6210\u7ED3\u679C ")
|
|
121
|
+
]),
|
|
122
|
+
footer: withCtx(() => [
|
|
123
|
+
createVNode(_component_a_button, { onClick: $setup.handleClose }, {
|
|
124
|
+
default: withCtx(() => [
|
|
125
|
+
createTextVNode("\u5173\u95ED")
|
|
126
|
+
]),
|
|
127
|
+
_: 1
|
|
128
|
+
}, 8, ["onClick"]),
|
|
129
|
+
createVNode(_component_a_button, {
|
|
130
|
+
type: "primary",
|
|
131
|
+
ghost: "",
|
|
132
|
+
onClick: $setup.handleView
|
|
133
|
+
}, {
|
|
134
|
+
default: withCtx(() => [
|
|
135
|
+
createTextVNode("\u5728\u7EBF\u9884\u89C8")
|
|
136
|
+
]),
|
|
137
|
+
_: 1
|
|
138
|
+
}, 8, ["onClick"]),
|
|
139
|
+
createVNode(_component_a_button, {
|
|
140
|
+
type: "primary",
|
|
141
|
+
onClick: $setup.onDownloadGenerateCode,
|
|
142
|
+
loading: $setup.loading
|
|
143
|
+
}, {
|
|
144
|
+
default: withCtx(() => [
|
|
145
|
+
createTextVNode("\u4E0B\u8F7D\u5230\u672C\u5730")
|
|
146
|
+
]),
|
|
147
|
+
_: 1
|
|
148
|
+
}, 8, ["onClick", "loading"])
|
|
149
|
+
]),
|
|
150
|
+
default: withCtx(() => [
|
|
151
|
+
createElementVNode("div", {
|
|
152
|
+
style: normalizeStyle($setup.divStyle)
|
|
153
|
+
}, [
|
|
154
|
+
createElementVNode("p", null, [
|
|
155
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($setup.codeList, (item) => {
|
|
156
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
157
|
+
createTextVNode(toDisplayString(item), 1),
|
|
158
|
+
_hoisted_1
|
|
159
|
+
], 64);
|
|
160
|
+
}), 256))
|
|
161
|
+
])
|
|
162
|
+
], 4)
|
|
163
|
+
]),
|
|
164
|
+
_: 1
|
|
165
|
+
}, 8, ["onRegister"]),
|
|
166
|
+
createVNode(_component_code_file_view_modal, {
|
|
167
|
+
onRegister: $setup.registerCodeViewModal,
|
|
168
|
+
onDownload: $setup.onDownloadGenerateCode,
|
|
169
|
+
onClose: $setup.handleClose
|
|
170
|
+
}, null, 8, ["onRegister", "onDownload", "onClose"])
|
|
171
|
+
], 64);
|
|
172
|
+
}
|
|
173
|
+
var CodeFileListModal = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
174
|
+
export { CodeFileListModal as default };
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { defineComponent, ref, reactive, resolveComponent, openBlock, createBlock, withCtx, createVNode, createTextVNode, createElementVNode, normalizeStyle, createCommentVNode } from "vue";
|
|
22
|
+
import { defHttp } from "/@/utils/http/axios";
|
|
23
|
+
import { BasicModal, useModalInner } from "/@/components/Modal";
|
|
24
|
+
import { InfoCircleTwoTone } from "@ant-design/icons-vue";
|
|
25
|
+
import { message } from "ant-design-vue";
|
|
26
|
+
import { JCodeEditor } from "/@/components/Form";
|
|
27
|
+
import { _ as _export_sfc } from "./index.js";
|
|
28
|
+
import "/@/hooks/web/useMessage";
|
|
29
|
+
import "@vueuse/core";
|
|
30
|
+
const _sfc_main = defineComponent({
|
|
31
|
+
name: "CodeFileViewModal",
|
|
32
|
+
components: {
|
|
33
|
+
BasicModal,
|
|
34
|
+
InfoCircleTwoTone,
|
|
35
|
+
JCodeEditor
|
|
36
|
+
},
|
|
37
|
+
emits: ["download", "register", "close"],
|
|
38
|
+
setup(_p, { emit }) {
|
|
39
|
+
const codeList = ref([]);
|
|
40
|
+
const pathKey = ref("");
|
|
41
|
+
const treeData = ref([]);
|
|
42
|
+
const expandStatus = ref(false);
|
|
43
|
+
const height = window.innerHeight - 160;
|
|
44
|
+
const language = ref("java");
|
|
45
|
+
const activeCodeContent = ref("");
|
|
46
|
+
let codeMap = reactive({});
|
|
47
|
+
const [registerModal, { closeModal }] = useModalInner((data) => __async(this, null, function* () {
|
|
48
|
+
codeMap = reactive({});
|
|
49
|
+
activeCodeContent.value = "";
|
|
50
|
+
codeList.value = data.codeList;
|
|
51
|
+
pathKey.value = data.pathKey;
|
|
52
|
+
getTreeData();
|
|
53
|
+
expandStatus.value = true;
|
|
54
|
+
}));
|
|
55
|
+
function getTreeData() {
|
|
56
|
+
let list = getPlainList();
|
|
57
|
+
let root = list[0];
|
|
58
|
+
assembleTree(root, list);
|
|
59
|
+
let treeList = [];
|
|
60
|
+
const getFinalTreeData = function(root2) {
|
|
61
|
+
if (root2.children) {
|
|
62
|
+
let children = root2.children;
|
|
63
|
+
if (children.length == 1) {
|
|
64
|
+
getFinalTreeData(children[0]);
|
|
65
|
+
} else if (children.length > 1) {
|
|
66
|
+
treeList.push(root2);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
getFinalTreeData(root);
|
|
71
|
+
console.log(123, treeList);
|
|
72
|
+
treeData.value = treeList;
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
loadFirstFileContent(root);
|
|
75
|
+
}, 300);
|
|
76
|
+
}
|
|
77
|
+
function loadFirstFileContent(root) {
|
|
78
|
+
return __async(this, null, function* () {
|
|
79
|
+
const getFirstFile = function(temp) {
|
|
80
|
+
if (temp.isLeaf === true) {
|
|
81
|
+
return temp;
|
|
82
|
+
} else {
|
|
83
|
+
if (temp.children) {
|
|
84
|
+
return getFirstFile(temp.children[0]);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
let node = getFirstFile(root);
|
|
89
|
+
if (node && node.isLeaf === true) {
|
|
90
|
+
let path = node.path;
|
|
91
|
+
if (!codeMap[path]) {
|
|
92
|
+
yield loadCode(path);
|
|
93
|
+
}
|
|
94
|
+
language.value = getCodeLanguage(path);
|
|
95
|
+
activeCodeContent.value = codeMap[path];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function assembleTree(root, list) {
|
|
100
|
+
for (let item of list) {
|
|
101
|
+
if (root.key == item.pid) {
|
|
102
|
+
let children = root.children;
|
|
103
|
+
if (!children) {
|
|
104
|
+
root.children = [];
|
|
105
|
+
}
|
|
106
|
+
root.children.push(item);
|
|
107
|
+
assembleTree(item, list);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function getAbsolutePath(arr, index) {
|
|
112
|
+
let i = 0;
|
|
113
|
+
let str = "";
|
|
114
|
+
while (i <= index) {
|
|
115
|
+
str += arr[i];
|
|
116
|
+
i++;
|
|
117
|
+
}
|
|
118
|
+
return str;
|
|
119
|
+
}
|
|
120
|
+
function getPlainList() {
|
|
121
|
+
let list = [];
|
|
122
|
+
let list2 = [];
|
|
123
|
+
let arr = codeList.value;
|
|
124
|
+
for (let item of arr) {
|
|
125
|
+
let temp = item.replace(new RegExp("\\\\", "g"), "/").replace("\u751F\u6210\u6210\u529F\uFF1A", "").trim();
|
|
126
|
+
if (temp) {
|
|
127
|
+
let arr2 = temp.split("/");
|
|
128
|
+
for (let i = 0; i < arr2.length; i++) {
|
|
129
|
+
let a = arr2[i];
|
|
130
|
+
let id = getAbsolutePath(arr2, i);
|
|
131
|
+
if (a) {
|
|
132
|
+
let item2 = {
|
|
133
|
+
title: a,
|
|
134
|
+
key: id
|
|
135
|
+
};
|
|
136
|
+
if (a == 0)
|
|
137
|
+
;
|
|
138
|
+
else {
|
|
139
|
+
let lastKey = getAbsolutePath(arr2, i - 1);
|
|
140
|
+
if (lastKey) {
|
|
141
|
+
item2["pid"] = lastKey;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (i == arr2.length - 1) {
|
|
145
|
+
item2["isLeaf"] = true;
|
|
146
|
+
item2["path"] = temp;
|
|
147
|
+
}
|
|
148
|
+
if (list2.indexOf(id) < 0 || i == arr2.length - 1) {
|
|
149
|
+
list.push(item2);
|
|
150
|
+
list2.push(id);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return list;
|
|
157
|
+
}
|
|
158
|
+
function handleClose() {
|
|
159
|
+
closeModal();
|
|
160
|
+
emit("close");
|
|
161
|
+
}
|
|
162
|
+
function onDownloadGenerateCode() {
|
|
163
|
+
emit("download");
|
|
164
|
+
}
|
|
165
|
+
function getCodeLanguage(path) {
|
|
166
|
+
if (path.endsWith("xml")) {
|
|
167
|
+
return "application/xml";
|
|
168
|
+
}
|
|
169
|
+
if (path.endsWith("sql")) {
|
|
170
|
+
return "text/x-sql";
|
|
171
|
+
}
|
|
172
|
+
if (path.endsWith("vue")) {
|
|
173
|
+
return "text/x-vue";
|
|
174
|
+
}
|
|
175
|
+
if (path.endsWith("ts")) {
|
|
176
|
+
return "text/typescript";
|
|
177
|
+
} else {
|
|
178
|
+
return "text/x-java";
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function showCodeContent(_selectedKeys, e) {
|
|
182
|
+
return __async(this, null, function* () {
|
|
183
|
+
let node = e.node.dataRef;
|
|
184
|
+
if (node.isLeaf) {
|
|
185
|
+
let path = node.path;
|
|
186
|
+
if (!codeMap[path]) {
|
|
187
|
+
yield loadCode(path);
|
|
188
|
+
}
|
|
189
|
+
language.value = getCodeLanguage(path);
|
|
190
|
+
activeCodeContent.value = codeMap[path];
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function loadCode(path) {
|
|
195
|
+
return new Promise((resolve) => {
|
|
196
|
+
let params = {
|
|
197
|
+
path: encodeURI(path),
|
|
198
|
+
pathKey: pathKey.value
|
|
199
|
+
};
|
|
200
|
+
defHttp.get({ url: "/online/cgform/api/codeView", params }, { isTransformResponse: false }).then((data) => {
|
|
201
|
+
if (!data || data.size === 0) {
|
|
202
|
+
message.warning("\u6587\u4EF6\u4E0B\u8F7D\u5931\u8D25");
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
let blob = new Blob([data]);
|
|
206
|
+
let reader = new FileReader();
|
|
207
|
+
reader.readAsText(blob, "utf8");
|
|
208
|
+
reader.onload = function() {
|
|
209
|
+
let content = this.result;
|
|
210
|
+
codeMap[path] = content;
|
|
211
|
+
resolve(1);
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
registerModal,
|
|
218
|
+
codeList,
|
|
219
|
+
onDownloadGenerateCode,
|
|
220
|
+
handleClose,
|
|
221
|
+
treeData,
|
|
222
|
+
showCodeContent,
|
|
223
|
+
activeCodeContent,
|
|
224
|
+
expandStatus,
|
|
225
|
+
height,
|
|
226
|
+
language
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
231
|
+
const _component_info_circle_two_tone = resolveComponent("info-circle-two-tone");
|
|
232
|
+
const _component_a_directory_tree = resolveComponent("a-directory-tree");
|
|
233
|
+
const _component_a_col = resolveComponent("a-col");
|
|
234
|
+
const _component_JCodeEditor = resolveComponent("JCodeEditor");
|
|
235
|
+
const _component_a_empty = resolveComponent("a-empty");
|
|
236
|
+
const _component_a_row = resolveComponent("a-row");
|
|
237
|
+
const _component_a_button = resolveComponent("a-button");
|
|
238
|
+
const _component_BasicModal = resolveComponent("BasicModal");
|
|
239
|
+
return openBlock(), createBlock(_component_BasicModal, {
|
|
240
|
+
onRegister: _ctx.registerModal,
|
|
241
|
+
okText: "",
|
|
242
|
+
cancelText: "\u5173\u95ED",
|
|
243
|
+
width: 1200,
|
|
244
|
+
defaultFullscreen: true,
|
|
245
|
+
canFullscreen: false,
|
|
246
|
+
onOk: _ctx.onDownloadGenerateCode
|
|
247
|
+
}, {
|
|
248
|
+
title: withCtx(() => [
|
|
249
|
+
createVNode(_component_info_circle_two_tone),
|
|
250
|
+
createTextVNode(" \u4EE3\u7801\u5728\u7EBF\u9884\u89C8 ")
|
|
251
|
+
]),
|
|
252
|
+
footer: withCtx(() => [
|
|
253
|
+
createVNode(_component_a_button, { onClick: _ctx.handleClose }, {
|
|
254
|
+
default: withCtx(() => [
|
|
255
|
+
createTextVNode("\u5173\u95ED")
|
|
256
|
+
]),
|
|
257
|
+
_: 1
|
|
258
|
+
}, 8, ["onClick"]),
|
|
259
|
+
createVNode(_component_a_button, {
|
|
260
|
+
type: "primary",
|
|
261
|
+
onClick: _ctx.onDownloadGenerateCode
|
|
262
|
+
}, {
|
|
263
|
+
default: withCtx(() => [
|
|
264
|
+
createTextVNode("\u4E0B\u8F7D\u5230\u672C\u5730")
|
|
265
|
+
]),
|
|
266
|
+
_: 1
|
|
267
|
+
}, 8, ["onClick"])
|
|
268
|
+
]),
|
|
269
|
+
default: withCtx(() => [
|
|
270
|
+
createElementVNode("div", null, [
|
|
271
|
+
createVNode(_component_a_row, null, {
|
|
272
|
+
default: withCtx(() => [
|
|
273
|
+
createVNode(_component_a_col, {
|
|
274
|
+
span: 6,
|
|
275
|
+
gutter: 3,
|
|
276
|
+
style: { "border-right": "1px solid #eee" }
|
|
277
|
+
}, {
|
|
278
|
+
default: withCtx(() => [
|
|
279
|
+
createElementVNode("div", {
|
|
280
|
+
style: normalizeStyle({ height: _ctx.height + "px", overflowY: "auto" })
|
|
281
|
+
}, [
|
|
282
|
+
_ctx.treeData.length ? (openBlock(), createBlock(_component_a_directory_tree, {
|
|
283
|
+
key: 0,
|
|
284
|
+
defaultExpandAll: true,
|
|
285
|
+
"tree-data": _ctx.treeData,
|
|
286
|
+
onSelect: _ctx.showCodeContent
|
|
287
|
+
}, null, 8, ["tree-data", "onSelect"])) : createCommentVNode("", true)
|
|
288
|
+
], 4)
|
|
289
|
+
]),
|
|
290
|
+
_: 1
|
|
291
|
+
}),
|
|
292
|
+
createVNode(_component_a_col, {
|
|
293
|
+
span: 18,
|
|
294
|
+
gutter: 3
|
|
295
|
+
}, {
|
|
296
|
+
default: withCtx(() => [
|
|
297
|
+
_ctx.activeCodeContent ? (openBlock(), createBlock(_component_JCodeEditor, {
|
|
298
|
+
key: 0,
|
|
299
|
+
value: _ctx.activeCodeContent,
|
|
300
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.activeCodeContent = $event),
|
|
301
|
+
theme: "idea",
|
|
302
|
+
language: _ctx.language,
|
|
303
|
+
fullScreen: false,
|
|
304
|
+
lineNumbers: true,
|
|
305
|
+
height: _ctx.height + "px",
|
|
306
|
+
"language-change": true
|
|
307
|
+
}, null, 8, ["value", "language", "height"])) : (openBlock(), createBlock(_component_a_empty, {
|
|
308
|
+
key: 1,
|
|
309
|
+
style: { "margin-top": "50px" },
|
|
310
|
+
description: "\u8BF7\u9009\u62E9\u5DE6\u4FA7\u6587\u4EF6\uFF0C\u663E\u793A\u8BE6\u7EC6\u4EE3\u7801"
|
|
311
|
+
}))
|
|
312
|
+
]),
|
|
313
|
+
_: 1
|
|
314
|
+
})
|
|
315
|
+
]),
|
|
316
|
+
_: 1
|
|
317
|
+
})
|
|
318
|
+
])
|
|
319
|
+
]),
|
|
320
|
+
_: 1
|
|
321
|
+
}, 8, ["onRegister", "onOk"]);
|
|
322
|
+
}
|
|
323
|
+
var CodeFileViewModal = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
324
|
+
export { CodeFileViewModal as default };
|
package/CodeGeneratorModal.js
CHANGED
|
@@ -25,24 +25,23 @@ import { BasicModal, useModalInner, useModal } from "/@/components/Modal";
|
|
|
25
25
|
import { JVxeTypes } from "/@/components/jeecg/JVxeTable/types";
|
|
26
26
|
import { b as useCodeGeneratorFormSchemas } from "./useSchemas.js";
|
|
27
27
|
import { underLine2CamelCase } from "/@/utils/common/compUtils";
|
|
28
|
-
import
|
|
29
|
-
import { downloadByData } from "/@/utils/file/download";
|
|
28
|
+
import CodeFileListModal from "./CodeFileListModal.js";
|
|
30
29
|
import FileSelectModal from "./FileSelectModal.js";
|
|
31
|
-
import { useMessageOnline } from "./useMessageOnline.js";
|
|
32
30
|
import { _ as _export_sfc } from "./index.js";
|
|
33
31
|
import "ant-design-vue";
|
|
34
32
|
import "@ant-design/icons-vue";
|
|
35
|
-
import "/@/
|
|
36
|
-
import "/@/
|
|
37
|
-
import "
|
|
33
|
+
import "/@/hooks/web/usePermission";
|
|
34
|
+
import "/@/utils/helper/validator";
|
|
35
|
+
import "./CodeFileViewModal.js";
|
|
36
|
+
import "/@/hooks/web/useMessage";
|
|
37
|
+
import "/@/utils/file/download";
|
|
38
|
+
import "@vueuse/core";
|
|
38
39
|
const _sfc_main = defineComponent({
|
|
39
40
|
name: "CodeGenerator",
|
|
40
|
-
components: { BasicForm, BasicModal, FileSelectModal },
|
|
41
|
+
components: { BasicForm, BasicModal, FileSelectModal, CodeFileListModal },
|
|
41
42
|
emits: ["register"],
|
|
42
43
|
setup(props) {
|
|
43
44
|
const JEECG_ONL_PROJECT_PATH = "JEECG_ONL_PROJECT_PATH";
|
|
44
|
-
const { createMessage: $message } = useMessage();
|
|
45
|
-
const { createConfirm: $confirm } = useMessageOnline();
|
|
46
45
|
const single = ref(true);
|
|
47
46
|
const subTableRef = ref();
|
|
48
47
|
const modalWidth = computed(() => single.value ? 800 : 1200);
|
|
@@ -86,11 +85,15 @@ const _sfc_main = defineComponent({
|
|
|
86
85
|
]
|
|
87
86
|
});
|
|
88
87
|
const showSubTable = computed(() => subTable.dataSource.length > 0);
|
|
89
|
-
const { formSchemas } = useCodeGeneratorFormSchemas(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
const { formSchemas } = useCodeGeneratorFormSchemas(
|
|
89
|
+
props,
|
|
90
|
+
{
|
|
91
|
+
onProjectPathChange,
|
|
92
|
+
onProjectPathSearch,
|
|
93
|
+
jspModeOptions
|
|
94
|
+
},
|
|
95
|
+
single
|
|
96
|
+
);
|
|
94
97
|
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
|
|
95
98
|
schemas: formSchemas,
|
|
96
99
|
showActionButtonGroup: false,
|
|
@@ -152,6 +155,7 @@ const _sfc_main = defineComponent({
|
|
|
152
155
|
}
|
|
153
156
|
});
|
|
154
157
|
}
|
|
158
|
+
const [registerCodeFileListModal, { openModal: openCodeFileListModal }] = useModal();
|
|
155
159
|
function onSubmit() {
|
|
156
160
|
return __async(this, null, function* () {
|
|
157
161
|
try {
|
|
@@ -165,16 +169,11 @@ const _sfc_main = defineComponent({
|
|
|
165
169
|
params.subList = subTableRef.value.getTableData();
|
|
166
170
|
}
|
|
167
171
|
confirmLoading.value = true;
|
|
168
|
-
let
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
closable: true,
|
|
174
|
-
okText: "\u4E0B\u8F7D\u5230\u672C\u5730",
|
|
175
|
-
cancelText: "\u786E\u5B9A\u5E76\u5173\u95ED",
|
|
176
|
-
content: `<p>${codeList.map((item) => item + "<br>").join("")}</p>`,
|
|
177
|
-
onOk: () => onDownloadGenerateCode(codeList, values.tableName_tmp)
|
|
172
|
+
let res = yield codeGen(params);
|
|
173
|
+
openCodeFileListModal(true, {
|
|
174
|
+
codeList: res.codeList,
|
|
175
|
+
pathKey: res.pathKey,
|
|
176
|
+
tableName: values.tableName_tmp
|
|
178
177
|
});
|
|
179
178
|
closeModal();
|
|
180
179
|
} catch (e) {
|
|
@@ -184,20 +183,20 @@ const _sfc_main = defineComponent({
|
|
|
184
183
|
}
|
|
185
184
|
});
|
|
186
185
|
}
|
|
187
|
-
function
|
|
188
|
-
return
|
|
189
|
-
url: "/online/cgform/api/
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
186
|
+
function codeGen(params) {
|
|
187
|
+
return new Promise((resolve, reject) => {
|
|
188
|
+
defHttp.post({ url: "/online/cgform/api/codeGenerate", params }, { isTransformResponse: false }).then((res) => {
|
|
189
|
+
if (res.success) {
|
|
190
|
+
let codeList = res.result;
|
|
191
|
+
let pathKey = res.message;
|
|
192
|
+
resolve({
|
|
193
|
+
codeList,
|
|
194
|
+
pathKey
|
|
195
|
+
});
|
|
196
|
+
} else {
|
|
197
|
+
reject(res.message);
|
|
198
|
+
}
|
|
199
|
+
});
|
|
201
200
|
});
|
|
202
201
|
}
|
|
203
202
|
function onCancel() {
|
|
@@ -237,7 +236,8 @@ const _sfc_main = defineComponent({
|
|
|
237
236
|
registerFileSelectModal,
|
|
238
237
|
subTableRef,
|
|
239
238
|
registerForm,
|
|
240
|
-
registerModal
|
|
239
|
+
registerModal,
|
|
240
|
+
registerCodeFileListModal
|
|
241
241
|
};
|
|
242
242
|
}
|
|
243
243
|
});
|
|
@@ -248,6 +248,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
248
248
|
const _component_a_spin = resolveComponent("a-spin");
|
|
249
249
|
const _component_BasicModal = resolveComponent("BasicModal");
|
|
250
250
|
const _component_FileSelectModal = resolveComponent("FileSelectModal");
|
|
251
|
+
const _component_code_file_list_modal = resolveComponent("code-file-list-modal");
|
|
251
252
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
252
253
|
createVNode(_component_BasicModal, {
|
|
253
254
|
onRegister: _ctx.registerModal,
|
|
@@ -286,7 +287,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
286
287
|
createVNode(_component_FileSelectModal, {
|
|
287
288
|
onRegister: _ctx.registerFileSelectModal,
|
|
288
289
|
onSelect: _ctx.onFileSelect
|
|
289
|
-
}, null, 8, ["onRegister", "onSelect"])
|
|
290
|
+
}, null, 8, ["onRegister", "onSelect"]),
|
|
291
|
+
createVNode(_component_code_file_list_modal, { onRegister: _ctx.registerCodeFileListModal }, null, 8, ["onRegister"])
|
|
290
292
|
], 64);
|
|
291
293
|
}
|
|
292
294
|
var CodeGeneratorModal = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|