mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 06:20:50 +00:00
Merge branch 'v5.0.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v5.0.0dev
This commit is contained in:
commit
9006bd4a1a
@ -536,6 +536,7 @@ class SystemCrudServices extends BaseServices
|
||||
$controller = app()->make(Controller::class);
|
||||
$controller->setFilePathName($filePath['controller'] ?? '')->setbasePath($basePath)->handle($tableName, [
|
||||
'usePath' => $service->getUsePath(),
|
||||
'validateName' => '\\' . str_replace('/', '\\', $validate->getUsePath()) . '::class',
|
||||
'field' => array_column($options['fromField'], 'field'),
|
||||
]);
|
||||
//生成路由
|
||||
|
||||
@ -53,8 +53,8 @@ class Controller extends Make
|
||||
{
|
||||
$path = $options['path'] ?? '';
|
||||
$contentPhp = '';
|
||||
$var = ["{%date%}"];
|
||||
$fieldPhp = [$this->value['date']];
|
||||
$var = ["{%date%}", '{%validateName%}'];
|
||||
$fieldPhp = [$this->value['date'], $options['validateName'] ?? ''];
|
||||
|
||||
$action = $options['action'] ?? [];
|
||||
$field = $options['field'] ?? [];
|
||||
@ -94,7 +94,7 @@ class Controller extends Make
|
||||
$this->value['name'] = $className;
|
||||
$this->value['path'] = $this->getfolderPath($path);
|
||||
$this->value['content-php'] = $contentPhp;
|
||||
$this->value['use-php'] = "use " . $options['usePath'] . "Services;\n";
|
||||
$this->value['use-php'] = "use " . str_replace('/', '\\', $options['usePath']) . "Services;\n";
|
||||
|
||||
$contentStr = str_replace($this->var, $this->value, $contentController);
|
||||
|
||||
|
||||
@ -236,7 +236,7 @@ abstract class Make
|
||||
$this->value['path'] = $this->getfolderPath($path);
|
||||
}
|
||||
if (isset($this->value['use-php']) && !empty($options['usePath'])) {
|
||||
$this->value['use-php'] = "use " . $options['usePath'] . ";\n";
|
||||
$this->value['use-php'] = "use " . str_replace('/', '\\', $options['usePath']) . ";\n";
|
||||
}
|
||||
|
||||
$contentStr = str_replace($this->var, $this->value, $content);
|
||||
|
||||
@ -75,7 +75,7 @@ class Service extends Make
|
||||
$from[] = $this->tab(2) . $this->getframeImagesPhpContent($item['field'], $item['name'], $item['required'] ?? false) . ';';
|
||||
break;
|
||||
default:
|
||||
$from[] = $this->tab(2) . '$rule[] = FormBuilder::' . $item['type'] . '("' . $item['field'] . '","' . $item['name'] . '",$info["' . $item['field'] . '"] ?? "")' . $this->getOptionContent($item['option'] ?? []) . (!empty($item['required']) ? '->required()' : '') . ';';
|
||||
$from[] = $this->tab(2) . '$rule[] = FormBuilder::' . $item['type'] . '("' . $item['field'] . '","' . $item['name'] . '",$info["' . $item['field'] . '"] ?? "")' . $this->getOptionContent(in_array($item['type'], ['radio']), $item['option'] ?? []) . (!empty($item['required']) ? '->required()' : '') . ';';
|
||||
break;
|
||||
}
|
||||
|
||||
@ -117,9 +117,9 @@ class Service extends Make
|
||||
* @email 136327134@qq.com
|
||||
* @date 2023/3/23
|
||||
*/
|
||||
protected function getOptionContent(array $option = [])
|
||||
protected function getOptionContent(bool $isOption, array $option = [])
|
||||
{
|
||||
if (!$option) {
|
||||
if (!$option && $isOption) {
|
||||
$option = [
|
||||
['value' => 1, 'label' => '开启'],
|
||||
['value' => 0, 'label' => '关闭']
|
||||
|
||||
@ -88,8 +88,9 @@ class ViewPages extends Make
|
||||
}
|
||||
$columnStr[] = ($key == 0 ? $this->tab(2) : '') . "{\n" . $this->tab(3) . "title:\"{$item['name']}\"," . $this->tab(2) . "\n" . $this->tab(3) . "key:\"{$item['field']}\"\n" . $this->tab(2) . "}\n";
|
||||
}
|
||||
$this->value['route'] = $route;
|
||||
$this->value['auth'] = Str::snake($name);
|
||||
$this->value['componentName'] = $this->value['auth'];
|
||||
$this->value['route'] = $route;
|
||||
$this->value['content-vue'] = $columnStr ? "\n" . implode($this->tab(2) . ',', $columnStr) . $this->tab(2) . ',' : '';
|
||||
$this->value['pathApiJs'] = $options['pathApiJs'] ?? '';
|
||||
$this->value['nameStudly'] = Str::studly($name);
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
{%field-php%}
|
||||
]);
|
||||
|
||||
validate({%validateName%})->check($data);
|
||||
|
||||
$this->service->crudSave($data);
|
||||
|
||||
return app('json')->success(100021);
|
||||
|
||||
@ -14,6 +14,8 @@
|
||||
{%field-php%}
|
||||
]);
|
||||
|
||||
validate({%validateName%})->check($data);
|
||||
|
||||
$this->service->crudUpdate((int)$id, $data);
|
||||
|
||||
return app('json')->success(100001);
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
import { mapState } from 'vuex';
|
||||
import { {%nameCamel%}SaveApi, {%nameCamel%}DeleteApi, {%nameCamel%}UpdateApi, get{%nameStudly%}CreateApi, get{%nameStudly%}EditApi, get{%nameStudly%}ListApi} from '{%pathApiJs%}';
|
||||
export default {
|
||||
name: 'user_group',
|
||||
name: '{%componentName%}',
|
||||
data() {
|
||||
return {
|
||||
grid: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user