iccid卡号加入显示限制
This commit is contained in:
parent
8f8daad4f4
commit
9c45d8e390
@ -330,7 +330,8 @@ var iccidList=[]
|
|||||||
|
|
||||||
this.api.popupwindow({userId:userInfo.userid}).then(res1=>{
|
this.api.popupwindow({userId:userInfo.userid}).then(res1=>{
|
||||||
data.forEach((el,index)=>{
|
data.forEach((el,index)=>{
|
||||||
this.api.qibenGeticcid(el).then(res=>{
|
if(this.validateIccid(el.iccid)){
|
||||||
|
this.api.qibenGeticcid(el).then(res=>{
|
||||||
if(res.data.code==200){
|
if(res.data.code==200){
|
||||||
iccidList.push(res.data.data)
|
iccidList.push(res.data.data)
|
||||||
this.$store.state.iccidList=iccidList
|
this.$store.state.iccidList=iccidList
|
||||||
@ -346,11 +347,37 @@ var iccidList=[]
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
// 判断iccid是否显示
|
||||||
|
validateIccid(iccidcode) {
|
||||||
|
// 如果 iccidcode 是 false(严格判断,排除 0、"" 等情况)
|
||||||
|
if (!iccidcode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 如果 iccidcode 不是字符串,先转为字符串(防止数字 0 等情况)
|
||||||
|
const str = String(iccidcode);
|
||||||
|
|
||||||
|
// 检测是否全为 0
|
||||||
|
const isAllZeros = /^0+$/.test(str);
|
||||||
|
|
||||||
|
// 检测是否包含中文(Unicode 范围:\u4e00-\u9fa5)
|
||||||
|
const hasChinese = /[\u4e00-\u9fa5]/.test(str);
|
||||||
|
// 如果全为 0 或包含中文,返回 false
|
||||||
|
if (isAllZeros || hasChinese) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 其他情况返回 true(表示有效)
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
//获取设备
|
//获取设备
|
||||||
getEqbyid(selTrue) {
|
getEqbyid(selTrue) {
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- 控制器/施肥机 -->
|
<!-- 控制器/施肥机 -->
|
||||||
<div class="page-content new-data" v-else :class="deviceName !=1 ? 'control-page' : ''">
|
<div class="page-content new-data" v-else :class="deviceName !=1 ? 'control-page' : ''">
|
||||||
<div class="page-iccid"><span>卡号:{{$store.state.equipmentList[indexs - 1].iccidcode?$store.state.equipmentList[indexs - 1].iccidcode:''}}</span> <span>到期时间: </span><span :class="getPackageTimeColor()?'color-red':''">{{getPackageTime()}}<span v-if="getPackageTimeColor()">(即将到期)</span></span> </div>
|
<div class="page-iccid" v-if="validateIccid($store.state.equipmentList[indexs - 1].iccidcode)"><span>卡号:{{$store.state.equipmentList[indexs - 1].iccidcode?$store.state.equipmentList[indexs - 1].iccidcode:''}}</span> <span>到期时间: </span><span :class="getPackageTimeColor()?'color-red':''">{{getPackageTime()}}<span v-if="getPackageTimeColor()">(即将到期)</span></span> </div>
|
||||||
<div class="control-view" v-if="deviceName !=1">
|
<div class="control-view" v-if="deviceName !=1">
|
||||||
<div class="title" @click='weatherModel = true'>气象站:</div>
|
<div class="title" @click='weatherModel = true'>气象站:</div>
|
||||||
<vue-seamless class="control-list" :data="controlList" :class-option="defaultOption1">
|
<vue-seamless class="control-list" :data="controlList" :class-option="defaultOption1">
|
||||||
@ -1090,6 +1090,30 @@ export default {
|
|||||||
return chunks.join(":");
|
return chunks.join(":");
|
||||||
// 使用join方法将切割后的数组元素用冒号连接起来
|
// 使用join方法将切割后的数组元素用冒号连接起来
|
||||||
},
|
},
|
||||||
|
// 判断iccid是否显示
|
||||||
|
validateIccid(iccidcode) {
|
||||||
|
// 如果 iccidcode 是 false(严格判断,排除 0、"" 等情况)
|
||||||
|
if (iccidcode === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果 iccidcode 不是字符串,先转为字符串(防止数字 0 等情况)
|
||||||
|
const str = String(iccidcode);
|
||||||
|
|
||||||
|
// 检测是否全为 0
|
||||||
|
const isAllZeros = /^0+$/.test(str);
|
||||||
|
|
||||||
|
// 检测是否包含中文(Unicode 范围:\u4e00-\u9fa5)
|
||||||
|
const hasChinese = /[\u4e00-\u9fa5]/.test(str);
|
||||||
|
|
||||||
|
// 如果全为 0 或包含中文,返回 false
|
||||||
|
if (isAllZeros || hasChinese) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 其他情况返回 true(表示有效)
|
||||||
|
return true;
|
||||||
|
},
|
||||||
//countType计算类型
|
//countType计算类型
|
||||||
//0是原数据
|
//0是原数据
|
||||||
//1是原数据-400
|
//1是原数据-400
|
||||||
|
Loading…
x
Reference in New Issue
Block a user