国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

springboot里結(jié)合layui對表格數(shù)據(jù)的一些記錄

這篇具有很好參考價(jià)值的文章主要介紹了springboot里結(jié)合layui對表格數(shù)據(jù)的一些記錄。希望對大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

js代碼

var $ = layui.$, active = {
            reload: function(){
                //處理人的選擇
                var handler = $('#handler input[name="handler"]:checked ').val()//獲取選中的值
                var systemNo;
                var systemType;
                //判斷當(dāng)前是常用還是全部(全部的話,a標(biāo)簽的值為常用)
                if($("#changeSystem").text() == "全部"){
                    systemNo = tagIns2.selected;
                    systemType = 2;
                }else{
                    systemNo = tagIns1.selected;
                    systemType = 1;
                }
                //將頁面全部復(fù)選框選中的值拼接到一個(gè)數(shù)組中
                var arr_box = '';
                $('input[type=checkbox]:checked').each(function() {
                    arr_box = arr_box+','+ $(this).val()
                });
                var name = $('#username').val();//會話人
                //var systemNo = $('#systemNo option:selected').val();//系統(tǒng)別
                var factory = $('#factory option:selected').val();//廠別
                var priority = $('#priority option:selected').val();//優(yōu)先級
                var workNo = $('#workNo').val();//作業(yè)編號
                var applier = $('#applier').val();//申請人
                var content = $('#content').val();//標(biāo)題/描述
                var department = $('#department').val();//申請部門
                var createDate = $('#test1').val();//申請日期
                var status = $("#status").val();//狀態(tài)
                var system = "";
                if (systemNo.length > 0) {
                    for (var i = 0; i < systemNo.length; i++) {
                        if(system == ""){
                            system = systemNo[i].name;
                        }else{
                            system = system+","+systemNo[i].name;
                        }
                    }
                }else{
                    system = null;
                }
                var cols = $("#cols").val();
                var table_json = {
                    'id':"序號",
                    'title' : '主題',
                    'priority' : '優(yōu)先級',
                    'status' : '狀態(tài)',
                    'system' : '系統(tǒng)別',
                    'taskNo' : '作業(yè)編號',
                    'questionType' : '問題類型',
                    'applier' : '申請人工號',
                    'trueName' : '申請人姓名',
                    'createDateTime' : '申請時(shí)間',
                    'handler' : '處理人工號',
                    'handlerName' : '處理人姓名',
                    'handDateTime' : '上一次處理時(shí)間',
                    'updater' : '更新人工號',
                    'updaterName' : '更新人姓名',
                    'updaterDateTime' : '更新日期',
                    'planDate':'預(yù)計(jì)完成時(shí)間',
                    'updateDateTime':'結(jié)案時(shí)間',
                    'parentQuestionId':'問題對應(yīng)的父任務(wù)ID',
                    'childQuestionIds':'子任務(wù)ID列表'
                };
                //每次搜索就得清空table_col和重置array_col
                table_col = [];
                array_col = [{checkbox: true, fixed: true}, {title: '編輯', width: 80, toolbar: '#table_bar'}];
                for(var obj in table_json){
                    var values = cols.split(",");
                    for(var i in values){
                        if(table_json[obj] == values[i]){
                            table_col.push(obj);
                        }
                    }
                }
                for(var i in table_col) {
                    if (table_col[i] == "id") {
                        array_col.push({field: 'id', title: '序號', width: 60, sort: true, style: 'font-size: 12px;', sort: true}
                        );
                    }
                    if (table_col[i] == 'title') {
                        array_col.push({
                            field: 'title', title: '主題', sort: true, width: 250, style: 'font-size: 12px;text-align:left;',
                            templet: function (d) {
                                return '<div style="text-align: left">' + d.title + '</div>';
                            }
                        });
                    }
                    if (table_col[i] == 'priority') {
                        array_col.push({field: 'priority', title: '優(yōu)先級', sort: true,width: 80, style: 'font-size: 12px;'});
                    }
                    if (table_col[i] == 'status') {
                        array_col.push({
                            field: 'status', title: '狀態(tài)', sort: true,width: 160, style: 'font-size: 12px;', templet: function (e) {
                                if (e.status == "0") {
                                    return "未開始";
                                } else if (e.status == "1") {
                                    return "已提問";
                                } else if (e.status == "2") {
                                    return "已回復(fù)";
                                } else if (e.status == "4") {
                                    return "結(jié)案";
                                } else if (e.status == "5") {
                                    return "取消問題";
                                } else if (e.status == "9") {
                                    return "刪除";
                                }
                            }
                        });
                    }
                    if (table_col[i] == 'system') {
                        array_col.push({
                            field: 'system',
                            title: '系統(tǒng)別',
                            sort: true,
                            width: 90,
                            style: 'font-size: 12px;'
                    })
                        ;
                    }
                    if (table_col[i] == 'taskNo') {
                        array_col.push({
                            field: 'taskNo',
                            title: '作業(yè)編號',
                            sort: true,
                            width: 90,
                            style: 'font-size: 12px;'
                    })
                        ;
                    }
                    if (table_col[i] == 'questionType') {
                        array_col.push({
                            field: 'questionType',
                            title: '問題類型',
                            sort: true,
                            width: 90,
                            style: 'font-size: 12px;'
                    })
                        ;
                    }
                    if (table_col[i] == 'applier') {
                        array_col.push({
                            field: 'applier',
                            title: '申請人工號',
                            sort: true,
                            width: 90,
                            style: 'font-size: 12px;'
                    })
                        ;
                    }
                    if (table_col[i] == 'trueName') {
                        array_col.push({
                            field: 'trueName',
                            title: '申請人姓名',
                            sort: true,
                            width: 180,
                            style: 'font-size: 12px;'
                    })
                        ;
                    }
                    if (table_col[i] == 'createDateTime') {
                        array_col.push({
                            field: 'createDateTime',
                            title: '申請時(shí)間',
                            sort: true,
                            width: 100,
                            style: 'font-size: 12px;'
                    })
                        ;
                    }
                    if (table_col[i] == 'handler') {
                        array_col.push({
                            field: 'handler',
                            title: '處理人工號',
                            sort: true,
                            width: 90,
                            style: 'font-size: 12px;'
                    })
                        ;
                    }
                    if (table_col[i] == 'handlerName') {
                        array_col.push({
                            field: 'handlerName',
                            title: '處理人姓名',
                            sort: true,
                            width: 90,
                            style: 'font-size: 12px;'
                    })
                        ;
                    }
                    if (table_col[i] == 'handDateTime') {
                        array_col.push({
                            field: 'handDateTime',
                            title: '上一次處理時(shí)間',
                            sort: true,
                            width: 90,
                            style: 'font-size: 12px;'
                    })
                        ;
                    }
                    if (table_col[i] == 'updater') {
                        array_col.push({
                            field: 'updater',
                            title: '更新人工號',
                            sort: true,
                            width: 100,
                            style: 'font-size: 12px;'
                    })
                        ;
                    }
                    if (table_col[i] == 'updaterName') {
                        array_col.push({
                            field: 'updaterName',
                            title:'更新人姓名',
                            sort: true,
                            width: 100,
                            style: 'font-size: 12px;'
                    })
                    }
                    if (table_col[i] == 'updaterDateTime') {
                        array_col.push({
                            field: 'updaterDateTime',
                            title: '更新日期',
                            sort: true,
                            width: 120,
                            style: 'font-size: 12px;'
                    })
                        ;
                    }
                    if (table_col[i] == 'planDate') {
                        array_col.push({
                            field: 'planDate',
                            title: '預(yù)計(jì)完成時(shí)間',
                            sort: true,
                            width: 120,
                            style: 'font-size: 12px;'
                    })
                        ;
                    }
                    if (table_col[i] == 'updateDateTime') {
                        array_col.push({
                            field: 'updateDateTime',
                            title: '結(jié)案時(shí)間',
                            sort:true,
                            width: 120,
                            style: 'font-size: 12px;'
                    })
                        ;
                    }
                    if(table_col[i] == 'parentQuestionId') {
                        array_col.push({
                            field: 'parentQuestionId',
                            title: '問題對應(yīng)的父任務(wù)ID',
                            sort: true,
                            width: 120,
                            style: 'font-size: 12px;'
                        });
                    }
                    if(table_col[i] == 'childQuestionIds') {
                        array_col.push({
                            field: 'childQuestionIds',
                            title: '子任務(wù)ID列表',
                            sort: true,
                            width: 120,
                            style: 'font-size: 12px;'
                        });
                    }
                }
                var questionType = $("#questionType").val();
                table.reload('table', {
                    url: '/admin/receiveQuestion/list',
                    page:{
                        curr:1//重新從第一頁開始
                    },
                    cols:[array_col],
                    where: {
                        systemNo:system,
                        factory:factory,
                        priority:priority,
                        workNo:workNo,
                        applier:applier,
                        content:content,
                        department:department,
                        createDate:createDate,
                        name:name,
                        status:status,
                        arr:arr_box,
                        handler:handler,
                        systemType:systemType,
                        cols: cols,
                        questionType:questionType,
                    },
                    done:function(res, curr, count){
                        apitableFilterIns.reload();
                        console.log("table.reload的res:",res);
                        var arr = res.param_1;
                        var that = this.elem.next();
                        res.data.forEach(function (item, index) {
                            if(arr.indexOf(item.id)> -1){
                                var tr = that.find(".layui-table-box tbody tr[data-index='" + index + "']");
                                tr.css("color", "#FF2D2D");
                            }
                        });
                    }
                });
            },

解釋分析:

這段代碼主要實(shí)現(xiàn)了一個(gè)前端的數(shù)據(jù)表格展示功能,使用了 layui 的表格組件進(jìn)行渲染。以下是對代碼的解釋:

首先,定義了一個(gè)名為 active 的對象,其中包含了一個(gè)方法 reload,這個(gè)方法用于重新加載數(shù)據(jù)表格,并且根據(jù)用戶選擇的條件進(jìn)行數(shù)據(jù)篩選和顯示。

reload 方法內(nèi)部執(zhí)行了數(shù)據(jù)表格的重新加載操作,使用 table.reload 方法實(shí)現(xiàn)。table.reload 是 layui 表格組件提供的方法,用于重新加載數(shù)據(jù)表格,可以傳入?yún)?shù)來控制表格的數(shù)據(jù)來源、頁碼等。

在 reload 方法內(nèi)部,首先獲取用戶選擇的各種查詢條件,比如 handler、systemNo、factory 等等。

然后,通過遍歷 table_json 對象,根據(jù)用戶選擇的列信息 cols,構(gòu)造 array_col 數(shù)組,用于設(shè)置表格的列頭信息。

在遍歷 table_col 數(shù)組時(shí),根據(jù)每個(gè)元素的值,判斷當(dāng)前列是否為 “id”、“title”、“priority” 等,如果是,則添加相應(yīng)的列信息到 array_col 數(shù)組中。

完成 array_col 數(shù)組的構(gòu)造后,使用 table.reload 方法重新加載數(shù)據(jù)表格,并傳入相應(yīng)的參數(shù)。

table.reload 方法的 url 參數(shù)指定了數(shù)據(jù)的來源地址,即請求后端接口 /admin/receiveQuestion/list 來獲取數(shù)據(jù)。

cols 參數(shù)用于指定表格的列頭信息,即使用 array_col 數(shù)組構(gòu)造的表格列頭。

where 參數(shù)用于傳遞查詢條件給后端,在這里,將前端獲取到的各種查詢條件傳遞給了后端接口。

done 參數(shù)是一個(gè)回調(diào)函數(shù),在數(shù)據(jù)表格加載完畢后,會執(zhí)行這個(gè)回調(diào)函數(shù)。在這個(gè)函數(shù)內(nèi)部,對表格的數(shù)據(jù)進(jìn)行遍歷,并根據(jù)返回的 res 數(shù)據(jù)中的 param_1 數(shù)組中的數(shù)據(jù),對表格的每一行進(jìn)行顏色標(biāo)記。

