Commit 52690262 authored by XieZhiXiong's avatar XieZhiXiong
parents 0b046713 dd9130c3
......@@ -3,6 +3,7 @@ import { Dropdown, Space, Menu, message } from 'antd';
import { CaretDownOutlined } from '@ant-design/icons';
import { getAuth, setAuth, setRouters } from '@/utils/auth';
import { postMemberLoginSwitchrole } from '@/services/MemberV2Api';
import { useIntl } from 'umi'
interface MemberRole {
memberRoleId: number;
......@@ -11,6 +12,7 @@ interface MemberRole {
};
const Roles: React.FC = () => {
const intl = useIntl()
const [curRole, setCurRole] = useState<MemberRole>(null);
const [roles, setRoles] = useState<MemberRole[]>([]);
......
......@@ -19,7 +19,7 @@ export default {
'priceManage.constant.memberColumns.roleName':'Role',
'priceManage.constant.memberColumns.ctl':'Operation',
'priceManage.effect.goods':'Corresponding goods',
'priceManage.effect.unitPrice':'Unit Price',
'priceManage.effect.unitPrice':'Unit price',
'priceManage.effect.index':'Index',
'priceManage.effect.goodsId':'Product ID',
'priceManage.effect.goodsName':'Product name',
......@@ -114,4 +114,4 @@ export default {
'priceManage.schema.formProduct.customerCategoryId':'Product category',
'priceManage.schema.formProduct.brandId':'Please select a brand',
'priceManage.schema.formProduct.submit':'Query',
}
\ No newline at end of file
}
......@@ -41,6 +41,7 @@ const AddAtttribute: React.FC<{}> = () => {
const [isSee, setIsSee] = useState(false) // 判断查看依据
const [isSpecial, setIsSpecial] = useState(false) //特殊属性禁用展示方式
const [submitLoading, setSubmitLoading] = useState<boolean>(false)
const [isDisabledEmpty, setIsDisabledEmpty] = useState<boolean>(false) // 禁用必填
useEffect(() => {
const { location } = history
......@@ -162,8 +163,10 @@ const AddAtttribute: React.FC<{}> = () => {
const priceAttributeChange = (e) => {
if(e.target.checked) {
setIsDisabledEmpty(true)
menuForm.setFieldsValue({"isEmpty": true})
} else {
setIsDisabledEmpty(false)
menuForm.setFieldsValue({"isEmpty": false})
}
}
......@@ -253,7 +256,9 @@ const AddAtttribute: React.FC<{}> = () => {
>
<Row>
<Col span={24}>
<Form.Item name="isEmpty" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled={isSee}>{intl.formatMessage({ id: 'classAndProperty.attribute.addAttribute.form.isEmpty' })}</Checkbox></Form.Item>
<Form.Item name="isEmpty" valuePropName="checked" initialValue={false} noStyle>
<Checkbox disabled={isSee || isDisabledEmpty}>{intl.formatMessage({ id: 'classAndProperty.attribute.addAttribute.form.isEmpty' })}</Checkbox>
</Form.Item>
</Col>
{/* <Col span={24}>
<Form.Item name="isImage" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled={isSee}>上传图片</Checkbox></Form.Item>
......@@ -269,7 +274,12 @@ const AddAtttribute: React.FC<{}> = () => {
</Col> */}
<Col span={24}>
{/* 规格属性 -> 原价格属性 */}
<Form.Item name="isPrice" valuePropName="checked" initialValue={false} noStyle><Checkbox onChange={priceAttributeChange} disabled={isSee}>{intl.formatMessage({ id: 'classAndProperty.attribute.addAttribute.form.isPrice' })}</Checkbox></Form.Item>
<Form.Item name="isPrice" valuePropName="checked" initialValue={false} noStyle>
<Checkbox
onChange={priceAttributeChange}
disabled={isSee}>{intl.formatMessage({ id: 'classAndProperty.attribute.addAttribute.form.isPrice' })}
</Checkbox>
</Form.Item>
<Tooltip title={intl.formatMessage({ id: 'classAndProperty.attribute.addAttribute.form.isPrice.tooltip' })}>
<InfoCircleOutlined />
</Tooltip>
......
......@@ -26,17 +26,6 @@ import { getProductGoodsGetGoodsList, postProductGoodsDeleteBatchGoods } from '@
const { Option } = Select;
const { confirm } = Modal
// 定义选择的行数据的类型
interface Item {
key: string;
role: string;
specification: string;
type: string;
brand: string;
unit: string;
unitPrice: string;
batch: string;
}
let timeChange: any;
......@@ -45,15 +34,17 @@ const formActions = createFormActions();
const Goods: React.FC<{}> = () => {
const intl = useIntl();
const ref = useRef<any>({})
const [selectRow, setSelectRow] = useState<Item[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<number>>([])
const currentRefRow = useRef<any>([])
const [importModal, setImportModal] = useState(false)
const [deleteBatchModal, setDeleteBatchModal] = useState(false)
const [modalTitle, setModalTitle] = useState(intl.formatMessage({ id: 'commodity.goods.modalTitle.1' }))
const [modalStep, setModalStep] = useState(0)
const [batchDeleteKeys, setBatchDeleteKeys] = useState<any>([])
const [goodsRowSelection, goodsRowCtl] = useRowSelectionTable()
useEffect(() => {
currentRefRow.current = goodsRowCtl.selectRow
}, [goodsRowCtl])
const columns: ColumnType<any>[] = [
{
title: intl.formatMessage({ id: 'commodity.goods.columns.code' }),
......@@ -148,16 +139,6 @@ const Goods: React.FC<{}> = () => {
setImportModal(false)
}
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
setBatchDeleteKeys([...batchDeleteKeys, ...selectedRowKeys]);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
}
}
const modalLoadTemplate = () => {
console.log('模板下载!')
}
......@@ -286,8 +267,8 @@ const Goods: React.FC<{}> = () => {
title: intl.formatMessage({ id: 'commodity.goods.handleMenuClick.title' }),
icon: <ExclamationCircleOutlined />,
onOk() {
if (!goodsRowCtl.selectedRowKeys.length) { return message.error(intl.formatMessage({ id: 'commodity.goods.handleMenuClick.error' })) }
postProductGoodsDeleteBatchGoods({ idList: goodsRowCtl.selectedRowKeys }).then(res => {
if (!currentRefRow.current.length) { return message.error(intl.formatMessage({ id: 'commodity.goods.handleMenuClick.error' })) }
postProductGoodsDeleteBatchGoods({ idList: currentRefRow.current.map(item => item.id) }).then(res => {
ref.current.reload()
})
},
......
import React, { useState, useRef } from 'react'
import React, { useState, useRef, useEffect } from 'react'
import { history, useIntl } from 'umi'
import { Button, Form, Card, Modal, Row, Col, Dropdown, Tooltip, Menu, Space, message, Checkbox, Badge } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
......@@ -25,19 +25,7 @@ import moment from 'moment'
import { productStatusColor, productStatusLabel } from './constant'
import { getProductChannelCommodityGetChannelCommodityList, getProductChannelCommodityGetShop, getProductChannelCommodityGetShopBatch, GetProductChannelCommodityGetShopResponse, postProductChannelCommodityBatchOffPublishCommodity, postProductChannelCommodityBatchPublishCommodity, postProductChannelCommodityDeleteBatchChannelCommodity, postProductChannelCommodityPublishCommodity } from '@/services/ProductV2Api'
import { getTemplateWebMemberChannelWebFindCurrMemberChannel } from '@/services/TemplateV2Api'
// 定义选择的行数据的类型
interface Item {
id: string;
role: string;
specification: string;
type: string;
brand: string;
unit: string;
price: string;
batch: string;
status: string;
}
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
const { confirm } = Modal;
const formActions = createFormActions();
......@@ -45,8 +33,7 @@ const formActions = createFormActions();
const DirectChannel: React.FC<{}> = () => {
const intl = useIntl();
const ref = useRef<any>({})
const [selectRow, setSelectRow] = useState<Item[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<number[]>([])
const currentRefRow = useRef<any>([])
const [isUp, setIsUp] = useState(1) // 1上0下架状态
const [upDownModal, setUpDownModal] = useState(false)
const [shopsOption, setShopsOption] = useState<GetProductChannelCommodityGetShopResponse>([])
......@@ -56,8 +43,11 @@ const DirectChannel: React.FC<{}> = () => {
const [currentOptionId, setCurrentOptionId] = useState<number>()
const [isDisabledOKbtn, setIsDisabledOKbtn] = useState<boolean>(false)
const [isBatchOption, setIsBatchOption] = useState<boolean>(false) // 是否是批量上下架操作
const currentRef = useRef<any>([])
const currentRowRef = useRef<any>([])
const [rowSelection, rowCtl] = useRowSelectionTable()
useEffect(() => {
currentRefRow.current = rowCtl.selectRow
}, [rowCtl])
const columns: ColumnType<any>[] = [
{
......@@ -187,7 +177,8 @@ const DirectChannel: React.FC<{}> = () => {
// paramId ? 单个删除 : 批量删除
const clickDelete = (paramId?: number) => {
if (currentRef.current.length || paramId)
const ids = currentRefRow.current.map(item => item.id)
if (ids.length || paramId)
confirm({
title: intl.formatMessage({ id: 'commodity.products.directChannel.clickDelete.title' }),
icon: <ExclamationCircleOutlined />,
......@@ -195,8 +186,7 @@ const DirectChannel: React.FC<{}> = () => {
okType: 'danger',
cancelText: intl.formatMessage({ id: 'commodity.products.directChannel.clickDelete.cancelText' }),
onOk() {
console.log(currentRef.current)
postProductChannelCommodityDeleteBatchChannelCommodity({ idList: paramId ? [paramId] : currentRef.current }).then(res => {
postProductChannelCommodityDeleteBatchChannelCommodity({ idList: paramId ? [paramId] : ids }).then(res => {
if (res.code === 1000)
ref.current.reload()
})
......@@ -218,24 +208,12 @@ const DirectChannel: React.FC<{}> = () => {
})
}
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
currentRef.current = selectedRowKeys
currentRowRef.current = selectedRows
}
}
// 判断所选商品 priceType, ?source, status一致
const judgeType = () => {
// let sourceArr = Array.from(new Set(selectRow.map((item:any) => item.channelCommodity.source)))
let priceTypeArr = Array.from(new Set(currentRowRef.current.map((item: any) => item.channelCommodity.commodity.priceType)))
let statusArr = Array.from(new Set(currentRowRef.current.map((item: any) => item.status)))
let priceTypeArr = Array.from(new Set(currentRefRow.current.map((item: any) => item.channelCommodity.commodity.priceType)))
let statusArr = Array.from(new Set(currentRefRow.current.map((item: any) => item.status)))
return {
isPassJudge: priceTypeArr.length === 1 && statusArr.length === 1,
// source: sourceArr,
priceType: priceTypeArr
}
}
......@@ -243,7 +221,7 @@ const DirectChannel: React.FC<{}> = () => {
const handleBatchClick = (param: string) => {
setIsBatchOption(true)
setShopsOption([])
if (currentRef.current.length) {
if (currentRefRow.current.length) {
let _judge = judgeType()
if (_judge.isPassJudge) {
setUpDownModal(true)
......@@ -296,7 +274,7 @@ const DirectChannel: React.FC<{}> = () => {
let params: any = {}
if (isBatchOption) {
params = {
idList: currentRowRef.current.map(item => item.id),
idList: currentRefRow.current.map(item => item.id),
shopList: checkedValues
}
} else {
......
This diff is collapsed.
......@@ -399,7 +399,7 @@ const EAccountDetail: React.FC<{}> = () => {
</div>
<div className={styles['repayment-end']}>
<span className={styles['repayment-time']}>
{details?.name}
{details?.memberName}
</span>
</div>
</div>
......
......@@ -299,10 +299,10 @@ const Company: React.FC<{}> = () => {
required: true,
message: intl.formatMessage({ id: 'payandSettle.eAccountApprove.components.company.mellowCard.1.uniCredit.message' })
},
{
pattern: /^\d{12}$/,
message: intl.formatMessage({ id: 'payandSettle.eAccountApprove.components.company.mellowCard.1.uniCredit.message1' })
}
// {
// pattern: /^\d{12}$/,
// message: intl.formatMessage({ id: 'payandSettle.eAccountApprove.components.company.mellowCard.1.uniCredit.message1' })
// }
]}
>
<Input placeholder={intl.formatMessage({ id: 'payandSettle.eAccountApprove.components.company.mellowCard.1.uniCredit.placeholder' })} />
......
import React from 'react'
import React, { useState } from 'react'
import { history, useIntl } from 'umi'
import { Button, Card, message } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
......@@ -31,10 +31,12 @@ const AddRepository: React.FC<{}> = (props) => {
pageStatus
} = usePageStatus()
const [loading, setLoading] = useState<boolean>(false)
// 整体表单提交
const formSubmit = async (values) => {
setLoading(true)
const params = omit(values, ['NO_SUBMIT3'])
console.log(params, 'params')
if (params['applyMember']) {
params['applyMember'] = params['applyMember']
}
......@@ -52,10 +54,11 @@ const AddRepository: React.FC<{}> = (props) => {
let res = await postProductFreightSpaceAdd(params)
if (res.code === 1000) {
setTimeout(() => {
history.goBack(-1)
history.goBack()
}, 1000)
}
}
setLoading(false)
}
return (
......@@ -67,7 +70,7 @@ const AddRepository: React.FC<{}> = (props) => {
extra={(
pageStatus !== PageStatus.PREVIEW
? (
<Button key="1" onClick={() => addSchemaAction.submit()} type="primary" icon={<SaveOutlined />}>
<Button key="1" loading={loading} onClick={() => addSchemaAction.submit()} type="primary" icon={<SaveOutlined />}>
{intl.formatMessage({ id: 'repositories.addRepository.extra' })}
</Button>
)
......
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