From 94b3efb10d13415055544dd3cf91cbb50671a64f Mon Sep 17 00:00:00 2001 From: lSun <15893999301@qq.com> Date: Fri, 23 May 2025 17:47:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E5=A4=B4=E9=83=A8=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=EF=BC=9B=E5=B7=A5=E7=A8=8B=E3=80=81=E4=B8=93=E4=B8=9A=E3=80=81?= =?UTF-8?q?=E5=B7=A5=E5=BA=8F=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/index.html | 248 +++++++++--------- .../child/coordinatePhotoForm.js | 31 +++ .../child/qualityInspectionForm.js | 30 +++ .../safetyMeasure/child/safetyMeasureForm.js | 31 +++ .../child/safetyViolationsForm.js | 50 ++-- src/main/resources/static/js/main.js | 27 +- 6 files changed, 253 insertions(+), 164 deletions(-) diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html index 1a45de2..768f0b0 100644 --- a/src/main/resources/static/index.html +++ b/src/main/resources/static/index.html @@ -2,139 +2,143 @@ - - - - - - - - 项目全过程影像管理工具 - - - - - + + + + + + + + 项目全过程影像管理工具 + + + + + - - - -
- -
-
- + +
- -
-
- -
-
-
-
-
    -
  • - - -
  • -
-
-
- -
-
-
-
- -
- -
-
+
+ +
+
+ +
+
+
+
+
    +
  • + + +
  • +
