From 70bde89905aa72e21901aa08ffd4573345b51311 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期四, 31 七月 2025 11:31:02 +0800
Subject: [PATCH] 优化页面逻辑
---
pages/caigoudingdan/generate.vue | 50 +++++++--
pages/shouliaotongzhi/table.vue | 21 +++
pages/zhijiediaobo/form.vue | 86 ++++++++++++++---
utils/elemIterator.js | 49 +++++++++
pages/tiaomadaying/tiaomadaying.vue | 41 +++++--
pages/caigoudingdan/caigoudingdan.vue | 25 +++-
6 files changed, 222 insertions(+), 50 deletions(-)
diff --git a/pages/caigoudingdan/caigoudingdan.vue b/pages/caigoudingdan/caigoudingdan.vue
index d1ae9ec..7cf3c02 100644
--- a/pages/caigoudingdan/caigoudingdan.vue
+++ b/pages/caigoudingdan/caigoudingdan.vue
@@ -4,7 +4,7 @@
<view class="form-item">
<view class="title"><text>*</text>鏉$爜:</view>
<view class="right" style="width: 380rpx;">
- <input auto-focus v-model="HBarCode" placeholder="璇锋壂鎻�(鎴栬緭鍏�)鏉$爜" @focus="HBarCode = ''" @blur="getCode(HBarCode)" @confirm="getCode(HBarCode)" />
+ <input :focus="HBarCodeFocus" v-model="HBarCode" placeholder="璇锋壂鎻�(鎴栬緭鍏�)鏉$爜" @confirm="getCode(HBarCode)" />
</view>
<uni-icons type="scan"
style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;"
@@ -32,7 +32,7 @@
<view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
- <view class="list" v-for="(item,index) in listData" :key="index" @tap="toSon(item)">
+ <view class="list" v-for="(item,index) in listData" :key="index" @tap="toSon(item, index+1)">
<uni-card :title="item.鐗╂枡浠g爜" :extra="'No. ' + Number(index+1)" style="margin: 10px;">
<view class="card-detail">
<view class="detail">
@@ -64,6 +64,7 @@
export default {
data() {
return {
+ HBarCodeFocus: true,
userInfo: getUserInfo(),
serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
HBarCode: '',
@@ -77,7 +78,9 @@
listData: [],
}
},
- onLoad() {},
+ onLoad() {
+ this.HBarCodeFocus = true
+ },
methods: {
//鎵爜
toScanCode() {
@@ -107,7 +110,7 @@
(res) => {
console.log('閲囪喘璁㈠崟: ', res)
let {data, count, Message} = res.data
- if(count == 0 && data.count > 0){
+ if(count == 1 && Array.from(data).length> 0){
CommonUtils.playSound(1)
this.baseInfo = {
HBillNo: data[0].鍗曟嵁鍙�,
@@ -118,6 +121,7 @@
this.listData = data
} else {
CommonUtils.playSound(0)
+ this.refeshBarcodeState()
uni.showToast({
title: "姝ゆ潯鐮佹棤杩斿洖鍊�...",
icon: 'none'
@@ -125,15 +129,24 @@
}
},
(err) => {
+ this.refeshBarcodeState()
CommonUtils.playSound(0)
}
)
}
},
- toSon(item) {
+ async refeshBarcodeState(){
+ this.HBarCodeFocus = false
+
+ await this.$nextTick(() => {
+ this.HBarCode = ""
+ this.HBarCodeFocus = true
+ })
+ },
+ toSon(item, lineNo) {
uni.navigateTo({
- url: `./generate?OperationType=1&closeType=1&linterid=${this.baseInfo.HInterID}&hmaterid=${item["HMaterID"]}`
+ url: `./generate?OperationType=1&closeType=1&linterid=${this.baseInfo.HInterID}&hmaterid=${item["HMaterID"]}&lineNo=${lineNo}`
})
}
}
diff --git a/pages/caigoudingdan/generate.vue b/pages/caigoudingdan/generate.vue
index 95ab858..dc3a29a 100644
--- a/pages/caigoudingdan/generate.vue
+++ b/pages/caigoudingdan/generate.vue
@@ -98,6 +98,7 @@
export default {
data() {
return {
+ lineNo: 0,
printInfo: "",
userInfo: getUserInfo(),
serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
@@ -109,6 +110,7 @@
baseInfo: {
HBillNo: '',
HMainID: '',
+ HSupName: '',
HSubID: '',
HOrderBillNo: '',
HMaterID: '',
@@ -121,6 +123,8 @@
HMinQty: '',
HBQty: '',
HSupID: '',
+ HBatchNo: '',
+ HDate: '',
},
sWhere: '',
listData: [],
@@ -131,10 +135,11 @@
labelPrinterComponentVue
},
onLoad(e) {
- console.log(e)
+ console.log("椤甸潰浼犻�掑弬鏁�: ",e)
this.OperationType = e.OperationType
this.linterid = e.linterid
this.hmaterid = e.hmaterid
+ this.lineNo = e.lineNo
this.getData()
},
methods: {
@@ -161,7 +166,11 @@
HMaterModel: data[0]['瑙勬牸鍨嬪彿'],
HQty: data[0]['鏁伴噺'],
HMTONo: data[0]['璁″垝璺熻釜鍙�'],
- HSupID: data[0]['HSupID']
+ HSupID: data[0]['HSupID'],
+ HBatchNo: data[0]['鎵瑰彿'],
+ HSupName: data[0]['渚涘簲鍟�'],
+ HBatchNo: data[0]['鎵瑰彿'],
+ HDate: data[0]['鏃ユ湡'],
}
this.listData = data
} else {
@@ -205,22 +214,35 @@
B QR 500 30 M 2 U 3
LA,${listOne['鏉$爜缂栧彿']}
ENDQR
-T 24 0 30 30 渚涘簲鍟�: ${listOne['渚涘簲鍟�']}
-T 24 0 30 80 渚涘簲鍟嗘枡鍙�:
-T 24 0 30 130 鐗╂枡缂栫爜: ${listOne['鐗╂枡浠g爜']}
-T 24 0 30 180 鐗╂枡鍒嗙粍: ${listOne['鎵樺彿']}
-T 24 0 300 180 瑙勬牸鍨嬪彿: ${listOne['瑙勬牸鍨嬪彿']}
-T 24 0 30 230 鏁伴噺: ${listOne['鏁伴噺']}
-T 24 0 300 230 鏃ユ湡: ${listOne['鏃ユ湡'].split(" ")[0]}
-T 24 0 30 280 妫�楠屽憳:
-T 24 0 300 280 璁″垝璺熻釜鍙�: ${listOne['璁″垝璺熻釜鍙�']}
-T 24 0 30 330 妫�楠岀粨鏋�:
+T 24 0 10 30 渚涘簲鍟�: ${this.baseInfo.HSupName}
+T 24 0 10 55 (eng)
+T 24 0 10 80 渚涘簲鍟嗘枡鍙�: ${this.baseInfo.HMaterNumber}
+T 24 0 10 105 (eng)
+T 24 0 10 130 鐗╂枡鍚嶇О: ${this.baseInfo.HMaterName}
+T 24 0 5 155 (eng)
+T 24 0 5 180 鍒嗙粍: ${this.baseInfo.HBatchNo}
+T 24 0 5 205 (eng)
+T 24 0 300 180 瑙勬牸: ${this.baseInfo.HMaterModel}
+T 24 0 300 205 (eng)
+T 24 0 10 230 鏁伴噺: ${this.baseInfo.HQty} (${this.baseInfo.HPcsName})
+T 24 0 5 255 (eng)
+T 24 0 300 230 鏃ユ湡: ${this.baseInfo.HDate}
+T 24 0 300 255 (eng)
+T 24 0 5 280 妫�楠屽憳:
+T 24 0 5 305 (eng)
+T 24 0 300 280 閲囪喘鍗曞彿: ${this.baseInfo.HBillNo || ''}
+T 24 0 300 305 (eng)
+T 24 0 5 330 妫�楠岀粨鏋�:
+T 24 0 5 355 (eng)
BOX 260 330 280 350 4
T 24 0 290 330 鍚堟牸
+T 24 0 290 355 (eng)
BOX 360 330 380 350 4
T 24 0 390 330 涓嶅悎鏍�
+T 24 0 390 355 (eng)
BOX 480 330 500 350 4
T 24 0 510 330 鐗归噰
+T 24 0 510 355 (eng)
FORM
PRINT`)
count++;
@@ -249,9 +271,9 @@
//鑾峰彇閫夋嫨鐨勫伐鍘備唬鐮�
var CampanyName = "xxx";
//鑾峰彇閫夋嫨鐨勬簮鍗曠被鍨�
- var HSourceBillType = "鏀舵枡閫氱煡鍗�";
+ var HSourceBillType = "閲囪喘璁㈠崟";
//鑾峰彇閫夋嫨鐨勬潯鐮佺被鍨�
- var HSelectBarCodeType = "鍞竴鏉$爜";
+ var HSelectBarCodeType = "鍝佺鏉$爜";
//鑾峰彇褰撳墠鐧诲綍浜哄憳
var UserName = uni.getStorageSync('HUserName');
var sMainSub = sMainStr + ';' + HOrgType + ';' + HSourceBillType + ';' + HSelectBarCodeType + ';' +
diff --git a/pages/shouliaotongzhi/table.vue b/pages/shouliaotongzhi/table.vue
index 4337840..41adb4b 100644
--- a/pages/shouliaotongzhi/table.vue
+++ b/pages/shouliaotongzhi/table.vue
@@ -4,7 +4,7 @@
<view class="form-item">
<view class="title"><text>*</text>鏉$爜:</view>
<view class="right" style="width: 380rpx;">
- <input auto-focus v-model="HBarCode" placeholder="璇锋壂鎻�(鎴栬緭鍏�)鏉$爜" @confirm="getCode(HBarCode)"/>
+ <input :focus="HBarCodeFocus" v-model="HBarCode" placeholder="璇锋壂鎻�(鎴栬緭鍏�)鏉$爜" @confirm="getCode(HBarCode)"/>
</view>
<uni-icons type="scan" style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20" @click="toScanCode"></uni-icons>
</view>
@@ -57,6 +57,8 @@
export default {
data() {
return {
+ HBarCodeFocus: false,
+
userInfo:getUserInfo(),
serverUrl: uni.getStorageSync('serverUrl')||'http://47.96.97.237/API',
HBarCode:'',
@@ -70,9 +72,18 @@
listData:[],
}
},
- onLoad() {},
+ onLoad() {
+ this.HBarCodeFocus = true
+ },
methods: {
- playSound(e){
+ async refreshBarCodeState() {
+ this.HBarCodeFocus = false
+ await this.$nextTick(() => {
+ this.HBarCodeFocus = true
+ this.HBarCode = ""
+ })
+ },
+ playSound(e){
const innerAudioContext = uni.createInnerAudioContext();
if(e == 1){
innerAudioContext.src = '/static/success.wav';
@@ -96,6 +107,8 @@
//鎵潯鐮佸鐞�
getCode(HBarCode){
if(!HBarCode){
+ this.playSound(0)
+ this.refreshBarCodeState()
uni.showToast({
title:'鏉$爜涓嶈兘涓虹┖',
icon:'none'
@@ -119,6 +132,7 @@
this.listData = data
}else{
this.playSound(0)
+ this.refreshBarCodeState()
uni.showToast({
title:res.data.Message,
icon:'none'
@@ -127,6 +141,7 @@
},
fail: (res) => {
this.playSound(0)
+ this.refreshBarCodeState()
console.log(res);
uni.showToast({
title:'鎺ュ彛璇锋眰澶辫触',
diff --git a/pages/tiaomadaying/tiaomadaying.vue b/pages/tiaomadaying/tiaomadaying.vue
index 2ba04ff..db9a6f2 100644
--- a/pages/tiaomadaying/tiaomadaying.vue
+++ b/pages/tiaomadaying/tiaomadaying.vue
@@ -6,7 +6,8 @@
<view class="item">
<view class="left">鏉$爜缂栧彿锛�</view>
<view class="right barcode">
- <input auto-focus name="HBarCode" v-model="lailiaoInfo.barCodeNo" @focus="lailiaoInfo.barCodeNo = ''" @blur="barCodeEntryHandler(lailiaoInfo.barCodeNo)"
+ <input :focus="HBarCodeFocus" name="HBarCode" v-model="lailiaoInfo.barCodeNo"
+ @focus="lailiaoInfo.barCodeNo = ''" @confirm="barCodeEntryHandler(lailiaoInfo.barCodeNo)"
placeholder="璇锋壂鎻忓晢鍝佹潯鐮�" />
</view>
<view>
@@ -121,6 +122,8 @@
export default {
data() {
return {
+ HBarCodeFocus: false,
+
printInfo: "",
userInfo: getUserInfo(),
buttonStatus: {
@@ -155,7 +158,17 @@
components: {
labelPrinterComponentVue
},
+ onLoad() {
+ this.HBarCodeFocus = true
+ },
methods: {
+ async refreshBarcodeState() {
+ this.HBarCodeFocus = false
+ await this.$nextTick(() => {
+ this.HBarCodeFocus = true
+ this.lailiaoInfo.barCodeNo = ""
+ })
+ },
async print() {
if (this.$printer.isConnected() === false) {
this.$refs.labelPrinter.openPopup()
@@ -281,7 +294,7 @@
// await this.$nextTick(() => {
// this.$refs.labelPrinter.execPrint()
// })
-// T 24 0 300 280 璁″垝璺熻釜鍙�: ${this.lailiaoInfo.HMTONo || ''}
+ // T 24 0 300 280 璁″垝璺熻釜鍙�: ${this.lailiaoInfo.HMTONo || ''}
this.printInfo = `! 0 200 200 400 1
PAGE-WIDTH 608
SETQRVER 3
@@ -334,10 +347,10 @@
icon: 'none',
title: '鏌ヨ鐨勫崟鎹彿涓嶅瓨鍦�...'
})
-
+
}
let d = data[row - 1]
- console.log('鏉$爜鎺ユ敹鏁版嵁: ',d)
+ console.log('鏉$爜鎺ユ敹鏁版嵁: ', d)
this.lailiaoInfo = Object.assign(this.lailiaoInfo, {
HMaterNumber: d['鐗╂枡缂栫爜'],
HMaterName: d['鐗╂枡鍚嶇О'],
@@ -386,13 +399,14 @@
btn2: false
}
},
- barCodeEntryHandler(barCode){
+ barCodeEntryHandler(barCode) {
if (CommonUtils.isEmpty(barCode) === false) {
console.log('鏉$爜鍐呭锛�' + barCode);
this.lailiaoInfo.barCodeNo = barCode;
if (barCode.includes("@") === false) {
this.buttonStatus.btn2 = false
CommonUtils.playSound(0)
+ this.refreshBarcodeState()
return uni.showToast({
icon: 'none',
title: '鏉$爜鏍煎紡閿欒锛岃閲嶆柊鎵弿...'
@@ -418,22 +432,24 @@
count
} = res.data
if (count > 0) {
-
+
this.setLailiaoInfo(data, Row)
-
- }else {
+
+ } else {
CommonUtils.playSound(0)
+ this.refreshBarcodeState()
}
},
(error) => {
CommonUtils.playSound(0)
+ this.refreshBarcodeState()
this.buttonStatus.btn2 = false
}
)
-
+
}
},
- toScanCode() {
+ toScanCode() {
uni.scanCode({
onlyFromCamera: true,
success: (res) => {
@@ -442,7 +458,8 @@
});
},
GenereateBarCode() {
- let HBarCodeNoStr = `${this.lailiaoInfo.HBillNo}@${this.lailiaoInfo.HBillLineNo}@${this.lailiaoInfo.HMaterNumber}@${this.lailiaoInfo.HMTONo}@${this.lailiaoInfo.HQty}@${this.lailiaoInfo.HSupID}`
+ let HBarCodeNoStr =
+ `${this.lailiaoInfo.HBillNo}@${this.lailiaoInfo.HBillLineNo}@${this.lailiaoInfo.HMaterNumber}@${this.lailiaoInfo.HMTONo}@${this.lailiaoInfo.HQty}@${this.lailiaoInfo.HSupID}`
let sMain = []
sMain[0] = this.lailiaoInfo
let sMainStr = JSON.stringify(sMain);
@@ -567,7 +584,7 @@
}
}
-
+
.barcode {
background-color: #fff !important;
}
diff --git a/pages/zhijiediaobo/form.vue b/pages/zhijiediaobo/form.vue
index 8ca98a2..647fc74 100644
--- a/pages/zhijiediaobo/form.vue
+++ b/pages/zhijiediaobo/form.vue
@@ -4,7 +4,8 @@
<view class="form-item">
<view class="title">鏉$爜:</view>
<view class="right" style="width: 380rpx;">
- <input v-model="hform.HBarCode" placeholder="璇锋壂鎻�(鎴栬緭鍏�)鏉$爜" @confirm="getCode(hform.HBarCode)" />
+ <input :focus="barCodeFocus" v-model="hform.HBarCode" placeholder="璇锋壂鎻�(鎴栬緭鍏�)鏉$爜"
+ @confirm="getCode(hform.HBarCode)" />
</view>
<view class="icon-wrapper">
<uni-icons type="scan" size="20" @click="toScanCode"></uni-icons>
@@ -63,7 +64,8 @@
<view class="right" v-show="showHSourceBillNo">
<!-- <uni-combox v-if="reHSourceBillNo" :candidates="arrayHSourceBillNo" placeholder="璇疯緭鍏ユ簮鍗曞崟鍙�"
v-model="hform.HSourceBillNo" @input="HSourceBillNoChange"></uni-combox> -->
- <input type="text" name="HSourceBillNo" v-model="hform.HSourceBillNo" placeholder="璇疯緭鍏ユ簮鍗曞崟鍙�" />
+ <input :focus="HSourcebillNoFocus" type="text" @confirm="onHSourceBillNoConfirmHandler" name="HSourceBillNo"
+ v-model="hform.HSourceBillNo" placeholder="璇疯緭鍏ユ簮鍗曞崟鍙�" />
</view>
<view class="icon-wrapper" v-show="showHSourceBillNo" :disabled="hform.HMainSourceBillType === -1">
@@ -352,17 +354,19 @@
import {
getUserInfo
} from "@/utils/auth.js";
+ import elemIterator from '../../utils/elemIterator';
import BillListPopupVue from '../../components/BillListPopup/BillListPopup.vue';
export default {
data() {
return {
+
userInfo: getUserInfo(),
serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
HModName: 'Kf_MoveStockBill_PDA',
ModRightName: 'CE_MoveStock',
OperationType: 1,
HInterID_Temp: '',
-
+
HSCIsStockMgr: false,
HIsStockMgr: false,
showHStockPlaceName: true,
@@ -370,6 +374,8 @@
showHSourceBillNo: true,
reHSourceBillNo: true,
showHSupName: true,
+ barCodeFocus: false,
+ HSourcebillNoFocus: false,
HStockStyleArray: ["缁勭粐鍐呰皟鎷�", "璺ㄧ粍缁囪皟鎷�"],
@@ -417,17 +423,17 @@
HQty: '',
HSCWHName: getUserInfo().HWHName,
HSCWHID: getUserInfo().HWhID,
- HWHName: getUserInfo().HWHName,
- HWHID: getUserInfo().HWhID,
+ HWHName: "",
+ HWHID: "",
HStockStyle: '缁勭粐鍐呰皟鎷�',
- HOutStockPlaceName: getUserInfo().HSPName,
+ HOutStockPlaceName: getUserInfo().HSPName,
HOutStockPlaceID: getUserInfo().HSPID,
HStockPlaceName: getUserInfo().HSPName,
HStockPlaceID: getUserInfo().HSPID,
HTransferDirect: '', //璋冩嫧鏂瑰悜
HShipType: '', // 鍑哄簱绫诲瀷
- HMainSourceBillType: 3720,
+ HMainSourceBillType: 1402,
HSourceBillNo: '', //CGDD000200
HFIFOWHName: '',
HFIFOWHID: '',
@@ -468,8 +474,10 @@
if (e.HInterID) {
this.HInterID_Temp = e.HInterID
// this.btnType = 1
+ this.barCodeFocus = true
this.RoadBillMain(e.HInterID)
} else {
+ this.HSourcebillNoFocus = true
this.getNewData()
}
this.getHBaseList()
@@ -520,6 +528,15 @@
}
}
)
+ },
+ onHSourceBillNoConfirmHandler() {
+ if (this.hform.HMainSourceBillType == -1) {
+ // 鎵嬪伐褰曞叆涓嶈繘琛屾彁浜�
+ this.playSound(1)
+ return
+ }
+
+ this.getHBarCodeData(this.hform.HSourceBillNo)
},
playSound(e) {
const innerAudioContext = uni.createInnerAudioContext();
@@ -1048,7 +1065,7 @@
this.hform.HFIFOWHID = 0
}
uni.request({
- url: this.serverUrl + '/WEBSController/get_SourceBarCode_MateOut_Json',
+ url: this.serverUrl + '/WEBSController/get_SourceBarCode_MoveStock_Json',
data: {
HInterID: this.hform.HInterID,
HBillNo: this.hform.HBillNo,
@@ -1056,10 +1073,10 @@
HSourceBillNo: HBarCode,
HSourceBillType: this.hform.HMainSourceBillType,
HMaker: this.hform.HMaker,
- HStockOrgID: this.hform.HStockOrgID,
- HFIFOWHID: this.hform.HFIFOWHID,
- HPTQty: this.hform.HPTQty || 0,
- HPlanMode: this.hform.HPlanMode || 0
+ HOWNERID: this.hform.HStockOrgID,
+ HFIFOWhID: this.hform.HFIFOWHID,
+ // HPTQty: this.hform.HPTQty || 0,
+ // HPlanMode: this.hform.HPlanMode || 0
},
success: (res) => {
if (res.data.count == 1) {
@@ -1078,19 +1095,35 @@
}
this.tabs = 2
this.showHSupName = false
+ this.barCodeFocus = true
+ this.playSound(1)
this.DisBillEntryList()
} else {
+ this.playSound(0)
+ console.log('res: ',res);
+
uni.showToast({
title: res.data.Message,
icon: 'none'
})
+ this.HSourcebillNoFocus = false
+ this.$nextTick(() => {
+ this.hform.HSourceBillNo = ""
+ this.HSourcebillNoFocus = true
+ })
}
},
- fail: (res) => {
- console.log(res);
+ fail: (err) => {
+ console.log('err: ',err);
+ this.playSound(0)
uni.showToast({
title: '鎺ュ彛璇锋眰澶辫触',
icon: 'none'
+ })
+ this.HSourcebillNoFocus = false
+ this.$nextTick(() => {
+ this.hform.HSourceBillNo = ""
+ this.HSourcebillNoFocus = true
})
},
});
@@ -1139,18 +1172,30 @@
this.DisBillEntryList()
} else {
this.playSound(0)
+
uni.showToast({
title: res.data.Message,
icon: 'none'
+ })
+ this.barCodeFocus = false
+ this.$nextTick(() => {
+ this.barCodeFocus = true
+ this.hform.HBarCode = ""
})
}
},
fail: (res) => {
this.playSound(0)
+ this.barCodeFocus = true
console.log(res);
uni.showToast({
title: '鎺ュ彛璇锋眰澶辫触',
icon: 'none'
+ })
+ this.barCodeFocus = false
+ this.$nextTick(() => {
+ this.barCodeFocus = true
+ this.hform.HBarCode = ""
})
},
});
@@ -1277,14 +1322,25 @@
title: res.data.Message,
icon: 'none'
})
+ this.barCodeFocus = false
+ this.$nextTick(() => {
+ this.barCodeFocus = true
+ this.hform.HBarCode = ""
+ })
}
},
fail: (res) => {
this.playSound(0)
+ this.barCodeFocus = true
console.log(res);
uni.showToast({
title: '鎺ュ彛璇锋眰澶辫触',
icon: 'none'
+ })
+ this.barCodeFocus = false
+ this.$nextTick(() => {
+ this.barCodeFocus = true
+ this.hform.HBarCode = ""
})
},
});
@@ -1593,7 +1649,7 @@
}
}
},
-
+
goBack() {
uni.showModal({
title: '鎻愮ず',
diff --git a/utils/elemIterator.js b/utils/elemIterator.js
new file mode 100644
index 0000000..0e539a9
--- /dev/null
+++ b/utils/elemIterator.js
@@ -0,0 +1,49 @@
+import { CommonUtils } from "./common"
+
+export default class elemIterator{
+ current = 0
+ elemArray = []
+ constructor(current, elemArray){
+ if(CommonUtils.isAllDigits(current) == false) {
+ current = 0
+ }
+
+ if(Array.isArray(elemArray) == false){
+ elemArray = []
+ }
+
+ this.current = Number(current)
+ this.elemArray = elemArray
+ }
+
+ setElemArray(elemArray) {
+ if(Array.isArray(elemArray) == false){
+ throw new TypeError()
+ }
+ this.elemArray = elemArray
+ }
+
+ setElemArrayArgs(...args) {
+ this.elemArray = args
+ }
+
+ moveNext(){
+ this.current++
+ if(this.current == this.elemArray.length){
+ this.current = 0
+ }
+ }
+
+ getCurrentElem(){
+ return this.elemArray[this.current]
+ }
+
+ exec(callback){
+ if(Object.prototype.toString.call(callback) !== '[object Function]'){
+ throw new TypeError()
+ }
+
+ callback.call(null, this.elemArray[this.current])
+ }
+}
+
--
Gitblit v1.9.1