|
|
|
<?php
|
|
|
|
namespace app\admin\controller;
|
|
|
|
use think\Db;
|
|
|
|
use think\facade\Request;
|
|
|
|
class Basicinfo extends Common
|
|
|
|
{
|
|
|
|
/********************************打印机管理*******************************/
|
|
|
|
//打印机型号列表
|
|
|
|
public function Printer($sys_id=1){
|
|
|
|
if(Request::isAjax()) {
|
|
|
|
$list= file_get_contents(UNDER_LINE.'App.Prints.QueryPrintsList');
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'],'rel'=>1];
|
|
|
|
}
|
|
|
|
$this->assign('title','打印机型号列表');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
//打印机型号添加
|
|
|
|
public function printerAdd(){
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = input('post.');
|
|
|
|
$list= file_get_contents(UNDER_LINE.'App.Prints.addPrintsInfo&name='.$data['modelname']);
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
//添加
|
|
|
|
if ($array['ret']==200) {
|
|
|
|
return ['code'=>1,'msg'=>'添加成功!','url'=>url('Printer')];
|
|
|
|
} else {
|
|
|
|
return ['code'=>0,'msg'=>$array['msg']];
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$this->assign('title','添加打印机型号');
|
|
|
|
$this->assign('info','null');
|
|
|
|
return view('printerForm');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//打印机型号修改
|
|
|
|
public function printerEdit(){
|
|
|
|
if(request()->isPost()){
|
|
|
|
$data = input('post.');
|
|
|
|
$list= file_get_contents(UNDER_LINE.'App.Prints.editPrintsInfo&data='.json_encode($data));
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
if($array['ret']==200){
|
|
|
|
return ['code'=>1,'msg'=>'修改成功!','url'=>url('Printer')];
|
|
|
|
}else{
|
|
|
|
return ['code'=>0,'msg'=>$array['msg']];
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
//根据ID获取打印型号信息
|
|
|
|
$list= file_get_contents(UNDER_LINE.'App.Prints.queryPrintsFetch&id='.input('id'));
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
$array['data']['modelname'] = $array['data']['name'];
|
|
|
|
$this->assign('info', json_encode($array['data'],true));
|
|
|
|
$this->assign('title','编辑打印机型号');
|
|
|
|
return view('printerForm');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|