|
@@ -72,7 +72,7 @@ class Depart extends Backend
|
|
|
}
|
|
|
|
|
|
$this->success('', [
|
|
|
- 'list' => $list,
|
|
|
+ 'list' => $arr,
|
|
|
'total' => $res->total(),
|
|
|
'remark' => get_route_remark(),
|
|
|
]);
|
|
@@ -108,7 +108,7 @@ class Depart extends Backend
|
|
|
$attachment = '';
|
|
|
try {
|
|
|
$upload = new Upload($file);
|
|
|
- $attachment = $upload->upload(null, $this->auth->id);
|
|
|
+ $attachment = $upload->upload(null, $this->auth->ID);
|
|
|
unset($attachment['create_time'], $attachment['quote']);
|
|
|
} catch (Throwable $e) {
|
|
|
$this->error($e->getMessage());
|
|
@@ -139,6 +139,7 @@ class Depart extends Backend
|
|
|
'depart_name'=>$val[0], //科室名称
|
|
|
'depart_code'=>$val[1], //科室编码
|
|
|
'institution_id'=>$institution, //所属机构
|
|
|
+ 'create_datetime'=>date('Y-m-d H:i:s'),
|
|
|
];
|
|
|
}
|
|
|
Cache::delete('allDepart');
|
|
@@ -163,7 +164,7 @@ class Depart extends Backend
|
|
|
$attachment = '';
|
|
|
try {
|
|
|
$upload = new Upload($file);
|
|
|
- $attachment = $upload->upload(null, $this->auth->id);
|
|
|
+ $attachment = $upload->uploadExcel(null, $this->auth->ID);
|
|
|
unset($attachment['create_time'], $attachment['quote']);
|
|
|
} catch (Throwable $e) {
|
|
|
$this->error($e->getMessage());
|
|
@@ -189,12 +190,6 @@ class Depart extends Backend
|
|
|
$data = [];
|
|
|
$admin = new Admin();
|
|
|
foreach ($excel_data as $key=>$val) {
|
|
|
- foreach ($val as &$v) {
|
|
|
- $v = str_replace(' ', '', trim($v));
|
|
|
- $v = str_replace("\xC2\xA0", '', $v);
|
|
|
- }
|
|
|
- unset($v);
|
|
|
-
|
|
|
//加密盐
|
|
|
$salt = Random::build('alnum', 16);
|
|
|
//密码
|
|
@@ -282,7 +277,12 @@ class Depart extends Backend
|
|
|
{
|
|
|
$pk = $this->model->getPk();
|
|
|
$id = $this->request->param($pk);
|
|
|
- $row = $this->model->find($id);
|
|
|
+ $arr = $this->model->find($id);
|
|
|
+ $row = [];
|
|
|
+ foreach ($arr->toArray() as $k=>$v)
|
|
|
+ {
|
|
|
+ $row[strtolower($k)] = $v;
|
|
|
+ }
|
|
|
if (!$row) {
|
|
|
$this->error(__('Record not found'));
|
|
|
}
|
|
@@ -316,7 +316,7 @@ class Depart extends Backend
|
|
|
{
|
|
|
$data['create_user'] = Admin::where('id',$data['create_user_id'])->value('nickname');
|
|
|
}
|
|
|
- $result = $row->save($data);
|
|
|
+ $result = $arr->save($data);
|
|
|
$this->model->commit();
|
|
|
Cache::delete('allDepart');
|
|
|
} catch (Throwable $e) {
|