yusijie
2024-07-29 8b70348572a14575613915b890811ff7e8e894a4
设备、器具PDA拍照上传
10个文件已修改
5728 ■■■■■ 已修改文件
WebTM/Properties/PublishProfiles/JFTM.pubxml.user 4419 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/layuiadmin/Scripts/webConfig.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/模治具管理/模治具点检保养/Sc_MouldDotCheckBill_PDA.html 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/模治具管理/模治具点检保养/Sc_MouldMaintainBill_PDA.html 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/模治具管理/模治具管理/Sc_Add_MouldDotCheckBillList.html 208 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/模治具管理/模治具管理/Sc_Add_MouldMaintainBillList.html 209 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/设备管理/Sb_EquipDotCheckBillEdit.html 213 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/设备管理/Sb_EquipDotCheckBill_PDA.html 185 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/设备管理/Sb_EquipMaintainBillEdit.html 212 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/设备管理/Sb_EquipMaintainBill_PDA.html 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/Properties/PublishProfiles/JFTM.pubxml.user
Diff too large
WebTM/layuiadmin/Scripts/webConfig.js
@@ -8,9 +8,9 @@
    /*var WEBURL = "http://localhost:8082/API/";    //杜贺本地配置*/
    //var WEBURL = "http://localhost:81/API/";    //王彬本地配置
    /*var WEBURL = "http://localhost:8083/API/";  //陈雯静本地配置*/
    var WEBURL = "http://localhost:81/API/"    //翁涛涛本地配置
    //var WEBURL = "http://localhost:81/API/"    //翁涛涛本地配置
    /*var WEBURL = "http://localhost:8082/API/";    *//*//张瑞广本地配置*/
   // var WEBURL = "http://localhost:8082/LuBaoAPI/";    //余思杰本地配置
    var WEBURL = "http://localhost:8082/LuBaoAPI/";    //余思杰本地配置
    //var WEBURL = "http://localhost:8088/ARAPI/";    //余思杰本地配置(安瑞)
    //var WEBURL = "http://10.1.4.155/API/";   //江丰客户NEW
   /* var WEBURL = "http://47.96.97.237/API/";   //智云服务器*/
WebTM/views/Ä£Öξ߹ÜÀí/Ä£Öξߵã¼ì±£Ñø/Sc_MouldDotCheckBill_PDA.html
@@ -171,7 +171,7 @@
                                                <input type="hidden" name="HDeptID" id="HDeptID" value="0" autocomplete="off" class="layui-input">
                                                <button type="button" lay-submit="" class="layui-btn layui-col-xs2 bz_btu" lay-filter="Department" id="Department" style="font-weight:bolder">...</button>
                                            </td>
                                        </tr>
                                        </tr>
                                        <tr>
                                            <th>备&ensp;&ensp;&ensp;&ensp;注</th>
                                            <td class="bz_td">
@@ -287,11 +287,34 @@
                                    </tbody>
                                </table>
                            </div>
                            <!--附件信息-->
                            <div class="layui-tab-item">
                                <div class="layui-form-item" style="padding-top: 10px;min-height:calc(50vh);">
                                    <div class="layui-upload">
                                        <button type="button" class="layui-btn" id="testList"><i class="layui-icon"></i>选择文件</button>
                                        <div class="layui-upload-list">
                                            <table class="layui-table">
                                                <thead>
                                                    <tr>
                                                        <th>文件名</th>
                                                        <th>大小</th>
                                                        <th>状态</th>
                                                        <th>操作</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="ProImgByList">
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <ul class="layui-tab-title">
                            <li class="layui-this">基本信息</li>
                            <li>明细信息</li>
                            <li>其他信息</li>
                            <li>附件信息</li>
                        </ul>
                    </div>
                    <!--隐藏字段-->
@@ -325,13 +348,14 @@
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
        }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , laydate = layui.laydate
                , upload = layui.upload
                , element = layui.element;
            var option = [];
@@ -375,6 +399,7 @@
                    //console.log(d.data);
                    $("#HInterID").val("0");
                    $("#HBillNo").val(d.data[0].HBillNo);
                    PicUpload(); //文件上传
                }
            });
@@ -1046,6 +1071,71 @@
                })
            }
            //文件上传
            function PicUpload() {
                //多图片上传
                //多文件列表示例
                var ProImgByList = $('#ProImgByList')
                    , uploadListIns = upload.render({
                        elem: '#testList'
                        , url: GetWEBURL() + "/Sc_MouldDotCheckBill/UploadFile"
                        , accept: 'file'
                        , multiple: true
                        , auto: false
                        , acceptMime: 'image/*'
                        //, bindAction: '#testListAction' //按扭绑定
                        , data: { "HBillNo": $("#HBillNo").val(), "HRemark": $("#HRemark").val(), "HUserName": sessionStorage["HUserName"] }
                        , choose: function (obj) {
                            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 / 1014).toFixed(1) + 'kb</td>'
                                    , '<td>等待上传</td>'
                                    , '<td>'
                                    , '<button class="layui-btn layui-btn-xs demo-reload ">上传</button>'
                                    , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
                                    , '</td>'
                                    , '</tr>'].join(''));
                                //单个重传
                                tr.find('.demo-reload').on('click', function () {
                                    obj.upload(index, file);
                                    return false;
                                });
                                //删除
                                tr.find('.demo-delete').on('click', function () {
                                    delete files[index]; //删除对应的文件
                                    tr.remove();
                                    uploadListIns.config.elem.next()[0].value = ''; //清空 input file å€¼ï¼Œä»¥å…åˆ é™¤åŽå‡ºçŽ°åŒåæ–‡ä»¶ä¸å¯é€‰
                                });
                                ProImgByList.append(tr);
                            });
                        }
                        , done: function (res, index, upload) {
                            if (res.code == 1) { //上传成功
                                var tr = ProImgByList.find('tr#upload-' + index)
                                    , tds = tr.children();
                                tds.eq(2).html('<span style="color: #5FB878;">上传成功</span>');
                                tds.eq(3).html(''); //清空操作
                                //tds.eq(3).find('.demo-reload').addClass('layui-hide'); //隐藏上传
                                return delete this.files[index]; //删除文件队列已经上传成功的文件
                            }
                            this.error(index, upload);
                        }
                        , error: function (index, upload) {
                            var tr = ProImgByList.find('tr#upload-' + index)
                                , tds = tr.children();
                            tds.eq(2).html('<span style="color: #FF5722;">上传失败[检查文件名及文件格式]</span>');
                            tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示上传
                        }
                    });
            }
            //以上为layui模块
        });
    </script>
WebTM/views/Ä£Öξ߹ÜÀí/Ä£Öξߵã¼ì±£Ñø/Sc_MouldMaintainBill_PDA.html
@@ -253,11 +253,34 @@
                                    </tbody>
                                </table>
                            </div>
                            <!--附件信息-->
                            <div class="layui-tab-item">
                                <div class="layui-form-item" style="padding-top: 10px;min-height:calc(50vh);">
                                    <div class="layui-upload">
                                        <button type="button" class="layui-btn" id="testList"><i class="layui-icon"></i>选择文件</button>
                                        <div class="layui-upload-list">
                                            <table class="layui-table">
                                                <thead>
                                                    <tr>
                                                        <th>文件名</th>
                                                        <th>大小</th>
                                                        <th>状态</th>
                                                        <th>操作</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="ProImgByList">
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <ul class="layui-tab-title">
                            <li class="layui-this">基本信息</li>
                            <li>明细信息</li>
                            <li>其他信息</li>
                            <li>附件信息</li>
                        </ul>
                    </div>
                    <!--隐藏字段-->
