基础数据模块优化
This commit is contained in:
parent
33baa7726a
commit
963b0de0b7
83
app/home/controller/Check.php
Normal file
83
app/home/controller/Check.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?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\home\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, "删除失败");
|
||||
}
|
||||
}
|
||||
}
|
344
app/home/controller/Invoice.php
Normal file
344
app/home/controller/Invoice.php
Normal file
@ -0,0 +1,344 @@
|
||||
<?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\home\BaseController;
|
||||
use app\home\model\Invoice as InvoiceList;
|
||||
use app\home\model\InvoiceSubject;
|
||||
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());
|
||||
}
|
||||
$data['update_time'] = time();
|
||||
$res = InvoiceSubject::strict(false)->field(true)->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 = 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 = ExpenseList::where($where)
|
||||
->order('create_time asc')
|
||||
->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->user_name = Db::name('Admin')->where(['id' => $item->uid])->value('name');
|
||||
$item->admin_name = 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->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['uid']])->value('name');
|
||||
$expense['department'] = Db::name('Department')->where(['id' => $expense['did']])->value('title');
|
||||
$expense['amount'] = Db::name('ExpenseInterfix')->where(['exid' => $expense['id']])->sum('amount');
|
||||
|
||||
if ($expense['check_admin_id'] > 0) {
|
||||
$expense['check_admin'] = Db::name('Admin')->where(['id' => $expense['check_admin_id']])->value('name');
|
||||
$expense['check_time'] = date('Y-m-d H:i:s', $expense['check_time']);
|
||||
}
|
||||
if ($expense['pay_admin_id'] > 0) {
|
||||
$expense['pay_admin'] = Db::name('Admin')->where(['id' => $expense['pay_admin_id']])->value('name');
|
||||
$expense['pay_time'] = date('Y-m-d H:i:s', $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')
|
||||
->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]];
|
||||
}
|
||||
$expense = $this->get_list($param, $where);
|
||||
return table_assign(0, '', $expense);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
function list() {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = [];
|
||||
$where[] = ['admin_id', '=', $this->uid];
|
||||
$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]];
|
||||
}
|
||||
$expense = $this->get_list($param, $where);
|
||||
return table_assign(0, '', $expense);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//添加
|
||||
public function add()
|
||||
{
|
||||
$id = empty(get_params('id')) ? 0 : get_params('id');
|
||||
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 post_submit()
|
||||
{
|
||||
$admin_id = $this->uid;
|
||||
$dbRes = false;
|
||||
$param = get_params();
|
||||
$param['admin_id'] = $admin_id;
|
||||
$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();
|
||||
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, '保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
//查看
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
@ -40,20 +40,8 @@ class Keywords extends BaseController
|
||||
//添加
|
||||
public function add()
|
||||
{
|
||||
$id = empty(get_params('id')) ? 0 : get_params('id');
|
||||
if ($id > 0) {
|
||||
$keywords = Db::name('Keywords')->where(['id' => $id])->find();
|
||||
View::assign('keywords', $keywords);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
|
||||
//提交添加
|
||||
public function post_submit()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(KeywordsCheck::class)->scene('edit')->check($param);
|
||||
@ -66,7 +54,6 @@ class Keywords extends BaseController
|
||||
if ($res) {
|
||||
add_log('edit', $param['id'], $param);
|
||||
}
|
||||
|
||||
return to_assign();
|
||||
} else {
|
||||
try {
|
||||
@ -80,11 +67,20 @@ class Keywords extends BaseController
|
||||
if ($insertId) {
|
||||
add_log('add', $insertId, $param);
|
||||
}
|
||||
|
||||
return to_assign();
|
||||
}
|
||||
} else {
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if ($id > 0) {
|
||||
$keywords = Db::name('Keywords')->where(['id' => $id])->find();
|
||||
View::assign('keywords', $keywords);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delete()
|
||||
{
|
||||
|
@ -11,58 +11,123 @@ namespace app\home\controller;
|
||||
|
||||
use app\home\BaseController;
|
||||
use app\home\model\Schedule as ScheduleList;
|
||||
use app\home\validate\ScheduleCheck;
|
||||
use think\exception\ValidateException;
|
||||
use schedule\Schedule as ScheduleIndex;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Schedule extends BaseController
|
||||
{
|
||||
public function cate()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
$where[] = ['s.status', '>=', 0];
|
||||
$rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit'];
|
||||
$content = Db::name('ScheduleCate')
|
||||
->field('s.*,d.title as department')
|
||||
->alias('s')
|
||||
->join('Department d', 's.did = d.id', 'LEFT')
|
||||
->where($where)
|
||||
->paginate($rows, false, ['query' => $param]);
|
||||
return table_assign(0, '', $content);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//添加/编辑工作类别
|
||||
public function cate_add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('ScheduleCate')->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('ScheduleCate')->strict(false)->field(true)->insertGetId($param);
|
||||
if ($insertId) {
|
||||
add_log('add', $insertId, $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
} else {
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$department = set_recursion(get_department());
|
||||
if ($id > 0) {
|
||||
$detail = Db::name('ScheduleCate')->where(['id' => $id])->find();
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
View::assign('department', $department);
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//删除
|
||||
public function cate_delete()
|
||||
{
|
||||
$id = get_params("id");
|
||||
$data['status'] = '-1';
|
||||
$data['id'] = $id;
|
||||
$data['update_time'] = time();
|
||||
if (Db::name('ScheduleCate')->update($data) !== false) {
|
||||
add_log('delete', $id, $data);
|
||||
return to_assign(0, "删除成功");
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
//工作记录
|
||||
public function index()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param=get_params();
|
||||
$uid=$this->uid;
|
||||
$param = get_params();
|
||||
$uid = $this->uid;
|
||||
if (!empty($param['uid'])) {
|
||||
$uid = $param['uid'];
|
||||
}
|
||||
$where=[];
|
||||
$where[]=['start_time','>=',strtotime($param['start'])];
|
||||
$where[]=['end_time','<=',strtotime($param['end'])];
|
||||
$where[] =['admin_id','=',$uid];
|
||||
$where[] = ['status','=', 1];
|
||||
$where = [];
|
||||
$where[] = ['start_time', '>=', strtotime($param['start'])];
|
||||
$where[] = ['end_time', '<=', strtotime($param['end'])];
|
||||
$where[] = ['admin_id', '=', $uid];
|
||||
$where[] = ['status', '=', 1];
|
||||
$schedule = Db::name('Schedule')->where($where)->field('id,name,labor_time,start_time,end_time')->select()->toArray();
|
||||
$events = [];
|
||||
$countEvents=[];
|
||||
$countEvents = [];
|
||||
foreach ($schedule as $k => $v) {
|
||||
$v['backgroundColor']='#009688';
|
||||
$v['borderColor']='#009688';
|
||||
$v['title']='['.$v['labor_time'].'工时] '.$v['name'];
|
||||
$v['start']=date('Y-m-d H:i', $v['start_time']);
|
||||
$v['end']=date('Y-m-d H:i', $v['end_time']);
|
||||
$temData=date('Y-m-d', $v['start_time']);
|
||||
if(array_key_exists($temData, $countEvents)){
|
||||
$countEvents[$temData]['times']+=$v['labor_time'];
|
||||
}
|
||||
else{
|
||||
$countEvents[$temData]['times']=$v['labor_time'];
|
||||
$countEvents[$temData]['start']=date('Y-m-d', $v['start_time']);
|
||||
$v['backgroundColor'] = '#009688';
|
||||
$v['borderColor'] = '#009688';
|
||||
$v['title'] = '[' . $v['labor_time'] . '工时] ' . $v['name'];
|
||||
$v['start'] = date('Y-m-d H:i', $v['start_time']);
|
||||
$v['end'] = date('Y-m-d H:i', $v['end_time']);
|
||||
$temData = date('Y-m-d', $v['start_time']);
|
||||
if (array_key_exists($temData, $countEvents)) {
|
||||
$countEvents[$temData]['times'] += $v['labor_time'];
|
||||
} else {
|
||||
$countEvents[$temData]['times'] = $v['labor_time'];
|
||||
$countEvents[$temData]['start'] = date('Y-m-d', $v['start_time']);
|
||||
}
|
||||
unset($v['name']);
|
||||
unset($v['start_time']);
|
||||
unset($v['end_time']);
|
||||
$events[] = $v;
|
||||
}
|
||||
}
|
||||
foreach ($countEvents as $kk => $vv) {
|
||||
$vv['backgroundColor']='#FF5722';
|
||||
$vv['borderColor']='#FF5722';
|
||||
$vv['title']='【当天总工时:'.$vv['times'].'】';
|
||||
$vv['end']=$vv['start'];
|
||||
$vv['id']=0;
|
||||
$vv['backgroundColor'] = '#FF5722';
|
||||
$vv['borderColor'] = '#FF5722';
|
||||
$vv['title'] = '【当天总工时:' . $vv['times'] . '】';
|
||||
$vv['end'] = $vv['start'];
|
||||
$vv['id'] = 0;
|
||||
unset($vv['times']);
|
||||
$events[] = $vv;
|
||||
}
|
||||
}
|
||||
$input_arrays = $events;
|
||||
$range_start = parseDateTime($param['start']);
|
||||
$range_end = parseDateTime($param['end']);
|
||||
@ -70,7 +135,7 @@ class Schedule extends BaseController
|
||||
if (isset($_GET['timeZone'])) {
|
||||
$timeZone = new DateTimeZone($_GET['timeZone']);
|
||||
}
|
||||
|
||||
|
||||
// Accumulate an output array of event data arrays.
|
||||
$output_arrays = array();
|
||||
foreach ($input_arrays as $array) {
|
||||
@ -86,28 +151,26 @@ class Schedule extends BaseController
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
|
||||
function list() {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
//按时间检索
|
||||
$start_time = isset($param['start_time']) ? strtotime($param['start_time']) : 0;
|
||||
$end_time = isset($param['end_time']) ? strtotime($param['end_time']) : 0;
|
||||
$where=[];
|
||||
$where = [];
|
||||
if ($start_time > 0 && $end_time > 0) {
|
||||
$where[]=['a.start_time','between', [$start_time,$end_time]];
|
||||
}
|
||||
$where[] = ['a.start_time', 'between', [$start_time, $end_time]];
|
||||
}
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['a.name','like', '%' . trim($param['keywords']) . '%'];
|
||||
$where[] = ['a.name', 'like', '%' . trim($param['keywords']) . '%'];
|
||||
}
|
||||
if (!empty($param['uid'])) {
|
||||
$where[] =['a.admin_id','=',$param['uid']];
|
||||
$where[] = ['a.admin_id', '=', $param['uid']];
|
||||
} else {
|
||||
$where[] = ['a.admin_id', '=', $this->uid];
|
||||
}
|
||||
else{
|
||||
$where[] =['a.admin_id','=',$this->uid];
|
||||
}
|
||||
$where[] = ['a.status','=', 1];
|
||||
$where[] = ['a.status', '=', 1];
|
||||
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
|
||||
$schedule = ScheduleList::where($where)
|
||||
->field('a.*,u.name as create_admin')
|
||||
@ -116,45 +179,111 @@ class Schedule extends BaseController
|
||||
->order('a.id desc')
|
||||
->paginate($rows, false)
|
||||
->each(function ($item, $key) {
|
||||
$item->start_time = empty($item->start_time) ? '': date('Y-m-d H:i', $item->start_time);
|
||||
$item->start_time = empty($item->start_time) ? '' : date('Y-m-d H:i', $item->start_time);
|
||||
//$item->end_time = empty($item->end_time) ? '': date('Y-m-d H:i', $item->end_time);
|
||||
$item->end_time = empty($item->end_time) ? '': date('H:i', $item->end_time);
|
||||
$item->end_time = empty($item->end_time) ? '' : date('H:i', $item->end_time);
|
||||
});
|
||||
return table_assign(0, '', $schedule);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//保存日志数据
|
||||
public function save()
|
||||
{
|
||||
$param = get_params();
|
||||
$admin_id=$this->uid;
|
||||
if($param['id']==0){
|
||||
if(isset($param['start_time'])){
|
||||
$param['start_time'] = strtotime($param['start_time'].''.$param['start_time_1']);
|
||||
$admin_id = $this->uid;
|
||||
if ($param['id'] == 0) {
|
||||
if (isset($param['start_time'])) {
|
||||
$param['start_time'] = strtotime($param['start_time'] . '' . $param['start_time_1']);
|
||||
}
|
||||
if(isset($param['end_time'])){
|
||||
$param['end_time'] = strtotime($param['end_time'].''.$param['end_time_1']);
|
||||
if (isset($param['end_time'])) {
|
||||
$param['end_time'] = strtotime($param['end_time'] . '' . $param['end_time_1']);
|
||||
}
|
||||
if( $param['end_time'] <= $param['start_time']){
|
||||
if ($param['end_time'] <= $param['start_time']) {
|
||||
return to_assign(1, "结束时间需要大于开始时间");
|
||||
}
|
||||
$where1[]=['status','=',1];
|
||||
$where1[]=['admin_id','=',$admin_id];
|
||||
$where1[]=['start_time','between', [$param['start_time'],$param['end_time']-1]];
|
||||
$where1[] = ['status', '=', 1];
|
||||
$where1[] = ['admin_id', '=', $admin_id];
|
||||
$where1[] = ['start_time', 'between', [$param['start_time'], $param['end_time'] - 1]];
|
||||
|
||||
$where2[]=['status','=',1];
|
||||
$where2[]=['admin_id','=',$admin_id];
|
||||
$where2[]=['start_time','<=',$param['start_time']];
|
||||
$where2[]=['start_time','>=',$param['end_time']];
|
||||
$where2[] = ['status', '=', 1];
|
||||
$where2[] = ['admin_id', '=', $admin_id];
|
||||
$where2[] = ['start_time', '<=', $param['start_time']];
|
||||
$where2[] = ['start_time', '>=', $param['end_time']];
|
||||
|
||||
$where3[]=['status','=',1];
|
||||
$where3[]=['admin_id','=',$admin_id];
|
||||
$where3[]=['end_time','between', [$param['start_time']+1,$param['end_time']]];
|
||||
$where3[] = ['status', '=', 1];
|
||||
$where3[] = ['admin_id', '=', $admin_id];
|
||||
$where3[] = ['end_time', 'between', [$param['start_time'] + 1, $param['end_time']]];
|
||||
|
||||
$record = Db::name('Schedule')
|
||||
->where(function ($query) use ($where1) {
|
||||
$query->where($where1);
|
||||
})
|
||||
->whereOr(function ($query) use ($where2) {
|
||||
$query->where($where2);
|
||||
})
|
||||
->whereOr(function ($query) use ($where3) {
|
||||
$query->where($where3);
|
||||
})
|
||||
->count();
|
||||
if ($record > 0) {
|
||||
return to_assign(1, "您所选的时间区间已有工作记录,请重新选时间");
|
||||
}
|
||||
$param['labor_time'] = ($param['end_time'] - $param['start_time']) / 3600;
|
||||
$param['admin_id'] = $admin_id;
|
||||
$param['did'] = get_admin($admin_id)['did'];
|
||||
$param['create_time'] = time();
|
||||
$addid = Db::name('Schedule')->strict(false)->field(true)->insertGetId($param);
|
||||
if ($addid > 0) {
|
||||
add_log('add', $addid, $param);
|
||||
return to_assign(0, '操作成功');
|
||||
} else {
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
} else {
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('Schedule')->strict(false)->field(true)->update($param);
|
||||
if ($res !== false) {
|
||||
add_log('edit', $addid, $param);
|
||||
return to_assign(0, '操作成功');
|
||||
} else {
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//更改工时
|
||||
public function update_labor_time()
|
||||
{
|
||||
$param = get_params();
|
||||
if (isset($param['start_time'])) {
|
||||
$param['start_time'] = strtotime($param['start_time'] . '' . $param['start_time_1']);
|
||||
}
|
||||
if (isset($param['end_time'])) {
|
||||
$param['end_time'] = strtotime($param['end_time'] . '' . $param['end_time_1']);
|
||||
}
|
||||
if ($param['end_time'] <= $param['start_time']) {
|
||||
return to_assign(1, "结束时间需要大于开始时间");
|
||||
}
|
||||
$where1[] = ['status', '=', 1];
|
||||
$where1[] = ['id', '<>', $param['id']];
|
||||
$where1[] = ['admin_id', '=', $param['admin_id']];
|
||||
$where1[] = ['start_time', 'between', [$param['start_time'], $param['end_time'] - 1]];
|
||||
|
||||
$where2[] = ['status', '=', 1];
|
||||
$where2[] = ['id', '<>', $param['id']];
|
||||
$where2[] = ['admin_id', '=', $param['admin_id']];
|
||||
$where2[] = ['start_time', '<=', $param['start_time']];
|
||||
$where2[] = ['start_time', '>=', $param['end_time']];
|
||||
|
||||
$where3[] = ['status', '=', 1];
|
||||
$where3[] = ['id', '<>', $param['id']];
|
||||
$where3[] = ['admin_id', '=', $param['admin_id']];
|
||||
$where3[] = ['end_time', 'between', [$param['start_time'] + 1, $param['end_time']]];
|
||||
|
||||
$record = Db::name('Schedule')
|
||||
->where(function ($query) use ($where1) {
|
||||
$query->where($where1);
|
||||
})
|
||||
@ -165,78 +294,12 @@ class Schedule extends BaseController
|
||||
$query->where($where3);
|
||||
})
|
||||
->count();
|
||||
if($record>0){
|
||||
return to_assign(1, "您所选的时间区间已有工作记录,请重新选时间");
|
||||
}
|
||||
$param['labor_time'] = ($param['end_time'] - $param['start_time']) / 3600;
|
||||
$param['admin_id'] = $admin_id;
|
||||
$param['did'] = get_admin($admin_id)['did'];
|
||||
$param['create_time']=time();
|
||||
$addid = Db::name('Schedule')->strict(false)->field(true)->insertGetId($param);
|
||||
if($addid>0){
|
||||
add_log('add', $addid, $param);
|
||||
return to_assign(0,'操作成功');
|
||||
}else{
|
||||
return to_assign(0,'操作失败');
|
||||
}
|
||||
}else{
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('Schedule')->strict(false)->field(true)->update($param);
|
||||
if ($res!==false) {
|
||||
add_log('edit', $addid, $param);
|
||||
return to_assign(0,'操作成功');
|
||||
}else{
|
||||
return to_assign(0,'操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//更改工时
|
||||
public function update_labor_time()
|
||||
{
|
||||
$param = get_params();
|
||||
if(isset($param['start_time'])){
|
||||
$param['start_time'] = strtotime($param['start_time'].''.$param['start_time_1']);
|
||||
}
|
||||
if(isset($param['end_time'])){
|
||||
$param['end_time'] = strtotime($param['end_time'].''.$param['end_time_1']);
|
||||
}
|
||||
if( $param['end_time'] <= $param['start_time']){
|
||||
return to_assign(1, "结束时间需要大于开始时间");
|
||||
}
|
||||
$where1[]=['status','=',1];
|
||||
$where1[]=['id','<>',$param['id']];
|
||||
$where1[]=['admin_id','=',$param['admin_id']];
|
||||
$where1[]=['start_time','between', [$param['start_time'],$param['end_time']-1]];
|
||||
|
||||
$where2[]=['status','=',1];
|
||||
$where2[]=['id','<>',$param['id']];
|
||||
$where2[]=['admin_id','=',$param['admin_id']];
|
||||
$where2[]=['start_time','<=',$param['start_time']];
|
||||
$where2[]=['start_time','>=',$param['end_time']];
|
||||
|
||||
$where3[]=['status','=',1];
|
||||
$where3[]=['id','<>',$param['id']];
|
||||
$where3[]=['admin_id','=',$param['admin_id']];
|
||||
$where3[]=['end_time','between', [$param['start_time']+1,$param['end_time']]];
|
||||
|
||||
$record = Db::name('Schedule')
|
||||
->where(function ($query) use ($where1) {
|
||||
$query->where($where1);
|
||||
})
|
||||
->whereOr(function ($query) use ($where2) {
|
||||
$query->where($where2);
|
||||
})
|
||||
->whereOr(function ($query) use ($where3) {
|
||||
$query->where($where3);
|
||||
})
|
||||
->count();
|
||||
if($record>0){
|
||||
if ($record > 0) {
|
||||
return to_assign(1, "您所选的时间区间已有工作记录,请重新选时间");
|
||||
}
|
||||
}
|
||||
$param['labor_time'] = ($param['end_time'] - $param['start_time']) / 3600;
|
||||
$res = Db::name('Schedule')->strict(false)->field(true)->update($param);
|
||||
if ($res!==false) {
|
||||
if ($res !== false) {
|
||||
return to_assign(0, "操作成功");
|
||||
add_log('edit', $param['id'], $param);
|
||||
} else {
|
||||
@ -261,34 +324,32 @@ class Schedule extends BaseController
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
$id=get_params('id');
|
||||
$schedule = Db::name('Schedule')->where(['id'=>$id])->find();
|
||||
$id = get_params('id');
|
||||
$schedule = Db::name('Schedule')->where(['id' => $id])->find();
|
||||
if (!empty($schedule)) {
|
||||
$schedule['start_time_1'] = date('H:i', $schedule['start_time']);
|
||||
$schedule['end_time_1'] = date('H:i', $schedule['end_time']);
|
||||
$schedule['start_time'] = date('Y-m-d', $schedule['start_time']);
|
||||
$schedule['end_time'] = date('Y-m-d', $schedule['end_time']);
|
||||
$schedule['create_time'] = date('Y-m-d H:i:s', $schedule['create_time']);
|
||||
$schedule['user'] = Db::name('Admin')->where(['id'=>$schedule['admin_id']])->value('name');
|
||||
$schedule['user'] = Db::name('Admin')->where(['id' => $schedule['admin_id']])->value('name');
|
||||
}
|
||||
if (request()->isAjax()) {
|
||||
return to_assign(0, "", $schedule);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
return $schedule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//读取日程弹层详情
|
||||
public function view()
|
||||
{
|
||||
$id=get_params('id');
|
||||
$schedule=$this->detail($id);
|
||||
if($schedule){
|
||||
$id = get_params('id');
|
||||
$schedule = $this->detail($id);
|
||||
if ($schedule) {
|
||||
View::assign('schedule', $schedule);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
echo '该工作记录不存在';
|
||||
}
|
||||
}
|
||||
@ -298,7 +359,7 @@ class Schedule extends BaseController
|
||||
{
|
||||
$this_year = date("Y");
|
||||
$admin_did = \think\Session::get('vae_admin');
|
||||
return view('', ['this_year' => $this_year, 'this_uid' => $admin_did['id'],'username'=>$admin_did['nickname']]);
|
||||
return view('', ['this_year' => $this_year, 'this_uid' => $admin_did['id'], 'username' => $admin_did['nickname']]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,12 +30,12 @@ class Expense extends BaseController
|
||||
}
|
||||
}
|
||||
//提交保存分类
|
||||
public function cate_post_submit()
|
||||
public function cate_add()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
try {
|
||||
validate(ExpenseCateCheck::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
@ -48,7 +48,7 @@ class Expense extends BaseController
|
||||
}
|
||||
return to_assign();
|
||||
} else {
|
||||
try {
|
||||
try {
|
||||
validate(ExpenseCateCheck::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
@ -63,89 +63,88 @@ class Expense extends BaseController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function get_list($param=[],$where=[])
|
||||
|
||||
public function get_list($param = [], $where = [])
|
||||
{
|
||||
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
|
||||
$expense = ExpenseList::where($where)
|
||||
->order('create_time asc')
|
||||
->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->user_name = Db::name('Admin')->where(['id' => $item->uid])->value('name');
|
||||
$item->admin_name = 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->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;
|
||||
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
|
||||
$expense = ExpenseList::where($where)
|
||||
->order('create_time asc')
|
||||
->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->user_name = Db::name('Admin')->where(['id' => $item->uid])->value('name');
|
||||
$item->admin_name = 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->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)
|
||||
|
||||
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 = 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['uid']])->value('name');
|
||||
$expense['user_name'] = Db::name('Admin')->where(['id' => $expense['uid']])->value('name');
|
||||
$expense['department'] = Db::name('Department')->where(['id' => $expense['did']])->value('title');
|
||||
$expense['amount'] = Db::name('ExpenseInterfix')->where(['exid'=>$expense['id']])->sum('amount');
|
||||
|
||||
if($expense['check_admin_id']>0){
|
||||
$expense['check_admin'] = Db::name('Admin')->where(['id' => $expense['check_admin_id']])->value('name');
|
||||
$expense['check_time'] = date('Y-m-d H:i:s', $expense['check_time']);
|
||||
}
|
||||
if($expense['pay_admin_id']>0){
|
||||
$expense['pay_admin'] = Db::name('Admin')->where(['id' => $expense['pay_admin_id']])->value('name');
|
||||
$expense['pay_time'] = date('Y-m-d H:i:s', $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')
|
||||
->where(['a.exid'=>$expense['id']])
|
||||
->select();
|
||||
}
|
||||
return $expense;
|
||||
$expense['amount'] = Db::name('ExpenseInterfix')->where(['exid' => $expense['id']])->sum('amount');
|
||||
|
||||
if ($expense['check_admin_id'] > 0) {
|
||||
$expense['check_admin'] = Db::name('Admin')->where(['id' => $expense['check_admin_id']])->value('name');
|
||||
$expense['check_time'] = date('Y-m-d H:i:s', $expense['check_time']);
|
||||
}
|
||||
if ($expense['pay_admin_id'] > 0) {
|
||||
$expense['pay_admin'] = Db::name('Admin')->where(['id' => $expense['pay_admin_id']])->value('name');
|
||||
$expense['pay_time'] = date('Y-m-d H:i:s', $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')
|
||||
->where(['a.exid' => $expense['id']])
|
||||
->select();
|
||||
}
|
||||
return $expense;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where=[];
|
||||
$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]];
|
||||
$where[] = ['expense_time', 'between', [$start_time, $end_time]];
|
||||
}
|
||||
$expense = $this->get_list($param,$where);
|
||||
$expense = $this->get_list($param, $where);
|
||||
return table_assign(0, '', $expense);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
|
||||
function list() {
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where=[];
|
||||
$where = [];
|
||||
$where[] = ['admin_id', '=', $this->uid];
|
||||
$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]];
|
||||
$where[] = ['expense_time', 'between', [$start_time, $end_time]];
|
||||
}
|
||||
$expense = $this->get_list($param,$where);
|
||||
$expense = $this->get_list($param, $where);
|
||||
return table_assign(0, '', $expense);
|
||||
} else {
|
||||
return view();
|
||||
@ -157,10 +156,10 @@ class Expense extends BaseController
|
||||
{
|
||||
$id = empty(get_params('id')) ? 0 : get_params('id');
|
||||
if ($id > 0) {
|
||||
$expense = $this->detail($id );
|
||||
$expense = $this->detail($id);
|
||||
View::assign('expense', $expense);
|
||||
}
|
||||
$expense_cate=Db::name('ExpenseCate')->where(['status' => 1])->select()->toArray();
|
||||
$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);
|
||||
@ -170,124 +169,126 @@ class Expense extends BaseController
|
||||
//提交添加
|
||||
public function post_submit()
|
||||
{
|
||||
$admin_id=$this->uid;
|
||||
$dbRes = false;
|
||||
$param = get_params();
|
||||
$param['admin_id'] = $admin_id;
|
||||
$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();
|
||||
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,'保存失败');
|
||||
}
|
||||
$admin_id = $this->uid;
|
||||
$dbRes = false;
|
||||
$param = get_params();
|
||||
$param['admin_id'] = $admin_id;
|
||||
$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();
|
||||
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, '保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
//查看
|
||||
public function view()
|
||||
{
|
||||
$id = empty(get_params('id')) ? 0 : get_params('id');
|
||||
$expense = $this->detail($id );
|
||||
$expense = $this->detail($id);
|
||||
View::assign('uid', $this->uid);
|
||||
View::assign('expense', $expense);
|
||||
return view();
|
||||
@ -297,13 +298,13 @@ class Expense extends BaseController
|
||||
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, "已打款的报销记录不能删除");
|
||||
}
|
||||
$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();
|
||||
@ -314,29 +315,29 @@ class Expense extends BaseController
|
||||
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, "操作失败");
|
||||
}
|
||||
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);
|
||||
$expense = $this->detail($param['id']);
|
||||
View::assign('expense', $expense);
|
||||
View::assign('uid', $this->uid);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
7
app/home/model/Invoice.php
Normal file
7
app/home/model/Invoice.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
namespace app\home\model;
|
||||
use think\Model;
|
||||
class Invoice extends Model
|
||||
{
|
||||
|
||||
}
|
15
app/home/model/InvoiceSubject.php
Normal file
15
app/home/model/InvoiceSubject.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?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 InvoiceSubject extends Model
|
||||
{
|
||||
|
||||
}
|
23
app/home/validate/InvoiceCheck.php
Normal file
23
app/home/validate/InvoiceCheck.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace app\home\validate;
|
||||
use think\Validate;
|
||||
|
||||
class InvoiceCheck 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']
|
||||
];
|
||||
}
|
29
app/home/validate/InvoiceSubjectCheck.php
Normal file
29
app/home/validate/InvoiceSubjectCheck.php
Normal 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 InvoiceSubjectCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:expense_cate',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '名称不能为空',
|
||||
'title.unique' => '同样的名称已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title'],
|
||||
'edit' => ['id', 'title'],
|
||||
];
|
||||
}
|
131
app/home/view/check/add.html
Normal file
131
app/home/view/check/add.html
Normal file
@ -0,0 +1,131 @@
|
||||
{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">
|
||||
{if condition="$id eq 0"}
|
||||
<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">报销审核</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>
|
||||
<button lay-event="back" 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:"{:url('/home/api/get_department_tree')}",
|
||||
employee_url:"{:url('/home/api/get_employee')}",
|
||||
ids:idsArray,
|
||||
names:namesArray,
|
||||
callback:function(ids,names){
|
||||
$('[name="uids"]').val(ids.join(',')),
|
||||
$('[name="person_name"]').val(names.join(','));
|
||||
}
|
||||
});
|
||||
}
|
||||
//选择对应人
|
||||
$('[name="name"]').on('click',function(){
|
||||
addEmployee();
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
$.ajax({
|
||||
url: "{:url('home/conf/add')}",
|
||||
type: 'post',
|
||||
data: data.field,
|
||||
success: function (e) {
|
||||
if (e.code == 0) {
|
||||
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
|
||||
window.location.href="{:url('home/conf/index')}";
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
//监听返回
|
||||
$('.body-content').on('click', '[lay-event="back"]', function () {
|
||||
history.back(-1);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
{include file="common/layui" base="base" extend="['employeepicker']" callback="init" /}
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
88
app/home/view/check/index.html
Normal file
88
app/home/view/check/index.html
Normal file
@ -0,0 +1,88 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<div class="body-content">
|
||||
<table class="layui-hide" id="test" lay-filter="test"></table>
|
||||
</div>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
<a class="layui-btn layui-btn-normal layui-btn-sm" href="{:url('home/check/add')}">+ 添加审核人配置</a>
|
||||
</div>
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
function init(layui) {
|
||||
var table = layui.table,
|
||||
form = layui.form;
|
||||
|
||||
var tableIns = table.render({
|
||||
elem: '#test',
|
||||
title: '配置列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: "{: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+='<a class="layui-btn layui-btn-xs" href="/home/check/add?id='+d.id+'">编辑</a>';
|
||||
html+= '<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>';
|
||||
html+= '</div>';
|
||||
return html;
|
||||
}
|
||||
}]
|
||||
]
|
||||
});
|
||||
//删除
|
||||
table.on('tool(test)', function (obj) {
|
||||
if (obj.event === 'del') {
|
||||
layer.confirm('确定要删除吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function (index) {
|
||||
$.ajax({
|
||||
url: "{:url('home/check/delete')}",
|
||||
type: 'post',
|
||||
data: {
|
||||
id: obj.data.id
|
||||
},
|
||||
success: function (res) {
|
||||
layer.msg(res.msg);
|
||||
if (res.code == 0) {
|
||||
obj.del();
|
||||
}
|
||||
}
|
||||
})
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{include file="common/layui" base="base" extend="[]" callback="init" /}
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -12,9 +12,9 @@
|
||||
<td class="layui-td-gray2">上级部门<font>*</font></td>
|
||||
<td>
|
||||
<select name="pid" lay-verify="required" lay-reqText="请选择上级部门">
|
||||
<option value="0">作为顶级部门</option>
|
||||
<option value="">作为顶级部门</option>
|
||||
{volist name="department" id="v"}
|
||||
<option value="{$v.id}" {eq name="pid" value="$v.id" }selected {/eq}>{$v.title}</option>
|
||||
<option value="{$v.id}">{$v.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
@ -34,7 +34,7 @@
|
||||
<td class="layui-td-gray2">上级部门<font>*</font></td>
|
||||
<td>
|
||||
<select name="pid" lay-verify="required" lay-reqText="请选择上级部门">
|
||||
<option value="0">作为顶级部门</option>
|
||||
<option value="">作为顶级部门</option>
|
||||
{volist name="department" id="v"}
|
||||
<option value="{$v.id}" {eq name="detail.pid" value="$v.id"} selected{/eq}>{$v.title}</option>
|
||||
{/volist}
|
||||
|
@ -64,7 +64,7 @@
|
||||
if(obj.event === 'disable'){
|
||||
layer.confirm('确定要禁用该类别吗?', {icon: 3, title:'提示'}, function(index){
|
||||
$.ajax({
|
||||
url: "{:url('home/expense/cate_post_submit')}",
|
||||
url: "{:url('home/expense/cate_add')}",
|
||||
type: 'post',
|
||||
data: {
|
||||
id: obj.data.id,
|
||||
@ -84,7 +84,7 @@
|
||||
if(obj.event === 'open'){
|
||||
layer.confirm('确定要启用该类别吗?', {icon: 3, title:'提示'}, function(index){
|
||||
$.ajax({
|
||||
url: "{:url('home/expense/cate_post_submit')}",
|
||||
url: "{:url('home/expense/cate_add')}",
|
||||
type: 'post',
|
||||
data: {
|
||||
id: obj.data.id,
|
||||
@ -120,7 +120,7 @@
|
||||
var value = layero.find(".layui-layer-input").val();
|
||||
if (value) {
|
||||
$.ajax({
|
||||
url: "{:url('home/expense/cate_post_submit')}",
|
||||
url: "{:url('home/expense/cate_add')}",
|
||||
type: 'post',
|
||||
data: {
|
||||
id: id,
|
||||
|
279
app/home/view/invoice/add.html
Normal file
279
app/home/view/invoice/add.html
Normal file
@ -0,0 +1,279 @@
|
||||
{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>
|
||||
<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>报销信息</h3>
|
||||
{if condition="($id == 0)"}
|
||||
<table class="layui-table">
|
||||
<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-gray2">报销人<span style="color: red">*</span></td>
|
||||
<td>
|
||||
<input type="text" name="name" placeholder="请选择报销人" readonly class="layui-input" lay-verify="required" lay-reqText="请选择报销人" value="{$user.name}" readonly>
|
||||
<input type="hidden" name="uid" autocomplete="off" class="layui-input" value="{$user.id}">
|
||||
</td>
|
||||
<td class="layui-td-gray">报销部门</td>
|
||||
<td>
|
||||
<input type="text" name="department" readonly class="layui-input" value="{$user.department}" readonly>
|
||||
<input type="hidden" name="did" autocomplete="off" class="layui-input" value="{$user.did}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray2">费用金额<span style="color: red">*</span><button class="layui-btn layui-btn-normal layui-btn-sm" type="button" id="addInterfix">+报销选项</button></td>
|
||||
<td colspan="5">
|
||||
<div>
|
||||
<table id="interfix" class="layui-table layui-table-min">
|
||||
<tr>
|
||||
<th width="200">报销金额</th>
|
||||
<th width="300">报销项目</th>
|
||||
<th>备注信息</th>
|
||||
<th width="100">操作</th>
|
||||
</tr>
|
||||
<tr class="more_interfix">
|
||||
<td><input type="text" name="amount[]" value="" class="layui-input" lay-verify="required|number" lay-reqText="请完善报销金额"></td>
|
||||
<td style="text-align:left">
|
||||
<select name="cate_id[]" lay-verify="required" lay-reqText="请选择报销项目">
|
||||
<option value="">请选择</option>
|
||||
{volist name="$expense_cate" id="vo"}
|
||||
<option value="{$vo.id}">{$vo.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
<td><input type="text" name="remarks[]" class="layui-input" value=""><input type="hidden" name="expense_id[]" class="layui-input" value="0"></td>
|
||||
<td><a class="layui-btn layui-btn-danger layui-btn-xs" data-id="0" lay-event="del">删除</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{else/}
|
||||
<table class="layui-table">
|
||||
<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-gray2">报销人<span style="color: red">*</span></td>
|
||||
<td>
|
||||
<input type="text" name="name" placeholder="请选择报销人" readonly class="layui-input" lay-verify="required" lay-reqText="请选择报销人" value="{$expense.user_name}" readonly>
|
||||
<input type="hidden" name="uid" autocomplete="off" class="layui-input" value="{$expense.uid}">
|
||||
</td>
|
||||
<td class="layui-td-gray">报销部门</td>
|
||||
<td>
|
||||
<input type="text" name="department" readonly class="layui-input" value="{$expense.department}" readonly>
|
||||
<input type="hidden" name="did" autocomplete="off" class="layui-input" value="{$expense.did}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray2">费用金额<span style="color: red">*</span><button class="layui-btn layui-btn-normal layui-btn-sm" type="button" id="addInterfix">+报销选项</button></td>
|
||||
<td colspan="5">
|
||||
<div>
|
||||
<table id="interfix" class="layui-table layui-table-min">
|
||||
<tr>
|
||||
<th width="200">报销金额</th>
|
||||
<th width="300">报销类别</th>
|
||||
<th>备注信息</th>
|
||||
<th width="100">操作</th>
|
||||
</tr>
|
||||
{volist name="$expense.list" id="val"}
|
||||
<tr class="more_interfix">
|
||||
<td><input type="text" name="amount[]" value="{$val.amount}" class="layui-input" lay-verify="required|number" lay-reqText="请完善报销金额"></td>
|
||||
<td style="text-align:left">
|
||||
<select name="cate_id[]" lay-verify="required" lay-reqText="请选择报销项目">
|
||||
<option value="">请选择</option>
|
||||
{volist name="$expense_cate" id="vo"}
|
||||
<option value="{$vo.id}" {eq name="$vo.id" value="$val.cate_id"} selected{/eq}>{$vo.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
<td><input type="text" name="remarks[]" class="layui-input" value="{$val.remarks}"><input type="hidden" name="expense_id[]" class="layui-input" value="{$val.id}"></td>
|
||||
<td><a class="layui-btn layui-btn-danger layui-btn-xs" data-id="{$val.id}" lay-event="del">删除</a></td>
|
||||
</tr>
|
||||
{/volist}
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{/if}
|
||||
|
||||
<div class="layui-form-item" style="padding-top:10px;">
|
||||
<input name="id" id="id" type="hidden" value="{$id}">
|
||||
<button class="layui-btn" lay-submit="" lay-filter="webform">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
<div id="selectTem" style="display:none;">
|
||||
<select name="cate_id[]" lay-verify="required" lay-reqText="请选择报销项目">
|
||||
<option value="">请选择</option>
|
||||
{volist name="$expense_cate" id="vo"}
|
||||
<option value="{$vo.id}">{$vo.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
function init(layui){
|
||||
var form = layui.form
|
||||
,layer = layui.layer
|
||||
,table = layui.table
|
||||
,employeepicker = layui.employeepicker//很重要
|
||||
,laydate = layui.laydate;
|
||||
|
||||
laydate.render({
|
||||
elem: '#income_month',
|
||||
type:'month',
|
||||
showBottom: false
|
||||
});
|
||||
|
||||
laydate.render({
|
||||
elem: '#expense_time',
|
||||
max:0,
|
||||
showBottom: false
|
||||
});
|
||||
|
||||
// 选择员工
|
||||
$('.body-content').on('click','[name="name"]',function(){
|
||||
var that = $(this);
|
||||
var names = that.val(), ids = $('[name="uid"]').val();
|
||||
employeepicker.init({
|
||||
ids: ids,
|
||||
names: names,
|
||||
type: 0,
|
||||
department_url:"{:url('/home/api/get_department_tree')}",
|
||||
employee_url:"{:url('/home/api/get_employee')}",
|
||||
callback: function (ids, names, dids, departments) {
|
||||
$('[name="uid"]').val(ids);
|
||||
$('[name="did"]').val(dids);
|
||||
$('[name="department"]').val(departments);
|
||||
that.val(names);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function(data){
|
||||
var interfix = $('.more_interfix');
|
||||
if(interfix.length <1 ){
|
||||
layer.msg('至少要保留一个报销选项');
|
||||
return false;
|
||||
}
|
||||
$.ajax({
|
||||
url:"{:url('/home/expense/post_submit')}",
|
||||
type:'post',
|
||||
data:data.field,
|
||||
success:function(e){
|
||||
layer.msg(e.msg);
|
||||
if(e.code==0){
|
||||
parent.location.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
|
||||
//添加报销信息表格
|
||||
$('#addInterfix').on('click',function(){
|
||||
var html = '';
|
||||
var selectTem=$('#selectTem').html();
|
||||
html += '<tr class="more_interfix">\
|
||||
<td><input type="text" name="amount[]" class="layui-input" lay-verify="required|number" lay-reqText="请完善报销金额"></td>\
|
||||
<td style="text-align:left">'+selectTem+'</td>\
|
||||
<td><input type="text" name="remarks[]" class="layui-input"><input type="hidden" name="expense_id[]" class="layui-input" value="0"></td>\
|
||||
<td><a class="layui-btn layui-btn-danger layui-btn-xs" data-id="0" lay-event="del">删除</a></td>\
|
||||
</tr>';
|
||||
$("#interfix").append(html).find('.tr-none').remove();
|
||||
form.render();
|
||||
});
|
||||
|
||||
$('#interfix').on('click', '[lay-event="del"]', function() {
|
||||
if($('.more_interfix').length<2){
|
||||
layer.msg('至少保留一个报销选项');
|
||||
return false;
|
||||
}
|
||||
var that=$(this);
|
||||
var _id = that.data('id');
|
||||
if(_id>0){
|
||||
layer.confirm('确定删除该报销数据项?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function(index) {
|
||||
$.ajax({
|
||||
url: "{:url('home/api/del_expense_interfix')}",
|
||||
data: {
|
||||
id: _id
|
||||
},
|
||||
success: function(res) {
|
||||
layer.msg(res.msg);
|
||||
if (res.code == 0) {
|
||||
that.parents(".more_interfix").remove();
|
||||
}
|
||||
}
|
||||
})
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
else{
|
||||
that.parents(".more_interfix").remove();
|
||||
}
|
||||
});
|
||||
|
||||
//报销成员修改
|
||||
$('[name="nickname"]').on('click',function() {
|
||||
var that=$(this);
|
||||
var ids=that.next().val(),names=that.val();
|
||||
employeepicker.init({
|
||||
ids:ids,
|
||||
names:names,
|
||||
type:0,
|
||||
callback:function(ids,names,dids,departments){
|
||||
that.val(names);
|
||||
that.next().val(ids);
|
||||
$('[name="department"]').val(departments);
|
||||
$('[name="did"]').val(dids);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
{include file="common/layui" base='base' extend="['employeepicker']" callback="init" /}
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
175
app/home/view/invoice/check.html
Normal file
175
app/home/view/invoice/check.html
Normal file
@ -0,0 +1,175 @@
|
||||
{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>报销详情</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:#393D49">报销审核中</span>
|
||||
{elseif condition="$expense.check_status == 2"}
|
||||
<span style="color:#5FB878">审核通过</span>
|
||||
{elseif condition="$expense.check_status == 3"}
|
||||
<span style="color:#009688">已打款</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{if condition="$expense.check_admin_id > 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>
|
||||
{/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>
|
||||
</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}
|
||||
{eq name="$expense.check_status" value="1"}
|
||||
<button class="layui-btn layui-btn-danger" lay-event="checkno">审核不通过</button>
|
||||
<button class="layui-btn" lay-event="checkok">审核通过</button>
|
||||
{/eq}
|
||||
{eq name="$expense.check_status" value="2"}
|
||||
<button class="layui-btn" lay-event="payed">已打款确认</button>
|
||||
{/eq}
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
function init(layui) {
|
||||
//监听返回
|
||||
$('.body-content').on('click', '[lay-event="back"]', function () {
|
||||
window.location.href="{:url('home/expense/index')}";
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.body-content').on('click', '[lay-event="checkok"]', function () {
|
||||
var id=$('#id').val();
|
||||
layer.confirm('确定审核通过该报销申请?', {icon: 3, title:'提示'}, function(index){
|
||||
$.ajax({
|
||||
url:"{:url('home/expense/check')}",
|
||||
data:{id:id,check_status:2},
|
||||
success:function(res){
|
||||
layer.msg(res.msg);
|
||||
if(res.code==0){
|
||||
window.setTimeout(function(){
|
||||
window.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:"{:url('home/expense/check')}",
|
||||
data:{id:id,check_status:0,check_remark:text},
|
||||
success:function(res){
|
||||
layer.msg(res.msg);
|
||||
if(res.code==0){
|
||||
window.setTimeout(function(){
|
||||
parent.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:"{:url('home/expense/check')}",
|
||||
data:{id:id,check_status:3},
|
||||
success:function(res){
|
||||
layer.msg(res.msg);
|
||||
if(res.code==0){
|
||||
window.setTimeout(function(){
|
||||
parent.location.reload();
|
||||
},1200)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
{include file="common/layui" base='base' extend="[]" callback="init" /}
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
156
app/home/view/invoice/index.html
Normal file
156
app/home/view/invoice/index.html
Normal file
@ -0,0 +1,156 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<div class="body-content">
|
||||
<table class="layui-hide" id="test" lay-filter="test"></table>
|
||||
</div>
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group"><span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详情</span><span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</span></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: "{:url('home/expense/index')}", //数据接口
|
||||
page: true, //开启分页
|
||||
limit: 20,
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID号',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'amount',
|
||||
title: '报销总金额(元)',
|
||||
align: 'right',
|
||||
width: 120,
|
||||
},{
|
||||
field: 'user_name',
|
||||
title: '报销人',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},{
|
||||
field: 'department',
|
||||
title: '报销部门',
|
||||
align: 'center',
|
||||
width: 120
|
||||
},{
|
||||
field: 'code',
|
||||
title: '报销凭证编号',
|
||||
width: 150,
|
||||
},{
|
||||
field: 'expense_time',
|
||||
title: '原始单据日期',
|
||||
align: 'center',
|
||||
width: 110
|
||||
},{
|
||||
field: 'income_month',
|
||||
title: '入账月份',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},{
|
||||
field: 'admin_name',
|
||||
title: '登记人',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},{
|
||||
field: 'create_time',
|
||||
title: '录入时间',
|
||||
align: 'center',
|
||||
width: 150
|
||||
},{
|
||||
field: '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:#393D49">报销审核中</span>';
|
||||
}
|
||||
else if(d.check_status==2){
|
||||
html='<span style="color:#5FB878">审核通过</span>';
|
||||
}
|
||||
else if(d.check_status==3){
|
||||
html='<span style="color:#009688">已打款</span>';
|
||||
}
|
||||
return html;
|
||||
}
|
||||
},{
|
||||
field: 'check_name',
|
||||
title: '审核人',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},{
|
||||
field: 'check_time',
|
||||
title: '审核时间',
|
||||
align: 'center',
|
||||
width: 136
|
||||
},{
|
||||
field: 'pay_name',
|
||||
title: '打款确认人',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},{
|
||||
field: 'pay_time',
|
||||
title: '打款确认时间',
|
||||
align: 'center',
|
||||
width: 136
|
||||
}, {
|
||||
field: 'right',
|
||||
fixed: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
width: 100,
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//监听行工具事件
|
||||
table.on('tool(test)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'view') {
|
||||
rightpage.open("/home/expense/check?id="+data.id);
|
||||
return;
|
||||
}
|
||||
if (obj.event === 'del') {
|
||||
layer.confirm('确定删除该报销记录吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function(index) {
|
||||
$.ajax({
|
||||
url: "{:url('home/expense/delete')}",
|
||||
data: {
|
||||
id: data.id
|
||||
},
|
||||
success: function(res) {
|
||||
layer.msg(res.msg);
|
||||
if (res.code == 0) {
|
||||
obj.del();
|
||||
}
|
||||
}
|
||||
})
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{include file="common/layui" base='base' extend="['rightpage']" use="['table','form']" callback="init" /}
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
161
app/home/view/invoice/list.html
Normal file
161
app/home/view/invoice/list.html
Normal file
@ -0,0 +1,161 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<div class="body-content">
|
||||
<table class="layui-hide" id="test" lay-filter="test"></table>
|
||||
</div>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
<a class="layui-btn layui-btn-normal layui-btn-sm" href="{:url('home/expense/add')}">添加报销登记</a>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group"><span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详情</span><span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</span></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: "{:url('home/expense/index')}", //数据接口
|
||||
page: true, //开启分页
|
||||
limit: 20,
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID号',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'amount',
|
||||
title: '报销总金额(元)',
|
||||
align: 'right',
|
||||
width: 120,
|
||||
},{
|
||||
field: 'user_name',
|
||||
title: '报销人',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},{
|
||||
field: 'department',
|
||||
title: '报销部门',
|
||||
align: 'center',
|
||||
width: 120
|
||||
},{
|
||||
field: 'code',
|
||||
title: '报销凭证编号',
|
||||
width: 150,
|
||||
},{
|
||||
field: 'expense_time',
|
||||
title: '原始单据日期',
|
||||
align: 'center',
|
||||
width: 110
|
||||
},{
|
||||
field: 'income_month',
|
||||
title: '入账月份',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},{
|
||||
field: 'admin_name',
|
||||
title: '登记人',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},{
|
||||
field: 'create_time',
|
||||
title: '录入时间',
|
||||
align: 'center',
|
||||
width: 150
|
||||
},{
|
||||
field: '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:#393D49">报销审核中</span>';
|
||||
}
|
||||
else if(d.check_status==2){
|
||||
html='<span style="color:#5FB878">审核通过</span>';
|
||||
}
|
||||
else if(d.check_status==3){
|
||||
html='<span style="color:#009688">已打款</span>';
|
||||
}
|
||||
return html;
|
||||
}
|
||||
},{
|
||||
field: 'check_name',
|
||||
title: '审核人',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},{
|
||||
field: 'check_time',
|
||||
title: '审核时间',
|
||||
align: 'center',
|
||||
width: 136
|
||||
},{
|
||||
field: 'pay_name',
|
||||
title: '打款确认人',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},{
|
||||
field: 'pay_time',
|
||||
title: '打款确认时间',
|
||||
align: 'center',
|
||||
width: 136
|
||||
}, {
|
||||
field: 'right',
|
||||
fixed: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
width: 100,
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//监听行工具事件
|
||||
table.on('tool(test)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'view') {
|
||||
rightpage.open("/home/expense/check?id="+data.id);
|
||||
return;
|
||||
}
|
||||
if (obj.event === 'del') {
|
||||
layer.confirm('确定删除该报销记录吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function(index) {
|
||||
$.ajax({
|
||||
url: "{:url('home/expense/delete')}",
|
||||
data: {
|
||||
id: data.id
|
||||
},
|
||||
success: function(res) {
|
||||
layer.msg(res.msg);
|
||||
if (res.code == 0) {
|
||||
obj.del();
|
||||
}
|
||||
}
|
||||
})
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{include file="common/layui" base='base' extend="['rightpage']" use="['table','form']" callback="init" /}
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
146
app/home/view/invoice/subject.html
Normal file
146
app/home/view/invoice/subject.html
Normal file
@ -0,0 +1,146 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<div class="body-content">
|
||||
<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,
|
||||
form = layui.form,
|
||||
layer=layui.layer;
|
||||
|
||||
var tableIns = table.render({
|
||||
elem: '#test'
|
||||
,toolbar: '#toolbarDemo'
|
||||
,title:'报销类别列表'
|
||||
,url:"{:url('home/invoice/subject')}"
|
||||
,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: "{:url('home/invoice/subject_add')}",
|
||||
type: 'post',
|
||||
data: {
|
||||
id: obj.data.id,
|
||||
status: 0,
|
||||
title: obj.data.title,
|
||||
},
|
||||
success: function(e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
setTimeout('location.reload()', 1000);
|
||||
}
|
||||
}
|
||||
})
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
if(obj.event === 'open'){
|
||||
layer.confirm('确定要启用该发票主体吗?', {icon: 3, title:'提示'}, function(index){
|
||||
$.ajax({
|
||||
url: "{:url('home/invoice/subject_add')}",
|
||||
type: 'post',
|
||||
data: {
|
||||
id: obj.data.id,
|
||||
status: 1,
|
||||
title: obj.data.title,
|
||||
},
|
||||
success: function(e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
setTimeout('location.reload()', 1000);
|
||||
}
|
||||
}
|
||||
})
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('.body-content').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: "{:url('home/invoice/subject_add')}",
|
||||
type: 'post',
|
||||
data: {
|
||||
id: id,
|
||||
title: value,
|
||||
},
|
||||
success: function(e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
setTimeout('location.reload()', 1000);
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
layer.msg('请填写发票主体名称');
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{include file="common/layui" base='base' extend="[]" callback="init" /}
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
100
app/home/view/invoice/view.html
Normal file
100
app/home/view/invoice/view.html
Normal file
@ -0,0 +1,100 @@
|
||||
{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>报销详情</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:#393D49">报销审核中</span>
|
||||
{elseif condition="$expense.check_status == 2"}
|
||||
<span style="color:#5FB878">审核通过</span>
|
||||
{elseif condition="$expense.check_status == 3"}
|
||||
<span style="color:#009688">已打款</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{if condition="$expense.check_admin_id > 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>
|
||||
{/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>
|
||||
</table>
|
||||
{if condition="($expense.check_status == 0) AND ($uid == $expense.admin_id)"}
|
||||
<div class="layui-form-item" style="padding-top:10px;">
|
||||
<a class="layui-btn" href="/home/expense/add?id={$expense.id}">编辑</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
function init(layui) {
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
{include file="common/layui" base='base' extend="[]" callback="init" /}
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -4,23 +4,15 @@
|
||||
<form class="layui-form body-content">
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray2">关键字名称<font>*</font>
|
||||
<td class="layui-td-gray">关键字名称<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="title" lay-verify="required" lay-reqText="请输入关键字名称" autocomplete="off" placeholder="请输入关键字名称" class="layui-input" {notempty name="$keywords.title"} value="{$keywords.title}" {/notempty}>
|
||||
</td>
|
||||
<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>
|
||||
<td class="layui-td-gray">状态<font>*</font></td>
|
||||
<td>
|
||||
<input type="hidden" name="id" value="{$id}" />
|
||||
<input type="text" name="title" lay-verify="required" lay-reqText="请输入关键字名称" autocomplete="off" placeholder="请输入关键字名称"
|
||||
class="layui-input" style="max-width: 360px;" {notempty name="$keywords.title"}
|
||||
value="{$keywords.title}" {/notempty}>
|
||||
</td>
|
||||
<td class="layui-td-gray2">排序</td>
|
||||
<td><input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input"
|
||||
style="max-width: 360px;" {notempty name="$keywords.sort" }value="{$keywords.sort}" {/notempty}>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray2">状态<font>*</font>
|
||||
</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="禁用">
|
||||
@ -34,6 +26,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
<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>
|
||||
<button lay-event="back" class="layui-btn layui-btn-primary">返回</button>
|
||||
@ -52,7 +45,7 @@
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
$.ajax({
|
||||
url: "{:url('home/keywords/post_submit')}",
|
||||
url: "{:url('home/keywords/add')}",
|
||||
type: 'post',
|
||||
data: data.field,
|
||||
success: function (e) {
|
||||
|
85
app/home/view/schedule/cate.html
Normal file
85
app/home/view/schedule/cate.html
Normal file
@ -0,0 +1,85 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<div class="body-content">
|
||||
<table class="layui-hide" id="test" lay-filter="test"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="status">
|
||||
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
|
||||
</script>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
<a class="layui-btn layui-btn-normal layui-btn-sm" href="{:url('home/schedule/cate_add')}">+ 添加工作类型</a>
|
||||
</div>
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
function init(layui) {
|
||||
var table = layui.table,
|
||||
form = layui.form;
|
||||
|
||||
var tableIns = table.render({
|
||||
elem: '#test',
|
||||
title: '工作类型列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: "{:url('home/schedule/cate')}",
|
||||
page: true, //开启分页
|
||||
limit: 20,
|
||||
cols: [
|
||||
[{field: 'id',width: 80,title: 'ID编号',align: 'center'}
|
||||
, { field: 'name', width: 180, title: '工作类型名称'}
|
||||
, { field: 'department',width: 300,title: '关联部门'}
|
||||
, { field: 'remark', title: '备注'}
|
||||
, {
|
||||
field: 'status',
|
||||
width: 80,
|
||||
title: '状态',
|
||||
templet: '#status',
|
||||
align: 'center'
|
||||
},
|
||||
, {width: 100, title: '操作', align: 'center'
|
||||
, templet: function (d) {
|
||||
var html = '<div class="layui-btn-group">';
|
||||
html+='<a class="layui-btn layui-btn-xs" href="/home/schedule/cate_add?id='+d.id+'">编辑</a>';
|
||||
html+= '<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>';
|
||||
html+= '</div>';
|
||||
return html;
|
||||
}
|
||||
}]
|
||||
]
|
||||
});
|
||||
|
||||
//删除
|
||||
table.on('tool(test)', function (obj) {
|
||||
if (obj.event === 'del') {
|
||||
layer.confirm('确定要删除吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function (index) {
|
||||
$.ajax({
|
||||
url: "{:url('home/schedule/cate_delete')}",
|
||||
type: 'post',
|
||||
data: {
|
||||
id: obj.data.id
|
||||
},
|
||||
success: function (res) {
|
||||
layer.msg(res.msg);
|
||||
if (res.code == 0) {
|
||||
obj.del();
|
||||
}
|
||||
}
|
||||
})
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{include file="common/layui" base="base" extend="[]" callback="init" /}
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
107
app/home/view/schedule/cate_add.html
Normal file
107
app/home/view/schedule/cate_add.html
Normal file
@ -0,0 +1,107 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form body-content">
|
||||
{if condition="$id eq 0"}
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray2">工作类型名称<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="title" autocomplete="off" placeholder="请输入工作类型名称" lay-verify="required" lay-reqText="请输入工作类型名称" class="layui-input" value="">
|
||||
</td>
|
||||
<td class="layui-td-gray2">关联部门<font>*</font></td>
|
||||
<td>
|
||||
<select name="pid" lay-verify="required" lay-reqText="请选择部门">
|
||||
<option value="">请选择</option>
|
||||
{volist name="department" id="v"}
|
||||
<option value="{$v.id}" {eq name="pid" value="$v.id" }selected {/eq}>{$v.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
<td class="layui-td-gray2">状态<font>*</font></td>
|
||||
<td>
|
||||
<input type="radio" name="status" value="1" title="正常" checked>
|
||||
<input type="radio" name="status" value="0" title="禁用">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray2" style="vertical-align: top;">备注信息</td>
|
||||
<td colspan="5">
|
||||
<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>
|
||||
<input type="text" name="title" autocomplete="off" placeholder="请输入工作类型名称" lay-verify="required" lay-reqText="请输入工作类型名称" class="layui-input" value="{$detail.title}">
|
||||
</td>
|
||||
<td class="layui-td-gray2">关联部门<font>*</font></td>
|
||||
<td>
|
||||
<select name="type" lay-verify="required" lay-reqText="请选择部门">
|
||||
<option value="">请选择</option>
|
||||
<option value="{$v.id}" {eq name="detail.did" value="$v.id"} selected{/eq}>{$v.title}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="layui-td-gray2">状态<font>*</font></td>
|
||||
<td>
|
||||
<input type="radio" name="status" value="1" title="正常" {eq name="$detail.status" value="1"}checked{/eq}>
|
||||
<input type="radio" name="status" value="0" title="禁用" {eq name="$detail.status" value="0"}checked{/eq}>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray2" style="vertical-align: top;">备注信息</td>
|
||||
<td colspan="5">
|
||||
<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>
|
||||
<button lay-event="back" 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: "{:url('home/schedule/cate_add')}",
|
||||
type: 'post',
|
||||
data: data.field,
|
||||
success: function (e) {
|
||||
if (e.code == 0) {
|
||||
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
|
||||
window.location.href="{:url('home/conf/index')}";
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
//监听返回
|
||||
$('.body-content').on('click', '[lay-event="back"]', function () {
|
||||
history.back(-1);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
{include file="common/layui" base="base" extend="[]" callback="init" /}
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,100 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<div class="body-content">
|
||||
<form class="layui-form">
|
||||
<div class="layui-input-inline" style="width:300px;">
|
||||
<input type="text" name="keywords" placeholder="关键字名称" class="layui-input" autocomplete="off" />
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
|
||||
</form>
|
||||
<table class="layui-hide" id="test" lay-filter="test"></table>
|
||||
</div>
|
||||
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
function init(layui) {
|
||||
var table = layui.table,
|
||||
form = layui.form;
|
||||
|
||||
var tableIns = table.render({
|
||||
elem: '#test',
|
||||
title: '关键字搜索列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: "{:url('home/search/index')}",
|
||||
page: true, //开启分页
|
||||
limit: 20,
|
||||
cols: [
|
||||
[{
|
||||
field: 'id',
|
||||
width: 90,
|
||||
title: 'ID号',
|
||||
align: 'center'
|
||||
}, {
|
||||
field: 'title',
|
||||
title: '关键字名称'
|
||||
}, {
|
||||
field: 'times',
|
||||
width: 100,
|
||||
title: '搜索次数',
|
||||
align: 'center'
|
||||
}, {
|
||||
width: 80,
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
templet: function (d) {
|
||||
var html = '';
|
||||
var delBtn = '<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>';
|
||||
return delBtn;
|
||||
}
|
||||
}]
|
||||
]
|
||||
});
|
||||
|
||||
//监听搜索提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
tableIns.reload({
|
||||
where: {
|
||||
keywords: data.field.keywords
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
//删除
|
||||
table.on('tool(test)', function (obj) {
|
||||
if (obj.event === 'del') {
|
||||
layer.confirm('确定要删除吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function (index) {
|
||||
$.ajax({
|
||||
url: "{:url('home/search/delete')}",
|
||||
type: 'post',
|
||||
data: {
|
||||
id: obj.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="[]" callback="init" /}
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -134,7 +134,7 @@ INSERT INTO `oa_admin_menu` VALUES (17, 2, '审核人相关配置', 'home/check/
|
||||
INSERT INTO `oa_admin_menu` VALUES (18, 2, '工作类型设置', 'home/schedule/cate', '', 1, 0, 0);
|
||||
INSERT INTO `oa_admin_menu` VALUES (19, 2, '知识关键字设置', 'home/keywords/index', '', 1, 0, 0);
|
||||
INSERT INTO `oa_admin_menu` VALUES (20, 2, '报销类型设置', 'home/expense/cate', '', 1, 0, 0);
|
||||
INSERT INTO `oa_admin_menu` VALUES (21, 2, '发票主体设置', 'home/invoice/server', '', 1, 0, 0);
|
||||
INSERT INTO `oa_admin_menu` VALUES (21, 2, '发票主体设置', 'home/invoice/subject', '', 1, 0, 0);
|
||||
|
||||
INSERT INTO `oa_admin_menu` VALUES (22, 3, '部门架构', 'home/department/index', '', 1, 0, 0);
|
||||
INSERT INTO `oa_admin_menu` VALUES (23, 3, '岗位职称', 'home/position/index', '', 1, 0, 0);
|
||||
@ -241,10 +241,10 @@ INSERT INTO `oa_admin_rule` VALUES (43, 42, 'home/expense/cate_add', '新增/编
|
||||
INSERT INTO `oa_admin_rule` VALUES (44, 42, 'home/expense/cate_disable', '禁用报销类型','报销类型', 0, 0);
|
||||
INSERT INTO `oa_admin_rule` VALUES (45, 42, 'home/expense/cate_delete', '删除报销类型','报销类型', 0, 0);
|
||||
|
||||
INSERT INTO `oa_admin_rule` VALUES (46, 2, 'home/invoice/server', '发票主体设置','发票主体', 0, 0);
|
||||
INSERT INTO `oa_admin_rule` VALUES (47, 46, 'home/invoice/server_add', '新增/编辑发票主体','发票主体', 0, 0);
|
||||
INSERT INTO `oa_admin_rule` VALUES (48, 46, 'home/invoice/server_disable', '禁用发票主体','发票主体', 0, 0);
|
||||
INSERT INTO `oa_admin_rule` VALUES (49, 46, 'home/invoice/server_delete', '删除发票主体','发票主体', 0, 0);
|
||||
INSERT INTO `oa_admin_rule` VALUES (46, 2, 'home/invoice/subject', '发票主体设置','发票主体', 0, 0);
|
||||
INSERT INTO `oa_admin_rule` VALUES (47, 46, 'home/invoice/subject_add', '新增/编辑发票主体','发票主体', 0, 0);
|
||||
INSERT INTO `oa_admin_rule` VALUES (48, 46, 'home/invoice/subject_disable', '禁用发票主体','发票主体', 0, 0);
|
||||
INSERT INTO `oa_admin_rule` VALUES (49, 46, 'home/invoice/subject_delete', '删除发票主体','发票主体', 0, 0);
|
||||
|
||||
INSERT INTO `oa_admin_rule` VALUES (50, 3, 'home/department/index', '部门架构','部门', 0, 0);
|
||||
INSERT INTO `oa_admin_rule` VALUES (51, 50, 'home/department/add', '添加/编辑部门信息','部门', 0, 0);
|
||||
@ -421,7 +421,7 @@ CREATE TABLE `oa_check` (
|
||||
`create_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
|
||||
`update_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '审核人配置';
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '审核人配置表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of oa_check
|
||||
@ -766,6 +766,22 @@ CREATE TABLE `oa_schedule` (
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '工作记录';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for oa_schedule_cate
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `oa_schedule_cate`;
|
||||
CREATE TABLE `oa_schedule_cate` (
|
||||
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(100) NOT NULL DEFAULT '' COMMENT '工作类型名称',
|
||||
`did` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '关联部门id',
|
||||
`service_cate_id` int(11) NOT NULL DEFAULT 0 COMMENT '预留字段:关联业务类型id',
|
||||
`remark` varchar(1000) NULL DEFAULT '' COMMENT '备注',
|
||||
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:-1删除 0禁用 1启用',
|
||||
`create_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
|
||||
`update_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '工作类型表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for oa_schedule_interfix
|
||||
-- ----------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user