Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
Jz-Php
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
PHP
Jz-Php
Commits
497f8467
提交
497f8467
authored
4月 28, 2020
作者:
chengye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
完成抄表的驳回,修改操作
上级
14f65b58
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
69 行增加
和
37 行删除
+69
-37
Useage.php
application/em/controller/Useage.php
+47
-13
Useage.php
application/em/model/Useage.php
+6
-1
UseageGeneralInfoValidate.php
application/em/validate/UseageGeneralInfoValidate.php
+1
-1
default.html
application/em/view/useage/default.html
+1
-1
detail.html
application/em/view/useage/detail.html
+5
-13
index.html
application/em/view/useage/index.html
+8
-7
update.html
application/em/view/useage/update.html
+0
-0
admin.php
route/admin.php
+1
-1
没有找到文件。
application/em/controller/Useage.php
浏览文件 @
497f8467
...
@@ -119,11 +119,35 @@ class Useage extends Base
...
@@ -119,11 +119,35 @@ class Useage extends Base
return
$this
->
fetch
(
'default'
);
return
$this
->
fetch
(
'default'
);
}
}
public
function
update
(){
$useage_id
=
Request
::
param
(
'useage_id'
);
$uModel
=
(
new
\app\em\model\Useage
())
->
with
(
'photo'
)
->
get
([
'useage_id'
=>
$useage_id
]);
$em
=
(
new
\app\em\model\Em
)
->
getEmUseageInfoById
(
$uModel
->
em_id
,
false
);
//基站信息
$station_info
=
Station
::
getBaseInfoById
(
$em
->
station_id
);
$this
->
assign
(
'station'
,
$station_info
);
//当前用户
$user
=
Session
::
get
(
'user'
);
$this
->
assign
(
'uid'
,
$user
[
'user_id'
]);
//员工列表
$this
->
assign
(
'staffs'
,(
new
Staff
())
->
getStaffs
(
$user
[
'is_admin'
],
''
,
'useage'
));
$this
->
assign
(
'em'
,
$em
);
$step
=
1000000
;
$uModel
->
repo_numb
=
((
int
)(
$uModel
->
current_sum_numb
*
$step
)
-
(
int
)(
$uModel
->
last_sum_numb
*
$step
))
/
$step
;
$this
->
assign
(
'useage'
,
$uModel
);
return
$this
->
fetch
(
'update'
);
}
//保存抄表单
//保存抄表单
public
function
store
(
$useage_id
=
''
){
public
function
store
(){
//获取表单数据
//获取表单数据
$data
=
Request
::
post
();
$data
=
Request
::
post
();
$useage_id
=
isset
(
$data
[
'useage_id'
])
?
$data
[
'useage_id'
]
:
''
;
$action
=
'新增'
;
$action
=
'新增'
;
//数据验证
//数据验证
$validate
=
new
UseageGeneralInfoValidate
();
$validate
=
new
UseageGeneralInfoValidate
();
...
@@ -149,6 +173,7 @@ class Useage extends Base
...
@@ -149,6 +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
]);
$uModel
->
status
=
1
;
}
}
//更新
//更新
$uModel
->
staff_id
=
$data
[
'staff_id'
];
$uModel
->
staff_id
=
$data
[
'staff_id'
];
...
@@ -162,13 +187,14 @@ class Useage extends Base
...
@@ -162,13 +187,14 @@ class Useage extends Base
if
(
empty
(
$useage_id
)){
if
(
empty
(
$useage_id
)){
$udModel
=
new
UseageDetail
();
//抄表详情模型
$udModel
=
new
UseageDetail
();
//抄表详情模型
$udModel
->
type
=
$data
[
'type'
]
==
1
?
5
:
6
;
$udModel
->
useage_id
=
$uModel
->
useage_id
;
$uModel
->
current_numb
=
$data
[
'current_numb'
];
$udModel
->
type
=
$data
[
'pricing_type'
]
==
1
?
5
:
6
;
$uModel
->
last_numb
=
$data
[
'last_numb'
];
$udModel
->
current_numb
=
$uModel
->
current_sum_numb
;
$udModel
->
last_numb
=
$uModel
->
last_sum_numb
;
}
else
{
}
else
{
$udModel
=
(
new
UseageDetail
())
->
get
([
'useage_id'
=>
$useage_id
]);
;
//抄表详情模型
$udModel
=
(
new
UseageDetail
())
->
get
([
'useage_id'
=>
$useage_id
]);
//抄表详情模型
}
}
$udModel
->
current_numb
=
$
data
[
'current_numb'
]
;
$udModel
->
current_numb
=
$
uModel
->
current_sum_numb
;
$udModel
->
price
=
$uModel
->
price
;
$udModel
->
price
=
$uModel
->
price
;
$udModel
->
save
();
$udModel
->
save
();
...
@@ -188,6 +214,8 @@ class Useage extends Base
...
@@ -188,6 +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
)
{
$res
=
$this
->
checkEnd
(
$useage_id
);
if
(
$res
!==
true
)
return
$res
;
$useage
->
status
=
3
;
//3代表被驳回
$useage
->
status
=
3
;
//3代表被驳回
$useage
->
save
();
$useage
->
save
();
return
json
([
'status'
=>
1
,
'message'
=>
'单据已经驳回'
]);
return
json
([
'status'
=>
1
,
'message'
=>
'单据已经驳回'
]);
...
@@ -249,15 +277,20 @@ class Useage extends Base
...
@@ -249,15 +277,20 @@ class Useage extends Base
public
function
del
(){
public
function
del
(){
$useage_id
=
Request
::
param
(
'uid'
);
$useage_id
=
Request
::
param
(
'uid'
);
$this
->
checkEnd
(
$useage_id
);
$res
=
$this
->
checkEnd
(
$useage_id
);
if
(
$res
!==
true
)
return
$res
;
$useage
=
(
new
\app\em\model\Useage
())
->
get
([
'useage_id'
=>
$useage_id
]);
$useage
=
(
new
\app\em\model\Useage
())
->
get
([
'useage_id'
=>
$useage_id
]);
$useage_details
=
(
new
UseageDetail
())
->
select
([
'useage_id'
=>
$useage_id
]);
$useage_details
=
(
new
UseageDetail
())
->
select
([
'useage_id'
=>
$useage_id
]);
Db
::
startTrans
();
Db
::
startTrans
();
try
{
try
{
$useage
->
delete
();
$useage
->
delete
();
$useage_details
->
delete
();
if
(
!
empty
(
$useage_details
)){
foreach
(
$useage_details
as
$u
){
$u
->
delete
();
}
}
Db
::
commit
();
Db
::
commit
();
return
json
([
'status'
=>
1
,
'message'
=>
"删除单据成功"
]);
return
json
([
'status'
=>
1
,
'message'
=>
"删除单据成功"
]);
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
...
@@ -278,15 +311,16 @@ class Useage extends Base
...
@@ -278,15 +311,16 @@ class Useage extends Base
public
function
checkEnd
(
$useage_id
){
public
function
checkEnd
(
$useage_id
){
$uModel
=
(
new
\app\em\model\Useage
())
->
get
([
'useage_id'
=>
$useage_id
]);
$uModel
=
(
new
\app\em\model\Useage
())
->
get
([
'useage_id'
=>
$useage_id
]);
if
(
!
$uModel
)
return
json
([
'status'
=>
0
,
'message'
=>
"不存在的抄表单号,请联系管理员"
]);
if
(
!
$uModel
)
return
json
([
'status'
=>
0
,
'message'
=>
"不存在的抄表单号,请联系管理员"
]);
if
(
$uModel
->
status
==
2
)
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
)
$lastModel
=
(
new
\app\em\model\Useage
())
->
where
(
'em_id'
,
'='
,
$uModel
->
em_id
)
->
order
(
'id desc'
)
->
find
();
->
order
(
'id desc'
)
->
find
();
if
(
$lastModel
->
status
==
2
)
return
json
([
'status'
=>
0
,
'message'
=>
"单号不是最新的抄表记录且最新的抄表记录已经审核无法
修改
,请联系管理员"
]);
if
(
$lastModel
->
status
==
2
)
return
json
([
'status'
=>
0
,
'message'
=>
"单号不是最新的抄表记录且最新的抄表记录已经审核无法
操作
,请联系管理员"
]);
if
(
$uModel
->
id
!=
$lastModel
->
id
){
if
(
$uModel
->
id
!=
$lastModel
->
id
){
return
json
([
'status'
=>
0
,
'message'
=>
"抄表单号不是最新的抄表记录
,无法修改
,请联系管理员"
]);
return
json
([
'status'
=>
0
,
'message'
=>
"抄表单号不是最新的抄表记录
无法操作
,请联系管理员"
]);
}
}
return
true
;
}
}
...
...
application/em/model/Useage.php
浏览文件 @
497f8467
...
@@ -53,8 +53,13 @@ class Useage extends Base
...
@@ -53,8 +53,13 @@ class Useage extends Base
foreach
(
$data
as
$k
=>
$v
){
foreach
(
$data
as
$k
=>
$v
){
$data
[
$k
][
'repo_numb'
]
=
round
(
round
(
$v
[
'current_sum_numb'
]
-
$v
[
'last_sum_numb'
],
2
)
*
$v
[
'rate'
],
2
);
$data
[
$k
][
'repo_numb'
]
=
round
(
round
(
$v
[
'current_sum_numb'
]
-
$v
[
'last_sum_numb'
],
2
)
*
$v
[
'rate'
],
2
);
if
(
$v
[
'status'
]
==
3
){
$info
=
(
new
EmCheckBill
())
->
field
(
'info'
)
->
get
([
'mode_id'
=>
$v
[
'useage_id'
]]);
$data
[
$k
][
'info'
]
=
$info
[
'info'
];
}
}
}
return
$data
;
return
$data
;
}
}
public
function
getCopyListCount
(
$map
){
public
function
getCopyListCount
(
$map
){
$data
=
self
::
alias
(
'ue'
)
$data
=
self
::
alias
(
'ue'
)
...
...
application/em/validate/UseageGeneralInfoValidate.php
浏览文件 @
497f8467
...
@@ -30,7 +30,7 @@ class UseageGeneralInfoValidate extends Validate
...
@@ -30,7 +30,7 @@ class UseageGeneralInfoValidate extends Validate
];
];
protected
$scene
=
[
protected
$scene
=
[
's1'
=>
'em_id,last_numb,last_date,current_numb,current_date,photo_id,staff_id'
,
's1'
=>
'em_id,last_numb,last_date,current_numb,current_date,photo_id,staff_id
,price
'
,
's2'
=>
'em_id,last_numb,last_date,current_numb,current_date,photo_id,staff_id,price'
,
's2'
=>
'em_id,last_numb,last_date,current_numb,current_date,photo_id,staff_id,price'
,
];
];
...
...
application/em/view/useage/default.html
浏览文件 @
497f8467
...
@@ -205,7 +205,7 @@
...
@@ -205,7 +205,7 @@
</div>
</div>
{if $detail == false}
{if $detail == false}
<div
class=
"layui-form-item layui-col-md-offset4"
>
<div
class=
"layui-form-item layui-col-md-offset4"
>
<a
href=
"/
em
"
class=
"layui-btn"
>
<a
href=
"/
useage/
"
class=
"layui-btn"
>
返回
返回
</a>
</a>
<button
class=
"layui-btn"
lay-filter=
"save"
lay-submit=
""
>
<button
class=
"layui-btn"
lay-filter=
"save"
lay-submit=
""
>
...
...
application/em/view/useage/detail.html
浏览文件 @
497f8467
...
@@ -217,13 +217,6 @@
...
@@ -217,13 +217,6 @@
{block name="js"}
{block name="js"}
<script>
<script>
//限制输入长度
function
sliceDom
(
dom
,
len
){
if
(
dom
.
value
.
length
>
len
)
return
dom
.
value
=
dom
.
value
.
slice
(
0
,
len
)
}
//初始化Layui控件
//初始化Layui控件
layui
.
use
([
'form'
,
'layer'
,
'laydate'
,
'upload'
],
layui
.
use
([
'form'
,
'layer'
,
'laydate'
,
'upload'
],
function
()
{
function
()
{
...
@@ -251,11 +244,11 @@
...
@@ -251,11 +244,11 @@
dataType
:
"json"
,
dataType
:
"json"
,
success
:
function
(
data
)
{
success
:
function
(
data
)
{
if
(
data
.
status
==
1
)
{
if
(
data
.
status
==
1
)
{
layer
.
msg
(
data
.
message
,{
icon
:
6
,
time
:
2
000
},
function
(){
layer
.
msg
(
data
.
message
,{
icon
:
6
,
time
:
3
000
},
function
(){
window
.
location
.
href
=
'/useage'
;
window
.
location
.
href
=
'/useage'
;
})
})
}
else
{
}
else
{
layer
.
msg
(
data
.
message
||
data
.
msg
,{
icon
:
5
,
time
:
1
000
})
layer
.
msg
(
data
.
message
||
data
.
msg
,{
icon
:
5
,
time
:
3
000
})
window
.
location
.
href
=
'/useage'
;
window
.
location
.
href
=
'/useage'
;
}
}
}
}
...
@@ -272,7 +265,7 @@
...
@@ -272,7 +265,7 @@
layer
.
open
({
layer
.
open
({
type
:
1
,
type
:
1
,
title
:
'填写驳回理由'
,
title
:
'填写驳回理由'
,
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>'
,
btn
:
"提交"
,
btn
:
"提交"
,
yes
:
function
(){
yes
:
function
(){
$data
.
field
.
checkType
=
2
;
$data
.
field
.
checkType
=
2
;
...
@@ -284,12 +277,11 @@
...
@@ -284,12 +277,11 @@
dataType
:
"json"
,
dataType
:
"json"
,
success
:
function
(
data
)
{
success
:
function
(
data
)
{
if
(
data
.
status
==
1
)
{
if
(
data
.
status
==
1
)
{
layer
.
msg
(
data
.
message
,{
icon
:
6
,
time
:
2
000
},
function
(){
layer
.
msg
(
data
.
message
,{
icon
:
6
,
time
:
4
000
},
function
(){
window
.
location
.
href
=
'/useage'
;
window
.
location
.
href
=
'/useage'
;
})
})
}
else
{
}
else
{
layer
.
msg
(
data
.
message
||
data
.
msg
,{
icon
:
5
,
time
:
1000
})
layer
.
msg
(
data
.
message
||
data
.
msg
,{
icon
:
5
,
time
:
5000
})
window
.
location
.
href
=
'/useage'
;
}
}
}
}
});
});
...
...
application/em/view/useage/index.html
浏览文件 @
497f8467
...
@@ -95,18 +95,19 @@
...
@@ -95,18 +95,19 @@
{{
#
if
(
d
.
status
==
2
){
}}
{{
#
if
(
d
.
status
==
2
){
}}
<
span
class
=
"layui-bg-blue"
>
已审核
<
/span
>
<
span
class
=
"layui-bg-blue"
>
已审核
<
/span
>
{{
#
}
}}
{{
#
}
}}
{{
#
if
(
d
.
status
==
3
)
{
}}
<
span
class
=
"layui-bg-orange"
title
=
"{{ d.info.info }}"
>
被驳回
<
/span
>
{{
#
if
(
d
.
status
==
3
){
}}
<
span
class
=
"layui-bg-orange"
title
=
"{{ d.info }}"
>
被驳回
<
/span
>
{{
#
}
}}
{{
#
}
}}
{{
#
if
(
d
.
status
<
2
)
{
}}
{{
#
if
(
d
.
status
<
2
){
}}
<
span
class
=
"layui-bg-green"
title
=
"{{ d.info.info }}"
>
未审核
<
/span
>
<
span
class
=
"layui-bg-green"
>
未审核
<
/span
>
{{
#
}
}}
{{
#
}
}}
</script>
</script>
{if $admin == true}
{if $admin == true}
<script
type=
"text/html"
id=
"barDemo"
>
<script
type=
"text/html"
id=
"barDemo"
>
{{
#
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"
lay
-
event
=
"update
"
>
编辑
<
/a
>
<
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-btn-danger"
lay
-
event
=
"del"
>
删除
<
/a
>
<
a
title
=
"删除"
class
=
"layui-btn layui-btn-sm layui-btn-danger"
lay
-
event
=
"del"
>
删除
<
/a
>
{{
#
}
}}
{{
#
}
}}
</script>
</script>
...
@@ -138,13 +139,13 @@
...
@@ -138,13 +139,13 @@
dataType
:
"json"
,
dataType
:
"json"
,
success
:
function
(
data
)
{
success
:
function
(
data
)
{
if
(
data
.
status
==
1
){
if
(
data
.
status
==
1
){
layer
.
msg
(
data
.
message
,{
icon
:
6
,
time
:
2
000
},
function
(){
layer
.
msg
(
data
.
message
,{
icon
:
6
,
time
:
4
000
},
function
(){
obj
.
del
();
obj
.
del
();
layer
.
close
(
index
);
layer
.
close
(
index
);
location
.
reload
()
location
.
reload
()
})
})
}
else
{
}
else
{
layer
.
msg
(
data
.
message
,{
icon
:
5
,
time
:
1
000
})
layer
.
msg
(
data
.
message
,{
icon
:
5
,
time
:
5
000
})
}
}
}
}
});
});
...
...
application/em/view/useage/update.html
0 → 100644
浏览文件 @
497f8467
差异被折叠。
点击展开。
route/admin.php
浏览文件 @
497f8467
...
@@ -147,7 +147,7 @@ Route::get('useage/:useage_id','em/useage/detail');
...
@@ -147,7 +147,7 @@ Route::get('useage/:useage_id','em/useage/detail');
Route
::
get
(
'useage_add/:id'
,
'em/useage/create'
);
Route
::
get
(
'useage_add/:id'
,
'em/useage/create'
);
Route
::
post
(
'useage_add'
,
'em/useage/store'
);
Route
::
post
(
'useage_add'
,
'em/useage/store'
);
Route
::
post
(
'useage_del'
,
'em/useage/del'
);
Route
::
post
(
'useage_del'
,
'em/useage/del'
);
Route
::
post
(
'useage_update
'
,
'em/useage/update'
);
Route
::
get
(
'useage_update/:useage_id
'
,
'em/useage/update'
);
Route
::
post
(
'upFile'
,
'em/UploadFile/upFile'
);
Route
::
post
(
'upFile'
,
'em/UploadFile/upFile'
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论