@@ -283,13 +306,14 @@
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
        }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , laydate = layui.laydate
                , upload = layui.upload
                , element = layui.element;
            var option = [];
@@ -333,6 +357,7 @@
                    //console.log(d.data);
                    $("#HInterID").val("0");
                    $("#HBillNo").val(d.data[0].HBillNo);
                    PicUpload(); //文件上传
                }
            });
@@ -768,6 +793,71 @@
                    }
                })
            }
            //文件上传
            function PicUpload() {
                //多图片上传
                //多文件列表示例
                var ProImgByList = $('#ProImgByList')
                    , uploadListIns = upload.render({
                        elem: '#testList'
                        , url: GetWEBURL() + "/Sc_MouldMaintainBill/UploadFile"
                        , accept: 'file'
                        , multiple: true
                        , auto: false
                        , acceptMime: 'image/*'
                        //, bindAction: '#testListAction' //按扭绑定
                        , data: { "HBillNo": $("#HBillNo").val(), "HRemark": $("#HRemark").val(), "HUserName": sessionStorage["HUserName"] }
                        , choose: function (obj) {
                            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 / 1014).toFixed(1) + 'kb</td>'
                                    , '<td>等待上传</td>'
                                    , '<td>'
                                    , '<button class="layui-btn layui-btn-xs demo-reload ">上传</button>'
                                    , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
                                    , '</td>'
                                    , '</tr>'].join(''));
                                //单个重传
                                tr.find('.demo-reload').on('click', function () {
                                    obj.upload(index, file);
                                    return false;
                                });
                                //删除
                                tr.find('.demo-delete').on('click', function () {
                                    delete files[index]; //删除对应的文件
                                    tr.remove();
                                    uploadListIns.config.elem.next()[0].value = ''; //清空 input file å€¼ï¼Œä»¥å…åˆ é™¤åŽå‡ºçŽ°åŒåæ–‡ä»¶ä¸å¯é€‰
                                });
                                ProImgByList.append(tr);
                            });
                        }
                        , done: function (res, index, upload) {
                            if (res.code == 1) { //上传成功
                                var tr = ProImgByList.find('tr#upload-' + index)
                                    , tds = tr.children();
                                tds.eq(2).html('<span style="color: #5FB878;">上传成功</span>');
                                tds.eq(3).html(''); //清空操作
                                //tds.eq(3).find('.demo-reload').addClass('layui-hide'); //隐藏上传
                                return delete this.files[index]; //删除文件队列已经上传成功的文件
                            }
                            this.error(index, upload);
                        }
                        , error: function (index, upload) {
                            var tr = ProImgByList.find('tr#upload-' + index)
                                , tds = tr.children();
                            tds.eq(2).html('<span style="color: #FF5722;">上传失败[检查文件名及文件格式]</span>');
                            tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示上传
                        }
                    });
            }
            //以上为layui模块
        });
    </script>
WebTM/views/Ä£Öξ߹ÜÀí/Ä£Öξ߹ÜÀí/Sc_Add_MouldDotCheckBillList.html
@@ -41,6 +41,10 @@
                        </div>
                        <div class="layui-card-body">
                            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                                 <ul class="layui-tab-title">
                                    <li class="layui-this">基本信息</li>
                                    <li>附件信息</li>
                                </ul>
                                <h1 style="text-align:center;"><b>器具点检记录表</b></h1>
                                <div class="layui-tab-content">
                                    <div class="layui-tab-item layui-show">
@@ -170,6 +174,29 @@
                                            </div>
                                        </div>
                                    </div>
                                    <!--附件信息-->
                                    <div class="layui-tab-item">
                                        <div class="layui-form-item" style="padding-top: 10px;">
                                            <div class="layui-upload">
                                                <button type="button" class="layui-btn" id="testList">选择文件</button><input class="layui-upload-file" type="file" accept="" name="file" multiple="">
                                                <div class="layui-upload-list">
                                                    <table class="layui-table" lay-filter="fileTable">
                                                        <thead>
                                                            <tr>
                                                                <th>文件名</th>
                                                                <th>图片</th>
                                                                <th>大小</th>
                                                                <th>状态</th>
                                                                <th>操作</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody id="ProImgByList" class="ProImgByList">
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
@@ -242,7 +269,7 @@
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
        }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
            //#region å…¬å…±å˜é‡
            var $ = layui.$
                , admin = layui.admin
@@ -250,6 +277,7 @@
                , table = layui.table
                , form = layui.form
                , laydate = layui.laydate
                , upload = layui.upload
                , element = layui.element;
            var option = [];//点检
            var option1 = [];//配件
