重复车架恢复

master
zhaocheng 2 years ago
parent d0a4023504
commit 0a5376b42c
  1. 23
      app/controller/Repeat.php
  2. 13
      app/view/repeat/index.html

@ -2,6 +2,7 @@
namespace app\controller; namespace app\controller;
use app\BaseController; use app\BaseController;
use app\model\RepeatFrameT;
use library\Tree; use library\Tree;
use think\facade\Db; use think\facade\Db;
use think\response\Json; use think\response\Json;
@ -147,6 +148,28 @@ class Repeat extends BaseController
} }
public function recovery($id)
{
if(Db::table('repeat_data_t')->where('repeat_id', $id)->count() == 0) {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '当前批次没有可恢复数量';
return json($this->json_data);
}
Db::startTrans();
try {
Db::query("insert into car_info_t( `id`, `register_date`, `car_man`, `car_number`, `car_phone`, `car_frame_no`, `car_no`, `engine_no`, `factory_model`, `purchase_price`, `company`, `insurer1_date`, `insurer2_date`, `id_man`, `id_number`, `id_phone`, `insured_man`, `insured_number`, `insured_phone`, `link_man_1`, `link_phone_1`, `link_man_2`, `link_phone_2`, `link_man_3`, `link_phone_3`, `is_delete`, `source`, `is_export_bhx`, `is_export_bmc`, `is_export_failed`, `is_export_none_bmc`, `is_update_bhx`, `create_timestamp`, `update_timestamp`, `is_export_failed_bmc`, `tag`)
select `id`, `register_date`, `car_man`, `car_number`, `car_phone`, `car_frame_no`, `car_no`, `engine_no`, `factory_model`, `purchase_price`, `company`, `insurer1_date`, `insurer2_date`, `id_man`, `id_number`, `id_phone`, `insured_man`, `insured_number`, `insured_phone`, `link_man_1`, `link_phone_1`, `link_man_2`, `link_phone_2`, `link_man_3`, `link_phone_3`, `is_delete`, `source`, `is_export_bhx`, `is_export_bmc`, `is_export_failed`, `is_export_none_bmc`, `is_update_bhx`, `create_timestamp`, `update_timestamp`, `is_export_failed_bmc`, `tag` from repeat_data_t where repeat_id=:id;",
['id' => $id]);
RepeatFrameT::where('repeat_data_t', $id)->delete();
Db::commit();
} catch (\Exception $e) {
Db::rollback();
$this->json_data['code'] = 0;
$this->json_data['msg'] = '恢复失败: '. $e->getMessage();
}
return json($this->json_data);
}
/** /**
* @param $params * @param $params
* @return array * @return array

@ -141,6 +141,7 @@
<div class="layui-form-item layui-col-md2" style="clear: none;"> <div class="layui-form-item layui-col-md2" style="clear: none;">
<div class="layui-input-block layui-text-right" id="tool-bar"> <div class="layui-input-block layui-text-right" id="tool-bar">
<button type="button" class="layui-btn layui-btn-sm" id="search-btn">搜索</button> <button type="button" class="layui-btn layui-btn-sm" id="search-btn">搜索</button>
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" id="recovery-btn">恢复</button>
</div> </div>
</div> </div>
</div> </div>
@ -253,6 +254,18 @@
where: param, where: param,
}, 'data'); }, 'data');
}); });
$('#recovery-btn').on('click', function(){
layer.prompt({title: '请输入删除任务ID值',}, function(value, index, elem){
index = layer.load();
//向服务端发送删除指令
$.post('{:url("/repeat/recovery/")}' + value, function (ret) {
layer.close(index);
layer.msg(ret.msg, function () {
layui.table.reload('carInfo');
});
});
});
});
}); });
function task_create(type,id = 0){ function task_create(type,id = 0){

Loading…
Cancel
Save