Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a0ff912b5 | ||
|
|
517fd191d3 | ||
|
|
d1dfa8b49b | ||
|
|
c819751a66 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -9,4 +9,4 @@ Thumbs.db
|
|||||||
/vendor
|
/vendor
|
||||||
/.settings
|
/.settings
|
||||||
/.buildpath
|
/.buildpath
|
||||||
/.project
|
/.project
|
||||||
|
|||||||
@@ -1041,7 +1041,7 @@ class BuildCurd
|
|||||||
$relationCode = '';
|
$relationCode = '';
|
||||||
foreach ($this->relationArray as $key => $val) {
|
foreach ($this->relationArray as $key => $val) {
|
||||||
$relation = CommonTool::lineToHump($key);
|
$relation = CommonTool::lineToHump($key);
|
||||||
$relationCode = "with(['{$relation}'])";
|
$relationCode = "withJoin('{$relation}', 'LEFT')";
|
||||||
if (!empty($val['bindSelectField']) && !empty($val['primaryKey'])) {
|
if (!empty($val['bindSelectField']) && !empty($val['primaryKey'])) {
|
||||||
$constructRelation = '$notes["' . lcfirst($val['foreignKey']) . '"] = \app\admin\model\\' . $val['modelFilename'] . '::column("' . $val['bindSelectField'] . '", "' . $val['primaryKey'] . '");';
|
$constructRelation = '$notes["' . lcfirst($val['foreignKey']) . '"] = \app\admin\model\\' . $val['modelFilename'] . '::column("' . $val['bindSelectField'] . '", "' . $val['primaryKey'] . '");';
|
||||||
}
|
}
|
||||||
@@ -1101,8 +1101,8 @@ class BuildCurd
|
|||||||
[
|
[
|
||||||
'relationMethod' => $relation,
|
'relationMethod' => $relation,
|
||||||
'relationModel' => "{$val['modelFilename']}::class",
|
'relationModel' => "{$val['modelFilename']}::class",
|
||||||
'foreignKey' => $val['primaryKey'],
|
'foreignKey' => $val['foreignKey'],
|
||||||
'primaryKey' => $val['foreignKey'],
|
'primaryKey' => $val['primaryKey'],
|
||||||
'relationFields' => empty($val['onlyFields']) ? "" : "->field('{$val['primaryKey']}," . implode(',', $val['onlyFields']) . "')",
|
'relationFields' => empty($val['onlyFields']) ? "" : "->field('{$val['primaryKey']}," . implode(',', $val['onlyFields']) . "')",
|
||||||
]);
|
]);
|
||||||
$relationList .= $relationCode;
|
$relationList .= $relationCode;
|
||||||
@@ -1403,13 +1403,12 @@ class BuildCurd
|
|||||||
} else {
|
} else {
|
||||||
$templateValue = "{field: '{$field}', title: '{$val['comment']}'}";
|
$templateValue = "{field: '{$field}', title: '{$val['comment']}'}";
|
||||||
}
|
}
|
||||||
|
|
||||||
$indexCols .= $this->formatColsRow("{$templateValue},\r");
|
$indexCols .= $this->formatColsRow("{$templateValue},\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关联表
|
// 关联表
|
||||||
foreach ($this->relationArray as $table => $tableVal) {
|
foreach ($this->relationArray as $table => $tableVal) {
|
||||||
$table = CommonTool::lineToHump($table);
|
$table = CommonTool::humpToLine($table);
|
||||||
foreach ($tableVal['tableColumns'] as $field => $val) {
|
foreach ($tableVal['tableColumns'] as $field => $val) {
|
||||||
if ($val['formType'] == 'image') {
|
if ($val['formType'] == 'image') {
|
||||||
$templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ea.table.image}";
|
$templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ea.table.image}";
|
||||||
@@ -1430,7 +1429,7 @@ class BuildCurd
|
|||||||
} elseif (in_array($field, $this->sortFields)) {
|
} elseif (in_array($field, $this->sortFields)) {
|
||||||
$templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', edit: 'text'}";
|
$templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', edit: 'text'}";
|
||||||
} else {
|
} else {
|
||||||
$templateValue = "";
|
$templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}'}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($templateValue) $indexCols .= $this->formatColsRow("{$templateValue},\r");
|
if ($templateValue) $indexCols .= $this->formatColsRow("{$templateValue},\r");
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
return $this->selectList();
|
return $this->selectList();
|
||||||
}
|
}
|
||||||
list($page, $limit, $where) = $this->buildTableParams();
|
list($page, $limit, $where) = $this->buildTableParams();
|
||||||
$count = self::$model::where($where)->count();
|
$count = self::$model::where($where)->{{relationIndexMethod}}->count();
|
||||||
$list = self::$model::where($where)->{{relationIndexMethod}}->page($page, $limit)->order($this->sort)->select()->toArray();
|
$list = self::$model::where($where)->{{relationIndexMethod}}->page($page, $limit)->order($this->sort)->select()->toArray();
|
||||||
$data = [
|
$data = [
|
||||||
'code' => 0,
|
'code' => 0,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
public function {{relationMethod}}()
|
public function {{relationMethod}}()
|
||||||
{
|
{
|
||||||
return $this->hasOne({{relationModel}}, '{{foreignKey}}', '{{primaryKey}}'){{relationFields}};
|
return $this->belongsTo({{relationModel}}, '{{foreignKey}}', '{{primaryKey}}'){{relationFields}};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,6 +91,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 文档:https://xm-select.com/file/xm-select/v1.2.4/#/basic/use -->
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">模拟多选</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<div id="demo1" class="xm-select-demo"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="layui-form-item layui-form-text">
|
<div class="layui-form-item layui-form-text">
|
||||||
<label class="layui-form-label">备注信息</label>
|
<label class="layui-form-label">备注信息</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
|
|||||||
@@ -92,6 +92,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 文档:https://xm-select.com/file/xm-select/v1.2.4/#/basic/use -->
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">模拟多选</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<div id="demo1" class="xm-select-demo"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="layui-form-item layui-form-text">
|
<div class="layui-form-item layui-form-text">
|
||||||
<label class="layui-form-label">备注信息</label>
|
<label class="layui-form-label">备注信息</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
|
|||||||
2
extend/.gitignore
vendored
2
extend/.gitignore
vendored
@@ -1,2 +1,2 @@
|
|||||||
*
|
*
|
||||||
!.gitignore
|
!.gitignore
|
||||||
|
|||||||
@@ -93,6 +93,25 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
|||||||
aiOptimization(data)
|
aiOptimization(data)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let colors = [
|
||||||
|
'#f10f0f', // 红色
|
||||||
|
'#ffaf00', // 橙色
|
||||||
|
'#FF69B4', // 猛男粉
|
||||||
|
'#0087ff', // 蓝色
|
||||||
|
'#00ff00', // 青青草原
|
||||||
|
];
|
||||||
|
var demo1 = xmSelect.render({
|
||||||
|
el: '#demo1',
|
||||||
|
name: 'xxx', // form表单提交的name
|
||||||
|
theme: {color: colors[Math.floor(Math.random() * colors.length)]},
|
||||||
|
data: [
|
||||||
|
{name: 'Make', value: 1},
|
||||||
|
{name: 'PHP', value: 2},
|
||||||
|
{name: 'Great Again', value: 3},
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
ea.listen();
|
ea.listen();
|
||||||
},
|
},
|
||||||
edit: function () {
|
edit: function () {
|
||||||
@@ -103,6 +122,25 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
|||||||
aiOptimization(data)
|
aiOptimization(data)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let colors = [
|
||||||
|
'#f10f0f', // 红色
|
||||||
|
'#ffaf00', // 橙色
|
||||||
|
'#FF69B4', // 猛男粉
|
||||||
|
'#0087ff', // 蓝色
|
||||||
|
'#00ff00', // 青青草原
|
||||||
|
];
|
||||||
|
var demo1 = xmSelect.render({
|
||||||
|
el: '#demo1',
|
||||||
|
name: 'xxx', // form表单提交的name
|
||||||
|
theme: {color: colors[Math.floor(Math.random() * colors.length)]},
|
||||||
|
data: [
|
||||||
|
{name: 'Make', value: 1},
|
||||||
|
{name: 'PHP', value: 2, selected: true,},
|
||||||
|
{name: 'Great Again', value: 3, selected: true,},
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
ea.listen();
|
ea.listen();
|
||||||
},
|
},
|
||||||
stock: function () {
|
stock: function () {
|
||||||
|
|||||||
@@ -10,10 +10,4 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
use think\facade\Route;
|
use think\facade\Route;
|
||||||
|
|
||||||
Route::get('think', function () {
|
|
||||||
return 'hello,ThinkPHP6!';
|
|
||||||
});
|
|
||||||
|
|
||||||
Route::get('hello/:name', 'index/hello');
|
|
||||||
|
|
||||||
Route::any('install', '\app\index\controller\Install@index');
|
Route::any('install', '\app\index\controller\Install@index');
|
||||||
|
|||||||
2
runtime/.gitignore
vendored
2
runtime/.gitignore
vendored
@@ -1,2 +1,2 @@
|
|||||||
*
|
*
|
||||||
!.gitignore
|
!.gitignore
|
||||||
|
|||||||
Reference in New Issue
Block a user