@@ -276,10 +304,14 @@
            //判断操作类型
            if (OperationType == 1) {//无源单
                set_AddFNew();
                //文件选择初始化
                PicUpload();
            }
            else if (OperationType == 3) {//编辑
                set_EditFromGrid();
                //文件选择初始化
                PicUpload();
                getFile();
            }
            else {
                layer.alert("未知操作类型!", { icon: 5 });
@@ -926,6 +958,7 @@
                    data: {
                        "HID": linterid
                    },
                    async: false,
                    success: function (result) {
                        if (result.code == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            var data = result.data.h_v_Sc_MouldDotCheckBillList[0];
@@ -1102,6 +1135,112 @@
                return Result;
            }
            //#region æ–‡ä»¶ä¸Šä¼ 
            function PicUpload() {
                //多图片上传
                //多文件列表示例
                var ProImgByList = $('#ProImgByList')
                    , uploadListIns = upload.render({
                        elem: '#testList'
                        , url: GetWEBURL() + "/Sc_MouldDotCheckBill/UploadFile"
                        , accept: 'file'
                        , multiple: true
                        , auto: false
                        //, bindAction: '#testListAction' //按扭绑定
                        , data: { "HBillNo": $("#HBillNo").val(), "HRemark": $("#HRemark").val(), "HUserName": sessionStorage["HUserName"] }
                        , choose: function (obj) {
                            var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
                            //读取本地文件
                            obj.preview(function (index, file, result) {
                                var tr = $(['<tr id="upload-' + index + '">'
                                    , '<td>' + file.name + '</td>'
                                    , '<td>' + '<img onclick=\"previewImg(this)\" id="showImg" class="ImgClass" style="width: 150px; margin:10px;cursor:pointer;"src="' + result + '" alt="' + file.name + '">' + '</td>'
                                    , '<td>' + (file.size / 1014).toFixed(1) + 'kb</td>'
                                    , '<td>等待上传</td>'
                                    , '<td>'
                                    , '<button class="layui-btn layui-btn-xs demo-reload ">上传</button>'
                                    , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
                                    , '</td>'
                                    , '</tr>'].join(''));
                                //单个重传
                                tr.find('.demo-reload').on('click', function () {
                                    obj.upload(index, file);
                                    return false;
                                });
                                //删除
                                tr.find('.demo-delete').on('click', function () {
                                    delete files[index]; //删除对应的文件
                                    tr.remove();
                                    uploadListIns.config.elem.next()[0].value = ''; //清空 input file å€¼ï¼Œä»¥å…åˆ é™¤åŽå‡ºçŽ°åŒåæ–‡ä»¶ä¸å¯é€‰
                                });
                                ProImgByList.append(tr);
                            });
                        }
                        , done: function (res, index, upload) {
                            if (res.code == 1) { //上传成功
                                var tr = ProImgByList.find('tr#upload-' + index)
                                    , tds = tr.children();
                                tds.eq(3).html('<span style="color: #5FB878;">上传成功</span>');
                                tds.eq(4).html(''); //清空操作
                                return delete this.files[index]; //删除文件队列已经上传成功的文件
                            }
                            this.error(index, upload);
                        }
                        , error: function (index, upload) {
                            var tr = ProImgByList.find('tr#upload-' + index)
                                , tds = tr.children();
                            tds.eq(2).html('<span style="color: #FF5722;">上传失败[检查文件名及文件格式]</span>');
                            tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示上传
                        }
                    });
            }
            //#endregion
            //#region ç¼–辑时,获取已上传的文件列表
            function getFile() {
                var ProImgByList = $('#ProImgByList')
                $.ajax({
                    url: GetWEBURL() + '/Sc_MouldDotCheckBill/Filelist',
                    type: "GET",
                    data: { "HBillNo": $("#HBillNo").val() },
                    success: function (data1) {
                        if (data1.count == 1) {
                            var index = 0;
                            for (var i = 0; i < data1.data.length; i++) {
                                var tr = $(['<tr id="upload-' + i + '">'
                                    , '<td style="display:none">' + data1.data[i].HItemID + '</td>'
                                    , '<td style="display:none">' + data1.data[i].HSourceBillNo + '</td>'
                                    , '<td>' + data1.data[i].HFileName + '</td>'
                                    , '<td>' + '<img onclick=\"previewImg(this)\" id="showImg' + i + '" class="ImgClass" style="width: 150px; margin:10px;cursor:pointer;"src="' + data1.data[i].HFilePath + '" alt="' + data1.data[i].HFileName + '">' + '</td>'
                                    , '<td>' + (data1.data[i].HFileSize / 1014).toFixed(1) + 'kb</td>'
                                    , '<td style="color: #5FB878;">上传成功</td>'
                                    , '<td style="display:none">' + data1.data[i].url + '</td>'
                                    , '<td>'
                                    , '<button class="layui-btn layui-btn-xs  demo-dowload" type="button" id="deltefile" onclick="javascript:dowload(this)"><i class="layui-icon layui-icon-download-circle layuiadmin-button-btn"></i>下载</button>'
                                    , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete" type="button" id="deltefile" onclick="javascript:toManager(this)"><i class="layui-icon layui-icon-delete layuiadmin-button-btn"></i>删除</button>'
                                    , '</td>'
                                    , '</tr>'].join(''));
                                $('#ProImgByList').append(tr);
                            }
                        } else {
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //#endregion
            //#endregion
        });
@@ -1123,6 +1262,71 @@
            get_DocCheckItem2(obj[0].hmainid);
        }
        function previewImg(obj) {
            var img = new Image();
            img.src = obj.src;
            var height = img.height * 1.2; //获取图片高度
            var width = img.width * 1.2; //获取图片宽度
            var imgHtml = "<img src='" + obj.src + "' width='100%' height='100%'/>";
            //弹出层
            layer.open({
                type: 1,
                shade: 0.8,
                offset: 'auto',
                area: ['80%', '80%'],
                shadeClose: true,
                scrollbar: false,
                title: "图片预览", //不显示标题
                content: imgHtml, //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
                cancel: function () {
                    //layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', { time: 5000, icon: 6 });
                }
            });
        }
        //#region ä¸‹è½½å·²ä¸Šä¼ çš„æ–‡ä»¶
        function dowload(r) {
            //得到当前所在行
            var rows = r.parentNode.parentNode.rowIndex;
            //得到所在行的第五列的内容:文件地址
            var url = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(6)").html();
            /*window.location.href = url;*/
            window.open(url)
        }
        //#endregion
        //#region åˆ é™¤å·²ä¸Šä¼ çš„æ–‡ä»¶
        function toManager(r) {
            //得到当前所在行
            var rows = r.parentNode.parentNode.rowIndex;
            //得到所在行的第一列的内容:主键ID
            var HItemID = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(0)").html();
            //得到所在行的第二列的内容:单据号
            var HSourceBillNo = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(1)").html();
            //得到所在行的第三列的内容:文件名称
            var HFileName = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(2)").html();
            layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                //删除已上传文件
                $.ajax({
                    url: GetWEBURL() + '/Sc_MouldDotCheckBill/DeleteFilelist',
                    type: "GET",
                    data: { "HItemID": HItemID, "HSourceBillNo": HSourceBillNo, "HFileName": HFileName },
                    success: function (data1) {
                        if (data1.count == 1) {
                            layer.alert(data1.Message, { icon: 1 });
                            $("#ProImgByList tr").eq((rows - 1)).remove();
                        }
                        else {
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            })
        }
    </script>
</body>
</html>
WebTM/views/Ä£Öξ߹ÜÀí/Ä£Öξ߹ÜÀí/Sc_Add_MouldMaintainBillList.html
@@ -43,6 +43,10 @@
                        </div>
                        <div class="layui-card-body">
                            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                                <ul class="layui-tab-title">
                                    <li class="layui-this">基本信息</li>
                                    <li>附件信息</li>
                                </ul>
                                <h1 style="text-align:center;"><b>器具保养记录表</b></h1>
                                <div class="layui-tab-content">
                                    <div class="layui-tab-item layui-show">
@@ -145,6 +149,29 @@
                                            </div>
                                        </div>
                                    </div>
                                    <!--附件信息-->
                                    <div class="layui-tab-item">
                                        <div class="layui-form-item" style="padding-top: 10px;">
                                            <div class="layui-upload">
                                                <button type="button" class="layui-btn" id="testList">选择文件</button><input class="layui-upload-file" type="file" accept="" name="file" multiple="">
                                                <div class="layui-upload-list">
                                                    <table class="layui-table" lay-filter="fileTable">
                                                        <thead>
                                                            <tr>
                                                                <th>文件名</th>
                                                                <th>图片</th>
                                                                <th>大小</th>
                                                                <th>状态</th>
                                                                <th>操作</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody id="ProImgByList" class="ProImgByList">
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
@@ -226,7 +253,7 @@
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
        }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
            //#region å…¬ç”¨å˜é‡
            var $ = layui.$
@@ -235,6 +262,7 @@
                , table = layui.table
                , form = layui.form
                , laydate = layui.laydate
                , upload = layui.upload
                , element = layui.element;
            var option;
            var option2;
@@ -261,10 +289,14 @@
            //判断操作类型
            if (OperationType == 1) {//无源单
                set_AddFNew();
                //文件选择初始化
                PicUpload();
            }
            else if (OperationType == 3) {//编辑
                set_EditFromGrid();
                //文件选择初始化
                PicUpload();
                getFile();
            }
            else {
                layer.alert("未知操作类型!", { icon: 5 });
@@ -1109,6 +1141,7 @@
                    data: {
                        "HID": linterid
                    },
                    async: false,
                    success: function (result) {
                        if (result.code == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            var data = result.data.h_v_Sc_MouldMaintain[0];
@@ -1321,6 +1354,113 @@
                }
                return Result;
            }
            //#region æ–‡ä»¶ä¸Šä¼ 
            function PicUpload() {
                //多图片上传
                //多文件列表示例
                var ProImgByList = $('#ProImgByList')
                    , uploadListIns = upload.render({
                        elem: '#testList'
                        , url: GetWEBURL() + "/Sc_MouldMaintainBill/UploadFile"
                        , accept: 'file'
                        , multiple: true
                        , auto: false
                        //, bindAction: '#testListAction' //按扭绑定
                        , data: { "HBillNo": $("#HBillNo").val(), "HRemark": $("#HRemark").val(), "HUserName": sessionStorage["HUserName"] }
                        , choose: function (obj) {
                            var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
                            //读取本地文件
                            obj.preview(function (index, file, result) {
                                var tr = $(['<tr id="upload-' + index + '">'
                                    , '<td>' + file.name + '</td>'
                                    , '<td>' + '<img onclick=\"previewImg(this)\" id="showImg" class="ImgClass" style="width: 150px; margin:10px;cursor:pointer;"src="' + result + '" alt="' + file.name + '">' + '</td>'
                                    , '<td>' + (file.size / 1014).toFixed(1) + 'kb</td>'
                                    , '<td>等待上传</td>'
                                    , '<td>'
                                    , '<button class="layui-btn layui-btn-xs demo-reload ">上传</button>'
                                    , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
                                    , '</td>'
                                    , '</tr>'].join(''));
                                //单个重传
                                tr.find('.demo-reload').on('click', function () {
                                    obj.upload(index, file);
                                    return false;
                                });
                                //删除
                                tr.find('.demo-delete').on('click', function () {
                                    delete files[index]; //删除对应的文件
                                    tr.remove();
                                    uploadListIns.config.elem.next()[0].value = ''; //清空 input file å€¼ï¼Œä»¥å…åˆ é™¤åŽå‡ºçŽ°åŒåæ–‡ä»¶ä¸å¯é€‰
                                });
                                ProImgByList.append(tr);
                            });
                        }
                        , done: function (res, index, upload) {
                            if (res.code == 1) { //上传成功
                                var tr = ProImgByList.find('tr#upload-' + index)
                                    , tds = tr.children();
                                tds.eq(3).html('<span style="color: #5FB878;">上传成功</span>');
                                tds.eq(4).html(''); //清空操作
                                return delete this.files[index]; //删除文件队列已经上传成功的文件
                            }
                            this.error(index, upload);
                        }
                        , error: function (index, upload) {
                            var tr = ProImgByList.find('tr#upload-' + index)
                                , tds = tr.children();
                            tds.eq(2).html('<span style="color: #FF5722;">上传失败[检查文件名及文件格式]</span>');
                            tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示上传
                        }
                    });
            }
            //#endregion
            //#region ç¼–辑时,获取已上传的文件列表
            function getFile() {
                var ProImgByList = $('#ProImgByList')
                $.ajax({
                    url: GetWEBURL() + '/Sc_MouldMaintainBill/Filelist',
                    type: "GET",
                    data: { "HBillNo": $("#HBillNo").val() },
                    success: function (data1) {
                        if (data1.count == 1) {
                            var index = 0;
                            for (var i = 0; i < data1.data.length; i++) {
                                var tr = $(['<tr id="upload-' + i + '">'
                                    , '<td style="display:none">' + data1.data[i].HItemID + '</td>'
                                    , '<td style="display:none">' + data1.data[i].HSourceBillNo + '</td>'
                                    , '<td>' + data1.data[i].HFileName + '</td>'
                                    , '<td>' + '<img onclick=\"previewImg(this)\" id="showImg' + i + '" class="ImgClass" style="width: 150px; margin:10px;cursor:pointer;"src="' + data1.data[i].HFilePath + '" alt="' + data1.data[i].HFileName + '">' + '</td>'
                                    , '<td>' + (data1.data[i].HFileSize / 1014).toFixed(1) + 'kb</td>'
                                    , '<td style="color: #5FB878;">上传成功</td>'
                                    , '<td style="display:none">' + data1.data[i].url + '</td>'
                                    , '<td>'
                                    , '<button class="layui-btn layui-btn-xs  demo-dowload" type="button" id="deltefile" onclick="javascript:dowload(this)"><i class="layui-icon layui-icon-download-circle layuiadmin-button-btn"></i>下载</button>'
                                    , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete" type="button" id="deltefile" onclick="javascript:toManager(this)"><i class="layui-icon layui-icon-delete layuiadmin-button-btn"></i>删除</button>'
                                    , '</td>'
                                    , '</tr>'].join(''));
                                $('#ProImgByList').append(tr);
                            }
                        } else {
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //#endregion
            //#endregion
        });
@@ -1342,6 +1482,71 @@
            get_MaintainItem2();
        }
        function previewImg(obj) {
            var img = new Image();
            img.src = obj.src;
            var height = img.height * 1.2; //获取图片高度
            var width = img.width * 1.2; //获取图片宽度
            var imgHtml = "<img src='" + obj.src + "' width='100%' height='100%'/>";
            //弹出层
            layer.open({
                type: 1,
                shade: 0.8,
                offset: 'auto',
                area: ['80%', '80%'],
                shadeClose: true,
                scrollbar: false,
                title: "图片预览", //不显示标题
                content: imgHtml, //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
                cancel: function () {
                    //layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', { time: 5000, icon: 6 });
                }
            });
        }
        //#region ä¸‹è½½å·²ä¸Šä¼ çš„æ–‡ä»¶
        function dowload(r) {
            //得到当前所在行
            var rows = r.parentNode.parentNode.rowIndex;
            //得到所在行的第五列的内容:文件地址
            var url = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(6)").html();
            /*window.location.href = url;*/
            window.open(url)
        }
        //#endregion
        //#region åˆ é™¤å·²ä¸Šä¼ çš„æ–‡ä»¶
        function toManager(r) {
            //得到当前所在行
            var rows = r.parentNode.parentNode.rowIndex;
            //得到所在行的第一列的内容:主键ID
            var HItemID = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(0)").html();
            //得到所在行的第二列的内容:单据号
            var HSourceBillNo = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(1)").html();
            //得到所在行的第三列的内容:文件名称
            var HFileName = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(2)").html();
            layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                //删除已上传文件
                $.ajax({
                    url: GetWEBURL() + '/Sc_MouldMaintainBill/DeleteFilelist',
                    type: "GET",
                    data: { "HItemID": HItemID, "HSourceBillNo": HSourceBillNo, "HFileName": HFileName },
                    success: function (data1) {
                        if (data1.count == 1) {
                            layer.alert(data1.Message, { icon: 1 });
                            $("#ProImgByList tr").eq((rows - 1)).remove();
                        }
                        else {
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            })
        }
    </script>
</body>
</html>
WebTM/views/É豸¹ÜÀí/Sb_EquipDotCheckBillEdit.html
@@ -44,10 +44,10 @@
                        </div>
                        <div class="layui-card-body">
                            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                                <!--<ul class="layui-tab-title">
                                <li class="layui-this">基本信息</li>-->
                                <!--<li>其他信息</li>-->
                                <!--</ul>-->
                                <ul class="layui-tab-title">
                                    <li class="layui-this">基本信息</li>
                                    <li>附件信息</li>
                                </ul>
                                <h1 style="text-align: center; padding: 10px 0;"><b>设备点检记录单</b></h1>
                                <div class="layui-tab-content">
                                    <div class="layui-tab-item layui-show">
@@ -172,6 +172,29 @@
                                            </div>
                                        </div>
                                    </div>
                                    <!--附件信息-->
                                    <div class="layui-tab-item">
                                        <div class="layui-form-item" style="padding-top: 10px;">
                                            <div class="layui-upload">
                                                <button type="button" class="layui-btn" id="testList">选择文件</button><input class="layui-upload-file" type="file" accept="" name="file" multiple="">
                                                <div class="layui-upload-list">
                                                    <table class="layui-table" lay-filter="fileTable">
                                                        <thead>
                                                            <tr>
                                                                <th>文件名</th>
                                                                <th>图片</th>
                                                                <th>大小</th>
                                                                <th>状态</th>
                                                                <th>操作</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody id="ProImgByList" class="ProImgByList">
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
@@ -221,7 +244,7 @@
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
        }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
            //#region å…¬ç”¨å˜é‡
            var $ = layui.$
@@ -230,6 +253,7 @@
                , table = layui.table
                , form = layui.form
                , laydate = layui.laydate
                , upload = layui.upload
                , element = layui.element;
            var option = [];
@@ -255,9 +279,14 @@
            //判断操作类型
            if (OperationType == 1) {//无源新增
                set_AddFNew();
                //文件选择初始化
                PicUpload();
            }
            else if (OperationType == 3) {//编辑
                set_EditFromGrid(linterid);
                //文件选择初始化
                PicUpload();
                getFile();
            }
            else {
                layer.alert("未知操作类型!", { icon: 5 });
@@ -988,6 +1017,7 @@
                    data: {
                        "HID": linterid
                    },
                    async: false,
                    success: function (result) {
                        if (result.code == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            var data = result.data.h_v_Sb_EquipDotCheckBillList[0];
@@ -1062,6 +1092,113 @@
                    }
                });
            }
            //#region æ–‡ä»¶ä¸Šä¼ 
            function PicUpload() {
                //多图片上传
                //多文件列表示例
                var ProImgByList = $('#ProImgByList')
                    , uploadListIns = upload.render({
                        elem: '#testList'
                        , url: GetWEBURL() + "/Sb_EquipDotCheckBill/UploadFile"
                        , accept: 'file'
                        , multiple: true
                        , auto: false
                        //, bindAction: '#testListAction' //按扭绑定
                        , data: { "HBillNo": $("#HBillNo").val(), "HRemark": $("#HRemark").val(), "HUserName": sessionStorage["HUserName"] }
                        , choose: function (obj) {
                            var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
                            //读取本地文件
                            obj.preview(function (index, file, result) {
                                var tr = $(['<tr id="upload-' + index + '">'
                                    , '<td>' + file.name + '</td>'
                                    , '<td>' + '<img onclick=\"previewImg(this)\" id="showImg" class="ImgClass" style="width: 150px; margin:10px;cursor:pointer;"src="' + result + '" alt="' + file.name + '">' + '</td>'
                                    , '<td>' + (file.size / 1014).toFixed(1) + 'kb</td>'
                                    , '<td>等待上传</td>'
                                    , '<td>'
                                    , '<button class="layui-btn layui-btn-xs demo-reload ">上传</button>'
                                    , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
                                    , '</td>'
                                    , '</tr>'].join(''));
                                //单个重传
                                tr.find('.demo-reload').on('click', function () {
                                    obj.upload(index, file);
                                    return false;
                                });
                                //删除
                                tr.find('.demo-delete').on('click', function () {
                                    delete files[index]; //删除对应的文件
                                    tr.remove();
                                    uploadListIns.config.elem.next()[0].value = ''; //清空 input file å€¼ï¼Œä»¥å…åˆ é™¤åŽå‡ºçŽ°åŒåæ–‡ä»¶ä¸å¯é€‰
                                });
                                ProImgByList.append(tr);
                            });
                        }
                        , done: function (res, index, upload) {
                            if (res.code == 1) { //上传成功
                                var tr = ProImgByList.find('tr#upload-' + index)
                                    , tds = tr.children();
                                tds.eq(3).html('<span style="color: #5FB878;">上传成功</span>');
                                tds.eq(4).html(''); //清空操作
                                return delete this.files[index]; //删除文件队列已经上传成功的文件
                            }
                            this.error(index, upload);
                        }
                        , error: function (index, upload) {
                            var tr = ProImgByList.find('tr#upload-' + index)
                                , tds = tr.children();
                            tds.eq(2).html('<span style="color: #FF5722;">上传失败[检查文件名及文件格式]</span>');
                            tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示上传
                        }
                    });
            }
            //#endregion
            //#region ç¼–辑时,获取已上传的文件列表
            function getFile() {
                var ProImgByList = $('#ProImgByList')
                $.ajax({
                    url: GetWEBURL() + '/Sb_EquipDotCheckBill/Filelist',
                    type: "GET",
                    data: { "HBillNo": $("#HBillNo").val() },
                    success: function (data1) {
                        if (data1.count == 1) {
                            var index = 0;
                            for (var i = 0; i < data1.data.length; i++) {
                                var tr = $(['<tr id="upload-' + i + '">'
                                    , '<td style="display:none">' + data1.data[i].HItemID + '</td>'
                                    , '<td style="display:none">' + data1.data[i].HSourceBillNo + '</td>'
                                    , '<td>' + data1.data[i].HFileName + '</td>'
                                    , '<td>' + '<img onclick=\"previewImg(this)\" id="showImg' + i + '" class="ImgClass" style="width: 150px; margin:10px;cursor:pointer;"src="' + data1.data[i].HFilePath + '" alt="' + data1.data[i].HFileName + '">' + '</td>'
                                    , '<td>' + (data1.data[i].HFileSize / 1014).toFixed(1) + 'kb</td>'
                                    , '<td style="color: #5FB878;">上传成功</td>'
                                    , '<td style="display:none">' + data1.data[i].url + '</td>'
                                    , '<td>'
                                    , '<button class="layui-btn layui-btn-xs  demo-dowload" type="button" id="deltefile" onclick="javascript:dowload(this)"><i class="layui-icon layui-icon-download-circle layuiadmin-button-btn"></i>下载</button>'
                                    , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete" type="button" id="deltefile" onclick="javascript:toManager(this)"><i class="layui-icon layui-icon-delete layuiadmin-button-btn"></i>删除</button>'
                                    , '</td>'
                                    , '</tr>'].join(''));
                                $('#ProImgByList').append(tr);
                            }
                        } else {
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //#endregion
            // è¡¨å•数据编辑时间格式化
            function formatDate(date) {
                var d = new Date(date),
@@ -1143,6 +1280,72 @@
        function GetHManagerValue(obj) {
            OptionData = obj;
        }
        function previewImg(obj) {
            var img = new Image();
            img.src = obj.src;
            var height = img.height * 1.2; //获取图片高度
            var width = img.width * 1.2; //获取图片宽度
            var imgHtml = "<img src='" + obj.src + "' width='100%' height='100%'/>";
            //弹出层
            layer.open({
                type: 1,
                shade: 0.8,
                offset: 'auto',
                area: ['80%', '80%'],
                shadeClose: true,
                scrollbar: false,
                title: "图片预览", //不显示标题
                content: imgHtml, //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
                cancel: function () {
                    //layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', { time: 5000, icon: 6 });
                }
            });
        }
        //#region ä¸‹è½½å·²ä¸Šä¼ çš„æ–‡ä»¶
        function dowload(r) {
            //得到当前所在行
            var rows = r.parentNode.parentNode.rowIndex;
            //得到所在行的第五列的内容:文件地址
            var url = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(6)").html();
            /*window.location.href = url;*/
            window.open(url)
        }
        //#endregion
        //#region åˆ é™¤å·²ä¸Šä¼ çš„æ–‡ä»¶
        function toManager(r) {
            //得到当前所在行
            var rows = r.parentNode.parentNode.rowIndex;
            //得到所在行的第一列的内容:主键ID
            var HItemID = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(0)").html();
            //得到所在行的第二列的内容:单据号
            var HSourceBillNo = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(1)").html();
            //得到所在行的第三列的内容:文件名称
            var HFileName = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(2)").html();
            layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                //删除已上传文件
                $.ajax({
                    url: GetWEBURL() + '/Sb_EquipDotCheckBill/DeleteFilelist',
                    type: "GET",
                    data: { "HItemID": HItemID, "HSourceBillNo": HSourceBillNo, "HFileName": HFileName },
                    success: function (data1) {
                        if (data1.count == 1) {
                            layer.alert(data1.Message, { icon: 1 });
                            $("#ProImgByList tr").eq((rows - 1)).remove();
                        }
                        else {
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            })
        }
        //#endregion
    </script>
</body>
</html>
WebTM/views/É豸¹ÜÀí/Sb_EquipDotCheckBill_PDA.html
@@ -287,11 +287,39 @@
                                    </tbody>
                                </table>
                            </div>
                            <!--附件信息-->
                            <div class="layui-tab-item">
                                <div class="layui-form-item" style="padding-top: 10px;min-height:calc(50vh);">
                                    <div class="layui-upload">
                                        <button type="button" class="layui-btn" id="testList"><i class="layui-icon"></i>选择文件</button>
                                        <!--<input class="layui-upload-file" type="file" accept="" name="file" multiple="">-->
                                        <!--<button type="button" class="layui-btn" id="camera" capture="user"><i class="layui-icon"></i>拍照上传</button>-->
                                        <div class="layui-upload-list">
                                            <table class="layui-table">
                                                <thead>
                                                    <tr>
                                                        <th>文件名</th>
                                                        <th>大小</th>
                                                        <th>状态</th>
                                                        <th>操作</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="ProImgByList">
                                                </tbody>
                                            </table>
                                        </div>
                                        <div>
                                            <button class="layui-btn" id="cameraBtn">调用相机</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <ul class="layui-tab-title">
                            <li class="layui-this">基本信息</li>
                            <li>明细信息</li>
                            <li>其他信息</li>
                            <li>附件信息</li>
                        </ul>
                    </div>
                    <!--隐藏字段-->
@@ -321,17 +349,25 @@
        </select>
    </script>-->
    <script>
        var u = navigator.userAgent, app = navigator.appVersion;
        var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
        if (isAndroid) {
            $(":file").attr('capture', 'camera');
        }
    </script>
    <script>
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
        }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , laydate = layui.laydate
                , upload = layui.upload
                , element = layui.element;
            var option = [];
@@ -375,6 +411,8 @@
                    //console.log(d.data);
                    $("#HInterID").val("0");
                    $("#HBillNo").val(d.data[0].HBillNo);
                    PicUpload(); //文件上传
                    PicUploads(); //拍照上传
                }
            });
@@ -977,6 +1015,151 @@
                })
            }
            upload.render({
                elem: '#cameraBtn', // ç»‘定元素
                url: GetWEBURL() + "/Sb_EquipDotCheckBill/UploadFile",
                accept: 'images', // æŒ‡å®šå…è®¸ä¸Šä¼ çš„æ–‡ä»¶ç±»åž‹
                type: 'camera', // è®¾ç½®ç±»åž‹ä¸ºcamera,调用相机
                done: function (res) {
                    // ä¸Šä¼ å®Œæ¯•回调
                    if (res.status === 200) {
                        // å‡è®¾åŽç«¯è¿”回的是图片地址
                        $('#cameraImg').append('<img src="' + res.data.src + '" alt=""/>');
                    }
                },
                error: function () {
                    // ä¸Šä¼ å‡ºé”™çš„回调
                    console.log('上传出错');
                }
            });
            //文件上传
            function PicUpload() {
                //多图片上传
                //多文件列表示例
                var ProImgByList = $('#ProImgByList')
                    , uploadListIns = upload.render({
                        elem: '#testList'
                        , url: GetWEBURL() + "/Sb_EquipDotCheckBill/UploadFile"
                        , accept: 'file'
                        , multiple: true
                        , auto: false
                        , acceptMime: 'image/*'
                        //, bindAction: '#testListAction' //按扭绑定
                        , data: { "HBillNo": $("#HBillNo").val(), "HRemark": $("#HRemark").val(), "HUserName": sessionStorage["HUserName"] }
                        , choose: function (obj) {
                            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 / 1014).toFixed(1) + 'kb</td>'
                                    , '<td>等待上传</td>'
                                    , '<td>'
                                    , '<button class="layui-btn layui-btn-xs demo-reload ">上传</button>'
                                    , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
                                    , '</td>'
                                    , '</tr>'].join(''));
                                //单个重传
                                tr.find('.demo-reload').on('click', function () {
                                    obj.upload(index, file);
                                    return false;
                                });
                                //删除
                                tr.find('.demo-delete').on('click', function () {
                                    delete files[index]; //删除对应的文件
                                    tr.remove();
                                    uploadListIns.config.elem.next()[0].value = ''; //清空 input file å€¼ï¼Œä»¥å…åˆ é™¤åŽå‡ºçŽ°åŒåæ–‡ä»¶ä¸å¯é€‰
                                });
                                ProImgByList.append(tr);
                            });
                        }
                        , done: function (res, index, upload) {
                            if (res.code == 1) { //上传成功
                                var tr = ProImgByList.find('tr#upload-' + index)
                                    , tds = tr.children();
                                tds.eq(2).html('<span style="color: #5FB878;">上传成功</span>');
                                tds.eq(3).html(''); //清空操作
                                //tds.eq(3).find('.demo-reload').addClass('layui-hide'); //隐藏上传
                                return delete this.files[index]; //删除文件队列已经上传成功的文件
                            }
                            this.error(index, upload);
                        }
                        , error: function (index, upload) {
                            var tr = ProImgByList.find('tr#upload-' + index)
                                , tds = tr.children();
                            tds.eq(2).html('<span style="color: #FF5722;">上传失败[检查文件名及文件格式]</span>');
                            tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示上传
                        }
                    });
            }
            //拍照上传
            function PicUploads() {
                var ProImgByList = $('#ProImgByList')
                    , uploadListIns = upload.render({
                        elem: '#camera'
                        , url: GetWEBURL() + "/Sb_EquipDotCheckBill/UploadFile"
                        , accept: 'file'
                        , multiple: true
                        , acceptMime: 'image/*'
                        , auto: false
                        , data: { "HBillNo": $("#HBillNo").val(), "HRemark": $("#HRemark").val(), "HUserName": sessionStorage["HUserName"] }
                        , choose: function (obj) {
                            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 / 1014).toFixed(1) + 'kb</td>'
                                    , '<td>等待上传</td>'
                                    , '<td>'
                                    , '<button class="layui-btn layui-btn-xs demo-reload ">上传</button>'
                                    , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
                                    , '</td>'
                                    , '</tr>'].join(''));
                                //单个重传
                                tr.find('.demo-reload').on('click', function () {
                                    obj.upload(index, file);
                                    return false;
                                });
                                //删除
                                tr.find('.demo-delete').on('click', function () {
                                    delete files[index]; //删除对应的文件
                                    tr.remove();
                                    uploadListIns.config.elem.next()[0].value = ''; //清空 input file å€¼ï¼Œä»¥å…åˆ é™¤åŽå‡ºçŽ°åŒåæ–‡ä»¶ä¸å¯é€‰
                                });
                                ProImgByList.append(tr);
                            });
                        }
                        , done: function (res, index, upload) {
                            if (res.code == 1) { //上传成功
                                var tr = ProImgByList.find('tr#upload-' + index)
                                    , tds = tr.children();
                                tds.eq(2).html('<span style="color: #5FB878;">上传成功</span>');
                                tds.eq(3).html(''); //清空操作
                                //tds.eq(3).find('.demo-reload').addClass('layui-hide'); //隐藏上传
                                return delete this.files[index]; //删除文件队列已经上传成功的文件
                            }
                            this.error(index, upload);
                        }
                        , error: function (index, upload) {
                            var tr = ProImgByList.find('tr#upload-' + index)
                                , tds = tr.children();
                            tds.eq(2).html('<span style="color: #FF5722;">上传失败[检查文件名及文件格式]</span>');
                            tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示上传
                        }
                    });
            }
            //以上为layui模块
        });
    </script>
