Browse Source

处理datetime类型

master
李可松 4 years ago
parent
commit
59fe0de9d0
  1. 4
      app/AdminAgent/Forms/IndustryProductBuy.php
  2. 5
      app/AdminSupplier/Controllers/DiyFormController.php
  3. 1
      resources/lang/zh_CN/diy-form.php

4
app/AdminAgent/Forms/IndustryProductBuy.php

@ -185,13 +185,15 @@ class IndustryProductBuy extends Form
$this->{$v['type']}('info.' . $v['field'])->options(array_combine($v['options'], $v['options']))->required((bool)$v['required']); $this->{$v['type']}('info.' . $v['field'])->options(array_combine($v['options'], $v['options']))->required((bool)$v['required']);
} else if ($v['type'] == 'image') { } else if ($v['type'] == 'image') {
$this->multipleImage('info.' . $v['field'])->uniqueName()->saveFullUrl()->required((bool)$v['required']); $this->multipleImage('info.' . $v['field'])->uniqueName()->saveFullUrl()->required((bool)$v['required']);
} else if ($v['type'] == 'datetime') {
$this->datetime('info.' . $v['field'])->format($v['format'] ?? 'YYYY-MM-DD HH:mm')->required((bool)$v['required']);
} else { } else {
$this->{$v['type']}('info.' . $v['field'])->required((bool)$v['required']); $this->{$v['type']}('info.' . $v['field'])->required((bool)$v['required']);
} }
} }
} }
$this->html(Alert::make(null, '产品信息')->info())->width(12);
$this->html(Alert::make(null, '产品信息确认')->info())->width(12);
$this->text('', '购买产品')->default($industry->title)->disable(); $this->text('', '购买产品')->default($industry->title)->disable();
$this->text('', '单价')->default($industry->price)->disable(); $this->text('', '单价')->default($industry->price)->disable();
$this->text('', '库存')->default($industry->stock)->disable(); $this->text('', '库存')->default($industry->stock)->disable();

5
app/AdminSupplier/Controllers/DiyFormController.php

@ -100,6 +100,11 @@ class DiyFormController extends AdminController
->options(admin_trans('diy-form.options')) ->options(admin_trans('diy-form.options'))
->when(['radio', 'checkbox'], function (Form\NestedForm $form) { ->when(['radio', 'checkbox'], function (Form\NestedForm $form) {
$form->list('options', '选项列表'); $form->list('options', '选项列表');
})
->when('datetime', function (Form\NestedForm $form) {
$form->text('format', '格式')
->default('YYYY-MM-DD HH:mm')
->help('默认格式:YYYY-MM-DD HH:mm。YYYY:年,MM:月,DD:日,HH:时,mm:分');
}); });
$form->number('sort', '排序') $form->number('sort', '排序')
->help('数字越小越靠前') ->help('数字越小越靠前')

1
resources/lang/zh_CN/diy-form.php

@ -17,5 +17,6 @@ return [
'radio' => '单选框', 'radio' => '单选框',
'checkbox' => '多选框', 'checkbox' => '多选框',
'image' => '图片上传', 'image' => '图片上传',
'datetime' => '日期时间',
], ],
]; ];
Loading…
Cancel
Save