|  |  |  | 
|---|
|  |  |  | display: none; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 样式用于美化图片展示 */ | 
|---|
|  |  |  | .layui-table-cell img { | 
|---|
|  |  |  | max-width: 100px; | 
|---|
|  |  |  | max-height: 100px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 样式用于美化图片展示 */ | 
|---|
|  |  |  | .layui-table-cell img { | 
|---|
|  |  |  | max-width: 100px; | 
|---|
|  |  |  | max-height: 100px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </style> | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | // 这里是需要在页面渲染之前执行的代码 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div style="display: none;" id="UploadImageView"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div  id="UploadImage" style="margin-left: 35px;margin-top: 30px;"> | 
|---|
|  |  |  | <label>上传图片:</label><button type="button" class="layui-btn" id="uploadBtn" style="margin-left: 20px;" >浏览</button> | 
|---|
|  |  |  | <div id="UploadImage" style="margin-left: 35px;margin-top: 30px;"> | 
|---|
|  |  |  | <label>上传图片:</label><button type="button" class="layui-btn" id="uploadBtn" | 
|---|
|  |  |  | style="margin-left: 20px;">浏览</button> | 
|---|
|  |  |  | <button type="button" class="layui-btn" id="upload" style="margin-left: 20px;">上传</button> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | base: '../../layuiadmin/' //静态资源所在路径 | 
|---|
|  |  |  | }).extend({ | 
|---|
|  |  |  | index: 'lib/index' //主入口模块 | 
|---|
|  |  |  | }).use(['index', 'table', 'laypage', 'element', 'layer', 'laydate','upload'], function () { | 
|---|
|  |  |  | }).use(['index', 'table', 'laypage', 'element', 'layer', 'laydate', 'upload'], function () { | 
|---|
|  |  |  | var table = layui.table, | 
|---|
|  |  |  | form = layui.form, | 
|---|
|  |  |  | element = layui.element, | 
|---|
|  |  |  | laypage = layui.laypage, | 
|---|
|  |  |  | layer = layui.layer, | 
|---|
|  |  |  | laydate = layui.laydate, | 
|---|
|  |  |  | upload   = layui.upload; | 
|---|
|  |  |  | upload = layui.upload; | 
|---|
|  |  |  | var h1 = GetTableTabHeight(); | 
|---|
|  |  |  | laydate.render({ | 
|---|
|  |  |  | elem: '#StartTime' | 
|---|
|  |  |  | 
|---|
|  |  |  | { field: 'Status', title: '执行状态', align: 'center', width: 90, templet: '#templetStatus' }, | 
|---|
|  |  |  | { field: 'RequestTime', title: '请验日期', align: 'center', width: 165, templet: '#templetCompleteTime' }, | 
|---|
|  |  |  | { field: 'RequestUser', title: '请验人', align: 'center', width: 165 }, | 
|---|
|  |  |  | { field: 'UDF5', title: '图片', align: 'center', width: 100 ,templet: function (d) { | 
|---|
|  |  |  | return d.image ? '<img src="' + d.image + '" alt="图片">' : '无图片';}}, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | field: 'UDF5', title: '图片', align: 'center', width: 100, templet: function (d) { | 
|---|
|  |  |  | return d.image ? '<img src="' + d.image + '" alt="图片">' : '无图片'; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // { field: 'UDF2', title: '自定义2', align: 'center', width: 100 }, | 
|---|
|  |  |  | // { field: 'UDF3', title: '自定义3', align: 'center', width: 100 }, | 
|---|
|  |  |  | // { field: 'UDF4', title: '自定义4', align: 'center', width: 100 }, | 
|---|
|  |  |  | 
|---|
|  |  |  | sendData(IP + "/Basis/GetRoleRightList", {}, 'get', function (res) { | 
|---|
|  |  |  | if (res.code == 0) { //成功 | 
|---|
|  |  |  | for (var k = 0; k < res.data.length; k++) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (res.data[k].MenuName == "上传") { | 
|---|
|  |  |  | $(function () { | 
|---|
|  |  |  | $(".shangClass").show(); | 
|---|
|  |  |  | 
|---|
|  |  |  | var data = obj.data; | 
|---|
|  |  |  | switch (obj.event) { | 
|---|
|  |  |  | case "upImage": | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type:1, | 
|---|
|  |  |  | title: '上传图片', | 
|---|
|  |  |  | content: $('#UploadImageView'), | 
|---|
|  |  |  | maxmin: true, | 
|---|
|  |  |  | area: ['350px','215px'], | 
|---|
|  |  |  | btn: ['确定'], | 
|---|
|  |  |  | success: function(index, layero){ | 
|---|
|  |  |  | upload.render({ | 
|---|
|  |  |  | elem: '#uploadBtn', | 
|---|
|  |  |  | url: IP + '/BllQuality/UploadImage', | 
|---|
|  |  |  | accept: 'images', | 
|---|
|  |  |  | exts:'jpg|png|gif', | 
|---|
|  |  |  | multiple: false, | 
|---|
|  |  |  | size: 1024 * 5, // 5MB | 
|---|
|  |  |  | auto: false, | 
|---|
|  |  |  | bindAction: '#upload', | 
|---|
|  |  |  | headers: { ToKen: $.cookie('token') }, | 
|---|
|  |  |  | xhrFields: { | 
|---|
|  |  |  | withCredentials: true // 携带cookie | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | before: function(){ | 
|---|
|  |  |  | this.data = { | 
|---|
|  |  |  | qualityId:data.Id | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | layer.load(1, {shade: [0.5, '#000']}); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | done: function(res){ | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type: 1, | 
|---|
|  |  |  | title: '上传图片', | 
|---|
|  |  |  | content: $('#UploadImageView'), | 
|---|
|  |  |  | maxmin: true, | 
|---|
|  |  |  | area: ['350px', '215px'], | 
|---|
|  |  |  | btn: ['确定'], | 
|---|
|  |  |  | success: function (index, layero) { | 
|---|
|  |  |  | upload.render({ | 
|---|
|  |  |  | elem: '#uploadBtn', | 
|---|
|  |  |  | url: IP + '/BllQuality/UploadImage', | 
|---|
|  |  |  | accept: 'images', | 
|---|
|  |  |  | exts: 'jpg|png|gif', | 
|---|
|  |  |  | multiple: false, | 
|---|
|  |  |  | size: 1024 * 5, // 5MB | 
|---|
|  |  |  | auto: false, | 
|---|
|  |  |  | bindAction: '#upload', | 
|---|
|  |  |  | headers: { ToKen: $.cookie('token') }, | 
|---|
|  |  |  | xhrFields: { | 
|---|
|  |  |  | withCredentials: true // 携带cookie | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | before: function () { | 
|---|
|  |  |  | this.data = { | 
|---|
|  |  |  | qualityId: data.Id | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | layer.load(1, { shade: [0.5, '#000'] }); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | done: function (res) { | 
|---|
|  |  |  | layer.closeAll('loading'); | 
|---|
|  |  |  | if(res.code == 0){ | 
|---|
|  |  |  | layer.msg('上传成功', {icon: 1}); | 
|---|
|  |  |  | if (res.code == 0) { | 
|---|
|  |  |  | layer.msg('上传成功', { icon: 1 }); | 
|---|
|  |  |  | // 上传成功后的回调,如刷新表格等 | 
|---|
|  |  |  | // table.reload('LAY-app-content-list'); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg || '上传失败', {icon: 2}); | 
|---|
|  |  |  | layer.msg(res.msg || '上传失败', { icon: 2 }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | error: function(){ | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | error: function () { | 
|---|
|  |  |  | layer.closeAll('loading'); | 
|---|
|  |  |  | layer.msg('上传失败', {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case "ViewImage": | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type:1, | 
|---|
|  |  |  | title: '查看图片', | 
|---|
|  |  |  | content: $('#ImagesShowView'), | 
|---|
|  |  |  | maxmin: true, | 
|---|
|  |  |  | area: ['650px','315px'], | 
|---|
|  |  |  | btn: ['确定'], | 
|---|
|  |  |  | success: function(index, layero){ | 
|---|
|  |  |  | getImage(data.Id); | 
|---|
|  |  |  | layer.msg('上传失败', { icon: 2 }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case "ViewImage": | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type: 1, | 
|---|
|  |  |  | title: '查看图片', | 
|---|
|  |  |  | content: $('#ImagesShowView'), | 
|---|
|  |  |  | maxmin: true, | 
|---|
|  |  |  | area: ['650px', '315px'], | 
|---|
|  |  |  | btn: ['确定'], | 
|---|
|  |  |  | success: function (index, layero) { | 
|---|
|  |  |  | getImage(data.Id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case "add": | 
|---|
|  |  |  | layer.confirm('确定要发起请验?', function (index) { | 
|---|
|  |  |  | var param = { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function getImage(id) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var param = { | 
|---|
|  |  |  | Id:id | 
|---|
|  |  |  | } | 
|---|
|  |  |  | sendData(IP + "/BllQuality/GetImage", param, 'post', function (res) { | 
|---|
|  |  |  | if (res.code == 0) { //成功 | 
|---|
|  |  |  | $("#ImagesShow").html(''); | 
|---|
|  |  |  | res.data.forEach(function (item) { | 
|---|
|  |  |  | $("#ImagesShow").append('<div>'+ | 
|---|
|  |  |  | '<a href='+item+' target="_blank" class="image-item"><img src="'+ item + '"  /></a>'+ | 
|---|
|  |  |  | '<button class="layui-btn layui-btn-primary layui-btn-sm delete-btn" data-type="customCols" data_Url='+item+' >删除</button>'+ | 
|---|
|  |  |  | '</div>'); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | $('.delete-btn').on('click',  function ( ) { | 
|---|
|  |  |  | var item = $(this); | 
|---|
|  |  |  | var QualityId = id; | 
|---|
|  |  |  | var imageUrl = item.attr('data_Url'); | 
|---|
|  |  |  | layer.confirm('确定删除吗?', function (index) { | 
|---|
|  |  |  | var param = { | 
|---|
|  |  |  | QualityId: QualityId, | 
|---|
|  |  |  | ImageUrl: imageUrl | 
|---|
|  |  |  | } | 
|---|
|  |  |  | sendData(IP + "/BllQuality/DeleteImage", param, 'post', function (res) { | 
|---|
|  |  |  | if (res.code == 0) { //成功 | 
|---|
|  |  |  | layer.msg(res.msg, { | 
|---|
|  |  |  | icon: 1, | 
|---|
|  |  |  | time: 1000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function () { | 
|---|
|  |  |  | getImage(id); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg, { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | })}); | 
|---|
|  |  |  | } else { //不成功 | 
|---|
|  |  |  | $("#ImagesShow").html(''); | 
|---|
|  |  |  | res.msg, { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | function getImage(id) { | 
|---|
|  |  |  | var param = { | 
|---|
|  |  |  | Id: id | 
|---|
|  |  |  | } | 
|---|
|  |  |  | sendData(IP + "/BllQuality/GetImage", param, 'post', function (res) { | 
|---|
|  |  |  | if (res.code == 0) { //成功 | 
|---|
|  |  |  | $("#ImagesShow").html(''); | 
|---|
|  |  |  | res.data.forEach(function (item) { | 
|---|
|  |  |  | $("#ImagesShow").append('<div>' + | 
|---|
|  |  |  | '<a href=' + item + ' target="_blank" class="image-item"><img src="' + item + '"  /></a>' + | 
|---|
|  |  |  | '<button class="layui-btn layui-btn-primary layui-btn-sm delete-btn" data-type="customCols" data_Url=' + item + ' >删除</button>' + | 
|---|
|  |  |  | '</div>'); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | $('.delete-btn').on('click', function () { | 
|---|
|  |  |  | var item = $(this); | 
|---|
|  |  |  | var QualityId = id; | 
|---|
|  |  |  | var imageUrl = item.attr('data_Url'); | 
|---|
|  |  |  | layer.confirm('确定删除吗?', function (index) { | 
|---|
|  |  |  | var param = { | 
|---|
|  |  |  | QualityId: QualityId, | 
|---|
|  |  |  | ImageUrl: imageUrl | 
|---|
|  |  |  | } | 
|---|
|  |  |  | sendData(IP + "/BllQuality/DeleteImage", param, 'post', function (res) { | 
|---|
|  |  |  | if (res.code == 0) { //成功 | 
|---|
|  |  |  | layer.msg(res.msg, { | 
|---|
|  |  |  | icon: 1, | 
|---|
|  |  |  | time: 1000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }, function () { | 
|---|
|  |  |  | getImage(id); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg, { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } else { //不成功 | 
|---|
|  |  |  | $("#ImagesShow").html(''); | 
|---|
|  |  |  | res.msg, { | 
|---|
|  |  |  | icon: 2, | 
|---|
|  |  |  | time: 2000 //2秒关闭(如果不配置,默认是3秒) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 取样明细单机事件 | 
|---|
|  |  |  | table.on('tool(SamplingDetails)', function (obj) { | 
|---|