From 2281e3ac9929818587d658c78741a8f5351cded6 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 09 七月 2020 17:02:06 +0800
Subject: [PATCH] #
---
src/main/webapp/views/pdaCe/index.html | 134 ++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 127 insertions(+), 7 deletions(-)
diff --git a/src/main/webapp/views/pdaCe/index.html b/src/main/webapp/views/pdaCe/index.html
index 81d7f1e..fce94cf 100644
--- a/src/main/webapp/views/pdaCe/index.html
+++ b/src/main/webapp/views/pdaCe/index.html
@@ -134,7 +134,7 @@
<div id="btn-con">
<button style="margin-right: 20px" onclick="reset()">閲嶇疆</button>
- <button >缁勬墭</button>
+ <button onclick="comb()">缁勬墭</button>
<span id="tips"></span>
</div>
@@ -162,6 +162,7 @@
</body>
<script>
var matMsgTableBlankRows = 0; // 绌虹櫧琛屾暟
+ var matData = []; // 琛ㄦ牸鏁版嵁
var code = document.getElementById("code")
var matnr = document.getElementById("matnr")
var matMsg = document.getElementById("mat-msg-id");
@@ -171,12 +172,12 @@
var btnCon = document.getElementById("btn-con");
var tipDom = document.getElementById("tips");
- var matetail = document.getElementById("mat-detail");
+ var matDetail = document.getElementById("mat-detail");
var matName = document.getElementById("matName");
var str1 = document.getElementById("str1");
var count = document.getElementById("count");
- matetail.style.display = 'none';
+ matDetail.style.display = 'none';
var initMatCount = 1;
// 鏌ヨ鐗╂祦
@@ -193,7 +194,7 @@
// 鏍峰紡
matMsg.style.display = 'none';
btnCon.style.display = 'none';
- matetail.style.display = 'block';
+ matDetail.style.display = 'block';
// 濉厖鏁版嵁
matName.value = res.data.matName;
str1.value = res.data.str1;
@@ -201,17 +202,77 @@
} else {
matMsg.style.display = 'block';
btnCon.style.display = 'block';
- matetail.style.display = 'none';
+ matDetail.style.display = 'none';
}
} else {
alert(res.msg);
}
+ })
+ }
+ // 缁勬墭
+ function comb() {
+ var barcode = code.value;
+ if (isEmpty(barcode)) {
+ tips("鎵樼洏鏉$爜涓虹┖", true);
+ // document.getElementById("code").focus();
+ return;
+ }
+ if (matData.length === 0) {
+ tips("璇锋彁鍙栫墿鏂�", true);
+ return;
+ }
+ httpRequest({
+ httpUrl: baseUrl+"/mobile/comb/auth",
+ type: 'post',
+ data: JSON.stringify({
+ barcode: barcode,
+ combMats: matData
+ }),
+ }, function (res) {
+ if (res.code === 200) {
+ if (res.data != null) {
+ // 鏍峰紡
+ matMsg.style.display = 'none';
+ btnCon.style.display = 'none';
+ matDetail.style.display = 'block';
+ // 濉厖鏁版嵁
+ matName.value = res.data.matName;
+ str1.value = res.data.str1;
+ count.value = initMatCount;
+ } else {
+ matMsg.style.display = 'block';
+ btnCon.style.display = 'block';
+ matDetail.style.display = 'none';
+ }
+ } else {
+ alert(res.msg);
+ }
+ })
+ $.ajax({
+ url: baseUrl+"/mobile/comb/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: JSON.stringify({
+ barcode: barcode,
+ combMats: matData
+ }),
+ contentType:'application/json;charset=UTF-8',
+ method: 'POST',
+ async: false,
+ success: function (res) {
+ if (res.code === 200) {
+ reset();
+ tips("缁勬墭鎴愬姛")
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/pda";
+ } else {
+ tips(res.msg, true)
+ }
+ }
})
}
initCrnMsgTable();
- // 鍫嗗灈鏈烘暟鎹〃鑾峰彇 ----- 琛ㄤ簩
function initCrnMsgTable(row) {
var line;
if (row === undefined){
@@ -224,7 +285,6 @@
} else {
line = row;
}
-
var html = "";
for (var i = 0; i < line; i ++){
html += " <div>\n" +
@@ -237,10 +297,44 @@
ttbody.innerHTML = html;
}
+ // 娣诲姞琛ㄦ牸鏁版嵁
+ function addTableData(data) {
+ if (isEmpty(data.matName)){
+ tips("鎻愬彇澶辫触");
+ return;
+ }
+ var toPush = true;
+ for (var j=0;j<matData.length;j++){
+ if (data.matnr === matData[j].matnr) {
+ matData[j].count = Number(matData[j].count) + Number(data.count);
+ toPush = false;
+ }
+ }
+ if (toPush) {
+ matData.push(data);
+ }
+ var html = "";
+ for (var i=0;i<matData.length;i++) {
+ html += " <div class='table-data'>\n" +
+ " <span>" + matData[i].matnr + "</span>\n" +
+ " <span>" + matData[i].matName + "</span>\n" +
+ " <span>" + matData[i].str1 + "</span>\n" +
+ " <span>" + matData[i].count + "</span>\n" +
+ " </div>\n";
+ }
+
+ ttbody.innerHTML = html;
+ }
+
// 閲嶇疆
function reset() {
code.value = "";
matnr.value = "";
+ cancel();
+ while(ttbody.hasChildNodes()) {
+ ttbody.removeChild(ttbody.firstChild);
+
+ }
}
/**
@@ -257,6 +351,32 @@
}
}
+ /**
+ * 璇︽儏
+ */
+ // 鎻愬彇
+ function confirm() {
+ addTableData({
+ matnr: matnr.value,
+ matName: matName.value,
+ str1: str1.value,
+ count: count.value
+ })
+ cancel();
+ tips("鎻愬彇鎴愬姛");
+ }
+ // 鍙栨秷
+ function cancel() {
+ matnr.value = "";
+ matName.value = "";
+ str1.value = "";
+ count.value = initMatCount;
+ matMsg.style.display = 'block';
+ btnCon.style.display = 'block';
+ matDetail.style.display = 'none';
+ tips("");
+ }
+
function add() {
count.value = Number(count.value) + 1;
}
--
Gitblit v1.9.1