feat(DeviceSn): 添加设备组件并更新本地接口地址

This commit is contained in:
2026-07-30 17:13:38 +08:00
parent 1ff46bc33b
commit 742b32490f
22 changed files with 3767 additions and 2 deletions

View File

@@ -0,0 +1,182 @@
import DeviceAPI from "@/api/system/device";
import RoleAPI from "@/api/system/role";
import type { DeviceQueryParams, DeviceItem } from "@/api/system/device/types";
import type { IContentConfig } from "@/components/DeviceSn/types";
const contentConfig: IContentConfig<DeviceQueryParams, DeviceItem> = {
permPrefix: "sys:user", // 不写不进行按钮权限校验
table: {
border: true,
highlightCurrentRow: true,
},
pagination: {
background: true,
layout: "prev,pager,next,jumper,total,sizes",
pageSize: 20,
pageSizes: [10, 20, 30, 50],
},
indexAction(params) {
return DeviceAPI.getPage(params);
},
deleteAction: DeviceAPI.deleteByIds,
importAction(file) {
return DeviceAPI.import(file);
},
exportAction: DeviceAPI.export,
importTemplate: DeviceAPI.downloadTemplate,
importsAction(data) {
// 模拟导入数据
console.warn("importsAction", data);
return Promise.resolve();
},
async exportsAction(params) {
// 模拟获取到的是全量数据
const data = await DeviceAPI.getPage(params);
console.warn("exportsAction", data.list);
return data.list;
},
pk: "id",
toolbar: [
"add",
"delete",
"import",
"export",
{
name: "custom1",
text: "自定义1",
perm: "add",
attrs: { icon: "plus", color: "#626AEF" },
},
],
defaultToolbar: ["refresh", "filter", "imports", "exports", "search"],
cols: [
{ type: "selection", width: 50, align: "center" },
{ label: "编号", align: "center", prop: "id", width: 100, show: false },
{
label: "SN",
align: "center",
prop: "serialno",
templet: "custom",
slotName: "serialno",
width: 150,
},
{ label: "设备型号", align: "center", prop: "snModel", width: 200 },
{ label: "设备昵称", align: "center", prop: "snName", width: 200 },
{ label: "推送ID", align: "center", prop: "pushId", width: 200 },
// { label: "设备 IMEI", align: "center", prop: "snImei", width: 200 },
// { label: "设备版本号", align: "center", prop: "snDispalyId", width: 400 },
// { label: "头像", align: "center", prop: "avatar", templet: "image" },
// {
// label: "性别",
// align: "center",
// prop: "gender",
// width: 100,
// templet: "custom",
// slotName: "gender",
// },
// { label: "部门", align: "center", prop: "deptName", width: 120 },
// {
// label: "角色",
// align: "center",
// prop: "roleNames",
// width: 120,
// columnKey: "roleIds",
// filters: [],
// filterMultiple: true,
// filterJoin: ",",
// async initFn(colItem) {
// const roleOptions = await RoleAPI.getOptions();
// colItem.filters = roleOptions.map((item) => {
// return { text: item.label, value: item.value };
// });
// },
// },
{
label: "手机号码",
align: "center",
prop: "snMobile",
templet: "custom",
slotName: "mobile",
width: 150,
},
{
label: "状态",
align: "center",
prop: "status",
templet: "custom",
slotName: "status",
width: 120,
},
{ label: "创建时间", align: "center", prop: "createTime", width: 180 },
{ label: "激活时间", align: "center", prop: "activateTime", width: 180 },
{
label: "操作",
align: "center",
fixed: "right",
width: 280,
templet: "tool",
operat: [
{
name: "detail",
text: "详情",
attrs: { icon: "Document", type: "primary" },
},
// {
// name: "reset_pwd",
// text: "重置密码",
// // perm: "password-reset",
// attrs: {
// icon: "refresh-left",
// // color: "#626AEF", // 使用 text 属性,颜色不生效
// style: {
// "--el-button-text-color": "#626AEF",
// "--el-button-hover-link-text-color": "#9197f4",
// },
// },
// },
"edit",
"delete",
{
name: "more", // 主按钮名称
text: "更多", // 显示文本
attrs: { icon: "more", type: "primary" }, // 图标
// children 数组定义下拉菜单项
children: [
{
name: "refresh",
text: "刷新",
attrs: { icon: "Refresh" },
},
{
name: "screenshot",
text: "截图",
attrs: { icon: "FullScreen" },
},
{
name: "locate",
text: "定位",
attrs: { icon: "Position" },
},
{
name: "shutdown",
text: "关机",
attrs: { icon: "SwitchButton" },
},
{
name: "reboot",
text: "重启",
attrs: { icon: "SwitchButton" },
},
{
name: "refactory",
text: "重置",
attrs: { icon: "RefreshLeft" },
},
],
},
],
},
],
};
export default contentConfig;