|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | changeNumber(num, index, unitAttribute) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (unitAttribute === 0 && num !== '') { | 
|---|
|  |  |  | if (!positiveInteger.test(num)) { | 
|---|
|  |  |  | uni.$u.toast({ | 
|---|
|  |  |  | message: '只能输入正整数' | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | uni.$u.toast('只能输入正整数') | 
|---|
|  |  |  | this.materialList[index].num = '' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else if (unitAttribute === 1 && num !== '') { | 
|---|
|  |  |  | if (!number.test(num)) { | 
|---|
|  |  |  | uni.$u.toast({ | 
|---|
|  |  |  | message: '只能输入正整数或小数(最多四位)' | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | uni.$u.toast('只能输入正整数或小数(最多四位)') | 
|---|
|  |  |  | this.materialList[index].num = '' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (num <= 0) { | 
|---|
|  |  |  | uni.$u.toast({ | 
|---|
|  |  |  | message: '投料数量不能小于等于0' | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | uni.$u.toast('投料数量不能小于等于0') | 
|---|
|  |  |  | this.materialList[index].num = '' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|