Commit 32eb7245 authored by TZW's avatar TZW

12121733

parent 97b50a3a
export default [ export default [
{ {
"path": "/welcome", "path": "/welcome",
"name": "欢迎", "name": "欢迎",
"icon": "smile", "icon": "smile",
"component": "./Welcome" "component": "./Welcome"
}, },
{ {
"name": "基础设置", "name": "基础设置",
"icon": "setting", "icon": "setting",
"path": "/setting", "path": "/setting",
"routes": [ "routes": [
{ {
"name": "用户管理", "name": "用户管理",
"path": "/setting/users", "path": "/setting/users",
"component": "./setting/users" "component": "./setting/users"
}, },
{ {
"name": "角色管理", "name": "角色管理",
"path": "/setting/role", "path": "/setting/role",
"component": "./setting/role" "component": "./setting/role"
}, },
{ {
"name": "组织管理", "name": "组织管理",
"path": "/setting/organization", "path": "/setting/organization",
"component": "./setting/organization" "component": "./setting/organization"
}, },
{ {
"name": "工厂管理", "name": "工厂管理",
"path": "/setting/factory", "path": "/setting/factory",
"component": "./setting/factory" "component": "./setting/factory"
}, },
{ {
"name": "车间管理", "name": "车间管理",
"path": "/setting/workshop", "path": "/setting/workshop",
"component": "./setting/workshop" "component": "./setting/workshop"
}, },
{ {
"name": "工段管理", "name": "工段管理",
"path": "/setting/section", "path": "/setting/section",
"component": "./setting/section" "component": "./setting/section"
}, },
{ {
"name": "产线管理", "name": "产线管理",
"path": "/setting/production", "path": "/setting/production",
"component": "./setting/production" "component": "./setting/production"
} }
] ]
}, },
{ {
"name": "设备管理", "name": "设备管理",
"icon": "bulb", "icon": "bulb",
"path": "/device", "path": "/device",
"routes": [ "routes": [
{ {
"name": "设备台账", "name": "设备台账",
"path": "/device/account", "path": "/device/account",
"component": "./device/account" "component": "./device/account"
}, },
{ {
"name": "设备类型", "name": "设备类型",
"path": "/device/type", "path": "/device/type",
"component": "./device/type" "component": "./device/type"
}, },
{ {
"name": "设备型号", "name": "设备型号",
"path": "/device/model", "path": "/device/model",
"component": "./device/model" "component": "./device/model"
}, },
{ {
"name": "设备供应商", "name": "设备供应商",
"path": "/device/supplier", "path": "/device/supplier",
"component": "./device/supplier" "component": "./device/supplier"
} }
] ]
}, },
{ {
"name": "维修管理", "name": "维修管理",
"path": "/repair", "path": "/repair",
"icon": "tool", "icon": "tool",
"routes": [ "routes": [
{ {
"name": "接单平台", "name": "接单平台",
"path": "/repair/platform", "path": "/repair/platform",
"icon": "", "icon": "",
"component": "./repair/platform" "component": "./repair/platform"
}, },
{ {
"name": "故障报修", "name": "故障报修",
"path": "/repair/failure", "path": "/repair/failure",
"icon": "", "icon": "",
"component": "./repair/failure" "component": "./repair/failure"
}, },
{ {
"name": "维修工单", "name": "维修工单",
"path": "/repair/order", "path": "/repair/order",
"icon": "", "icon": "",
"component": "./repair/order" "component": "./repair/order"
}, },
{ {
"name": "追踪工单", "name": "追踪工单",
"path": "/repair/track", "path": "/repair/track",
"icon": "", "icon": "",
"component": "./repair/track" "component": "./repair/track"
}, },
{ {
"name": "外协工单", "name": "外协工单",
"path": "/repair/outsourcing", "path": "/repair/outsourcing",
"icon": "", "icon": "",
"component": "./repair/outsourcing" "component": "./repair/outsourcing"
}, },
{ {
"name": "故障设置", "name": "故障设置",
"path": "/repair/fault", "path": "/repair/fault",
"icon": "", "icon": "",
"component": "./repair/fault" "component": "./repair/fault"
} }
] ]
}, },
{ {
"name": "系统管理", "name": "系统管理",
"path": "/system", "path": "/system",
"icon": "desktop", "icon": "desktop",
"routes": [ "routes": [
{ {
"name": "数据字典", "name": "数据字典",
"path": "/system/dictionary", "path": "/system/dictionary",
"icon": "", "icon": "",
"component": "./system/dictionary" "component": "./system/dictionary"
}, },
{ {
"name": "扩展字段", "name": "扩展字段",
"path": "/system/field", "path": "/system/field",
"icon": "", "icon": "",
"component": "./system/field" "component": "./system/field"
}, },
{ {
"name": "编号规则", "name": "编号规则",
"path": "/system/rules", "path": "/system/rules",
"icon": "", "icon": "",
"component": "./system/rules" "component": "./system/rules"
} },
] {
} "name": "推送配置",
]; "path": "/system/pushsetting",
"icon": "",
"component": "./system/pushsetting"
}
]
}
];
\ No newline at end of file
function getcolumns(setdrawer) {
return {
"columns": [
{
"title": "推送场景",
"dataIndex": "businessMsgSceneId",
"key": "businessMsgSceneId"
},
{
"title": "推送方式",
"dataIndex": "sendMethodType",
"key": "sendMethodType"
},
{
"title": "适用类型",
"dataIndex": "fitField",
"key": "fitField",
"valueType": "select",
"mode": "radio",
"options": [
{
"label": "全部",
"value": "1"
},
{
"label": "公司",
"value": "2"
},
{
"label": "部门",
"value": "3"
},
{
"label": "工厂",
"value": "4"
},
{
"label": "车间",
"value": "5"
},
{
"label": "工段",
"value": "6"
},
{
"label": "产线",
"value": "7"
}
]
},
{
"title": "适用选择",
"dataIndex": "fieldId",
"key": "fieldId"
},
{
"title": "推送标题",
"dataIndex": "sendTitle",
"key": "sendTitle"
},
{
"title": "推送内容",
"dataIndex": "sendContent",
"key": "sendContent"
}
],
"pathconfig": {
"enableadd": false,
"enableedit": false,
"enabledelete": false,
"enabledetail": false,
"add": "",
"edit": "",
"list": "/repair/umRepairOrder/queryRepairOrderList",
"delete": "",
"detail": ""
}
};
}
export default getcolumns;
\ No newline at end of file
import * as React from 'react';
import { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton';
import getcolumns from './columns';
import { useRequest } from 'ahooks';
import { doFetch } from '@/utils/doFetch';
function Pushsetting(props) {
const actionRef = useRef(),
formRef = useRef();
const [drawer, setdrawer] = useState({
open: false,
});
const pathconfig = useMemo(() => {
let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
return pathconf;
}, []);
const { run, loading } = useRequest(doFetch, {
manual: true,
onSuccess: (res, params) => {
if (res?.code == '0000') {
actionRef?.current?.reload();
setdrawer((s) => ({
...s,
open: false,
}));
}
},
});
const detail = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
type: 'link',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '详情',
val: 'detail',
title: '详细信息',
}));
},
}}
>
详情
</PremButton>
);
};
const edit = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '编辑',
val: 'edit',
}));
},
}}
>
编辑
</PremButton>
);
};
const remove = (text, row, _, action) => {
return (
<PremButton
pop={{
title: '是否删除?',
okText: '确认',
cancelText: '取消',
onConfirm: () => {
run({ url: pathconfig?.delete || '/delete', params: { id: row?.id } });
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
删除
</PremButton>
);
};
const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer)?.columns;
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
pathconfig?.enabledetail && detail(text, row, _, action),
pathconfig?.enableedit && edit(text, row, _, action),
pathconfig?.enabledelete && remove(text, row, _, action),
],
});
}, []);
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle="推送配置"
columns={columns}
actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
pageextra={pathconfig?.enableadd ? 'add' : null}
resizeable={true}
addconfig={{
// access: 'sysDepartment_save',
btn: {
disabled: false,
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: null,
title: '新增',
val: 'add',
}));
},
},
}}
/>
<DrawerPro
fields={columns}
params={{ id: drawer?.item?.id }}
formRef={formRef}
placement="right"
detailpath={pathconfig?.detail || null}
detailData={drawer?.item}
defaultFormValue={drawer?.item}
onClose={() => {
setdrawer((s) => ({
...s,
open: false,
}));
}}
{...drawer}
onFinish={(vals) => {
if (drawer?.val == 'add') {
run({ url: pathconfig?.add || '/add', params: { ...vals } });
} else if (drawer?.val == 'edit') {
run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
}
}}
/>
</div>
);
}
export default Pushsetting;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment