完全vue渲染列表的功能

去掉不必要的js函数定义
修改返回json的方式
This commit is contained in:
乐风 2021-03-15 06:12:12 +08:00
parent d795809fb3
commit 975be7cc91
135 changed files with 402 additions and 792 deletions

View File

@ -151,9 +151,7 @@ class MarketController extends DefaultController
$model->selectRaw($sql);
$rows = $model->paginate();
$items = Grid::dataFilters($rows, $header);
return response()->json($items);
return Grid::dataFilters($rows, $header);
}
}
}

View File

@ -15,11 +15,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
action.fee_detail = function(data) {
viewDialog({
title: '兑现明细',

View File

@ -13,13 +13,6 @@
var action = config.action;
var search = config.search;
//action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -15,11 +15,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -51,7 +51,6 @@ class ArticleController extends DefaultController
$header['cols'] = $cols;
$header['tabs'] = Article::$tabs;
$header['bys'] = Article::$bys;
$header['js'] = Grid::js($header);
$search = $header['search_form'];
$query = $search['query'];

View File

@ -34,7 +34,7 @@ class WidgetController extends DefaultController
$json['total'] = sizeof($rows);
$json['data'] = $rows;
return response()->json($json);
return $json;
}
return $this->render();
}

View File

@ -7,7 +7,7 @@ class Article extends BaseModel
protected $table = 'article';
public static $tabs = [
'name' => 'tab',
'name' => 'tab',
'items' => [
['url' => 'article/article/index', 'name' => '未读', 'value' => 'unread'],
['url' => 'article/article/index', 'name' => '已读', 'value' => 'done'],
@ -16,7 +16,7 @@ class Article extends BaseModel
];
public static $bys = [
'name' => 'by',
'name' => 'by',
'items' => [
['value' => '', 'name' => '全部'],
['value' => 'divider'],

View File

@ -1,66 +1,50 @@
<div id="{{$header['master_table']}}-controller">
<div class="vue-list-page" id="{{$header['master_table']}}-controller">
<div class="panel no-border">
@include('headers')
<div class="panel-header">
@include('headers2')
</div>
<div class='list-jqgrid'>
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
</div>
</div>
</div>
{{$header["js"]}}
<script>
Vue.createApp({
setup(props, ctx) {
var table = '{{$header["master_table"]}}';
(function ($) {
var header = {{json_encode($header, JSON_UNESCAPED_UNICODE)}};
var config = new gdoo.grid(table);
var table = '{{$header["master_table"]}}';
var config = gdoo.grids[table];
var action = config.action;
var search = config.search;
var grid = config.grid;
grid.remoteDataUrl = '{{url()}}';
grid.onRowDoubleClicked = function (params) {
if (params.node.rowPinned) {
return;
}
if (params.data == undefined) {
return;
}
if (params.data.master_id > 0) {
action.show(params.data);
}
};
action.dialogType = 'layer';
var action = config.action;
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
var setup = config.setup;
Vue.onMounted(function() {
var gridDiv = document.querySelector("#" + table + "-grid");
gridDiv.style.height = getPanelHeight(136);
new agGrid.Grid(gridDiv, grid);
// 初始化数据
grid.remoteData({page: 1}, function(res) {
config.init(res);
});
});
return setup;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);
options.remoteDataUrl = '{{url()}}';
options.remoteParams = search.advanced.query;
options.columnDefs = config.cols;
options.onRowDoubleClicked = function (params) {
if (params.node.rowPinned) {
return;
}
if (params.data == undefined) {
return;
}
if (params.data.master_id > 0) {
action.show(params.data);
}
};
new agGrid.Grid(gridDiv, options);
// 读取数据
options.remoteData({page: 1});
// 绑定自定义事件
var $gridDiv = $(gridDiv);
$gridDiv.on('click', '[data-toggle="event"]', function () {
var data = $(this).data();
if (data.master_id > 0) {
action[data.action](data);
}
});
config.grid = options;
})(jQuery);
</script>
@include('footers')
}).mount("#{{$header['master_table']}}-controller");
</script>

View File

@ -1,105 +0,0 @@
<style>
.vue-list-page .search-inline-form .form-group {
margin-left: 4px;
}
.vue-list-page .btn-group {
margin-left: 4px;
}
</style>
<div class="vue-list-page" id="{{$header['master_table']}}-controller">
<div class="panel no-border">
@include('headers3')
<div class='list-jqgrid'>
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
</div>
</div>
</div>
{{$header["js"]}}
<script>
(function ($) {
var header = {{json_encode($header, JSON_UNESCAPED_UNICODE)}};
var table = '{{$header["master_table"]}}';
var config = gdoo.grids[table];
var action = config.action;
var search = config.search;
const vueData = {
data() {
return {
header: {},
tab_active: '',
}
},mounted() {
abc(this);
},
methods: {
url(url, query) {
var me = this;
let params = Vue.toRaw(me.header.search_form.params);
for (const key in query) {
params[key] = query[key];
}
return app.url(url, params);
}
}
}
Vue.createApp(vueData).mount("#{{$header['master_table']}}-controller");
function abc(vue) {
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);
options.remoteDataUrl = '{{url()}}';
options.remoteParams = search.advanced.query;
options.columnDefs = config.cols;
options.onRowDoubleClicked = function (params) {
if (params.node.rowPinned) {
return;
}
if (params.data == undefined) {
return;
}
if (params.data.master_id > 0) {
action.show(params.data);
}
};
new agGrid.Grid(gridDiv, options);
// 读取数据
options.remoteData({page: 1});
options.remoteSuccessed = function(res) {
vue.header = res.header;
vue.tab_active = vue.header.search_form.params['tab'] ? vue.header.search_form.params['tab'] : vue.header.tabs.items[0].value;
};
// 绑定自定义事件
var $gridDiv = $(gridDiv);
$gridDiv.on('click', '[data-toggle="event"]', function () {
var data = $(this).data();
if (data.master_id > 0) {
action[data.action](data);
}
});
config.grid = options;
}
})(jQuery);
</script>
@include('footers')

View File

@ -57,7 +57,7 @@ class EventController extends DefaultController
$events[] = $row;
}
}
return response()->json($events);
return $events;
}
// 客户端显示事件列表
@ -120,7 +120,7 @@ class EventController extends DefaultController
$repeat = CalendarObjectService::getEventRepeat($master, '1D', 'Y-n-j');
$items = array_merge($items, $repeat);
}
return response()->json($items);
return $items;
}
// 调整事件

