first commit
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
namespace app\adm\controller;
|
||||
|
||||
use app\api\BaseController;
|
||||
use app\adm\model\Property;
|
||||
use app\adm\model\Car;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Api extends BaseController
|
||||
{
|
||||
public function get_propertycate()
|
||||
{
|
||||
$cate = get_base_data('PropertyCate');
|
||||
return to_assign(0, '', $cate);
|
||||
}
|
||||
|
||||
public function get_propertycate_tree()
|
||||
{
|
||||
$cate = get_base_data('PropertyCate');
|
||||
$list = get_tree($cate, 0, 2);
|
||||
$data['trees'] = $list;
|
||||
return json($data);
|
||||
}
|
||||
//获取资产数据
|
||||
public function get_property()
|
||||
{
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['p.title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$where[] = ['p.status', '=', 1];
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$model = new Property();
|
||||
$list = $model->datalist($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
|
||||
//获取车辆信息
|
||||
public function get_car()
|
||||
{
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['title|name', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$where[] = ['delete_time', '=', 0];
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$model = new Car();
|
||||
$list = $model->datalist($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
|
||||
//获取车辆维修信息
|
||||
public function get_car_repair()
|
||||
{
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
$where[] = ['cr.car_id','=',$param['car_id']];
|
||||
$where[] = ['cr.types','=',1];
|
||||
$where[] = ['cr.delete_time','=',0];
|
||||
$model = new Car();
|
||||
$list = $model->repairlist($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
//获取车辆保养信息
|
||||
public function get_car_protect()
|
||||
{
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
$where[] = ['cr.car_id','=',$param['car_id']];
|
||||
$where[] = ['cr.types','=',2];
|
||||
$where[] = ['cr.delete_time','=',0];
|
||||
$model = new Car();
|
||||
$list = $model->repairlist($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
|
||||
//获取车辆费用信息
|
||||
public function get_car_fee()
|
||||
{
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
$where[] = ['cf.car_id','=',$param['car_id']];
|
||||
$where[] = ['cf.delete_time','=',0];
|
||||
$model = new Car();
|
||||
$list = $model->feelist($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
|
||||
//获取车辆费用信息
|
||||
public function get_car_mileage()
|
||||
{
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
$where[] = ['car_id','=',$param['car_id']];
|
||||
$where[] = ['delete_time','=',0];
|
||||
$model = new Car();
|
||||
$list = $model->mileagelist($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
|
||||
//获取会议室
|
||||
public function get_meeting_room()
|
||||
{
|
||||
$list = Db::name('MeetingRoom')->where('status',1)->paginate(['list_rows'=> 20]);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
|
||||
//获取审核类型
|
||||
public function get_flow_item()
|
||||
{
|
||||
$param = get_params();
|
||||
$flows = Db::name('FlowItem')->where(['flow_cate'=>$param['cate'],'status'=>1])->select()->toArray();
|
||||
return to_assign(0, '', $flows);
|
||||
}
|
||||
|
||||
//修改公章状态
|
||||
public function set_seal_status()
|
||||
{
|
||||
$param = get_params();
|
||||
$res = Db::name('Seal')->where(['id'=>$param['id']])->update(['status'=>$param['status']]);
|
||||
if($res!==false){
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(1, '操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
//测试demo
|
||||
public function work_flow()
|
||||
{
|
||||
return view('/flow/work_flow');
|
||||
}
|
||||
|
||||
public function table()
|
||||
{
|
||||
$param = get_params();
|
||||
$prefix = config('database.connections.mysql.prefix');
|
||||
//查询指定表信息
|
||||
$table_info = Db::query('SHOW TABLE STATUS LIKE ' . "'" .$prefix.$param['name'] . "'");
|
||||
if(empty($table_info)){
|
||||
return view(EEEOR_REPORTING,['code'=>406,'warning'=>'找不到该数据表']);
|
||||
}
|
||||
$table_columns = Db::query("SHOW FULL COLUMNS FROM " .$prefix.$param['name']);
|
||||
$columns=[];
|
||||
foreach($table_columns as $key=>$val) {
|
||||
if (strpos($val['Type'], 'int') !== false || strpos($val['Type'], 'decimal') !== false) {
|
||||
$columns[]=$val;
|
||||
}
|
||||
}
|
||||
//var_dump($table_info);exit;
|
||||
//dd($table_columns);exit;
|
||||
View::assign('id', 0);
|
||||
View::assign('columns', $columns);
|
||||
return view('/flow/table');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\adm\controller;
|
||||
|
||||
use app\base\BaseController;
|
||||
use app\adm\validate\BasicAdmCheck;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Basic extends BaseController
|
||||
{
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where=[];
|
||||
if (!empty($param['types'])) {
|
||||
$where[] = ['types', '=', $param['types']];
|
||||
}
|
||||
$list = Db::name('BasicAdm')->where($where)->order('create_time asc')->select();
|
||||
return to_assign(0, '', $list);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
//新建编辑
|
||||
public function add()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(BasicAdmCheck::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('BasicAdm')->strict(false)->field('title,types,id,update_time')->update($param);
|
||||
if ($res) {
|
||||
add_log('edit', $param['id'], $param);
|
||||
}
|
||||
return to_assign();
|
||||
} else {
|
||||
try {
|
||||
validate(BasicAdmCheck::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['create_time'] = time();
|
||||
$insertId = Db::name('BasicAdm')->strict(false)->field('title,types,id,create_time')->insertGetId($param);
|
||||
if ($insertId) {
|
||||
add_log('add', $insertId, $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//设置
|
||||
public function set()
|
||||
{
|
||||
$param = get_params();
|
||||
$res = Db::name('BasicAdm')->strict(false)->field('id,status')->update($param);
|
||||
if ($res) {
|
||||
if($param['status'] == 0){
|
||||
add_log('disable', $param['id'], $param);
|
||||
}
|
||||
else if($param['status'] == 1){
|
||||
add_log('recovery', $param['id'], $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,501 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\adm\controller;
|
||||
|
||||
use app\base\BaseController;
|
||||
use app\adm\model\Car as CarModel;
|
||||
use app\adm\validate\CarValidate;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Car extends BaseController
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
protected $model;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(); // 调用父类构造函数
|
||||
$this->model = new CarModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
public function datalist()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$where=[];
|
||||
$where[]=['delete_time','=',0];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['id|title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$list = $this->model->datalist($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
else{
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (isset($param['insure_time'])) {
|
||||
$param['insure_time'] = strtotime($param['insure_time']);
|
||||
}
|
||||
if (isset($param['review_time'])) {
|
||||
$param['review_time'] = strtotime($param['review_time']);
|
||||
}
|
||||
if (isset($param['buy_time'])) {
|
||||
$param['buy_time'] = strtotime($param['buy_time']);
|
||||
}
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(CarValidate::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$this->model->edit($param);
|
||||
} else {
|
||||
try {
|
||||
validate(CarValidate::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$this->model->add($param);
|
||||
}
|
||||
}else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if ($id>0) {
|
||||
$detail = $this->model->getById($id);
|
||||
if(!empty($detail['file_ids'])){
|
||||
$file_array = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['file_array'] = $file_array;
|
||||
}
|
||||
if($detail['driver']>0){
|
||||
$detail['driver_name'] = Db::name('Admin')->where('id','=',$detail['driver'])->value('name');
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
return view('edit');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function view($id)
|
||||
{
|
||||
$detail = $this->model->getById($id);
|
||||
if (!empty($detail)) {
|
||||
if(!empty($detail['file_ids'])){
|
||||
$file_array = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['file_array'] = $file_array;
|
||||
}
|
||||
if($detail['driver']>0){
|
||||
$detail['driver_name'] = Db::name('Admin')->where('id','=',$detail['driver'])->value('name');
|
||||
}
|
||||
$latestMileage = Db::name('CarMileage')->where(['car_id'=>$detail['id'],'delete_time'=>0])->max('mileage');
|
||||
if(empty($latestMileage)){
|
||||
$latestMileage = $detail['mileage'];
|
||||
}
|
||||
$detail['latestMileage'] = $latestMileage;
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
return view(EEEOR_REPORTING,['warning'=>'找不到页面']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if (request()->isDelete()) {
|
||||
$this->model->delById($id);
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
|
||||
//维修记录列表
|
||||
public function repair_list()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = [];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['c.title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
if (!empty($param['diff_time'])) {
|
||||
$diff_time =explode('~', $param['diff_time']);
|
||||
$where[] = ['cr.repair_time', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1]))]];
|
||||
}
|
||||
$where[] = ['cr.types','=',1];
|
||||
$where[] = ['cr.delete_time','=',0];
|
||||
$model = new Car();
|
||||
$list = $this->model->repairlist($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//维修记录添加&编辑
|
||||
public function repair_add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (isset($param['repair_time'])) {
|
||||
$param['repair_time'] = strtotime($param['repair_time']);
|
||||
}
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('CarRepair')->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('CarRepair')->strict(false)->field(true)->insertGetId($param);
|
||||
if ($insertId) {
|
||||
add_log('add', $insertId, $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
} else {
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$cid = isset($param['cid']) ? $param['cid'] : 0;
|
||||
if ($id > 0) {
|
||||
$detail = Db::name('CarRepair')->where(['id' => $id])->find();
|
||||
$detail['handled_name'] = Db::name('Admin')->where('id',$detail['handled'])->value('name');
|
||||
$detail['car'] = Db::name('Car')->where('id',$detail['car_id'])->value('title');
|
||||
if($detail['file_ids'] !=''){
|
||||
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['fileArray'] = $fileArray;
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
return view('repair_edit');
|
||||
}
|
||||
if($cid>0){
|
||||
View::assign('car', $this->model->getById($cid));
|
||||
}
|
||||
View::assign('cid', $cid);
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//维修记录查看
|
||||
public function repair_view()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = Db::name('CarRepair')->where(['id' => $id])->find();
|
||||
$detail['handled_name'] = Db::name('Admin')->where('id',$detail['handled'])->value('name');
|
||||
$detail['car'] = Db::name('Car')->where('id',$detail['car_id'])->value('title');
|
||||
if($detail['file_ids'] !=''){
|
||||
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['fileArray'] = $fileArray;
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
|
||||
//维修记录删除
|
||||
public function repair_del()
|
||||
{
|
||||
$param = get_params();
|
||||
$res = Db::name('CarRepair')->where('id',$param['id'])->update(['delete_time'=>time()]);
|
||||
if ($res) {
|
||||
add_log('delete', $param['id'], $param);
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//保养记录列表
|
||||
public function protect_list()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = [];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['c.title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
if (!empty($param['diff_time'])) {
|
||||
$diff_time =explode('~', $param['diff_time']);
|
||||
$where[] = ['cr.repair_time', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1]))]];
|
||||
}
|
||||
$where[] = ['cr.types','=',2];
|
||||
$where[] = ['cr.delete_time','=',0];
|
||||
$list = $this->model->repairlist($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//保养记录添加&编辑
|
||||
public function protect_add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (isset($param['repair_time'])) {
|
||||
$param['repair_time'] = strtotime($param['repair_time']);
|
||||
}
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('CarRepair')->strict(false)->field(true)->update($param);
|
||||
if($res){
|
||||
add_log('edit', $param['id'], $param);
|
||||
return to_assign();
|
||||
}
|
||||
} else {
|
||||
$param['create_time'] = time();
|
||||
$param['types'] = 2;
|
||||
$insertId = Db::name('CarRepair')->strict(false)->field(true)->insertGetId($param);
|
||||
if ($insertId) {
|
||||
add_log('add', $insertId, $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
} else {
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$cid = isset($param['cid']) ? $param['cid'] : 0;
|
||||
if ($id > 0) {
|
||||
$detail = Db::name('CarRepair')->where(['id' => $id])->find();
|
||||
$detail['handled_name'] = Db::name('Admin')->where('id',$detail['handled'])->value('name');
|
||||
$detail['car'] = Db::name('Car')->where('id',$detail['car_id'])->value('title');
|
||||
if($detail['file_ids'] !=''){
|
||||
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['fileArray'] = $fileArray;
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
return view('protect_edit');
|
||||
}
|
||||
if($cid>0){
|
||||
View::assign('car', $this->model->getById($cid));
|
||||
}
|
||||
View::assign('cid', $cid);
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//保养记录查看
|
||||
public function protect_view()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = Db::name('CarRepair')->where(['id' => $id])->find();
|
||||
$detail['handled_name'] = Db::name('Admin')->where('id',$detail['handled'])->value('name');
|
||||
$detail['car'] = Db::name('Car')->where('id',$detail['car_id'])->value('title');
|
||||
if($detail['file_ids'] !=''){
|
||||
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['fileArray'] = $fileArray;
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
|
||||
//保养记录删除
|
||||
public function protect_del()
|
||||
{
|
||||
$param = get_params();
|
||||
$res = Db::name('CarRepair')->where('id',$param['id'])->update(['delete_time'=>time()]);
|
||||
if ($res) {
|
||||
add_log('delete', $param['id'], $param);
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
//费用记录列表
|
||||
public function fee_list()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = [];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['cf.title|c.title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
if (!empty($param['diff_time'])) {
|
||||
$diff_time =explode('~', $param['diff_time']);
|
||||
$where[] = ['cf.fee_time', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1]))]];
|
||||
}
|
||||
if (!empty($param['types'])) {
|
||||
$where[] = ['cf.types','=',$param['types']];
|
||||
}
|
||||
$where[] = ['cf.delete_time','=',0];
|
||||
$list = $this->model->feelist($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//费用记录添加&编辑
|
||||
public function fee_add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (isset($param['fee_time'])) {
|
||||
$param['fee_time'] = strtotime($param['fee_time']);
|
||||
}
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('CarFee')->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('CarFee')->strict(false)->field(true)->insertGetId($param);
|
||||
if ($insertId) {
|
||||
add_log('add', $insertId, $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
} else {
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$cid = isset($param['cid']) ? $param['cid'] : 0;
|
||||
if ($id > 0) {
|
||||
$detail = Db::name('CarFee')->where(['id' => $id])->find();
|
||||
$detail['handled_name'] = Db::name('Admin')->where('id',$detail['handled'])->value('name');
|
||||
$detail['car'] = Db::name('Car')->where('id',$detail['car_id'])->value('title');
|
||||
if($detail['file_ids'] !=''){
|
||||
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['fileArray'] = $fileArray;
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
return view('fee_edit');
|
||||
}
|
||||
if($cid>0){
|
||||
View::assign('car', $this->model->getById($cid));
|
||||
}
|
||||
View::assign('cid', $cid);
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//费用记录查看
|
||||
public function fee_view()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = Db::name('CarFee')->where(['id' => $id])->find();
|
||||
$detail['handled_name'] = Db::name('Admin')->where('id',$detail['handled'])->value('name');
|
||||
$detail['car'] = Db::name('Car')->where('id',$detail['car_id'])->value('title');
|
||||
$detail['types_str'] = Db::name('basicAdm')->where('id',$detail['types'])->value('title');
|
||||
if($detail['file_ids'] !=''){
|
||||
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['fileArray'] = $fileArray;
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
|
||||
//费用记录删除
|
||||
public function fee_del()
|
||||
{
|
||||
$param = get_params();
|
||||
$res = Db::name('CarFee')->where('id',$param['id'])->update(['delete_time'=>time()]);
|
||||
if ($res) {
|
||||
add_log('delete', $param['id'], $param);
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
//获取里程数记录
|
||||
public function mileage_list()
|
||||
{
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
$where[] = ['car_id', '=', $param['car_id']];
|
||||
$where[] = ['delete_time', '=', 0];
|
||||
$this->model->mileagelist($where, $param);
|
||||
table_assign(0, '', $list);
|
||||
}
|
||||
|
||||
//增加里程数记录
|
||||
public function mileage_add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (isset($param['mileage_time'])) {
|
||||
$param['mileage_time'] = strtotime($param['mileage_time']);
|
||||
}
|
||||
$latestMileage = Db::name('CarMileage')->where([['id','<>',$param['id']],['car_id','=',$param['car_id']],['delete_time','=',0]])->order('mileage_time', 'desc')->value('mileage');
|
||||
$mileage = Db::name('Car')->where('id',$param['car_id'])->value('mileage');
|
||||
if(empty($latestMileage)){
|
||||
$latestMileage = $mileage;
|
||||
}
|
||||
if($param['mileage'] < $latestMileage){
|
||||
return to_assign(1,'新增的里程数,不能小于现有里程数');
|
||||
}
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('CarMileage')->strict(false)->field(true)->update($param);
|
||||
return to_assign();
|
||||
} else {
|
||||
$param['create_time'] = time();
|
||||
$param['admin_id'] = $this->uid;
|
||||
$insertId = Db::name('CarMileage')->strict(false)->field(true)->insertGetId($param);
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//里程数记录删除
|
||||
public function mileage_del()
|
||||
{
|
||||
$param = get_params();
|
||||
$res = Db::name('CarMileage')->where('id',$param['id'])->update(['delete_time'=>time()]);
|
||||
if ($res) {
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(1, '操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,353 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\adm\controller;
|
||||
|
||||
use app\base\BaseController;
|
||||
use app\adm\validate\FlowCateCheck;
|
||||
use app\adm\validate\FlowCheck;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Flow extends BaseController
|
||||
{
|
||||
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$list = Db::name('Flow')
|
||||
->field('f.*,fc.title as cate,fm.title as module')
|
||||
->alias('f')
|
||||
->join('FlowCate fc', 'fc.id = f.cate_id', 'left')
|
||||
->join('FlowModule fm', 'fm.id = fc.module_id', 'left')
|
||||
->order('id desc')->paginate(['list_rows'=> $rows])
|
||||
->each(function($item, $key){
|
||||
if(!empty($item['department_ids'])){
|
||||
$item['departments']=get_department_name($item['department_ids']);
|
||||
}
|
||||
else{
|
||||
$item['departments']='全部';
|
||||
}
|
||||
if(!empty($item['copy_uids'])){
|
||||
$copy_unames=Db::name('Admin')->where([['status','=',1],['id','in',$item['copy_uids']]])->column('name');
|
||||
$item['copy_unames']=implode(',',$copy_unames);
|
||||
}
|
||||
else{
|
||||
$item['copy_unames']='-';
|
||||
}
|
||||
return $item;
|
||||
});
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//添加新增/编辑
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$param['flow_list'] = '';
|
||||
$flow_list=[];
|
||||
//固定审批流
|
||||
if($param['check_type']==2){
|
||||
$roleData = isset($param['check_role']) ? $param['check_role'] : '';
|
||||
$positionIdData = isset($param['check_position_id']) ? $param['check_position_id'] : '';
|
||||
$checkUidsData = isset($param['check_uids_a']) ? $param['check_uids_a'] : '';
|
||||
$checkTypesData = isset($param['check_types']) ? $param['check_types'] : '';
|
||||
foreach ($roleData as $key => $value) {
|
||||
if (!$value) {
|
||||
continue;
|
||||
}
|
||||
if($value==3 && $positionIdData[$key]==''){
|
||||
return to_assign(1, '第'.($key+1).'行的指定岗位职称未选择');
|
||||
break;
|
||||
}
|
||||
if($value>3 && $checkUidsData[$key]==''){
|
||||
return to_assign(1, '第'.($key+1).'行的指定人未选择');
|
||||
break;
|
||||
}
|
||||
$item = [];
|
||||
$item['check_role'] = $value;
|
||||
$item['check_position_id'] = $positionIdData[$key];
|
||||
$item['check_uids'] = $checkUidsData[$key];
|
||||
$item['check_types'] = $checkTypesData[$key];
|
||||
$flow_list[]=$item;
|
||||
}
|
||||
$param['flow_list'] = serialize($flow_list);
|
||||
}
|
||||
//可回退审批流
|
||||
if($param['check_type']==3){
|
||||
$flowNameData = isset($param['flow_name']) ? $param['flow_name'] : '';
|
||||
$checkUidsData = isset($param['check_uids_b']) ? $param['check_uids_b'] : '';
|
||||
foreach ($flowNameData as $key => $value) {
|
||||
if (!$value) {
|
||||
continue;
|
||||
}
|
||||
if($checkUidsData[$key]==''){
|
||||
return to_assign(1, '第'.($key+1).'行的指定人未选择');
|
||||
break;
|
||||
}
|
||||
$item = [];
|
||||
$item['check_role'] = 5;
|
||||
$item['flow_name'] = $value;
|
||||
$item['check_uids'] = $checkUidsData[$key];
|
||||
$flow_list[]=$item;
|
||||
}
|
||||
if(empty($flow_list)){
|
||||
return to_assign(1, '审批流程信息未完善');
|
||||
}
|
||||
$param['flow_list'] = serialize($flow_list);
|
||||
}
|
||||
|
||||
if ($param['id'] > 0) {
|
||||
try {
|
||||
validate(FlowCheck::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['update_time'] = time();
|
||||
Db::name('Flow')->strict(false)->field(true)->update($param);
|
||||
add_log('edit', $param['id'], $param);
|
||||
} else {
|
||||
try {
|
||||
validate(FlowCheck::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['admin_id'] = $this->uid;
|
||||
$param['create_time'] = time();
|
||||
$mid = Db::name('Flow')->strict(false)->field(true)->insertGetId($param);
|
||||
add_log('add', $mid, $param);
|
||||
}
|
||||
return to_assign();
|
||||
} else {
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$check_type = 1;
|
||||
if($id>0){
|
||||
$detail = Db::name('Flow')->where('id',$id)->find();
|
||||
$flow_list = unserialize($detail['flow_list']);
|
||||
if(!empty($flow_list)){
|
||||
foreach ($flow_list as $key => &$val) {
|
||||
$val['check_unames'] ='';
|
||||
$val['check_position_title'] ='';
|
||||
if($val['check_role']==3){
|
||||
$val['check_position_title'] = Db::name('Position')->where('id', '=', $val['check_position_id'])->value('title');
|
||||
}
|
||||
if($val['check_role']>3){
|
||||
$check_unames = Db::name('Admin')->where('id', 'in', $val['check_uids'])->column('name');
|
||||
$val['check_unames'] = implode(',', $check_unames);
|
||||
}
|
||||
}
|
||||
}
|
||||
$detail['flow_list'] = $flow_list;
|
||||
$detail['copy_unames'] ='';
|
||||
if($detail['copy_uids']!=''){
|
||||
$copy_unames = Db::name('Admin')->where('id', 'in', $detail['copy_uids'])->column('name');
|
||||
$detail['copy_unames'] = implode(',', $copy_unames);
|
||||
}
|
||||
$check_type = $detail['check_type'];
|
||||
//var_dump($flow_list);exit;
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
View::assign('check_type', $check_type);
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//禁用/启用
|
||||
public function check()
|
||||
{
|
||||
$param = get_params();
|
||||
$param['update_time']= time();
|
||||
$res = Db::name('Flow')->strict(false)->field('status,update_time')->update($param);
|
||||
if($res!==false){
|
||||
if($param['status'] == 0){
|
||||
add_log('disable', $param['id'], $param);
|
||||
}
|
||||
else if($param['status'] == 1){
|
||||
add_log('recovery', $param['id'], $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(1,'操作失败');
|
||||
}
|
||||
}
|
||||
//审批模块
|
||||
public function modulelist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$list = Db::name('FlowModule')
|
||||
->order('sort desc,id desc')
|
||||
->paginate(['list_rows'=> $rows]);
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
//添加模块
|
||||
public function module_add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('FlowModule')->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('FlowModule')->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('FlowModule')->find($id);
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//设置
|
||||
public function module_check()
|
||||
{
|
||||
$param = get_params();
|
||||
$res = Db::name('FlowModule')->strict(false)->field('id,status')->update($param);
|
||||
if ($res) {
|
||||
if($param['status'] == 0){
|
||||
add_log('disable', $param['id'], $param);
|
||||
}
|
||||
else if($param['status'] == 1){
|
||||
add_log('recovery', $param['id'], $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
//审批类型列表
|
||||
public function catelist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$list = Db::name('FlowCate')
|
||||
->field('fc.*,fm.title as module')
|
||||
->alias('fc')
|
||||
->join('FlowModule fm', 'fm.id = fc.module_id', 'left')
|
||||
->order('fc.sort desc,fc.id desc')
|
||||
->paginate(['list_rows'=> $rows])
|
||||
->each(function($item, $key){
|
||||
if(!empty($item['department_ids'])){
|
||||
$item['departments']=get_department_name($item['department_ids']);
|
||||
}
|
||||
else{
|
||||
$item['departments']='全部';
|
||||
}
|
||||
return $item;
|
||||
});
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
//添加审批类型
|
||||
public function cate_add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(FlowCateCheck::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('FlowCate')->strict(false)->field(true)->update($param);
|
||||
if ($res) {
|
||||
add_log('edit', $param['id'], $param);
|
||||
}
|
||||
return to_assign();
|
||||
} else {
|
||||
try {
|
||||
validate(FlowCateCheck::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['create_time'] = time();
|
||||
$insertId = Db::name('FlowCate')->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('FlowCate')->find($id);
|
||||
if(!empty($detail['department_ids'])){
|
||||
$detail['departments']=get_department_name($detail['department_ids']);
|
||||
}
|
||||
else{
|
||||
$detail['departments']='全部';
|
||||
}
|
||||
if($detail['template_id']>0){
|
||||
$detail['template_title'] = Db::name('Template')->where('id',$detail['template_id'])->value('title');
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//审批类型设置
|
||||
public function cate_check()
|
||||
{
|
||||
$param = get_params();
|
||||
$res = Db::name('FlowCate')->strict(false)->field('id,status')->update($param);
|
||||
if ($res) {
|
||||
if($param['status'] == 0){
|
||||
add_log('disable', $param['id'], $param);
|
||||
}
|
||||
else if($param['status'] == 1){
|
||||
add_log('recovery', $param['id'], $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,373 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\adm\controller;
|
||||
|
||||
use app\base\BaseController;
|
||||
use app\adm\model\MeetingRecords as MeetingRecordsModel;
|
||||
use app\adm\model\MeetingOrder;
|
||||
use schedule\Schedule as ScheduleIndex;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Meeting extends BaseController
|
||||
{
|
||||
protected $model;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(); // 调用父类构造函数
|
||||
$this->model = new MeetingRecordsModel();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 预定数据列表
|
||||
*/
|
||||
public function datalist()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$where=[];
|
||||
$whereOr=[];
|
||||
$where[]=['delete_time','=',0];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['id|title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$model = new MeetingOrder();
|
||||
$list = $model->datalist($param,$where,$whereOr);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
else{
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑预定
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$param['start_date'] = strtotime($param['start_date']);
|
||||
$param['end_date'] = strtotime($param['end_date']);
|
||||
if ($param['end_date'] <= $param['start_date']) {
|
||||
return to_assign(1, "结束时间需要大于开始时间");
|
||||
}
|
||||
$where1[] = ['delete_time', '=', 0];
|
||||
$where1[] = ['room_id', '=', $param['room_id']];
|
||||
$where1[] = ['start_date', 'between', [$param['start_date'], $param['end_date'] - 1]];
|
||||
|
||||
$where2[] = ['delete_time', '=', 0];
|
||||
$where2[] = ['room_id', '=', $param['room_id']];
|
||||
$where2[] = ['start_date', '<=', $param['start_date']];
|
||||
$where2[] = ['start_date', '>=', $param['end_date']];
|
||||
|
||||
$where3[] = ['delete_time', '=', 0];
|
||||
$where3[] = ['room_id', '=', $param['room_id']];
|
||||
$where3[] = ['end_date', 'between', [$param['start_date'] + 1, $param['end_date']]];
|
||||
|
||||
$record = Db::name('MeetingOrder')
|
||||
->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, "您所选的时间区间已有预定记录,请重新选时间");
|
||||
}
|
||||
$requirementData = isset($param['requirement']) ? $param['requirement'] : '';
|
||||
$param['requirements'] = implode(',', $requirementData);
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$model = new MeetingOrder();
|
||||
$model->edit($param);
|
||||
} else {
|
||||
$param['admin_id'] = $this->uid;
|
||||
$param['did'] = $this->did;
|
||||
$model = new MeetingOrder();
|
||||
$model->add($param);
|
||||
}
|
||||
}else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$requirements = get_base_type_data('BasicAdm',2);
|
||||
if ($id>0) {
|
||||
$model = new MeetingOrder();
|
||||
$detail = $model->getById($id);
|
||||
$requirements_array = explode(',', $detail['requirements']);
|
||||
foreach ($requirements as &$val) {
|
||||
if (in_array($val['id'], $requirements_array)) {
|
||||
$val['checked'] = 1;
|
||||
} else {
|
||||
$val['checked'] = 0;
|
||||
}
|
||||
}
|
||||
View::assign('requirements', $requirements);
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
View::assign('requirements', $requirements);
|
||||
if(is_mobile()){
|
||||
return view('qiye@/approve/add_meeting');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看预定
|
||||
*/
|
||||
public function view($id)
|
||||
{
|
||||
$model = new MeetingOrder();
|
||||
$detail = $model->getById($id);
|
||||
View::assign('create_user', get_admin($detail['admin_id']));
|
||||
if (!empty($detail)) {
|
||||
View::assign('detail', $detail);
|
||||
if(is_mobile()){
|
||||
return view('qiye@/approve/view_meeting');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
return view(EEEOR_REPORTING,['code'=>404,'warning'=>'找不到页面']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除预定
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
if (request()->isDelete()) {
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$model = new MeetingOrder();
|
||||
$model->delById($id);
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//会议室
|
||||
public function room()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$list = Db::name('MeetingRoom')
|
||||
->field('mr.*,u.name as keep_name')
|
||||
->alias('mr')
|
||||
->join('Admin u', 'u.id = mr.keep_uid', 'left')
|
||||
->paginate(['list_rows'=> $rows]);
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
//会议室添加
|
||||
public function room_add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('MeetingRoom')->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('MeetingRoom')->strict(false)->field(true)->insertGetId($param);
|
||||
if ($insertId) {
|
||||
add_log('add', $insertId, $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
} else {
|
||||
//keep_name
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if ($id>0) {
|
||||
$detail = Db::name('MeetingRoom')->find($id);
|
||||
if($detail['keep_uid']>0){
|
||||
$detail['keep_name'] = Db::name('Admin')->where('id','=',$detail['keep_uid'])->value('name');
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
return view('room_edit');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//会议室查看
|
||||
public function room_view()
|
||||
{
|
||||
$param = get_params();
|
||||
$detail = Db::name('MeetingRoom')->find($param['id']);
|
||||
if($detail['keep_uid']>0){
|
||||
$detail['keep_name'] = Db::name('Admin')->where('id','=',$detail['keep_uid'])->value('name');
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
|
||||
//会议室查看
|
||||
public function room_use()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = [];
|
||||
|
||||
$where[] = ['start_date','<=',strtotime($param['end'])];
|
||||
$where[] = ['end_date','>=',strtotime($param['start'])];
|
||||
$where[] = ['delete_time', '=', 0];
|
||||
$where[] = ['check_status', '=', 2];
|
||||
$where[] = ['room_id', '=', $param['id']];
|
||||
|
||||
$schedule = Db::name('MeetingOrder')
|
||||
->where($where)
|
||||
->field('id,title,start_date,end_date')
|
||||
->select()->toArray();
|
||||
$events = [];
|
||||
$bg_array=['#ECECEC','#FFD3D3','#F6F6C7','#D7EBFF','#CCEBCC','#E9E9CB'];
|
||||
$border_array=['#CCCCCC','#FF9999','#E8E89B','#99CCFF','#99CC99','#CCCC99'];
|
||||
foreach ($schedule as $k => $v) {
|
||||
$v['backgroundColor'] = $bg_array[3];
|
||||
$v['borderColor'] = $border_array[3];
|
||||
$v['title'] = $v['title'];
|
||||
$v['start'] = date('Y-m-d H:i', $v['start_date']);
|
||||
$v['end'] = date('Y-m-d H:i', $v['end_date']);
|
||||
unset($v['start_date']);
|
||||
unset($v['end_date']);
|
||||
$events[] = $v;
|
||||
}
|
||||
$input_arrays = $events;
|
||||
$range_start = parseDateTime($param['start']);
|
||||
$range_end = parseDateTime($param['end']);
|
||||
$timeZone = null;
|
||||
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) {
|
||||
// Convert the input array into a useful Event object
|
||||
$event = new ScheduleIndex($array, $timeZone);
|
||||
// If the event is in-bounds, add it to the output
|
||||
if ($event->isWithinDayRange($range_start, $range_end)) {
|
||||
$output_arrays[] = $event->toArray();
|
||||
}
|
||||
}
|
||||
return json($output_arrays);
|
||||
} else {
|
||||
$param = get_params();
|
||||
$detail = Db::name('MeetingRoom')->find($param['id']);
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//会议室设置
|
||||
public function room_check()
|
||||
{
|
||||
$param = get_params();
|
||||
$res = Db::name('MeetingRoom')->strict(false)->field('id,status')->update($param);
|
||||
if ($res) {
|
||||
if($param['status'] == 0){
|
||||
add_log('disable', $param['id'], $param);
|
||||
}
|
||||
else if($param['status'] == 1){
|
||||
add_log('recovery', $param['id'], $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
//会议纪要
|
||||
public function records()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where=[];
|
||||
$whereOr = [];
|
||||
$uid = $this->uid;
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
if (!empty($param['anchor_id'])) {
|
||||
$where[] = ['anchor_id', '=', $param['anchor_id']];
|
||||
}
|
||||
if (!empty($param['diff_time'])) {
|
||||
$diff_time =explode('~', $param['diff_time']);
|
||||
$where[] = ['meeting_date', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1].' 23:59:59'))]];
|
||||
}
|
||||
$where[] = ['delete_time', '=', 0];
|
||||
$list = $this->model->datalist($param,$where,$whereOr);
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//添加会议纪要
|
||||
public function records_add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$param['meeting_date'] = isset($param['meeting_date']) ? strtotime(urldecode($param['meeting_date'])) : 0;
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$this->model->edit($param);
|
||||
} else {
|
||||
$param['admin_id'] = $this->uid;
|
||||
$this->model->add($param);
|
||||
}
|
||||
} else {
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if ($id > 0) {
|
||||
View::assign('detail', $this->model->getById($id));
|
||||
return view('records_edit');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//查看会议纪要
|
||||
public function records_view($id)
|
||||
{
|
||||
View::assign('detail', $this->model->getById($id));
|
||||
return view();
|
||||
}
|
||||
|
||||
//删除会议纪要
|
||||
public function records_del()
|
||||
{
|
||||
if (request()->isDelete()) {
|
||||
$id = get_params("id");
|
||||
$this->model->delById($id);
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\adm\controller;
|
||||
|
||||
use app\base\BaseController;
|
||||
use app\adm\model\News as NewsModel;
|
||||
use app\adm\validate\NewsValidate;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class News extends BaseController
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
protected $model;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(); // 调用父类构造函数
|
||||
$this->model = new NewsModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
public function datalist()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$where=[];
|
||||
$where[]=['delete_time','=',0];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['id|title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$list = $this->model->datalist($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
else{
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(NewsValidate::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$this->model->edit($param);
|
||||
} else {
|
||||
try {
|
||||
validate(NewsValidate::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['admin_id']=$this->uid;
|
||||
$this->model->add($param);
|
||||
}
|
||||
}else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if ($id>0) {
|
||||
$detail = $this->model->getById($id);
|
||||
if($detail['file_ids'] !=''){
|
||||
$file_array = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['file_array'] = $file_array;
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function view($id)
|
||||
{
|
||||
$detail = $this->model->getById($id);
|
||||
if (!empty($detail)) {
|
||||
$detail['cate'] = Db::name('NoteCate')->where(['id' => $detail['cate_id']])->value('title');
|
||||
$detail['admin_name'] = Db::name('Admin')->where(['id' => $detail['admin_id']])->value('name');
|
||||
if($detail['file_ids'] !=''){
|
||||
$file_array = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['file_array'] = $file_array;
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
if(is_mobile()){
|
||||
return view('qiye@/index/view_news');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
return view(EEEOR_REPORTING,['code'=>404,'warning'=>'找不到页面']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if (request()->isDelete()) {
|
||||
$this->model->delById($id);
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\adm\controller;
|
||||
|
||||
use app\base\BaseController;
|
||||
use app\adm\model\Note as NoteModel;
|
||||
use app\adm\validate\NoteValidate;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Note extends BaseController
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
protected $model;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(); // 调用父类构造函数
|
||||
$this->model = new NoteModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
public function datalist()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$where=[];
|
||||
$where[]=['a.delete_time','=',0];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['a.id|a.title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$list = $this->model->datalist($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
else{
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$param['start_time'] = isset($param['start_time']) ? strtotime(urldecode($param['start_time'])) : 0;
|
||||
$param['end_time'] = isset($param['end_time']) ? strtotime(urldecode($param['end_time'])) : 0;
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(NoteValidate::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$this->model->edit($param);
|
||||
} else {
|
||||
try {
|
||||
validate(NoteValidate::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['admin_id']=$this->uid;
|
||||
$this->model->add($param);
|
||||
}
|
||||
}else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if ($id>0) {
|
||||
$detail = $this->model->getById($id);
|
||||
if($detail['file_ids'] !=''){
|
||||
$file_array = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['file_array'] = $file_array;
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
if(is_mobile()){
|
||||
return view('qiye@/index/note_add');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function view($id)
|
||||
{
|
||||
$detail = $this->model->getById($id);
|
||||
if (!empty($detail)) {
|
||||
$detail['cate'] = Db::name('NoteCate')->where(['id' => $detail['cate_id']])->value('title');
|
||||
$detail['admin_name'] = Db::name('Admin')->where(['id' => $detail['admin_id']])->value('name');
|
||||
if($detail['file_ids'] !=''){
|
||||
$file_array = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['file_array'] = $file_array;
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
if(is_mobile()){
|
||||
return view('qiye@/index/note_view');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
return view(EEEOR_REPORTING,['code'=>404,'warning'=>'找不到页面']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if (request()->isDelete()) {
|
||||
$this->model->delById($id);
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\adm\controller;
|
||||
|
||||
use app\base\BaseController;
|
||||
use app\adm\model\NoteCate as NoteCateModel;
|
||||
use app\adm\validate\NotecateValidate;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Notecate extends BaseController
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
protected $model;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(); // 调用父类构造函数
|
||||
$this->model = new NoteCateModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$list = $this->model->where('delete_time',0)->order('sort asc')->select();
|
||||
return to_assign(0, '', $list);
|
||||
}
|
||||
else{
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(NotecateValidate::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$this->model->edit($param);
|
||||
} else {
|
||||
try {
|
||||
validate(NotecateValidate::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$this->model->add($param);
|
||||
}
|
||||
}else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if ($id>0) {
|
||||
$detail = $this->model->getCateById($id);
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function view($id)
|
||||
{
|
||||
$detail = $this->model->getById($id);
|
||||
if (!empty($detail)) {
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
return view(EEEOR_REPORTING,['code'=>404,'warning'=>'找不到页面']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
if (request()->isDelete()) {
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$type = isset($param['type']) ? $param['type'] : 0;
|
||||
$this->model->delById($id,$type);
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置
|
||||
*/
|
||||
public function set()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$res = $this->model->strict(false)->field('id,status')->update($param);
|
||||
if ($res) {
|
||||
if($param['status'] == 0){
|
||||
add_log('disable', $param['id'], $param);
|
||||
}
|
||||
else if($param['status'] == 1){
|
||||
add_log('recovery', $param['id'], $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\adm\controller;
|
||||
|
||||
use app\base\BaseController;
|
||||
use app\adm\model\OfficialDocs;
|
||||
use app\adm\validate\CarValidate;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Official extends BaseController
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
protected $model;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(); // 调用父类构造函数
|
||||
$this->model = new OfficialDocs();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
public function datalist()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$where=[];
|
||||
$whereOr = [];
|
||||
$map1 = [];
|
||||
$map2 = [];
|
||||
$map3 = [];
|
||||
$map4 = [];
|
||||
$uid = $this->uid;
|
||||
$tab = isset($param['tab']) ? $param['tab'] : 0;
|
||||
|
||||
//条件1
|
||||
$map1[] = ['admin_id','=',$uid];
|
||||
|
||||
//条件2
|
||||
$map2[] = ['check_status','=',2];
|
||||
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',send_uids)")];
|
||||
|
||||
//条件3
|
||||
$map3[] = ['check_status','=',2];
|
||||
$map3[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',copy_uids)")];
|
||||
|
||||
//条件4
|
||||
$map4[] = ['check_status','=',2];
|
||||
$map4[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',share_uids)")];
|
||||
|
||||
|
||||
$where[]=['delete_time','=',0];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['id|title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
if (!empty($param['secrets'])) {
|
||||
$where[] = ['secrets', '=', $param['secrets']];
|
||||
}
|
||||
if (!empty($param['urgency'])) {
|
||||
$where[] = ['urgency', '=', $param['urgency']];
|
||||
}
|
||||
if($tab == 0){
|
||||
$whereOr = [$map1,$map2];
|
||||
}
|
||||
if($tab == 1){
|
||||
$where[] = ['admin_id','=',$uid];
|
||||
}
|
||||
if($tab == 2){
|
||||
$where[] = ['check_status','=',2];
|
||||
$where[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',send_uids)")];
|
||||
}
|
||||
if($tab == 3){
|
||||
$where[] = ['check_status','=',2];
|
||||
$where[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',copy_uids)")];
|
||||
}
|
||||
if($tab == 4){
|
||||
$where[] = ['check_status','=',2];
|
||||
$where[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',share_uids)")];
|
||||
}
|
||||
$list = $this->model->datalist($param,$where,$whereOr);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
else{
|
||||
View::assign('secrets', $this->model::$Secrets);
|
||||
View::assign('urgency', $this->model::$Urgency);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (isset($param['draft_time'])) {
|
||||
$param['draft_time'] = strtotime($param['draft_time']);
|
||||
}
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$this->model->edit($param);
|
||||
} else {
|
||||
$param['admin_id'] = $this->uid;
|
||||
$this->model->add($param);
|
||||
}
|
||||
}else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if(is_mobile()){
|
||||
return view('qiye@/index/405',['msg' => '由于公文包含了富文本编辑,手机端不方便操作,请到PC端新增或编辑']);
|
||||
}
|
||||
if ($id>0) {
|
||||
$detail = $this->model->getById($id);
|
||||
View::assign('detail', $detail);
|
||||
return view('edit');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function view($id)
|
||||
{
|
||||
$detail = $this->model->getById($id);
|
||||
if (!empty($detail)) {
|
||||
View::assign('detail', $detail);
|
||||
View::assign('auth_office', isAuth($this->uid,'office_admin','conf_1'));
|
||||
if(is_mobile()){
|
||||
return view('qiye@/index/official_view');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
return view(EEEOR_REPORTING,['warning'=>'找不到页面']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if (request()->isDelete()) {
|
||||
$this->model->delById($id);
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
|
||||
//待审公文列表
|
||||
public function pending()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$uid = $this->uid;
|
||||
$where=[];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$where[] = ['check_status', '=', 1];
|
||||
$where[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',check_uids)")];
|
||||
$list = $this->model->datalist($param,$where);
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//已审公文列表
|
||||
public function reviewed()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$uid = $this->uid;
|
||||
$where=[];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$where[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',check_history_uids)")];
|
||||
$list = $this->model->datalist($param,$where);
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\adm\controller;
|
||||
|
||||
use app\base\BaseController;
|
||||
use app\adm\model\Property as PropertyModel;
|
||||
use app\adm\validate\PropertyCheck;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Property extends BaseController
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
protected $model;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(); // 调用父类构造函数
|
||||
$this->model = new PropertyModel();
|
||||
}
|
||||
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = [];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['p.title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
if (isset($param['status']) && $param['status']!='') {
|
||||
$where[] = ['p.status', '=', $param['status']];
|
||||
}
|
||||
else{
|
||||
$where[] = ['p.status','>=',0];
|
||||
}
|
||||
if (!empty($param['cate_id'])) {
|
||||
$cate_id_array = get_cate_son('PropertyCate',$param['cate_id']);
|
||||
$where[] = ['p.cate_id', 'in', $cate_id_array];
|
||||
}
|
||||
if (!empty($param['brand_id'])) {
|
||||
$where[] = ['p.brand_id', '=', $param['brand_id']];
|
||||
}
|
||||
$list = $this->model->datalist($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
View::assign('status', $this->model::$property_status);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
//新建编辑
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (isset($param['buy_time'])) {
|
||||
$param['buy_time'] = strtotime($param['buy_time']);
|
||||
}
|
||||
if (isset($param['quality_time'])) {
|
||||
$param['quality_time'] = strtotime($param['quality_time']);
|
||||
}
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(PropertyCheck::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['update_time'] = time();
|
||||
$param['update_id'] = $this->uid;
|
||||
$this->model->edit($param);
|
||||
} else {
|
||||
try {
|
||||
validate(PropertyCheck::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['create_time'] = time();
|
||||
$param['admin_id'] = $this->uid;
|
||||
$this->model->add($param);
|
||||
}
|
||||
} else {
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
View::assign('status', $this->model::$property_status);
|
||||
View::assign('source', $this->model::$property_source);
|
||||
if($id>0){
|
||||
$detail = $this->model->getById($id);
|
||||
if(!empty($detail['user_ids'])){
|
||||
$users = Db::name('Admin')->where('id','in',$detail['user_ids'])->column('name');
|
||||
$detail['users_name'] = implode(',',$users);
|
||||
}
|
||||
if($detail['file_ids'] !=''){
|
||||
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['fileArray'] = $fileArray;
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
return view('edit');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//查看
|
||||
public function view()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = $this->model->getById($id);
|
||||
if($detail['cate_id']>0){
|
||||
$detail['cate'] = Db::name('PropertyCate')->where('id',$detail['cate_id'])->value('title');
|
||||
}
|
||||
if($detail['unit_id']>0){
|
||||
$detail['unit'] = Db::name('PropertyUnit')->where('id',$detail['unit_id'])->value('title');
|
||||
}
|
||||
if($detail['brand_id']>0){
|
||||
$detail['brand'] = Db::name('PropertyBrand')->where('id',$detail['brand_id'])->value('title');
|
||||
}
|
||||
if(!empty($detail['user_ids'])){
|
||||
$users = Db::name('Admin')->where('id','in',$detail['user_ids'])->column('name');
|
||||
$detail['users_name'] = implode(',',$users);
|
||||
}
|
||||
if(!empty($detail['user_dids'])){
|
||||
$titles = Db::name('Department')->where('id','in',$detail['user_dids'])->column('title');
|
||||
$detail['dids_title'] = implode(',',$titles);
|
||||
}
|
||||
if($detail['file_ids'] !=''){
|
||||
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['fileArray'] = $fileArray;
|
||||
}
|
||||
$repair = Db::name('PropertyRepair')
|
||||
->field('pr.*,u.name as director_name')
|
||||
->alias('pr')
|
||||
->join('Admin u', 'u.id = pr.director_id', 'left')
|
||||
->where(['pr.delete_time'=>0,'pr.property_id'=>$detail['id']])
|
||||
->select()->toArray();
|
||||
$detail['repair'] = $repair;
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
|
||||
//设置
|
||||
public function check()
|
||||
{
|
||||
$param = get_params();
|
||||
$res = Db::name('Property')->strict(false)->field('id,status')->update($param);
|
||||
if ($res) {
|
||||
add_log('set', $param['id'], $param);
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//维修记录列表
|
||||
public function repair_list()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = [];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['p.title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
if (!empty($param['diff_time'])) {
|
||||
$diff_time =explode('~', $param['diff_time']);
|
||||
$where[] = ['pr.repair_time', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1]))]];
|
||||
}
|
||||
$where[] = ['pr.delete_time','=',0];
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$list = Db::name('PropertyRepair')
|
||||
->field('pr.*,pc.title as cate,pb.title as brand,p.title,p.model,u.name as director_name')
|
||||
->alias('pr')
|
||||
->join('Property p', 'p.id = pr.property_id', 'left')
|
||||
->join('PropertyCate pc', 'pc.id = p.cate_id', 'left')
|
||||
->join('PropertyBrand pb', 'pb.id = p.brand_id', 'left')
|
||||
->join('Admin u', 'u.id = pr.director_id', 'left')
|
||||
->where($where)
|
||||
->order('id desc')
|
||||
->paginate(['list_rows'=> $rows])
|
||||
->each(function ($item, $key){
|
||||
$item['repair_time'] = date('Y-m-d',$item['repair_time']);
|
||||
$item['create_time'] = date('Y-m-d H:i',$item['create_time']);
|
||||
return $item;
|
||||
});
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//维修记录添加&编辑
|
||||
public function repair_add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (isset($param['repair_time'])) {
|
||||
$param['repair_time'] = strtotime($param['repair_time']);
|
||||
}
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('PropertyRepair')->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('PropertyRepair')->strict(false)->field(true)->insertGetId($param);
|
||||
if ($insertId) {
|
||||
add_log('add', $insertId, $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
} else {
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$pid = isset($param['pid']) ? $param['pid'] : 0;
|
||||
if ($id > 0) {
|
||||
$detail = Db::name('PropertyRepair')->where(['id' => $id])->find();
|
||||
$detail['director_name'] = Db::name('Admin')->where('id',$detail['director_id'])->value('name');
|
||||
$detail['property'] = Db::name('Property')->where('id',$detail['property_id'])->value('title');
|
||||
if($detail['file_ids'] !=''){
|
||||
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['fileArray'] = $fileArray;
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
return view('repair_edit');
|
||||
}
|
||||
if($pid>0){
|
||||
View::assign('property', $this->model->getById($pid));
|
||||
}
|
||||
View::assign('pid', $pid);
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//维修记录查看
|
||||
public function repair_view()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = Db::name('PropertyRepair')->where(['id' => $id])->find();
|
||||
$detail['director_name'] = Db::name('Admin')->where('id',$detail['director_id'])->value('name');
|
||||
$detail['property'] = Db::name('Property')->where('id',$detail['property_id'])->value('title');
|
||||
if($detail['file_ids'] !=''){
|
||||
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['fileArray'] = $fileArray;
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
|
||||
//维修记录删除
|
||||
public function repair_del()
|
||||
{
|
||||
$param = get_params();
|
||||
$res = Db::name('PropertyRepair')->where('id',$param['id'])->update(['delete_time'=>time()]);
|
||||
if ($res) {
|
||||
add_log('delete', $param['id'], $param);
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\adm\controller;
|
||||
|
||||
use app\base\BaseController;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Propertybrand extends BaseController
|
||||
{
|
||||
//资产品牌
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$cate = Db::name('PropertyBrand')->order('create_time asc')->select();
|
||||
return to_assign(0, '', $cate);
|
||||
} 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('PropertyBrand')->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('PropertyBrand')->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('PropertyBrand')->where(['id' => $id])->find();
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//禁用启用
|
||||
public function check()
|
||||
{
|
||||
$param = get_params();
|
||||
$res = Db::name('PropertyBrand')->strict(false)->field('id,status')->update($param);
|
||||
if ($res) {
|
||||
if($param['status'] == 0){
|
||||
add_log('disable', $param['id'], $param);
|
||||
}
|
||||
else if($param['status'] == 1){
|
||||
add_log('recovery', $param['id'], $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\adm\controller;
|
||||
|
||||
use app\base\BaseController;
|
||||
use app\adm\validate\CateCheck;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Propertycate extends BaseController
|
||||
{
|
||||
//类别
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$cate = Db::name('PropertyCate')->order('create_time asc')->select();
|
||||
$list = generateTree($cate);
|
||||
return to_assign(0, '', $list);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//分类添加&编辑
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(CateCheck::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$note_array = get_cate_son('PropertyCate',$param['id']);
|
||||
if (in_array($param['pid'], $note_array)) {
|
||||
return to_assign(1, '父级分类不能是该分类本身或其子分类');
|
||||
} else {
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('PropertyCate')->strict(false)->field(true)->update($param);
|
||||
if($res){
|
||||
add_log('edit', $param['id'], $param);
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
validate(CateCheck::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['create_time'] = time();
|
||||
$insertId = Db::name('PropertyCate')->strict(false)->field(true)->insertGetId($param);
|
||||
if ($insertId) {
|
||||
add_log('add', $insertId, $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
} else {
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$pid = isset($param['pid']) ? $param['pid'] : 0;
|
||||
$cate = Db::name('PropertyCate')->order('id desc')->select()->toArray();
|
||||
$cates = set_recursion($cate);
|
||||
if ($id > 0) {
|
||||
$detail = Db::name('PropertyCate')->where(['id' => $id])->find();
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
View::assign('pid', $pid);
|
||||
View::assign('cates', $cates);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//删除分类
|
||||
public function del()
|
||||
{
|
||||
$id = get_params("id");
|
||||
$cate_count = Db::name('PropertyCate')->where(["pid" => $id])->count();
|
||||
if ($cate_count > 0) {
|
||||
return to_assign(1, "该分类下还有子分类,无法删除");
|
||||
}
|
||||
$content_count = Db::name('Property')->where(["cate_id" => $id])->count();
|
||||
if ($content_count > 0) {
|
||||
return to_assign(1, "该分类下还有资产,无法删除");
|
||||
}
|
||||
if (Db::name('PropertyCate')->delete($id) !== false) {
|
||||
add_log('delete', $id);
|
||||
return to_assign(0, "删除分类成功");
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\adm\controller;
|
||||
|
||||
use app\base\BaseController;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Propertyunit extends BaseController
|
||||
{
|
||||
//资产单位
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$cate = Db::name('PropertyUnit')->order('create_time asc')->select();
|
||||
return to_assign(0, '', $cate);
|
||||
} 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('PropertyUnit')->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('PropertyUnit')->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('PropertyUnit')->where(['id' => $id])->find();
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//禁用启用
|
||||
public function check()
|
||||
{
|
||||
$param = get_params();
|
||||
$res = Db::name('PropertyUnit')->strict(false)->field('id,status')->update($param);
|
||||
if ($res) {
|
||||
if($param['status'] == 0){
|
||||
add_log('disable', $param['id'], $param);
|
||||
}
|
||||
else if($param['status'] == 1){
|
||||
add_log('recovery', $param['id'], $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\adm\controller;
|
||||
|
||||
use app\base\BaseController;
|
||||
use app\adm\model\Seal as SealModel;
|
||||
use app\adm\validate\CarValidate;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Seal extends BaseController
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
protected $model;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(); // 调用父类构造函数
|
||||
$this->model = new SealModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
public function datalist()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$tab = isset($param['tab']) ? $param['tab'] : 0;
|
||||
$uid=$this->uid;
|
||||
$where = array();
|
||||
$whereOr = array();
|
||||
$where[]=['delete_time','=',0];
|
||||
if($tab == 0){
|
||||
//全部
|
||||
$whereOr[] = ['admin_id', '=', $this->uid];
|
||||
$whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',check_uids)")];
|
||||
$whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',check_history_uids)")];
|
||||
$whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',check_copy_uids)")];
|
||||
}
|
||||
if($tab == 1){
|
||||
//创建的
|
||||
$where[] = ['admin_id', '=', $this->uid];
|
||||
}
|
||||
if($tab == 2){
|
||||
//待我审核的
|
||||
$where[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',check_uids)")];
|
||||
}
|
||||
if($tab == 3){
|
||||
//我已审核的
|
||||
$where[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',check_history_uids)")];
|
||||
}
|
||||
if($tab == 4){
|
||||
//抄送给我的
|
||||
$where[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',check_copy_uids)")];
|
||||
}
|
||||
if (!empty($param['seal_cate_id'])) {
|
||||
$where[] = ['seal_cate_id', '=', $param['seal_cate_id']];
|
||||
}
|
||||
if (isset($param['check_status']) && $param['check_status'] != "") {
|
||||
$where[] = ['check_status', '=', $param['check_status']];
|
||||
}
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['id|title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$list = $this->model->datalist($where,$whereOr, $param);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
else{
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['use_time'])) {
|
||||
$param['use_time'] = strtotime($param['use_time']);
|
||||
}
|
||||
if (!empty($param['start_time'])) {
|
||||
$param['start_time'] = strtotime($param['start_time']);
|
||||
}
|
||||
else{
|
||||
$param['start_time'] = 0;
|
||||
}
|
||||
if (!empty($param['end_time'])) {
|
||||
$param['end_time'] = strtotime($param['end_time']);
|
||||
if($param['end_time']<$param['start_time']){
|
||||
return to_assign(1, "结束借用日期需要大于等于印章借用日期");
|
||||
}
|
||||
}
|
||||
else{
|
||||
$param['end_time'] = 0;
|
||||
}
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$this->model->edit($param);
|
||||
} else {
|
||||
$param['admin_id'] = $this->uid;
|
||||
$this->model->add($param);
|
||||
}
|
||||
}else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$did = $this->did;
|
||||
$map1 = [];
|
||||
$map2 = [];
|
||||
$map1[] = ['status', '=', 1];
|
||||
$map1[] = ['dids', '=', ''];
|
||||
|
||||
$map2[] = ['status', '=', 1];
|
||||
$map2[] = ['', 'exp', Db::raw("FIND_IN_SET('{$did}',dids)")];
|
||||
|
||||
$sealcate = Db::name('SealCate')->whereOr([$map1,$map2])->order('id desc')->select()->toArray();
|
||||
View::assign('sealcate', $sealcate);
|
||||
View::assign('user', get_admin($this->uid));
|
||||
if ($id>0) {
|
||||
$detail = $this->model->getById($id);
|
||||
if($detail['check_status']==0 || $detail['check_status']==4){
|
||||
View::assign('detail', $detail);
|
||||
if(is_mobile()){
|
||||
return view('qiye@/approve/add_seal');
|
||||
}
|
||||
return view('edit');
|
||||
}
|
||||
}
|
||||
if(is_mobile()){
|
||||
return view('qiye@/approve/add_seal');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function view($id)
|
||||
{
|
||||
$detail = $this->model->getById($id);
|
||||
if (!empty($detail)) {
|
||||
View::assign('detail', $detail);
|
||||
View::assign('create_user', get_admin($detail['admin_id']));
|
||||
if(is_mobile()){
|
||||
return view('qiye@/approve/view_seal');
|
||||
}
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
return view(EEEOR_REPORTING,['warning'=>'找不到页面']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if (request()->isDelete()) {
|
||||
$this->model->delById($id);
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
|
||||
//用章记录
|
||||
public function record()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = [];
|
||||
$whereOr = [];
|
||||
$where[]=['delete_time','=',0];
|
||||
$where[]=['check_status','=',2];
|
||||
if (!empty($param['seal_cate_id'])) {
|
||||
$where[] = ['seal_cate_id', '=', $param['seal_cate_id']];
|
||||
}
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['id|title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$list = $this->model->datalist($where,$whereOr, $param);
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
View::assign('status', ['未使用','已使用','已归还']);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
* @Author 勾股工作室 <hdm58@qq.com>
|
||||
+-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\adm\controller;
|
||||
|
||||
use app\base\BaseController;
|
||||
use app\adm\validate\SealCateCheck;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Sealcate extends BaseController
|
||||
{
|
||||
//印章类别
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$cate = Db::name('SealCate')
|
||||
->field('a.*,u.name,d.title as department')
|
||||
->alias('a')
|
||||
->join('Admin u', 'u.id = a.keep_uid')
|
||||
->join('Department d', 'd.id = u.did')
|
||||
->order('create_time asc')->select()->toArray();
|
||||
foreach ($cate as $key => &$value) {
|
||||
if(!empty($value['dids'])){
|
||||
$value['departments']=get_department_name($value['dids']);
|
||||
}
|
||||
else{
|
||||
$value['departments']='全部';
|
||||
}
|
||||
}
|
||||
return to_assign(0, '', $cate);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
//添加
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(SealCateCheck::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('SealCate')->strict(false)->field(true)->update($param);
|
||||
if ($res) {
|
||||
add_log('edit', $param['id'], $param);
|
||||
}
|
||||
return to_assign();
|
||||
} else {
|
||||
try {
|
||||
validate(SealCateCheck::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['create_time'] = time();
|
||||
$insertId = Db::name('SealCate')->strict(false)->field(true)->insertGetId($param);
|
||||
if ($insertId) {
|
||||
add_log('add', $insertId, $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
}else {
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if ($id > 0) {
|
||||
$detail = Db::name('SealCate')->where(['id' => $id])->find();
|
||||
$detail['keep_name'] = Db::name('Admin')->where(['id' => $detail['keep_uid']])->value('name');
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//设置
|
||||
public function check()
|
||||
{
|
||||
$param = get_params();
|
||||
$res = Db::name('SealCate')->strict(false)->field('id,status')->update($param);
|
||||
if ($res) {
|
||||
if($param['status'] == 0){
|
||||
add_log('disable', $param['id'], $param);
|
||||
}
|
||||
else if($param['status'] == 1){
|
||||
add_log('recovery', $param['id'], $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
else{
|
||||
return to_assign(0, '操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user