@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/AuthDataTree.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
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 { o as authDataLoadTree, l as loadRoleAuthChecked, p as saveAuthData } from "./auth.api.js";
|
|
24
|
+
import { _ as _export_sfc } from "./index.js";
|
|
25
|
+
import "/@/utils/http/axios";
|
|
26
|
+
import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
|
|
27
|
+
import "vue-router";
|
|
28
|
+
var AuthDataTree_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
29
|
+
const _sfc_main = defineComponent({
|
|
30
|
+
name: "AuthDataTree",
|
|
31
|
+
props: {
|
|
32
|
+
cgformId: { type: String, required: true }
|
|
33
|
+
},
|
|
34
|
+
setup(props) {
|
|
35
|
+
const { createMessage: $message } = useMessage();
|
|
36
|
+
const roleId = ref("");
|
|
37
|
+
const authType = ref(3);
|
|
38
|
+
const autoExpandParent = ref(true);
|
|
39
|
+
const expandedKeys = ref([]);
|
|
40
|
+
const checkedKeys = ref([]);
|
|
41
|
+
const treeData = ref([]);
|
|
42
|
+
const authMode = ref("");
|
|
43
|
+
const disabled = computed(() => !roleId.value);
|
|
44
|
+
watch(() => props.cgformId, loadTree, { immediate: true });
|
|
45
|
+
function loadTree() {
|
|
46
|
+
return __async(this, null, function* () {
|
|
47
|
+
if (!props.cgformId)
|
|
48
|
+
return;
|
|
49
|
+
let result = yield authDataLoadTree(props.cgformId, authType.value);
|
|
50
|
+
treeData.value = result.map((item) => ({ key: item.id, title: item.ruleName }));
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function loadChecked($roleId, $authMode) {
|
|
54
|
+
return __async(this, null, function* () {
|
|
55
|
+
roleId.value = $roleId;
|
|
56
|
+
authMode.value = $authMode;
|
|
57
|
+
checkedKeys.value = [];
|
|
58
|
+
let result = yield loadRoleAuthChecked({
|
|
59
|
+
roleId: $roleId,
|
|
60
|
+
cgformId: props.cgformId,
|
|
61
|
+
type: authType.value,
|
|
62
|
+
authMode: $authMode
|
|
63
|
+
});
|
|
64
|
+
checkedKeys.value = result.map((item) => item.authId);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function clearChecked() {
|
|
68
|
+
roleId.value = "";
|
|
69
|
+
}
|
|
70
|
+
function onRefresh() {
|
|
71
|
+
loadTree();
|
|
72
|
+
loadChecked(roleId.value, authMode.value);
|
|
73
|
+
}
|
|
74
|
+
function onSave() {
|
|
75
|
+
return __async(this, null, function* () {
|
|
76
|
+
yield saveAuthData(roleId.value, props.cgformId, {
|
|
77
|
+
authId: JSON.stringify(checkedKeys.value),
|
|
78
|
+
authMode: authMode.value
|
|
79
|
+
});
|
|
80
|
+
$message.success("\u4FDD\u5B58\u6210\u529F");
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function onExpand($expandedKeys) {
|
|
84
|
+
expandedKeys.value = $expandedKeys;
|
|
85
|
+
autoExpandParent.value = false;
|
|
86
|
+
}
|
|
87
|
+
function clear() {
|
|
88
|
+
roleId.value = "";
|
|
89
|
+
checkedKeys.value = [];
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
loadChecked,
|
|
93
|
+
clear,
|
|
94
|
+
expandedKeys,
|
|
95
|
+
autoExpandParent,
|
|
96
|
+
checkedKeys,
|
|
97
|
+
treeData,
|
|
98
|
+
disabled,
|
|
99
|
+
onSave,
|
|
100
|
+
onExpand,
|
|
101
|
+
onRefresh,
|
|
102
|
+
clearChecked
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
const _hoisted_1 = { class: "onl-auth-tree-btns" };
|
|
107
|
+
const _hoisted_2 = /* @__PURE__ */ createTextVNode("\u5237\u65B0");
|
|
108
|
+
const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u4FDD\u5B58");
|
|
109
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
110
|
+
const _component_a_empty = resolveComponent("a-empty");
|
|
111
|
+
const _component_a_button = resolveComponent("a-button");
|
|
112
|
+
const _component_a_tree = resolveComponent("a-tree");
|
|
113
|
+
return openBlock(), createElementBlock("div", null, [
|
|
114
|
+
_ctx.disabled ? (openBlock(), createBlock(_component_a_empty, {
|
|
115
|
+
key: 0,
|
|
116
|
+
description: "\u8BF7\u5148\u9009\u4E2D\u5DE6\u4FA7\u89D2\u8272/\u90E8\u95E8/\u7528\u6237"
|
|
117
|
+
})) : _ctx.treeData.length === 0 ? (openBlock(), createBlock(_component_a_empty, {
|
|
118
|
+
key: 1,
|
|
119
|
+
description: "\u65E0\u6743\u9650\u4FE1\u606F"
|
|
120
|
+
})) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
121
|
+
createElementVNode("div", _hoisted_1, [
|
|
122
|
+
createVNode(_component_a_button, {
|
|
123
|
+
onClick: _ctx.onRefresh,
|
|
124
|
+
size: "small",
|
|
125
|
+
type: "primary",
|
|
126
|
+
preIcon: "ant-design:redo",
|
|
127
|
+
ghost: ""
|
|
128
|
+
}, {
|
|
129
|
+
default: withCtx(() => [
|
|
130
|
+
_hoisted_2
|
|
131
|
+
]),
|
|
132
|
+
_: 1
|
|
133
|
+
}, 8, ["onClick"]),
|
|
134
|
+
createVNode(_component_a_button, {
|
|
135
|
+
onClick: _ctx.onSave,
|
|
136
|
+
size: "small",
|
|
137
|
+
type: "primary",
|
|
138
|
+
preIcon: "ant-design:save",
|
|
139
|
+
ghost: ""
|
|
140
|
+
}, {
|
|
141
|
+
default: withCtx(() => [
|
|
142
|
+
_hoisted_3
|
|
143
|
+
]),
|
|
144
|
+
_: 1
|
|
145
|
+
}, 8, ["onClick"])
|
|
146
|
+
]),
|
|
147
|
+
createVNode(_component_a_tree, {
|
|
148
|
+
checkable: "",
|
|
149
|
+
checkedKeys: _ctx.checkedKeys,
|
|
150
|
+
"onUpdate:checkedKeys": _cache[0] || (_cache[0] = ($event) => _ctx.checkedKeys = $event),
|
|
151
|
+
expandedKeys: _ctx.expandedKeys,
|
|
152
|
+
autoExpandParent: _ctx.autoExpandParent,
|
|
153
|
+
treeData: _ctx.treeData,
|
|
154
|
+
onExpand: _ctx.onExpand
|
|
155
|
+
}, null, 8, ["checkedKeys", "expandedKeys", "autoExpandParent", "treeData", "onExpand"])
|
|
156
|
+
], 64))
|
|
157
|
+
]);
|
|
158
|
+
}
|
|
159
|
+
var AuthDataTree = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-23685c7d"]]);
|
|
160
|
+
export { AuthDataTree as default };
|
|
@@ -0,0 +1,167 @@
|
|
|
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 { a as authFieldLoadData, b as authFieldUpdateStatus, c as authFieldUpdateCheckbox } from "./auth.api.js";
|
|
24
|
+
import { a as authFieldColumns } from "./auth.data.js";
|
|
25
|
+
import { _ as _export_sfc } from "./index.js";
|
|
26
|
+
import "/@/utils/http/axios";
|
|
27
|
+
import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
|
|
28
|
+
import "/@/hooks/web/useMessage";
|
|
29
|
+
import "vue-router";
|
|
30
|
+
var AuthFieldConfig_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
31
|
+
const _sfc_main = defineComponent({
|
|
32
|
+
name: "AuthFieldConfig",
|
|
33
|
+
components: { BasicTable },
|
|
34
|
+
props: {
|
|
35
|
+
headId: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "",
|
|
38
|
+
required: true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
emits: ["update:authFields"],
|
|
42
|
+
setup(props, { emit }) {
|
|
43
|
+
const cgformId = ref("");
|
|
44
|
+
const [registerTable, { reload }] = useTable({
|
|
45
|
+
api: loadData,
|
|
46
|
+
rowKey: "code",
|
|
47
|
+
bordered: true,
|
|
48
|
+
columns: authFieldColumns,
|
|
49
|
+
showIndexColumn: false
|
|
50
|
+
});
|
|
51
|
+
watch(() => props.headId, (headId) => {
|
|
52
|
+
cgformId.value = headId.split("?")[0];
|
|
53
|
+
reload().catch(() => null);
|
|
54
|
+
}, { immediate: true });
|
|
55
|
+
function loadData(params) {
|
|
56
|
+
return __async(this, null, function* () {
|
|
57
|
+
const exclude = ["id"];
|
|
58
|
+
let data = yield authFieldLoadData(cgformId.value, params);
|
|
59
|
+
let fields = [];
|
|
60
|
+
let filterData = [];
|
|
61
|
+
data.forEach((item) => {
|
|
62
|
+
if (exclude.indexOf(item.code) < 0) {
|
|
63
|
+
if (item.isShowForm == 1 || item.isShowList == 1) {
|
|
64
|
+
filterData.push(item);
|
|
65
|
+
}
|
|
66
|
+
fields.push({ text: item.title, value: item.code });
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
emit("update:authFields", fields);
|
|
70
|
+
return filterData;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function onUpdateStatus(flag, record) {
|
|
74
|
+
return __async(this, null, function* () {
|
|
75
|
+
yield authFieldUpdateStatus({
|
|
76
|
+
cgformId: cgformId.value,
|
|
77
|
+
code: record.code,
|
|
78
|
+
status: flag ? 1 : 0
|
|
79
|
+
});
|
|
80
|
+
if (!(record.formEditable || record.formShow || record.listShow)) {
|
|
81
|
+
record.formEditable = true;
|
|
82
|
+
record.formShow = true;
|
|
83
|
+
record.listShow = true;
|
|
84
|
+
}
|
|
85
|
+
record.status = Math.abs(record.status - 1);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function onCheckboxChange(event, record, switchFlag) {
|
|
89
|
+
return __async(this, null, function* () {
|
|
90
|
+
let checked = event.target.checked;
|
|
91
|
+
yield authFieldUpdateCheckbox({
|
|
92
|
+
cgformId: cgformId.value,
|
|
93
|
+
code: record.code,
|
|
94
|
+
switchFlag,
|
|
95
|
+
listShow: checked,
|
|
96
|
+
formShow: checked,
|
|
97
|
+
formEditable: checked
|
|
98
|
+
});
|
|
99
|
+
if (switchFlag == 1) {
|
|
100
|
+
record.listShow = checked;
|
|
101
|
+
} else if (switchFlag == 2) {
|
|
102
|
+
record.formShow = checked;
|
|
103
|
+
} else if (switchFlag == 3) {
|
|
104
|
+
record.formEditable = checked;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return { registerTable, onUpdateStatus, onCheckboxChange };
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
const _hoisted_1 = { class: "auth-field-config" };
|
|
112
|
+
const _hoisted_2 = /* @__PURE__ */ createTextVNode(" \u53EF\u89C1 ");
|
|
113
|
+
const _hoisted_3 = /* @__PURE__ */ createTextVNode(" \u53EF\u89C1 ");
|
|
114
|
+
const _hoisted_4 = /* @__PURE__ */ createTextVNode(" \u53EF\u7F16\u8F91 ");
|
|
115
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
116
|
+
const _component_a_switch = resolveComponent("a-switch");
|
|
117
|
+
const _component_a_checkbox = resolveComponent("a-checkbox");
|
|
118
|
+
const _component_BasicTable = resolveComponent("BasicTable");
|
|
119
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
120
|
+
createVNode(_component_BasicTable, { onRegister: _ctx.registerTable }, {
|
|
121
|
+
switch: withCtx(({ text, record }) => [
|
|
122
|
+
createVNode(_component_a_switch, {
|
|
123
|
+
size: "small",
|
|
124
|
+
checked: record.status === 1,
|
|
125
|
+
onChange: (flag) => _ctx.onUpdateStatus(flag, record)
|
|
126
|
+
}, null, 8, ["checked", "onChange"])
|
|
127
|
+
]),
|
|
128
|
+
list: withCtx(({ text, record }) => [
|
|
129
|
+
createVNode(_component_a_checkbox, {
|
|
130
|
+
checked: record.listShow,
|
|
131
|
+
disabled: record.status === 0,
|
|
132
|
+
onChange: (e) => _ctx.onCheckboxChange(e, record, 1)
|
|
133
|
+
}, {
|
|
134
|
+
default: withCtx(() => [
|
|
135
|
+
_hoisted_2
|
|
136
|
+
]),
|
|
137
|
+
_: 2
|
|
138
|
+
}, 1032, ["checked", "disabled", "onChange"])
|
|
139
|
+
]),
|
|
140
|
+
form: withCtx(({ text, record }) => [
|
|
141
|
+
createVNode(_component_a_checkbox, {
|
|
142
|
+
checked: record.formShow,
|
|
143
|
+
disabled: record.status === 0,
|
|
144
|
+
onChange: (e) => _ctx.onCheckboxChange(e, record, 2)
|
|
145
|
+
}, {
|
|
146
|
+
default: withCtx(() => [
|
|
147
|
+
_hoisted_3
|
|
148
|
+
]),
|
|
149
|
+
_: 2
|
|
150
|
+
}, 1032, ["checked", "disabled", "onChange"]),
|
|
151
|
+
createVNode(_component_a_checkbox, {
|
|
152
|
+
checked: record.formEditable,
|
|
153
|
+
disabled: record.status === 0,
|
|
154
|
+
onChange: (e) => _ctx.onCheckboxChange(e, record, 3)
|
|
155
|
+
}, {
|
|
156
|
+
default: withCtx(() => [
|
|
157
|
+
_hoisted_4
|
|
158
|
+
]),
|
|
159
|
+
_: 2
|
|
160
|
+
}, 1032, ["checked", "disabled", "onChange"])
|
|
161
|
+
]),
|
|
162
|
+
_: 1
|
|
163
|
+
}, 8, ["onRegister"])
|
|
164
|
+
]);
|
|
165
|
+
}
|
|
166
|
+
var AuthFieldConfig = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-a4e37bde"]]);
|
|
167
|
+
export { AuthFieldConfig as default };
|
package/AuthFieldTree.js
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
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, unref, createTextVNode } from "vue";
|
|
22
|
+
import { useMessage } from "/@/hooks/web/useMessage";
|
|
23
|
+
import { k as authFieldLoadTree, l as loadRoleAuthChecked, s as saveAuthField } from "./auth.api.js";
|
|
24
|
+
import { _ as _export_sfc } from "./index.js";
|
|
25
|
+
import "/@/utils/http/axios";
|
|
26
|
+
import "/@/components/jeecg/OnLine/JPopupOnlReport.vue";
|
|
27
|
+
import "vue-router";
|
|
28
|
+
var AuthFieldTree_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
29
|
+
const _sfc_main = defineComponent({
|
|
30
|
+
name: "AuthFieldTree",
|
|
31
|
+
props: {
|
|
32
|
+
cgformId: { type: String, required: true }
|
|
33
|
+
},
|
|
34
|
+
setup(props) {
|
|
35
|
+
const { createMessage: $message } = useMessage();
|
|
36
|
+
const roleId = ref("");
|
|
37
|
+
const authType = ref(1);
|
|
38
|
+
const autoExpandParent = ref(true);
|
|
39
|
+
const expandedKeys = ref([]);
|
|
40
|
+
const checkedKeys = ref([]);
|
|
41
|
+
const allCode = 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 authFieldLoadTree(props.cgformId, authType.value);
|
|
51
|
+
let trees = [];
|
|
52
|
+
let codes = [];
|
|
53
|
+
result.forEach((item) => {
|
|
54
|
+
if (!codes.includes(item.code)) {
|
|
55
|
+
codes.push(item.code);
|
|
56
|
+
trees.push({ key: item.code, title: item.title });
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
for (let node of trees) {
|
|
60
|
+
let children = [];
|
|
61
|
+
for (let item of result) {
|
|
62
|
+
if (node.key === item.code) {
|
|
63
|
+
let temp = getTreeNodeTitle(item);
|
|
64
|
+
children.push({ key: item.id, title: temp });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
node.children = children;
|
|
68
|
+
}
|
|
69
|
+
treeData.value = trees;
|
|
70
|
+
expandedKeys.value = [...codes];
|
|
71
|
+
allCode.value = codes;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function getTreeNodeTitle(item) {
|
|
75
|
+
let str = "";
|
|
76
|
+
if (item.page == 3) {
|
|
77
|
+
str += "\u5217\u8868";
|
|
78
|
+
} else if (item.page == 5) {
|
|
79
|
+
str += "\u8868\u5355";
|
|
80
|
+
}
|
|
81
|
+
if (item.control == 3) {
|
|
82
|
+
str += "\u53EF\u7F16\u8F91";
|
|
83
|
+
} else if (item.control == 5) {
|
|
84
|
+
str += "\u53EF\u89C1";
|
|
85
|
+
}
|
|
86
|
+
return str;
|
|
87
|
+
}
|
|
88
|
+
function loadChecked($roleId, $authMode) {
|
|
89
|
+
return __async(this, null, function* () {
|
|
90
|
+
roleId.value = $roleId;
|
|
91
|
+
authMode.value = $authMode;
|
|
92
|
+
checkedKeys.value = [];
|
|
93
|
+
let result = yield loadRoleAuthChecked({
|
|
94
|
+
roleId: $roleId,
|
|
95
|
+
cgformId: props.cgformId,
|
|
96
|
+
type: authType.value,
|
|
97
|
+
authMode: $authMode
|
|
98
|
+
});
|
|
99
|
+
checkedKeys.value = result.map((item) => item.authId);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function clearChecked() {
|
|
103
|
+
roleId.value = "";
|
|
104
|
+
}
|
|
105
|
+
function onRefresh() {
|
|
106
|
+
loadTree();
|
|
107
|
+
loadChecked(roleId.value, authMode.value);
|
|
108
|
+
}
|
|
109
|
+
function onSave() {
|
|
110
|
+
return __async(this, null, function* () {
|
|
111
|
+
let ids = checkedKeys.value.filter((i) => allCode.value.indexOf(i) < 0);
|
|
112
|
+
yield saveAuthField(roleId.value, props.cgformId, {
|
|
113
|
+
authId: JSON.stringify(ids),
|
|
114
|
+
authMode: authMode.value
|
|
115
|
+
});
|
|
116
|
+
$message.success("\u4FDD\u5B58\u6210\u529F");
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function onExpandAll() {
|
|
120
|
+
expandedKeys.value = [...allCode.value];
|
|
121
|
+
}
|
|
122
|
+
function onCloseAll() {
|
|
123
|
+
expandedKeys.value = [];
|
|
124
|
+
}
|
|
125
|
+
function onExpand($expandedKeys) {
|
|
126
|
+
expandedKeys.value = $expandedKeys;
|
|
127
|
+
autoExpandParent.value = false;
|
|
128
|
+
}
|
|
129
|
+
function clear() {
|
|
130
|
+
roleId.value = "";
|
|
131
|
+
checkedKeys.value = [];
|
|
132
|
+
}
|
|
133
|
+
function onClearSelected() {
|
|
134
|
+
checkedKeys.value = [];
|
|
135
|
+
}
|
|
136
|
+
function onSelectAll() {
|
|
137
|
+
const selectFun = function(arr) {
|
|
138
|
+
for (let node of arr) {
|
|
139
|
+
checkedKeys.value.push(node.key);
|
|
140
|
+
if (node.children && node.children.length > 0) {
|
|
141
|
+
selectFun.call(null, node.children);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
checkedKeys.value = [];
|
|
146
|
+
selectFun.call(null, unref(treeData));
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
loadChecked,
|
|
150
|
+
clear,
|
|
151
|
+
expandedKeys,
|
|
152
|
+
autoExpandParent,
|
|
153
|
+
checkedKeys,
|
|
154
|
+
treeData,
|
|
155
|
+
disabled,
|
|
156
|
+
onSave,
|
|
157
|
+
onExpand,
|
|
158
|
+
clearChecked,
|
|
159
|
+
onCloseAll,
|
|
160
|
+
onExpandAll,
|
|
161
|
+
onRefresh,
|
|
162
|
+
onClearSelected,
|
|
163
|
+
onSelectAll
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
const _hoisted_1 = { class: "onl-auth-tree-btns" };
|
|
168
|
+
const _hoisted_2 = /* @__PURE__ */ createTextVNode("\u5237\u65B0");
|
|
169
|
+
const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u5C55\u5F00");
|
|
170
|
+
const _hoisted_4 = /* @__PURE__ */ createTextVNode("\u6298\u53E0");
|
|
171
|
+
const _hoisted_5 = /* @__PURE__ */ createTextVNode("\u4FDD\u5B58");
|
|
172
|
+
const _hoisted_6 = /* @__PURE__ */ createTextVNode("\u5168\u9009");
|
|
173
|
+
const _hoisted_7 = /* @__PURE__ */ createTextVNode("\u91CD\u7F6E");
|
|
174
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
175
|
+
const _component_a_empty = resolveComponent("a-empty");
|
|
176
|
+
const _component_a_button = resolveComponent("a-button");
|
|
177
|
+
const _component_a_tree = resolveComponent("a-tree");
|
|
178
|
+
return openBlock(), createElementBlock("div", null, [
|
|
179
|
+
_ctx.disabled ? (openBlock(), createBlock(_component_a_empty, {
|
|
180
|
+
key: 0,
|
|
181
|
+
description: "\u8BF7\u5148\u9009\u4E2D\u5DE6\u4FA7\u89D2\u8272/\u90E8\u95E8/\u7528\u6237"
|
|
182
|
+
})) : _ctx.treeData.length === 0 ? (openBlock(), createBlock(_component_a_empty, {
|
|
183
|
+
key: 1,
|
|
184
|
+
description: "\u65E0\u6743\u9650\u4FE1\u606F"
|
|
185
|
+
})) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
186
|
+
createElementVNode("div", _hoisted_1, [
|
|
187
|
+
createVNode(_component_a_button, {
|
|
188
|
+
onClick: _ctx.onRefresh,
|
|
189
|
+
size: "small",
|
|
190
|
+
type: "primary",
|
|
191
|
+
preIcon: "ant-design:redo",
|
|
192
|
+
ghost: ""
|
|
193
|
+
}, {
|
|
194
|
+
default: withCtx(() => [
|
|
195
|
+
_hoisted_2
|
|
196
|
+
]),
|
|
197
|
+
_: 1
|
|
198
|
+
}, 8, ["onClick"]),
|
|
199
|
+
createVNode(_component_a_button, {
|
|
200
|
+
onClick: _ctx.onExpandAll,
|
|
201
|
+
size: "small",
|
|
202
|
+
type: "primary",
|
|
203
|
+
preIcon: "ant-design:down-circle",
|
|
204
|
+
ghost: ""
|
|
205
|
+
}, {
|
|
206
|
+
default: withCtx(() => [
|
|
207
|
+
_hoisted_3
|
|
208
|
+
]),
|
|
209
|
+
_: 1
|
|
210
|
+
}, 8, ["onClick"]),
|
|
211
|
+
createVNode(_component_a_button, {
|
|
212
|
+
onClick: _ctx.onCloseAll,
|
|
213
|
+
size: "small",
|
|
214
|
+
type: "primary",
|
|
215
|
+
preIcon: "ant-design:up-circle",
|
|
216
|
+
ghost: ""
|
|
217
|
+
}, {
|
|
218
|
+
default: withCtx(() => [
|
|
219
|
+
_hoisted_4
|
|
220
|
+
]),
|
|
221
|
+
_: 1
|
|
222
|
+
}, 8, ["onClick"]),
|
|
223
|
+
createVNode(_component_a_button, {
|
|
224
|
+
onClick: _ctx.onSave,
|
|
225
|
+
size: "small",
|
|
226
|
+
type: "primary",
|
|
227
|
+
preIcon: "ant-design:save",
|
|
228
|
+
ghost: ""
|
|
229
|
+
}, {
|
|
230
|
+
default: withCtx(() => [
|
|
231
|
+
_hoisted_5
|
|
232
|
+
]),
|
|
233
|
+
_: 1
|
|
234
|
+
}, 8, ["onClick"]),
|
|
235
|
+
createVNode(_component_a_button, {
|
|
236
|
+
onClick: _ctx.onSelectAll,
|
|
237
|
+
size: "small",
|
|
238
|
+
type: "primary",
|
|
239
|
+
preIcon: "ant-design:check",
|
|
240
|
+
ghost: ""
|
|
241
|
+
}, {
|
|
242
|
+
default: withCtx(() => [
|
|
243
|
+
_hoisted_6
|
|
244
|
+
]),
|
|
245
|
+
_: 1
|
|
246
|
+
}, 8, ["onClick"]),
|
|
247
|
+
createVNode(_component_a_button, {
|
|
248
|
+
onClick: _ctx.onClearSelected,
|
|
249
|
+
size: "small",
|
|
250
|
+
type: "primary",
|
|
251
|
+
preIcon: "ant-design:undo",
|
|
252
|
+
ghost: ""
|
|
253
|
+
}, {
|
|
254
|
+
default: withCtx(() => [
|
|
255
|
+
_hoisted_7
|
|
256
|
+
]),
|
|
257
|
+
_: 1
|
|
258
|
+
}, 8, ["onClick"])
|
|
259
|
+
]),
|
|
260
|
+
createVNode(_component_a_tree, {
|
|
261
|
+
checkable: "",
|
|
262
|
+
checkedKeys: _ctx.checkedKeys,
|
|
263
|
+
"onUpdate:checkedKeys": _cache[0] || (_cache[0] = ($event) => _ctx.checkedKeys = $event),
|
|
264
|
+
expandedKeys: _ctx.expandedKeys,
|
|
265
|
+
autoExpandParent: _ctx.autoExpandParent,
|
|
266
|
+
treeData: _ctx.treeData,
|
|
267
|
+
onExpand: _ctx.onExpand
|
|
268
|
+
}, null, 8, ["checkedKeys", "expandedKeys", "autoExpandParent", "treeData", "onExpand"])
|
|
269
|
+
], 64))
|
|
270
|
+
]);
|
|
271
|
+
}
|
|
272
|
+
var AuthFieldTree = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-73e2c712"]]);
|
|
273
|
+
export { AuthFieldTree as default };
|