提交 f0073ec8 authored 作者: chengye's avatar chengye

抄表单上传支持多种格式

上级 9aac272c
......@@ -41,46 +41,6 @@ class Copy extends Base
parent::__construct($app);
}
// public function index(){
// //区域
// $regions = Region::field('id,region_name')->select()->toArray();
// //页码
// $pageNow = Request::get('pages');
// //抄表单列表
// $user = Session::get('user');
// $map = [];
// $identity = (new Staff)->getIdentity();
// if(!$user['is_admin'] && $identity != 5){
// if(config('admin.search_area') == 1){
// $staff = StaffModel::get($user['user_id']);
// //通过员工的部门id查询 员工所在部门以及下属部门的数据范围
// $dids = (new DepartmentModel)->getNodeIds($staff->d_id);
// $cpIds = CopyModel::field('copy.id')
// ->leftJoin(['staff'],'staff.id = copy.staff_id')
// ->where('staff.d_id','in',$dids)
// ->select()
// ->toArray();
// $copyArr = [];
// foreach ($cpIds as $copy){
// $copyArr[]= $copy['id'];
// }
// if($copyArr != '')
// $map[] = ['copy.id','in',$copyArr];
// }
// }
// $list = CopyModel::list($pageNow,'',$map);
// $page = $list->render();
// $this->assign('identity',$identity);
// $this->assign('regions',$regions);
// $this->assign('page',$page);
// $this->assign('data',$list);
// return $this->fetch();
// }
public function index(){
$map=[];
//权限检测
......
......@@ -31,7 +31,7 @@ class Upload extends Base
$info = $this->file->validate(['ext'=>'jpg,png,gif'])
->move($this->images_dir);
} else {
$info = $this->file->validate(['ext'=>'doc,docx,xls,xlsx,ppt,pdf'])
$info = $this->file->validate(['ext'=>'jpg,png,gif,doc,docx,xls,xlsx,zip,rar,pdf'])
->move($this->files_dir);
}
......
<?php
/**
* Created by PhpStorm.
* User: chouchou
* Date: 2020-2-23
* Time: 23:30
*/
namespace app\em\controller;
use app\admin\controller\Upload;
use app\em\model\Base;
class UploadFile extends Base
{
public function upPhoto(){
$file = Request::file('cp_photo');
$upload = new Upload($file,1);
$result = $upload->upload();
if($result){
return jsonSuc('照片上传成功',$result);
} else {
return jsonErr($result);
}
}
public function upFile(){
$file = Request::file('up_file');
$upload = new Upload($file,2);
$result = $upload->upload();
if($result){
return jsonSuc('上传文件成功',$result);
} else {
return jsonErr($result);
}
}
}
\ No newline at end of file
......@@ -238,8 +238,8 @@
//上传电表照片
var upPhoto = upload.render({
elem: '#up_photo' ,
url: '/up_photo',
field: 'cp_photo',
url: '/upFile',
field: 'up_file',
done: function (res) {
if(res.status == 1){
layMsg(res.message)
......@@ -256,8 +256,6 @@
}
}
});
});
</script>
......
......@@ -146,6 +146,8 @@ Route::get('useage/:useage_id','em/useage/detail');
Route::get('useage_add/:id','em/useage/create');
Route::post('useage_add','em/useage/store');
Route::post('useage_del','em/useage/del');
Route::post('upFile','em/UploadFile/upFile');
//账单
Route::get('invoice','em/invoice/index');
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论