From 48c869e81cc9aa6160fc0232653243722918d7c6 Mon Sep 17 00:00:00 2001 From: JY <1140938202@qq.com> Date: Fri, 18 Jul 2025 16:12:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=85=AC=E5=8A=A1=E8=88=B1=E8=B5=84?= =?UTF-8?q?=E4=BA=A7=E9=94=81=E5=AE=9A=E4=BB=A5=E5=90=8E=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E4=B8=8B=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../open/mallTemplate/widget/list.tsx | 52 +++++++++++++++++-- .../open/mallTemplate/widget/product.tsx | 39 +++++++++++--- 2 files changed, 80 insertions(+), 11 deletions(-) diff --git a/src/executor/open/mallTemplate/widget/list.tsx b/src/executor/open/mallTemplate/widget/list.tsx index a4f9dcb6b..f15737991 100644 --- a/src/executor/open/mallTemplate/widget/list.tsx +++ b/src/executor/open/mallTemplate/widget/list.tsx @@ -1,8 +1,8 @@ -import React, { memo, useEffect, useRef, useState } from 'react'; +import React, { memo, useRef, useState } from 'react'; import { IMallTemplate } from '@/ts/core/thing/standard/page/mallTemplate'; -import { schema } from '@/ts/base'; +import { kernel, schema } from '@/ts/base'; import { DataGrid } from 'devextreme-react'; -import { Button, Space } from 'antd'; +import { Button, Modal, Space } from 'antd'; import cls from '../index.module.less'; import DataDetails from '../components/dataDetails'; import { IForm, IWork } from '@/ts/core'; @@ -10,23 +10,64 @@ import { FieldModel } from '@/ts/base/model'; import { userFormatFilter } from '@/utils/tools'; import CustomStore from 'devextreme/data/custom_store'; import GenerateThingTable from '@/executor/tools/generate/thingTable'; +import { ArchiveItem } from '../../form/detail/archive'; interface IMallList { current: IMallTemplate; fields: FieldModel[]; form: IForm; - works?: IWork[] + works?: IWork[]; onBatchAddCar: (products: schema.XProduct[], staging?: boolean) => void; onPurchase: (selectedRows: schema.XProduct[], work: IWork) => void; } -const MallList = ({ current, onBatchAddCar, onPurchase, fields, form, works }: IMallList) => { +const MallList = ({ + current, + onBatchAddCar, + onPurchase, + fields, + form, + works, +}: IMallList) => { const [selectedRows, setSelectedRows] = useState([]); const [center, setCenter] = useState(<>); let ref = useRef>(null); const onSelectionChanged = (e: any) => { setSelectedRows(e.selectedRowsData); }; + + const onLockCell = (row: any) => { + const [loading, setLoading] = useState(false); + if (row.data?.locks?.exclusion) { + return ( + + ); + } + return <>; + }; return (
{selectedRows.length ? ( @@ -68,6 +109,7 @@ const MallList = ({ current, onBatchAddCar, onPurchase, fields, form, works }: I showBorders={true} reference={ref} fields={fields} + onLockCell={onLockCell} remoteOperations={true} dataSource={ new CustomStore({ diff --git a/src/executor/open/mallTemplate/widget/product.tsx b/src/executor/open/mallTemplate/widget/product.tsx index 77de0b90c..0277ebcb9 100644 --- a/src/executor/open/mallTemplate/widget/product.tsx +++ b/src/executor/open/mallTemplate/widget/product.tsx @@ -2,7 +2,7 @@ import EntityIcon from '@/components/Common/GlobalComps/entityIcon'; import { model, schema } from '@/ts/base'; import { IMallTemplate } from '@/ts/core/thing/standard/page/mallTemplate'; import { ShoppingCartOutlined } from '@ant-design/icons'; -import { Carousel, Image, Skeleton, Space, Typography } from 'antd'; +import { Carousel, Image, message, Skeleton, Space, Typography } from 'antd'; import React, { useEffect, useState } from 'react'; import cls from './../index.module.less'; import down from '/public/img/mallTemplate/down.svg'; @@ -15,7 +15,7 @@ interface IProps { current: IMallTemplate; product: schema.XProduct; form: IForm; - works?: IWork[] + works?: IWork[]; onAddCar: (product: schema.XProduct, staging: boolean) => void; onPurchase: (selectedRows: schema.XProduct[], work: IWork) => void; } @@ -81,7 +81,13 @@ export const Product: React.FC = ({ form={form} current={current} works={works} - onAddCar={onAddCar.bind(this, product, staging)} + onAddCar={() => { + if (product.locks?.exclusion?.name) + return message.error( + `资产已锁定 (${product.locks.exclusion.name})`, + ); + onAddCar(product, staging); + }} onPurchase={onPurchase} onCancel={() => setCenter(<>)} />, @@ -141,7 +147,13 @@ export const Product: React.FC = ({ )}
+ onClick={() => { + if (product.locks?.exclusion?.name) + return message.error( + `资产已锁定 (${product.locks.exclusion.name})`, + ); + onAddCar(product, staging); + }}> = ({ form={form} current={current} works={works} - onAddCar={onAddCar.bind(this, product, staging)} + onAddCar={() => { + if (product.locks?.exclusion?.name) + return message.error( + `资产已锁定 (${product.locks.exclusion.name})`, + ); + onAddCar(product, staging); + }} onPurchase={onPurchase} onCancel={() => setCenter(<>)} />, @@ -201,6 +219,9 @@ export const Product: React.FC = ({ {product.brand && `[${product.brand}]`} {product.title || '[未设置名称]'}
+ {/* {product.locks && product.locks?.exclusion?.name && ( +
{`锁定 (${product.locks.exclusion.name})`}
+ )} */} {product.mode === '空间共享' && (
{product.startHours}-{product.endHours} @@ -246,7 +267,13 @@ export const Product: React.FC = ({ )}
{ + if (product.locks?.exclusion?.name) + return message.error( + `资产已锁定 (${product.locks.exclusion.name})`, + ); + onAddCar(product, staging); + }} style={{ fontSize: 20, color: staging ? 'red' : undefined, -- Gitee