js校验数组中"POSTMEASURESTEPSEQ"不能为空[{ "SAMPLINGMODE": "Target Sampling", "MEASURESTEPSEQ": "095200.1.095600", "MEASURESTAGE": "UPCH-STRIP", "MEASURESTEPDESC": "MEAS:UCH AEI OVERLAY(UCH TO LCH) YS1375", "PROCESSRECIPE": "4A9-00D000@AY08800.649CA1", "MEASURESTEPID": "AMBCHOL1Y.0", "MEASURECAPABILITY": "AMIAIDM", "PROCESSSTEPDESC": "UCH PHOTO(QTIME TO UCH PHOTO DEVELOP 4HR)", "POSTMEASURESTEPSEQ": "", "PACKAGEGROUP": "" }, { "SAMPLINGMODE": "Target Sampling", "MEASURESTEPSEQ": "095200.1.095600", "MEASURESTAGE": "UPCH-STRIP", "MEASURESTEPDESC": "MEAS:UCH AEI OVERLAY(UCH TO LCH) YS1375", "PROCESSRECIPE": "500-030000", "MEASURESTEPID": "AMBCHOL1Y.0", "MEASURECAPABILITY": "AMIAIDM", "PROCESSSTEPDESC": "UCH PHOTO DEVELOP(QTIME TO UCH HMO 48HR)", "POSTMEASURESTEPSEQ": "", "PACKAGEGROUP": "" }, { "SAMPLINGMODE": "Target Sampling", "MEASURESTEPSEQ": "095200.1.095600", "MEASURESTAGE": "UPCH-STRIP", "MEASURESTEPDESC": "MEAS:UCH AEI OVERLAY(UCH TO LCH) YS1375", "PROCESSRECIPE": "EP-NA232UCH-01", "MEASURESTEPID": "AMBCHOL1Y.0", "MEASURECAPABILITY": "AMIAIDM", "PROCESSSTEPDESC": "UCH ETCH(QTIME TO UCH ETCH ASHING 12HR)", "POSTMEASURESTEPSEQ": "", "PACKAGEGROUP": "", }],第一次检测到就提示“不能通过”
时间: 2023-07-31 07:04:22 浏览: 134
你可以使用以下代码来检查数组中的"POSTMEASURESTEPSEQ"是否为空,并在第一次检测到为空时给出提示:
```javascript
// 假设数组存储在变量data中
const data = [
{
"SAMPLINGMODE": "Target Sampling",
"MEASURESTEPSEQ": "095200.1.095600",
"MEASURESTAGE": "UPCH-STRIP",
"MEASURESTEPDESC": "MEAS:UCH AEI OVERLAY(UCH TO LCH) YS1375",
"PROCESSRECIPE": "4A9-00D000@AY08800.649CA1",
"MEASURESTEPID": "AMBCHOL1Y.0",
"MEASURECAPABILITY": "AMIAIDM",
"PROCESSSTEPDESC": "UCH PHOTO(QTIME TO UCH PHOTO DEVELOP 4HR)",
"POSTMEASURESTEPSEQ": "",
"PACKAGEGROUP": ""
},
{
"SAMPLINGMODE": "Target Sampling",
"MEASURESTEPSEQ": "095200.1.095600",
"MEASURESTAGE": "UPCH-STRIP",
"MEASURESTEPDESC": "MEAS:UCH AEI OVERLAY(UCH TO LCH) YS1375",
"PROCESSRECIPE": "500-030000",
"MEASURESTEPID": "AMBCHOL1Y.0",
"MEASURECAPABILITY": "AMIAIDM",
"PROCESSSTEPDESC": "UCH PHOTO DEVELOP(QTIME TO UCH HMO 48HR)",
"POSTMEASURESTEPSEQ": "",
"PACKAGEGROUP": ""
},
{
"SAMPLINGMODE": "Target Sampling",
"MEASURESTEPSEQ": "095200.1.095600",
"MEASURESTAGE": "UPCH-STRIP",
"MEASURESTEPDESC": "MEAS:UCH AEI OVERLAY(UCH TO LCH) YS1375",
"PROCESSRECIPE": "EP-NA232UCH-01",
"MEASURESTEPID": "AMBCHOL1Y.0",
"MEASURECAPABILITY": "AMIAIDM",
"PROCESSSTEPDESC": "UCH ETCH(QTIME TO UCH ETCH ASHING 12HR)",
"POSTMEASURESTEPSEQ": "",
"PACKAGEGROUP": ""
}
];
let isEmptyFound = false;
for (const item of data) {
if (item.POSTMEASURESTEPSEQ === "") {
isEmptyFound = true;
break;
}
}
if (isEmptyFound) {
console.log("不能通过");
} else {
console.log("可以通过");
}
```
这段代码会遍历数组中的每个对象,检查它们的"POSTMEASURESTEPSEQ"属性是否为空。如果找到了空值,就会给出提示"不能通过";如果没有找到空值,就会给出提示"可以通过"。你可以根据需要修改提示的方式,比如使用弹窗或在页面上显示提示信息。
阅读全文