Showing
3 changed files
with
138 additions
and
0 deletions
application/admin/controller/Basicinfo.php
0 → 100644
| 1 | +<?php | ||
| 2 | +namespace app\admin\controller; | ||
| 3 | +use think\Db; | ||
| 4 | +use think\facade\Request; | ||
| 5 | +class Basicinfo extends Common | ||
| 6 | +{ | ||
| 7 | + /********************************打印机管理*******************************/ | ||
| 8 | + //打印机型号列表 | ||
| 9 | + public function Printer($sys_id=1){ | ||
| 10 | + if(Request::isAjax()) { | ||
| 11 | + $list= file_get_contents(UNDER_LINE.'App.Prints.QueryPrintsList'); | ||
| 12 | + $array = json_decode($list,TRUE); | ||
| 13 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'],'rel'=>1]; | ||
| 14 | + } | ||
| 15 | + $this->assign('title','打印机型号列表'); | ||
| 16 | + return $this->fetch(); | ||
| 17 | + } | ||
| 18 | + //打印机型号添加 | ||
| 19 | + public function printerAdd(){ | ||
| 20 | + if(Request::isAjax()){ | ||
| 21 | + $data = input('post.'); | ||
| 22 | + $list= file_get_contents(UNDER_LINE.'App.Prints.addPrintsInfo&name='.$data['modelname']); | ||
| 23 | + $array = json_decode($list,TRUE); | ||
| 24 | + //添加 | ||
| 25 | + if ($array['ret']==200) { | ||
| 26 | + return ['code'=>1,'msg'=>'添加成功!','url'=>url('Printer')]; | ||
| 27 | + } else { | ||
| 28 | + return ['code'=>0,'msg'=>$array['msg']]; | ||
| 29 | + } | ||
| 30 | + }else{ | ||
| 31 | + $this->assign('title','添加打印机型号'); | ||
| 32 | + $this->assign('info','null'); | ||
| 33 | + return view('printerForm'); | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + //打印机型号修改 | ||
| 37 | + public function printerEdit(){ | ||
| 38 | + if(request()->isPost()){ | ||
| 39 | + $data = input('post.'); | ||
| 40 | + $list= file_get_contents(UNDER_LINE.'App.Prints.editPrintsInfo&data='.json_encode($data)); | ||
| 41 | + $array = json_decode($list,TRUE); | ||
| 42 | + if($array['ret']==200){ | ||
| 43 | + return ['code'=>1,'msg'=>'修改成功!','url'=>url('Printer')]; | ||
| 44 | + }else{ | ||
| 45 | + return ['code'=>0,'msg'=>$array['msg']]; | ||
| 46 | + } | ||
| 47 | + }else{ | ||
| 48 | + //根据ID获取打印型号信息 | ||
| 49 | + $list= file_get_contents(UNDER_LINE.'App.Prints.queryPrintsFetch&id='.input('id')); | ||
| 50 | + $array = json_decode($list,TRUE); | ||
| 51 | + $array['data']['modelname'] = $array['data']['name']; | ||
| 52 | + $this->assign('info', json_encode($array['data'],true)); | ||
| 53 | + $this->assign('title','编辑打印机型号'); | ||
| 54 | + return view('printerForm'); | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | +} |
| 1 | +{include file="common/head"/} | ||
| 2 | +<div class="admin-main layui-anim layui-anim-upbit"> | ||
| 3 | + <fieldset class="layui-elem-field layui-field-title"> | ||
| 4 | + <legend>{$title}</legend> | ||
| 5 | + </fieldset> | ||
| 6 | + <blockquote class="layui-elem-quote"> | ||
| 7 | + <a href="{:url('printerAdd')}" class="layui-btn layui-btn-sm">添加型号</a> | ||
| 8 | + </blockquote> | ||
| 9 | + <table class="layui-table" id="list" lay-filter="list"></table> | ||
| 10 | +</div> | ||
| 11 | + | ||
| 12 | +{include file="common/foot"/} | ||
| 13 | +<script type="text/html" id="barDemo"> | ||
| 14 | + <a href="{:url('printerEdit')}?id={{d.id}}" class="layui-btn layui-btn-xs">{:lang('edit')}</a> | ||
| 15 | +</script> | ||
| 16 | +<script> | ||
| 17 | + layui.use(['table','form'], function() { | ||
| 18 | + var table = layui.table,form = layui.form,$ = layui.jquery; | ||
| 19 | + var tableIn = table.render({ | ||
| 20 | + elem: '#list', | ||
| 21 | + url: '{:url("Printer")}', | ||
| 22 | + method:'post', | ||
| 23 | + cols: [[ | ||
| 24 | + {field:'id', title: '编号', width:80,fixed: true} | ||
| 25 | + ,{field:'name', title: '型号名称', width:200} | ||
| 26 | + ,{field:'cdate', title: '日期', width:200} | ||
| 27 | + ,{width:80,title: '操作', toolbar: '#barDemo'} | ||
| 28 | + ]] | ||
| 29 | + }); | ||
| 30 | + }); | ||
| 31 | +</script> | ||
| 32 | +</body> | ||
| 33 | +</html> |
| 1 | +{include file="common/head"/} | ||
| 2 | +<div class="admin-main layui-anim layui-anim-upbit"> | ||
| 3 | + <fieldset class="layui-elem-field layui-field-title"> | ||
| 4 | + <legend>{$title}</legend> | ||
| 5 | + </fieldset> | ||
| 6 | + <form class="layui-form layui-form-pane" lay-filter="form"> | ||
| 7 | + <div class="layui-form-item"> | ||
| 8 | + <label class="layui-form-label">型号名称</label> | ||
| 9 | + <div class="layui-input-4"> | ||
| 10 | + <input type="text" name="modelname" lay-verify="required" placeholder="{:lang('pleaseEnter')}型号名称" class="layui-input"> | ||
| 11 | + <input type="hidden" name="id"> | ||
| 12 | + </div> | ||
| 13 | + <div class="layui-form-mid layui-word-aux"> | ||
| 14 | + 便于后期顺利打印,请认真填写。 | ||
| 15 | + </div> | ||
| 16 | + </div> | ||
| 17 | + | ||
| 18 | + <div class="layui-form-item"> | ||
| 19 | + <div class="layui-input-block"> | ||
| 20 | + <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button> | ||
| 21 | + <a href="{:url('Printer')}" class="layui-btn layui-btn-primary">{:lang('back')}</a> | ||
| 22 | + </div> | ||
| 23 | + </div> | ||
| 24 | + </form> | ||
| 25 | +</div> | ||
| 26 | +{include file="common/foot"/} | ||
| 27 | +<script> | ||
| 28 | + layui.use(['form', 'layer','upload'], function () { | ||
| 29 | + var form = layui.form, layer = layui.layer,$= layui.jquery,upload = layui.upload; | ||
| 30 | + var info = {$info|raw}; | ||
| 31 | + form.val("form", info); | ||
| 32 | + form.render(); | ||
| 33 | + form.on('submit(submit)', function (data) { | ||
| 34 | + loading =layer.load(1, {shade: [0.1,'#fff']}); | ||
| 35 | + $.post("", data.field, function (res) { | ||
| 36 | + layer.close(loading); | ||
| 37 | + if (res.code > 0) { | ||
| 38 | + layer.msg(res.msg, {time: 1800, icon: 1}, function () { | ||
| 39 | + location.href = res.url; | ||
| 40 | + }); | ||
| 41 | + } else { | ||
| 42 | + layer.msg(res.msg, {time: 1800, icon: 2}); | ||
| 43 | + } | ||
| 44 | + }); | ||
| 45 | + }); | ||
| 46 | + }); | ||
| 47 | +</script> |
-
Please register or login to post a comment