fix: 导入人员列表后卡住
初始化数据时,提供的字段值为string类型,使用push方法报错。
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
// 筛选人员数据
|
// 筛选人员数据
|
||||||
export const filterData = (tableData: any[],localRowCount: number,startIndex=0) => {
|
export const filterData = (tableData: any[], localRowCount: number, startIndex = 0) => {
|
||||||
const dataLength = tableData.length
|
const dataLength = tableData.length
|
||||||
let j = 0;
|
let j = 0;
|
||||||
for (let i = 0; i < dataLength; i++) {
|
for (let i = 0; i < dataLength; i++) {
|
||||||
@@ -14,26 +14,27 @@ export const filterData = (tableData: any[],localRowCount: number,startIndex=0)
|
|||||||
tableData[i].isWin = false
|
tableData[i].isWin = false
|
||||||
}
|
}
|
||||||
|
|
||||||
return tableData
|
return tableData
|
||||||
}
|
}
|
||||||
|
|
||||||
export const addOtherInfo=(personList:any[])=>{
|
export const addOtherInfo = (personList: any[]) => {
|
||||||
const len=personList.length;
|
const len = personList.length;
|
||||||
for(let i=0;i<len;i++){
|
for (let i = 0; i < len; i++) {
|
||||||
personList[i].createTime=dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss');
|
personList[i].createTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss');
|
||||||
personList[i].updateTime=dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss');
|
personList[i].updateTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss');
|
||||||
personList[i].prizeName='';
|
personList[i].prizeName = [] as string[];
|
||||||
personList[i].prizeTime='';
|
personList[i].prizeTime = [] as string[];
|
||||||
|
personList[i].prizeId = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return personList
|
return personList
|
||||||
}
|
}
|
||||||
|
|
||||||
export const selectCard=(cardIndexArr:number[],tableLength:number,personId:number):number=>{
|
export const selectCard = (cardIndexArr: number[], tableLength: number, personId: number): number => {
|
||||||
const cardIndex = Math.round(Math.random() * (tableLength-1));
|
const cardIndex = Math.round(Math.random() * (tableLength - 1));
|
||||||
if(cardIndexArr.includes(cardIndex)){
|
if (cardIndexArr.includes(cardIndex)) {
|
||||||
return selectCard(cardIndexArr,tableLength,personId)
|
return selectCard(cardIndexArr, tableLength, personId)
|
||||||
}
|
}
|
||||||
|
|
||||||
return cardIndex
|
return cardIndex
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user