123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>网站管理</title>
- <script src="../../js/min-loader-next.js"></script>
- </head>
- <body class="content">
- <div class="order-body">
- <div class="order-tiaojian back-gray">
- <div class="tiaojian-part1" id = "conditions">
- <div class="fl f12-gray4-op mt4">所选条件:</div>
- </div>
- <div class="tiaojian-part2 fr demoTable">
- <button class="layui-btn order-bnt1" data-type="reload" >搜索</button>
- <button class="layui-btn order-bnt2" data-type="reset">重置</button>
- <button class="layui-btn order-bnt2" id = "addMachine">新增机器</button>
- <a href="#" id="toggle" class="top">收起</a>
- </div>
- </div>
- <form class="layui-form" action="javascript:void(0)" id = "formName">
- <div class="order-select back-border" id="content">
- <div class="layui-inline">
- <label class="f12-gray4">时间:</label>
- <input readonly class="search-select" type="text" name="strDate" id ="strDate" value="" placeholder="请选择时间(区间)" />
- </div>
- <div class="layui-inline">
- <label class="f12-gray4">标题:</label>
- <input onchange = "changeSelectCon(1,this,'inp')" class="search-select" type="text" name="titleId" id ="titleId" value="" placeholder="请输入标题" />
- </div>
- <div class="layui-inline">
- <label class="f12-gray4">机台号:</label>
- <input onchange = "changeSelectCon(2,this,'qpp')" class="search-select" type="text" name="machineId" id ="machineId" value="" placeholder="请输入机台号" />
- </div>
- </div>
- </form>
- </div>
- <div class="shadow-content" style="margin:1.5rem;">
- <table id="newsManage" lay-filter="tableFilter"></table>
- </div>
- <!--操作功能-->
- <script type="text/html" id="barDemo">
- <a class="layui-btn layui-btn-xs" lay-event="equCode">二维码</a>
- <a class="layui-btn layui-btn-xs" lay-event="detail">查看货道</a>
- <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
- {{# if(d.songStatus == '00'){ }}
- <a class="layui-btn layui-btn-xs" lay-event="close">关闭音乐</a>
- {{# } }}
- {{# if(d.songStatus == '01'){ }}
- <a class="layui-btn layui-btn-xs" lay-event="open">开启音乐</a>
- {{# } }}
- </script>
- <script type="text/html" id="switchTwo">
- <div style="width:90px;height:70px">
- {{#
- if(!isEmpty(d.imgUrl)&& d.url != "null"){ }}
- <img src="{{ d.imgUrl}}">
- {{# } }}
- </div>
- </script>
- <script>
- //添加消息
- $(document).on('click','#addMachine', function(){
- openMainTabPage('201001-01', ' 新增机器', 'machineManage/addmachine.html', '', '201001', reload);
- });
- $("#toggle").click(function() {
- $(this).html($("#content").is(":hidden") ? "收起" + "<i class='iconfont up iconSelect_drop-down'/></i>" : "展开" +
- "<i class='iconfont up iconSelect_drop-down'/></i>");
- $("#content").slideToggle();
- });
- layui.use('laydate', function(){
- var laydate = layui.laydate;
- //日期范围
- laydate.render({
- elem: '#strDate'
- ,range: true
- ,format:'yyyyMMdd'
- ,done: function(value, date, endDate){
- changeSelectCon(0,"strDate",'date',value)
- }
- });
- })
- var table;
- layui.use('table', function(){
- table = layui.table;
- table.render({
- id : 'newsManage'
- ,elem: '#newsManage'
- ,limit:10
- ,url: '../MachineManageAction/queryEqumentInf' //数据接口
- ,method: 'post'
- ,where:{MINView:"JSON", token: 'sasasas'}
- ,page: true //开启分页
- ,cols: [[ //表头
- {type:'numbers', title: '序号',width:'5%', fixed: true, align: 'center'}
- ,{field: 'machineNo', title: '机台号', width:"15%", sort: true, fixed: 'left'}
- ,{field: 'name', title: '机器名称', width:"20%"}
- ,{field: 'stateDesc', title: '状态', width:"10%"}
- ,{field: 'payeeNo', title: '支付账号', width:"10%"}
- ,{field: 'equTypeDesc', title: '机器类型', width:"10%"}
- ,{field: 'createTime', title: '创建时间', width:"15%"}
- ,{field: 'operate', title: '操作', width: "15%", toolbar: '#barDemo',fixed: 'right'}
- ]]
- ,done: function(res, curr, count){
- //如果是异步请求数据方式,res即为你接口返回的信息。
- console.log(res);
- //得到当前页码
- console.log(curr);
- //得到数据总量
- console.log(count);
- }
- ,even: true //开启隔行背景
- });
- // 监听工具条(操作)
- table.on('tool(tableFilter)', function(obj){ //注:tool是工具条事件名,tableFilter是table原始容器的属性 lay-filter="对应的值"
- var data = obj.data; //获得当前行数据
- var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
- var tr = obj.tr; //获得当前行 tr 的DOM对象
- var id = data.id;
- if(layEvent == 'detail'){ //查看
- showDetail(data);
- } else if(layEvent == 'close'){ //关闭音乐
- layer.confirm('真的要关闭音乐吗', function(index){
- $.request({
- action : '../../MachineManageAction/closeSong',
- data : {
- id : id ,//机器名
- status :"01"
- },
- success : function(data) {
- //成功后刷新
- var btn=$(".layui-laypage-btn")[0];
- btn.click();
- layer.alert('操作成功!', {
- icon: 6,
- title: "提示"
- });
- },
- error : function(data) {
- layer.alert('操作失败!', {
- icon: 5,
- title: "提示"
- });
- }
- });
- });
- }else if(layEvent == 'open'){ //开音乐
- layer.confirm('真的要开启音乐吗', function(index){
- $.request({
- action : '../../MachineManageAction/closeSong',
- data : {
- id : id ,//机器名
- status :"00"
- },
- success : function(data) {
- //成功后刷新
- var btn=$(".layui-laypage-btn")[0];
- btn.click();
- layer.alert('操作成功!', {
- icon: 6,
- title: "提示"
- });
- },
- error : function(data) {
- layer.alert('操作失败!', {
- icon: 5,
- title: "提示"
- });
- }
- });
- });
- }else if(layEvent == 'edit'){ //编辑
- editDetail(data);
- }else if(layEvent =='equCode'){//二维码
- layui.sessionData("ROW_DATA", {key:"NOW_ROW", value:data});
- layer.open({
- type: 2,
- title: '查看二维码',
- shadeClose: true,
- shade: 0.6,
- area: ['50%', '80%'],
- content: 'erWm.html'
- });
- }
- });
- var $ = layui.$, active = {
- reload: function(){
- reload();
- }
- ,reset: function(){
- $('#formName')[0].reset();
- $("#conditions").html('<div class="fl f12-gray4-op mt4">所选条件:</div>');
- }
- };
- $('.layui-btn').on('click', function(){
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
- });
- function reload() {
- var strDate = $('#strDate').val();
- var titleId = $('#titleId').val();
- var machineId = $('#machineId').val();
- var paramId = '1';
- //执行重载
- table.reload('newsManage', {
- page: {
- curr: 1 //重新从第 1 页开始
- }
- ,where: {
- strDate : strDate,
- titleId : titleId,
- paramId : paramId,
- machineId : machineId
- }
- });
- }
- // function showDetail(data) {
- // var params = {};
- // params.columnNumber = 2; //每行显示两个字段
- // // 要显示的数据
- // params.fields = [
- // {field: 'id', title: 'ID'}
- // ,{field: 'title', title: '标题'}
- // ,{field: 'moduleDesc', title: '模块'}
- // ,{field: 'statusDesc', title: '状态'}
- // ,{field: 'createuser', title: '创建人'}
- // ,{field: 'createtime', title: '创建日期'}
- // ,{field: 'modifyuser', title: '修改人'}
- // ,{field: 'modifytime', title: '修改时间'}
- // ];
- // // 寄存当前数据
- // setNowRowData(data, params);
- // layer.open({
- // type: 2,
- // title: '消息详情',
- // shadeClose: true,
- // shade: 0.8,
- // //maxmin: true, //开启最大化最小化按钮
- // area: ['800px', '500px'],
- // content: '../../web/showDetail.html'
- // });
- // }
- function changeSelectCon(index, t, type, dateValue){
- if (type == "date") {
- if (isEmpty(dateValue)) {
- $("#search" + index).remove();
- } else {
- $("#search" + index).remove();
- if (isEmpty($("#search" + index).attr("name"))) {
- $("#conditions").append(getSelectConHtml(index, t, type,dateValue));
- }
- }
- } else if (type == 'inp') {
- if (isEmpty($(t).val())) {
- $("#search" + index).remove();
- } else {
- $("#search" + index).remove();
- if (isEmpty($("#search" + index).attr("name"))) {
- $("#conditions").append(getSelectConHtml(index, t, type));
- }
- }
- } else if (type == 'qpp') {
- if (isEmpty($(t).val())) {
- $("#search" + index).remove();
- } else {
- $("#search" + index).remove();
- if (isEmpty($("#search" + index).attr("name"))) {
- $("#conditions").append(getSelectConHtml(index, t, type));
- }
- }
- }else {
- if (isEmpty($(t).val())) {
- $("#search" + index).remove();
- } else {
- $("#search" + index).remove();
- if (isEmpty($("#search" + index).attr("name"))) {
- $(t).attr("id","subjects");
- $("#conditions").append(getSelectConHtml(index, t, type));
- }
- }
- }
- }
- var array = new Array('时间','标题','机台号');
- function getSelectConHtml(index, t, type,dateValue){
- var name;
- var value;
- if(type == "inp"){
- value = t.value.substr(0,5)+"..";
- }
- if (type == "date") {
- value = dateValue;
- }
- if (type == "qpp") {
- value = t.value.substr(0,5)+"..";
- }
- if(type == "sel"){
- value = $("#state").find("option:selected").text();
- }
- if (type == "date") {
- name = $("#"+t).attr("id");
- } else {
- name = $(t).attr("id");
- }
- var html = '<div class="fl xuanzhong-active" id = "search' + index + '" name = "' + name + '" onclick = "removeSearch(this)">' +
- '<div class="fl">' + array[index] + '</div>' +
- ':<i>'+value+'</i>' +
- '<svg class="icon" aria-hidden="true">' +
- '<use xlink:href="#iconicon_close1"></use>' +
- '</svg>' +
- '</div>';
- return html;
- }
- function removeSearch(t) {
- if ($(t).attr("name") == 'subjects') {
- initSelect('state', "ORDER_STT", "state", ' ', true);
- form.render();
- $(t).remove();
- } else {
- $("#"+$(t).attr("name")).val('');
- $(t).remove();
- }
- }
- //编辑
- function editDetail(data) {
- // 寄存当前数据
- layui.sessionData("ROW_DATA", {key:"NOW_ROW", value:data});
- openMainTabPage('201001-02', ' 编辑', 'machineManage/editmachine.html', '', '201001', reload);
- }
- //查看货道
- function showDetail(data) {
- // 寄存当前数据
- layui.sessionData("ROW_DATA", {key:"NOW_ROW", value:data});
- openMainTabPage('201001-03', ' 查看货道', 'machineManage/machineDetail.html', '', '201001', reload);
- }
- </script>
- </body>
- </html>
|