最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Layui表格行工具事件與數(shù)據(jù)回填方法

 更新時間:2019年09月13日 14:25:44   作者:張俊輝  
今天小編就為大家分享一篇Layui表格行工具事件與數(shù)據(jù)回填方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

使用Layui數(shù)據(jù)表格實(shí)現(xiàn)行工具事件與Layui表單彈框與數(shù)據(jù)回填具體步驟如下:

步驟一:布置行工具欄樣式與數(shù)據(jù)表格初始化,代碼如下:

<script type="text/html" id="barDemo2">
    <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="compile">編輯</a>
    <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="delete">刪除</a>
 </script>
var listEnquiryQuote;//詢價記錄表格
layui.use(['table','form','layer'], function () {
//詢價記錄表格初始化
      listEnquiryQuote = table.render({
        elem: '#EnquiryQuote'
       , method: 'post'
       , url: '/Purchase/AwaitQueryPrice/SelectEnquiry' //數(shù)據(jù)接口
       , id: 'idEnquiryQuote'
       , page: true //開啟分頁
       , cols: [[ //表頭
         { type: 'radio' }
        , { field: 'EnquiryID', title: '詢價ID', hide: true }
        , { field: 'SupplierName', title: '供應(yīng)商名稱', width: 180 }
        , { field: 'CompanyName', title: '公司英文名', width: 180 }
        , { field: 'SupplierID', title: '供應(yīng)商ID', hide: true }
        , { field: 'ProductName', title: '產(chǎn)品名稱', width: 90 }
        , { field: 'Model', title: '型號', width: 120 }
        , { field: 'Trademark', title: '原廠品牌', width: 90 }
        , { field: 'PrimaryNumber', title: '原廠料號', width: 90 }
        , { field: 'QualityName', title: '品質(zhì)', width: 60 }
        , { field: 'QualityID', title: '品質(zhì)ID', hide: true }
        , { field: 'UnitName', title: '單位', width: 60 }
        , { field: 'UnitID', title: '單位ID', hide: true }
        , { field: 'FPackaging', title: '封裝', width: 90 }
        , { field: 'BPackaging', title: '包裝', width: 60 }
        , { field: 'DateCodeS', title: '生產(chǎn)日期', width: 105 }
        , { field: 'Describe', title: '描述', width: 150 }
        , { field: 'DeliveryTime', title: '貨期', width: 60 }
        , { field: 'MinOrder', title: '最小訂購量', width: 105 }
        , { field: 'QuantityDemanded', title: '需求量', width: 80 }
        , { field: 'TaxPoint', title: '稅點(diǎn)', width: 60 }
        , { field: 'Quote', title: '報價', width: 70 }
        , { field: 'EnquiryDateS', title: '詢價日期', width: 105 }
        , { field: 'AdoptQuantity', title: '采納量', width: 80 }
        , { fixed: 'right', title: '操作', toolbar: '#barDemo2', width: 120 }
       ]]
        , limit: 10
        , response: {
          statusName: 'success' //規(guī)定數(shù)據(jù)狀態(tài)的字段名稱,默認(rèn):code
         , statusCode: true //規(guī)定成功的狀態(tài)碼,默認(rèn):0
         , countName: 'totalRows' //規(guī)定數(shù)據(jù)總數(shù)的字段名稱,默認(rèn):count
        }
        , request: {
          pageName: 'curPage' //頁碼的參數(shù)名稱,默認(rèn):page
         , limitName: 'pageSize'
        }
      });
});

效果圖如下:

步驟二:監(jiān)聽行點(diǎn)擊事件:

layui.use(['table','form','layer'], function () {
//監(jiān)聽詢價記錄行工具事件
      table.on('tool(EnquiryQuote)', function (obj) {
        var data = obj.data;
        //修改
        if (obj.event === 'compile') {
          if (data.AdoptQuantity == null || data.AdoptQuantity == 0) {
            //彈出修改詢價記錄模態(tài)框
            layer.open({
              type: 1,
              title: '修改詢價記錄',
              area: ['950px', '600px'],
              content: $('#UpdateEnquiry'), //這里content是一個DOM,注意:最好該元素要存放在body最外層,否則可能被其它的相對元素所影響
            });
          } else {
            layer.msg('已有采購單采納該詢價,不得編輯!', { icon: 0 });
          }
          //重置
          $("#reset4").click(function () {
            //數(shù)據(jù)回填
            form.val("UpdateEnquiry", data);
            form.val("UpdateEnquiry", {
              "DateCode": data.DateCodeS
            })
            if (data.SupplierID != null) {
              //給表單賦值
              form.val("UpdateEnquiry", {
                "State": "true"
              })
            } else {
              //給表單賦值
              form.val("UpdateEnquiry", {
                "State": ""
              })
            }
          });
          $("#reset4").click();
    } 
});

應(yīng)注意的表單必須有l(wèi)ayui-form類與lay-filter屬性,本文獻(xiàn)lay-filter屬性值為UpdateEnquiry,可自定義

把回填事件寫入重置按鈕點(diǎn)擊事件這樣設(shè)置的好處是在點(diǎn)擊重置是在點(diǎn)擊重置時可以重新回填數(shù)據(jù),可以給用戶選擇的空間,效果圖如下:

以上這篇Layui表格行工具事件與數(shù)據(jù)回填方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

公主岭市| 格尔木市| 平潭县| 张北县| 延吉市| 张北县| 霍城县| 荣昌县| 滕州市| 易门县| 伊春市| 临澧县| 麻栗坡县| 连云港市| 邻水| 桦川县| 卫辉市| 昭苏县| 文昌市| 西昌市| 绍兴县| 平遥县| 伊通| 邵武市| 萍乡市| 安义县| 淅川县| 南乐县| 丹江口市| 呼玛县| 顺平县| 湖南省| 揭东县| 眉山市| 梨树县| 湖北省| 体育| 三穗县| 龙江县| 永安市| 阳新县|