Commit bc16f269 authored by 左玲玲's avatar 左玲玲 😬

1718

parent 8336f687
......@@ -74,6 +74,7 @@ const EditTable = (props) => {
if (Array.isArray(it.options)) {
options = {
fieldProps: {
...it?.fieldProps,
options: [...it.options],
},
};
......@@ -141,20 +142,20 @@ const EditTable = (props) => {
scroll={
x
? {
x: x,
}
x: x,
}
: {}
}
pagination={
ifspagination
? false
: {
showTotal: (total, range) => <span>{total}</span>,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: [5, 10, 15, 30, 50, 100, 200],
defaultPageSize: pageSize || 15,
}
showTotal: (total, range) => <span>{total}</span>,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: [5, 10, 15, 30, 50, 100, 200],
defaultPageSize: pageSize || 15,
}
}
editable={{
type: 'multiple',
......
import { Popconfirm, Switch } from 'antd';
function getcolumns(setdrawer, run) {
import dayjs from 'dayjs';
function getcolumns(setdrawer) {
const disabledDate = (current) => {
// Can not select days before today and today
return current && current < dayjs().endOf('day');
};
const columns = [
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
editable: false,
},
{
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
editable: false,
},
{
title: '工厂名称',
dataIndex: 'factoryName',
key: 'factoryId',
hideInForm: true,
valueType: 'select',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
options: {
path: '/auth/sysFactory/getAllFactorySelection',
params: {},
},
editable: false,
},
{
title: '车间名称',
dataIndex: 'shopName',
key: 'shopId',
hideInForm: true,
valueType: 'select',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
options: {
path: '/auth/sysShop/getAllShopSelection',
params: {},
},
editable: false,
},
{
title: '下次点检日期',
dataIndex: 'checkPlanDate',
formItemProps: {
rules: [
{
required: true,
message: '此项为必填项',
},
],
},
fieldProps: {
disabledDate,
},
valueType: 'date',
hideInSearch: true,
},
];
return [
{
tab: '未完成',
......@@ -48,6 +115,10 @@ function getcolumns(setdrawer, run) {
key: 'factoryId',
hideInForm: true,
valueType: 'select',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
options: {
path: '/auth/sysFactory/getAllFactorySelection',
params: {},
......@@ -59,8 +130,12 @@ function getcolumns(setdrawer, run) {
key: 'shopId',
hideInForm: true,
valueType: 'select',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
options: {
path: '/auth/sysShop/getShopSelectionByFactory',
path: '/auth/sysShop/getAllShopSelection',
linkParams: {
factoryId: '',
},
......@@ -122,8 +197,9 @@ function getcolumns(setdrawer, run) {
hideInSearch: true,
valueType: 'digit',
hideInForm: {
checkLoop: [1],
checkLoop: [1, undefined],
},
precision: 0,
},
{
title: '下次点检日期',
......@@ -131,6 +207,9 @@ function getcolumns(setdrawer, run) {
key: 'planCheckDateList',
hideInForm: true,
valueType: 'dateRange',
render: (text, row, _, action) => {
return <span>{row.planCheckDate}</span>;
},
},
{
title: '状态',
......@@ -153,32 +232,10 @@ function getcolumns(setdrawer, run) {
},
],
},
{
title: '启用/停用',
dataIndex: 'checkEnable',
key: 'checkEnable',
hideInForm: true,
hideInSearch: true,
valueType: 'switch',
render: (text, row, _, action) => {
return <Popconfirm
title="是否开启或停用?"
onConfirm={() => {
if (row.checkEnable == 1) {
run({ url: "/check/umEquipmentCheckPlan/enable", params: { id: row.id, checkEnable: 2 } })
}
}}
okText="确定"
cancelText="取消"
>
< Switch checked={row.checkEnable == 1 ? true : false} checkedChildren="开启" unCheckedChildren="停用" defaultChecked={false} />
</Popconfirm>
}
},
{
title: '选择设备',
dataIndex: 'equipmentId',
key: 'equipmentId',
dataIndex: 'paramList',
key: 'paramList',
formItemProps: {
rules: [
{
......@@ -193,6 +250,9 @@ function getcolumns(setdrawer, run) {
colProps: {
span: 24,
},
path: '/asset/equipment/list/user/shop',
columns,
hideInDescriptions: true,
},
],
pathconfig: {
......@@ -215,6 +275,25 @@ function getcolumns(setdrawer, run) {
title: '点检计划单号',
dataIndex: 'checkNo',
key: 'checkNo',
render: (text, row, _, action) => {
return (
<a
onClick={() => {
setdrawer((s) => ({
...s,
open: true,
title: '详情',
val: 'detail',
type: 'detail',
title: '详细信息',
item: row,
}));
}}
>
{row?.checkNo}
</a>
);
},
},
{
title: '设备编号',
......@@ -230,7 +309,12 @@ function getcolumns(setdrawer, run) {
title: '工厂名称',
dataIndex: 'factoryName',
key: 'factoryId',
hideInForm: true,
valueType: 'select',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
options: {
path: '/auth/sysFactory/getAllFactorySelection',
params: {},
......@@ -240,10 +324,17 @@ function getcolumns(setdrawer, run) {
title: '车间名称',
dataIndex: 'shopName',
key: 'shopId',
hideInForm: true,
valueType: 'select',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
options: {
path: '/auth/sysShop/getShopSelectionByFactory',
params: {},
path: '/auth/sysShop/getAllShopSelection',
linkParams: {
factoryId: '',
},
},
},
{
......@@ -289,6 +380,9 @@ function getcolumns(setdrawer, run) {
dataIndex: 'endDate',
key: 'endDateList',
valueType: 'dateRange',
render: (text, row, _, action) => {
return <span>{row.endDate}</span>;
},
},
{
title: '状态',
......
This diff is collapsed.
......@@ -17,7 +17,7 @@ function Project({ equipmentCheckStandardId }) {
let pathconf = procolumns(setdrawer)?.pathconfig ?? {};
return pathconf;
}, []);
const { run, loading } = useRequest(doFetch, {
const { run, loading, runAsync } = useRequest(doFetch, {
manual: true,
onSuccess: (res, params) => {
if (res?.code == '0000') {
......@@ -82,8 +82,8 @@ function Project({ equipmentCheckStandardId }) {
title: '是否删除?',
okText: '确认',
cancelText: '取消',
onConfirm: () => {
run({ url: pathconfig?.delete || '/delete', params: { id: row?.id } });
onConfirm: async () => {
await runAsync({ url: pathconfig?.delete || '/delete', params: { id: row?.id } });
},
}}
btn={{
......@@ -120,6 +120,7 @@ function Project({ equipmentCheckStandardId }) {
addconfig={{
// access: 'sysDepartment_save',
btn: {
type: 'primary',
disabled: false,
onClick: () => {
setdrawer((s) => ({
......@@ -152,11 +153,11 @@ function Project({ equipmentCheckStandardId }) {
}));
}}
{...drawer}
onFinish={(vals) => {
onFinish={async (vals) => {
if (drawer?.val == 'add') {
run({ url: pathconfig?.add || '/add', params: { ...vals, equipmentCheckStandardId } });
await runAsync({ url: pathconfig?.add || '/add', params: { ...vals, equipmentCheckStandardId } });
} else if (drawer?.val == 'edit') {
run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id, equipmentCheckStandardId } });
await runAsync({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id, equipmentCheckStandardId } });
}
}}
/>
......
......@@ -17,7 +17,7 @@ function Standard(props) {
let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
return pathconf;
}, []);
const { run, loading } = useRequest(doFetch, {
const { run, loading, runAsync } = useRequest(doFetch, {
manual: true,
onSuccess: (res, params) => {
if (res?.code == '0000') {
......@@ -103,8 +103,8 @@ function Standard(props) {
title: '是否删除?',
okText: '确认',
cancelText: '取消',
onConfirm: () => {
run({ url: pathconfig?.delete || '/delete', params: { id: row?.id } });
onConfirm: async () => {
await runAsync({ url: pathconfig?.delete || '/delete', params: { id: row?.id } });
},
}}
btn={{
......@@ -144,6 +144,7 @@ function Standard(props) {
addconfig={{
// access: 'sysDepartment_save',
btn: {
type: 'primary',
disabled: false,
onClick: () => {
setdrawer((s) => ({
......@@ -175,11 +176,11 @@ function Standard(props) {
}));
}}
{...drawer}
onFinish={(vals) => {
onFinish={async (vals) => {
if (drawer?.val == 'add') {
run({ url: pathconfig?.add || '/add', params: { ...vals } });
await runAsync({ url: pathconfig?.add || '/add', params: { ...vals } });
} else if (drawer?.val == 'edit') {
run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
await runAsync({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
}
}}
>
......
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