layui中对table中的数据进行判断(0、1)转换为提示信息


layui table 时间格式转换、根据数据转换为提示信息

    <script type="text/javascript">
         layui.use("table", function (table) {
         //展示已知数据
         t = table.render({
            cols: [[ //标题栏
                { field: 'NOA_NPCode', title: '产品', align: 'center', sort: true },
                { field: 'NOA_Count', title: '剩余次数', align: 'center', sort: true },
                { field: 'NOA_ExpireTime', title: '到期时间', align: 'center', sort: true, templet: '<div>{{ layui.util.toDateString(d.NOA_ExpireTime, "yyyy年MM月dd日") }}</div>'},
                { field: 'operate', title: '操作',width: 150, toolbar: '#barTable', align: 'center' }
            ]],
            elem:'#idforRenderElem',
            url: '@Url.Action("GetAccountList")',
            page: false,
            response: {
                statusName: 'Code',
                statusCode: 1,
                dataName: 'Data'
             },
             done: function (res, curr, count) {
                 $("[data-field='NOA_Count']").children().each(function () {
                     if ($(this).text() == '-1') {
                         $(this).text("不限次")
                     } 
                 });
             }
        });
        //监听工具条
        table.on('tool(layFilterTable)', function (obj) {
            if (obj.event === 'edit') {
                //页面层
                AddOrEdit(obj);
            }
        });
        });

        //点击刷新按钮
        $('#btnRefresh').click(function () {
            t.reload();
        });
    </script>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM