@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
|
@@ -0,0 +1,140 @@
|
|
|
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, watch, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, createTextVNode } from "vue";
|
|
22
|
+
import { BasicTable, useTable } from "/@/components/Table";
|
|
23
|
+
import { d as authButtonLoadData, e as authButtonEnable, f as authButtonDisable } from "./auth.api.js";
|
|
24
|
+
import { b as authButtonColumns, c as authButtonFixedList } from "./auth.data.js";
|
|
25
|
+
import { _ as _export_sfc } from "./index.js";
|
|
26
|
+
import { c as cloneDeep } from "./cloneDeep.js";
|
|
27
|
+
import "/@/utils/http/axios";
|
|
28
|
+
import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
|
|
29
|
+
import "/@/hooks/web/useMessage";
|
|
30
|
+
import "vue-router";
|
|
31
|
+
import "./_arrayPush.js";
|
|
32
|
+
import "./isArray.js";
|
|
33
|
+
const _sfc_main = defineComponent({
|
|
34
|
+
name: "AuthButtonConfig",
|
|
35
|
+
components: { BasicTable },
|
|
36
|
+
props: {
|
|
37
|
+
headId: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "",
|
|
40
|
+
required: true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
setup(props) {
|
|
44
|
+
const cgformId = ref("");
|
|
45
|
+
const pageType = ref(2);
|
|
46
|
+
const pageControlList = ref(3);
|
|
47
|
+
const pageControlForm = ref(5);
|
|
48
|
+
const [registerTable, { reload }] = useTable({
|
|
49
|
+
api: loadData,
|
|
50
|
+
rowKey: "code",
|
|
51
|
+
bordered: true,
|
|
52
|
+
columns: authButtonColumns,
|
|
53
|
+
showIndexColumn: false
|
|
54
|
+
});
|
|
55
|
+
watch(() => props.headId, (headId) => {
|
|
56
|
+
cgformId.value = headId.split("?")[0];
|
|
57
|
+
reload().catch(() => null);
|
|
58
|
+
}, { immediate: true });
|
|
59
|
+
function loadData(params) {
|
|
60
|
+
return __async(this, null, function* () {
|
|
61
|
+
let result = yield authButtonLoadData(cgformId.value, params);
|
|
62
|
+
let { authList, buttonList } = result;
|
|
63
|
+
let dataSource = [];
|
|
64
|
+
for (let btn of cloneDeep(authButtonFixedList)) {
|
|
65
|
+
let item = {
|
|
66
|
+
status: 0,
|
|
67
|
+
page: pageControlList.value
|
|
68
|
+
};
|
|
69
|
+
let auth = authList.find((auth2) => auth2.code == btn.code);
|
|
70
|
+
Object.assign(btn, item, auth);
|
|
71
|
+
dataSource.push(btn);
|
|
72
|
+
}
|
|
73
|
+
return concatCustomButton(authList, buttonList, dataSource);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function concatCustomButton(authList, buttonList, dataSource) {
|
|
77
|
+
for (let btn of buttonList) {
|
|
78
|
+
let auth = authList.find((auth2) => auth2.code == btn.buttonCode);
|
|
79
|
+
let item = {
|
|
80
|
+
code: btn.buttonCode,
|
|
81
|
+
title: btn.buttonName,
|
|
82
|
+
status: 0,
|
|
83
|
+
page: btn.buttonStyle == "form" ? pageControlForm.value : pageControlList.value
|
|
84
|
+
};
|
|
85
|
+
dataSource.push(Object.assign(item, auth));
|
|
86
|
+
}
|
|
87
|
+
return dataSource;
|
|
88
|
+
}
|
|
89
|
+
function onUpdateStatus(flag, record) {
|
|
90
|
+
return __async(this, null, function* () {
|
|
91
|
+
flag ? doEnableAuthButton(record) : doDisableAuthButton(record);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function doEnableAuthButton(record) {
|
|
95
|
+
return __async(this, null, function* () {
|
|
96
|
+
let result = yield authButtonEnable({
|
|
97
|
+
id: record.id,
|
|
98
|
+
code: record.code,
|
|
99
|
+
page: record.page,
|
|
100
|
+
cgformId: cgformId.value,
|
|
101
|
+
type: pageType.value,
|
|
102
|
+
control: 5,
|
|
103
|
+
status: 1
|
|
104
|
+
});
|
|
105
|
+
record.id = result.id;
|
|
106
|
+
record.status = 1;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function doDisableAuthButton(record) {
|
|
110
|
+
return __async(this, null, function* () {
|
|
111
|
+
yield authButtonDisable(record.id);
|
|
112
|
+
record.status = 0;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return { registerTable, onUpdateStatus };
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
const _hoisted_1 = { class: "auth-field-config" };
|
|
119
|
+
const _hoisted_2 = /* @__PURE__ */ createTextVNode(" \u53EF\u89C1 ");
|
|
120
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
121
|
+
const _component_a_switch = resolveComponent("a-switch");
|
|
122
|
+
const _component_BasicTable = resolveComponent("BasicTable");
|
|
123
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
124
|
+
createVNode(_component_BasicTable, { onRegister: _ctx.registerTable }, {
|
|
125
|
+
switch: withCtx(({ text, record }) => [
|
|
126
|
+
createVNode(_component_a_switch, {
|
|
127
|
+
size: "small",
|
|
128
|
+
checked: record.status === 1,
|
|
129
|
+
onChange: (flag) => _ctx.onUpdateStatus(flag, record)
|
|
130
|
+
}, null, 8, ["checked", "onChange"])
|
|
131
|
+
]),
|
|
132
|
+
control: withCtx(() => [
|
|
133
|
+
_hoisted_2
|
|
134
|
+
]),
|
|
135
|
+
_: 1
|
|
136
|
+
}, 8, ["onRegister"])
|
|
137
|
+
]);
|
|
138
|
+
}
|
|
139
|
+
var AuthButtonConfig = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
140
|
+
export { AuthButtonConfig as default };
|
|
@@ -0,0 +1,183 @@
|
|
|
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, computed, watch, resolveComponent, openBlock, createElementBlock, createBlock, Fragment, createElementVNode, createVNode, withCtx, createTextVNode } from "vue";
|
|
22
|
+
import { useMessage } from "/@/hooks/web/useMessage";
|
|
23
|
+
import { c as authButtonFixedList } from "./auth.data.js";
|
|
24
|
+
import { m as authButtonLoadTree, l as loadRoleAuthChecked, n as saveAuthButton } from "./auth.api.js";
|
|
25
|
+
import { _ as _export_sfc } from "./index.js";
|
|
26
|
+
import "/@/utils/http/axios";
|
|
27
|
+
import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
|
|
28
|
+
import "vue-router";
|
|
29
|
+
var AuthButtonTree_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
30
|
+
const _sfc_main = defineComponent({
|
|
31
|
+
name: "AuthButtonTree",
|
|
32
|
+
props: {
|
|
33
|
+
cgformId: { type: String, required: true }
|
|
34
|
+
},
|
|
35
|
+
setup(props) {
|
|
36
|
+
const { createMessage: $message } = useMessage();
|
|
37
|
+
const roleId = ref("");
|
|
38
|
+
const authType = ref(2);
|
|
39
|
+
const autoExpandParent = ref(true);
|
|
40
|
+
const expandedKeys = ref([]);
|
|
41
|
+
const checkedKeys = ref([]);
|
|
42
|
+
const treeData = ref([]);
|
|
43
|
+
const authMode = ref("");
|
|
44
|
+
const disabled = computed(() => !roleId.value);
|
|
45
|
+
watch(() => props.cgformId, loadTree, { immediate: true });
|
|
46
|
+
function loadTree() {
|
|
47
|
+
return __async(this, null, function* () {
|
|
48
|
+
if (!props.cgformId)
|
|
49
|
+
return;
|
|
50
|
+
let result = yield authButtonLoadTree(props.cgformId, authType.value);
|
|
51
|
+
result.forEach((item) => {
|
|
52
|
+
for (const btn of authButtonFixedList) {
|
|
53
|
+
if (item.code == btn.code) {
|
|
54
|
+
item["title"] = btn.title;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
let trees = [];
|
|
60
|
+
for (let item of result) {
|
|
61
|
+
let title = getTreeNodeTitle(item);
|
|
62
|
+
trees.push({ key: item.id, title });
|
|
63
|
+
}
|
|
64
|
+
treeData.value = trees;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function onRefresh() {
|
|
68
|
+
loadTree();
|
|
69
|
+
loadChecked(roleId.value, authMode.value);
|
|
70
|
+
}
|
|
71
|
+
function loadChecked($roleId, $authMode) {
|
|
72
|
+
return __async(this, null, function* () {
|
|
73
|
+
roleId.value = $roleId;
|
|
74
|
+
authMode.value = $authMode;
|
|
75
|
+
checkedKeys.value = [];
|
|
76
|
+
let result = yield loadRoleAuthChecked({
|
|
77
|
+
roleId: $roleId,
|
|
78
|
+
cgformId: props.cgformId,
|
|
79
|
+
type: authType.value,
|
|
80
|
+
authMode: $authMode
|
|
81
|
+
});
|
|
82
|
+
checkedKeys.value = result.map((item) => item.authId);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function clearChecked() {
|
|
86
|
+
roleId.value = "";
|
|
87
|
+
}
|
|
88
|
+
function onSave() {
|
|
89
|
+
return __async(this, null, function* () {
|
|
90
|
+
yield saveAuthButton(roleId.value, props.cgformId, {
|
|
91
|
+
authId: JSON.stringify(checkedKeys.value),
|
|
92
|
+
authMode: authMode.value
|
|
93
|
+
});
|
|
94
|
+
$message.success("\u4FDD\u5B58\u6210\u529F");
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function getTreeNodeTitle(item) {
|
|
98
|
+
let str = item.title + "-";
|
|
99
|
+
if (item.page == 3) {
|
|
100
|
+
str += "\u5217\u8868\u53EF\u89C1";
|
|
101
|
+
} else if (item.page == 5) {
|
|
102
|
+
str += "\u8868\u5355\u53EF\u89C1";
|
|
103
|
+
}
|
|
104
|
+
return str;
|
|
105
|
+
}
|
|
106
|
+
function onExpand($expandedKeys) {
|
|
107
|
+
expandedKeys.value = $expandedKeys;
|
|
108
|
+
autoExpandParent.value = false;
|
|
109
|
+
}
|
|
110
|
+
function clear() {
|
|
111
|
+
roleId.value = "";
|
|
112
|
+
checkedKeys.value = [];
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
loadChecked,
|
|
116
|
+
clear,
|
|
117
|
+
expandedKeys,
|
|
118
|
+
autoExpandParent,
|
|
119
|
+
checkedKeys,
|
|
120
|
+
treeData,
|
|
121
|
+
disabled,
|
|
122
|
+
onSave,
|
|
123
|
+
onExpand,
|
|
124
|
+
onRefresh,
|
|
125
|
+
clearChecked
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
const _hoisted_1 = { class: "onl-auth-tree-btns" };
|
|
130
|
+
const _hoisted_2 = /* @__PURE__ */ createTextVNode("\u5237\u65B0");
|
|
131
|
+
const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u4FDD\u5B58");
|
|
132
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
133
|
+
const _component_a_empty = resolveComponent("a-empty");
|
|
134
|
+
const _component_a_button = resolveComponent("a-button");
|
|
135
|
+
const _component_a_tree = resolveComponent("a-tree");
|
|
136
|
+
return openBlock(), createElementBlock("div", null, [
|
|
137
|
+
_ctx.disabled ? (openBlock(), createBlock(_component_a_empty, {
|
|
138
|
+
key: 0,
|
|
139
|
+
description: "\u8BF7\u5148\u9009\u4E2D\u5DE6\u4FA7\u89D2\u8272/\u90E8\u95E8/\u7528\u6237"
|
|
140
|
+
})) : _ctx.treeData.length === 0 ? (openBlock(), createBlock(_component_a_empty, {
|
|
141
|
+
key: 1,
|
|
142
|
+
description: "\u65E0\u6743\u9650\u4FE1\u606F"
|
|
143
|
+
})) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
144
|
+
createElementVNode("div", _hoisted_1, [
|
|
145
|
+
createVNode(_component_a_button, {
|
|
146
|
+
onClick: _ctx.onRefresh,
|
|
147
|
+
size: "small",
|
|
148
|
+
type: "primary",
|
|
149
|
+
preIcon: "ant-design:redo",
|
|
150
|
+
ghost: ""
|
|
151
|
+
}, {
|
|
152
|
+
default: withCtx(() => [
|
|
153
|
+
_hoisted_2
|
|
154
|
+
]),
|
|
155
|
+
_: 1
|
|
156
|
+
}, 8, ["onClick"]),
|
|
157
|
+
createVNode(_component_a_button, {
|
|
158
|
+
onClick: _ctx.onSave,
|
|
159
|
+
size: "small",
|
|
160
|
+
type: "primary",
|
|
161
|
+
preIcon: "ant-design:save",
|
|
162
|
+
ghost: ""
|
|
163
|
+
}, {
|
|
164
|
+
default: withCtx(() => [
|
|
165
|
+
_hoisted_3
|
|
166
|
+
]),
|
|
167
|
+
_: 1
|
|
168
|
+
}, 8, ["onClick"])
|
|
169
|
+
]),
|
|
170
|
+
createVNode(_component_a_tree, {
|
|
171
|
+
checkable: "",
|
|
172
|
+
checkedKeys: _ctx.checkedKeys,
|
|
173
|
+
"onUpdate:checkedKeys": _cache[0] || (_cache[0] = ($event) => _ctx.checkedKeys = $event),
|
|
174
|
+
expandedKeys: _ctx.expandedKeys,
|
|
175
|
+
autoExpandParent: _ctx.autoExpandParent,
|
|
176
|
+
treeData: _ctx.treeData,
|
|
177
|
+
onExpand: _ctx.onExpand
|
|
178
|
+
}, null, 8, ["checkedKeys", "expandedKeys", "autoExpandParent", "treeData", "onExpand"])
|
|
179
|
+
], 64))
|
|
180
|
+
]);
|
|
181
|
+
}
|
|
182
|
+
var AuthButtonTree = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-3285957e"]]);
|
|
183
|
+
export { AuthButtonTree as default };
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __async = (__this, __arguments, generator) => {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
var fulfilled = (value) => {
|
|
23
|
+
try {
|
|
24
|
+
step(generator.next(value));
|
|
25
|
+
} catch (e) {
|
|
26
|
+
reject(e);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var rejected = (value) => {
|
|
30
|
+
try {
|
|
31
|
+
step(generator.throw(value));
|
|
32
|
+
} catch (e) {
|
|
33
|
+
reject(e);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
37
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
import { defineComponent, ref, watch, reactive, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, normalizeProps, guardReactiveProps, createTextVNode, nextTick } from "vue";
|
|
41
|
+
import { BasicTable, TableAction, useTable } from "/@/components/Table";
|
|
42
|
+
import { BasicModal, useModal } from "/@/components/Modal";
|
|
43
|
+
import { BasicForm, useForm } from "/@/components/Form";
|
|
44
|
+
import { g as authDataLoadData, h as authDataSaveOrUpdate, i as authDataUpdateStatus, j as authDataDelete } from "./auth.api.js";
|
|
45
|
+
import { d as authDataColumns, u as useAuthDataFormSchemas, U as USE_SQL_RULES } from "./auth.data.js";
|
|
46
|
+
import { _ as _export_sfc } from "./index.js";
|
|
47
|
+
import "/@/utils/http/axios";
|
|
48
|
+
import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
|
|
49
|
+
import "/@/hooks/web/useMessage";
|
|
50
|
+
import "vue-router";
|
|
51
|
+
const _sfc_main = defineComponent({
|
|
52
|
+
name: "AuthDataConfig",
|
|
53
|
+
components: { BasicTable, TableAction, BasicModal, BasicForm },
|
|
54
|
+
props: {
|
|
55
|
+
cgformId: { type: String, required: true },
|
|
56
|
+
authFields: { type: Array, required: true }
|
|
57
|
+
},
|
|
58
|
+
setup(props) {
|
|
59
|
+
const loading = ref(false);
|
|
60
|
+
const [registerTable, { reload, setLoading }] = useTable({
|
|
61
|
+
api: (params) => authDataLoadData(props.cgformId, params),
|
|
62
|
+
rowKey: "id",
|
|
63
|
+
bordered: true,
|
|
64
|
+
columns: authDataColumns,
|
|
65
|
+
showIndexColumn: false,
|
|
66
|
+
actionColumn: {
|
|
67
|
+
width: 120,
|
|
68
|
+
title: "\u64CD\u4F5C",
|
|
69
|
+
fixed: false,
|
|
70
|
+
dataIndex: "action",
|
|
71
|
+
slots: { customRender: "action" }
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
watch(loading, (l) => setLoading(l));
|
|
75
|
+
const [registerModal, { openModal, closeModal }] = useModal();
|
|
76
|
+
const formModalProps = reactive({
|
|
77
|
+
title: "",
|
|
78
|
+
width: 800,
|
|
79
|
+
confirmLoading: false,
|
|
80
|
+
onOk: onSubmit,
|
|
81
|
+
onCancel: closeModal,
|
|
82
|
+
onRegister: registerModal
|
|
83
|
+
});
|
|
84
|
+
let isUpdate = false;
|
|
85
|
+
let formRecord = {};
|
|
86
|
+
const { formSchemas } = useAuthDataFormSchemas(props, {
|
|
87
|
+
onRuleOperatorChange
|
|
88
|
+
});
|
|
89
|
+
const [registerForm, { validate, resetFields, setFieldsValue }] = useForm({
|
|
90
|
+
schemas: formSchemas,
|
|
91
|
+
showActionButtonGroup: false,
|
|
92
|
+
labelAlign: "right"
|
|
93
|
+
});
|
|
94
|
+
watch(() => props.cgformId, () => {
|
|
95
|
+
reload().catch(() => null);
|
|
96
|
+
}, { immediate: true });
|
|
97
|
+
function openFormModal(data) {
|
|
98
|
+
return __async(this, null, function* () {
|
|
99
|
+
var _a;
|
|
100
|
+
isUpdate = (_a = data.isUpdate) != null ? _a : false;
|
|
101
|
+
formModalProps.title = data.title;
|
|
102
|
+
openModal();
|
|
103
|
+
yield nextTick();
|
|
104
|
+
yield resetFields();
|
|
105
|
+
formRecord = Object.assign({}, data.record);
|
|
106
|
+
yield setFieldsValue(formRecord);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function onAdd() {
|
|
110
|
+
openFormModal({ title: "\u65B0\u589E" });
|
|
111
|
+
}
|
|
112
|
+
function onEdit(record) {
|
|
113
|
+
openFormModal({ title: "\u7F16\u8F91", record, isUpdate: true });
|
|
114
|
+
}
|
|
115
|
+
function onDelete(id) {
|
|
116
|
+
loading.value = true;
|
|
117
|
+
authDataDelete(id).then(reload).finally(() => loading.value = false);
|
|
118
|
+
}
|
|
119
|
+
function onSubmit() {
|
|
120
|
+
return __async(this, null, function* () {
|
|
121
|
+
try {
|
|
122
|
+
formModalProps.confirmLoading = true;
|
|
123
|
+
let formData = yield validate();
|
|
124
|
+
formData = Object.assign({}, formRecord, formData);
|
|
125
|
+
if (formData.ruleOperator == USE_SQL_RULES) {
|
|
126
|
+
formData.ruleColumn = "";
|
|
127
|
+
}
|
|
128
|
+
formData.cgformId = props.cgformId;
|
|
129
|
+
yield authDataSaveOrUpdate(formData, isUpdate);
|
|
130
|
+
reload();
|
|
131
|
+
closeModal();
|
|
132
|
+
} finally {
|
|
133
|
+
formModalProps.confirmLoading = false;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function onUpdateStatus(record) {
|
|
138
|
+
loading.value = true;
|
|
139
|
+
let status = Math.abs(record.status - 1);
|
|
140
|
+
authDataUpdateStatus(__spreadProps(__spreadValues({}, record), { status })).then(() => {
|
|
141
|
+
record.status = status;
|
|
142
|
+
}).finally(() => {
|
|
143
|
+
loading.value = false;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function onRuleOperatorChange(val) {
|
|
147
|
+
if (val == USE_SQL_RULES) {
|
|
148
|
+
setFieldsValue({
|
|
149
|
+
ruleColumn: ""
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function getTableAction(record) {
|
|
154
|
+
return [
|
|
155
|
+
{
|
|
156
|
+
label: "\u7F16\u8F91",
|
|
157
|
+
onClick: () => onEdit(record)
|
|
158
|
+
}
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
function getDropDownAction(record) {
|
|
162
|
+
return [
|
|
163
|
+
{
|
|
164
|
+
label: "\u5220\u9664",
|
|
165
|
+
popConfirm: {
|
|
166
|
+
title: "\u786E\u5B9A\u5220\u9664\u5417\uFF1F",
|
|
167
|
+
placement: "left",
|
|
168
|
+
confirm: () => onDelete(record.id)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
];
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
loading,
|
|
175
|
+
formModalProps,
|
|
176
|
+
onAdd,
|
|
177
|
+
onUpdateStatus,
|
|
178
|
+
getTableAction,
|
|
179
|
+
getDropDownAction,
|
|
180
|
+
registerTable,
|
|
181
|
+
registerModal,
|
|
182
|
+
registerForm
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
const _hoisted_1 = /* @__PURE__ */ createTextVNode("\u65B0\u589E");
|
|
187
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
188
|
+
const _component_a_button = resolveComponent("a-button");
|
|
189
|
+
const _component_a_switch = resolveComponent("a-switch");
|
|
190
|
+
const _component_TableAction = resolveComponent("TableAction");
|
|
191
|
+
const _component_BasicTable = resolveComponent("BasicTable");
|
|
192
|
+
const _component_BasicForm = resolveComponent("BasicForm");
|
|
193
|
+
const _component_a_spin = resolveComponent("a-spin");
|
|
194
|
+
const _component_BasicModal = resolveComponent("BasicModal");
|
|
195
|
+
return openBlock(), createElementBlock("div", null, [
|
|
196
|
+
createVNode(_component_BasicTable, {
|
|
197
|
+
onRegister: _ctx.registerTable,
|
|
198
|
+
loading: _ctx.loading
|
|
199
|
+
}, {
|
|
200
|
+
tableTitle: withCtx(() => [
|
|
201
|
+
createVNode(_component_a_button, {
|
|
202
|
+
onClick: _ctx.onAdd,
|
|
203
|
+
type: "primary",
|
|
204
|
+
preIcon: "ant-design:plus"
|
|
205
|
+
}, {
|
|
206
|
+
default: withCtx(() => [
|
|
207
|
+
_hoisted_1
|
|
208
|
+
]),
|
|
209
|
+
_: 1
|
|
210
|
+
}, 8, ["onClick"])
|
|
211
|
+
]),
|
|
212
|
+
switch: withCtx(({ text, record }) => [
|
|
213
|
+
createVNode(_component_a_switch, {
|
|
214
|
+
size: "small",
|
|
215
|
+
checked: record.status === 1,
|
|
216
|
+
onClick: () => _ctx.onUpdateStatus(record)
|
|
217
|
+
}, null, 8, ["checked", "onClick"])
|
|
218
|
+
]),
|
|
219
|
+
action: withCtx(({ record }) => [
|
|
220
|
+
createVNode(_component_TableAction, {
|
|
221
|
+
actions: _ctx.getTableAction(record),
|
|
222
|
+
dropDownActions: _ctx.getDropDownAction(record)
|
|
223
|
+
}, null, 8, ["actions", "dropDownActions"])
|
|
224
|
+
]),
|
|
225
|
+
_: 1
|
|
226
|
+
}, 8, ["onRegister", "loading"]),
|
|
227
|
+
createVNode(_component_BasicModal, normalizeProps(guardReactiveProps(_ctx.formModalProps)), {
|
|
228
|
+
default: withCtx(() => [
|
|
229
|
+
createVNode(_component_a_spin, {
|
|
230
|
+
spinning: _ctx.formModalProps.confirmLoading
|
|
231
|
+
}, {
|
|
232
|
+
default: withCtx(() => [
|
|
233
|
+
createVNode(_component_BasicForm, { onRegister: _ctx.registerForm }, null, 8, ["onRegister"])
|
|
234
|
+
]),
|
|
235
|
+
_: 1
|
|
236
|
+
}, 8, ["spinning"])
|
|
237
|
+
]),
|
|
238
|
+
_: 1
|
|
239
|
+
}, 16)
|
|
240
|
+
]);
|
|
241
|
+
}
|
|
242
|
+
var AuthDataConfig = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
243
|
+
export { AuthDataConfig as default };
|