Commit e2796ff9 by lujunyi

修改期

parent 8b46e869
...@@ -121,7 +121,7 @@ protected function form() ...@@ -121,7 +121,7 @@ protected function form()
return Form::make(new DrugRepository('tag'), function (Form $form) { return Form::make(new DrugRepository('tag'), function (Form $form) {
$form->display('id')->width(4); $form->display('id')->width(4);
$form->text('name')->width(4)->required()->maxLength(64, '最多输入64个字符'); $form->text('name')->width(4)->required()->maxLength(64, '最多输入64个字符');
$form->text('code')->readonly()->width(4); $form->display('code')->width(4);
$form->select('unit')->options(DrugUnitModel::all()->pluck('name', 'name'))->width(4); $form->select('unit')->options(DrugUnitModel::all()->pluck('name', 'name'))->width(4);
$form->text('spec')->width(4)->required()->maxLength(128, '最多输入128个字符'); $form->text('spec')->width(4)->required()->maxLength(128, '最多输入128个字符');
$form->text('dosage_form')->width(4)->required()->maxLength(128, '最多输入128个字符'); $form->text('dosage_form')->width(4)->required()->maxLength(128, '最多输入128个字符');
......
...@@ -20,7 +20,7 @@ public function setNameAttribute($value) ...@@ -20,7 +20,7 @@ public function setNameAttribute($value)
$this->attributes['name'] = $value; $this->attributes['name'] = $value;
$pinyin = new Pinyin(); $pinyin = new Pinyin();
$abbr = $pinyin->abbr($this->name)->join(''); // 获取拼音首字母 $abbr = $pinyin->abbr($value)->join(''); // 获取拼音首字母
$this->attributes['code'] = strtoupper($abbr); $this->attributes['code'] = strtoupper($abbr);
} }
} }
...@@ -36,10 +36,12 @@ class DrugModel extends Model ...@@ -36,10 +36,12 @@ class DrugModel extends Model
self::RX_FALSE => '否', self::RX_FALSE => '否',
]; ];
public function setCodeAttribute($value) public function setNameAttribute($value)
{ {
$this->attributes['name'] = $value;
$pinyin = new Pinyin(); $pinyin = new Pinyin();
$abbr = $pinyin->abbr($this->name)->join(''); // 获取拼音首字母 $abbr = $pinyin->abbr($value)->join(''); // 获取拼音首字母
$this->attributes['code'] = strtoupper($abbr); $this->attributes['code'] = strtoupper($abbr);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment