|
@@ -12,8 +12,11 @@ use catcher\base\CatchController;
|
|
|
use catchAdmin\hydraulic\model\HydEquipment as hydEquipmentModel;
|
|
|
use catchAdmin\hydraulic\model\Hydraulic;
|
|
|
use catchAdmin\hydraulic\model\Wrench;
|
|
|
+use catchAdmin\hydraulic\server\ExcelServer;
|
|
|
use catchAdmin\system\model\SysDictData;
|
|
|
use catcher\base\CatchRequest;
|
|
|
+use catcher\Code;
|
|
|
+use catcher\library\excel\ExcelContract;
|
|
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
|
|
use PhpParser\Node\Stmt\Catch_;
|
|
|
use think\facade\Db;
|
|
@@ -321,7 +324,6 @@ class HydEquipment extends CatchController
|
|
|
{
|
|
|
$data = $request->get();
|
|
|
$type = $data['type'];
|
|
|
-
|
|
|
$list = $this->hydEquipmentModel->where('equipment_type', $type)->field('id as value,name as text')->select();
|
|
|
return CatchResponse::success($list);
|
|
|
}
|
|
@@ -360,7 +362,6 @@ class HydEquipment extends CatchController
|
|
|
} else {
|
|
|
$data['check_status'] = 1;
|
|
|
}
|
|
|
-
|
|
|
if ($data['status'] = '使用中') {
|
|
|
$data['status'] = 4;
|
|
|
} else if ($data['status'] == '待维修') {
|
|
@@ -372,12 +373,26 @@ class HydEquipment extends CatchController
|
|
|
} else if ($data['status'] == '备用') {
|
|
|
$data['status'] = 3;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
return $data;
|
|
|
};
|
|
|
- return importExcel($request, $map, $this->hydEquipmentModel, $func);
|
|
|
+ $install = function ($data) {
|
|
|
+ $id = $this->hydEquipmentModel->save($data);
|
|
|
+ };
|
|
|
+ $server = ExcelServer::getInterface();
|
|
|
+ return $server->importExcel($request, $map, $func, $install);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @Descripttion: 导出excel
|
|
|
+ * @name: likang
|
|
|
+ * @param {Request} $request
|
|
|
+ * @return {*}
|
|
|
+ */
|
|
|
+ public function exportExcel(Request $request)
|
|
|
+ {
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* @Descripttion: 查看上传的日志
|
|
|
* @name: likang
|
|
@@ -388,14 +403,30 @@ class HydEquipment extends CatchController
|
|
|
//获取设备的imei号
|
|
|
$imei = $request->get('imei');
|
|
|
$pub_ack = new PublishAck();
|
|
|
+ $limit = 10;
|
|
|
+ $page = 1;
|
|
|
+ if ($request->get('page')) {
|
|
|
+ $page = $request->get('page');
|
|
|
+ }
|
|
|
+ if ($request->get('limit')) {
|
|
|
+ $limit = $request->get('limit');
|
|
|
+ }
|
|
|
|
|
|
- $list = Db::name('publish_ack')->where('Imei', $imei)->field('id,PublishVersion,AddTime,Succ,AckTime,Imei')->order('PublishVersion', 'desc')->select()->toArray();
|
|
|
+ $list = Db::name('publish_ack')->where('Imei', $imei)->limit($limit)->page($page)
|
|
|
+ ->field('id,PublishVersion,AddTime,Succ,AckTime,Imei')->order('PublishVersion', 'desc')->select()->toArray();
|
|
|
foreach ($list as $key => $item) {
|
|
|
//时间
|
|
|
$list[$key]['AddTime'] = date('Y-m-d H:i:s', substr($item['AddTime'], 0, 10));
|
|
|
$list[$key]['AckTime'] = date('Y-m-d H:i:s', substr($item['AckTime'], 0, 10));
|
|
|
}
|
|
|
- return CatchResponse::success($list);
|
|
|
+ return json([
|
|
|
+ 'code' => Code::SUCCESS,
|
|
|
+ 'message' => 'success',
|
|
|
+ 'count' => Db::name('publish_ack')->where('Imei', $imei)->count(),
|
|
|
+ 'current' => $page,
|
|
|
+ 'limit' => $limit,
|
|
|
+ 'data' => $list,
|
|
|
+ ]);
|
|
|
}
|
|
|
/**
|
|
|
* @Descripttion: 获取日志详情
|
|
@@ -419,8 +450,6 @@ class HydEquipment extends CatchController
|
|
|
$data = Db::name('publish_ack')->where('id', $id)->value('Extra');
|
|
|
$data = optimize_json($data);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
return CatchResponse::success($data);
|
|
|
}
|
|
|
}
|