View File

@ -92,7 +92,7 @@ class BusinessController extends DefaultController
$row['address'] = str_replace("\n", " ", $row['address']);
$attachments = AttachmentService::show($row['attachment']);
$row['attachments'] = $attachments['main'];
return response()->json($row);
return $row;
}
// 负责人列表

View File

@ -142,7 +142,7 @@ class ContactController extends DefaultController
$item['text'] = $item['name'];
return $item;
});
return response()->json($items);
return $items;
}
$query['form_id'] = $query['jqgrid'] == '' ? $query['id'] : $query['jqgrid'];
return $this->render([

View File

@ -102,7 +102,7 @@ class CustomerClassController extends DefaultController
}
}
$rows = $model->get();
return response()->json(['data' => $rows]);
return ['data' => $rows];
}
return $this->render([
'search' => $search

View File

@ -278,19 +278,14 @@ class CustomerController extends DefaultController
if ($query['suggest']) {
$rows = $model->limit(15)->get();
$data = Grid::dataFilters($rows, $header, function($item) {
return $item;
});
$items['data'] = $data;
} else {
$rows = $model->paginate($query['limit']);
$items = Grid::dataFilters($rows, $header, function($item) {
$item['text'] = $item['name'];
$item['sid'] = 'u'.$item['user_id'];
return $item;
});
}
return response()->json($items);
return Grid::dataFilters($rows, $header, function($item) {
$item['text'] = $item['name'];
$item['sid'] = 'u'.$item['user_id'];
return $item;
});
}
return $this->render([
'search' => $search,

View File

@ -139,11 +139,7 @@ class DeliveryAddressController extends DefaultController
$model->select($header['select']);
$rows = $model->paginate($query['limit']);
if (isset($query['autocomplete'])) {
return response()->json($rows->items());
}
return response()->json($rows);
return $rows;
}
return $this->render([
'search' => $search,

View File

@ -140,7 +140,7 @@ class RegionController extends DefaultController
foreach($rows as $row) {
$json[] = $row;
}
return response()->json(['data' => $json]);
return ['data' => $json];
}
return $this->render([
'search' => $search

View File

@ -135,8 +135,7 @@ class TaxController extends AuditController
}
$model->select(['customer_tax.*','customer.code as customer_code', 'customer.name as customer_name']);
$rows = $model->paginate($query['limit']);
return response()->json($rows);
return $model->paginate($query['limit']);
}
return $this->render([
'search' => $search,

View File

@ -97,7 +97,7 @@ class TypeController extends DefaultController
}
}
$rows = $model->get(['*', 'name as text']);
return response()->json(['data' => $rows]);
return ['data' => $rows];
}
return $this->render([
'get' => Request::all()

View File

@ -49,7 +49,7 @@ class WidgetController extends DefaultController
$json['total'] = sizeof($rows);
$json['data'] = $rows;
return response()->json($json);
return $json;
}
return $this->render();
}

View File

@ -15,11 +15,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -15,11 +15,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -15,11 +15,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
action.priceEdit = function() {
var me = this;
var grid = config.grid;

View File

@ -15,11 +15,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -14,11 +14,6 @@
var action = config.action;
var search = config.search;
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var grid = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['table']}}-grid");

View File

@ -15,11 +15,6 @@
//action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -14,11 +14,6 @@
var search = config.search;
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");

View File

@ -12,14 +12,8 @@ var config = gdoo.grids[table];
var action = config.action;
var search = config.search;
(function ($) {
var options = new agGridOptions();
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
config.cols[0]['hide'] = true;
config.cols[1]['hide'] = true;
config.cols[2]['hide'] = true;

View File

@ -15,11 +15,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -14,11 +14,6 @@
var search = config.search;
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");

View File

@ -15,11 +15,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -13,11 +13,6 @@
var action = config.action;
var search = config.search;
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -95,7 +95,7 @@ class CategoryController extends DefaultController
}
}
$rows = $model->get(['*', 'name as text']);
return response()->json(['data' => $rows]);
return ['data' => $rows];
}
return $this->render([
'get' => Request::all()

View File

@ -177,11 +177,10 @@ class CostController extends AuditController
}
$rows = $model->get();
$rows->transform(function($row) {
return $row;
});
return response()->json(['data' => $rows]);
return ['data' => $rows];
}
return $this->render([

View File

@ -14,11 +14,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -13,11 +13,6 @@
var action = config.action;
var search = config.search;
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -13,12 +13,7 @@
var search = config.search;
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -40,11 +40,6 @@
});
}
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -14,11 +14,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -174,10 +174,10 @@ class AttachmentController extends DefaultController
$insert_id = DB::table($table)->insertGetId($data);
$data['id'] = $insert_id;
return response()->json($data);
return $data;
}
}
return response()->json([]);
return [];
}
}
$query = Request::all();