WebTM/views/É豸¹ÜÀí/Sb_EquipMaintainBillEdit.html
@@ -46,10 +46,10 @@
                        </div>
                        <div class="layui-card-body">
                            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                                <!--<ul class="layui-tab-title">
                                <li class="layui-this">基本信息</li>-->
                                <!--<li>其他信息</li>-->
                                <!--</ul>-->
                                <ul class="layui-tab-title">
                                    <li class="layui-this">基本信息</li>
                                    <li>附件信息</li>
                                </ul>
                                <h1 style="text-align: center; padding: 10px 0;"><b>设备保养记录单</b></h1>
                                <div class="layui-tab-content">
                                    <div class="layui-tab-item layui-show">
@@ -154,6 +154,29 @@
                                            </div>
                                        </div>
                                    </div>
                                    <!--附件信息-->
                                    <div class="layui-tab-item">
                                        <div class="layui-form-item" style="padding-top: 10px;">
                                            <div class="layui-upload">
                                                <button type="button" class="layui-btn" id="testList">选择文件</button><input class="layui-upload-file" type="file" accept="" name="file" multiple="">
                                                <div class="layui-upload-list">
                                                    <table class="layui-table" lay-filter="fileTable">
                                                        <thead>
                                                            <tr>
                                                                <th>文件名</th>
                                                                <th>图片</th>
                                                                <th>大小</th>
                                                                <th>状态</th>
                                                                <th>操作</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody id="ProImgByList" class="ProImgByList">
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
@@ -233,7 +256,7 @@
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
        }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
            //#region å…¬å…±å˜é‡
            var $ = layui.$
                , admin = layui.admin
