勾股2.0版本,重构了系统菜单功能模块、权限模块、新增审批流程、办公审批模块,其他功能模块的优化。

This commit is contained in:
hdm 2022-02-11 13:23:31 +08:00
parent b033d573fc
commit 3b685f1761
266 changed files with 26135 additions and 5718 deletions

112
README.md
View File

@ -1,6 +1,6 @@
# 勾股OA
[![勾股OA](https://img.shields.io/badge/GouguOA-1.1.6-brightgreen.svg)](https://gitee.com/gougucms/office/)
[![勾股OA](https://img.shields.io/badge/GouguOA-2.0.9-brightgreen.svg)](https://gitee.com/gougucms/office/)
[![star](https://gitee.com/gougucms/office/badge/star.svg?theme=dark)](https://gitee.com/gougucms/office/stargazers)
[![fork](https://gitee.com/gougucms/office/badge/fork.svg?theme=dark)](https://gitee.com/gougucms/office/members)
@ -50,13 +50,48 @@ PS为了给后面的人提供良好的演示体验体验以查看为主
www 系统部署目录(或者子目录)
├─app 应用目录
│ │
│ ├─home 前台模块目录
│ ├─api 公共api模块目录
│ │ ├─controller 控制器目录
│ │ ├─middleware 中间层目录
│ │ ├─model 模型目录
│ │ ├─validate 校验器目录
│ │ ├─view 视图模板目录
│ │ ├─common.php 模块函数文件
│ │
│ ├─article 知识模块目录
│ │ ├─controller 控制器目录
│ │ ├─middleware 中间层目录
│ │ ├─model 模型目录
│ │ ├─validate 校验器目录
│ │ ├─view 视图模板目录
│ │ ├─common.php 模块函数文件
│ │
│ ├─base 公共api模块目录
│ │ ├─view 视图模板目录
│ │ ├─BaseController.php 基础控制器
│ │
│ ├─business 商业智能模块目录
│ │ ├─controller 控制器目录
│ │ ├─middleware 中间层目录
│ │ ├─model 模型目录
│ │ ├─validate 校验器目录
│ │ ├─view 视图模板目录
│ │ ├─common.php 模块函数文件
│ │
│ ├─finance 财务模块目录
│ │ ├─controller 控制器目录
│ │ ├─middleware 中间层目录
│ │ ├─model 模型目录
│ │ ├─validate 校验器目录
│ │ ├─view 视图模板目录
│ │ ├─common.php 模块函数文件
│ │
│ ├─home 系统模块目录
│ │ ├─controller 控制器目录
│ │ ├─middleware 中间层目录
│ │ ├─model 模型目录
│ │ ├─validate 校验器目录
│ │ ├─view 视图模板目录
│ │ ├─common.php 模块函数文件
│ │
│ ├─install 安装模块目录(系统安装完后,建议删除)
@ -65,6 +100,38 @@ www 系统部署目录(或者子目录)
│ │ ├─validate 校验器目录
│ │ ├─view 视图模板目录
│ │
│ ├─message 消息模块目录
│ │ ├─controller 控制器目录
│ │ ├─middleware 中间层目录
│ │ ├─model 模型目录
│ │ ├─validate 校验器目录
│ │ ├─view 视图模板目录
│ │ ├─common.php 模块函数文件
│ │
│ ├─note 公告模块目录
│ │ ├─controller 控制器目录
│ │ ├─middleware 中间层目录
│ │ ├─model 模型目录
│ │ ├─validate 校验器目录
│ │ ├─view 视图模板目录
│ │ ├─common.php 模块函数文件
│ │
│ ├─oa 办公模块目录
│ │ ├─controller 控制器目录
│ │ ├─middleware 中间层目录
│ │ ├─model 模型目录
│ │ ├─validate 校验器目录
│ │ ├─view 视图模板目录
│ │ ├─common.php 模块函数文件
│ │
│ ├─user 用户模块目录
│ │ ├─controller 控制器目录
│ │ ├─middleware 中间层目录
│ │ ├─model 模型目录
│ │ ├─validate 校验器目录
│ │ ├─view 视图模板目录
│ │ ├─common.php 模块函数文件
│ │
├─config 配置文件目录
│ ├─app.php 系统主要配置文件
│ ├─database.php 数据库配置文件
@ -99,7 +166,7 @@ www 系统部署目录(或者子目录)
### 功能矩阵
系统后台集成了主流的通用功能登录验证、系统配置、操作日志管理、用户管理、用户权限、功能管理后台菜单管理、TAG关键字管理、文件上传、数据备份/还原、基础数据、人力资源、消息通知、企业公告、知识文章、日常办公、财务管理、商业智能、 API接口等。更多的个性化功能可以基于当前系统便捷做二次开发。
系统后台集成了主流的通用功能登录验证、系统配置、操作日志管理、用户管理、用户权限、功能管理后台菜单管理、TAG关键字管理、文件上传、数据备份/还原、基础数据、审批流程、员工管理、消息通知、企业公告、知识文章、办公审批、日常办公、财务管理、商业智能、 API接口等。更多的个性化功能可以基于当前系统便捷做二次开发。
具体功能如下:
@ -108,7 +175,7 @@ www 系统部署目录(或者子目录)
├─系统管理
│ ├─系统配置
│ ├─功能菜单
│ ├─功能模块
│ ├─功能节点
│ ├─权限角色
│ ├─操作日志
@ -117,13 +184,17 @@ www 系统部署目录(或者子目录)
│ ├─数据还原
├─基础数据
│ ├─审核人相关配置
│ ├─工作类型设置
│ ├─知识关键字设置
│ ├─报销类型设置
│ ├─发票主体设置
│ ├─审核类型
│ ├─审核流程
│ ├─报销类型
│ ├─费用类型
│ ├─印章类型
│ ├─车辆类型
│ ├─发票主体
│ ├─公告类型
│ ├─知识类型
├─人力资源
├─员工管理
│ ├─部门架构
│ ├─岗位职称
│ ├─企业员工
@ -137,7 +208,6 @@ www 系统部署目录(或者子目录)
│ ├─垃圾箱
├─企业公告
│ ├─公告类别
│ ├─公告列表
├─知识文章
@ -145,15 +215,26 @@ www 系统部署目录(或者子目录)
│ ├─共享知识
│ ├─个人知识
├─办公审批
│ ├─我发起的审批
│ ├─我负责的审批
├─日常办公
│ ├─工作计划
│ ├─计划日历
│ ├─工作记录
│ ├─日程日历
│ ├─日程安排
│ ├─工作日历
│ ├─工作记录
│ ├─工作汇报
├─财务管理
│ ├─报销管理
│ │ ├─我申请的报销
│ │ ├─我负责的报销
│ │
│ ├─发票管理
│ │ ├─我申请的发票
│ │ ├─我负责的发票
│ │
│ ├─到账管理
├─商业智能
@ -164,6 +245,9 @@ www 系统部署目录(或者子目录)
~~~
### 功能导图
![输入图片说明](https://oa.gougucms.com/storage/image/gouguoa2.0.png)
### 安装教程
一、勾股OA推荐你使用阿里云和腾讯云服务器。

View File

@ -12,7 +12,9 @@ namespace app\api;
use think\App;
use think\exception\HttpResponseException;
use think\facade\Request;
use think\facade\Session;
use think\Response;
use think\facade\View;
/**
* 控制器基础类
@ -58,6 +60,10 @@ abstract class BaseController
{
$this->app = $app;
$this->request = $this->app->request;
$this->module = strtolower(app('http')->getName());
$this->controller = strtolower($this->request->controller());
$this->action = strtolower($this->request->action());
$this->uid = 0;
// 控制器初始化
$this->initialize();
@ -66,10 +72,26 @@ abstract class BaseController
// 初始化
protected function initialize()
{
// 检测权限
$this->checkLogin();
//每页显示数据量
$this->pageSize = Request::param('page_size', \think\facade\Config::get('app.page_size'));
}
/**
*验证用户登录
*/
protected function checkLogin()
{
$session_admin = get_config('app.session_admin');
if (!Session::has($session_admin)) {
$this->apiError('请先登录');
}
else{
$this->uid = Session::get($session_admin)['id'];
View::assign('login_user', $this->uid);
}
}
/**
* Api处理成功结果返回方法
* @param $message

View File

@ -8,143 +8,421 @@ declare (strict_types = 1);
namespace app\api\controller;
use app\api\BaseController;
use app\api\middleware\Auth;
use app\api\service\JwtAuth;
use app\home\model\AdminLog;
use app\user\validate\AdminCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\Request;
use think\facade\Session;
class Index extends BaseController
{
/**
* 控制器中间件 [登录、注册 不需要鉴权]
* @var array
*/
protected $middleware = [
Auth::class => ['except' => ['index','login','reg'] ]
];
/**
* @api {post} /index/index API页面
* @apiDescription 返回首页信息
*/
public function index()
//上传文件
public function upload()
{
$list = Db::name('Article')->select();
$seo = get_system_config('web');
add_user_log('api', '首页');
$this->apiSuccess('请求成功',['list' => $list,'seo' => $seo]);
}
/**
* @api {post} /index/login 会员登录
* @apiDescription 系统登录接口,返回 token 用于操作需验证身份的接口
* @apiParam (请求参数:) {string} username 登录用户名
* @apiParam (请求参数:) {string} password 登录密码
* @apiParam (响应字段:) {string} token Token
* @apiSuccessExample {json} 成功示例
* {"code":0,"msg":"登录成功","time":1627374739,"data":{"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuZ291Z3VjbXMuY29tIiwiYXVkIjoiZ291Z3VjbXMiLCJpYXQiOjE2MjczNzQ3MzksImV4cCI6MTYyNzM3ODMzOSwidWlkIjoxfQ.gjYMtCIwKKY7AalFTlwB2ZVWULxiQpsGvrz5I5t2qTs"}}
* @apiErrorExample {json} 失败示例
* {"code":1,"msg":"帐号或密码错误","time":1627374820,"data":[]}
*/
public function login()
{
$param = get_params();
if(empty($param['username']) || empty($param['password'])){
$this->apiError('参数错误');
}
// 校验用户名密码
$user = Db::name('User')->where(['username' => $param['username']])->find();
if (empty($user)) {
$this->apiError('帐号或密码错误');
$param = get_params();
if (request()->file('file')) {
$file = request()->file('file');
} else {
return to_assign(1, '没有选择上传文件');
}
$param['pwd'] = set_password($param['password'], $user['salt']);
if ($param['pwd'] !== $user['password']) {
$this->apiError('帐号或密码错误');
}
if ($user['status'] == -1) {
$this->apiError('该用户禁止登录,请于平台联系');
}
$data = [
'last_login_time' => time(),
'last_login_ip' => request()->ip(),
'login_num' => $user['login_num'] + 1,
// dump($file);die;
// 获取上传文件的hash散列值
$sha1 = $file->hash('sha1');
$md5 = $file->hash('md5');
$rule = [
'image' => 'jpg,png,jpeg,gif',
'doc' => 'doc,docx,ppt,pptx,xls,xlsx,pdf',
'file' => 'zip,gz,7z,rar,tar',
];
$res = Db::name('user')->where(['id' => $user['id']])->update($data);
if($res){
//获取jwt的句柄
$jwtAuth = JwtAuth::getInstance();
$token = $jwtAuth->setUid($user['id'])->encode()->getToken();
add_user_log('api', '登录');
$this->apiSuccess('登录成功',['token' => $token]);
}
}
/**
* @api {post} /index/reg 会员注册
* @apiDescription 系统注册接口,返回是否成功的提示,需再次登录
* @apiParam (请求参数:) {string} username 用户名
* @apiParam (请求参数:) {string} password 密码
* @apiSuccessExample {json} 成功示例
* {"code":0,"msg":"注册成功","time":1627375117,"data":[]}
* @apiErrorExample {json} 失败示例
* {"code":1,"msg":"该账户已经存在","time":1627374899,"data":[]}
*/
public function reg()
{
$param = get_params();
if(empty($param['username']) || empty($param['pwd'])){
$this->apiError('参数错误');
}
$user = Db::name('user')->where(['username' => $param['username']])->find();
if (!empty($user)) {
$this->apiError('该账户已经存在');
$fileExt = $rule['image'] . ',' . $rule['doc'] . ',' . $rule['file'];
//1M=1024*1024=1048576字节
$fileSize = 2 * 1024 * 1024;
if (isset($param['type']) && $param['type']) {
$fileExt = $rule[$param['type']];
}
$param['salt'] = set_salt(20);
$param['password'] = set_password($param['pwd'], $param['salt']);
$param['register_time'] = time();
$param['headimgurl'] = '/static/home/images/icon.png';
$param['register_ip'] = request()->ip();
$char = mb_substr($param['username'], 0, 1, 'utf-8');
$uid = Db::name('User')->strict(false)->field(true)->insertGetId($param);
if($uid){
add_user_log('api', '注册');
$this->apiSuccess('注册成功');
}else{
$this->apiError('注册失败');
if (isset($param['size']) && $param['size']) {
$fileSize = $param['size'];
}
$validate = \think\facade\Validate::rule([
'image' => 'require|fileSize:' . $fileSize . '|fileExt:' . $fileExt,
]);
$file_check['image'] = $file;
if (!$validate->check($file_check)) {
return to_assign(1, $validate->getError());
}
// 日期前綴
$dataPath = date('Ym');
$use = 'thumb';
$filename = \think\facade\Filesystem::disk('public')->putFile($dataPath, $file, function () use ($md5) {
return $md5;
});
if ($filename) {
//写入到附件表
$data = [];
$path = get_config('filesystem.disks.public.url');
$data['filepath'] = $path . '/' . $filename;
$data['name'] = $file->getOriginalName();
$data['mimetype'] = $file->getOriginalMime();
$data['fileext'] = $file->extension();
$data['filesize'] = $file->getSize();
$data['filename'] = $filename;
$data['sha1'] = $sha1;
$data['md5'] = $md5;
$data['module'] = \think\facade\App::initialize()->http->getName();
$data['action'] = app('request')->action();
$data['uploadip'] = app('request')->ip();
$data['create_time'] = time();
$data['user_id'] = $this->uid;
if ($data['module'] = 'admin') {
//通过后台上传的文件直接审核通过
$data['status'] = 1;
$data['admin_id'] = $data['user_id'];
$data['audit_time'] = time();
}
$data['use'] = request()->has('use') ? request()->param('use') : $use; //附件用处
$res['id'] = Db::name('file')->insertGetId($data);
$res['filepath'] = $data['filepath'];
$res['name'] = $data['name'];
$res['filename'] = $data['filename'];
$res['filesize'] = $data['filesize'];
add_log('upload', $data['user_id'], $data);
return to_assign(0, '上传成功', $res);
} else {
return to_assign(1, '上传失败,请重试');
}
}
//清空缓存
public function cache_clear()
{
\think\facade\Cache::clear();
return to_assign(0, '系统缓存已清空');
}
//获取关键字
public function get_keyword_cate()
{
$keyword = Db::name('Keywords')->where(['status' => 1])->order('id desc')->select()->toArray();
return to_assign(0, '', $keyword);
}
// 测试邮件发送
public function email_test()
{
$sender = get_params('email');
//检查是否邮箱格式
if (!is_email($sender)) {
return to_assign(1, '测试邮箱码格式有误');
}
$email_config = \think\facade\Db::name('config')->where('name', 'email')->find();
$config = unserialize($email_config['content']);
$content = $config['template'];
//所有项目必须填写
if (empty($config['smtp']) || empty($config['smtp_port']) || empty($config['smtp_user']) || empty($config['smtp_pwd'])) {
return to_assign(1, '请完善邮件配置信息!');
}
$send = send_email($sender, '测试邮件', $content);
if ($send) {
return to_assign(0, '邮件发送成功!');
} else {
return to_assign(1, '邮件发送失败!');
}
}
//获取部门树形节点列表
public function get_department_tree()
{
$department = get_department();
$list = get_tree($department, 0, 2);
$data['trees'] = $list;
return json($data);
}
//获取部门树形节点列表2
public function get_department_select()
{
$keyword = get_params('keyword');
$selected = [];
if(!empty($keyword)){
$selected = explode(",",$keyword);
}
$department = get_department();
$list = get_select_tree($department, 0,0,$selected);
return to_assign(0, '',$list);
}
//获取子部门所有员工
public function get_employee($did = 0)
{
$did = get_params('did');
if($did == 1){
$department = $did;
}
else{
$department = get_department_son($did);
}
$employee = Db::name('admin')
->field('a.id,a.did,a.position_id,a.mobile,a.name,a.nickname,a.sex,a.status,a.thumb,a.username,d.title as department')
->alias('a')
->join('Department d', 'a.did = d.id')
->where(['a.status' => 1])
->where('a.id', ">", 1)
->where('a.did', "in", $department)
->select();
return to_assign(0, '', $employee);
}
//获取部门所有员工
public function get_employee_select()
{
$employee = Db::name('admin')
->field('id as value,name')
->where(['status' => 1])
->select();
return to_assign(0, '', $employee);
}
//获取角色列表
public function get_position()
{
$position = Db::name('Position')->field('id,title as name')->where([['status', '=', 1], ['id', '>', 1]])->select();
return to_assign(0, '', $position);
}
//首页公告
public function get_note_list()
{
$list = Db::name('Note')
->field('a.*,c.title as cate_title')
->alias('a')
->join('note_cate c', 'a.cate_id = c.id')
->where(['a.status' => 1])
->order('a.id desc')
->limit(10)
->select()->toArray();
foreach ($list as $key => $val) {
$list[$key]['create_time'] = date('Y-m-d :H:i', $val['create_time']);
}
$res['data'] = $list;
return table_assign(0, '', $res);
}
//首页文章
public function get_article_list()
{
$list = Db::name('Article')
->field('a.*,c.title as cate_title')
->alias('a')
->join('article_cate c', 'a.article_cate_id = c.id')
->where(['a.status' => 1])
->order('a.id desc')
->limit(10)
->select()->toArray();
foreach ($list as $key => $val) {
$list[$key]['create_time'] = date('Y-m-d :H:i', $val['create_time']);
}
$res['data'] = $list;
return table_assign(0, '', $res);
}
//修改个人信息
public function edit_personal()
{
if (request()->isAjax()) {
$param = get_params();
$uid = $this->uid;
Db::name('Admin')->where(['id' => $uid])->strict(false)->field(true)->update($param);
$session_admin = get_config('app.session_admin');
Session::set($session_admin, Db::name('admin')->find($uid));
return to_assign();
}
else{
return view('user@user/edit_personal', [
'admin' => get_admin($this->uid),
]);
}
}
/**
* @api {post} /index/demo 测试页面
* @apiDescription 返回文章列表信息
* @apiParam (请求参数:) {string} token Token
* @apiSuccessExample {json} 响应数据样例
* {"code":1,"msg":"","time":1563517637,"data":{"id":13,"email":"test110@qq.com","password":"e10adc3949ba59abbe56e057f20f883e","sex":1,"last_login_time":1563517503,"last_login_ip":"127.0.0.1","qq":"123455","mobile":"","mobile_validated":0,"email_validated":0,"type_id":1,"status":1,"create_ip":"127.0.0.1","update_time":1563507130,"create_time":1563503991,"type_name":"注册会员"}}
*/
public function demo()
//修改密码
public function edit_password()
{
$list = Db::name('Article')->select();
$jwtAuth = JwtAuth::getInstance();
$uid = $jwtAuth->getUid();
$userInfo = Db::name('User')->where(['id' => $uid])->find();
add_user_log('api', '测试页面');
$this->apiSuccess('请求成功',['list' => $list,'user' => $userInfo]);
if (request()->isAjax()) {
$param = get_params();
try {
validate(AdminCheck::class)->scene('editPwd')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$uid = $this->uid;
$admin = Db::name('Admin')->where(['id' => $uid])->find();
$old_psw = set_password($param['old_pwd'], $admin['salt']);
if ($admin['pwd'] != $old_psw) {
return to_assign(1, '旧密码错误');
}
$salt = set_salt(20);
$new_pwd = set_password($param['pwd'], $salt);
$data = [
'reg_pwd' => '',
'salt' => $salt,
'pwd' => $new_pwd,
'update_time' => time(),
];
Db::name('Admin')->where(['id' => $uid])->strict(false)->field(true)->update($data);
$session_admin = get_config('app.session_admin');
Session::set($session_admin, Db::name('admin')->find($uid));
return to_assign();
}
else{
return view('user@user/edit_password', [
'admin' => get_admin($this->uid),
]);
}
}
//系统操作日志
public function log_list()
{
if (request()->isAjax()) {
$param = get_params();
$log = new AdminLog();
$content = $log->get_log_list($param);
return table_assign(0, '', $content);
}else{
return view('home@log/log_list');
}
}
/**
* 获取用户id
* @return mixed
*/
protected function getUid()
//保存密码修改
public function password_submit()
{
$jwtAuth = JwtAuth::getInstance();
return $jwtAuth->getUid();
if (request()->isAjax()) {
$param = get_params();
try {
validate(AdminCheck::class)->scene('editpwd')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$admin = get_admin($this->uid);
if (set_password($param['old_pwd'], $admin['salt']) !== $admin['pwd']) {
return to_assign(1, '旧密码不正确!');
}
unset($param['username']);
$param['salt'] = set_salt(20);
$param['pwd'] = set_password($param['pwd'], $param['salt']);
Db::name('Admin')->where(['id' => $admin['id'],
])->strict(false)->field(true)->update($param);
$session_admin = get_config('app.session_admin');
Session::set($session_admin, Db::name('admin')->find($admin['id']));
return to_assign();
}
}
//获取审核类型
public function get_flow_cate($type=0)
{
$flows = Db::name('FlowType')->where(['type'=>$type,'status'=>1])->select()->toArray();
return to_assign(0, '', $flows);
}
//获取审核步骤人员
public function get_flow_users($id=0)
{
$flow = Db::name('Flow')->where(['id' => $id])->find();
$flowData = unserialize($flow['flow_list']);
foreach ($flowData as $key => &$val) {
$val['user_id_info'] = Db::name('Admin')->field('id,name,thumb')->where('id','in',$val['flow_uids'])->select()->toArray();
}
return to_assign(0, '', $flowData);
}
//获取审核流程节点
public function get_flow_nodes($id=0,$type=1)
{
$flows = Db::name('FlowStep')->where(['action_id'=>$id,'type'=>$type,'delete_time'=>0])->order('sort asc')->select()->toArray();
foreach ($flows as $key => &$val) {
$user_id_info = Db::name('Admin')->field('id,name,thumb')->where('id','in',$val['flow_uids'])->select()->toArray();
foreach ($user_id_info as $k => &$v) {
$v['check_time'] = 0;
$v['content'] = '';
$v['status'] = 0;
$checked = Db::name('FlowRecord')->where(['check_user_id' => $v['id'],'step_id' => $val['id']])->find();
if($checked){
$v['check_time'] = date('Y-m-d :H:i', $checked['check_time']);
$v['content'] = $checked['content'];
$v['status'] = $checked['status'];
}
}
$check_list = Db::name('FlowRecord')
->field('f.*,a.name,a.thumb')
->alias('f')
->join('Admin a', 'a.id = f.check_user_id', 'left')
->where(['f.step_id' => $val['id']])->select()->toArray();
foreach ($check_list as $kk => &$vv) {
$vv['check_time_str'] = date('Y-m-d :H:i', $vv['check_time']);
}
$val['user_id_info'] = $user_id_info;
$val['check_list'] = $check_list;
}
return to_assign(0, '', $flows);
}
//删除报销附件
public function del_expense_interfix()
{
$id = get_params("id");
$admin_id = Db::name('ExpenseInterfix')->where('id', $id)->value('admin_id');
if ($admin_id == $this->uid) {
if (Db::name('ExpenseInterfix')->where('id', $id)->delete() !== false) {
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
} else {
return to_assign(1, "您没权限删除该报销数据");
}
}
//删除消息附件
public function del_message_interfix()
{
$id = get_params("id");
$detail = Db::name('MessageFileInterfix')->where('id', $id)->find();
if ($detail['admin_id'] == $this->uid) {
if (Db::name('MessageFileInterfix')->where('id', $id)->delete() !== false) {
$data = Db::name('MessageFileInterfix')->where('mid', $detail['mid'])->column('file_id');
return to_assign(0, "删除成功",$data);
} else {
return to_assign(1, "删除失败");
}
} else {
return to_assign(1, "您没权限删除该消息附件");
}
}
//获取访问记录
public function get_view_data()
{
$param = get_params();
$first_time = time();
$second_time = $first_time - 86400;
$three_time = $first_time - 86400 * 365;
$begin_first = strtotime(date('Y-m-d', $first_time) . " 00:00:00");
$end_first = strtotime(date('Y-m-d', $first_time) . " 23:59:59");
$begin_second = strtotime(date('Y-m-d', $second_time) . " 00:00:00");
$end_second = strtotime(date('Y-m-d', $second_time) . " 23:59:59");
$begin_three = strtotime(date('Y-m-d', $three_time) . " 00:00:00");
$data_first = Db::name('AdminLog')->field('create_time')->whereBetween('create_time', "$begin_first,$end_first")->select();
$data_second = Db::name('AdminLog')->field('create_time')->whereBetween('create_time', "$begin_second,$end_second")->select();
$data_three = Db::name('AdminLog')->field('create_time')->whereBetween('create_time', "$begin_three,$end_first")->select();
return to_assign(0, '', ['data_first' => hour_document($data_first), 'data_second' => hour_document($data_second), 'data_three' => date_document($data_three)]);
}
}

18
app/article/common.php Normal file
View File

@ -0,0 +1,18 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
/**
======================
*模块数据获取公共文件
======================
*/
use think\facade\Db;
//读取知识分类列表
function article_cate()
{
$cate = Db::name('ArticleCate')->order('id desc')->select()->toArray();
return $cate;
}

View File

@ -7,99 +7,17 @@
declare (strict_types = 1);
namespace app\home\controller;
namespace app\article\controller;
use app\base\BaseController;
use app\home\model\Article as ArticleList;
use app\home\model\ArticleCate;
use app\home\validate\ArticleCateCheck;
use app\home\validate\ArticleCheck;
use app\article\model\Article as ArticleList;
use app\article\validate\ArticleCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Article extends BaseController
class Index extends BaseController
{
public function cate()
{
if (request()->isAjax()) {
$cate = Db::name('ArticleCate')->order('create_time asc')->select();
return to_assign(0, '', $cate);
} else {
return view();
}
}
//文章分类添加&编辑
public function cate_add()
{
$param = get_params();
if (request()->isAjax()) {
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(ArticleCateCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$note_array = get_article_son($param['id']);
if (in_array($param['pid'], $note_array)) {
return to_assign(1, '父级分类不能是该分类本身或其子分类');
} else {
$param['update_time'] = time();
$res = ArticleCate::strict(false)->field(true)->update($param);
if($res){
add_log('edit', $param['id'], $param);
return to_assign();
}
}
} else {
try {
validate(ArticleCateCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = ArticleCate::strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
} else {
$id = isset($param['id']) ? $param['id'] : 0;
$pid = isset($param['pid']) ? $param['pid'] : 0;
if ($id > 0) {
$detail = Db::name('ArticleCate')->where(['id' => $id])->find();
View::assign('detail', $detail);
}
View::assign('id', $id);
View::assign('pid', $pid);
return view();
}
}
//删除文章分类
public function cate_delete()
{
$id = get_params("id");
$cate_count = Db::name('ArticleCate')->where(["pid" => $id])->count();
if ($cate_count > 0) {
return to_assign(1, "该分类下还有子分类,无法删除");
}
$content_count = Db::name('Article')->where(["article_cate_id" => $id])->count();
if ($content_count > 0) {
return to_assign(1, "该分类下还有文章,无法删除");
}
if (Db::name('ArticleCate')->delete($id) !== false) {
add_log('delete', $id);
return to_assign(0, "删除分类成功");
} else {
return to_assign(1, "删除失败");
}
}
public function index()
{
if (request()->isAjax()) {
@ -113,7 +31,7 @@ class Article extends BaseController
}
$where[] = ['a.status', '>=', 0];
$where[] = ['a.is_share', '=', 1];
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = ArticleList::where($where)
->field('a.*,c.id as cate_id,a.id as id,c.title as cate_title,a.title as title,d.title as department,u.name as user')
->alias('a')
@ -141,7 +59,7 @@ class Article extends BaseController
}
$where[] = ['a.status', '>=', 0];
$where[] = ['a.uid', '=', $this->uid];
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = ArticleList::where($where)
->field('a.*,c.id as cate_id,a.id as id,c.title as cate_title,a.title as title')
->alias('a')

5
app/article/event.php Normal file
View File

@ -0,0 +1,5 @@
<?php
// 这是系统自动生成的event定义文件
return [
];

View File

@ -0,0 +1,14 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
// 这是系统自动生成的middleware定义文件
return [
//开启session中间件
//'think\middleware\SessionInit',
//验证勾股OA是否完成安装
\app\home\middleware\Install::class,
];

View File

@ -5,9 +5,10 @@
* @link https://www.gougucms.com
*/
namespace app\home\model;
namespace app\article\model;
use app\home\model\Keywords;
use think\facade\Db;
use think\Model;
class Article extends Model
@ -15,11 +16,11 @@ class Article extends Model
// 获取文章详情
public function detail($id)
{
$article = \think\facade\Db::name('Article')->where(['id' => $id])->find();
$article = Db::name('Article')->where(['id' => $id])->find();
if (empty($article)) {
return $this->error('文章不存在');
return $this->error('文章知识不存在');
}
$keywrod_array = \think\facade\Db::name('ArticleKeywords')
$keywrod_array = Db::name('ArticleKeywords')
->field('i.aid,i.keywords_id,k.title')
->alias('i')
->join('Keywords k', 'k.id = i.keywords_id', 'LEFT')
@ -29,8 +30,8 @@ class Article extends Model
$article['keyword_ids'] = implode(",", array_column($keywrod_array, 'keywords_id'));
$article['keyword_names'] = implode(',', array_column($keywrod_array, 'title'));
$article['user'] = \think\facade\Db::name('Admin')->where(['id' => $article['uid']])->value('name');
$article['department'] = \think\facade\Db::name('Department')->where(['id' => $article['did']])->value('title');
$article['user'] = Db::name('Admin')->where(['id' => $article['uid']])->value('name');
$article['department'] = Db::name('Department')->where(['id' => $article['did']])->value('title');
return $article;
}
@ -49,7 +50,7 @@ class Article extends Model
'create_time' => $time,
];
}
$res = \think\facade\Db::name('ArticleKeywords')->strict(false)->field(true)->insertAll($insert);
$res = Db::name('ArticleKeywords')->strict(false)->field(true)->insertAll($insert);
return $res;
}
}

View File

@ -5,7 +5,7 @@
* @link https://www.gougucms.com
*/
namespace app\home\validate;
namespace app\article\validate;
use think\Validate;

View File

@ -1,7 +1,7 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<form class="layui-form page-content">
<h3 class="h3-title">新增知识文章</h3>
<table class="layui-table">
<tr>
@ -12,7 +12,7 @@
<td>
<select name="article_cate_id" lay-verify="required" lay-reqText="请选择分类">
<option value="">请选择分类</option>
{volist name=":set_recursion(get_article_cate())" id="v"}
{volist name=":set_recursion(article_cate())" id="v"}
<option value="{$v.id}">{$v.title}</option>
{/volist}
</select>
@ -75,7 +75,7 @@
</td>
</tr>
</table>
<div class="layui-form-item">
<div style="padding: 10px 0">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
@ -93,7 +93,7 @@ function init(layui) {
, upload = layui.upload;
var tags = new tagspicker({
'url': "/home/api/get_keyword_cate",
'url': "/api/index/get_keyword_cate",
'target': 'keyword_name',
'tag_ids': 'keyword_id',
'tag_tags': 'keyword_name',
@ -104,7 +104,7 @@ function init(layui) {
//封面上传
var uploadInst = upload.render({
elem: '#test1'
, url: "/home/api/upload"
, url: "/api/index/upload"
, done: function (res) {
//如果上传失败
if (res.code == 1) {
@ -119,16 +119,16 @@ function init(layui) {
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/home/article/add",
url: "/article/index/add",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
parent.location.reload();
});
} else {
layer.msg(e.msg);
parent.tableIns.reload();
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
}
})
@ -138,7 +138,7 @@ function init(layui) {
}
</script>
{include file="common/layui" base="base" extend="['tagpicker']" callback="init" /}
{include file="common/ueditor" id="container" name="content" width="750" height="500" toolbar="[]" /}
{include file="../../base/view/common/layui" base="base" extend="['tagpicker']" callback="init" /}
{include file="../../base/view/common/ueditor" id="container" name="content" width="750" height="360" toolbar="[]" /}
{/block}
<!-- /脚本 -->

View File

@ -1,7 +1,7 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<form class="layui-form page-content">
<h3 class="h3-title">编辑知识文章</h3>
<table class="layui-table">
<tr>
@ -12,7 +12,7 @@
<td>
<select name="article_cate_id" lay-verify="required" lay-reqText="请选择分类">
<option value="">请选择分类</option>
{volist name=":set_recursion(get_article_cate())" id="v"}
{volist name=":set_recursion(article_cate())" id="v"}
<option value="{$v.id}" {eq name="$article.article_cate_id" value="$v.id" }selected{/eq}>{$v.title}</option>
{/volist}
</select>
@ -75,7 +75,7 @@
</td>
</tr>
</table>
<div class="layui-form-item">
<div style="padding: 10px 0">
<input type="hidden" name="id" value="{$article.id}">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
@ -105,7 +105,7 @@
//封面上传
var uploadInst = upload.render({
elem: '#test1',
url: "/home/api/upload",
url: "/api/index/upload",
done: function (res) {
//如果上传失败
if (res.code == 1) {
@ -120,16 +120,16 @@
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/home/article/add",
url: "/article/index/add",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
parent.location.reload();
});
} else {
layer.msg(e.msg);
parent.tableIns.reload();
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
}
})
@ -139,7 +139,7 @@
}
</script>
{include file="common/layui" base='base' extend="['tagpicker']" callback="init" /}
{include file="common/ueditor" id="container" name="content" width="750" height="500" toolbar="[]" /}
{include file="../../base/view/common/layui" base='base' extend="['tagpicker']" callback="init" /}
{include file="../../base/view/common/ueditor" id="container" name="content" width="750" height="360" toolbar="[]" /}
{/block}
<!-- /脚本 -->

View File

@ -1,4 +1,4 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
@ -6,7 +6,7 @@
<div class="layui-input-inline">
<select name="article_cate_id">
<option value="">请选择知识文章分类</option>
{volist name=":set_recursion(get_article_cate())" id="v"}
{volist name=":set_recursion(article_cate())" id="v"}
<option value="{$v.id}">{$v.title}</option>
{/volist}
</select>
@ -38,7 +38,7 @@
elem: '#test',
title: '文章列表',
toolbar: '#toolbarDemo',
url: "/home/article/index", //数据接口
url: "/article/index/index", //数据接口
page: true, //开启分页
limit: 20,
cols: [
@ -91,7 +91,7 @@
table.on('tool(test)', function(obj) {
var data = obj.data;
if(obj.event === 'view'){
rightpage.open('/home/article/view?id='+data.id);
rightpage.open('/article/index/view?id='+data.id,'900px');
return;
}
});
@ -111,6 +111,6 @@
});
}
</script>
{include file="common/layui" base="base" extend="['rightpage']" callback="init" /}
{include file="../../base/view/common/layui" base="base" extend="['rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,4 +1,4 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
@ -6,7 +6,7 @@
<div class="layui-input-inline">
<select name="article_cate_id">
<option value="">请选择知识文章分类</option>
{volist name=":set_recursion(get_article_cate())" id="v"}
{volist name=":set_recursion(article_cate())" id="v"}
<option value="{$v.id}">{$v.title}</option>
{/volist}
</select>
@ -39,17 +39,18 @@
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns = null;
function init(layui) {
var TAB = parent.layui.tab,
table = layui.table,
rightpage = layui.rightpage,
form = layui.form;
var tableIns = table.render({
tableIns = table.render({
elem: '#test',
title: '文章列表',
toolbar: '#toolbarDemo',
url: "/home/article/list", //数据接口
url: "/article/index/list", //数据接口
page: true, //开启分页
limit: 20,
cols: [
@ -103,7 +104,7 @@
//表头工具栏事件
table.on('toolbar(test)', function(obj){
if (obj.event === 'add') {
rightpage.open("/home/article/add");
rightpage.open("/article/index/add");
return;
}
});
@ -111,11 +112,11 @@
table.on('tool(test)', function(obj) {
var data = obj.data;
if(obj.event === 'view'){
rightpage.open('/home/article/view?id='+data.id);
rightpage.open('/article/index/view?id='+data.id,'900px');
return;
}
if(obj.event === 'edit'){
rightpage.open('/home/article/add?id='+data.id);
rightpage.open('/article/index/add?id='+data.id);
return;
}
if (obj.event === 'del') {
@ -124,7 +125,7 @@
title: '提示'
}, function(index) {
$.ajax({
url: "/home/article/delete",
url: "/article/index/delete",
data: {
id: data.id
},
@ -155,6 +156,6 @@
});
}
</script>
{include file="common/layui" base="base" extend="['rightpage']" callback="init" /}
{include file="../../base/view/common/layui" base="base" extend="['rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,4 +1,4 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
{block name="style"}
<link rel="stylesheet" href="{__STATIC__}/ueditor/third-party/SyntaxHighlighter/prism.css?v=1"/>
<script src="{__STATIC__}/ueditor/third-party/SyntaxHighlighter/prism.js?v=1"></script>
@ -19,7 +19,7 @@
<td colspan="3">{$detail.title}</td>
<td class="layui-td-gray">文章分类</td>
<td>
{volist name=":set_recursion(get_article_cate())" id="v"}
{volist name=":set_recursion(article_cate())" id="v"}
{eq name="$detail.article_cate_id" value="$v.id" }{$v.title}{/eq}
{/volist}
</td>
@ -79,6 +79,6 @@ function init(layui) {
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{include file="../../base/view/common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -91,7 +91,7 @@ abstract class BaseController
if ($this->controller !== 'index' && $this->controller !== 'api') {
$reg_pwd = Db::name('Admin')->where(['id' => $this->uid])->value('reg_pwd');
if($reg_pwd!==''){
redirect('/home/api/edit_password.html')->send();
redirect('/api/index/edit_password.html')->send();
exit;
}
if (!$this->checkAuth()) {

View File

@ -1,6 +1,6 @@
<script src="{__LAYUI__}/layui.js?v={:get_system_config('web','version')}"></script>
<script>
var base='{__JS__}/module/';
var base="{__LAYUI__}/plugin/";
{if condition=" '[base]'!=='base' "}
base=[base];
{/if}
@ -16,7 +16,7 @@
}
layui.config({
base: base,
version:'{:get_system_config('web','version')}'
version:"{:get_system_config('web','version')}"
}).extend(extend).use(extendArray, function(){
callback(layui);
});

View File

@ -4,12 +4,9 @@
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\home\model;
use think\Model;
class ExpenseCate extends Model
{
}
/**
======================
*模块数据获取公共文件
======================
*/
use think\facade\Db;

View File

@ -7,7 +7,7 @@
declare (strict_types = 1);
namespace app\home\controller;
namespace app\business\controller;
use app\base\BaseController;
use think\facade\Db;
@ -20,9 +20,4 @@ class Analysis extends BaseController
return View();
}
public function errorShow()
{
echo '错误';
}
}

5
app/business/event.php Normal file
View File

@ -0,0 +1,5 @@
<?php
// 这是系统自动生成的event定义文件
return [
];

View File

@ -0,0 +1,14 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
// 这是系统自动生成的middleware定义文件
return [
//开启session中间件
//'think\middleware\SessionInit',
//验证勾股OA是否完成安装
\app\home\middleware\Install::class,
];

View File

@ -1,4 +1,4 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
{block name="style"}
<style type="text/css">
@ -425,6 +425,6 @@ fieldset.layui-field-title {
};
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{include file="../../base/view/common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -7,6 +7,49 @@
// 应用公共文件,内置主要的数据处理方法
use think\facade\Config;
use think\facade\Request;
use think\facade\Cache;
use think\facade\Db;
//设置缓存
function set_cache($key, $value, $date = 86400)
{
Cache::set($key, $value, $date);
}
//读取缓存
function get_cache($key)
{
return Cache::get($key);
}
//清空缓存
function clear_cache($key)
{
Cache::clear($key);
}
//读取系统配置
function get_system_config($name, $key = '')
{
$config = [];
if (get_cache('system_config' . $name)) {
$config = get_cache('system_config' . $name);
} else {
$conf = Db::name('config')->where('name', $name)->find();
if ($conf['content']) {
$config = unserialize($conf['content']);
}
set_cache('system_config' . $name, $config);
}
if ($key == '') {
return $config;
} else {
if ($config[$key]) {
return $config[$key];
}
}
}
//读取文件配置
function get_config($key)
@ -67,6 +110,320 @@ function set_password($pwd, $salt)
{
return md5(md5($pwd . $salt) . $salt);
}
//获取指定管理员的信息
function get_admin($id)
{
$admin = Db::name('Admin')
->alias('a')
->field('a.*,d.title as department,p.title as position')
->leftJoin ('Department d ','d.id= a.did')
->leftJoin ('Position p ','p.id= a.position_id')
->where(['a.id' => $id])
->cache(true,60)
->find();
$admin['last_login_time'] = empty($admin['last_login_time']) ? '-' : date('Y-m-d H:i', $admin['last_login_time']);
return $admin;
}
//获取当前登录用户的信息
function get_login_admin($key = '')
{
$session_admin = get_config('app.session_admin');
if (\think\facade\Session::has($session_admin)) {
$gougu_admin = \think\facade\Session::get($session_admin);
$admin = get_admin($gougu_admin['id']);
if (!empty($key)) {
if (isset($admin[$key])) {
return $admin[$key];
} else {
return '';
}
} else {
return $admin;
}
} else {
return '';
}
}
/**
* 节点权限判断
* @return bool
*/
function check_auth($rule, $uid)
{
$auth_list = Cache::get('RulesSrc' . $uid);
if (!in_array($rule, $auth_list)) {
return false;
} else {
return true;
}
}
//读取部门列表
function get_department()
{
$department = Db::name('Department')->where(['status' => 1])->select()->toArray();
return $department;
}
//获取某部门的子部门id.$is_self时候包含自己
function get_department_son($did = 0, $is_self = 1)
{
$department = get_department();
$department_list = get_data_node($department, $did);
$department_array = array_column($department_list, 'id');
if ($is_self == 1) {
//包括自己在内
$department_array[] = $did;
}
return $department_array;
}
//读取员工所在部门的负责人
function get_department_leader($uid=0,$pid=0)
{
$did = get_admin($uid)['did'];
if($pid==0){
$leader = Db::name('Department')->where(['id' => $did])->value('leader_id');
}
else{
$pdid = Db::name('Department')->where(['id' => $did])->value('pid');
if($pdid == 0){
$leader = 0;
}
else{
$leader = Db::name('Department')->where(['id' => $pdid])->value('leader_id');
}
}
return $leader;
}
//读取职位
function get_position()
{
$position = Db::name('Position')->where(['status' => 1])->select()->toArray();
return $position;
}
//根据流程模块读取某部门某模块的审核流程
function get_flows($type=1,$department=0)
{
$map1 = [];
$map2 = [];
$map1[] = ['status', '=', 1];
$map1[] = ['flow_cate', '=', $type];
$map1[] = ['department_ids', '=', ''];
$map2[] = ['status', '=', 1];
$map2[] = ['flow_cate', '=', $type];
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$department}',department_ids)")];
$list = Db::name('Flow')
->field('id,name,check_type')
->whereOr([$map1,$map2])
->order('id desc')->select()->toArray();
return $list;
}
//根据流程所属模块读取某部门某模块的审核流程
function get_type_flows($module=6,$department=0)
{
$map1 = [];
$map2 = [];
$map1[] = ['status', '=', 1];
$map1[] = ['type', '=', $module];
$map1[] = ['department_ids', '=', ''];
$map2[] = ['status', '=', 1];
$map2[] = ['type', '=', $module];
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$department}',department_ids)")];
$list = Db::name('Flow')
->field('id,name,check_type')
->whereOr([$map1,$map2])
->order('id desc')->select()->toArray();
return $list;
}
/**
* 根据附件表的id返回url地址
* @param [type] $id [description]
*/
function get_file($id)
{
if ($id) {
$geturl = Db::name("file")->where(['id' => $id])->find();
if ($geturl['status'] == 1) {
//审核通过
//获取签名的URL
$url = $geturl['filepath'];
return $url;
} elseif ($geturl['status'] == 0) {
//待审核
return '/static/home/images/none_pic.jpg';
} else {
//不通过
return '/static/home/images/none_pic.jpg';
}
}
return false;
}
/**
* 员工操作日志
* @param string $type 操作类型 login add edit view delete
* @param int $param_id 操作类型
* @param array $param 提交的参数
*/
function add_log($type, $param_id = '', $param = [])
{
$action = '未知操作';
$type_action = get_config('log.type_action');
if($type_action[$type]){
$action = $type_action[$type];
}
if ($type == 'login') {
$login_admin = Db::name('Admin')->where(array('id' => $param_id))->find();
} else {
$session_admin = get_config('app.session_admin');
$login_admin = \think\facade\Session::get($session_admin);
}
$data = [];
$data['uid'] = $login_admin['id'];
$data['name'] = $login_admin['name'];
$data['type'] = $type;
$data['action'] = $action;
$data['param_id'] = $param_id;
$data['param'] = json_encode($param);
$data['module'] = strtolower(app('http')->getName());
$data['controller'] = strtolower(app('request')->controller());
$data['function'] = strtolower(app('request')->action());
$parameter = $data['module'] . '/' . $data['controller'] . '/' . $data['function'];
$rule_menu = Db::name('AdminRule')->where(array('src' => $parameter))->find();
if($rule_menu){
$data['title'] = $rule_menu['title'];
$data['subject'] = $rule_menu['name'];
}
else{
$data['title'] = '';
$data['subject'] ='系统';
}
$content = $login_admin['name'] . '在' . date('Y-m-d H:i:s') . $data['action'] . '了' . $data['subject'];
$data['content'] = $content;
$data['ip'] = app('request')->ip();
$data['create_time'] = time();
Db::name('AdminLog')->strict(false)->field(true)->insert($data);
}
/**
* 发送站内信
* @param $user_id 接收人user_id
* @param $data 操作内容
* @param $sysMessage 1为系统消息
* @param $template 消息模板
* @return
*/
function sendMessage($user_id, $template, $data=[])
{
$content = get_config('message.template')[$template]['template'];
foreach ($data as $key => $val) {
$content = str_replace('{' . $key . '}', $val, $content);
}
if(isSet($data['from_uid'])){
$content = str_replace('{from_user}', get_admin($data['from_uid'])['name'], $content);
}
$content = str_replace('{date}', date('Y-m-d'), $content);
if (!$user_id) return false;
if (!$content) return false;
if (!is_array($user_id)) {
$users[] = $user_id;
} else {
$users = $user_id;
}
$users = array_unique(array_filter($users));
//组合要发的消息
$send_data = [];
foreach ($users as $key => $value) {
$send_data[] = array(
'to_uid' => $value,//接收人
'action_id' => $data['action_id'],
'title' => $data['title'],
'content' => $content,
'template' => $template,
'module_name' => strtolower(app('http')->getName()),
'controller_name' => strtolower(app('request')->controller()),
'action_name' => strtolower(app('request')->action()),
'send_time' => time(),
'create_time' => time()
);
}
$res = Db::name('Message')->strict(false)->field(true)->insertAll($send_data);
return $res;
}
/**
* 邮件发送
* @param $to 接收人
* @param string $subject 邮件标题
* @param string $content 邮件内容(html模板渲染后的内容)
* @throws Exception
* @throws phpmailerException
*/
function send_email($to, $subject = '', $content = '')
{
$mail = new PHPMailer\PHPMailer\PHPMailer();
$email_config = Db::name('config')->where('name', 'email')->find();
$config = unserialize($email_config['content']);
$mail->CharSet = 'UTF-8'; //设定邮件编码默认ISO-8859-1如果发中文此项必须设置否则乱码
$mail->isSMTP();
$mail->SMTPDebug = 0;
//调试输出格式
//$mail->Debugoutput = 'html';
//smtp服务器
$mail->Host = $config['smtp'];
//端口 - likely to be 25, 465 or 587
$mail->Port = $config['smtp_port'];
if ($mail->Port == '465') {
$mail->SMTPSecure = 'ssl'; // 使用安全协议
}
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//发送邮箱
$mail->Username = $config['smtp_user'];
//密码
$mail->Password = $config['smtp_pwd'];
//Set who the message is to be sent from
$mail->setFrom($config['email'], $config['from']);
//回复地址
//$mail->addReplyTo('replyto@example.com', 'First Last');
//接收邮件方
if (is_array($to)) {
foreach ($to as $v) {
$mail->addAddress($v);
}
} else {
$mail->addAddress($to);
}
$mail->isHTML(true); // send as HTML
//标题
$mail->Subject = $subject;
//HTML内容转换
$mail->msgHTML($content);
$status = $mail->send();
if ($status) {
return true;
} else {
// echo "Mailer Error: ".$mail->ErrorInfo;// 输出错误信息
// die;
return false;
}
}
/**
* 截取文章摘要
* @return bool
@ -87,6 +444,17 @@ function get_desc_content($content, $count)
}
return $res;
}
/**
* PHP去除空格
* @param string $str 字符串
* @return string 字符串
*/
function trim_space($str=''){
$str = mb_ereg_replace('^( | )+', '', $str);
$str = mb_ereg_replace('( | )+$', '', $str);
return mb_ereg_replace('  ', "\n  ", $str);
}
/**
* PHP格式化字节大小
* @param number $size 字节数
@ -251,6 +619,29 @@ function get_tree($data, $pId ,$open=0,$deep=0)
return array_values($tree);
}
//递归返回树形菜单数据
function get_select_tree($data, $pId ,$deep=0, $selected=[])
{
$tree = [];
foreach($data as $k => $v)
{
$vv=[];
$vv['name']=$v['title'];
$vv['value']=$v['id'];
$vv['selected']='';
if(in_array($v['id'],$selected)){
$vv['selected'] = 'selected';
}
if($v['pid'] == $pId){
//父亲找到儿子
$deep++;
$vv['children'] = get_select_tree($data, $v['id'],$deep,$selected);
$tree[] = $vv;
}
}
return array_values($tree);
}
/**
* 根据id递归返回子数据
* @param $data 数据
@ -684,152 +1075,180 @@ function monthList($start, $end)
/**
* 等于(时间段)数据处理
*
* @param $data
* @param $type
* @return array
* @since 2021-06-11
* @author fanqi
*/
function advancedDate($data)
function advancedDate($type)
{
// 本年度
if ($data['value'][0] == 'year') {
if ($type == 'year') {
$arrTime = DataTime::year();
$data['value'][0] = date('Y-m-d 00:00:00', $arrTime[0]);
$data['value'][1] = date('Y-m-d 23:59:59', $arrTime[1]);
$start_time = date('Y-m-d 00:00:00', $arrTime[0]);
$end_time = date('Y-m-d 23:59:59', $arrTime[1]);
}
// 上一年度
if ($data['value'][0] == 'lastYear') {
$data['value'][0] = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '-1 year'));
$data['value'][1] = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '-1 year'));
if ($type == 'lastYear') {
$start_time = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '-1 year'));
$end_time = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '-1 year'));
}
// 下一年度
if ($data['value'][0] == 'nextYear') {
$data['value'][0] = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '+1 year'));
$data['value'][1] = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '+1 year'));
if ($type == 'nextYear') {
$start_time = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '+1 year'));
$end_time = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '+1 year'));
}
// 上半年
if ($data['value'][0] == 'firstHalfYear') {
$data['value'][0] = date('Y-01-01 00:00:00');
$data['value'][1] = date('Y-06-30 23:59:59');
if ($type == 'firstHalfYear') {
$start_time = date('Y-01-01 00:00:00');
$end_time = date('Y-06-30 23:59:59');
}
// 下半年
if ($data['value'][0] == 'nextHalfYear') {
$data['value'][0] = date('Y-07-01 00:00:00');
$data['value'][1] = date('Y-12-31 23:59:59');
if ($type == 'nextHalfYear') {
$start_time = date('Y-07-01 00:00:00');
$end_time = date('Y-12-31 23:59:59');
}
// 本季度
if ($data['value'][0] == 'quarter') {
if ($type == 'quarter') {
$season = ceil((date('n')) / 3);
$data['value'][0] = date('Y-m-d H:i:s', mktime(0, 0, 0, $season * 3 - 3 + 1, 1, date('Y')));
$data['value'][1] = date('Y-m-d H:i:s', mktime(23, 59, 59, $season * 3, date('t', mktime(0, 0, 0, $season * 3, 1, date("Y"))), date('Y')));
$start_time = date('Y-m-d H:i:s', mktime(0, 0, 0, $season * 3 - 3 + 1, 1, date('Y')));
$end_time = date('Y-m-d H:i:s', mktime(23, 59, 59, $season * 3, date('t', mktime(0, 0, 0, $season * 3, 1, date("Y"))), date('Y')));
}
// 上一季度
if ($data['value'][0] == 'lastQuarter') {
if ($type == 'lastQuarter') {
$season = ceil((date('n')) / 3) - 1;
$data['value'][0] = date('Y-m-d H:i:s', mktime(0, 0, 0, $season * 3 - 3 + 1, 1, date('Y')));
$data['value'][1] = date('Y-m-d H:i:s', mktime(23, 59, 59, $season * 3, date('t', mktime(0, 0, 0, $season * 3, 1, date("Y"))), date('Y')));
$start_time = date('Y-m-d H:i:s', mktime(0, 0, 0, $season * 3 - 3 + 1, 1, date('Y')));
$end_time = date('Y-m-d H:i:s', mktime(23, 59, 59, $season * 3, date('t', mktime(0, 0, 0, $season * 3, 1, date("Y"))), date('Y')));
}
// 下一季度
if ($data['value'][0] == 'nextQuarter') {
if ($type == 'nextQuarter') {
$season = ceil((date('n')) / 3);
$data['value'][0] = date('Y-m-d H:i:s', mktime(0, 0, 0, $season * 3 + 1, 1, date('Y')));
$data['value'][1] = date('Y-m-d H:i:s', mktime(23, 59, 59, $season * 3 + 3, date('t', mktime(0, 0, 0, $season * 3, 1, date("Y"))), date('Y')));
$start_time = date('Y-m-d H:i:s', mktime(0, 0, 0, $season * 3 + 1, 1, date('Y')));
$end_time = date('Y-m-d H:i:s', mktime(23, 59, 59, $season * 3 + 3, date('t', mktime(0, 0, 0, $season * 3, 1, date("Y"))), date('Y')));
}
// 本月
if ($data['value'][0] == 'month') {
$data['value'][0] = date('Y-m-01 00:00:00');
$data['value'][1] = date('Y-m-31 23:59:59');
if ($type == 'month') {
$start_time = date('Y-m-01 00:00:00');
$end_time = date('Y-m-31 23:59:59');
}
// 上月
if ($data['value'][0] == 'lastMonth') {
$data['value'][0] = date('Y-m-01 00:00:00', strtotime(date('Y-m-d') . '-1 month'));
$data['value'][1] = date('Y-m-31 23:59:59', strtotime(date('Y-m-d') . '-1 month'));
if ($type == 'lastMonth') {
$start_time = date('Y-m-01 00:00:00', strtotime(date('Y-m-d') . '-1 month'));
$end_time = date('Y-m-31 23:59:59', strtotime(date('Y-m-d') . '-1 month'));
}
// 下月
if ($data['value'][0] == 'nextMonth') {
$data['value'][0] = date('Y-m-01 00:00:00', strtotime(date('Y-m-d') . '+1 month'));
$data['value'][1] = date('Y-m-31 23:59:59', strtotime(date('Y-m-d') . '+1 month'));
if ($type == 'nextMonth') {
$start_time = date('Y-m-01 00:00:00', strtotime(date('Y-m-d') . '+1 month'));
$end_time = date('Y-m-31 23:59:59', strtotime(date('Y-m-d') . '+1 month'));
}
// 本周
if ($data['value'][0] == 'week') {
$data['value'][0] = date('Y-m-d 00:00:00', mktime(0, 0, 0, date('m'), date('d') - date('w') + 1, date('Y')));
$data['value'][1] = date('Y-m-d 23:59:59', mktime(23, 59, 59, date('m'), date('d') - date('w') + 7, date('Y')));
if ($type == 'week') {
$start_time = date('Y-m-d 00:00:00', mktime(0, 0, 0, date('m'), date('d') - date('w') + 1, date('Y')));
$end_time = date('Y-m-d 23:59:59', mktime(23, 59, 59, date('m'), date('d') - date('w') + 7, date('Y')));
}
// 上周
if ($data['value'][0] == 'lastWeek') {
if ($type == 'lastWeek') {
$date = date("Y-m-d");
$w = date("w", strtotime($date));
$d = $w ? $w - 1 : 6;
$start = date("Y-m-d", strtotime($date . " - " . $d . " days"));
$data['value'][0] = date('Y-m-d', strtotime($start . " - 7 days"));
$data['value'][1] = date('Y-m-d', strtotime($start . " - 1 days"));
$start_time = date('Y-m-d', strtotime($start . " - 7 days"));
$end_time = date('Y-m-d', strtotime($start . " - 1 days"));
}
// 下周
if ($data['value'][0] == 'nextWeek') {
if ($type == 'nextWeek') {
$date = date("Y-m-d");
$w = date("w", strtotime($date));
$d = $w ? $w - 1 : 6;
$start = date("Y-m-d", strtotime($date . " - " . $d . " days"));
$data['value'][0] = date('Y-m-d', strtotime($start . " + 7 days"));
$data['value'][1] = date('Y-m-d', strtotime($start . " + 13 days"));
$start_time = date('Y-m-d', strtotime($start . " + 7 days"));
$end_time = date('Y-m-d', strtotime($start . " + 13 days"));
}
// 今天
if ($data['value'][0] == 'today') {
$data['value'][0] = date('Y-m-d 00:00:00');
$data['value'][1] = date('Y-m-d 23:59:59');
if ($type == 'today') {
$start_time = date('Y-m-d 00:00:00');
$end_time = date('Y-m-d 23:59:59');
}
// 昨天
if ($data['value'][0] == 'yesterday') {
$data['value'][0] = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '-1 day'));
$data['value'][1] = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '-1 day'));
if ($type == 'yesterday') {
$start_time = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '-1 day'));
$end_time = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '-1 day'));
}
// 明天
if ($data['value'][0] == 'tomorrow') {
$data['value'][0] = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '+1 day'));
$data['value'][1] = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '+1 day'));
if ($type == 'tomorrow') {
$start_time = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '+1 day'));
$end_time = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '+1 day'));
}
// 过去3天
if ($type == 'previous3day') {
$start_time = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '-3 day'));
$end_time = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '-1 day'));
}
// 过去5天
if ($type == 'previous5day') {
$start_time = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '-5 day'));
$end_time = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '-1 day'));
}
// 过去7天
if ($data['value'][0] == 'previous7day') {
$data['value'][0] = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '-7 day'));
$data['value'][1] = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '-1 day'));
if ($type == 'previous7day') {
$start_time = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '-7 day'));
$end_time = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '-1 day'));
}
// 过去10天
if ($type == 'previous10day') {
$start_time = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '-10 day'));
$end_time = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '-1 day'));
}
// 过去30天
if ($data['value'][0] == 'previous30day') {
$data['value'][0] = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '-30 day'));
$data['value'][1] = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '-1 day'));
if ($type == 'previous30day') {
$start_time = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '-30 day'));
$end_time = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '-1 day'));
}
// 未来3天
if ($type == 'future3day') {
$start_time = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '+1 day'));
$end_time = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '+3 day'));
}
// 未来5天
if ($type == 'future5day') {
$start_time = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '+1 day'));
$end_time = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '+5 day'));
}
// 未来7天
if ($data['value'][0] == 'future7day') {
$data['value'][0] = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '+1 day'));
$data['value'][1] = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '+7 day'));
if ($type == 'future7day') {
$start_time = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '+1 day'));
$end_time = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '+7 day'));
}
// 未来10天
if ($type == 'future10day') {
$start_time = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '+1 day'));
$end_time = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '+10 day'));
}
// 未来30天
if ($data['value'][0] == 'future30day') {
$data['value'][0] = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '+1 day'));
$data['value'][1] = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '+30 day'));
if ($type == 'future30day') {
$start_time = date('Y-m-d 00:00:00', strtotime(date('Y-m-d') . '+1 day'));
$end_time = date('Y-m-d 23:59:59', strtotime(date('Y-m-d') . '+30 day'));
}
return $data;
return [$start_time,$end_time];
}
/**

24
app/finance/common.php Normal file
View File

@ -0,0 +1,24 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
/**
======================
*模块数据获取公共文件
======================
*/
//读取开票主体
function finance_invoice_subject()
{
$subject = Db::name('InvoiceSubject')->where(['status' => 1])->order('id desc')->select()->toArray();
return $subject;
}
//读取报销类型
function finance_expense_cate()
{
$cate = Db::name('ExpenseCate')->where(['status' => 1])->order('id desc')->select()->toArray();
return $cate;
}

View File

@ -0,0 +1,636 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\finance\controller;
use app\base\BaseController;
use app\finance\model\Expense as ExpenseList;
use app\finance\validate\ExpenseCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Expense extends BaseController
{
public function get_list($where = [], $param = [], $type='and')
{
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
if($type == 'or'){
$expense = ExpenseList::whereOr($where)
->order('id desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->income_month = empty($item->income_month) ? '-' : date('Y-m', $item->income_month);
$item->expense_time = empty($item->expense_time) ? '-' : date('Y-m-d', $item->expense_time);
$item->admin_name = Db::name('Admin')->where(['id' => $item->admin_id])->value('name');
$item->department = Db::name('Department')->where(['id' => $item->admin_id])->value('title');
$item->pay_name = Db::name('Admin')->where(['id' => $item->pay_admin_id])->value('name');
$item->pay_time = empty($item->pay_time) ? '-' : date('Y-m-d H:i', $item->pay_time);
$item->amount = Db::name('ExpenseInterfix')->where(['exid' => $item->id])->sum('amount');
$item['check_user'] = '-';
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('Admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_user'] = implode(',',$check_user);
}
});
}
else{
$expense = ExpenseList::where($where)
->order('id desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->income_month = empty($item->income_month) ? '-' : date('Y-m', $item->income_month);
$item->expense_time = empty($item->expense_time) ? '-' : date('Y-m-d', $item->expense_time);
$item->admin_name = Db::name('Admin')->where(['id' => $item->admin_id])->value('name');
$item->department = Db::name('Department')->where(['id' => $item->admin_id])->value('title');
$item->pay_name = Db::name('Admin')->where(['id' => $item->pay_admin_id])->value('name');
$item->pay_time = empty($item->pay_time) ? '-' : date('Y-m-d H:i', $item->pay_time);
$item->amount = Db::name('ExpenseInterfix')->where(['exid' => $item->id])->sum('amount');
$item['check_user'] = '-';
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('Admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_user'] = implode(',',$check_user);
}
});
}
return $expense;
}
public function detail($id = 0)
{
$expense = Db::name('Expense')->where(['id' => $id])->find();
if ($expense) {
$expense['income_month'] = empty($expense['income_month']) ? '-' : date('Y-m', $expense['income_month']);
$expense['expense_time'] = empty($expense['expense_time']) ? '-' : date('Y-m-d', $expense['expense_time']);
$expense['create_user'] = Db::name('Admin')->where(['id' => $expense['admin_id']])->value('name');
$expense['department'] = Db::name('Department')->where(['id' => $expense['did']])->value('title');
$expense['amount'] = Db::name('ExpenseInterfix')->where(['exid' => $expense['id']])->sum('amount');
$expense['pay_admin'] = Db::name('Admin')->where(['id' => $expense['pay_admin_id']])->value('name');
if ($expense['pay_time'] > 0) {
$expense['pay_time'] = date('Y-m-d H:i:s', $expense['pay_time']);
}
else{
$expense['pay_time'] = '-';
}
$expense['list'] = Db::name('ExpenseInterfix')
->field('a.*,c.title as cate_title')
->alias('a')
->join('ExpenseCate c', 'a.cate_id = c.id','LEFT')
->where(['a.exid' => $expense['id']])
->select();
}
return $expense;
}
public function index()
{
if (request()->isAjax()) {
$param = get_params();
$where = [];
//按时间检索
$start_time = !empty($param['start_time']) ? strtotime(urldecode($param['start_time'])) : 0;
$end_time = !empty($param['end_time']) ? strtotime(urldecode($param['end_time'])) : 0;
if ($start_time > 0 && $end_time > 0) {
$where[] = ['expense_time', 'between', [$start_time, $end_time]];
}
$where[] = ['admin_id','=',$this->uid];
if (!empty($param['check_status']) && $param['check_status']!='') {
$where[] = ['check_status', '=', $param['check_status']];
}
$expense = $this->get_list($where, $param);
return table_assign(0, '', $expense);
} else {
return view();
}
}
//待审批的报销
public function list()
{
if (request()->isAjax()) {
$param = get_params();
$status = isset($param['status'])?$param['status']:0;
$user_id = $this->uid;
//查询条件
$map1 = [];
$map2 = [];
$map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',check_admin_ids)")];
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',flow_admin_ids)")];
if($status == 0){
$list = $this->get_list([$map1,$map2],$param,'or');
}
if($status == 1){
$list = $this->get_list($map1,$param);
}
if($status == 2){
$list = $this->get_list($map2,$param);
}
return table_assign(0, '', $list);
} else {
return view();
}
}
//报销打款
public function checkedlist()
{
if (request()->isAjax()) {
$param = get_params();
$where = [];
if (!empty($param['check_status'])) {
$where[] = ['check_status','=',$param['check_status']];
}
else{
$where[] = ['check_status','in',[2,5]];
}
//按时间检索
$start_time = !empty($param['start_time']) ? strtotime(urldecode($param['start_time'])) : 0;
$end_time = !empty($param['end_time']) ? strtotime(urldecode($param['end_time'])) : 0;
if ($start_time > 0 && $end_time > 0) {
$where[] = ['expense_time', 'between', [$start_time, $end_time]];
}
$list = $this->get_list($where,$param);
return table_assign(0, '', $list);
} else {
return view();
}
}
//添加
public function add()
{
$param = get_params();
if (request()->isAjax()) {
$dbRes = false;
$admin_id = $this->uid;
$param['income_month'] = isset($param['income_month']) ? strtotime(urldecode($param['income_month'])) : 0;
$param['expense_time'] = isset($param['expense_time']) ? strtotime(urldecode($param['expense_time'])) : 0;
$param['check_status'] = 1;
$flow_list = Db::name('Flow')->where('id',$param['flow_id'])->value('flow_list');
$flow = unserialize($flow_list);
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(ExpenseCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['update_time'] = time();
Db::startTrans();
try {
//删除原来的审核流程和审核记录
Db::name('FlowStep')->where(['action_id'=>$param['id'],'type'=>2,'delete_time'=>0])->update(['delete_time'=>time()]);
Db::name('FlowRecord')->where(['action_id'=>$param['id'],'type'=>2,'delete_time'=>0])->update(['delete_time'=>time()]);
if (!isset($param['check_admin_ids'])) {
if($flow[0]['flow_type'] == 1){
//部门负责人
$leader = get_department_leader($this->uid);
if($leader == 0){
return to_assign(1,'审批流程设置有问题当前部门负责人还未设置请联系HR或者管理员');
}
else{
$param['check_admin_ids'] = $leader;
}
}
else if($flow[0]['flow_type'] == 2){
//上级部门负责人
$leader = get_department_leader($this->uid,1);
if($leader == 0){
return to_assign(1,'审批流程设置有问题上级部门负责人还未设置请联系HR或者管理员');
}
else{
$param['check_admin_ids'] = $leader;
}
}
else{
$param['check_admin_ids'] = $flow[0]['flow_uids'];
}
foreach ($flow as $key => &$value){
$value['action_id'] = $param['id'];
$value['sort'] = $key;
$value['type'] = 2;
$value['create_time'] = time();
}
//增加审核流程
Db::name('FlowStep')->strict(false)->field(true)->insertAll($flow);
}
else{
$flow_step = array(
'action_id' => $param['id'],
'type' => 2,
'flow_uids' => $param['check_admin_ids'],
'create_time' => time()
);
//增加审核流程
Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
}
$res = ExpenseList::where('id', $param['id'])->strict(false)->field(true)->update($param);
if ($res !== false) {
$exid = $param['id'];
//相关内容多个数组;
$amountData = isset($param['amount']) ? $param['amount'] : '';
$remarksData = isset($param['remarks']) ? $param['remarks'] : '';
$cateData = isset($param['cate_id']) ? $param['cate_id'] : '';
$idData = isset($param['expense_id']) ? $param['expense_id'] : 0;
if ($amountData) {
foreach ($amountData as $key => $value) {
if (!$value) {
continue;
}
$data = [];
$data['id'] = $idData[$key];
$data['exid'] = $exid;
$data['admin_id'] = $admin_id;
$data['amount'] = $amountData[$key];
$data['cate_id'] = $cateData[$key];
$data['remarks'] = $remarksData[$key];
if ($data['amount'] == 0) {
Db::rollback();
return to_assign(1, '第' . ($key + 1) . '条报销金额不能为零');
}
if ($data['id'] > 0) {
$data['update_time'] = time();
$resa = Db::name('ExpenseInterfix')->strict(false)->field(true)->update($data);
} else {
$data['create_time'] = time();
$eid = Db::name('ExpenseInterfix')->strict(false)->field(true)->insertGetId($data);
}
}
}
add_log('edit', $exid, $param);
Db::commit();
$dbRes = true;
} else {
Db::rollback();
}
} catch (\Exception $e) { ##这里参数不能删除($e错误信息)
Db::rollback();
return to_assign(1, $e->getMessage());
}
} else {
try {
validate(ExpenseCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$param['admin_id'] = $admin_id;
$param['did'] = get_login_admin('did');
Db::startTrans();
try {
if (!isset($param['check_admin_ids'])) {
if($flow[0]['flow_type'] == 1){
//部门负责人
$leader = get_department_leader($this->uid);
if($leader == 0){
return to_assign(1,'审批流程设置有问题当前部门负责人还未设置请联系HR或者管理员');
}
else{
$param['check_admin_ids'] = $leader;
}
}
else if($flow[0]['flow_type'] == 2){
//上级部门负责人
$leader = get_department_leader($this->uid,1);
if($leader == 0){
return to_assign(1,'审批流程设置有问题上级部门负责人还未设置请联系HR或者管理员');
}
else{
$param['check_admin_ids'] = $leader;
}
}
else{
$param['check_admin_ids'] = $flow[0]['flow_uids'];
}
$exid = ExpenseList::strict(false)->field(true)->insertGetId($param);
foreach ($flow as $key => &$value){
$value['action_id'] = $exid;
$value['sort'] = $key;
$value['type'] = 2;
$value['create_time'] = time();
}
//增加审核流程
Db::name('FlowStep')->strict(false)->field(true)->insertAll($flow);
}
else{
$exid = ExpenseList::strict(false)->field(true)->insertGetId($param);
$flow_step = array(
'action_id' => $exid,
'type' => 2,
'flow_uids' => $param['check_admin_ids'],
'create_time' => time()
);
//增加审核流程
Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
}
if ($exid) {
//相关内容多个数组;
$amountData = isset($param['amount']) ? $param['amount'] : '';
$remarksData = isset($param['remarks']) ? $param['remarks'] : '';
$cateData = isset($param['cate_id']) ? $param['cate_id'] : '';
if ($amountData) {
foreach ($amountData as $key => $value) {
if (!$value) {
continue;
}
$data = [];
$data['exid'] = $exid;
$data['admin_id'] = $admin_id;
$data['amount'] = $amountData[$key];
$data['cate_id'] = $cateData[$key];
$data['remarks'] = $remarksData[$key];
$data['create_time'] = time();
if ($data['amount'] == 0) {
Db::rollback();
return to_assign(1, '第' . ($key + 1) . '条报销金额不能为零');
}
$eid = Db::name('ExpenseInterfix')->strict(false)->field(true)->insertGetId($data);
}
}
add_log('add', $exid, $param);
Db::commit();
$dbRes = true;
} else {
Db::rollback();
}
} catch (\Exception $e) { ##这里参数不能删除($e错误信息)
Db::rollback();
return to_assign(1, $e->getMessage());
}
}
if ($dbRes == true) {
return to_assign();
} else {
return to_assign(1, '保存失败');
}
}
else{
$id = isset($param['id']) ? $param['id'] : 0;
if ($id > 0) {
$expense = $this->detail($id);
View::assign('expense', $expense);
}
$department = get_login_admin('did');
//获取报销审批流程
$flows = get_type_flows(6,$department);
$expense_cate = Db::name('ExpenseCate')->where(['status' => 1])->select()->toArray();
View::assign('user', get_admin($this->uid));
View::assign('expense_cate', $expense_cate);
View::assign('flows', $flows);
View::assign('id', $id);
return view();
}
}
//查看
public function view()
{
$id = empty(get_params('id')) ? 0 : get_params('id');
$detail = $this->detail($id);
$flows = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>2,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
$detail['check_user'] = '-';
$check_user_ids = [];
if($detail['check_status']<2){
if($flows['flow_type']==1){
$detail['check_user'] = '部门负责人';
$check_user_ids[]=get_department_leader($detail['admin_id']);
}
else if($flows['flow_type']==2){
$detail['check_user'] = '上级部门负责人';
$check_user_ids[]=get_department_leader($detail['admin_id'],1);
}
else{
$check_user_ids = explode(',',$flows['flow_uids']);
$check_user = Db::name('Admin')->where('id','in',$flows['flow_uids'])->column('name');
$detail['check_user'] = implode(',',$check_user);
}
}
$is_check_admin = 0;
$is_create_admin = 0;
if($detail['admin_id'] == $this->uid){
$is_create_admin = 1;
}
if(in_array($this->uid,$check_user_ids)){
$is_check_admin = 1;
//当前审核节点详情
$step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>2,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
if($step['flow_type'] == 4){
$check_count = Db::name('FlowRecord')->where(['action_id'=>$detail['id'],'type'=>2,'step_id'=>$step['id'],'check_user_id'=>$this->uid])->count();
if($check_count>0){
$is_check_admin = 0;
}
}
}
View::assign('is_create_admin', $is_create_admin);
View::assign('is_check_admin', $is_check_admin);
View::assign('detail', $detail);
View::assign('flows', $flows);
View::assign('uid', $this->uid);
return view();
}
//删除
public function delete()
{
$id = get_params("id");
$expense = $this->detail($id);
if ($expense['check_status'] == 2) {
return to_assign(1, "已审核的报销记录不能删除");
}
if ($expense['check_status'] == 3) {
return to_assign(1, "已打款的报销记录不能删除");
}
$data['status'] = '-1';
$data['id'] = $id;
$data['update_time'] = time();
if (Db::name('expense')->update($data) !== false) {
add_log('delete', $id);
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
}
//审核
public function check()
{
$param = get_params();
$detail = Db::name('Expense')->where(['id' => $param['id']])->find();
//当前审核节点详情
$step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>2,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
//审核通过
if($param['status'] == 1){
//多人会签审批
if($step['flow_type'] == 4){
//查询当前会签记录数
$check_count = Db::name('FlowRecord')->where(['action_id'=>$detail['id'],'type'=>2,'step_id'=>$step['id']])->count();
//当前会签记应有记录数
$flow_count = explode(',', $step['flow_uids']);
if(($check_count+1) >=count($flow_count)){
$next_step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>2,'sort'=>($detail['check_step_sort']+1),'delete_time'=>0])->find();
if($next_step){
//存在下一步审核
$param['check_step_sort'] = $detail['check_step_sort']+1;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
}
}
}
else if($step['flow_type'] == 0){
//自由人审批
if($param['check_node'] == 2){
$next_step = $detail['check_step_sort']+1;
$flow_step = array(
'action_id' => $detail['id'],
'sort' => $next_step,
'type' => 2,
'flow_uids' => $param['check_admin_ids'],
'create_time' => time()
);
$fid = Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
//下一步审核步骤
$param['check_admin_ids'] = $param['check_admin_ids'];
$param['check_step_sort'] = $next_step;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
$param['check_admin_ids'] ='';
}
}
else{
$next_step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>2,'sort'=>($detail['check_step_sort']+1),'delete_time'=>0])->find();
if($next_step){
//存在下一步审核
if($next_step['flow_type'] == 1){
$param['check_admin_ids'] = get_department_leader($this->uid);
}
else if($next_step['flow_type'] == 2){
$param['check_admin_ids'] = get_department_leader($this->uid,1);
}
else{
$param['check_admin_ids'] = $next_step['flow_uids'];
}
$param['check_step_sort'] = $detail['check_step_sort']+1;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
$param['check_admin_ids'] ='';
}
}
//审核通过数据操作
$param['last_admin_id'] = $this->uid;
$param['flow_admin_ids'] = $detail['flow_admin_ids'].$this->uid.',';
$res = Db::name('Expense')->strict(false)->field('check_step_sort,check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
if($res!==false){
$checkData=array(
'action_id' => $detail['id'],
'step_id' => $step['id'],
'check_user_id' => $this->uid,
'type' => 2,
'check_time' => time(),
'status' => $param['status'],
'content' => $param['content'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('check', $param['id'], $param);
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
else if($param['status'] == 2){
//拒绝审核,数据操作
$param['check_status'] = 3;
$param['last_admin_id'] = $this->uid;
$param['flow_admin_ids'] = $detail['flow_admin_ids'].$this->uid.',';
$param['check_admin_ids'] ='';
$res = Db::name('Expense')->strict(false)->field('check_step_sort,check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
if($res!==false){
$checkData=array(
'action_id' => $detail['id'],
'step_id' => $step['id'],
'check_user_id' => $this->uid,
'type' => 2,
'check_time' => time(),
'status' => $param['status'],
'content' => $param['content'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('refue', $param['id'], $param);
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
else if($param['status'] == 3){
if($detail['admin_id'] != $this->uid){
return to_assign(1,'你没权限操作');
}
//撤销审核,数据操作
$param['check_status'] = 4;
$param['check_admin_ids'] ='';
$param['check_step_sort'] =0;
$res = Db::name('Expense')->strict(false)->field('check_step_sort,check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
if($res!==false){
$checkData=array(
'action_id' => $detail['id'],
'step_id' => 0,
'check_user_id' => $this->uid,
'type' => 2,
'check_time' => time(),
'status' => $param['status'],
'content' => $param['content'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('back', $param['id'], $param);
return to_assign();
}else{
return to_assign(1,'操作失败');
}
}
}
//设置为已打款
public function topay()
{
$param = get_params();
if (request()->isAjax()) {
$param['check_status'] = 5;
$param['pay_admin_id'] = $this->uid;
$param['pay_time'] = time();
$res = ExpenseList::where('id', $param['id'])->strict(false)->field(true)->update($param);
if ($res !== false) {
return to_assign();
} else {
return to_assign(1, "操作失败");
}
}
}
}

View File

@ -7,11 +7,10 @@
declare (strict_types = 1);
namespace app\home\controller;
namespace app\finance\controller;
use app\base\BaseController;
use app\home\model\Invoice as InvoiceList;
use app\home\validate\InvoiceCheck;
use app\finance\model\Invoice as InvoiceList;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
@ -71,7 +70,7 @@ class Income extends BaseController
$param = get_params();
$where = [];
$where[] = ['status', '=', 1];
$where[] = ['invoice_status', '=', 3];
$where[] = ['check_status', '=', 5];
//按时间检索
$start_time = isset($param['start_time']) ? strtotime(urldecode($param['start_time'])) : 0;
$end_time = isset($param['end_time']) ? strtotime(urldecode($param['end_time'])) : 0;

View File

@ -0,0 +1,617 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\finance\controller;
use app\base\BaseController;
use app\finance\model\Invoice as InvoiceList;
use app\finance\validate\InvoiceCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Invoice extends BaseController
{
//发票列表检索
public function get_list($where = [],$param=[], $type='and')
{
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
if($type == 'or'){
$list = Db::name('Invoice')
->field('i.*,a.name,d.title as department_name')
->alias('i')
->join('Admin a', 'a.id = i.admin_id', 'left')
->join('Department d', 'd.id = i.did', 'left')
->whereOr($where)
->order('i.id desc')
->group('i.id')
->paginate(['list_rows' => $rows, 'query' => $param])
->each(function($item, $key){
$item['create_time'] = date('Y-m-d H:i', $item['create_time']);
if ($item['open_time'] > 0) {
$item['open_time'] = empty($item['open_time']) ? '0' : date('Y-m-d', $item['open_time']);
$item['open_name'] = Db::name('Admin')->where('id',$item['open_admin_id'])->value('name');
}
else{
$item['open_time'] = '';
$item['open_name'] = '-';
}
$item['check_user'] = '-';
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('Admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_user'] = implode(',',$check_user);
}
return $item;
});
}
else{
$list = Db::name('Invoice')
->field('i.*,a.name,d.title as department_name')
->alias('i')
->join('Admin a', 'a.id = i.admin_id', 'left')
->join('Department d', 'd.id = i.did', 'left')
->where($where)
->order('i.id desc')
->paginate(['list_rows' => $rows, 'query' => $param])
->each(function($item, $key){
$item['create_time'] = date('Y-m-d H:i', $item['create_time']);
$item['check_user'] = '-';
if ($item['open_time'] > 0) {
$item['open_time'] = empty($item['open_time']) ? '0' : date('Y-m-d', $item['open_time']);
$item['open_name'] = Db::name('Admin')->where('id',$item['open_admin_id'])->value('name');
}
else{
$item['open_time'] = '';
$item['open_name'] = '-';
}
if($item['check_status']<2 && !empty($item['check_admin_ids'])){
$check_user = Db::name('Admin')->where('id','in',$item['check_admin_ids'])->column('name');
$item['check_user'] = implode(',',$check_user);
}
return $item;
});
}
return $list;
}
//发票详情
public function detail($id = 0)
{
$invoice = Db::name('Invoice')->where(['id' => $id])->find();
if ($invoice) {
$invoice['create_user'] = Db::name('Admin')->where(['id' => $invoice['admin_id']])->value('name');
$invoice['department'] = Db::name('Department')->where(['id' => $invoice['did']])->value('title');
$invoice['check_admin'] = Db::name('Admin')->where(['id' => $invoice['check_admin_id']])->value('name');
$invoice['open_admin'] = Db::name('Admin')->where(['id' => $invoice['open_admin_id']])->value('name');
if ($invoice['check_time'] > 0) {
$invoice['check_time'] = empty($invoice['check_time']) ? '0' : date('Y-m-d H:i', $invoice['check_time']);
}
if ($invoice['open_time'] > 0) {
$invoice['open_time'] = empty($invoice['open_time']) ? '0' : date('Y-m-d', $invoice['open_time']);
}
else{
$invoice['open_time'] = '-';
}
}
return $invoice;
}
//我申请的发票
public function index()
{
if (request()->isAjax()) {
$param = get_params();
$where = [];
if (!empty($param['check_status'])) {
$where[] = ['i.check_status','=',$param['check_status']];
}
//按时间检索
$start_time = isset($param['start_time']) ? strtotime(urldecode($param['start_time'])) : 0;
$end_time = isset($param['end_time']) ? strtotime(urldecode($param['end_time'])) : 0;
if ($start_time > 0 && $end_time > 0) {
$where[] = ['i.create_time', 'between', [$start_time, $end_time]];
}
$where[] = ['i.admin_id','=',$this->uid];
$list = $this->get_list($where,$param);
return table_assign(0, '', $list);
} else {
return view();
}
}
//待审批的发票
public function list()
{
if (request()->isAjax()) {
$param = get_params();
$status = isset($param['status'])?$param['status']:0;
$user_id = $this->uid;
//查询条件
$map1 = [];
$map2 = [];
$map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',i.check_admin_ids)")];
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',i.flow_admin_ids)")];
if($status == 0){
$list = $this->get_list([$map1,$map2],$param,'or');
}
if($status == 1){
$list = $this->get_list($map1,$param);
}
if($status == 2){
$list = $this->get_list($map2,$param);
}
return table_assign(0, '', $list);
} else {
return view();
}
}
//发票开具
public function checkedlist()
{
if (request()->isAjax()) {
$param = get_params();
$where = [];
if (!empty($param['check_status'])) {
$where[] = ['i.check_status','=',$param['check_status']];
}
else{
$where[] = ['i.check_status','in',[2,5,10]];
}
//按时间检索
$start_time = !empty($param['start_time']) ? strtotime(urldecode($param['start_time'])) : 0;
$end_time = !empty($param['end_time']) ? strtotime(urldecode($param['end_time'])) : 0;
if ($start_time > 0 && $end_time > 0) {
$where[] = ['i.create_time', 'between', [$start_time, $end_time]];
}
$list = $this->get_list($where,$param);
return table_assign(0, '', $list);
} else {
return view();
}
}
//添加&编辑
public function add()
{
$param = get_params();
if (request()->isAjax()) {
$param['check_status'] = 1;
$flow_list = Db::name('Flow')->where('id',$param['flow_id'])->value('flow_list');
$flow = unserialize($flow_list);
if ($param['type'] == 1) {
if (!$param['invoice_tax']) {
return to_assign(1, '纳税人识别号不能为空');
}
if (!$param['invoice_bank']) {
return to_assign(1, '开户银行不能为空');
}
if (!$param['invoice_account']) {
return to_assign(1, '银行账号不能为空');
}
if (!$param['invoice_banking']) {
return to_assign(1, '银行营业网点不能为空');
}
if (!$param['invoice_address']) {
return to_assign(1, '银地址不能为空');
}
}
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(InvoiceCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['update_time'] = time();
//删除原来的审核流程和审核记录
Db::name('FlowStep')->where(['action_id'=>$param['id'],'type'=>3,'delete_time'=>0])->update(['delete_time'=>time()]);
Db::name('FlowRecord')->where(['action_id'=>$param['id'],'type'=>3,'delete_time'=>0])->update(['delete_time'=>time()]);
if (!isset($param['check_admin_ids'])) {
if($flow[0]['flow_type'] == 1){
//部门负责人
$leader = get_department_leader($this->uid);
if($leader == 0){
return to_assign(1,'审批流程设置有问题当前部门负责人还未设置请联系HR或者管理员');
}
else{
$param['check_admin_ids'] = $leader;
}
}
else if($flow[0]['flow_type'] == 2){
//上级部门负责人
$leader = get_department_leader($this->uid,1);
if($leader == 0){
return to_assign(1,'审批流程设置有问题上级部门负责人还未设置请联系HR或者管理员');
}
else{
$param['check_admin_ids'] = $leader;
}
}
else{
$param['check_admin_ids'] = $flow[0]['flow_uids'];
}
foreach ($flow as $key => &$value){
$value['action_id'] = $param['id'];
$value['sort'] = $key;
$value['type'] = 3;
$value['create_time'] = time();
}
//增加审核流程
Db::name('FlowStep')->strict(false)->field(true)->insertAll($flow);
}
else{
$flow_step = array(
'action_id' => $param['id'],
'type' => 3,
'flow_uids' => $param['check_admin_ids'],
'create_time' => time()
);
//增加审核流程
Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
}
$res = InvoiceList::where('id', $param['id'])->strict(false)->field(true)->update($param);
if ($res !== false) {
add_log('edit', $param['id'], $param);
return to_assign();
} else {
return to_assign(1, '操作失败');
}
} else {
try {
validate(InvoiceCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$admin_id = $this->uid;
$param['admin_id'] = $admin_id;
$param['did'] = get_login_admin('did');
$param['create_time'] = time();
if (!isset($param['check_admin_ids'])) {
if($flow[0]['flow_type'] == 1){
//部门负责人
$leader = get_department_leader($this->uid);
if($leader == 0){
return to_assign(1,'审批流程设置有问题当前部门负责人还未设置请联系HR或者管理员');
}
else{
$param['check_admin_ids'] = $leader;
}
}
else if($flow[0]['flow_type'] == 2){
//上级部门负责人
$leader = get_department_leader($this->uid,1);
if($leader == 0){
return to_assign(1,'审批流程设置有问题上级部门负责人还未设置请联系HR或者管理员');
}
else{
$param['check_admin_ids'] = $leader;
}
}
else{
$param['check_admin_ids'] = $flow[0]['flow_uids'];
}
$exid = InvoiceList::strict(false)->field(true)->insertGetId($param);
foreach ($flow as $key => &$value){
$value['action_id'] = $exid;
$value['sort'] = $key;
$value['type'] = 3;
$value['create_time'] = time();
}
//增加审核流程
Db::name('FlowStep')->strict(false)->field(true)->insertAll($flow);
}
else{
$exid = InvoiceList::strict(false)->field(true)->insertGetId($param);
$flow_step = array(
'action_id' => $exid,
'type' => 3,
'flow_uids' => $param['check_admin_ids'],
'create_time' => time()
);
//增加审核流程
Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
}
if ($exid) {
add_log('apply', $exid, $param);
return to_assign();
} else {
return to_assign(1, '操作失败');
}
}
} else {
$id = isset($param['id']) ? $param['id'] : 0;
if ($id > 0) {
$detail = $this->detail($id);
View::assign('detail', $detail);
}
$department = get_login_admin('did');
//获取发票审批流程
$flows = get_type_flows(7,$department);
View::assign('user', get_admin($this->uid));
View::assign('id', $id);
View::assign('flows', $flows);
return view();
}
}
//查看
public function view()
{
$id = empty(get_params('id')) ? 0 : get_params('id');
$detail = $this->detail($id);
$flows = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>3,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
$detail['check_user'] = '-';
$check_user_ids = [];
if($detail['check_status']<2){
if($flows['flow_type']==1){
$detail['check_user'] = '部门负责人';
$check_user_ids[]=get_department_leader($detail['admin_id']);
}
else if($flows['flow_type']==2){
$detail['check_user'] = '上级部门负责人';
$check_user_ids[]=get_department_leader($detail['admin_id'],1);
}
else{
$check_user_ids = explode(',',$flows['flow_uids']);
$check_user = Db::name('Admin')->where('id','in',$flows['flow_uids'])->column('name');
$detail['check_user'] = implode(',',$check_user);
}
}
$is_check_admin = 0;
$is_create_admin = 0;
if($detail['admin_id'] == $this->uid){
$is_create_admin = 1;
}
if(in_array($this->uid,$check_user_ids)){
$is_check_admin = 1;
//当前审核节点详情
$step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>3,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
if($step['flow_type'] == 4){
$check_count = Db::name('FlowRecord')->where(['action_id'=>$detail['id'],'type'=>3,'step_id'=>$step['id'],'check_user_id'=>$this->uid])->count();
if($check_count>0){
$is_check_admin = 0;
}
}
}
View::assign('is_create_admin', $is_create_admin);
View::assign('is_check_admin', $is_check_admin);
View::assign('detail', $detail);
View::assign('flows', $flows);
View::assign('uid', $this->uid);
return view();
}
//删除
public function delete()
{
$id = get_params("id");
$detail = $this->detail($id);
if ($detail['invoice_status'] == 2) {
return to_assign(1, "已审核的发票不能删除");
}
if ($detail['invoice_status'] == 3) {
return to_assign(1, "已开具的发票不能删除");
}
$data['status'] = '-1';
$data['id'] = $id;
$data['update_time'] = time();
if (Db::name('Invoice')->update($data) !== false) {
add_log('delete', $id);
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
}
//审核
public function check()
{
$param = get_params();
$detail = Db::name('Invoice')->where(['id' => $param['id']])->find();
//当前审核节点详情
$step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>3,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
//审核通过
if($param['status'] == 1){
//多人会签审批
if($step['flow_type'] == 4){
//查询当前会签记录数
$check_count = Db::name('FlowRecord')->where(['action_id'=>$detail['id'],'type'=>3,'step_id'=>$step['id']])->count();
//当前会签记应有记录数
$flow_count = explode(',', $step['flow_uids']);
if(($check_count+1) >=count($flow_count)){
$next_step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>3,'sort'=>($detail['check_step_sort']+1),'delete_time'=>0])->find();
if($next_step){
//存在下一步审核
$param['check_step_sort'] = $detail['check_step_sort']+1;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
}
}
}
else if($step['flow_type'] == 0){
//自由人审批
if($param['check_node'] == 2){
$next_step = $detail['check_step_sort']+1;
$flow_step = array(
'action_id' => $detail['id'],
'sort' => $next_step,
'type' => 3,
'flow_uids' => $param['check_admin_ids'],
'create_time' => time()
);
$fid = Db::name('FlowStep')->strict(false)->field(true)->insertGetId($flow_step);
//下一步审核步骤
$param['check_admin_ids'] = $param['check_admin_ids'];
$param['check_step_sort'] = $next_step;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
$param['check_admin_ids'] ='';
}
}
else{
$next_step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>3,'sort'=>($detail['check_step_sort']+1),'delete_time'=>0])->find();
if($next_step){
//存在下一步审核
if($next_step['flow_type'] == 1){
$param['check_admin_ids'] = get_department_leader($this->uid);
}
else if($next_step['flow_type'] == 2){
$param['check_admin_ids'] = get_department_leader($this->uid,1);
}
else{
$param['check_admin_ids'] = $next_step['flow_uids'];
}
$param['check_step_sort'] = $detail['check_step_sort']+1;
$param['check_status'] = 1;
}
else{
//不存在下一步审核,审核结束
$param['check_status'] = 2;
$param['check_admin_ids'] ='';
}
}
//审核通过数据操作
$param['last_admin_id'] = $this->uid;
$param['flow_admin_ids'] = $detail['flow_admin_ids'].$this->uid.',';
$res = Db::name('Invoice')->strict(false)->field('check_step_sort,check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
if($res!==false){
$checkData=array(
'action_id' => $detail['id'],
'step_id' => $step['id'],
'check_user_id' => $this->uid,
'type' => 3,
'check_time' => time(),
'status' => $param['status'],
'content' => $param['content'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('check', $param['id'], $param);
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
else if($param['status'] == 2){
//拒绝审核,数据操作
$param['check_status'] = 3;
$param['last_admin_id'] = $this->uid;
$param['flow_admin_ids'] = $detail['flow_admin_ids'].$this->uid.',';
$param['check_admin_ids'] ='';
$res = Db::name('Invoice')->strict(false)->field('check_step_sort,check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
if($res!==false){
$checkData=array(
'action_id' => $detail['id'],
'step_id' => $step['id'],
'check_user_id' => $this->uid,
'type' => 3,
'check_time' => time(),
'status' => $param['status'],
'content' => $param['content'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('refue', $param['id'], $param);
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
else if($param['status'] == 3){
if($detail['admin_id'] != $this->uid){
return to_assign(1,'你没权限操作');
}
//撤销审核,数据操作
$param['check_status'] = 4;
$param['check_admin_ids'] ='';
$param['check_step_sort'] =0;
$res = Db::name('Invoice')->strict(false)->field('check_step_sort,check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
if($res!==false){
$checkData=array(
'action_id' => $detail['id'],
'step_id' => 0,
'check_user_id' => $this->uid,
'type' => 3,
'check_time' => time(),
'status' => $param['status'],
'content' => $param['content'],
'create_time' => time()
);
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
add_log('back', $param['id'], $param);
return to_assign();
}else{
return to_assign(1,'操作失败');
}
}
}
//作废
public function tovoid()
{
$param = get_params();
if (request()->isAjax()) {
if ($param['check_status'] == 10) {
$count = Db::name('InvoiceIncome')->where(['inid'=>$param['id'],'status'=>1])->count();
if($count>0){
return to_assign(1, "发票已经新增有到账记录,请先反到账后再作废发票");
}
else{
$param['update_time'] = time();
add_log('tovoid', $param['id'],$param);
}
}
$res = InvoiceList::where('id', $param['id'])->strict(false)->field('check_status')->update($param);
if ($res !== false) {
return to_assign();
} else {
return to_assign(1, "操作失败");
}
}
}
//开具发票
public function open()
{
$param = get_params();
if (request()->isAjax()) {
$detail = Db::name('Invoice')->where(['id' => $param['id']])->find();
if ($detail['check_status'] == 2) {
$param['check_status'] = 5;
$param['open_admin_id'] = $this->uid;
}
$param['open_time'] = isset($param['open_time']) ? strtotime(urldecode($param['open_time'])) : 0;
$res = InvoiceList::where('id', $param['id'])->strict(false)->field('code,check_status,open_time,open_admin_id,delivery')->update($param);
if ($res !== false) {
add_log('open', $param['id'],$param);
return to_assign();
} else {
return to_assign(1, "操作失败");
}
}
}
}

5
app/finance/event.php Normal file
View File

@ -0,0 +1,5 @@
<?php
// 这是系统自动生成的event定义文件
return [
];

View File

@ -0,0 +1,14 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
// 这是系统自动生成的middleware定义文件
return [
//开启session中间件
//'think\middleware\SessionInit',
//验证勾股OA是否完成安装
\app\home\middleware\Install::class,
];

View File

@ -1,5 +1,5 @@
<?php
namespace app\home\model;
namespace app\finance\model;
use think\Model;
class Expense extends Model
{

View File

@ -1,5 +1,5 @@
<?php
namespace app\home\model;
namespace app\finance\model;
use think\Model;
class Invoice extends Model
{

View File

@ -1,49 +1,46 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
{block name="style"}
<link rel="stylesheet" href="{__LAYUI__}/plugin/dtree/dtree.css">
<link rel="stylesheet" href="{__LAYUI__}/plugin/dtree/font/dtreefont.css">
<style>
.layui-form-pane .layui-form-label{color:#999; width:80px; padding:8px 3px;}
.layui-form-item .layui-inline{margin-right:3px; margin-bottom:10px;}
.layui-form-item{margin-bottom:5px;}
.layui-form-item .layui-btn-danger{display:none; margin-top:-8px}
.layui-form-item:hover .layui-btn-danger{display:inline-block;}
.select-1,.select-2{display:none;}
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
</style>
<link rel="stylesheet" href="{__JS__}/module/dtree/dtree.css">
<link rel="stylesheet" href="{__JS__}/module/dtree/font/dtreefont.css">
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<form class="layui-form page-content">
<h3 class="h3-title">报销信息</h3>
{if condition="($id == 0)"}
<table class="layui-table">
<tr>
<td class="layui-td-gray2">报销人</td>
<td>
{$user.name}
</td>
<td class="layui-td-gray2">报销部门</td>
<td colspan="3">
{$user.department}
</td>
</tr>
<tr>
<td class="layui-td-gray2">报销凭证编号<span style="color: red">*</span></td>
<td>
<input type="text" name="code" autocomplete="off" lay-verify="required" placeholder="报销凭证编号" lay-reqText="请填写报销凭证编号" class="layui-input" value="">
</td>
<td class="layui-td-gray">入账月份<span style="color: red">*</span></td>
<td>
<input type="text" class="layui-input" id="income_month" name="income_month" lay-verify="required" placeholder="请选择入账月份" lay-reqText="请选择入账月份" readonly value="">
</td>
<td class="layui-td-gray2">原始单据日期<span style="color: red">*</span></td>
<td>
<input type="text" class="layui-input" id="expense_time" name="expense_time" lay-verify="required" placeholder="请选择原始单据日期" lay-reqText="请选择原始单据日期" readonly value="">
</td>
</tr>
<tr>
<td class="layui-td-gray">报销审核人<span style="color: red">*</span></td>
<td class="layui-td-gray">入账月份<span style="color: red">*</span></td>
<td>
<select name="check_admin_id" lay-verify="required" lay-reqText="请选择报销审核人">
<option value="">请选择报销审核人</option>
{volist name=":get_check_user(1)" id="vo"}
<option value="{$vo.uid}">{$vo.user}</option>
{/volist}
</select>
</td>
<td class="layui-td-gray2">报销人</td>
<td>
{$user.name}
</td>
<td class="layui-td-gray">报销部门</td>
<td>
{$user.department}
<input type="text" class="layui-input" id="income_month" name="income_month" lay-verify="required" placeholder="请选择入账月份" lay-reqText="请选择入账月份" readonly value="">
</td>
</tr>
<tr>
@ -52,10 +49,10 @@
<div>
<table id="interfix" class="layui-table layui-table-min">
<tr>
<th width="200">报销金额</th>
<th width="300">报销项目</th>
<th width="100">报销金额</th>
<th width="120">报销项目</th>
<th>备注信息</th>
<th width="100">操作</th>
<th width="60">操作</th>
</tr>
<tr class="more_interfix">
<td><input type="text" name="amount[]" value="" class="layui-input" lay-verify="required|number" lay-reqText="请完善报销金额"></td>
@ -75,37 +72,45 @@
<button class="layui-btn layui-btn-normal layui-btn-sm" type="button" id="addInterfix">+报销选项</button>
</td>
</tr>
<tr>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td colspan="5">
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>
</td>
</tr>
</table>
{else/}
<table class="layui-table">
<tr>
<td class="layui-td-gray2">报销人</td>
<td>{$expense.create_user}</td>
<td class="layui-td-gray2">报销部门</td>
<td colspan="3">{$expense.department}</td>
</tr>
<tr>
<td class="layui-td-gray2">报销凭证编号<span style="color: red">*</span></td>
<td>
<input type="text" name="code" autocomplete="off" lay-verify="required" placeholder="报销凭证编号" lay-reqText="请填写报销凭证编号" class="layui-input" value="{$expense.code}">
</td>
<td class="layui-td-gray">入账月份<span style="color: red">*</span></td>
<td>
<input type="text" class="layui-input" id="income_month" name="income_month" lay-verify="required" placeholder="请选择入账月份" lay-reqText="请选择入账月份" readonly value="{$expense.income_month}">
</td>
<td class="layui-td-gray2">原始单据日期<span style="color: red">*</span></td>
<td>
<input type="text" class="layui-input" id="expense_time" name="expense_time" lay-verify="required" placeholder="请选择原始单据日期" lay-reqText="请选择原始单据日期" readonly value="{$expense.expense_time}">
</td>
</tr>
<tr>
<td class="layui-td-gray">报销审核人<span style="color: red">*</span></td>
<td class="layui-td-gray">入账月份<span style="color: red">*</span></td>
<td>
<select name="check_admin_id" lay-verify="required" lay-reqText="请选择报销审核人">
<option value="">请选择报销审核人</option>
{volist name=":get_check_user(1)" id="vo"}
<option value="{$vo.uid}" {eq name="$vo.uid" value="$expense.check_admin_id"}selected{/eq}>{$vo.user}</option>
{/volist}
</select>
<input type="text" class="layui-input" id="income_month" name="income_month" lay-verify="required" placeholder="请选择入账月份" lay-reqText="请选择入账月份" readonly value="{$expense.income_month}">
</td>
<td class="layui-td-gray2">报销人</td>
<td>{$expense.user_name}</td>
<td class="layui-td-gray">报销部门</td>
<td>{$expense.department}</td>
</tr>
<tr>
<td class="layui-td-gray2">报销选项<span style="color: red">*</span></td>
@ -113,10 +118,10 @@
<div>
<table id="interfix" class="layui-table layui-table-min">
<tr>
<th width="200">报销金额</th>
<th width="300">报销类别</th>
<th width="100">报销金额</th>
<th width="120">报销类别</th>
<th>备注信息</th>
<th width="100">操作</th>
<th width="60">操作</th>
</tr>
{volist name="$expense.list" id="val"}
<tr class="more_interfix">
@ -138,6 +143,23 @@
<button class="layui-btn layui-btn-normal layui-btn-sm" type="button" id="addInterfix">+报销选项</button>
</td>
</tr>
<tr>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td colspan="5">
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>
</td>
</tr>
</table>
{/if}
@ -165,6 +187,7 @@
var form = layui.form
,layer = layui.layer
,table = layui.table
,employeepicker = layui.employeepicker
,laydate = layui.laydate;
laydate.render({
@ -190,7 +213,7 @@
title: '提示'
}, function(index) {
$.ajax({
url: "/home/expense/add",
url: "/finance/expense/add",
type:'post',
data:data.field,
success:function(e){
@ -207,6 +230,81 @@
return false;
});
//选择人员
$('.layui-form').on('click','[name="check_admin_name"]',function(){
if($('[name="flow_id"]').val()==''){
layer.msg('请先选择审批流程');
return false;
}
employeepicker.init({
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type:0,
callback:function(ids,names){
$('[name="check_admin_ids"]').val(ids),
$('[name="check_admin_name"]').val(names);
}
});
})
form.on('select(flowtype)', function(data){
var check_type = data.elem[data.elem.selectedIndex].title;
var formHtml='<td class="layui-td-gray">审核人<font>*</font></td>\
<td colspan="5">\
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>\
</td>';
if(check_type == 2){
$('#flow_tr').html(formHtml);
form.render();
}
else{
$.ajax({
url: "/api/index/get_flow_users",
type:'post',
data:{id:data.value},
success: function (e) {
if (e.code == 0) {
var flowLi='';
for(var a=0;a<e.data.length;a++){
var userList='',sign_type = '';
if(e.data[a].flow_type==1){
userList+= '<li style="padding:3px 0">当前部门负责人</li>';
}
else if(e.data[a].flow_type==2){
userList+= '<li style="padding:3px 0">上级部门负责人</li>';
}
else{
if(e.data[a].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
}
if(e.data[a].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
}
for(var b=0;b<e.data[a].user_id_info.length;b++){
userList+= '<li style="padding:3px 0"><img src="'+e.data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+e.data[a].user_id_info[b].name+'</li>';
}
}
flowLi+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title"><strong>第'+(a+1)+'级审批</strong>'+sign_type+'</p>\
<ul>'+userList+'</ul>\
</div>\
</li>';
}
formHtml = '<td class="layui-td-gray">审批流程</td>\
<td colspan="5">\
<ul id="flowList" class="layui-timeline">'+flowLi+'</ul>\
</td>';
$('#flow_tr').html(formHtml);
}
}
})
}
});
//添加报销信息表格
$('#addInterfix').on('click',function(){
var html = '';
@ -234,7 +332,7 @@
title: '提示'
}, function(index) {
$.ajax({
url: "/home/api/del_expense_interfix",
url: "/api/index/del_expense_interfix",
data: {
id: _id
},
@ -256,6 +354,6 @@
}
</script>
{include file="common/layui" base='base' extend="['employeepicker']" callback="init" /}
{include file="../../base/view/common/layui" base='base' extend="['employeepicker']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,189 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<form class="layui-form layui-form-bar">
<div id="barDate" class="layui-input-inline">
<div class="layui-input-inline" style="width:110px;">
<input type="text" class="layui-input" id="start_time" placeholder="选择时间区间" readonly name="start_time">
</div>
~
<div class="layui-input-inline" style="width:110px;">
<input type="text" class="layui-input" id="end_time" placeholder="选择时间区间" readonly name="end_time">
</div>
</div>
<div class="layui-input-inline">
<select name="check_status">
<option value="">请选择状态</option>
<option value="2">审批通过,待打款</option>
<option value="5">已打款</option>
</select>
</div>
<button class="layui-btn layui-btn-danger" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<h3 class="h3-title" style="height:32px;">报销列表</h3>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns=null;
function init(layui) {
var table = layui.table,
rightpage = layui.rightpage,
form = layui.form,
laydate = layui.laydate;
//日期范围
laydate.render({
elem: '#barDate',
range: ['#start_time', '#end_time']
});
//监听搜索提交
form.on('submit(webform)', function(data){
let f=data.field;
tableIns.reload({where:{check_status:f.check_status,start_time:f.start_time,end_time:f.end_time},page:{curr:1}});
return false;
});
tableIns = table.render({
elem: '#test',
title: '报销管理列表',
toolbar: '#toolbarDemo',
url: "/finance/expense/checkedlist", //数据接口
page: true, //开启分页
limit: 20,
cols: [
[
{
field: 'id',
title: 'ID号',
align: 'center',
width: 80
}, {
field: 'amount',
title: '报销总金额(元)',
align: 'right',
style: 'color:#1E9FFF',
width: 120,
},{
field: 'check_status',
title: '状态',
align: 'center',
width: 120,
templet:function(d){
var html='<span style="color:#FF5722">审批不通过</span>';
if(d.check_status==1){
html='<span style="color:#5FB878">审批中</span>';
}
else if(d.check_status==2){
html='<span style="color:#1E9FFF">审批通过</span>';
}
else if(d.check_status==4){
html='<span style="color:#FF5722">撤销</span>';
}
else if(d.check_status==5){
html='<span style="color:#FFB800">已打款</span>';
}
return html;
}
},{
field: 'admin_name',
title: '报销人',
align: 'center',
width: 100
},{
field: 'department',
title: '报销部门',
align: 'center',
width: 150
},{
field: 'code',
title: '报销凭证编号',
minWidth: 150,
},{
field: 'expense_time',
title: '原始单据日期',
align: 'center',
width: 120
},{
field: 'income_month',
title: '入账月份',
align: 'center',
width: 90
},{
field: 'create_time',
title: '录入时间',
align: 'center',
width: 150
},{
field: 'pay_name',
title: '打款人',
align: 'center',
width: 90
},{
field: 'pay_time',
title: '打款确认时间',
align: 'center',
width: 150
}, {
field: 'right',
fixed: 'right',
title: '操作',
width: 150,
align: 'center',
templet:function(d){
//0待审、1审批中、2通过、3失败、4撤销、5已开具、10已作废
var html='<div class="layui-btn-group">';
var btn1='<span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详情</span>';
var btn2='<span class="layui-btn layui-btn-warm layui-btn-xs" lay-event="open">标记为已打款</span>';
html+=btn1;
if(d.check_status==2){
html+=btn2;
}
html+='</div>';
return html;
}
}
]
]
});
//监听行工具事件
table.on('tool(test)', function(obj) {
var data = obj.data;
if (obj.event === 'view') {
rightpage.open("/finance/expense/view?id="+data.id,"900px");
return;
}
if(obj.event === 'open'){
layer.confirm('确定标记为已打款?', {
icon: 3,
title: '提示'
}, function(index) {
$.ajax({
url: "/finance/expense/topay",
data: {
id: data.id
},
success: function(res) {
layer.msg(res.msg);
tableIns.reload();
}
})
layer.close(index);
});
}
});
}
</script>
{include file="../../base/view/common/layui" base='base' extend="['rightpage']" use="['table','form']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,7 +1,7 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<div class="body-table">
<form class="layui-form layui-form-bar">
<div id="barDate" class="layui-input-inline">
<div class="layui-input-inline" style="width:110px;">
@ -15,10 +15,11 @@
<div class="layui-input-inline">
<select name="check_status">
<option value="">请选择状态</option>
<option value="1">未审核</option>
<option value="0">审核不通过</option>
<option value="2">审核通过</option>
<option value="3">已打款</option>
<option value="1">审批中</option>
<option value="2">审批通过,待打款</option>
<option value="3">审批不通过</option>
<option value="4">撤销</option>
<option value="5">已打款</option>
</select>
</div>
<button class="layui-btn layui-btn-danger" lay-submit="" lay-filter="webform">提交搜索</button>
@ -59,7 +60,7 @@
elem: '#test',
title: '报销管理列表',
toolbar: '#toolbarDemo',
url: "/home/expense/index", //数据接口
url: "/finance/expense/index", //数据接口
page: true, //开启分页
limit: 20,
cols: [
@ -81,14 +82,17 @@
align: 'center',
width: 120,
templet:function(d){
var html='<span style="color:#FF5722">不通过</span>';
var html='<span style="color:#FF5722">不通过</span>';
if(d.check_status==1){
html='<span style="color:#5FB878">报销审核</span>';
html='<span style="color:#5FB878">审批</span>';
}
else if(d.check_status==2){
html='<span style="color:#1E9FFF">通过</span>';
html='<span style="color:#1E9FFF">通过</span>';
}
else if(d.check_status==3){
else if(d.check_status==4){
html='<span style="color:#FF5722">撤销</span>';
}
else if(d.check_status==5){
html='<span style="color:#FFB800">已打款</span>';
}
return html;
@ -123,15 +127,8 @@
align: 'center',
width: 150
},{
field: 'check_name',
title: '审核人',
align: 'center',
width: 90
},{
field: 'check_time',
title: '审核时间',
align: 'center',
width: 150
field: 'check_user',
title: '当前审核人'
},{
field: 'pay_name',
title: '打款人',
@ -147,14 +144,14 @@
fixed: 'right',
title: '操作',
width: 130,
align: 'right',
align: 'center',
templet:function(d){
var html='<div class="layui-btn-group">';
var btn1='<span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详情</span>';
var btn2='<span class="layui-btn layui-btn-xs" lay-event="edit">编辑</span>';
var btn3='<span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</span>';
html+=btn1;
if(d.check_status==0 && d.admin_id==login_user){
if(d.check_status==4 && d.admin_id==login_user){
html+=btn2+btn3;
}
html+='</div>';
@ -168,7 +165,7 @@
//表头工具栏事件
table.on('toolbar(test)', function(obj){
if (obj.event === 'add') {
rightpage.open("/home/expense/add");
rightpage.open("/finance/expense/add","900px");
return;
}
});
@ -176,11 +173,11 @@
table.on('tool(test)', function(obj) {
var data = obj.data;
if (obj.event === 'view') {
rightpage.open("/home/expense/view?id="+data.id);
rightpage.open("/finance/expense/view?id="+data.id,"900px");
return;
}
if (obj.event === 'edit') {
rightpage.open("/home/expense/add?id="+data.id);
rightpage.open("/finance/expense/add?id="+data.id,"900px");
return;
}
if (obj.event === 'del') {
@ -189,7 +186,7 @@
title: '提示'
}, function(index) {
$.ajax({
url: "/home/expense/delete",
url: "/finance/expense/delete",
data: {
id: data.id
},
@ -206,6 +203,6 @@
});
}
</script>
{include file="common/layui" base='base' extend="['rightpage']" use="['table','form']" callback="init" /}
{include file="../../base/view/common/layui" base='base' extend="['rightpage']" use="['table','form']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,147 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<div class="layui-tab layui-tab-brief" lay-filter="tab">
<ul class="layui-tab-title">
<li class="layui-this">全部</li>
<li>待我审批</li>
<li>我已审批</li>
</ul>
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<h3 class="h3-title" style="height:32px;">报销列表</h3>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns=null;
function init(layui) {
var table = layui.table,
rightpage = layui.rightpage,
element=layui.element,
form = layui.form;
element.on('tab(tab)', function(data){
tableIns.reload({where:{status:data.index},page:{curr:1}});
return false;
});
tableIns = table.render({
elem: '#test',
title: '报销管理列表',
toolbar: '#toolbarDemo',
url: "/finance/expense/list", //数据接口
page: true, //开启分页
limit: 20,
cols: [
[
{
field: 'id',
title: 'ID号',
align: 'center',
width: 80
}, {
field: 'amount',
title: '报销总金额(元)',
align: 'right',
style: 'color:#1E9FFF',
width: 120,
},{
field: 'check_status',
title: '状态',
align: 'center',
width: 120,
templet:function(d){
var html='<span style="color:#FF5722">审批不通过</span>';
if(d.check_status==1){
html='<span style="color:#5FB878">审批中</span>';
}
else if(d.check_status==2){
html='<span style="color:#1E9FFF">审批通过</span>';
}
else if(d.check_status==4){
html='<span style="color:#FF5722">撤销</span>';
}
else if(d.check_status==5){
html='<span style="color:#FFB800">已打款</span>';
}
return html;
}
},{
field: 'admin_name',
title: '报销人',
align: 'center',
width: 100
},{
field: 'department',
title: '报销部门',
align: 'center',
width: 150
},{
field: 'code',
title: '报销凭证编号',
width: 150,
},{
field: 'expense_time',
title: '原始单据日期',
align: 'center',
width: 120
},{
field: 'income_month',
title: '入账月份',
align: 'center',
width: 90
},{
field: 'create_time',
title: '录入时间',
align: 'center',
width: 150
},{
field: 'check_user',
title: '当前审核人'
},{
field: 'pay_name',
title: '打款人',
align: 'center',
width: 90
},{
field: 'pay_time',
title: '打款确认时间',
align: 'center',
width: 150
}, {
field: 'right',
fixed: 'right',
title: '操作',
width: 80,
align: 'center',
templet:function(d){
var html='<span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详情</span>';
return html;
}
}
]
]
});
//监听行工具事件
table.on('tool(test)', function(obj) {
var data = obj.data;
if (obj.event === 'view') {
rightpage.open("/finance/expense/view?id="+data.id,"900px");
return;
}
});
}
</script>
{include file="../../base/view/common/layui" base='base' extend="['rightpage']" use="['table','form']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,427 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<link rel="stylesheet" href="{__LAYUI__}/plugin/dtree/dtree.css">
<link rel="stylesheet" href="{__LAYUI__}/plugin/dtree/font/dtreefont.css">
<style>
.layui-form-pane .layui-form-label{color:#999; width:80px; padding:8px 3px;}
.layui-form-item .layui-inline{margin-right:3px; margin-bottom:10px;}
.layui-form-item{margin-bottom:5px;}
.layui-form-item .layui-btn-danger{display:none; margin-top:-8px}
.layui-form-item:hover .layui-btn-danger{display:inline-block;}
.select-1,.select-2{display:none;}
.check-items{overflow-x: auto; padding: 10px 0;}
.flow-flex-row {box-direction: row;
box-orient: horizontal;
-webkit-box-orient: horizontal;
-ms-flex-direction: row;
flex-direction: row;
}
.flow-flexbox { width: 100%;text-align: left;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
display: -webkit-flex;
box-align: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.check-item{width: auto; -ms-flex-negative: 0; flex-shrink: 0;}
.check-item i{font-size:20px; margin-right:3px; color:#4285f4;}
.check-item span{color:#999;margin:0 3px;}
.layui-icon[data-ok]{color:#34a853}
.layui-icon[data-no]{color:#FF5722;}
.check-item-status{color:#999; font-size:12px; margin-left:3px;}
.flow-tips{padding:6px 10px;}
.flow-tips li{padding:5px 0;}
.flow-tips li i{color:#4285f4;}
.flow-tips li span{color:#999; font-size:12px; margin-left:4px;}
.flow-record{padding:10px 10px 0;}
.flow-record .layui-icon {font-size:20px;}
.flow-record .layui-timeline-item{padding-bottom:10px;}
.layui-timeline-content ul{font-size:12px;}
.check-status{color:#999; margin-left:5px;}
.check-remark{padding:6px; margin-top:6px; margin-bottom:10px; border-radius:4px; background-color:#f5f5f5;}
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="page-content">
<h3 class="h3-title">报销详情</h3>
<table class="layui-table">
<tr>
<td class="layui-td-gray2">报销凭证编号</td>
<td>{$detail.code}</td>
<td class="layui-td-gray">入账月份</td>
<td>{$detail.income_month}</td>
<td class="layui-td-gray2">原始单据日期</td>
<td>{$detail.expense_time}</td>
</tr>
<tr>
<td class="layui-td-gray2">报销人</td>
<td>{$detail.create_user}</td>
<td class="layui-td-gray">报销部门</td>
<td>{$detail.department}</td>
<td class="layui-td-gray">报销总费用(元)</td>
<td><span style="color:#1E9FFF">{$detail.amount}</span></td>
</tr>
{if condition="$detail.pay_admin_id > 0"}
<tr>
<td class="layui-td-gray2">打款人</td>
<td>{$detail.pay_admin}</td>
<td class="layui-td-gray">打款时间</td>
<td colspan="3">{$detail.pay_time}</td>
</tr>
{/if}
<tr>
<td class="layui-td-gray2">费用金额</td>
<td colspan="5">
<div>
<table class="layui-table layui-table-min">
<tr>
<th width="100">报销金额(元)</th>
<th width="150">报销类别</th>
<th>备注信息</th>
</tr>
{volist name="$detail.list" id="vo"}
<tr>
<td>{$vo.amount}</td>
<td>{$vo.cate_title}</td>
<td style="text-align:left">{$vo.remarks}</td>
</tr>
{/volist}
</table>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">审核状态</td>
<td>{eq name="$detail.check_status" value="0"}<span style="color:#666666">待审批</span>{/eq}
{eq name="$detail.check_status" value="1"}<span style="color:#4285f4">审批中</span>{/eq}
{eq name="$detail.check_status" value="2"}<span style="color:#34a853">已通过</span>{/eq}
{eq name="$detail.check_status" value="3"}<span style="color:#FF5722">已拒绝</span>{/eq}
{eq name="$detail.check_status" value="4"}<span style="color:#fbbc05">已撤销</span>{/eq}
<span id="showRecord" class="layui-btn layui-btn-xs layui-btn-radius layui-btn-normal" style="margin-left:10px;">查看审批记录</span>
</td>
<td class="layui-td-gray">当前审核人</td>
<td colspan="3">{$detail.check_user}</td>
</tr>
<tr>
<td class="layui-td-gray">审批流程</td>
<td colspan="5">
<div class="flow-flexbox check-items flow-flex-row" id="flowList">
<div class="flow-flexbox check-item flow-flex-row">
<i class="layui-icon layui-icon-add-circle" data-ok=""></i>
<div class="check-item-name">{$detail.create_user}</div>
<div class="check-item-status">创建</div>
<span class="layui-icon layui-icon-right"></span>
</div>
</div>
</td>
</tr>
{if ( $detail.check_status lt 2) AND ( $is_check_admin eq 1) }
{eq name="$flows.flow_type" value="0"}
<tr>
<td class="layui-td-gray">审批节点 <font>*</font></td>
<td colspan="5">
<form class="layui-form">
<input type="radio" name="check_node" lay-filter="check_node" value="1" title="审核结束">
<input type="radio" name="check_node" lay-filter="check_node" value="2" title="下一审批人">
<div class="layui-inline">
<input type="hidden" name="check_admin_ids" value=""><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择下一审批人" lay-verify="required" lay-reqText="请选择下一审批人" class="layui-input">
</div>
</form>
</td>
</tr>
{/eq}
<tr>
<td class="layui-td-gray">审批意见 <font>*</font></td>
<td colspan="5">
<textarea name="content" placeholder="请输入审批意见" class="layui-textarea"></textarea>
</td>
</tr>
{/if}
</table>
<input type="hidden" name="id" value="{$detail.id}">
<input type="hidden" name="flow_type" value="{$flows.flow_type}">
<div id="formBtn" style="padding: 10px 0">
{eq name="$is_check_admin" value='1'}
<span class="layui-btn layui-btn-normal" data-status="1"><i class="layui-icon layui-icon-ok"></i> 通过</span>
<span class="layui-btn layui-btn-danger" data-status="2"><i class="layui-icon layui-icon-close"></i> 拒绝</span>
{/eq}
{if ( $detail.check_status lt 2) AND ( $is_create_admin eq 1) }
<span class="layui-btn layui-btn-primary" data-status="3"><i class="layui-icon layui-icon-reduce-circle"></i> 撤回</span>
{/if}
{if ( $detail.check_status gt 2) AND ( $is_create_admin eq 1) }
<a class="layui-btn" href="/finance/expense/add?id={$detail.id}">重新编辑</a>
{/if}
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form
,dropdown = layui.dropdown
,employeepicker = layui.employeepicker
,layer = layui.layer;
//获取审核信息
$.ajax({
url: "/api/index/get_flow_nodes",
type:'post',
data:{id:$('[name="id"]').val(),type:2},
success: function (e) {
if (e.code == 0) {
console.log(e);
let flowHtml='',list = e.data,record_list='';
for(var f=0;f<list.length;f++){
//审批流程
let checkUser = '',
iconRight ='<span class="layui-icon layui-icon-right"></span>',
iconStatus ='<i class="layui-icon layui-icon-time"></i>',
strStatus ='<div class="check-item-status">待审核</div>';
if(f == list.length-1){
iconRight ='';
}
if(list[f].flow_type == 1 || list[f].flow_type == 2){
checkUser=list[f].flow_type == 1?'部门负责人':'上级部门负责人';
if(list[f].check_list.length>0){
if(list[f].check_list[0].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
else if(list[f].check_list[0].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
else if(list[f].flow_type == 0 ){
checkUser=list[f].user_id_info[0].name;
if(list[f].check_list.length>0){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
for(var m=0;m<list[f].check_list.length;m++){
if(list[f].check_list[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
}
}
}
else if(list[f].flow_type == 3 ){
checkUser='多人或签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
break;
}
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
}
else if(list[f].flow_type == 4){
checkUser='多人会签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
break;
}
if(list[f].user_id_info[m].status == 0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
}
}
}
}
flowHtml+= '<div class="flow-flexbox check-item flow-flex-row" id="flow'+f+'">'+iconStatus+'\
<div class="check-item-name">'+checkUser+'</div>'+strStatus+iconRight+'\
</div>';
//审批历史数据
var sign_type = '',user_check_list='';
if(list[f].check_list.length>0){
if(list[f].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
}
if(list[f].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
}
for(var b=0;b<list[f].check_list.length;b++){
var status_str = '通过了此申请';
if(list[f].check_list[b].status == 2){
status_str = '拒绝了此申请';
}
user_check_list+= '<li style="padding:3px 0"><img src="'+list[f].check_list[b].thumb+'" style="width:22px; height:22px; border-radius:50%; margin-right:8px;" />'+list[f].check_list[b].name+'<span class="check-status">'+list[f].check_list[b].check_time_str+status_str+'</span><div class="check-remark">'+list[f].check_list[b].content+'</div></li>';
}
record_list+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#x1005;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title">第'+(f+1)+'级'+sign_type+'</p>\
<ul>'+user_check_list+'</ul>\
</div>\
</li>';
}
}
$('#flowList').append(flowHtml);
if(record_list == ''){
record_list='<div style="text-align:center; color:#999; padding:10px 10px 20px;">无审批记录</div>';
}
dropdown.render({
elem: '#showRecord'
,trigger: 'click'
,content: ['<div class="flow-record">'
,'<ul>'+record_list+'</ul>'
,'</div>'].join('')
});
for(var f=0;f<list.length;f++){
if(list[f].flow_type == 3 || list[f].flow_type == 4){
var user_list= '';
for(var a=0;a<list[f].user_id_info.length;a++){
if(list[f].user_id_info[a].status==0){
user_list+='<li><i class="layui-icon layui-icon-time"></i> '+list[f].user_id_info[a].name+'<span>待审核此申请</span></li>';
}
else if(list[f].user_id_info[a].status==1){
user_list+='<li><i class="layui-icon layui-icon-ok-circle" data-ok=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已通过此申请</span></li>';
}else if(list[f].user_id_info[a].status==2){
user_list+='<li><i class="layui-icon layui-icon-close" data-no=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已拒绝此申请</span></li>';
}
}
dropdown.render({
elem: '#flow'+f
,trigger: 'hover'
,content: ['<div class="flow-tips">'
,'<ul>'+user_list+'</ul>'
,'</div>'].join('')
});
}
}
}
}
})
//选择人员
$('.layui-form').on('click','[name="check_admin_name"]',function(){
employeepicker.init({
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type:0,
callback:function(ids,names){
$('[name="check_admin_ids"]').val(ids),
$('[name="check_admin_name"]').val(names);
}
});
})
//监听提交
$('#formBtn').on('click','span', function(data){
let id=$('[name="id"]').val();
let content=$('[name="content"]').val();
let check_status=$(this).data('status');
let flow_type = $('input[name="flow_type"]').val();
let check_node=0,check_admin_ids=0;
if(flow_type == 0 && check_status==1){
check_node = $('input[name="check_node"]:checked').val();
check_admin_ids = $('input[name="check_admin_ids"]').val();
if(!check_node){
layer.msg('请选择下一审批节点');
return false;
}
if(check_node == 2 && check_admin_ids==''){
layer.msg('请选择下一审批人');
return false;
}
}
if(check_status ==1 || check_status==2){
if(content==''){
layer.msg('请输入审批意见');
return false;
}
let confirmTips='确定通过该审核?';
if(check_status==2){
confirmTips='确定拒绝该审核?';
}
layer.confirm(confirmTips, function(index){
$.ajax({
url: "/finance/expense/check",
type:'post',
data:{
id:id,
check_node:check_node,
check_admin_ids:check_admin_ids,
status:check_status,
content:content
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.tableIns.reload();
location.reload();
}
}
})
layer.close(index);
});
}
else if(check_status ==3){
layer.prompt({
formType: 2,
title: '请输入撤回理由',
area: ['500px', '120px'] //自定义文本域宽高
}, function(value, index, elem){
$.ajax({
url: "/finance/expense/check",
type:'post',
data:{
id:id,
status:check_status,
content:value
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.tableIns.reload();
location.reload();
}
}
})
layer.close(index);
});
}
return false;
});
}
</script>
{include file="../../base/view/common/layui" base='base' extend="['employeepicker']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,499 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<style>
.check-items{overflow-x: auto; padding: 10px 0;}
.flow-flex-row {box-direction: row;
box-orient: horizontal;
-webkit-box-orient: horizontal;
-ms-flex-direction: row;
flex-direction: row;
}
.flow-flexbox { width: 100%;text-align: left;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
display: -webkit-flex;
box-align: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.check-item{width: auto; -ms-flex-negative: 0; flex-shrink: 0;}
.check-item i{font-size:20px; margin-right:3px; color:#4285f4;}
.check-item span{color:#999;margin:0 3px;}
.layui-icon[data-ok]{color:#34a853}
.layui-icon[data-no]{color:#FF5722;}
.check-item-status{color:#999; font-size:12px; margin-left:3px;}
.flow-tips{padding:6px 10px;}
.flow-tips li{padding:5px 0;}
.flow-tips li i{color:#4285f4;}
.flow-tips li span{color:#999; font-size:12px; margin-left:4px;}
.flow-record{padding:10px 10px 0;}
.flow-record .layui-icon {font-size:20px;}
.flow-record .layui-timeline-item{padding-bottom:10px;}
.layui-timeline-content ul{font-size:12px;}
.check-status{color:#999; margin-left:5px;}
.check-remark{padding:6px; margin-top:6px; margin-bottom:10px; border-radius:4px; background-color:#f5f5f5;}
.layui-table-min{margin-bottom:6px;}
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="page-content">
<h3 class="h3-title">发票信息</h3>
<table class="layui-table">
<tr>
<td class="layui-td-gray">发票金额</td>
<td>
{$detail.amount}
</td>
<td class="layui-td-gray">发票类型</td>
<td>
{eq name="$detail.invoice_type" value="1"}增值税专用发票{/eq}
{eq name="$detail.invoice_type" value="2"}增值税普通发票{/eq}
</td>
<td class="layui-td-gray">发票主体</td>
<td>
{volist name=":oa_invoice_subject()" id="vo"}
{eq name="$vo.id" value="$detail.invoice_subject"}{$vo.title}{/eq}
{/volist}
</td>
</tr>
<tr>
<td class="layui-td-gray">抬头类型</td>
<td>
{eq name="$detail.type" value="1"}企业{/eq}
{eq name="$detail.type" value="2"}个人{/eq}
</td>
<td class="layui-td-gray">发票抬头</td>
<td>{$detail.invoice_title}</td>
<td class="layui-td-gray">电话号码</td>
<td>{$detail.invoice_phone}</td>
</tr>
<tr class="invoice-type" {eq name="$detail.type" value="2"}style="display:none"{/eq}>
<td class="layui-td-gray2">纳税人识别号</td>
<td>{$detail.invoice_tax}</td>
<td class="layui-td-gray">开户行</td>
<td>{$detail.invoice_bank}</td>
<td class="layui-td-gray">银行账号</td>
<td>{$detail.invoice_account}</td>
</tr>
<tr class="invoice-type" {eq name="$detail.type" value="2"}style="display:none"{/eq}>
<td class="layui-td-gray2">银行营业网点</td>
<td>{$detail.invoice_banking}</td>
<td class="layui-td-gray">地址</td>
<td colspan="3">{$detail.invoice_address}</td>
</tr>
{notempty name="$detail.remark"}
<tr>
<td class="layui-td-gray">备注信息</td>
<td colspan="5">{$detail.remark}</td>
</tr>
{/notempty}
<tr>
<td class="layui-td-gray">发票状态</td>
<td colspan="5">
{if condition="($detail.check_status == 0)"}
<span style="color:#009688">待审</span>
{elseif condition="($detail.check_status == 1)"}
<span style="color:#009688">审核中</span>
{elseif condition="($detail.check_status == 2)"}
<span style="color:#1E9FFF">审核通过,待开具</span>
{elseif condition="($detail.check_status == 3)"}
<span style="color:#FF5722">审核不通过 【原因:{$detail.check_remark}】</span>
{elseif condition="($detail.check_status == 4)"}
<span style="color:#FF5722">撤销 【原因:{$detail.check_remark}】</span>
{elseif condition="($detail.check_status == 5)"}
<span style="color:#1E9FFF">已开具</span>
{elseif condition="($detail.check_status == 10)"}
<span style="color:#FF5722">已作废</span>
{/if}
<span id="showRecord" class="layui-btn layui-btn-xs layui-btn-radius layui-btn-normal" style="margin-left:10px;">查看审批记录</span>
</td>
</tr>
{if condition="$detail.open_admin_id > 0"}
<tr>
<td class="layui-td-gray2">开票人</td>
<td>{$detail.open_admin}</td>
<td class="layui-td-gray2">开票时间</td>
<td>{$detail.open_time}</td>
<td class="layui-td-gray2">发票号码</td>
<td>{$detail.code}</td>
</tr>
{/if}
</table>
<h3 class="h3-title2">到账信息</h3>
<form class="layui-form">
<table class="layui-table">
<tr>
<td class="layui-td-gray">到账状态</td>
<td>
{if condition="($detail.is_cash == 0)"}
<span style="color:#FF5722">未到账</span>
{elseif condition="($detail.is_cash == 1)"}
<span style="color:#1E9FFF">部分到账</span>
{elseif condition="($detail.is_cash == 2)"}
<span style="color:#009688">全部到账</span>
{/if}
</td>
<td class="layui-td-gray2">未到账金额(元)</td>
<td style="color:#FF5722">{$detail.not_income}</td>
<td class="layui-td-gray2">已到账金额(元)</td>
<td style="color:#1E9FFF">{$detail.enter_amount}</td>
</tr>
<tr>
<td class="layui-td-gray">到账记录</td>
<td colspan="5">
<table id="interfix" class="layui-table layui-table-min">
<tr>
<th style="width:200px;">到账日期</th>
<th style="width:200px;">到帐金额(元)</th>
<th>备注</th>
<th style="width:100px;">操作</th>
</tr>
{empty name="$detail.income"}
<tr class="none_interfix">
<td colspan="4" style="text-align: center;">暂无到账记录</td>
</tr>
{else/}
{volist name="$detail.income" id="vo"}
<tr class="more_interfix">
<td>{$vo.enter_time | date='Y-m-d'}</td>
<td>{$vo.amount}</td>
<td style="text-align:left;">{$vo.remarks}</td>
<td><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="remove" data-id="{$vo.id}" data-inid="{$id}">删除</a></td>
</tr>
{/volist}
{/empty}
</table>
{if condition="($detail.is_cash lt 2)"}
<div><button class="layui-btn layui-btn-sm layui-btn-normal" type="button" id="addInterfix">+ 添加到账记录</button></div>
{/if}
</td>
</tr>
</table>
<div class="layui-form-item" style="padding-top:10px; text-align:center">
<input name="inid" id="inid" type="hidden" value="{$id}">
<input name="enter_type" id="enter_type" type="hidden" value="1">
{if condition="($detail.is_cash lt 2)"}
<button class="layui-btn" lay-submit="" lay-filter="webform">保存到账记录</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
{/if}
{if condition="($detail.is_cash eq 0)"}
<span class="layui-btn layui-btn-danger" lay-event="all">全部到账</span>
{/if}
{if condition="($detail.is_cash eq 1)"}
<span class="layui-btn layui-btn-danger" lay-event="all">剩余部分全部到账</span>
{/if}
{if condition="($detail.is_cash gt 0)"}
<span class="layui-btn layui-btn-warm" lay-event="refue">全部反到账</span>
{/if}
</div>
</form>
<input type="hidden" name="id" value="{$detail.id}">
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form
,layer = layui.layer
,laydate = layui.laydate
,dropdown = layui.dropdown
,table = layui.table;
//获取审核信息
$.ajax({
url: "/api/index/get_flow_nodes",
type:'post',
data:{id:$('[name="id"]').val(),type:3},
success: function (e) {
if (e.code == 0) {
console.log(e);
let flowHtml='',list = e.data,record_list='';
for(var f=0;f<list.length;f++){
//审批流程
let checkUser = '',
iconRight ='<span class="layui-icon layui-icon-right"></span>',
iconStatus ='<i class="layui-icon layui-icon-time"></i>',
strStatus ='<div class="check-item-status">待审核</div>';
if(f == list.length-1){
iconRight ='';
}
if(list[f].flow_type == 1 || list[f].flow_type == 2){
checkUser=list[f].flow_type == 1?'部门负责人':'上级部门负责人';
if(list[f].check_list.length>0){
if(list[f].check_list[0].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
else if(list[f].check_list[0].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
else if(list[f].flow_type == 0 ){
checkUser=list[f].user_id_info[0].name;
if(list[f].check_list.length>0){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
for(var m=0;m<list[f].check_list.length;m++){
if(list[f].check_list[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
}
}
}
else if(list[f].flow_type == 3 ){
checkUser='多人或签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
break;
}
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
}
else if(list[f].flow_type == 4){
checkUser='多人会签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
break;
}
if(list[f].user_id_info[m].status == 0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
}
}
}
}
flowHtml+= '<div class="flow-flexbox check-item flow-flex-row" id="flow'+f+'">'+iconStatus+'\
<div class="check-item-name">'+checkUser+'</div>'+strStatus+iconRight+'\
</div>';
//审批历史数据
var sign_type = '',user_check_list='';
if(list[f].check_list.length>0){
if(list[f].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
}
if(list[f].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
}
for(var b=0;b<list[f].check_list.length;b++){
var status_str = '通过了此申请';
if(list[f].check_list[b].status == 2){
status_str = '拒绝了此申请';
}
user_check_list+= '<li style="padding:3px 0"><img src="'+list[f].check_list[b].thumb+'" style="width:22px; height:22px; border-radius:50%; margin-right:8px;" />'+list[f].check_list[b].name+'<span class="check-status">'+list[f].check_list[b].check_time_str+status_str+'</span><div class="check-remark">'+list[f].check_list[b].content+'</div></li>';
}
record_list+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#x1005;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title">第'+(f+1)+'级'+sign_type+'</p>\
<ul>'+user_check_list+'</ul>\
</div>\
</li>';
}
}
$('#flowList').append(flowHtml);
if(record_list == ''){
record_list='<div style="text-align:center; color:#999; padding:10px 10px 20px;">无审批记录</div>';
}
dropdown.render({
elem: '#showRecord'
,trigger: 'click'
,content: ['<div class="flow-record">'
,'<ul>'+record_list+'</ul>'
,'</div>'].join('')
});
for(var f=0;f<list.length;f++){
if(list[f].flow_type == 3 || list[f].flow_type == 4){
var user_list= '';
for(var a=0;a<list[f].user_id_info.length;a++){
if(list[f].user_id_info[a].status==0){
user_list+='<li><i class="layui-icon layui-icon-time"></i> '+list[f].user_id_info[a].name+'<span>待审核此申请</span></li>';
}
else if(list[f].user_id_info[a].status==1){
user_list+='<li><i class="layui-icon layui-icon-ok-circle" data-ok=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已通过此申请</span></li>';
}else if(list[f].user_id_info[a].status==2){
user_list+='<li><i class="layui-icon layui-icon-close" data-no=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已拒绝此申请</span></li>';
}
}
dropdown.render({
elem: '#flow'+f
,trigger: 'hover'
,content: ['<div class="flow-tips">'
,'<ul>'+user_list+'</ul>'
,'</div>'].join('')
});
}
}
}
}
})
//添加表格行
$('#addInterfix').on('click',function(){
var html = '';
html += '<tr class="more_interfix">';
html += '<td><input type="text" class="layui-input enter-time" name="enter_time[]" readonly lay-verify="required" lay-reqText="请选择到账日期">';
html += '<td><input type="text" class="layui-input" name="amount[]" lay-verify="required|number" lay-reqText="请输入到账金额,数字"></td>';
html += '<td><input type="text" class="layui-input" name="remarks[]"></td>';
html += '<td><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></td>';
html += '</tr>';
$("#interfix").find('.none_interfix').remove();
$("#interfix").append(html);
form.render();
lay('.enter-time').each(function () {
laydate.render({
elem: this,
trigger: 'click',
showBottom:false
});
});
});
//删除表格
$('#interfix').on('click', '[lay-event="del"]', function() {
$(this).parents(".more_interfix").remove();
if($("#interfix").find('.more_interfix').length<1){
$("#interfix").append('<tr class="none_interfix"><td colspan="4" style="text-align: center;">暂无到账记录</td></tr>');
}
});
//删除到账记录
$('#interfix').on('click', '[lay-event="remove"]', function() {
var that=$(this);
var id=that.data('id');
var inid=that.data('inid');
layer.confirm('确定要删除该到账记录?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/finance/income/delete",
data:{id:id,inid:inid},
success:function(res){
layer.msg(res.msg);
if(res.code==0){
parent.tableIns.reload();
window.setTimeout(function(){
location.reload();
},1200)
}
}
})
})
});
//监听提交
form.on('submit(webform)', function(data){
console.log(data.field);
if($("#interfix").find('.enter-time').length<1){
layer.msg('请添加到账记录');
return false;
}
$.ajax({
url: "/finance/income/add",
type:'post',
data:data.field,
success:function(res){
layer.msg(res.msg);
if(res.code==0){
parent.tableIns.reload();
window.setTimeout(function(){
location.reload();
},1200)
}
}
})
return false;
});
$('.page-content').on('click', '[lay-event="refue"]', function () {
var inid=$('#inid').val();
layer.confirm('确定要全部反到账?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/finance/income/add",
data:{inid:inid,enter_type:3},
success:function(res){
layer.msg(res.msg);
if(res.code==0){
parent.tableIns.reload();
window.setTimeout(function(){
location.reload();
},1200)
}
}
})
})
return false;
})
$('.page-content').on('click', '[lay-event="all"]', function () {
var inid=$('#inid').val();
layer.confirm('确定已经全部到账?', {icon: 3, title:'提示'}, function(idx){
layer.prompt({title: '选择到账日期', formType: 3,value :'',success: function(layero, index){
$('.layui-layer-input').attr('readonly',true);
lay('.layui-layer-input').each(function () {
laydate.render({
elem: this,
trigger: 'click',
showBottom:false
});
});
layer.close(idx);
}
}, function(enter_time, index){
if(enter_time ==''){
layer.msg('选择到账日期');
return false;
}
$.ajax({
url: "/finance/income/add",
data:{inid:inid,enter_type:2,enter_time:enter_time},
success:function(res){
layer.msg(res.msg);
if(res.code==0){
parent.tableIns.reload();
window.setTimeout(function(){
location.reload();
},1200)
}
}
})
})
})
return false;
})
}
</script>
{include file="../../base/view/common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,4 +1,4 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
@ -53,7 +53,7 @@
elem: '#test',
title: '到账列表',
toolbar: '#toolbarDemo',
url: "/home/income/index", //数据接口
url: "/finance/income/index", //数据接口
page: true, //开启分页
limit: 20,
cols: [
@ -67,7 +67,7 @@
field: 'is_cash',
title: '到账状态',
align: 'center',
width: 100,
width: 90,
templet:function(d){
var html='<span style="color:#FF5722">未到账</span>';
if(d.is_cash==1){
@ -91,7 +91,7 @@
}, {
field: 'invoice_title',
title: '发票抬头',
width: 300,
minWidth: 300,
templet:function(d){
var html='';
if(d.type==1){
@ -141,7 +141,7 @@
field: 'code',
title: '发票号码',
align: 'center',
width: 136
width: 120
},{
field: 'open_time',
title: '开票时间',
@ -166,16 +166,16 @@
table.on('tool(test)', function(obj) {
var data = obj.data;
if (obj.event === 'add') {
rightpage.open("/home/income/add?id="+data.id);
rightpage.open("/finance/income/add?id="+data.id);
return;
}
if (obj.event === 'view') {
rightpage.open("/home/income/view?id="+data.id);
rightpage.open("/finance/income/view?id="+data.id);
return;
}
});
}
</script>
{include file="common/layui" base='base' extend="['rightpage']" use="['table','form']" callback="init" /}
{include file="../../base/view/common/layui" base='base' extend="['rightpage']" use="['table','form']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,344 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<style>
.check-items{overflow-x: auto; padding: 10px 0;}
.flow-flex-row {box-direction: row;
box-orient: horizontal;
-webkit-box-orient: horizontal;
-ms-flex-direction: row;
flex-direction: row;
}
.flow-flexbox { width: 100%;text-align: left;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
display: -webkit-flex;
box-align: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.check-item{width: auto; -ms-flex-negative: 0; flex-shrink: 0;}
.check-item i{font-size:20px; margin-right:3px; color:#4285f4;}
.check-item span{color:#999;margin:0 3px;}
.layui-icon[data-ok]{color:#34a853}
.layui-icon[data-no]{color:#FF5722;}
.check-item-status{color:#999; font-size:12px; margin-left:3px;}
.flow-tips{padding:6px 10px;}
.flow-tips li{padding:5px 0;}
.flow-tips li i{color:#4285f4;}
.flow-tips li span{color:#999; font-size:12px; margin-left:4px;}
.flow-record{padding:10px 10px 0;}
.flow-record .layui-icon {font-size:20px;}
.flow-record .layui-timeline-item{padding-bottom:10px;}
.layui-timeline-content ul{font-size:12px;}
.check-status{color:#999; margin-left:5px;}
.check-remark{padding:6px; margin-top:6px; margin-bottom:10px; border-radius:4px; background-color:#f5f5f5;}
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="page-content">
<h3 class="h3-title">发票信息</h3>
<table class="layui-table">
<tr>
<td class="layui-td-gray">发票金额(元)</td>
<td>
{$detail.amount}
</td>
<td class="layui-td-gray">发票类型</td>
<td>
{eq name="$detail.invoice_type" value="1"}增值税专用发票{/eq}
{eq name="$detail.invoice_type" value="2"}增值税普通发票{/eq}
</td>
<td class="layui-td-gray">发票主体</td>
<td>
{volist name=":oa_invoice_subject()" id="vo"}
{eq name="$vo.id" value="$detail.invoice_subject"}{$vo.title}{/eq}
{/volist}
</td>
</tr>
<tr>
<td class="layui-td-gray">抬头类型</td>
<td>
{eq name="$detail.type" value="1"}企业{/eq}
{eq name="$detail.type" value="2"}个人{/eq}
</td>
<td class="layui-td-gray">发票抬头</td>
<td>{$detail.invoice_title}</td>
<td class="layui-td-gray">电话号码</td>
<td>{$detail.invoice_phone}</td>
</tr>
<tr class="invoice-type" {eq name="$detail.type" value="2"}style="display:none"{/eq}>
<td class="layui-td-gray2">纳税人识别号</td>
<td>{$detail.invoice_tax}</td>
<td class="layui-td-gray">开户行</td>
<td>{$detail.invoice_bank}</td>
<td class="layui-td-gray">银行账号</td>
<td>{$detail.invoice_account}</td>
</tr>
<tr class="invoice-type" {eq name="$detail.type" value="2"}style="display:none"{/eq}>
<td class="layui-td-gray2">银行营业网点</td>
<td>{$detail.invoice_banking}</td>
<td class="layui-td-gray">地址</td>
<td colspan="3">{$detail.invoice_address}</td>
</tr>
{notempty name="$detail.remark"}
<tr>
<td class="layui-td-gray">备注信息</td>
<td colspan="5">{$detail.remark}</td>
</tr>
{/notempty}
<tr>
<td class="layui-td-gray">发票状态</td>
<td colspan="5">
{if condition="($detail.check_status == 0)"}
<span style="color:#009688">待审</span>
{elseif condition="($detail.check_status == 1)"}
<span style="color:#009688">审核中</span>
{elseif condition="($detail.check_status == 2)"}
<span style="color:#1E9FFF">审核通过,待开具</span>
{elseif condition="($detail.check_status == 3)"}
<span style="color:#FF5722">审核不通过 【原因:{$detail.check_remark}】</span>
{elseif condition="($detail.check_status == 4)"}
<span style="color:#FF5722">撤销 【原因:{$detail.check_remark}】</span>
{elseif condition="($detail.check_status == 5)"}
<span style="color:#1E9FFF">已开具</span>
{elseif condition="($detail.check_status == 10)"}
<span style="color:#FF5722">已作废</span>
{/if}
<span id="showRecord" class="layui-btn layui-btn-xs layui-btn-radius layui-btn-normal" style="margin-left:10px;">查看审批记录</span>
</td>
</tr>
{if condition="$detail.open_admin_id > 0"}
<tr>
<td class="layui-td-gray2">开票人</td>
<td>{$detail.open_admin}</td>
<td class="layui-td-gray2">开票时间</td>
<td>{$detail.open_time}</td>
<td class="layui-td-gray2">发票号码</td>
<td>{$detail.code}</td>
</tr>
{/if}
</table>
<h3 class="h3-title2">到账信息</h3>
<form class="layui-form">
<table class="layui-table">
<tr>
<td class="layui-td-gray">到账状态</td>
<td>
{if condition="($detail.is_cash == 0)"}
<span style="color:#FF5722">未到账</span>
{elseif condition="($detail.is_cash == 1)"}
<span style="color:#1E9FFF">部分到账</span>
{elseif condition="($detail.is_cash == 2)"}
<span style="color:#009688">全部到账</span>
{/if}
</td>
<td class="layui-td-gray2">未到账金额(元)</td>
<td style="color:#FF5722">{$detail.not_income}</td>
<td class="layui-td-gray2">已到账金额(元)</td>
<td style="color:#1E9FFF">{$detail.enter_amount}</td>
</tr>
<tr>
<td class="layui-td-gray">到账记录</td>
<td colspan="5">
<table class="layui-table layui-table-min">
<tr>
<th style="width:150px;">到账日期</th>
<th style="width:150px;">到帐金额(元)</th>
<th>备注</th>
<th style="width:100px;">登记人</th>
<th style="width:150px;">登记时间</th>
</tr>
{empty name="$detail.income"}
<tr class="none_interfix">
<td colspan="5" style="text-align: center;">暂无到账记录</td>
</tr>
{else/}
{volist name="$detail.income" id="vo"}
<tr class="more_interfix">
<td>{$vo.enter_time | date='Y-m-d'}</td>
<td>{$vo.amount}</td>
<td style="text-align:left;">{$vo.remarks}</td>
<td>{$vo.admin}</td>
<td>{$vo.create_time | date='Y-m-d H:i:s'}</td>
</tr>
{/volist}
{/empty}
</table
</td>
</tr>
</table>
</form>
<input type="hidden" name="id" value="{$detail.id}">
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var dropdown = layui.dropdown;
//获取审核信息
$.ajax({
url: "/api/index/get_flow_nodes",
type:'post',
data:{id:$('[name="id"]').val(),type:3},
success: function (e) {
if (e.code == 0) {
console.log(e);
let flowHtml='',list = e.data,record_list='';
for(var f=0;f<list.length;f++){
//审批流程
let checkUser = '',
iconRight ='<span class="layui-icon layui-icon-right"></span>',
iconStatus ='<i class="layui-icon layui-icon-time"></i>',
strStatus ='<div class="check-item-status">待审核</div>';
if(f == list.length-1){
iconRight ='';
}
if(list[f].flow_type == 1 || list[f].flow_type == 2){
checkUser=list[f].flow_type == 1?'部门负责人':'上级部门负责人';
if(list[f].check_list.length>0){
if(list[f].check_list[0].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
else if(list[f].check_list[0].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
else if(list[f].flow_type == 0 ){
checkUser=list[f].user_id_info[0].name;
if(list[f].check_list.length>0){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
for(var m=0;m<list[f].check_list.length;m++){
if(list[f].check_list[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
}
}
}
else if(list[f].flow_type == 3 ){
checkUser='多人或签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
break;
}
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
}
else if(list[f].flow_type == 4){
checkUser='多人会签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
break;
}
if(list[f].user_id_info[m].status == 0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
}
}
}
}
flowHtml+= '<div class="flow-flexbox check-item flow-flex-row" id="flow'+f+'">'+iconStatus+'\
<div class="check-item-name">'+checkUser+'</div>'+strStatus+iconRight+'\
</div>';
//审批历史数据
var sign_type = '',user_check_list='';
if(list[f].check_list.length>0){
if(list[f].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
}
if(list[f].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
}
for(var b=0;b<list[f].check_list.length;b++){
var status_str = '通过了此申请';
if(list[f].check_list[b].status == 2){
status_str = '拒绝了此申请';
}
user_check_list+= '<li style="padding:3px 0"><img src="'+list[f].check_list[b].thumb+'" style="width:22px; height:22px; border-radius:50%; margin-right:8px;" />'+list[f].check_list[b].name+'<span class="check-status">'+list[f].check_list[b].check_time_str+status_str+'</span><div class="check-remark">'+list[f].check_list[b].content+'</div></li>';
}
record_list+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#x1005;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title">第'+(f+1)+'级'+sign_type+'</p>\
<ul>'+user_check_list+'</ul>\
</div>\
</li>';
}
}
$('#flowList').append(flowHtml);
if(record_list == ''){
record_list='<div style="text-align:center; color:#999; padding:10px 10px 20px;">无审批记录</div>';
}
dropdown.render({
elem: '#showRecord'
,trigger: 'click'
,content: ['<div class="flow-record">'
,'<ul>'+record_list+'</ul>'
,'</div>'].join('')
});
for(var f=0;f<list.length;f++){
if(list[f].flow_type == 3 || list[f].flow_type == 4){
var user_list= '';
for(var a=0;a<list[f].user_id_info.length;a++){
if(list[f].user_id_info[a].status==0){
user_list+='<li><i class="layui-icon layui-icon-time"></i> '+list[f].user_id_info[a].name+'<span>待审核此申请</span></li>';
}
else if(list[f].user_id_info[a].status==1){
user_list+='<li><i class="layui-icon layui-icon-ok-circle" data-ok=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已通过此申请</span></li>';
}else if(list[f].user_id_info[a].status==2){
user_list+='<li><i class="layui-icon layui-icon-close" data-no=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已拒绝此申请</span></li>';
}
}
dropdown.render({
elem: '#flow'+f
,trigger: 'hover'
,content: ['<div class="flow-tips">'
,'<ul>'+user_list+'</ul>'
,'</div>'].join('')
});
}
}
}
}
})
}
</script>
{include file="../../base/view/common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,15 +1,17 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
{block name="style"}
<link rel="stylesheet" href="{__LAYUI__}/plugin/dtree/dtree.css">
<link rel="stylesheet" href="{__LAYUI__}/plugin/dtree/font/dtreefont.css">
<style>
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
.layui-form-radio{margin-right:6px}
.layui-form-radio>i{margin-right:3px; }
</style>
<link rel="stylesheet" href="{__JS__}/module/dtree/dtree.css">
<link rel="stylesheet" href="{__JS__}/module/dtree/font/dtreefont.css">
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<form class="layui-form page-content">
<h3 class="h3-title">申请开票</h3>
{if condition="($id == 0)"}
<table class="layui-table">
@ -30,7 +32,7 @@
<td>
<select name="invoice_subject" lay-verify="required" lay-reqText="请选择开票主体">
<option value="">请选择开票主体</option>
{volist name=":get_invoice_subject()" id="vo"}
{volist name=":oa_invoice_subject()" id="vo"}
<option value="{$vo.id}">{$vo.title}</option>
{/volist}
</select>
@ -66,16 +68,20 @@
<td colspan="5"><textarea name="remark" placeholder="请输入备注信息" class="layui-textarea"></textarea></td>
</tr>
<tr>
<td class="layui-td-gray">发票审核人<span style="color: red">*</span></td>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<div style="width:300px;">
<select name="check_admin_id" lay-verify="required" lay-reqText="请选择发票审核人">
<option value="">请选择发票审核人</option>
{volist name=":get_check_user(3)" id="vo"}
<option value="{$vo.uid}">{$vo.user}</option>
{/volist}
</select>
</div>
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td colspan="5">
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>
</td>
</tr>
</table>
@ -98,7 +104,7 @@
<td>
<select name="invoice_subject" lay-verify="required" lay-reqText="请选择开票主体">
<option value="">请选择开票主体</option>
{volist name=":get_invoice_subject()" id="vo"}
{volist name=":oa_invoice_subject()" id="vo"}
<option value="{$vo.id}" {eq name="$vo.id" value="$detail.invoice_subject"}selected{/eq}>{$vo.title}</option>
{/volist}
</select>
@ -134,16 +140,20 @@
<td colspan="5"><textarea name="remark" placeholder="请输入备注信息" class="layui-textarea">{$detail.remark}</textarea></td>
</tr>
<tr>
<td class="layui-td-gray">发票审核人<span style="color: red">*</span></td>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<div style="width:300px;">
<select name="check_admin_id" lay-verify="required" lay-reqText="请选择发票审核人">
<option value="">请选择发票审核人</option>
{volist name=":get_check_user(3)" id="vo"}
<option value="{$vo.uid}" {eq name="$vo.uid" value="$detail.check_admin_id"}selected{/eq}>{$vo.user}</option>
{/volist}
</select>
</div>
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
<option value="">--请选择--</option>
{volist name="flows" id="vo"}
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
{/volist}
</select>
</td>
</tr>
<tr id="flow_tr">
<td class="layui-td-gray">审核人<font>*</font></td>
<td colspan="5">
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>
</td>
</tr>
</table>
@ -164,6 +174,7 @@
function init(layui){
var form = layui.form
,layer = layui.layer
,employeepicker = layui.employeepicker
,laydate = layui.laydate;
//选择收件人类型
@ -175,19 +186,96 @@
$('.invoice-type').show();
}
});
//选择人员
$('.layui-form').on('click','[name="check_admin_name"]',function(){
if($('[name="flow_id"]').val()==''){
layer.msg('请先选择审批流程');
return false;
}
employeepicker.init({
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type:0,
callback:function(ids,names){
$('[name="check_admin_ids"]').val(ids),
$('[name="check_admin_name"]').val(names);
}
});
})
form.on('select(flowtype)', function(data){
var check_type = data.elem[data.elem.selectedIndex].title;
var formHtml='<td class="layui-td-gray">审核人<font>*</font></td>\
<td colspan="5">\
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>\
</td>';
if(check_type == 2){
$('#flow_tr').html(formHtml);
form.render();
}
else{
$.ajax({
url: "/api/index/get_flow_users",
type:'post',
data:{id:data.value},
success: function (e) {
if (e.code == 0) {
var flowLi='';
for(var a=0;a<e.data.length;a++){
var userList='',sign_type = '';
if(e.data[a].flow_type==1){
userList+= '<li style="padding:3px 0">当前部门负责人</li>';
}
else if(e.data[a].flow_type==2){
userList+= '<li style="padding:3px 0">上级部门负责人</li>';
}
else{
if(e.data[a].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
}
if(e.data[a].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
}
for(var b=0;b<e.data[a].user_id_info.length;b++){
userList+= '<li style="padding:3px 0"><img src="'+e.data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+e.data[a].user_id_info[b].name+'</li>';
}
}
flowLi+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title"><strong>第'+(a+1)+'级审批</strong>'+sign_type+'</p>\
<ul>'+userList+'</ul>\
</div>\
</li>';
}
formHtml = '<td class="layui-td-gray">审批流程</td>\
<td colspan="5">\
<ul id="flowList" class="layui-timeline">'+flowLi+'</ul>\
</td>';
$('#flow_tr').html(formHtml);
}
}
})
}
});
//监听提交
form.on('submit(webform)', function(data){
form.on('submit(webform)', function(data){
$.ajax({
url: "/home/invoice/add",
url: "/finance/invoice/add",
type:'post',
data:data.field,
success:function(e){
layer.msg(e.msg);
if(e.code==0){
window.setTimeout(function(){
parent.location.reload();
},1200)
if (e.code == 0) {
parent.tableIns.reload();
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
}
})
@ -196,6 +284,6 @@
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{include file="../../base/view/common/layui" base='base' extend="['employeepicker']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,284 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<form class="layui-form layui-form-bar">
<div id="barDate" class="layui-input-inline">
<div class="layui-input-inline" style="width:110px;">
<input type="text" class="layui-input" id="start_time" placeholder="选择时间区间" readonly name="start_time">
</div>
~
<div class="layui-input-inline" style="width:110px;">
<input type="text" class="layui-input" id="end_time" placeholder="选择时间区间" readonly name="end_time">
</div>
</div>
<div class="layui-input-inline">
<select name="check_status">
<option value="">请选择状态</option>
<option value="2">审核通过,待开具</option>
<option value="5">已开具</option>
<option value="10">已作废</option>
</select>
</div>
<button class="layui-btn layui-btn-danger" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<h3 class="h3-title" style="height:32px;">发票列表</h3>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns=null;
function init(layui) {
var table = layui.table,
rightpage = layui.rightpage,
form = layui.form,
laydate = layui.laydate;
//日期范围
laydate.render({
elem: '#barDate',
range: ['#start_time', '#end_time']
});
//监听搜索提交
form.on('submit(webform)', function(data){
let f=data.field;
tableIns.reload({where:{check_status:f.check_status,start_time:f.start_time,end_time:f.end_time},page:{curr:1}});
return false;
});
tableIns = table.render({
elem: '#test',
title: '发票列表',
toolbar: '#toolbarDemo',
url: "/finance/invoice/checkedlist", //数据接口
page: true, //开启分页
limit: 20,
cols: [
[
{
field: 'id',
title: 'ID号',
align: 'center',
width: 80
}, {
field: 'invoice_title',
title: '开票抬头',
minWidth: 300,
templet:function(d){
var html='';
if(d.type==1){
html='<span class="layui-badge layui-bg-blue">企业</span> '+d.invoice_title;
}
else if(d.type==2){
html='<span class="layui-badge layui-bg-green">个人</span> '+d.invoice_title;
}
return html;
}
},{
field: 'amount',
title: '开票金额(元)',
align: 'right',
style: 'color:#1E9FFF',
width: 100,
},{
field: 'invoice_type',
title: '开票类型',
align: 'center',
width: 90,
templet:function(d){
var html='-';
if(d.invoice_type==1){
html='<span style="color:#1E9FFF">专票</span>';
}
else if(d.invoice_type==2){
html='<span style="color:#5FB878">普票</span>';
}
return html;
}
},{
field: 'check_status',
title: '发票状态',
align: 'center',
width: 100,
templet:function(d){
var html='<span style="color:#FF5722">待审</span>';
if(d.check_status==1){
html='<span style="color:#FFB800">审核中</span>';
}
else if(d.check_status==2){
html='<span style="color:#5FB878">待开具</span>';
}
else if(d.check_status==3){
html='<span style="color:#FF5722">审核不通过</span>';
}
else if(d.check_status==4){
html='<span style="color:#FF5722">撤销</span>';
}
else if(d.check_status==5){
html='<span style="color:#1E9FFF">已开具</span>';
}
else if(d.check_status==10){
html='<span style="color:#FF5722">已作废</span>';
}
return html;
}
},{
field: 'name',
title: '申请人',
align: 'center',
width: 100
},{
field: 'department_name',
title: '所属部门',
align: 'center',
width: 120
},{
field: 'create_time',
title: '申请时间',
align: 'center',
width: 150
},{
field: 'open_name',
title: '开票人',
align: 'center',
width: 90
},{
field: 'open_time',
title: '开票时间',
align: 'center',
width: 100
},{
field: 'code',
title: '发票号码',
align: 'center',
width: 132
}, {
field: 'right',
fixed: 'right',
title: '操作',
width: 168,
align: 'center',
templet:function(d){
//0待审、1审批中、2通过、3失败、4撤销、5已开具、10已作废
var html='<div class="layui-btn-group">';
var btn1='<span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详情</span>';
var btn2='<span class="layui-btn layui-btn-warm layui-btn-xs" lay-event="open">标记为开票</span>';
var btn3='<span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disabled">作废</span>';
html+=btn1;
if(d.check_status==2){
html+=btn2;
}
if(d.check_status==5 && d.open_admin_id==login_user){
html+=btn2+btn3;
}
html+='</div>';
return html;
}
}
]
]
});
//监听行工具事件
table.on('tool(test)', function(obj) {
var data = obj.data;
if (obj.event === 'view') {
rightpage.open("/finance/invoice/view?id="+data.id,"900px");
return;
}
if(obj.event === 'open'){
layer.open({
type: 1
,title: '标记为已开票'
,area: '368px;'
,id: 'LAY_module' //设定一个id防止重复弹出
,btn: ['确定', '取消']
,btnAlign: 'c'
,content: '<div style="padding-top:15px;">\
<div class="layui-form-item">\
<label class="layui-form-label">发票号码</label>\
<div class="layui-input-inline">\
<input type="text" name="code" autocomplete="off" value="'+data.code+'" placeholder="请输入发票号码" class="layui-input">\
</div>\
</div>\
<div class="layui-form-item">\
<label class="layui-form-label">开票日期</label>\
<div class="layui-input-inline">\
<input type="text" id="open_time" name="open_time" autocomplete="off" value="'+data.open_time+'" placeholder="请选择实际开票日期" class="layui-input">\
</div>\
</div>\
<div class="layui-form-item">\
<label class="layui-form-label">物流单号</label>\
<div class="layui-input-inline">\
<input type="text" name="delivery" autocomplete="off" value="'+data.delivery+'" placeholder="请输入物流快递单号" class="layui-input">\
</div>\
</div>\
</div>'
,success:function(){
laydate.render({
elem: '#open_time',
showBottom:false
});
}
,yes: function(index){
let code = $('#LAY_module').find('[name="code"]').val();
let open_time = $('#LAY_module').find('[name="open_time"]').val();
let delivery = $('#LAY_module').find('[name="delivery"]').val();
$.ajax({
url: "/finance/invoice/open",
type: 'post',
data: {
id: data.id,
code: code,
open_time: open_time,
delivery: delivery
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.close(index);
tableIns.reload();
}
}
})
}
,btn2: function(){
layer.closeAll();
}
});
}
if (obj.event === 'disabled') {
layer.confirm('确定作废该发票吗?', {
icon: 3,
title: '提示'
}, function(index) {
$.ajax({
url: "/finance/invoice/tovoid",
data: {
id: data.id,
check_status:10
},
success: function(res) {
layer.msg(res.msg);
if (res.code == 0) {
location.reload();
}
}
})
layer.close(index);
});
}
});
}
</script>
{include file="../../base/view/common/layui" base='base' extend="['rightpage']" use="['table','form']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,4 +1,4 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
@ -13,12 +13,13 @@
</div>
</div>
<div class="layui-input-inline">
<select name="invoice_status">
<select name="check_status">
<option value="">请选择状态</option>
<option value="0">审核不通过</option>
<option value="1">审核中</option>
<option value="2">审核通过,待开具</option>
<option value="3">已开具</option>
<option value="3">审核拒绝</option>
<option value="4">撤销</option>
<option value="5">已开具</option>
<option value="10">已作废</option>
</select>
</div>
@ -52,7 +53,7 @@
//监听搜索提交
form.on('submit(webform)', function(data){
let f=data.field;
tableIns.reload({where:{invoice_status:f.invoice_status,start_time:f.start_time,end_time:f.end_time},page:{curr:1}});
tableIns.reload({where:{check_status:f.check_status,start_time:f.start_time,end_time:f.end_time},page:{curr:1}});
return false;
});
@ -60,7 +61,7 @@
elem: '#test',
title: '发票列表',
toolbar: '#toolbarDemo',
url: "/home/invoice/index", //数据接口
url: "/finance/invoice/index", //数据接口
page: true, //开启分页
limit: 20,
cols: [
@ -106,33 +107,39 @@
return html;
}
},{
field: 'invoice_status',
field: 'check_status',
title: '发票状态',
align: 'center',
width: 100,
templet:function(d){
var html='<span style="color:#FF5722">审核不通过</span>';
if(d.invoice_status==1){
var html='<span style="color:#FF5722">审核</span>';
if(d.check_status==1){
html='<span style="color:#FFB800">审核中</span>';
}
else if(d.invoice_status==2){
else if(d.check_status==2){
html='<span style="color:#5FB878">待开具</span>';
}
else if(d.invoice_status==3){
else if(d.check_status==3){
html='<span style="color:#FF5722">审核不通过</span>';
}
else if(d.check_status==4){
html='<span style="color:#FF5722">撤销</span>';
}
else if(d.check_status==5){
html='<span style="color:#1E9FFF">已开具</span>';
}
else if(d.invoice_status==10){
else if(d.check_status==10){
html='<span style="color:#FF5722">已作废</span>';
}
return html;
}
},{
field: 'user',
field: 'name',
title: '申请人',
align: 'center',
width: 100
},{
field: 'department',
field: 'department_name',
title: '所属部门',
align: 'center',
width: 120
@ -142,15 +149,9 @@
align: 'center',
width: 150
},{
field: 'check_name',
title: '审核人',
align: 'center',
width: 90
},{
field: 'check_time',
title: '审核时间',
align: 'center',
width: 136
field: 'check_user',
title: '当前审核人',
width: 150
},{
field: 'open_name',
title: '开票人',
@ -160,31 +161,28 @@
field: 'open_time',
title: '开票时间',
align: 'center',
width: 136
width: 100
},{
field: 'code',
title: '发票号码',
align: 'center',
width: 120
width: 132
}, {
field: 'right',
fixed: 'right',
title: '操作',
width: 130,
align: 'right',
width: 164,
align: 'center',
templet:function(d){
//0待审、1审批中、2通过、3失败、4撤销、5已开具、10已作废
var html='<div class="layui-btn-group">';
var btn1='<span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详情</span>';
var btn2='<span class="layui-btn layui-btn-xs" lay-event="edit">编辑</span>';
var btn3='<span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</span>';
var btn4='<span class="layui-btn layui-btn-warm layui-btn-xs" lay-event="disabled">作废</span>';
html+=btn1;
if(d.invoice_status==0 && d.admin_id==login_user){
if(d.check_status==4 && d.admin_id==login_user){
html+=btn2+btn3;
}
if(d.invoice_status==3 && d.open_admin_id==login_user){
html+=btn4;
}
html+='</div>';
return html;
}
@ -196,7 +194,7 @@
//表头工具栏事件
table.on('toolbar(test)', function(obj){
if (obj.event === 'add') {
rightpage.open("/home/invoice/add");
rightpage.open("/finance/invoice/add","900px");
return;
}
});
@ -204,11 +202,11 @@
table.on('tool(test)', function(obj) {
var data = obj.data;
if (obj.event === 'view') {
rightpage.open("/home/invoice/view?id="+data.id);
rightpage.open("/finance/invoice/view?id="+data.id,"900px");
return;
}
if (obj.event === 'edit') {
rightpage.open("/home/invoice/add?id="+data.id);
rightpage.open("/finance/invoice/add?id="+data.id,"900px");
return;
}
if (obj.event === 'del') {
@ -217,7 +215,7 @@
title: '提示'
}, function(index) {
$.ajax({
url: "/home/invoice/delete",
url: "/finance/invoice/delete",
data: {
id: data.id
},
@ -231,30 +229,9 @@
layer.close(index);
});
}
if (obj.event === 'disabled') {
layer.confirm('确定作废该发票吗?', {
icon: 3,
title: '提示'
}, function(index) {
$.ajax({
url: "/home/invoice/check",
data: {
id: data.id,
invoice_status:10
},
success: function(res) {
layer.msg(res.msg);
if (res.code == 0) {
location.reload();
}
}
})
layer.close(index);
});
}
});
}
</script>
{include file="common/layui" base='base' extend="['rightpage']" use="['table','form']" callback="init" /}
{include file="../../base/view/common/layui" base='base' extend="['rightpage']" use="['table','form']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,174 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<div class="layui-tab layui-tab-brief" lay-filter="tab">
<ul class="layui-tab-title">
<li class="layui-this">全部</li>
<li>待我审批</li>
<li>我已审批</li>
</ul>
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<h3 class="h3-title" style="height:32px;">发票列表</h3>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns=null;
function init(layui) {
var table = layui.table,
rightpage = layui.rightpage,
element=layui.element,
form = layui.form;
element.on('tab(tab)', function(data){
tableIns.reload({where:{status:data.index},page:{curr:1}});
return false;
});
tableIns = table.render({
elem: '#test',
title: '发票列表',
toolbar: '#toolbarDemo',
url: "/finance/invoice/list", //数据接口
page: true, //开启分页
limit: 20,
cols: [
[
{
field: 'id',
title: 'ID号',
align: 'center',
width: 80
}, {
field: 'invoice_title',
title: '开票抬头',
width: 320,
templet:function(d){
var html='';
if(d.type==1){
html='<span class="layui-badge layui-bg-blue">企业</span> '+d.invoice_title;
}
else if(d.type==2){
html='<span class="layui-badge layui-bg-green">个人</span> '+d.invoice_title;
}
return html;
}
},{
field: 'amount',
title: '开票金额(元)',
align: 'right',
style: 'color:#1E9FFF',
width: 100,
},{
field: 'invoice_type',
title: '开票类型',
align: 'center',
width: 90,
templet:function(d){
var html='-';
if(d.invoice_type==1){
html='<span style="color:#1E9FFF">专票</span>';
}
else if(d.invoice_type==2){
html='<span style="color:#5FB878">普票</span>';
}
return html;
}
},{
field: 'check_status',
title: '发票状态',
align: 'center',
width: 100,
templet:function(d){
var html='<span style="color:#FF5722">待审核</span>';
if(d.check_status==1){
html='<span style="color:#FFB800">审核中</span>';
}
else if(d.check_status==2){
html='<span style="color:#5FB878">待开具</span>';
}
else if(d.check_status==3){
html='<span style="color:#FF5722">审核不通过</span>';
}
else if(d.check_status==4){
html='<span style="color:#FF5722">撤销</span>';
}
else if(d.check_status==5){
html='<span style="color:#1E9FFF">已开具</span>';
}
else if(d.check_status==10){
html='<span style="color:#FF5722">已作废</span>';
}
return html;
}
},{
field: 'name',
title: '申请人',
align: 'center',
width: 100
},{
field: 'department_name',
title: '所属部门',
align: 'center',
width: 120
},{
field: 'create_time',
title: '申请时间',
align: 'center',
width: 150
},{
field: 'check_user',
title: '当前审核人',
width: 200
},{
field: 'open_name',
title: '开票人',
align: 'center',
width: 100
},{
field: 'open_time',
title: '开票时间',
align: 'center',
width: 100
},{
field: 'code',
title: '发票号码',
align: 'center',
width: 136
}, {
field: 'right',
fixed: 'right',
title: '操作',
width: 80,
align: 'center',
templet:function(d){
//0待审、1审批中、2通过、3失败、4撤销、5已开具、10已作废
var html='<span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详情</span>';
return html;
}
}
]
]
});
//监听行工具事件
table.on('tool(test)', function(obj) {
var data = obj.data;
if (obj.event === 'view') {
rightpage.open("/finance/invoice/view?id="+data.id,"900px");
return;
}
});
}
</script>
{include file="../../base/view/common/layui" base='base' extend="['rightpage']" use="['table','form']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,452 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<link rel="stylesheet" href="{__LAYUI__}/plugin/dtree/dtree.css">
<link rel="stylesheet" href="{__LAYUI__}/plugin/dtree/font/dtreefont.css">
<style>
.layui-form-pane .layui-form-label{color:#999; width:80px; padding:8px 3px;}
.layui-form-item .layui-inline{margin-right:3px; margin-bottom:10px;}
.layui-form-item{margin-bottom:5px;}
.layui-form-item .layui-btn-danger{display:none; margin-top:-8px}
.layui-form-item:hover .layui-btn-danger{display:inline-block;}
.select-1,.select-2{display:none;}
.check-items{overflow-x: auto; padding: 10px 0;}
.flow-flex-row {box-direction: row;
box-orient: horizontal;
-webkit-box-orient: horizontal;
-ms-flex-direction: row;
flex-direction: row;
}
.flow-flexbox { width: 100%;text-align: left;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
display: -webkit-flex;
box-align: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.check-item{width: auto; -ms-flex-negative: 0; flex-shrink: 0;}
.check-item i{font-size:20px; margin-right:3px; color:#4285f4;}
.check-item span{color:#999;margin:0 3px;}
.layui-icon[data-ok]{color:#34a853}
.layui-icon[data-no]{color:#FF5722;}
.check-item-status{color:#999; font-size:12px; margin-left:3px;}
.flow-tips{padding:6px 10px;}
.flow-tips li{padding:5px 0;}
.flow-tips li i{color:#4285f4;}
.flow-tips li span{color:#999; font-size:12px; margin-left:4px;}
.flow-record{padding:10px 10px 0;}
.flow-record .layui-icon {font-size:20px;}
.flow-record .layui-timeline-item{padding-bottom:10px;}
.layui-timeline-content ul{font-size:12px;}
.check-status{color:#999; margin-left:5px;}
.check-remark{padding:6px; margin-top:6px; margin-bottom:10px; border-radius:4px; background-color:#f5f5f5;}
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="page-content">
<h3 class="h3-title">发票详情</h3>
<table class="layui-table">
<tr>
<td class="layui-td-gray">开票金额(元)</td>
<td>
{$detail.amount}
</td>
<td class="layui-td-gray">开票类型</td>
<td>
{eq name="$detail.invoice_type" value="1"}增值税专用发票{/eq}
{eq name="$detail.invoice_type" value="2"}增值税普通发票{/eq}
</td>
<td class="layui-td-gray">开票主体</td>
<td>
{volist name=":oa_invoice_subject()" id="vo"}
{eq name="$vo.id" value="$detail.invoice_subject"}{$vo.title}{/eq}
{/volist}
</td>
</tr>
<tr>
<td class="layui-td-gray">抬头类型</td>
<td>
{eq name="$detail.type" value="1"}企业{/eq}
{eq name="$detail.type" value="2"}个人{/eq}
</td>
<td class="layui-td-gray">开票抬头</td>
<td>{$detail.invoice_title}</td>
<td class="layui-td-gray">电话号码</td>
<td>{$detail.invoice_phone}</td>
</tr>
<tr class="invoice-type" {eq name="$detail.type" value="2"}style="display:none"{/eq}>
<td class="layui-td-gray2">纳税人识别号</td>
<td>{$detail.invoice_tax}</td>
<td class="layui-td-gray">开户行</td>
<td>{$detail.invoice_bank}</td>
<td class="layui-td-gray">银行账号</td>
<td>{$detail.invoice_account}</td>
</tr>
<tr class="invoice-type" {eq name="$detail.type" value="2"}style="display:none"{/eq}>
<td class="layui-td-gray2">银行营业网点</td>
<td>{$detail.invoice_banking}</td>
<td class="layui-td-gray">地址</td>
<td colspan="3">{$detail.invoice_address}</td>
</tr>
{notempty name="$detail.remark"}
<tr>
<td class="layui-td-gray">备注信息</td>
<td colspan="5">{$detail.remark}</td>
</tr>
{/notempty}
<tr>
<td class="layui-td-gray">发票状态</td>
<td colspan="3">
{if condition="($detail.check_status == 0)"}
<span style="color:#009688">待审</span>
{elseif condition="($detail.check_status == 1)"}
<span style="color:#009688">审核中</span>
{elseif condition="($detail.check_status == 2)"}
<span style="color:#1E9FFF">审核通过,待开具</span>
{elseif condition="($detail.check_status == 3)"}
<span style="color:#FF5722">审核不通过 【原因:{$detail.check_remark}】</span>
{elseif condition="($detail.check_status == 4)"}
<span style="color:#FF5722">撤销 【原因:{$detail.check_remark}】</span>
{elseif condition="($detail.check_status == 5)"}
<span style="color:#1E9FFF">已开具</span>
{elseif condition="($detail.check_status == 10)"}
<span style="color:#FF5722">已作废</span>
{/if}
<span id="showRecord" class="layui-btn layui-btn-xs layui-btn-radius layui-btn-normal" style="margin-left:10px;">查看审批记录</span>
</td>
<td class="layui-td-gray">当前审核人</td>
<td colspan="3">{$detail.check_user}</td>
</tr>
<tr>
<td class="layui-td-gray">审批流程</td>
<td colspan="5">
<div class="flow-flexbox check-items flow-flex-row" id="flowList">
<div class="flow-flexbox check-item flow-flex-row">
<i class="layui-icon layui-icon-add-circle" data-ok=""></i>
<div class="check-item-name">{$detail.create_user}</div>
<div class="check-item-status">创建</div>
<span class="layui-icon layui-icon-right"></span>
</div>
</div>
</td>
</tr>
{if ( $detail.check_status lt 2) AND ( $is_check_admin eq 1) }
{eq name="$flows.flow_type" value="0"}
<tr>
<td class="layui-td-gray">审批节点 <font>*</font></td>
<td colspan="5">
<form class="layui-form">
<input type="radio" name="check_node" lay-filter="check_node" value="1" title="审核结束">
<input type="radio" name="check_node" lay-filter="check_node" value="2" title="下一审批人">
<div class="layui-inline">
<input type="hidden" name="check_admin_ids" value=""><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择下一审批人" lay-verify="required" lay-reqText="请选择下一审批人" class="layui-input">
</div>
</form>
</td>
</tr>
{/eq}
<tr>
<td class="layui-td-gray">审批意见 <font>*</font></td>
<td colspan="5">
<textarea name="content" placeholder="请输入审批意见" class="layui-textarea"></textarea>
</td>
</tr>
{/if}
{if ( $detail.check_status gt 4)}
<tr>
<td class="layui-td-gray2">开票人</td>
<td>{$detail.open_admin}</td>
<td class="layui-td-gray">发票号码</td>
<td>{$detail.code}</td>
<td class="layui-td-gray">开票时间</td>
<td colspan="3">{$detail.open_time}</td>
</tr>
<tr>
<td class="layui-td-gray2">快递单号</td>
<td colspan="5">{$detail.delivery}</td>
</tr>
{/if}
</table>
<input type="hidden" name="id" value="{$detail.id}">
<input type="hidden" name="flow_type" value="{$flows.flow_type}">
<div id="formBtn" style="padding: 10px 0">
{eq name="$is_check_admin" value='1'}
<span class="layui-btn layui-btn-normal" data-status="1"><i class="layui-icon layui-icon-ok"></i> 通过</span>
<span class="layui-btn layui-btn-danger" data-status="2"><i class="layui-icon layui-icon-close"></i> 拒绝</span>
{/eq}
{if ( $detail.check_status lt 2) AND ( $is_create_admin eq 1) }
<span class="layui-btn layui-btn-primary" data-status="3"><i class="layui-icon layui-icon-reduce-circle"></i> 撤回</span>
{/if}
{if ( $detail.check_status eq 4) AND ( $is_create_admin eq 1) }
<a class="layui-btn" href="/finance/invoice/add?id={$detail.id}">重新编辑</a>
{/if}
</div>
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form
,dropdown = layui.dropdown
,employeepicker = layui.employeepicker
,layer = layui.layer;
//获取审核信息
$.ajax({
url: "/api/index/get_flow_nodes",
type:'post',
data:{id:$('[name="id"]').val(),type:3},
success: function (e) {
if (e.code == 0) {
console.log(e);
let flowHtml='',list = e.data,record_list='';
for(var f=0;f<list.length;f++){
//审批流程
let checkUser = '',
iconRight ='<span class="layui-icon layui-icon-right"></span>',
iconStatus ='<i class="layui-icon layui-icon-time"></i>',
strStatus ='<div class="check-item-status">待审核</div>';
if(f == list.length-1){
iconRight ='';
}
if(list[f].flow_type == 1 || list[f].flow_type == 2){
checkUser=list[f].flow_type == 1?'部门负责人':'上级部门负责人';
if(list[f].check_list.length>0){
if(list[f].check_list[0].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
else if(list[f].check_list[0].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
else if(list[f].flow_type == 0 ){
checkUser=list[f].user_id_info[0].name;
if(list[f].check_list.length>0){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
for(var m=0;m<list[f].check_list.length;m++){
if(list[f].check_list[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
}
}
}
}
else if(list[f].flow_type == 3 ){
checkUser='多人或签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 1){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
break;
}
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
}
}
}
}
else if(list[f].flow_type == 4){
checkUser='多人会签';
if(list[f].user_id_info.length>0){
iconStatus ='<i class="layui-icon layui-icon-ok-circle" data-ok=""></i>';
strStatus ='<div class="check-item-status">通过</div>';
for(var m=0;m<list[f].user_id_info.length;m++){
if(list[f].user_id_info[m].status == 2){
iconStatus ='<i class="layui-icon layui-icon-close" data-no=""></i>';
strStatus ='<div class="check-item-status">拒绝</div>';
break;
}
if(list[f].user_id_info[m].status == 0){
iconStatus ='<i class="layui-icon layui-icon-time"></i>';
strStatus ='<div class="check-item-status">待审核</div>';
}
}
}
}
flowHtml+= '<div class="flow-flexbox check-item flow-flex-row" id="flow'+f+'">'+iconStatus+'\
<div class="check-item-name">'+checkUser+'</div>'+strStatus+iconRight+'\
</div>';
//审批历史数据
var sign_type = '',user_check_list='';
if(list[f].check_list.length>0){
if(list[f].flow_type==3){
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
}
if(list[f].flow_type==4){
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
}
for(var b=0;b<list[f].check_list.length;b++){
var status_str = '通过了此申请';
if(list[f].check_list[b].status == 2){
status_str = '拒绝了此申请';
}
user_check_list+= '<li style="padding:3px 0"><img src="'+list[f].check_list[b].thumb+'" style="width:22px; height:22px; border-radius:50%; margin-right:8px;" />'+list[f].check_list[b].name+'<span class="check-status">'+list[f].check_list[b].check_time_str+status_str+'</span><div class="check-remark">'+list[f].check_list[b].content+'</div></li>';
}
record_list+='<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis">&#x1005;</i>\
<div class="layui-timeline-content">\
<p class="layui-timeline-title">第'+(f+1)+'级'+sign_type+'</p>\
<ul>'+user_check_list+'</ul>\
</div>\
</li>';
}
}
$('#flowList').append(flowHtml);
if(record_list == ''){
record_list='<div style="text-align:center; color:#999; padding:10px 10px 20px;">无审批记录</div>';
}
dropdown.render({
elem: '#showRecord'
,trigger: 'click'
,content: ['<div class="flow-record">'
,'<ul>'+record_list+'</ul>'
,'</div>'].join('')
});
for(var f=0;f<list.length;f++){
if(list[f].flow_type == 3 || list[f].flow_type == 4){
var user_list= '';
for(var a=0;a<list[f].user_id_info.length;a++){
if(list[f].user_id_info[a].status==0){
user_list+='<li><i class="layui-icon layui-icon-time"></i> '+list[f].user_id_info[a].name+'<span>待审核此申请</span></li>';
}
else if(list[f].user_id_info[a].status==1){
user_list+='<li><i class="layui-icon layui-icon-ok-circle" data-ok=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已通过此申请</span></li>';
}else if(list[f].user_id_info[a].status==2){
user_list+='<li><i class="layui-icon layui-icon-close" data-no=""></i><span>'+list[f].user_id_info[a].check_time+'</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+list[f].user_id_info[a].name+'<span>已拒绝此申请</span></li>';
}
}
dropdown.render({
elem: '#flow'+f
,trigger: 'hover'
,content: ['<div class="flow-tips">'
,'<ul>'+user_list+'</ul>'
,'</div>'].join('')
});
}
}
}
}
})
//选择人员
$('.layui-form').on('click','[name="check_admin_name"]',function(){
employeepicker.init({
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type:0,
callback:function(ids,names){
$('[name="check_admin_ids"]').val(ids),
$('[name="check_admin_name"]').val(names);
}
});
})
//监听提交
$('#formBtn').on('click','span', function(data){
let id=$('[name="id"]').val();
let content=$('[name="content"]').val();
let check_status=$(this).data('status');
let flow_type = $('input[name="flow_type"]').val();
let check_node=0,check_admin_ids=0;
if(flow_type == 0 && check_status==1){
check_node = $('input[name="check_node"]:checked').val();
check_admin_ids = $('input[name="check_admin_ids"]').val();
if(!check_node){
layer.msg('请选择下一审批节点');
return false;
}
if(check_node == 2 && check_admin_ids==''){
layer.msg('请选择下一审批人');
return false;
}
}
if(check_status ==1 || check_status==2){
if(content==''){
layer.msg('请输入审批意见');
return false;
}
let confirmTips='确定通过该审核?';
if(check_status==2){
confirmTips='确定拒绝该审核?';
}
layer.confirm(confirmTips, function(index){
$.ajax({
url: "/finance/invoice/check",
type:'post',
data:{
id:id,
check_node:check_node,
check_admin_ids:check_admin_ids,
status:check_status,
content:content
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.tableIns.reload();
location.reload();
}
}
})
layer.close(index);
});
}
else if(check_status ==3){
layer.prompt({
formType: 2,
title: '请输入撤回理由',
area: ['500px', '120px'] //自定义文本域宽高
}, function(value, index, elem){
$.ajax({
url: "/finance/invoice/check",
type:'post',
data:{
id:id,
status:check_status,
content:value
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.tableIns.reload();
location.reload();
}
}
})
layer.close(index);
});
}
return false;
});
}
</script>
{include file="../../base/view/common/layui" base='base' extend="['employeepicker']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -9,189 +9,49 @@
*模块数据获取公共文件
======================
*/
use think\facade\Cache;
use think\facade\Db;
//设置缓存
function set_cache($key, $value, $date = 86400)
{
Cache::set($key, $value, $date);
}
//读取缓存
function get_cache($key)
{
return Cache::get($key);
}
//清空缓存
function clear_cache($key)
{
Cache::clear($key);
}
//读取系统配置
function get_system_config($name, $key = '')
{
$config = [];
if (get_cache('system_config' . $name)) {
$config = get_cache('system_config' . $name);
} else {
$conf = Db::name('config')->where('name', $name)->find();
if ($conf['content']) {
$config = unserialize($conf['content']);
}
set_cache('system_config' . $name, $config);
}
if ($key == '') {
return $config;
} else {
if ($config[$key]) {
return $config[$key];
}
}
}
//获取指定管理员的信息
function get_admin($id)
{
$admin = Db::name('Admin')
->alias('a')
->field('a.*,d.title as department,p.title as position')
->leftJoin ('Department d ','d.id= a.did')
->leftJoin ('Position p ','p.id= a.position_id')
->where(['a.id' => $id])
->cache(true,60)
->find();
$admin['last_login_time'] = empty($admin['last_login_time']) ? '-' : date('Y-m-d H:i', $admin['last_login_time']);
return $admin;
}
//获取当前登录用户的信息
function get_login_admin($key = '')
{
$session_admin = get_config('app.session_admin');
if (\think\facade\Session::has($session_admin)) {
$gougu_admin = \think\facade\Session::get($session_admin);
$admin = get_admin($gougu_admin['id']);
if (!empty($key)) {
if (isset($admin[$key])) {
return $admin[$key];
} else {
return '';
}
} else {
return $admin;
}
} else {
return '';
}
}
//读取后台菜单列表
function get_admin_menu()
function admin_menu()
{
$menu = Db::name('AdminMenu')->order('sort asc,id asc')->select()->toArray();
$menu = Db::name('AdminRule')->where(['menu' => 1,'status'=>1])->order('sort asc,id asc')->select()->toArray();
return $menu;
}
//读取权限节点列表
function get_admin_rule()
function admin_rule()
{
$rule = Db::name('AdminRule')->order('sort asc,id asc')->select()->toArray();
$rule = Db::name('AdminRule')->where(['status'=>1])->order('sort asc,id asc')->select()->toArray();
return $rule;
}
//读取权限分组列表
function get_admin_group()
function admin_group()
{
$group = Db::name('AdminGroup')->order('id desc')->select()->toArray();
return $group;
}
//读取指定权限分组详情
function get_admin_group_info($id)
//读取指定权限分组菜单详情
function admin_group_info($id)
{
$group = Db::name('AdminGroup')->where(['id' => $id])->find();
$group['rules'] = explode(',', $group['rules']);
$group['menus'] = explode(',', $group['menus']);
$rule = Db::name('AdminGroup')->where(['id' => $id])->value('rules');
$rules = explode(',', $rule);
return $rules;
}
//读取模块列表
function admin_module()
{
$group = Db::name('AdminModule')->order('id asc')->select()->toArray();
return $group;
}
//菜单父子关系排序,用于菜单
function get_admin_menus()
{
$admin = get_login_admin();
if (get_cache('menu' . $admin['id'])) {
$list = get_cache('menu' . $admin['id']);
} else {
$adminGroup = Db::name('PositionGroup')->where(['pid' => $admin['position_id']])->column('group_id');
$adminMenu = Db::name('AdminGroup')->where('id', 'in', $adminGroup)->column('menus');
$adminMenus = [];
foreach ($adminMenu as $k => $v) {
$v = explode(',', $v);
$adminMenus = array_merge($adminMenus, $v);
}
$menu = Db::name('AdminMenu')->where('id', 'in', $adminMenus)->order('sort asc')->select()->toArray();
$list = list_to_tree($menu);
Cache::tag('adminMenu')->set('menu' . $admin['id'], $list);
}
return $list;
}
/**
* 节点权限判断
* @return bool
*/
function check_auth($rule, $uid)
{
$auth_list = Cache::get('RulesSrc' . $uid);
if (!in_array($rule, $auth_list)) {
return false;
} else {
return true;
}
}
//读取部门列表
function get_department()
{
$department = Db::name('Department')->where(['status' => 1])->select()->toArray();
return $department;
}
//获取某部门的子部门id.$is_self时候包含自己
function get_department_son($did = 0, $is_self = 1)
{
$department = get_department();
$department_list = get_data_node($department, $did);
$department_array = array_column($department_list, 'id');
if ($is_self == 1) {
//包括自己在内
$department_array[] = $did;
}
return $department_array;
}
//读取关键字列表
function get_keywords()
{
$keywords = Db::name('Keywords')->where(['status' => 1])->order('id desc')->select()->toArray();
return $keywords;
}
//读取公告分类列表
function get_note_cate()
{
$cate = Db::name('NoteCate')->order('id desc')->select()->toArray();
return $cate;
}
//读取公告分类子分类ids
function get_note_son($id = 0, $is_self = 1)
function admin_note_cate_son($id = 0, $is_self = 1)
{
$note = get_note_cate();
$note = Db::name('NoteCate')->order('create_time asc')->select();
$note_list = get_data_node($note, $id);
$note_array = array_column($note_list, 'id');
if ($is_self == 1) {
@ -201,17 +61,10 @@ function get_note_son($id = 0, $is_self = 1)
return $note_array;
}
//读取知识分类列表
function get_article_cate()
{
$cate = Db::name('ArticleCate')->order('id desc')->select()->toArray();
return $cate;
}
//读取知识分类子分类ids
function get_article_son($id = 0, $is_self = 1)
function admin_article_cate_son($id = 0, $is_self = 1)
{
$article = get_article_cate();
$article = Db::name('ArticleCate')->order('id desc')->select()->toArray();
$article_list = get_data_node($article, $id);
$article_array = array_column($article_list, 'id');
if ($is_self == 1) {
@ -220,202 +73,3 @@ function get_article_son($id = 0, $is_self = 1)
}
return $article_array;
}
//读取开票主体
function get_invoice_subject()
{
$subject = Db::name('InvoiceSubject')->where(['status' => 1])->order('id desc')->select()->toArray();
return $subject;
}
//读取审核人
function get_check_user($type=1)
{
$user = Db::name('Check')
->field('c.*,a.name as user')
->alias('c')
->join('admin a', 'a.id = c.uid', 'LEFT')
->where(['c.type'=>$type,'c.status' => 1])
->order('c.id desc')
->select()
->toArray();
return $user;
}
/**
* 根据附件表的id返回url地址
* @param [type] $id [description]
*/
function get_file($id)
{
if ($id) {
$geturl = Db::name("file")->where(['id' => $id])->find();
if ($geturl['status'] == 1) {
//审核通过
//获取签名的URL
$url = $geturl['filepath'];
return $url;
} elseif ($geturl['status'] == 0) {
//待审核
return '/static/home/images/none_pic.jpg';
} else {
//不通过
return '/static/home/images/none_pic.jpg';
}
}
return false;
}
/**
* 发送站内信
* @param $user_id 接收人user_id
* @param $data 操作内容
* @param $sysMessage 1为系统消息
* @param $template 消息模板
* @return
*/
function sendMessage($user_id, $template, $data=[])
{
$content = get_config('message.template')[$template]['template'];
foreach ($data as $key => $val) {
$content = str_replace('{' . $key . '}', $val, $content);
}
if(isSet($data['from_uid'])){
$content = str_replace('{from_user}', get_admin($data['from_uid'])['name'], $content);
}
$content = str_replace('{date}', date('Y-m-d'), $content);
if (!$user_id) return false;
if (!$content) return false;
if (!is_array($user_id)) {
$users[] = $user_id;
} else {
$users = $user_id;
}
$users = array_unique(array_filter($users));
//组合要发的消息
$send_data = [];
foreach ($users as $key => $value) {
$send_data[] = array(
'to_uid' => $value,//接收人
'action_id' => $data['action_id'],
'title' => $data['title'],
'content' => $content,
'template' => $template,
'module_name' => strtolower(app('http')->getName()),
'controller_name' => strtolower(app('request')->controller()),
'action_name' => strtolower(app('request')->action()),
'send_time' => time(),
'create_time' => time()
);
}
$res = Db::name('Message')->strict(false)->field(true)->insertAll($send_data);
return $res;
}
/**
* 员工操作日志
* @param string $type 操作类型 login add edit view delete
* @param int $param_id 操作类型
* @param array $param 提交的参数
*/
function add_log($type, $param_id = '', $param = [])
{
$action = '未知操作';
$type_action = get_config('log.type_action');
if($type_action[$type]){
$action = $type_action[$type];
}
if ($type == 'login') {
$login_admin = Db::name('Admin')->where(array('id' => $param_id))->find();
} else {
$session_admin = get_config('app.session_admin');
$login_admin = \think\facade\Session::get($session_admin);
}
$data = [];
$data['uid'] = $login_admin['id'];
$data['name'] = $login_admin['name'];
$data['type'] = $type;
$data['action'] = $action;
$data['param_id'] = $param_id;
$data['param'] = json_encode($param);
$data['module'] = strtolower(app('http')->getName());
$data['controller'] = strtolower(app('request')->controller());
$data['function'] = strtolower(app('request')->action());
$parameter = $data['module'] . '/' . $data['controller'] . '/' . $data['function'];
$rule_menu = Db::name('AdminRule')->where(array('src' => $parameter))->find();
if($rule_menu){
$data['title'] = $rule_menu['title'];
$data['subject'] = $rule_menu['name'];
}
else{
$data['title'] = '';
$data['subject'] ='系统';
}
$content = $login_admin['name'] . '在' . date('Y-m-d H:i:s') . $data['action'] . '了' . $data['subject'];
$data['content'] = $content;
$data['ip'] = app('request')->ip();
$data['create_time'] = time();
Db::name('AdminLog')->strict(false)->field(true)->insert($data);
}
/**
* 邮件发送
* @param $to 接收人
* @param string $subject 邮件标题
* @param string $content 邮件内容(html模板渲染后的内容)
* @throws Exception
* @throws phpmailerException
*/
function send_email($to, $subject = '', $content = '')
{
$mail = new PHPMailer\PHPMailer\PHPMailer();
$email_config = Db::name('config')->where('name', 'email')->find();
$config = unserialize($email_config['content']);
$mail->CharSet = 'UTF-8'; //设定邮件编码默认ISO-8859-1如果发中文此项必须设置否则乱码
$mail->isSMTP();
$mail->SMTPDebug = 0;
//调试输出格式
//$mail->Debugoutput = 'html';
//smtp服务器
$mail->Host = $config['smtp'];
//端口 - likely to be 25, 465 or 587
$mail->Port = $config['smtp_port'];
if ($mail->Port == '465') {
$mail->SMTPSecure = 'ssl'; // 使用安全协议
}
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//发送邮箱
$mail->Username = $config['smtp_user'];
//密码
$mail->Password = $config['smtp_pwd'];
//Set who the message is to be sent from
$mail->setFrom($config['email'], $config['from']);
//回复地址
//$mail->addReplyTo('replyto@example.com', 'First Last');
//接收邮件方
if (is_array($to)) {
foreach ($to as $v) {
$mail->addAddress($v);
}
} else {
$mail->addAddress($to);
}
$mail->isHTML(true); // send as HTML
//标题
$mail->Subject = $subject;
//HTML内容转换
$mail->msgHTML($content);
$status = $mail->send();
if ($status) {
return true;
} else {
// echo "Mailer Error: ".$mail->ErrorInfo;// 输出错误信息
// die;
return false;
}
}

View File

@ -1,358 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\controller;
use app\base\BaseController;
use app\home\model\AdminLog;
use app\home\validate\AdminCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\Session;
class Api extends BaseController
{
//上传文件
public function upload()
{
$param = get_params();
if (request()->file('file')) {
$file = request()->file('file');
} else {
return to_assign(1, '没有选择上传文件');
}
// dump($file);die;
// 获取上传文件的hash散列值
$sha1 = $file->hash('sha1');
$md5 = $file->hash('md5');
$rule = [
'image' => 'jpg,png,jpeg,gif',
'doc' => 'doc,docx,ppt,pptx,xls,xlsx,pdf',
'file' => 'zip,gz,7z,rar,tar',
];
$fileExt = $rule['image'] . ',' . $rule['doc'] . ',' . $rule['file'];
//1M=1024*1024=1048576字节
$fileSize = 2 * 1024 * 1024;
if (isset($param['type']) && $param['type']) {
$fileExt = $rule[$param['type']];
}
if (isset($param['size']) && $param['size']) {
$fileSize = $param['size'];
}
$validate = \think\facade\Validate::rule([
'image' => 'require|fileSize:' . $fileSize . '|fileExt:' . $fileExt,
]);
$file_check['image'] = $file;
if (!$validate->check($file_check)) {
return to_assign(1, $validate->getError());
}
// 日期前綴
$dataPath = date('Ym');
$use = 'thumb';
$filename = \think\facade\Filesystem::disk('public')->putFile($dataPath, $file, function () use ($md5) {
return $md5;
});
if ($filename) {
//写入到附件表
$data = [];
$path = get_config('filesystem.disks.public.url');
$data['filepath'] = $path . '/' . $filename;
$data['name'] = $file->getOriginalName();
$data['mimetype'] = $file->getOriginalMime();
$data['fileext'] = $file->extension();
$data['filesize'] = $file->getSize();
$data['filename'] = $filename;
$data['sha1'] = $sha1;
$data['md5'] = $md5;
$data['module'] = \think\facade\App::initialize()->http->getName();
$data['action'] = app('request')->action();
$data['uploadip'] = app('request')->ip();
$data['create_time'] = time();
$data['user_id'] = $this->uid;
if ($data['module'] = 'admin') {
//通过后台上传的文件直接审核通过
$data['status'] = 1;
$data['admin_id'] = $data['user_id'];
$data['audit_time'] = time();
}
$data['use'] = request()->has('use') ? request()->param('use') : $use; //附件用处
$res['id'] = Db::name('file')->insertGetId($data);
$res['filepath'] = $data['filepath'];
$res['name'] = $data['name'];
$res['filename'] = $data['filename'];
add_log('upload', $data['user_id'], $data);
return to_assign(0, '上传成功', $res);
} else {
return to_assign(1, '上传失败,请重试');
}
}
//清空缓存
public function cache_clear()
{
\think\facade\Cache::clear();
return to_assign(0, '系统缓存已清空');
}
//获取权限树所需的节点列表
public function get_rule()
{
$rule = get_admin_rule();
$group = [];
if (!empty(get_params('id'))) {
$group = get_admin_group_info(get_params('id'))['rules'];
}
$list = create_tree_list(0, $rule, $group);
return to_assign(0, '', $list);
}
//获取菜单树列表
public function get_menu()
{
$rule = get_admin_menu();
$group = [];
if (!empty(get_params('id'))) {
$group = get_admin_group_info(get_params('id'))['menus'];
}
$list = create_tree_list(0, $rule, $group);
return to_assign(0, '', $list);
}
//获取关键字
public function get_keyword_cate()
{
$keyword = get_keywords();
return to_assign(0, '', $keyword);
}
// 测试邮件发送
public function email_test()
{
$sender = get_params('email');
//检查是否邮箱格式
if (!is_email($sender)) {
return to_assign(1, '测试邮箱码格式有误');
}
$email_config = \think\facade\Db::name('config')->where('name', 'email')->find();
$config = unserialize($email_config['content']);
$content = $config['template'];
//所有项目必须填写
if (empty($config['smtp']) || empty($config['smtp_port']) || empty($config['smtp_user']) || empty($config['smtp_pwd'])) {
return to_assign(1, '请完善邮件配置信息!');
}
$send = send_email($sender, '测试邮件', $content);
if ($send) {
return to_assign(0, '邮件发送成功!');
} else {
return to_assign(1, '邮件发送失败!');
}
}
//获取部门节点列表
public function get_department_tree()
{
$department = get_department();
$list = get_tree($department, 0, 2);
$data['trees'] = $list;
return json($data);
}
//获取子部门所有员工
public function get_employee($did = 0)
{
$did = get_params('did');
$department = get_department_son($did);
$employee = Db::name('admin')
->field('a.id,a.did,a.position_id,a.mobile,a.name,a.nickname,a.sex,a.status,a.thumb,a.username,d.title as department')
->alias('a')
->join('Department d', 'a.did = d.id')
->where(['a.status' => 1])
->where('a.did', "in", $department)
->select();
return to_assign(0, '', $employee);
}
//获取角色列表
public function get_position()
{
$position = Db::name('Position')->field('id,title as name')->where([['status', '=', 1], ['id', '>', 1]])->select();
return to_assign(0, '', $position);
}
//首页公告
public function get_note_list()
{
$list = Db::name('Note')
->field('a.*,c.title as cate_title')
->alias('a')
->join('note_cate c', 'a.cate_id = c.id')
->where(['a.status' => 1])
->order('a.id desc')
->limit(10)
->select()->toArray();
foreach ($list as $key => $val) {
$list[$key]['create_time'] = date('Y-m-d :H:i', $val['create_time']);
}
$res['data'] = $list;
return table_assign(0, '', $res);
}
//首页文章
public function get_article_list()
{
$list = Db::name('Article')
->field('a.*,c.title as cate_title')
->alias('a')
->join('article_cate c', 'a.article_cate_id = c.id')
->where(['a.status' => 1])
->order('a.id desc')
->limit(10)
->select()->toArray();
foreach ($list as $key => $val) {
$list[$key]['create_time'] = date('Y-m-d :H:i', $val['create_time']);
}
$res['data'] = $list;
return table_assign(0, '', $res);
}
//修改个人信息
public function edit_personal()
{
if (request()->isAjax()) {
$param = get_params();
$uid = $this->uid;
Db::name('Admin')->where(['id' => $uid])->strict(false)->field(true)->update($param);
$session_admin = get_config('app.session_admin');
Session::set($session_admin, Db::name('admin')->find($uid));
return to_assign();
}
else{
return view('admin/edit_personal', [
'admin' => get_admin($this->uid),
]);
}
}
//修改密码
public function edit_password()
{
if (request()->isAjax()) {
$param = get_params();
try {
validate(AdminCheck::class)->scene('editPwd')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$uid = $this->uid;
$admin = Db::name('Admin')->where(['id' => $uid])->find();
$old_psw = set_password($param['old_pwd'], $admin['salt']);
if ($admin['pwd'] != $old_psw) {
return to_assign(1, '旧密码错误');
}
$salt = set_salt(20);
$new_pwd = set_password($param['pwd'], $salt);
$data = [
'reg_pwd' => '',
'salt' => $salt,
'pwd' => $new_pwd,
'update_time' => time(),
];
Db::name('Admin')->where(['id' => $uid])->strict(false)->field(true)->update($data);
$session_admin = get_config('app.session_admin');
Session::set($session_admin, Db::name('admin')->find($uid));
return to_assign();
}
else{
return view('admin/edit_password', [
'admin' => get_admin($this->uid),
]);
}
}
//保存密码修改
public function password_submit()
{
if (request()->isAjax()) {
$param = get_params();
try {
validate(AdminCheck::class)->scene('editpwd')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$admin = get_admin($this->uid);
if (set_password($param['old_pwd'], $admin['salt']) !== $admin['pwd']) {
return to_assign(1, '旧密码不正确!');
}
unset($param['username']);
$param['salt'] = set_salt(20);
$param['pwd'] = set_password($param['pwd'], $param['salt']);
Db::name('Admin')->where(['id' => $admin['id'],
])->strict(false)->field(true)->update($param);
$session_admin = get_config('app.session_admin');
Session::set($session_admin, Db::name('admin')->find($admin['id']));
return to_assign();
}
}
//删除
public function del_expense_interfix()
{
$id = get_params("id");
$admin_id = Db::name('ExpenseInterfix')->where('id', $id)->value('admin_id');
if ($admin_id == $this->uid) {
if (Db::name('ExpenseInterfix')->where('id', $id)->delete() !== false) {
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
} else {
return to_assign(1, "您没权限删除该报销数据");
}
}
//系统操作日志
public function log_list()
{
return view('admin/log_list');
}
//获取系统操作日志
public function get_log_list()
{
$param = get_params();
$log = new AdminLog();
$content = $log->get_log_list($param);
return table_assign(0, '', $content);
}
//获取访问记录
public function get_view_data()
{
$param = get_params();
$first_time = time();
$second_time = $first_time - 86400;
$three_time = $first_time - 86400 * 365;
$begin_first = strtotime(date('Y-m-d', $first_time) . " 00:00:00");
$end_first = strtotime(date('Y-m-d', $first_time) . " 23:59:59");
$begin_second = strtotime(date('Y-m-d', $second_time) . " 00:00:00");
$end_second = strtotime(date('Y-m-d', $second_time) . " 23:59:59");
$begin_three = strtotime(date('Y-m-d', $three_time) . " 00:00:00");
$data_first = Db::name('AdminLog')->field('create_time')->whereBetween('create_time', "$begin_first,$end_first")->select();
$data_second = Db::name('AdminLog')->field('create_time')->whereBetween('create_time', "$begin_second,$end_second")->select();
$data_three = Db::name('AdminLog')->field('create_time')->whereBetween('create_time', "$begin_three,$end_first")->select();
return to_assign(0, '', ['data_first' => hour_document($data_first), 'data_second' => hour_document($data_second), 'data_three' => date_document($data_three)]);
}
}

View File

@ -0,0 +1,591 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\controller;
use app\base\BaseController;
use app\home\validate\FlowTypeCheck;
use app\home\validate\ExpenseCateCheck;
use app\home\validate\CostCateCheck;
use app\home\validate\SealCateCheck;
use app\home\validate\CarCateCheck;
use app\home\validate\NoteCateCheck;
use app\home\validate\ArticleCateCheck;
use app\home\validate\InvoiceSubjectCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Cate extends BaseController
{
//审批类型
public function flow_type()
{
if (request()->isAjax()) {
$cate = Db::name('FlowType')->order('id asc')->select();
return to_assign(0, '', $cate);
} else {
return view();
}
}
//审批类型添加
public function flow_type_add()
{
$param = get_params();
if (request()->isAjax()) {
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(FlowTypeCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$data['update_time'] = time();
$res = Db::name('FlowType')->strict(false)->field(true)->update($param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
} else {
try {
validate(FlowTypeCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = Db::name('FlowType')->strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
}
else {
$id = isset($param['id']) ? $param['id'] : 0;
if ($id > 0) {
$detail = Db::name('FlowType')->where(['id' => $id])->find();
View::assign('detail', $detail);
}
View::assign('id', $id);
return view();
}
}
//审批类型设置
public function flow_type_check()
{
$param = get_params();
$res = Db::name('FlowType')->strict(false)->field('id,status')->update($param);
if ($res) {
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}
else if($param['status'] == 1){
add_log('recovery', $param['id'], $param);
}
return to_assign();
}
else{
return to_assign(0, '操作失败');
}
}
//费用类别
public function cost_cate()
{
if (request()->isAjax()) {
$cate = Db::name('CostCate')->order('create_time asc')->select();
return to_assign(0, '', $cate);
} else {
return view();
}
}
//费用类别添加
public function cost_cate_add()
{
if (request()->isAjax()) {
$param = get_params();
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(CostCateCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$data['update_time'] = time();
$res = Db::name('CostCate')->strict(false)->field(true)->update($param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
} else {
try {
validate(CostCateCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = Db::name('CostCate')->strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
}
}
//费用类别设置
public function cost_cate_check()
{
$param = get_params();
$res = Db::name('CostCate')->strict(false)->field('id,status')->update($param);
if ($res) {
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}
else if($param['status'] == 1){
add_log('recovery', $param['id'], $param);
}
return to_assign();
}
else{
return to_assign(0, '操作失败');
}
}
//印章类别
public function seal_cate()
{
if (request()->isAjax()) {
$cate = Db::name('SealCate')->order('create_time asc')->select();
return to_assign(0, '', $cate);
} else {
return view();
}
}
//印章类别添加
public function seal_cate_add()
{
if (request()->isAjax()) {
$param = get_params();
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(SealCateCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$data['update_time'] = time();
$res = Db::name('SealCate')->strict(false)->field(true)->update($param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
} else {
try {
validate(SealCateCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = Db::name('SealCate')->strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
}
}
//印章类别设置
public function seal_cate_check()
{
$param = get_params();
$res = Db::name('SealCate')->strict(false)->field('id,status')->update($param);
if ($res) {
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}
else if($param['status'] == 1){
add_log('recovery', $param['id'], $param);
}
return to_assign();
}
else{
return to_assign(0, '操作失败');
}
}
//车辆类型
public function car_cate()
{
if (request()->isAjax()) {
$cate = Db::name('CarCate')->order('create_time asc')->select();
return to_assign(0, '', $cate);
} else {
return view();
}
}
//车辆类型添加
public function car_cate_add()
{
if (request()->isAjax()) {
$param = get_params();
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(CarCateCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$data['update_time'] = time();
$res = Db::name('CarCate')->strict(false)->field(true)->update($param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
} else {
try {
validate(CarCateCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = Db::name('CarCate')->strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
}
}
//车辆类型设置
public function car_cate_check()
{
$param = get_params();
$res = Db::name('CarCate')->strict(false)->field('id,status')->update($param);
if ($res) {
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}
else if($param['status'] == 1){
add_log('recovery', $param['id'], $param);
}
return to_assign();
}
else{
return to_assign(0, '操作失败');
}
}
//报销类别
public function expense_cate()
{
if (request()->isAjax()) {
$cate = Db::name('ExpenseCate')->order('create_time asc')->select();
return to_assign(0, '', $cate);
} else {
return view();
}
}
//报销类别添加
public function expense_cate_add()
{
if (request()->isAjax()) {
$param = get_params();
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(ExpenseCateCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$data['update_time'] = time();
$res = Db::name('ExpenseCate')->strict(false)->field(true)->update($param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
} else {
try {
validate(ExpenseCateCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = Db::name('ExpenseCate')->strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
}
}
//报销类别设置
public function expense_cate_check()
{
$param = get_params();
$res = Db::name('ExpenseCate')->strict(false)->field('id,status')->update($param);
if ($res) {
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}
else if($param['status'] == 1){
add_log('recovery', $param['id'], $param);
}
return to_assign();
}
else{
return to_assign(0, '操作失败');
}
}
//发票主体
public function subject()
{
if (request()->isAjax()) {
$subject = Db::name('InvoiceSubject')->order('create_time asc')->select();
return to_assign(0, '', $subject);
} else {
return view();
}
}
//发票主体新建编辑
public function subject_add()
{
if (request()->isAjax()) {
$param = get_params();
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(InvoiceSubjectCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['update_time'] = time();
$res = Db::name('InvoiceSubject')->strict(false)->field('title,id,update_time')->update($param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
} else {
try {
validate(InvoiceSubjectCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = Db::name('InvoiceSubject')->strict(false)->field('title,id,create_time')->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
}
}
//发票主体设置
public function subject_check()
{
$param = get_params();
$res = Db::name('InvoiceSubject')->strict(false)->field('id,status')->update($param);
if ($res) {
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}
else if($param['status'] == 1){
add_log('recovery', $param['id'], $param);
}
return to_assign();
}
else{
return to_assign(0, '操作失败');
}
}
//公告类别
public function note_cate()
{
if (request()->isAjax()) {
$cate = Db::name('NoteCate')->order('create_time asc')->select();
return to_assign(0, '', $cate);
} else {
return view();
}
}
//公告类别添加
public function note_cate_add()
{
$param = get_params();
if (request()->isAjax()) {
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(NoteCateCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$note_array = admin_note_cate_son($param['id']);
if (in_array($param['pid'], $note_array)) {
return to_assign(1, '父级分类不能是该分类本身或其子分类');
} else {
$param['update_time'] = time();
$res = Db::name('NoteCate')->strict(false)->field(true)->update($param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
}
} else {
try {
validate(NoteCateCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = Db::name('NoteCate')->strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
} else {
$id = isset($param['id']) ? $param['id'] : 0;
$pid = isset($param['pid']) ? $param['pid'] : 0;
$cate = $cate = Db::name('NoteCate')->order('id desc')->select()->toArray();
$cates = set_recursion($cate);
if ($id > 0) {
$detail = Db::name('NoteCate')->where(['id' => $id])->find();
View::assign('detail', $detail);
}
View::assign('id', $id);
View::assign('pid', $pid);
View::assign('cates', $cates);
return view();
}
}
//公告类别删除
public function note_cate_delete()
{
$id = get_params("id");
$cate_count = Db::name('NoteCate')->where(["pid" => $id])->count();
if ($cate_count > 0) {
return to_assign(1, "该分类下还有子分类,无法删除");
}
$content_count = Db::name('Article')->where(["article_cate_id" => $id])->count();
if ($content_count > 0) {
return to_assign(1, "该分类下还有文章,无法删除");
}
if (Db::name('NoteCate')->delete($id) !== false) {
add_log('delete', $id);
return to_assign(0, "删除分类成功");
} else {
return to_assign(1, "删除失败");
}
}
//文章类别
public function article_cate()
{
if (request()->isAjax()) {
$cate = Db::name('ArticleCate')->order('create_time asc')->select();
return to_assign(0, '', $cate);
} else {
return view();
}
}
//文章分类添加&编辑
public function article_cate_add()
{
$param = get_params();
if (request()->isAjax()) {
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(ArticleCateCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$note_array = admin_article_cate_son($param['id']);
if (in_array($param['pid'], $note_array)) {
return to_assign(1, '父级分类不能是该分类本身或其子分类');
} else {
$param['update_time'] = time();
$res = Db::name('ArticleCate')->strict(false)->field(true)->update($param);
if($res){
add_log('edit', $param['id'], $param);
return to_assign();
}
}
} else {
try {
validate(ArticleCateCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = Db::name('ArticleCate')->strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
} else {
$id = isset($param['id']) ? $param['id'] : 0;
$pid = isset($param['pid']) ? $param['pid'] : 0;
$cate = Db::name('ArticleCate')->order('id desc')->select()->toArray();
$cates = set_recursion($cate);
if ($id > 0) {
$detail = Db::name('ArticleCate')->where(['id' => $id])->find();
View::assign('detail', $detail);
}
View::assign('id', $id);
View::assign('pid', $pid);
View::assign('cates', $cates);
return view();
}
}
//删除文章分类
public function article_cate_delete()
{
$id = get_params("id");
$cate_count = Db::name('ArticleCate')->where(["pid" => $id])->count();
if ($cate_count > 0) {
return to_assign(1, "该分类下还有子分类,无法删除");
}
$content_count = Db::name('Article')->where(["article_cate_id" => $id])->count();
if ($content_count > 0) {
return to_assign(1, "该分类下还有文章,无法删除");
}
if (Db::name('ArticleCate')->delete($id) !== false) {
add_log('delete', $id);
return to_assign(0, "删除分类成功");
} else {
return to_assign(1, "删除失败");
}
}
}

View File

@ -1,83 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\controller;
use app\base\BaseController;
use think\facade\Db;
use think\facade\View;
class Check extends BaseController
{
public function index()
{
if (request()->isAjax()) {
$param = get_params();
$where = array();
$where[] = ['a.status', '>=', 0];
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
$content = Db::name('Check')
->field('a.*,u.username as username,u.name as name')
->alias('a')
->join('Admin u', 'a.uid = u.id', 'LEFT')
->where($where)
->paginate($rows, false, ['query' => $param]);
return table_assign(0, '', $content);
} else {
return view();
}
}
//添加/编辑
public function add()
{
$param = get_params();
if (request()->isAjax()) {
if (!empty($param['id']) && $param['id'] > 0) {
$param['update_time'] = time();
$res = Db::name('Check')->strict(false)->field(true)->update($param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
} else {
$param['create_time'] = time();
$insertId = Db::name('Check')->strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
} else {
$id = isset($param['id']) ? $param['id'] : 0;
if ($id > 0) {
$detail = Db::name('Check')->where(['id' => $id])->find();
$detail['name'] = Db::name('Admin')->where(['id' => $detail['uid']])->value('name');
View::assign('detail', $detail);
}
View::assign('id', $id);
return view();
}
}
//删除
public function delete()
{
$id = get_params("id");
$data['status'] = '-1';
$data['id'] = $id;
$data['update_time'] = time();
if (Db::name('Config')->update($data) !== false) {
add_log('delete', $id, $data);
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
}
}

View File

@ -1,328 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\controller;
use app\base\BaseController;
use app\home\model\Expense as ExpenseList;
use app\home\model\ExpenseCate;
use app\home\validate\ExpenseCateCheck;
use app\home\validate\ExpenseCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Expense extends BaseController
{
public function cate()
{
if (request()->isAjax()) {
$cate = Db::name('ExpenseCate')->order('create_time asc')->select();
return to_assign(0, '', $cate);
} else {
return view();
}
}
//提交保存分类
public function cate_add()
{
if (request()->isAjax()) {
$param = get_params();
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(ExpenseCateCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$data['update_time'] = time();
$res = ExpenseCate::strict(false)->field(true)->update($param);
if ($res) {
add_log('edit', $param['id'], $param);
}
return to_assign();
} else {
try {
validate(ExpenseCateCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = ExpenseCate::strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
}
}
public function get_list($param = [], $where = [])
{
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$expense = ExpenseList::where($where)
->order('id desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->income_month = empty($item->income_month) ? '-' : date('Y-m', $item->income_month);
$item->expense_time = empty($item->expense_time) ? '-' : date('Y-m-d', $item->expense_time);
$item->admin_name = Db::name('Admin')->where(['id' => $item->admin_id])->value('name');
$item->department = Db::name('Department')->where(['id' => $item->admin_id])->value('title');
$item->check_name = Db::name('Admin')->where(['id' => $item->check_admin_id])->value('name');
$item->check_time = empty($item->check_time) ? '-' : date('Y-m-d H:i', $item->check_time);
$item->pay_name = Db::name('Admin')->where(['id' => $item->pay_admin_id])->value('name');
$item->pay_time = empty($item->pay_time) ? '-' : date('Y-m-d H:i', $item->pay_time);
$item->amount = Db::name('ExpenseInterfix')->where(['exid' => $item->id])->sum('amount');
});
return $expense;
}
public function detail($id = 0)
{
$expense = Db::name('Expense')->where(['id' => $id])->find();
if ($expense) {
$expense['income_month'] = empty($expense['income_month']) ? '-' : date('Y-m', $expense['income_month']);
$expense['expense_time'] = empty($expense['expense_time']) ? '-' : date('Y-m-d', $expense['expense_time']);
$expense['user_name'] = Db::name('Admin')->where(['id' => $expense['admin_id']])->value('name');
$expense['department'] = Db::name('Department')->where(['id' => $expense['did']])->value('title');
$expense['amount'] = Db::name('ExpenseInterfix')->where(['exid' => $expense['id']])->sum('amount');
$expense['check_admin'] = Db::name('Admin')->where(['id' => $expense['check_admin_id']])->value('name');
$expense['pay_admin'] = Db::name('Admin')->where(['id' => $expense['pay_admin_id']])->value('name');
if ($expense['check_time'] > 0) {
$expense['check_time'] = date('Y-m-d H:i:s', $expense['check_time']);
}
if ($expense['pay_time'] > 0) {
$expense['pay_time'] = date('Y-m-d H:i:s', $expense['pay_time']);
}
else{
$expense['pay_time'] = '-';
}
$expense['list'] = Db::name('ExpenseInterfix')
->field('a.*,c.title as cate_title')
->alias('a')
->join('ExpenseCate c', 'a.cate_id = c.id','LEFT')
->where(['a.exid' => $expense['id']])
->select();
}
return $expense;
}
public function index()
{
if (request()->isAjax()) {
$param = get_params();
$where = [];
$where[] = ['status', '=', 1];
//按时间检索
$start_time = isset($param['start_time']) ? strtotime(urldecode($param['start_time'])) : 0;
$end_time = isset($param['end_time']) ? strtotime(urldecode($param['end_time'])) : 0;
if ($start_time > 0 && $end_time > 0) {
$where[] = ['expense_time', 'between', [$start_time, $end_time]];
}
if (isset($param['check_status']) && $param['check_status']!='') {
$where[] = ['check_status', '=', $param['check_status']];
}
$expense = $this->get_list($param, $where);
return table_assign(0, '', $expense);
} else {
return view();
}
}
//添加
public function add()
{
$param = get_params();
if (request()->isAjax()) {
$dbRes = false;
$admin_id = $this->uid;
$param['income_month'] = isset($param['income_month']) ? strtotime(urldecode($param['income_month'])) : 0;
$param['expense_time'] = isset($param['expense_time']) ? strtotime(urldecode($param['expense_time'])) : 0;
$param['check_status'] = 1;
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(ExpenseCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['update_time'] = time();
Db::startTrans();
try {
$res = ExpenseList::where('id', $param['id'])->strict(false)->field(true)->update($param);
if ($res !== false) {
$exid = $param['id'];
//相关内容多个数组;
$amountData = isset($param['amount']) ? $param['amount'] : '';
$remarksData = isset($param['remarks']) ? $param['remarks'] : '';
$cateData = isset($param['cate_id']) ? $param['cate_id'] : '';
$idData = isset($param['expense_id']) ? $param['expense_id'] : 0;
if ($amountData) {
foreach ($amountData as $key => $value) {
if (!$value) {
continue;
}
$data = [];
$data['id'] = $idData[$key];
$data['exid'] = $exid;
$data['admin_id'] = $admin_id;
$data['amount'] = $amountData[$key];
$data['cate_id'] = $cateData[$key];
$data['remarks'] = $remarksData[$key];
if ($data['amount'] == 0) {
Db::rollback();
return to_assign(1, '第' . ($key + 1) . '条报销金额不能为零');
}
if ($data['id'] > 0) {
$data['update_time'] = time();
$resa = Db::name('ExpenseInterfix')->strict(false)->field(true)->update($data);
} else {
$data['create_time'] = time();
$eid = Db::name('ExpenseInterfix')->strict(false)->field(true)->insertGetId($data);
}
}
}
add_log('edit', $exid, $param);
Db::commit();
$dbRes = true;
} else {
Db::rollback();
}
} catch (\Exception $e) { ##这里参数不能删除($e错误信息)
Db::rollback();
return to_assign(1, $e->getMessage());
}
} else {
try {
validate(ExpenseCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$param['admin_id'] = $admin_id;
$param['did'] = get_login_admin('did');
Db::startTrans();
try {
$exid = ExpenseList::strict(false)->field(true)->insertGetId($param);
if ($exid) {
//相关内容多个数组;
$amountData = isset($param['amount']) ? $param['amount'] : '';
$remarksData = isset($param['remarks']) ? $param['remarks'] : '';
$cateData = isset($param['cate_id']) ? $param['cate_id'] : '';
if ($amountData) {
foreach ($amountData as $key => $value) {
if (!$value) {
continue;
}
$data = [];
$data['exid'] = $exid;
$data['admin_id'] = $admin_id;
$data['amount'] = $amountData[$key];
$data['cate_id'] = $cateData[$key];
$data['remarks'] = $remarksData[$key];
$data['create_time'] = time();
if ($data['amount'] == 0) {
Db::rollback();
return to_assign(1, '第' . ($key + 1) . '条报销金额不能为零');
}
$eid = Db::name('ExpenseInterfix')->strict(false)->field(true)->insertGetId($data);
}
}
add_log('add', $exid, $param);
Db::commit();
$dbRes = true;
} else {
Db::rollback();
}
} catch (\Exception $e) { ##这里参数不能删除($e错误信息)
Db::rollback();
return to_assign(1, $e->getMessage());
}
}
if ($dbRes == true) {
return to_assign();
} else {
return to_assign(1, '保存失败');
}
}
else{
$id = isset($param['id']) ? $param['id'] : 0;
if ($id > 0) {
$expense = $this->detail($id);
View::assign('expense', $expense);
}
$expense_cate = Db::name('ExpenseCate')->where(['status' => 1])->select()->toArray();
View::assign('user', get_admin($this->uid));
View::assign('expense_cate', $expense_cate);
View::assign('id', $id);
return view();
}
}
//查看
public function view()
{
$id = empty(get_params('id')) ? 0 : get_params('id');
$expense = $this->detail($id);
View::assign('uid', $this->uid);
View::assign('expense', $expense);
return view();
}
//删除
public function delete()
{
$id = get_params("id");
$expense = $this->detail($id);
if ($expense['check_status'] == 2) {
return to_assign(1, "已审核的报销记录不能删除");
}
if ($expense['check_status'] == 3) {
return to_assign(1, "已打款的报销记录不能删除");
}
$data['status'] = '-1';
$data['id'] = $id;
$data['update_time'] = time();
if (Db::name('expense')->update($data) !== false) {
add_log('delete', $id);
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
}
//设置
public function check()
{
$param = get_params();
if (request()->isAjax()) {
if ($param['check_status'] == 2 || $param['check_status'] == 0) {
$param['check_admin_id'] = $this->uid;
$param['check_time'] = time();
}
if ($param['check_status'] == 3) {
$param['pay_admin_id'] = $this->uid;
$param['pay_time'] = time();
}
$res = ExpenseList::where('id', $param['id'])->strict(false)->field(true)->update($param);
if ($res !== false) {
return to_assign();
} else {
return to_assign(1, "操作失败");
}
} else {
$expense = $this->detail($param['id']);
View::assign('expense', $expense);
View::assign('uid', $this->uid);
return view();
}
}
}

View File

@ -0,0 +1,127 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\controller;
use app\base\BaseController;
use app\home\validate\FlowCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Flow extends BaseController
{
public function index()
{
if (request()->isAjax()) {
$list = Db::name('Flow')
->field('f.*,a.name as username,t.title as flow_cate')
->alias('f')
->join('Admin a', 'a.id = f.admin_id', 'left')
->join('FlowType t', 't.id = f.flow_cate', 'left')
->select()->toArray();
foreach ($list as $key => &$value){
$department = Db::name('Department')->where('id','in',$value['department_ids'])->column('title');
$value['department'] = implode(',',$department);
if($value['department']==''){
$value['department'] = '全公司';
}
}
return to_assign(0, '', $list);
} else {
return view();
}
}
//添加新增/编辑
public function add()
{
$param = get_params();
if (request()->isAjax()) {
$flowTypeData = isset($param['flowType']) ? $param['flowType'] : '';
$flowUidsData = isset($param['flowUids']) ? $param['flowUids'] : '';
$flow_list=[];
foreach ($flowTypeData as $key => $value) {
if (!$value) {
continue;
}
$item = [];
$item['flow_type'] = $value;
$item['flow_uids'] = $flowUidsData[$key];
$flow_list[]=$item;
}
$param['flow_list'] = serialize($flow_list);
if ($param['id'] > 0) {
try {
validate(FlowCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['update_time'] = time();
Db::name('Flow')->strict(false)->field(true)->update($param);
add_log('edit', $param['id'], $param);
} else {
try {
validate(FlowCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['admin_id'] = $this->uid;
$param['create_time'] = time();
$mid = Db::name('Flow')->strict(false)->field(true)->insertGetId($param);
add_log('add', $mid, $param);
}
return to_assign();
} else {
$id = isset($param['id']) ? $param['id'] : 0;
if($id>0){
$detail = Db::name('Flow')->where('id',$id)->find();
$detail['flow_list'] = unserialize($detail['flow_list']);
$detail['flow_cate_list'] = Db::name('FlowType')->where(['type'=>$detail['type'],'status'=>1])->select()->toArray();
View::assign('detail', $detail);
}
View::assign('id', $id);
return view();
}
}
//添加&编辑
public function flow()
{
$param = get_params();
if (request()->isAjax()) {
}
else{
return view();
}
}
//禁用/启用
public function check()
{
$param = get_params();
$param['update_time']= time();
$res = Db::name('Flow')->strict(false)->field('status,update_time')->update($param);
if($res!==false){
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}
else if($param['status'] == 1){
add_log('recovery', $param['id'], $param);
}
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
}

View File

@ -20,12 +20,11 @@ class Index extends BaseController
if (request()->isAjax()) {
$admin_id = $this->uid;
//发票待审核统计
$invoice_map_check[] = ['check_time','=',0];
$invoice_map_check[] = ['check_admin_id','=',$admin_id];
$invoice_map_check[] = ['check_status','<',2];
$invoice_map_check[] = ['', 'exp', Db::raw("FIND_IN_SET('{$admin_id}',check_admin_ids)")];
$invoice_map_check[] = ['status','=',1];
$invoice_count_check = Db::name('Invoice')->where($invoice_map_check)->count();
$statistics['invoice_html_check'] = '<a data-id="41" data-title="待审核发票" data-src="/home/invoice/index.html" class="site-menu-active"> 您有<font style="color:#FF0000">'.$invoice_count_check.'</font>条发票申请待审核</a>';
//$statistics['invoice_count_check'] = $invoice_count_check;
$statistics['invoice_html_check'] = '<a data-id="129" data-title="待审核发票" data-src="finance/invoice/list" class="site-menu-active"> 您有<font style="color:#FF0000">'.$invoice_count_check.'</font>条发票申请待审核</a>';
if($invoice_count_check==0){
$statistics['invoice_html_check'] = '';
}
@ -35,18 +34,17 @@ class Index extends BaseController
$invoice_map_open[] = ['open_admin_id','=',$admin_id];
$invoice_map_open[] = ['status','=',1];
$invoice_count_open = Db::name('Invoice')->where($invoice_map_open)->count();
$statistics['invoice_html_open'] = '<a data-id="41" data-title="待开具发票" data-src="/home/invoice/index.html" class="site-menu-active"> 您有<font style="color:#FF0000">'.$invoice_count_open.'</font>条发票待开具</a>';
// $statistics['invoice_count_open'] = $invoice_count_open;
$statistics['invoice_html_open'] = '<a data-id="130" data-title="发票开具" data-src="finance/invoice/checkedlist" class="site-menu-active"> 您有<font style="color:#FF0000">'.$invoice_count_open.'</font>条发票待开具</a>';
if($invoice_count_open==0){
$statistics['invoice_html_open'] = '';
}
//待审核的报销统计
$expense_map_check[] = ['check_time','=',0];
$expense_map_check[] = ['check_admin_id','=',$admin_id];
$expense_map_check[] = ['check_status','<',2];
$expense_map_check[] = ['', 'exp', Db::raw("FIND_IN_SET('{$admin_id}',check_admin_ids)")];
$expense_map_check[] = ['status','=',1];
$expense_count_check = Db::name('Expense')->where($expense_map_check)->count();
$statistics['expense_html_check'] = '<a data-id="40" data-title="报销管理" data-src="/home/expense/index.html" class="site-menu-active"> 您有<font style="color:#FF0000">'.$expense_count_check.'</font>条报销单待审核</a>';
$statistics['expense_html_check'] = '<a data-id="120" data-title="待我审批的报销" data-src="finance/expense/list" class="site-menu-active"> 您有<font style="color:#FF0000">'.$expense_count_check.'</font>条报销单待审核</a>';
// $statistics['expense_count_check'] = $expense_count_check;
if($expense_count_check==0){
$statistics['expense_html_check'] = '';
@ -69,8 +67,22 @@ class Index extends BaseController
return to_assign(0,'ok',$statistics);
}
else{
$menu = get_admin_menus();
View::assign('menu', $menu);
$admin = get_login_admin();
if (get_cache('menu' . $admin['id'])) {
$list = get_cache('menu' . $admin['id']);
} else {
$adminGroup = Db::name('PositionGroup')->where(['pid' => $admin['position_id']])->column('group_id');
$adminMenu = Db::name('AdminGroup')->where('id', 'in', $adminGroup)->column('rules');
$adminMenus = [];
foreach ($adminMenu as $k => $v) {
$v = explode(',', $v);
$adminMenus = array_merge($adminMenus, $v);
}
$menu = Db::name('AdminRule')->where(['menu' => 1,'status'=>1])->where('id', 'in', $adminMenus)->order('sort asc')->select()->toArray();
$list = list_to_tree($menu);
\think\facade\Cache::tag('adminMenu')->set('menu' . $admin['id'], $list);
}
View::assign('menu', $list);
return View();
}
}
@ -83,11 +95,15 @@ class Index extends BaseController
}
$adminCount = Db::name('Admin')->where('status', '1')->count();
$articleCount = Db::name('Article')->where('status', '1')->count();
$scheduleCount = Db::name('Schedule')->where('status', '1')->count();
$approveCount = Db::name('Approve')->count();
$expenseCount = Db::name('Expense')->count();
$invoiceCount = Db::name('Invoice')->count();
View::assign('install', $install);
View::assign('adminCount', $adminCount);
View::assign('articleCount', $articleCount);
View::assign('scheduleCount', $scheduleCount);
View::assign('approveCount', $approveCount);
View::assign('expenseCount', $expenseCount);
View::assign('invoiceCount', $invoiceCount);
return View();
}

View File

@ -1,267 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\controller;
use app\base\BaseController;
use app\home\model\InvoiceSubject;
use app\home\model\Invoice as InvoiceList;
use app\home\validate\InvoiceSubjectCheck;
use app\home\validate\InvoiceCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Invoice extends BaseController
{
public function subject()
{
if (request()->isAjax()) {
$subject = Db::name('InvoiceSubject')->order('create_time asc')->select();
return to_assign(0, '', $subject);
} else {
return view();
}
}
//提交保存分类
public function subject_add()
{
if (request()->isAjax()) {
$param = get_params();
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(InvoiceSubjectCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['update_time'] = time();
$res = InvoiceSubject::strict(false)->field(true)->update($param);
if ($res) {
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}
else if($param['status'] == 1){
add_log('recovery', $param['id'], $param);
}
else{
add_log('edit', $param['id'], $param);
}
}
return to_assign();
} else {
try {
validate(InvoiceSubjectCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$insertId = InvoiceSubject::strict(false)->field(true)->insertGetId($param);
if ($insertId) {
add_log('add', $insertId, $param);
}
return to_assign();
}
}
}
public function get_list($param = [], $where = [])
{
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$expense = InvoiceList::where($where)
->order('id desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
$item->user = Db::name('Admin')->where(['id' => $item->admin_id])->value('name');
$item->department = Db::name('Department')->where(['id' => $item->did])->value('title');
$item->check_name = Db::name('Admin')->where(['id' => $item->check_admin_id])->value('name');
$item->check_time = empty($item->check_time) ? '-' : date('Y-m-d H:i', $item->check_time);
$item->open_name = Db::name('Admin')->where(['id' => $item->open_admin_id])->value('name');
$item->open_time = empty($item->open_time) ? '-' : date('Y-m-d H:i', $item->open_time);
});
return $expense;
}
public function detail($id = 0)
{
$invoice = Db::name('Invoice')->where(['id' => $id])->find();
if ($invoice) {
$invoice['user'] = Db::name('Admin')->where(['id' => $invoice['admin_id']])->value('name');
$invoice['department'] = Db::name('Department')->where(['id' => $invoice['did']])->value('title');
$invoice['check_admin'] = Db::name('Admin')->where(['id' => $invoice['check_admin_id']])->value('name');
$invoice['open_admin'] = Db::name('Admin')->where(['id' => $invoice['open_admin_id']])->value('name');
if ($invoice['check_time'] > 0) {
$invoice['check_time'] = empty($invoice['check_time']) ? '0' : date('Y-m-d H:i', $invoice['check_time']);
}
if ($invoice['open_time'] > 0) {
$invoice['open_time'] = empty($invoice['open_time']) ? '0' : date('Y-m-d H:i', $invoice['open_time']);
}
else{
$invoice['open_time'] = '-';
}
}
return $invoice;
}
public function index()
{
if (request()->isAjax()) {
$param = get_params();
$where = [];
$where[] = ['status', '=', 1];
//按时间检索
$start_time = isset($param['start_time']) ? strtotime(urldecode($param['start_time'])) : 0;
$end_time = isset($param['end_time']) ? strtotime(urldecode($param['end_time'])) : 0;
if ($start_time > 0 && $end_time > 0) {
$where[] = ['create_time', 'between', [$start_time, $end_time]];
}
if (isset($param['invoice_status']) && $param['invoice_status']!='') {
$where[] = ['invoice_status', '=', $param['invoice_status']];
}
$invoice = $this->get_list($param, $where);
return table_assign(0, '', $invoice);
} else {
return view();
}
}
//添加&编辑
public function add()
{
$param = get_params();
if (request()->isAjax()) {
$param['invoice_status'] = 1;
if ($param['type'] == 1) {
if (!$param['invoice_tax']) {
return to_assign(1, '纳税人识别号不能为空');
}
if (!$param['invoice_bank']) {
return to_assign(1, '开户银行不能为空');
}
if (!$param['invoice_account']) {
return to_assign(1, '银行账号不能为空');
}
if (!$param['invoice_banking']) {
return to_assign(1, '银行营业网点不能为空');
}
if (!$param['invoice_address']) {
return to_assign(1, '银地址不能为空');
}
}
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(InvoiceCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['update_time'] = time();
$res = InvoiceList::where('id', $param['id'])->strict(false)->field(true)->update($param);
if ($res !== false) {
add_log('edit', $param['id'], $param);
return to_assign();
} else {
return to_assign(1, '操作失败');
}
} else {
try {
validate(InvoiceCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$admin_id = $this->uid;
$param['admin_id'] = $admin_id;
$param['did'] = get_login_admin('did');
$param['create_time'] = time();
$exid = InvoiceList::strict(false)->field(true)->insertGetId($param);
if ($exid) {
add_log('apply', $exid, $param);
return to_assign();
} else {
return to_assign(1, '操作失败');
}
}
} else {
$id = isset($param['id']) ? $param['id'] : 0;
if ($id > 0) {
$detail = $this->detail($id);
View::assign('detail', $detail);
}
View::assign('user', get_admin($this->uid));
View::assign('id', $id);
return view();
}
}
//查看
public function view()
{
$id = empty(get_params('id')) ? 0 : get_params('id');
$detail = $this->detail($id);
View::assign('uid', $this->uid);
View::assign('detail', $detail);
return view();
}
//删除
public function delete()
{
$id = get_params("id");
$detail = $this->detail($id);
if ($detail['invoice_status'] == 2) {
return to_assign(1, "已审核的发票不能删除");
}
if ($detail['invoice_status'] == 3) {
return to_assign(1, "已开具的发票不能删除");
}
$data['status'] = '-1';
$data['id'] = $id;
$data['update_time'] = time();
if (Db::name('Invoice')->update($data) !== false) {
add_log('delete', $id);
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
}
//设置
public function check()
{
$param = get_params();
if (request()->isAjax()) {
if ($param['invoice_status'] == 2 || $param['invoice_status'] == 0) {
$param['check_time'] = time();
add_log('check', $param['id'],$param);
}
if ($param['invoice_status'] == 3) {
$param['open_time'] = time();
add_log('open', $param['id'],$param);
}
if ($param['invoice_status'] == 10) {
$count = Db::name('InvoiceIncome')->where(['inid'=>$param['id'],'status'=>1])->count();
if($count>0){
return to_assign(1, "发票已经新增有到账记录,请先反到账后再作废发票");
}
else{
$param['update_time'] = time();
add_log('tovoid', $param['id'],$param);
}
}
$res = InvoiceList::where('id', $param['id'])->strict(false)->field(true)->update($param);
if ($res !== false) {
return to_assign();
} else {
return to_assign(1, "操作失败");
}
}
}
}

View File

@ -0,0 +1,62 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\controller;
use app\base\BaseController;
use think\facade\Db;
use think\facade\View;
class Log extends BaseController
{
//管理员操作日志
public function index()
{
if (request()->isAjax()) {
$param = get_params();
$where = array();
if (!empty($param['keywords'])) {
$where[] = ['name|rule_menu|param_id', 'like', '%' . $param['keywords'] . '%'];
}
if (!empty($param['action'])) {
$where['action'] = $param['action'];
}
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = DB::name('AdminLog')
->field("id,uid,name,action,title,content,rule_menu,ip,param_id,param,FROM_UNIXTIME(create_time,'%Y-%m-%d %H:%i:%s') create_time")
->order('create_time desc')
->where($where)
->paginate($rows, false, ['query' => $param]);
$content->toArray();
foreach ($content as $k => $v) {
$data = $v;
$param_array = json_decode($v['param'], true);
if(is_array($param_array)){
$param_value = '';
foreach ($param_array as $key => $value) {
if (is_array($value)) {
$value = implode(',', $value);
}
$param_value .= $key . ':' . $value . '&nbsp;&nbsp;|&nbsp;&nbsp;';
}
$data['param'] = $param_value;
}
else{
$data['param'] = $param_array;
}
$content->offsetSet($k, $data);
}
return table_assign(0, '', $content);
} else {
$type_action = get_config('log.type_action');
View::assign('type_action', $type_action);
return view();
}
}
}

View File

@ -1,96 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\controller;
use app\base\BaseController;
use app\home\validate\MenuCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Menu extends BaseController
{
public function index()
{
if (request()->isAjax()) {
$menu = Db::name('AdminMenu')->order('sort asc')->select();
return to_assign(0, '', $menu);
} else {
return view();
}
}
//添加菜单页面
public function add()
{
$param = get_params();
if (request()->isAjax()) {
if ($param['id'] > 0) {
try {
validate(MenuCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['update_time'] = time();
Db::name('AdminMenu')->strict(false)->field(true)->update($param);
add_log('edit', $param['id'], $param);
} else {
try {
validate(MenuCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$mid = Db::name('AdminMenu')->strict(false)->field(true)->insertGetId($param);
//自动为系统所有者管理组分配新增的菜单
$group = Db::name('AdminGroup')->find(1);
if (!empty($group)) {
$newGroup['id'] = 1;
$newGroup['menus'] = $group['menus'] . ',' . $mid;
Db::name('AdminGroup')->strict(false)->field(true)->update($newGroup);
add_log('add', $mid, $param);
}
}
// 删除后台菜单缓存
clear_cache('adminMenu');
return to_assign();
} else {
$id = isset($param['id']) ? $param['id'] : 0;
$pid = isset($param['pid']) ? $param['pid'] : 0;
if($id>0){
$detail = Db::name('AdminMenu')->where('id',$id)->find();
View::assign('detail', $detail);
}
View::assign('id', $id);
View::assign('pid', $pid);
return view();
}
}
//删除
public function delete()
{
$id = get_params('id');
$count = Db::name('AdminMenu')->where(['pid' => $id])->count();
if ($count > 0) {
return to_assign(1, '该菜单下还有子菜单,无法删除');
}
if (Db::name('AdminMenu')->delete($id) !== false) {
// 删除后台菜单缓存
clear_cache('adminMenu');
add_log('delete', $id, []);
return to_assign(0, '删除菜单成功');
} else {
return to_assign(1, '删除失败');
}
}
}

View File

@ -0,0 +1,98 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\controller;
use app\base\BaseController;
use app\home\validate\ModuleCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Module extends BaseController
{
public function index()
{
if (request()->isAjax()) {
$module = Db::name('AdminModule')->select();
return to_assign(0, '', $module);
} else {
return view();
}
}
//添加新增/编辑
public function add()
{
$param = get_params();
if (request()->isAjax()) {
$param['name'] = preg_replace('# #','',$param['name']);
if ($param['id'] > 0) {
if($param['id'] == 1 || $param['id'] == 2){
return to_assign(1,'系统默认模块不能编辑');
}
try {
validate(ModuleCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['update_time'] = time();
Db::name('AdminModule')->strict(false)->field(true)->update($param);
add_log('edit', $param['id'], $param);
} else {
try {
validate(ModuleCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
$mid = Db::name('AdminModule')->strict(false)->field(true)->insertGetId($param);
add_log('add', $mid, $param);
}
return to_assign();
} else {
$id = isset($param['id']) ? $param['id'] : 0;
if($id>0){
$detail = Db::name('AdminModule')->where('id',$id)->find();
View::assign('detail', $detail);
}
View::assign('id', $id);
return view();
}
}
//禁用/启用
public function disable()
{
$param = get_params();
$module = Db::name('AdminModule')->where('id',$param['id'])->find();
if($module['type'] == 1){
return to_assign(1,'系统模块不能禁用');
}
$param['update_time']= time();
$res = Db::name('AdminModule')->strict(false)->field('status,update_time')->update($param);
if($res!==false){
Db::name('AdminRule')->strict(false)->where('module',$module['name'])->field('status')->update(['status'=>$param['status']]);
// 删除后台节点缓存
clear_cache('adminRules');
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}
else if($param['status'] == 1){
add_log('recovery', $param['id'], $param);
}
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
}

View File

@ -41,9 +41,7 @@ class Role extends BaseController
{
$param = get_params();
if (request()->isAjax()) {
$menuData = isset($param['menu']) ? $param['menu'] : 0;
$ruleData = isset($param['rule']) ? $param['rule'] : 0;
$param['menus'] = implode(',', $menuData);
$param['rules'] = implode(',', $ruleData);
if (!empty($param['id']) && $param['id'] > 0) {
try {
@ -74,19 +72,15 @@ class Role extends BaseController
return to_assign();
} else {
$id = isset($param['id']) ? $param['id'] : 0;
$menu = get_admin_menu();
$rule = get_admin_rule();
$rule = admin_rule();
if ($id > 0) {
$group = get_admin_group_info($id);
$role_menu = create_tree_list(0, $menu, $group['menus']);
$role_rule = create_tree_list(0, $rule, $group['rules']);
$rules = admin_group_info($id);
$role_rule = create_tree_list(0, $rule, $rules);
$role = Db::name('AdminGroup')->where(['id' => $id])->find();
View::assign('role', $role);
} else {
$role_menu = create_tree_list(0, $menu, []);
$role_rule = create_tree_list(0, $rule, []);
}
View::assign('role_menu', $role_menu);
View::assign('role_rule', $role_rule);
View::assign('id', $id);
return view();

View File

@ -20,7 +20,12 @@ class Rule extends BaseController
public function index()
{
if (request()->isAjax()) {
$rule = Db::name('adminRule')->order('create_time asc')->select();
$rule = Db::name('adminRule')
->field('a.*,m.title as module_title')
->alias('a')
->leftJoin('adminModule m','a.module = m.name')
->order('a.sort asc a.id asc')
->select();
return to_assign(0, '', $rule);
} else {
return view();
@ -32,6 +37,7 @@ class Rule extends BaseController
{
$param = get_params();
if (request()->isAjax()) {
$param['src'] = preg_replace('# #','',$param['src']);
if ($param['id'] > 0) {
try {
validate(RuleCheck::class)->scene('edit')->check($param);

View File

@ -1,85 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\home\model;
use think\Model;
use think\facade\Db;
class Message extends Model
{
const ZERO = 0;
const ONE = 1;
const TWO = 2;
const THREE = 3;
const FOUR = 4;
const FINE = 5;
public static $Source = [
self::ZERO => '无',
self::ONE => '已发消息',
self::TWO => '草稿消息',
self::THREE => '已收消息',
];
public static $Type = [
self::ZERO => '系统',
self::ONE => '同事',
self::TWO => '部门',
self::THREE => '岗位',
self::FOUR => '全部',
];
//获取消息列表
public function getList($map = [], $param = [],$uid)
{
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
//垃圾箱列表特殊处理
if ($param['status'] == 0) {
$where = [['from_uid', '=', $uid], ['to_uid', '=', $uid]];
$mail = $this->where($map)
->where(function ($query) use ($where) {$query->whereOr($where);})
->order('create_time desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
if($item->template==0){
$item->msg_type = '个人信息';
$item->from_name = Db::name('Admin')->where(['id' => $item->from_uid])->value('name');
}
else{
$item->msg_type = '系统信息';
$item->from_name = '系统';
}
$item->send_time = empty($item->send_time) ? '-' : date('Y-m-d H:i:s', $item->send_time);
$item->to_name = Db::name('Admin')->where(['id' => $item->to_uid])->value('name');
$item->type_title = self::$Type[(int)$item->type];
$item->delete_source_title = self::$Source[(int)$item->delete_source];
$item->files = Db::name('MessageFileInterfix')->where(['mid' => $item->id, 'status' => 1])->count();
});
return $mail;
} else {
$mail = self::where($map)
->order('create_time desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
if($item->template==0){
$item->msg_type = '个人信息';
$item->from_name = Db::name('Admin')->where(['id' => $item->from_uid])->value('name');
}
else{
$item->msg_type = '系统信息';
$item->from_name = '系统';
}
$item->send_time = empty($item->send_time) ? '-' : date('Y-m-d H:i:s', $item->send_time);
$item->to_name = Db::name('Admin')->where(['id' => $item->to_uid])->value('name');
$item->type_title = self::$Type[(int)$item->type];
$item->files = Db::name('MessageFileInterfix')->where(['mid' => $item->id, 'status' => 1])->count();
});
return $mail;
}
}
}

View File

@ -1,15 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\home\model;
use think\Model;
class NoteCate extends Model
{
}

View File

@ -9,21 +9,21 @@ namespace app\home\validate;
use think\Validate;
class MenuCheck extends Validate
class CarCateCheck extends Validate
{
protected $rule = [
'title' => 'require|unique:admin_menu',
'title' => 'require|unique:cost_cate',
'id' => 'require',
];
protected $message = [
'title.require' => '菜单名称不能为空',
'title.unique' => '同样的菜单名称已经存在',
'title.require' => '名称不能为空',
'title.unique' => '同样的名称已经存在',
'id.require' => '缺少更新条件',
];
protected $scene = [
'add' => ['title'],
'edit' => ['id','title'],
'edit' => ['id', 'title'],
];
}

View File

@ -0,0 +1,29 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\home\validate;
use think\Validate;
class CostCateCheck extends Validate
{
protected $rule = [
'title' => 'require|unique:seal_cate',
'id' => 'require',
];
protected $message = [
'title.require' => '名称不能为空',
'title.unique' => '同样的名称已经存在',
'id.require' => '缺少更新条件',
];
protected $scene = [
'add' => ['title'],
'edit' => ['id', 'title'],
];
}

View File

@ -1,23 +0,0 @@
<?php
namespace app\home\validate;
use think\Validate;
class ExpenseCheck extends Validate
{
protected $rule = [
'code' => 'require',
'id' => 'require',
'status' => 'require'
];
protected $message = [
'code.require' => '报销凭证编号不能为空',
'id.require' => '缺少更新条件',
'status.require' => '状态为必选',
];
protected $scene = [
'add' => ['code'],
'edit' => ['id', 'code']
];
}

View File

@ -0,0 +1,29 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\home\validate;
use think\Validate;
class FlowCheck extends Validate
{
protected $rule = [
'name' => 'require|unique:flow',
'id' => 'require',
];
protected $message = [
'name.require' => '名称不能为空',
'name.unique' => '同样的名称已经存在',
'id.require' => '缺少更新条件',
];
protected $scene = [
'add' => ['name',],
'edit' => ['id','name'],
];
}

View File

@ -0,0 +1,34 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\home\validate;
use think\Validate;
class FlowTypeCheck extends Validate
{
protected $rule = [
'title' => 'require|unique:flow_type',
'name' => 'require|lower|min:2|unique:flow_type',
'id' => 'require',
];
protected $message = [
'title.require' => '名称不能为空',
'title.unique' => '同样的名称已经存在',
'name.require' => '标识不能为空',
'name.lower' => '标识只能是小写字符',
'name.min' => '标识至少需要2个小写字符',
'name.unique' => '同样的标识已经存在',
'id.require' => '缺少更新条件',
];
protected $scene = [
'add' => ['title','name'],
'edit' => ['id','title','name'],
];
}

View File

@ -1,26 +0,0 @@
<?php
namespace app\home\validate;
use think\Validate;
class InvoiceCheck extends Validate
{
protected $rule = [
'amount' => 'require|float',
'invoice_type' => 'require',
'invoice_subject' => 'require',
'id' => 'require'
];
protected $message = [
'amount.require' => '开票金额不能为空',
'amount.number' => '开票金额只能为数字',
'id.require' => '缺少更新条件',
'invoice_type.require' => '请选择开票类型',
'invoice_subject.require' => '请选择开票主体',
];
protected $scene = [
'add' => ['amount','invoice_type','invoice_subject'],
'edit' => ['id', 'amount','invoice_type','invoice_subject']
];
}

View File

@ -7,7 +7,6 @@
namespace app\home\validate;
use think\facade\Db;
use think\Validate;
class KeywordsCheck extends Validate

View File

@ -0,0 +1,34 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\home\validate;
use think\Validate;
class ModuleCheck extends Validate
{
protected $rule = [
'title' => 'require|unique:admin_module',
'name' => 'require|upper|min:2|unique:admin_module',
'id' => 'require',
];
protected $message = [
'title.require' => '模块名称不能为空',
'title.unique' => '同样的模块名称已经存在',
'name.require' => '模块标识不能为空',
'name.upper' => '模块标识只能是大写字符',
'name.min' => '模块标识至少需要2个大写字符',
'name.unique' => '同样的模块标识已经存在',
'id.require' => '缺少更新条件',
];
protected $scene = [
'add' => ['title','name'],
'edit' => ['id','title','name'],
];
}

View File

@ -12,23 +12,23 @@ use think\Validate;
class RuleCheck extends Validate
{
protected $rule = [
'title' => 'require|unique:admin_rule',
'title' => 'require',
'name' => 'require',
'menu' => 'require',
'src' => 'unique:admin_rule',
'id' => 'require',
];
protected $message = [
'title.require' => '节点名称不能为空',
'title.unique' => '同样的节点名称已经存在',
'src.unique' => '同样的节点规则已经存在',
'title.require' => '菜单节点名称不能为空',
'src.unique' => '同样的菜单节点URL已经存在',
'menu.require' => '是否是左侧菜单需要选择',
'name.require' => '节点日志操作名称不能为空',
'id.require' => '缺少更新条件',
'filed.require' => '缺少要更新的字段名',
'id.require' => '缺少更新条件'
];
protected $scene = [
'add' => ['title','src','name'],
'edit' => ['id', 'title','src','name']
'add' => ['title','src','name','menu'],
'edit' => ['id', 'title','src','name','menu']
];
}

View File

@ -0,0 +1,29 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\home\validate;
use think\Validate;
class SealCateCheck extends Validate
{
protected $rule = [
'title' => 'require|unique:cost_cate',
'id' => 'require',
];
protected $message = [
'title.require' => '名称不能为空',
'title.unique' => '同样的名称已经存在',
'id.require' => '缺少更新条件',
];
protected $scene = [
'add' => ['title'],
'edit' => ['id', 'title'],
];
}

View File

@ -1,4 +1,4 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table" style="margin-bottom:0">
@ -18,7 +18,7 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
function init(layui) {
var treeGrid = layui.treeGrid,
layer = layui.layer,
rightpage = layui.rightpage,
@ -26,7 +26,7 @@
id:'treeTable'
,elem: '#treeTable'
,idField:'id'
,url: "/home/article/cate"
,url: "/home/cate/article_cate"
,cellMinWidth: 100
,treeId:'id'//树形id字段名称
,treeUpId:'pid'//树形父id字段名称
@ -49,24 +49,24 @@
//表头工具栏事件
$('.add-menu').on('click', function(){
rightpage.open("/home/article/cate_add");
rightpage.open("/home/cate/article_cate_add",'900px');
return;
});
//操作按钮
treeGrid.on('tool(treeTable)', function (obj) {
if (obj.event === 'add') {
rightpage.open('/home/article/cate_add?pid='+obj.data.id);
rightpage.open('/home/cate/article_cate_add?pid='+obj.data.id,'900px');
return;
}
if (obj.event === 'edit') {
rightpage.open('/home/article/cate_add?id='+obj.data.id);
rightpage.open('/home/cate/article_cate_add?id='+obj.data.id,'900px');
return;
}
if (obj.event === 'del') {
layer.confirm('确定要删除吗?', { icon: 3, title: '提示' }, function (index) {
$.ajax({
url: "/home/article/cate_delete",
url: "/home/cate/article_cate_delete",
type: 'post',
data: { id: obj.data.id },
success: function (e) {
@ -82,6 +82,6 @@
});
}
</script>
{include file="common/layui" base='base' extend="['treeGrid','rightpage']" callback="init" /}
{include file="../../base/view/common/layui" base='base' extend="['treeGrid','rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,7 +1,7 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<form class="layui-form page-content">
<h3 class="h3-title">知识分类</h3>
{eq name="$id" value="0"}
<table class="layui-table">
@ -10,7 +10,7 @@
<td>
<select name="pid" lay-verify="required" lay-reqText="请选择父级分类">
<option value="0">作为顶级分类</option>
{volist name=":set_recursion(get_article_cate())" id="v"}
{volist name="$cates" id="v"}
<option value="{$v.id}" {eq name="$pid" value="$v.id"}selected=""{/eq}>{$v.title}</option>
{/volist}
</select>
@ -36,7 +36,7 @@
<td>
<select name="pid" lay-verify="required" lay-reqText="请选择父级分类">
<option value="0">作为顶级分类</option>
{volist name=":set_recursion(get_article_cate())" id="v"}
{volist name="$cates" id="v"}
<option value="{$v.id}" {eq name="$detail.pid" value="$v.id"}selected=""{/eq}>{$v.title}</option>
{/volist}
</select>
@ -75,16 +75,15 @@
//监听提交
form.on('submit(webform)', function(data){
$.ajax({
url: "/home/article/cate_add",
url: "/home/cate/article_cate_add",
type:'post',
data:data.field,
success:function(e){
if(e.code==0){
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function(){
parent.location.reload();
});
}else{
layer.msg(e.msg);
},1000);
}
}
})
@ -92,6 +91,6 @@
});
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{include file="../../base/view/common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,166 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm addNew" type="button">+ 添加车辆类型</button>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui){
var table=layui.table,
layer=layui.layer;
var tableIns = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,title:'车辆类型列表'
,url: "/home/cate/car_cate"
,page: true //开启分页
,limit: 20
,cellMinWidth: 80
,cols: [[
{field:'id',width:80, title: 'ID号', align:'center'}
,{field:'title',title: '车辆名称'}
,{field:'name',title: '车牌号码'}
,{field:'status', title: '状态',width:80,align:'center',templet: function(d){
var html1='<span>正常</span>';
var html2='<span style="color:#FF5722">禁用</span>';
if(d.status==1){
return html1;
}
else{
return html2;
}
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}
else{
html = '<div class="layui-btn-group">'+btn+btn2+'</div>';
}
return html;
}}
]]
});
table.on('tool(test)',function (obj) {
if(obj.event === 'edit'){
addExpense(obj.data.id,obj.data.title,obj.data.name);
}
if(obj.event === 'disable'){
layer.confirm('确定要禁用该车辆吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/cate/car_cate_check",
type: 'post',
data: {
id: obj.data.id,
status: 0
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
tableIns.reload();
}
}
})
layer.close(index);
});
}
if(obj.event === 'open'){
layer.confirm('确定要启用该车辆吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/cate/car_cate_check",
type: 'post',
data: {
id: obj.data.id,
status: 1
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
tableIns.reload();
}
}
})
layer.close(index);
});
}
});
$('.body-table').on('click','.addNew',function(){
addExpense(0,'','');
});
function addExpense(id,title,name){
var biaoti = '新增车辆';
if(id>0){
biaoti = '编辑车辆';
}
layer.open({
type: 1
,title: biaoti
,area: '368px;'
,id: 'LAY_module' //设定一个id防止重复弹出
,btn: ['确定', '取消']
,btnAlign: 'c'
,content: '<div style="padding-top:15px;">\
<div class="layui-form-item">\
<label class="layui-form-label">车辆名称</label>\
<div class="layui-input-inline">\
<input type="hidden" name="id" value="'+id+'">\
<input type="text" name="title" autocomplete="off" value="'+title+'" placeholder="请输入车辆名称" class="layui-input">\
</div>\
</div>\
<div class="layui-form-item">\
<label class="layui-form-label">车牌号码</label>\
<div class="layui-input-inline">\
<input type="text" name="name" autocomplete="off" value="'+name+'" placeholder="请输入车牌号码" class="layui-input">\
</div>\
</div>\
</div>'
,yes: function(index){
let id = $('#LAY_module').find('[name="id"]').val();
let title = $('#LAY_module').find('[name="title"]').val();
let name = $('#LAY_module').find('[name="name"]').val();
$.ajax({
url: "/home/cate/car_cate_add",
type: 'post',
data: {
id: id,
title: title,
name: name
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.close(index);
tableIns.reload();
}
}
})
}
,btn2: function(){
layer.closeAll();
}
});
}
}
</script>
{include file="../../base/view/common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,150 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm addNew" type="button">+ 添加费用类型</button>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns = null;
function init(layui){
var table=layui.table,
form = layui.form,
layer=layui.layer;
tableIns = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,title:'费用类型列表'
,url: "/home/cate/cost_cate"
,page: true //开启分页
,limit: 20
,cellMinWidth: 80
,cols: [[
{field:'id',width:80, title: 'ID号', align:'center'}
,{field:'title',title: '类别名称'}
,{field:'status', title: '状态',width:80,align:'center',templet: function(d){
var html1='<span>正常</span>';
var html2='<span style="color:#FF5722">禁用</span>';
if(d.status==1){
return html1;
}
else{
return html2;
}
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}
else{
html = '<div class="layui-btn-group">'+btn+btn2+'</div>';
}
return html;
}}
]]
});
table.on('tool(test)',function (obj) {
if(obj.event === 'edit'){
addExpense(obj.data.id,obj.data.title);
}
if(obj.event === 'disable'){
layer.confirm('确定要禁用该类别吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/cate/cost_cate_check",
type: 'post',
data: {
id: obj.data.id,
status: 0,
title: obj.data.title,
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
tableIns.reload();
}
}
})
layer.close(index);
});
}
if(obj.event === 'open'){
layer.confirm('确定要启用该类别吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/cate/cost_cate_check",
type: 'post',
data: {
id: obj.data.id,
status: 1,
title: obj.data.title,
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
tableIns.reload();
}
}
})
layer.close(index);
});
}
});
$('.body-table').on('click','.addNew',function(){
addExpense(0,'');
});
function addExpense(id,val){
var title = '新增类别';
if(id>0){
title = '编辑类别';
}
layer.prompt({
title: title,
value: val,
yes: function(index, layero) {
// 获取文本框输入的值
var value = layero.find(".layui-layer-input").val();
if (value) {
$.ajax({
url: "/home/cate/cost_cate_add",
type: 'post',
data: {
id: id,
title: value,
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
tableIns.reload();
setTimeout(function(){
layer.closeAll();
}, 1000);
}
}
})
} else {
layer.msg('请填写类别标题');
}
}
})
}
}
</script>
{include file="../../base/view/common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,4 +1,4 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
@ -24,7 +24,7 @@
elem: '#test'
,toolbar: '#toolbarDemo'
,title:'报销类别列表'
,url: "/home/expense/cate"
,url: "/home/cate/expense_cate"
,page: true //开启分页
,limit: 20
,cellMinWidth: 80
@ -64,7 +64,7 @@
if(obj.event === 'disable'){
layer.confirm('确定要禁用该类别吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/expense/cate_add",
url: "/home/cate/expense_cate_check",
type: 'post',
data: {
id: obj.data.id,
@ -74,7 +74,7 @@
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout('location.reload()', 1000);
tableIns.reload();
}
}
})
@ -84,7 +84,7 @@
if(obj.event === 'open'){
layer.confirm('确定要启用该类别吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/expense/cate_add",
url: "/home/cate/expense_cate_check",
type: 'post',
data: {
id: obj.data.id,
@ -94,7 +94,7 @@
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout('location.reload()', 1000);
tableIns.reload();
}
}
})
@ -120,7 +120,7 @@
var value = layero.find(".layui-layer-input").val();
if (value) {
$.ajax({
url: "/home/expense/cate_add",
url: "/home/cate/expense_cate_add",
type: 'post',
data: {
id: id,
@ -128,9 +128,10 @@
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout('location.reload()', 1000);
}
tableIns.reload();
setTimeout(function(){
layer.closeAll();
}, 1000);
}
})
} else {
@ -141,6 +142,6 @@
}
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{include file="../../base/view/common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,135 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm addNew" type="button">+ 添加审批类型</button>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns = null;
function init(layui){
var table=layui.table,
rightpage = layui.rightpage,
layer=layui.layer;
tableIns = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,title:'审批模块列表'
,url: "/home/cate/flow_type"
,page: false //开启分页
,limit: 20
,cellMinWidth: 80
,cols: [[
{field:'id',width:80, title: 'ID号', align:'center'}
,{field:'title',title: '审批类型名称'}
,{field:'name',title: '审批类型标识'}
,{field:'icon',title: '审批类型图标'}
,{field:'type', title: '所属分类',width:100,align:'center',templet: function(d){
var html='';
if(d.type==1){
html = '假勤';
}
else if(d.type==2){
html = '行政';
}else if(d.type==3){
html = '财务';
}else if(d.type==4){
html = '人事';
}else if(d.type==5){
html = '其他';
}else if(d.type==6){
html = '报销';
}else if(d.type==7){
html = '发票';
}
return html;
}}
,{field:'status', title: '状态',width:80,align:'center',templet: function(d){
var html1='<span>正常</span>';
var html2='<span style="color:#FF5722">禁用</span>';
if(d.status==1){
return html1;
}
else{
return html2;
}
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}
else{
html = '<div class="layui-btn-group">'+btn+btn2+'</div>';
}
return html;
}}
]]
});
table.on('tool(test)',function (obj) {
if(obj.event === 'edit'){
rightpage.open("/home/cate/flow_type_add?id="+obj.data.id,'900px');
}
if(obj.event === 'disable'){
layer.confirm('确定要禁用该模块吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/cate/flow_type_check",
type: 'post',
data: {
id: obj.data.id,
status: 0
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
tableIns.reload();
}
}
})
layer.close(index);
});
}
if(obj.event === 'open'){
layer.confirm('确定要启用该模块吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/cate/flow_type_check",
type: 'post',
data: {
id: obj.data.id,
status: 1
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
tableIns.reload();
}
}
})
layer.close(index);
});
}
});
$('.body-table').on('click','.addNew',function(){
rightpage.open("/home/cate/flow_type_add",'900px');
return;
});
}
</script>
{include file="../../base/view/common/layui" base='base' extend="['rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,111 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">审批类型</h3>
{eq name="$id" value="0"}
<table class="layui-table">
<tr>
<td class="layui-td-gray">所属分类<font>*</font></td>
<td>
<select name="type" lay-verify="required" lay-reqText="请选择所属分类">
<option value="">--请选择--</option>
<option value="1">假勤</option>
<option value="2">行政</option>
<option value="3">财务</option>
<option value="4">人事</option>
<option value="5">其他</option>
<option value="6">报销</option>
<option value="7">发票</option>
</select>
</td>
<td class="layui-td-gray">名称<font>*</font></td>
<td>
<input type="text" name="title" autocomplete="off" placeholder="请输入审批类型名称" lay-verify="required" lay-reqText="请输入审批类型名称" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">标识<font>*</font></td>
<td>
<input type="text" name="name" placeholder="请输入审批类型标识" value="" autocomplete="off" lay-verify="required" lay-reqText="请输入审批类型标识" class="layui-input">
</td>
<td class="layui-td-gray">图标<font>*</font></td>
<td>
<input style="width:150px; display:inline" class="layui-input" type="text" name="icon" value="" placeholder="请输入审批类型图标" lay-verify="required" lay-reqText="请输入审批类型图标" >
icon-jichuguanli<a href="/static/layui/font/extend/demo_index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
</td>
</tr>
</table>
{else/}
<table class="layui-table">
<tr>
<td class="layui-td-gray">所属分类<font>*</font></td>
<td>
<select name="type" lay-verify="required" lay-reqText="请选择所属分类">
<option value="">--请选择--</option>
<option value="1" {eq name="$detail.type" value="1"}selected=""{/eq}>假勤</option>
<option value="2" {eq name="$detail.type" value="2"}selected=""{/eq}>行政</option>
<option value="3" {eq name="$detail.type" value="3"}selected=""{/eq}>财务</option>
<option value="4" {eq name="$detail.type" value="4"}selected=""{/eq}>人事</option>
<option value="5" {eq name="$detail.type" value="5"}selected=""{/eq}>其他</option>
<option value="6" {eq name="$detail.type" value="6"}selected=""{/eq}>报销</option>
<option value="7" {eq name="$detail.type" value="7"}selected=""{/eq}>发票</option>
</select>
</td>
<td class="layui-td-gray">名称<font>*</font></td>
<td>
<input type="text" name="title" value="{$detail.title}" placeholder="请输入审批类型名称" lay-verify="required" lay-reqText="请输入审批类型名称" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">标识<font>*</font></td>
<td>
<input type="text" name="name" placeholder="请输入审批类型标识" value="{$detail.name}" autocomplete="off" lay-verify="required" lay-reqText="请输入审批类型标识" class="layui-input">
</td>
<td class="layui-td-gray">图标<font>*</font></td>
<td>
<input style="width:150px; display:inline" class="layui-input" type="text" name="icon" value="{$detail.icon}" placeholder="请输入审批类型图标" lay-verify="required" lay-reqText="请输入审批类型图标" >
icon-jichuguanli<a href="/static/layui/font/extend/demo_index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
</td>
</tr>
</table>
{/eq}
<div style="padding: 10px 0">
<input type="hidden" name="id" value="{$id}">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui){
var form = layui.form
,layer = layui.layer;
//监听提交
form.on('submit(webform)', function(data){
$.ajax({
url: "/home/cate/flow_type_add",
type:'post',
data:data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.tableIns.reload();
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
}
})
return false;
});
}
</script>
{include file="../../base/view/common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,4 +1,4 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table" style="margin-bottom:0">
@ -26,7 +26,7 @@
id:'treeTable'
,elem: '#treeTable'
,idField:'id'
,url: "/home/note/cate"
,url: "/home/cate/note_cate"
,cellMinWidth: 100
,treeId:'id'//树形id字段名称
,treeUpId:'pid'//树形父id字段名称
@ -50,24 +50,24 @@
//表头工具栏事件
$('.add-menu').on('click', function(){
rightpage.open("/home/note/cate_add");
rightpage.open("/home/cate/note_cate_add",'900px');
return;
});
//操作按钮
treeGrid.on('tool(treeTable)', function (obj) {
if (obj.event === 'add') {
rightpage.open('/home/note/cate_add?pid='+obj.data.id);
rightpage.open('/home/cate/note_cate_add?pid='+obj.data.id,'900px');
return;
}
if (obj.event === 'edit') {
rightpage.open('/home/note/cate_add?id='+obj.data.id);
rightpage.open('/home/cate/note_cate_add?id='+obj.data.id,'900px');
return;
}
if (obj.event === 'del') {
layer.confirm('确定要删除吗?', { icon: 3, title: '提示' }, function (index) {
$.ajax({
url: "/home/note/cate_delete",
url: "/home/cate/note_cate_delete",
type: 'post',
data: { id: obj.data.id },
success: function (e) {
@ -83,6 +83,6 @@
});
}
</script>
{include file="common/layui" base='base' extend="['treeGrid','rightpage']" callback="init" /}
{include file="../../base/view/common/layui" base='base' extend="['treeGrid','rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,7 +1,7 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<form class="layui-form page-content">
<h3 class="h3-title">公告分类</h3>
{eq name="$id" value="0"}
<table class="layui-table">
@ -10,7 +10,7 @@
<td>
<select name="pid" lay-verify="required" lay-reqText="请选择父级分类">
<option value="0">作为顶级分类</option>
{volist name=":set_recursion(get_note_cate())" id="v"}
{volist name="$cates" id="v"}
<option value="{$v.id}" {eq name="$pid" value="$v.id"}selected=""{/eq}>{$v.title}</option>
{/volist}
</select>
@ -32,7 +32,7 @@
<td>
<select name="pid" lay-verify="required" lay-reqText="请选择父级分类">
<option value="0">作为顶级分类</option>
{volist name=":set_recursion(get_note_cate())" id="v"}
{volist name="$cates" id="v"}
<option value="{$v.id}" {eq name="$detail.pid" value="$v.id"}selected=""{/eq}>{$v.title}</option>
{/volist}
</select>
@ -67,16 +67,15 @@
//监听提交
form.on('submit(webform)', function(data){
$.ajax({
url: "/home/note/cate_add",
url: "/home/cate/note_cate_add",
type:'post',
data:data.field,
success:function(e){
if(e.code==0){
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function(){
parent.location.reload();
});
}else{
layer.msg(e.msg);
},1000);
}
}
})
@ -84,6 +83,6 @@
});
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{include file="../../base/view/common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,150 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm addNew" type="button">+ 添加印章类型</button>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns = null;
function init(layui){
var table=layui.table,
form = layui.form,
layer=layui.layer;
tableIns = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,title:'印章类型列表'
,url: "/home/cate/seal_cate"
,page: true //开启分页
,limit: 20
,cellMinWidth: 80
,cols: [[
{field:'id',width:80, title: 'ID号', align:'center'}
,{field:'title',title: '类别名称'}
,{field:'status', title: '状态',width:80,align:'center',templet: function(d){
var html1='<span>正常</span>';
var html2='<span style="color:#FF5722">禁用</span>';
if(d.status==1){
return html1;
}
else{
return html2;
}
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}
else{
html = '<div class="layui-btn-group">'+btn+btn2+'</div>';
}
return html;
}}
]]
});
table.on('tool(test)',function (obj) {
if(obj.event === 'edit'){
addExpense(obj.data.id,obj.data.title);
}
if(obj.event === 'disable'){
layer.confirm('确定要禁用该类别吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/cate/seal_cate_check",
type: 'post',
data: {
id: obj.data.id,
status: 0,
title: obj.data.title,
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
tableIns.reload();
}
}
})
layer.close(index);
});
}
if(obj.event === 'open'){
layer.confirm('确定要启用该类别吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/cate/seal_cate_check",
type: 'post',
data: {
id: obj.data.id,
status: 1,
title: obj.data.title,
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
tableIns.reload();
}
}
})
layer.close(index);
});
}
});
$('.body-table').on('click','.addNew',function(){
addExpense(0,'');
});
function addExpense(id,val){
var title = '新增类别';
if(id>0){
title = '编辑类别';
}
layer.prompt({
title: title,
value: val,
yes: function(index, layero) {
// 获取文本框输入的值
var value = layero.find(".layui-layer-input").val();
if (value) {
$.ajax({
url: "/home/cate/seal_cate_add",
type: 'post',
data: {
id: id,
title: value,
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
tableIns.reload();
setTimeout(function(){
layer.closeAll();
}, 1000);
}
}
})
} else {
layer.msg('请填写类别标题');
}
}
})
}
}
</script>
{include file="../../base/view/common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,4 +1,4 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
@ -24,7 +24,7 @@
elem: '#test'
,toolbar: '#toolbarDemo'
,title:'报销类别列表'
,url: "/home/invoice/subject"
,url: "/home/cate/subject"
,page: true //开启分页
,limit: 20
,cellMinWidth: 80
@ -64,17 +64,16 @@
if(obj.event === 'disable'){
layer.confirm('确定要禁用该发票主体吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/invoice/subject_add",
url: "/home/cate/subject_check",
type: 'post',
data: {
id: obj.data.id,
status: 0,
title: obj.data.title
status: 0
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout('location.reload()', 1000);
tableIns.reload();
}
}
})
@ -84,17 +83,16 @@
if(obj.event === 'open'){
layer.confirm('确定要启用该发票主体吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/invoice/subject_add",
url: "/home/cate/subject_check",
type: 'post',
data: {
id: obj.data.id,
status: 1,
title: obj.data.title
status: 1
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout('location.reload()', 1000);
tableIns.reload();
}
}
})
@ -120,7 +118,7 @@
var value = layero.find(".layui-layer-input").val();
if (value) {
$.ajax({
url: "/home/invoice/subject_add",
url: "/home/cate/subject_add",
type: 'post',
data: {
id: id,
@ -129,7 +127,10 @@
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout('location.reload()', 1000);
tableIns.reload();
setTimeout(function(){
layer.closeAll();
}, 1000);
}
}
})
@ -141,6 +142,6 @@
}
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{include file="../../base/view/common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,126 +0,0 @@
{extend name="common/base"/}
{block name="style"}
<link rel="stylesheet" href="{__JS__}/module/dtree/dtree.css">
<link rel="stylesheet" href="{__JS__}/module/dtree/font/dtreefont.css">
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<h3 class="h3-title">审核人配置</h3>
{if condition="$id eq 0"}
<table class="layui-table">
<tr>
<td class="layui-td-gray2">审核类型<font>*</font></td>
<td>
<select name="type" lay-verify="required" lay-reqText="请审核类型">
<option value=""></option>
<option value="1">报销审核</option>
<option value="2">报销打款确认</option>
<option value="3">发票审核</option>
<option value="4">发票开票</option>
</select>
</td>
<td class="layui-td-gray2">审核人<font>*</font></td>
<td>
<input type="hidden" name="uid" value=""/>
<input type="text" name="name" readonly autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" value="">
</td>
</tr>
<tr>
<td class="layui-td-gray2" style="vertical-align: top;">备注信息</td>
<td colspan="3">
<textarea name="remark" placeholder="请输入备注" class="layui-textarea"></textarea>
</td>
</tr>
</table>
{else/}
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray2">审核类型<font>*</font></td>
<td>
<select name="type" lay-verify="required" lay-reqText="请审核类型">
<option value=""></option>
<option value="1" {eq name="$detail.type" value="1"}selected{/eq}>报销审核</option>
<option value="2" {eq name="$detail.type" value="2"}selected{/eq}>报销打款确认</option>
<option value="3" {eq name="$detail.type" value="3"}selected{/eq}>发票审核</option>
<option value="4" {eq name="$detail.type" value="4"}selected{/eq}>发票开票</option>
</select>
</td>
<td class="layui-td-gray2">审核人<font>*</font></td>
<td>
<input type="hidden" name="uid" value="{$detail.uid}"/>
<input type="text" name="name" readonly autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" value="{$detail.name}">
</td>
</tr>
<tr>
<td class="layui-td-gray2" style="vertical-align: top;">备注信息</td>
<td colspan="3">
<textarea name="remark" placeholder="请输入备注" class="layui-textarea">{$detail.remark}</textarea>
</td>
</tr>
</table>
{/if}
<div style="padding: 10px 0">
<input type="hidden" name="id" value="{$id}" />
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form
, employeepicker = layui.employeepicker
, layer = layui.layer;
//添加人员
function addEmployee(){
var ids=$('[name="uid"]').val(),names=$('[name="name"]').val(),idsArray=[],namesArray=[];
if(ids!=''){
idsArray=ids.split(',');
namesArray=names.split(',');
}
employeepicker.init({
department_url: "/home/api/get_department_tree",
employee_url: "/home/api/get_employee",
ids:idsArray,
names:namesArray,
type:0,
callback:function(ids,names){
$('[name="uid"]').val(ids),
$('[name="name"]').val(names);
}
});
}
//选择对应人
$('[name="name"]').on('click',function(){
addEmployee();
});
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/home/check/add",
type: 'post',
data: data.field,
success: function (e) {
if (e.code == 0) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
parent.location.reload();
});
} else {
layer.msg(e.msg);
}
}
})
return false;
});
}
</script>
{include file="common/layui" base="base" extend="['employeepicker']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,96 +0,0 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm" lay-event="add">+ 添加审核人配置</button>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var table = layui.table,
rightpage = layui.rightpage,
form = layui.form;
var tableIns = table.render({
elem: '#test',
title: '配置列表',
toolbar: '#toolbarDemo',
url: "/home/check/index",
page: true, //开启分页
limit: 20,
cols: [
[{field: 'id',width: 80,title: 'ID编号',align: 'center'}
, { field: 'name', width: 180, title: '审核人姓名'}
, { field: 'type',width: 300,title: '审核类型', templet: function (d) {
var html = '';
if(d.type==1){
html='报销审核';
}
else if(d.type==2){
html='报销打款确认';
}
else if(d.type==3){
html='发票审核';
}
else if(d.type==4){
html='发票开票';
}
return html;
}}
, { field: 'remark', title: '备注'}
, {width: 100, title: '操作', align: 'center'
, templet: function (d) {
var html = '<div class="layui-btn-group">';
html+='<button class="layui-btn layui-btn-xs" lay-event="edit">编辑</button>';
html+= '<button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>';
html+= '</div>';
return html;
}
}]
]
});
//表头工具栏事件
table.on('toolbar(test)', function(obj){
if (obj.event === 'add') {
rightpage.open("/home/check/add");
return;
}
});
//监听行工具事件
table.on('tool(test)', function (obj) {
var data = obj.data;
if (obj.event === 'edit') {
rightpage.open('/home/check/add?id='+obj.data.id);
return;
}
if (obj.event === 'del') {
layer.confirm('确定要删除吗?', { icon: 3, title: '提示' }, function (index) {
$.ajax({
url: "/home/check/delete",
data: { id: data.id },
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
})
layer.close(index);
});
}
});
}
</script>
{include file="common/layui" base="base" extend="['rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,17 +1,17 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<form class="layui-form page-content">
<h3 class="h3-title">配置项</h3>
<table class="layui-table">
<tr>
<td class="layui-td-gray2">配置名称<font>*</font>
<td class="layui-td-gray">配置名称<font>*</font>
</td>
<td>
<input type="hidden" name="id" value="{$id}" />
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入配置名称" lay-reqText="请输入配置名称" class="layui-input" {notempty name="$config.title"} value="{$config.title}" {/notempty}>
</td>
<td class="layui-td-gray2">状态<font>*</font></td>
<td class="layui-td-gray">状态<font>*</font></td>
<td>{if condition="$id eq 0"}
<input type="radio" name="status" value="1" title="正常" checked>
<input type="radio" name="status" value="0" title="禁用">
@ -24,12 +24,19 @@
</td>
</tr>
<tr>
<td class="layui-td-gray2" style="vertical-align: top;">
<td class="layui-td-gray" style="vertical-align: top;">
配置标识<font>*</font>
</td>
<td colspan="3">
<input style="width: 300px;" type="text" name="name" lay-verify="required" placeholder="请输入配置标识" lay-reqText="请输入配置标识" autocomplete="off" class="layui-input" {notempty name="$config.name"} value="{$config.name}" {/notempty}>
<span style ="color: red; font-size: 12px; margin-top: 5px;">(注意:新增配置项以后,需要对应新增模板文件,模板文件名称需与标识名称一致,建议复制现有的配置模板文件,然后根据需求修改对应的表单即可)</span>
<input type="text" name="name" lay-verify="required" placeholder="请输入配置标识" lay-reqText="请输入配置标识" autocomplete="off" class="layui-input" {notempty name="$config.name"} value="{$config.name}" {/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray2" style="vertical-align: top;">
注意
</td>
<td colspan="3">
<span style ="color: red; font-size: 12px;">(注意:新增配置项以后,需要对应新增模板文件,模板文件名称需与标识名称一致,建议复制现有的配置模板文件,然后根据需求修改对应的表单即可)</span>
</td>
</tr>
</table>
@ -54,12 +61,12 @@
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
parent.location.reload();
});
} else {
layer.msg(e.msg);
parent.tableIns.reload();
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
}
})
@ -68,6 +75,6 @@
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{include file="../../base/view/common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,7 +1,7 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<form class="layui-form page-content">
<h3 class="h3-title">邮箱配置</h3>
<table class="layui-table">
<tr>
@ -86,12 +86,11 @@
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
parent.location.reload();
});
} else {
layer.msg(e.msg);
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
}
})
@ -136,7 +135,7 @@
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{include file="common/ueditor" id="container" name="content" width="100%" height="100%" toolbar="[]" /}
{include file="../../base/view/common/layui" base="base" extend="[]" callback="init" /}
{include file="../../base/view/common/ueditor" id="container" name="content" width="100%" height="100%" toolbar="[]" /}
{/block}
<!-- /脚本 -->

View File

@ -1,4 +1,4 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
@ -100,7 +100,7 @@
//表头工具栏事件
table.on('toolbar(test)', function(obj){
if (obj.event === 'add') {
rightpage.open("/home/conf/add");
rightpage.open("/home/conf/add",'900px');
return;
}
});
@ -123,6 +123,6 @@
});
}
</script>
{include file="common/layui" base="base" extend="['rightpage']" callback="init" /}
{include file="../../base/view/common/layui" base="base" extend="['rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,7 +1,7 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<form class="layui-form page-content">
<h3 class="h3-title">其他配置</h3>
<table class="layui-table">
<tr>
@ -40,12 +40,11 @@
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
parent.location.reload();
});
} else {
layer.msg(e.msg);
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
}
})
@ -58,6 +57,6 @@
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{include file="../../base/view/common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,7 +1,7 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<form class="layui-form page-content">
<h3 class="h3-title">Token配置</h3>
<table class="layui-table">
<tr>
@ -59,12 +59,11 @@
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
parent.location.reload();
});
} else {
layer.msg(e.msg);
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
}
})
@ -188,6 +187,6 @@
})
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{include file="../../base/view/common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,7 +1,7 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<form class="layui-form page-content">
<h3 class="h3-title">系统配置</h3>
<table class="layui-table">
<tr>
@ -96,7 +96,7 @@
//logo上传
var uploadInst = upload.render({
elem: '#test1',
url: "/home/api/upload",
url: "/api/index/upload",
done: function (res) {
//如果上传失败
if (res.code == 1) {
@ -116,12 +116,11 @@
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
parent.location.reload();
});
} else {
layer.msg(e.msg);
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
}
})
@ -129,6 +128,6 @@
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{include file="../../base/view/common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,4 +1,4 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
@ -9,7 +9,7 @@
<th style=" text-align: center; font-weight: 800;"><span>文件大小</span></th>
<th style=" text-align: center; font-weight: 800;"><span>文件格式</span></th>
<th style=" text-align: center; font-weight: 800;"><span>分隔符</span></th>
<th style=" text-align: center; font-weight: 800;"><span>操作</span></th>
<th style=" text-align: center; font-weight: 800; width:222px"><span>操作</span></th>
</tr>
{empty name="list"}
<tr>
@ -17,8 +17,8 @@
</tr>
{/empty}
{volist name="list" id="vo" key="k"}
<tr style="background-color: #f5f5f5;">
<td colspan="6">备份时间:{$vo.time}</td>
<tr style="background-color: #fafafa;">
<td colspan="6"><strong>备份时间:{$vo.time}</strong></td>
</tr>
{volist name="vo.data" id="voo"}
<tr>
@ -86,6 +86,6 @@
})
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{include file="../../base/view/common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,4 +1,4 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
@ -147,6 +147,6 @@
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{include file="../../base/view/common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,195 +0,0 @@
{extend name="common/base"/}
{block name="style"}
<style>
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="body-content">
<h3 class="h3-title">报销详情</h3>
<table class="layui-table">
<tr>
<td class="layui-td-gray2">报销凭证编号</td>
<td>{$expense.code}</td>
<td class="layui-td-gray2">入账月份</td>
<td>{$expense.income_month}</td>
<td class="layui-td-gray2">原始单据日期</td>
<td>{$expense.expense_time}</td>
</tr>
<tr>
<td class="layui-td-gray2">报销人</td>
<td>{$expense.user_name}</td>
<td class="layui-td-gray2">报销部门</td>
<td>{$expense.department}</td>
<td class="layui-td-gray">报销总费用(元)</td>
<td><span style="color:#1E9FFF">{$expense.amount}</span></td>
</tr>
<tr>
<td class="layui-td-gray2">报销状态</td>
<td colspan="5">
{if condition="$expense.check_status == 0"}
<span style="color:#FF5722">审核不通过 【原因:{$expense.check_remark}】</span>
{elseif condition="$expense.check_status == 1"}
<span style="color:#FFB800">报销审核中</span>
{elseif condition="$expense.check_status == 2"}
<span style="color:#1E9FFF">审核通过</span>
{elseif condition="$expense.check_status == 3"}
<span style="color:#009688">已打款</span>
{/if}
</td>
</tr>
{if condition="$expense.check_time > 0"}
<tr>
<td class="layui-td-gray2">审核人</td>
<td>{$expense.check_admin}</td>
<td class="layui-td-gray2">审核时间</td>
<td colspan="3">{$expense.check_time}</td>
</tr>
{else/}
<tr>
<td class="layui-td-gray2">审核人</td>
<td colspan="5">{$expense.check_admin}</td>
</tr>
{/if}
{if condition="$expense.pay_admin_id > 0"}
<tr>
<td class="layui-td-gray2">打款人</td>
<td>{$expense.pay_admin}</td>
<td class="layui-td-gray2">打款时间</td>
<td colspan="3">{$expense.pay_time}</td>
</tr>
{/if}
<tr>
<td class="layui-td-gray2">费用金额</td>
<td colspan="5">
<div>
<table class="layui-table layui-table-min">
<tr>
<th width="200">报销金额(元)</th>
<th width="300">报销类别</th>
<th>备注信息</th>
</tr>
{volist name="$expense.list" id="vo"}
<tr>
<td>{$vo.amount}</td>
<td>{$vo.cate_title}</td>
<td style="text-align:left">{$vo.remarks}</td>
</tr>
{/volist}
</table>
</div>
</td>
</tr>
{if condition="($expense.check_status == 1) AND ($uid == $expense.check_admin_id)"}
<tr>
<td class="layui-td-gray">选择打款人<span style="color: red">*</span></td>
<td>
<form class="layui-form">
<select name="pay_admin_id">
<option value="">请选择报销打款人</option>
{volist name=":get_check_user(2)" id="vo"}
<option value="{$vo.uid}">{$vo.user}</option>
{/volist}
</select>
</form>
</td>
<td colspan="4">
<button class="layui-btn layui-btn-danger" lay-event="checkno">审核不通过</button>
<button class="layui-btn" lay-event="checkok">审核通过</button>
</td>
</tr>
{/if}
</table>
<div class="layui-form-item" style="padding-top:10px;">
<input name="id" id="id" type="hidden" value="{$expense.id}">
{if condition="($expense.check_status == 0) AND ($uid == $expense.admin_id)"}
<a class="layui-btn" href="/home/expense/add?id={$expense.id}">编辑</a>
{/if}
{if condition="($expense.check_status == 2) AND ($uid == $expense.pay_admin_id)"}
<button class="layui-btn" lay-event="payed">打款确认</button>
{/if}
</div>
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
$('.body-content').on('click', '[lay-event="checkok"]', function () {
var id=$('#id').val();
var pay_admin=$('[name="pay_admin_id"]').val();
if(pay_admin == ''){
layer.msg('请选择报销打款人');
return false;
}
layer.confirm('确定审核通过该报销申请?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/expense/check",
data:{id:id,check_status:2,pay_admin_id:pay_admin},
success:function(res){
layer.msg(res.msg);
if(res.code==0){
parent.tableIns.reload();
window.setTimeout(function(){
location.reload();
},1200)
}
}
})
})
return false;
});
$('.body-content').on('click', '[lay-event="checkno"]', function () {
var id=$('#id').val();
layer.confirm('确定拒绝该报销申请?', {icon: 3, title:'提示'}, function(index){
layer.prompt({title: '拒绝的理由', formType: 3,value :''}, function(text, index){
if(text ==''){
layer.msg('请输入拒绝的理由');
return false;
}
$.ajax({
url: "/home/expense/check",
data:{id:id,check_status:0,check_remark:text},
success:function(res){
layer.msg(res.msg);
if(res.code==0){
parent.tableIns.reload();
window.setTimeout(function(){
location.reload();
},1200)
}
}
})
layer.closeAll();
})
})
})
$('.body-content').on('click', '[lay-event="payed"]', function () {
var id=$('#id').val();
layer.confirm('确定已经打款?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/expense/check",
data:{id:id,check_status:3},
success:function(res){
layer.msg(res.msg);
if(res.code==0){
parent.tableIns.reload();
window.setTimeout(function(){
location.reload();
},1200)
}
}
})
})
})
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

336
app/home/view/flow/add.html Normal file
View File

@ -0,0 +1,336 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<link rel="stylesheet" href="{__LAYUI__}/plugin/formSelects/formSelects-v4.css">
<style>
.layui-form-pane .layui-form-label{color:#999; width:80px; padding:8px 3px;}
.layui-form-item .layui-inline{margin-right:3px; margin-bottom:10px;}
.layui-form-item{margin-bottom:5px;}
.layui-form-item .layui-btn-danger{display:none; margin-top:-8px}
.layui-form-item:hover .layui-btn-danger{display:inline-block;}
.select-1,.select-2{display:none;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">审批流程</h3>
{eq name="$id" value="0"}
<table class="layui-table">
<tr>
<td class="layui-td-gray">流程名称<font>*</font></td>
<td>
<input type="text" name="name" autocomplete="off" placeholder="请输入审批流程名称" lay-verify="required" lay-reqText="请输入审批流程名称" class="layui-input">
</td>
<td class="layui-td-gray">应用模块<font>*</font></td>
<td>
<select name="type" lay-filter="type" lay-verify="required" lay-reqText="请选择应用模块">
<option value="">--请选择--</option>
<option value="1">假勤</option>
<option value="2">行政</option>
<option value="3">财务</option>
<option value="4">人事</option>
<option value="5">其他</option>
<option value="6">报销</option>
<option value="7">发票</option>
</select>
</td>
<td class="layui-td-gray">审批类型<font>*</font></td>
<td>
<select name="flow_cate" lay-filter="flowcate" lay-verify="required" lay-reqText="请选择审批类型">
<option value="">--请先选择应用模块--</option>
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">应用部门</td>
<td colspan="5">
<select name="department_ids" xm-selected="" xm-select="select1" xm-select-skin="default"></select>
<p style="padding:6px 0 0; font-size:12px; color:#999">不选,默认是全公司</p>
</td>
</tr>
<tr>
<td class="layui-td-gray">流程说明</td>
<td colspan="5">
<textarea name="remark" placeholder="请输入流程说明" class="layui-textarea"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">审批流类型<font>*</font></td>
<td colspan="5">
<input type="radio" name="check_type" lay-filter="checktype" value="1" title="固定审批流" checked>
<input type="radio" name="check_type" lay-filter="checktype" value="2" title="授权审批人">
</td>
</tr>
<tr id="flowTr">
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<div id="flowList">
<div class="layui-form-item layui-form-pane">
<div class="layui-inline">
<label class="layui-form-label">第1级</label>
<div class="layui-input-inline">
<select name="flowType[]" lay-filter="flowtype">
<option value="1">当前部门负责人</option>
<option value="2">上一级部门负责人</option>
<option value="3">指定人员(任意一人)</option>
<option value="4">指定人员(多人会签)</option>
</select>
</div>
</div>
<div class="layui-inline select-1">
<label class="layui-form-label">指定用户</label>
<div class="layui-input-inline" style="width:300px;">
<select name="flowUids[]" xm-selected="" xm-select="flowuids0" xm-select-skin="default" xm-select-height="36px"></select>
</div>
</div>
</div>
</div>
<span id="addFlow" class="layui-btn layui-btn-xs layui-btn-normal">+ 添加审批层级</span>
<div style="padding:10px; margin-top:10px; font-size:12px; background-color:#fffcf0">
<p><strong>温馨提示</strong></p>
<p>1、当选择“负责人主管”审批时。系统仅会通知负责人主管。</p>
<p>2、当选择多个“指定人员”审批时。如果指定用户没有权限查看对应的合同系统会通知其审批但是他无法查看此数据信息。</p>
<p>3、当选择“指定人员任意一人”表示指定用户中任意一人审批即可。当选择“指定人员多人会签”表示 指定人员中所有人都要审批。</p>
</div>
</td>
</tr>
</table>
{else/}
<table class="layui-table">
<tr>
<td class="layui-td-gray">流程名称<font>*</font></td>
<td>
<input type="text" name="name" value="{$detail.name}" autocomplete="off" placeholder="请输入审批流程名称" lay-verify="required" lay-reqText="请输入审批流程名称" class="layui-input">
</td>
<td class="layui-td-gray">应用模块<font>*</font></td>
<td>
<select name="type" lay-filter="type" lay-verify="required" lay-reqText="请选择应用模块">
<option value="">--请选择--</option>
<option value="1" {eq name="$detail.type" value="1"}selected=""{/eq}>假勤</option>
<option value="2" {eq name="$detail.type" value="2"}selected=""{/eq}>行政</option>
<option value="3" {eq name="$detail.type" value="3"}selected=""{/eq}>财务</option>
<option value="4" {eq name="$detail.type" value="4"}selected=""{/eq}>人事</option>
<option value="5" {eq name="$detail.type" value="5"}selected=""{/eq}>其他</option>
<option value="6" {eq name="$detail.type" value="6"}selected=""{/eq}>报销</option>
<option value="7" {eq name="$detail.type" value="7"}selected=""{/eq}>发票</option>
</select>
</td>
<td class="layui-td-gray">审批类型<font>*</font></td>
<td>
<select name="flow_cate" lay-verify="required" lay-reqText="请选择审批类型">
<option value="">--请选择--</option>
{volist name="$detail.flow_cate_list" id="vo"}
<option value="{$vo.id}" {eq name="$detail.flow_cate" value="$vo.id"}selected=""{/eq}>{$vo.title}</option>
{/volist}
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">应用部门</td>
<td colspan="5">
<select id="department_ids" name="department_ids" xm-selected="{$detail.department_ids}" xm-select="select1" xm-select-skin="default"></select>
<p style="padding:6px 0 0; font-size:12px; color:#999">不选,默认是全公司</p>
</td>
</tr>
<tr>
<td class="layui-td-gray">流程说明</td>
<td colspan="5">
<textarea name="remark" placeholder="请输入流程说明" class="layui-textarea">{$detail.remark}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">审批流类型<font>*</font></td>
<td colspan="5">
<input type="radio" name="check_type" lay-filter="checktype" value="1" title="固定审批流" {eq name="$detail.check_type" value="1"}checked{/eq}>
<input type="radio" name="check_type" lay-filter="checktype" value="2" title="授权审批人" {eq name="$detail.check_type" value="2"}checked{/eq}>
</td>
</tr>
<tr id="flowTr" {eq name="$detail.check_type" value="2"}style="display:none"{/eq}>
<td class="layui-td-gray">审批流程<font>*</font></td>
<td colspan="5">
<div id="flowList">
{volist name="detail.flow_list" id="vo"}
<div class="layui-form-item layui-form-pane">
<div class="layui-inline">
<label class="layui-form-label">第{$key+1}级</label>
<div class="layui-input-inline">
<select name="flowType[]" lay-filter="flowtype">
<option value="1" {eq name="$vo.flow_type" value="1"}selected=""{/eq}>当前部门负责人</option>
<option value="2" {eq name="$vo.flow_type" value="2"}selected=""{/eq}>上一级部门负责人</option>
<option value="3" {eq name="$vo.flow_type" value="3"}selected=""{/eq}>指定人员(任意一人)</option>
<option value="4" {eq name="$vo.flow_type" value="4"}selected=""{/eq}>指定人员(多人会签)</option>
</select>
</div>
</div>
<div class="layui-inline select-{$vo.flow_type}">
<label class="layui-form-label">指定人员</label>
<div class="layui-input-inline" style="width:300px;">
<select name="flowUids[]" xm-selected="{$vo.flow_uids}" xm-select="flowuids{$key}" xm-select-skin="default" xm-select-height="36px"></select>
</div>
</div>
{gt name="$key" value="0"}
<span class="layui-btn layui-btn-danger layui-btn-sm">删除</span>
{/gt}
</div>
{/volist}
</div>
<span id="addFlow" class="layui-btn layui-btn-xs layui-btn-normal">+ 添加审批层级</span>
<div style="padding:10px; margin-top:10px; font-size:12px; background-color:#fffcf0">
<p><strong>温馨提示</strong></p>
<p>1、当选择“负责人主管”审批时。系统仅会通知负责人主管。</p>
<p>2、当选择多个“指定人员”审批时。如果指定用户没有权限查看对应的合同系统会通知其审批但是他无法查看此数据信息。</p>
<p>3、当选择“指定人员任意一人”表示指定用户中任意一人审批即可。当选择“指定人员多人会签”表示 指定人员中所有人都要审批。</p>
</div>
</td>
</tr>
</table>
{/eq}
<div style="padding: 10px 0">
<input type="hidden" name="id" value="{$id}">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui){
var form = layui.form
,formSelects = layui.formSelects
,layer = layui.layer;
form.on('select(type)', function(data){
$.ajax({
url: "/api/index/get_flow_cate",
type:'post',
data:{type:data.value},
success: function (e) {
if (e.code == 0) {
if(e.data.length>0){
let ops='<option value="">--请选择--</option>';
for(var i=0;i<e.data.length;i++){
ops+='<option value="'+e.data[i].id+'">'+e.data[i].title+'</option>';
}
$('[name="flow_cate"]').html(ops);
form.render();
}
}
}
})
})
var selcted = $('#department_ids').attr('xm-selected');
formSelects.data('select1', 'server', {
url: '/api/index/get_department_select',
keyword: selcted,
});
//监听提交
form.on('submit(webform)', function(data){
console.log(data.field);
//return false;
$.ajax({
url: "/home/flow/add",
type:'post',
data:data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.tableIns.reload();
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
}
})
return false;
});
var employee=[];
$.ajax({
url: "/api/index/get_employee_select",
type:'post',
success: function (e) {
if (e.code == 0) {
employee=e.data;
$('#flowList').find('[xm-select-skin="default"]').each(function(index,item){
var select=$(this).attr('xm-select');
var selected=$(this).attr('xm-selected');
formSelects.data(select, 'local', {
arr: employee
});
if(selected && selected !=''){
formSelects.value(select, selected.split(','));
}
})
}
}
})
form.on('radio(checktype)', function(data){
if(data.value==1){
$('#flowTr').show();
}
else{
$('#flowTr').hide();
}
console.log(data.value); //被点击的radio的value值
});
form.on('select(flowtype)', function(data){
$(data.elem).parents('.layui-form-item').find('.layui-inline').eq(1).attr('class','layui-inline select-'+data.value);
// console.log(data.value); //得到被选中的值
});
$('#addFlow').on('click',function(){
var len = $('#flowList').find('.layui-form-item').length;
var index = len+1;
var timestamp=new Date().getTime();
var tem='<div class="layui-form-item layui-form-pane">\
<div class="layui-inline">\
<label class="layui-form-label label-index">第'+index+'级</label>\
<div class="layui-input-inline">\
<select name="flowType[]" lay-filter="flowtype">\
<option value="1">当前部门负责人</option>\
<option value="2">上一级部门负责人</option>\
<option value="3">指定人员(任意一人)</option>\
<option value="4">指定人员(多人会签)</option>\
</select>\
</div>\
</div>\
<div class="layui-inline select-1">\
<label class="layui-form-label">指定人员</label>\
<div class="layui-input-inline" style="width:300px;">\
<select name="flowUids[]" xm-selected="" xm-select="flowuids'+timestamp+'" xm-select-skin="default" xm-select-height="36px"></select>\
</div>\
</div>\
<span class="layui-btn layui-btn-danger layui-btn-sm">删除</span>\
</div>';
$('#flowList').append(tem);
form.render();
formSelects.render('flowuids'+timestamp);
console.log(employee);
formSelects.data('flowuids'+timestamp,'local', {
arr: employee
});
});
$('#flowList').on('click','.layui-btn-danger',function(){
$(this).parents('.layui-form-item').remove();
var items = $('.label-index').length;
if(items>0){
$('.label-index').each(function(index,item){
$(this).html('第'+(index+2)+'级');
})
}
});
}
</script>
{include file="../../base/view/common/layui" base='base' extend="['formSelects']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,136 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm addNew" type="button">+ 添加审批流程</button>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns = null;
function init(layui){
var table=layui.table,
rightpage=layui.rightpage,
layer=layui.layer;
tableIns = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,title:'审批流程列表'
,url: "/home/flow/index"
,page: false //开启分页
,limit: 20
,cellMinWidth: 80
,cols: [[
{field:'id',width:80, title: 'ID号', align:'center'}
,{field:'name',title: '流程名称',width:120}
,{field:'check_type',title: '流程类型', align:'center',width:100,templet:function(d){
var html = '固定审批流';
if(d.check_type==2){
html = '授权审批人';
}
return html;
}}
,{field:'name',title: '应用模块',width:80, align:'center',templet:function(d){
var html = '其他';
if(d.type==1){
html = '假勤';
}else if(d.type==2){
html = '行政';
}else if(d.type==3){
html = '财务';
}else if(d.type==4){
html = '其他';
}
return html;
}}
,{field:'flow_cate',title: '审批类型',width:100, align:'center'}
,{field:'department',title: '适用部门'}
,{field:'username',title: '最后修改人',width:90,align:'center'}
,{field:'status', title: '状态',width:80,align:'center',templet: function(d){
var html1='<span>正常</span>';
var html2='<span style="color:#FF5722">禁用</span>';
if(d.status==1){
return html1;
}
else{
return html2;
}
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}
else{
html = '<div class="layui-btn-group">'+btn+btn2+'</div>';
}
return html;
}}
]]
});
table.on('tool(test)',function (obj) {
if(obj.event === 'edit'){
rightpage.open('/home/flow/add?id='+obj.data.id,'900px');
}
if(obj.event === 'disable'){
layer.confirm('确定要禁用该模块吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/flow/check",
type: 'post',
data: {
id: obj.data.id,
status: 0
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
tableIns.reload();
}
}
})
layer.close(index);
});
}
if(obj.event === 'open'){
layer.confirm('确定要启用该模块吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/flow/check",
type: 'post',
data: {
id: obj.data.id,
status: 1
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
tableIns.reload();
}
}
})
layer.close(index);
});
}
});
$('.body-table').on('click','.addNew',function(){
rightpage.open('/home/flow/add','900px');
});
}
</script>
{include file="../../base/view/common/layui" base='base' extend="['rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,315 +0,0 @@
{extend name="common/base"/}
{block name="style"}
<style>
.layui-table-min{margin-bottom:6px;}
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="body-content">
<h3 class="h3-title">发票信息</h3>
<table class="layui-table">
<tr>
<td class="layui-td-gray">发票金额</td>
<td>
{$detail.amount}
</td>
<td class="layui-td-gray">发票类型</td>
<td>
{eq name="$detail.invoice_type" value="1"}增值税专用发票{/eq}
{eq name="$detail.invoice_type" value="2"}增值税普通发票{/eq}
</td>
<td class="layui-td-gray">发票主体</td>
<td>
{volist name=":get_invoice_subject()" id="vo"}
{eq name="$vo.id" value="$detail.invoice_subject"}{$vo.title}{/eq}
{/volist}
</td>
</tr>
<tr>
<td class="layui-td-gray">抬头类型</td>
<td>
{eq name="$detail.type" value="1"}企业{/eq}
{eq name="$detail.type" value="2"}个人{/eq}
</td>
<td class="layui-td-gray">发票抬头</td>
<td>{$detail.invoice_title}</td>
<td class="layui-td-gray">电话号码</td>
<td>{$detail.invoice_phone}</td>
</tr>
<tr class="invoice-type" {eq name="$detail.type" value="2"}style="display:none"{/eq}>
<td class="layui-td-gray2">纳税人识别号</td>
<td>{$detail.invoice_tax}</td>
<td class="layui-td-gray">开户行</td>
<td>{$detail.invoice_bank}</td>
<td class="layui-td-gray">银行账号</td>
<td>{$detail.invoice_account}</td>
</tr>
<tr class="invoice-type" {eq name="$detail.type" value="2"}style="display:none"{/eq}>
<td class="layui-td-gray2">银行营业网点</td>
<td>{$detail.invoice_banking}</td>
<td class="layui-td-gray">地址</td>
<td colspan="3">{$detail.invoice_address}</td>
</tr>
{notempty name="$detail.remark"}
<tr>
<td class="layui-td-gray">备注信息</td>
<td colspan="5">{$detail.remark}</td>
</tr>
{/notempty}
<tr>
<td class="layui-td-gray">发票状态</td>
<td colspan="5">
{if condition="($detail.invoice_status == 0)"}
<span style="color:#FF5722">审核不通过 【原因:{$detail.check_remark}】</span>
{elseif condition="($detail.invoice_status == 1)"}
<span style="color:#009688">审核中</span>
{elseif condition="($detail.invoice_status == 2)"}
<span style="color:#1E9FFF">审核通过,待开具</span>
{elseif condition="($detail.invoice_status == 3)"}
<span style="color:#1E9FFF">已开具</span>
{elseif condition="($detail.invoice_status == 10)"}
<span style="color:#FF5722">已作废</span>
{/if}
</td>
</tr>
{if condition="$detail.check_time > 0"}
<tr>
<td class="layui-td-gray2">审核人</td>
<td>{$detail.check_admin}</td>
<td class="layui-td-gray2">审核时间</td>
<td colspan="3">{$detail.check_time}</td>
</tr>
{else/}
<tr>
<td class="layui-td-gray2">审核人</td>
<td colspan="5">{$detail.check_admin}</td>
</tr>
{/if}
{if condition="$detail.open_admin_id > 0"}
<tr>
<td class="layui-td-gray2">开票人</td>
<td>{$detail.open_admin}</td>
<td class="layui-td-gray2">开票时间</td>
<td>{$detail.open_time}</td>
<td class="layui-td-gray2">发票号码</td>
<td>{$detail.code}</td>
</tr>
{/if}
</table>
<h3 class="h3-title2">到账信息</h3>
<form class="layui-form">
<table class="layui-table">
<tr>
<td class="layui-td-gray">到账状态</td>
<td>
{if condition="($detail.is_cash == 0)"}
<span style="color:#FF5722">未到账</span>
{elseif condition="($detail.is_cash == 1)"}
<span style="color:#1E9FFF">部分到账</span>
{elseif condition="($detail.is_cash == 2)"}
<span style="color:#009688">全部到账</span>
{/if}
</td>
<td class="layui-td-gray2">未到账金额(元)</td>
<td style="color:#FF5722">{$detail.not_income}</td>
<td class="layui-td-gray2">已到账金额(元)</td>
<td style="color:#1E9FFF">{$detail.enter_amount}</td>
</tr>
<tr>
<td class="layui-td-gray">到账记录</td>
<td colspan="5">
<table id="interfix" class="layui-table layui-table-min">
<tr>
<th style="width:200px;">到账日期</th>
<th style="width:200px;">到帐金额(元)</th>
<th>备注</th>
<th style="width:100px;">操作</th>
</tr>
{empty name="$detail.income"}
<tr class="none_interfix">
<td colspan="4" style="text-align: center;">暂无到账记录</td>
</tr>
{else/}
{volist name="$detail.income" id="vo"}
<tr class="more_interfix">
<td>{$vo.enter_time | date='Y-m-d'}</td>
<td>{$vo.amount}</td>
<td style="text-align:left;">{$vo.remarks}</td>
<td><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="remove" data-id="{$vo.id}" data-inid="{$id}">删除</a></td>
</tr>
{/volist}
{/empty}
</table>
<div><button class="layui-btn layui-btn-sm layui-btn-normal" type="button" id="addInterfix">+ 添加到账记录</button></div>
</td>
</tr>
</table>
<div class="layui-form-item" style="padding-top:10px; text-align:center">
<input name="inid" id="inid" type="hidden" value="{$id}">
<input name="enter_type" id="enter_type" type="hidden" value="1">
{if condition="($detail.is_cash lt 2)"}
<button class="layui-btn" lay-submit="" lay-filter="webform">保存到账记录</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
{/if}
{if condition="($detail.is_cash eq 0)"}
<button class="layui-btn layui-btn-danger" lay-event="all">全部到账</button>
{/if}
{if condition="($detail.is_cash eq 1)"}
<button class="layui-btn layui-btn-danger" lay-event="all">剩余部分全部到账</button>
{/if}
{if condition="($detail.is_cash gt 0)"}
<button class="layui-btn layui-btn-warm" lay-event="refue">全部反到账</button>
{/if}
</div>
</form>
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form
,layer = layui.layer
,laydate = layui.laydate
,table = layui.table;
//添加表格
$('#addInterfix').on('click',function(){
var html = '';
html += '<tr class="more_interfix">';
html += '<td><input type="text" class="layui-input enter-time" name="enter_time[]" readonly lay-verify="required" lay-reqText="请选择到账日期">';
html += '<td><input type="text" class="layui-input" name="amount[]" lay-verify="required|number" lay-reqText="请输入到账金额,数字"></td>';
html += '<td><input type="text" class="layui-input" name="remarks[]"></td>';
html += '<td><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></td>';
html += '</tr>';
$("#interfix").find('.none_interfix').remove();
$("#interfix").append(html);
form.render();
lay('.enter-time').each(function () {
laydate.render({
elem: this,
trigger: 'click',
showBottom:false
});
});
});
//删除表格
$('#interfix').on('click', '[lay-event="del"]', function() {
$(this).parents(".more_interfix").remove();
if($("#interfix").find('.more_interfix').length<1){
$("#interfix").append('<tr class="none_interfix"><td colspan="4" style="text-align: center;">暂无到账记录</td></tr>');
}
});
//删除到账记录
$('#interfix').on('click', '[lay-event="remove"]', function() {
var that=$(this);
var id=that.data('id');
var inid=that.data('inid');
layer.confirm('确定要删除该到账记录?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/income/delete",
data:{id:id,inid:inid},
success:function(res){
layer.msg(res.msg);
if(res.code==0){
parent.tableIns.reload();
window.setTimeout(function(){
location.reload();
},1200)
}
}
})
})
});
//监听提交
form.on('submit(webform)', function(data){
console.log(data.field);
if($("#interfix").find('.enter-time').length<1){
layer.msg('请添加到账记录');
return false;
}
$.ajax({
url: "/home/income/add",
type:'post',
data:data.field,
success:function(res){
layer.msg(res.msg);
if(res.code==0){
parent.tableIns.reload();
window.setTimeout(function(){
location.reload();
},1200)
}
}
})
return false;
});
$('.body-content').on('click', '[lay-event="refue"]', function () {
var inid=$('#inid').val();
layer.confirm('确定要全部反到账?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/income/add",
data:{inid:inid,enter_type:3},
success:function(res){
layer.msg(res.msg);
if(res.code==0){
parent.tableIns.reload();
window.setTimeout(function(){
location.reload();
},1200)
}
}
})
})
return false;
})
$('.body-content').on('click', '[lay-event="all"]', function () {
var inid=$('#inid').val();
layer.confirm('确定已经全部到账?', {icon: 3, title:'提示'}, function(idx){
layer.prompt({title: '选择到账日期', formType: 3,value :'',success: function(layero, index){
$('.layui-layer-input').attr('readonly',true);
lay('.layui-layer-input').each(function () {
laydate.render({
elem: this,
trigger: 'click',
showBottom:false
});
});
layer.close(idx);
}
}, function(enter_time, index){
if(enter_time ==''){
layer.msg('选择到账日期');
return false;
}
$.ajax({
url: "/home/income/add",
data:{inid:inid,enter_type:2,enter_time:enter_time},
success:function(res){
layer.msg(res.msg);
if(res.code==0){
parent.tableIns.reload();
window.setTimeout(function(){
location.reload();
},1200)
}
}
})
})
})
return false;
})
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,165 +0,0 @@
{extend name="common/base"/}
{block name="style"}
<style>
.layui-table-min{margin-bottom:6px;}
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="body-content">
<h3 class="h3-title">发票信息</h3>
<table class="layui-table">
<tr>
<td class="layui-td-gray">发票金额(元)</td>
<td>
{$detail.amount}
</td>
<td class="layui-td-gray">发票类型</td>
<td>
{eq name="$detail.invoice_type" value="1"}增值税专用发票{/eq}
{eq name="$detail.invoice_type" value="2"}增值税普通发票{/eq}
</td>
<td class="layui-td-gray">发票主体</td>
<td>
{volist name=":get_invoice_subject()" id="vo"}
{eq name="$vo.id" value="$detail.invoice_subject"}{$vo.title}{/eq}
{/volist}
</td>
</tr>
<tr>
<td class="layui-td-gray">抬头类型</td>
<td>
{eq name="$detail.type" value="1"}企业{/eq}
{eq name="$detail.type" value="2"}个人{/eq}
</td>
<td class="layui-td-gray">发票抬头</td>
<td>{$detail.invoice_title}</td>
<td class="layui-td-gray">电话号码</td>
<td>{$detail.invoice_phone}</td>
</tr>
<tr class="invoice-type" {eq name="$detail.type" value="2"}style="display:none"{/eq}>
<td class="layui-td-gray2">纳税人识别号</td>
<td>{$detail.invoice_tax}</td>
<td class="layui-td-gray">开户行</td>
<td>{$detail.invoice_bank}</td>
<td class="layui-td-gray">银行账号</td>
<td>{$detail.invoice_account}</td>
</tr>
<tr class="invoice-type" {eq name="$detail.type" value="2"}style="display:none"{/eq}>
<td class="layui-td-gray2">银行营业网点</td>
<td>{$detail.invoice_banking}</td>
<td class="layui-td-gray">地址</td>
<td colspan="3">{$detail.invoice_address}</td>
</tr>
{notempty name="$detail.remark"}
<tr>
<td class="layui-td-gray">备注信息</td>
<td colspan="5">{$detail.remark}</td>
</tr>
{/notempty}
<tr>
<td class="layui-td-gray">发票状态</td>
<td colspan="5">
{if condition="($detail.invoice_status == 0)"}
<span style="color:#FF5722">审核不通过 【原因:{$detail.check_remark}】</span>
{elseif condition="($detail.invoice_status == 1)"}
<span style="color:#009688">审核中</span>
{elseif condition="($detail.invoice_status == 2)"}
<span style="color:#1E9FFF">审核通过,待开具</span>
{elseif condition="($detail.invoice_status == 3)"}
<span style="color:#1E9FFF">已开具</span>
{elseif condition="($detail.invoice_status == 10)"}
<span style="color:#FF5722">已作废</span>
{/if}
</td>
</tr>
{if condition="$detail.check_time > 0"}
<tr>
<td class="layui-td-gray2">审核人</td>
<td>{$detail.check_admin}</td>
<td class="layui-td-gray2">审核时间</td>
<td colspan="3">{$detail.check_time}</td>
</tr>
{else/}
<tr>
<td class="layui-td-gray2">审核人</td>
<td colspan="5">{$detail.check_admin}</td>
</tr>
{/if}
{if condition="$detail.open_admin_id > 0"}
<tr>
<td class="layui-td-gray2">开票人</td>
<td>{$detail.open_admin}</td>
<td class="layui-td-gray2">开票时间</td>
<td>{$detail.open_time}</td>
<td class="layui-td-gray2">发票号码</td>
<td>{$detail.code}</td>
</tr>
{/if}
</table>
<h3 class="h3-title2">到账信息</h3>
<form class="layui-form">
<table class="layui-table">
<tr>
<td class="layui-td-gray">到账状态</td>
<td>
{if condition="($detail.is_cash == 0)"}
<span style="color:#FF5722">未到账</span>
{elseif condition="($detail.is_cash == 1)"}
<span style="color:#1E9FFF">部分到账</span>
{elseif condition="($detail.is_cash == 2)"}
<span style="color:#009688">全部到账</span>
{/if}
</td>
<td class="layui-td-gray2">未到账金额(元)</td>
<td style="color:#FF5722">{$detail.not_income}</td>
<td class="layui-td-gray2">已到账金额(元)</td>
<td style="color:#1E9FFF">{$detail.enter_amount}</td>
</tr>
<tr>
<td class="layui-td-gray">到账记录</td>
<td colspan="5">
<table class="layui-table layui-table-min">
<tr>
<th style="width:150px;">到账日期</th>
<th style="width:150px;">到帐金额(元)</th>
<th>备注</th>
<th style="width:100px;">登记人</th>
<th style="width:150px;">登记时间</th>
</tr>
{empty name="$detail.income"}
<tr class="none_interfix">
<td colspan="5" style="text-align: center;">暂无到账记录</td>
</tr>
{else/}
{volist name="$detail.income" id="vo"}
<tr class="more_interfix">
<td>{$vo.enter_time | date='Y-m-d'}</td>
<td>{$vo.amount}</td>
<td style="text-align:left;">{$vo.remarks}</td>
<td>{$vo.admin}</td>
<td>{$vo.create_time | date='Y-m-d H:i:s'}</td>
</tr>
{/volist}
{/empty}
</table
</td>
</tr>
</table>
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,4 +1,4 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
{block name="style"}
<link rel="stylesheet" href="{__LAYUI__}/font/extend/iconfont.css?v={:get_system_config('web','version')}">
<link rel="stylesheet" href="{__CSS__}/gougucms.css?v={:get_system_config('web','version')}">
@ -10,71 +10,64 @@
<div class="layui-layout layui-layout-admin">
<div class="layui-header">
<div class="layui-logo" ittab-home><img src="{__IMG__}/syslogo.png" width="166" alt="{:get_system_config('web','admin_title')}" /></div>
<ul class="layui-nav layui-layout-right">
<ul class="layui-layout-right">
<li class="layui-nav-item" lay-unselect>
<a href="javascript:;" ittab-refresh class="refreshThis" id="ittab-refresh" title="刷新当前页"
style="margin-top:3px;">
<i class="layui-icon layui-icon-refresh-3"></i>
<a href="javascript:;" ittab-refresh class="refreshThis" id="ittab-refresh" title="刷新当前页">
<i class="layui-icon layui-icon-refresh"></i>
</a>
</li>
<li class="layui-nav-item" lay-unselect>
<a href="javascript:;" ittab-del-cache id="ittab-del-cache" style="margin-top:2px;" title="清空缓存"><i
class="layui-icon layui-icon-fonts-clear"></i></a>
<a href="javascript:;" ittab-notice class="noticeThis menu-active" data-src="/message/index/inbox" id="ittab-refresh" data-title="已收消息" title="消息通知">
<i class="layui-icon layui-icon-notice"></i>
</a>
<div id="msgNum" class="msg-num"><a data-title="已收消息" class="menu-active" data-src="/message/index/inbox" title="未读消息">0</a></div>
</li>
<li class="layui-nav-item" lay-unselect>
<a href="javascript:;" ittab-logout title="{:get_login_admin('nickname')}-点击退出登录">
<img src="{:get_login_admin('thumb')}" class="layui-nav-img" onerror="javascript:this.src='{__IMG__}/nonepic360x360.jpg';this.onerror=null;">
</a>
<div id="msgNum" class="msg-num"><a data-id="27" data-title="已收消息" data-src="/home/mail/inbox.html" class="site-menu-active" title="未读消息">0</a></div>
</li>
</ul>
</div>
<div class="layui-side ittab-bg-gray">
<div class="ittab-menulist">
<div class="ittab-menulist-top">
<a href="/" title="返回首页" style="background-color: #E94335"><i class="layui-icon layui-icon-home"></i></a><a href="javascript:;" title="修改个人信息" style="background-color:#fbbc05" data-id="10000" data-title="修改个人信息" data-src="/home/api/edit_personal" class="site-menu-active"><i class="layui-icon layui-icon-username"></i></a><a href="javascript:;" title="修改密码" style="background-color:#4285f4" data-id="10001" data-title="修改密码" data-src="/home/api/edit_password" class="site-menu-active"><i class="layui-icon layui-icon-password"></i></a>
<div class="layui-side menulist-bg-gray">
<div class="menulist">
<div class="menulist-top">
<a href="/" title="返回首页" style="background-color: #E94335"><i class="layui-icon layui-icon-home"></i></a><a href="javascript:;" title="修改个人信息" style="background-color:#fbbc05" data-title="修改个人信息" data-src="/api/index/edit_personal" class="menu-active"><i class="layui-icon layui-icon-username"></i></a><a href="javascript:;" title="修改密码" style="background-color:#4285f4" data-title="修改密码" data-src="/api/index/edit_password" class="menu-active"><i class="layui-icon layui-icon-password"></i></a><a href="javascript:;" ittab-del-cache id="ittab-del-cache" style="margin-top:2px;" title="清空缓存" style="background-color:#12bb37"><i class="layui-icon layui-icon-fonts-clear"></i></a>
</div>
<div class="ittab-menulist-1">
<ul class="layui-nav layui-nav-tree layui-inline" lay-shrink="all">
{foreach name="menu" item="a"}
<div class="ittab-menulist-2"><i class="iconfont {$a.icon}"></i> {$a.title}</div>
{notempty name="$a.list"}
<div class="ittab-menulist-3">
<ul>
{foreach name="$a.list" item="b"}
{empty name="$b.list"}
<li data-id="{$b.id}" data-title="{$b.title}" data-src="{:url($b.src)}"
class="site-menu-active"><span>{$b.title}</span></li>
{else /}
<li class="ittab-menulist-2">{$b.title}<i class="layui-icon layui-icon-triangle-r"></i></li>
<div class="ittab-menulist-3 ittab-menulist-4">
<ul>
{foreach name="$b.list" item="c"}
{empty name="$c.list"}
<li data-id="{$c.id}" data-title="{$c.title}" data-src="{:url($c.src)}"
class="site-menu-active"><span>{$c.title}</span></li>
{else /}
<li class="ittab-menulist-2">{$c.title}<i
class="layui-icon layui-icon-triangle-r"></i></li>
<div class="ittab-menulist-3 ittab-menulist-5">
<ul>
{foreach name="$c.list" item="d"}
<li data-id="{$d.id}" data-title="{$d.title}" data-src="{:url($d.src)}"
class="site-menu-active"><span>{$d.title}</span></li>
{/foreach}
</ul>
</div>
{/empty}
{/foreach}
</ul>
</div>
{/empty}
{/foreach}
</ul>
</div>
{/notempty}
<li class="layui-nav-item">
<a href="javascript:;" class="menu-active" data-id="{$a.id}" data-title="{$a.title}" data-src="/{$a.src}"><i class="iconfont {$a.icon}"></i> {$a.title}</a>
{notempty name="$a.list"}
<dl class="layui-nav-child">
{foreach name="$a.list" item="b"}
<dd>
<a href="javascript:;" class="menu-active menu-b" data-id="{$b.id}" data-title="{$b.title}" data-src="/{$b.src}">{$b.title}</a>
{notempty name="$b.list"}
<dl class="layui-nav-child">
{foreach name="$b.list" item="c"}
<dd>
<a href="javascript:;" class="menu-active menu-c" data-id="{$c.id}" data-title="{$c.title}" data-src="/{$c.src}">{$c.title}</a>
{notempty name="$c.list"}
<dl class="layui-nav-child">
{foreach name="$c.list" item="d"}
<dd><a href="javascript:;" class="menu-active menu-d" data-id="{$d.id}" data-title="{$d.title}" data-src="/{$d.src}">{$d.title}</a></dd>
{/foreach}
</dl>
{/notempty}
</dd>
{/foreach}
</dl>
{/notempty}
</dd>
{/foreach}
</dl>
{/notempty}
</li>
{/foreach}
</div>
</ul>
</div>
</div>
@ -170,6 +163,6 @@
})
}, 10000);
</script>
{include file="common/layui" base='base' extend="['gougucms']" callback="init" /}
{include file="../../base/view/common/layui" base='base' extend="['gougucms']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,4 +1,4 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
{block name="style"}
<style type="text/css">
@ -76,16 +76,16 @@
<div class="num-num">{$articleCount}</div>
</td>
<td>
<div class="num-title">工作记录</div>
<div class="num-num">{$scheduleCount}</div>
<div class="num-title">审批</div>
<div class="num-num">{$approveCount}</div>
</td>
<td>
<div class="num-title">客户</div>
<div class="num-num">0</div>
<div class="num-title">报销</div>
<div class="num-num">{$expenseCount}</div>
</td>
<td>
<div class="num-title">项目</div>
<div class="num-num">0</div>
<div class="num-title">发票</div>
<div class="num-num">{$invoiceCount}</div>
</td>
</tr>
</table>
@ -161,7 +161,7 @@
<div class="table-title">员工动态</div>
<div class="layui-card-body">
<ul class="layui-timeline" id="logs"></ul>
<div class="panel-more"><a href="/home/api/log_list">查看更多动态</a></div>
<div class="panel-more"><a href="javascript:;">查看更多动态</a></div>
</div>
</div>
</div>
@ -181,7 +181,7 @@
//公告
table.render({
elem: '#Note'
, url: "/home/api/get_note_list" //数据接口
, url: "/api/index/get_note_list" //数据接口
, page: false //开启分页
, cols: [[ //表头
{ field: 'cate_title', title: '公告分类', align: 'center','width': 90 },
@ -196,7 +196,7 @@
//文章
table.render({
elem: '#Article'
, url: "/home/api/get_article_list" //数据接口
, url: "/api/index/get_article_list" //数据接口
, page: false //开启分页
, cols: [[ //表头
{ field: 'cate_title', title: '知识分类', align: 'center','width': 90 },
@ -210,18 +210,23 @@
]]
});
$('.panel-more').on('click', function () {
TAB.sonAdd('/api/index/log_list','员工动态');
return;
});
//监听行工具事件
table.on('tool(Note)', function (obj) {
var data = obj.data;
if (obj.event === 'view') {
TAB.sonAdd('/home/note/view?id='+data.id,'公告详情');
TAB.sonAdd('/note/index/view?id='+data.id,'公告详情');
return;
}
});
table.on('tool(Article)', function (obj) {
var data = obj.data;
if (obj.event === 'view') {
TAB.sonAdd('/home/article/view?id='+data.id,'知识文章详情');
TAB.sonAdd('/article/index/view?id='+data.id,'知识文章详情');
return;
}
});
@ -234,7 +239,7 @@
function get_logs() {
$.ajax({
url: "/home/api/get_log_list",
url: "/api/index/log_list",
type: 'post',
data: {
page: 1,
@ -269,7 +274,7 @@
var chartView = echarts.init(document.getElementById('chartView'));
function get_view_data() {
$.ajax({
url: "/home/api/get_view_data",
url: "/api/index/get_view_data",
type: 'post',
data: {},
success: function (e) {
@ -501,6 +506,6 @@
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{include file="../../base/view/common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,216 +0,0 @@
{extend name="common/base"/}
{block name="style"}
<style>
.layui-table-min th{font-size:13px; text-align:center; background-color:#f8f8f8;}
.layui-table-min td{font-size:13px; padding:6px;text-align:center;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="body-content">
<h3 class="h3-title">发票详情</h3>
<table class="layui-table">
<tr>
<td class="layui-td-gray">开票金额(元)</td>
<td>
{$detail.amount}
</td>
<td class="layui-td-gray">开票类型</td>
<td>
{eq name="$detail.invoice_type" value="1"}增值税专用发票{/eq}
{eq name="$detail.invoice_type" value="2"}增值税普通发票{/eq}
</td>
<td class="layui-td-gray">开票主体</td>
<td>
{volist name=":get_invoice_subject()" id="vo"}
{eq name="$vo.id" value="$detail.invoice_subject"}{$vo.title}{/eq}
{/volist}
</td>
</tr>
<tr>
<td class="layui-td-gray">抬头类型</td>
<td>
{eq name="$detail.type" value="1"}企业{/eq}
{eq name="$detail.type" value="2"}个人{/eq}
</td>
<td class="layui-td-gray">开票抬头</td>
<td>{$detail.invoice_title}</td>
<td class="layui-td-gray">电话号码</td>
<td>{$detail.invoice_phone}</td>
</tr>
<tr class="invoice-type" {eq name="$detail.type" value="2"}style="display:none"{/eq}>
<td class="layui-td-gray2">纳税人识别号</td>
<td>{$detail.invoice_tax}</td>
<td class="layui-td-gray">开户行</td>
<td>{$detail.invoice_bank}</td>
<td class="layui-td-gray">银行账号</td>
<td>{$detail.invoice_account}</td>
</tr>
<tr class="invoice-type" {eq name="$detail.type" value="2"}style="display:none"{/eq}>
<td class="layui-td-gray2">银行营业网点</td>
<td>{$detail.invoice_banking}</td>
<td class="layui-td-gray">地址</td>
<td colspan="3">{$detail.invoice_address}</td>
</tr>
{notempty name="$detail.remark"}
<tr>
<td class="layui-td-gray">备注信息</td>
<td colspan="5">{$detail.remark}</td>
</tr>
{/notempty}
<tr>
<td class="layui-td-gray">发票状态</td>
<td colspan="5">
{if condition="($detail.invoice_status == 0)"}
<span style="color:#FF5722">审核不通过 【原因:{$detail.check_remark}】</span>
{elseif condition="($detail.invoice_status == 1)"}
<span style="color:#009688">审核中</span>
{elseif condition="($detail.invoice_status == 2)"}
<span style="color:#1E9FFF">审核通过,待开具</span>
{elseif condition="($detail.invoice_status == 3)"}
<span style="color:#1E9FFF">已开具</span>
{elseif condition="($detail.invoice_status == 10)"}
<span style="color:#FF5722">已作废</span>
{/if}
</td>
</tr>
{if condition="$detail.check_time > 0"}
<tr>
<td class="layui-td-gray2">审核人</td>
<td>{$detail.check_admin}</td>
<td class="layui-td-gray2">审核时间</td>
<td colspan="3">{$detail.check_time}</td>
</tr>
{else/}
<tr>
<td class="layui-td-gray2">审核人</td>
<td colspan="5">{$detail.check_admin}</td>
</tr>
{/if}
{if condition="$detail.open_admin_id > 0"}
<tr>
<td class="layui-td-gray2">开票人</td>
<td>{$detail.open_admin}</td>
<td class="layui-td-gray2">开票时间</td>
<td>{$detail.open_time}</td>
<td class="layui-td-gray2">发票号码</td>
<td>{$detail.code}</td>
</tr>
{/if}
{if condition="($detail.invoice_status == 1) AND ($uid == $detail.check_admin_id)"}
<tr>
<td class="layui-td-gray">选择开票人<span style="color: red">*</span></td>
<td>
<form class="layui-form">
<select name="open_admin_id">
<option value="">请选择发票开具人</option>
{volist name=":get_check_user(4)" id="vo"}
<option value="{$vo.uid}">{$vo.user}</option>
{/volist}
</select>
</form>
</td>
<td colspan="4">
<button class="layui-btn layui-btn-danger" lay-event="checkno">审核不通过</button>
<button class="layui-btn" lay-event="checkok">审核通过</button>
</td>
</tr>
{/if}
</table>
<div class="layui-form-item" style="padding-top:10px;">
<input name="id" id="id" type="hidden" value="{$detail.id}">
{if condition="($detail.invoice_status == 0) AND ($uid == $detail.admin_id)"}
<a class="layui-btn" href="/home/invoice/add?id={$detail.id}">编辑</a>
{/if}
{if condition="($detail.invoice_status == 2) AND ($uid == $detail.open_admin_id)"}
<button class="layui-btn" lay-event="payed">开票确认</button>
{/if}
</div>
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
$('.body-content').on('click', '[lay-event="checkok"]', function () {
var id=$('#id').val();
var open_admin=$('[name="open_admin_id"]').val();
if(open_admin == ''){
layer.msg('请选择发票开具人');
return false;
}
layer.confirm('确定审核通过该发票申请?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/home/invoice/check",
data:{id:id,invoice_status:2,open_admin_id:open_admin},
success:function(res){
layer.msg(res.msg);
if(res.code==0){
parent.tableIns.reload();
window.setTimeout(function(){
location.reload();
},1200)
}
}
})
})
return false;
});
$('.body-content').on('click', '[lay-event="checkno"]', function () {
var id=$('#id').val();
layer.confirm('确定拒绝该发票申请?', {icon: 3, title:'提示'}, function(index){
layer.prompt({title: '拒绝的理由', formType: 3,value :''}, function(text, index){
if(text ==''){
layer.msg('请输入拒绝的理由');
return false;
}
$.ajax({
url: "/home/invoice/check",
data:{id:id,invoice_status:0,check_remark:text},
success:function(res){
layer.msg(res.msg);
if(res.code==0){
parent.tableIns.reload();
window.setTimeout(function(){
location.reload();
},1200)
}
}
})
layer.closeAll();
})
})
})
$('.body-content').on('click', '[lay-event="payed"]', function () {
var id=$('#id').val();
layer.confirm('确定已经开具发票?', {icon: 3, title:'提示'}, function(index){
layer.prompt({title: '输入发票号码', formType: 3,value :''}, function(text, index){
if(text ==''){
layer.msg('请输入发票号码');
return false;
}
$.ajax({
url: "/home/invoice/check",
data:{id:id,invoice_status:3,code:text},
success:function(res){
layer.msg(res.msg);
if(res.code==0){
parent.tableIns.reload();
window.setTimeout(function(){
location.reload();
},1200)
}
}
})
})
})
})
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,7 +1,7 @@
{extend name="common/base"/}
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<form class="layui-form page-content">
<h3 class="h3-title">知识关键字</h3>
<table class="layui-table">
<tr>
@ -12,8 +12,10 @@
<td class="layui-td-gray">排序</td>
<td><input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input" {notempty name="$keywords.sort" }value="{$keywords.sort}" {/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray">状态<font>*</font></td>
<td>
<td colspan = "3">
{if condition="$id eq 0"}
<input type="radio" name="status" value="1" title="正常" checked>
<input type="radio" name="status" value="0" title="禁用">
@ -49,12 +51,12 @@
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
parent.location.reload();
});
} else {
layer.msg(e.msg);
parent.tableIns.reload();
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
}
})
@ -63,6 +65,6 @@
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{include file="../../base/view/common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

Some files were not shown because too many files have changed in this diff Show More