This commit is contained in:
skjia 2024-08-20 21:29:46 +08:00
parent a14c4f4fe7
commit b2afcb3fb3
12 changed files with 667 additions and 262 deletions

View File

@ -9,7 +9,7 @@
<script src="../../../plugs/jquery/jquery-3.6.0.min.js"></script>
<script src="../../../plugs/layui-v2.9.2/layui/layui.js"></script>
<link href="../../../plugs/layui-v2.9.2/layui/css/layui.css" rel="stylesheet">
<script src="../../../util/Interceptor.js"></script>
<!-- <script src="../../../util/Interceptor.js"></script> -->
<script src="../../../js/wireManager/viewResult/normalInspectionUpload.js"></script>
<style>
.layui-form input[type=checkbox], .layui-form input[type=radio], .layui-form select {
@ -29,12 +29,18 @@
<div class="layui-input-inline" style="display: flex;justify-content: center;align-items: center;">
<span>上传到工程:</span>
<select id="proId" name="proId" class="layui-select" lay-verify="required">
<option value="" selected>请选择</option>
</select>
</div>
</div>
<div class="layui-input-inline" style="display: flex;justify-content: center;align-items: center;">
<span>巡护轮次:</span>
<select id="numTimes" name="numTimes" class="layui-select" lay-verify="required">
<option value="1" selected>第一次</option>
<option value="2" >第二次</option>
</select>
</div>
<div class="layui-input-inline" style="display: flex;justify-content: center;align-items: center;">
<span style="width: 190px;">选择日期:</span>
<input type="text" class="layui-input" id="dataTime" placeholder="yyyy-MM-dd">
<input type="text" class="layui-input" id="dataTime" placeholder="yyyy-MM-dd" autocomplete="off">
</div>
</div>
</div>
@ -47,7 +53,7 @@
<div style="margin-top: 1.5%;color: #F56C6C;">2.仅支持批量导入人员管辖范围内的杆塔照片。</div>
<div style="margin-top: 1.5%;">将图片拖到此处或点击选择按住Ctrl可同时多选单次最多可选50张</div>
<div style="margin-top: 1.5%;margin-bottom: 3%">仅支持上传jpg/png格式文件单个文件不限大小</div>
<button id="hideUpload" style=""></button>
</div>
<div class="layui-upload-list">
<table class="layui-table">
@ -67,7 +73,7 @@
</table>
</div>
<div style="color:#F56C6C;text-align: center;">上传过程中请不要删除原始图片</div>
<button type="button" class="layui-btn" onclick="addFile()">开始上传</button>
<button id="searchBt" class="layui-btn" lay-submit lay-filter="formDemo">开始上传</button>
</div>
</body>
</html>

View File

@ -9,7 +9,7 @@
<script src="../../../plugs/jquery/jquery-3.6.0.min.js"></script>
<script src="../../../plugs/layui-v2.9.2/layui/layui.js"></script>
<link href="../../../plugs/layui-v2.9.2/layui/css/layui.css" rel="stylesheet">
<script src="../../../util/Interceptor.js"></script>
<!-- <script src="../../../util/Interceptor.js"></script> -->
<script src="../../../js/wireManager/viewResult/patrolOutsideAdd.js"></script>
<style type="text/css">
.layui-form-label {
@ -55,8 +55,8 @@
<label class="layui-form-label" style="width: 220px;">
<i class="tip-required" style="color: red;font-size: 20px">*</i>训次:</label>
<div class="layui-input-inline patrolNum">
<div class="patrolBatch patrolNumDivClick">第一次巡视</div>
<div class="patrolBatch">第二次巡视</div>
<div id="one" class="patrolBatch patrolNumDivClick">第一次巡视</div>
<div id="two" class="patrolBatch">第二次巡视</div>
</div>
</div>
</div>
@ -65,8 +65,7 @@
<label class="layui-form-label" style="width: 220px;">
<i class="tip-required" style="color: red;font-size: 20px">*</i>巡视工程:</label>
<div class="layui-input-inline" style="width:210px;">
<select id="proId" name="proId" class="layui-select" lay-verify="required">
<option value="" selected>请选择</option>
<select id="proId" name="proId" class="layui-select" lay-filter="proId" lay-verify="required">
</select>
</div>
</div>
@ -76,8 +75,7 @@
<label class="layui-form-label" style="width: 220px;">
<i class="tip-required" style="color: red;font-size: 20px">*</i>巡视杆塔:</label>
<div class="layui-input-inline" style="width:210px;">
<select id="tower" name="tower" class="layui-select" lay-verify="required">
<option value="" selected>请选择</option>
<select id="gtId" name="gtId" class="layui-select" lay-verify="required">
</select>
</div>
</div>
@ -88,7 +86,7 @@
<label class="layui-form-label" style="width: 220px;">
<i class="tip-required" style="color: red;font-size: 20px">*</i>巡视日期:</label>
<div class="layui-input-inline" style="width:210px;">
<input type="text" lay-verify="required" class="layui-input" id="dataTime" placeholder="yyyy-MM-dd">
<input type="text" lay-verify="required" class="layui-input" id="dataTime" placeholder="yyyy-MM-dd" autocomplete="off">
</div>
</div>
</div>

View File

@ -29,6 +29,9 @@
<input type="hidden" id="gtId" name="gtId">
<input type="hidden" id="month" name="month">
<input type="hidden" id="numTimes" name="numTimes">
<input type="hidden" id="userId" name="userId">
<input type="hidden" id="makeType" name="makeType">
<input type="hidden" id="proId" name="proId">
<label class="layui-form-label" style="width:220px;">
<i class="tip-required" style="color: red;font-size: 20px">*</i>考勤照片(可多个):</label>
<div class="layui-input-inline" style="width: 610px;">

View File

@ -53,7 +53,7 @@
</div>
<div class="layui-inline">
<div class="layui-input-inline">
<input id="makeMonth" name="makeMonth" name="makeMonth" type="text" class="layui-input" placeholder="请选择月份">
<input id="makeMonth" name="makeMonth" name="makeMonth" type="text" class="layui-input" placeholder="请选择月份" autocomplete="off">
</div>
</div>
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="query">

View File

@ -2,14 +2,14 @@
<html>
<head>
<meta charset="utf-8">
<title>巡视结果上传-查看</title>
<title>巡视结果上传</title>
<script src="../../../js/public/public.js"></script>
<script src="../../../js/public/public_utils.js"></script>
<script src="../../../js/public/aescbc.js"></script>
<script src="../../../plugs/jquery/jquery-3.6.0.min.js"></script>
<script src="../../../plugs/layui-v2.9.2/layui/layui.js"></script>
<link href="../../../plugs/layui-v2.9.2/layui/css/layui.css" rel="stylesheet">
<script src="../../../util/Interceptor.js"></script>
<!-- <script src="../../../util/Interceptor.js"></script> -->
<!--业务js-->
<script src="../../../js/wireManager/viewResult/viewResultDetails.js"></script>
@ -62,7 +62,7 @@
height: 50px;
display: flex;
align-items: center;
font-size: 24px;
font-size: 20px;
color: #FFF;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
@ -78,11 +78,9 @@
}
.viewContent{
width: 100%;
height: 220px;
display: flex;
align-items: center;
justify-content: center;
height: 210px;
background-color: #FFF;
text-align: center;
}
.viewContent>img{
width: 160px;
@ -91,7 +89,7 @@
}
.viewFooter{
width: 100%;
height: 24px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
@ -136,13 +134,14 @@
#title>div:nth-child(3),
#title>div:nth-child(4),
#title>div:nth-child(5),
#title>input
{
width: 10%;
}
#title>input{
margin-left: 32%;
margin-right: 4%;
#title>div:nth-child(6){
width: 20%;
margin-left: 15%;
}
#title>div:nth-child(1){
display: flex;
@ -207,6 +206,18 @@
align-items: center;
font-size: 12px;
}
/* 边框闪烁呼吸样式 */
.arrow_box{animation: glow 800ms ease-out infinite alternate; }
@keyframes glow {
0% {
border-color: #393;
box-shadow: 0 0 5px rgba(0,255,0,.2), inset 0 0 5px rgba(0,255,0,.1), 0 1px 0 #393;
}
100% {
border-color: #6f6;
box-shadow: 0 0 20px rgba(0,255,0,.8), inset 0 0 10px rgba(0,255,0,.6), 0 1px 0 #6f6;
}
}
</style>
</head>
<body>
@ -234,11 +245,13 @@
<div>特巡天数</div>
<div id="otherNum">--</div>
</div>
<div>
</div>
<input type="text" class="layui-input" readonly placeholder="月份" id="month" style="border: none;">
</div>
<div id="projects">
<input type="hidden" id="id" name="id">
</div>
<div class="detail-content">
<div style="width: 100%;height: 88%;">

