增加重复车架数据页

master
zcstatham 2 years ago
parent fe15721363
commit 1f92fa1251
  1. 350
      app/controller/Repeat.php
  2. 170
      app/view/index/edit.html.bak
  3. 12
      app/view/public/header.html.bak
  4. 1
      app/view/public/layout.html
  5. 206
      app/view/repeat/index.html

@ -0,0 +1,350 @@
<?php
namespace app\controller;
use app\BaseController;
use think\facade\Db;
use think\response\Json;
class Repeat extends BaseController
{
/**
* 显示资源列表
*
* @return string
* @throws \Exception
*/
public function index()
{
return $this->fetch();
}
/**
* @return Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function data(){
$params = $this->request->param();
$page = $this->request->param('page', 1);
$limit = $this->request->param('limit', 20);
if ($page <= 1) {
$page = 1;
}
$offset = ($page - 1) * $limit;
$map = $this->getQueryCondition($params);
$query = Db::table('repeat_data_t')->alias('car_info_t')->field('car_info_t.*')
->where($map)
->order('repeat_data_t.car_frame_no desc');
if (isset($params['is_delete_frame']) && $params['is_delete_frame'] > 0) {
$query = $query->where('repeat_data_t.repeat_id', '=', $params['is_delete_frame']);
}
$map_or1 = [];
$map_or2 = [];
$insurer_month1 = $params['insurer_month1']??'';
$insurer_day1 = $params['insurer_day1']??'';
$insurer_month2 = $params['insurer_month2']??'';
$insurer_day2 = $params['insurer_day2']??'';
if($insurer_month1 != '' && $insurer_day1 == '') {
$map_or1[] = [Db::raw('month(car_info_t.insurer1_date)'), '>=', $insurer_month1];
$map_or2[] = [Db::raw('month(car_info_t.insurer2_date)'), '>=', $insurer_month1];
} else if ($insurer_month1 == '' && $insurer_day1 != '') {
$map_or1[] = [Db::raw('day(car_info_t.insurer1_date)'), '>=', $insurer_day1];
$map_or2[] = [Db::raw('day(car_info_t.insurer2_date)'), '>=', $insurer_day1];
} else if ($insurer_month1 != '' && $insurer_day1 != '') {
$map_or1[] = [Db::raw('DATE_FORMAT(car_info_t.insurer1_date,"%m-%d")'), '>=', substr('0' . $insurer_month1, -2) . '-' . substr('0' . $insurer_day1, -2)];
$map_or2[] = [Db::raw('DATE_FORMAT(car_info_t.insurer2_date,"%m-%d")'), '>=', substr('0' . $insurer_month1, -2) . '-' . substr('0' . $insurer_day1, -2)];
}
if($insurer_month2 != '' && $insurer_day2 == '') {
$map_or1[] = [Db::raw('month(car_info_t.insurer1_date)'), '<=', $insurer_month2];
$map_or2[] = [Db::raw('month(car_info_t.insurer2_date)'), '<=', $insurer_month2];
} else if ($insurer_month2 == '' && $insurer_day2 != '') {
$map_or1[] = [Db::raw('day(car_info_t.insurer1_date)'), '<=', $insurer_day2];
$map_or2[] = [Db::raw('day(car_info_t.insurer2_date)'), '<=', $insurer_day2];
} else if ($insurer_month2 != '' && $insurer_day2 != '') {
$map_or1[] = [Db::raw('DATE_FORMAT(car_info_t.insurer1_date,"%m-%d")'), '<=', substr('0' . $insurer_month2, -2) . '-' . substr('0' . $insurer_day2, -2)];
$map_or2[] = [Db::raw('DATE_FORMAT(car_info_t.insurer2_date,"%m-%d")'), '<=', substr('0' . $insurer_month2, -2) . '-' . substr('0' . $insurer_day2, -2)];
}
if(count($map_or1) > 0){
$map_or1 = array_merge([['car_info_t.insurer1_date', '<>', '']],$map_or1);
}
if(count($map_or2) > 0){
$map_or2 = array_merge([['car_info_t.insurer1_date', '=', ''],['car_info_t.insurer2_date', '<>', '']],$map_or2);
}
if (count($map_or1) > 0 && count($map_or2) > 0) {
$query = $query->where(function ($query) use ($map_or1, $map_or2) {
if (count($map_or1) > 0 && count($map_or2) > 0) {
$query->whereOr([$map_or1, $map_or2]);
}
});
}
if (isset($params['data_filter']) && !empty($params['data_filter'])) {
$map = $this->getAddStatusQuery(array_flip($params['data_filter']));
if(count($map) > 1 ){
$query = $query->where(function ($query) use ($map) {
if (count($map) > 0){
$query->whereOr($map);
}
});
}else {
$query = $query->where($map);
}
}
$count = $query->count();
$list = $query->limit($offset, $limit)->select()->toArray();
foreach ($list as &$item) {
$item['export_bhx_name'] = $jobs_name[$item['is_export_bhx']]['queue'] ?? '';
$item['export_bmc_name'] = $jobs_name[$item['is_export_bmc']]['queue'] ?? '';
$item['bhx_download_times'] = $jobs_name[$item['is_export_bhx']]['download_times'] ?? 0;
$item['bmc_download_times'] = $jobs_name[$item['is_export_bmc']]['download_times'] ?? 0;
}
$this->layui_data['data'] = $list;
$this->layui_data['count'] = $count;
return json($this->layui_data);
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function edit($id)
{
$car_info = Db::table('repeat_data_t')->find($id);
if($this->request->isGet()){
$this->assign('info', $car_info);
return $this->fetch();
}else if($this->request->isPost()){
$data = $this->request->param();
$car_info->car_no = $data['car_no'] ?? $car_info->car_no;
$car_info->car_frame_no = $data['car_frame_no'] ?? $car_info->car_frame_no;
$car_info->engine_no = $data['engine_no'] ?? $car_info->engine_no;
$car_info->factory_model = $data['factory_model'] ?? $car_info->factory_model;
$car_info->register_date = $data['register_date'] ?? $car_info->register_date;
$car_info->purchase_price = $data['purchase_price'] ?? $car_info->purchase_price;
$car_info->company = $data['company'] ?? $car_info->company;
$car_info->insurer1_date = $data['insurer1_date'] ?? $car_info->insurer1_date;
$car_info->insurer2_date = $data['insurer2_date'] ?? $car_info->insurer2_date;
$car_info->car_man = $data['car_man'] ?? $car_info->car_man;
$car_info->car_number = $data['car_number'] ?? $car_info->car_number;
$car_info->car_phone = $data['car_phone'] ?? $car_info->car_phone;
$car_info->id_man = $data['id_man'] ?? $car_info->id_man;
$car_info->id_number = $data['id_number'] ?? $car_info->id_number;
$car_info->update_timestamp = date('Y-m-d H:i:s');
if($car_info->save()){
return json($this->json_data);
}else {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '保存失败';
return json($this->layui_data);
}
}
}
/**
* @param $params
* @return array
*/
private function getQueryCondition($params)
{
$map = [];
if (isset($params['car_man']) && $params['car_man'] != '') {
$car_man = explode(',', str_replace(',', '', $params['car_man']));
array_walk($car_man, function (&$value) {
$value = '%' . $value . '%';
});
$map[] = ['car_info_t.car_man', 'like', $car_man];
}
if (isset($params['factory_model']) && $params['factory_model'] != '') {
$factory_model = explode(',', str_replace(',', '', $params['factory_model']));
array_walk($factory_model, function (&$value) {
$value = '%' . $value . '%';
});
$map[] = ['car_info_t.factory_model', 'like', $factory_model];
}
if (isset($params['car_frame_no']) && $params['car_frame_no'] != '') {
$map[] = ['car_info_t.car_frame_no', '=', $params['car_frame_no']];
}
if (isset($params['car_no']) && $params['car_no'] != '') {
$map[] = ['car_info_t.car_no', '=', $params['car_no']];
}
if (isset($params['car_number']) && $params['car_number'] != '') {
$map[] = ['car_info_t.car_number', '=', $params['car_number']];
}
if (isset($params['car_phone']) && $params['car_phone'] != '') {
$map[] = ['car_info_t.car_phone', '=', $params['car_phone']];
}
if (isset($params['register_date']) && $params['register_date'] != '') {
$map[] = ['car_info_t.register_date', '=', $params['register_date']];
}
if (isset($params['car_phone_empty']) && $params['car_phone_empty'] == 'yes') {
$map[] = ['car_info_t.car_phone', '<>', ''];
}
if (isset($params['car_phone_empty']) && $params['car_phone_empty'] == 'no') {
$map[] = ['car_info_t.car_phone', '=', ''];
}
if (isset($params['car_phone_repeat']) && $params['car_phone_repeat'] == 'yes') {
$map[] = ['car_info_t.id', '=', 'peer_phone_t.id'];
}
if (isset($params['is_update_bhx']) && $params['is_update_bhx'] > 0 ) {
$map[] = ['car_info_t.is_update_bhx', '=', $params['is_update_bhx']];
}
if (isset($params['is_export_bhx']) && $params['is_export_bhx'] > 0 ) {
$map[] = ['car_info_t.is_export_bhx', '=', $params['is_export_bhx']];
}
if (isset($params['is_export_bmc']) && $params['is_export_bmc'] > 0 ) {
$map[] = ['car_info_t.is_export_bmc', '=', $params['is_export_bmc']];
}
if (isset($params['is_export_failed']) && $params['is_export_failed'] > 0 ) {
$map[] = ['car_info_t.is_export_failed', '=', $params['is_export_failed']];
}
if (isset($params['is_export_failed_bmc']) && $params['is_export_failed_bmc'] > 0 ) {
$map[] = ['car_info_t.is_export_failed_bmc', '=', $params['is_export_failed_bmc']];
}
if (isset($params['is_export_none_bmc']) && $params['is_export_none_bmc'] > 0 ) {
$map[] = ['car_info_t.is_export_none_bmc', '=', $params['is_export_none_bmc']];
}
if (isset($params['source']) && $params['source'] > 0 ) {
$map[] = ['car_info_t.source', '=', $params['source']];
}
if(isset($params['register_date1']) && $params['register_date1'] != ''){
$map[] = ['car_info_t.register_date', '>=', $params['register_date1']];
}
if(isset($params['register_date2']) && $params['register_date2'] != ''){
$map[] = ['car_info_t.register_date', '<=', $params['register_date2']];
}
if (isset($params['price1']) && $params['price1'] != '') {
$map[] = ['car_info_t.purchase_price', '>=', $params['price1'] * 10000];
}
if (isset($params['price2']) && $params['price2'] != '') {
$map[] = ['car_info_t.purchase_price', '<=', $params['price2'] * 10000];
}
return $map;
}
/**
* 添加状态筛选
* @param $data_filter
* @return array
*/
private function getAddStatusQuery($data_filter)
{
$tree = new Tree();
$tree->setNode(1, isset($data_filter['bhx']) ? [['car_info_t.is_export_bhx', '>', 0]] : []);
$tree->setNode(2, isset($data_filter['none']) ? [['car_info_t.is_export_bhx', '=', 0]] : []);
if(isset($data_filter['bhx_success'])){
$tree->setNode(3, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '>', 0],
]],1);
$tree->setNode(1, [], 0);
}else {
$tree->setNode(3, [],1);
}
if(isset($data_filter['bhx_failed'])){
$tree->setNode(4, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '<', 0],
]],1);
$tree->setNode(1, [], 0);
}else {
$tree->setNode(4, [],1);
}
if(isset($data_filter['bhx_none'])){
$tree->setNode(5, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '=', 0],
]],1);
$tree->setNode(1, [], 0);
}else {
$tree->setNode(5, [],1);
}
if(isset($data_filter['none_bmc'])){
$tree->setNode(6, [[
['car_info_t.is_export_bhx', '=', 0],
['car_info_t.is_export_none_bmc', '>', 0],
]],2);
$tree->setNode(2, [], 0);
}else {
$tree->setNode(6, [],2);
}
if(isset($data_filter['none_none'])){
$tree->setNode(7, [[
['car_info_t.is_export_bhx', '=', 0],
['car_info_t.is_export_none_bmc', '=', 0],
]],2);
$tree->setNode(2, [], 0);
}else {
$tree->setNode(7, [],2);
}
if(isset($data_filter['bhx_success_bmc'])){
$tree->setNode(8, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '>', 0],
['car_info_t.is_export_bmc', '>', 0],
]],3);
$tree->setNode(3, [], 0);
}else {
$tree->setNode(8, [],3);
}
if(isset($data_filter['bhx_success_none'])){
$tree->setNode(9, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '>', 0],
['car_info_t.is_export_bmc', '=', 0],
]],3);
$tree->setNode(3, [], 0);
}else {
$tree->setNode(9, [],3);
}
if(isset($data_filter['bhx_failed_bmc'])){
$tree->setNode(10, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '<', 0],
['car_info_t.is_export_bmc', '=', 0],
['car_info_t.is_export_failed', '=', 0],
['car_info_t.is_export_failed_bmc', '>', 0],
]],4);
$tree->setNode(4, [], 0);
}else {
$tree->setNode(10, [],4);
}
if(isset($data_filter['bhx_failed_bhx'])){
$tree->setNode(11, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '<', 0],
['car_info_t.is_export_bmc', '=', 0],
['car_info_t.is_export_failed', '>', 0],
]],4);
$tree->setNode(4, [], 0);
}else {
$tree->setNode(11, [],4);
}
if(isset($data_filter['bhx_failed_none'])){
$tree->setNode(12, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '<', 0],
['car_info_t.is_export_bmc', '=', 0],
['car_info_t.is_export_failed', '=', 0],
['car_info_t.is_export_failed_bmc', '=', 0],
]],4);
$tree->setNode(4, [], 0);
}else {
$tree->setNode(12, [],4);
}
$map = $tree->getAllChildrenNodes(0, function ($value) {
return count($value) > 0;
}, function ($value) {
return $value;
});
return array_column(array_filter($map), null);
}
}

