更改id类型为string

This commit is contained in:
2026-03-19 15:41:02 +08:00
parent bbc10ce359
commit e94204423b
14 changed files with 75 additions and 53 deletions

View File

@@ -12,7 +12,7 @@ ENV = 'development'
# 主服务地址端口8808
# 用途: 系统管理、用户认证、权限控制、模块开通等原有功能
VITE_API_URL = 'http://192.168.100.162:8808/'
VITE_API_URL = 'http://192.168.3.11:8808/'
# 新功能服务地址端口8000
# 用途: 资产管理、分类、SKU、订单等新业务模块
VITE_NEW_API_URL = 'http://192.168.100.162:8000/'
VITE_NEW_API_URL = 'http://192.168.3.11:8000/'

View File

@@ -12,11 +12,11 @@ export function getCategoryTree(query?: Object) {
}
// 获取分类详情
export function getCategory(id: number) {
export function getCategory(id: number | string) {
return newService({
url: '/assets/category/getCategory',
method: 'get',
params: { id },
params: { id: id.toString() },
});
}
@@ -56,19 +56,19 @@ export function updateCategory(data: object) {
}
// 删除分类
export function deleteCategory(id: number) {
export function deleteCategory(id: number | string) {
return newService({
url: '/assets/category/deleteCategory',
method: 'delete',
params: { id },
params: { id: id.toString() },
});
}
// 更新分类状态
export function updateCategoryStatus(id: number, status: number) {
export function updateCategoryStatus(id: number | string, status: number) {
return newService({
url: '/assets/category/updateCategoryStatus',
method: 'put',
data: { id, status },
data: { id: id.toString(), status },
});
}

View File

@@ -9,7 +9,7 @@ export function getConfigList(query:Object) {
})
}
export function getConfig(id:number) {
export function getConfig(id:string) {
return request({
url: '/api/v1/system/config/get',
method: 'get',
@@ -33,7 +33,7 @@ export function editConfig(data:any) {
})
}
export function deleteConfig(ids:number[]) {
export function deleteConfig(ids:string[]) {
return request({
url: '/api/v1/system/config/delete',
method: 'delete',

View File

@@ -9,7 +9,7 @@ export function listSysUserOnline(query:object) {
})
}
export function forceLogout(ids:number[]) {
export function forceLogout(ids:string[]) {
return request({
url: '/api/v1/system/online/forceLogout',
method: 'delete',

View File

@@ -23,7 +23,7 @@ export function addRole(data:object) {
})
}
export function getRole(id:number) {
export function getRole(id:string) {
return request({
url: '/api/v1/system/role/get',
method: 'get',
@@ -41,7 +41,7 @@ export function editRole(data:object) {
}
export function deleteRole(id:number) {
export function deleteRole(id:string) {
return request({
url: '/api/v1/system/role/delete',
method: 'delete',
@@ -59,7 +59,7 @@ export function dataScope(data:any) {
// 根据角色ID查询部门树结构
export function roleDeptTreeSelect(roleId:number) {
export function roleDeptTreeSelect(roleId:string) {
return request({
url: '/api/v1/system/role/deptTreeSelect',
method: 'get',

View File

@@ -129,7 +129,7 @@ import { getDicts } from '/@/api/system/dict/data';
import { createFormDiff } from '/@/utils/diffUtils';
interface CategoryRow {
id: number;
id: string;
name: string;
level: number;
options?: string[];
@@ -163,7 +163,7 @@ interface DictValue {
}
interface RuleForm {
id: number | '';
id: string | '';
parentId: string;
name: string;
sort: number;
@@ -324,7 +324,18 @@ const openDialog = (row?: CategoryRow | string, edit?: boolean) => {
// 获取分类树数据
getCategoryTree().then((res: any) => {
categoryData.value = res.data?.tree ?? [];
const tree = res.data?.tree ?? [];
// 递归函数将所有id字段转换为字符串
const convertIdsToString = (items: any[]): any[] => {
return items.map(item => ({
...item,
id: item.id?.toString(),
children: item.children && item.children.length > 0 ? convertIdsToString(item.children) : []
}));
};
categoryData.value = convertIdsToString(tree);
});
if (row && typeof row === 'object' && edit) {

View File

@@ -73,7 +73,7 @@ import OperationLogDialog from '../component/operationLogDialog.vue';
import { getCategoryTree, deleteCategory, updateCategoryStatus,listCategories } from '/@/api/assets/category';
interface CategoryRow {
id: number;
id: string;
name: string;
level: number;
type: string;
@@ -102,7 +102,18 @@ const getCategoryList = () => {
.then((res: any) => {
// 主类目不做展示直接取主类目的children
const tree = res.data?.tree ?? [];
tableData.data = tree.length > 0 && tree[0].children ? tree[0].children : [];
// 递归函数将所有id字段转换为字符串
const convertIdsToString = (items: any[]): any[] => {
return items.map(item => ({
...item,
id: item.id?.toString(),
children: item.children && item.children.length > 0 ? convertIdsToString(item.children) : []
}));
};
const processedTree = convertIdsToString(tree);
tableData.data = processedTree.length > 0 && processedTree[0].children ? processedTree[0].children : [];
})
.catch(() => {
tableData.data = [];

View File

@@ -111,7 +111,7 @@ import { ref, reactive, onMounted } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';
interface VideoItem {
id: number;
id: string;
name: string;
thumbnail: string;
videoType: string;
@@ -141,7 +141,7 @@ const previewVideo = ref<VideoItem | null>(null);
// 模拟数据
const mockData: VideoItem[] = [
{
id: 1,
id: '1',
name: '商务男性数字人-产品介绍',
thumbnail: 'https://picsum.photos/400/225?random=10',
videoType: 'avatar',
@@ -154,7 +154,7 @@ const mockData: VideoItem[] = [
createdAt: '2024-01-15 10:30:00',
},
{
id: 2,
id: '2',
name: '甜美女性数字人-直播带货',
thumbnail: 'https://picsum.photos/400/225?random=11',
videoType: 'avatar',
@@ -167,7 +167,7 @@ const mockData: VideoItem[] = [
createdAt: '2024-01-14 14:20:00',
},
{
id: 3,
id: '3',
name: '科技感背景-蓝色粒子',
thumbnail: 'https://picsum.photos/400/225?random=12',
videoType: 'background',
@@ -180,7 +180,7 @@ const mockData: VideoItem[] = [
createdAt: '2024-01-13 09:15:00',
},
{
id: 4,
id: '4',
name: '办公室场景背景',
thumbnail: 'https://picsum.photos/400/225?random=13',
videoType: 'background',
@@ -193,7 +193,7 @@ const mockData: VideoItem[] = [
createdAt: '2024-01-12 16:45:00',
},
{
id: 5,
id: '5',
name: '转场特效-渐变',
thumbnail: 'https://picsum.photos/400/225?random=14',
videoType: 'material',
@@ -206,7 +206,7 @@ const mockData: VideoItem[] = [
createdAt: '2024-01-11 11:00:00',
},
{
id: 6,
id: '6',
name: '知性女性数字人-新闻播报',
thumbnail: 'https://picsum.photos/400/225?random=15',
videoType: 'avatar',

View File

@@ -1,6 +1,6 @@
<template>
<div class="system-edit-dic-container">
<el-dialog :title="(ruleForm.configId!==0?'修改':'添加')+'参数'" v-model="isShowDialog" width="769px">
<el-dialog :title="(ruleForm.configId!==''?'修改':'添加')+'参数'" v-model="isShowDialog" width="769px">
<el-form :model="ruleForm" ref="formRef" :rules="rules" size="default" label-width="90px">
<el-form-item label="参数名称" prop="configName">
<el-input v-model="ruleForm.configName" placeholder="请输入参数名称" />
@@ -27,7 +27,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="onCancel" size="default"> </el-button>
<el-button type="primary" @click="onSubmit" size="default">{{ruleForm.configId!==0?'修 改':'添 加'}}</el-button>
<el-button type="primary" @click="onSubmit" size="default">{{ruleForm.configId!==''?'修 改':'添 加'}}</el-button>
</span>
</template>
</el-dialog>
@@ -39,7 +39,7 @@ import { reactive, toRefs, defineComponent,ref, unref } from 'vue';
import {ElMessage} from "element-plus";
import {addConfig, editConfig, getConfig} from "/@/api/system/config";
interface RuleFormState {
configId: number;
configId: string;
configName: string;
configKey: string;
configValue: string;
@@ -65,7 +65,7 @@ export default defineComponent({
const state = reactive<DicState>({
isShowDialog: false,
ruleForm: {
configId: 0,
configId: '',
configName: '',
configKey: '',
configValue: '',
@@ -99,7 +99,7 @@ export default defineComponent({
};
const resetForm = ()=>{
state.ruleForm = {
configId: 0,
configId: '',
configName: '',
configKey: '',
configValue: '',
@@ -121,7 +121,7 @@ export default defineComponent({
if (!formWrap) return;
formWrap.validate((valid: boolean) => {
if (valid) {
if(state.ruleForm.configId!==0){
if(state.ruleForm.configId!==''){
//修改
editConfig(state.ruleForm).then(()=>{
ElMessage.success('参数修改成功');

View File

@@ -111,7 +111,7 @@ import {deleteConfig, getConfigList} from "/@/api/system/config";
// 定义接口来定义对象的类型
interface TableDataRow {
configId: number;
configId: string;
configName: string;
configKey: string;
configValue: string,
@@ -120,7 +120,7 @@ interface TableDataRow {
createdAt: string,
}
interface TableDataState {
ids:number[];
ids:string[];
tableData: {
data: Array<TableDataRow>;
total: number;
@@ -182,9 +182,9 @@ export default defineComponent({
// 删除参数row 为空表示批量删除)
const onRowDel = (row?: TableDataRow | null) => {
let msg = '你确定要删除所选数据?';
let ids:number[] = [] ;
let ids:string[] = [] ;
if(row){
msg = `此操作将永久删除用户:${row.configName},是否继续?`
msg = `此操作将永久删除用户:"${row.configName}",是否继续?`
ids = [row.configId]
}else{
ids = state.ids

View File

@@ -70,13 +70,13 @@ import {ElMessage} from "element-plus";
// 定义接口来定义对象的类型
interface TableDataRow {
deptName: string;
id: number;
parentId:number;
id: string;
parentId:string;
children?: TableDataRow[];
}
interface RuleFormState {
deptId:number;
parentId: number;
deptId:string;
parentId: string;
deptName: string;
orderNum: number;
leader: string;

View File

@@ -63,7 +63,7 @@ import {ElMessageBox, ElMessage, FormInstance} from 'element-plus';
import { forceLogout, listSysUserOnline} from "/@/api/system/monitor/userOnline";
// 定义接口来定义对象的类型
interface TableData {
id: number;
id: string;
uuid: string;
token: string;
createTime: string;
@@ -73,7 +73,7 @@ interface TableData {
os: string;
}
interface TableDataState {
ids:number[];
ids:string[];
tableData: {
data: Array<TableData>;
total: number;
@@ -124,7 +124,7 @@ export default defineComponent({
// 删除岗位
const onRowDel = (row?: TableData | null) => {
let msg = '你确定要强制退出用户登录?';
let ids:number[] = [] ;
let ids:string[] = [] ;
if(row){
msg = `将强制用户下线,是否继续?`
ids = [row.id]

View File

@@ -1,6 +1,6 @@
<template>
<div class="system-edit-role-container">
<el-dialog :title="(formData.id === 0 ? '添加' : '修改') + '角色'" v-model="isShowDialog" width="769px">
<el-dialog :title="(formData.id === '' ? '添加' : '修改') + '角色'" v-model="isShowDialog" width="769px">
<el-form ref="formRef" :model="formData" :rules="rules" size="default" label-width="90px">
<el-row :gutter="35">
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
@@ -58,7 +58,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="onCancel" size="default"> </el-button>
<el-button type="primary" @click="onSubmit" size="default" :loading="loading">{{ formData.id === 0 ? '新 增' : '修 改' }}</el-button>
<el-button type="primary" @click="onSubmit" size="default" :loading="loading">{{ formData.id === '' ? '新 增' : '修 改' }}</el-button>
</span>
</template>
</el-dialog>
@@ -73,18 +73,18 @@ import { refreshBackEndControlRoutes } from '/@/router/backEnd';
// 定义接口来定义对象的类型
interface MenuDataTree {
id: number;
pid: number;
id: string;
pid: string;
title: string;
children?: MenuDataTree[];
}
interface DialogRow {
id: number;
id: string;
name: string;
status: number;
listOrder: number;
remark: string;
menuIds: Array<number>;
menuIds: Array<string>;
}
interface RoleState {
loading: boolean;
@@ -111,7 +111,7 @@ export default defineComponent({
loading: false,
isShowDialog: false,
formData: {
id: 0,
id: '',
name: '',
status: 1,
listOrder: 0,
@@ -161,7 +161,7 @@ export default defineComponent({
if (valid) {
state.loading = true;
state.formData.menuIds = getMenuAllCheckedKeys();
if (state.formData.id === 0) {
if (state.formData.id === '') {
//添加
addRole(state.formData)
.then(() => {
@@ -200,7 +200,7 @@ export default defineComponent({
state.menuExpand = false;
state.menuNodeAll = false;
state.formData = {
id: 0,
id: '',
name: '',
status: 1,
listOrder: 0,

View File

@@ -70,7 +70,7 @@ import EditRole from '/@/views/system/role/component/editRole.vue';
import { deleteRole, getRoleList } from '/@/api/system/role';
// 定义接口来定义对象的类型
interface TableData {
id: number;
id: string;
status: number;
listOrder: number;
name: string;