generated from liutk/owl-admin-base
Update
parent
882f2bdb7c
commit
24e6ac6a7d
|
|
@ -108,7 +108,7 @@ class PlanController extends AdminController
|
|||
->visibleOn('${planable_type == "plan_performances"}'),
|
||||
amis()->TreeSelectControl()
|
||||
->name('plan_performance[store_category_id]')
|
||||
->label(__('plan.plan.store_category_id'))
|
||||
->label(__('plan.plan.store_category'))
|
||||
->source(admin_url('api/keywords/tree-list?parent_key=store_category'))
|
||||
->labelField('name')
|
||||
->valueField('key')
|
||||
|
|
@ -118,7 +118,7 @@ class PlanController extends AdminController
|
|||
->visibleOn('${planable_type == "plan_performances"}'),
|
||||
amis()->SelectControl()
|
||||
->name('plan_performance[store_level_id]')
|
||||
->label(__('plan.plan.store_level_id'))
|
||||
->label(__('plan.plan.store_level'))
|
||||
->source(admin_url('api/keywords/tree-list?parent_key=store_level'))
|
||||
->labelField('name')
|
||||
->valueField('key')
|
||||
|
|
@ -143,6 +143,18 @@ class PlanController extends AdminController
|
|||
->required()
|
||||
->valueFormat('YYYY-MM')
|
||||
->visibleOn('${planable_type == "plan_hygienes"}'),
|
||||
amis()->SelectControl()
|
||||
->name('plan_hygiene[store_ids]')
|
||||
->label(__('plan.plan.store'))
|
||||
->value('${planable.store_ids}')
|
||||
->multiple()
|
||||
->joinValues(false)
|
||||
->extractValue(true)
|
||||
->source(admin_url('api/stores?_all=1'))
|
||||
->labelField('title')
|
||||
->valueField('id')
|
||||
->searchable()
|
||||
->visibleOn('${planable_type == "plan_hygienes"}'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class PlanService extends BaseService
|
|||
$planable = PlanPerformance::create($data['plan_performance']);
|
||||
break;
|
||||
|
||||
case 'plan_performances':
|
||||
case 'plan_hygienes':
|
||||
$planable = PlanHygiene::create($data['plan_hygiene']);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphOne;
|
||||
|
|
@ -12,10 +13,25 @@ class PlanHygiene extends Model
|
|||
|
||||
protected $fillable = [
|
||||
'month',
|
||||
'store_ids',
|
||||
];
|
||||
|
||||
public function plan(): MorphOne
|
||||
{
|
||||
return $this->morphOne(Plan::class, 'planable');
|
||||
}
|
||||
|
||||
protected function storeIds(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: function (mixed $value) {
|
||||
if (! is_array($photos = json_decode($value ?? '', true))) {
|
||||
$photos = [];
|
||||
}
|
||||
|
||||
return $photos;
|
||||
},
|
||||
set: fn (mixed $value) => json_encode(is_array($value) ? $value : []),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ return new class extends Migration
|
|||
Schema::create('plan_hygienes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('month')->comment('月份: 2024-04');
|
||||
$table->json('store_ids')->nullable()->comment('门店');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@ return [
|
|||
'created_at' => '创建时间',
|
||||
'updated_at' => '更新时间',
|
||||
'month' => '月份',
|
||||
'store_category_id' => '门店分类',
|
||||
'store_level_id' => '门店等级',
|
||||
'store' => '门店',
|
||||
'store_category' => '门店分类',
|
||||
'store_level' => '门店等级',
|
||||
'performance' => '业绩',
|
||||
],
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue