cqp 1 week geleden
bovenliggende
commit
bd5e75abea
3 gewijzigde bestanden met toevoegingen van 19 en 1 verwijderingen
  1. 8 1
      app/Model/CostManagement.php
  2. 7 0
      app/Service/CostManagementService.php
  3. 4 0
      config/header/81.php

+ 8 - 1
app/Model/CostManagement.php

@@ -10,5 +10,12 @@ class CostManagement extends UseScopeBaseModel
     protected $dateFormat = 'U';
     const employee_column = "crt_id";
 
-    public static $field = ['man_mark','id','mark','amount','crt_id','crt_time','customer_supply_id', 'order_time'];
+    public static $field = ['man_mark','id','mark','amount','crt_id','crt_time','customer_supply_id', 'order_time', 'is_open'];
+
+    const is_open = 1;
+    const is_not_open = 0;
+    const IS_OPEN_title = [
+        self::is_not_open => '否',
+        self::is_open => '是'
+    ];
 }

+ 7 - 0
app/Service/CostManagementService.php

@@ -23,6 +23,7 @@ class CostManagementService extends Service
             $model->man_mark = $data['man_mark'] ?? '';
             $model->mark = $data['mark'] ?? '';
             $model->amount = $data['amount'] ?? 0;
+            $model->is_open = $data['is_open'] ?? 1;
             $model->save();
 
             DB::commit();
@@ -48,6 +49,8 @@ class CostManagementService extends Service
             $model->mark = $data['mark'] ?? '';
             $model->amount = $data['amount'] ?? 0;
             $model->crt_id = $user['id'];
+            $model->is_open = $data['is_open'] ?? 1;
+
             $model->save();
 
             DB::commit();
@@ -112,6 +115,7 @@ class CostManagementService extends Service
 
         if(! empty($data['man_mark'])) $model->where('man_mark', 'LIKE', '%'.$data['man_mark'].'%');
         if(! empty($data['id'])) $model->whereIn('id', $data['id']);
+        if(isset($data['is_open'])) $model->where('is_open', $data['is_open']);
         if(! empty($data['crt_time'][0]) && ! empty($data['crt_time'][1])) {
             $return = $this->changeDateToTimeStampAboutRange($data['crt_time']);
             $model->where('crt_time','>=',$return[0]);
@@ -137,6 +141,8 @@ class CostManagementService extends Service
         if(empty($data['amount'])) return [false, '总金额不能为空'];
         $res = $this->checkNumber($data['amount'],2,'positive');
         if(! $res['valid']) return [false,'总金额:' . $res['error']];
+        if(! isset($data['is_open']) || ! isset(CostManagement::IS_OPEN_title[$data['is_open']])) return [false, '费用状态不能为空'];
+
         if($is_add){
 
         }else{
@@ -160,6 +166,7 @@ class CostManagementService extends Service
             $data['data'][$key]['order_time'] = $value['order_time'] ? date('Y-m-d',$value['order_time']) : '';
             $data['data'][$key]['crt_name'] = $emp[$value['crt_id']] ?? '';
             $data['data'][$key]['customer_supply_title'] = $emp_2[$value['customer_supply_id']] ?? '';
+            $data['data'][$key]['is_open_title'] = CostManagement::IS_OPEN_title[$value['is_open']] ?? '';
         }
 
         return $data;

+ 4 - 0
config/header/81.php

@@ -35,4 +35,8 @@ return [
         'key' =>'crt_time',
         'value' => '创建时间',
     ],
+    [
+        'key' =>'is_open_title',
+        'value' => '费用状态',
+    ],
 ];