From f6abc8c724eed706487b7616bc6c816e5db5c939 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期二, 09 十二月 2025 20:13:48 +0800
Subject: [PATCH] 数量检测页面提交
---
fzzy-igdss-web/src/main/resources/static/grain/grain-check1.js | 718 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 718 insertions(+), 0 deletions(-)
diff --git a/fzzy-igdss-web/src/main/resources/static/grain/grain-check1.js b/fzzy-igdss-web/src/main/resources/static/grain/grain-check1.js
new file mode 100644
index 0000000..8df0c66
--- /dev/null
+++ b/fzzy-igdss-web/src/main/resources/static/grain/grain-check1.js
@@ -0,0 +1,718 @@
+var layer;
+var grainData;// 褰撳墠浠撶伯鎯呮暟鎹�
+var form;
+var table;
+var element;
+var compareData = null;// 瀵规瘮鏁版嵁
+var listGrainData;// 榛樿椤甸潰涓殑绮儏鍒楄〃
+var mapGrainData;// 鎵归噺鎵撳嵃涓殑鎵归噺绮儏淇℃伅
+
+$(function () {
+ layui.use(['layer', 'laydate', 'form', 'table', 'element'], function () {
+ element = layui.element;
+ form = layui.form;
+ layer = layui.layer;
+ var laydate = layui.laydate;
+ table = layui.table;
+
+ // 鏃ユ湡
+ laydate.render({
+ elem: '#checkDateMore',
+ type: 'month',
+ theme: '#7b8e9f',
+ position: 'static',
+ done: function (value, date, endDate) {
+ flushGrain(value);
+ }
+ });
+
+ laydate.render({
+ elem: '#compareCheckDate',
+ type: 'month',
+ theme: '#7b8e9f',
+ done: function (value, date, endDate) {
+ compareStep2(value);
+ }
+ });
+
+ laydate.render({
+ elem: '#printCheckDate',
+ theme: '#7b8e9f'
+ });
+
+ laydate.render({
+ elem: '#printCheckDate2',
+ theme: '#7b8e9f'
+ });
+ form.render();
+
+ // 鐩戝惉浠撳簱閫夋嫨
+ form.on('select(select_depotId)', function (obj) {
+ return changeView();
+ });
+
+ // 鐩戝惉閫夋嫨鎵规
+ form.on('select(select_batchId)', function (obj) {
+ var value = obj.value;
+ if (value == "0") {// 琛ㄧず寮瑰嚭鏇村鎵规
+ showMore();
+ } else {
+ flushGrainByBatchId(value);
+ }
+ });
+
+ // 鐩戝惉鏄剧ず绫诲瀷
+ form.on('switch(filter_switch)', function (obj) {
+ var value = obj.value;
+ var checked = obj.elem.checked;
+ if (checked) {
+ if ("lay" == value) {// 灞�
+ $("#switch_row").prop("checked", false);
+ $("#switch_col").prop("checked", false);
+ lay();
+ }
+ if ("row" == value) {
+ $("#switch_lay").prop("checked", false);
+ $("#switch_col").prop("checked", false);
+ row();
+ }
+ if ("col" == value) {
+ $("#switch_lay").prop("checked", false);
+ $("#switch_row").prop("checked", false);
+ col();
+ }
+ form.render();
+ }
+ });
+
+ form.on('switch(filter_switch2)', function (obj) {
+ var value = obj.value;
+ var checked = obj.elem.checked;
+ console.log(value);
+
+ if (checked) {
+ if ("outer" == value) {
+ $("#switch_all").prop("checked", false);
+ $("#switch_inner").prop("checked", false);
+ display_outside();
+ }
+ if ("all" == value) {
+ $("#switch_inner").prop("checked", false);
+ $("#switch_outer").prop("checked", false);
+ display_all();
+ }
+ if ("inner" == value) {
+ $("#switch_all").prop("checked", false);
+ $("#switch_outer").prop("checked", false);
+ display_inside();
+ }
+ form.render();
+ }
+ });
+
+ // 鐩戝惉瀵规瘮鏁版嵁
+ table.on('radio(filterTable)', function (obj) {
+ compareData = obj.data;
+ });
+
+ //鍒濆鍖栧埛鏂版暟鎹�
+ initData();
+ });
+
+ // 鍒濆鍖栧潗鏍囩郴
+ initGrainChar3d();
+
+});
+
+function initData() {
+ if (depotId) {
+ $("#depotId").val(depotId);
+ flushGrain(null);
+ form.render();
+ }
+}
+
+function changeView() {
+ depotId = $("#depotId").val();
+ window.location.href = "/grain/gateway?depotId=" + depotId;
+ return true;
+}
+
+// 鍗曚粨鎵撳嵃
+function printSingle() {
+ layer.msg("寮�濮嬭皟鐢ㄥ悗鍙版墦鍗版ā鏉库�︹��");
+ toPrintSingle(grainData);
+}
+
+// 鎵归噺鎵撳嵃
+function printBatch() {
+ // 棣栧厛鍘婚櫎涔嬪墠鐨勯�夋嫨
+ $('#batchPrintSelect input').each(function () {
+ var name = $(this).prop("name");
+ if (name == "printCheckDate") {// 璺宠繃
+ return true;
+ }
+ $(this).prop("disabled", false);
+ $(this).prop("checked", false);
+ });
+ form.render();
+
+ //鍒濆鍖栨壒閲忔ā鏉�
+ initModel();
+
+ // 寮瑰嚭閫夋嫨妗�
+ layer.open({
+ type: 1,
+ title: '鎵归噺绮儏鎵撳嵃锛堢孩鑹茶〃绀烘病鏈夌伯鎯呰褰曪紝榛樿涓哄綋澶╋級',
+ area: ['750px', '450px'],
+ shade: 0,
+ content: $('#batchPrintSelect'),
+ btn: ['鍏ㄩ��', '鍙嶉��', '閲嶉��', '鎵ц鎵撳嵃', '鍙栨秷鎵撳嵃'],
+ yes: function () {
+ var name;
+ $('#batchPrintSelect input').each(function () {
+ name = $(this).prop("name");
+ if (name == "printCheckDate" || $(this).prop("disabled")) {
+ // doNothing
+ } else {
+ $(this).prop("checked", true);
+ }
+ });
+ form.render();
+ },
+ btn2: function () {
+ var name;
+ $('#batchPrintSelect input').each(function () {
+ name = $(this).prop("name");
+ if (name == "printCheckDate" || $(this).prop("disabled")) {
+ // doNothing
+ } else {
+ if ($(this).prop("checked")) {
+ $(this).prop("checked", false);
+ } else {
+ $(this).prop("checked", false);
+ }
+ }
+ });
+ form.render();
+ return false;
+ },
+ btn3: function () {
+ var name;
+ $('#batchPrintSelect input').each(function () {
+ name = $(this).prop("name");
+ if (name == "printCheckDate" || $(this).prop("disabled")) {
+ // doNothing
+ } else {
+ $(this).prop("checked", false);
+ }
+ });
+ form.render();
+ return false;
+ },
+ btn4: function () {
+ printBatchTodo();
+ },
+ btn5: function () {
+ layer.close(0);
+ },
+ closeBtn: 0
+ });
+ // 榛樿璋冪敤鑾峰彇鏁版嵁鏇存柊
+ $("#printCheckDate").prop("value", dateFtt("yyyy-MM-dd", new Date()));
+ getPrintBatchDepot();
+};
+
+// 鑾峰彇鎵归噺鎵撳嵃鐨勪俊鎭�
+function getPrintBatchDepot() {
+ layer.msg("楠岃瘉绮儏妫�娴嬭褰曗�︹��");
+ var checkDate = $("#printCheckDate").val();
+ var checkHour = $("#printCheckHour").val();
+
+ //console.log(checkTime);
+
+ $.ajax({
+ type: "POST",
+ url: "/grain/query-checkDate-map",
+ dataType: "json",
+ contentType: "application/json;charset=UTF-8",
+ data: JSON.stringify({
+ checkDate: checkDate,
+ checkHour: checkHour
+ }),
+ success: function (result) {
+ if (result.code != "0000") {
+ layer.msg(result.msg);
+ disabledAllSelectDepot();
+ } else {
+ mapGrainData = result.data;
+ updateSelectDepot();
+ }
+ },
+ error: function () {
+ layer.msg("鎵归噺鎵撳嵃鑾峰彇绮儏淇℃伅澶辫触锛�");
+ }
+ });
+};
+
+// 鏍规嵁鏌ヨ鐨勬暟鎹壒閲忔墦鍗伴瑙�
+function printBatchTodo() {
+ layer.msg("寮�濮嬫壒閲忕敓鎴愭墦鍗版ā鐗堚�︹��");
+ var strHtml;
+ var value;
+ var checked;
+ var printGrainData;
+ // 灏嗕粨搴撴暟鎹垪琛ㄨ浆鎹负MAP
+ var mapDepot = {};
+ $.each(listDepot, function (index, data) {
+ mapDepot[data.id] = data;
+ });
+ var LODOP = CLODOP;
+ // 璁剧疆榛樿婊″紶鎵撳嵃
+ LODOP.PRINT_INIT("绮儏鎶ヨ〃");// 鍒濆鍖栧湪寰幆澶�
+ LODOP.SET_PRINT_PAGESIZE(1, 0, 0, "A4");
+ $('#batchPrintSelect input').each(function () {
+ if ($(this).prop("name") == "printCheckDate") {// 璺宠繃
+ return true;
+ }
+ checked = $(this).prop("checked");
+ if (checked) {
+ value = $(this).val();
+ printGrainData = mapGrainData[value];
+ if (!printGrainData) {// 濡傛灉娌℃湁绮儏鏁版嵁璺宠繃鎵ц涓嬩竴涓�
+ return true;
+ }
+ LODOP.NewPage();
+ printGrainData.depotData = mapDepot[value];
+ strHtml = builderModel(printGrainData);
+ LODOP.ADD_PRINT_HTM(30, 40, "180mm", "100%", strHtml);
+ }
+ });
+ layer.msg("寮�濮嬭皟鐢ㄦ墦鍗扮▼搴忛瑙堚�︹��");
+ LODOP.SET_PRINT_MODE("PRINT_PAGE_PERCENT", "Full-Page");
+ LODOP.PREVIEW();
+};
+
+// 璁剧疆鎵归噺鎵撳嵃涓墍鏈変粨搴撲笉鍙�夋嫨
+function disabledAllSelectDepot() {
+ var name;
+ $('#batchPrintSelect input').each(function () {
+ name = $(this).prop("name");
+ if (name == "printCheckDate") {// 璺宠繃
+ return true;
+ }
+ $(this).prop("disabled", true);
+ });
+ form.render();
+};
+
+function updateSelectDepot() {
+ var value, name;
+ $('#batchPrintSelect input').each(function () {
+ value = $(this).val();
+ name = $(this).prop("name");
+ if (name == "printCheckDate") {// 璺宠繃
+ return true;
+ }
+ if (mapGrainData[value]) {
+ $(this).prop("disabled", false);
+ } else {
+ $(this).prop("disabled", true);
+ }
+ });
+ form.render();
+};
+
+// 绮儏瀵规瘮
+function compare() {
+ if (!depotId) {
+ layer.msg("璇峰厛閫夋嫨浠撳簱鈥︹��");
+ return;
+ }
+ var batchId = $("#batchId").val();
+ if (!batchId) {
+ layer.msg("褰撳墠娌℃湁鍙互姣旇緝鐨勬暟鎹�︹��");
+ return;
+ }
+ // 涓轰簡閬垮厤閲嶅姣旇緝鍑虹幇鐨勯棶棰橈紝濡傛灉宸茬粡姣旇緝杩囨暟鎹紝鍒欏湪姣旇緝鍓嶅埛鏂颁笅鏁版嵁
+ if (compareData) {
+ flushGrainByBatchId(batchId);
+ }
+ // 棣栧厛寮瑰嚭灞�
+ layer.open({
+ type: 1,
+ title: '绮儏瀵规瘮閫夋嫨',
+ area: ['330px', '640px'],
+ shade: 0,
+ content: $('#compareSelect'),
+ btn: ['纭瀵规瘮', '鍙栨秷瀵规瘮'],
+ yes: function () {
+ if (compareData) {
+ layer.msg("寮�濮嬫墽琛屾壒娆″姣斺�︹��");
+ compareStep3(grainData, compareData);
+ } else {
+ layer.msg("娌℃湁鑾峰彇鍒板姣旀暟鎹紒锛�");
+ }
+ },
+ btn2: function () {
+ layer.closeAll();
+ },
+ closeBtn: 1
+ });
+
+ $("#compareCheckDate").prop("value", null);
+ compareStep2(null);
+ form.render();
+};
+
+function compareStep2(compareDate) {
+ depotId = $("#depotId").val();
+ if (!depotId) {
+ layer.msg("璇峰厛閫夋嫨浠撳簱锛�");
+ return;
+ }
+ if (!compareDate) {
+ compareDate = $("#compareCheckDate").val();
+ }
+ var data = {
+ depotId: depotId,
+ checkMonth: compareDate,
+ extBatchId: grainData.batchId
+ };
+ $.ajax({
+ type: "POST",
+ url: "/grain/page-list",
+ dataType: "json",
+ contentType: "application/json;charset=UTF-8",
+ data: JSON.stringify(data),
+ success: function (result) {
+ if (result.code != "0000") {
+ layer.msg(result.msg);
+ } else {
+ table.render({
+ elem: '#tableSelect',
+ height: 450,
+ data: result.data,
+ page: false,
+ limit: 100,
+ skin: "nob",
+ even: true,
+ size: "sm",
+ cols: [[{
+ type: 'radio',
+ fixed: 'left',
+ title: '閫夋嫨'
+ }, {
+ field: 'receiveDate',
+ title: '妫�娴嬫椂闂�',
+ align: 'center',
+ }]]
+ });
+ }
+ },
+ error: function () {
+ layer.msg("鑾峰彇褰撳墠浠撳簱妫�娴嬭褰曞け璐ワ紝璇烽噸鏂板皾璇曪紒锛�");
+ }
+ });
+};
+
+// 寮�濮嬫壒娆″姣�
+function compareStep3(dataA, dataB) {
+ $.ajax({
+ type: "POST",
+ url: "/grain/data-compare",
+ dataType: "json",
+ contentType: "application/json;charset=UTF-8",
+ data: JSON.stringify({
+ dataA: dataA,
+ dataB: dataB
+ }),
+ success: function (result) {
+ if (result.code != "0000") {
+ layer.msg(result.msg);
+ } else {
+ // 瑕嗙洊椤甸潰涓殑绮儏鏁版嵁
+ grainData = result.data;
+ // 鏄剧ず閲囬泦鐐逛俊鎭�
+ resetGrainChart3d();
+ // 绮儏淇℃伅璧嬪��
+ renderGrainInfo();
+
+ layer.closeAll();
+ }
+ },
+ error: function () {
+ layer.msg("鎵规瀵规瘮鍑虹幇寮傚父锛岃閲嶆柊閫夋嫨");
+ }
+ });
+};
+
+// 鐐瑰嚮鍒锋柊鎿嶄綔
+function flushGrain(checkMonth) {
+ compareData = null;
+ depotId = $("#depotId").val();
+
+ if (!depotId) {
+ layer.alert("璇峰厛閫夋嫨浠撳簱锛�");
+ return;
+ }
+ var data = {
+ depotId: depotId,
+ checkMonth: checkMonth
+ };
+
+ $.ajax({
+ type: "POST",
+ url: "/grain/query-list-data",
+ dataType: "json",
+ contentType: "application/json;charset=UTF-8",
+ data: JSON.stringify(data),
+ success: function (result) {
+ if (result.code != "0000") {
+ layer.msg(result.msg);
+ clearGrainChart3d();
+ }
+ listGrainData = result.data;
+ if (!listGrainData) {
+ return;
+ }
+ grainData = listGrainData[0];
+ // 鏄剧ず閲囬泦鐐逛俊鎭�
+ resetGrainChart3d();
+ // 绮儏淇℃伅璧嬪��
+ renderGrainInfo();
+ // 鍦ㄦ壒娆¢�夋嫨涓坊鍔犱笅鎷夋暟鎹�
+ resetSelectBatchId();
+ // 璋冪敤鍏ㄩ儴鍏抽棴
+ layer.closeAll();
+ layer.msg("鏇存柊鎴愬姛鈥︹��");
+ },
+ error: function () {
+ layer.msg("鏍规嵁褰撳墠鏉′欢鑾峰彇绮儏鏁版嵁娓叉煋鍥炬爣澶辫触锛侊紒");
+ }
+ });
+};
+
+// 濉啓绮儏淇℃伅
+function renderGrainInfo() {
+ // 閰嶇疆浠撳簱鍗$墖淇℃伅
+ var depotData = grainData.depotData;
+ $("#depotTypeName").text(depotData.depotTypeName);
+ $("#storeDate").text(depotData.storeDate);
+ $("#storageReal").text(depotData.storageReal);
+ $("#foodVarietyName").text(depotData.foodVarietyName);
+ $("#perWet").text(depotData.perWet);
+ $("#depotStatus").text(DEPOT_STATUS_MSG(depotData.depotStatus));
+ $("#foodLocation").text(depotData.foodLocation);
+ $("#perImpurity").text(depotData.perImpurity);
+ $("#storeKeeperName").text(depotData.storeKeeperName);
+ $("#storeKeeperLevel").text(depotData.storeKeeperLevel);
+ $("#storeKeeperPhone").text(depotData.storeKeeperPhone);
+
+ // 绮儏妫�娴嬩俊鎭祴鍊�
+ $("#checkUser").text(grainData.checkUser);
+ $("#tempMax").text(grainData.tempMax);
+ $("#tempAve").text(grainData.tempAve);
+ $("#tempMin").text(grainData.tempMin);
+
+
+ //console.log("------------"+grainData.humidityIn);
+ //濡傛灉婀垮害==0琛ㄧず娌℃湁鑾峰彇鍒�
+ if(grainData.humidityIn != 0){
+ $("#tempIn").text(grainData.tempIn <= -100.0 ? "--" : grainData.tempIn);
+ $("#humidityIn").text(
+ grainData.humidityIn <= -100.0 ? "--" : grainData.humidityIn);
+ }
+ if(grainData.humidityOut != 0){
+ $("#tempOut").text(grainData.tempOut <= -100.0 ? "--" : grainData.tempOut);
+ $("#humidityOut").text(
+ grainData.humidityOut <= -100.0 ? "--" : grainData.humidityOut);
+ }
+};
+
+// 鏍规嵁鎵规鏇存柊鐨勫�艰皟鏁�
+function flushGrainByBatchId(batchId) {
+ var temp;
+ $.each(listGrainData, function (index, item) {
+ if (item.batchId == batchId) {
+ temp = item;
+ return false;
+ }
+ });
+ if (temp) {
+ grainData = temp;
+ // 鏄剧ず閲囬泦鐐逛俊鎭�
+ resetGrainChart3d();
+ // 绮儏淇℃伅璧嬪��
+ renderGrainInfo();
+ layer.msg("鏇存柊鎴愬姛鈥︹��");
+ }
+};
+
+// 閲嶇疆鎵规涓嬫媺妗�
+function resetSelectBatchId() {
+ // 棣栧厛娓呯┖鍘熸潵鐨勫��
+ $("#batchId").empty();
+ // 鏈笅鎷夋璧嬪��
+ $.each(listGrainData, function (index, item) {
+ $('#batchId').append(new Option(item.receiveDate, item.batchId));// 涓嬫媺鑿滃崟閲屾坊鍔犲厓绱�
+ });
+ $('#batchId').append(new Option("閫夋嫨鏃堕棿鈥︹��", "0"));
+ form.render();
+};
+
+// 鏇村鎵规閫夋嫨
+function showMore() {
+ layer.open({
+ type: 1,
+ title: '閫夋嫨妫�娴嬫椂闂�',
+ area: ['300px', '400px'],
+ shade: 0,
+ content: $('#dialogMoreSelect'),
+ btn: 0,
+ closeBtn: 1
+ });
+};
+
+// 鍗曚釜绮儏妫�娴�
+function checkGrain() {
+ if (!depotId) {
+ layer.msg("璇峰厛閫夋嫨浠撳簱锛�");
+ return;
+ }
+ var data = {
+ depotId: depotId
+ };
+ $.ajax({
+ type: "POST",
+ url: "/grain/check-single",
+ dataType: "json",
+ contentType: "application/json;charset=UTF-8",
+ data: JSON.stringify(data),
+ success: function (result) {
+ showOrderProgress();
+ if (result.code != "ORDER_SUCCESS") {
+ layer.msg(result.msg);
+ } else {
+ layer.msg("鍛戒护宸茬粡鎴愬姛鍙戦�侊紝寰呯粓绔搷搴斺�︹��");
+ }
+ },
+ error: function () {
+ layer.alert("绮儏妫�娴嬪嚭鐜板紓甯革紝鎵ц澶辫触锛�");
+ }
+ });
+};
+
+// 鎵归噺绮儏閲囬泦
+function checkGrainBatch() {
+ $('#batchCheckSelect input').each(function () {
+ $(this).prop("checked", false);
+ });
+ form.render();
+ // 寮瑰嚭閫夋嫨妗�
+ layer.open({
+ type: 1,
+ title: '鎵归噺妫�娴嬮�夋嫨浠撳簱',
+ area: ['730px', '450px'],
+ shade: 0,
+ content: $('#batchCheckSelect'),
+ btn: ['鍏ㄩ��', '鍙嶉��', '閲嶉��', '纭畾妫�娴�', '鍙栨秷妫�娴�'],
+ yes: function () {
+ $('#batchCheckSelect input').each(function () {
+ $(this).prop("checked", true);
+ });
+ form.render();
+ },
+ btn2: function () {
+ $('#batchCheckSelect input').each(function () {
+ if ($(this).prop("checked")) {
+ $(this).prop("checked", false);
+ } else {
+ $(this).prop("checked", true);
+ }
+ });
+ form.render();
+ return false;
+ },
+ btn3: function () {
+ $('#batchCheckSelect input').each(function () {
+ $(this).prop("checked", false);
+ });
+ form.render();
+ return false;
+ },
+ btn4: function () {
+ showOrderProgress();
+ return checkBatchTodo();
+ },
+ btn5: function () {
+ layer.close(0);
+ },
+ closeBtn: 0
+ });
+};
+
+/**
+ * 寮�濮嬫墽琛屾壒閲忔娴�
+ */
+function checkBatchTodo() {
+ var depotIds = "";
+ $('#batchCheckSelect input').each(function () {
+ if ($(this).prop("checked")) {
+ depotIds += $(this).val() + ",";
+ }
+ });
+
+ if (depotIds == "") {
+ layer.msg("璇峰厛閫夋嫨闇�瑕佹娴嬬殑浠撳簱鈥︹��");
+ return false;
+ }
+ layer.msg("寮�濮嬫墽琛屾壒閲忔娴嬧�︹��");
+ // 璋冪敤鍚庡彴鎵归噺妫�娴�
+ var data = {
+ depotIds: depotIds
+ };
+ $.ajax({
+ type: "POST",
+ url: "/grain/check-batch",
+ dataType: "json",
+ contentType: "application/json;charset=UTF-8",
+ data: JSON.stringify(data),
+ success: function (result) {
+ if (result.code != "ORDER_SUCCESS") {
+ layer.alert("鎵ц澶辫触锛�" + result.msg);
+ return false;
+ } else {
+ layer.msg("鍛戒护宸茬粡鎴愬姛鍙戦�侊紝寰呯粓绔搷搴斺�︹��");
+ return true;
+ }
+ },
+ error: function () {
+ layer.alert("绮儏妫�娴嬪嚭鐜板紓甯革紝鎵ц澶辫触锛�");
+ return false;
+ }
+ });
+ return true;
+};
+
+/**
+ * 寮瑰嚭鍛戒护鎵ц杩涘害妗�
+ */
+var iframeOrderIndex = 0;
+
+function showOrderProgress() {
+ var domId = "#layui-layer-iframe" + iframeOrderIndex;
+ if ($(domId).length == 0) {
+ iframeOrderIndex = layer.open({
+ type: 2,
+ title: "鎵ц杩涘害鍜岃褰�",
+ icon: 1,
+ shadeClose: true,
+ shade: 0.3,
+ closeBtn: 1,
+ anim: 2,
+ area: ['1000px', '600px'],
+ content: '/grain/order-list?depotId=' + depotId + "&t=" + Math.random()
+ });
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.3