update
This commit is contained in:
parent
a9f9af33ec
commit
89b5e5a985
@ -250,6 +250,51 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 质量等级
|
||||||
|
getFieldEnumTree({ FieldExplainField: 'COMMODITYGRADE' }).then((COMMODITYGRADE: any) => {
|
||||||
|
if (COMMODITYGRADE && COMMODITYGRADE.length > 0) {
|
||||||
|
const obj: any = {}
|
||||||
|
const list: any = []
|
||||||
|
COMMODITYGRADE.forEach((item: any) => {
|
||||||
|
list.push({ label: item.label, value: item.value })
|
||||||
|
obj[item.value] = item.label
|
||||||
|
})
|
||||||
|
session.set('COMMODITYGRADEList', list);
|
||||||
|
session.set('COMMODITYGRADEObj', obj);
|
||||||
|
session.set('COMMODITYGRADETree', COMMODITYGRADE);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 商品属性
|
||||||
|
getFieldEnumTree({ FieldExplainField: 'COMMODITY_NATURE' }).then((COMMODITYNATURE: any) => {
|
||||||
|
if (COMMODITYNATURE && COMMODITYNATURE.length > 0) {
|
||||||
|
const obj: any = {}
|
||||||
|
const list: any = []
|
||||||
|
COMMODITYNATURE.forEach((item: any) => {
|
||||||
|
list.push({ label: item.label, value: item.value })
|
||||||
|
obj[item.value] = item.label
|
||||||
|
})
|
||||||
|
session.set('CCOMMODITYNATUREList', list);
|
||||||
|
session.set('COMMODITYNATUREObj', obj);
|
||||||
|
session.set('COMMODITYNATURETree', COMMODITYNATURE);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 消费模式
|
||||||
|
getFieldEnumTree({ FieldExplainField: 'PAY_METHOD' }).then((PAYMETHOD: any) => {
|
||||||
|
if (PAYMETHOD && PAYMETHOD.length > 0) {
|
||||||
|
const obj: any = {}
|
||||||
|
const list: any = []
|
||||||
|
PAYMETHOD.forEach((item: any) => {
|
||||||
|
list.push({ label: item.label, value: item.value })
|
||||||
|
obj[item.value] = item.label
|
||||||
|
})
|
||||||
|
session.set('PAYMETHODList', list);
|
||||||
|
session.set('PAYMETHODObj', obj);
|
||||||
|
session.set('PAYMETHODTree', PAYMETHOD);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
// 消费类型
|
// 消费类型
|
||||||
@ -267,6 +312,22 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 商品税率
|
||||||
|
getFieldEnumTree({ FieldExplainField: 'DUTY_PARAGRAPH' }).then((DUTYPARAGRAPH: any) => {
|
||||||
|
if (DUTYPARAGRAPH && DUTYPARAGRAPH.length > 0) {
|
||||||
|
const obj: any = {}
|
||||||
|
const list: any = []
|
||||||
|
DUTYPARAGRAPH.forEach((item: any) => {
|
||||||
|
list.push({ label: item.label, value: item.value })
|
||||||
|
obj[item.value] = item.label
|
||||||
|
})
|
||||||
|
session.set('DUTYPARAGRAPHList', list);
|
||||||
|
session.set('DUTYPARAGRAPHObj', obj);
|
||||||
|
session.set('DUTYPARAGRAPHTree', DUTYPARAGRAPH);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// 会员类型的枚举
|
// 会员类型的枚举
|
||||||
// const MEMBERSHIPTYPE =
|
// const MEMBERSHIPTYPE =
|
||||||
getFieldEnumTree({ FieldExplainField: 'MEMBERSHIP_TYPE' }).then((MEMBERSHIPTYPE: any) => {
|
getFieldEnumTree({ FieldExplainField: 'MEMBERSHIP_TYPE' }).then((MEMBERSHIPTYPE: any) => {
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import type { FormInstance } from 'antd';
|
|||||||
import { handleDeleteSERVERPARTSELLER, handleGetMEMBERADDRESSList, handleGetRelateShopToSeller, handleGetSERVERPARTSELLERDetail, handleGetSERVERPARTSHOPList, handleRemoveShopFromSeller, handleSynchroSERVERPARTSELLER } from '../service';
|
import { handleDeleteSERVERPARTSELLER, handleGetMEMBERADDRESSList, handleGetRelateShopToSeller, handleGetSERVERPARTSELLERDetail, handleGetSERVERPARTSHOPList, handleRemoveShopFromSeller, handleSynchroSERVERPARTSELLER } from '../service';
|
||||||
import LeftSelectTree from '@/pages/reports/settlementAccount/component/leftSelectTree';
|
import LeftSelectTree from '@/pages/reports/settlementAccount/component/leftSelectTree';
|
||||||
import session from '@/utils/session';
|
import session from '@/utils/session';
|
||||||
|
import PageTitleBox from '@/components/PageTitleBox';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -512,7 +513,7 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
|
|||||||
}}
|
}}
|
||||||
bordered
|
bordered
|
||||||
formRef={formRef}
|
formRef={formRef}
|
||||||
headerTitle="服务区商家信息列表" // 列表表头
|
headerTitle={<PageTitleBox props={props} />} // 列表表头
|
||||||
actionRef={actionRef}
|
actionRef={actionRef}
|
||||||
search={{ span: 6, labelWidth: 'auto' }}
|
search={{ span: 6, labelWidth: 'auto' }}
|
||||||
// 请求数据
|
// 请求数据
|
||||||
|
|||||||
@ -16,8 +16,9 @@ import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSele
|
|||||||
import { handlDeleteBRAND, handleGetBRANDList, handleSynchroBRAND } from "../service";
|
import { handlDeleteBRAND, handleGetBRANDList, handleSynchroBRAND } from "../service";
|
||||||
import session from "@/utils/session";
|
import session from "@/utils/session";
|
||||||
import Draggable from "react-draggable";
|
import Draggable from "react-draggable";
|
||||||
import ProForm, { ProFormDatePicker, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea } from "@ant-design/pro-form";
|
import ProForm, { ProFormDatePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea } from "@ant-design/pro-form";
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
|
import PageTitleBox from "@/components/PageTitleBox";
|
||||||
|
|
||||||
|
|
||||||
const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
|
const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
|
||||||
@ -50,7 +51,7 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
|
|||||||
const [currentRow, setCurrentRow] = useState<any>();
|
const [currentRow, setCurrentRow] = useState<any>();
|
||||||
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
|
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
|
||||||
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
|
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
|
||||||
|
const [selectBrandList, setSelectBrandList] = useState<any>([])
|
||||||
|
|
||||||
const onDraggaleStart = (event, uiData) => {
|
const onDraggaleStart = (event, uiData) => {
|
||||||
const { clientWidth, clientHeight } = window.document.documentElement;
|
const { clientWidth, clientHeight } = window.document.documentElement;
|
||||||
@ -78,7 +79,6 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
|
|||||||
title: '品牌名称',
|
title: '品牌名称',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 150,
|
width: 150,
|
||||||
hideInSearch: true,
|
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -88,7 +88,8 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
|
|||||||
valueType: 'select',
|
valueType: 'select',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
valueEnum: BRANDCATEGORYObj
|
valueEnum: BRANDCATEGORYObj,
|
||||||
|
hideInSearch: true,
|
||||||
// request: async () => {
|
// request: async () => {
|
||||||
// return await getFieldEnumTree({ FieldExplainField: 'BRAND_CATEGORY', sessionName: 'BRAND_CATEGORY' });
|
// return await getFieldEnumTree({ FieldExplainField: 'BRAND_CATEGORY', sessionName: 'BRAND_CATEGORY' });
|
||||||
// },
|
// },
|
||||||
@ -98,23 +99,15 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
|
|||||||
// </a>
|
// </a>
|
||||||
// },
|
// },
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
dataIndex: 'BRAND_TYPE',
|
// dataIndex: 'BRAND_TYPE',
|
||||||
title: '品牌类型',
|
// title: '品牌类型',
|
||||||
valueType: 'select',
|
// valueType: 'select',
|
||||||
align: 'center',
|
// align: 'center',
|
||||||
width: 120,
|
// width: 120,
|
||||||
ellipsis: true,
|
// ellipsis: true,
|
||||||
valueEnum: brandObj
|
// 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',
|
dataIndex: 'BRAND_STATE',
|
||||||
title: '有效状态',
|
title: '有效状态',
|
||||||
@ -157,7 +150,7 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
|
|||||||
<Popconfirm
|
<Popconfirm
|
||||||
title="确认删除该品牌列表信息吗?"
|
title="确认删除该品牌列表信息吗?"
|
||||||
onConfirm={async () => {
|
onConfirm={async () => {
|
||||||
// await handelDelete(record.BRAND_ID);
|
await handelDelete(record.BRAND_ID);
|
||||||
}}>
|
}}>
|
||||||
<a>删除</a>
|
<a>删除</a>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
@ -171,7 +164,7 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
|
|||||||
const handelDelete = async (id: number) => {
|
const handelDelete = async (id: number) => {
|
||||||
console.log('fjsdfsdflksa', id);
|
console.log('fjsdfsdflksa', id);
|
||||||
const req: any = {
|
const req: any = {
|
||||||
SERVERPARTSELLERId: id
|
BRANDId: id
|
||||||
}
|
}
|
||||||
const result = await handlDeleteBRAND(req)
|
const result = await handlDeleteBRAND(req)
|
||||||
if (result.Result_Code !== 100) {
|
if (result.Result_Code !== 100) {
|
||||||
@ -188,27 +181,29 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
|
|||||||
req = {
|
req = {
|
||||||
...currentRow,
|
...currentRow,
|
||||||
...res,
|
...res,
|
||||||
UPDATE_STAFF_ID: currentUser?.ID,
|
BRAND_CATEGORY: 2000,
|
||||||
UPDATE_STAFF_NAME: currentUser?.Name,
|
PROVINCE_CODE: currentUser?.ProvinceCode,
|
||||||
UPDATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
|
STAFF_ID: currentUser?.ID,
|
||||||
|
STAFF_NAME: currentUser?.Name,
|
||||||
|
OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
req = {
|
req = {
|
||||||
...res,
|
...res,
|
||||||
|
BRAND_CATEGORY: 2000,
|
||||||
PROVINCE_CODE: currentUser?.ProvinceCode,
|
PROVINCE_CODE: currentUser?.ProvinceCode,
|
||||||
ISVALID: 1,
|
STAFF_ID: currentUser?.ID,
|
||||||
CREATE_STAFF_ID: currentUser?.ID,
|
STAFF_NAME: currentUser?.Name,
|
||||||
CREATE_STAFF_NAME: currentUser?.Name,
|
OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
CREATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await handleSynchroBRAND(req)
|
const data = await handleSynchroBRAND(req)
|
||||||
handleConfirmLoading(false)
|
handleConfirmLoading(false)
|
||||||
if (data.Result_Code === 100) {
|
if (data.Result_Code === 100) {
|
||||||
message.success(data.Result_Desc)
|
message.success("新增成功!")
|
||||||
formRef?.current?.resetFields()
|
|
||||||
setCurrentRow(undefined)
|
setCurrentRow(undefined)
|
||||||
|
formRef?.current?.resetFields()
|
||||||
handleModalVisible(false)
|
handleModalVisible(false)
|
||||||
actionRef.current?.reload()
|
actionRef.current?.reload()
|
||||||
} else {
|
} else {
|
||||||
@ -240,23 +235,38 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
|
|||||||
expandable={{
|
expandable={{
|
||||||
expandRowByClick: true
|
expandRowByClick: true
|
||||||
}}
|
}}
|
||||||
headerTitle={<span style={{ color: "#1890ff", fontSize: 14, fontWeight: 600 }}>单品销售排行统计</span>}
|
|
||||||
search={{ span: 6 }}
|
search={{ span: 6 }}
|
||||||
|
rowKey={(record: any) => {
|
||||||
|
return `${record.BRAND_PID}-${record.BRAND_ID}`
|
||||||
|
}}
|
||||||
|
scroll={{ x: "100%", y: "calc(100vh - 410px)" }}
|
||||||
|
headerTitle={<PageTitleBox props={props} />} // 列表表头
|
||||||
request={async (params) => {
|
request={async (params) => {
|
||||||
|
|
||||||
setSearchParams(params)
|
setSearchParams(params)
|
||||||
const req: any = {
|
const req: any = {
|
||||||
searchParameter: {
|
searchParameter: {
|
||||||
OWNERUNIT_ID: currentUser?.OwnerUnitId,
|
OWNERUNIT_ID: currentUser?.OwnerUnitId,
|
||||||
PROVINCE_CODE: currentUser?.ProvinceCode,
|
PROVINCE_CODE: currentUser?.ProvinceCode,
|
||||||
|
BRAND_TYPE: params?.BRAND_TYPE,
|
||||||
|
BRAND_STATE: 1,
|
||||||
BRAND_CATEGORY: 2000
|
BRAND_CATEGORY: 2000
|
||||||
},
|
},
|
||||||
|
keyWord: {
|
||||||
|
key: "BRAND_NAME",
|
||||||
|
value: params?.BRAND_NAME
|
||||||
|
},
|
||||||
PageIndex: 1,
|
PageIndex: 1,
|
||||||
PageSize: 999999,
|
PageSize: 999999,
|
||||||
|
SortStr: "BRAND_INDEX,OPERATE_DATE"
|
||||||
}
|
}
|
||||||
const data = await handleGetBRANDList(req)
|
const data = await handleGetBRANDList(req)
|
||||||
console.log('datadatadatadatadata', data);
|
console.log('datadatadatadatadata', data);
|
||||||
if (data.List && data.List.length > 0) {
|
if (data.List && data.List.length > 0) {
|
||||||
|
let brandSelectList: any = []
|
||||||
|
data.List.forEach((item: any) => {
|
||||||
|
brandSelectList.push({ label: item.BRAND_NAME, value: item.BRAND_ID })
|
||||||
|
})
|
||||||
|
setSelectBrandList(brandSelectList)
|
||||||
return { data: data.List, success: true, total: data.TotalCount }
|
return { data: data.List, success: true, total: data.TotalCount }
|
||||||
}
|
}
|
||||||
return { data: [], success: true }
|
return { data: [], success: true }
|
||||||
@ -303,7 +313,7 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
destroyOnClose={true}
|
destroyOnClose={true}
|
||||||
width={900}
|
width={500}
|
||||||
visible={modalVisible}
|
visible={modalVisible}
|
||||||
confirmLoading={confirmLoading}
|
confirmLoading={confirmLoading}
|
||||||
afterClose={() => {
|
afterClose={() => {
|
||||||
@ -337,58 +347,82 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
|
|||||||
autoFocusFirstInput
|
autoFocusFirstInput
|
||||||
submitter={false}
|
submitter={false}
|
||||||
preserve={false}
|
preserve={false}
|
||||||
initialValues={currentRow}
|
initialValues={currentRow ? currentRow : {
|
||||||
|
BRAND_PID: -1, // 默认上级内码为-1
|
||||||
|
BRAND_STATE: 1, // 默认有效状态为1
|
||||||
|
}}
|
||||||
onFinish={async (values) => {
|
onFinish={async (values) => {
|
||||||
let newValue: any = { ...values };
|
let newValue: any = { ...values };
|
||||||
if (currentRow) {
|
if (currentRow) {
|
||||||
// 编辑数据
|
// 编辑数据
|
||||||
newValue = { ...values, BRAND_ID: currentRow.BRAND_ID };
|
newValue = { ...values, BRAND_ID: currentRow.BRAND_ID };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
console.log('newValuenewValue', newValue);
|
||||||
|
|
||||||
// 如果有开关,要把开关的代码写进去
|
// 如果有开关,要把开关的代码写进去
|
||||||
await handleAddUpdate(newValue);
|
await handleAddUpdate(newValue);
|
||||||
handleConfirmLoading(false)
|
handleConfirmLoading(false)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Row gutter={8}>
|
<Row gutter={8}>
|
||||||
<Col span={12}>
|
<Col span={24}>
|
||||||
<ProFormSelect
|
<ProFormSelect
|
||||||
name="BRAND_PID"
|
name="BRAND_PID"
|
||||||
label="上级内码"
|
label="上级内码"
|
||||||
|
request={async () => {
|
||||||
|
if (selectBrandList && selectBrandList.length > 0) {
|
||||||
|
let list: any = [{ label: "默认类别", value: -1 }, ...selectBrandList]
|
||||||
|
return list
|
||||||
|
} else {
|
||||||
|
const req: any = {
|
||||||
|
searchParameter: {
|
||||||
|
OWNERUNIT_ID: currentUser?.OwnerUnitId,
|
||||||
|
PROVINCE_CODE: currentUser?.ProvinceCode,
|
||||||
|
BRAND_CATEGORY: 2000
|
||||||
|
},
|
||||||
|
PageIndex: 1,
|
||||||
|
PageSize: 999999,
|
||||||
|
}
|
||||||
|
const data = await handleGetBRANDList(req)
|
||||||
|
if (data.List && data.List.length > 0) {
|
||||||
|
let brandSelectList: any = []
|
||||||
|
data.List.forEach((item: any) => {
|
||||||
|
brandSelectList.push({ label: item.BRAND_NAME, value: item.BRAND_ID })
|
||||||
|
})
|
||||||
|
setSelectBrandList(brandSelectList)
|
||||||
|
brandSelectList.unshirft({ label: "默认类别", value: -1 })
|
||||||
|
return brandSelectList
|
||||||
|
} else {
|
||||||
|
return [{ label: "默认类别", value: -1 }]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
fieldProps={{
|
||||||
|
showSearch: true,
|
||||||
|
filterOption: (input, option) =>
|
||||||
|
(option?.label ?? '').toLowerCase().includes(input.toLowerCase())
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={24}>
|
||||||
<ProFormMoney
|
<ProFormDigit
|
||||||
name="BRAND_INDEX"
|
name="BRAND_INDEX"
|
||||||
label="品牌索引"
|
label="品牌索引"
|
||||||
|
fieldProps={{
|
||||||
|
precision: 0, // 只允许整数
|
||||||
|
min: -1, // 可选:最小值
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={24}>
|
||||||
<ProFormText
|
<ProFormText
|
||||||
name="BRAND_NAME"
|
name="BRAND_NAME"
|
||||||
label="品牌名称"
|
label="品牌名称"
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={24}>
|
||||||
<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
|
<ProFormSelect
|
||||||
name="BRAND_STATE"
|
name="BRAND_STATE"
|
||||||
label="有效状态"
|
label="有效状态"
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import Draggable from 'react-draggable';
|
|||||||
import SubMenu from "antd/lib/menu/SubMenu";
|
import SubMenu from "antd/lib/menu/SubMenu";
|
||||||
import ProTable from '@ant-design/pro-table';
|
import ProTable from '@ant-design/pro-table';
|
||||||
import ProDescriptions from '@ant-design/pro-descriptions';
|
import ProDescriptions from '@ant-design/pro-descriptions';
|
||||||
import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton } from '@ant-design/pro-form';
|
import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDateTimeRangePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form';
|
||||||
import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
|
import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
|
||||||
import { PageContainer } from '@ant-design/pro-layout';
|
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 { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd';
|
||||||
@ -21,11 +21,28 @@ import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
|
|||||||
import type { FormInstance } from 'antd';
|
import type { FormInstance } from 'antd';
|
||||||
|
|
||||||
import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除
|
import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除
|
||||||
import { handlGetUSERDEFINEDTYPEList } from '../service';
|
import { handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUSERDEFINEDTYPE } from '../service';
|
||||||
|
import PageTitleBox from '@/components/PageTitleBox';
|
||||||
|
import { uploadPicture } from '@/services/picture';
|
||||||
|
import defaultIcon from '../../../assets/brand/defaultIcon.png'
|
||||||
|
|
||||||
|
|
||||||
|
const beforeUpload = (file: any) => {
|
||||||
|
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
|
||||||
|
if (!isJpgOrPng) {
|
||||||
|
message.error('请上传JPEG、jpg、png格式的图片文件!');
|
||||||
|
}
|
||||||
|
const isLt2M = file.size / 1024 / 1024 < 2;
|
||||||
|
if (!isLt2M) {
|
||||||
|
message.error('图片大小不超过 2MB!');
|
||||||
|
}
|
||||||
|
return isJpgOrPng && isLt2M;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
|
const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
|
||||||
const { currentUser } = props
|
const { currentUser } = props
|
||||||
|
const { confirm } = Modal;
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
const formRef = useRef<FormInstance>();
|
const formRef = useRef<FormInstance>();
|
||||||
const [currentRow, setCurrentRow] = useState<any>();
|
const [currentRow, setCurrentRow] = useState<any>();
|
||||||
@ -33,12 +50,20 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
|
|||||||
const [modalVisible, handleModalVisible] = useState<boolean>();
|
const [modalVisible, handleModalVisible] = useState<boolean>();
|
||||||
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
|
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
|
||||||
const [searchParams, setSearchParams] = useState<any>();
|
const [searchParams, setSearchParams] = useState<any>();
|
||||||
|
// 分类的树形结构数据
|
||||||
|
const [typeTreeData, setTypeTreeData] = useState<any>()
|
||||||
|
// 表单里面的是否预售
|
||||||
|
const [formPRESALE_TYPE, setFormPRESALE_TYPE] = useState<boolean>(false)
|
||||||
|
|
||||||
// 弹出框拖动效果
|
// 弹出框拖动效果
|
||||||
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
|
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
|
||||||
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
|
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
|
||||||
const draggleRef = React.createRef<any>()
|
const draggleRef = React.createRef<any>()
|
||||||
|
|
||||||
|
// 文件列表
|
||||||
|
const [fileList, setFileList] = useState<any>([])
|
||||||
|
const [imagePreviewVisible, setImagePreviewVisible] = useState<boolean>(false) // 预览图片
|
||||||
|
|
||||||
const onDraggaleStart = (event, uiData) => {
|
const onDraggaleStart = (event, uiData) => {
|
||||||
const { clientWidth, clientHeight } = window.document.documentElement;
|
const { clientWidth, clientHeight } = window.document.documentElement;
|
||||||
const targetRect = draggleRef.current?.getBoundingClientRect();
|
const targetRect = draggleRef.current?.getBoundingClientRect();
|
||||||
@ -55,43 +80,107 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
|
|||||||
// 拖动结束
|
// 拖动结束
|
||||||
|
|
||||||
// 定义列表字段内容
|
// 定义列表字段内容
|
||||||
const columns = [
|
const columns: any = [
|
||||||
|
// {
|
||||||
|
// title: '上级类别',
|
||||||
|
// align: 'center',
|
||||||
|
// width: 150,
|
||||||
|
// ellipsis: true,
|
||||||
|
// dataIndex: 'USERDEFINEDTYPE_PID',
|
||||||
|
// hideInSearch: true,
|
||||||
|
// hideInDescriptions: true,
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
dataIndex: 'USERDEFINEDTYPE_NAME',
|
dataIndex: 'USERDEFINEDTYPE_NAME',
|
||||||
title: '类别名称',
|
title: '类别名称',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
width: 300,
|
||||||
|
ellipsis: true,
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
hideInDescriptions: true,
|
hideInDescriptions: true,
|
||||||
|
render: (_, record) => {
|
||||||
|
return <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}>
|
||||||
|
<img style={{ width: '30px', height: '30px', marginRight: '5px', borderRadius: '50%' }} src={record?.USERDEFINEDTYPE_ICO || defaultIcon} />
|
||||||
|
<span style={{ width: '240px', display: "inline-block", whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', textAlign: 'left' }}>{record?.USERDEFINEDTYPE_NAME}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'USERDEFINEDTYPE_INDEX',
|
dataIndex: 'USERDEFINEDTYPE_INDEX',
|
||||||
title: '类别索引',
|
title: '类别索引',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
width: 120,
|
||||||
|
ellipsis: true,
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'USERDEFINEDTYPE_STATE',
|
dataIndex: 'USERDEFINEDTYPE_STATE',
|
||||||
title: '有效状态',
|
title: '有效状态',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
width: 120,
|
||||||
|
ellipsis: true,
|
||||||
|
valueType: "select",
|
||||||
|
valueEnum: {
|
||||||
|
"1": "有效",
|
||||||
|
"0": "无效"
|
||||||
|
},
|
||||||
|
initialValue: "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'SCANCODE_ORDER',
|
||||||
|
title: '上架状态',
|
||||||
|
align: 'center',
|
||||||
|
width: 120,
|
||||||
|
ellipsis: true,
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
|
valueType: "select",
|
||||||
|
valueEnum: {
|
||||||
|
"1": "上架",
|
||||||
|
"0": "下架"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: "PRESALE_TYPE",
|
||||||
|
title: "是否预售",
|
||||||
|
align: 'center',
|
||||||
|
hideInSearch: true,
|
||||||
|
width: 120,
|
||||||
|
ellipsis: true,
|
||||||
|
valueType: "select",
|
||||||
|
valueEnum: {
|
||||||
|
"0": "否",
|
||||||
|
"1": "是"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'OWNERUNIT_NAME',
|
dataIndex: 'OWNERUNIT_NAME',
|
||||||
title: '业主单位',
|
title: '业主单位',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
width: 180,
|
||||||
|
ellipsis: true,
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'option',
|
dataIndex: 'option',
|
||||||
title: '操作',
|
title: '操作',
|
||||||
|
width: 100,
|
||||||
|
ellipsis: true,
|
||||||
valueType: 'option',
|
valueType: 'option',
|
||||||
|
align: 'center',
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
return (
|
return (
|
||||||
<Space>
|
<Space>
|
||||||
|
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
console.log('recordrecordrecord', record);
|
||||||
|
if (record?.USERDEFINEDTYPE_ICO) {
|
||||||
|
setFileList([{
|
||||||
|
name: "",
|
||||||
|
url: record?.USERDEFINEDTYPE_ICO
|
||||||
|
}])
|
||||||
|
}
|
||||||
|
|
||||||
setCurrentRow({ ...record });
|
setCurrentRow({ ...record });
|
||||||
handleModalVisible(true);
|
handleModalVisible(true);
|
||||||
}}
|
}}
|
||||||
@ -102,7 +191,6 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
|
|||||||
title="确认删除该商品自定义类别列表信息吗?"
|
title="确认删除该商品自定义类别列表信息吗?"
|
||||||
onConfirm={async () => {
|
onConfirm={async () => {
|
||||||
handelDelete(record.USERDEFINEDTYPE_ID);
|
handelDelete(record.USERDEFINEDTYPE_ID);
|
||||||
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<a>删除</a>
|
<a>删除</a>
|
||||||
@ -113,6 +201,74 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// 预览上传后的图片
|
||||||
|
const handlePreview = async () => {
|
||||||
|
setFileList(fileList)
|
||||||
|
setImagePreviewVisible(true)
|
||||||
|
};
|
||||||
|
const handleChangePreview = (val: any) => {
|
||||||
|
setImagePreviewVisible(val)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除商品类别
|
||||||
|
const handelDelete = async (id: any) => {
|
||||||
|
const req: any = {
|
||||||
|
USERDEFINEDTYPEId: id
|
||||||
|
}
|
||||||
|
const result = await handlDeleteUSERDEFINEDTYPE(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?.USERDEFINEDTYPE_ID) {
|
||||||
|
req = {
|
||||||
|
...currentRow,
|
||||||
|
...res,
|
||||||
|
GOODSTYPE: 4000,
|
||||||
|
USERDEFINEDTYPE_ICO: fileList && fileList.length > 0 ? fileList[0].url : "",
|
||||||
|
PRESALE_STARTTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[0] : "",
|
||||||
|
PRESALE_ENDTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[1] : "",
|
||||||
|
PROVINCE_CODE: currentUser?.ProvinceCode,
|
||||||
|
STAFF_ID: currentUser?.ID,
|
||||||
|
STAFF_NAME: currentUser?.Name,
|
||||||
|
OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
req = {
|
||||||
|
...res,
|
||||||
|
GOODSTYPE: 4000,
|
||||||
|
USERDEFINEDTYPE_ICO: fileList && fileList.length > 0 ? fileList[0].url : "",
|
||||||
|
PRESALE_STARTTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[0] : "",
|
||||||
|
PRESALE_ENDTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[1] : "",
|
||||||
|
PROVINCE_CODE: currentUser?.ProvinceCode,
|
||||||
|
STAFF_ID: currentUser?.ID,
|
||||||
|
STAFF_NAME: currentUser?.Name,
|
||||||
|
OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
|
USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const data = await handlSynchroUSERDEFINEDTYPE(req)
|
||||||
|
handleConfirmLoading(false)
|
||||||
|
if (data.Result_Code === 100) {
|
||||||
|
message.success("新增成功!")
|
||||||
|
setCurrentRow(undefined)
|
||||||
|
formRef?.current?.resetFields()
|
||||||
|
handleModalVisible(false)
|
||||||
|
setFormPRESALE_TYPE(false)
|
||||||
|
setFileList([])
|
||||||
|
actionRef.current?.reload()
|
||||||
|
} else {
|
||||||
|
message.error(data.Result_Desc)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContainer header={{
|
<PageContainer header={{
|
||||||
title: '',
|
title: '',
|
||||||
@ -122,26 +278,27 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
|
|||||||
style={{ height: 'calc(100vh - 135px)', background: '#fff' }}
|
style={{ height: 'calc(100vh - 135px)', background: '#fff' }}
|
||||||
scroll={{ y: 'calc(100vh - 410px)' }}
|
scroll={{ y: 'calc(100vh - 410px)' }}
|
||||||
rowKey={(record) => {
|
rowKey={(record) => {
|
||||||
return `${record?.USERDEFINEDTYPE_ID}`
|
return `${record?.USERDEFINEDTYPE_PID}-${record?.USERDEFINEDTYPE_ID}`
|
||||||
}}
|
}}
|
||||||
formRef={formRef}
|
formRef={formRef}
|
||||||
headerTitle="商品自定义类别列表" // 列表表头
|
headerTitle={<PageTitleBox props={props} />} // 列表表头
|
||||||
actionRef={actionRef}
|
actionRef={actionRef}
|
||||||
search={{ span: 6, labelWidth: 'auto' }}
|
search={{ span: 6, labelWidth: 'auto' }}
|
||||||
|
bordered
|
||||||
// 请求数据
|
// 请求数据
|
||||||
request={async (params, sorter) => {
|
request={async (params, sorter) => {
|
||||||
|
|
||||||
const req = {
|
const req = {
|
||||||
searchParameter: {
|
OWNERUNIT_ID: currentUser?.OwnerUnitId,
|
||||||
|
PROVINCE_CODE: "",
|
||||||
},
|
GOODSTYPE: 4000,
|
||||||
PageIndex: 1,
|
USERDEFINEDTYPE_STATE: params?.USERDEFINEDTYPE_STATE
|
||||||
PageSize: 999999
|
// SearchKey: ""
|
||||||
}
|
}
|
||||||
const data = await handlGetUSERDEFINEDTYPEList(req);
|
const data = await handlGetUSERDEFINEDTYPEList(req);
|
||||||
console.log('datadatadatadatadata', data);
|
console.log('datadatadatadatadata', data);
|
||||||
if (data.List && data.List.length > 0) {
|
if (data && data.length > 0) {
|
||||||
return { data: data.List, success: true, total: data.TotalCount }
|
setTypeTreeData(data)
|
||||||
|
return { data: data, success: true, total: data.length }
|
||||||
}
|
}
|
||||||
return { data: [], success: true }
|
return { data: [], success: true }
|
||||||
}}
|
}}
|
||||||
@ -161,9 +318,24 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
|
|||||||
</Button>,
|
</Button>,
|
||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
pagination={{ defaultPageSize: 10 }}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{/* 图片预览组件 */}
|
||||||
|
{fileList && fileList.length > 0 && <div style={{ display: 'none' }}>
|
||||||
|
<Image.PreviewGroup
|
||||||
|
preview={{
|
||||||
|
visible: imagePreviewVisible,
|
||||||
|
onVisibleChange: vis => {
|
||||||
|
handleChangePreview(vis)
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
{
|
||||||
|
fileList.map((n) => <Image src={n.url} key={n.url} />)
|
||||||
|
}
|
||||||
|
</Image.PreviewGroup>
|
||||||
|
</div>}
|
||||||
|
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
title={
|
title={
|
||||||
<div
|
<div
|
||||||
@ -197,6 +369,8 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
|
|||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
handleConfirmLoading(false)
|
handleConfirmLoading(false)
|
||||||
handleModalVisible(false)
|
handleModalVisible(false)
|
||||||
|
setFormPRESALE_TYPE(false)
|
||||||
|
setFileList([])
|
||||||
}}
|
}}
|
||||||
|
|
||||||
onOk={async () => { // 提交框内的数据
|
onOk={async () => { // 提交框内的数据
|
||||||
@ -221,109 +395,214 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
|
|||||||
autoFocusFirstInput
|
autoFocusFirstInput
|
||||||
submitter={false}
|
submitter={false}
|
||||||
preserve={false}
|
preserve={false}
|
||||||
initialValues={currentRow}
|
initialValues={currentRow ? currentRow : {
|
||||||
|
USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
|
OWNERUNIT_NAME: currentUser?.OwnerUnitName
|
||||||
|
}}
|
||||||
onFinish={async (values) => {
|
onFinish={async (values) => {
|
||||||
let newValue = { ...values };
|
let newValue = { ...values };
|
||||||
if (currentRow) {
|
if (currentRow) {
|
||||||
// 编辑数据
|
// 编辑数据
|
||||||
newValue = { ...values, USERDEFINEDTYPE_ID: currentRow.USERDEFINEDTYPE_ID };
|
newValue = { ...values, USERDEFINEDTYPE_ID: currentRow.USERDEFINEDTYPE_ID };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
console.log('fileListfileList', fileList);
|
||||||
|
console.log('newValuenewValuenewValue', newValue);
|
||||||
|
|
||||||
// 如果有开关,要把开关的代码写进去
|
// 如果有开关,要把开关的代码写进去
|
||||||
handleAddUpdate(newValue);
|
await handleAddUpdate(newValue);
|
||||||
|
|
||||||
handleConfirmLoading(false)
|
handleConfirmLoading(false)
|
||||||
|
setFormPRESALE_TYPE(false)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Row>
|
<Row gutter={8}>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<ProFormSelect
|
<ProFormTreeSelect
|
||||||
name="USERDEFINEDTYPE_PID"
|
name="USERDEFINEDTYPE_PID"
|
||||||
label="上级内码"
|
label="上级类别"
|
||||||
|
request={async () => {
|
||||||
|
if (typeTreeData && typeTreeData.length > 0) {
|
||||||
|
let list: any = [{ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }, ...typeTreeData]
|
||||||
|
return list
|
||||||
|
} else {
|
||||||
|
const req = {
|
||||||
|
OWNERUNIT_ID: currentUser?.OwnerUnitId,
|
||||||
|
PROVINCE_CODE: "",
|
||||||
|
GOODSTYPE: 4000,
|
||||||
|
}
|
||||||
|
const data = await handlGetUSERDEFINEDTYPEList(req);
|
||||||
|
console.log('datadatadatadatadata', data);
|
||||||
|
if (data.List && data.List.length > 0) {
|
||||||
|
data.List.unshirft({ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 })
|
||||||
|
setTypeTreeData(data.List)
|
||||||
|
return data.List
|
||||||
|
} else {
|
||||||
|
return [{ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
fieldProps={{
|
||||||
|
fieldNames: {
|
||||||
|
label: 'USERDEFINEDTYPE_NAME',
|
||||||
|
value: 'USERDEFINEDTYPE_ID',
|
||||||
|
children: 'children'
|
||||||
|
},
|
||||||
|
showSearch: true,
|
||||||
|
filterTreeNode: (input, node) =>
|
||||||
|
(node.USERDEFINEDTYPE_NAME || '').toLowerCase().includes(input.toLowerCase())
|
||||||
|
}}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请选择上级类别"
|
||||||
|
}
|
||||||
|
]}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<ProFormText
|
<ProFormText
|
||||||
name="USERDEFINEDTYPE_NAME"
|
name="USERDEFINEDTYPE_NAME"
|
||||||
label="类别名称"
|
label="类别名称"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请输入类别名称"
|
||||||
|
}
|
||||||
|
]}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<ProFormText
|
<ProFormDigit
|
||||||
name="PROVINCE_CODE"
|
name="USERDEFINEDTYPE_INDEX"
|
||||||
label="省份编码"
|
label="类别索引"
|
||||||
/>
|
rules={[
|
||||||
</Col>
|
{
|
||||||
<Col span={12}>
|
required: true,
|
||||||
<ProFormText
|
message: "请输入类别索引"
|
||||||
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>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<ProFormSelect
|
<ProFormSelect
|
||||||
name="BUSINESSTYPE"
|
|
||||||
label="业态"
|
|
||||||
/>
|
|
||||||
</Col>
|
|
||||||
<Col span={12}>
|
|
||||||
<ProFormMoney
|
|
||||||
width="lg"
|
|
||||||
fieldProps={{
|
|
||||||
moneySymbol: false,
|
|
||||||
}}
|
|
||||||
name="SCANCODE_ORDER"
|
name="SCANCODE_ORDER"
|
||||||
label="扫码点餐"
|
label="上架状态"
|
||||||
/>
|
options={[{ label: "上架", value: 1 }, { label: "下架", value: 0 }]}
|
||||||
</Col>
|
|
||||||
<Col span={12}>
|
|
||||||
<ProFormDatePicker
|
|
||||||
name="USERDEFINEDTYPE_DATE"
|
|
||||||
label="添加时间"
|
|
||||||
width="lg"
|
|
||||||
/>
|
|
||||||
</Col>
|
|
||||||
<Col span={12}>
|
|
||||||
<ProFormMoney
|
|
||||||
name="USERDEFINEDTYPE_INDEX"
|
|
||||||
label="类别索引"
|
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<ProFormSelect
|
<ProFormSelect
|
||||||
name="USERDEFINEDTYPE_STATE"
|
name="USERDEFINEDTYPE_STATE"
|
||||||
label="有效状态"
|
label="有效状态"
|
||||||
|
options={[{ label: "有效", value: 1 }, { label: "无效", value: 0 }]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请选择有效状态"
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<ProFormSelect
|
||||||
|
name="PRESALE_TYPE"
|
||||||
|
label="是否预售"
|
||||||
|
options={[{ label: "是", value: 1 }, { label: "否", value: 0 }]}
|
||||||
|
fieldProps={{
|
||||||
|
onChange: (e: any) => {
|
||||||
|
setFormPRESALE_TYPE(e)
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
{
|
||||||
|
formPRESALE_TYPE ?
|
||||||
|
<Col span={12}>
|
||||||
|
<ProFormDateTimeRangePicker
|
||||||
|
width={'lg'}
|
||||||
|
name="PRESALE_TIME"
|
||||||
|
label="预售时间"
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
<Col span={12}>
|
||||||
|
<ProFormUploadButton
|
||||||
|
name="USERDEFINEDTYPE_ICO"
|
||||||
|
label="图标地址"
|
||||||
|
fileList={fileList || []}
|
||||||
|
listType="picture-card"
|
||||||
|
accept="image/*"
|
||||||
|
fieldProps={{
|
||||||
|
beforeUpload,
|
||||||
|
maxCount: 1,
|
||||||
|
onPreview: handlePreview,
|
||||||
|
customRequest: async (info) => {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('files', info.file);
|
||||||
|
formData.append('TableType', '1215');
|
||||||
|
formData.append('ImageName', typeof info.file !== 'string' ? info.file?.name : '');
|
||||||
|
if (info.filename) {
|
||||||
|
const success = await uploadPicture(formData)
|
||||||
|
if (success) {
|
||||||
|
const list = [{
|
||||||
|
// uid: `${success.ImageId}`, // 注意,这个uid一定不能少,否则上传失败
|
||||||
|
name: success.Result_Data.ImageName,
|
||||||
|
// status: 'done',
|
||||||
|
url: success.Result_Data.ImageUrl, // url 是展示在页面上的绝对链接
|
||||||
|
// imgUrl: success.ImagePath // + success.ImageUrl,
|
||||||
|
}]
|
||||||
|
setFileList(list)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
message.error("您上传的图片不存在.")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onChange: async (info: any) => {
|
||||||
|
if (info.file.status === 'removed') {
|
||||||
|
confirm({
|
||||||
|
title: '确认删除该图片吗?',
|
||||||
|
icon: <ExclamationCircleOutlined rev={undefined} />,
|
||||||
|
async onOk() {
|
||||||
|
setFileList([])
|
||||||
|
|
||||||
|
// const deleteLoading = message.loading('正在删除...')
|
||||||
|
// try {
|
||||||
|
|
||||||
|
// const deleteIndex = fileList?.findIndex((n: any) => n.uid === info.file.uid)
|
||||||
|
// const success = await deletePicture(info.file?.ImagePath, info.file?.ImageId, '1208')
|
||||||
|
// if (deleteIndex !== -1) {
|
||||||
|
// const files = [...fileList]
|
||||||
|
// files.splice(deleteIndex, 1)
|
||||||
|
// setFileList(files)
|
||||||
|
// }
|
||||||
|
// deleteLoading()
|
||||||
|
// return true
|
||||||
|
// } catch (error) {
|
||||||
|
// deleteLoading()
|
||||||
|
// return false
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<ProFormText
|
<ProFormText
|
||||||
name="STAFF_NAME"
|
name="USERDEFINEDTYPE_DATE"
|
||||||
label="操作人员名称"
|
label="添加时间"
|
||||||
|
disabled
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<ProFormDatePicker
|
<ProFormText
|
||||||
name="OPERATE_DATE"
|
name="OWNERUNIT_NAME"
|
||||||
label="操作时间"
|
label="业主单位"
|
||||||
width="lg"
|
disabled
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
@ -332,102 +611,7 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
|
|||||||
label="备注"
|
label="备注"
|
||||||
/>
|
/>
|
||||||
</Col>
|
</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>
|
</Row>
|
||||||
</ProForm>
|
</ProForm>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@ -1,11 +1,202 @@
|
|||||||
// 商城订单管理
|
// 商城订单管理
|
||||||
import { ConnectState } from "@/models/connect";
|
import { connect } from "umi";
|
||||||
import { connect, CurrentUser } from "umi";
|
import type { CurrentUser } from "umi";
|
||||||
|
import type { ConnectState } from "@/models/connect";
|
||||||
|
import React, { useRef, useState } from "react";
|
||||||
|
import type { FormInstance } from "antd";
|
||||||
|
import type { ActionType } from "@ant-design/pro-table";
|
||||||
|
import ProTable from "@ant-design/pro-table";
|
||||||
|
import PageTitleBox from "@/components/PageTitleBox";
|
||||||
|
import moment from 'moment'
|
||||||
|
|
||||||
|
|
||||||
|
const MallOrderManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
|
||||||
|
const { currentUser } = props
|
||||||
|
const actionRef = useRef<ActionType>();
|
||||||
|
const formRef = useRef<FormInstance>();
|
||||||
|
|
||||||
|
|
||||||
|
// 查询的条件
|
||||||
|
const [searchParams, setSearchParams] = useState<any>()
|
||||||
|
|
||||||
|
const columns: any = [
|
||||||
|
{
|
||||||
|
title: "查询时间",
|
||||||
|
dataIndex: "searchTime",
|
||||||
|
valueType: "dateRange",
|
||||||
|
hideInTable: true,
|
||||||
|
initialValue: [moment().subtract(1, 'day'), moment().subtract(1, 'day').startOf('M')],
|
||||||
|
search: {
|
||||||
|
transform: (value) => {
|
||||||
|
return {
|
||||||
|
StartDate: moment(value[0]).format('YYYY-MM-DD'),
|
||||||
|
EndDate: moment(value[1]).format('YYYY-MM-DD'),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fieldProps: {
|
||||||
|
picker: "month",
|
||||||
|
format: 'YYYY-MM',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "订单状态",
|
||||||
|
dataIndex: "orderStatus",
|
||||||
|
valueType: "select",
|
||||||
|
valueEnum: {},
|
||||||
|
hideInTable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "订单类型",
|
||||||
|
dataIndex: "orderType",
|
||||||
|
valueType: "select",
|
||||||
|
valueEnum: {},
|
||||||
|
hideInTable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "支付方式",
|
||||||
|
dataIndex: "paymentMethod",
|
||||||
|
valueType: "select",
|
||||||
|
valueEnum: {},
|
||||||
|
hideInTable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "序号",
|
||||||
|
dataIndex: "index",
|
||||||
|
valueType: "index",
|
||||||
|
hideInSearch: true,
|
||||||
|
align: "center",
|
||||||
|
width: 60,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "供货商",
|
||||||
|
dataIndex: "",
|
||||||
|
width: 200,
|
||||||
|
hideInSearch: true,
|
||||||
|
ellipsis: true,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "收货人员",
|
||||||
|
dataIndex: "",
|
||||||
|
width: 150,
|
||||||
|
hideInSearch: true,
|
||||||
|
ellipsis: true,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "联系电话",
|
||||||
|
dataIndex: "",
|
||||||
|
width: 150,
|
||||||
|
hideInSearch: true,
|
||||||
|
ellipsis: true,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "购买的商品",
|
||||||
|
dataIndex: "",
|
||||||
|
width: 300,
|
||||||
|
hideInSearch: true,
|
||||||
|
ellipsis: true,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "订单金额",
|
||||||
|
dataIndex: "",
|
||||||
|
width: 120,
|
||||||
|
hideInSearch: true,
|
||||||
|
ellipsis: true,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "实付金额",
|
||||||
|
dataIndex: "",
|
||||||
|
width: 120,
|
||||||
|
hideInSearch: true,
|
||||||
|
ellipsis: true,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "订单类型",
|
||||||
|
dataIndex: "",
|
||||||
|
width: 120,
|
||||||
|
hideInSearch: true,
|
||||||
|
ellipsis: true,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "支付方式",
|
||||||
|
dataIndex: "",
|
||||||
|
width: 120,
|
||||||
|
hideInSearch: true,
|
||||||
|
ellipsis: true,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "订单时间",
|
||||||
|
dataIndex: "",
|
||||||
|
width: 180,
|
||||||
|
hideInSearch: true,
|
||||||
|
ellipsis: true,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "订单编号",
|
||||||
|
dataIndex: "",
|
||||||
|
width: 150,
|
||||||
|
hideInSearch: true,
|
||||||
|
ellipsis: true,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "订单状态",
|
||||||
|
dataIndex: "",
|
||||||
|
width: 120,
|
||||||
|
hideInSearch: true,
|
||||||
|
ellipsis: true,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "备注说明",
|
||||||
|
dataIndex: "",
|
||||||
|
width: 180,
|
||||||
|
hideInSearch: true,
|
||||||
|
ellipsis: true,
|
||||||
|
align: "center",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
const MallOrderManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
|
|
||||||
|
<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
|
||||||
|
}}
|
||||||
|
scroll={{ x: "100%", y: "calc(100vh - 410px)" }}
|
||||||
|
headerTitle={<PageTitleBox props={props} />} // 列表表头
|
||||||
|
search={{ span: 6 }}
|
||||||
|
request={async (params) => {
|
||||||
|
setSearchParams(params)
|
||||||
|
}}
|
||||||
|
toolbar={{
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,232 @@
|
|||||||
|
import { connect } from "umi";
|
||||||
|
import type { ConnectState } from "@/models/connect";
|
||||||
|
import ProCard from "@ant-design/pro-card";
|
||||||
|
import searchIcon from '@/assets/ai/searchIcon.png'
|
||||||
|
import { useRef, useState } from "react";
|
||||||
|
import { MenuFoldOutlined } from "@ant-design/icons";
|
||||||
|
import ProForm, { ProFormText } from "@ant-design/pro-form";
|
||||||
|
import { Button, Col, FormInstance, Row, Tree } from "antd";
|
||||||
|
import close from '@/assets/ai/close.png'
|
||||||
|
import { getServerpartTree } from "@/services/options";
|
||||||
|
import useRequest from "@ahooksjs/use-request";
|
||||||
|
import './style.less'
|
||||||
|
import { getMerchantShopTree } from "@/pages/Setting/Users/service";
|
||||||
|
import { handlGetUSERDEFINEDTYPEList } from "../../service";
|
||||||
|
|
||||||
|
|
||||||
|
type DetailProps = {
|
||||||
|
setSelectedId: any; // 把选择的服务区 可以带给外层
|
||||||
|
reload?: boolean; // 选择服务区 是否可以刷新组件之外的内容
|
||||||
|
actionRef?: any; // 和reload配合使用 确认要刷新的内容
|
||||||
|
currentUser: any; // 当前用户的信息
|
||||||
|
width?: number; // 组件的宽度
|
||||||
|
otherFun?: any; // 点击之后要进行的其他操作 多个操作可以写在一个方法里面传进来
|
||||||
|
setCollapsible: any; // 是否收缩组件
|
||||||
|
collapsible: boolean; // 收缩组件的判断依据
|
||||||
|
haveTest?: boolean;// 是否有测试服务区
|
||||||
|
handleGetLeftTreeData?: any // 拿到树数据的方法 必须要有输出值的
|
||||||
|
noWj?: any // 把万佳商贸隐藏
|
||||||
|
selectOnly?: boolean// 传入的时候 仅支持单选
|
||||||
|
setData?: any // 把树形的数据 传出去
|
||||||
|
}
|
||||||
|
const LeftSelectMallType = ({ setSelectedId, reload, actionRef, currentUser, width, otherFun, setCollapsible, collapsible, haveTest, handleGetLeftTreeData, noWj, selectOnly, setData }: DetailProps) => {
|
||||||
|
const searchTreeRef = useRef<FormInstance>();
|
||||||
|
// 默认的服务区树
|
||||||
|
const [allTreeViews, setAllTreeViews] = useState<any>()
|
||||||
|
// 是否要显示全部
|
||||||
|
const [isShowAllInTree, setIsShowAllInTree] = useState<boolean>(false)
|
||||||
|
// 加载服务区树
|
||||||
|
const { loading: treeLoading, data: treeViews } = useRequest(async () => {
|
||||||
|
const req = {
|
||||||
|
OWNERUNIT_ID: currentUser?.OwnerUnitId,
|
||||||
|
PROVINCE_CODE: "",
|
||||||
|
GOODSTYPE: 4000,
|
||||||
|
USERDEFINEDTYPE_STATE: 1
|
||||||
|
}
|
||||||
|
const data = await handlGetUSERDEFINEDTYPEList(req);
|
||||||
|
setTreeView(data)
|
||||||
|
setData(data)
|
||||||
|
return data
|
||||||
|
})
|
||||||
|
// 显示服务区树搜索框
|
||||||
|
const [showServiceSearchBox, setShowServiceSearchBox] = useState<boolean>(false)
|
||||||
|
// 实际显示在左侧的服务区树
|
||||||
|
const [treeView, setTreeView] = useState<any>()
|
||||||
|
// 树要展开的行
|
||||||
|
const [treeShowRow, setTreeShowRow] = useState<any>()
|
||||||
|
// 筛选左侧的服务区树
|
||||||
|
const handleFilterServiceTree = async (value?: string) => {
|
||||||
|
const resList: any = JSON.parse(JSON.stringify(allTreeViews))
|
||||||
|
setSelectedId('')
|
||||||
|
if (resList && resList.length > 0 && value) {
|
||||||
|
setTreeView([])
|
||||||
|
const list: any = []
|
||||||
|
resList.forEach((item: any) => {
|
||||||
|
if (item.label.indexOf(value) !== -1) {
|
||||||
|
list.push(item)
|
||||||
|
} else {
|
||||||
|
if (item.children && item.children.length > 0) {
|
||||||
|
const childrenList: any = []
|
||||||
|
item.children.forEach((subItem: any) => {
|
||||||
|
if (subItem.label.indexOf(value) !== -1) {
|
||||||
|
childrenList.push(subItem)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
item.children = childrenList
|
||||||
|
if (childrenList && childrenList.length > 0) {
|
||||||
|
list.push(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (list && list.length > 0) {
|
||||||
|
const keyList: any = ['0-0']
|
||||||
|
list.forEach((item: any) => {
|
||||||
|
keyList.push(item.key)
|
||||||
|
})
|
||||||
|
setTreeShowRow(keyList)
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
setTreeView(list)
|
||||||
|
}, 100)
|
||||||
|
} else {
|
||||||
|
setTreeView([])
|
||||||
|
setTreeShowRow([])
|
||||||
|
setTreeView(allTreeViews)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 根据传入的服务区id筛选剔除掉这个服务区
|
||||||
|
const handleFilterList = (list: any, id: any) => {
|
||||||
|
let res: any = []
|
||||||
|
list.forEach((item: any) => {
|
||||||
|
if (item.value === id) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
res.push(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log('res', res);
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
// 仅支持单选一个服务区的时候 调用的方法
|
||||||
|
const convertTreeForSelectOnly = (treeData: any[]): any[] => {
|
||||||
|
return treeData.map(item => {
|
||||||
|
const newItem = {
|
||||||
|
...item,
|
||||||
|
disabled: item.type !== 1,
|
||||||
|
};
|
||||||
|
if (item.children) {
|
||||||
|
newItem.children = convertTreeForSelectOnly(item.children);
|
||||||
|
}
|
||||||
|
return newItem;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<ProCard
|
||||||
|
style={{ width: !collapsible ? width ? `${width}px` : "300px" : "60px" }}
|
||||||
|
className="pageTable-leftnav"
|
||||||
|
bodyStyle={{ padding: 0, paddingTop: 20, paddingLeft: 20, width: !collapsible ? width ? `${width}px` : "300px" : "60px" }}
|
||||||
|
extra={<div className="leftSelectBox">
|
||||||
|
{/* <img className="searchIcon" src={searchIcon} onClick={() => {
|
||||||
|
setShowServiceSearchBox(true)
|
||||||
|
}} /> */}
|
||||||
|
<MenuFoldOutlined onClick={() => {
|
||||||
|
setCollapsible(!collapsible);
|
||||||
|
}} />
|
||||||
|
<div className="fixedBox" style={{ display: showServiceSearchBox ? 'flex' : 'none', width: width ? `${width}px` : '275px' }}>
|
||||||
|
<ProForm
|
||||||
|
formRef={searchTreeRef}
|
||||||
|
layout={'horizontal'}
|
||||||
|
submitter={{
|
||||||
|
render: () => {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
isKeyPressSubmit
|
||||||
|
onFinish={(values: any) => {
|
||||||
|
return handleFilterServiceTree(values?.searchValue || '')
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Row>
|
||||||
|
<Col span={15} className={'noBottom'}>
|
||||||
|
<ProFormText
|
||||||
|
name={'searchValue'}
|
||||||
|
fieldProps={{
|
||||||
|
placeholder: '请输入服务区名称'
|
||||||
|
}}
|
||||||
|
allowClear
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={2}></Col>
|
||||||
|
<Col span={5}>
|
||||||
|
<Button type={'primary'} onClick={() => {
|
||||||
|
searchTreeRef.current?.submit()
|
||||||
|
}}>查询</Button>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
|
||||||
|
</ProForm>
|
||||||
|
<img style={{ width: '20px', height: '20px', cursor: 'pointer', marginLeft: '5px' }} src={close} onClick={() => {
|
||||||
|
setShowServiceSearchBox(false)
|
||||||
|
}} />
|
||||||
|
</div>
|
||||||
|
</div>}
|
||||||
|
colSpan={!collapsible ? "300px" : "60px"}
|
||||||
|
title={!collapsible ? "请选择商城分类" : ""}
|
||||||
|
headerBordered
|
||||||
|
collapsed={collapsible}
|
||||||
|
>
|
||||||
|
{treeView && treeView.length > 0 ? <Tree
|
||||||
|
checkable
|
||||||
|
treeData={selectOnly
|
||||||
|
? (isShowAllInTree
|
||||||
|
? [{
|
||||||
|
label: '全部',
|
||||||
|
value: 0,
|
||||||
|
key: '0-0',
|
||||||
|
children: convertTreeForSelectOnly(treeView)
|
||||||
|
}]
|
||||||
|
: convertTreeForSelectOnly(treeView))
|
||||||
|
: (isShowAllInTree
|
||||||
|
? [{
|
||||||
|
label: '全部',
|
||||||
|
value: 0,
|
||||||
|
key: '0-0',
|
||||||
|
children: treeView
|
||||||
|
}]
|
||||||
|
: treeView)}
|
||||||
|
blockNode
|
||||||
|
// defaultExpandAll={isShowAllInTree ? false : true}
|
||||||
|
// defaultExpandedKeys={isShowAllInTree ? treeShowRow && treeShowRow.length > 0 ? treeShowRow : ['0-0'] : []}
|
||||||
|
onCheck={(checkedKeys: React.Key[] | any, info) => {
|
||||||
|
console.log('checkedKeyscheckedKeyscheckedKeys', checkedKeys);
|
||||||
|
console.log('infoinfoinfoinfoinfoinfo', info);
|
||||||
|
|
||||||
|
// 多选逻辑
|
||||||
|
// const selectedIds = info.checkedNodes.filter((n: any) => n?.USERDEFINEDTYPE_PID !== -1)
|
||||||
|
const selectedIds = info.checkedNodes.filter((n: any) => n?.USERDEFINEDTYPE_ID)
|
||||||
|
console.log('selectedIdsselectedIds', selectedIds);
|
||||||
|
setSelectedId(selectedIds.map((n: any) => n?.USERDEFINEDTYPE_ID)?.toString() || '')
|
||||||
|
if (reload) {
|
||||||
|
actionRef?.current?.reload()
|
||||||
|
}
|
||||||
|
if (otherFun) {
|
||||||
|
otherFun(info)
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
fieldNames={{
|
||||||
|
title: "USERDEFINEDTYPE_NAME",
|
||||||
|
key: "USERDEFINEDTYPE_ID"
|
||||||
|
}}
|
||||||
|
/> : ''}
|
||||||
|
</ProCard>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default connect(({ user }: ConnectState) => ({
|
||||||
|
currentUser: user.currentUser,
|
||||||
|
}))(LeftSelectMallType);
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
.pageTable-leftnav{
|
||||||
|
.leftSelectBox{
|
||||||
|
position: relative;
|
||||||
|
.searchIcon{
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
.fixedBox{
|
||||||
|
position: absolute;
|
||||||
|
width: 275px;
|
||||||
|
background: #fff;
|
||||||
|
right: -10px;
|
||||||
|
box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
|
||||||
|
border-radius: 8px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 12px;
|
||||||
|
z-index: 2;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.noBottom{
|
||||||
|
.ant-form-item{
|
||||||
|
margin-bottom: 0!important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,5 @@
|
|||||||
// import request from '@/utils/request';
|
// import request from '@/utils/request';
|
||||||
|
import { wrapTreeNode } from '@/utils/format';
|
||||||
import requestEncryption from '@/utils/requestEncryption';
|
import requestEncryption from '@/utils/requestEncryption';
|
||||||
|
|
||||||
|
|
||||||
@ -168,14 +169,14 @@ export async function handleDeleteMEMBERADDRESS(params: any) {
|
|||||||
|
|
||||||
// 获取品牌管理列表
|
// 获取品牌管理列表
|
||||||
export async function handleGetBRANDList(params: any) {
|
export async function handleGetBRANDList(params: any) {
|
||||||
const data = await requestEncryption(`/BaseInfo/GetBRANDList`, {
|
const data = await requestEncryption(`/MallBasic/GetBRANDList`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { ...params, requestEncryption: true }
|
data: { ...params, requestEncryption: true }
|
||||||
})
|
})
|
||||||
if (data.Result_Code !== 100) {
|
if (data.Result_Code !== 100) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
return data
|
return data.Result_Data
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同步品牌信息
|
// 同步品牌信息
|
||||||
@ -203,9 +204,69 @@ export async function handlDeleteBRAND(params: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 获取商城分类管理
|
// 获取商城分类管理(自定义类别的那个) 树形
|
||||||
export async function handlGetUSERDEFINEDTYPEList(params: any) {
|
export async function handlGetUSERDEFINEDTYPEList(params: any) {
|
||||||
const data = await requestEncryption(`/MemberBasic/GetUSERDEFINEDTYPEList`, {
|
const data = await requestEncryption(`/MallBasic/GetNestingUSERDEFINEDTYPEList`, {
|
||||||
|
method: 'POST',
|
||||||
|
data: { ...params, requestEncryption: true }
|
||||||
|
})
|
||||||
|
if (data.Result_Code !== 100) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return wrapTreeNode(data.Result_Data.List)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 同步商城分类管理
|
||||||
|
export async function handlSynchroUSERDEFINEDTYPE(params: any) {
|
||||||
|
const data = await requestEncryption(`/MallBasic/SynchroUSERDEFINEDTYPE`, {
|
||||||
|
method: 'POST',
|
||||||
|
data: { ...params, requestEncryption: true }
|
||||||
|
})
|
||||||
|
if (data.Result_Code !== 100) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除商城分类管理
|
||||||
|
export async function handlDeleteUSERDEFINEDTYPE(params: any) {
|
||||||
|
const data = await requestEncryption(`/MallBasic/DeleteUSERDEFINEDTYPE`, {
|
||||||
|
method: 'POST',
|
||||||
|
data: { ...params, requestEncryption: true }
|
||||||
|
})
|
||||||
|
if (data.Result_Code !== 100) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取商品管理列表
|
||||||
|
export async function handeGetCOMMODITYList(params: any) {
|
||||||
|
const data = await requestEncryption(`/MallBasic/GetCOMMODITYList`, {
|
||||||
|
method: 'POST',
|
||||||
|
data: { ...params, requestEncryption: true }
|
||||||
|
})
|
||||||
|
if (data.Result_Code !== 100) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return data.Result_Data
|
||||||
|
}
|
||||||
|
|
||||||
|
// 同步商品管理
|
||||||
|
export async function handeSynchroCOMMODITY(params: any) {
|
||||||
|
const data = await requestEncryption(`/MallBasic/SynchroCOMMODITY`, {
|
||||||
|
method: 'POST',
|
||||||
|
data: { ...params, requestEncryption: true }
|
||||||
|
})
|
||||||
|
if (data.Result_Code !== 100) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除商品管理
|
||||||
|
export async function handeDeleteCOMMODITY(params: any) {
|
||||||
|
const data = await requestEncryption(`/MallBasic/DeleteCOMMODITY`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { ...params, requestEncryption: true }
|
data: { ...params, requestEncryption: true }
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user