@ -1,170 +0,0 @@
{extend name="public/base" /}
{block name="header"}
<style>
.layui-form-label {
width: 100px;
}
.layui-badge {
height: 28px;
line-height: 28px;
font-size: 14px;
}
</style>
{/block}
{block name="body"}
<div class="layui-card">
<div class="layui-card-header"></div>
<div class="layui-card-body layui-form">
<input type="hidden" name="id" value="{$info.id}">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">车牌号</label>
<div class="layui-input-inline">
<input type="text" name="car_no" value="{$info.car_no}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">车架号</label>
<div class="layui-input-inline">
<input type="text" name="car_frame_no" value="{$info.car_frame_no}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">发动机号</label>
<div class="layui-input-inline">
<input type="text" name="engine_no" value="{$info.engine_no}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">厂牌型号</label>
<div class="layui-input-inline">
<input type="text" name="factory_model" value="{$info.factory_model}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">初登日期</label>
<div class="layui-input-inline">
<input type="text" name="register_date" id="register_date" value="{$info.register_date}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">新车购置价</label>
<div class="layui-input-inline">
<input type="text" name="purchase_price" value="{$info.purchase_price}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">车主姓名</label>
<div class="layui-input-inline">
<input type="text" name="car_man" value="{$info.car_man}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">车主证件号</label>
<div class="layui-input-inline">
<input type="text" name="car_number" value="{$info.car_number}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">车主联系方式</label>
<div class="layui-input-inline">
<input type="text" name="car_phone" value="{$info.car_phone}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">上年承保公司</label>
<div class="layui-input-inline">
<input type="text" name="company" value="{$info.company}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">商业止保日期</label>
<div class="layui-input-inline">
<input type="text" name="insurer1_date" id="insurer1_date" value="{$info.insurer1_date}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">交强止保日期</label>
<div class="layui-input-inline">
<input type="text" name="insurer2_date" id="insurer2_date" value="{$info.insurer2_date}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">被保险人</label>
<div class="layui-input-inline">
<input type="text" name="id_man" value="{$info.id_man}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">被保险人证件号</label>
<div class="layui-input-inline">
<input type="text" name="id_number" value="{$info.id_number}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数据状态</label>
<div class="layui-input-block" style="height: 36px; line-height: 36px;">
{if $info.is_export_bhx == 0 && $info.is_update_bhx == 0 && $info.is_export_bmc == 0 &&
$info.is_export_failed == 0 && $info.is_export_none_bmc == 0 && $info.is_export_failed_bmc == 0}
<span class="layui-badge layui-bg-green">未处理</span>
{/if}
{if $info.is_export_bhx > 0 /}
<span class="layui-badge layui-bg-green">导出至清洗</span>
{/if}
{if $info.is_export_bhx > 0 && $info.is_update_bhx > 0 /}
<span class="layui-badge layui-bg-green">清洗成功</span>
{/if}
{if $info.is_export_bhx > 0 && $info.is_update_bhx == -1 /}
<span class="layui-badge layui-bg-green">清洗失败</span>
{/if}
{if $info.is_export_bhx > 0 && $info.is_export_failed > 0 /}
<span class="layui-badge layui-bg-green">导出清洗失败</span>
{/if}
{if $info.is_export_bhx > 0 && $info.is_export_failed_bmc > 0 /}
<span class="layui-badge layui-bg-green">导出清洗失败至上传</span>
{/if}
{if $info.is_export_bhx > 0 && $info.is_update_bhx > 0 && $info.is_export_bmc > 0 /}
<span class="layui-badge layui-bg-green">导出清洗成功至上传</span>
{/if}
{if $info.is_export_none_bmc > 0 /}
<span class="layui-badge layui-bg-green">导出未处理至上传</span>
{/if}
</div>
</div>
<div class="layui-form-item" style="margin-top: 60px; text-align: center">
<button type="submit" class="layui-btn" lay-submit="" lay-filter="car-info">立即提交</button>
<button type="button" class="layui-btn layui-btn-danger" onclick="location.reload();">重置</button>
<button type="button" class="layui-btn layui-btn-danger" onclick="window.parent.layer.closeAll();">关闭</button>
</div>
</div>
</div>
{/block}
{block name="script"}
<script>
layui.laydate.render({
elem: '#register_date'
});
layui.form.on('submit(car-info)', function(data){
$.post('{:url("index/edit")}',data.field,function(ret){
layer.msg(ret['msg'],function(){
if(ret['code'] == 1){
window.parent.layer.closeAll();
window.parent.layui.table.reload('carInfo');
}
delete ret;
});
});
return false;
});
</script>
{/block}

