Commit fd65ec2a authored by TZW's avatar TZW

11.10

parent 7219878d
...@@ -43,13 +43,30 @@ export default [ ...@@ -43,13 +43,30 @@ export default [
], ],
}, },
{ {
name: "设备管理", name: '设备管理',
icon: 'BulbOutlined', icon: 'bulb',
path: '/device', path: '/device',
routes: [{ routes: [
{
name: '设备台账', name: '设备台账',
path: '/setting/account', path: '/device/account',
component: './setting/account', component: './device/account',
}] },
} {
name: '设备类型',
path: '/device/type',
component: './device/type',
},
{
name: '设备型号',
path: '/device/model',
component: './device/model',
},
{
name: '设备供应商',
path: '/device/supplier',
component: './device/supplier',
},
],
},
]; ];
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
changeOrigin: true, changeOrigin: true,
}, },
'/staticfile/': { '/staticfile/': {
target: 'http://192.168.40.2/', target: 'http://192.168.40.68:9088/',
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/staticfile': '', '^/staticfile': '',
......
...@@ -38,7 +38,7 @@ import EditTable from './EditTable'; ...@@ -38,7 +38,7 @@ import EditTable from './EditTable';
import EditorItem from './EditorItem'; import EditorItem from './EditorItem';
import defaultSetting from '../../../config/defaultSettings'; import defaultSetting from '../../../config/defaultSettings';
const { Image, Form, Upload, Col, Pagination, Avatar, Dropdown, Menu, Tabs } = Antd; const { Image, Form, Upload, Col, Pagination, Avatar, Dropdown, Menu, Tabs, message } = Antd;
const AntdCheckBox = Antd.Checkbox; const AntdCheckBox = Antd.Checkbox;
const FormItems = { const FormItems = {
...@@ -75,7 +75,6 @@ const FormItems = { ...@@ -75,7 +75,6 @@ const FormItems = {
CheckboxItem, CheckboxItem,
RadioItem, RadioItem,
}; };
function upperCase(str) { function upperCase(str) {
const newStr = str.slice(0, 1).toUpperCase() + str.slice(1); const newStr = str.slice(0, 1).toUpperCase() + str.slice(1);
return newStr; return newStr;
...@@ -468,7 +467,6 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) { ...@@ -468,7 +467,6 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) {
label={item.title} label={item.title}
placeholder={`请选择${item.title}`} placeholder={`请选择${item.title}`}
params={params} params={params}
mode={item?.mode}
request={async (parse) => { request={async (parse) => {
let result = {}; let result = {};
for (let key in curlinkparams) { for (let key in curlinkparams) {
...@@ -528,7 +526,6 @@ function NolinkSelect({ item, colProps }) { ...@@ -528,7 +526,6 @@ function NolinkSelect({ item, colProps }) {
label={item.title} label={item.title}
placeholder={`请选择${item.title}`} placeholder={`请选择${item.title}`}
showSearch showSearch
mode={item?.mode}
{...options} {...options}
/> />
</> </>
...@@ -560,7 +557,6 @@ function LinkTreeSelect({ item, colProps, formRef, name, curindex }) { ...@@ -560,7 +557,6 @@ function LinkTreeSelect({ item, colProps, formRef, name, curindex }) {
...item?.fieldProps, ...item?.fieldProps,
fieldNames: { label: 'title', value: 'key', children: 'children' }, fieldNames: { label: 'title', value: 'key', children: 'children' },
showSearch: false, showSearch: false,
multiple: item?.mode === 'multiple',
}} }}
formItemProps={item.formItemProps} formItemProps={item.formItemProps}
name={curkey} name={curkey}
...@@ -628,14 +624,12 @@ function NolinkTreeSelect({ item, colProps }) { ...@@ -628,14 +624,12 @@ function NolinkTreeSelect({ item, colProps }) {
...item?.fieldProps, ...item?.fieldProps,
fieldNames: { label: 'title', value: 'key', children: 'children' }, fieldNames: { label: 'title', value: 'key', children: 'children' },
showSearch: true, showSearch: true,
multiple: item?.mode === 'multiple',
}} }}
formItemProps={item.formItemProps} formItemProps={item.formItemProps}
name={item.key ?? item.dataIndex} name={item.key ?? item.dataIndex}
colProps={item.colProps ?? colProps} colProps={item.colProps ?? colProps}
label={item.title} label={item.title}
placeholder={`请选择${item.title}`} placeholder={`请选择${item.title}`}
multiple
{...options} {...options}
/> />
</> </>
...@@ -876,8 +870,7 @@ function LinkCascader({ item, colProps, formRef, name, curindex }) { ...@@ -876,8 +870,7 @@ function LinkCascader({ item, colProps, formRef, name, curindex }) {
fieldProps={{ fieldProps={{
...item?.fieldProps, ...item?.fieldProps,
fieldNames: { label: 'title', value: 'key', children: 'children' }, fieldNames: { label: 'title', value: 'key', children: 'children' },
showSearch: true, showSearch: false,
multiple: item?.mode === 'multiple',
}} }}
formItemProps={item.formItemProps} formItemProps={item.formItemProps}
name={curkey} name={curkey}
...@@ -944,7 +937,6 @@ function NolinkCascader({ item, colProps }) { ...@@ -944,7 +937,6 @@ function NolinkCascader({ item, colProps }) {
...item?.fieldProps, ...item?.fieldProps,
fieldNames: { label: 'title', value: 'key', children: 'children' }, fieldNames: { label: 'title', value: 'key', children: 'children' },
showSearch: true, showSearch: true,
multiple: item?.mode === 'multiple',
}} }}
formItemProps={item.formItemProps} formItemProps={item.formItemProps}
name={item.key ?? item.dataIndex} name={item.key ?? item.dataIndex}
...@@ -1016,12 +1008,14 @@ function Slider({ item, colProps }) { ...@@ -1016,12 +1008,14 @@ function Slider({ item, colProps }) {
//uploadbtn //uploadbtn
function UploadBtn({ item, colProps }) { function UploadBtn({ item, colProps }) {
let token = `Bearer ${localStorage.getItem('TOKENES')}`;
return ( return (
<> <>
<ProFormUploadButton <ProFormUploadButton
fieldProps={{ fieldProps={{
...item?.fieldProps, ...item?.fieldProps,
action: defaultSetting.proxypath + '/ngic-base-business/sysAttachment/uploadFile', action: defaultSetting.proxypath + '/base/sysAttachment/uploadFile',
headers: { Authorization: token },
onPreview: (file) => { onPreview: (file) => {
let url = ''; let url = '';
if (file.response) { if (file.response) {
...@@ -1052,15 +1046,15 @@ function UploadBtn({ item, colProps }) { ...@@ -1052,15 +1046,15 @@ function UploadBtn({ item, colProps }) {
colProps={item.colProps ?? colProps} colProps={item.colProps ?? colProps}
label={item.title} label={item.title}
title={`上传${item.title}`} title={`上传${item.title}`}
max={item.max}
/> />
</> </>
); );
} }
function UploadImg({ value, onChange, fieldProps }) { function UploadImg({ value, onChange, fieldProps }) {
let token = `Bearer ${localStorage.getItem('TOKENES')}`;
const [image, setImage] = useState({}); const [image, setImage] = useState({});
let token = '18e1081d54f57af2fdeac1964cc981e7';
function beforeUpload(file) { function beforeUpload(file) {
const isJpgOrPng = const isJpgOrPng =
file.type === 'image/jpg' || file.type === 'image/jpeg' || file.type === 'image/png'; file.type === 'image/jpg' || file.type === 'image/jpeg' || file.type === 'image/png';
...@@ -1074,12 +1068,12 @@ function UploadImg({ value, onChange, fieldProps }) { ...@@ -1074,12 +1068,12 @@ function UploadImg({ value, onChange, fieldProps }) {
// maxCount 最大数量 // maxCount 最大数量
const defaultconfig = { const defaultconfig = {
name: 'file', name: 'file',
action: defaultSetting.proxypath + '/ngic-base-business/sysAttachment/uploadFile', action: defaultSetting.proxypath + '/base/sysAttachment/uploadFile',
accept: '.jpg,.png,.jpeg', accept: '.jpg,.png,.jpeg',
listType: 'picture-card', listType: 'picture-card',
beforeUpload: beforeUpload, beforeUpload: beforeUpload,
defaultFileList: value, defaultFileList: value,
headers: { token }, headers: { Authorization: token },
onChange(info) { onChange(info) {
let { let {
file: { name, status, response }, file: { name, status, response },
...@@ -1090,7 +1084,7 @@ function UploadImg({ value, onChange, fieldProps }) { ...@@ -1090,7 +1084,7 @@ function UploadImg({ value, onChange, fieldProps }) {
message.error(`${info.file.name} 上传失败`); message.error(`${info.file.name} 上传失败`);
} else if (status === 'done') { } else if (status === 'done') {
const transfile = fileList.map((it) => { const transfile = fileList.map((it) => {
return it?.response ? it?.response.data.dataList[0] : it; return it?.response ? it?.response?.data?.dataList[0] : it;
}); });
onChange(transfile); onChange(transfile);
} }
...@@ -1122,6 +1116,7 @@ function UploadImg({ value, onChange, fieldProps }) { ...@@ -1122,6 +1116,7 @@ function UploadImg({ value, onChange, fieldProps }) {
<div style={{ marginTop: 8 }}>上传图片</div> <div style={{ marginTop: 8 }}>上传图片</div>
</div> </div>
); );
console.log(value?.length, fieldProps.limit);
return ( return (
<> <>
<Image <Image
...@@ -1175,12 +1170,14 @@ function UploadImage({ item, colProps }) { ...@@ -1175,12 +1170,14 @@ function UploadImage({ item, colProps }) {
// uploadDragger // uploadDragger
function UploadDragger({ item, colProps }) { function UploadDragger({ item, colProps }) {
let token = `Bearer ${localStorage.getItem('TOKENES')}`;
return ( return (
<> <>
<ProFormUploadDragger <ProFormUploadDragger
fieldProps={{ fieldProps={{
...item?.fieldProps, ...item?.fieldProps,
action: defaultSetting.proxypath + '/ngic-base-business/sysAttachment/uploadFile', action: defaultSetting.proxypath + '/base/sysAttachment/uploadFile',
headers: { Authorization: token },
onPreview: (file) => { onPreview: (file) => {
let url = ''; let url = '';
if (file.response) { if (file.response) {
...@@ -1227,14 +1224,20 @@ function Editor({ item, colProps, formRef }) { ...@@ -1227,14 +1224,20 @@ function Editor({ item, colProps, formRef }) {
// }} // }}
transform={(value) => { transform={(value) => {
return { return {
[curkey]: value.toHTML(), [curkey]: value && value?.toHTML?.(),
}; };
}} }}
name={curkey} name={curkey}
label={item.title} label={item.title}
{...item.formItemProps} {...item.formItemProps}
> >
<EditorItem item={item} params={item.params} formRef={formRef} curkey={curkey} /> <EditorItem
serverURL={defaultSetting.proxypath + '/base/sysAttachment/uploadFile'}
item={item}
params={item.params}
formRef={formRef}
curkey={curkey}
/>
</ProForm.Item> </ProForm.Item>
</Col> </Col>
); );
......
/*
* @Author: Li Hanlin
* @Date: 2022-11-10 09:39:56
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-10 09:39:56
*/
import * as React from 'react'; import * as React from 'react';
import { useState, useMemo, useRef } from 'react'; import { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro'; import DrawerPro from '@/components/DrawerPro';
......
import { Image } from 'antd';
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return [ return [
{ {
title: '基础信息', title: '设备型号',
valueType: 'split', dataIndex: 'equipmentModelName',
}, key: 'equipmentModelName',
{
title: '用户名',
dataIndex: 'accountName',
formItemProps: { formItemProps: {
rules: [ rules: [
{ {
...@@ -15,93 +13,34 @@ function getcolumns(setdrawer) { ...@@ -15,93 +13,34 @@ function getcolumns(setdrawer) {
}, },
], ],
}, },
initialValue: '默认值',
hideInForm: false,
search: false,
render: (text, row) => {
return (
<a
onClick={() => {
setdrawer?.((s) => ({
...s,
visible: true,
item: null,
title: '新增',
val: 'add',
}));
}}
>
{text}
</a>
);
},
},
{
title: '姓名',
dataIndex: 'userName',
key: 'userId',
hideInForm: {
accountName: {
reverse: ['1', '2', '5'],
},
remark: ['3'],
},
search: false,
},
{
title: '额外信息',
valueType: 'split',
},
{
title: '联系电话',
dataIndex: 'telephone',
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
search: false,
},
{
title: '邮箱',
dataIndex: 'mailNo',
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
search: false,
}, },
{ {
title: '备注', title: '备注',
dataIndex: 'remark', dataIndex: 'modelDescription',
valueType: 'editor', key: 'modelDescription',
initialValue: '默认值',
hideInForm: false,
search: false, search: false,
colProps: { span: 24 },
initialValue: '<p>Hello <b>World!</b></p>',
}, },
{ {
title: '上传样式-图片', title: '设备图片',
dataIndex: 'uploadImage', dataIndex: 'pictureUrl',
key: 'uploadImage', key: 'picList',
search: false,
valueType: 'uploadImage', valueType: 'uploadImage',
fieldProps: { fieldProps: {
limit: 2, limit: 1,
}, },
formItemProps: { formItemProps: {
rules: [ rules: [
{ {
required: false, required: true,
message: '此项为必填项', message: '此项为必填项',
}, },
], ],
}, },
hideInTable: false,
render: (text, row) => <Image width={70} src={row.pictureUrl} />,
}, },
]; ];
} }
......
/* 设备型号
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-10 15:12:23
*/
import * as React from 'react'; import * as React from 'react';
import { useState, useMemo, useRef } from 'react'; import { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro'; import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable'; import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton'; import PremButton from '@/components/PremButton';
import getcolumns from './columns'; import getcolumns from './columns';
import { doFetch } from '@/utils/doFetch';
import { message } from 'antd';
function Model(props) { function Model(props) {
const actionRef = useRef(), const actionRef = useRef(),
formRef = useRef(); formRef = useRef();
const [drawer, setdrawer] = useState({ const [drawer, setDrawer] = useState({
visible: false, visible: false,
}); });
const urlParams = {
save: '/asset/equipmentModel/save',
remove: '/asset/equipmentModel/deleteById',
list: '/asset/equipmentModel/queryList',
detail: '/asset/equipmentModel/queryById',
};
const detail = (text, row, _, action) => { const detail = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
...@@ -19,7 +35,7 @@ function Model(props) { ...@@ -19,7 +35,7 @@ function Model(props) {
size: 'small', size: 'small',
type: 'link', type: 'link',
onClick: () => { onClick: () => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: row, item: row,
...@@ -41,12 +57,32 @@ function Model(props) { ...@@ -41,12 +57,32 @@ function Model(props) {
btn={{ btn={{
size: 'small', size: 'small',
onClick: () => { onClick: () => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: row,
title: '编辑', title: '编辑',
val: 'edit', val: 'edit',
detailpath: urlParams.detail,
params: { id: row.id },
onFinish: async (vals) => {
console.log(1);
let params = {
...vals,
id: row.id,
};
let res = await doFetch({
url: urlParams.save,
params,
});
if (res.code === '0000') {
message.success('新增成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
})); }));
}, },
}} }}
...@@ -63,8 +99,16 @@ function Model(props) { ...@@ -63,8 +99,16 @@ function Model(props) {
title: '是否删除该用户?', title: '是否删除该用户?',
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onConfirm: () => { onConfirm: async () => {
alert(0); let res = await doFetch({ url: urlParams.remove, params: { id: row.id } });
if (res.code === '0000') {
message.success('删除成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
}, },
}} }}
btn={{ btn={{
...@@ -78,39 +122,55 @@ function Model(props) { ...@@ -78,39 +122,55 @@ function Model(props) {
}; };
const columns = useMemo(() => { const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer); let defcolumn = getcolumns(setDrawer);
return defcolumn.concat({ return defcolumn.concat({
title: '操作', title: '操作',
valueType: 'option', valueType: 'option',
width: 150, width: 150,
render: (text, row, _, action) => [ render: (text, row, _, action) => [edit(text, row, _, action), remove(text, row, _, action)],
detail(text, row, _, action),
edit(text, row, _, action),
remove(text, row, _, action),
],
}); });
}, []); }, []);
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle="设备型号" pagetitle={<h3 className="page-title">设备型号</h3>}
columns={columns} columns={columns}
path="/ngic-auth/sysUser/query/page" path={urlParams.list}
actionRef={actionRef} actionRef={actionRef}
pageextra={'add'} pageextra={'add'}
resizeable={true} resizeable={false}
addconfig={{ addconfig={{
// access: 'sysDepartment_save', // access: 'sysDepartment_save',
btn: { btn: {
disabled: false, disabled: false,
onClick: () => { onClick: () => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: null, item: null,
detailpath: null,
title: '新增', title: '新增',
val: 'add', val: 'add',
onFinish: async (vals) => {
// console.log(1);
console.log(drawer);
let params = {
...vals,
};
let res = await doFetch({
url: urlParams.save,
params,
});
if (res.code === '0000') {
message.success('新增成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
})); }));
}, },
}, },
...@@ -119,12 +179,11 @@ function Model(props) { ...@@ -119,12 +179,11 @@ function Model(props) {
<DrawerPro <DrawerPro
fields={columns} fields={columns}
detailpath="/ngic-auth/sysUser/query/detail" defaultFormValue={drawer?.item ?? {}}
params={{ id: drawer?.item?.id }}
formRef={formRef} formRef={formRef}
placement="right" placement="right"
onClose={() => { onClose={() => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: false, visible: false,
})); }));
......
import { doFetch } from '@/utils/doFetch';
import { Switch } from 'antd';
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return [ return [
{ {
title: '基础信息', title: '供应商编号',
valueType: 'split', dataIndex: 'supplierNo',
key: 'supplierNo',
hideInForm: {
accountName: {
reverse: ['1', '2', '5'],
},
remark: ['3'],
},
}, },
{ {
title: '用户名', title: '供应商名称',
dataIndex: 'accountName', dataIndex: 'supplierName',
key: 'supplierName',
formItemProps: { formItemProps: {
rules: [ rules: [
{ {
...@@ -15,46 +25,24 @@ function getcolumns(setdrawer) { ...@@ -15,46 +25,24 @@ function getcolumns(setdrawer) {
}, },
], ],
}, },
initialValue: '默认值',
hideInForm: false,
search: false,
render: (text, row) => {
return (
<a
onClick={() => {
setdrawer?.((s) => ({
...s,
visible: true,
item: null,
title: '新增',
val: 'add',
}));
}}
>
{text}
</a>
);
},
}, },
{ {
title: '姓名', title: '电话',
dataIndex: 'userName', dataIndex: 'telephone',
key: 'userId', key: 'telephone',
hideInForm: { formItemProps: {
accountName: { rules: [
reverse: ['1', '2', '5'], {
}, required: false,
remark: ['3'], message: '此项为必填项',
}, },
search: false, ],
}, },
{
title: '额外信息',
valueType: 'split',
}, },
{ {
title: '联系电话', title: '邮箱',
dataIndex: 'telephone', dataIndex: 'email',
key: 'email',
formItemProps: { formItemProps: {
rules: [ rules: [
{ {
...@@ -63,11 +51,11 @@ function getcolumns(setdrawer) { ...@@ -63,11 +51,11 @@ function getcolumns(setdrawer) {
}, },
], ],
}, },
search: false,
}, },
{ {
title: '邮箱', title: '地址',
dataIndex: 'mailNo', dataIndex: 'address',
key: 'address',
formItemProps: { formItemProps: {
rules: [ rules: [
{ {
...@@ -76,24 +64,24 @@ function getcolumns(setdrawer) { ...@@ -76,24 +64,24 @@ function getcolumns(setdrawer) {
}, },
], ],
}, },
search: false,
}, },
{ {
title: '备注', title: '评分',
dataIndex: 'remark', dataIndex: 'score',
valueType: 'editor', formItemProps: {
search: false, rules: [
colProps: { span: 24 },
initialValue: '<p>Hello <b>World!</b></p>',
},
{ {
title: '上传样式-图片', required: false,
dataIndex: 'uploadImage', message: '此项为必填项',
key: 'uploadImage', },
valueType: 'uploadImage', ],
fieldProps: {
limit: 2,
}, },
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
valueType: 'radio',
formItemProps: { formItemProps: {
rules: [ rules: [
{ {
...@@ -102,6 +90,29 @@ function getcolumns(setdrawer) { ...@@ -102,6 +90,29 @@ function getcolumns(setdrawer) {
}, },
], ],
}, },
render: (text, row) => {
return (
<Switch
checkedChildren="启用"
unCheckedChildren="禁用"
defaultChecked={row.status == 1}
onChange={(flag) => {
// console.log(e);
if (flag) {
doFetch({
url: '/asset/equipmentSupplier/update/status',
params: { id: row.id, status: '1' },
});
} else {
doFetch({
url: '/asset/equipmentSupplier/update/status',
params: { id: row.id, status: '2' },
});
}
}}
/>
);
},
}, },
]; ];
} }
......
/* 设备供应商
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-10 16:57:58
*/
import * as React from 'react'; import * as React from 'react';
import { useState, useMemo, useRef } from 'react'; import { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro'; import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable'; import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton'; import PremButton from '@/components/PremButton';
import getcolumns from './columns'; import getcolumns from './columns';
import { doFetch } from '@/utils/doFetch';
import { message } from 'antd';
function Supplier(props) { function Supplier(props) {
const actionRef = useRef(), const actionRef = useRef(),
formRef = useRef(); formRef = useRef();
const [drawer, setdrawer] = useState({ const [drawer, setDrawer] = useState({
visible: false, visible: false,
}); });
const urlParams = {
save: '/asset/equipmentSupplier/save',
remove: '/asset/equipmentSupplier/deleteById',
list: '/asset/equipmentSupplier/queryList',
detail: '/asset/equipmentSupplier/query/detail',
detail_nocp: '/asset/equipmentSupplier/queryById',
};
const detail = (text, row, _, action) => { const detail = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
...@@ -19,7 +36,7 @@ function Supplier(props) { ...@@ -19,7 +36,7 @@ function Supplier(props) {
size: 'small', size: 'small',
type: 'link', type: 'link',
onClick: () => { onClick: () => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: row, item: row,
...@@ -41,12 +58,32 @@ function Supplier(props) { ...@@ -41,12 +58,32 @@ function Supplier(props) {
btn={{ btn={{
size: 'small', size: 'small',
onClick: () => { onClick: () => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: row, detailpath: urlParams.detail,
params: { id: drawer?.item?.id },
title: '编辑', title: '编辑',
val: 'edit', val: 'edit',
onFinish: async (vals) => {
console.log(1);
let params = {
...vals,
id: row.id,
};
let res = await doFetch({
url: urlParams.save,
params,
});
if (res.code === '0000') {
message.success('编辑成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
})); }));
}, },
}} }}
...@@ -60,11 +97,19 @@ function Supplier(props) { ...@@ -60,11 +97,19 @@ function Supplier(props) {
return ( return (
<PremButton <PremButton
pop={{ pop={{
title: '是否删除该用户?', title: '是否删除该供应商?',
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onConfirm: () => { onConfirm: async () => {
alert(0); let res = await doFetch({ url: urlParams.remove, params: { id: row.id } });
if (res.code === '0000') {
message.success('删除成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
}, },
}} }}
btn={{ btn={{
...@@ -78,39 +123,53 @@ function Supplier(props) { ...@@ -78,39 +123,53 @@ function Supplier(props) {
}; };
const columns = useMemo(() => { const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer); let defcolumn = getcolumns(setDrawer);
return defcolumn.concat({ return defcolumn.concat({
title: '操作', title: '操作',
valueType: 'option', valueType: 'option',
width: 150, width: 150,
render: (text, row, _, action) => [ render: (text, row, _, action) => [edit(text, row, _, action), remove(text, row, _, action)],
detail(text, row, _, action),
edit(text, row, _, action),
remove(text, row, _, action),
],
}); });
}, []); }, []);
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle="设备供应商" pagetitle={<h3 className="page-title">设备供应商</h3>}
columns={columns} columns={columns}
path="/ngic-auth/sysUser/query/page" path={urlParams.list}
actionRef={actionRef} actionRef={actionRef}
pageextra={'add'} pageextra={'add'}
resizeable={true} resizeable={false}
addconfig={{ addconfig={{
// access: 'sysDepartment_save', // access: 'sysDepartment_save',
btn: { btn: {
disabled: false, disabled: false,
type: 'primary',
onClick: () => { onClick: () => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: null, item: null,
title: '新增', title: '新增',
val: 'add', val: 'add',
onFinish: async (vals) => {
let params = {
...vals,
};
let res = await doFetch({
url: urlParams.save,
params,
});
if (res.code === '0000') {
message.success('新增成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
})); }));
}, },
}, },
...@@ -119,12 +178,11 @@ function Supplier(props) { ...@@ -119,12 +178,11 @@ function Supplier(props) {
<DrawerPro <DrawerPro
fields={columns} fields={columns}
detailpath="/ngic-auth/sysUser/query/detail" defaultFormValue={drawer?.item ?? {}}
params={{ id: drawer?.item?.id }}
formRef={formRef} formRef={formRef}
placement="right" placement="right"
onClose={() => { onClose={() => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: false, visible: false,
})); }));
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44 * @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-09 14:44:44 * @Last Modified time: 2022-11-10 15:41:24
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -95,7 +95,7 @@ function Factory(props) { ...@@ -95,7 +95,7 @@ function Factory(props) {
return ( return (
<PremButton <PremButton
pop={{ pop={{
title: '是否删除该用户?', title: '是否删除该工厂?',
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onConfirm: async () => { onConfirm: async () => {
...@@ -142,12 +142,14 @@ function Factory(props) { ...@@ -142,12 +142,14 @@ function Factory(props) {
addconfig={{ addconfig={{
// access: 'sysDepartment_save', // access: 'sysDepartment_save',
btn: { btn: {
type: 'primary',
disabled: false, disabled: false,
onClick: () => { onClick: () => {
setDrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: null, item: null,
detailpath: null,
title: '新增', title: '新增',
val: 'add', val: 'add',
onFinish: async (vals) => { onFinish: async (vals) => {
......
...@@ -103,12 +103,14 @@ function Organization(props) { ...@@ -103,12 +103,14 @@ function Organization(props) {
addconfig={{ addconfig={{
// access: 'sysDepartment_save', // access: 'sysDepartment_save',
btn: { btn: {
type: 'primary',
disabled: false, disabled: false,
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: null, item: null,
detailpath: null,
title: '新增', title: '新增',
val: 'add', val: 'add',
})); }));
......
...@@ -18,10 +18,15 @@ function getcolumns(setdrawer) { ...@@ -18,10 +18,15 @@ function getcolumns(setdrawer) {
{ {
title: '所属车间', title: '所属车间',
dataIndex: 'shopName', dataIndex: 'shopName',
key: 'shopName', key: 'shopId',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
valueType: 'select', valueType: 'select',
options: { path: '/auth/sysShop/getShopSelectionByFactory', params: {} }, options: {
path: '/auth/sysShop/getShopSelectionByFactory',
linkParams: {
factoryId: '', //key 后面如果存在value 则该value会在调用接口时format
},
},
}, },
]; ];
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-09 14:43:54 * @Date: 2022-11-09 14:43:54
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-09 16:47:41 * @Last Modified time: 2022-11-10 16:25:11
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -67,11 +67,11 @@ function Section(props) { ...@@ -67,11 +67,11 @@ function Section(props) {
onFinish: async (vals) => { onFinish: async (vals) => {
let params = { let params = {
...vals, ...vals,
id: row.id,
}; };
let res = await doFetch({ let res = await doFetch({
url: urlParams.save, url: urlParams.save,
params, params,
id: row.id,
}); });
if (res.code === '0000') { if (res.code === '0000') {
message.success('新增成功!'); message.success('新增成功!');
...@@ -95,7 +95,7 @@ function Section(props) { ...@@ -95,7 +95,7 @@ function Section(props) {
return ( return (
<PremButton <PremButton
pop={{ pop={{
title: '是否删除该用户?', title: '是否删除该产线?',
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onConfirm: async () => { onConfirm: async () => {
...@@ -142,12 +142,14 @@ function Section(props) { ...@@ -142,12 +142,14 @@ function Section(props) {
addconfig={{ addconfig={{
// access: 'sysDepartment_save', // access: 'sysDepartment_save',
btn: { btn: {
type: 'primary',
disabled: false, disabled: false,
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: null, item: null,
detailpath: null,
title: '新增', title: '新增',
val: 'add', val: 'add',
onFinish: async (vals) => { onFinish: async (vals) => {
...@@ -160,7 +162,7 @@ function Section(props) { ...@@ -160,7 +162,7 @@ function Section(props) {
}); });
if (res.code === '0000') { if (res.code === '0000') {
message.success('新增成功!'); message.success('新增成功!');
setDraw((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: false, visible: false,
})); }));
......
...@@ -103,6 +103,7 @@ function Role(props) { ...@@ -103,6 +103,7 @@ function Role(props) {
addconfig={{ addconfig={{
// access: 'sysDepartment_save', // access: 'sysDepartment_save',
btn: { btn: {
type: 'primary',
disabled: false, disabled: false,
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
......
...@@ -24,7 +24,7 @@ function getcolumns(setdrawer) { ...@@ -24,7 +24,7 @@ function getcolumns(setdrawer) {
options: { options: {
path: '/auth/sysShop/getShopSelectionByFactory', path: '/auth/sysShop/getShopSelectionByFactory',
linkParams: { linkParams: {
factoryId: 'factoryId', //key 后面如果存在value 则该value会在调用接口时format factoryId: '', //key 后面如果存在value 则该value会在调用接口时format
}, },
}, },
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-09 14:43:54 * @Date: 2022-11-09 14:43:54
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-09 16:48:08 * @Last Modified time: 2022-11-10 15:37:21
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -95,7 +95,7 @@ function Section(props) { ...@@ -95,7 +95,7 @@ function Section(props) {
return ( return (
<PremButton <PremButton
pop={{ pop={{
title: '是否删除该用户?', title: '是否删除该工段?',
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onConfirm: async () => { onConfirm: async () => {
...@@ -142,12 +142,14 @@ function Section(props) { ...@@ -142,12 +142,14 @@ function Section(props) {
addconfig={{ addconfig={{
// access: 'sysDepartment_save', // access: 'sysDepartment_save',
btn: { btn: {
type: 'primary',
disabled: false, disabled: false,
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: null, item: null,
detailpath: null,
title: '新增', title: '新增',
val: 'add', val: 'add',
onFinish: async (vals) => { onFinish: async (vals) => {
...@@ -160,7 +162,7 @@ function Section(props) { ...@@ -160,7 +162,7 @@ function Section(props) {
}); });
if (res.code === '0000') { if (res.code === '0000') {
message.success('新增成功!'); message.success('新增成功!');
setDraw((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: false, visible: false,
})); }));
......
...@@ -103,12 +103,14 @@ function Users(props) { ...@@ -103,12 +103,14 @@ function Users(props) {
addconfig={{ addconfig={{
// access: 'sysDepartment_save', // access: 'sysDepartment_save',
btn: { btn: {
type: 'primary',
disabled: false, disabled: false,
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: null, item: null,
detailpath: null,
title: '新增', title: '新增',
val: 'add', val: 'add',
})); }));
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-09 14:44:18 * @Date: 2022-11-09 14:44:18
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-09 14:44:18 * @Last Modified time: 2022-11-10 15:36:27
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -141,12 +141,14 @@ function Factory(props) { ...@@ -141,12 +141,14 @@ function Factory(props) {
addconfig={{ addconfig={{
// access: 'sysDepartment_save', // access: 'sysDepartment_save',
btn: { btn: {
type: 'primary',
disabled: false, disabled: false,
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: null, item: null,
detailpath: null,
title: '新增', title: '新增',
val: 'add', val: 'add',
onFinish: async (vals) => { onFinish: async (vals) => {
...@@ -159,7 +161,7 @@ function Factory(props) { ...@@ -159,7 +161,7 @@ function Factory(props) {
}); });
if (res.code === '0000') { if (res.code === '0000') {
message.success('新增成功!'); message.success('新增成功!');
setDraw((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: false, visible: false,
})); }));
......
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