Commit 7848c41d authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

修改支付策略,系统管理,询价报价的BUG

parent fcd092ad
......@@ -139,6 +139,7 @@ const Details: React.FC<{}> = (props) => {
title: '序号',
key: 'inquiryListId',
dataIndex: 'inquiryListId',
render: (text: any, record: any, index: number) => <>{index + 1}</>
}, {
title: '操作角色',
key: 'roleName',
......@@ -323,4 +324,4 @@ const Details: React.FC<{}> = (props) => {
)
}
export default Details
\ No newline at end of file
export default Details
......@@ -112,6 +112,7 @@ const Details: React.FC<{}> = (props) => {
title: '序号',
key: 'inquiryListId',
dataIndex: 'inquiryListId',
render: (text: any, record: any, index: number) => <>{index + 1}</>
}, {
title: '操作角色',
key: 'roleName',
......@@ -236,7 +237,7 @@ const Details: React.FC<{}> = (props) => {
</div>
<div className={style.item_wrap}>
<div className={style.mainCol_title} style={view === 2 ? { paddingBottom: '0px' } : { paddingBottom: '24px' }}>报价商品</div>
<StandardTable
<StandardTable
currentRef={ref}
columns={inquiryGoods}
tableProps={{ rowKew: 'id' }}
......@@ -319,4 +320,4 @@ const Details: React.FC<{}> = (props) => {
)
}
export default Details
\ No newline at end of file
export default Details
......@@ -6,6 +6,7 @@ import SetUpModal from './setUpModal';
interface payWayTableParams {
name?: string,
way?: string,
payParametersList?: any,
payParametersListResponses?: any,
visible?: boolean,
......@@ -22,7 +23,7 @@ const PayWayTable: React.FC<payWayTableParams> = (props) => {
const [edit, setedit] = useState<any>({});
const [modifyIndex, setModifyIndex] = useState<any>(0)
const [modify, setmodify] = useState<boolean>(false);
const { name, payParametersListResponses, payParametersList, visible, onType, onGet, onDel, onEdit, id } = props;
const { name, payParametersListResponses, payParametersList, visible, onType, onGet, onDel, onEdit, id, way } = props;
const columns: ColumnType<any>[] = [
{
title: '参数代码',
......@@ -87,7 +88,7 @@ const PayWayTable: React.FC<payWayTableParams> = (props) => {
<Button style={{ marginBottom: 16, marginTop: 24 }} block icon={<PlusOutlined />} onClick={() => { setmodalvisible(true); setType(id); setmodify(false) }} type='dashed'>新增参数配置</Button>
{
id !== 2 &&
way !== '微信' &&
<>
<div style={{ borderLeft: '2px solid #00B37A', margin: '41px 0 8px', padding: '1px 5px' }}>{name}转账到银行卡参数配置</div>
<Table
......
......@@ -98,27 +98,33 @@ const PayWaySetTemplate: React.FC<{}> = () => {
const onHnadleSubmit = () => {
let conditions = false;
let wayName = '';
payItem.forEach(item => {
if (item.id === 2 && item.isPitchOn === 1) {
if(item.payParametersAddListRequests.length > 0) {
conditions = true
try {
payItem.forEach(item => {
if (item.way === '微信' && item.isPitchOn === 1) {
console.log(1)
if(item.payParametersAddListRequests.length > 0) {
conditions = true
} else {
conditions = false
wayName = item.way
throw new Error
}
} else if (item.way === '支付宝' && item.isPitchOn === 1) {
console.log(2)
if(item.payParametersAddListRequests.length > 0 && item.payParametersList.length > 0) {
conditions = true
} else {
conditions = false
wayName = item.way
throw new Error
}
} else {
conditions = false
wayName = item.way
return
}
} else if (item.id === 1 && item.isPitchOn === 1) {
if(item.payParametersAddListRequests.length > 0 && item.payParametersList.length > 0) {
conditions = true
} else {
conditions = false
wayName = item.way
return
}
} else {
conditions = true
}
})
})
} catch {
message.error(`${wayName}缺少支付参数配置`)
}
if (conditions) {
PublicApi.postPayCollectionParametersAdd({
platformPayWays: payItem
......@@ -127,8 +133,6 @@ const PayWaySetTemplate: React.FC<{}> = () => {
history.push('/ruleSettingManager/paySetting')
}
})
} else {
message.error(`请新增${wayName}的支付参数配置`)
}
}
......@@ -179,9 +183,10 @@ const PayWaySetTemplate: React.FC<{}> = () => {
selectId={payItem[idx].id}
onChange={(value) => onChangeRaido(value, idx)}
/>
{(payItem[idx].id === 1 || payItem[idx].id === 2) &&
{(payItem[idx].way === '微信' || payItem[idx].way === '支付宝') &&
<PayWayTable
id={payItem[idx].id}
way={payItem[idx].way}
onType={payItem[idx].payType}
name={payItem[idx].way}
payParametersList={payItem[idx].payParametersList}
......
......@@ -61,16 +61,16 @@ const PaySetting: React.FC<{}> = () => {
levelList: [],
roleList: []
})
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'memberId' })
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'id' })
const [optionType, setoptionType] = useState(0)
const { preview, pageStatus } = usePageStatus()
// const initValue = useInitValue(PublicApi.getPayPayMemberTacticsDetails)
const columnsSetMember: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'memberId',
dataIndex: 'id',
align: 'center',
key: 'memberId',
key: 'id',
},
{
title: '会员名称',
......@@ -130,7 +130,7 @@ const PaySetting: React.FC<{}> = () => {
// 弹出会员
const handleAddMemberBtn = () => {
const checkBoxs = payActions.getFieldValue('applyMember')
memberRowCtl.setSelectedRowKeys(checkBoxs.map(v => v.memberId))
memberRowCtl.setSelectedRowKeys(checkBoxs.map(v => v.id))
memberRowCtl.setSelectRow(checkBoxs)
setvisible(true)
console.log(visibleChannelMember)
......@@ -191,7 +191,7 @@ const PaySetting: React.FC<{}> = () => {
}).then(res => {
if (res.code === 1000) {
let { data } = res.data
memberRowCtl.setSelectedRowKeys(data.map(v => v.memberId))
memberRowCtl.setSelectedRowKeys(data.map(v => v.id))
memberRowCtl.setSelectRow(data)
payActions.setFieldValue('applyMember', data)
}
......@@ -417,7 +417,6 @@ const PaySetting: React.FC<{}> = () => {
}
}
//新增
console.log(param, 10086)
if (param.memberIdRoleIds.length === 0 && values.isSelected === 0) {
message.error('请选择指定的会员');
return
......@@ -495,7 +494,7 @@ const PaySetting: React.FC<{}> = () => {
}
}
tableProps={{
rowKey: 'memberId'
rowKey: 'id'
}}
/>
</PageHeaderWrapper>
......
......@@ -55,7 +55,7 @@ export const strategyDetailTab = (props: any, usePageStatus: any) => {
"x-component": 'checkbox',
'x-component-props': {
},
required: false,
required: true,
}
}
}
......
......@@ -16,8 +16,8 @@ const SensitiveWords: React.FC<{}> = () => {
await PublicApi.getManageUnitUpdateUnitStatus({ id: id, status: _status })
ref.current.reload()
}
const confirmCancel = (id: number) => {
PublicApi.postManageSensitiveWordDelete({ ids: [id] }).then(res => {
const confirmCancel = (id: any) => {
PublicApi.getManageUnitDeleteUnit({ id }).then(res => {
if (res.code === 1000) {
message.success('删除成功')
ref.current.reload()
......@@ -132,7 +132,7 @@ const SensitiveWords: React.FC<{}> = () => {
name: {
type: 'string',
'x-component-props': {
placeholder: '属性名称',
placeholder: '单位名称',
},
'x-component': 'Search'
}
......
import deepClone from 'clone'
import moment from 'moment';
import { ISchema } from '@formily/antd';
function isArray(arr: any) {
return Array.isArray(arr)
}
export const findArrayItem = (arr: Array<any>, flag: any) => {
const result = arr.find(v => v.value === flag)
return result ? result : {}
}
/**
* 找到最后一个可用的工作流状态的索引
* @param {array} data 数据
* @param {string} customKey 自定义 key
*/
export const findLastIndexFlowState = (data: any[], customKey = 'isExecute'): number => {
let index = 0;
if (!Array.isArray(data)) {
return index;
}
// 循环数据,找到状态值,一直覆盖
for (let i = 0; i < data.length; i++) {
if (data[i][customKey]) {
index = i;
}
}
return index;
};
export function formatTimeString(date, format: string = 'YYYY-MM-DD HH:mm:ss') {
return date ? moment(date).format(format) : ''
}
export function isObject(obj: any) {
return Object.prototype.toString.call(obj) === '[object Object]'
}
function transformDataPre(data: object, key: string): object {
const trans = {}
Object.getOwnPropertyNames(data).forEach(k => {
trans[`${key}.${k}`] = data[k]
})
return trans
}
const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
export function timeRange(val: number) {
let st, et;
switch (val) {
case 0:
st = et = '';
break;
case 1:
st = moment(
moment()
.startOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
break;
case 2:
st = moment(
moment()
.subtract(7, 'days')
.format('YYYY-MM-DD') + ' 00:00:00',
).unix();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
break;
case 3:
st = moment(
moment()
.subtract(29, 'days')
.format('YYYY-MM-DD') + ' 00:00:00',
).unix();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
break;
case 4:
st = moment(
moment()
.subtract(89, 'days')
.format('YYYY-MM-DD') + ' 00:00:00',
).unix();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
break;
case 5:
st = moment(
moment()
.subtract(179, 'days')
.format('YYYY-MM-DD') + ' 00:00:00',
).unix();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
break;
case 6:
st = moment(
moment()
.subtract(364, 'days')
.format('YYYY-MM-DD') + ' 00:00:00',
).unix();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
break;
case 7:
st = moment(
moment()
.year(moment().year() - 1)
.startOf('year')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
et = moment(
moment()
.year(moment().year() - 1)
.endOf('year')
.format('YYYY-MM-DD HH:mm:ss'),
).unix();
break;
}
return { st, et }
}
export const isUrl = (path: string): boolean => reg.test(path);
/**
* @description 用于将传入的接口,并行请求,并组装成Select组件可识别的形式返回
* @param asyncList {Array} 异步函数数组
*/
export const getAsyncSelectList = async (asyncList: any[]) => {
try {
const result = await Promise.all(asyncList)
return result.map(v => v.data.map(j => {
return {
label: j.name,
value: j.id
}
}))
} catch (error) {
return error
}
}
// 抽离对象中的某些属性, 并返回一个新对象
export const omit = (obj: any, arr: string[]): any => {
const newObj = deepClone(obj)
for(let item = 0; item < arr.length; item++) {
if (obj[arr[item]] !== undefined) {
delete newObj[arr[item]]
}
}
return newObj
}
/**
* @param { Object[] } arr 源数据
* @param { any } target 目标值 通常是id等主键
* @param { string } customKey 可选 自定义主键 默认'id'
*/
export const findItemAndDelete = (arr: any[], target: any, customKey?: string) => {
const newArr = [...arr]
if (newArr.length > 0 && isObject(newArr[0])) {
return newArr.filter(v => v[customKey||'id'] !== target)
}
const targetIndex = arr.indexOf(target)
if (targetIndex === -1) {
return newArr
} else {
newArr.splice(targetIndex, 1)
return newArr
}
}
// 遍历树拿到所有key的集合
export const findTreeKeys = (arr: any[], keyword?: string) => {
const copyArr: any[] = deepClone(arr)
const results: any[] = []
while(copyArr.length > 0) {
const item = copyArr.shift()
results.push(keyword ? item[keyword] : item.key)
if (item.children) {
copyArr.push(...item.children)
}
}
return results
}
// 树形结构降为一维对象处理
export const treeReduction = (data: any[]) => {
const hashMaps = {}
const selfData: any[] = deepClone(data)
while (selfData.length > 0) {
const useItem = selfData.shift()
// 存在子集
if (useItem.children && useItem.children.length > 0) {
useItem.children = useItem.children.map(v => {
v.parentId = useItem.id
return v
})
selfData.push(...useItem.children)
}
hashMaps[useItem.id] = useItem
}
return hashMaps
}
// 获取某一节点的title路径
export const getParentTreeTitles = (dataSouce, key) => {
const hashMaps = treeReduction(dataSouce)
let targetKey = key
let targetPath = ''
while (targetKey !== '') {
if (!hashMaps[targetKey]) {
break
}
const title = hashMaps[targetKey].title
targetPath = targetPath === '' ? title : `${title}-${targetPath}`
targetKey = hashMaps[targetKey].parentId || ''
}
return targetPath
}
// 数组通过某个key进行去重合并, 并返回一个新数组
export const mergeArrByKey = (preArr: any[], nextArr: any[], target?: string) => {
const mergeArr = preArr.concat(nextArr)
if (target) {
const result: any[] = []
mergeArr.forEach(v => {
const s = result.find(j => j[target] === v[target])
if (!s) {
result.push(v)
}
})
return result
} else {
return Array.from(new Set(mergeArr))
}
}
// 数组去重
export const dupliArr = (arr: any[]) => {
return Array.from(new Set(arr))
}
// 填充必填的schema message提示
export const padRequiredMessage = (originSchema: ISchema) => {
const messageSwich = (type) => {
return type ? '请选择' : '请输入'
}
const todoFn = (targetSchema) => {
}
Object.entries(originSchema.properties).map(([key, value]) => {
if (value.required) {
const isSelect = value.enum
const message = messageSwich(isSelect) + (value.title || '')
value['x-rules'] = Array.isArray(value['x-rules']) ? value['x-rules'].concat([{ message, required: true }]) : [{message, required: true}]
}
if (value.properties) {
padRequiredMessage(value)
}
return value
})
return originSchema
}
export interface FileData {
uid: string;
name: string;
status: 'uploading' | 'done' | 'error' | 'removed';
url: string;
};
/**
* 初始化 Upload 数据
*/
export function normalizeFiledata(url: string): FileData
export function normalizeFiledata(url: any): any {
if (!url) {
return url;
}
const splited = url.split('/');
const fileName = splited && splited.length ? splited[splited.length - 1] : '';
return {
uid: Math.random().toFixed(16).slice(2, 10),
name: fileName,
status: 'done',
url,
};
};
/**
* 检查是否还有更多
* @param {Number} curPage 当前页码
* @param {Number} curSize 当前页数
* @param {Number} dataLen 当前数据长度
* @param {Number} dataTotal 数据总长度
*/
export const checkMore = (curPage: number, curSize: number, dataLen: number, dataTotal: number) => {
let hasMore = true;
if (!dataLen || dataLen + (curPage - 1) * curSize >= +dataTotal) {
hasMore = false;
}
return hasMore;
};
/**
*
* @param {string} str 需要判断是否是 JSON字符串的 字符串
*/
export const isJSONStr = str => {
if (typeof str === 'string') {
try {
const complete = JSON.parse(str);
return complete;
} catch(e) {
return null;
}
}
return str;
}
/**
* 给 Table columns 的 filters 赋值
* @param {array} data 需要赋值的数组
* @param {string} dataIndex 索引
* @param {array} item 需要赋值的值
*/
export const coverColFiltersItem = (
data: Array<{[key: string]: any}>,
dataIndex: string,
item: {[key: string]: any}
) => {
const index = data.findIndex(i => i.dataIndex === dataIndex);
if (index !== -1) {
data.splice(index, 1, {
...data[index],
filters: item,
});
}
};
export default {
isArray,
isObject,
transformDataPre
}
\ No newline at end of file
import deepClone from 'clone'
import moment from 'moment';
import { ISchema } from '@formily/antd';
function isArray(arr: any) {
return Array.isArray(arr)
}
export const findArrayItem = (arr: Array<any>, flag: any) => {
const result = arr.find(v => v.value === flag)
return result ? result : {}
}
/**
* 找到最后一个可用的工作流状态的索引
* @param {array} data 数据
* @param {string} customKey 自定义 key
*/
export const findLastIndexFlowState = (data: any[], customKey = 'isExecute'): number => {
let index = 0;
if (!Array.isArray(data)) {
return index;
}
// 循环数据,找到状态值,一直覆盖
for (let i = 0; i < data.length; i++) {
if (data[i][customKey]) {
index = i;
}
}
return index;
};
export function formatTimeString(date, format: string = 'YYYY-MM-DD HH:mm:ss') {
return date ? moment(date).format(format) : ''
}
export function isObject(obj: any) {
return Object.prototype.toString.call(obj) === '[object Object]'
}
function transformDataPre(data: object, key: string): object {
const trans = {}
Object.getOwnPropertyNames(data).forEach(k => {
trans[`${key}.${k}`] = data[k]
})
return trans
}
const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
export function timeRange(val: number) {
let st, et;
switch (val) {
case 0:
st = et = '';
break;
case 1:
st = moment(
moment()
.startOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).valueOf();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).valueOf();
break;
case 2:
st = moment(
moment()
.subtract(7, 'days')
.format('YYYY-MM-DD') + ' 00:00:00',
).valueOf();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).valueOf();
break;
case 3:
st = moment(
moment()
.subtract(29, 'days')
.format('YYYY-MM-DD') + ' 00:00:00',
).valueOf();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).valueOf();
break;
case 4:
st = moment(
moment()
.subtract(89, 'days')
.format('YYYY-MM-DD') + ' 00:00:00',
).valueOf();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).valueOf();
break;
case 5:
st = moment(
moment()
.subtract(179, 'days')
.format('YYYY-MM-DD') + ' 00:00:00',
).valueOf();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).valueOf();
break;
case 6:
st = moment(
moment()
.subtract(364, 'days')
.format('YYYY-MM-DD') + ' 00:00:00',
).valueOf();
et = moment(
moment()
.endOf('days')
.format('YYYY-MM-DD HH:mm:ss'),
).valueOf();
break;
case 7:
st = moment('1971-01-01', 'YYYY-MM-DD').valueOf(); // 或者0
et = moment().subtract(1, "year").valueOf();
break;
}
return { st, et }
}
export const isUrl = (path: string): boolean => reg.test(path);
/**
* @description 用于将传入的接口,并行请求,并组装成Select组件可识别的形式返回
* @param asyncList {Array} 异步函数数组
*/
export const getAsyncSelectList = async (asyncList: any[]) => {
try {
const result = await Promise.all(asyncList)
return result.map(v => v.data.map(j => {
return {
label: j.name,
value: j.id
}
}))
} catch (error) {
return error
}
}
// 抽离对象中的某些属性, 并返回一个新对象
export const omit = (obj: any, arr: string[]): any => {
const newObj = deepClone(obj)
for(let item = 0; item < arr.length; item++) {
if (obj[arr[item]] !== undefined) {
delete newObj[arr[item]]
}
}
return newObj
}
/**
* @param { Object[] } arr 源数据
* @param { any } target 目标值 通常是id等主键
* @param { string } customKey 可选 自定义主键 默认'id'
*/
export const findItemAndDelete = (arr: any[], target: any, customKey?: string) => {
const newArr = [...arr]
if (newArr.length > 0 && isObject(newArr[0])) {
return newArr.filter(v => v[customKey||'id'] !== target)
}
const targetIndex = arr.indexOf(target)
if (targetIndex === -1) {
return newArr
} else {
newArr.splice(targetIndex, 1)
return newArr
}
}
// 遍历树拿到所有key的集合
export const findTreeKeys = (arr: any[], keyword?: string) => {
const copyArr: any[] = deepClone(arr)
const results: any[] = []
while(copyArr.length > 0) {
const item = copyArr.shift()
results.push(keyword ? item[keyword] : item.key)
if (item.children) {
copyArr.push(...item.children)
}
}
return results
}
// 树形结构降为一维对象处理
export const treeReduction = (data: any[]) => {
const hashMaps = {}
const selfData: any[] = deepClone(data)
while (selfData.length > 0) {
const useItem = selfData.shift()
// 存在子集
if (useItem.children && useItem.children.length > 0) {
useItem.children = useItem.children.map(v => {
v.parentId = useItem.id
return v
})
selfData.push(...useItem.children)
}
hashMaps[useItem.id] = useItem
}
return hashMaps
}
// 获取某一节点的title路径
export const getParentTreeTitles = (dataSouce, key) => {
const hashMaps = treeReduction(dataSouce)
let targetKey = key
let targetPath = ''
while (targetKey !== '') {
if (!hashMaps[targetKey]) {
break
}
const title = hashMaps[targetKey].title
targetPath = targetPath === '' ? title : `${title}-${targetPath}`
targetKey = hashMaps[targetKey].parentId || ''
}
return targetPath
}
// 数组通过某个key进行去重合并, 并返回一个新数组
export const mergeArrByKey = (preArr: any[], nextArr: any[], target?: string) => {
const mergeArr = preArr.concat(nextArr)
if (target) {
const result: any[] = []
mergeArr.forEach(v => {
const s = result.find(j => j[target] === v[target])
if (!s) {
result.push(v)
}
})
return result
} else {
return Array.from(new Set(mergeArr))
}
}
// 数组去重
export const dupliArr = (arr: any[]) => {
return Array.from(new Set(arr))
}
// 填充必填的schema message提示
export const padRequiredMessage = (originSchema: ISchema) => {
const messageSwich = (type) => {
return type ? '请选择' : '请输入'
}
const todoFn = (targetSchema) => {
}
Object.entries(originSchema.properties).map(([key, value]) => {
if (value.required) {
const isSelect = value.enum
const message = messageSwich(isSelect) + (value.title || '')
value['x-rules'] = Array.isArray(value['x-rules']) ? value['x-rules'].concat([{ message, required: true }]) : [{message, required: true}]
}
if (value.properties) {
padRequiredMessage(value)
}
return value
})
return originSchema
}
export interface FileData {
uid: string;
name: string;
status: 'uploading' | 'done' | 'error' | 'removed';
url: string;
};
/**
* 初始化 Upload 数据
*/
export function normalizeFiledata(url: string): FileData
export function normalizeFiledata(url: any): any {
if (!url) {
return url;
}
const splited = url.split('/');
const fileName = splited && splited.length ? splited[splited.length - 1] : '';
return {
uid: Math.random().toFixed(16).slice(2, 10),
name: fileName,
status: 'done',
url,
};
};
/**
* 检查是否还有更多
* @param {Number} curPage 当前页码
* @param {Number} curSize 当前页数
* @param {Number} dataLen 当前数据长度
* @param {Number} dataTotal 数据总长度
*/
export const checkMore = (curPage: number, curSize: number, dataLen: number, dataTotal: number) => {
let hasMore = true;
if (!dataLen || dataLen + (curPage - 1) * curSize >= +dataTotal) {
hasMore = false;
}
return hasMore;
};
/**
*
* @param {string} str 需要判断是否是 JSON字符串的 字符串
*/
export const isJSONStr = str => {
if (typeof str === 'string') {
try {
const complete = JSON.parse(str);
return complete;
} catch(e) {
return null;
}
}
return str;
}
/**
* 给 Table columns 的 filters 赋值
* @param {array} data 需要赋值的数组
* @param {string} dataIndex 索引
* @param {array} item 需要赋值的值
*/
export const coverColFiltersItem = (
data: Array<{[key: string]: any}>,
dataIndex: string,
item: {[key: string]: any}
) => {
const index = data.findIndex(i => i.dataIndex === dataIndex);
if (index !== -1) {
data.splice(index, 1, {
...data[index],
filters: item,
});
}
};
export default {
isArray,
isObject,
transformDataPre
}
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