@ -1,12 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="none">
<title>数据处理</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
<link rel="stylesheet" href="/static/css/default.css">

@ -9,6 +9,7 @@
<ul class="layui-nav layui-layout-left">
<li class="layui-nav-item"><a href="{:url('index/index')}">数据中心</a></li>
<li class="layui-nav-item"><a href="{:url('task/index')}">任务中心</a></li>
<li class="layui-nav-item"><a href="{:url('repeat/index')}">重复车架</a></li>
</ul>
</div>
<div class="layui-container-fluid" id="layui-content">

@ -60,16 +60,6 @@
<input type="text" name="car_phone" id="car_phone" autocomplete="off"
class="layui-input" value="{$params.car_phone | default=''}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">新车购置价</label>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price1" class="layui-input" style="display: inline-block; width: 60px;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price2" class="layui-input" style="display: inline-block; width: 60px;">
</div>
</div>
</div>
<div class="layui-form-item">
@ -84,7 +74,7 @@
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">商业保险日期</label>
<label class="layui-form-label" style="width: 100px;">保险日期</label>
<div class="layui-input-inline">
<input type="text" name="insurer_month1" class="layui-input" style="display: inline-block; width: 60px;">
<input type="text" name="insurer_day1" class="layui-input" style="display: inline-block; width: 60px;">
@ -96,50 +86,19 @@
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline" style="width: 695px;">
<label class="layui-form-label" style="width: 100px;">筛选类型</label>
<div class="layui-input-inline" style="width: 550px;">
<input type="checkbox" name="data_filter[]" value="is_export_bhx" title="已导出清洗">
<input type="checkbox" name="data_filter[]" value="is_update_bhx" title="清洗成功">
<input type="checkbox" name="data_filter[]" value="is_update_faild" title="清洗失败">
<input type="checkbox" name="data_filter[]" value="is_export_bmc" title="已导出上传">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">导出文件名</label>
<div class="layui-input-inline" style="width: 400px;">
<input type="text" name="export_name" id="export_name" autocomplete="off"
class="layui-input" value="{$params.export_name | default=''}">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">电话检测</label>
<div class="layui-input-inline" style="width: 300px">
<input type="radio" class="layui-input" name="car_phone_empty" value="all" title="全部" checked>
<input type="radio" class="layui-input" name="car_phone_empty" value="yes" title="不为空">
<input type="radio" class="layui-input" name="car_phone_empty" value="no" title="空">
<label class="layui-form-label" style="width: 100px;">新车购置价</label>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price1" class="layui-input" style="display: inline-block; width: 60px;">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">重复数据检测</label>
<div class="layui-input-inline" style="width: 400px;">
<input type="radio" class="layui-input" name="data_check" value="no" title="否" checked>
{if $repeat_frame_count > 0 }
<input type="radio" class="layui-input" name="data_check" value="car_frame_check" title="车架号">
{/if}
{if $peer_phone_count > 0 }
<input type="radio" class="layui-input" name="data_check" value="car_phone_check" title="个人电话">
{/if}
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price2" class="layui-input" style="display: inline-block; width: 60px;">
</div>
</div>
<div class="layui-input-block layui-text-right" id="tool-bar">
<button type="button" class="layui-btn" id="search-btn">搜索</button>
<a href="{:url('index/index')}" class="layui-btn" id="reset-btn">重置条件</a>
<button type="button" class="layui-btn layui-btn-danger" id="deletes-btn">批量删除</button>
<button type="button" class="layui-btn layui-btn-danger" id="clear-btn">清空数据</button>
</div>
</div>
</div>
@ -152,7 +111,6 @@
<!--Core Javascript -->
<script type="text/html" id="table-bar">
<a class="layui-btn layui-btn-xs" lay-event="detail">详情</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/html" id="BmcNameTpl">
{{# if(d.bmc_download_times > 0){ }}
@ -170,43 +128,13 @@
</script>
<script>
$(function () {
layui.form.on('checkbox(dataStatus)', function(data){
if(data.elem.checked){
if(data.value == 'is_none_handle'){
$(data.elem).siblings().attr('disabled',true);
}else{
if(data.value == 'is_update_success'){
$(data.elem).siblings('[value="is_update_failed"]').removeAttr('checked').attr('disabled',true);
}
if(data.value == 'is_update_failed'){
$(data.elem).siblings('[value="is_update_success"]').removeAttr('checked').attr('disabled',true);
}
$(data.elem).siblings('[value="is_none_handle"]').attr('disabled',true);
}
}else {
if(data.value == 'is_none_handle'){
$(data.elem).siblings().removeAttr('disabled');
}else{
if(data.value == 'is_update_success'){
$(data.elem).siblings('[value="is_update_failed"]').removeAttr('disabled');
}
if(data.value == 'is_update_failed'){
$(data.elem).siblings('[value="is_update_success"]').removeAttr('disabled');
}
if($(data.elem).siblings(':checked').length == 0){
$(data.elem).siblings('[value="is_none_handle"]').removeAttr('disabled');
}
}
}
});
//转换静态表格
layui.table.render({
var tableIns = layui.table.render({
id: 'carInfo',
elem: '#car-info',
title:'车辆信息',
url: '{:url("/index/carInfo/")}', //数据接口
where: $.extend($('.layui-card-header').find(':input').serializeObject(),getUrlParam('Object')),
url: '{:url("/repeat/data/")}', //数据接口
where: getUrlParam('Object'),
toolbar: true,
page: true, //开启分页
limit: 20,
loading: true,
@ -220,9 +148,19 @@
{field: 'car_man', title: '车主', width: 80, edit: 'text'},
{field: 'car_number', title: '车主证件号', width: 160, edit: 'text'},
{field: 'car_phone', title: '车主电话', width: 120, edit: 'text'},
{field: 'id_man', title: '被保险人', width: 80, edit: 'text'},
{field: 'id_number', title: '被保险人证件号', width: 160, edit: 'text'},
{field: 'id_phone', title: '被保险人电话', width: 120, edit: 'text'},
{field: 'insured_man', title: '投保人', width: 80, edit: 'text'},
{field: 'insured_number', title: '投保人证件号', width: 160, edit: 'text'},
{field: 'insured_phone', title: '投保人电话', width: 120, edit: 'text'},
{field: 'link_man_1', title: '联系人1', width: 80, edit: 'text'},
{field: 'link_phone_1', title: '联系人电话1', width: 120, edit: 'text'},
{field: 'link_man_2', title: '联系人2', width: 80, edit: 'text'},
{field: 'link_phone_2', title: '联系人电话2', width: 120, edit: 'text'},
{field: 'link_man_3', title: '联系人3', width: 80, edit: 'text'},
{field: 'link_phone_3', title: '联系人电话3', width: 120, edit: 'text'},
{field: 'purchase_price', title: '新车购置价', width: 100, edit: 'text'},
{field: 'export_bhx_name', title: '导出清洗', width: 140, edit: 'text', templet:'#BhxNameTpl'},
{field: 'export_bmc_name', title: '导出上传', width: 140, edit: 'text', templet:'#BmcNameTpl'},
{fixed: 'right', width: 100, align:'center', toolbar: '#table-bar'}
]],
done: function (res, curr, count) {
@ -236,37 +174,14 @@
layui.table.on('tool(car-info)', function(obj){ //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
var data = obj.data, //获得当前行数据
layEvent = obj.event; //获得 lay-event 对应的值
if(layEvent === 'clear_phone'){
layer.confirm('确定要清楚此项手机吗', function(index){
layer.close(index);
index = layer.load();
$.post('{:url("index/clearPhone")}', {id: data.id}, function (res) {
layer.close(index);
layer.msg(res.msg,function () {
layui.table.reload('carInfo');
});
})
});
} else if(layEvent === 'del'){
layer.confirm('真的删除行么', function(index){
layer.close(index);
index = layer.load();
//向服务端发送删除指令
$.post('{:url("index/delete")}', {id: data.id}, function (res) {
layer.close(index);
layer.msg(res.msg,function () {
obj.del(); //删除对应行(tr)的DOM结构
});
})
});
} else if(layEvent === 'detail'){
if(layEvent === 'detail'){
layer.open({
type: 2,
title: '车辆信息--' + data.car_no,
area: ['1100px','600px'],
shade: 0,
maxmin: true,
content: '{:url("index/edit")}?id=' + data.id,
content: '{:url("repeat/edit")}?id=' + data.id,
zIndex: layer.zIndex,
success: function(layero){
layer.setTop(layero);
@ -275,83 +190,24 @@
}
});
//监听单元格编辑
layui.table.on('edit(car-info)', function(obj){
var data = {
id : obj.data.id,
field: obj.field,
value: obj.value
};
if (data.value < 0) {
layer.msg('值不能为负数', {icon: 5});
layer.msg(res.msg,function () {
layui.table.reload('carInfo');
});
return false;
}
$.post('{:url("index/update")}', data, function (res) {
layer.msg(res.msg,function () {
layui.table.reload('carInfo');
});
});
});
var urlParams = getUrlParam('Object');
var jobId = 0;
if(urlParams.is_check_peer_phone > 0){
jobId = urlParams.is_check_peer_phone;
}else if(urlParams.is_check_repeat_frame > 0){
jobId = urlParams.is_check_repeat_frame;
}else if(urlParams.is_export_bhx > 0){
jobId = urlParams.is_export_bhx;
}
if(jobId > 0){
$.get('{:url("task/taskBtn")}?job_id=' + jobId,function(ret){
if(ret.code){
$('#tool-bar').prepend($.trim(ret.btns));
}
});
}
$('.layui-date-elem').each(function (i, d) {
layui.laydate.render({
elem: d,
});
});
$('#search-btn').on('click', function(){
var param = $('.layui-card-header').find(':input').serializeObject();
param['data_filter[]'] = param['data_filter[]']?param['data_filter[]']:'';
param = Object.assign(param, urlParams);
//执行重载
layui.table.reload('carInfo', {
tableIns.reload({
page: {
curr: 1 //重新从第 1 页开始
},
where: $.extend($('.layui-card-header').find(':input').serializeObject(),getUrlParam('Object'))
where: param,
}, 'data');
});
$('#deletes-btn').on('click', function () {
layer.confirm('真的删除行么', function(index){
layer.close(index);
index = layer.load();
//向服务端发送删除指令
$.post('{:url("index/deletes/")}', $('.layui-card-header').find(':input').serialize(), function (ret) {
layer.close(index);
layer.msg(ret.msg, function () {
layui.table.reload('carInfo');
});
});
});
});
$('#clear-btn').on('click', function () {
layer.confirm('清空数据将不能恢复,确认清空车辆信息吗?', function(index){
layer.close(index);
index = layer.load();
//向服务端发送删除指令
$.post('{:url("index/truncate/")}', function (ret) {
layer.close(index);
layer.msg(ret.msg, function () {
layui.table.reload('carInfo');
});
});
});
});
});
function task_create(type,id = 0){
@ -362,4 +218,4 @@
});
}
</script>
{/block}
{/block}
Loading…
Cancel
Save