12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- import { setallLampHttp, getStatusHttp } from '@/services/ant-design-pro/equipment';
- export const checkChangeLightStatusSuccess = (paramsArr, resultArr, fn) => {
- let checkParams = paramsArr;
- checkParams.forEach((item) => {
- for (let i = 0; i < resultArr.length; i++) {
- if ((item.id = resultArr[i].id)) {
- item.orderSeqNum = resultArr[i].orderSeqNum;
- }
- }
- });
- getStatusHttp(checkParams).then((res) => {
- judgeChangeResponeseSuccess(res, paramsArr, fn);
- });
- };
- export const judgeChangeResponeseSuccess = (response, paramsArr, fn) => {
- let resFlag = false;
- let resultArr = JSON.parse(JSON.stringify(response.content));
- resultArr &&
- resultArr.forEach((item) => {
- if (
- (item.state === 200 && item.exeResult === 'processing:rcvd') ||
- (item.state === 202 && !item.exeResult)
- ) {
- resFlag = true;
- } else {
- resultArr.splice(item, 1);
- }
- });
- if (resFlag) {
- setTimeout(() => {
- checkChangeLightStatusSuccess(paramsArr, resultArr, fn);
- }, 500);
- } else {
- fn && fn();
- }
-
- };
- export const setallLamps = (paramsArr, fn, waitSetResultFlag) => {
-
- setallLampHttp(paramsArr).then((res) => {
-
- waitSetResultFlag && (waitSetResultFlag.current = false);
- judgeChangeResponeseSuccess(res, paramsArr, fn);
- });
- };
|