dcat-admin / form-step Goto Github PK
View Code? Open in Web Editor NEWDcat Admin 分步表单扩展
Home Page: http://www.dcatadmin.com/
License: MIT License
Dcat Admin 分步表单扩展
Home Page: http://www.dcatadmin.com/
License: MIT License
protected function form()
{
return Form::make(new ShopGood(), function (Form $form) {
$form->title('商品');
$formStep = $form->multipleSteps();
$formStep->add('商品分类', function ($step) {
$step->tree('type_id')
->nodes(ShopType::get()->toArray())
->setIdColumn('id')
->setTitleColumn('title')
->setParentColumn('pid')
->customFormat(function ($v) { // 格式化外部注入的值
if (!$v) return [];
return array_column($v, 'id');
})->required();
});
$formStep->add('商品基本信息', function ($step) {
$step->text('title')->required();
$step->weditor('body')->required();
$step->select('sku_type')->options(Model::nodeSkuTypeSelect())->default(1)
->when([1], function ($step) {
$step->currency('price');
})->when([2], function ($step) {
$sku_params = [
[
'name' => '进货价',
'field' => 'price_buy',
'default' => '',
],
[
'name' => '市场价',
'field' => 'price_mark',
'default' => '',
],
];
$step->sku('sku', json_encode($sku_params))
->display(true)
->customFormat(function ($value) use ($step) {
if ($value === null) {
$data = new \stdClass();
$data->attrs = [
'颜色' => [
'红色',
'蓝色',
],
'大小' => [
'20',
],
];
$data->sku = [
[
"颜色" => "红色",
"大小" => '20',
"pic" => '',
"stock" => '1',
"price" => '100',
],
];
return json_encode($data);
}
return null;
});
});
});
$form->tools(function (Form\Tools $tools) {
$tools->disableDelete();
});
});
}
官网的demodown下来也用不了了
可以提交一下 packages 吗?方便 composer 方式的安装。
靓仔,分步表单的东西都用不上了,可以修复一下吗
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.