@jeecg/online 1.0.1 → 3.4.3-beta
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 +14 -7
- package/AuthButtonTree.js +3 -5
- package/AuthDataConfig.js +9 -6
- package/AuthDataTree.js +3 -5
- package/AuthFieldConfig.js +15 -12
- package/AuthFieldTree.js +24 -18
- package/AuthManagerDrawer.js +1 -1
- package/AuthSetterModal.js +1 -0
- package/CgformCopyList.js +34 -22
- package/CgformModal.js +57 -50
- package/CgreportModal.js +32 -39
- package/CheckDictTable.js +144 -24
- package/CodeFileListModal.js +175 -0
- package/CodeFileViewModal.js +325 -0
- package/CodeGeneratorModal.js +41 -38
- package/CustomButtonList.js +19 -22
- package/DBAttributeTable.js +248 -12
- package/DbToOnlineModal.js +27 -25
- package/DetailForm.js +605 -0
- package/EnhanceJavaModal.js +11 -17
- package/EnhanceJsHistory.js +6 -8
- package/EnhanceJsModal.js +9 -16
- package/EnhanceSqlModal.js +11 -17
- package/ExtendConfigModal.js +24 -15
- package/ForeignKeyTable.js +4 -3
- package/FormSchemaFactory.js +163 -30
- package/IndexTable.js +6 -5
- package/JModalTip.js +54 -0
- package/JOnlineSearchSelect.js +18 -10
- package/LeftDepart.js +1 -1
- package/LeftRole.js +7 -4
- package/LeftUser.js +7 -4
- package/LinkTableConfigModal.js +289 -0
- package/LinkTableFieldConfigModal.js +218 -0
- package/LinkTableListPiece.js +36 -0
- package/ModalFormDemo.js +3 -2
- package/OnlineAutoList.js +154 -55
- package/OnlineAutoModal.js +88 -131
- package/OnlineAutoTreeList.js +93 -53
- package/OnlineCustomModal.js +30 -14
- package/OnlineDetailModal.js +184 -0
- package/OnlineForm.js +259 -141
- package/OnlineFormDetail.js +326 -0
- package/OnlineQueryForm.js +72 -40
- package/OnlineSearchFormItem.js +26 -18
- package/OnlineSelectCascade.js +67 -53
- package/OnlineSubFormDetail.js +167 -0
- package/OnlineSuperQuery.js +69 -74
- package/OnlineSuperQueryValComponent.js +1 -0
- package/OnlineSuperQueryValComponent.vue_vue_type_script_lang.js +1 -17
- package/PageAttributeTable.js +233 -30
- package/ProcessOnlineForm.js +41 -16
- package/QueryTable.js +4 -3
- 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 +16 -6
- package/index2.js +48 -45
- package/index3.js +29 -26
- package/isArray.js +1 -1
- 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 +3437 -3791
- package/useCgformList.js +44 -31
- package/{useTableColumns.js → useListButton.js} +212 -407
- package/useOnlineTest.js +5 -26827
- package/useSchemas.js +364 -230
- 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/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
package/OnlineSubForm.js
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
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 { useMessage } from "/@/hooks/web/useMessage";
|
|
22
|
-
import { ref, watch, resolveComponent, openBlock, createBlock, unref, toRaw } from "vue";
|
|
23
|
-
import { BasicForm, useForm } from "/@/components/Form/index";
|
|
24
|
-
import { defHttp } from "/@/utils/http/axios";
|
|
25
|
-
import { a as useFormItems, g as getRefPromise, l as loadFormFieldsDefVal } from "./useAutoForm.js";
|
|
26
|
-
import { Loading } from "/@/components/Loading";
|
|
27
|
-
import { _ as _export_sfc } from "./index.js";
|
|
28
|
-
import "./FormSchemaFactory.js";
|
|
29
|
-
import "/@/components/Form/src/jeecg/components/JUpload";
|
|
30
|
-
import "/@/views/system/user/user.api";
|
|
31
|
-
import "/@/store/modules/user";
|
|
32
|
-
import "/@/utils";
|
|
33
|
-
import "/@/utils/desform/customExpression";
|
|
34
|
-
import "/@/components/Form/src/componentMap";
|
|
35
|
-
import "./OnlineSelectCascade.js";
|
|
36
|
-
import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
|
|
37
|
-
import "vue-router";
|
|
38
|
-
const baseUrl = "/online/cgform/api/subform";
|
|
39
|
-
const _sfc_main = {
|
|
40
|
-
name: "OnlineSubForm",
|
|
41
|
-
components: {
|
|
42
|
-
BasicForm,
|
|
43
|
-
Loading
|
|
44
|
-
},
|
|
45
|
-
props: {
|
|
46
|
-
properties: {
|
|
47
|
-
type: Object,
|
|
48
|
-
required: true
|
|
49
|
-
},
|
|
50
|
-
mainId: {
|
|
51
|
-
type: String,
|
|
52
|
-
default: ""
|
|
53
|
-
},
|
|
54
|
-
table: {
|
|
55
|
-
type: String,
|
|
56
|
-
default: ""
|
|
57
|
-
},
|
|
58
|
-
formTemplate: {
|
|
59
|
-
type: Number,
|
|
60
|
-
default: 1
|
|
61
|
-
},
|
|
62
|
-
requiredFields: {
|
|
63
|
-
type: Array,
|
|
64
|
-
default: []
|
|
65
|
-
},
|
|
66
|
-
isUpdate: {
|
|
67
|
-
type: Boolean,
|
|
68
|
-
default: false
|
|
69
|
-
},
|
|
70
|
-
disabled: {
|
|
71
|
-
type: Boolean,
|
|
72
|
-
default: false
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
emits: ["formChange"],
|
|
76
|
-
setup(props, { emit }) {
|
|
77
|
-
console.log("\u8FDB\u5165online\u5B50\u8868\u8868\u5355\u9875\u9762\u300B\u300B\u300B\u300B" + props.table);
|
|
78
|
-
const onlineFormRef = ref(null);
|
|
79
|
-
const formRendered = ref(false);
|
|
80
|
-
useMessage();
|
|
81
|
-
const { formSchemas, defaultValueFields, changeDataIfArray2String, tableName, dbData, checkOnlyFieldValue, fieldDisplayStatus, createFormSchemas, baseColProps } = useFormItems(props, onlineFormRef);
|
|
82
|
-
const [registerForm, { setProps, validate, resetFields, setFieldsValue, getFieldsValue }] = useForm({
|
|
83
|
-
schemas: formSchemas,
|
|
84
|
-
showActionButtonGroup: false,
|
|
85
|
-
baseColProps
|
|
86
|
-
});
|
|
87
|
-
watch(() => props.table, () => {
|
|
88
|
-
tableName.value = props.table;
|
|
89
|
-
}, { immediate: true });
|
|
90
|
-
watch(() => props.properties, (valueObj) => {
|
|
91
|
-
console.log("\u4E3B\u8868properties\u6539\u53D8", props.properties);
|
|
92
|
-
formRendered.value = false;
|
|
93
|
-
addFormChangeEvent();
|
|
94
|
-
createFormSchemas(props.properties, props.requiredFields, checkOnlyFieldValue);
|
|
95
|
-
formRendered.value = true;
|
|
96
|
-
}, { deep: true, immediate: true });
|
|
97
|
-
watch(() => props.mainId, (valueObj) => {
|
|
98
|
-
console.log("\u4E3B\u8868ID\u6539\u53D8", props.mainId);
|
|
99
|
-
setTimeout(() => {
|
|
100
|
-
resetSubForm();
|
|
101
|
-
}, 100);
|
|
102
|
-
}, { immediate: true });
|
|
103
|
-
watch(() => props.disabled, (val) => {
|
|
104
|
-
setProps({ disabled: val });
|
|
105
|
-
});
|
|
106
|
-
function addFormChangeEvent() {
|
|
107
|
-
return __async(this, null, function* () {
|
|
108
|
-
let formRefObject = yield getRefPromise(onlineFormRef);
|
|
109
|
-
formRefObject.$formValueChange = (field, value) => {
|
|
110
|
-
let emitArgument = { [field]: value };
|
|
111
|
-
emit("formChange", emitArgument);
|
|
112
|
-
};
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
function handleDefaultValue() {
|
|
116
|
-
if (unref(props.isUpdate) === false) {
|
|
117
|
-
let fieldProperties = toRaw(defaultValueFields[tableName.value]);
|
|
118
|
-
loadFormFieldsDefVal(fieldProperties, (values) => {
|
|
119
|
-
setFieldsValue(values);
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
function resetSubForm() {
|
|
124
|
-
return __async(this, null, function* () {
|
|
125
|
-
yield getRefPromise(formRendered);
|
|
126
|
-
yield resetFields();
|
|
127
|
-
handleDefaultValue();
|
|
128
|
-
const { table, mainId } = props;
|
|
129
|
-
if (!table || !mainId) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
let values = yield loadData(table, mainId);
|
|
133
|
-
dbData.value = values;
|
|
134
|
-
yield setFieldsValue(values);
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
function loadData(table, mainId) {
|
|
138
|
-
let url = `${baseUrl}/${table}/${mainId}`;
|
|
139
|
-
return new Promise((resolve, reject) => {
|
|
140
|
-
defHttp.get({ url }, { isTransformResponse: false }).then((res) => {
|
|
141
|
-
console.log(res);
|
|
142
|
-
if (res.success) {
|
|
143
|
-
resolve(res.result);
|
|
144
|
-
} else {
|
|
145
|
-
console.log(res.message);
|
|
146
|
-
reject();
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
}).finally(() => {
|
|
150
|
-
dbData.value = "";
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
function getAll() {
|
|
154
|
-
return new Promise((resolve, reject) => {
|
|
155
|
-
validate().then(() => {
|
|
156
|
-
let formData = getFieldsValue();
|
|
157
|
-
formData = changeDataIfArray2String(formData);
|
|
158
|
-
resolve(formData);
|
|
159
|
-
}).catch((e) => {
|
|
160
|
-
reject(e);
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
function getFormEvent() {
|
|
165
|
-
let row = getFieldsValue();
|
|
166
|
-
if (!row.id) {
|
|
167
|
-
row.id = "sub-change-temp-id";
|
|
168
|
-
}
|
|
169
|
-
return {
|
|
170
|
-
row,
|
|
171
|
-
target: context
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
function setValues(values) {
|
|
175
|
-
setFieldsValue(values);
|
|
176
|
-
}
|
|
177
|
-
const context = {
|
|
178
|
-
onlineFormRef,
|
|
179
|
-
baseColProps,
|
|
180
|
-
formSchemas,
|
|
181
|
-
registerForm,
|
|
182
|
-
setFieldsValue,
|
|
183
|
-
getFieldsValue,
|
|
184
|
-
getFormEvent,
|
|
185
|
-
setValues,
|
|
186
|
-
getAll,
|
|
187
|
-
sh: fieldDisplayStatus
|
|
188
|
-
};
|
|
189
|
-
return context;
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
193
|
-
const _component_BasicForm = resolveComponent("BasicForm");
|
|
194
|
-
return openBlock(), createBlock(_component_BasicForm, {
|
|
195
|
-
ref: "onlineFormRef",
|
|
196
|
-
onRegister: _ctx.registerForm
|
|
197
|
-
}, null, 8, ["onRegister"]);
|
|
198
|
-
}
|
|
199
|
-
var OnlineSubForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
200
|
-
export { OnlineSubForm as default };
|
package/ParamsTable.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref, resolveComponent, openBlock, createElementBlock, Fragment, createVNode, createElementVNode } from "vue";
|
|
2
|
-
import { JVxeTypes } from "/@/components/jeecg/JVxeTable/types";
|
|
3
|
-
import { _ as _export_sfc } from "./index.js";
|
|
4
|
-
import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
|
|
5
|
-
import "/@/hooks/web/useMessage";
|
|
6
|
-
import "vue-router";
|
|
7
|
-
const _sfc_main = defineComponent({
|
|
8
|
-
name: "FieldTable",
|
|
9
|
-
props: {
|
|
10
|
-
loading: Boolean,
|
|
11
|
-
dataSource: Array
|
|
12
|
-
},
|
|
13
|
-
setup() {
|
|
14
|
-
const tableRef = ref();
|
|
15
|
-
const columns = ref([
|
|
16
|
-
{
|
|
17
|
-
title: "\u53C2\u6570",
|
|
18
|
-
key: "paramName",
|
|
19
|
-
width: 230,
|
|
20
|
-
type: JVxeTypes.input,
|
|
21
|
-
defaultValue: "",
|
|
22
|
-
placeholder: "\u8BF7\u8F93\u5165${title}",
|
|
23
|
-
validateRules: [{ required: true, message: "${title}\u4E0D\u80FD\u4E3A\u7A7A" }]
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
title: "\u53C2\u6570\u6587\u672C",
|
|
27
|
-
key: "paramTxt",
|
|
28
|
-
width: 230,
|
|
29
|
-
type: JVxeTypes.input,
|
|
30
|
-
defaultValue: "",
|
|
31
|
-
placeholder: "\u8BF7\u8F93\u5165${title}",
|
|
32
|
-
validateRules: [{ required: true, message: "${title}\u4E0D\u80FD\u4E3A\u7A7A" }]
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
title: "\u9ED8\u8BA4\u503C",
|
|
36
|
-
key: "paramValue",
|
|
37
|
-
type: JVxeTypes.input,
|
|
38
|
-
defaultValue: "",
|
|
39
|
-
placeholder: "\u8BF7\u8F93\u5165${title}"
|
|
40
|
-
}
|
|
41
|
-
]);
|
|
42
|
-
return { tableRef, columns };
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
const _hoisted_1 = /* @__PURE__ */ createElementVNode("br", null, null, -1);
|
|
46
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
47
|
-
const _component_a_alert = resolveComponent("a-alert");
|
|
48
|
-
const _component_JVxeTable = resolveComponent("JVxeTable");
|
|
49
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
50
|
-
createVNode(_component_a_alert, {
|
|
51
|
-
type: "info",
|
|
52
|
-
showIcon: "",
|
|
53
|
-
message: "\u76EE\u524D\u53EA\u6709SQL\u6A21\u5F0F\u624D\u652F\u6301\u62A5\u8868\u53C2\u6570\uFF01"
|
|
54
|
-
}),
|
|
55
|
-
_hoisted_1,
|
|
56
|
-
createVNode(_component_JVxeTable, {
|
|
57
|
-
ref: "tableRef",
|
|
58
|
-
toolbar: "",
|
|
59
|
-
rowNumber: "",
|
|
60
|
-
rowSelection: "",
|
|
61
|
-
dragSort: "",
|
|
62
|
-
sortKey: "orderNum",
|
|
63
|
-
loading: _ctx.loading,
|
|
64
|
-
columns: _ctx.columns,
|
|
65
|
-
dataSource: _ctx.dataSource,
|
|
66
|
-
height: 336
|
|
67
|
-
}, null, 8, ["loading", "columns", "dataSource"])
|
|
68
|
-
], 64);
|
|
69
|
-
}
|
|
70
|
-
var ParamsTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
71
|
-
export { ParamsTable as default };
|
package/graphreport.api.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { defHttp } from "/@/utils/http/axios";
|
|
2
|
-
var Api = /* @__PURE__ */ ((Api2) => {
|
|
3
|
-
Api2["list"] = "/online/graphreport/head/list";
|
|
4
|
-
Api2["delete"] = "/online/graphreport/head/delete";
|
|
5
|
-
Api2["deleteBatch"] = "/online/graphreport/head/deleteBatch";
|
|
6
|
-
Api2["exportXls"] = "/online/graphreport/head/exportXls";
|
|
7
|
-
Api2["importXls"] = "/online/graphreport/head/importExcel";
|
|
8
|
-
Api2["paramsList"] = "/online/graphreport/params/listByHeadId";
|
|
9
|
-
Api2["getChartsData"] = "/online/graphreport/api/getChartsData";
|
|
10
|
-
Api2["getParamsInfo"] = "/online/graphreport/params/listByHeadId";
|
|
11
|
-
return Api2;
|
|
12
|
-
})(Api || {});
|
|
13
|
-
const list = (params) => defHttp.get({ url: "/online/graphreport/head/list", params });
|
|
14
|
-
function doBatchDelete(idList) {
|
|
15
|
-
return defHttp.delete({
|
|
16
|
-
url: "/online/graphreport/head/deleteBatch",
|
|
17
|
-
params: { ids: idList.join(",") }
|
|
18
|
-
}, { joinParamsToUrl: true });
|
|
19
|
-
}
|
|
20
|
-
const queryParamsList = (headId) => defHttp.get({ url: "/online/graphreport/params/listByHeadId", params: { headId } });
|
|
21
|
-
const getChartsData = (params) => defHttp.get({ url: "/online/graphreport/api/getChartsData", params });
|
|
22
|
-
const getParamsInfo = (params) => defHttp.get({ url: "/online/graphreport/params/listByHeadId", params });
|
|
23
|
-
export { Api as A, getChartsData as a, doBatchDelete as d, getParamsInfo as g, list as l, queryParamsList as q };
|
package/useChartRender.js
DELETED
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
import { ref, computed, reactive, watch } from "vue";
|
|
2
|
-
import { router } from "/@/router";
|
|
3
|
-
import { propTypes } from "/@/utils/propTypes";
|
|
4
|
-
import { printJS } from "/@/hooks/web/usePrintJS";
|
|
5
|
-
import { downloadByData } from "/@/utils/file/download";
|
|
6
|
-
import { filterDictText } from "/@/utils/dict/JDictSelectUtil";
|
|
7
|
-
import Bar from "/@/components/chart/Bar.vue";
|
|
8
|
-
import Pie from "/@/components/chart/Pie.vue";
|
|
9
|
-
import BarMulti from "/@/components/chart/BarMulti.vue";
|
|
10
|
-
import LineMulti from "/@/components/chart/LineMulti.vue";
|
|
11
|
-
import { defHttp } from "/@/utils/http/axios";
|
|
12
|
-
import { useMessage } from "/@/hooks/web/useMessage";
|
|
13
|
-
import { isFunction } from "/@/utils/is";
|
|
14
|
-
import { c as cloneDeep } from "./cloneDeep.js";
|
|
15
|
-
const ChartRenderProps = {
|
|
16
|
-
title: propTypes.string,
|
|
17
|
-
chartsData: propTypes.object,
|
|
18
|
-
asComponent: propTypes.bool.def(false)
|
|
19
|
-
};
|
|
20
|
-
const ChartRenderEmits = ["error"];
|
|
21
|
-
const ChartRenderComponents = {
|
|
22
|
-
LineMulti,
|
|
23
|
-
BarMulti,
|
|
24
|
-
Pie,
|
|
25
|
-
Bar
|
|
26
|
-
};
|
|
27
|
-
const ChartRenderCommon = {
|
|
28
|
-
components: ChartRenderComponents,
|
|
29
|
-
props: ChartRenderProps,
|
|
30
|
-
emits: ChartRenderEmits
|
|
31
|
-
};
|
|
32
|
-
const errorText = {
|
|
33
|
-
jsonFormattingFailed: "JSON\u5B57\u7B26\u4E32\u683C\u5F0F\u5316\u5931\u8D25"
|
|
34
|
-
};
|
|
35
|
-
function useChartRender(props, { emit }) {
|
|
36
|
-
const {
|
|
37
|
-
createMessage: $message,
|
|
38
|
-
createConfirm: $confirm,
|
|
39
|
-
createInfoModal: $info,
|
|
40
|
-
createErrorModal: $error,
|
|
41
|
-
createSuccessModal: $success,
|
|
42
|
-
createWarningModal: $warning
|
|
43
|
-
} = useMessage();
|
|
44
|
-
const headId = ref(null);
|
|
45
|
-
const height = ref("400px");
|
|
46
|
-
const activeKey = ref("bar");
|
|
47
|
-
const chartTypes = ref([]);
|
|
48
|
-
const pageSwitch = ref(true);
|
|
49
|
-
const printId = computed(() => `print-content-${headId.value}`);
|
|
50
|
-
const lineParams = reactive({
|
|
51
|
-
chartData: []
|
|
52
|
-
});
|
|
53
|
-
const barParams = reactive({
|
|
54
|
-
chartData: []
|
|
55
|
-
});
|
|
56
|
-
const pieParams = reactive({
|
|
57
|
-
chartData: []
|
|
58
|
-
});
|
|
59
|
-
const barLineParams = reactive({
|
|
60
|
-
dataSource: []
|
|
61
|
-
});
|
|
62
|
-
const tableParams = reactive({
|
|
63
|
-
fixedColumns: [
|
|
64
|
-
{
|
|
65
|
-
title: "#",
|
|
66
|
-
key: "rowIndex",
|
|
67
|
-
width: "10%",
|
|
68
|
-
align: "center",
|
|
69
|
-
customRender: function({ record, index }) {
|
|
70
|
-
if (record.isTotal === true) {
|
|
71
|
-
return "\u603B\u8BA1";
|
|
72
|
-
} else {
|
|
73
|
-
return parseInt(index) + 1;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
columns: [],
|
|
79
|
-
dataSource: []
|
|
80
|
-
});
|
|
81
|
-
const extendJsHandlerIsolation = reactive({});
|
|
82
|
-
const extendJsHandler = computed({
|
|
83
|
-
get() {
|
|
84
|
-
if (headId.value == null) {
|
|
85
|
-
return null;
|
|
86
|
-
} else {
|
|
87
|
-
return extendJsHandlerIsolation[headId.value];
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
set(obj) {
|
|
91
|
-
if (headId.value != null) {
|
|
92
|
-
extendJsHandlerIsolation[headId.value] = obj;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
const hasLine = computed(() => chartTypes.value.includes("line"));
|
|
97
|
-
const hasBar = computed(() => chartTypes.value.includes("bar"));
|
|
98
|
-
const hasPie = computed(() => chartTypes.value.includes("pie"));
|
|
99
|
-
const hasTable = ref(false);
|
|
100
|
-
const lineProps = computed(() => {
|
|
101
|
-
return {
|
|
102
|
-
type: "line",
|
|
103
|
-
height: height.value,
|
|
104
|
-
chartData: lineParams.chartData,
|
|
105
|
-
onClick(params) {
|
|
106
|
-
emitExtendJsEvent(params);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
});
|
|
110
|
-
const barProps = computed(() => {
|
|
111
|
-
return {
|
|
112
|
-
height: height.value,
|
|
113
|
-
chartData: barParams.chartData,
|
|
114
|
-
onClick(params) {
|
|
115
|
-
emitExtendJsEvent(params);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
});
|
|
119
|
-
const pieProps = computed(() => {
|
|
120
|
-
return {
|
|
121
|
-
height: height.value,
|
|
122
|
-
chartData: pieParams.chartData,
|
|
123
|
-
onClick(params) {
|
|
124
|
-
emitExtendJsEvent(params);
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
});
|
|
128
|
-
const barLineProps = computed(() => {
|
|
129
|
-
return {
|
|
130
|
-
height: height.value,
|
|
131
|
-
dataSource: barLineParams.dataSource,
|
|
132
|
-
onClick(_event, _chart) {
|
|
133
|
-
console.debug("barLineProps-click: ", arguments);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
});
|
|
137
|
-
const chartCardProps = computed(() => {
|
|
138
|
-
return {
|
|
139
|
-
title: props.title,
|
|
140
|
-
headStyle: { paddingLeft: "20px" },
|
|
141
|
-
bodyStyle: { padding: "10px" },
|
|
142
|
-
bordered: !props.asComponent
|
|
143
|
-
};
|
|
144
|
-
});
|
|
145
|
-
const tableCardProps = computed(() => {
|
|
146
|
-
return {
|
|
147
|
-
title: "\u6570\u636E\u660E\u7EC6",
|
|
148
|
-
headStyle: { paddingLeft: "20px" },
|
|
149
|
-
bodyStyle: { padding: "0" },
|
|
150
|
-
style: { marginTop: "20px" },
|
|
151
|
-
bordered: !props.asComponent
|
|
152
|
-
};
|
|
153
|
-
});
|
|
154
|
-
const exportButtonProps = computed(() => {
|
|
155
|
-
return {
|
|
156
|
-
type: "primary",
|
|
157
|
-
preIcon: "ant-design:download",
|
|
158
|
-
text: "\u5BFC\u51FA",
|
|
159
|
-
style: { margin: "12px" }
|
|
160
|
-
};
|
|
161
|
-
});
|
|
162
|
-
const pageSwitchProps = computed(() => {
|
|
163
|
-
return {
|
|
164
|
-
checkedChildren: "\u5206\u9875",
|
|
165
|
-
unCheckedChildren: "\u5206\u9875",
|
|
166
|
-
style: {
|
|
167
|
-
position: "absolute",
|
|
168
|
-
top: "17px",
|
|
169
|
-
right: "12px"
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
});
|
|
173
|
-
const tableProps = computed(() => {
|
|
174
|
-
return {
|
|
175
|
-
size: "middle",
|
|
176
|
-
rowKey: "id",
|
|
177
|
-
pagination: pageSwitch.value ? { pageSize: 10 } : false,
|
|
178
|
-
columns: tableParams.columns,
|
|
179
|
-
dataSource: tableParams.dataSource,
|
|
180
|
-
style: { borderTop: "1px solid #e8e8e8" }
|
|
181
|
-
};
|
|
182
|
-
});
|
|
183
|
-
const showPrint = computed(() => !props.asComponent);
|
|
184
|
-
const showDetail = computed(() => props.asComponent);
|
|
185
|
-
watch(() => props.chartsData, (data) => parseChartsData(data), { immediate: true });
|
|
186
|
-
function executeExtendJs(headId, jsCode) {
|
|
187
|
-
if (!jsCode || !headId) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
let onClick = { line: null, bar: null, pie: null };
|
|
191
|
-
eval(`;(function () {
|
|
192
|
-
${jsCode}
|
|
193
|
-
})();`);
|
|
194
|
-
if (extendJsHandler.value == null) {
|
|
195
|
-
extendJsHandler.value = { click: onClick };
|
|
196
|
-
} else {
|
|
197
|
-
extendJsHandler.value.click = onClick;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
const onClickThis = {
|
|
201
|
-
$router: router,
|
|
202
|
-
$http: defHttp,
|
|
203
|
-
$message,
|
|
204
|
-
$confirm,
|
|
205
|
-
$info,
|
|
206
|
-
$error,
|
|
207
|
-
$success,
|
|
208
|
-
$warning
|
|
209
|
-
};
|
|
210
|
-
function emitExtendJsEvent(params) {
|
|
211
|
-
if (extendJsHandler.value != null) {
|
|
212
|
-
let clickType = params.seriesType;
|
|
213
|
-
let fn = extendJsHandler.value.click[clickType];
|
|
214
|
-
if (isFunction(fn)) {
|
|
215
|
-
fn.call(onClickThis, params);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
function parseChartsData(chartsData) {
|
|
220
|
-
if (chartsData == null)
|
|
221
|
-
return null;
|
|
222
|
-
let { head, data, items, dictOptions } = chartsData;
|
|
223
|
-
if (head == null)
|
|
224
|
-
return;
|
|
225
|
-
let { id, xaxisField, yaxisField, dataType, cgrSql, graphType, extendJs } = head;
|
|
226
|
-
headId.value = id;
|
|
227
|
-
executeExtendJs(id, extendJs);
|
|
228
|
-
try {
|
|
229
|
-
data = dataType === "sql" || dataType === "api" ? data : JSON.parse(cgrSql);
|
|
230
|
-
} catch (e) {
|
|
231
|
-
emit("error", errorText.jsonFormattingFailed);
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
let dictList = dictOptions[xaxisField];
|
|
235
|
-
let graphTypes = graphType.split(",");
|
|
236
|
-
activeKey.value = graphTypes[0];
|
|
237
|
-
chartTypes.value = graphTypes;
|
|
238
|
-
let yaxisFields = yaxisField.split(",");
|
|
239
|
-
let fieldMap = /* @__PURE__ */ new Map();
|
|
240
|
-
items.forEach((item) => fieldMap.set(item.fieldName, item));
|
|
241
|
-
let index = graphTypes.indexOf("table");
|
|
242
|
-
hasTable.value = index !== -1;
|
|
243
|
-
if (hasTable.value) {
|
|
244
|
-
graphTypes.splice(index, 1);
|
|
245
|
-
}
|
|
246
|
-
let parseOption = { graphTypes, data, items, fieldMap, xaxisField, yaxisFields, dictList, dictOptions };
|
|
247
|
-
parseLineData(parseOption);
|
|
248
|
-
parseBarData(parseOption);
|
|
249
|
-
parsePicData(parseOption);
|
|
250
|
-
parseTableData(parseOption);
|
|
251
|
-
}
|
|
252
|
-
function parseCommonData(option) {
|
|
253
|
-
var _a;
|
|
254
|
-
let { data, fieldMap, xaxisField, yaxisFields, dictList } = option;
|
|
255
|
-
let chartData = [];
|
|
256
|
-
for (let yField of yaxisFields) {
|
|
257
|
-
for (let item of data) {
|
|
258
|
-
let name = item[xaxisField];
|
|
259
|
-
if (dictList) {
|
|
260
|
-
name = filterDictText(dictList, name);
|
|
261
|
-
}
|
|
262
|
-
chartData.push({
|
|
263
|
-
name,
|
|
264
|
-
value: item[yField],
|
|
265
|
-
type: ((_a = fieldMap.get(yField)) == null ? void 0 : _a.fieldTxt) || yField
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
return chartData;
|
|
270
|
-
}
|
|
271
|
-
function parseLineData(option) {
|
|
272
|
-
let { graphTypes } = option;
|
|
273
|
-
if (graphTypes.includes("line")) {
|
|
274
|
-
lineParams.chartData = parseCommonData(option);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
function parseBarData(option) {
|
|
278
|
-
let { graphTypes } = option;
|
|
279
|
-
if (graphTypes.includes("bar")) {
|
|
280
|
-
barParams.chartData = parseCommonData(option);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
function parsePicData(option) {
|
|
284
|
-
let { graphTypes, data, xaxisField, yaxisFields, dictList } = option;
|
|
285
|
-
let yField = yaxisFields[0];
|
|
286
|
-
if (graphTypes.includes("pie")) {
|
|
287
|
-
let chartData = [];
|
|
288
|
-
for (let item of data) {
|
|
289
|
-
let name = item[xaxisField];
|
|
290
|
-
if (dictList) {
|
|
291
|
-
name = filterDictText(dictList, name);
|
|
292
|
-
}
|
|
293
|
-
chartData.push({
|
|
294
|
-
name,
|
|
295
|
-
value: item[yField]
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
pieParams.chartData = chartData;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
function parseTableData(option) {
|
|
302
|
-
let { data, items, xaxisField, yaxisFields, dictList, dictOptions } = option;
|
|
303
|
-
if (hasTable.value) {
|
|
304
|
-
tableParams.dataSource = data.map((item, index) => {
|
|
305
|
-
item.id = index;
|
|
306
|
-
let pieData = {
|
|
307
|
-
item: item[xaxisField],
|
|
308
|
-
count: item[yaxisFields[0]]
|
|
309
|
-
};
|
|
310
|
-
if (dictList) {
|
|
311
|
-
pieData.item = filterDictText(dictList, pieData.item);
|
|
312
|
-
}
|
|
313
|
-
return item;
|
|
314
|
-
});
|
|
315
|
-
let tableColumns = cloneDeep(tableParams.fixedColumns);
|
|
316
|
-
let isTotals = [];
|
|
317
|
-
items.forEach((item) => {
|
|
318
|
-
if (item.isShow === "Y") {
|
|
319
|
-
let column = {
|
|
320
|
-
align: "center",
|
|
321
|
-
width: "10%",
|
|
322
|
-
title: item.fieldTxt,
|
|
323
|
-
dataIndex: item.fieldName
|
|
324
|
-
};
|
|
325
|
-
if (item.dictCode) {
|
|
326
|
-
column.customRender = ({ text }) => filterDictText(dictOptions[item.fieldName], text);
|
|
327
|
-
}
|
|
328
|
-
tableColumns.push(column);
|
|
329
|
-
if (item.isTotal === "Y")
|
|
330
|
-
isTotals.push(item.fieldName);
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
tableParams.columns = tableColumns;
|
|
334
|
-
if (isTotals.length > 0) {
|
|
335
|
-
let totalRow = { id: tableParams.dataSource.length, isTotal: true };
|
|
336
|
-
isTotals.forEach((column) => {
|
|
337
|
-
let count = 0;
|
|
338
|
-
tableParams.dataSource.forEach((row) => {
|
|
339
|
-
count += parseFloat(row[column]);
|
|
340
|
-
});
|
|
341
|
-
totalRow[column] = isNaN(count) ? "\u5305\u542B\u975E\u6570\u5B57\u5185\u5BB9" : count.toFixed(2);
|
|
342
|
-
});
|
|
343
|
-
tableParams.dataSource.push(totalRow);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
function onExportXls() {
|
|
348
|
-
let fileName = props.title;
|
|
349
|
-
defHttp.get({
|
|
350
|
-
url: "/online/graphreport/api/exportXlsById",
|
|
351
|
-
params: {
|
|
352
|
-
id: headId.value,
|
|
353
|
-
name: fileName
|
|
354
|
-
},
|
|
355
|
-
responseType: "blob"
|
|
356
|
-
}, { isTransformResponse: false }).then((data) => {
|
|
357
|
-
if (!data || data.size == 0) {
|
|
358
|
-
$message.warning("\u5BFC\u51FA\u5931\u8D25\uFF01");
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
downloadByData(data, fileName + ".xls");
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
function onPrint() {
|
|
365
|
-
printJS({
|
|
366
|
-
type: "html",
|
|
367
|
-
printable: "#" + printId.value
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
function onGoToDetail() {
|
|
371
|
-
goToInfo(props.chartsData);
|
|
372
|
-
}
|
|
373
|
-
function goToInfo(data) {
|
|
374
|
-
let url = `/online/graphreport/chart/${data.head.id}`;
|
|
375
|
-
router.push({ path: url });
|
|
376
|
-
}
|
|
377
|
-
return {
|
|
378
|
-
headId,
|
|
379
|
-
printId,
|
|
380
|
-
height,
|
|
381
|
-
activeKey,
|
|
382
|
-
chartTypes,
|
|
383
|
-
pageSwitch,
|
|
384
|
-
showPrint,
|
|
385
|
-
showDetail,
|
|
386
|
-
hasLine,
|
|
387
|
-
hasBar,
|
|
388
|
-
hasPie,
|
|
389
|
-
hasTable,
|
|
390
|
-
lineProps,
|
|
391
|
-
barProps,
|
|
392
|
-
pieProps,
|
|
393
|
-
tableProps,
|
|
394
|
-
barLineProps,
|
|
395
|
-
chartCardProps,
|
|
396
|
-
tableCardProps,
|
|
397
|
-
exportButtonProps,
|
|
398
|
-
pageSwitchProps,
|
|
399
|
-
extendJsHandlerIsolation,
|
|
400
|
-
onPrint,
|
|
401
|
-
onGoToDetail,
|
|
402
|
-
onExportXls
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
export { ChartRenderCommon as C, useChartRender as u };
|