From ce85e6d09eaafa4758ffeccacf8867969dca54ac Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期五, 09 六月 2023 15:01:00 +0800
Subject: [PATCH] apk
---
igds-app/js/admin/inout-out-handle-list.js | 439 ++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 326 insertions(+), 113 deletions(-)
diff --git a/igds-app/js/admin/inout-out-handle-list.js b/igds-app/js/admin/inout-out-handle-list.js
index 50c9d8c..7d0eb95 100644
--- a/igds-app/js/admin/inout-out-handle-list.js
+++ b/igds-app/js/admin/inout-out-handle-list.js
@@ -12,131 +12,133 @@
"intelCard": ""
}
};
-
+var data1 = {
+ "interfaceId": "5208",
+ "outId": "10208",
+ "reqDateTime": new Date(),
+ "tokenAuth": "",
+ "data": {
+ "type": "OUT",
+ "id": "",
+ "intelCard": ""
+ }
+};
//鍒濆鍖栨暟鎹�
function init() {
var user = JSON.parse(localStorage.getItem('user'));
var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId'));
url = user.url + "/api-phone/v35/gateway";
data.tokenAuth = user.tokenAuth;
+ data1.tokenAuth = user.tokenAuth;
data.data.deptId = selectDeptId;
- getOutHandleList();
+ getInHandleList();
}
//鏌ヨ鍑哄簱璁板綍
-function getOutHandleList() {
+function getInHandleList() {
outHandleData = null;
+ //鏌ヨ鐨勮溅鐗屽彿
data.data.plateNum = mui("#plateNum")[0].value;
- // //璇锋眰
- // mui.ajax(url, {
- // type: "POST",
- // dataType: "json",
- // crossDomain: true,
- // contentType: "application/json;charset=utf-8",
- // data: JSON.stringify(data),
- // success: function(result) {
- // if (result.code == "0000") {
- // outHandleData = result.data;
- // console.log("if",JSON.stringify(result))
- // renderData();
- // } else {
- // renderData();
- // mui.toast(result.msg);
- // console.log("else",JSON.stringify(result))
- // }
- // },
- // error: function() {
- // mui.alert("绯荤粺绻佸繖,璇烽噸璇曪紒", "鎻愮ず", ["纭畾"], function() {}, "div")
- // }
- // })
- outHandleData = [{
- "id": "44",
- "plateNum": "97",
- "deHandle": "ut",
- "depotId": "16",
- "depotName": "闈掑紶鍒楀仛鎬�",
- "foodVariety": "magna pariatur laboris sunt dolor",
- "foodVarietyName": "鎻愭竻闄�",
- "foodLevel": "fugiat",
- "foodLevelName": "搴斿彂鐑洓姘戞槸濮�",
- "storeKeeperName":""
+ //璇锋眰
+ mui.ajax(url, {
+ type: "POST",
+ dataType: "json",
+ crossDomain: true,
+ contentType: "application/json;charset=utf-8",
+ data: JSON.stringify(data),
+ success: function(result) {
+ if (result.code == "0000") {
+ outHandleData = result.data;
+ console.log("if", JSON.stringify(result))
+ renderData();
+ } else {
+ renderData();
+ mui.toast(result.msg);
+ console.log("else", JSON.stringify(result))
+ }
},
- {
- "id": "62",
- "plateNum": "71",
- "deHandle": "dolore ut non",
- "depotId": "79",
- "depotName": "澧炶薄瀹氱珛鏍�",
- "foodVariety": "Lorem est",
- "foodVarietyName": "甯傛潯缇ゆ眰琚洟涓�",
- "foodLevel": "ex labore",
- "foodLevelName": "鎸佸湪鍐欑О鎯呭苟",
- "storeKeeperName":"2"
- },
- {
- "id": "96",
- "plateNum": "61",
- "deHandle": "nulla magna ut proident cillum",
- "depotId": "42",
- "depotName": "鏉″叏浠�",
- "foodVariety": "aliquip",
- "foodVarietyName": "杩炲紑闃跺姩闄呭共",
- "foodLevel": "in id sunt",
- "foodLevelName": "娌$疆瀹氫娇鏂�",
- "storeKeeperName":"3"
- },
- {
- "id": "61",
- "plateNum": "17",
- "deHandle": "commodo",
- "depotId": "80",
- "depotName": "灞曡蹇伀鍏ㄩ",
- "foodVariety": "voluptate eu Lorem",
- "foodVarietyName": "浠栬竟娲炬柉閲嶇",
- "foodLevel": "dolor",
- "foodLevelName": "瑁呯涓�",
- "storeKeeperName":"4"
+ error: function() {
+ mui.alert("绯荤粺绻佸繖,璇烽噸璇曪紒", "鎻愮ず", ["纭畾"], function() {}, "div")
}
- ]
+ })
+ // outHandleData = [{
+ // "id": "44",
+ // "plateNum": "97",
+ // "deHandle": "ut",
+ // "depotId": "16",
+ // "depotName": "闈掑紶鍒楀仛鎬�",
+ // "foodVariety": "magna pariatur laboris sunt dolor",
+ // "foodVarietyName": "鎻愭竻闄�",
+ // "foodLevel": "fugiat",
+ // "foodLevelName": "搴斿彂鐑洓姘戞槸濮�",
+ // "storeKeeperName": ""
+ // },
+ // {
+ // "id": "62",
+ // "plateNum": "71",
+ // "deHandle": "dolore ut non",
+ // "depotId": "79",
+ // "depotName": "澧炶薄瀹氱珛鏍�",
+ // "foodVariety": "Lorem est",
+ // "foodVarietyName": "甯傛潯缇ゆ眰琚洟涓�",
+ // "foodLevel": "ex labore",
+ // "foodLevelName": "鎸佸湪鍐欑О鎯呭苟",
+ // "storeKeeperName": "2"
+ // },
+ // {
+ // "id": "96",
+ // "plateNum": "61",
+ // "deHandle": "nulla magna ut proident cillum",
+ // "depotId": "42",
+ // "depotName": "鏉″叏浠�",
+ // "foodVariety": "aliquip",
+ // "foodVarietyName": "杩炲紑闃跺姩闄呭共",
+ // "foodLevel": "in id sunt",
+ // "foodLevelName": "娌$疆瀹氫娇鏂�",
+ // "storeKeeperName": "3"
+ // },
+ // {
+ // "id": "61",
+ // "plateNum": "17",
+ // "deHandle": "commodo",
+ // "depotId": "80",
+ // "depotName": "灞曡蹇伀鍏ㄩ",
+ // "foodVariety": "voluptate eu Lorem",
+ // "foodVarietyName": "浠栬竟娲炬柉閲嶇",
+ // "foodLevel": "dolor",
+ // "foodLevelName": "瑁呯涓�",
+ // "storeKeeperName": "4"
+ // }
+ // ]
renderData();
}
//娓叉煋椤甸潰
function renderData() {
var html = '';
- if (outHandleData) {
- if (outHandleData && outHandleData.length > 0) {
- $.each(outHandleData, function(index, item) {
- html += '<li><div class="con"><div class="top">';
- html += '<div class="info">杞︾墝鍙�: <b>' + (item.plateNum == null ? "" : item.plateNum) +
- '</b></div>';
- html += '<a href="" id = "' + item.id + '" plateNum = "' + item.plateNum + '" depotName = "' +
- item.depotName + '" storeKeeperName = "' + (item.storeKeeperName == ""||item.storeKeeperName == "" ? '--' : item.storeKeeperName)+
- '" class="link">鍊间粨<span class="mui-icon mui-icon-arrowright"></span></a>';
- html += '</div><div class="box">';
- html +=
- '<div class="item"><div class="conbox" style="background-image: url(images/icons/g-i19.png);">';
- html += '<div class="h3">' + (item.depotName == null ? "" : item.depotName) + '</div>';
- html += '<div class="bot">鐩爣浠撳簱</div></div></div>';
- html +=
- '<div class="item"><div class="conbox" style="background-image: url(images/icons/g-i20.png);">';
- html += '<div class="h3">' + (item.foodVarietyName == null ? "" : item.foodVarietyName) +
- '</div>';
- html += '<div class="bot">绮鍝佺</div></div></div>';
- html +=
- '<div class="item"><div class="conbox" style="background-image: url(images/icons/g-i21.png);">';
- html += '<div class="h3">' + (item.foodLevelName == null ? "" : item.foodLevelName) + '</div>';
- html += '<div class="bot">绮绛夌骇</div></div></div>';
- html += '</div></div></li>';
- })
- } else {
- html +=
- '<li><div class="con"><div style="text-align: center;font-size: 20px;color:#dd524d;padding-top: 16px;">鏆傛棤鍏ュ簱寰呭�间粨淇℃伅</div></div></li>';
- }
+ if (outHandleData && outHandleData.length > 0) {
+ $.each(outHandleData, function(index, item) {
+ html += '<li><div class="con"><div class="top">';
+ html += '<div class="info">杞︾墝鍙�: <b>' + (item.plateNum == null ? "" : item.plateNum) + '</b></div>';
+ html += '<a href="" id = "' + item.id + '" plateNum = "' + item.plateNum + '" depotName = "' + item.depotName + '" storeKeeperName = "' +
+ (item.storeKeeperName == "" || item.storeKeeperName == "" ? '--' : item.storeKeeperName) + '" class="link">鍊间粨<span class="mui-icon mui-icon-arrowright"></span></a>';
+ html += '</div><div class="box">';
+ html += '<div class="item"><div class="conbox" style="background-image: url(images/icons/g-i19.png);">';
+ html += '<div class="h3">' + (item.depotName == null ? "" : item.depotName) + '</div>';
+ html += '<div class="bot">鐩爣浠撳簱</div></div></div>';
+ html += '<div class="item"><div class="conbox" style="background-image: url(images/icons/g-i20.png);">';
+ html += '<div class="h3">' + (item.foodVarietyName == null ? "" : item.foodVarietyName) + '</div>';
+ html += '<div class="bot">绮鍝佺</div></div></div>';
+ html += '<div class="item"><div class="conbox" style="background-image: url(images/icons/g-i21.png);">';
+ html += '<div class="h3">' + (item.foodLevelName == null ? "" : item.foodLevelName) + '</div>';
+ html += '<div class="bot">绮绛夌骇</div></div></div>';
+ html += '</div></div></li>';
+ })
} else {
html +=
'<li><div class="con"><div style="text-align: center;font-size: 20px;color:#dd524d;padding-top: 16px;">鏆傛棤鍏ュ簱寰呭�间粨淇℃伅</div></div></li>';
}
+
$("#handleList").html(html);
}
@@ -146,22 +148,233 @@
var depotName = this.getAttribute("depotName")
var plateNum = this.getAttribute("plateNum")
var storeKeeperName = this.getAttribute("storeKeeperName")
- mui.openWindow({
- url: "inout-out-handle.html",
- id: "inout-out-handle",
- extras: {
- data:{
- serialNumber: id,
- plateNum: plateNum,
- depotName: depotName,
- storeKeeperName:storeKeeperName
- }
+
+ var picker = new mui.PopPicker();
+ picker.setData([{
+ value: "photo",
+ text: "鐜板満鍊间粨"
+
+ }, {
+ value: "snap",
+ text: "杩滅▼鍊间粨"
+ }])
+ picker.show(function(SelectedItem) {
+ console.log(JSON.stringify(SelectedItem));
+ if (SelectedItem.value == 'photo') {
+ mui.openWindow({
+ url: "inout-out-handle.html",
+ id: "inout-out-handle",
+ extras: {
+ data: {
+ serialNumber: id,
+ plateNum: plateNum,
+ depotName: depotName,
+ storeKeeperName: storeKeeperName
+ }
+ }
+ })
+ } else {
+ mui.openWindow({
+ url: "inout-out-handle.html",
+ id: "inout-out-handle",
+ extras: {
+ data: {
+ serialNumber: id,
+ plateNum: plateNum,
+ depotName: depotName,
+ storeKeeperName: storeKeeperName
+ }
+ }
+ })
}
-
})
-
});
+/*---------------NFC璇诲崱鍔熻兘-------------------*/
+var waiting;
+var readyRead = false;
+//璇诲崱鏂规硶
+function readCard() {
+ readyRead = true;
+ listenNFCStatus();
+}
+
+var NfcAdapter;
+var NdefRecord;
+var NdefMessage;
+var count = 0;
+
+//鐩戝惉NFC鐘舵��
+function listenNFCStatus() {
+ try {
+ var main = plus.android.runtimeMainActivity();
+ var Intent = plus.android.importClass('android.content.Intent');
+ var Activity = plus.android.importClass('android.app.Activity');
+ var PendingIntent = plus.android.importClass('android.app.PendingIntent');
+ var IntentFilter = plus.android.importClass('android.content.IntentFilter');
+ NfcAdapter = plus.android.importClass('android.nfc.NfcAdapter');
+ var nfcAdapter = NfcAdapter.getDefaultAdapter(main);
+ //鍒ゆ柇璁惧鏄惁鏀寔NFC鍔熻兘
+ if (nfcAdapter == null) {
+ mui.alert("璁惧涓嶆敮鎸丯FC鍔熻兘锛�", '鎻愮ず', ["纭畾"], function() {}, "div");
+ return;
+ }
+ //鍒ゆ柇璁惧鏄惁寮�鍚疦FC鍔熻兘
+ if (!nfcAdapter.isEnabled()) {
+ mui.alert("璇峰湪绯荤粺璁剧疆涓惎鐢∟FC鍔熻兘锛�", '鎻愮ず', ["纭畾"], function() {}, "div");
+ return;
+ }
+ waiting = plus.nativeUI.showWaiting("璇峰皢NFC鏍囩闈犺繎锛�");
+
+ //鍊掕鏃�10绉掞紝璇诲彇涓嶅埌鍚庢彁绀烘槸鍚﹂噸鏂拌鍗�
+ var interval = setInterval(function() { //瀹氫箟瀹氭椂鍣�
+ count++;
+ if (count == 10 && readyRead) {
+ readyRead = false;
+ count = 0;
+ waiting.close();
+ clearInterval(interval); //娓呴櫎瀹氭椂鍣�
+ var btnArray = ["閲嶈瘯", "鍙栨秷"];
+ mui.confirm("宸茶秴鏃讹紝鏄惁閲嶆柊璇诲崱锛�", "鎻愮ず", btnArray, function(e) {
+ if (e.index == 0) {
+ readCard();
+ }
+ }, "div")
+ }
+ }, 1000);
+
+ var intent = new Intent(main, main.getClass());
+ intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
+ var pendingIntent = PendingIntent.getActivity(main, 0, intent, 0);
+ var ndef = new IntentFilter("android.nfc.action.TECH_DISCOVERED");
+ ndef.addDataType("*/*");
+ var intentFiltersArray = [ndef];
+ var techListsArray = [
+ ["android.nfc.tech.IsoDep"],
+ ["android.nfc.tech.NfcA"],
+ ["android.nfc.tech.NfcB"],
+ ["android.nfc.tech.NfcF"],
+ ["android.nfc.tech.Ndef"],
+ ["android.nfc.tech.NfcV"],
+ ["android.nfc.tech.NdefFormatable"],
+ ["android.nfc.tech.MifareClassic"],
+ ["android.nfc.tech.MifareUltralight"]
+ ];
+ document.addEventListener("newintent",
+ function() {
+ setTimeout(readData, 1000);
+ }, false);
+ document.addEventListener("pause", function(e) {
+ if (nfcAdapter) {
+ nfcAdapter.disableForegroundDispatch(main);
+ }
+ }, false);
+ document.addEventListener("resume", function(e) {
+ if (nfcAdapter) {
+ nfcAdapter.enableForegroundDispatch(main, pendingIntent, intentFiltersArray, techListsArray);
+ }
+ }, false);
+ nfcAdapter.enableForegroundDispatch(main, pendingIntent, intentFiltersArray, techListsArray);
+ } catch (e) {
+ mui.toast("璇诲崱澶辫触锛岃閲嶈瘯锛�");
+ waiting.close();
+ }
+}
+
+//璇诲彇鏁版嵁
+function readData() {
+ NdefRecord = plus.android.importClass("android.nfc.NdefRecord");
+ NdefMessage = plus.android.importClass("android.nfc.NdefMessage");
+ var main = plus.android.runtimeMainActivity();
+ var intent = main.getIntent();
+ // if ("android.nfc.action.TAG_DISCOVERED" == intent.getAction()) { //鐪熸満璋冭瘯
+ if ("android.nfc.action.TECH_DISCOVERED" == intent.getAction()) { //鎵撳寘
+ if (readyRead) {
+ readyRead = false;
+
+ waiting.setTitle('璇峰嬁绉诲紑鏍囩\n姝e湪璇诲彇鏁版嵁...');
+ var Parcelable = plus.android.importClass("android.os.Parcelable");
+ //璇诲彇id
+ var byteId = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);
+ //灏唅d杞负16杩涘埗瀛楃涓�
+ var id = ByteArrayToHexString(byteId);
+ //鍏抽棴绛夊緟鍦嗗湀
+ waiting.close();
+
+ //璇诲彇id鎴愬姛锛岃祴鍊煎苟鍙戦�佽姹傛煡璇�
+ data1.data.intelCard = id;
+ getInoutDetail();
+ }
+ } else {
+ waiting.close();
+ mui.alert('璇诲彇澶辫触锛岃閲嶈瘯锛�', '鎻愮ず', ["纭畾"], function() {}, "div");
+ }
+}
+
+//鑾峰彇鍊间粨鍗曞瓙璇︾粏淇℃伅
+function getInoutDetail() {
+ mui.ajax(url, {
+ type: "POST",
+ dataType: "json",
+ crossDomain: true,
+ contentType: "application/json;charset=utf-8",
+ data: JSON.stringify(data1),
+ success: function(result) {
+ if (result.code == "0000") {
+ //寮圭獥淇℃伅锛氬崟瀛愯溅鐗岃窡浠撳簱锛屽幓鍊间粨鍒欒繘鍏ュ�间粨椤甸潰锛屼紶閫掑崟瀛恑d锛�
+ var btnArray = ["鍘诲�间粨", "鍙栨秷"];
+ var text = '鍊间粨浠撳簱:' + result.data.depotName + '<br/>杞︾墝鍙凤細' + result.data.plateNum;
+ mui.confirm(text, "妫�娴嬪埌寰呭�间粨淇℃伅濡備笅", btnArray, function(e) {
+ if (e.index == 0) {
+ //鍏堝垽鏂崟瀛愭槸鍚﹀湪鍊间粨鐘舵��
+ if (result.data.progress == "HANDLE") {
+ //鍘诲�间粨鏃跺垽鏂崟瀛愮被鍨嬫槸鍚︽槸鍏ュ簱锛屼笉鏄粰鍑烘彁閱掞紱
+ if (result.data.type == "OUT") {
+ mui.openWindow({
+ url: "inout-out-handle.html",
+ id: "inout-out-handle",
+ extras: {
+ data: {
+ serialNumber: result.data.id,
+ plateNum: result.data.plateNum,
+ depotName: result.data.depotName,
+ storeKeeperName: result.data.storeKeeperName
+ }
+ }
+ })
+ } else {
+ mui.alert("璇ュ崱淇℃伅涓嶆槸鍑哄簱绫诲瀷锛岃鏍稿锛�", "鎻愮ず", ["纭畾"], function() {}, "div")
+ }
+ } else {
+ mui.alert("褰撳墠鍗′笉鍦ㄥ�间粨鐘舵�侊紝璇锋牳鏌ワ紒", "鎻愮ず", ["纭畾"], function() {}, "div")
+ }
+ }
+ }, "div")
+ } else {
+ mui.toast(result.msg);
+ }
+ },
+ error: function() {
+ mui.alert('绯荤粺绻佸繖,璇烽噸璇曪紒', '鎻愮ず', ["纭畾"], function() {}, "div");
+ }
+ })
+}
+
+//灏嗗瓧鑺傛暟缁勮浆涓�16杩涘埗瀛楃涓�
+function ByteArrayToHexString(inarray) {
+ var i, j, inn;
+ hex = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"];
+ out = "";
+ for (j = 0; j < inarray.length; ++j) {
+ inn = inarray[j] & 0xff;
+ i = (inn >>> 4) & 0x0f;
+ out += hex[i];
+ i = inn & 0x0f;
+ out += hex[i];
+ }
+ return out;
+}
+
mui('.mui-scroll-wrapper').scroll({
indicators: false, //鏄惁鏄剧ず婊氬姩鏉�
deceleration: 0.0006, //闃诲凹绯绘暟,绯绘暟瓒婂皬婊戝姩瓒婄伒鏁�
--
Gitblit v1.9.3