View File

@ -249,7 +249,7 @@
<button type="button" class="layui-btn layui-bg-blue" onclick="normalInspectionUpload()">正常巡视照片导入</button>
<button type="button" class="layui-btn layui-bg-orange" onclick="specialPatrolAdd()">新增特巡结果</button>
</div>
<input type="text" class="layui-input" readonly placeholder="月份" id="month" style="border: none;">
<input type="text" class="layui-input" readonly placeholder="月份" id="month" style="border: none;" autocomplete="off">
</div>
<div id="projects">

View File

@ -1,14 +1,17 @@
let loadingMsg;
var form;
var beanArr = [];
var urls="";
var ysurls="";
var gtIds="";
var gtNames="";
layui.use(['upload','laydate','form'], function () {
var upload = layui.upload;
var element = layui.element;
var $ = layui.$;
var form = layui.form;
form = layui.form;
var laydate = layui.laydate;
initProList();
laydate.render({
elem: '#dataTime'
});
@ -17,7 +20,7 @@ layui.use(['upload','laydate','form'], function () {
var uploadListIns = upload.render({
elem: '#ID-upload-demo-files',
elemList: $('#ID-upload-demo-files-list'), // 列表元素对象
url: "", // 实际使用时改成您自己的上传接口即可。
url: PATH_URL + "/makeInfo/upload", // 实际使用时改成您自己的上传接口即可。
multiple: true, //是否允许多文件上传默认未false
dataType: "json",
// exts: 'jpg|png|jpeg|txt|pdf|xlsx|xls|docx|doc|ppt|pptx|mp4|avi|flv',
@ -26,14 +29,12 @@ layui.use(['upload','laydate','form'], function () {
number: 10, //最大上传数量
auto: false, //是否自动上传 默认为true
// size: 1024 * 30, //最大文件大小单位k
bindAction: '#ID-upload-demo-files-action',
bindAction: '#hideUpload',
choose: function(obj){
var that = this;
var files = this.files = obj.pushFile(); // 将每次选择的文件追加到文件队列
// 读取本地文件
obj.preview(function(index, file, result){
var tr = $(['<tr id="upload-'+ index +'">',
'<td>'+ file.name +'</td>',
'<td>'+ (file.size/1024).toFixed(1) +'kb</td>',
@ -48,24 +49,25 @@ layui.use(['upload','laydate','form'], function () {
tr.find('.demo-reload').on('click', function(){
obj.upload(index, file);
});
// 删除
tr.find('.demo-delete').on('click', function(){
//双击删除指定预上传图片
delete files[index]; // 删除对应的文件
tr.remove(); // 删除表格行
// 清空 input file 值,以免删除后出现同名文件不可选
uploadListIns.config.elem.next()[0].value = '';
});
that.elemList.append(tr);
element.render('progress'); // 渲染新加的进度条组件
});
},
before: function (obj) {
urls="";
ysurls="";
gtIds="";
gtNames="";
this.data = {
photoType: "trainBank"
uploadType:"1",photoType:"hxy"
};
},
done: function(res, index, upload){ // 成功的回调
@ -82,14 +84,21 @@ layui.use(['upload','laydate','form'], function () {
tds.eq(3).html(''); // 清空操作
delete this.files[index]; // 删除文件队列已经上传成功的文件
urls=urls+res.data.url+",";
ysurls=ysurls+res.data.ysUrl+",";
gtIds=gtIds+res.data.gtId+",";
gtNames=gtNames+res.data.gtName+",";
return;
this.error(index, upload);
},
allDone: function(obj){ // 多文件上传完毕后的状态回调
top.layer.close(loadingMsg);
top.layer.msg("上传成功", { icon: 1 });
reloading();
insertBatch();
var iframeWindow = parent.window['layui-layer-iframe' + localStorage.getItem("resultindex")];
iframeWindow.reloadData();
var index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
parent.layer.close(index);
},
error: function(index, upload){ // 错误回调
var that = this;
@ -102,44 +111,69 @@ layui.use(['upload','laydate','form'], function () {
element.progress('progress-demo-'+ index, n + '%'); // 执行进度条。n 即为返回的进度百分比
}
});
form.on('submit(formDemo)', function (data) {
$("#hideUpload").trigger("click");
});
});
function initProList(){
$.ajax({//id获取详情打开弹窗传值子页面
type: 'post',
url: PATH_URL + "/makeInfo/getProList",
dataType: 'json',
async:false,
data: {
userId:localStorage.getItem("resultUserId")
},
success: function (res) {
console.log(res,"getProList");
$("#proId").empty();
var html="<option value='' selected>请选择</option>";
for(var i=0;i<res.data.length;i++){
html+="<option value='"+res.data[i].proId+"'>"+ res.data[i].proName +"</option>";
}
$("#proId").append(html);
form.render();
},
error:function(e){
}
})
}
function addFile() {
loadingMsg = layer.msg('数据请求中,请稍候...', {icon: 16, scrollbar: false, time: 0, shade: [0.8, '#393D49']});
var json = {
"proId": $("#proId").val(),
"dataTime": $("#dataTime").val()
function insertBatch(){
if(urls.length == 0){
layer.msg('请上传文件', {icon: 2});
return;
}
$.ajax({
type: 'POST',
contentType: "application/json; charset=utf-8",
url: '', // 请求地址
async : true,
data: JSON.stringify(json), //获取提交的表单字段
success: function (data) {
if (data.code == 200) {
$("#ID-upload-demo-files-action").trigger("click");
} else {
layer.alert(data.msg);
}
},
error: function (XMLHttpRequest, textStatus, e) {
top.layer.close(loadingMsg);
layer.msg('数据请求发生异常,请稍后重试', {icon: 16, scrollbar: false});
}
});
$.ajax({
type:"post",
url : PATH_URL + "/makeInfo/insertBatchMakeGt",
async:false,
data:{
"gtId": gtIds,
gtName:gtNames,
userId:localStorage.getItem("resultUserId"),
makeMonth:localStorage.getItem("resultMakeMonth"),
proId:localStorage.getItem("resultProId"),
makeTime:$("#dataTime").val(),
sFilePath:ysurls,
filePath:urls,
makeType:0,
numTimes:$("#numTimes").val()
},
dataType:"json",
success:function(res){
console.log(res,"res")
if(res.code==500){
parent.layer.msg(res.msg)
return;
}
},
error:function(data){
}
});
}
function setData(data) {
$("#companyId").val(data.companyId);
$("#proId").val(data.proId);
$("#month").val(data.month);
}
function reloading() {
var index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
parent.layer.close(index); //再执行关闭

View File

@ -4,10 +4,10 @@ var startWorkFiles = {};
var upload;
var id;
var formData;
let form;
var outsidenum=1;
layui.use(['form', 'table', 'upload', 'laydate'], function () {
let form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
form.render();
upload = layui.upload;
var laydate = layui.laydate;
@ -15,26 +15,82 @@ layui.use(['form', 'table', 'upload', 'laydate'], function () {
laydate.render({
elem: '#dataTime'
});
initProList();
uploadFile();
//训次的点击事件
$(".patrolBatch").click(function(){
$(".patrolBatch").removeClass("patrolNumDivClick");
$(this).addClass("patrolNumDivClick");
if($(this).attr("id")=="one"){
outsidenum=1;
}else{
outsidenum=2;
}
})
form.on('submit(formDemo)', function (data) {
add(data);
$("#hideUpload").trigger("click");
});
form.on('select(proId)', function(data){
console.log(data);
initGtList(data.value);
})
});
function initProList(){
$.ajax({//id获取详情打开弹窗传值子页面
type: 'post',
url: PATH_URL + "/makeInfo/getProList",
dataType: 'json',
async:false,
data: {
},
success: function (res) {
console.log(res,"getProList");
$("#proId").empty();
var html="<option value='' selected>请选择</option>";
for(var i=0;i<res.data.length;i++){
html+="<option value='"+res.data[i].proId+"'>"+ res.data[i].proName +"</option>";
}
$("#proId").append(html);
form.render();
},
error:function(e){
}
})
}
function initGtList(proId){
$.ajax({//id获取详情打开弹窗传值子页面
type: 'post',
url: PATH_URL + "/makeInfo/getGtList",
dataType: 'json',
async:false,
data: {
proId:proId,userId:localStorage.getItem("resultUserId")
},
success: function (res) {
console.log(res,"getGtList");
$("#gtId").empty();
var html="<option value='' selected>请选择</option>";
for(var i=0;i<res.data.length;i++){
html+="<option value='"+res.data[i].gtId+"'>"+ res.data[i].gtName +"</option>";
}
$("#gtId").append(html);
form.render();
},
error:function(e){
}
})
}
var url="";
var ysurl="";
function uploadFile(){
var uploadcom = upload.render({
elem: '#test',
url: '', //改成您自己的上传接口
url: PATH_URL + "/makeInfo/upload", //改成您自己的上传接口
multiple: true, //是否允许多文件上传默认未false
dataType: "json",
// data: {"pickId": id},
@ -75,15 +131,19 @@ function uploadFile(){
},
before: function (obj) {
this.data = {
photoType: "supplyChainBlack"
uploadType:"one",photoType:"hxy"
};
},
done: function (data) {
url=data.data.url;
ysurl=data.data.ysUrl;
},
allDone: function (data) {
top.layer.close(loadingMsg);
top.layer.msg(data.msg, {icon: 1});
reloading();
insertOutside();
var iframeWindow = parent.window['layui-layer-iframe' + localStorage.getItem("resultindex")];
iframeWindow.reloadData();
var index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
parent.layer.close(index);
},
error: function (e) {
//请求异常回调
@ -92,48 +152,39 @@ function uploadFile(){
});
}
function add(formData) {
//获取选择的巡视次数
var patrolBatchs = $(".patrolBatch");
for (var i = 0; i < patrolBatchs.length; i++) {
if($(patrolBatchs[i]).attr("class").indexOf('patrolNumDivClick') > -1){
console.log("巡视批次:", $(patrolBatchs[i]).text())
//将选择的巡视批次保存起来
formData.field.patrolBatch = $(patrolBatchs[i]).text();
}
}
// loadingMsg = top.layer.msg('数据上传中,请稍候...', {icon: 16, scrollbar: false, time: 0, shade: [0.8, '#393D49']});
var files = $('#demo img')
if(files.length == 0){
function insertOutside(){
if(url.length == 0){
layer.msg('请上传文件', {icon: 2});
return;
}
$.ajax({
type: 'POST',
async: true, // 默认异步true,false表示同步
url: ctxPath + '/supplyChainBlack/addBlack',
contentType: "application/json; charset=utf-8",
data: JSON.stringify(formData.field), //获取提交的表单字段
dataType: 'json', // 服务器返回数据类型
success: function (data) {
if (data.code == 200) {
$("#hideUpload").trigger("click");
} else {
layer.alert(data.msg, {icon: 2});
}
},
error: function (XMLHttpRequest, textStatus, e) {
top.layer.close(loadingMsg);
layer.msg('数据请求发生异常,请稍后重试', {icon: 16, scrollbar: false});
}
});
$.ajax({
type:"post",
url : PATH_URL + "/makeInfo/insertMakeGt",
async:false,
data:{
"gtId": $("#gtId").val(),
userId:localStorage.getItem("resultUserId"),
makeMonth:localStorage.getItem("resultMakeMonth"),
proId:localStorage.getItem("resultProId"),
makeTime:$("#dataTime").val(),
sFilePath:ysurl,
filePath:url,
makeType:1,
numTimes:outsidenum
},
dataType:"json",
success:function(res){
console.log(res,"res")
if(res.code==500){
parent.layer.msg(res.msg)
return;
}
},
error:function(data){
}
});
}
var deletePhoto = [];
function delPhoto(i,id) {
var parentcolor = document.getElementById("demo" + i);

View File

@ -86,7 +86,10 @@ function uploadFile(){
filenum=data.total
if(filenum==urls.length){
insertSpecial();
reloading();
var iframeWindow = parent.window['layui-layer-iframe' + localStorage.getItem("resultindex")];
iframeWindow.reloadData();
var index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
parent.layer.close(index);
}else{
layer.msg("传输错误,请重新上传!")
}
@ -118,7 +121,7 @@ function insertSpecial(obj){
url : PATH_URL + "/makeInfo/insertSpecial",
async:false,
data:{
makeId:localStorage.getItem("resultId"),
userId: localStorage.getItem("resultUserId"),proId:localStorage.getItem("resultProId"),makeMonth:localStorage.getItem("resultMakeMonth"),
ysUrl:ysurld,url:urld,
remarks:$("#remark").val(),
makeTime:$("#dataTime").val()

View File

@ -7,6 +7,9 @@ var formData;
var gtId;
var month;
var numTimes;
var userId;
var makeType;
var proId;
layui.use(['form', 'table', 'upload'], function () {
let form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
form.render();
@ -14,18 +17,24 @@ layui.use(['form', 'table', 'upload'], function () {
gtId=$("#gtId").val();
month=$("#month").val();
numTimes=$("#numTimes").val();
userId=$("#userId").val();
makeType=$("#makeType").val();
proId=$("#proId").val();
uploadFile();
form.on('submit(formDemo)', function (data) {
$("#hideUpload").trigger("click");
});
});
function setGtId(gtId,month,numTimes){
function setGtId(gtId,month,numTimes,resultUserId,makeType,proId){
console.log(gtId,"gtId");
console.log(month,"month");
$("#gtId").val(gtId);
$("#month").val(month);
$("#numTimes").val(numTimes);
$("#userId").val(resultUserId);
$("#makeType").val(makeType);
$("#proId").val(proId);
}
var ysUrls="";
var urls="";
@ -79,8 +88,8 @@ function uploadFile(){
},
done: function (data) {
console.log(data,"donedata");
ysUrls=data.data.url;
urls=data.data.ysUrl;
urls=data.data.url;
ysUrls=data.data.ysUrl;
},
allDone: function (data) {
console.log(data,"allDonedata");
@ -112,14 +121,19 @@ function insertMakeGt(){
async:false,
data:{
"gtId": gtId,
userId:userId,
makeMonth:month,
sFilePath:ysUrls,
filePath:urls,
filePath:urls,makeType:makeType,proId:proId,
numTimes:numTimes
},
dataType:"json",
success:function(res){
console.log(res,"res")
if(res.code==500){
parent.layer.msg(res.msg)
return;
}
},
error:function(data){
}

View File

@ -3,6 +3,9 @@ var currentDate = new Date();
var tabList=[];
var month = currentDate.getMonth() + 1;//当前第几月
var year = currentDate.getFullYear();
var resultUserId;
var resultProId;
var resultMonth;
layui.use(['form','layer','table','laydate','element'], function () {
table = layui.table;
form = layui.form;
@ -18,38 +21,29 @@ layui.use(['form','layer','table','laydate','element'], function () {
btns:['now','confirm'], //选择框右下角显示的按钮 清除-现在-确定
value: formatCurrentMonth(), // 如果你想预设当前日期为选中状态
done: function (value, date) {//时间回调
console.log("date:", date)
console.log("date:", date);
localStorage.setItem("resultMakeMonth",value);
resultMonth=value;
init(date.year,date.month);
}
});
$("#month").val(localStorage.getItem("resultMakeMonth"));
resultMonth=localStorage.getItem("resultMakeMonth")
init(year,month)
setData(null)
setData()
});
//工程切换
function projectTab(event){
function projectTab(event,proId){
resultProId=proId;
localStorage.setItem("resultProId",resultProId);
console.log(resultProId,'resultProId')
//修改所点工程样式
$("#projects>div").removeClass("projectsStyle");
$(event).addClass("projectsStyle")
//获取时间
var date = $("#month").val();
var year;
var month;
if(date != ''){
//截取年
year = date.split("-")[0];
//截取月并去0
month = Integer.parseInt(date.split("-")[1]);
}else{
layer.msg("日期获取错误", { icon: 0 });
return;
}
getView(year, month);
getView();
getSpecial(localStorage.getItem("resultMakeMonth").substring(0,4),localStorage.getItem("resultMakeMonth").substring(5,7)<10?localStorage.getItem("resultMakeMonth").substring(5,7).replace("0",""):localStorage.getItem("resultMakeMonth").substring(5,7));
}
function formatCurrentMonth() {
@ -62,15 +56,79 @@ function formatCurrentMonth() {
*/
function init(chosenYear,chosenMonth){
layui.use(['table'], function () {
getView(chosenYear, chosenMonth)
getTab(chosenMonth)
getTab(chosenMonth)
getView()
getSpecial(chosenYear,chosenMonth)
})
}
function getSpecial(chosenYear,chosenMonth){
let table = layui.table;
let daysInMonth = new Date(chosenYear, chosenMonth, 0).getDate();
console.log(daysInMonth)
let tableData = []
$.ajax({//id获取详情打开弹窗传值子页面
type: 'post',
url: PATH_URL + "/makeInfo/getSpecialData",
dataType: 'json',
async:false,
data: {
userId: localStorage.getItem("resultUserId"),proId:localStorage.getItem("resultProId"),makeMonth:localStorage.getItem("resultMakeMonth")
},
success: function (data) {
console.log(data,"resultSpecial");
var isWorkData=[];
$.each(data.data,function(index,item){
isWorkData.push(item.makeTime)
})
var isWork={};
isWork.isWork=isWorkData;
tableData.push(isWork);
},
error:function(e){
}
})
let cols = []
for (let k = 1; k <= daysInMonth; k++) {
let str = chosenMonth+'.'+k;
let obj = {field:'isWork', title: str,align: 'center',width:70,
templet: function(d){
if(d.isWork.includes(d.LAY_COL.title)){
return `<i class="layui-icon" style="color: red;">&#xe605;</i> `
}else{
return `<apan></apan>`
}
}}
cols.push(obj)
}
console.log(tableData,"tableData");
table.render({
elem: '#isWorkList',
// url: "/sys/achievement",
// where: obj,
//skin: 'line', // 横向边框线
cols: [cols],
data: tableData
});
}
function getTab(chosenMonth){
tabList = [{id:'1',projectName:'xxx工程1'},{id:'2',projectName:'xxx工程2'},{id:'3',projectName:'xxx工程3'},{id:'4',projectName:'xxx工程4'}]
$.ajax({//id获取详情打开弹窗传值子页面
type: 'post',
url: PATH_URL + "/makeInfo/getProByUser",
dataType: 'json',
async:false,
data: {
id: localStorage.getItem("resultUserId")
},
success: function (data) {
tabList=data.data;
},
error:function(e){
}
})
// projectList
$("#projects").empty()
let html = ``
@ -78,72 +136,172 @@ function getTab(chosenMonth){
var className = ""
if(i == 0){
className = "projectsStyle";
localStorage.setItem("resultProId",tabList[i].id);
}
html += `<div class="${className}" onclick="projectTab(this)">
<span id="${tabList[i].id}">${tabList[i].projectName}</span>
html += `<div class="${className}" onclick="projectTab(this,${tabList[i].id})">
<span id="${tabList[i].id}">${tabList[i].proName}</span>
</div>`
}
$("#projects").append(html);
}
function getView(chosenYear, chosenMonth){
function getView(){
// ①已上传:展示修改、删除图标,上传日期不可选择,照片信息,杆塔号;颜色为“#52C1F5”
// ②未上传:展示上传图标,上传日期可选择,杆塔号,颜色为“#F56C6C”
// ③巡护段外:展示修改、删除图标,上传日期不可选择,照片信息,工程名称,杆塔号;颜色为“#FF9900”
// ④特巡/值守:展示修改、删除图标,上传日期不可选择,照片信息,备注;颜色为“#73A0FA”
// ⑤正在编辑:修改图标绿色背景,可重新上传照片、重新选择日期,编辑即边框闪烁;
$.ajax({//id获取详情打开弹窗传值子页面
type: 'post',
url: PATH_URL + "/makeInfo/getById",
dataType: 'json',
async:false,
data: {
userId: localStorage.getItem("resultUserId"),makeMonth:localStorage.getItem("resultMakeMonth"),proId:localStorage.getItem("resultProId")
},
success: function (data) {
console.log(data,"result");
viewList1=data.mgtListone;
photoList1=data.vgtListone;
viewList2=data.mgtListtwo;
photoList2=data.vgtListtwo;
viewList3=data.mgtListspe;
photoList3=data.mgtListspe;
},
error:function(e){
}
})
$("#inspectionTourContent").empty();
viewList1 = [{name:"sss"},{name:'#1'},{name:'#1'},{name:'#1'},{name:'#1'},{name:'#1'},{name:'#1'},{name:'#1'},{name:'#1'}]
//杆塔集合
// viewList1 = [{id:"1",name:"#1"},{id:"2",name:'#2'},{id:"3",name:'#3'},{id:"4",name:'#4'},{id:"5",name:'#5'},{id:"6",name:'#6'},
// {id:"7",name:'#7'},{id:"8",name:'#8'},{id:"9",name:'#9'}]
// //照片集合
var filePath = 'http://192.168.0.14:1909/file/ynRealName/violationBlack/2024/05/13/c0a62f0b51924a4584ec0c8f011fc2af0074P3wTgy1h3gtizuzvfj30zk0zg7ad.jpg';
var sFilePath='../../../image/viewImg.jpg';
// photoList1 = [{name:'#2', filePath:filePath,sFilePath:sFilePath,makeTime:'2024-08-19'},{name:'#3', filePath:filePath,sFilePath:sFilePath,makeTime:'2024-08-19'},
// {name:'#4', filePath:filePath,sFilePath:sFilePath,makeTime:'2024-08-19'},{name:'#5', filePath:filePath,sFilePath:sFilePath,makeTime:'2024-08-19'},
// {name:'#6', filePath:filePath,sFilePath:sFilePath,makeTime:'2024-08-19'}]
let html = ``;
html += `<div style="width: 90%;height: 30px;font-weight: bold;">
<span style="border: 3px solid #409EFF;width: 20px;height: 10px;margin-left: 2%;margin-right: 1%;"></span>-
<span style="border: 3px solid #409EFF;width: 20px;height: 10px;margin-left: 2%;margin-right: 1%;"></span>
<span style="color:#666666">正常巡视-第一次巡视</span>
<span style="color:#F56C6C">(负责的巡护区段杆塔)</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</div>
<div id="firstViewBox" style="width: 100%;min-height: 200px;margin-bottom: 20px;display: flex;flex-wrap: wrap;">`
for (let i = 0;i < viewList1.length;i++) {
for (let i = 0;i < viewList1.length;i++) {
var gtName = viewList1[i].gtName.length>4?viewList1[i].gtName.substring(0,4) + '...': viewList1[i].gtName;
html += `<div class="viewBox">
<div class="viewHeader">
<img src="../../../image/dataIcon3.png" alt="">
<span>${viewList1[i].name}</span>
<div style="width: 100%;height:100%">
<div class="viewHeader">
<img src="../../../image/tower_white.png" alt="">
<span style="width: 33%;" title="${viewList1[i].gtName}">${gtName}</span>
</div>
<div class="viewContent">`
var flag = false;
for (var j = 0; j < photoList1.length; j++) {
if(viewList1[i].gtName == photoList1[j].gtName){
//照片存在,直接显示
html += `<img src="${IMG_URL+photoList1[j].sfilePath}" alt="" onclick="filePreView('${IMG_URL+photoList1[j].filePath}')">`
flag = true;
break;
}
}
if(!flag){
//照片不存在,显示上传照片按钮
html += `<img src="../../../image/add2.png" style="width:150px;height:150px;border: 1px solid #E9E9E9;backgroubd:#F9F9F9;cursor: pointer;margin-top: 10px;" alt="">
<div style="color:#cccccc">上传图片</div>`
}
html += `<div style="display: none;align-items: center;justify-content: center;position: relative;top:-100%;width:100%;height:100%;z-index:99;background-color: rgba(0,0,0,.2)">
<button class="layui-btn" onclick="uploadPhoto(${viewList1[i].gtId},1)">
<i class="layui-icon layui-icon-refresh-3"></i>
重新上传
</button>
</div>
</div>
<div class="viewFooter">
<img src="../../../image/calendarIcon.png" width="18">&nbsp;&nbsp;`
for (var j = 0; j < photoList1.length; j++) {
if(viewList1[i].gtName == photoList1[j].gtName){
//照片存在,直接显示
html += `${photoList1[j].makeTime}`
break;
}
}
html +=`</div>
</div>
<div class="viewContent">
<img src="../../../image/viewImg.jpg" alt="" onclick="filePreView('${"s.jpg"}')">
</div>
<div class="viewFooter">
<img src="../../../image/calendarIcon.png" width="18">&nbsp;&nbsp;
2024-03-15
</div>`
}
html += `</div>`;
// viewList2 = [{id:"1",name:"#1"},{id:"2",name:'#2'},{id:"3",name:'#3'},{id:"4",name:'#4'},{id:"5",name:'#5'},{id:"6",name:'#6'},
// {id:"7",name:'#7'},{id:"8",name:'#8'},{id:"9",name:'#9'}]
// photoList2 = [{name:'#2', filePath:filePath,sFilePath:sFilePath,makeTime:'2024-08-19'},{name:'#3', filePath:filePath,sFilePath:sFilePath,makeTime:'2024-08-19'},
// {name:'#4', filePath:filePath,sFilePath:sFilePath,makeTime:'2024-08-19'},{name:'#5', filePath:filePath,sFilePath:sFilePath,makeTime:'2024-08-19'},
// {name:'#6', filePath:filePath,sFilePath:sFilePath,makeTime:'2024-08-19'}]
html += `<div style="width: 90%;height: 30px;font-weight: bold;">
<span style="border: 3px solid #409EFF;width: 20px;height: 10px;margin-left: 2%;margin-right: 1%;"></span>
<span style="color:#666666">正常巡视-第二次巡视</span>
<span style="color:#F56C6C">(负责的巡护区段杆塔)</span>
</div>
<div id="secondViewBox" style="width: 100%;min-height: 200px;margin-bottom: 20px;display: flex;flex-wrap: wrap;">`
for (let i = 0;i < viewList2.length;i++) {
var gtName = viewList2[i].gtName.length>4?viewList2[i].gtName.substring(0,4) + '...': viewList2[i].gtName;
html += `<div class="viewBox">
<div style="width: 100%;height:100%">
<div class="viewHeader">
<img src="../../../image/tower_white.png" alt="">
<span style="width: 33%;" title="${viewList2[i].gtName}">${gtName}</span>
</div>
<div class="viewContent">`
var flag = false;
for (var j = 0; j < photoList2.length; j++) {
if(viewList2[i].gtName == photoList2[j].gtName){
//照片存在,直接显示
html += `<img src="${IMG_URL+photoList2[j].sfilePath}" alt="" onclick="filePreView('${IMG_URL+photoList2[j].filePath}')">`
flag = true;
break;
}
}
if(!flag){
//照片不存在,显示上传照片按钮
html += `<img src="../../../image/add2.png" style="width:150px;height:150px;border: 1px solid #E9E9E9;backgroubd:#F9F9F9;cursor: pointer;margin-top: 10px;" alt="" >
<div style="color:#cccccc">上传图片</div>`
}
html += `<div style="display: none;align-items: center;justify-content: center;position: relative;top:-100%;width:100%;height:100%;z-index:99;background-color: rgba(0,0,0,.2)">
<button class="layui-btn" onclick="uploadPhoto(${viewList2[i].gtId},2)>
<i class="layui-icon layui-icon-refresh-3"></i>
重新上传
</button>
</div>
</div>
<div class="viewFooter">
<img src="../../../image/calendarIcon.png" width="18">&nbsp;&nbsp;`
for (var j = 0; j < photoList2.length; j++) {
if(viewList2[i].gtName == photoList2[j].gtName){
//照片存在,直接显示
html += `${photoList2[j].makeTime}`
break;
}
}
html +=`
</div>
</div>
</div>`
}
html += `</div>`;
viewList2 = [{name:'#2'},{name:'#2'},{name:'#2'},{name:'#2'},{name:'#2'},{name:'#2'},{name:'#2'},{name:'#2'},{name:'#2'}]
html += `<div style="width: 90%;height: 30px;font-weight: bold;">
<span style="border: 3px solid #409EFF;width: 20px;height: 10px;margin-left: 2%;margin-right: 1%;"></span>-
</div>
<div id="secondViewBox" style="width: 100%;min-height: 200px;margin-bottom: 20px;display: flex;flex-wrap: wrap;">`
for (let j = 0;j < viewList2.length;j++) {
html += `<div class="viewBox">
<div class="viewHeader">
<img src="../../../image/dataIcon3.png" alt="">
<span>${viewList2[j].name}</span>
</div>
<div class="viewContent">
<img src="../../../image/viewImg.jpg" alt="" onclick="filePreView('${"s.jpg"}')">
</div>
<div class="viewFooter">
<img src="../../../image/calendarIcon.png" width="18">&nbsp;&nbsp;
2024-03-15
</div>
</div>`
}
html += `</div>`;
viewList3 = [{name:'#3'},{name:'#3'},{name:'#3'},{name:'#3'},{name:'#3'},{name:'#3'},{name:'#3'},{name:'#3'},{name:'#3'}]
// viewList3 = [{id:"1",name:"#1"},{id:"2",name:'#2'},{id:"3",name:'#3'},{id:"4",name:'#4'},{id:"5",name:'#5'},{id:"6",name:'#6'},
// {id:"7",name:'#7'},{id:"8",name:'#8'},{id:"9",name:'#9'}]
// photoList3 = [{name:'#2', filePath:filePath,sFilePath:sFilePath,makeTime:'2024-08-19'},{name:'#3', filePath:filePath,sFilePath:sFilePath,makeTime:'2024-08-19'},
// {name:'#4', filePath:filePath,sFilePath:sFilePath,makeTime:'2024-08-19'},{name:'#5', filePath:filePath,sFilePath:sFilePath,makeTime:'2024-08-19'},
// {name:'#6', filePath:filePath,sFilePath:sFilePath,makeTime:'2024-08-19'}]
html += `<div style="width: 90%;height: 30px;font-weight: bold;">
<span style="border: 3px solid #409EFF;width: 20px;height: 10px;margin-left: 2%;margin-right: 1%;"></span>特巡 / 值守
</div>
@ -151,60 +309,82 @@ function getView(chosenYear, chosenMonth){
<table id="isWorkList" class="layui-table" lay-skin="row" style="width:100%;"></table>
</div>
<div id="specialViewBox" style="width: 100%;min-height: 200px;margin-bottom: 20px;display: flex;flex-wrap: wrap;">`
for (let j = 0;j < viewList3.length;j++) {
for (let i = 0;i < viewList3.length;i++) {
var gtName = viewList3[i].gtName.length>11?viewList3[i].gtName.substring(0,11) + '...': viewList3[i].gtName;
html += `<div class="viewBox">
<div class="viewHeader">
<img src="../../../image/dataIcon3.png" alt="">
<span>${viewList3[j].name}</span>
</div>
<div class="viewContent">
<img src="../../../image/viewImg.jpg" alt="" onclick="filePreView('${"s.jpg"}')">
</div>
<div class="viewFooter">
<img src="../../../image/calendarIcon.png" width="18">&nbsp;&nbsp;
2024-03-15
<div style="width: 100%;height:100%">
<div class="viewHeader" style="font-size:12px">
<img src="../../../image/tower_white.png" alt="">
<span style="width: 33%;" title="${viewList3[i].gtName}">${gtName}</span>
</div>
<div class="viewContent">
`
var flag = false;
for (var j = 0; j < photoList3.length; j++) {
if(viewList3[i].gtName == photoList3[j].gtName){
//照片存在,直接显示
html += `<img src="${IMG_URL+photoList3[j].sfilePath}" alt="" onclick="filePreView('${IMG_URL+photoList3[j].filePath}')">`
flag = true;
break;
}
}
if(!flag){
//照片不存在,显示上传照片按钮
html += `<img src="../../../image/add2.png" style="width:150px;height:150px;border: 1px solid #E9E9E9;backgroubd:#F9F9F9;cursor: pointer;margin-top: 10px;" alt="" ">
<div style="color:#cccccc">上传图片</div>`
}
html += `
<div style="display: none;align-items: center;justify-content: center;position: relative;top:-100%;width:100%;height:100%;z-index:99;background-color: rgba(0,0,0,.2)">
<button class="layui-btn">
<i class="layui-icon layui-icon-refresh-3"></i>
重新上传
</button>
</div>
</div>
<div class="viewFooter">
<img src="../../../image/calendarIcon.png" width="18">&nbsp;&nbsp;
`
for (var j = 0; j < photoList3.length; j++) {
if(viewList3[i].gtName == photoList3[j].gtName){
//照片存在,直接显示
html += `${photoList3[j].makeTime}`
break;
}
}
html +=`
</div>
</div>
</div>`
}
html += `</div>`;
$("#inspectionTourContent").append(html);
let table = layui.table;
let daysInMonth = new Date(chosenYear, chosenMonth, 0).getDate();
console.log(daysInMonth)
let tableData = [{isWork:['7.1','7.3','7.6','7.8']}]
let cols = []
for (let k = 1; k <= daysInMonth; k++) {
let str = chosenMonth+'.'+k;
let obj = {field:'isWork', title: str,align: 'center',width:70,
templet: function(d){
if(d.isWork.includes(d.LAY_COL.title)){
return `<i class="layui-icon" style="color: red;">&#xe605;</i> `
}else{
return `<apan></apan>`
}
}}
cols.push(obj)
}
table.render({
elem: '#isWorkList',
// url: "/sys/achievement",
// where: obj,
//skin: 'line', // 横向边框线
cols: [cols],
data: tableData
});
}
//页面赋值
function setData(data){
$("#username").text("张三");
$("#phone").text("15856564578");
$("#num").text("60");
$("#oneNum").text("16");
$("#twoNum").text("16");
$("#otherNum").text("16");
function setData(){
var id=localStorage.getItem("resultUserId");
$.ajax({//id获取详情打开弹窗传值子页面
type: 'post',
url: PATH_URL + "/makeInfo/getUserDetail",
dataType: 'json',
data: {
id: id
},
success: function (data) {
$("#username").text(data.data.userName);
$("#phone").text(data.data.tel);
$("#num").text(data.data.powerNum);
$("#oneNum").text(data.data.oneMake);
$("#twoNum").text(data.data.twoMake);
$("#otherNum").text(data.data.special);
},
error:function(e){
}
})
}
//文件查看
@ -224,7 +404,7 @@ function filePreView(url) {
maxmin: false
});
}else{
// localStorage.setItem("filePath", url);
localStorage.setItem("filePath", url);
// localStorage.setItem("fileName", fileName);
// localStorage.setItem("fileTime", time);
var height = '99%';
@ -238,4 +418,62 @@ function filePreView(url) {
});
}
}
}
}
//正常巡视照片导入
function normalInspectionUpload(){
let height = '99%';
let width = '70%';
var index = parent.layer.open({
title: ['正常巡视照片导入', 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
type: 2,
content: './normalInspectionUpload.html',
area: [width, height],
maxmin: false,
success: function (layero, index) {
// var myIframe = window[layero.find('iframe')[0]['name']];
// myIframe.hideSubmit();
// var fnc = myIframe.setData(data.data); //aaa()为子页面的方法
},
});
}
//新增特巡结果
function specialPatrolAdd(){
let height = '99%';
let width = '60%';
var index = parent.layer.open({
title: ['特巡结果上传', 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
type: 2,
content: './specialPatrolAdd.html',
area: [width, height],
maxmin: false,
success: function (layero, index) {
// var myIframe = window[layero.find('iframe')[0]['name']];
// myIframe.hideSubmit();
// var fnc = myIframe.setData(data.data); //aaa()为子页面的方法
},
});
}
//巡护段外上传
function patrolOutsideAdd(){
let height = '99%';
let width = '60%';
var index = parent.layer.open({
title: ['巡视结果上传-巡护范围之外的杆塔', 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
type: 2,
content: './patrolOutsideAdd.html',
area: [width, height],
maxmin: false,
success: function (layero, index) {
// var myIframe = window[layero.find('iframe')[0]['name']];
// myIframe.hideSubmit();
// var fnc = myIframe.setData(data.data); //aaa()为子页面的方法
},
});
}

View File

@ -197,9 +197,13 @@ function getView(){
for (let i = 0;i < viewList1.length;i++) {
var gtName = viewList1[i].gtName.length>4?viewList1[i].gtName.substring(0,4) + '...': viewList1[i].gtName;
html += `<div class="viewBox">
<div style="width: 100%;height:100%">
<div class="viewHeader">
<img src="../../../image/tower_white.png" alt="">
<div style="width: 100%;height:100%">`
if("1"==viewList1[i].makeType){
html +=`<div class="viewHeader" style="background-color: #FF9900;">`
}else{
html +=`<div class="viewHeader">`
}
html += `<img src="../../../image/tower_white.png" alt="">
<span style="width: 33%;" title="${viewList1[i].gtName}">${gtName}</span>
<img src="../../../image/edit_white.png" onclick="towerEdit(this,${viewList1[i].gtId},1)" style="cursor: pointer;width: 14px;height:16px" alt="">
<img src="../../../image/del_white.png" onclick="towerDel(this,${viewList1[i].gtId},1)" style="cursor: pointer;width: 14px;height:16px" alt="">
@ -207,7 +211,7 @@ function getView(){
<div class="viewContent">`
var flag = false;
for (var j = 0; j < photoList1.length; j++) {
if(viewList1[i].gtName == photoList1[j].gtName){
if(viewList1[i].gtId == photoList1[j].gtId){
//照片存在,直接显示
html += `<img src="${IMG_URL+photoList1[j].sfilePath}" alt="" onclick="filePreView('${IMG_URL+photoList1[j].filePath}')">`
flag = true;
@ -216,11 +220,11 @@ function getView(){
}
if(!flag){
//照片不存在,显示上传照片按钮
html += `<img src="../../../image/add2.png" style="width:150px;height:150px;border: 1px solid #E9E9E9;backgroubd:#F9F9F9;cursor: pointer;margin-top: 10px;" alt="" onclick="uploadPhoto(${viewList1[i].gtId},1)">
html += `<img src="../../../image/add2.png" style="width:150px;height:150px;border: 1px solid #E9E9E9;backgroubd:#F9F9F9;cursor: pointer;margin-top: 10px;" alt="" onclick="uploadPhoto(${viewList1[i].gtId},1,${viewList1[i].makeType})">
<div style="color:#cccccc">上传图片</div>`
}
html += `<div style="display: none;align-items: center;justify-content: center;position: relative;top:-100%;width:100%;height:100%;z-index:99;background-color: rgba(0,0,0,.2)">
<button class="layui-btn">
<button class="layui-btn" onclick="uploadPhoto(${viewList1[i].gtId},1,${viewList1[i].makeType})">
<i class="layui-icon layui-icon-refresh-3"></i>
重新上传
</button>
@ -229,7 +233,7 @@ function getView(){
<div class="viewFooter">
<img src="../../../image/calendarIcon.png" width="18">&nbsp;&nbsp;`
for (var j = 0; j < photoList1.length; j++) {
if(viewList1[i].gtName == photoList1[j].gtName){
if(viewList1[i].gtId == photoList1[j].gtId){
//照片存在,直接显示
html += `${photoList1[j].makeTime}`
break;
@ -257,7 +261,13 @@ function getView(){
var gtName = viewList2[i].gtName.length>4?viewList2[i].gtName.substring(0,4) + '...': viewList2[i].gtName;
html += `<div class="viewBox">
<div style="width: 100%;height:100%">
<div class="viewHeader">
`
if("1"==viewList2[i].makeType){
html +=`<div class="viewHeader" style="background-color: #FF9900;">`
}else{
html +=`<div class="viewHeader">`
}
html += `
<img src="../../../image/tower_white.png" alt="">
<span style="width: 33%;" title="${viewList2[i].gtName}">${gtName}</span>
<img src="../../../image/edit_white.png" onclick="towerEdit(this,${viewList2[i].gtId},2)" style="cursor: pointer;width: 14px;height:16px" alt="">
@ -266,7 +276,7 @@ function getView(){
<div class="viewContent">`
var flag = false;
for (var j = 0; j < photoList2.length; j++) {
if(viewList2[i].gtName == photoList2[j].gtName){
if(viewList2[i].gtId == photoList2[j].gtId){
//照片存在,直接显示
html += `<img src="${IMG_URL+photoList2[j].sfilePath}" alt="" onclick="filePreView('${IMG_URL+photoList2[j].filePath}')">`
flag = true;
@ -275,11 +285,11 @@ function getView(){
}
if(!flag){
//照片不存在,显示上传照片按钮
html += `<img src="../../../image/add2.png" style="width:150px;height:150px;border: 1px solid #E9E9E9;backgroubd:#F9F9F9;cursor: pointer;margin-top: 10px;" alt="" onclick="uploadPhoto(${viewList2[i].gtId},2)">
html += `<img src="../../../image/add2.png" style="width:150px;height:150px;border: 1px solid #E9E9E9;backgroubd:#F9F9F9;cursor: pointer;margin-top: 10px;" alt="" onclick="uploadPhoto(${viewList2[i].gtId},2,${viewList2[i].makeType})">
<div style="color:#cccccc">上传图片</div>`
}
html += `<div style="display: none;align-items: center;justify-content: center;position: relative;top:-100%;width:100%;height:100%;z-index:99;background-color: rgba(0,0,0,.2)">
<button class="layui-btn">
<button class="layui-btn" onclick="uploadPhoto(${viewList2[i].gtId},2,${viewList2[i].makeType})>
<i class="layui-icon layui-icon-refresh-3"></i>
重新上传
</button>
@ -288,7 +298,7 @@ function getView(){
<div class="viewFooter">
<img src="../../../image/calendarIcon.png" width="18">&nbsp;&nbsp;`
for (var j = 0; j < photoList2.length; j++) {
if(viewList2[i].gtName == photoList2[j].gtName){
if(viewList2[i].gtId == photoList2[j].gtId){
//照片存在,直接显示
html += `${photoList2[j].makeTime}`
break;
@ -322,12 +332,13 @@ function getView(){
<div class="viewHeader" style="font-size:12px">
<img src="../../../image/tower_white.png" alt="">
<span style="width: 33%;" title="${viewList3[i].gtName}">${gtName}</span>
<img src="../../../image/del_white.png" onclick="towerSpecialDel(this,${viewList3[i].gtId},3)" style="cursor: pointer;width: 14px;height:16px" alt="">
</div>
<div class="viewContent">
`
var flag = false;
for (var j = 0; j < photoList3.length; j++) {
if(viewList3[i].gtName == photoList3[j].gtName){
if(viewList3[i].gtId == photoList3[j].gtId){
//照片存在,直接显示
html += `<img src="${IMG_URL+photoList3[j].sfilePath}" alt="" onclick="filePreView('${IMG_URL+photoList3[j].filePath}')">`
flag = true;
@ -351,7 +362,7 @@ function getView(){
<img src="../../../image/calendarIcon.png" width="18">&nbsp;&nbsp;
`
for (var j = 0; j < photoList3.length; j++) {
if(viewList3[i].gtName == photoList3[j].gtName){
if(viewList3[i].gtId == photoList3[j].gtId){
//照片存在,直接显示
html += `${photoList3[j].makeTime}`
break;
@ -458,13 +469,45 @@ function towerDel(event,id,numTimes){
dataType: 'json',
async:false,
data: {
gtId:id,makeMonth:localStorage.getItem("resultMakeMonth"),numTimes:numTimes
gtId:id,makeMonth:localStorage.getItem("resultMakeMonth"),numTimes:numTimes,userId:localStorage.getItem("resultUserId")
},
success: function (data) {
console.log(data,"确定删除");
getView()
getSpecial(localStorage.getItem("resultMakeMonth").substring(0,4),localStorage.getItem("resultMakeMonth").substring(5,7)<10?localStorage.getItem("resultMakeMonth").substring(5,7).replace("0",""):localStorage.getItem("resultMakeMonth").substring(5,7));
layer.close(index);
if(data.code==500){
layer.msg(data.msg)
}else{
setData()
getView()
getSpecial(localStorage.getItem("resultMakeMonth").substring(0,4),localStorage.getItem("resultMakeMonth").substring(5,7)<10?localStorage.getItem("resultMakeMonth").substring(5,7).replace("0",""):localStorage.getItem("resultMakeMonth").substring(5,7));
layer.close(index);
}
},
error:function(e){
}
})
})
}
function towerSpecialDel(event,id,numTimes){
layer.confirm("确定删除吗?", function (index) {
$.ajax({//id获取详情打开弹窗传值子页面
type: 'post',
url: PATH_URL + "/makeInfo/delGtId",
dataType: 'json',
async:false,
data: {
id:id,numTimes:numTimes
},
success: function (data) {
console.log(data,"确定删除");
if(data.code==500){
layer.msg(data.msg)
}else{
setData()
getView()
getSpecial(localStorage.getItem("resultMakeMonth").substring(0,4),localStorage.getItem("resultMakeMonth").substring(5,7)<10?localStorage.getItem("resultMakeMonth").substring(5,7).replace("0",""):localStorage.getItem("resultMakeMonth").substring(5,7));
layer.close(index);
}
},
error:function(e){
@ -473,6 +516,7 @@ function towerDel(event,id,numTimes){
})
}
function reloadData(){
setData();
getView();
getSpecial(localStorage.getItem("resultMakeMonth").substring(0,4),localStorage.getItem("resultMakeMonth").substring(5,7)<10?localStorage.getItem("resultMakeMonth").substring(5,7).replace("0",""):localStorage.getItem("resultMakeMonth").substring(5,7));
}
@ -516,6 +560,7 @@ function specialPatrolAdd(){
//巡护段外上传
function patrolOutsideAdd(){
localStorage.setItem("resultUserId",localStorage.getItem("resultUserId"));
let height = '99%';
let width = '60%';
var index = parent.layer.open({
@ -534,7 +579,7 @@ function patrolOutsideAdd(){
}
//上传单张巡视图片
function uploadPhoto(id,numTimes){
function uploadPhoto(id,numTimes,makeType){
let height = '70%';
let width = '60%';
var index = parent.layer.open({
@ -545,7 +590,7 @@ function uploadPhoto(id,numTimes){
maxmin: false,
success: function (layero, index) {
var myIframe = parent.window[layero.find('iframe')[0]['name']];
myIframe.setGtId(id,localStorage.getItem("resultMakeMonth"),numTimes);
myIframe.setGtId(id,localStorage.getItem("resultMakeMonth"),numTimes,localStorage.getItem("resultUserId"),makeType,localStorage.getItem("resultProId"));
// var fnc = myIframe.setData(data.data); //aaa()为子页面的方法
},