View File

@ -14,11 +14,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
action.create = function(data) {
var me = this;
var grid = config.grid;

View File

@ -14,11 +14,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
action.create = function(data) {
var me = this;
var grid = config.grid;

View File

@ -108,7 +108,7 @@ class ApiController extends Controller
{
$key = Request::get('key');
$rows = option($key);
return response()->json($rows)->setEncodingOptions(JSON_UNESCAPED_UNICODE);
return $rows;
}
/**
@ -118,7 +118,7 @@ class ApiController extends Controller
{
$key = Request::get('key');
$rows = option($key);
return response()->json($rows)->setEncodingOptions(JSON_UNESCAPED_UNICODE);
return $rows;
}
/**
@ -156,6 +156,6 @@ class ApiController extends Controller
->get()->toArray();
$rows = array_merge($title, $rows);
return response()->json($rows);
return $rows;
}
}

View File

@ -131,7 +131,7 @@ class AttachmentController extends DefaultController
{
$id = Request::get('id');
$rows = AttachmentService::get($id);
return response()->json($rows);
return $rows;
}
/**
@ -141,7 +141,7 @@ class AttachmentController extends DefaultController
{
$key = Request::get('key');
$rows = AttachmentService::draft($key);
return response()->json($rows);
return $rows;
}
/**

View File

@ -50,10 +50,10 @@ class IndexController extends DefaultController
if ($key) {
$badge = ModuleService::badges($key);
if ($badge) {
return response()->json($badge());
return $badge();
}
}
return response()->json(['total' => 0, 'data' => []]);
return ['total' => 0, 'data' => []];
}
// 获取全部待办数量
@ -64,6 +64,6 @@ class IndexController extends DefaultController
foreach($badges as $key => $badge) {
$json[$key] = $badge();
}
return response()->json($json);
return $json;
}
}

View File

@ -419,7 +419,7 @@ class FieldController extends DefaultController
public function getEnumsAction()
{
$enums = Option::where('parent_id', 0)->orderBy('sort', 'asc')->orderBy('id', 'asc')->get();
return response()->json($enums);
return $enums;
}
public function deleteAction()

View File

@ -1992,7 +1992,7 @@ class Form
$permission = $permissions[$table];
foreach ($fields as $field) {
$key = $field['field'];
$setting = $field['setting'];
$value = $values[$key];
@ -2002,56 +2002,57 @@ class Form
if ($row['w'] == 1) {
$_field_data = Hook::fire($table.'.onFieldFilter', ['table' => $table, 'master' => $master, 'field' => $field, 'values' => $values]);
extract($_field_data);
}
if ($field['data_format']) {
switch ($field['data_format']) {
case 'number':
case 'money':
list($_, $len) = explode(',', $field['length']);
$len = $len > 0 ? $len : 2;
$value = round(floatval($value), $len);
break;
}
} else {
switch ($field['type']) {
case 'DECIMAL':
list($_, $len) = explode(',', $field['length']);
$value = round(floatval($value), $len);
if ($field['data_format']) {
switch ($field['data_format']) {
case 'number':
case 'money':
list($_, $len) = explode(',', $field['length']);
$len = $len > 0 ? $len : 2;
$value = round(floatval($value), $len);
break;
}
} else {
switch ($field['type']) {
case 'DECIMAL':
list($_, $len) = explode(',', $field['length']);
$value = round(floatval($value), $len);
break;
}
}
switch ($field['form_type']) {
case 'autocomplete':
$value = str_replace('draft_', '', $value);
break;
case 'address':
$value = join("\n", (array)$value);
break;
case 'files':
$value = (array)$value;
$dataFiles = array_merge($dataFiles, $value);
$value = join("\n", $value);
break;
case 'images':
$value = join("\n", (array)$value);
break;
case 'date':
if ($setting['save'] == 'u') {
$value = empty($value) ? '' : strtotime($value);
}
break;
case 'checkbox':
if (is_array($value)) {
$value = join(",", (array)$value);
} else {
$value = intval($value);
}
break;
}
$values[$key] = $value;
}
switch ($field['form_type']) {
case 'autocomplete':
$value = str_replace('draft_', '', $value);
break;
case 'address':
$value = join("\n", (array)$value);
break;
case 'files':
$value = (array)$value;
$dataFiles = array_merge($dataFiles, $value);
$value = join("\n", $value);
break;
case 'images':
$value = join("\n", (array)$value);
break;
case 'date':
if ($setting['save'] == 'u') {
$value = empty($value) ? '' : strtotime($value);
}
break;
case 'checkbox':
if (is_array($value)) {
$value = join(",", (array)$value);
} else {
$value = intval($value);
}
break;
}
$values[$key] = $value;
}
return $values;
}

View File

@ -20,6 +20,7 @@ use Gdoo\Model\Models\Step;
use Gdoo\Model\Models\StepLog;
use Gdoo\Model\Services\ModelService;
use Gdoo\Model\Services\ModuleService;
use Gdoo\User\Services\UserAssetService;
class Grid
{
@ -99,6 +100,7 @@ class Grid
$_header = $header;
unset($_header['columns']);
unset($_header['cols']);
unset($_header['dialogs']);
unset($_header['join']);
unset($_header['js']);
@ -106,6 +108,19 @@ class Grid
unset($_header['search']);
unset($_header['select']);
// 重新组合字段给前端
$columns = [];
foreach ($header['cols'] as $field => $col) {
if ($field == 'action' && empty($col['events'])) {
continue;
}
if ($col['field'] == 'created_by') {
$col['formatter'] = 'created_by';
}
$columns[] = $col;
}
$_header['columns'] = $columns;
$header['runs'] = $runs;
$header['dialogs'] = $dialogs;
$header['regions'] = $regions;
@ -886,6 +901,7 @@ class Grid
$res['form_type'] = $bill['form_type'];
$res['bill_id'] = $bill['id'];
$res['bill_uri'] = $bill['uri'];
$res['name'] = $master['name'];
$res['model_id'] = $master['id'];
$res['is_sort'] = $master['is_sort'];
@ -893,6 +909,9 @@ class Grid
$res['sort'] = $sort;
$res['order'] = $order;
// 获取当前权限
$res['access'] = UserAssetService::getNowRoleAssets();
// 是否开启简单搜索框
$res['simple_search_form'] = 1;
$res['exist_sub_table'] = $exist_sub_table;

View File

@ -15,11 +15,6 @@
action.dialogType = 'dialog';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
action.view = function(data) {
var me = this;
var grid = config.grid;

View File

@ -15,11 +15,6 @@
action.dialogType = 'dialog';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
action.field = function(data) {
var me = this;
var grid = config.grid;

View File

@ -56,11 +56,6 @@
}
}
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -135,7 +135,7 @@ class LogisticsController extends DefaultController
$rows['total'] = $model->count();
$rows['data'] = $model->get();
}
return response()->json($rows);
return $rows;
}
return $this->render([

View File

@ -828,7 +828,7 @@ class OrderController extends WorkflowController
$item['text'] = $item['name'];
return $item;
});
return response()->json($items);
return $items;
}
return $this->render([
'search' => $search,
@ -918,7 +918,7 @@ class OrderController extends WorkflowController
");
$rows = $model->get();
}
return response()->json(['data' => $rows]);
return ['data' => $rows];
}
return $this->render([
'search' => $search,

View File

@ -70,7 +70,7 @@ class PlanController extends DefaultController
}
$rows = ProduceService::getPlanDetail($sdate, $edate, $query['warehouse_id'], $query['category_id'], $query['type']);
$json = ['data' => $rows, 'status' => true];
return response()->json($json);
return $json;
}
$header = [
@ -205,7 +205,7 @@ class PlanController extends DefaultController
});
}
$json = ['data' => $rows, 'status' => true];
return response()->json($json);
return $json;
}
$search['table'] = 'produce_plan';
@ -298,7 +298,7 @@ class PlanController extends DefaultController
}
$rows = ProduceService::getPlanDetail($sdate, $edate, 0, $query['category_id'], $query['type']);
$json = ['columns' => $columns, 'data' => $rows, 'status' => true];
return response()->json($json);
return $json;
}
$header = [

View File

@ -111,7 +111,7 @@ class TypeController extends DefaultController
$item['text'] = $item['name'];
return $item;
});
return response()->json($items);
return $items;
}
$query['form_id'] = $query['jqgrid'] == '' ? $query['id'] : $query['jqgrid'];
return $this->render([

View File

@ -198,7 +198,7 @@ class WidgetController extends DefaultController
$json['total'] = sizeof($rows);
$json['data'] = $rows;
return response()->json($json);
return $json;
}
return $this->render();
}
@ -225,7 +225,7 @@ class WidgetController extends DefaultController
->get();
$json['total'] = $rows->count();
$json['data'] = $rows;
return response()->json($json);
return $json;
}
return $this->render();
}

View File

@ -15,11 +15,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -108,11 +108,6 @@
}
}
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -17,11 +17,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -15,11 +15,6 @@
var search = config.search;
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");

View File

@ -35,11 +35,6 @@
}
}
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -34,11 +34,6 @@
return;
}
}
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");

View File

@ -12,11 +12,6 @@
var config = gdoo.grids[table];
var action = config.action;
var search = config.search;
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['table']}}-grid");

View File

@ -315,7 +315,7 @@ class MaterialController extends DefaultController
$rows['total'] = $model->count();
$rows['data'] = $model->get();
}
return response()->json($rows);
return $rows;
}
return $this->render([

View File

@ -43,11 +43,6 @@
}
}
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -14,11 +14,6 @@
var search = config.search;
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");

View File

@ -99,7 +99,6 @@ class CategoryController extends DefaultController
['text','product_category.id','ID'],
]);
$query = $search['query'];
$type = Request::get('type', 1);
if (Request::method() == 'POST') {
$model = ProductCategory::orderBy('lft', 'asc');
@ -110,7 +109,7 @@ class CategoryController extends DefaultController
$data[] = $row;
}
$json = ['data' => $data];
return response()->json($json);
return $json;
}
return $this->render(array(

View File

@ -163,17 +163,10 @@ class ProductController extends DefaultController
if ($query['suggest']) {
$rows = $model->limit(15)->get();
$data = Grid::dataFilters($rows, $header, function($item) {
return $item;
});
$items['data'] = $data;
} else {
$rows = $model->paginate($query['limit']);
$items = Grid::dataFilters($rows, $header, function($item) {
return $item;
});
}
return response()->json($items);
return Grid::dataFilters($rows, $header);
}
return $this->render([
'search' => $search,
@ -246,17 +239,10 @@ class ProductController extends DefaultController
if ($query['suggest']) {
$rows = $model->limit(15)->get();
$data = Grid::dataFilters($rows, $header, function($item) {
return $item;
});
$items['data'] = $data;
} else {
$rows = $model->paginate($query['limit']);
$items = Grid::dataFilters($rows, $header, function($item) {
return $item;
});
}
return response()->json($items);
return Grid::dataFilters($rows, $header);
}
return $this->render([
'search' => $search,
@ -270,7 +256,7 @@ class ProductController extends DefaultController
$rows = $model->get(['*', 'name as text'])->toArray();
$rows = array_nest($rows);
$rows = array_merge($rows);
return response()->json(['data' => $rows]);
return ['data' => $rows];
}
}

View File

@ -94,7 +94,7 @@ class UnitController extends DefaultController
}
}
$rows = $model->get(['*', 'name as text']);
return response()->json(['data' => $rows]);
return ['data' => $rows];
}
return $this->render([
'search' => $search,

View File

@ -14,11 +14,6 @@
var action = config.action;
var search = config.search;
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var grid = new agGridOptions;
var gridDiv = document.querySelector("#{{$header['table']}}-grid");

View File

@ -83,11 +83,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var height = getPanelHeight(140);
var treeOptions = new agGridOptions();
treeOptions.rowSelection = 'single';

View File

@ -12,11 +12,6 @@
var config = gdoo.grids[table];
var action = config.action;
var search = config.search;
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['table']}}-grid");

View File

@ -45,12 +45,12 @@ class TaskController extends DefaultController
$rows[] = $_task;
}
$json['data'] = $rows;
return response()->json($json);
return $json;
}
if ($request->ajax()) {
$tasks = TaskService::data($search);
return response()->json(['data' => $tasks]);
return ['data' => $tasks];
}
$project = Project::find($query['project_id']);

View File

@ -208,7 +208,7 @@ class MaterialController extends DefaultController
$row['upload_url'] = URL::to('/uploads');
if (Request::wantsJson()) {
return response()->json($row);
return $row;
}
return $this->render([

View File

@ -36,11 +36,6 @@
}
});
}
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");

View File

@ -36,11 +36,6 @@
}
});
}
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");

View File

@ -15,11 +15,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -121,8 +121,7 @@ class SupplierController extends DefaultController
}
$model->select($header['select']);
$rows = $model->paginate($query['limit']);
return response()->json($rows);
return $model->paginate($query['limit']);
}
return $this->render([
'search' => $search,

View File

@ -14,11 +14,6 @@
var search = config.search;
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");

View File

@ -13,13 +13,6 @@
var action = config.action;
var search = config.search;
//action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -106,10 +106,7 @@ class CategoryController extends DefaultController
$model->select($header['select']);
$rows = $model->paginate($query['limit']);
$items = Grid::dataFilters($rows, $header, function($item) {
return $item;
});
return response()->json($items);
return Grid::dataFilters($rows, $header);
}
return $this->render([

View File

@ -106,10 +106,7 @@ class LocationController extends DefaultController
$model->select($header['select']);
$rows = $model->paginate($query['limit']);
$items = Grid::dataFilters($rows, $header, function($item) {
return $item;
});
return response()->json($items);
return Grid::dataFilters($rows, $header);
}
return $this->render([
@ -145,10 +142,7 @@ class LocationController extends DefaultController
$model->select($header['select']);
$rows = $model->paginate($query['limit']);
$items = Grid::dataFilters($rows, $header, function($item) {
return $item;
});
return response()->json($items);
return Grid::dataFilters($rows, $header);
}
return $this->render([
@ -167,7 +161,7 @@ class LocationController extends DefaultController
->where('warehouse_location.warehouse_id', $warehouse_id)
->where('warehouse_location.status', 1)
->orderBy('warehouse_location.sort', 'asc');
return response()->json($model->get());
return $model->get();
}
}

View File

@ -106,10 +106,7 @@ class TypeController extends DefaultController
$model->select($header['select']);
$rows = $model->paginate($query['limit']);
$items = Grid::dataFilters($rows, $header, function($item) {
return $item;
});
return response()->json($items);
return Grid::dataFilters($rows, $header);
}
return $this->render([

View File

@ -113,11 +113,10 @@ class WarehouseController extends DefaultController
$locations[$_location['warehouse_id']][] = $_location;
}
$items = Grid::dataFilters($rows, $header, function($item) use($locations) {
return Grid::dataFilters($rows, $header, function($item) use($locations) {
$item['pos'] = (array)$locations[$item['id']];
return $item;
});
return response()->json($items);
}
return $this->render([

View File

@ -14,11 +14,6 @@
var search = config.search;
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");

View File

@ -14,11 +14,6 @@
var search = config.search;
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");

View File

@ -12,11 +12,6 @@
var config = gdoo.grids[table];
var action = config.action;
var search = config.search;
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['table']}}-grid");

View File

@ -15,11 +15,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -15,11 +15,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -14,11 +14,6 @@
var search = config.search;
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");

View File

@ -12,11 +12,6 @@
var config = gdoo.grids[table];
var action = config.action;
var search = config.search;
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['table']}}-grid");

View File

@ -14,11 +14,6 @@
var search = config.search;
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");

View File

@ -14,11 +14,6 @@
var search = config.search;
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");

View File

@ -15,11 +15,6 @@
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -14,11 +14,6 @@
var search = config.search;
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");

View File

@ -14,11 +14,6 @@
var search = config.search;
action.dialogType = 'layer';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");

View File

@ -12,11 +12,6 @@
var config = gdoo.grids[table];
var action = config.action;
var search = config.search;
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['table']}}-grid");

View File

@ -13,11 +13,6 @@
var action = config.action;
var search = config.search;
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

View File

@ -202,7 +202,7 @@ class OptionController extends DefaultController
if (Request::method() == 'POST') {
$rows = Option::where('parent_id', 0)->orderBy('sort', 'asc')->orderBy('id', 'asc')->get();
$rows->prepend(['name' => '全部类别', 'id' => 0, 'parent_id' => 0]);
return response()->json(['data' => $rows]);
return ['data' => $rows];
}
}

View File

@ -108,7 +108,7 @@ class RegionController extends DefaultController
$row['text'] = $row['layer_space'].$row['name'];
$json[] = $row;
}
return response()->json(['data' => $json]);
return ['data' => $json];
}
return $this->render([
'search' => $search,
@ -122,7 +122,7 @@ class RegionController extends DefaultController
$model = Region::orderBy('id', 'asc');
$rows = $model->get(['*', 'name as text']);
array_nest($rows);
return response()->json(['data' => $rows]);
return ['data' => $rows];
}
}

View File

@ -15,11 +15,6 @@
action.dialogType = 'dialog';
// 自定义搜索方法
search.searchInit = function (e) {
var self = this;
}
var options = new agGridOptions();
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
gridDiv.style.height = getPanelHeight(48);

Some files were not shown because too many files have changed in this diff Show More