博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
lyui 列表 上传
阅读量:5769 次
发布时间:2019-06-18

本文共 18815 字,大约阅读时间需要 62 分钟。

1.js

layui.use(['table', 'element', 'laydate', 'layer','upload'], function () {        var table = layui.table, element = layui.element, form = layui.form, laydate = layui.laydate,            layer = layui.layer,upload=layui.upload;        element.init();                              Date.prototype.Format = function (fmt) {            var o = {                    "M+": this.getMonth() + 1, //月份                     "d+": this.getDate(), //日                     "H+": this.getHours(), //小时                     "m+": this.getMinutes(), //分                     "s+": this.getSeconds(), //秒                     "q+": Math.floor((this.getMonth() + 3) / 3), //季度                     "S": this.getMilliseconds() //毫秒                 };                if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));                for (var k in o)                if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));                return fmt;        }        //供方资料列表        table.render({            elem: '#js_purchasePlan_manage_list_table',            url: gContextPath + '/purchasePlan/purchasePlanListPage.htm',            cellMinWidth: 80,            loading: true,            page: true,            even: true,            method: 'POST',            limits: [10,20,30, 50, 100],            limit: 10, //每页默认显示的数量            done: function () {                layer.closeAll();                upload.render({                    elem: '.js_upload_file',                    url: gContextPath+"/uploadfile2.htm"                    ,multiple: false                    ,before:function(){                    }                    ,field: 'file'                    , accept: 'images'                    , data: {                        "index": 1                    },                    accept: 'file',                    //普通文件                    done: function (res) {                       console.log(res);                       var _rel = $(this.item).attr('rel')||"";                       var _rel_type = $(this.item).attr('rel_type')||"";                       var _fileId = res[0].data.fid;                       $.ajax({                           url  : gContextPath+"/purchasePlan/uptPlanSjTime.htm",                           type: "POST",                           data:{id:_rel,relType:_rel_type,fileId:_fileId},                           dataType: 'json',                           success: function (response) {                               var returnCode = response.returnCode;                               if ("1" == returnCode) {                                   layer.alert("上传成功",{offset: '100px'},function(){                                        $(".js_purchasePlan_manage_list_serach").click();                                   });                               } else {                                   layer.alert("上传失败:" + response.msg,{offset: '100px'});                                   return false;                               }                           },                           error: function (XMLHttpRequest, textStatus, errorThrown) {                               if (XMLHttpRequest.readyState == 0) {                                   layer.alert("上传失败",{offset: '100px'});                                   return false;                               }                           }                       });                                           },                    error: function () {                        layer.alert("上传失败",{offset: '100px'});                        return false;                    }                });            },            where:                {                plan_code:$('.js_purchasePlan_plan_code').val()||"",                tender_type:$('.js_purchasePlan_tender_type').val()||"",                purchase_type:$('.js_purchasePlan_purchase_type').val()||"",                plan_status:$('.js_purchasePlan_plan_status').val()||"",                isErr:$('.js_purchasePlan_isError').val()||"",                tender_category:$('#tender_category').val()||"",                tender_category2:$("#tender_category2").val()||""                }            ,            cols: [                [                    {field: 'tender_type', title:"选择", width: "100%", unresize: true,templet: function (row) {                        var $list = $($("#js_div_order_hide").html());                        var planCode = row.plan_code||"";                        var planName = row.plan_name||"";                        var tenderType = row.tender_type||"";                        var purchaseType = row.purchase_type||"";                        var chTime = row.ch_date||"";                        var fbTime = row.fb_date||"";                        var dbTime = row.db_date||"";                        var planStatus = row.plan_status||"";                        var qyTime = row.qy_date||"";                        var jcTime = row.jc_date||"";                        var updateTime = row.updatedat||"";                        var userName = row.user_name||"";                        var typeName = row.type_name||"";                        var name = row.name||"";                        var whetherRelease = row.whether_release;                        var id = row.id||"";                        $list.find(".js_table_plan_id").val(id);                        $list.find(".js_table_plan_id").attr("whether_release",whetherRelease);                        $list.find(".js_table_plan_id").attr("plan_status",planStatus);                        $list.find(".js_table_plan_detail").attr("rel",id);                        $list.find(".js_plan_status_follow").attr("rel",id);                        if(whetherRelease=='1'){                            $list.find(".js_table_whether_release").html("已发布");                        }else{                            $list.find(".js_table_whether_release").html("未发布");                        }                                                $list.find(".js_table_plan_type").html(getTenderType(tenderType));                        $list.find(".js_table_plan_code").html(planCode);                        $list.find(".js_table_plan_name").html(planName);                        $list.find(".js_table_plan_cg_way").html(returnPurchaseType(purchaseType));                        $list.find(".js_table_plan_ch_time").html(chTime);                        $list.find(".js_table_plan_fb_time").html(fbTime);                        $list.find(".js_table_plan_db_time").html(dbTime);                        $list.find(".js_table_plan_status").html(returnPlanStatus(planStatus));                        $list.find(".js_table_plan_qy_time").html(qyTime);                        $list.find(".js_table_plan_jc_time").html(jcTime);                        $list.find(".js_table_update_time").html(updateTime);                        $list.find(".js_table_update_by").html(userName);                        $list.find(".js_table_plan_type_name").html(typeName+"|"+name);                        var sjChtime =  row.sj_ch_time||"";                        var sjFbTime = row.sj_fb_time||"";                        var sjDbTime = row.sj_fb_time||"";                        var sjQyTime = row.sj_qy_time||"";                        var sjJcTime = row.sj_jc_time||"";                                                $list.find(".js_table_jc_upload").attr("rel",id);                        $list.find(".js_table_jc_upload").attr("rel_type","2");                        $list.find(".js_table_qy_upload").attr("rel",id);                        $list.find(".js_table_qy_upload").attr("rel_type","1");                                                if(sjQyTime!=""){                            $list.find(".js_table_qy_upload").html("已上传");                            $list.find(".js_table_qy_upload").removeClass("js_upload_file");                        }                                                if(sjJcTime!=""){                            $list.find(".js_table_jc_upload").html("已上传");                            $list.find(".js_table_jc_upload").removeClass("js_upload_file");                        }                        var nowTime = new Date().Format("yyyy-MM-dd HH:mm:ss");//当前时间                        var nowDate = new Date(nowTime);//当前时间                        var chDate = new Date(chTime);                        var fbDate = new Date(fbTime);                        var dbDate = new Date(dbTime);                        var qyDate = new Date(qyTime);                        var jcDate = new Date(jcTime);                        if(sjChtime==""){
//实际策划时间为空 $list.find('.js_table_ch_icon').html(""); if(chDate.getTime()>nowDate.getTime()){
//后 //未开始 $list.find('.js_table_ch_icon').addClass("js_table_wwc"); }else{
//前 //延期 $list.find('.js_table_ch_icon').addClass("js_table_yq"); } }else{
//判断系统时间 $list.find('.js_table_ch_icon').html("စ"); var sjChDate = new Date(sjChTime); if(sjChDate.getTime()>chDate.getTime()){
//后 //延期完成 $list.find('.js_table_ch_icon').addClass("js_table_yqwc"); }else{
//前 //正常 $list.find('.js_table_ch_icon').addClass("js_table_zcwc"); } } if(sjFbTime==""){ $list.find('.js_table_fb_icon').html(""); if(fbDate.getTime()>nowDate.getTime()){
//后 //未开始 $list.find('.js_table_fb_icon').addClass("js_table_wwc"); }else{
//前 //延期 $list.find('.js_table_fb_icon').addClass("js_table_yq"); } }else{ $list.find('.js_table_fb_icon').html("စ"); var sjFbDate = new Date(sjFbTime); if(sjFbDate.getTime()>fbDate.getTime()){
//后 //延期完成 $list.find('.js_table_fb_icon').addClass("js_table_yqwc"); }else{
//前 //正常 $list.find('.js_table_fb_icon').addClass("js_table_zcwc"); } } if(sjDbTime==""){ $list.find('.js_table_db_icon').html(""); if(dbDate.getTime()>nowDate.getTime()){
//后 //未开始 $list.find('.js_table_db_icon').addClass("js_table_wwc"); }else{
//前 //延期 $list.find('.js_table_db_icon').addClass("js_table_yq"); } }else{ $list.find('.js_table_db_icon').html("စ"); var sjDbDate = new Date(sjDbTime); if(sjDbDate.getTime()>dbDate.getTime()){
//后 //延期完成 $list.find('.js_table_db_icon').addClass("js_table_yqwc"); }else{
//前 //正常 $list.find('.js_table_db_icon').addClass("js_table_zcwc"); } } if(sjQyTime==""){ $list.find('.js_table_qy_icon').html(""); if(qyDate.getTime()>nowDate.getTime()){
//后 //未开始 $list.find('.js_table_qy_icon').addClass("js_table_wwc"); }else{
//前 //延期 $list.find('.js_table_qy_icon').addClass("js_table_yq"); } }else{ $list.find('.js_table_qy_icon').html("စ"); var sjQyDate = new Date(sjQyTime); if(sjQyDate.getTime()>qyDate.getTime()){
//后 //延期完成 $list.find('.js_table_qy_icon').addClass("js_table_yqwc"); }else{
//前 //正常 $list.find('.js_table_qy_icon').addClass("js_table_zcwc"); } } if(sjJcTime==""){ $list.find('.js_table_jc_icon').html(""); if(jcDate.getTime()>nowDate.getTime()){
//后 //未开始 $list.find('.js_table_jc_icon').addClass("js_table_wwc"); }else{
//前 //延期 $list.find('.js_table_jc_icon').addClass("js_table_yq"); } }else{ $list.find('.js_table_jc_icon').html("စ"); var sjJcDate = new Date(sjJcTime); if(sjJcDate.getTime()>jcDate.getTime()){
//后 //延期完成 $list.find('.js_table_jc_icon').addClass("js_table_yqwc"); }else{
//前 //正常 $list.find('.js_table_jc_icon').addClass("js_table_zcwc"); } } return $list[0].outerHTML; }} ]] }); //查询 $(".js_purchasePlan_manage_list_serach").click(function () { layer.load(0, {shade: [0.1, '#FFF']}); //0代表加载的风格,支持0-2 table.reload('js_purchasePlan_manage_list_table', { page: { curr: 1 //重新从第 1 页开始 }, where: { plan_code:$('.js_purchasePlan_plan_code').val()||"", tender_type:$('.js_purchasePlan_tender_type').val()||"", purchase_type:$('.js_purchasePlan_purchase_type').val()||"", plan_status:$('.js_purchasePlan_plan_status').val()||"", isErr:$('.js_purchasePlan_isError').val()||"", tender_category:$('#tender_category').val()||"", tender_category2:$("#tender_category2").val()||"" }, done: function () { layer.closeAll(); upload.render({ elem: '.js_upload_file', url: gContextPath+"/uploadfile2.htm" ,multiple: false ,before:function(){ } ,field: 'file' , accept: 'images' , data: { "index": 1 }, accept: 'file', //普通文件 done: function (res) { console.log(res); var _rel = $(this.item).attr('rel')||""; var _rel_type = $(this.item).attr('rel_type')||""; var _fileId = res[0].data.fid; $.ajax({ url : gContextPath+"/purchasePlan/uptPlanSjTime.htm", type: "POST", data:{id:_rel,relType:_rel_type,fileId:_fileId}, dataType: 'json', success: function (response) { var returnCode = response.returnCode; if ("1" == returnCode) { layer.alert("上传成功",{offset: '100px'},function(){ $(".js_purchasePlan_manage_list_serach").click(); }); } else { layer.alert("上传失败:" + response.msg,{offset: '100px'}); return false; } }, error: function (XMLHttpRequest, textStatus, errorThrown) { if (XMLHttpRequest.readyState == 0) { layer.alert("上传失败",{offset: '100px'}); return false; } } }); }, error: function () { layer.alert("上传失败",{offset: '100px'}); return false; } }); } }); });

2.页面

| 发布状态: 维护人: 维护时间 :
计划类型:
采购方式:
计划状态:

 

转载于:https://www.cnblogs.com/tangbang/p/10170229.html

你可能感兴趣的文章
C++概述
查看>>
卡特兰数
查看>>
006_mac osx 应用跨屏幕
查看>>
nginx中配置文件的讲解
查看>>
MindNode使用
查看>>
SQL Server 2016 Alwayson新增功能
查看>>
HTTP库Axios
查看>>
CentOS7下安装python-pip
查看>>
认知计算 Cognitive Computing
查看>>
左手坐标系和右手坐标系 ZZ
查看>>
陀螺仪主要性能指标
查看>>
Java 架构师眼中的 HTTP 协议
查看>>
Linux 目录结构和常用命令
查看>>
Linux内存管理之mmap详解 (可用于android底层内存调试)
查看>>
利润表(年末)未分配利润公式备份
查看>>
Android开发中ViewStub的应用方法
查看>>
gen already exists but is not a source folder. Convert to a source folder or rename it 的解决办法...
查看>>
HDOJ-2069Coin Change(母函数加强)
查看>>
遍历Map的四种方法
查看>>
Altium Designer 小记
查看>>