mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 21:49:19 +08:00
fix: 修复前端若干类型报错
This commit is contained in:
@@ -51,6 +51,7 @@ const statusOptions = [
|
||||
];
|
||||
|
||||
// 搜索表单配置
|
||||
const gridReloadRef = ref<(() => void) | null>(null);
|
||||
const formOptions = computed(() => ({
|
||||
schemas: [
|
||||
{
|
||||
@@ -59,7 +60,7 @@ const formOptions = computed(() => ({
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入登录账号(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -68,7 +69,7 @@ const formOptions = computed(() => ({
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入真实姓名(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -77,7 +78,7 @@ const formOptions = computed(() => ({
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入手机号(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -87,7 +88,7 @@ const formOptions = computed(() => ({
|
||||
componentProps: {
|
||||
options: statusOptions,
|
||||
placeholder: '请选择状态',
|
||||
onChange: () => gridApi?.reload(),
|
||||
onChange: () => gridReloadRef.value?.(),
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -232,6 +233,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
showSearchForm: true,
|
||||
tableTitle: '超级账户管理',
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
|
||||
// 计算属性
|
||||
const hasSelected = computed(() => {
|
||||
|
||||
+12
-4
@@ -127,7 +127,7 @@ function findDepartmentPathById(
|
||||
options: DepartmentCascaderOption[],
|
||||
departmentId: number,
|
||||
currentPath: number[] = [],
|
||||
): number[] | null {
|
||||
): null | number[] {
|
||||
for (const option of options) {
|
||||
const nextPath = [...currentPath, option.value];
|
||||
if (option.value === departmentId) return nextPath;
|
||||
@@ -207,7 +207,9 @@ function handleDepartmentChange(value: number[]) {
|
||||
if (
|
||||
previousDepartmentId !== selectedDepartmentId &&
|
||||
formData.value.positionId &&
|
||||
!positionOptions.value.some((item) => item.value === formData.value.positionId)
|
||||
!positionOptions.value.some(
|
||||
(item) => item.value === formData.value.positionId,
|
||||
)
|
||||
) {
|
||||
formData.value.positionId = undefined;
|
||||
}
|
||||
@@ -279,7 +281,9 @@ watch(
|
||||
() => {
|
||||
if (
|
||||
formData.value.positionId &&
|
||||
!positionOptions.value.some((item) => item.value === formData.value.positionId)
|
||||
!positionOptions.value.some(
|
||||
(item) => item.value === formData.value.positionId,
|
||||
)
|
||||
) {
|
||||
formData.value.positionId = undefined;
|
||||
}
|
||||
@@ -345,7 +349,11 @@ defineExpose({
|
||||
:options="departmentTreeOptions"
|
||||
:loading="departmentOptionsLoading"
|
||||
placeholder="请选择所属部门"
|
||||
:field-names="{ label: 'label', value: 'value', children: 'children' }"
|
||||
:field-names="{
|
||||
label: 'label',
|
||||
value: 'value',
|
||||
children: 'children',
|
||||
}"
|
||||
change-on-select
|
||||
class="w-full"
|
||||
@change="(value) => handleDepartmentChange((value || []) as number[])"
|
||||
|
||||
@@ -48,6 +48,7 @@ const statusOptions = [
|
||||
];
|
||||
|
||||
// 搜索表单配置
|
||||
const gridReloadRef = ref<(() => void) | null>(null);
|
||||
const formOptions = computed(() => ({
|
||||
schemas: [
|
||||
{
|
||||
@@ -56,7 +57,7 @@ const formOptions = computed(() => ({
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入登录账号(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -65,7 +66,7 @@ const formOptions = computed(() => ({
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入真实姓名(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -74,7 +75,7 @@ const formOptions = computed(() => ({
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入手机号(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -84,7 +85,7 @@ const formOptions = computed(() => ({
|
||||
componentProps: {
|
||||
options: statusOptions,
|
||||
placeholder: '请选择状态',
|
||||
onChange: () => gridApi?.reload(),
|
||||
onChange: () => gridReloadRef.value?.(),
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -229,6 +230,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
showSearchForm: true,
|
||||
tableTitle: '账户管理',
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
|
||||
// 计算属性
|
||||
const hasSelected = computed(() => {
|
||||
|
||||
+12
-3
@@ -416,15 +416,24 @@ onUnmounted(() => {
|
||||
name="ownerName"
|
||||
:rules="[{ required: true, message: '请输入公司拥有者姓名' }]"
|
||||
>
|
||||
<Input v-model:value="formData.ownerName" placeholder="请输入公司拥有者姓名" />
|
||||
<Input
|
||||
v-model:value="formData.ownerName"
|
||||
placeholder="请输入公司拥有者姓名"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label="拥有者电话"
|
||||
name="ownerPhone"
|
||||
:rules="[{ required: true, message: '请输入公司拥有者电话' }, { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码' }]"
|
||||
:rules="[
|
||||
{ required: true, message: '请输入公司拥有者电话' },
|
||||
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码' },
|
||||
]"
|
||||
>
|
||||
<Input v-model:value="formData.ownerPhone" placeholder="请输入公司拥有者电话" />
|
||||
<Input
|
||||
v-model:value="formData.ownerPhone"
|
||||
placeholder="请输入公司拥有者电话"
|
||||
/>
|
||||
</Form.Item>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -195,13 +195,15 @@ const gridOptions: VxeGridProps<any> = {
|
||||
};
|
||||
|
||||
// 搜索表单配置
|
||||
const gridReloadRef = ref<(() => void) | null>(null);
|
||||
|
||||
const formOptions = computed(() => ({
|
||||
schema: [
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入公司名称(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'name',
|
||||
label: '公司名称',
|
||||
@@ -210,7 +212,7 @@ const formOptions = computed(() => ({
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入拥有者姓名(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'ownerName',
|
||||
label: '拥有者姓名',
|
||||
@@ -219,7 +221,7 @@ const formOptions = computed(() => ({
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入拥有者电话(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'ownerPhone',
|
||||
label: '拥有者电话',
|
||||
@@ -228,7 +230,7 @@ const formOptions = computed(() => ({
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入邮箱(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'email',
|
||||
label: '邮箱',
|
||||
@@ -239,7 +241,7 @@ const formOptions = computed(() => ({
|
||||
placeholder: '请选择状态',
|
||||
options: statusOptions,
|
||||
allowClear: true,
|
||||
onChange: () => gridApi?.reload(),
|
||||
onChange: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
@@ -253,7 +255,7 @@ const formOptions = computed(() => ({
|
||||
{ label: '正常', value: 'false' },
|
||||
],
|
||||
allowClear: true,
|
||||
onChange: () => gridApi?.reload(),
|
||||
onChange: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'expired',
|
||||
label: '过期状态',
|
||||
@@ -315,6 +317,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
showSearchForm: true,
|
||||
tableTitle: '公司管理',
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -383,7 +386,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
<Button size="small" type="primary" @click="handleMenuManage(row)">
|
||||
菜单
|
||||
</Button>
|
||||
<Button size="small" type="primary" ghost @click="handlePermissionManage(row)">
|
||||
<Button
|
||||
size="small"
|
||||
type="primary"
|
||||
ghost
|
||||
@click="handlePermissionManage(row)"
|
||||
>
|
||||
权限
|
||||
</Button>
|
||||
<Popconfirm
|
||||
|
||||
@@ -202,13 +202,15 @@ function findParentDepartment(
|
||||
}
|
||||
|
||||
// 搜索表单配置
|
||||
const gridReloadRef = ref<(() => void) | null>(null);
|
||||
|
||||
const formOptions = computed(() => ({
|
||||
schema: [
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入部门名称(回车搜索)',
|
||||
onPressEnter: () => gridApi?.reload(),
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'name',
|
||||
label: '部门名称',
|
||||
@@ -219,7 +221,7 @@ const formOptions = computed(() => ({
|
||||
placeholder: '请选择父部门',
|
||||
options: parentDepartmentOptions,
|
||||
allowClear: true,
|
||||
onChange: () => gridApi?.reload(),
|
||||
onChange: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'parentId',
|
||||
label: '父部门',
|
||||
@@ -230,7 +232,7 @@ const formOptions = computed(() => ({
|
||||
placeholder: '请选择状态',
|
||||
options: statusOptions,
|
||||
allowClear: true,
|
||||
onChange: () => gridApi?.reload(),
|
||||
onChange: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
@@ -282,6 +284,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
showSearchForm: true,
|
||||
tableTitle: '部门管理',
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
+18
-6
@@ -18,12 +18,12 @@ import {
|
||||
Tag,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { getPositionPageApi } from '#/api/organization/position';
|
||||
import {
|
||||
batchUpdatePositionPermissionsApi,
|
||||
getAllPermissionsApi,
|
||||
getPositionPermissionIdsApi,
|
||||
} from '#/api/organization/position-permission-assign/apis';
|
||||
import { getPositionPageApi } from '#/api/organization/position';
|
||||
|
||||
defineOptions({
|
||||
name: 'PositionPermissionAssignPage',
|
||||
@@ -338,8 +338,8 @@ onMounted(() => {
|
||||
? 'text-[var(--warning)]'
|
||||
: 'text-[var(--success)]'
|
||||
"
|
||||
>{{ stats.selected }}</span
|
||||
>
|
||||
>{{ stats.selected }}
|
||||
</span>
|
||||
</span>
|
||||
<span v-if="stats.changed" class="text-[var(--warning)]">
|
||||
(有未保存的更改)
|
||||
@@ -357,10 +357,22 @@ onMounted(() => {
|
||||
class="rounded border p-3"
|
||||
>
|
||||
<div class="mb-2 text-sm font-semibold">
|
||||
{{ type === 'api' ? '接口权限' : type === 'button' ? '按钮权限' : type === 'data' ? '数据权限' : '其他权限' }}
|
||||
<Tag class="ml-2" color="blue">{{ permissions.length }}</Tag>
|
||||
{{
|
||||
type === 'api'
|
||||
? '接口权限'
|
||||
: type === 'button'
|
||||
? '按钮权限'
|
||||
: type === 'data'
|
||||
? '数据权限'
|
||||
: '其他权限'
|
||||
}}
|
||||
<Tag class="ml-2" color="blue">
|
||||
{{ permissions.length }}
|
||||
</Tag>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-2 lg:grid-cols-3 xl:grid-cols-4">
|
||||
<div
|
||||
class="grid grid-cols-2 gap-2 lg:grid-cols-3 xl:grid-cols-4"
|
||||
>
|
||||
<div
|
||||
v-for="perm in permissions"
|
||||
:key="perm.id"
|
||||
|
||||
+1
-4
@@ -229,10 +229,7 @@ async function savePositionPermissions() {
|
||||
try {
|
||||
// 确保提交时包含必要的父菜单ID
|
||||
const finalMenuIds = ensureParentMenuIds(checkedKeys.value);
|
||||
await batchUpdatePositionMenusApi(
|
||||
currentPosition.value.id,
|
||||
finalMenuIds,
|
||||
);
|
||||
await batchUpdatePositionMenusApi(currentPosition.value.id, finalMenuIds);
|
||||
message.success('权限配置保存成功');
|
||||
|
||||
// 重新加载权限数据
|
||||
|
||||
Reference in New Issue
Block a user