總體來說,這段代碼實(shí)現(xiàn)了一個(gè)功能較為復(fù)雜的數(shù)據(jù)表格展示頁面,通過 layui 表格組件實(shí)現(xiàn)了表格的動態(tài)列和數(shù)據(jù)加載,根據(jù)用戶選擇的條件來過濾數(shù)據(jù),并在表格上做了一些樣式標(biāo)記,以提升用戶體驗(yàn)。文章來源地址http://www.zghlxwxcb.cn/news/detail-603085.html

到了這里,關(guān)于springboot里結(jié)合layui對表格數(shù)據(jù)的一些記錄的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 開發(fā)實(shí)例:Spring Boot、MyBatis和Layui打造增刪改查項(xiàng)目

    開發(fā)實(shí)例:Spring Boot、MyBatis和Layui打造增刪改查項(xiàng)目

    通過學(xué)習(xí)這個(gè)實(shí)例項(xiàng)目,我們將積累點(diǎn)滴技術(shù)知識和實(shí)踐經(jīng)驗(yàn),進(jìn)一步提升我們的開發(fā)能力。學(xué)習(xí)如何構(gòu)建增刪改查功能的完整應(yīng)用,從數(shù)據(jù)庫訪問到前端界面的開發(fā),涵蓋了全棧開發(fā)的方方面面。此外,我們還將學(xué)會處理常見的業(yè)務(wù)邏輯和數(shù)據(jù)操作,提高編碼質(zhì)量和效率。

    2024年02月06日
    瀏覽(43)
  • layui框架學(xué)習(xí)(40:數(shù)據(jù)表格_主要事件)

    layui框架學(xué)習(xí)(40:數(shù)據(jù)表格_主要事件)

    ??Layui數(shù)據(jù)表格模塊主要通過各類事件響應(yīng)工具欄操作、單元格編輯或點(diǎn)擊等交互操作,本文學(xué)習(xí)table數(shù)據(jù)表格模塊中的主要事件及處理方式。 ?? 頭部工具欄事件 。通過代碼“table.on(‘toolbar(test)’, function(obj))”獲取lay-filter屬性為test的數(shù)據(jù)表格的頭部工具欄事件,頭部

    2024年02月10日
    瀏覽(42)
  • 【react框架】結(jié)合antd做表單組件的一些心得記錄

    【react框架】結(jié)合antd做表單組件的一些心得記錄

    作為一個(gè)前端最常遇見的需求場景就是寫表單、寫表格。寫多了會逐漸的積累一些開發(fā)心得,此文章根據(jù)我使用vue和react的經(jīng)驗(yàn)記錄了一些東西,拋磚引玉的給大家看看。 舉例react項(xiàng)目,在做表單的很多時(shí)候,我都是從antd上把其中一個(gè)form組件例子復(fù)制下來,然后再看看提供了

    2024年02月07日
    瀏覽(50)
  • SpringBoot Thymeleaf企業(yè)級真實(shí)應(yīng)用:使用Flying Saucer結(jié)合iText5將HTML界面數(shù)據(jù)轉(zhuǎn)換為PDF輸出(四) 表格中斷問題

    SpringBoot Thymeleaf企業(yè)級真實(shí)應(yīng)用:使用Flying Saucer結(jié)合iText5將HTML界面數(shù)據(jù)轉(zhuǎn)換為PDF輸出(四) 表格中斷問題

    接上一篇 SpringBoot Thymeleaf企業(yè)級真實(shí)應(yīng)用:使用Flying Saucer結(jié)合iText5將HTML界面數(shù)據(jù)轉(zhuǎn)換為PDF輸出(三) 給pdf加水印、頁眉頁腳、頁眉logo 設(shè)置表格的css樣式

    2024年02月12日
    瀏覽(24)
  • IDEA+Spring Boot + MyBatis + Layui+Mysql垃圾回收管理系統(tǒng)源碼

    IDEA+Spring Boot + MyBatis + Layui+Mysql垃圾回收管理系統(tǒng)源碼

    本系統(tǒng)實(shí)現(xiàn)了垃圾回收管理系統(tǒng),管理端實(shí)現(xiàn)了管理員登錄、垃圾回收管理、添加需要回收的垃圾、垃圾去向管理、申請需要打包運(yùn)出的垃圾、系統(tǒng)公告管理、個(gè)人信息管理、修改密碼 JDK版本:1.8 Mysql:5.7 賬號:好貴啊 密碼:123456 點(diǎn)擊以下鏈接獲取源碼。 IDEA+Spring Boot + MyBati

    2024年02月13日
    瀏覽(19)
  • IDEA+Spring Boot+MyBatis+shiro+Layui+Mysql智能平臺管理系統(tǒng)

    IDEA+Spring Boot+MyBatis+shiro+Layui+Mysql智能平臺管理系統(tǒng)

    本系統(tǒng)實(shí)現(xiàn)了智能平臺管理系統(tǒng),pc端用戶可以登錄,注冊,發(fā)帖,留言,提交問卷,展示公告,查看文章,管理端實(shí)現(xiàn)了管理員登錄,管理員管理, 管理員管理,用戶管理 ,問卷管理,問卷結(jié)果管理 ,帖子分類管理 ,數(shù)據(jù)分析統(tǒng)計(jì) ,公告管理,帖子管理 ,友情鏈接管理

    2024年02月12日
    瀏覽(23)
  • 【Spring Boot】SpringBoot和數(shù)據(jù)庫交互: 使用Spring Data JPA

    在現(xiàn)代應(yīng)用程序的開發(fā)中,數(shù)據(jù)是核心部分。為了能夠持久化、檢索、更新和刪除數(shù)據(jù),應(yīng)用程序需要與數(shù)據(jù)庫進(jìn)行交互。 1.1 為什么需要數(shù)據(jù)庫交互 數(shù)據(jù)持久化 :當(dāng)你關(guān)閉應(yīng)用程序或者服務(wù)器時(shí),你仍希望數(shù)據(jù)能夠保存。數(shù)據(jù)庫提供了一個(gè)持久的存儲方案,使得數(shù)據(jù)在關(guān)閉

    2024年02月12日
    瀏覽(29)
  • 【Spring Boot】Spring Boot結(jié)合MyBatis簡單實(shí)現(xiàn)學(xué)生信息管理模塊

    環(huán)境準(zhǔn)備 JDK Spring Boot MyBatis 創(chuàng)建Spring Boot項(xiàng)目 使用Spring Initializr創(chuàng)建一個(gè)新的Spring Boot項(xiàng)目,并添加以下依賴: Spring Web MyBatis Framework MySQL Driver 數(shù)據(jù)庫設(shè)計(jì) 在MySQL數(shù)據(jù)庫中創(chuàng)建一個(gè)名為 studentdb 的數(shù)據(jù)庫,并創(chuàng)建一個(gè)名為 students 的表,表結(jié)構(gòu)如下:

    2024年02月11日
    瀏覽(93)
  • 使用多數(shù)據(jù)源dynamic-datasource-spring-boot-starter遇到的問題記錄

    使用多數(shù)據(jù)源dynamic-datasource-spring-boot-starter遇到的問題記錄

    記錄使用多數(shù)據(jù)源dynamic-datasource-spring-boot-starter遇到的問題: 1、工程啟動失敗 缺少clickhouse連接驅(qū)動,引入對應(yīng)的maven依賴 2、clickhouse的sql語句讀到了mysql數(shù)據(jù)庫 在工程的配置文件只配置了ck數(shù)據(jù)源配置的時(shí)候,@DS(“數(shù)據(jù)源名稱”)用在service接口上沒什么問題。 由于新的需求

    2024年02月15日
    瀏覽(28)
  • Spring Boot進(jìn)階(75):從容應(yīng)對HTTP請求——Spring Boot與OkHttp完美結(jié)合

    Spring Boot進(jìn)階(75):從容應(yīng)對HTTP請求——Spring Boot與OkHttp完美結(jié)合

    ????????在現(xiàn)代的Web應(yīng)用程序中,HTTP請求成為了構(gòu)建客戶端和服務(wù)器端之間通信的一個(gè)重要手段。Spring Boot是一個(gè)靈活的Web框架,它提供了與HTTP請求相關(guān)的許多特性和API。OkHttp是一個(gè)流行的HTTP客戶端庫,它提供了面向?qū)ο蟮腁PI,以便開發(fā)人員輕松地在其應(yīng)用中進(jìn)行HTTP請求

    2024年02月06日
    瀏覽(24)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包