Commit d2523523 authored by XieZhiXiong's avatar XieZhiXiong
parents cb382011 d11d0b2f
......@@ -81,10 +81,24 @@ const PlatformGoods: React.FC<PlatformGoodsProps> = (props) => {
const [selectedRows, setSelectedRows] = useState([]);
const [mallSelectList, setMallSelectList] = useState<NewSelectItemType[]>([]);
const [selectMallInfo, setSelectMallInfo] = useState<NewSelectItemType>();
const [categoryId, setCategoryId] = useState<number>();
const [categoryId, setCategoryId] = useState<string>();
const [fontColor, setFontColor] = useState<string>();
const ref = useRef<any>({});
const initCategoryId = () => {
if (dataInfo) {
if (dataInfo.thirdId) {
setCategoryId(dataInfo.thirdId)
} else if (dataInfo.secondId) {
setCategoryId(dataInfo.secondId)
} else if (dataInfo.firstId){
setCategoryId(dataInfo.firstId)
} else {
setCategoryId(undefined)
}
}
}
const initMallList = (mallList: ShopInfo[]) => {
if (!mallList) {
return [];
......@@ -134,6 +148,7 @@ const PlatformGoods: React.FC<PlatformGoodsProps> = (props) => {
const enterpriseMallList = GlobalConfig.web.shopInfo.filter((item) => item.type === 1 && item.environment === 1);
setMallSelectList(initMallList(enterpriseMallList));
initColorPicker();
initCategoryId()
}, []);
useEffect(() => {
......@@ -207,6 +222,27 @@ const PlatformGoods: React.FC<PlatformGoodsProps> = (props) => {
const result = produce(newProps, (old) => {
old.dataInfo['visible'] = true
})
if (result.dataInfo.name) {
let str = result.dataInfo.name
str = str.replace(/[\u4e00-\u9fa5]/g, 'OO')
const maxByte = 16
if(str.length > maxByte) {
message.error(`最多输入${maxByte}个字符,${Math.floor(maxByte / 2)}个汉字`);
return
}
}
if (result.dataInfo.describe) {
let str = result.dataInfo.describe
str = str.replace(/[\u4e00-\u9fa5]/g, 'OO')
const maxByte = 28
if(str.length > maxByte) {
message.error(`最多输入${maxByte}个字符,${Math.floor(maxByte / 2)}个汉字`);
return
}
}
changeProps({
props: result
});
......@@ -492,13 +528,13 @@ const PlatformGoods: React.FC<PlatformGoodsProps> = (props) => {
<div className={styles.setting_line_addItem_line}>
<div className={cx(styles.setting_line_addItem_line_label, styles.height32)}>分类名称:</div>
<div className={styles.setting_line_addItem_line_brief}>
<Input className={styles.setting_line_addItem_input} value={dataInfo.name} maxLength={8} onChange={(e) => handleChangeForKey(e.target.value, 'name')} />
<Input className={styles.setting_line_addItem_input} value={dataInfo.name} onChange={(e) => handleChangeForKey(e.target.value, 'name')} />
</div>
</div>
<div className={styles.setting_line_addItem_line}>
<div className={cx(styles.setting_line_addItem_line_label, styles.height32)}>分类描述:</div>
<div className={styles.setting_line_addItem_line_brief}>
<Input className={styles.setting_line_addItem_input} value={dataInfo.describe} maxLength={14} onChange={(e) => handleChangeForKey(e.target.value, 'describe')} />
<Input className={styles.setting_line_addItem_input} value={dataInfo.describe} onChange={(e) => handleChangeForKey(e.target.value, 'describe')} />
</div>
</div>
<div className={styles.setting_line_addItem_line}>
......
......@@ -29,10 +29,6 @@ const AddRule:React.FC<{}> = (props) => {
const formSubmit = async (values) => {
setIsDisabled(true)
const params = omit(values, ['state'])
params.baseProcessId = params.baseProcessId[0]
console.log(params, 'parmas')
// 切割memberId
let res: any = {}
if(pageStatus === PageStatus.EDIT){
res = await PublicApi.postOrderPlatformPurchaseProcessUpdate(params)
......
......@@ -59,8 +59,10 @@ const SelectProcesss = (props: ISchemaFieldComponentProps) => {
})
const modalRef = useRef<any>({})
const { dataSource, showMore } = state
const { mutators, editable } = props
const value: number[] = props.value || []
const { value, mutators, editable } = props
// @注释说明:多选变单选
// const { mutators, editable } = props
// const value: number[] = props.value || []
useEffect(() => {
PublicApi.getOrderPlatformPurchaseProcessBaseList().then(res => {
......@@ -74,26 +76,26 @@ const SelectProcesss = (props: ISchemaFieldComponentProps) => {
const showDataSource = showMore ? dataSource : [...dataSource].splice(0, 3)
const handleCheck = (id) => {
// if (editable) {
// mutators.change(id)
// }
if (!editable) {
return false
}
if (value.includes(id)) {
const newValue = findItemAndDelete(value, id)
mutators.change(newValue)
} else {
mutators.change([...value, id])
if (editable) {
mutators.change(id)
}
}
// if (!editable) {
// return false
// }
// if (value.includes(id)) {
// const newValue = findItemAndDelete(value, id)
// mutators.change(newValue)
// } else {
// mutators.change([...value, id])
// }
const isChecked = (id) => {
return value.includes(id)
}
// const isChecked = (id) => {
// return value.includes(id)
// }
const toogleMore = () => {
setFieldState({
dataSource,
......@@ -111,7 +113,8 @@ const SelectProcesss = (props: ISchemaFieldComponentProps) => {
<div style={{ width: '100%' }}>
<SelectStyles>
{
showDataSource.map(v => <div key={v.baseProcessid} onClick={() => handleCheck(v.baseProcessid)} className={cx('select_style_border', isChecked(v.baseProcessid) ? 'active' : '')}>
// showDataSource.map(v => <div key={v.baseProcessid} onClick={() => handleCheck(v.baseProcessid)} className={cx('select_style_border', isChecked(v.baseProcessid) ? 'active' : '')}>
showDataSource.map(v => <div key={v.baseProcessid} onClick={() => handleCheck(v.baseProcessid)} className={cx('select_style_border', value === v.baseProcessid ? 'active' : '')}>
<div>
<Row style={{ color: '#303133' }}>
<Col>{v.processName}</Col>
......
......@@ -46,7 +46,7 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
]
},
baseProcessId: {
type: 'array:number',
type: 'number',
title: '流程选择',
"x-component": 'SelectProcesss',
"x-mega-props": {
......
import React, {useState, useRef, useEffect} from 'react'
import React, {useState} from 'react'
import { history } from 'umi'
import { Button, Card } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
......@@ -8,8 +8,8 @@ import {
import ReutrnEle from '@/components/ReturnEle';
import './index.less'
import { ruleDetailSchema } from './schema'
import { createFormActions, ISchema, FormEffectHooks } from '@formily/antd'
import { findItemAndDelete, omit } from '@/utils'
import { createFormActions } from '@formily/antd'
import { omit } from '@/utils'
import { PublicApi } from '@/services/api'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import RuleSetting from './components/RuleSetting'
......@@ -29,9 +29,7 @@ const AddRule:React.FC<{}> = (props) => {
const formSubmit = async (values) => {
setIsDisabled(true)
const params = omit(values, ['state'])
params.baseProcessId = params.baseProcessId[0]
// 切割memberId
console.log(values, 'vvv')
let res: any = {}
if(pageStatus === PageStatus.EDIT){
res = await PublicApi.postOrderPlatformTradeProcessUpdate(params)
......
import React, {useEffect, useState} from 'react'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import { useInitValue } from '@/formSchema/effects/useInitValue'
import EyePreview from '@/components/EyePreview'
import { findItemAndDelete } from '@/utils'
import { ISchemaFormActions, ISchema, FormEffectHooks } from '@formily/antd'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import { createAddContractTemplateEffect, useUnitPreview } from '../effects'
import { PublicApi } from '@/services/api'
import {
PlusOutlined,
LinkOutlined,
} from '@ant-design/icons'
import { Button, message } from 'antd'
import { PlusOutlined } from '@ant-design/icons'
import { Button } from 'antd'
import NiceForm from '@/components/NiceForm'
import { GlobalConfig } from '@/global/config'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import SearchSelect from '@/components/NiceForm/components/SearchSelect'
import Search from '@/components/NiceForm/components/Search'
......
......@@ -59,8 +59,10 @@ const SelectProcesss = (props: ISchemaFieldComponentProps) => {
})
const modalRef = useRef<any>({})
const { dataSource, showMore } = state
const { mutators, editable } = props
const value: number[] = props.value || []
const { value, mutators, editable } = props
// @注释说明:多选变单选
// const { mutators, editable } = props
// const value: number[] = props.value || []
useEffect(() => {
PublicApi.getOrderPlatformTradeProcessBaseList().then(res => {
......@@ -74,26 +76,27 @@ const SelectProcesss = (props: ISchemaFieldComponentProps) => {
const showDataSource = showMore ? dataSource : [...dataSource].splice(0, 3)
const handleCheck = (id) => {
// if (editable) {
// mutators.change(id)
// }
if (!editable) {
return false
}
if (value.includes(id)) {
const newValue = findItemAndDelete(value, id)
mutators.change(newValue)
} else {
mutators.change([...value, id])
console.log(id, 'id')
if (editable) {
mutators.change(id)
}
}
// if (!editable) {
// return false
// }
// if (value.includes(id)) {
// const newValue = findItemAndDelete(value, id)
// mutators.change(newValue)
// } else {
// mutators.change([...value, id])
// }
const isChecked = (id) => {
return value.includes(id)
}
// const isChecked = (id) => {
// return value.includes(id)
// }
const toogleMore = () => {
setFieldState({
dataSource,
......@@ -111,7 +114,8 @@ const SelectProcesss = (props: ISchemaFieldComponentProps) => {
<div style={{ width: '100%' }}>
<SelectStyles>
{
showDataSource.map(v => <div key={v.baseProcessid} onClick={() => handleCheck(v.baseProcessid)} className={cx('select_style_border', isChecked(v.baseProcessid) ? 'active' : '')}>
// showDataSource.map(v => <div key={v.baseProcessid} onClick={() => handleCheck(v.baseProcessid)} className={cx('select_style_border', isChecked(v.baseProcessid) ? 'active' : '')}>
showDataSource.map(v => <div key={v.baseProcessid} onClick={() => handleCheck(v.baseProcessid)} className={cx('select_style_border', value === v.baseProcessid ? 'active' : '')}>
<div>
<Row style={{ color: '#303133' }}>
<Col>{v.processName}</Col>
......
......@@ -73,7 +73,7 @@ const TransactionRules: React.FC<{}> = () => {
>
<Button
type="link"
style={record.status ? { color: '#00B37A' } : { color: 'red' }}>{record.state ? <>有效 <PlayCircleOutlined /></> : <>无效 <PauseCircleOutlined /></>}</Button>
style={record.status ? { color: '#00B37A' } : { color: 'red' }}>{record.status ? <>有效 <PlayCircleOutlined /></> : <>无效 <PauseCircleOutlined /></>}</Button>
</Popconfirm>
)
return component
......
......@@ -46,9 +46,8 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
]
},
baseProcessId: {
type: 'array:number',
type: 'number',
title: '流程选择',
"x-component": 'SelectProcesss',
"x-mega-props": {
style: {
......
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