提交 f20e95f4 authored 作者: wangkr's avatar wangkr

update

上级 d2eee4bb
config/cache.php merge=ours
config/admin.php merge=ours
config/session.php merge=ours
config/admin.php merge=ours
......@@ -17,3 +17,5 @@
/public/dist2
/public/static/uploads
/public/static/xadmin
/config/jz.php
/config/cookie.php
......@@ -47,12 +47,9 @@ class Base extends Controller
private function authCheck($user_id){
//通过uid查询roleid通过roleid查询权限列表
$permissions = StaffRoleModel::getStaffRolesById($user_id);
$permissions = explode(',',$permissions);
//获取当前访问路由
$path = Request::pathinfo() ?: '/';
if($path !== '/'){
//检测是否存在数字,如果存在数字则删除最后一个/之后的所有数据
if(preg_match('/[0-9]+/',$path)){
......
......@@ -484,13 +484,13 @@ class Basestation extends Base
public function basestation_map(Request $request){
$id= $request->get('station_name');
$db = Db::connect([
'type' => 'mysql',
'hostname' => '127.0.0.1',
'database' => 'jzdb',
'username' => 'root',
'password' => 'pvv5718J0CwhNfn4B^8^H3igPj#oiQkX',
'hostport' => '10036',
'charset' => 'utf8',
'type' => config('jz.jztype'),
'hostname' => config('jz.jzhostname'),
'database' => config('jz.jzdatabase'),
'username' => config('jz.jzusername'),
'password' => config('jz.jzpassword'),
'hostport' =>config('jz.jzhostport'),
'charset' => config('jz.jzcharset'),
]);
$data=$db->table('jz_message')->field('business_id')->where(['jz_name'=>$id])->find();
$this->assign('data',$data['business_id']);
......@@ -499,13 +499,13 @@ class Basestation extends Base
public function basestation_region(Request $request){
$db = Db::connect([
'type' => 'mysql',
'hostname' => '127.0.0.1',
'database' => 'jzdb',
'username' => 'root',
'password' => 'pvv5718J0CwhNfn4B^8^H3igPj#oiQkX',
'hostport' => '10036',
'charset' => 'utf8',
'type' => config('jz.jztype'),
'hostname' => config('jz.jzhostname'),
'database' => config('jz.jzdatabase'),
'username' => config('jz.jzusername'),
'password' => config('jz.jzpassword'),
'hostport' =>config('jz.jzhostport'),
'charset' => config('jz.jzcharset'),
]);
$data['business_id']= $request->get('station_id');
if(empty($data['business_id'])){
......
......@@ -20,7 +20,8 @@ class Login extends Controller
{
public function index()
{
echo '<script type="text/javascript">top.location.href="http://oa.gonn.com.cn/";</script>';
$baseUrl = config('admin.base_url');
echo '<script type="text/javascript">top.location.href="'.$baseUrl.'";</script>';
}
public function login(Request $request,LoginValidate $validate)
......
......@@ -5,22 +5,17 @@
* Date: 2020-3-22
* Time: 19:03
*/
namespace app\admin\controller;
use app\admin\model\StaffModel;
use think\Exception;
use think\facade\Cookie;
class SingleSign {
public $instence = null;
public function __construct($ip='192.168.1.222',$port=6379){
public function __construct(){
if($this->instence === null){
$redis = new \Redis();
$res = $redis->connect($ip,$port);
$res = $redis->connect(config('admin.redis_host'),config('admin.redis_port'));
if($res) $this->instence = $redis;
else throw new Exception("redis connect faild");
}
......@@ -30,20 +25,15 @@ class SingleSign {
public function getSid($prex = 'PHPREDIS_SESSION:'){
$sid = Cookie::get('PHPSESSID');
$sid = $prex.$sid;
$str = $this->instence->get($sid);
if(!$str) throw new Exception("session info not found");
return $str;
}
//从session中读取信息
public function getUserInfo(){
$str = $this->getSid();
$pos = stripos($str,'is_admin|b:') + 11;
$pos = stripos($str,'isadmin|i:') + 10;
$isAdmin = substr($str,$pos,1);
$user['is_admin'] = $isAdmin;
......@@ -51,7 +41,6 @@ class SingleSign {
$user['username'] = 'gonnadmin';
} else {
preg_match('/adminuser\|s\:(\d+)\:/',$str,$match);
if($match){
$pos = stripos($str,'adminuser|s:') + strlen('adminuser|s:');
$pos += strlen($match[1]) + 2;
......@@ -59,14 +48,12 @@ class SingleSign {
}
}
$pos = stripos($str,'ukey|s:10:') + 11;
$ukey = substr($str,$pos,10);
$user['ukey'] = $ukey;
preg_match('/[\x80-\xff]+/',$str,$matchb);
if($matchb) $user['name'] = $matchb[0];
return $user;
}
......
......@@ -97,19 +97,19 @@
<script type="text/javascript">
var map = new BMap.Map("allmap", {enableMapClick: false}); // 创建Map实例
var map = new BMap.Map("allmap", {enableMapClick: false}); // 创建Map实例
map.centerAndZoom(new BMap.Point(116.404, 39.915), 14); // 初始化地图,设置中心点坐标和地图级别
//添加地图类型控件
map.addControl(new BMap.MapTypeControl({
mapTypes: [
BMAP_NORMAL_MAP,
BMAP_HYBRID_MAP
BMAP_NORMAL_MAP,
BMAP_HYBRID_MAP
]
}));
}));
map.setCurrentCity("北京"); // 设置地图显示的城市 此项是必须设置的
map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
layui.use(['form', 'layer', 'laydate', 'upload'],
layui.use(['form', 'layer', 'laydate', 'upload'],
function () {
$ = layui.jquery;
var form = layui.form,
......
......@@ -27,7 +27,7 @@
<tbody>
{foreach $data as $item}
<tr>
<td>{$item.name}</td>
<td>{$item.department.name|default='广厦网络'}</td>
<td>
......@@ -42,9 +42,7 @@
<a title="设置数据权限" onclick="xadmin.open('数据权限配置','/staff_role_department/{$item.id}')" href="javascript:;">
<i class="layui-icon iconfont">&#xe70c;</i>
</a>
<!-- <a title="删除" onclick="member_del(this,'{$item.id}')" href="javascript:;">
<i class="layui-icon">&#xe640;</i>
</a> -->
</td>
</tr>
{/foreach}
......@@ -62,55 +60,14 @@
<script src="dist/js/md5.js"></script>
<script src="dist/js/sha1.js"></script>
<script src="dist/js/util.js"></script>
<script src="dist/js/getUserToken.js"></script>
<<<<<<< HEAD
<!--<script src="dist/js/getUserToken.js"></script>-->
=======
<!-- <script src="dist/js/getUserToken.js"></script> -->
>>>>>>> test
<script>
layui.use(['laydate','form','upload'], function(){
var laydate = layui.laydate;
var form = layui.form;
upload = layui.upload;
//执行一个laydate实例
laydate.render({
elem: '#start' //指定元素
});
//执行一个laydate实例
laydate.render({
elem: '#end' //指定元素
});
var EmImport = upload.render({
elem: '#EmImport' ,
url: '/basestation_import',
accept:'file',
field: 'file_name',
done: function (res) {
if(res.status == 1){
layer.open({
content: res.message,
btn: ['确定'],
yes: function() {
layer.closeAll();
window.location.reload();
}
});
}
if(res.status == 0){
layer.open({
content: res.message,
btn: ['确定'],
yes: function() {
layer.closeAll();
window.location.reload();
}
});
}
else {
//layMsg(res.message,5)
return;
}
}
});
});
......
{extend name="public:form" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<form class="layui-form">
</form>
</div>
<div class="layui-card-header">
<button class="layui-btn" onclick="synUser()" id="sameIsadmin"><i class="layui-icon layui-icon-refresh"></i>同步</button>
<button class="layui-btn" id="EmImport">
<i class="layui-icon iconfont">&#xe7e4;</i></button>
</div>
<div class="layui-card-body ">
<table class="layui-table layui-form">
<thead>
<tr>
<th>姓名</th>
<th>部门</th>
<th>角色权限</th>
<th>操作</th>
</thead>
<tbody>
{foreach $data as $item}
<tr>
<td>{$item.name}</td>
<td>{$item.department.name|default='广厦网络'}</td>
<td>
{volist name="$item.roles" id="role" empty="$empty"}
[{$role.title}]
{/volist}
</td>
<td class="td-manage">
<a title="设置功能权限" onclick="xadmin.open('设置功能权限','/staff_role_edit/{$item.id}')" href="javascript:;">
<i class="layui-icon">&#xe642;</i>
</a>
<a title="设置数据权限" onclick="xadmin.open('数据权限配置','/staff_role_department/{$item.id}')" href="javascript:;">
<i class="layui-icon iconfont">&#xe70c;</i>
</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</body>
<script src="dist/js/api.js"></script>
<script src="dist/js/layer.js"></script>
<script src="dist/js/md5.js"></script>
<script src="dist/js/sha1.js"></script>
<script src="dist/js/util.js"></script>
<script src="dist/js/getUserToken.js"></script>
<script>
layui.use(['laydate','form','upload'], function(){
var laydate = layui.laydate;
var form = layui.form;
upload = layui.upload;
//执行一个laydate实例
laydate.render({
elem: '#start' //指定元素
});
//执行一个laydate实例
laydate.render({
elem: '#end' //指定元素
});
var EmImport = upload.render({
elem: '#EmImport' ,
url: '/basestation_import',
accept:'file',
field: 'file_name',
done: function (res) {
if(res.status == 1){
layer.open({
content: res.message,
btn: ['确定'],
yes: function() {
layer.closeAll();
window.location.reload();
}
});
}
if(res.status == 0){
layer.open({
content: res.message,
btn: ['确定'],
yes: function() {
layer.closeAll();
window.location.reload();
}
});
}
else {
//layMsg(res.message,5)
return;
}
}
});
});
/*用户-停用*/
function member_stop(obj,id){
layer.confirm('确认要停用吗?',function(index){
if($(obj).attr('title')=='启用'){
//发异步把用户状态进行更改
$(obj).attr('title','停用')
$(obj).find('i').html('&#xe62f;');
$(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
layer.msg('已停用!',{icon: 5,time:1000});
}else{
$(obj).attr('title','启用')
$(obj).find('i').html('&#xe601;');
$(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
layer.msg('已启用!',{icon: 5,time:1000});
}
});
}
/*用户-删除*/
function member_del(obj,id){
layer.confirm('确认要删除吗?',function(index){
//发异步删除数据
var url = '/staff_role_del';
$.ajax({
url: url,
method: "POST",
data: {id:id},
dataType: "json",
success: function (data) {
if(data.status == 1){
layer.msg(data.message,{icon:1,time:1000});
location.reload()
} else {
layer.alert(data.message, {
icon: 5
});
}
},
error : function (XMLHttpRequest, textStatus, errorThrow ) {
console.log('AJAX 执行删除失败...');
}
});
});
}
function delAll (argument) {
var data = tableCheck.getData();
layer.confirm('确认要删除吗?'+data,function(index){
//捉到所有被选中的,发异步进行删除
layer.msg('删除成功', {icon: 1});
$(".layui-form-checked").not('.header').parents('tr').remove();
});
}
function synUser() {
layer.confirm('确定要同步吗?', {skin: 'layui-layer-lan',btn:['取消','确认'],icon: 3, title:'提示'},
function(index,layero){
layer.close(index);
},
function(index,layero){
var indexload = layer.load(0, {
shade: [0.7,'#fff'] //0.7透明度的白色背景
});
let time = Math.round(new Date().getTime()/1000);
let app_secret = '4d8e605fa7ed546c4bcb33dee1381179';
let serverAuthenticateStaticKey= 'de5kio2f';
var temp = hex_sha1(app_secret+time+serverAuthenticateStaticKey);
var sign= hex_md5(temp);
util.ajax({
type:'get',
dataType: 'json',
url: util.interfaceUrl + interfacenName.synSuser ,
data: {
timestamp:time,
sign: sign
},
success: (res) => {
if(res.code == "200"){
setTimeout(function () {
layer.close(indexload)
},1500)
layer.msg("同步成功")
} else {
setTimeout(function () {
layer.close(indexload)
},1500)
layer.msg(res.message)
}
},
error:function (err) {
layer.msg('网络接口异常')
}
});
})
}
</script>
{/block}
\ No newline at end of file
......@@ -124,6 +124,55 @@ class BasicInfor
'data' => $basestates
]);
}
//获取项目数据权限
public function getDataPermission(){
$uid = request()->get('uid');
//查找数据权限规则表
$map=[];
$permission=db::name('permission_data')->field('permission_ids')->where(['s_id'=>$uid])->find();
$arr= json_decode($permission['permission_ids'],true);
if($arr['department_id']){
$department_ids=strpos($arr['department_id'],',');
if($department_ids===false){
$map[]=['department_id','=', $arr['department_id']];
}else{
$map[]=['department_id','in',$arr['department_id']];
}
}
if($arr['region_id']){
$area_ids=strpos($arr['region_id'],',');
if($area_ids===false){
$map[]=['area_id','=', $arr['region_id']];
}else{
$map[]=['area_id','in',$arr['region_id']];
}
}
if($arr['business_id']){
$business_ids=strpos($arr['business_id'],',');
if($business_ids===false){
$map[]=['business_line_id','=', $arr['business_id']];
}else{
$map[]=['business_line_id','in',$arr['business_id']];
}
}
//如果数据规则表不存在数据信息 ,默认返回此用户的部门id
if(!$map){
$staff = db::name('staff')->field('d_id')->where(['id'=>$uid])->find();
if($staff && $staff['d_id']!==0){
$map[]=['department_id','=',$staff['d_id']];
}
}
return json([
'code' => 200,
'message' => 'SUCCESS',
'data' => $map
]);
}
static function getBasestateTree($array, $pid =0, $level = 0){
......
......@@ -80,4 +80,10 @@ class Assign
return (new BasicInfor)->getBasestate();
}
public function getDataPermission($uid){
$this->token->check();
return (new BasicInfor)->getDataPermission($uid);
}
}
\ No newline at end of file
<?php
use app\admin\model\PermissionModel;
use app\admin\model\StaffRoleModel;
use think\db;
use think\facade\Session;
function check_data(){
$user = session('user');
......@@ -341,3 +345,23 @@ function getInvoicesStatusName($statusCode,$index=0){
}
}
}
//检测元素与按钮权限
function check_ele_permission($path){
$user = Session::get('user');
//获取当前用户的所有权限id
$permissions = StaffRoleModel::getStaffRolesById($user['user_id']);
$permissions = explode(',',$permissions);
//查询$path所对应id
$permission = PermissionModel::field('id,nav_url')->get(['nav_url'=>$path]);
if(isset($permission->id)){
if(!in_array($permission->id,$permissions) || $permission == null){
return false;
}
return true;
}
return false;
}
\ No newline at end of file
......@@ -212,7 +212,7 @@ class Invoice extends Base
//缴费信息
$inv->payment_amount = $inv->payment_balance = $amount * $uData['rate'];
//结算信息
$inv->settle_amount = $inv->settle_balance = $repo_numb * $uData['settle_price'];
$inv->settle_amount = $inv->settle_balance = $repo_numb * $uData['rate'] *$uData['settle_price'];
$inv->status = '000';
$inv->invoice_id = $this->getInvoiceId();
......
<?php
namespace app\em\controller;
use app\admin\controller\Base;
use app\em\model\EmInvoice;
use app\em\model\EmPaymentReceipt;
use app\em\model\EmReceiptType;
use app\em\validate\AddReceiptValidate;
use think\facade\Request;
/**
* 缴费发票
* Class Receipt
* @package app\em\controller
*/
class Receipt extends Base
{
//显示缴费凭证表单
public function create(){
$payment_id = Request::param('payment_id');
//将缴费应缴金额传递给模板
$balance = (new EmInvoice())->alias('ei')
->leftJoin(['em_payment_invoice'=>'epi'],'epi.invoice_id=ei.invoice_id')
->where('epi.payment_id','=',$payment_id)
->where('ei.payment_balance','>',0)
->sum('ei.payment_balance');
$this->assign('balance',$balance?:0);
$this->assign('payment_id',$payment_id);
$types = EmReceiptType::select();
$this->assign('types',$types);
return $this->fetch();
}
public function store(){
$data = Request::post();
$validata = new AddReceiptValidate();
if(!$validata->check($data)){
return json(['status'=>0,'message'=>$validata->getError()]);
}
//获取certId
$data['receipt_id'] = $this->createReceiptId();
//保存凭证
$receiptModel = new EmPaymentReceipt();
if($receiptModel->save($data)){
//更新缴费单状态
return json(['status'=>1,'message'=>'上传发票成功']);
} else {
return json(['status'=>0,'message'=>'添加发票失败']);
}
}
//查看列表
public function receipts(){
$payment_id = Request::param('payment_id');
$list = EmPaymentReceipt::with('file,types')->where('payment_id','=',$payment_id)->order('receipt_id asc')->select();
foreach ($list as &$item){
if(!empty($item->file->src)){
$item->file->src = ltrim($item->file->src,'.');
}
}
$this->assign('data',$list);
return $this->fetch('list');
}
//创建凭证id
private function createReceiptId(){
$epr = EmPaymentReceipt::field('id')->order('id desc,create_time desc')->find();
if(!$epr) $id = 1;
else $id = $epr->id + 1;
return "RT".date('Ymd').zero($id);
}
}
\ No newline at end of file
差异被折叠。
差异被折叠。
......@@ -59,54 +59,17 @@ class Em extends Base
}
//如果没有超过表 不论是峰谷表还是普通表 都是空的
if(!$ue) {
//如果不是详情页
$em->last_date = $em->init_date;
$em->last_numb = $em->init_numb;
//如果是峰谷表 初始化
if($em->rule->pricing_type == 2) {
$em->last_sum_numb = 0;
$ulist[] = ['typeName' => '尖峰段', 'last_numb' => 0, 'current_numb' => ''];
$ulist[] = ['typeName' => '峰段', 'last_numb' => 0, 'current_numb' => ''];
$ulist[] = ['typeName' => '谷段', 'last_numb' => 0, 'current_numb' => ''];
$ulist[] = ['typeName' => '平段', 'last_numb' => 0, 'current_numb' => ''];
} else {
$ulist[] = ['typeName' => '普通', 'last_numb' => 0, 'current_numb' => ''];
$em->last_sum_numb = $em->init_numb;
}
$em->useage = $ulist;
//历史抄表
if($em->rule->settle_type==1){
$em->is_history = 1;
}
$ue = new Useage();
$ue->last_date = $em->init_date;
$ue->last_sum_numb = $em->init_numb ?: 0;
} else {
$em->last_date = $ue->current_date;
$em->last_sum_numb = $ue->current_sum_numb;
$fields = 'last_numb,current_numb,price';
if($em->rule->pricing_type == 2){
$ulist = UseageDetail
::field('case type
when 1 then "尖峰段"
when 2 then "峰段"
when 3 then "谷段"
when 4 then "平段"
else "普通" end as typeName
')
->field($fields)
->where(['useage_id'=>$ue->useage_id])->select();
foreach ($ulist as &$u){
$u->last_numb = $u->current_numb;
$u->current_numb = '';
$u->price = '';
}
$em->useage = $ulist;
if($curr == false){
$ue->last_sum_numb = $ue->current_sum_numb;
$ue->last_date = $ue->current_date;
}
$em->photo = $ue->photo;
}
$ue->price = $em->rule->pricing_type==1 ? $em->rule->pay_price : '';
$em->useage = $ue;
return $em;
}
......
<?php
namespace app\em\model;
class EmCheckBill extends Base
{
}
\ No newline at end of file
......@@ -45,6 +45,7 @@ class EmInvoice extends Base
->select()
->toarray();
$step = 100000;
foreach ($data as &$item){
if($item['payment_balance'] == 0){
......@@ -58,6 +59,8 @@ class EmInvoice extends Base
} else {
$item['sett_amount'] = round($item['settle_amount'] - $item['settle_balance'],3);
}
$item['repo_numb'] = ($item['current_sum_numb'] * $step - $item['last_sum_numb'] * $step ) * $item['rate'] / $step;
}
return $data;
}
......
......@@ -53,8 +53,13 @@ class Useage extends Base
foreach ($data as $k => $v){
$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){
$data = self::alias('ue')
......@@ -107,4 +112,8 @@ class Useage extends Base
public function em(){
return $this->belongsTo('Em','em_id','id');
}
public function info(){
return $this->HasOne('EmCheckBill','useage_id','useage_id');
}
}
\ No newline at end of file
......@@ -12,11 +12,8 @@ class UseageGeneralInfoValidate extends Validate
'current_date' => 'require|date|checkDate',
'photo_id' => 'require',
'staff_id' => 'require',
'uType1_current_numb' => 'require', //波峰
'uType2_current_numb' => 'require', //峰
'uType3_current_numb' => 'require', //谷
'amount' =>'require' //账单金额
'price' => 'require',
'amount' =>'require'
];
protected $message = [
......@@ -28,15 +25,13 @@ class UseageGeneralInfoValidate extends Validate
'current_date.date' => '本次抄表日期格式不正确',
'photo_id.require' => '请上传电表照片',
'staff_id.require' => '请选择抄表员',
'uType1_current_numb.require' => '请填写波峰数据',
'uType2_current_numb.require' => '请填写峰数据',
'uType3_current_numb.require' => '请填写波谷数据',
'price' => '单价必填且只能是数字或小数',
'amount.require' =>'缴费金额未填写'
];
protected $scene = [
's1' => 'em_id,last_numb,last_date,current_numb,current_date,photo_id,staff_id',
's2' => 'em_id,photo_id,staff_id,uType1_current_numb,uType2_current_numb,uType3_current_numb',
'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',
];
protected function checkDate($value,$rule,$data=[]){
......
File mode changed from 100644 to 100755
......@@ -75,7 +75,7 @@
<th lay-data="{field:'station_name',sort: true}">所属基站名</th>
<th lay-data="{templet:'#em_numb',sort: true} ">所属电表号</th>
<th lay-data="{templet: '#useage'}">抄表度数</th>
<th lay-data="{templet: '#repo_numb'}">用电量</th>
<th lay-data="{field: 'repo_numb'}">用电量</th>
<th lay-data="{templet:'#payment'}">缴费金额</th>
<th lay-data="{templet:'#settle'}">结算金额</th>
<th lay-data="{field: 'status'}">账单状态</th>
......
差异被折叠。
......@@ -151,7 +151,19 @@
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label">
单价
</label>
<div class="layui-input-inline">
<input type="text" id="price" name="price" autocomplete="off" class="layui-input" disabled="disabled" value="{$useage.price}">
</div>
<div class="layui-form-mid layui-word-aux">
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
......@@ -187,12 +199,17 @@
</div>
</div>
</div>
{if $useage.status != 2}
<div class="layui-form-item layui-col-md-offset4">
<button class="layui-btn" lay-filter="check" lay-submit="">
审核
</button>
</div>
{if $useage.status < 2}
{if check_ele_permission('useage/check') }
<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}
{/if}
</form>
</div>
......@@ -202,21 +219,12 @@
{block name="js"}
<script>
//限制输入长度
function sliceDom(dom,len){
if(dom.value.length>len)
return dom.value = dom.value.slice(0,len)
}
//初始化Layui控件
layui.use(['form', 'layer', 'laydate', 'upload'],
function () {
$ = layui.jquery;
var form = layui.form,
layer = layui.layer;
//消息提示
function layMsg(msg,type=6,time=1000){
layer.msg(msg,{
......@@ -226,10 +234,11 @@
}
//保存抄表单,并且返回列表
form.on('submit(check)',
form.on('submit(pass)',
function (data) {
$(this).addClass('layui-disabled');
$(this).attr('disabled','disabled');
data.checkType = 1;
$.ajax({
url: '/useage/check',
method: "POST",
......@@ -237,17 +246,57 @@
dataType: "json",
success: function (data) {
if (data.status == 1) {
layer.msg(data.message,{icon: 6,time: 2000},function(){
layer.msg(data.message,{icon: 6,time: 3000},function(){
window.location.href='/useage';
})
} else {
layer.msg(data.msg,{icon: 5,time: 1000 })
layer.msg(data.message || data.msg,{icon: 5,time: 3000 })
window.location.href='/useage';
}
}
});
return false;
});
form.on('submit(refuse)',
function (data) {
var $that = $(this)
var $data = data;
$that.addClass('layui-disabled');
$that.attr('disabled','disabled');
layer.open({
type: 1,
title:'填写驳回理由',
content: '<div class="layui-form-item"><div style="padding:15px;"><textarea placeholder="驳回理由" class="layui-textarea" id="refuseInfo" name="refuseInfo"></textarea></div>',
btn:"提交",
yes: function(){
$data.field.checkType = 2;
$data.field.refuseInfo = $('#refuseInfo').val();
$.ajax({
url: '/useage/check',
method: "POST",
data: $data.field,
dataType: "json",
success: function (data) {
if (data.status == 1) {
layer.msg(data.message,{icon: 6,time: 4000},function(){
window.location.href='/useage';
})
} else {
layer.msg(data.message || data.msg,{icon: 5,time: 5000 })
}
}
});
},
end:function(){
$that.removeClass('layui-disabled');
$that.removeAttr('disabled');
layer.closeAll();
}
});
return false;
});
});
</script>
{/block}
\ No newline at end of file
......@@ -151,6 +151,20 @@
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label">
单价
</label>
<div class="layui-input-inline">
<input type="text" id="price" name="price" autocomplete="off" class="layui-input" disabled="disabled" value="{$useage.price}">
</div>
<div class="layui-form-mid layui-word-aux">
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label">
......@@ -182,28 +196,7 @@
</div>
</div>
</div>
<div class="layui-col-md10" style="padding:0 130px 0 30px;margin-bottom: 20px;">
<table class="layui-table layui-form">
<thead>
<tr>
<th>阶段</th>
<th>上期表数</th>
<th>本期表数</th>
<th>单价</th>
</thead>
<tbody>
{volist name="useage_detail" id="item"}
<tr>
<td>{$item.typeName}</td>
<td><input type="text" class="no-border" name="uType{$i}_last_numb" value="{$item.last_numb}" disabled="disabled"></td>
<td><input type="text" class="no-border current_numb" name="uType{$i}_current_numb" value="{$item.current_numb|default=''}" disabled="disabled"></td>
<td><input type="text" class="no-border" name="uType{$i}_price" value="{$item.price|default=''}" disabled="disabled"></td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
</div>
......
......@@ -28,6 +28,8 @@
<option value="0" selected="selected" {if $status eq 0 } selected {/if}>全部</option>
<option value="1" {if $status eq 1 } selected {/if}>未审核</option>
<option value="2" {if $status eq 2 } selected {/if}>已审核</option>
<option value="3" {if $status eq 3 } selected {/if}>被驳回</option>
</select>
</div>
<div class="layui-input-inline" style="width:150px;">
......@@ -55,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} }">
<thead>
<tr>
<th lay-data="{templet: '#useage_id',sort: true} ">抄表单号</th>
<th lay-data="{field:'station_name'}">所属基站名</th>
<th lay-data="{field:'em_numb'} ">所属电表号</th>
<th lay-data="{field:'last_date',sort: true}">上次日期</th>
<th lay-data="{field:'current_date',sort: true}">本次日期</th>
<th lay-data="{templet: '#useage_id',sort: true,width:'12%'} ">抄表单号</th>
<th lay-data="{field:'station_name',width:'12%'}">所属基站名</th>
<th lay-data="{field:'em_numb',width:'8%'} ">所属电表号</th>
<th lay-data="{field:'last_date',sort: true,width:'9%'}">上次日期</th>
<th lay-data="{field:'current_date',sort: true,width:'9%'}">本次日期</th>
<th lay-data="{field:'last_sum_numb'}">上次度数</th>
<th lay-data="{field:'current_sum_numb'}">本次度数</th>
<th lay-data="{field:'repo_numb'}">用电量</th>
<th lay-data="{templet: '#status',sort: true}">状态</th>
<th lay-data="{field:'last_sum_numb',width:'7%'}">上次度数</th>
<th lay-data="{field:'current_sum_numb',width:'7%'}">本次度数</th>
<th lay-data="{field:'repo_numb',width:'7%'}">用电量</th>
<th lay-data="{templet: '#status',sort: true,width:'5%'}">状态</th>
<th lay-data="{templet: '#photo_id',sort: true}">抄表凭证</th>
<th lay-data="{fixed: 'right', align:'center', toolbar: '#barDemo'}">操作</th>
<th lay-data="{templet: '#photo_id',sort: true,width:'7%'}">抄表凭证</th>
<th lay-data="{fixed: 'right', align:'center', toolbar: '#barDemo',width:'16%'}">操作</th>
</tr>
</thead>
</table>
......@@ -92,17 +94,27 @@
<script type="text/html" id="status">
{{# if(d.status == 2){ }}
<span class="layui-bg-blue">已审核</span>
{{# }else { }}
{{# } }}
{{# if(d.status == 3){ }}
<span class="layui-bg-orange" title="{{ d.info }}">被驳回</span>
{{# } }}
{{# if(d.status < 2){ }}
<span class="layui-bg-green">未审核</span>
{{# } }}
</script>
{if $admin == true}
<script type="text/html" id="barDemo">
{{# if(d.status == 1){ }}
<a title="审核" class="layui-btn layui-btn-sm layui-bg-green" href="/useage/{{d.useage_id}}">审核</a>
{{# } }}
{{# 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-btn-danger" lay-event="del">删除</a>
{{# } }}
</script>
{/if}
<script>
layui.use(['laydate','form','table'], function(){
var laydate = layui.laydate,
......@@ -130,13 +142,13 @@
dataType: "json",
success: function (data) {
if(data.status == 1){
layer.msg(data.message,{icon: 6,time: 2000},function(){
layer.msg(data.message,{icon: 6,time: 4000},function(){
obj.del();
layer.close(index);
location.reload()
})
} else {
layer.msg(data.message,{icon: 5,time: 1000 })
layer.msg(data.message,{icon: 5,time: 5000 })
}
}
});
......
......@@ -95,7 +95,7 @@
</label>
<div class="layui-input-inline">
<input type="text" id="last_date" name="last_date"
autocomplete="off" class="layui-input" value="{if isset($em.last_date)}{$em.last_date}{/if}" disabled="disabled">
autocomplete="off" class="layui-input" value="{$em.useage.last_date}" disabled="disabled">
</div>
</div>
</div>
......@@ -107,7 +107,7 @@
</label>
<div class="layui-input-inline">
<input type="text" id="current_date" name="current_date"
autocomplete="off" class="layui-input" value="{if isset($em.current_date)}{$em.current_date}{/if}">
autocomplete="off" class="layui-input" value="{$em.useage.current_date|date='Y:m:d'}">
</div>
</div>
</div>
......@@ -119,7 +119,7 @@
</label>
<div class="layui-input-inline">
<input type="text" id="last_numb" name="last_numb"
autocomplete="off" class="layui-input" disabled="disabled" value="{$em.last_sum_numb}" >
autocomplete="off" class="layui-input" disabled="disabled" value="{$em.useage.last_sum_numb}" >
</div>
<div class="layui-form-mid layui-word-aux">
......@@ -134,7 +134,7 @@
</label>
<div class="layui-input-inline">
<input type="text" id="current_numb" name="current_numb"
autocomplete="off" class="layui-input" disabled="disabled">
autocomplete="off" class="layui-input" value="{$em.useage.current_numb|default=''}">
</div>
<div class="layui-form-mid layui-word-aux">
......@@ -155,6 +155,21 @@
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label">
单价
</label>
<div class="layui-input-inline">
<input type="text" id="price" name="price" autocomplete="off" class="layui-input" value="">
</div>
<div class="layui-form-mid layui-word-aux">
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label">
......@@ -186,29 +201,6 @@
</div>
</div>
</div>
<div class="layui-col-md10" style="padding:0 130px 0 30px;margin-bottom: 20px;">
<table class="layui-table layui-form">
<thead>
<tr>
<th>阶段</th>
<th>上期表数</th>
<th>本期表数</th>
<th>单价</th>
</thead>
<tbody>
{volist name="em.useage" id="item"}
<tr>
<td>{$item.typeName}</td>
<td><input type="text" class="no-border" name="uType{$i}_last_numb" value="{$item.last_numb}" disabled="disabled"></td>
<td><input type="text" class="no-border current_numb" name="uType{$i}_current_numb" value="{$item.current_numb|default=''}"></td>
<td><input type="text" class="no-border" name="uType{$i}_price" value="{$item.price|default=''}"></td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
</div>
......@@ -261,7 +253,6 @@
trigger:'click',
})
//保存抄表单,并且返回列表
form.on('submit(save)',
function (data) {
......@@ -307,24 +298,18 @@
}
}
});
$('#current_numb').change(function(){
$leve = 100000;
var $rNum = $(this).val()*$leve - $('#last_numb').val()*$leve;
if($rNum < 0){
layMsg('本次抄表必须大于上次抄表读数',5);
$('#current_numb').focus();
} else{
$('#repo_numb').val( $rNum/$leve )
//总度数实时更新
$sum = $('#current_numb');
$('.current_numb').change(function(){
var $sum_numb = 0;
for (var i = 0; i < $('.current_numb').length; i++) {
$temp_numb = $('.current_numb').eq(i).val();
if($temp_numb != 'undefind' && $temp_numb != ''){
$sum_numb += Number($temp_numb)
}
}
$sum.val($sum_numb);
var nm = Number($('#rate').val()) * $sum_numb;
$('#repo_numb').val(nm);
})
});
</script>
{/block}
\ No newline at end of file
差异被折叠。
<?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',
];
\ No newline at end of file
<?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.222',
'redis_port' => 6379,
'base_url' => 'http://oa.gonn.com.cn/?m=login',
];
......@@ -2,7 +2,7 @@ let userIdLocal = document.cookie.split('user=')[1]?(document.cookie.split('user
let temp = sessionStorage.getItem('userIdLocal')?sessionStorage.getItem('userIdLocal'):''
if(userIdLocal == '') top.location.href="http://oa.gonn.com.cn/";
if(userIdLocal == '') top.location.href="http://oa-test.gonn.tech/";
if ( temp != userIdLocal || !sessionStorage.getItem('userToken')){
sessionStorage.setItem("userIdLocal", userIdLocal)
......
......@@ -147,6 +147,8 @@ Route::get('useage/:useage_id','em/useage/detail');
Route::get('useage_add/:id','em/useage/create');
Route::post('useage_add','em/useage/store');
Route::post('useage_del','em/useage/del');
Route::get('useage_update/:useage_id','em/useage/update');
Route::post('upFile','em/UploadFile/upFile');
......
......@@ -28,4 +28,6 @@ Route::get('/v1/source','api/v1.supplier.Assign/getSource'); //需求来源信
Route::get('/v1/customers','api/v1.supplier.Assign/getCustomers'); //上游客户信息
//基站状态
Route::get('/v1/basestate','api/v1.supplier.Assign/getBasestate'); //基站状态信息
\ No newline at end of file
Route::get('/v1/basestate','api/v1.supplier.Assign/getBasestate'); //基站状态信息
Route::get('/v1/permission','api/v1.supplier.Assign/getDataPermission'); //获取项目数据权限
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论