提交 9ea5a97e authored 作者: fengzy's avatar fengzy

Merge branch 'test' of ssh://39.155.253.71:33222/PHP/Jz-Php into test

...@@ -144,14 +144,10 @@ class Useage extends Base ...@@ -144,14 +144,10 @@ class Useage extends Base
} }
//保存抄表单 //保存抄表单
public function store($useage_id = ''){ public function store(){
//获取表单数据 //获取表单数据
$data = Request::post(); $data = Request::post();
<<<<<<< HEAD
=======
$useage_id = isset($data['useage_id']) ? $data['useage_id'] : ''; $useage_id = isset($data['useage_id']) ? $data['useage_id'] : '';
>>>>>>> 712dea449184407dd0ea2cb79857be09da1c93cd
$action = '新增'; $action = '新增';
//数据验证 //数据验证
$validate = new UseageGeneralInfoValidate(); $validate = new UseageGeneralInfoValidate();
...@@ -177,10 +173,7 @@ class Useage extends Base ...@@ -177,10 +173,7 @@ class Useage extends Base
$this->checkEnd($useage_id); $this->checkEnd($useage_id);
$action = '修改'; $action = '修改';
$uModel = (new \app\em\model\Useage())->get(['useage_id' => $useage_id]); $uModel = (new \app\em\model\Useage())->get(['useage_id' => $useage_id]);
<<<<<<< HEAD
=======
$uModel->status = 1; $uModel->status = 1;
>>>>>>> 712dea449184407dd0ea2cb79857be09da1c93cd
} }
//更新 //更新
$uModel->staff_id = $data['staff_id']; $uModel->staff_id = $data['staff_id'];
...@@ -194,15 +187,6 @@ class Useage extends Base ...@@ -194,15 +187,6 @@ class Useage extends Base
if(empty($useage_id)){ if(empty($useage_id)){
$udModel = new UseageDetail(); //抄表详情模型 $udModel = new UseageDetail(); //抄表详情模型
<<<<<<< HEAD
$udModel->type = $data['type'] == 1 ? 5 : 6;
$uModel->current_numb = $data['current_numb'];
$uModel->last_numb = $data['last_numb'];
} else {
$udModel = (new UseageDetail())->get(['useage_id' => $useage_id]);; //抄表详情模型
}
$udModel->current_numb = $data['current_numb'];
=======
$udModel->useage_id = $uModel->useage_id; $udModel->useage_id = $uModel->useage_id;
$udModel->type = $data['pricing_type'] == 1 ? 5 : 6; $udModel->type = $data['pricing_type'] == 1 ? 5 : 6;
$udModel->current_numb = $uModel->current_sum_numb; $udModel->current_numb = $uModel->current_sum_numb;
...@@ -211,7 +195,6 @@ class Useage extends Base ...@@ -211,7 +195,6 @@ class Useage extends Base
$udModel = (new UseageDetail())->get(['useage_id' => $useage_id]); //抄表详情模型 $udModel = (new UseageDetail())->get(['useage_id' => $useage_id]); //抄表详情模型
} }
$udModel->current_numb = $uModel->current_sum_numb; $udModel->current_numb = $uModel->current_sum_numb;
>>>>>>> 712dea449184407dd0ea2cb79857be09da1c93cd
$udModel->price = $uModel->price; $udModel->price = $uModel->price;
$udModel->save(); $udModel->save();
...@@ -231,11 +214,8 @@ class Useage extends Base ...@@ -231,11 +214,8 @@ class Useage extends Base
$checkType = Request::param('checkType'); $checkType = Request::param('checkType');
$this->verify($useage_id,$checkType); //1是通过 2是驳回 $this->verify($useage_id,$checkType); //1是通过 2是驳回
if($checkType == 2) { if($checkType == 2) {
<<<<<<< HEAD
=======
$res = $this->checkEnd($useage_id); $res = $this->checkEnd($useage_id);
if($res !== true) return $res; if($res !== true) return $res;
>>>>>>> 712dea449184407dd0ea2cb79857be09da1c93cd
$useage->status = 3; //3代表被驳回 $useage->status = 3; //3代表被驳回
$useage->save(); $useage->save();
return json(['status'=>1,'message'=>'单据已经驳回']); return json(['status'=>1,'message'=>'单据已经驳回']);
...@@ -297,24 +277,6 @@ class Useage extends Base ...@@ -297,24 +277,6 @@ class Useage extends Base
public function del(){ public function del(){
$useage_id = Request::param('uid'); $useage_id = Request::param('uid');
<<<<<<< HEAD
$this->checkEnd($useage_id);
$useage = (new \app\em\model\Useage())->get(['useage_id'=>$useage_id]);
$useage_details = (new UseageDetail())->select(['useage_id'=>$useage_id]);
Db::startTrans();
try{
$useage->delete();
$useage_details->delete();
Db::commit();
return json(['status'=>1,'message'=>"删除单据成功"]);
} catch (\Exception $e) {
// 回滚事务
Db::rollback();
return json(['status'=>0,'message'=>"删除异常,单据删除失败,请联系管理员"]);
}
=======
$res = $this->checkEnd($useage_id); $res = $this->checkEnd($useage_id);
if($res !== true) return $res; if($res !== true) return $res;
//删除useage表数据 //删除useage表数据
...@@ -349,42 +311,6 @@ class Useage extends Base ...@@ -349,42 +311,6 @@ class Useage extends Base
} }
//审核
public function verify($usage_id,$status=2){
$user = Session::get('user');
$cModel = new EmCheckBill();
$cModel->info = Request::param('refuseInfo');
$cModel->uid = $user['user_id'];
$cModel->mode = 'useage';
$cModel->mode_id = $usage_id;
$cModel->status = $status;
$cModel->save();
>>>>>>> 712dea449184407dd0ea2cb79857be09da1c93cd
}
/**
* 判断useage_id是否是em_id的最后一条记录
* @param $useage_id
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function checkEnd($useage_id){
$uModel = (new \app\em\model\Useage())->get(['useage_id'=>$useage_id]);
if(!$uModel) return json(['status'=>0,'message'=>"不存在的抄表单号,请联系管理员"]);
if($uModel->status == 2) return json(['status'=>0,'message'=>"已审核过的单据无法编辑,请联系管理员"]);
//找出电表最后一条数据
$lastModel = (new \app\em\model\Useage())->where('em_id','=',$uModel->em_id)
->order('id desc')->find();
if($lastModel->status == 2) return json(['status'=>0,'message'=>"单号不是最新的抄表记录且最新的抄表记录已经审核无法修改,请联系管理员"]);
if($uModel->id != $lastModel->id){
return json(['status'=>0,'message'=>"抄表单号不是最新的抄表记录,无法修改,请联系管理员"]);
}
}
//审核 //审核
public function verify($usage_id,$status=2){ public function verify($usage_id,$status=2){
$user = Session::get('user'); $user = Session::get('user');
......
...@@ -200,16 +200,6 @@ ...@@ -200,16 +200,6 @@
</div> </div>
</div> </div>
{if $useage.status < 2} {if $useage.status < 2}
<<<<<<< HEAD
<div class="layui-form-item layui-col-md-offset4">
<button class="layui-btn" lay-filter="pass" lay-submit="">
通过
</button>
<button class="layui-btn" lay-filter="refuse" lay-submit="">
驳回
</button>
</div>
=======
{if check_ele_permission('useage/check') } {if check_ele_permission('useage/check') }
<div class="layui-form-item layui-col-md-offset4"> <div class="layui-form-item layui-col-md-offset4">
<button class="layui-btn" lay-filter="pass" lay-submit=""> <button class="layui-btn" lay-filter="pass" lay-submit="">
...@@ -220,7 +210,6 @@ ...@@ -220,7 +210,6 @@
</button> </button>
</div> </div>
{/if} {/if}
>>>>>>> 712dea449184407dd0ea2cb79857be09da1c93cd
{/if} {/if}
</form> </form>
</div> </div>
...@@ -261,11 +250,7 @@ ...@@ -261,11 +250,7 @@
window.location.href='/useage'; window.location.href='/useage';
}) })
} else { } else {
<<<<<<< HEAD
layer.msg(data.message || data.msg,{icon: 5,time: 1000 })
=======
layer.msg(data.message || data.msg,{icon: 5,time: 3000 }) layer.msg(data.message || data.msg,{icon: 5,time: 3000 })
>>>>>>> 712dea449184407dd0ea2cb79857be09da1c93cd
window.location.href='/useage'; window.location.href='/useage';
} }
} }
...@@ -282,11 +267,7 @@ ...@@ -282,11 +267,7 @@
layer.open({ layer.open({
type: 1, type: 1,
title:'填写驳回理由', title:'填写驳回理由',
<<<<<<< HEAD
content: '<div class="layui-form-item><div class="layui-input-block" style="padding:15px;"><textarea placeholder="驳回理由" class="layui-textarea" id="refuseInfo" name="refuseInfo"></textarea></div>',
=======
content: '<div class="layui-form-item"><div style="padding:15px;"><textarea placeholder="驳回理由" class="layui-textarea" id="refuseInfo" name="refuseInfo"></textarea></div>', content: '<div class="layui-form-item"><div style="padding:15px;"><textarea placeholder="驳回理由" class="layui-textarea" id="refuseInfo" name="refuseInfo"></textarea></div>',
>>>>>>> 712dea449184407dd0ea2cb79857be09da1c93cd
btn:"提交", btn:"提交",
yes: function(){ yes: function(){
$data.field.checkType = 2; $data.field.checkType = 2;
...@@ -298,20 +279,11 @@ ...@@ -298,20 +279,11 @@
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
if (data.status == 1) { if (data.status == 1) {
<<<<<<< HEAD
layer.msg(data.message,{icon: 6,time: 2000},function(){
window.location.href='/useage';
})
} else {
layer.msg(data.message || data.msg,{icon: 5,time: 1000 })
window.location.href='/useage';
=======
layer.msg(data.message,{icon: 6,time: 4000},function(){ layer.msg(data.message,{icon: 6,time: 4000},function(){
window.location.href='/useage'; window.location.href='/useage';
}) })
} else { } else {
layer.msg(data.message || data.msg,{icon: 5,time: 5000 }) layer.msg(data.message || data.msg,{icon: 5,time: 5000 })
>>>>>>> 712dea449184407dd0ea2cb79857be09da1c93cd
} }
} }
}); });
......
...@@ -57,19 +57,19 @@ ...@@ -57,19 +57,19 @@
<table class="layui-table" lay-filter="useage" lay-data="{ url:'/useage', page:true, id:'idTest',where:{search_type:document.getElementById('search_type').value,search_text:document.getElementById('search_text').value,date_start:document.getElementById('date_start').value,date_end:document.getElementById('date_end').value,cp_date:document.getElementById('cp_date').value,status:document.getElementById('useage_status').value} }"> <table class="layui-table" lay-filter="useage" lay-data="{ url:'/useage', page:true, id:'idTest',where:{search_type:document.getElementById('search_type').value,search_text:document.getElementById('search_text').value,date_start:document.getElementById('date_start').value,date_end:document.getElementById('date_end').value,cp_date:document.getElementById('cp_date').value,status:document.getElementById('useage_status').value} }">
<thead> <thead>
<tr> <tr>
<th lay-data="{templet: '#useage_id',sort: true,width:'12%'} ">抄表单号</th> <th lay-data="{templet: '#useage_id',sort: true} ">抄表单号</th>
<th lay-data="{field:'station_name',width:'12%'}">所属基站名</th> <th lay-data="{field:'station_name'}">所属基站名</th>
<th lay-data="{field:'em_numb',width:'8%'} ">所属电表号</th> <th lay-data="{field:'em_numb'} ">所属电表号</th>
<th lay-data="{field:'last_date',sort: true,width:'9%'}">上次日期</th> <th lay-data="{field:'last_date',sort: true}">上次日期</th>
<th lay-data="{field:'current_date',sort: true,width:'9%'}">本次日期</th> <th lay-data="{field:'current_date',sort: true}">本次日期</th>
<th lay-data="{field:'last_sum_numb',width:'7%'}">上次度数</th> <th lay-data="{field:'last_sum_numb'}">上次度数</th>
<th lay-data="{field:'current_sum_numb',width:'7%'}">本次度数</th> <th lay-data="{field:'current_sum_numb'}">本次度数</th>
<th lay-data="{field:'repo_numb',width:'7%'}">用电量</th> <th lay-data="{field:'repo_numb'}">用电量</th>
<th lay-data="{templet: '#status',sort: true,width:'5%'}">状态</th> <th lay-data="{templet: '#status',sort: true}">状态</th>
<th lay-data="{templet: '#photo_id',sort: true,width:'7%'}">抄表凭证</th> <th lay-data="{templet: '#photo_id',sort: true}">抄表凭证</th>
<th lay-data="{fixed: 'right', align:'center', toolbar: '#barDemo',width:'16%'}">操作</th> <th lay-data="{fixed: 'right', align:'center', toolbar: '#barDemo'}">操作</th>
</tr> </tr>
</thead> </thead>
</table> </table>
...@@ -95,14 +95,6 @@ ...@@ -95,14 +95,6 @@
{{# if(d.status == 2){ }} {{# if(d.status == 2){ }}
<span class="layui-bg-blue">已审核</span> <span class="layui-bg-blue">已审核</span>
{{# } }} {{# } }}
<<<<<<< HEAD
{{# if(d.status == 3) { }}
<span class="layui-bg-orange" title="{{ d.info.info }}">被驳回</span>
{{# } }}
{{# if(d.status < 2) { }}
<span class="layui-bg-green" title="{{ d.info.info }}">未审核</span>
=======
{{# if(d.status == 3){ }} {{# if(d.status == 3){ }}
<span class="layui-bg-orange" title="{{ d.info }}">被驳回</span> <span class="layui-bg-orange" title="{{ d.info }}">被驳回</span>
...@@ -110,14 +102,9 @@ ...@@ -110,14 +102,9 @@
{{# if(d.status < 2){ }} {{# if(d.status < 2){ }}
<span class="layui-bg-green">未审核</span> <span class="layui-bg-green">未审核</span>
>>>>>>> 712dea449184407dd0ea2cb79857be09da1c93cd
{{# } }} {{# } }}
</script> </script>
<script type="text/html" id="barDemo"> <script type="text/html" id="barDemo">
<<<<<<< HEAD
{{# if(d.status == 1 || d.status == 3){ }}
<a title="删除" class="layui-btn layui-btn-sm layui-bg-green" lay-event="update">编辑</a>
=======
{{# if(d.status == 1){ }} {{# if(d.status == 1){ }}
<a title="审核" class="layui-btn layui-btn-sm layui-bg-green" href="/useage/{{d.useage_id}}">审核</a> <a title="审核" class="layui-btn layui-btn-sm layui-bg-green" href="/useage/{{d.useage_id}}">审核</a>
{{# } }} {{# } }}
...@@ -125,7 +112,6 @@ ...@@ -125,7 +112,6 @@
{{# if(d.status == 1 || d.status == 3){ }} {{# if(d.status == 1 || d.status == 3){ }}
<a title="编辑" class="layui-btn layui-btn-sm layui-bg-green" href="/useage_update/{{d.useage_id}}">编辑</a> <a title="编辑" class="layui-btn layui-btn-sm layui-bg-green" href="/useage_update/{{d.useage_id}}">编辑</a>
>>>>>>> 712dea449184407dd0ea2cb79857be09da1c93cd
<a title="删除" class="layui-btn layui-btn-sm layui-btn-danger" lay-event="del">删除</a> <a title="删除" class="layui-btn layui-btn-sm layui-btn-danger" lay-event="del">删除</a>
{{# } }} {{# } }}
</script> </script>
......
<?php
//配置文件
return [
//加密串
'passwd_salt' => 'gonn',
'passwd_init' => 'gonn',
'encrypt_key' => 'INJq4HXEGI',
'login_pattern' => '/^\w{2,}@\w+/', //开放模式
//'login_pattern' => '/^\w{2,}@gonn\.com\.cn$', 严格模式
'upload_dir' => './static/uploads',
'images_dir' => './static/uploads/images',
'files_dir' => './static/uploads/files',
'search_area' => '1', //1按部门搜索,2全局
'order_per' =>'ZD',
'redis_host' => '192.168.1.71',
'redis_port' => 6379,
];
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论