Commit 56b15cce authored by 前端-许佳敏's avatar 前端-许佳敏
parents afffd563 93b48149
......@@ -39,7 +39,7 @@
"braft-editor": "^2.3.9",
"classnames": "^2.2.6",
"core-js": "^3.6.5",
"god": "0.1.22",
"god": "^0.1.26",
"lingxi-design": "^1.0.7",
"lingxi-design-ui": "^1.0.8",
"lingxi-editor-core": "^1.0.6",
......
export interface MemberType {
id: number;
typeName: string;
}
export interface BusinessType {
id: number;
typeName: string;
}
export interface UseType {
memberType: MemberType[];
businessType: BusinessType[];
}
export interface UserRegister {
useType: UseType;
}
export interface PayPlatformPayConfig {
id: number;
payType: number;
way: string;
isPitchOn: number;
}
export interface PayConfig {
payInitializeConfig: any[];
payPlatformPayConfig: PayPlatformPayConfig[];
}
export interface CountryList {
name: string;
key: string;
icon: string;
}
export interface Children {
code: string;
}
export interface MenuList {
code: string;
children: Children[];
}
export interface Global {
logo: string;
countryList: CountryList[];
menuList: MenuList[];
}
export interface RootObject {
userRegister: UserRegister;
payConfig: PayConfig;
global: Global;
}
\ No newline at end of file
......@@ -15,6 +15,7 @@ import { PublicApi } from '@/services/api';
import TabTree from '@/components/TabTree';
import { createFormActions } from '@formily/antd';
import { useTreeTabs } from '@/hooks/useTreeTabs';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
const formActions = createFormActions()
......@@ -35,6 +36,7 @@ const CategoryAttributes: React.FC<{}> = () => {
const [selectTableRow, setSelectTableRow] = useState<any[]>([])
const [selectedTableRowKeys, setSelectedTableRowKeys] = useState<Array<number>>([]) //表格选择
const [linkTableRowData, setLinkTableRowData] = useState<any[]>([])
const [attributeRowSelection, attributeRowCtl] = useRowSelectionTable()
const {
treeStatus,
......@@ -55,25 +57,28 @@ const CategoryAttributes: React.FC<{}> = () => {
// 获取选中项的关联属性列表
useEffect(() => {
if (selectKey)
ref.current.reload({ current: 1, pageSize: 10, name: '', categoryId: selectKey })
ref.current.reload({ current: 1, pageSize: 10, name: '', categoryId: selectKey, isByCategory: true })
}, [selectKey])
const fetchLinkAttributeData = (params: any) => {
console.log(params, 'params')
return new Promise((resolve, reject) => {
PublicApi.getProductPlatformGetCategoryAttributeList({...params, categoryId: selectKey, name: params.name || ''}).then(res=>{
PublicApi.getProductPlatformGetCategoryAttributeList({...params, categoryId: selectKey, name: params.name || '', isByCategory: true}).then(res=>{
resolve(res.data)
setLinkTableRowData(res.data.data)
})
})
}
// 获取所有属性列表
// 获取所有属性列表 modal
const fetchAttributeData = (params: any) => {
return new Promise((resolve, reject) => {
PublicApi.getProductPlatformGetAttributeList({ ...params, name: params.name || '' }).then(res=>{
PublicApi.getProductPlatformGetCategoryAttributeList({...params, categoryId: selectKey, name: params.name || '', isByCategory: false}).then(res=>{
resolve(res.data)
})
// PublicApi.getProductPlatformGetAttributeList({ ...params, name: params.name || '' }).then(res=>{
// resolve(res.data)
// })
})
}
......@@ -84,13 +89,10 @@ const CategoryAttributes: React.FC<{}> = () => {
const handleSelectOk = () => {
setRoleVisible(false)
if (selectTableRow.length) {
PublicApi.postProductPlatformSaveCategoryAttribute({ categoryId: selectKey, attributeIds: selectedTableRowKeys }).then(res=>{
//@ts-ignore
ref.current.reload()
})
}
console.log(selectRow)
PublicApi.postProductPlatformSaveCategoryAttribute({ categoryId: selectKey, attributeIds: attributeRowCtl.selectedRowKeys }).then(res=>{
if(res.code === 1000)
setTimeout(() => ref.current.reload(), 500)
})
}
const handleSelectCancel = () => {
......@@ -102,26 +104,22 @@ const CategoryAttributes: React.FC<{}> = () => {
{
title: 'ID',
dataIndex: 'id',
align: 'center',
key: 'id',
},
{
title: '属性名称',
dataIndex: 'name',
align: 'center',
key: 'name',
render: (text: any, record: any) => <span className="commonPickColor" onClick={() => handleSee(record)}>{text}&nbsp;<EyeOutlined /></span>
},
{
title: '属性组名称',
dataIndex: 'groupName',
align: 'center',
key: 'groupName',
},
{
title: '展示方式',
dataIndex: 'type',
align: 'center',
key: 'type',
render: (text: any, record: any) => {
let _txt: string = ''
......@@ -138,44 +136,22 @@ const CategoryAttributes: React.FC<{}> = () => {
{
title: '是否必填',
dataIndex: 'isEmpty',
align: 'center',
key: 'isEmpty',
render: (text: any, record: any) => (<>{text ? '是' : '否'}</>)
},
{
title: '状态',
align: 'center',
dataIndex: 'isEnable',
key: 'isEnable',
render: (text: any, record: any) => {
let component: ReactNode = null
component = (
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => confirm(record)}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button
type="link"
style={text ? { color: '#00B37A' } : { color: 'red' }}
>
{text ? <>有效 <PlayCircleOutlined /></> : <>无效 <PauseCircleOutlined /></>}
</Button>
</Popconfirm>
)
return component
}
render: (text: any, record: any) => text ? '有效' : '无效',
},
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (text: any, record: any) => {
return (
<>
{record.isEnable ? <></> : <Button type='link' onClick={() => clickRelief(record.id)}>解除关联</Button>}
<Button type='link' onClick={() => clickRelief(record.id)}>解除关联</Button>
</>
)
}
......@@ -186,25 +162,21 @@ const CategoryAttributes: React.FC<{}> = () => {
{
title: 'ID',
dataIndex: 'id',
align: 'center',
key: 'id',
},
{
title: '属性名称',
dataIndex: 'name',
align: 'center',
key: 'name',
},
{
title: '属性组名称',
dataIndex: 'groupName',
align: 'center',
key: 'groupName',
},
{
title: '展示方式',
dataIndex: 'type',
align: 'center',
key: 'type',
render: (text: any, record: any) => {
let _txt: string = ''
......@@ -221,7 +193,6 @@ const CategoryAttributes: React.FC<{}> = () => {
{
title: '是否必填',
dataIndex: 'isEmpty',
align: 'center',
key: 'isEmpty',
render: (text: any, record: any) => (<>{text ? '是' : '否'}</>)
}
......@@ -260,7 +231,8 @@ const CategoryAttributes: React.FC<{}> = () => {
linkTableRowData.forEach((item, index) => {
linkArray.push(item.id)
})
console.log(linkArray)
// console.log(linkArray)
attributeRowCtl.setSelectedRowKeys(linkArray)
setSelectedTableRowKeys(linkArray)
}
......@@ -311,7 +283,7 @@ const CategoryAttributes: React.FC<{}> = () => {
name: {
type: 'string',
'x-component-props': {
placeHolder: '属性名称'
placeholder: '属性名称'
},
'x-component': 'Search'
}
......@@ -341,11 +313,12 @@ const CategoryAttributes: React.FC<{}> = () => {
onCancel={handleSelectCancel}
okText="确认"
cancelText="取消"
width={704}
>
<StandardTable
columns={columnsLink}
currentRef={refLink}
rowSelection={rowSelection}
rowSelection={attributeRowSelection}
fetchTableData={(params: any) => fetchAttributeData(params)}
tableProps={{
rowKey: 'id'
......@@ -358,7 +331,7 @@ const CategoryAttributes: React.FC<{}> = () => {
name: {
type: 'string',
'x-component-props': {
placeHolder: '属性名称'
placeholder: '属性名称'
},
'x-component': 'Search'
}
......
......@@ -31,8 +31,9 @@ const fetchClassTreeData = async (params?) => {
return res
}
let flag = false; // 全局变量 用于控制表单编辑退出提示
const ClassProperty: React.FC<{}> = () => {
const [roleVisible, setRoleVisible] = useState(false)
const {
treeStatus,
......@@ -74,7 +75,11 @@ const ClassProperty: React.FC<{}> = () => {
// 保存后要将是否填写过表单设为false
setIsEditForm(false)
})
}
const clickSelect = (key, node) => {
handleSelect(key, node)
flag = false
}
return <PageHeaderWrapper
......@@ -86,15 +91,15 @@ const ClassProperty: React.FC<{}> = () => {
<h3 className="mb-30">选择要编辑的项目</h3>
{
treeData && treeData.length > 0
? <TabTree
fetchData = {params => fetchClassTreeData(params)}
treeData={treeData}
toolsRender={toolsRender}
handleSelect={(key, node) => handleSelect(key, node)}
customKey="id"
/>
:
<Button block type='primary' onClick={() => handleSelect()}>暂无菜单, 开始新增</Button>
? <TabTree
fetchData = {params => fetchClassTreeData(params)}
treeData={treeData}
toolsRender={toolsRender}
handleSelect={(key, node) => clickSelect(key, node)}
customKey="id"
/>
:
<Button block type='primary' onClick={() => handleSelect()}>暂无菜单, 开始新增</Button>
}
</Card>
</Col>
......@@ -110,6 +115,20 @@ const ClassProperty: React.FC<{}> = () => {
name='classForm'
onSubmit={onFinish}
actions={formActions}
effects={($, action)=>{
flag = false
$(ON_FORM_INPUT_CHANGE).subscribe(() => {
setIsEditForm(true)
})
$('onFieldValueChange', 'name, type, imageUrl, category').subscribe(state => {
if(flag){
setIsEditForm(true)
flag = false
}
else
flag = true
})
}}
schema={classSchema}
>
<FormButtonGroup>
......@@ -117,9 +136,11 @@ const ClassProperty: React.FC<{}> = () => {
保存
</Button>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={handleDeleteMenu}>
<Button style={{ marginTop: 32, marginBottom: 16}}>
删除
</Button>
{
treeStatus !== FormState.ADD && <Button style={{ marginTop: 32, marginBottom: 16}}>
删除
</Button>
}
</Popconfirm>
</FormButtonGroup>
</NiceForm>
......
......@@ -16,10 +16,11 @@ import { ColumnType } from 'antd/lib/table/interface';
import { PublicApi } from '@/services/api';
import { createFormActions } from '@formily/antd';
import { useTreeTabs } from '@/hooks/useTreeTabs';
import TabTree from '@/components/TabTree';
import TabTree, { createTreeActions } from '@/components/TabTree';
import { GetProductCustomerGetCustomerAttributeResponse } from '@/services';
const formActions = createFormActions()
const treeActions = createTreeActions()
const fetchAttributeTreeData = async (params?) => {
const res = await PublicApi.getProductPlatformGetAttributeTree()
......@@ -43,6 +44,7 @@ const PropertyValue: React.FC<{}> = () => {
setTreeMaps,
resetMenu
} = useTreeTabs({
treeActions,
fetchMenuData: fetchAttributeTreeData,
})
......@@ -52,8 +54,12 @@ const PropertyValue: React.FC<{}> = () => {
}, [selectKey])
const onHandleSelect = (key, node) => {
if (node.children && node.children.length > 0) {
return ;
}
if(key){
setSelectKey(key[key.length-1])
let arr = key.split('_');
setSelectKey(arr[arr.length-1])
setSelectNode(node)
}
}
......@@ -173,6 +179,7 @@ const PropertyValue: React.FC<{}> = () => {
? <TabTree
fetchData = {params => fetchAttributeTreeData(params)}
treeData={treeData}
actions={treeActions}
handleSelect={(key, node) => onHandleSelect(key, node)}
customKey="id"
/>
......
......@@ -141,7 +141,7 @@ const Products: React.FC<{}> = () => {
];
const fetchData = (params: any) => {
console.log(params, filterParams)
// console.log(params, filterParams)
return new Promise((resolve, reject) => {
//@ts-ignore
PublicApi.getProductCommodityGetPlatformCommodityList({ ...filterParams, ...params, status: 2 }).then(res => {
......@@ -152,7 +152,6 @@ const Products: React.FC<{}> = () => {
}
const clickSubmitCheck = (record:any) => {
console.log('提交审核')
const { id } = record;
if(id)
PublicApi.postProductCommodityApplyCheckCommodity({id: id})
......@@ -196,7 +195,6 @@ const Products: React.FC<{}> = () => {
}
const handleSearch = (val?: string) => {
console.log(val)
let obj = val ? {...filterParams, name: val} : { ...filterParams }
setFilterParams(obj)
ref.current.reload(obj)
......
......@@ -194,11 +194,11 @@ const viewProducts: React.FC<{}> = () => {
component = (<><span className="commonStatusValid"></span>审核通过</>)
else if (status === 3)
component = (<><span className="commonStatusInvalid"></span>审核不通过</>)
}
if (status === 5)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
else if (status === 6)
component = (<span style={{ padding: '2px 5px', background: 'rgba(244,245,247,1)', borderRadius: '4px' }}>已下架</span>)
}else
if (status === 5)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
else if (status === 6)
component = (<span style={{ padding: '2px 5px', background: 'rgba(244,245,247,1)', borderRadius: '4px' }}>已下架</span>)
return component
}
......@@ -402,7 +402,7 @@ const viewProducts: React.FC<{}> = () => {
<Col span={20}>
<p>
{
productDetail?.commodityAreaList.map(_item => <p>{_item.provinceName+'/'+(_item.cityName||'')}</p>)
productDetail?.commodityAreaList.length>0 ? productDetail?.commodityAreaList.map(_item => <p>{_item.provinceName+'/'+(_item.cityName||'')}</p>) : '全国'
}
</p>
</Col>
......
import React, { useState, useEffect, useRef, ReactNode } from 'react'
import { history } from 'umi'
// import { history } from 'umi'
import { Button, Card, Select, Row, Col, Input } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
......@@ -144,7 +144,7 @@ const Products: React.FC<{}> = () => {
];
const fetchData = (params: any) => {
console.log(params, filterParams)
// console.log(params, filterParams)
return new Promise((resolve, reject) => {
//@ts-ignore
PublicApi.getProductCommodityGetPlatformCommodityList({ ...filterParams, ...params}).then(res => {
......@@ -155,7 +155,6 @@ const Products: React.FC<{}> = () => {
}
const clickSubmitCheck = (record:any) => {
console.log('提交审核')
const { id } = record;
if(id)
PublicApi.postProductCommodityApplyCheckCommodity({id: id})
......@@ -185,7 +184,7 @@ const Products: React.FC<{}> = () => {
}
const handleClassSearch = (value?:any) => {
PublicApi.getProductSelectGetSelectCustomerCategory({name: value}).then(res=>{
PublicApi.getProductSelectGetSelectCustomerCategory({name: value}).then(res => {
if(res.code === 1000)
setClassData(res.data)
})
......@@ -198,7 +197,6 @@ const Products: React.FC<{}> = () => {
}
const handleSearch = (val?: string) => {
console.log(val)
let obj = val ? {...filterParams, name: val} : { ...filterParams }
setFilterParams(obj)
ref.current.reload(obj)
......
......@@ -192,11 +192,11 @@ const viewProducts: React.FC<{}> = () => {
component = (<><span className="commonStatusValid"></span>审核通过</>)
else if (status === 3)
component = (<><span className="commonStatusInvalid"></span>审核不通过</>)
}
if (status === 5)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
else if (status === 6)
component = (<span style={{ padding: '2px 5px', background: 'rgba(244,245,247,1)', borderRadius: '4px' }}>已下架</span>)
}else
if (status === 5)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
else if (status === 6)
component = (<span style={{ padding: '2px 5px', background: 'rgba(244,245,247,1)', borderRadius: '4px' }}>已下架</span>)
return component
}
......@@ -369,7 +369,7 @@ const viewProducts: React.FC<{}> = () => {
<Col span={20}>
<p>
{
productDetail?.commodityAreaList.map(_item => <p>{_item.provinceName+'/'+(_item.cityName||'')}</p>)
productDetail?.commodityAreaList.length>0 ? productDetail?.commodityAreaList.map(_item => <p>{_item.provinceName+'/'+(_item.cityName||'')}</p>) : '全国'
}
</p>
</Col>
......
......@@ -261,7 +261,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
<ToolBar />
<div className={styles['content']}>
<div className={styles['canvas-container']}>
<DesignPanel />
<DesignPanel theme={theme} />
</div>
</div>
</div>
......
......@@ -8,7 +8,7 @@ const { TabPane } = Tabs;
type SettingPanelType = {
selectedInfo: SelectedInfoType,
componentConfigs: ComponentConfigsType,
templateId: number
templateId: number,
}
const SettingPanel = (props) => {
const { selectedInfo, componentConfigs } = useSelector<SettingPanelType, STATE_PROPS>(['selectedInfo', 'componentConfigs'])
......
......@@ -14,7 +14,7 @@ import { PublicApi } from '@/services/api'
import EyePreview from '@/components/EyePreview'
const Trademark: React.FC<{}> = () => {
const ref = useRef({})
const ref = useRef<any>({})
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
......@@ -76,19 +76,9 @@ const Trademark: React.FC<{}> = () => {
const handleReset = (actions: any) => {
actions.reset({})
//@ts-ignore
ref.current.reload()
}
const handleSee = (record: any) => {
console.log('see')
history.push(`/trademark/viewBrand?id=${record.id}`)
}
const cancel = () => {
console.log('cancel')
}
return (
<PageHeaderWrapper>
<Card>
......@@ -102,6 +92,11 @@ const Trademark: React.FC<{}> = () => {
},
ctx: {
inline: false,
effects: ($, action) => {
$('onFieldValueChange', 'status').subscribe(state => {
ref.current.reload({current:1, pageSize: 10, status: state.value})
})
},
schema: {
type: 'object',
properties: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment