inl-ui 0.0.3 → 0.0.4
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/conf/cp.js +51 -0
- package/dist/index.js +55 -2
- package/dist/index.js.map +1 -1
- package/dist/style.css +0 -1
- package/dist/theme/dark copy.less +448 -0
- package/dist/theme/dark.less +182 -0
- package/dist/theme/default.less +1067 -0
- package/dist/types/src/pageComponent/api/auth/menuManager.d.ts +5 -5
- package/dist/types/src/pageComponent/api/auth/roleManager.d.ts +6 -6
- package/dist/types/src/pageComponent/api/auth/userManager.d.ts +10 -10
- package/dist/types/src/pageComponent/api/axios.d.ts +1 -1
- package/dist/types/src/pageComponent/api/index.d.ts +4 -4
- package/dist/types/src/pageComponent/api/logManager.d.ts +2 -2
- package/dist/types/src/pageComponent/api/org/depManager.d.ts +13 -13
- package/dist/types/src/pageComponent/api/org/postManager.d.ts +5 -5
- package/dist/types/src/pageComponent/api/org/teamManager.d.ts +7 -7
- package/dist/types/src/pageComponent/api/param.d.ts +6 -6
- package/dist/types/src/pageComponent/components/EditPasswordForm.d.ts +1 -1
- package/dist/types/src/pageComponent/components/ProFormItem.d.ts +2 -2
- package/dist/types/src/pageComponent/components/SearchSelect.d.ts +2 -2
- package/dist/types/src/pageComponent/views/systemManager/authManager/userManager/updateUserDialog.d.ts +2 -2
- package/dist/types/src/pageComponent/views/systemManager/orgManager/depManager/updateDepDialog.d.ts +1 -1
- package/dist/types/src/pageComponent/views/systemManager/orgManager/depManager/updateEmployeeDialog.d.ts +1 -1
- package/dist/types/src/pageComponent/views/systemManager/orgManager/postManager/updatePostDialog.d.ts +1 -1
- package/dist/types/src/pageComponent/views/systemManager/orgManager/teamManager/updateTeamDialog.d.ts +1 -1
- package/dist/types/src/utils/className.d.ts +2 -0
- package/dist/types/src/utils/config.d.ts +4 -0
- package/dist/types/src/utils/getSlots.d.ts +3 -0
- package/dist/types/src/utils/index.d.ts +10 -0
- package/dist/types/src/utils/installComponent.d.ts +3 -0
- package/package.json +4 -2
- package/src/{gl.ts → gl.d.ts} +6 -0
- package/src/ht/ht-widget.d.ts +11327 -0
- package/src/ht/ht.d.ts +11410 -0
- package/src/ht/index.d.ts +4 -0
- package/src/pageComponent/api/axios.ts +18 -18
- package/src/pageComponent/components/CommonTree.tsx +31 -31
- package/src/pageComponent/components/EditPasswordForm.tsx +20 -20
- package/src/pageComponent/components/IconSelect.tsx +12 -12
- package/src/pageComponent/components/Navbar.tsx +9 -9
- package/src/pageComponent/components/ProFormItem.tsx +18 -18
- package/src/pageComponent/components/SearchSelect.tsx +20 -20
- package/src/pageComponent/components/Sidebar.tsx +11 -11
- package/src/pageComponent/config/htconfig.ts +5 -5
- package/dist/types/src/gl.d.ts +0 -8
- package/dist/types/src/utll.d.ts +0 -2
|
@@ -5,26 +5,26 @@
|
|
|
5
5
|
* @LastEditors: wang liang
|
|
6
6
|
* @LastEditTime: 2022-04-19 16:10:57
|
|
7
7
|
*/
|
|
8
|
-
import axios from
|
|
9
|
-
import { omit, isPlainObject } from
|
|
10
|
-
import { message } from
|
|
8
|
+
import axios from "axios";
|
|
9
|
+
import { omit, isPlainObject } from "lodash";
|
|
10
|
+
import { message } from "ant-design-vue";
|
|
11
11
|
|
|
12
12
|
const instance = axios.create({
|
|
13
|
-
baseURL:
|
|
13
|
+
baseURL: "/api/comlite/v1", // /api/
|
|
14
14
|
timeout: 5000,
|
|
15
15
|
headers: {
|
|
16
|
-
|
|
17
|
-
clientType:
|
|
18
|
-
|
|
16
|
+
"X-Custom-Header": "foobar",
|
|
17
|
+
clientType: "app",
|
|
18
|
+
"Content-Type": "application/json;charset=UTF-8",
|
|
19
19
|
},
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
const getToken = (): string => {
|
|
23
|
-
return `${sessionStorage.getItem(
|
|
23
|
+
return `${sessionStorage.getItem("token")}`;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const getUser = () => {
|
|
27
|
-
const user = sessionStorage.getItem(
|
|
27
|
+
const user = sessionStorage.getItem("userinfo");
|
|
28
28
|
if (user) {
|
|
29
29
|
return JSON.parse(user);
|
|
30
30
|
}
|
|
@@ -32,7 +32,7 @@ const getUser = () => {
|
|
|
32
32
|
|
|
33
33
|
instance.interceptors.request.use(
|
|
34
34
|
(conf) => {
|
|
35
|
-
const corpId = sessionStorage.getItem(
|
|
35
|
+
const corpId = sessionStorage.getItem("corpId");
|
|
36
36
|
conf.headers.token = getToken();
|
|
37
37
|
conf.headers.userId = getUser()?.userId;
|
|
38
38
|
conf.headers.userName = getUser()?.userName;
|
|
@@ -41,10 +41,10 @@ instance.interceptors.request.use(
|
|
|
41
41
|
if (isPlainObject(data)) {
|
|
42
42
|
conf.data = omit(
|
|
43
43
|
data,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
"createDt",
|
|
45
|
+
"createUser",
|
|
46
|
+
"updateDt",
|
|
47
|
+
"updateUser"
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
if (corpId) {
|
|
@@ -54,24 +54,24 @@ instance.interceptors.request.use(
|
|
|
54
54
|
},
|
|
55
55
|
(err) => {
|
|
56
56
|
return Promise.reject(err);
|
|
57
|
-
}
|
|
57
|
+
}
|
|
58
58
|
);
|
|
59
59
|
|
|
60
60
|
instance.interceptors.response.use(
|
|
61
61
|
(res) => {
|
|
62
62
|
const resData = res.data;
|
|
63
|
-
const status = resData.code ===
|
|
63
|
+
const status = resData.code === "0";
|
|
64
64
|
if (status) {
|
|
65
65
|
return Promise.resolve(resData);
|
|
66
66
|
}
|
|
67
|
-
const msg = res.data?.msg ??
|
|
67
|
+
const msg = res.data?.msg ?? "请求失败";
|
|
68
68
|
message.error(msg);
|
|
69
69
|
|
|
70
70
|
return Promise.reject(resData);
|
|
71
71
|
},
|
|
72
72
|
(err) => {
|
|
73
73
|
return Promise.reject(err);
|
|
74
|
-
}
|
|
74
|
+
}
|
|
75
75
|
);
|
|
76
76
|
|
|
77
77
|
export { instance };
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* @LastEditTime: 2022-04-25 15:10:09
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { defineComponent, onBeforeUnmount, onMounted, ref } from
|
|
10
|
-
import useProxy from
|
|
11
|
-
import useBus from
|
|
12
|
-
import { debounce } from
|
|
13
|
-
import { findById } from
|
|
9
|
+
import { defineComponent, onBeforeUnmount, onMounted, ref } from "vue";
|
|
10
|
+
import useProxy from "@/pageComponent/hooks/useProxy";
|
|
11
|
+
import useBus from "@/pageComponent/hooks/useBus";
|
|
12
|
+
import { debounce } from "lodash";
|
|
13
|
+
import { findById } from "@/pageComponent/utils/tree";
|
|
14
14
|
|
|
15
|
-
import { Tree, Input, Space, Button, Spin, Modal, Empty } from
|
|
15
|
+
import { Tree, Input, Space, Button, Spin, Modal, Empty } from "ant-design-vue";
|
|
16
16
|
import {
|
|
17
17
|
SearchOutlined,
|
|
18
18
|
CloudUploadOutlined,
|
|
@@ -22,13 +22,13 @@ import {
|
|
|
22
22
|
DeleteOutlined,
|
|
23
23
|
PlusCircleOutlined,
|
|
24
24
|
HolderOutlined,
|
|
25
|
-
} from
|
|
25
|
+
} from "@ant-design/icons-vue";
|
|
26
26
|
|
|
27
27
|
const CommonTree = defineComponent({
|
|
28
28
|
props: {
|
|
29
29
|
downLoadName: {
|
|
30
30
|
type: String,
|
|
31
|
-
default:
|
|
31
|
+
default: "树结构数据.json",
|
|
32
32
|
},
|
|
33
33
|
getData: {
|
|
34
34
|
type: Function,
|
|
@@ -59,9 +59,9 @@ const CommonTree = defineComponent({
|
|
|
59
59
|
},
|
|
60
60
|
setup(props) {
|
|
61
61
|
const proxy = useProxy();
|
|
62
|
-
const bus = useBus(
|
|
62
|
+
const bus = useBus("system");
|
|
63
63
|
|
|
64
|
-
const searchText = ref(
|
|
64
|
+
const searchText = ref("");
|
|
65
65
|
|
|
66
66
|
const treeData = ref([]);
|
|
67
67
|
const originData = ref([]);
|
|
@@ -110,7 +110,7 @@ const CommonTree = defineComponent({
|
|
|
110
110
|
const str = JSON.stringify(originData.value, null, 2);
|
|
111
111
|
const blob = new Blob([str]);
|
|
112
112
|
const url = URL.createObjectURL(blob);
|
|
113
|
-
const aEl = document.createElement(
|
|
113
|
+
const aEl = document.createElement("a");
|
|
114
114
|
aEl.href = url;
|
|
115
115
|
aEl.download = props.downLoadName;
|
|
116
116
|
aEl.click();
|
|
@@ -118,7 +118,7 @@ const CommonTree = defineComponent({
|
|
|
118
118
|
// 复制节点
|
|
119
119
|
const handleCopy = (node: any) => {
|
|
120
120
|
Modal.confirm({
|
|
121
|
-
title:
|
|
121
|
+
title: "复制菜单",
|
|
122
122
|
content: `确定复制菜单“${node.name}”?`,
|
|
123
123
|
async onOk() {
|
|
124
124
|
props.onCopy?.(node);
|
|
@@ -137,7 +137,7 @@ const CommonTree = defineComponent({
|
|
|
137
137
|
// 删除节点
|
|
138
138
|
const handleDelete = (node: any) => {
|
|
139
139
|
Modal.confirm({
|
|
140
|
-
title:
|
|
140
|
+
title: "删除菜单",
|
|
141
141
|
content: `确定删除菜单“${node.name}”?`,
|
|
142
142
|
async onOk() {
|
|
143
143
|
props.onDelete?.(node);
|
|
@@ -150,7 +150,7 @@ const CommonTree = defineComponent({
|
|
|
150
150
|
const handleDrop = (info: any) => {
|
|
151
151
|
const dropKey = info.node.id;
|
|
152
152
|
const dragKey = info.dragNode.id;
|
|
153
|
-
const dropPos = info.node.pos.split(
|
|
153
|
+
const dropPos = info.node.pos.split("-");
|
|
154
154
|
const dropPosition =
|
|
155
155
|
info.dropPosition - Number(dropPos[dropPos.length - 1]);
|
|
156
156
|
const loop = (data: any, id: string | number, callback: any) => {
|
|
@@ -218,7 +218,7 @@ const CommonTree = defineComponent({
|
|
|
218
218
|
// 转换第一层数据
|
|
219
219
|
const res = data.map((item: any, index: number) => {
|
|
220
220
|
setSort(item, index);
|
|
221
|
-
item.id = parseInt(item.id.replace(
|
|
221
|
+
item.id = parseInt(item.id.replace("sys", ""));
|
|
222
222
|
item.menuList = item.subList;
|
|
223
223
|
return item;
|
|
224
224
|
});
|
|
@@ -231,30 +231,30 @@ const CommonTree = defineComponent({
|
|
|
231
231
|
const handleRefresh = async () => {
|
|
232
232
|
await getTreeData(proxy._reselect);
|
|
233
233
|
};
|
|
234
|
-
onMounted(() => bus.on(
|
|
235
|
-
onBeforeUnmount(() => bus.off(
|
|
234
|
+
onMounted(() => bus.on("tree/refresh", handleRefresh));
|
|
235
|
+
onBeforeUnmount(() => bus.off("tree/refresh", handleRefresh));
|
|
236
236
|
|
|
237
237
|
return () => (
|
|
238
|
-
<div class=
|
|
238
|
+
<div class="common-tree">
|
|
239
239
|
{/* 搜索 */}
|
|
240
240
|
<Input
|
|
241
|
-
style={{ marginBottom:
|
|
242
|
-
placeholder=
|
|
241
|
+
style={{ marginBottom: "16px" }}
|
|
242
|
+
placeholder="请输入内容"
|
|
243
243
|
allowClear
|
|
244
244
|
suffix={<SearchOutlined />}
|
|
245
|
-
v-model={[searchText.value,
|
|
245
|
+
v-model={[searchText.value, "value"]}
|
|
246
246
|
onChange={getTreeData}
|
|
247
247
|
/>
|
|
248
248
|
{/* 工具栏容器 */}
|
|
249
|
-
<div class=
|
|
249
|
+
<div class="utils-container">
|
|
250
250
|
<Space>
|
|
251
251
|
{props.isJSONOperation && (
|
|
252
252
|
<>
|
|
253
|
-
<Button type=
|
|
253
|
+
<Button type="link">
|
|
254
254
|
<CloudUploadOutlined />
|
|
255
255
|
上传JSON文件
|
|
256
256
|
</Button>
|
|
257
|
-
<Button type=
|
|
257
|
+
<Button type="link" onClick={handleDownload}>
|
|
258
258
|
<CloudDownloadOutlined />
|
|
259
259
|
下载JSON文件
|
|
260
260
|
</Button>
|
|
@@ -262,7 +262,7 @@ const CommonTree = defineComponent({
|
|
|
262
262
|
)}
|
|
263
263
|
</Space>
|
|
264
264
|
</div>
|
|
265
|
-
<div class=
|
|
265
|
+
<div class="tree-container">
|
|
266
266
|
<Spin spinning={isLoading.value}>
|
|
267
267
|
{treeData.value.length > 0 ? (
|
|
268
268
|
<Tree
|
|
@@ -270,20 +270,20 @@ const CommonTree = defineComponent({
|
|
|
270
270
|
blockNode
|
|
271
271
|
draggable={isDraggable.value}
|
|
272
272
|
defaultExpandAll
|
|
273
|
-
fieldNames={{ children:
|
|
273
|
+
fieldNames={{ children: "subList", key: "id", title: "name" }}
|
|
274
274
|
treeData={treeData.value}
|
|
275
|
-
v-model={[selectedKeys.value,
|
|
275
|
+
v-model={[selectedKeys.value, "selectedKeys"]}
|
|
276
276
|
onSelect={handleSelectNode}
|
|
277
277
|
onDrop={handleDrop}
|
|
278
278
|
>
|
|
279
279
|
{{
|
|
280
280
|
title: ({ name, selected, isSystem, dataRef }: any) => {
|
|
281
281
|
return (
|
|
282
|
-
<span class=
|
|
283
|
-
<span class=
|
|
282
|
+
<span class="tree-node-title">
|
|
283
|
+
<span class="name">{name}</span>
|
|
284
284
|
{/* 当前选中的节点需要展示操作按钮 */}
|
|
285
285
|
{selected && isSystem && (
|
|
286
|
-
<span class=
|
|
286
|
+
<span class="operation" style={{ float: "right" }}>
|
|
287
287
|
<PlusCircleOutlined
|
|
288
288
|
onClick={(e) => {
|
|
289
289
|
e.stopPropagation();
|
|
@@ -293,7 +293,7 @@ const CommonTree = defineComponent({
|
|
|
293
293
|
</span>
|
|
294
294
|
)}
|
|
295
295
|
{selected && !isSystem && (
|
|
296
|
-
<span class=
|
|
296
|
+
<span class="operation" style={{ float: "right" }}>
|
|
297
297
|
<Space>
|
|
298
298
|
{/* 只能复制没有子菜单的菜单 */}
|
|
299
299
|
{!dataRef.subList.length &&
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* @LastEditTime: 2022-04-14 16:45:42
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { defineComponent, PropType, ref } from
|
|
10
|
-
import useVModel from
|
|
11
|
-
import useProxy from
|
|
9
|
+
import { defineComponent, PropType, ref } from "vue";
|
|
10
|
+
import useVModel from "@/pageComponent/hooks/useVModel";
|
|
11
|
+
import useProxy from "@/pageComponent/hooks/useProxy";
|
|
12
12
|
|
|
13
|
-
import { Form, FormItem, InputPassword } from
|
|
13
|
+
import { Form, FormItem, InputPassword } from "ant-design-vue";
|
|
14
14
|
|
|
15
15
|
export interface IEditPasswordForm {
|
|
16
16
|
oldPassWord: string;
|
|
@@ -19,7 +19,7 @@ export interface IEditPasswordForm {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
const Editpasswordform = defineComponent({
|
|
22
|
-
emits: [
|
|
22
|
+
emits: ["udpate:form"],
|
|
23
23
|
props: {
|
|
24
24
|
form: {
|
|
25
25
|
type: Object as PropType<IEditPasswordForm>,
|
|
@@ -28,25 +28,25 @@ const Editpasswordform = defineComponent({
|
|
|
28
28
|
},
|
|
29
29
|
setup(props, { emit }) {
|
|
30
30
|
const proxy = useProxy();
|
|
31
|
-
const formModel = useVModel(props,
|
|
31
|
+
const formModel = useVModel(props, "form", emit);
|
|
32
32
|
|
|
33
33
|
const rules = {
|
|
34
34
|
passWord: {
|
|
35
35
|
async validator(rule: any, value: string) {
|
|
36
|
-
if (!value) throw new Error(
|
|
36
|
+
if (!value) throw new Error("请输入新密码");
|
|
37
37
|
if (!formModel.value.checkPassWord) return true;
|
|
38
38
|
if (value !== formModel.value.checkPassWord) {
|
|
39
|
-
throw new Error(
|
|
39
|
+
throw new Error("新旧密码不一致");
|
|
40
40
|
}
|
|
41
41
|
return true;
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
checkPassWord: {
|
|
45
45
|
async validator(rule: any, value: string) {
|
|
46
|
-
if (!value) throw new Error(
|
|
46
|
+
if (!value) throw new Error("请确认密码");
|
|
47
47
|
if (!formModel.value.passWord) return true;
|
|
48
48
|
if (value !== formModel.value.passWord) {
|
|
49
|
-
throw new Error(
|
|
49
|
+
throw new Error("新旧密码不一致");
|
|
50
50
|
}
|
|
51
51
|
return true;
|
|
52
52
|
},
|
|
@@ -56,7 +56,7 @@ const Editpasswordform = defineComponent({
|
|
|
56
56
|
const formRef = ref();
|
|
57
57
|
|
|
58
58
|
proxy._validate = async () => {
|
|
59
|
-
console.log(
|
|
59
|
+
console.log("验证");
|
|
60
60
|
|
|
61
61
|
await formRef.value.validate();
|
|
62
62
|
};
|
|
@@ -64,22 +64,22 @@ const Editpasswordform = defineComponent({
|
|
|
64
64
|
return () => (
|
|
65
65
|
<Form
|
|
66
66
|
ref={formRef}
|
|
67
|
-
labelCol={{ style: { width:
|
|
67
|
+
labelCol={{ style: { width: "100px" } }}
|
|
68
68
|
model={formModel.value}
|
|
69
69
|
rules={rules}
|
|
70
70
|
>
|
|
71
71
|
<FormItem
|
|
72
|
-
name=
|
|
73
|
-
rules={{ required: true, message:
|
|
74
|
-
label=
|
|
72
|
+
name="oldPassWord"
|
|
73
|
+
rules={{ required: true, message: "请输入原密码" }}
|
|
74
|
+
label="原密码"
|
|
75
75
|
>
|
|
76
|
-
<InputPassword v-model={[formModel.value.oldPassWord,
|
|
76
|
+
<InputPassword v-model={[formModel.value.oldPassWord, "value"]} />
|
|
77
77
|
</FormItem>
|
|
78
|
-
<FormItem name=
|
|
79
|
-
<InputPassword v-model={[formModel.value.passWord,
|
|
78
|
+
<FormItem name="passWord" label="新密码">
|
|
79
|
+
<InputPassword v-model={[formModel.value.passWord, "value"]} />
|
|
80
80
|
</FormItem>
|
|
81
|
-
<FormItem name=
|
|
82
|
-
<InputPassword v-model={[formModel.value.checkPassWord,
|
|
81
|
+
<FormItem name="checkPassWord" label="确认新密码">
|
|
82
|
+
<InputPassword v-model={[formModel.value.checkPassWord, "value"]} />
|
|
83
83
|
</FormItem>
|
|
84
84
|
</Form>
|
|
85
85
|
);
|
|
@@ -6,38 +6,38 @@
|
|
|
6
6
|
* @LastEditTime: 2022-04-06 16:12:58
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { defineComponent } from
|
|
10
|
-
import useVModel from
|
|
9
|
+
import { defineComponent } from "vue";
|
|
10
|
+
import useVModel from "@/pageComponent/hooks/useVModel";
|
|
11
11
|
|
|
12
|
-
import { Select, SelectOption } from
|
|
12
|
+
import { Select, SelectOption } from "ant-design-vue";
|
|
13
13
|
import {
|
|
14
14
|
CiOutlined,
|
|
15
15
|
UpOutlined,
|
|
16
16
|
ApiOutlined,
|
|
17
17
|
EyeOutlined,
|
|
18
18
|
KeyOutlined,
|
|
19
|
-
} from
|
|
19
|
+
} from "@ant-design/icons-vue";
|
|
20
20
|
|
|
21
21
|
const iconsList = [
|
|
22
|
-
{ name:
|
|
23
|
-
{ name:
|
|
24
|
-
{ name:
|
|
25
|
-
{ name:
|
|
26
|
-
{ name:
|
|
22
|
+
{ name: "CiOutlined", icon: CiOutlined },
|
|
23
|
+
{ name: "UpOutlined", icon: UpOutlined },
|
|
24
|
+
{ name: "ApiOutlined", icon: ApiOutlined },
|
|
25
|
+
{ name: "EyeOutlined", icon: EyeOutlined },
|
|
26
|
+
{ name: "KeyOutlined", icon: KeyOutlined },
|
|
27
27
|
];
|
|
28
28
|
|
|
29
29
|
const IconSelect = defineComponent({
|
|
30
|
-
emits: [
|
|
30
|
+
emits: ["update:value"],
|
|
31
31
|
props: {
|
|
32
32
|
value: {
|
|
33
33
|
type: [String, Number],
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
setup(props, { emit }) {
|
|
37
|
-
const selectValue = useVModel(props,
|
|
37
|
+
const selectValue = useVModel(props, "value", emit);
|
|
38
38
|
|
|
39
39
|
return () => (
|
|
40
|
-
<Select v-model={[selectValue.value,
|
|
40
|
+
<Select v-model={[selectValue.value, "value"]}>
|
|
41
41
|
{iconsList.map((item) => (
|
|
42
42
|
<SelectOption key={item.name}>
|
|
43
43
|
<item.icon />
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
h,
|
|
6
6
|
resolveComponent,
|
|
7
7
|
watch,
|
|
8
|
-
} from
|
|
9
|
-
import { Menu, MenuItem, SubMenu } from
|
|
10
|
-
import { useRoute, useRouter } from
|
|
8
|
+
} from "vue";
|
|
9
|
+
import { Menu, MenuItem, SubMenu } from "ant-design-vue";
|
|
10
|
+
import { useRoute, useRouter } from "vue-router";
|
|
11
11
|
|
|
12
12
|
// props
|
|
13
13
|
const props = {
|
|
@@ -40,10 +40,10 @@ export default defineComponent({
|
|
|
40
40
|
watch(
|
|
41
41
|
route,
|
|
42
42
|
(nVal) => {
|
|
43
|
-
const urlList = nVal.path.split(
|
|
43
|
+
const urlList = nVal.path.split("/");
|
|
44
44
|
state.selectedKeys = [`/${urlList[1]}`];
|
|
45
45
|
},
|
|
46
|
-
{ deep: true, immediate: true }
|
|
46
|
+
{ deep: true, immediate: true }
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
const toPath = (path: string) => {
|
|
@@ -71,7 +71,7 @@ export default defineComponent({
|
|
|
71
71
|
ele = (
|
|
72
72
|
<MenuItem
|
|
73
73
|
key={item.path}
|
|
74
|
-
onClick={() => toPath((fPath ? `${fPath}/` :
|
|
74
|
+
onClick={() => toPath((fPath ? `${fPath}/` : "") + item.path)}
|
|
75
75
|
v-slots={getSlots(meta.title, meta?.icon)}
|
|
76
76
|
>
|
|
77
77
|
{meta.title}
|
|
@@ -85,9 +85,9 @@ export default defineComponent({
|
|
|
85
85
|
|
|
86
86
|
return () => (
|
|
87
87
|
<Menu
|
|
88
|
-
class=
|
|
89
|
-
mode=
|
|
90
|
-
v-model={[state.selectedKeys,
|
|
88
|
+
class="topMenu"
|
|
89
|
+
mode="horizontal"
|
|
90
|
+
v-model={[state.selectedKeys, "selectedKeys"]}
|
|
91
91
|
>
|
|
92
92
|
{getMenuItem(prop.menu)}
|
|
93
93
|
</Menu>
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
ref,
|
|
15
15
|
watch,
|
|
16
16
|
PropType,
|
|
17
|
-
} from
|
|
18
|
-
import { isObject } from
|
|
17
|
+
} from "vue";
|
|
18
|
+
import { isObject } from "lodash";
|
|
19
19
|
|
|
20
20
|
import {
|
|
21
21
|
FormItem,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
Switch,
|
|
25
25
|
Select,
|
|
26
26
|
SelectOption,
|
|
27
|
-
} from
|
|
27
|
+
} from "ant-design-vue";
|
|
28
28
|
|
|
29
29
|
const ProFormItem = defineComponent({
|
|
30
30
|
props: {
|
|
@@ -45,10 +45,10 @@ const ProFormItem = defineComponent({
|
|
|
45
45
|
// 表单类型
|
|
46
46
|
const type = computed(() => paramDefine.value.type);
|
|
47
47
|
// 是否是开关表单
|
|
48
|
-
const isSwitch = computed(() => type.value ===
|
|
48
|
+
const isSwitch = computed(() => type.value === "boolean");
|
|
49
49
|
|
|
50
50
|
/* 是否修改状态 */
|
|
51
|
-
const isEdit = inject<Ref<boolean>>(
|
|
51
|
+
const isEdit = inject<Ref<boolean>>("isEdit")!;
|
|
52
52
|
|
|
53
53
|
/* ===== 输入框值 ===== */
|
|
54
54
|
const inputValue = ref();
|
|
@@ -59,12 +59,12 @@ const ProFormItem = defineComponent({
|
|
|
59
59
|
const value = props.description.paramDefineValue.value;
|
|
60
60
|
// boolean类型 true/false是字符串 所以需要单独判断
|
|
61
61
|
inputValue.value = isSwitch.value
|
|
62
|
-
? value ===
|
|
62
|
+
? value === "false"
|
|
63
63
|
? false
|
|
64
64
|
: true
|
|
65
65
|
: value;
|
|
66
66
|
},
|
|
67
|
-
{ deep: true, immediate: true }
|
|
67
|
+
{ deep: true, immediate: true }
|
|
68
68
|
);
|
|
69
69
|
// 输入框变化回调
|
|
70
70
|
const handleValueChange = (e: any) => {
|
|
@@ -80,14 +80,14 @@ const ProFormItem = defineComponent({
|
|
|
80
80
|
/* ==== 根据类型 返回不同的表单项 ===== */
|
|
81
81
|
let Filed: any = null;
|
|
82
82
|
switch (type.value) {
|
|
83
|
-
case
|
|
84
|
-
case
|
|
83
|
+
case "float":
|
|
84
|
+
case "int":
|
|
85
85
|
Filed = InputNumber;
|
|
86
86
|
break;
|
|
87
|
-
case
|
|
87
|
+
case "boolean":
|
|
88
88
|
Filed = Switch;
|
|
89
89
|
break;
|
|
90
|
-
case
|
|
90
|
+
case "select":
|
|
91
91
|
Filed = Select;
|
|
92
92
|
break;
|
|
93
93
|
|
|
@@ -102,7 +102,7 @@ const ProFormItem = defineComponent({
|
|
|
102
102
|
// 最大值
|
|
103
103
|
if (paramDefine.value.maxValue !== null) {
|
|
104
104
|
res.push({
|
|
105
|
-
type:
|
|
105
|
+
type: "number",
|
|
106
106
|
max: paramDefine.value.maxValue,
|
|
107
107
|
message: `最大值为${paramDefine.value.maxValue}`,
|
|
108
108
|
});
|
|
@@ -110,7 +110,7 @@ const ProFormItem = defineComponent({
|
|
|
110
110
|
// 最小值
|
|
111
111
|
if (paramDefine.value.minValue !== null) {
|
|
112
112
|
res.push({
|
|
113
|
-
type:
|
|
113
|
+
type: "number",
|
|
114
114
|
min: paramDefine.value.minValue,
|
|
115
115
|
message: `最小值为${paramDefine.value.minValue}`,
|
|
116
116
|
});
|
|
@@ -139,7 +139,7 @@ const ProFormItem = defineComponent({
|
|
|
139
139
|
|
|
140
140
|
// 单位
|
|
141
141
|
if (paramDefine.value.unit) {
|
|
142
|
-
res[
|
|
142
|
+
res["addon-after"] = paramDefine.value.unit;
|
|
143
143
|
}
|
|
144
144
|
// 是否可修改
|
|
145
145
|
if (!paramDefine.value.writeable || !isEdit.value) {
|
|
@@ -160,8 +160,8 @@ const ProFormItem = defineComponent({
|
|
|
160
160
|
// console.log(isSwitch.value);
|
|
161
161
|
|
|
162
162
|
const vModel = isSwitch.value
|
|
163
|
-
? [inputValue.value,
|
|
164
|
-
: [inputValue.value,
|
|
163
|
+
? [inputValue.value, "checked"]
|
|
164
|
+
: [inputValue.value, "value"];
|
|
165
165
|
return (
|
|
166
166
|
<FormItem
|
|
167
167
|
name={paramDefine.value.code}
|
|
@@ -170,11 +170,11 @@ const ProFormItem = defineComponent({
|
|
|
170
170
|
rules={rules.value}
|
|
171
171
|
>
|
|
172
172
|
<Filed
|
|
173
|
-
style={{ width: isSwitch.value ?
|
|
173
|
+
style={{ width: isSwitch.value ? "" : "100%" }}
|
|
174
174
|
{...inputProps.value}
|
|
175
175
|
onChange={handleValueChange}
|
|
176
176
|
>
|
|
177
|
-
<SelectOption key=
|
|
177
|
+
<SelectOption key="你好">你好</SelectOption>
|
|
178
178
|
</Filed>
|
|
179
179
|
</FormItem>
|
|
180
180
|
);
|