Commit 2f5a7431 authored by TZW's avatar TZW

1115

parent 907b28a4
import { Image } from 'antd';
function getcolumns(setdrawer) {
return [
{
title: '基础信息',
valueType: 'split',
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '用户名',
dataIndex: 'accountName',
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
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: 'equipmentName',
key: 'equipmentName',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{ title: '位置号', dataIndex: 'positionNo', key: 'positionNo' },
{
title: '姓名',
dataIndex: 'userName',
key: 'userId',
hideInForm: {
accountName: {
reverse: ['1', '2', '5'],
},
remark: ['3'],
},
search: false,
title: '设备类型',
dataIndex: 'equipmentTypeName',
key: 'equipmentTypeName',
valueType: 'treeSelect',
options: { path: '/asset/equipmentType/queryTreeList', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '额外信息',
valueType: 'split',
title: '设备型号',
dataIndex: 'equipmentModelName',
key: 'equipmentModelName',
valueType: 'select',
options: { path: '/asset/equipmentModel/query/selection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '联系电话',
dataIndex: 'telephone',
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
search: false,
title: '公司名称',
dataIndex: 'organizationName',
key: 'organizationName',
valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '邮箱',
dataIndex: 'mailNo',
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
search: false,
title: '工厂名称',
dataIndex: 'factoryName',
key: 'factoryName',
valueType: 'select',
options: { path: '/auth/sysDepartment/query/depart/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{ title: '部门名称', dataIndex: 'departmentName', key: 'departmentName' },
{
title: '备注',
dataIndex: 'remark',
valueType: 'editor',
search: false,
colProps: { span: 24 },
initialValue: '<p>Hello <b>World!</b></p>',
title: '车间名称',
dataIndex: 'shopName',
key: 'shopName',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{ title: '工段名称', dataIndex: 'sectionName', key: 'sectionName' },
{ title: '产线名称', dataIndex: 'productLineName', key: 'productLineName' },
{ title: '供应商', dataIndex: 'supplierName', key: 'supplierName' },
{ title: '设备原值(万元)', dataIndex: 'equipmentWorth', key: 'equipmentWorth' },
{
title: '上传样式-图片',
dataIndex: 'uploadImage',
key: 'uploadImage',
title: '图片地址',
width: 100,
dataIndex: 'pictureUrl',
search: false,
key: 'picList',
valueType: 'uploadImage',
fieldProps: {
limit: 2,
limit: 1,
},
formItemProps: {
rules: [
{
required: false,
required: true,
message: '此项为必填项',
},
],
},
render: (text, row) => <Image width={70} src={row.pictureUrl} />,
},
{
title: '二维码',
width: 80,
dataIndex: 'qrCodeUrl',
key: 'qrCodeUrl',
valueType: 'uploadImage',
search: false,
hideInForm: true,
render: (text, row) => <Image width={70} src={row.pictureUrl} />,
},
{ title: '状态名称', fixed: 'right', dataIndex: 'statusName', key: 'statusName' },
{ title: '设备状态', fixed: 'right', dataIndex: 'status', key: 'status' },
];
}
......
......@@ -2,27 +2,35 @@
* @Author: Li Hanlin
* @Date: 2022-11-10 09:39:56
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-15 13:29:58
* @Last Modified time: 2022-11-15 17:14:29
*/
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 TreeRender from '@/components/TreeRender';
import { doFetch } from '@/utils/doFetch';
import { message } from 'antd';
import { Layout } from 'antd';
import TreeRender from '@/components/TreeRender';
const { Sider, Content } = Layout;
function Account(props) {
function Model(props) {
const actionRef = useRef(),
formRef = useRef();
const [drawer, setdrawer] = useState({
const [drawer, setDrawer] = useState({
visible: false,
});
const urlParams = {
save: '/asset/equipmentModel/save',
remove: '/asset/equipment/deleteById',
list: '/asset/equipment/queryList',
detail: '/asset/equipmentModel/queryById',
};
const detail = (text, row, _, action) => {
return (
<PremButton
......@@ -30,7 +38,7 @@ function Account(props) {
size: 'small',
type: 'link',
onClick: () => {
setdrawer((s) => ({
setDrawer((s) => ({
...s,
visible: true,
item: row,
......@@ -52,12 +60,32 @@ function Account(props) {
btn={{
size: 'small',
onClick: () => {
setdrawer((s) => ({
setDrawer((s) => ({
...s,
visible: true,
item: row,
title: '编辑',
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();
}
},
}));
},
}}
......@@ -71,11 +99,19 @@ function Account(props) {
return (
<PremButton
pop={{
title: '是否删除该用户?',
title: '是否删除该设备?',
okText: '确认',
cancelText: '取消',
onConfirm: () => {
alert(0);
onConfirm: async () => {
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={{
......@@ -89,16 +125,12 @@ function Account(props) {
};
const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer);
let defcolumn = getcolumns(setDrawer);
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
detail(text, row, _, action),
edit(text, row, _, action),
remove(text, row, _, action),
],
render: (text, row, _, action) => [edit(text, row, _, action), remove(text, row, _, action)],
});
}, []);
......@@ -119,7 +151,7 @@ function Account(props) {
<AutoTable
pagetitle={<h3 style={{ marginBottom: 0, fontWeight: 400 }}>设备台账</h3>}
columns={columns}
path="/ngic-auth/sysUser/query/page"
path={urlParams.list}
actionRef={actionRef}
pageextra={'add'}
resizeable={true}
......@@ -160,4 +192,4 @@ function Account(props) {
);
}
export default Account;
export default Model;
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