@@ -241,6 +264,7 @@
                , table = layui.table
                , form = layui.form
                , laydate = layui.laydate
                , upload = layui.upload
                , element = layui.element;
            //查询条件
            var option = [];//保养
@@ -267,9 +291,14 @@
            //判断操作类型
            if (OperationType == 1) {//无源新增
                set_AddFNew();
                //文件选择初始化
                PicUpload();
            }
            else if (OperationType == 3) {//编辑
                set_EditFromGrid(linterid);
                //文件选择初始化
                PicUpload();
                getFile();
            }
            else {
                layer.alert("未知操作类型!", { icon: 5 });
@@ -906,6 +935,7 @@
                    data: {
                        "HID": linterid
                    },
                    async: false,
                    success: function (result) {
                        //console.log(result.code)
                        if (result.code == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
@@ -1428,6 +1458,113 @@
                layer.alert(sMsg, { icon: 5 });
            }
            //#region æ–‡ä»¶ä¸Šä¼ 
            function PicUpload() {
                //多图片上传
                //多文件列表示例
                var ProImgByList = $('#ProImgByList')
                    , uploadListIns = upload.render({
                        elem: '#testList'
                        , url: GetWEBURL() + "/Sb_EquipMaintainBill/UploadFile"
                        , accept: 'file'
                        , multiple: true
                        , auto: false
                        //, bindAction: '#testListAction' //按扭绑定
                        , data: { "HBillNo": $("#HBillNo").val(), "HRemark": $("#HRemark").val(), "HUserName": sessionStorage["HUserName"] }
                        , choose: function (obj) {
                            var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
                            //读取本地文件
                            obj.preview(function (index, file, result) {
                                var tr = $(['<tr id="upload-' + index + '">'
                                    , '<td>' + file.name + '</td>'
                                    , '<td>' + '<img onclick=\"previewImg(this)\" id="showImg" class="ImgClass" style="width: 150px; margin:10px;cursor:pointer;"src="' + result + '" alt="' + file.name + '">' + '</td>'
                                    , '<td>' + (file.size / 1014).toFixed(1) + 'kb</td>'
                                    , '<td>等待上传</td>'
                                    , '<td>'
                                    , '<button class="layui-btn layui-btn-xs demo-reload ">上传</button>'
                                    , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
                                    , '</td>'
                                    , '</tr>'].join(''));
                                //单个重传
                                tr.find('.demo-reload').on('click', function () {
                                    obj.upload(index, file);
                                    return false;
                                });
                                //删除
                                tr.find('.demo-delete').on('click', function () {
                                    delete files[index]; //删除对应的文件
                                    tr.remove();
                                    uploadListIns.config.elem.next()[0].value = ''; //清空 input file å€¼ï¼Œä»¥å…åˆ é™¤åŽå‡ºçŽ°åŒåæ–‡ä»¶ä¸å¯é€‰
                                });
                                ProImgByList.append(tr);
                            });
                        }
                        , done: function (res, index, upload) {
                            if (res.code == 1) { //上传成功
                                var tr = ProImgByList.find('tr#upload-' + index)
                                    , tds = tr.children();
                                tds.eq(3).html('<span style="color: #5FB878;">上传成功</span>');
                                tds.eq(4).html(''); //清空操作
                                return delete this.files[index]; //删除文件队列已经上传成功的文件
                            }
                            this.error(index, upload);
                        }
                        , error: function (index, upload) {
                            var tr = ProImgByList.find('tr#upload-' + index)
                                , tds = tr.children();
                            tds.eq(2).html('<span style="color: #FF5722;">上传失败[检查文件名及文件格式]</span>');
                            tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示上传
                        }
                    });
            }
            //#endregion
            //#region ç¼–辑时,获取已上传的文件列表
            function getFile() {
                var ProImgByList = $('#ProImgByList')
                $.ajax({
                    url: GetWEBURL() + '/Sb_EquipMaintainBill/Filelist',
                    type: "GET",
                    data: { "HBillNo": $("#HBillNo").val() },
                    success: function (data1) {
                        if (data1.count == 1) {
                            var index = 0;
                            for (var i = 0; i < data1.data.length; i++) {
                                var tr = $(['<tr id="upload-' + i + '">'
                                    , '<td style="display:none">' + data1.data[i].HItemID + '</td>'
                                    , '<td style="display:none">' + data1.data[i].HSourceBillNo + '</td>'
                                    , '<td>' + data1.data[i].HFileName + '</td>'
                                    , '<td>' + '<img onclick=\"previewImg(this)\" id="showImg' + i + '" class="ImgClass" style="width: 150px; margin:10px;cursor:pointer;"src="' + data1.data[i].HFilePath + '" alt="' + data1.data[i].HFileName + '">' + '</td>'
                                    , '<td>' + (data1.data[i].HFileSize / 1014).toFixed(1) + 'kb</td>'
                                    , '<td style="color: #5FB878;">上传成功</td>'
                                    , '<td style="display:none">' + data1.data[i].url + '</td>'
                                    , '<td>'
                                    , '<button class="layui-btn layui-btn-xs  demo-dowload" type="button" id="deltefile" onclick="javascript:dowload(this)"><i class="layui-icon layui-icon-download-circle layuiadmin-button-btn"></i>下载</button>'
                                    , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete" type="button" id="deltefile" onclick="javascript:toManager(this)"><i class="layui-icon layui-icon-delete layuiadmin-button-btn"></i>删除</button>'
                                    , '</td>'
                                    , '</tr>'].join(''));
                                $('#ProImgByList').append(tr);
                            }
                        } else {
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //#endregion
            //#endregion
        });
@@ -1461,6 +1598,71 @@
        function GetMaterValue(obj) {
            OptionData = obj;
        }
        function previewImg(obj) {
            var img = new Image();
            img.src = obj.src;
            var height = img.height * 1.2; //获取图片高度
            var width = img.width * 1.2; //获取图片宽度
            var imgHtml = "<img src='" + obj.src + "' width='100%' height='100%'/>";
            //弹出层
            layer.open({
                type: 1,
                shade: 0.8,
                offset: 'auto',
                area: ['80%', '80%'],
                shadeClose: true,
                scrollbar: false,
                title: "图片预览", //不显示标题
                content: imgHtml, //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
                cancel: function () {
                    //layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', { time: 5000, icon: 6 });
                }
            });
        }
        //#region ä¸‹è½½å·²ä¸Šä¼ çš„æ–‡ä»¶
        function dowload(r) {
            //得到当前所在行
            var rows = r.parentNode.parentNode.rowIndex;
            //得到所在行的第五列的内容:文件地址
            var url = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(6)").html();
            /*window.location.href = url;*/
            window.open(url)
        }
        //#endregion
        //#region åˆ é™¤å·²ä¸Šä¼ çš„æ–‡ä»¶
        function toManager(r) {
            //得到当前所在行
            var rows = r.parentNode.parentNode.rowIndex;
            //得到所在行的第一列的内容:主键ID
            var HItemID = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(0)").html();
            //得到所在行的第二列的内容:单据号
            var HSourceBillNo = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(1)").html();
            //得到所在行的第三列的内容:文件名称
            var HFileName = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(2)").html();
            layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                //删除已上传文件
                $.ajax({
                    url: GetWEBURL() + '/Sb_EquipMaintainBill/DeleteFilelist',
                    type: "GET",
                    data: { "HItemID": HItemID, "HSourceBillNo": HSourceBillNo, "HFileName": HFileName },
                    success: function (data1) {
                        if (data1.count == 1) {
                            layer.alert(data1.Message, { icon: 1 });
                            $("#ProImgByList tr").eq((rows - 1)).remove();
                        }
                        else {
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            })
        }
    </script>
</body>
</html>
WebTM/views/É豸¹ÜÀí/Sb_EquipMaintainBill_PDA.html
@@ -261,11 +261,34 @@
                                    </tbody>
                                </table>
                            </div>
                            <!--附件信息-->
                            <div class="layui-tab-item">
                                <div class="layui-form-item" style="padding-top: 10px;min-height:calc(50vh);">
                                    <div class="layui-upload">
                                        <button type="button" class="layui-btn" id="testList"><i class="layui-icon"></i>选择文件</button>
                                        <div class="layui-upload-list">
                                            <table class="layui-table">
                                                <thead>
                                                    <tr>
                                                        <th>文件名</th>
                                                        <th>大小</th>
                                                        <th>状态</th>
                                                        <th>操作</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="ProImgByList">
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <ul class="layui-tab-title">
                            <li class="layui-this">基本信息</li>
                            <li>明细信息</li>
                            <li>其他信息</li>
                            <li>附件信息</li>
                        </ul>
                    </div>
                    <!--隐藏字段-->
@@ -291,13 +314,14 @@
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
        }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , laydate = layui.laydate
                , upload = layui.upload
                , element = layui.element;
            var option = [];
@@ -341,6 +365,7 @@
                    //console.log(d.data);
                    $("#HInterID").val("0");
                    $("#HBillNo").val(d.data[0].HBillNo);
                    PicUpload(); //文件上传
                }
            });
@@ -815,6 +840,71 @@
                    }
                })
            }
            //文件上传
            function PicUpload() {
                //多图片上传
                //多文件列表示例
                var ProImgByList = $('#ProImgByList')
                    , uploadListIns = upload.render({
                        elem: '#testList'
                        , url: GetWEBURL() + "/Sb_EquipMaintainBill/UploadFile"
                        , accept: 'file'
                        , multiple: true
                        , auto: false
                        , acceptMime: 'image/*'
                        //, bindAction: '#testListAction' //按扭绑定
                        , data: { "HBillNo": $("#HBillNo").val(), "HRemark": $("#HRemark").val(), "HUserName": sessionStorage["HUserName"] }
                        , choose: function (obj) {
                            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 / 1014).toFixed(1) + 'kb</td>'
                                    , '<td>等待上传</td>'
                                    , '<td>'
                                    , '<button class="layui-btn layui-btn-xs demo-reload ">上传</button>'
                                    , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
                                    , '</td>'
                                    , '</tr>'].join(''));
                                //单个重传
                                tr.find('.demo-reload').on('click', function () {
                                    obj.upload(index, file);
                                    return false;
                                });
                                //删除
                                tr.find('.demo-delete').on('click', function () {
                                    delete files[index]; //删除对应的文件
                                    tr.remove();
                                    uploadListIns.config.elem.next()[0].value = ''; //清空 input file å€¼ï¼Œä»¥å…åˆ é™¤åŽå‡ºçŽ°åŒåæ–‡ä»¶ä¸å¯é€‰
                                });
                                ProImgByList.append(tr);
                            });
                        }
                        , done: function (res, index, upload) {
                            if (res.code == 1) { //上传成功
                                var tr = ProImgByList.find('tr#upload-' + index)
                                    , tds = tr.children();
                                tds.eq(2).html('<span style="color: #5FB878;">上传成功</span>');
                                tds.eq(3).html(''); //清空操作
                                //tds.eq(3).find('.demo-reload').addClass('layui-hide'); //隐藏上传
                                return delete this.files[index]; //删除文件队列已经上传成功的文件
                            }
                            this.error(index, upload);
                        }
                        , error: function (index, upload) {
                            var tr = ProImgByList.find('tr#upload-' + index)
                                , tds = tr.children();
                            tds.eq(2).html('<span style="color: #FF5722;">上传失败[检查文件名及文件格式]</span>');
                            tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示上传
                        }
                    });
            }
            //以上为layui模块
        });
    </script>