@jeecg/online 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AuthButtonConfig.js +140 -0
- package/AuthButtonTree.js +183 -0
- package/AuthDataConfig.js +243 -0
- package/AuthDataTree.js +160 -0
- package/AuthFieldConfig.js +167 -0
- package/AuthFieldTree.js +273 -0
- package/AuthManagerDrawer.js +125 -0
- package/AuthSetterModal.js +317 -0
- package/CgformCopyList.js +253 -0
- package/CgformModal.js +748 -0
- package/CgreportModal.js +673 -0
- package/ChartAutoRender.js +69 -0
- package/ChartDoubleRender.js +154 -0
- package/ChartSingleRender.js +132 -0
- package/ChartTabsRender.js +218 -0
- package/CheckDictTable.js +121 -0
- package/CodeGeneratorModal.js +293 -0
- package/CustomButtonList.js +413 -0
- package/DBAttributeTable.js +278 -0
- package/DbToOnlineModal.js +190 -0
- package/EnhanceJavaModal.js +304 -0
- package/EnhanceJsHistory.js +231 -0
- package/EnhanceJsModal.js +293 -0
- package/EnhanceSqlModal.js +305 -0
- package/ErrorTip.js +21 -0
- package/ExtendConfigModal.js +142 -0
- package/FieldTable.js +185 -0
- package/FileSelectModal.js +102 -0
- package/ForeignKeyTable.js +78 -0
- package/FormSchemaFactory.js +938 -0
- package/GraphreportAutoChart.js +352 -0
- package/GraphreportList.js +239 -0
- package/GraphreportModal.js +559 -0
- package/IndexTable.js +96 -0
- package/JOnlineSearchSelect.js +107 -0
- package/LICENSE +7 -0
- package/LeftDepart.js +96 -0
- package/LeftRole.js +95 -0
- package/LeftUser.js +114 -0
- package/ModalFormDemo.js +84 -0
- package/OnlineAutoList.js +410 -0
- package/OnlineAutoModal.js +265 -0
- package/OnlineAutoTreeList.js +513 -0
- package/OnlineCustomModal.js +269 -0
- package/OnlineForm.js +809 -0
- package/OnlineQueryForm.js +442 -0
- package/OnlineSearchFormItem.js +428 -0
- package/OnlineSelectCascade.js +217 -0
- package/OnlineSubForm.js +200 -0
- package/OnlineSuperQuery.js +912 -0
- package/OnlineSuperQueryValComponent.js +8 -0
- package/OnlineSuperQueryValComponent.vue_vue_type_script_lang.js +172 -0
- package/PageAttributeTable.js +242 -0
- package/ParamsTable.js +71 -0
- package/ProcessOnlineForm.js +183 -0
- package/QueryTable.js +128 -0
- package/README.md +23 -0
- package/_arrayPush.js +276 -0
- package/auth.api.js +43 -0
- package/auth.data.js +144 -0
- package/cgform.data.js +235 -0
- package/cloneDeep.js +475 -0
- package/enhance.api.js +120 -0
- package/enhance.data.js +196 -0
- package/graphreport.api.js +23 -0
- package/index.js +64 -0
- package/index2.js +336 -0
- package/index3.js +799 -0
- package/isArray.js +47 -0
- package/main.index.js +6 -0
- package/package.json +6 -0
- package/pick.js +238 -0
- package/style.css +1 -0
- package/toString.js +31 -0
- package/useAutoForm.js +4274 -0
- package/useCgformList.js +353 -0
- package/useChartRender.js +405 -0
- package/useMessageOnline.js +71 -0
- package/useOnlineTest.js +26866 -0
- package/useSchemas.js +505 -0
- package/useTableColumns.js +1154 -0
- package/useTableSync.js +105 -0
package/OnlineSubForm.js
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
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 };
|