@befly-addon/admin 1.8.4 → 1.8.5
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/adminViews/403_1/index.vue +9 -10
- package/adminViews/config/dict/components/edit.vue +30 -33
- package/adminViews/config/dict/index.vue +64 -63
- package/adminViews/config/dictType/components/edit.vue +29 -32
- package/adminViews/config/dictType/index.vue +43 -43
- package/adminViews/config/system/components/edit.vue +69 -67
- package/adminViews/config/system/index.vue +44 -54
- package/adminViews/index/components/userInfo.vue +67 -77
- package/adminViews/log/email/index.vue +92 -103
- package/adminViews/log/login/index.vue +31 -45
- package/adminViews/log/operate/index.vue +44 -59
- package/adminViews/login_1/index.vue +24 -31
- package/adminViews/people/admin/components/edit.vue +57 -69
- package/adminViews/people/admin/index.vue +32 -33
- package/adminViews/permission/api/index.vue +52 -62
- package/adminViews/permission/menu/index.vue +43 -53
- package/adminViews/permission/role/components/api.vue +164 -168
- package/adminViews/permission/role/components/edit.vue +39 -44
- package/adminViews/permission/role/components/menu.vue +139 -150
- package/adminViews/permission/role/index.vue +53 -53
- package/adminViews/tsconfig.json +14 -0
- package/package.json +2 -2
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<h1 class="error-title">无权限访问</h1>
|
|
6
6
|
<p class="error-description">抱歉,您没有访问该页面的权限</p>
|
|
7
7
|
<div class="error-actions">
|
|
8
|
-
<TButton theme="primary" @click="
|
|
9
|
-
<TButton @click="
|
|
8
|
+
<TButton theme="primary" @click="goHome">返回首页</TButton>
|
|
9
|
+
<TButton @click="goBack">返回上一页</TButton>
|
|
10
10
|
</div>
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
@@ -18,14 +18,13 @@ import { Button as TButton } from "tdesign-vue-next";
|
|
|
18
18
|
|
|
19
19
|
const router = useRouter();
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
21
|
+
function goHome(): void {
|
|
22
|
+
router.push("/");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function goBack(): void {
|
|
26
|
+
router.back();
|
|
27
|
+
}
|
|
29
28
|
</script>
|
|
30
29
|
|
|
31
30
|
<style scoped lang="scss">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<PageDialog v-model="visible" :title="actionType === 'add' ? '添加字典项' : '编辑字典项'" @confirm="handleSubmit">
|
|
3
3
|
<TForm :data="$Data.formData" :rules="$Data.rules" label-width="100px" :ref="(el) => ($From.form = el)">
|
|
4
4
|
<TFormItem label="字典类型" name="typeCode">
|
|
5
5
|
<TSelect v-model="$Data.formData.typeCode" placeholder="请选择字典类型" filterable>
|
|
@@ -19,13 +19,14 @@
|
|
|
19
19
|
<TTextarea v-model="$Data.formData.remark" placeholder="请输入备注信息" :autosize="{ minRows: 3, maxRows: 6 }" />
|
|
20
20
|
</TFormItem>
|
|
21
21
|
</TForm>
|
|
22
|
-
</
|
|
22
|
+
</PageDialog>
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
25
|
<script setup lang="ts">
|
|
26
26
|
import { computed } from "vue";
|
|
27
27
|
|
|
28
|
-
import {
|
|
28
|
+
import { Form as TForm, FormItem as TFormItem, Input as TInput, Select as TSelect, Option as TOption, Textarea as TTextarea, InputNumber as TInputNumber, MessagePlugin } from "tdesign-vue-next";
|
|
29
|
+
import PageDialog from "@/components/pageDialog.vue";
|
|
29
30
|
import { $Http } from "@/plugins/http";
|
|
30
31
|
|
|
31
32
|
const props = defineProps({
|
|
@@ -64,39 +65,35 @@ const $Data = $ref({
|
|
|
64
65
|
}
|
|
65
66
|
});
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
68
|
+
async function handleSubmit(): Promise<void> {
|
|
69
|
+
try {
|
|
70
|
+
const valid = await $From.form.validate();
|
|
71
|
+
if (valid !== true) return;
|
|
72
|
+
const apiUrl = props.actionType === "add" ? "/addon/admin/dict/ins" : "/addon/admin/dict/upd";
|
|
73
|
+
const params: Record<string, unknown> = {
|
|
74
|
+
typeCode: $Data.formData.typeCode,
|
|
75
|
+
key: $Data.formData.key,
|
|
76
|
+
label: $Data.formData.label,
|
|
77
|
+
sort: $Data.formData.sort,
|
|
78
|
+
remark: $Data.formData.remark
|
|
79
|
+
};
|
|
80
|
+
if (props.actionType === "upd" && props.rowData) {
|
|
81
|
+
const row = props.rowData as Record<string, unknown>;
|
|
82
|
+
params["id"] = row["id"];
|
|
83
|
+
}
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
} catch (error) {
|
|
93
|
-
MessagePlugin.error("操作失败");
|
|
85
|
+
const res = await $Http.post(apiUrl, params);
|
|
86
|
+
if (res.code === 0) {
|
|
87
|
+
MessagePlugin.success(props.actionType === "add" ? "添加成功" : "更新成功");
|
|
88
|
+
visible.value = false;
|
|
89
|
+
$Emit("success");
|
|
90
|
+
} else {
|
|
91
|
+
MessagePlugin.error(res.msg || "操作失败");
|
|
94
92
|
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
visible.value = false;
|
|
93
|
+
} catch (error) {
|
|
94
|
+
MessagePlugin.error("操作失败");
|
|
98
95
|
}
|
|
99
|
-
}
|
|
96
|
+
}
|
|
100
97
|
|
|
101
98
|
// 该组件由父组件 v-if 控制挂载/卸载,因此无需 watch:创建时初始化一次即可
|
|
102
99
|
if (props.actionType === "upd" && props.rowData) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<PagedTableDetail class="page-dict page-table" :columns="$Data.columns" :endpoints="$Data.endpoints">
|
|
3
3
|
<template #toolLeft>
|
|
4
|
-
<TButton theme="primary" @click="
|
|
4
|
+
<TButton theme="primary" @click="onAdd">
|
|
5
5
|
<template #icon>
|
|
6
6
|
<ILucidePlus />
|
|
7
7
|
</template>
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<template #toolRight="scope">
|
|
12
|
-
<TSelect v-model="$Data.searchTypeCode" placeholder="请选择字典类型" clearable filterable @change="
|
|
12
|
+
<TSelect v-model="$Data.searchTypeCode" placeholder="请选择字典类型" clearable filterable @change="handleSearch(scope.reload)">
|
|
13
13
|
<TOption v-for="item in $Data.typeList" :key="item.code" :value="item.code" :label="item.name" />
|
|
14
14
|
</TSelect>
|
|
15
|
-
<TInput v-model="$Data.searchKeyword" placeholder="搜索键/标签" clearable @enter="
|
|
15
|
+
<TInput v-model="$Data.searchKeyword" placeholder="搜索键/标签" clearable @enter="handleSearch(scope.reload)" @clear="handleSearch(scope.reload)">
|
|
16
16
|
<template #suffix-icon>
|
|
17
17
|
<ILucideSearch />
|
|
18
18
|
</template>
|
|
19
19
|
</TInput>
|
|
20
|
-
<TButton shape="circle" @click="
|
|
20
|
+
<TButton shape="circle" @click="handleRefresh(scope.reload)">
|
|
21
21
|
<template #icon>
|
|
22
22
|
<ILucideRotateCw />
|
|
23
23
|
</template>
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
</template>
|
|
26
26
|
|
|
27
27
|
<template #operation="{ row, deleteRow }">
|
|
28
|
-
<TDropdown trigger="click" placement="bottom-right" @click="
|
|
28
|
+
<TDropdown trigger="click" placement="bottom-right" @click="onDropdownAction($event, row, deleteRow)">
|
|
29
29
|
<TButton theme="primary" size="small">
|
|
30
30
|
操作
|
|
31
31
|
<template #suffix> <ILucideChevronDown /></template>
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
</template>
|
|
45
45
|
|
|
46
46
|
<template #dialogs="scope">
|
|
47
|
-
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" :type-list="$Data.typeList" @success="
|
|
47
|
+
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" :type-list="$Data.typeList" @success="onDialogSuccess(scope.reload)" />
|
|
48
48
|
</template>
|
|
49
|
-
</
|
|
49
|
+
</PagedTableDetail>
|
|
50
50
|
</template>
|
|
51
51
|
|
|
52
52
|
<script setup lang="ts">
|
|
@@ -61,7 +61,7 @@ import ILucideTrash2 from "~icons/lucide/trash-2";
|
|
|
61
61
|
import ILucideChevronDown from "~icons/lucide/chevron-down";
|
|
62
62
|
import EditDialog from "./components/edit.vue";
|
|
63
63
|
import { $Http } from "@/plugins/http";
|
|
64
|
-
import
|
|
64
|
+
import PagedTableDetail from "@/components/pagedTableDetail.vue";
|
|
65
65
|
import { withDefaultColumns } from "befly-shared/utils/withDefaultColumns";
|
|
66
66
|
|
|
67
67
|
const $Data = $ref({
|
|
@@ -106,70 +106,71 @@ const $Data = $ref({
|
|
|
106
106
|
rowData: {}
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
},
|
|
109
|
+
function onAdd(): void {
|
|
110
|
+
onAction("add", {});
|
|
111
|
+
}
|
|
113
112
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
function onDialogSuccess(reload: (options: { keepSelection?: boolean }) => void): void {
|
|
114
|
+
reload({ keepSelection: true });
|
|
115
|
+
}
|
|
117
116
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
async apiDictTypeAll() {
|
|
122
|
-
try {
|
|
123
|
-
const res = await $Http.post(
|
|
124
|
-
"/addon/admin/dictType/all",
|
|
125
|
-
{},
|
|
126
|
-
{
|
|
127
|
-
dropValues: [""]
|
|
128
|
-
}
|
|
129
|
-
);
|
|
130
|
-
$Data.typeList = res.data.lists || [];
|
|
131
|
-
} catch (error) {
|
|
132
|
-
MessagePlugin.error("加载数据失败");
|
|
133
|
-
}
|
|
134
|
-
},
|
|
117
|
+
async function initData(): Promise<void> {
|
|
118
|
+
await apiDictTypeAll();
|
|
119
|
+
}
|
|
135
120
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
121
|
+
async function apiDictTypeAll(): Promise<void> {
|
|
122
|
+
try {
|
|
123
|
+
const res = await $Http.post(
|
|
124
|
+
"/addon/admin/dictType/all",
|
|
125
|
+
{},
|
|
126
|
+
{
|
|
127
|
+
dropValues: [""]
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
$Data.typeList = res.data.lists || [];
|
|
131
|
+
} catch (error) {
|
|
132
|
+
MessagePlugin.error("加载数据失败");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
139
135
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
reload({ keepSelection: false, resetPage: true });
|
|
144
|
-
},
|
|
136
|
+
function handleSearch(reload: (options: { keepSelection?: boolean; resetPage?: boolean }) => void): void {
|
|
137
|
+
reload({ keepSelection: false, resetPage: true });
|
|
138
|
+
}
|
|
145
139
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
140
|
+
function handleRefresh(reload: (options: { keepSelection?: boolean; resetPage?: boolean }) => void): void {
|
|
141
|
+
$Data.searchTypeCode = "";
|
|
142
|
+
$Data.searchKeyword = "";
|
|
143
|
+
reload({ keepSelection: false, resetPage: true });
|
|
144
|
+
}
|
|
153
145
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
146
|
+
function onAction(type: string, row: Record<string, unknown>): void {
|
|
147
|
+
if (type === "add") {
|
|
148
|
+
$Data.actionType = "add";
|
|
149
|
+
$Data.rowData = {};
|
|
150
|
+
$Data.editVisible = true;
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
160
153
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
154
|
+
if (type === "upd") {
|
|
155
|
+
$Data.actionType = "upd";
|
|
156
|
+
$Data.rowData = Object.assign({}, row);
|
|
157
|
+
$Data.editVisible = true;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function onDropdownAction(data: unknown, row: Record<string, unknown>, deleteRow: (r: Record<string, unknown>) => void): void {
|
|
162
|
+
const record = data as Record<string, unknown>;
|
|
163
|
+
const rawValue = record && record["value"] ? record["value"] : "";
|
|
164
|
+
const cmd = rawValue ? String(rawValue) : "";
|
|
165
|
+
if (cmd === "del") {
|
|
166
|
+
deleteRow(row);
|
|
167
|
+
return;
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
onAction(cmd, row);
|
|
170
|
+
}
|
|
170
171
|
|
|
171
172
|
onMounted(() => {
|
|
172
|
-
|
|
173
|
+
initData();
|
|
173
174
|
});
|
|
174
175
|
</script>
|
|
175
176
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<PageDialog v-model="visible" :title="actionType === 'add' ? '添加字典类型' : '编辑字典类型'" @confirm="handleSubmit">
|
|
3
3
|
<TForm :data="$Data.formData" :rules="$Data.rules" label-width="100px" :ref="(el) => ($From.form = el)">
|
|
4
4
|
<TFormItem label="类型代码" name="code">
|
|
5
5
|
<TInput v-model="$Data.formData.code" placeholder="请输入类型代码(英文/数字/下划线)" :disabled="actionType === 'upd'" />
|
|
@@ -14,13 +14,14 @@
|
|
|
14
14
|
<TInputNumber v-model="$Data.formData.sort" :min="0" placeholder="请输入排序值" />
|
|
15
15
|
</TFormItem>
|
|
16
16
|
</TForm>
|
|
17
|
-
</
|
|
17
|
+
</PageDialog>
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<script setup lang="ts">
|
|
21
21
|
import { computed } from "vue";
|
|
22
22
|
|
|
23
|
-
import {
|
|
23
|
+
import { Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, InputNumber as TInputNumber, MessagePlugin } from "tdesign-vue-next";
|
|
24
|
+
import PageDialog from "@/components/pageDialog.vue";
|
|
24
25
|
import { $Http } from "@/plugins/http";
|
|
25
26
|
|
|
26
27
|
const props = defineProps({
|
|
@@ -56,39 +57,35 @@ const $Data = $ref({
|
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (valid !== true) return;
|
|
60
|
+
async function handleSubmit(): Promise<void> {
|
|
61
|
+
const valid = await $From.form.validate();
|
|
62
|
+
if (valid !== true) return;
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
try {
|
|
65
|
+
const apiUrl = props.actionType === "add" ? "/addon/admin/dictType/ins" : "/addon/admin/dictType/upd";
|
|
66
|
+
const params: Record<string, unknown> = {
|
|
67
|
+
code: $Data.formData.code,
|
|
68
|
+
name: $Data.formData.name,
|
|
69
|
+
description: $Data.formData.description,
|
|
70
|
+
sort: $Data.formData.sort
|
|
71
|
+
};
|
|
72
|
+
if (props.actionType === "upd" && props.rowData) {
|
|
73
|
+
const row = props.rowData as Record<string, unknown>;
|
|
74
|
+
params["id"] = row["id"];
|
|
75
|
+
}
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
} catch (error) {
|
|
85
|
-
MessagePlugin.error("操作失败");
|
|
77
|
+
const res = await $Http.post(apiUrl, params);
|
|
78
|
+
if (res.code === 0) {
|
|
79
|
+
MessagePlugin.success(props.actionType === "add" ? "添加成功" : "更新成功");
|
|
80
|
+
visible.value = false;
|
|
81
|
+
$Emit("success");
|
|
82
|
+
} else {
|
|
83
|
+
MessagePlugin.error(res.msg || "操作失败");
|
|
86
84
|
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
visible.value = false;
|
|
85
|
+
} catch (error) {
|
|
86
|
+
MessagePlugin.error("操作失败");
|
|
90
87
|
}
|
|
91
|
-
}
|
|
88
|
+
}
|
|
92
89
|
|
|
93
90
|
// 该组件由父组件 v-if 控制挂载/卸载,因此无需 watch:创建时初始化一次即可
|
|
94
91
|
if (props.actionType === "upd" && props.rowData) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<PagedTableDetail class="page-dict-type page-table" :columns="$Data.columns" :endpoints="$Data.endpoints">
|
|
3
3
|
<template #toolLeft>
|
|
4
|
-
<TButton theme="primary" @click="
|
|
4
|
+
<TButton theme="primary" @click="onAdd">
|
|
5
5
|
<template #icon>
|
|
6
6
|
<ILucidePlus />
|
|
7
7
|
</template>
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<template #toolRight="scope">
|
|
12
|
-
<TInput v-model="$Data.searchKeyword" placeholder="搜索类型名称" clearable @enter="
|
|
12
|
+
<TInput v-model="$Data.searchKeyword" placeholder="搜索类型名称" clearable @enter="handleSearch(scope.reload)" @clear="handleSearch(scope.reload)">
|
|
13
13
|
<template #suffix-icon>
|
|
14
14
|
<ILucideSearch />
|
|
15
15
|
</template>
|
|
16
16
|
</TInput>
|
|
17
|
-
<TButton shape="circle" @click="
|
|
17
|
+
<TButton shape="circle" @click="handleRefresh(scope.reload)">
|
|
18
18
|
<template #icon>
|
|
19
19
|
<ILucideRotateCw />
|
|
20
20
|
</template>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
</template>
|
|
23
23
|
|
|
24
24
|
<template #operation="{ row, deleteRow }">
|
|
25
|
-
<TDropdown trigger="click" placement="bottom-right" @click="
|
|
25
|
+
<TDropdown trigger="click" placement="bottom-right" @click="onDropdownAction($event, row, deleteRow)">
|
|
26
26
|
<TButton theme="primary" size="small">
|
|
27
27
|
操作
|
|
28
28
|
<template #suffix> <ILucideChevronDown /></template>
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
</template>
|
|
42
42
|
|
|
43
43
|
<template #dialogs="scope">
|
|
44
|
-
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="
|
|
44
|
+
<EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="onDialogSuccess(scope.reload)" />
|
|
45
45
|
</template>
|
|
46
|
-
</
|
|
46
|
+
</PagedTableDetail>
|
|
47
47
|
</template>
|
|
48
48
|
|
|
49
49
|
<script setup lang="ts">
|
|
@@ -55,7 +55,7 @@ import ILucidePencil from "~icons/lucide/pencil";
|
|
|
55
55
|
import ILucideTrash2 from "~icons/lucide/trash-2";
|
|
56
56
|
import ILucideChevronDown from "~icons/lucide/chevron-down";
|
|
57
57
|
import EditDialog from "./components/edit.vue";
|
|
58
|
-
import
|
|
58
|
+
import PagedTableDetail from "@/components/pagedTableDetail.vue";
|
|
59
59
|
import { withDefaultColumns } from "befly-shared/utils/withDefaultColumns";
|
|
60
60
|
|
|
61
61
|
const $Data = $ref({
|
|
@@ -98,48 +98,48 @@ const $Data = $ref({
|
|
|
98
98
|
rowData: {}
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
},
|
|
101
|
+
function onAdd(): void {
|
|
102
|
+
onAction("add", {});
|
|
103
|
+
}
|
|
105
104
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
function onDialogSuccess(reload: (options: { keepSelection?: boolean }) => void): void {
|
|
106
|
+
reload({ keepSelection: true });
|
|
107
|
+
}
|
|
109
108
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
function handleSearch(reload: (options: { keepSelection?: boolean; resetPage?: boolean }) => void): void {
|
|
110
|
+
reload({ keepSelection: false, resetPage: true });
|
|
111
|
+
}
|
|
113
112
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
function handleRefresh(reload: (options: { keepSelection?: boolean; resetPage?: boolean }) => void): void {
|
|
114
|
+
$Data.searchKeyword = "";
|
|
115
|
+
reload({ keepSelection: false, resetPage: true });
|
|
116
|
+
}
|
|
118
117
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
function onAction(type: string, row: Record<string, unknown>): void {
|
|
119
|
+
if (type === "add") {
|
|
120
|
+
$Data.actionType = "add";
|
|
121
|
+
$Data.rowData = {};
|
|
122
|
+
$Data.editVisible = true;
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
126
125
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
126
|
+
if (type === "upd") {
|
|
127
|
+
$Data.actionType = "upd";
|
|
128
|
+
$Data.rowData = Object.assign({}, row);
|
|
129
|
+
$Data.editVisible = true;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
133
132
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
133
|
+
function onDropdownAction(data: unknown, row: Record<string, unknown>, deleteRow: (r: Record<string, unknown>) => void): void {
|
|
134
|
+
const record = data as Record<string, unknown>;
|
|
135
|
+
const rawValue = record && record["value"] ? record["value"] : "";
|
|
136
|
+
const cmd = rawValue ? String(rawValue) : "";
|
|
137
|
+
if (cmd === "del") {
|
|
138
|
+
deleteRow(row);
|
|
139
|
+
return;
|
|
141
140
|
}
|
|
142
|
-
|
|
141
|
+
onAction(cmd, row);
|
|
142
|
+
}
|
|
143
143
|
</script>
|
|
144
144
|
|
|
145
145
|
<style scoped lang="scss">
|