This commit is contained in:
ylj20011123 2025-06-23 19:18:17 +08:00
parent aea7dea7c1
commit d6b779bde4
5 changed files with 1287 additions and 3 deletions

View File

@ -235,6 +235,22 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
} }
}) })
// 品牌分类
getFieldEnumTree({ FieldExplainField: 'BRAND_CATEGORY' }).then((BRANDCATEGORY: any) => {
if (BRANDCATEGORY && BRANDCATEGORY.length > 0) {
const obj: any = {}
const list: any = []
BRANDCATEGORY.forEach((item: any) => {
list.push({ label: item.label, value: item.value })
obj[item.value] = item.label
})
session.set('BRANDCATEGORYList', list);
session.set('BRANDCATEGORYObj', obj);
session.set('BRANDCATEGORYTree', BRANDCATEGORY);
}
})
// 消费类型 // 消费类型
getFieldEnumTree({ FieldExplainField: 'CONSUMPTIONRECORD_TYPE' }).then((CONSUMPTIONRECORDTYPE: any) => { getFieldEnumTree({ FieldExplainField: 'CONSUMPTIONRECORD_TYPE' }).then((CONSUMPTIONRECORDTYPE: any) => {

View File

@ -1 +1,418 @@
// 商城品牌管理 // 商城品牌管理
import { connect } from "umi";
import type { CurrentUser } from "umi";
import type { ConnectState } from "@/models/connect";
import React, { useRef, useState } from "react";
import ProCard from "@ant-design/pro-card";
import { MenuFoldOutlined, PlusOutlined } from "@ant-design/icons";
import type { FormInstance } from "antd";
import { Button, Col, Form, message, Modal, Popconfirm, Row, Space, Spin, Tree, TreeSelect } from "antd";
import useRequest from "@ahooksjs/use-request";
import { getServerpartTree } from "@/services/options";
import type { ActionType } from "@ant-design/pro-table";
import ProTable from "@ant-design/pro-table";
import ReactHTMLTableToExcel from "react-html-table-to-excel";
import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSelectTree";
import { handlDeleteBRAND, handleGetBRANDList, handleSynchroBRAND } from "../service";
import session from "@/utils/session";
import Draggable from "react-draggable";
import ProForm, { ProFormDatePicker, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea } from "@ant-design/pro-form";
import moment from 'moment'
const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
const { currentUser } = props
const downloadBtnRef = useRef<any>()
const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const [reqDetailList, setReqDetailList] = useState<any>(); // 合计项数据源
const [printOut, setPrintOut] = useState<any>(); // 打印数据的内容
const [collapsible, setCollapsible] = useState<boolean>(false)
const [treeView, setTreeView] = useState<any>()
const [printIndex, setPrintIndex] = useState<number>(new Date().getTime())
let BRANDCATEGORYObj = session.get('BRANDCATEGORYObj')
let BRANDCATEGORYList = session.get('BRANDCATEGORYList')
let brandObj = session.get('brandObj')
let brandList = session.get('brandList')
// 树相关的属性和方法
const [selectedId, setSelectedId] = useState<string>()
// 导出的加载效果
const [showLoading, setShowLoading] = useState<boolean>(false)
// 是否显示打印的表格
const [showExportTable, setShowExportTable] = useState<boolean>(false)
// 查询的条件
const [searchParams, setSearchParams] = useState<any>()
const [modalVisible, handleModalVisible] = useState<boolean>();
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
const draggleRef = React.createRef<any>()
const [currentRow, setCurrentRow] = useState<any>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const onDraggaleStart = (event, uiData) => {
const { clientWidth, clientHeight } = window.document.documentElement;
const targetRect = draggleRef.current?.getBoundingClientRect();
if (!targetRect) {
return;
}
setBounds({
left: -targetRect.left + uiData.x,
right: clientWidth - (targetRect.right - uiData.x),
top: -targetRect.top + uiData.y,
bottom: clientHeight - (targetRect.bottom - uiData.y),
});
};
const columns: any = [
{
dataIndex: 'BRAND_INDEX',
title: '品牌索引',
width: 120,
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'BRAND_NAME',
title: '品牌名称',
align: 'center',
width: 150,
hideInSearch: true,
ellipsis: true,
},
{
dataIndex: 'BRAND_CATEGORY',
title: '品牌分类',
width: 120,
valueType: 'select',
align: 'center',
ellipsis: true,
valueEnum: BRANDCATEGORYObj
// request: async () => {
// return await getFieldEnumTree({ FieldExplainField: 'BRAND_CATEGORY', sessionName: 'BRAND_CATEGORY' });
// },
// render: (_, record) => {
// return <a>
// {getFieldEnumName('BRAND_CATEGORY', record?.BRAND_CATEGORY)}
// </a>
// },
},
{
dataIndex: 'BRAND_TYPE',
title: '品牌类型',
valueType: 'select',
align: 'center',
width: 120,
ellipsis: true,
valueEnum: brandObj
// request: async () => {
// return await getFieldEnumTree({ FieldExplainField: 'BRAND_TYPE', sessionName: 'BRAND_TYPE' });
// },
// render: (_, record) => {
// return <a>
// {getFieldEnumName('BRAND_TYPE', record?.BRAND_TYPE)}
// </a>
// },
},
{
dataIndex: 'BRAND_STATE',
title: '有效状态',
align: 'center',
width: 120,
hideInSearch: true,
valueType: 'select',
valueEnum: {
"1": "有效",
"0": "无效"
}
},
{
dataIndex: 'BRAND_DESC',
title: '品牌介绍',
align: 'center',
width: 120,
hideInSearch: true,
ellipsis: true,
},
{
dataIndex: 'option',
title: '操作',
width: 120,
valueType: 'option',
align: 'center',
hideInSearch: true,
render: (_, record) => {
return (
<Space>
<a
onClick={() => {
// setCurrentRow({ ...record });
// handleModalVisible(true);
}}
>
</a>
<Popconfirm
title="确认删除该品牌列表信息吗?"
onConfirm={async () => {
// await handelDelete(record.BRAND_ID);
}}>
<a></a>
</Popconfirm>
</Space >
);
},
},
];
const handelDelete = async (id: number) => {
console.log('fjsdfsdflksa', id);
const req: any = {
SERVERPARTSELLERId: id
}
const result = await handlDeleteBRAND(req)
if (result.Result_Code !== 100) {
message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`);
} else {
message.success('删除成功!');
actionRef.current?.reload()
}
};
const handleAddUpdate = async (res: any) => {
let req: any = {}
if (currentRow?.SELLER_ID) {
req = {
...currentRow,
...res,
UPDATE_STAFF_ID: currentUser?.ID,
UPDATE_STAFF_NAME: currentUser?.Name,
UPDATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
}
} else {
req = {
...res,
PROVINCE_CODE: currentUser?.ProvinceCode,
ISVALID: 1,
CREATE_STAFF_ID: currentUser?.ID,
CREATE_STAFF_NAME: currentUser?.Name,
CREATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
}
}
const data = await handleSynchroBRAND(req)
handleConfirmLoading(false)
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
formRef?.current?.resetFields()
setCurrentRow(undefined)
handleModalVisible(false)
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
};
return (
<div ref={(el) => {
// 打印报表
if (!reqDetailList || reqDetailList.length === 0) return;
setPrintOut(el);
}} >
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
<div style={{
width: '100%',
paddingTop: 0,
paddingBottom: 0,
paddingRight: 0
}}>
<ProTable
actionRef={actionRef}
formRef={formRef}
columns={columns}
bordered
expandable={{
expandRowByClick: true
}}
headerTitle={<span style={{ color: "#1890ff", fontSize: 14, fontWeight: 600 }}></span>}
search={{ span: 6 }}
request={async (params) => {
setSearchParams(params)
const req: any = {
searchParameter: {
OWNERUNIT_ID: currentUser?.OwnerUnitId,
PROVINCE_CODE: currentUser?.ProvinceCode,
BRAND_CATEGORY: 2000
},
PageIndex: 1,
PageSize: 999999,
}
const data = await handleGetBRANDList(req)
console.log('datadatadatadatadata', data);
if (data.List && data.List.length > 0) {
return { data: data.List, success: true, total: data.TotalCount }
}
return { data: [], success: true }
}}
toolbar={{
actions: [
<Button
key="new"
icon={<PlusOutlined />}
type="primary"
onClick={() => {
handleModalVisible(true);
}}
>
</Button>,
]
}}
/>
</div>
</div>
<Modal
title={
<div
style={{
width: '100%',
cursor: 'move',
}}
onMouseOver={() => {
if (disabled) {
setDraggleDisabled(false)
}
}}
onMouseOut={() => {
setDraggleDisabled(true)
}}
onFocus={() => { }}
onBlur={() => { }}
>
{currentRow ? '更新品牌' : '新建品牌'}
</div>
}
destroyOnClose={true}
width={900}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
formRef.current?.resetFields();
setCurrentRow(undefined);
}}
onCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
}}
onOk={async () => { // 提交框内的数据
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
modalRender={(modal) => {
return <Draggable
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
}}
>
<ProForm
layout={'horizontal'}
formRef={formRef}
autoFocusFirstInput
submitter={false}
preserve={false}
initialValues={currentRow}
onFinish={async (values) => {
let newValue: any = { ...values };
if (currentRow) {
// 编辑数据
newValue = { ...values, BRAND_ID: currentRow.BRAND_ID };
}
// 如果有开关,要把开关的代码写进去
await handleAddUpdate(newValue);
handleConfirmLoading(false)
}}
>
<Row gutter={8}>
<Col span={12}>
<ProFormSelect
name="BRAND_PID"
label="上级内码"
/>
</Col>
<Col span={12}>
<ProFormMoney
name="BRAND_INDEX"
label="品牌索引"
/>
</Col>
<Col span={12}>
<ProFormText
name="BRAND_NAME"
label="品牌名称"
/>
</Col>
<Col span={12}>
<ProFormSelect
name="BRAND_CATEGORY"
label="品牌分类"
options={BRANDCATEGORYList}
/>
</Col>
<Col span={12}>
<ProFormSelect
name="BRAND_TYPE"
label="品牌类型"
options={brandList}
/>
</Col>
<Col span={12}>
<ProFormText
name="BRAND_INTRO"
label="品牌图标"
/>
</Col>
<Col span={12}>
<ProFormSelect
name="BRAND_STATE"
label="有效状态"
options={[
{ label: "有效", value: 1 },
{ label: "无效", value: 0 },
]}
/>
</Col>
<Col span={24}>
<ProFormTextArea
name="BRAND_DESC"
label="品牌介绍"
/>
</Col>
</Row>
</ProForm>
</Modal>
</div>
)
}
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(MallBrandManage);

View File

@ -1 +1,439 @@
// 商城分类管理 // 商城分类管理
import React, { useRef, useState, Suspense } from 'react';
import moment from 'moment'; // 时间相关引用,没有使用可以删除
import numeral from "numeral"; // 数字相关引用,没有使用可以删除
import { connect } from 'umi';
import useRequest from '@ahooksjs/use-request'; // 请求数据的引用
import Draggable from 'react-draggable';
import SubMenu from "antd/lib/menu/SubMenu";
import ProTable from '@ant-design/pro-table';
import ProDescriptions from '@ant-design/pro-descriptions';
import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton } from '@ant-design/pro-form';
import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-layout';
import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd';
import type { CurrentUser } from "umi";
import type { ConnectState } from '@/models/connect';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import type { FormInstance } from 'antd';
import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除
import { handlGetUSERDEFINEDTYPEList } from '../service';
const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
const { currentUser } = props
const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const [currentRow, setCurrentRow] = useState<any>();
const [showDetail, setShowDetail] = useState<boolean>();
const [modalVisible, handleModalVisible] = useState<boolean>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
const [searchParams, setSearchParams] = useState<any>();
// 弹出框拖动效果
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
const draggleRef = React.createRef<any>()
const onDraggaleStart = (event, uiData) => {
const { clientWidth, clientHeight } = window.document.documentElement;
const targetRect = draggleRef.current?.getBoundingClientRect();
if (!targetRect) {
return;
}
setBounds({
left: -targetRect.left + uiData.x,
right: clientWidth - (targetRect.right - uiData.x),
top: -targetRect.top + uiData.y,
bottom: clientHeight - (targetRect.bottom - uiData.y),
});
};
// 拖动结束
// 定义列表字段内容
const columns = [
{
dataIndex: 'USERDEFINEDTYPE_NAME',
title: '类别名称',
align: 'center',
hideInSearch: true,
hideInDescriptions: true,
},
{
dataIndex: 'USERDEFINEDTYPE_INDEX',
title: '类别索引',
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'USERDEFINEDTYPE_STATE',
title: '有效状态',
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'OWNERUNIT_NAME',
title: '业主单位',
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'option',
title: '操作',
valueType: 'option',
hideInSearch: true,
render: (_, record) => {
return (
<Space>
<a
onClick={() => {
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>
</a>
<Popconfirm
title="确认删除该商品自定义类别列表信息吗?"
onConfirm={async () => {
handelDelete(record.USERDEFINEDTYPE_ID);
}}
>
<a></a>
</Popconfirm>
</Space>
);
},
},
];
return (
<PageContainer header={{
title: '',
breadcrumb: {}
}}>
<ProTable
style={{ height: 'calc(100vh - 135px)', background: '#fff' }}
scroll={{ y: 'calc(100vh - 410px)' }}
rowKey={(record) => {
return `${record?.USERDEFINEDTYPE_ID}`
}}
formRef={formRef}
headerTitle="商品自定义类别列表" // 列表表头
actionRef={actionRef}
search={{ span: 6, labelWidth: 'auto' }}
// 请求数据
request={async (params, sorter) => {
const req = {
searchParameter: {
},
PageIndex: 1,
PageSize: 999999
}
const data = await handlGetUSERDEFINEDTYPEList(req);
console.log('datadatadatadatadata', data);
if (data.List && data.List.length > 0) {
return { data: data.List, success: true, total: data.TotalCount }
}
return { data: [], success: true }
}}
columns={columns}
toolbar={{
actions: [
// 新增按钮
<Button
key="new"
icon={<PlusOutlined />}
type="primary"
onClick={() => {
handleModalVisible(true);
}}
>
</Button>,
],
}}
pagination={{ defaultPageSize: 10 }}
/>
<Modal
title={
<div
style={{
width: '100%',
cursor: 'move',
}}
onMouseOver={() => {
if (disabled) {
setDraggleDisabled(false)
}
}}
onMouseOut={() => {
setDraggleDisabled(true)
}}
onFocus={() => { }}
onBlur={() => { }}
>
{currentRow ? '更新商品自定义类别' : '新建商品自定义类别'}
</div>
}
destroyOnClose={true}
width={900}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
formRef.current?.resetFields();
setCurrentRow(undefined);
}}
onCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
}}
onOk={async () => { // 提交框内的数据
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
modalRender={(modal) => {
return <Draggable
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
}}
>
<ProForm
layout={'horizontal'}
formRef={formRef}
autoFocusFirstInput
submitter={false}
preserve={false}
initialValues={currentRow}
onFinish={async (values) => {
let newValue = { ...values };
if (currentRow) {
// 编辑数据
newValue = { ...values, USERDEFINEDTYPE_ID: currentRow.USERDEFINEDTYPE_ID };
}
// 如果有开关,要把开关的代码写进去
handleAddUpdate(newValue);
handleConfirmLoading(false)
}}
>
<Row>
<Col span={12}>
<ProFormSelect
name="USERDEFINEDTYPE_PID"
label="上级内码"
/>
</Col>
<Col span={12}>
<ProFormText
name="USERDEFINEDTYPE_NAME"
label="类别名称"
/>
</Col>
<Col span={12}>
<ProFormText
name="PROVINCE_CODE"
label="省份编码"
/>
</Col>
<Col span={12}>
<ProFormText
name="SERVERPARTCODE"
label="服务区编码"
/>
</Col>
<Col span={12}>
<ProFormText
name="SERVERPART_NAME"
label="服务区名称"
/>
</Col>
<Col span={12}>
<ProFormText
name="SHOPCODE"
label="门店编码"
/>
</Col>
<Col span={12}>
<ProFormText
name="SHOPNAME"
label="门店名称"
/>
</Col>
<Col span={12}>
<ProFormSelect
name="BUSINESSTYPE"
label="业态"
/>
</Col>
<Col span={12}>
<ProFormMoney
width="lg"
fieldProps={{
moneySymbol: false,
}}
name="SCANCODE_ORDER"
label="扫码点餐"
/>
</Col>
<Col span={12}>
<ProFormDatePicker
name="USERDEFINEDTYPE_DATE"
label="添加时间"
width="lg"
/>
</Col>
<Col span={12}>
<ProFormMoney
name="USERDEFINEDTYPE_INDEX"
label="类别索引"
/>
</Col>
<Col span={12}>
<ProFormSelect
name="USERDEFINEDTYPE_STATE"
label="有效状态"
/>
</Col>
<Col span={12}>
<ProFormText
name="STAFF_NAME"
label="操作人员名称"
/>
</Col>
<Col span={12}>
<ProFormDatePicker
name="OPERATE_DATE"
label="操作时间"
width="lg"
/>
</Col>
<Col span={24}>
<ProFormTextArea
name="USERDEFINEDTYPE_DESC"
label="备注"
/>
</Col>
<Col span={12}>
<ProFormSelect
name="GOODSTYPE"
label="数据类型 "
/>
</Col>
<Col span={12}>
<ProFormText
name="MERCHANTS_NAME"
label="商户名称"
/>
</Col>
<Col span={12}>
<ProFormText
name="WECHATAPPSIGN_NAME"
label="小程序名字"
/>
</Col>
<Col span={12}>
<ProFormSelect
name="WECHATAPP_APPID"
label="小程序APPID"
/>
</Col>
<Col span={12}>
<ProFormText
name="OWNERUNIT_NAME"
label="业主单位"
/>
</Col>
<Col span={12}>
<ProFormSelect
name="PRESALE_TYPE"
label="是否预售"
/>
</Col>
<Col span={12}>
<ProFormMoney
name="PRESALE_STARTTIME"
label="预售开始时间"
/>
</Col>
<Col span={12}>
<ProFormMoney
name="PRESALE_ENDTIME"
label="预售结束时间"
/>
</Col>
<Col style={{ display: 'none' }}>
<ProFormText
name="USERDEFINEDTYPE_ID"
label="内码"
/>
</Col>
<Col style={{ display: 'none' }}>
<ProFormText
name="SERVERPART_ID"
label="服务区内码"
/>
</Col>
<Col style={{ display: 'none' }}>
<ProFormText
name="SERVERPARTSHOP_ID"
label="门店内码"
/>
</Col>
<Col style={{ display: 'none' }}>
<ProFormText
name="STAFF_ID"
label="操作人员内码"
/>
</Col>
<Col style={{ display: 'none' }}>
<ProFormText
name="MERCHANTS_ID"
label="商户ID"
/>
</Col>
<Col style={{ display: 'none' }}>
<ProFormText
name="WECHATAPPSIGN_ID"
label="小程序内码"
/>
</Col>
<Col style={{ display: 'none' }}>
<ProFormText
name="OWNERUNIT_ID"
label="业主内码"
/>
</Col>
<Col style={{ display: 'none' }}>
<ProFormText
name="USERDEFINEDTYPE_ICO"
label="图标地址"
/>
</Col>
</Row>
</ProForm>
</Modal>
</PageContainer>
);
};
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(MallClassificationManage);

View File

@ -1 +1,364 @@
// 商品规格管理 // 商品规格管理
import React, { useRef, useState, Suspense } from 'react';
import moment from 'moment'; // 时间相关引用,没有使用可以删除
import numeral from "numeral"; // 数字相关引用,没有使用可以删除
import { connect } from 'umi';
import useRequest from '@ahooksjs/use-request'; // 请求数据的引用
import Draggable from 'react-draggable';
import SubMenu from "antd/lib/menu/SubMenu";
import ProTable from '@ant-design/pro-table';
import ProDescriptions from '@ant-design/pro-descriptions';
import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton } from '@ant-design/pro-form';
import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-layout';
import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd';
import type { CurrentUser } from "umi";
import type { ConnectState } from '@/models/connect';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import type { FormInstance } from 'antd';
import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除
import PageTitleBox from "@/components/PageTitleBox";
const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
const { currentUser } = props
const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const [currentRow, setCurrentRow] = useState<any>();
const [showDetail, setShowDetail] = useState<boolean>();
const [modalVisible, handleModalVisible] = useState<boolean>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
const [searchParams, setSearchParams] = useState<any>();
// 弹出框拖动效果
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
const draggleRef = React.createRef<any>()
const onDraggaleStart = (event, uiData) => {
const { clientWidth, clientHeight } = window.document.documentElement;
const targetRect = draggleRef.current?.getBoundingClientRect();
if (!targetRect) {
return;
}
setBounds({
left: -targetRect.left + uiData.x,
right: clientWidth - (targetRect.right - uiData.x),
top: -targetRect.top + uiData.y,
bottom: clientHeight - (targetRect.bottom - uiData.y),
});
};
// 定义列表字段内容
const columns: any = [
{
dataIndex: 'PROVINCE_CODE',
title: '省份编码',
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'COMMODITY_NAME',
title: '商品名称',
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'USERDEFINEDTYPE_NAME',
title: '类别名称',
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'COMMODITY_STATE',
title: '商品状态',
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'OPERATE_DATE',
title: '操作时间',
valueType: 'fromNow',
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'COMMODITY_DESC',
title: '备注说明',
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'STAFF_NAME',
title: '操作员名称',
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'option',
title: '操作',
valueType: 'option',
hideInSearch: true,
render: (_, record) => {
return (
<Space>
<a
onClick={() => {
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>
</a>
<Popconfirm
title="确认删除该商品多规格列表信息吗?"
onConfirm={async () => {
await handelDelete(record.COMMODITY_MULTI_ID);
}}
>
<a></a>
</Popconfirm>
</Space>
);
},
},
];
// const handelDelete = async (commodity_multiid: number) => {
// const result = await delcommodity_multi({ commodity_multiid: commodity_multiid });
// if (result.Result_Code !== 100) {
// message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`);
// } else {
// message.success('删除成功!');
// actionRef.current?.reload()
// }
// };
// const handleAddUpdate = async (fields: COMMODITY_MULTIModel) => {
// const hide = message.loading('正在提交...');
// const result = await updatecommodity_multi(fields);
// hide();
// if (result.Result_Code !== 100) {
// message.error(`${result.Result_Desc}` || `${result.Result_Code}:提交失败`);
// return false;
// }
// return result.Result_Data ? result.Result_Data : true;
// };
return (
<div>
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
<ProTable<COMMODITY_MULTIModel>
style={{ height: 'calc(100vh - 135px)', background: '#fff' }}
scroll={{ y: 'calc(100vh - 410px)' }}
rowKey={(record) => {
return `${record?.COMMODITY_MULTI_ID}`
}}
formRef={formRef}
headerTitle={<PageTitleBox props={props} />} // 列表表头
actionRef={actionRef}
search={{ span: 6, labelWidth: 'auto' }}
// 请求数据
request={async (params, sorter) => {
const searchWholeParams = {
searchParameter: { ...params },
sortstr: sortstr.length ? sortstr.toString() : "",
pagesize: 999999
}
setSearchParams(searchWholeParams)
const data = await getList(searchWholeParams);
return data;
}}
columns={columns}
toolbar={{
actions: [
// 新增按钮
<Button
key="new"
icon={<PlusOutlined />}
type="primary"
onClick={() => {
handleModalVisible(true);
}}
>
</Button>,
],
}}
/>
<Modal
title={
<div
style={{
width: '100%',
cursor: 'move',
}}
onMouseOver={() => {
if (disabled) {
setDraggleDisabled(false)
}
}}
onMouseOut={() => {
setDraggleDisabled(true)
}}
onFocus={() => { }}
onBlur={() => { }}
>
{currentRow ? '更新商品多规格' : '新建商品多规格'}
</div>
}
destroyOnClose={true}
width={900}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
formRef.current?.resetFields();
setCurrentRow(undefined);
}}
onCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
}}
onOk={async () => { // 提交框内的数据
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
modalRender={(modal) => {
return <Draggable
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
}}
>
<ProForm
layout={'horizontal'}
wrapperCol={{ span: 16 }} // 表单项 填写部分所占的栅格数
labelCol={{ span: 6 }} // 表单项 标题所占的栅格数
formRef={formRef}
autoFocusFirstInput
submitter={false}
preserve={false}
initialValues={currentRow}
onFinish={async (values) => {
let newValue: COMMODITY_MULTIModel = { ...values };
if (currentRow) {
// 编辑数据
newValue = { ...values, COMMODITY_MULTI_ID: currentRow.COMMODITY_MULTI_ID };
}
// 如果有开关,要把开关的代码写进去
const success = await handleAddUpdate(newValue as COMMODITY_MULTIModel);
handleConfirmLoading(false)
if (success) {
if (actionRef.current) {
actionRef.current.reload();
}
handleModalVisible(false);
}
}}
>
<Row>
<Col span={12}>
<ProFormMoney
width="lg"
fieldProps={{
moneySymbol: false,
}}
name="PROVINCE_CODE"
label="省份编码"
/>
</Col>
<Col span={12}>
<ProFormText
name="COMMODITY_NAME"
label="商品名称"
/>
</Col>
<Col span={12}>
<ProFormText
name="USERDEFINEDTYPE_NAME"
label="类别名称"
/>
</Col>
<Col span={12}>
<ProFormSelect
name="COMMODITY_STATE"
label="商品状态"
/>
</Col>
<Col span={12}>
<ProFormDatePicker
name="OPERATE_DATE"
label="操作时间"
width="lg"
/>
</Col>
<Col span={24}>
<ProFormTextArea
name="COMMODITY_DESC"
label="备注说明"
labelCol={{ span: 3 }}
wrapperCol={{ span: 20 }}
/>
</Col>
<Col span={12}>
<ProFormText
name="STAFF_NAME"
label="操作员名称"
/>
</Col>
<Col style={{ display: 'none' }}>
<ProFormText
name="COMMODITY_MULTI_ID"
label="多规格内码"
/>
</Col>
<Col style={{ display: 'none' }}>
<ProFormText
name="SERVERPART_ID"
label="服务区内码"
/>
</Col>
<Col style={{ display: 'none' }}>
<ProFormText
name="SERVERPARTSHOP_ID"
label="门店内码"
/>
</Col>
<Col style={{ display: 'none' }}>
<ProFormText
name="USERDEFINEDTYPE_ID"
label="类别内码"
/>
</Col>
<Col style={{ display: 'none' }}>
<ProFormText
name="STAFF_ID"
label="操作员"
/>
</Col>
</Row>
</ProForm>
</Modal>
</div>
</div>
);
};
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(ProductSpecificationManage);

View File

@ -164,3 +164,53 @@ export async function handleDeleteMEMBERADDRESS(params: any) {
} }
return data return data
} }
// 获取品牌管理列表
export async function handleGetBRANDList(params: any) {
const data = await requestEncryption(`/BaseInfo/GetBRANDList`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return []
}
return data
}
// 同步品牌信息
export async function handleSynchroBRAND(params: any) {
const data = await requestEncryption(`/MallBasic/SynchroBRAND`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return []
}
return data
}
// 删除品牌信息
export async function handlDeleteBRAND(params: any) {
const data = await requestEncryption(`/MallBasic/DeleteBRAND`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return []
}
return data
}
// 获取商城分类管理
export async function handlGetUSERDEFINEDTYPEList(params: any) {
const data = await requestEncryption(`/MemberBasic/GetUSERDEFINEDTYPEList`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return []
}
return data
}