+
+
+ +
+
+
+
+ +
+ +
+
-
+ + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/static/js/imageUpload/coordinatePhoto/child/coordinatePhotoForm.js b/src/main/resources/static/js/imageUpload/coordinatePhoto/child/coordinatePhotoForm.js index 39ae3f2..ed1ac32 100644 --- a/src/main/resources/static/js/imageUpload/coordinatePhoto/child/coordinatePhotoForm.js +++ b/src/main/resources/static/js/imageUpload/coordinatePhoto/child/coordinatePhotoForm.js @@ -226,6 +226,37 @@ function setParams(params) { processList = getProcessSelected(); if (idParam) { getUserById(); + }else{ + + setTimeout(function () { + var proIdMain = top.$('#proIdMain').val(); + var proIdMainName = top.$('#proIdMain option:selected').text(); + if(proIdMain){ + $('#proId option[value=' + proIdMain + ']').attr('selected', true) + layui.form.render('select'); + proId = proIdMain; + proName = proIdMainName; + } + var majorIdMain = top.$('#majorIdMain').val(); + var majorIdMainName = top.$('#majorIdMain option:selected').text(); + if (majorIdMain){ + $('#majorId option[value=' + majorIdMain + ']').attr('selected', true) + layui.form.render('select') + + let gxs = getGxsSelect(majorIdMain); + setSelectValueName(gxs, 'gxId', '请选择工序'); + majorId= majorIdMain; + majorName = majorIdMainName; + } + var gxIdMain = top.$('#gxIdMain').val(); + var gxIdMainName = top.$('#gxIdMain option:selected').text(); + if(gxIdMain){ + $('#gxId option[value=' + gxIdMain + ']').attr('selected', true) + layui.form.render('select') + gxId = gxIdMain; + gxName = gxIdMainName; + } + },100) } form.on('select(proId)', function (data) { diff --git a/src/main/resources/static/js/imageUpload/qualityInspection/child/qualityInspectionForm.js b/src/main/resources/static/js/imageUpload/qualityInspection/child/qualityInspectionForm.js index f985f5f..c35a63b 100644 --- a/src/main/resources/static/js/imageUpload/qualityInspection/child/qualityInspectionForm.js +++ b/src/main/resources/static/js/imageUpload/qualityInspection/child/qualityInspectionForm.js @@ -221,6 +221,36 @@ function setParams(params) { processList = getProcessSelected(); if (idParam) { getUserById(); + }else{ + setTimeout(function () { + var proIdMain = top.$('#proIdMain').val(); + var proIdMainName = top.$('#proIdMain option:selected').text(); + if(proIdMain){ + $('#proId option[value=' + proIdMain + ']').attr('selected', true) + layui.form.render('select'); + proId = proIdMain; + proName = proIdMainName; + } + var majorIdMain = top.$('#majorIdMain').val(); + var majorIdMainName = top.$('#majorIdMain option:selected').text(); + if (majorIdMain){ + $('#majorId option[value=' + majorIdMain + ']').attr('selected', true) + layui.form.render('select') + + let gxs = getGxsSelect(majorIdMain); + setSelectValueName(gxs, 'gxId', '请选择工序'); + majorId= majorIdMain; + majorName = majorIdMainName; + } + var gxIdMain = top.$('#gxIdMain').val(); + var gxIdMainName = top.$('#gxIdMain option:selected').text(); + if(gxIdMain){ + $('#gxId option[value=' + gxIdMain + ']').attr('selected', true) + layui.form.render('select') + gxId = gxIdMain; + gxName = gxIdMainName; + } + },100) } form.on('select(proId)', function (data) { diff --git a/src/main/resources/static/js/imageUpload/safetyMeasure/child/safetyMeasureForm.js b/src/main/resources/static/js/imageUpload/safetyMeasure/child/safetyMeasureForm.js index c7375b0..e537b90 100644 --- a/src/main/resources/static/js/imageUpload/safetyMeasure/child/safetyMeasureForm.js +++ b/src/main/resources/static/js/imageUpload/safetyMeasure/child/safetyMeasureForm.js @@ -106,6 +106,37 @@ function setParams(params) { processList = getProcessSelected(); if (idParam) { getUserById(); + }else{ + + setTimeout(function () { + var proIdMain = top.$('#proIdMain').val(); + var proIdMainName = top.$('#proIdMain option:selected').text(); + if(proIdMain){ + $('#proId option[value=' + proIdMain + ']').attr('selected', true) + layui.form.render('select'); + proId = proIdMain; + proName = proIdMainName; + } + var majorIdMain = top.$('#majorIdMain').val(); + var majorIdMainName = top.$('#majorIdMain option:selected').text(); + if (majorIdMain){ + $('#majorId option[value=' + majorIdMain + ']').attr('selected', true) + layui.form.render('select') + + let gxs = getGxsSelect(majorIdMain); + setSelectValueName(gxs, 'gxId', '请选择工序'); + majorId= majorIdMain; + majorName = majorIdMainName; + } + var gxIdMain = top.$('#gxIdMain').val(); + var gxIdMainName = top.$('#gxIdMain option:selected').text(); + if(gxIdMain){ + $('#gxId option[value=' + gxIdMain + ']').attr('selected', true) + layui.form.render('select') + gxId = gxIdMain; + gxName = gxIdMainName; + } + },100) } form.on('select(proId)', function (data) { diff --git a/src/main/resources/static/js/imageUpload/safetyViolations/child/safetyViolationsForm.js b/src/main/resources/static/js/imageUpload/safetyViolations/child/safetyViolationsForm.js index 72a6151..b9db4ff 100644 --- a/src/main/resources/static/js/imageUpload/safetyViolations/child/safetyViolationsForm.js +++ b/src/main/resources/static/js/imageUpload/safetyViolations/child/safetyViolationsForm.js @@ -19,15 +19,6 @@ let files1, files2; let proId, proName, majorId, majorName, gxId, gxName; let formData; - -let selectedProId = localStorage.getItem('selectedProId'); -let selectedProName = localStorage.getItem('selectedProName'); - -let selectedMajor = localStorage.getItem('selectedMajor'); -let selectedMajorName = localStorage.getItem('selectedMajorName'); - -let selectedGxId = localStorage.getItem('selectedGxId'); -let selectedGxName = localStorage.getItem('selectedGxName'); layui.use(['laydate', 'upload', 'form'], function () { var upload = layui.upload; var layer = layui.layer; @@ -233,29 +224,32 @@ function setParams(params) { getUserById(); }else{ setTimeout(function () { - var s = parent.$('#proId').val() - alert(s); - if(selectedProId){ - proId = selectedProId ; - proName = selectedProName; - $('#proId option[value=' + selectedProId + ']').attr('selected', true) - layui.form.render('select') + var proIdMain = top.$('#proIdMain').val(); + var proIdMainName = top.$('#proIdMain option:selected').text(); + if(proIdMain){ + $('#proId option[value=' + proIdMain + ']').attr('selected', true) + layui.form.render('select'); + proId = proIdMain; + proName = proIdMainName; } - - if(selectedMajor){ - majorId = selectedMajor ; - majorName = selectedMajorName; - $('#majorId option[value=' + selectedMajor + ']').attr('selected', true) + var majorIdMain = top.$('#majorIdMain').val(); + var majorIdMainName = top.$('#majorIdMain option:selected').text(); + if (majorIdMain){ + $('#majorId option[value=' + majorIdMain + ']').attr('selected', true) layui.form.render('select') - } - if(selectedMajor && selectedGxId){ - let gxs = getGxsSelect(selectedMajor); + let gxs = getGxsSelect(majorIdMain); setSelectValueName(gxs, 'gxId', '请选择工序'); - gxId = selectedGxId ; - gxName = selectedGxName; - $('#gxId option[value=' + selectedGxId + ']').attr('selected', true) + majorId= majorIdMain; + majorName = majorIdMainName; + } + var gxIdMain = top.$('#gxIdMain').val(); + var gxIdMainName = top.$('#gxIdMain option:selected').text(); + if(gxIdMain){ + $('#gxId option[value=' + gxIdMain + ']').attr('selected', true) layui.form.render('select') + gxId = gxIdMain; + gxName = gxIdMainName; } },100) } @@ -279,7 +273,7 @@ function setParams(params) { } gxId = ''; gxName = ''; - let gxs = getGxsSelect(data.value); + let gxs = getGxsSelect(selectedId); setSelectValueName(gxs, 'gxId', '请选择工序'); }); diff --git a/src/main/resources/static/js/main.js b/src/main/resources/static/js/main.js index 4b236b3..55d1f43 100644 --- a/src/main/resources/static/js/main.js +++ b/src/main/resources/static/js/main.js @@ -254,18 +254,17 @@ layui.use(['form', 'layer', 'element'], function () { $('body').removeClass('site-mobile'); }); - // 监听选择事件并存储选中的值 - document.getElementById('majorId').addEventListener('change', function () { - const selectElement = event.target; - const selectedId = selectElement.value; // 获取选中项的 value (id) - if (selectedId === '' || selectedId == '') { - setSelectValueName("", 'gxId', '请先选择专业'); - } else { - let gxs = getGxsSelect(selectedId); - setSelectValueName(gxs, 'gxId', '请选择工序'); - } - }); + form.on('select(majorIdMain)', function (data) { + const selectedId = data.value; // 获取选中项的 value 值 + const selectedName = $(data.elem).find("option:selected").text(); // 获取选中项的文本 + if(selectedId === '' || selectedId == ''){ + setSelectValueName("", 'gxIdMain', '请先选择专业'); + }else{ + let gxs = getGxsSelect(data.value); + setSelectValueName(gxs, 'gxIdMain', '请选择工序'); + } + }); }); /** @@ -314,7 +313,7 @@ function getProSelected() { ajaxRequest(url, "POST", data, true, function () { }, function (result) { if (result.code === 200) { - setSelectValueName(result.data, 'proId', "请选择项目(可搜索)"); + setSelectValueName(result.data, 'proIdMain', "请选择项目(可搜索)"); } else { layer.alert(result.msg, {icon: 2}) } @@ -331,7 +330,7 @@ function getMajorSelected() { ajaxRequest(url, "GET", null, true, function () { }, function (result) { if (result.code === 200) { - setSelectValueName(result.data, 'majorId', "请选择专业"); + setSelectValueName(result.data, 'majorIdMain', "请选择专业"); } else { layer.alert(result.msg, {icon: 2}) } @@ -344,5 +343,5 @@ function getMajorSelected() { * 获取工序数据 */ function getProcessSelected() { - setSelectValueName("", 'gxId', '请先选择专业'); + setSelectValueName("", 'gxIdMain', '请先选择专业'); } \ No newline at end of file