创建版本
This commit is contained in:
@@ -0,0 +1,368 @@
|
||||
<?php namespace Gdoo\Approach\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\Approach\Models\Approach;
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Index\Controllers\WorkflowController;
|
||||
|
||||
class ApproachController extends WorkflowController
|
||||
{
|
||||
public $permission = ['dialog', 'reference', 'useCount', 'serviceReview', 'serviceCostList', 'serviceCostDetail', 'product'];
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
// 客户权限
|
||||
$region = regionCustomer('customer_id_customer');
|
||||
|
||||
$header = Grid::header([
|
||||
'code' => 'approach',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '显示',
|
||||
'action' => 'show',
|
||||
'display' => $this->access['show'],
|
||||
]];
|
||||
|
||||
$cols['master_product']['cellRenderer'] = 'htmlCellRenderer';
|
||||
$cols['master_cash_amount']['cellRenderer'] = 'htmlCellRenderer';
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
|
||||
$model->leftJoin(DB::raw('(SELECT sum(verification_cost) as master_cash_amount, min(date) as master_cash_date, apply_id FROM approach_review where status = 1 group by apply_id) as b'), 'approach.id', '=', 'b.apply_id');
|
||||
$header['select'][] = 'b.master_cash_amount';
|
||||
$header['select'][] = 'b.master_cash_date';
|
||||
|
||||
$model->orderBy($header['sort'], $header['order']);
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
if ($region['authorise']) {
|
||||
foreach ($region['whereIn'] as $key => $where) {
|
||||
$model->whereIn($key, $where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
|
||||
$items = Grid::dataFilters($rows, $header, function($item) {
|
||||
$item['master_cash_amount'] = '<a href="javascript:;" data-toggle="event" data-action="fee_detail" data-master_id="'.$item['master_id'].'" class="option">'.$item['master_cash_amount'].'</a>';
|
||||
$item['master_product'] = '<a href="javascript:;" data-toggle="event" data-action="product" data-master_id="'.$item['master_id'].'" class="option">明细</a>';
|
||||
return $item;
|
||||
});
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
// ['name' => '删除', 'icon' => 'fa-remove', 'action' => 'delete', 'display' => $this->access['delete']],
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
|
||||
$header['left_buttons'] = [
|
||||
['name' => '批量编辑', 'color' => 'default', 'icon' => 'fa-pencil-square-o', 'action' => 'batchEdit', 'display' => $this->access['batchEdit']],
|
||||
];
|
||||
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = Approach::$tabs;
|
||||
$header['bys'] = Approach::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 新建促销
|
||||
public function createAction($action = 'edit')
|
||||
{
|
||||
$id = (int) Request::get('id');
|
||||
|
||||
// 客户权限
|
||||
$header['region'] = ['field' => 'customer_id'];
|
||||
$header['authorise'] = ['action' => 'index', 'field' => 'created_id'];
|
||||
|
||||
$header['action'] = $action;
|
||||
$header['code'] = 'approach';
|
||||
$header['id'] = $id;
|
||||
|
||||
$form = Form::make($header);
|
||||
$tpl = $action == 'print' ? 'print' : 'create';
|
||||
return $this->display([
|
||||
'form' => $form,
|
||||
], $tpl);
|
||||
}
|
||||
|
||||
// 编辑进店
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
// 审核进店
|
||||
public function auditAction()
|
||||
{
|
||||
return $this->createAction('audit');
|
||||
}
|
||||
|
||||
// 显示进店
|
||||
public function showAction()
|
||||
{
|
||||
return $this->createAction('show');
|
||||
}
|
||||
|
||||
// 显示进店
|
||||
public function printAction()
|
||||
{
|
||||
$this->layout = 'layouts.print2';
|
||||
print_prince($this->createAction('print'));
|
||||
}
|
||||
|
||||
// 关闭操作
|
||||
public function closeAction()
|
||||
{
|
||||
$gets = Request::all();
|
||||
if (Request::method() == 'POST') {
|
||||
$row = DB::table('approach')->where('id', $gets['id'])->first();
|
||||
DB::table('approach')->where('id', $gets['id'])->update([
|
||||
'is_close' => !$row['is_close']
|
||||
]);
|
||||
return $this->json('操作成功。', true);
|
||||
}
|
||||
}
|
||||
|
||||
// 产品明细
|
||||
public function productAction()
|
||||
{
|
||||
$query = Request::all();
|
||||
if (Request::method() == 'POST') {
|
||||
$rows = DB::table('approach_data')
|
||||
->leftJoin('product', 'product.id', '=', 'approach_data.product_id')
|
||||
->where('approach_id', $query['id'])
|
||||
->orderBy('product.code', 'asc')
|
||||
->get(['product.*']);
|
||||
return $this->json($rows, true);
|
||||
}
|
||||
return $this->render(['query' => $query]);
|
||||
}
|
||||
|
||||
// 核销单选择
|
||||
public function serviceReviewAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'approach',
|
||||
'prefix' => '',
|
||||
]);
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
if ($query['master']) {
|
||||
$model = DB::table('approach');
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->leftJoin('approach_market', 'approach_market.id', '=', 'approach.market_id')
|
||||
->where('approach.status', 1)
|
||||
->orderBy('approach.id', 'desc');
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
$model->selectRaw('
|
||||
distinct(approach.id),
|
||||
approach.id,
|
||||
approach.sn,
|
||||
approach.status,
|
||||
approach.barcode_cast,
|
||||
approach.apply2_money,
|
||||
approach.created_at,
|
||||
approach.customer_id,
|
||||
customer_id_customer.region_id,
|
||||
approach_market.name as market_name,
|
||||
customer_id_region_id_customer_region.name as region_name,
|
||||
customer_id_customer.code as customer_code,
|
||||
customer_id_customer.name as customer_name,
|
||||
customer_id_customer.warehouse_contact,
|
||||
customer_id_customer.warehouse_phone,
|
||||
customer_id_customer.warehouse_address
|
||||
');
|
||||
$rows = $model->get();
|
||||
$rows = Grid::dataFilters($rows, $header);
|
||||
} else {
|
||||
|
||||
$model = DB::table('approach_data')
|
||||
->leftJoin('product', 'product.id', '=', 'approach_data.product_id')
|
||||
->leftJoin('approach', 'approach.id', '=', 'approach_data.approach_id')
|
||||
->leftJoin('product_unit', 'product_unit.id', '=', 'product.unit_id')
|
||||
->whereIn('approach.id', (array)$query['ids']);
|
||||
if ($query['sort'] && $query['order']) {
|
||||
$model->orderBy($query['sort'], $query['order']);
|
||||
}
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
$model->selectRaw("
|
||||
approach_data.*,
|
||||
approach.id as approach_id,
|
||||
approach.sn as approach_sn,
|
||||
product.code as product_code,
|
||||
product.name as product_name,
|
||||
product.spec as product_spec,
|
||||
product.barcode as product_barcode,
|
||||
product.unit_id as unit_id,
|
||||
product_unit.name as product_unit,
|
||||
product.weight
|
||||
");
|
||||
$rows = $model->get();
|
||||
}
|
||||
return $this->json($rows, true);
|
||||
}
|
||||
|
||||
return $this->render([
|
||||
'search' => $search,
|
||||
'query' => $query,
|
||||
]);
|
||||
}
|
||||
|
||||
// 费用申请明细
|
||||
public function serviceCostDetailAction()
|
||||
{
|
||||
$query = Request::all();
|
||||
$customer_id = (int)$query['customer_id'];
|
||||
$date = empty($query['date']) ? date('Y-m-d') : $query['date'];
|
||||
$year = date('Y', strtotime($date));
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
|
||||
if ($query['type'] == 'promotion') {
|
||||
$rows = DB::table('promotion')
|
||||
->where('type_id', 2)
|
||||
->whereRaw('customer_id=? and '.sql_year('actived_dt').'=? and isnull(is_close, 0) = 0 and isnull(status, 0) <> 0', [$customer_id, $year])
|
||||
->get();
|
||||
}
|
||||
if ($query['type'] == 'approach') {
|
||||
$rows = DB::table('approach')
|
||||
->whereRaw('customer_id=? and '.sql_year('actived_dt').'=? and isnull(is_close, 0) = 0 and isnull(status, 0) <> 0', [$customer_id, $year])
|
||||
->get();
|
||||
}
|
||||
if ($query['type'] == 'material') {
|
||||
$rows = DB::table('promotion')
|
||||
->where('type_id', 1)
|
||||
->whereRaw('customer_id=? and '.sql_year('actived_dt').'=? and isnull(is_close, 0) = 0 and isnull(status, 0) <> 0', [$customer_id, $year])
|
||||
->get();
|
||||
}
|
||||
return $this->json($rows, true);
|
||||
}
|
||||
|
||||
$approach = DB::table('approach')
|
||||
->whereRaw('customer_id=? and '.sql_year('actived_dt').'=? and isnull(is_close, 0) = 0 and isnull(status, 0) <> 0', [$customer_id, $year])
|
||||
->selectRaw('sum(barcode_cast) as apply_money,sum(apply2_money) as support_money')
|
||||
->first();
|
||||
|
||||
$promotion = DB::table('promotion')
|
||||
->whereRaw('customer_id=? and '.sql_year('actived_dt').'=? and isnull(is_close, 0) = 0 and isnull(status, 0) <> 0', [$customer_id, $year])
|
||||
->selectRaw('sum(apply_fee) as apply_money,sum(undertake_money) as support_money')
|
||||
->first();
|
||||
|
||||
$apply_money = $approach['apply_money'] + $promotion['apply_money'];
|
||||
$support_money = $approach['support_money'] + $promotion['support_money'];
|
||||
|
||||
|
||||
// 发货
|
||||
$delivery = DB::table('stock_delivery_data as d')
|
||||
->leftJoin('stock_delivery as m', 'm.id', '=', 'd.delivery_id')
|
||||
->leftJoin('product', 'product.id', '=', 'd.product_id')
|
||||
->whereRaw('m.customer_id=? and '.sql_year('m.invoice_dt').'=? and d.product_id <> 20226 and isnull(product.product_type, 0) = 1', [$customer_id, $year])
|
||||
->selectRaw('sum(isnull(d.money, 0) - isnull(d.other_money, 0)) money');
|
||||
// 退货
|
||||
$cancel = DB::table('stock_cancel_data as d')
|
||||
->leftJoin('stock_cancel as m', 'm.id', '=', 'd.cancel_id')
|
||||
->leftJoin('product', 'product.id', '=', 'd.product_id')
|
||||
->whereRaw('m.customer_id=? and '.sql_year('m.invoice_dt').'=? and d.product_id <> 20226 and isnull(product.product_type, 0) = 1', [$customer_id, $year])
|
||||
->selectRaw('sum(isnull(d.money, 0) - isnull(d.other_money, 0)) money');
|
||||
// 直营
|
||||
$direct = DB::table('stock_direct_data as d')
|
||||
->leftJoin('stock_direct as m', 'm.id', '=', 'd.direct_id')
|
||||
->leftJoin('product', 'product.id', '=', 'd.product_id')
|
||||
->whereRaw('m.customer_id=? and '.sql_year('m.invoice_dt').'=? and d.product_id <> 20226 and isnull(product.product_type, 0) = 1', [$customer_id, $year])
|
||||
->selectRaw('sum(isnull(d.money, 0) - isnull(d.other_money, 0)) money');
|
||||
$rows = $cancel->unionAll($delivery)->unionAll($direct)->get();
|
||||
$money = $rows->sum('money');
|
||||
|
||||
$apply_percent = $support_percent = 0;
|
||||
if ($money > 0) {
|
||||
$apply_percent = ($apply_money / $money) * 100;
|
||||
$support_percent = ($support_money / $money) * 100;
|
||||
}
|
||||
|
||||
$all = [
|
||||
'money' => $money,
|
||||
'apply_money' => $apply_money,
|
||||
'support_money' => $support_money,
|
||||
'apply_percent' => $apply_percent,
|
||||
'support_percent' => $support_percent,
|
||||
];
|
||||
|
||||
return $this->render([
|
||||
'all' => $all,
|
||||
'query' => $query,
|
||||
]);
|
||||
}
|
||||
|
||||
// 批量编辑
|
||||
public function batchEditAction()
|
||||
{
|
||||
$gets = Request::all();
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = explode(',', $gets['ids']);
|
||||
DB::table('approach')->whereIn('id', $ids)->update([
|
||||
$gets['field'] => $gets['search_0'],
|
||||
]);
|
||||
return $this->json('修改完成。', true);
|
||||
}
|
||||
$header = Grid::batchEdit([
|
||||
'code' => 'approach',
|
||||
'columns' => ['customer_id', 'tax_id'],
|
||||
]);
|
||||
return view('batchEdit', [
|
||||
'gets' => $gets,
|
||||
'header' => $header
|
||||
]);
|
||||
}
|
||||
|
||||
// 删除进店申请
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'approach', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
<?php namespace Gdoo\Approach\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\Approach\Models\ApproachMarket;
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Index\Controllers\DefaultController;
|
||||
|
||||
class MarketController extends DefaultController
|
||||
{
|
||||
public $permission = ['dialog'];
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
// 客户权限
|
||||
$region = regionCustomer('customer_id_customer');
|
||||
|
||||
$header = Grid::header([
|
||||
'code' => 'approach_market',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '编辑',
|
||||
'action' => 'edit',
|
||||
'display' => $this->access['edit'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order']);
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
if ($region['authorise']) {
|
||||
foreach ($region['whereIn'] as $key => $where) {
|
||||
$model->whereIn($key, $where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
['name' => '删除', 'icon' => 'fa-remove', 'action' => 'delete', 'display' => $this->access['delete']],
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = ApproachMarket::$tabs;
|
||||
$header['bys'] = ApproachMarket::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 新建促销
|
||||
public function createAction($action = 'edit')
|
||||
{
|
||||
$id = (int) Request::get('id');
|
||||
$header['action'] = $action;
|
||||
$header['code'] = 'approach_market';
|
||||
$header['id'] = $id;
|
||||
|
||||
$form = Form::make($header);
|
||||
return $this->render([
|
||||
'form' => $form,
|
||||
], 'create');
|
||||
}
|
||||
|
||||
// 编辑促销
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
// 审核促销
|
||||
public function auditAction()
|
||||
{
|
||||
return $this->createAction('audit');
|
||||
}
|
||||
|
||||
// 显示促销
|
||||
public function showAction()
|
||||
{
|
||||
return $this->createAction('show');
|
||||
}
|
||||
|
||||
// 删除促销
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'approach_market', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
|
||||
// 对话框
|
||||
public function dialogAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'approach_market',
|
||||
]);
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table('approach_market');
|
||||
/*
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
*/
|
||||
if ($query['sort'] && $query['order']) {
|
||||
$model->orderBy($query['sort'], $query['order']);
|
||||
}
|
||||
|
||||
if (isset($query['customer_id'])) {
|
||||
$model->where('approach_market.customer_id', $query['customer_id']);
|
||||
}
|
||||
|
||||
if ($query['q']) {
|
||||
$model->where('approach_market.name', 'like', '%'.$query['q'].'%');
|
||||
}
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'name as text,code,name,customer_id,market_count,type_id,single_cast,total_cast,fax,market_address,market_area,market_person_name,market_person_phone,status';
|
||||
|
||||
if ($query['related'] == '0') {
|
||||
$sql = $sql.',name as id';
|
||||
} else {
|
||||
$sql = $sql.',id as id';
|
||||
}
|
||||
$model->selectRaw($sql);
|
||||
$rows = $model->paginate();
|
||||
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
|
||||
return response()->json($items);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
<?php namespace Gdoo\Approach\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\User\Models\User;
|
||||
use Gdoo\Approach\Models\ApproachReview;
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Index\Controllers\WorkflowController;
|
||||
|
||||
class ReviewController extends WorkflowController
|
||||
{
|
||||
public $permission = ['dialog', 'reference', 'useCount', 'feeDetail'];
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
// 客户权限
|
||||
$region = regionCustomer('customer_id_customer');
|
||||
|
||||
$header = Grid::header([
|
||||
'code' => 'approach_review',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '显示',
|
||||
'action' => 'show',
|
||||
'display' => $this->access['show'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order']);
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
if ($region['authorise']) {
|
||||
foreach ($region['whereIn'] as $key => $where) {
|
||||
$model->whereIn($key, $where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
//['name' => '删除', 'icon' => 'fa-remove', 'action' => 'delete', 'display' => $this->access['delete']],
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
|
||||
$header['left_buttons'] = [
|
||||
['name' => '批量编辑', 'color' => 'default', 'icon' => 'fa-pencil-square-o', 'action' => 'batchEdit', 'display' => $this->access['batchEdit']],
|
||||
];
|
||||
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = ApproachReview::$tabs;
|
||||
$header['bys'] = ApproachReview::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 新建促销
|
||||
public function createAction($action = 'edit')
|
||||
{
|
||||
$id = (int) Request::get('id');
|
||||
|
||||
// 客户权限
|
||||
$header['region'] = ['field' => 'customer_id'];
|
||||
$header['authorise'] = ['action' => 'index', 'field' => 'created_id'];
|
||||
|
||||
$header['action'] = $action;
|
||||
$header['code'] = 'approach_review';
|
||||
$header['id'] = $id;
|
||||
|
||||
$header['joint'] = [
|
||||
['name' => '申请单', 'action' => 'apply', 'field' => 'apply_id'],
|
||||
['name' => '兑现明细', 'action' => 'cash_detail', 'field' => 'apply_id'],
|
||||
];
|
||||
|
||||
$form = Form::make($header);
|
||||
$tpl = $action == 'print' ? 'print' : 'create';
|
||||
return $this->display([
|
||||
'form' => $form,
|
||||
], $tpl);
|
||||
}
|
||||
|
||||
// 编辑促销
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
// 审核促销
|
||||
public function auditAction()
|
||||
{
|
||||
return $this->createAction('audit');
|
||||
}
|
||||
|
||||
// 显示促销
|
||||
public function showAction()
|
||||
{
|
||||
return $this->createAction('show');
|
||||
}
|
||||
|
||||
// 显示促销
|
||||
public function printAction()
|
||||
{
|
||||
$this->layout = 'layouts.print2';
|
||||
print_prince($this->createAction('print'));
|
||||
}
|
||||
|
||||
// 批量编辑
|
||||
public function batchEditAction()
|
||||
{
|
||||
$gets = Request::all();
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = explode(',', $gets['ids']);
|
||||
DB::table('approach_review')->whereIn('id', $ids)->update([
|
||||
$gets['field'] => $gets['search_0'],
|
||||
]);
|
||||
return $this->json('修改完成。', true);
|
||||
}
|
||||
$header = Grid::batchEdit([
|
||||
'code' => 'approach_review',
|
||||
'columns' => ['customer_id', 'tax_id'],
|
||||
]);
|
||||
return view('batchEdit', [
|
||||
'gets' => $gets,
|
||||
'header' => $header
|
||||
]);
|
||||
}
|
||||
|
||||
// 兑现明细
|
||||
public function feeDetailAction()
|
||||
{
|
||||
$query = Request::all();
|
||||
if (Request::method() == 'POST') {
|
||||
$rows = DB::table('approach_review')->where('apply_id', $query['id'])->orderBy('id', 'desc')->get();
|
||||
return $this->json($rows, true);
|
||||
}
|
||||
return $this->render(['query' => $query]);
|
||||
}
|
||||
|
||||
// 删除促销
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'approach_review', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php namespace Gdoo\Approach\Hooks;
|
||||
|
||||
use DB;
|
||||
use Gdoo\User\Models\User;
|
||||
|
||||
class ApproachHook
|
||||
{
|
||||
public function onBeforeForm($params) {
|
||||
$views = $params['views'];
|
||||
$view = $views[3];
|
||||
|
||||
$view['fields'][] = [
|
||||
'field' => 'apply_percentage',
|
||||
'hidden' => 1,
|
||||
'width' => 40,
|
||||
'readonly' => 0,
|
||||
'hide_title' => 1,
|
||||
'type' => 0,
|
||||
'name' => '按回款核销(%)',
|
||||
];
|
||||
$view['fields'][] = [
|
||||
'field' => 'order_payment_scale',
|
||||
'hidden' => 1,
|
||||
'width' => 40,
|
||||
'readonly' => 0,
|
||||
'hide_title' => 1,
|
||||
'type' => 0,
|
||||
'name' => '按订单进行兑付(%)',
|
||||
];
|
||||
$views[3] = $view;
|
||||
$params['views'] = $views;
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onFieldFilter($params) {
|
||||
$values = $params['values'];
|
||||
$field = $params['field'];
|
||||
$f = $field['field'];
|
||||
$value = $values[$f];
|
||||
if ($f == 'market_name') {
|
||||
if (strpos($value, 'draft_') === 0) {
|
||||
$name = str_replace('draft_', '', $value);
|
||||
$market = [
|
||||
'customer_id' => $values['customer_id'],
|
||||
'name' => $name,
|
||||
'market_count' => $values['market_totol'],
|
||||
'type_id' => $values['type_id'],
|
||||
'single_cast' => $values['single_cast'],
|
||||
'total_cast' => $values['totol_cast'],
|
||||
'fax' => $values['fax'],
|
||||
'market_address' => $values['market_address'],
|
||||
'market_area' => $values['market_size'],
|
||||
'market_person_name' => $values['market_contact'],
|
||||
'market_person_phone' => $values['market_contact_phone'],
|
||||
];
|
||||
$values['market_name'] = $name;
|
||||
$values['market_id'] = DB::table('approach_market')->insertGetId($market);
|
||||
}
|
||||
}
|
||||
$params['values'] = $values;
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onFormFieldFilter($params) {
|
||||
$_replace = $params['_replace'];
|
||||
|
||||
$verification_info = $_replace['{verification_info}'];
|
||||
if ($verification_info) {
|
||||
$verification_info = $verification_info.'
|
||||
<div class="m-xs">
|
||||
贵司出具发票:按回款(回款以我司批复之日起算) '.$_replace['{apply_percentage}'].'% 核销;
|
||||
贵司未出具发票:按订单(订单以提交审核资料核销后) '.$_replace['{order_payment_scale}'].'% 进行兑付。直到核完我司支持费用为止。
|
||||
</div>
|
||||
<div class="red">
|
||||
客户进场后必须在2个月内提交资料核销,否则不予受理。开始核销后,超过一年未核完的,将不再核销。
|
||||
</div>
|
||||
';
|
||||
$_replace['{verification_info}'] = $verification_info;
|
||||
unset($_replace['{apply_percentage}']);
|
||||
unset($_replace['{order_payment_scale}']);
|
||||
}
|
||||
|
||||
$params['_replace'] = $_replace;
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeAudit($params) {
|
||||
// 流程结束写入生效日期
|
||||
$master = $params['master'];
|
||||
$master['actived_dt'] = date('Y-m-d');
|
||||
$params['master'] = $master;
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeStore($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterStore($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeDelete($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeImport($params) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php namespace Gdoo\Approach\Hooks;
|
||||
|
||||
use DB;
|
||||
use Gdoo\User\Models\User;
|
||||
|
||||
class ReviewHook
|
||||
{
|
||||
public function onBeforeForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onFieldFilter($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onFormFieldFilter($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeStore($params)
|
||||
{
|
||||
$gets = $params['gets'];
|
||||
$approach_review = $gets['approach_review'];
|
||||
$count = count($gets['approach_review_data']['rows']);
|
||||
$apply_id = $approach_review['apply_id'];
|
||||
$count2 = DB::table('approach_data')->where('approach_id', $apply_id)->count();
|
||||
if ($count <> $count2) {
|
||||
abort_error('进店申请条码数量和核销条码数量不一致。');
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeAudit($params) {
|
||||
$id = $params['id'];
|
||||
// 生效费用
|
||||
$row = DB::table('approach_review')->where('id', $id)->first();
|
||||
if ($row['use_order'] == 1) {
|
||||
// 生成费用类型
|
||||
$categorys = [1 => 4, 3 => 5];
|
||||
$master = [
|
||||
'sn' => $row['sn'],
|
||||
'date' => $row['date'],
|
||||
'category_id' => $categorys[$row['pay_type']],
|
||||
'type_id' => 57,
|
||||
'remark' => $row['remark'],
|
||||
'status' => 1,
|
||||
];
|
||||
$cost_id = DB::table('customer_cost')->insertGetId($master);
|
||||
DB::table('customer_cost_data')->insert([
|
||||
'cost_id' => $cost_id,
|
||||
'customer_id' => $row['customer_id'],
|
||||
'money' => $row['fact_verification_cost'],
|
||||
'remain_money' => $row['fact_verification_cost'],
|
||||
'src_id' => $row['id'],
|
||||
'src_sn' => $row['sn'],
|
||||
'src_type_id' => 57,
|
||||
'status' => 1,
|
||||
]);
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$review = DB::table('approach_review')->where('id', $id)->first();
|
||||
$cost_count = DB::table('customer_cost')->where('sn', $review['sn'])->count();
|
||||
if ($cost_count > 0) {
|
||||
abort_error('客户费用单号['.$review['sn'].']已经存在无法弃审。');
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterStore($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeDelete($params) {
|
||||
// 删除生成的费用
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeImport($params) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php namespace Gdoo\Approach\Models;
|
||||
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class Approach extends BaseModel
|
||||
{
|
||||
protected $table = 'approach';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'approach', 'url' => 'approach/approach/index', 'name' => '进店列表'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo('Gdoo\Customer\Models\Customer');
|
||||
}
|
||||
|
||||
public function datas()
|
||||
{
|
||||
return $this->hasMany('Gdoo\Promotion\Models\PromotionData');
|
||||
}
|
||||
|
||||
public function scopeDialog($q, $value)
|
||||
{
|
||||
return $q->whereIn('id', $value)->pluck('sn', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php namespace Gdoo\Approach\Models;
|
||||
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class ApproachData extends BaseModel
|
||||
{
|
||||
protected $table = 'approach_data';
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php namespace Gdoo\Approach\Models;
|
||||
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class ApproachMarket extends BaseModel
|
||||
{
|
||||
protected $table = 'approach_market';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'market', 'url' => 'approach/market/index', 'name' => '超市列表'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo('Gdoo\Customer\Models\Customer');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php namespace Gdoo\Approach\Models;
|
||||
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class ApproachReview extends BaseModel
|
||||
{
|
||||
protected $table = 'approach_review';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'review', 'url' => 'approach/review/index', 'name' => '进店核销'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php namespace Gdoo\Approach\Services;
|
||||
|
||||
use DB;
|
||||
use Gdoo\Index\Services\BadgeService;
|
||||
|
||||
class ApproachService
|
||||
{
|
||||
/**
|
||||
* 获取待办的进店申请
|
||||
*/
|
||||
public static function getBadge()
|
||||
{
|
||||
return BadgeService::getModelTodo('approach');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
return [
|
||||
"name" => "进店管理",
|
||||
"version" => "1.0",
|
||||
"description" => "条码进店。",
|
||||
"listens" => [
|
||||
'approach' => 'Gdoo\Approach\Hooks\ApproachHook',
|
||||
'approach_review' => 'Gdoo\Approach\Hooks\ReviewHook',
|
||||
],
|
||||
'dialogs' => [
|
||||
'approach' => [
|
||||
'name' => '进店申请',
|
||||
'model' => 'Gdoo\Approach\Models\Approach::Dialog',
|
||||
'url' => 'approach/approach/dialog',
|
||||
],
|
||||
'approach_market' => [
|
||||
'name' => '进店超市',
|
||||
'model' => 'Gdoo\Approach\Models\ApproachMarket::Dialog',
|
||||
'url' => 'approach/market/dialog',
|
||||
],
|
||||
],
|
||||
'badges' => [
|
||||
'approach_approach_index' => 'Gdoo\Approach\Services\ApproachService::getBadge',
|
||||
],
|
||||
"controllers" => [
|
||||
"approach" => [
|
||||
"name" => "进店申请",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表"
|
||||
],
|
||||
"show" => [
|
||||
"name" => "查看"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"audit" => [
|
||||
"name" => "审核"
|
||||
],
|
||||
"recall" => [
|
||||
"name" => "撤回"
|
||||
],
|
||||
"abort" => [
|
||||
"name" => "弃审"
|
||||
],
|
||||
"print" => [
|
||||
"name" => "打印"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
],
|
||||
"close" => [
|
||||
"name" => "关闭"
|
||||
],
|
||||
"batchEdit" => [
|
||||
"name" => "批量编辑"
|
||||
],
|
||||
]
|
||||
],
|
||||
"review" => [
|
||||
"name" => "进店核销",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表"
|
||||
],
|
||||
"show" => [
|
||||
"name" => "查看"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"audit" => [
|
||||
"name" => "审核"
|
||||
],
|
||||
"recall" => [
|
||||
"name" => "撤回"
|
||||
],
|
||||
"abort" => [
|
||||
"name" => "弃审"
|
||||
],
|
||||
"print" => [
|
||||
"name" => "打印"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
],
|
||||
"batchEdit" => [
|
||||
"name" => "批量编辑"
|
||||
],
|
||||
]
|
||||
],
|
||||
"market" => [
|
||||
"name" => "进店超市",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,176 @@
|
||||
<div class="form-panel">
|
||||
<div class="form-panel-header">
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
{{$form['btn']}}
|
||||
|
||||
<a href="javascript:costDetailDialog();" class="btn btn-sm btn-default">
|
||||
费用申请明细
|
||||
</a>
|
||||
|
||||
@if($form['access']['close'])
|
||||
<a href="javascript:closeDialog();" class="btn btn-sm btn-default">
|
||||
关闭(打开)
|
||||
</a>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
<div class="form-panel-body panel-form-{{$form['action']}}">
|
||||
<form class="form-horizontal form-controller" method="post" id="{{$form['table']}}" name="{{$form['table']}}">
|
||||
{{$form['tpl']}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var table = '{{$form["table"]}}';
|
||||
var id = '{{$form["row"]["id"]}}';
|
||||
var actived_dt = '{{$form["row"]["actived_dt"]}}';
|
||||
var customer_id = '{{$form["row"]["customer_id"]}}';
|
||||
|
||||
function costDetailDialog() {
|
||||
viewDialog({
|
||||
title: '费用申请明细',
|
||||
dialogClass: 'modal-md',
|
||||
url: app.url('approach/approach/serviceCostDetail', {date: actived_dt, customer_id: customer_id}),
|
||||
close: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
$.post(app.url('approach/approach/close'), {id: id}, function(res) {
|
||||
toastrSuccess(res.data);
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
function get_customer_id() {
|
||||
var customer_id = $('#approach_customer_id').val();
|
||||
return customer_id;
|
||||
}
|
||||
|
||||
function undertake_ratio() {
|
||||
var v1 = $('#approach_barcode_cast').val();
|
||||
var v2 = $('#approach_market_cast').val();
|
||||
var v3 = (toNumber(v2) / toNumber(v1)) * 100;
|
||||
$('#approach_barcode_cast_ratio').val(v3 > 100 ? 100 : v3.toFixed(2));
|
||||
}
|
||||
|
||||
function undertake_ratio2() {
|
||||
var v1 = $('#approach_barcode_cast').val();
|
||||
var v2 = $('#approach_apply2_money').val();
|
||||
var v3 = (toNumber(v2) / toNumber(v1)) * 100;
|
||||
$('#approach_apply2_ratio').val(v3 > 100 ? 100 : v3.toFixed(2));
|
||||
|
||||
var v4 = $('#approach_apply_bccount').val();
|
||||
var v5 = $('#approach_apply_market_count').val();
|
||||
var v6 = (toNumber(v2) / toNumber(v4)) / toNumber(v5);
|
||||
$('#approach_apply2_single_cast').val(toNumber(v6).toFixed(2));
|
||||
}
|
||||
|
||||
function undertake_ratio3() {
|
||||
var v1 = $('#approach_barcode_cast').val();
|
||||
var v2 = $('#approach_apply_money').val();
|
||||
var v3 = (toNumber(v2) / toNumber(v1)) * 100;
|
||||
$('#approach_fee_support_ratio').val(v3 > 100 ? 100 : v3.toFixed(2));
|
||||
}
|
||||
|
||||
(function($) {
|
||||
|
||||
$('#approach_barcode_cast,#approach_market_cast').bind('input propertychange', function() {
|
||||
undertake_ratio();
|
||||
undertake_ratio2();
|
||||
});
|
||||
|
||||
$('#approach_apply2_money,#approach_apply_bccount,#approach_apply_market_count').bind('input propertychange', function() {
|
||||
undertake_ratio();
|
||||
undertake_ratio2();
|
||||
});
|
||||
|
||||
$('#approach_apply_money').bind('input propertychange', function() {
|
||||
undertake_ratio3();
|
||||
});
|
||||
|
||||
$('#approach_field001').prop('checked', true);
|
||||
$('#approach_field004').prop('checked', true);
|
||||
|
||||
})(jQuery);
|
||||
|
||||
// grid初始化事件
|
||||
gdoo.event.set('grid.approach_data', {
|
||||
ready(me) {
|
||||
grid = me;
|
||||
grid.dataKey = 'product_id';
|
||||
},
|
||||
editable: {
|
||||
product_name(params) {
|
||||
var customer_id = $('#approach_customer_id').val();
|
||||
if (customer_id.trim() == '') {
|
||||
toastrError('请先选择客户');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 子表对话框
|
||||
gdoo.event.set('approach_data.product_id', {
|
||||
open(params) {
|
||||
params.url = 'product/product/serviceCustomer';
|
||||
},
|
||||
query(query) {
|
||||
var customer_id = $('#approach_customer_id').val();
|
||||
query.customer_id = customer_id;
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
row.price = selectedRow.price;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 选择客户事件
|
||||
gdoo.event.set('approach.customer_id', {
|
||||
onSelect(row) {
|
||||
if (row.id) {
|
||||
$('#customer_region_region_id').val(row.region_id);
|
||||
$('#customer_region_region_id_text').val(row.region_id_name || '');
|
||||
$('#approach_phone').val(row.tel);
|
||||
$('#approach_fax').val(row.fax);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 选择超市事件
|
||||
gdoo.event.set('approach.market_name', {
|
||||
init(params) {
|
||||
params.ajax.url = app.url('approach/market/dialog');
|
||||
params.resultCache = false;
|
||||
},
|
||||
query(query) {
|
||||
query.field_0 = 'approach_market.name';
|
||||
var customer_id = $('#approach_customer_id').val();
|
||||
query.customer_id = customer_id;
|
||||
},
|
||||
onSelect(row) {
|
||||
if (row.id) {
|
||||
$('#approach_market_fax').val(row.fax);
|
||||
$('#approach_market_totol').val(row.market_count);
|
||||
$('#approach_single_cast').val(row.single_cast);
|
||||
$('#approach_totol_cast').val(row.total_cast);
|
||||
|
||||
$('#approach_market_size').val(row.market_area);
|
||||
$('#approach_market_address').val(row.market_address);
|
||||
$('#approach_market_contact').val(row.market_person_name);
|
||||
$('#approach_market_contact_phone').val(row.market_person_phone);
|
||||
$('#approach_market_type_id_select').val(row.type_id);
|
||||
$('#approach_market_type_id').val(row.type_id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,188 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<div class="wrapper-sm" style="padding-bottom:0;">
|
||||
<div id="dialog-approach-toolbar">
|
||||
<form id="dialog-approach-search-form" name="dialog_approach_search_form" class="form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_approach" class="ag-theme-balham" style="width:100%;height:140px;"></div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_approach_data" class="ag-theme-balham" style="width:100%;height:240px;"></div>
|
||||
</div>
|
||||
<script>
|
||||
var $ref_approach = null;
|
||||
var $ref_approach_data = null;
|
||||
var params = JSON.parse('{{json_encode($query)}}');
|
||||
(function($) {
|
||||
params['master'] = 1;
|
||||
var mGridDiv = document.querySelector("#ref_approach");
|
||||
var mGrid = new agGridOptions();
|
||||
mGrid.remoteDataUrl = '{{url()}}';
|
||||
|
||||
var option = gdoo.formKey(params);
|
||||
var event = gdoo.event.get(option.key);
|
||||
event.trigger('query', params);
|
||||
|
||||
mGrid.remoteParams = params;
|
||||
mGrid.rowMultiSelectWithClick = false;
|
||||
mGrid.rowSelection = 'multiple';
|
||||
mGrid.autoColumnsToFit = false;
|
||||
mGrid.defaultColDef.suppressMenu = true;
|
||||
mGrid.defaultColDef.sortable = false;
|
||||
mGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'sn', headerName: '单据编号', minWidth: 160},
|
||||
{cellClass:'text-center', field: 'created_at', headerName: '单据日期', width: 120},
|
||||
{cellClass:'text-center', field: 'status', cellRenderer: 'htmlCellRenderer', headerName: '状态', width: 160},
|
||||
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 120},
|
||||
{field:'customer_name', headerName: '客户名称', width: 160},
|
||||
{cellClass:'text-center',field:'region_name', headerName: '销售团队', width: 120},
|
||||
{cellClass:'text-right',field:'barcode_cast', headerName: '申请费用', width: 100},
|
||||
{cellClass:'text-right',field:'apply2_money', headerName: '批复费用', width: 100},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
mGrid.onSelectionChanged = function() {
|
||||
var rows = mGrid.api.getSelectedRows();
|
||||
var ids = [];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
params.ids = ids;
|
||||
sGrid.remoteData(params);
|
||||
};
|
||||
|
||||
mGrid.onRowClicked = function(row) {
|
||||
var selected = row.node.isSelected();
|
||||
if (selected === false) {
|
||||
row.node.setSelected(true, true);
|
||||
}
|
||||
};
|
||||
|
||||
mGrid.onRowDoubleClicked = function (row) {
|
||||
var ret = writeSelected();
|
||||
if (ret === true) {
|
||||
$('#gdoo-dialog-' + params.dialog_index).dialog('close');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 初始化选择
|
||||
*/
|
||||
function initSelected() {
|
||||
if (params.is_grid) {
|
||||
} else {
|
||||
var rows = {};
|
||||
var id = $('#'+option.id).val();
|
||||
if (id) {
|
||||
var ids = id.split(',');
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
rows[ids[i]] = ids[i];
|
||||
}
|
||||
}
|
||||
mGrid.api.forEachNode(function(node) {
|
||||
var key = node.data['id'];
|
||||
if (rows[key] != undefined) {
|
||||
node.setSelected(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入选中
|
||||
*/
|
||||
function writeSelected() {
|
||||
var rows = mGrid.api.getSelectedRows();
|
||||
if (params.is_grid) {
|
||||
var list = gdoo.forms[params.form_id];
|
||||
list.api.dialogSelected(params);
|
||||
} else {
|
||||
var id = [];
|
||||
var text = [];
|
||||
$.each(rows, function(k, row) {
|
||||
id.push(row['id']);
|
||||
text.push(row.name);
|
||||
});
|
||||
$('#'+option.id).val(id.join(','));
|
||||
$('#'+option.id+'_text').val(text.join(','));
|
||||
|
||||
if (event.exist('onSelect')) {
|
||||
return event.trigger('onSelect', multiple ? rows : rows[0]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
mGrid.writeSelected = writeSelected;
|
||||
gdoo.dialogs[option.id] = mGrid;
|
||||
|
||||
new agGrid.Grid(mGridDiv, mGrid);
|
||||
// 读取数据
|
||||
mGrid.remoteData();
|
||||
$ref_approach = mGrid;
|
||||
|
||||
params['master'] = 0;
|
||||
var sGridDiv = document.querySelector("#ref_approach_data");
|
||||
var sGrid = new agGridOptions();
|
||||
sGrid.remoteDataUrl = '{{url()}}';
|
||||
sGrid.remoteParams = params;
|
||||
sGrid.rowSelection = 'multiple';
|
||||
sGrid.defaultColDef.suppressMenu = true;
|
||||
sGrid.defaultColDef.sortable = false;
|
||||
sGrid.suppressRowClickSelection = true;
|
||||
sGrid.getRowClass = function(params) {
|
||||
params.node.setSelected(true);
|
||||
};
|
||||
sGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'product_code', headerName: '产品编码', width: 100},
|
||||
{field: 'product_name', headerName: '商品名称', minWidth: 180},
|
||||
{cellClass:'text-center', field: 'product_spec', headerName: '商品规格', width: 140},
|
||||
{cellClass:'text-center', field: 'product_barcode', headerName: '商品条码', width: 120},
|
||||
{cellClass:'text-center', field: 'product_unit', headerName: '计量单位', width: 80},
|
||||
{cellClass:'text-right', field: 'price1', headerName: '报价', width: 80},
|
||||
{cellClass:'text-right', field: 'price2', headerName: '售价', width: 80},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
sGrid.onRowClicked = function(row) {
|
||||
var selected = row.node.isSelected();
|
||||
if (selected === false) {
|
||||
row.node.setSelected(true, true);
|
||||
}
|
||||
};
|
||||
|
||||
new agGrid.Grid(sGridDiv, sGrid);
|
||||
// 读取数据
|
||||
sGrid.remoteData();
|
||||
$ref_approach_data = sGrid;
|
||||
|
||||
var data = JSON.parse('{{json_encode($search["forms"])}}');
|
||||
var search = $('#dialog-approach-search-form').searchForm({
|
||||
data: data,
|
||||
init:function(e) {}
|
||||
});
|
||||
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var query = search.serializeArray();
|
||||
$.map(query, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
|
||||
params['master'] = 1;
|
||||
mGrid.remoteData(params);
|
||||
|
||||
params['master'] = 0;
|
||||
sGrid.remoteData(params);
|
||||
return false;
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,83 @@
|
||||
{{$header["js"]}}
|
||||
|
||||
<div class="panel no-border" id="{{$header['master_table']}}-controller">
|
||||
@include('headers')
|
||||
<div class='list-jqgrid'>
|
||||
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
var table = '{{$header["master_table"]}}';
|
||||
var config = gdoo.grids[table];
|
||||
var action = config.action;
|
||||
var search = config.search;
|
||||
|
||||
action.dialogType = 'layer';
|
||||
|
||||
// 自定义搜索方法
|
||||
search.searchInit = function (e) {
|
||||
var self = this;
|
||||
}
|
||||
|
||||
action.fee_detail = function(data) {
|
||||
viewDialog({
|
||||
title: '兑现明细',
|
||||
dialogClass: 'modal-md',
|
||||
url: app.url('approach/review/feeDetail', {id: data.master_id}),
|
||||
close: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
action.product = function(data) {
|
||||
viewDialog({
|
||||
title: '产品明细',
|
||||
dialogClass: 'modal-md',
|
||||
url: app.url('approach/approach/product', {id: data.master_id}),
|
||||
close: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var options = new agGridOptions();
|
||||
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
|
||||
gridDiv.style.height = getPanelHeight(48);
|
||||
|
||||
options.remoteDataUrl = '{{url()}}';
|
||||
options.autoColumnsToFit = false;
|
||||
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')
|
||||
@@ -0,0 +1 @@
|
||||
{{$form['tpl']}}
|
||||
@@ -0,0 +1,33 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<div id="approach_product" class="ag-theme-balham" style="width:100%;height:320px;"></div>
|
||||
|
||||
<script>
|
||||
(function($) {
|
||||
var gridDiv = document.querySelector("#approach_product");
|
||||
var grid = new agGridOptions();
|
||||
grid.remoteDataUrl = '{{url()}}';
|
||||
|
||||
var params = JSON.parse('{{json_encode($query)}}');
|
||||
|
||||
grid.remoteParams = params;
|
||||
grid.rowMultiSelectWithClick = false;
|
||||
grid.rowSelection = 'multiple';
|
||||
// grid.autoColumnsToFit = false;
|
||||
grid.defaultColDef.suppressMenu = true;
|
||||
grid.defaultColDef.sortable = false;
|
||||
grid.columnDefs = [
|
||||
{cellClass:'text-center', headerName: '', type: 'sn', width: 40},
|
||||
{cellClass:'text-left', field: 'name', headerName: '产品名称', minWidth: 140},
|
||||
{cellClass:'text-center', field: 'spec', headerName: '规格型号', width: 100},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
new agGrid.Grid(gridDiv, grid);
|
||||
// 读取数据
|
||||
grid.remoteData();
|
||||
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,121 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<div class="wrapper-sm" style="padding-bottom:0;">
|
||||
<div id="dialog-approach-toolbar">
|
||||
<form id="dialog-approach-search-form" name="dialog_approach_search_form" class="form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_approach" class="ag-theme-balham" style="width:100%;height:140px;"></div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_approach_data" class="ag-theme-balham" style="width:100%;height:240px;"></div>
|
||||
</div>
|
||||
<script>
|
||||
var $ref_approach = null;
|
||||
var $ref_approach_data = null;
|
||||
var params = JSON.parse('{{json_encode($query)}}');
|
||||
(function($) {
|
||||
params['master'] = 1;
|
||||
var mGridDiv = document.querySelector("#ref_approach");
|
||||
var mGrid = new agGridOptions();
|
||||
mGrid.remoteDataUrl = '{{url()}}';
|
||||
mGrid.remoteParams = params;
|
||||
mGrid.rowSelection = 'multiple';
|
||||
mGrid.autoColumnsToFit = false;
|
||||
mGrid.rowMultiSelectWithClick = false;
|
||||
mGrid.defaultColDef.suppressMenu = true;
|
||||
mGrid.defaultColDef.sortable = false;
|
||||
mGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'sn', headerName: '促销编号', minWidth: 160},
|
||||
{cellClass:'text-center', field: 'created_at', type: 'datetime', headerName: '单据日期', width: 120},
|
||||
{cellClass:'text-center', field: 'status', headerName: '状态', width: 160},
|
||||
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 160},
|
||||
{field:'customer_name', headerName: '客户名称', width: 160},
|
||||
{field:'warehouse_contact', headerName: '收货人', width: 160},
|
||||
{field:'warehouse_phone', headerName: '收货人电话', width: 160},
|
||||
{field:'warehouse_address', headerName: '收货地址', width: 260},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
mGrid.onSelectionChanged = function() {
|
||||
var rows = mGrid.api.getSelectedRows();
|
||||
var ids = [];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
params.ids = ids;
|
||||
sGrid.remoteData(params);
|
||||
};
|
||||
new agGrid.Grid(mGridDiv, mGrid);
|
||||
// 读取数据
|
||||
mGrid.remoteData();
|
||||
$ref_approach = mGrid;
|
||||
|
||||
params['master'] = 0;
|
||||
var sGridDiv = document.querySelector("#ref_approach_data");
|
||||
var sGrid = new agGridOptions();
|
||||
sGrid.remoteDataUrl = '{{url()}}';
|
||||
sGrid.remoteParams = params;
|
||||
sGrid.rowSelection = 'multiple';
|
||||
sGrid.autoColumnsToFit = false;
|
||||
sGrid.defaultColDef.suppressMenu = true;
|
||||
sGrid.defaultColDef.sortable = false;
|
||||
sGrid.suppressRowClickSelection = true;
|
||||
sGrid.getRowClass = function(params) {
|
||||
var data = params.data;
|
||||
params.node.setSelected(true);
|
||||
};
|
||||
sGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'product_code', headerName: '存货编码', width: 100},
|
||||
{field: 'product_name', headerName: '商品名称', minWidth: 180},
|
||||
{cellClass:'text-center', field: 'product_spec', headerName: '商品规格', width: 140},
|
||||
{cellClass:'text-center', field: 'unit_name', headerName: '计量单位', width: 80},
|
||||
{cellClass:'text-center', field: 'discount_rate', headerName: '现存量', width: 80},
|
||||
{cellClass:'text-right', field: 'total_quantity', headerName: '促销数量', width: 80},
|
||||
{cellClass:'text-right', field: 'use_quantity', headerName: '已发数量', width: 80},
|
||||
{cellClass:'text-right', field: 'quantity', headerName: '可用数量', width: 80},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
sGrid.onRowClicked = function(row) {
|
||||
var selected = row.node.isSelected();
|
||||
if (selected === false) {
|
||||
row.node.setSelected(true, true);
|
||||
}
|
||||
};
|
||||
|
||||
new agGrid.Grid(sGridDiv, sGrid);
|
||||
// 读取数据
|
||||
sGrid.remoteData();
|
||||
$ref_approach_data = sGrid;
|
||||
|
||||
var data = JSON.parse('{{json_encode($search["forms"])}}');
|
||||
var search = $('#dialog-approach-search-form').searchForm({
|
||||
data: data,
|
||||
init:function(e) {}
|
||||
});
|
||||
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var query = search.serializeArray();
|
||||
$.map(query, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
|
||||
params['master'] = 1;
|
||||
mGrid.remoteData(params);
|
||||
|
||||
params['master'] = 0;
|
||||
sGrid.remoteData(params);
|
||||
return false;
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,124 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
.service-cost-detail .control-label {
|
||||
padding-top: 11px;
|
||||
text-align: right;
|
||||
}
|
||||
.service-cost-detail .form-group:first-child .col-xs-3:nth-child(3),
|
||||
.service-cost-detail .form-group:first-child .col-xs-3:nth-child(4) {
|
||||
border-top: 0 !important;
|
||||
}
|
||||
|
||||
.service-cost-detail .ag-theme-balham .ag-root-wrapper {
|
||||
border-left-width: 1px;
|
||||
border-right-width: 1px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="service-cost-detail">
|
||||
|
||||
<div class="form-controller">
|
||||
<div class="form-group">
|
||||
<div class="col-xs-3 col-sm-2 control-label">费用合计</div>
|
||||
<div class="col-xs-3 col-sm-2 control-text"><div class="form-control input-sm">@number($all['apply_money'], 2)</div></div>
|
||||
<div class="col-xs-3 col-sm-2 control-label">支持合计</div>
|
||||
<div class="col-xs-3 col-sm-2 control-text"><div class="form-control input-sm">@number($all['support_money'], 2)</div></div>
|
||||
<div class="col-xs-3 col-sm-2 control-label">年度销售额</div>
|
||||
<div class="col-xs-3 col-sm-2 control-text"><div class="form-control input-sm">@number($all['money'], 2)</div></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-xs-3 col-sm-2 control-label">申请产出比(%)</div>
|
||||
<div class="col-xs-3 col-sm-2 control-text"><div class="form-control input-sm">@number($all['support_percent'], 2)</div></div>
|
||||
<div class="col-xs-3 col-sm-2 control-label">兑现产出比(%)</div>
|
||||
<div class="col-xs-3 col-sm-2 control-text"><div class="form-control input-sm">@number($all['apply_percent'], 2)</div></div>
|
||||
<div class="col-xs-3 col-sm-2 control-label"></div>
|
||||
<div class="col-xs-3 col-sm-2 control-text"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<div class="tabs-box">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a class="text-sm" href="#tab_a" data-toggle="tab">促销</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="text-sm" href="#tab_b" data-toggle="tab">进店</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="text-sm" href="#tab_c" data-toggle="tab">物资</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="tab_ontent" class="tab-content" style="padding:5px;">
|
||||
<div class="tab-pane active" id="tab_a">
|
||||
<div id="ref_tab_a" class="ag-theme-balham" style="width:100%;height:280px;"></div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tab_b">
|
||||
<div id="ref_tab_b" class="ag-theme-balham" style="width:100%;height:280px;"></div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tab_c">
|
||||
<div id="ref_tab_c" class="ag-theme-balham" style="width:100%;height:280px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var params = JSON.parse('{{json_encode($query)}}');
|
||||
(function($) {
|
||||
var tabDiv = document.querySelector("#ref_tab_a");
|
||||
var grid = new agGridOptions();
|
||||
grid.remoteDataUrl = '{{url()}}';
|
||||
grid.remoteParams = params;
|
||||
grid.rowSelection = 'single';
|
||||
grid.defaultColDef.suppressMenu = true;
|
||||
grid.defaultColDef.sortable = false;
|
||||
grid.columnDefs = [
|
||||
{cellClass:'text-center', field: 'start_dt', headerName: '开始日期', width: 100},
|
||||
{cellClass:'text-center', field: 'end_dt', headerName: '结束日期', width: 100},
|
||||
{cellClass:'text-center', field: 'promote_scope', headerName: '超市', minWidth: 160},
|
||||
//{cellClass:'text-center', field: 'created_at', headerName: '促销方式', width: 100},
|
||||
{cellClass:'text-right',field:'pro_total_cost', headerName: '总费用', width: 100},
|
||||
{cellClass:'text-right',field:'undertake_money', headerName: '支持费用', width: 100}
|
||||
];
|
||||
new agGrid.Grid(tabDiv, grid);
|
||||
// 读取数据
|
||||
grid.remoteData({type: 'promotion'});
|
||||
|
||||
var tabDiv2 = document.querySelector("#ref_tab_b");
|
||||
var grid2 = new agGridOptions();
|
||||
grid2.remoteDataUrl = '{{url()}}';
|
||||
grid2.remoteParams = params;
|
||||
grid2.rowSelection = 'single';
|
||||
grid2.defaultColDef.suppressMenu = true;
|
||||
grid2.defaultColDef.sortable = false;
|
||||
grid2.columnDefs = [
|
||||
{cellClass:'text-center', field: 'created_at', type: 'date', headerName: '申请日期', width: 120},
|
||||
{cellClass:'text-center', field: 'market_name', headerName: '超市名称', minWidth: 160},
|
||||
{cellClass:'text-right',field:'barcode_cast', headerName: '总费用', width: 140},
|
||||
{cellClass:'text-right',field:'apply2_money', headerName: '支持费用', width: 140}
|
||||
];
|
||||
new agGrid.Grid(tabDiv2, grid2);
|
||||
// 读取数据
|
||||
grid2.remoteData({type: 'approach'});
|
||||
|
||||
var tabDiv3 = document.querySelector("#ref_tab_c");
|
||||
var grid3 = new agGridOptions();
|
||||
grid3.remoteDataUrl = '{{url()}}';
|
||||
grid3.remoteParams = params;
|
||||
grid3.rowSelection = 'single';
|
||||
grid3.defaultColDef.suppressMenu = true;
|
||||
grid3.defaultColDef.sortable = false;
|
||||
grid3.columnDefs = [
|
||||
{cellClass:'text-center', field: 'created_at', type: 'date', headerName: '申请日期', minWidth: 120},
|
||||
{cellClass:'text-right',field:'pro_total_cost', headerName: '总费用', width: 140},
|
||||
{cellClass:'text-right',field:'undertake_money', headerName: '支持费用', width: 140}
|
||||
];
|
||||
new agGrid.Grid(tabDiv3, grid3);
|
||||
// 读取数据
|
||||
grid3.remoteData({type: 'material'});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,179 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
<div class="wrapper-xs">
|
||||
<div id="dialog-approach-toolbar">
|
||||
<form id="dialog-approach-search-form" name="dialog_approach_search_form" class="form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ref_approach" class="ag-theme-balham" style="width:100%;height:140px;"></div>
|
||||
<div class="m-t-xs">
|
||||
<div id="ref_approach_data" class="ag-theme-balham" style="width:100%;height:240px;"></div>
|
||||
</div>
|
||||
<script>
|
||||
var $ref_approach = null;
|
||||
var $ref_approach_data = null;
|
||||
var params = JSON.parse('{{json_encode($query)}}');
|
||||
(function($) {
|
||||
params['master'] = 1;
|
||||
var mGridDiv = document.querySelector("#ref_approach");
|
||||
var mGrid = new agGridOptions();
|
||||
mGrid.remoteDataUrl = '{{url()}}';
|
||||
|
||||
var option = gdoo.formKey(params);
|
||||
var event = gdoo.event.get(option.key);
|
||||
event.trigger('query', params);
|
||||
|
||||
mGrid.remoteParams = params;
|
||||
mGrid.rowSelection = 'single';
|
||||
mGrid.autoColumnsToFit = false;
|
||||
mGrid.defaultColDef.suppressMenu = true;
|
||||
mGrid.defaultColDef.sortable = false;
|
||||
mGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'sn', headerName: '单据编号', minWidth: 160},
|
||||
{cellClass:'text-center', field: 'created_at', headerName: '单据日期', width: 120},
|
||||
{cellClass:'text-center', field: 'status', cellRenderer: 'htmlCellRenderer', headerName: '状态', width: 160},
|
||||
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 120},
|
||||
{field:'customer_name', headerName: '客户名称', width: 160},
|
||||
{cellClass:'text-center',field:'region_name', headerName: '销售团队', width: 120},
|
||||
{cellClass:'text-right',field:'barcode_cast', headerName: '申请费用', width: 100},
|
||||
{cellClass:'text-right',field:'apply2_money', headerName: '批复费用', width: 100},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
mGrid.onRowClicked = function(row) {
|
||||
var selected = row.node.isSelected();
|
||||
if (selected === false) {
|
||||
row.node.setSelected(true, true);
|
||||
}
|
||||
var rows = mGrid.api.getSelectedRows();
|
||||
var ids = [];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
params.ids = ids;
|
||||
sGrid.remoteData(params);
|
||||
};
|
||||
|
||||
mGrid.onRowDoubleClicked = function (row) {
|
||||
var ret = writeSelected();
|
||||
if (ret == true) {
|
||||
$('#gdoo-dialog-' + params.dialog_index).dialog('close');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 初始化选择
|
||||
*/
|
||||
function initSelected() {
|
||||
if (params.is_grid) {
|
||||
} else {
|
||||
var rows = {};
|
||||
var id = $('#'+option.id).val();
|
||||
if (id) {
|
||||
var ids = id.split(',');
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
rows[ids[i]] = ids[i];
|
||||
}
|
||||
}
|
||||
mGrid.api.forEachNode(function(node) {
|
||||
var key = node.data['id'];
|
||||
if (rows[key] != undefined) {
|
||||
node.setSelected(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入选中
|
||||
*/
|
||||
function writeSelected() {
|
||||
var rows = mGrid.api.getSelectedRows();
|
||||
if (params.is_grid) {
|
||||
var list = gdoo.forms[params.form_id];
|
||||
list.api.dialogSelected(params);
|
||||
} else {
|
||||
var id = [];
|
||||
var text = [];
|
||||
$.each(rows, function(k, row) {
|
||||
id.push(row['id']);
|
||||
text.push(row.name);
|
||||
});
|
||||
$('#'+option.id).val(id.join(','));
|
||||
$('#'+option.id+'_text').val(text.join(','));
|
||||
|
||||
if (event.exist('onSelect')) {
|
||||
return event.trigger('onSelect', multiple ? rows : rows[0]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
mGrid.writeSelected = writeSelected;
|
||||
gdoo.dialogs[option.id] = mGrid;
|
||||
|
||||
new agGrid.Grid(mGridDiv, mGrid);
|
||||
// 读取数据
|
||||
mGrid.remoteData();
|
||||
$ref_approach = mGrid;
|
||||
|
||||
params['master'] = 0;
|
||||
var sGridDiv = document.querySelector("#ref_approach_data");
|
||||
var sGrid = new agGridOptions();
|
||||
sGrid.remoteDataUrl = '{{url()}}';
|
||||
sGrid.remoteParams = params;
|
||||
sGrid.rowSelection = 'multiple';
|
||||
sGrid.defaultColDef.suppressMenu = true;
|
||||
sGrid.defaultColDef.sortable = false;
|
||||
sGrid.suppressRowClickSelection = true;
|
||||
sGrid.getRowClass = function(params) {
|
||||
params.node.setSelected(true);
|
||||
};
|
||||
sGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'product_code', headerName: '产品编码', width: 100},
|
||||
{field: 'product_name', headerName: '商品名称', minWidth: 180},
|
||||
{cellClass:'text-center', field: 'product_spec', headerName: '商品规格', width: 140},
|
||||
{cellClass:'text-center', field: 'product_barcode', headerName: '商品条码', width: 120},
|
||||
{cellClass:'text-center', field: 'product_unit', headerName: '计量单位', width: 80},
|
||||
{cellClass:'text-right', field: 'price1', headerName: '报价', width: 80},
|
||||
{cellClass:'text-right', field: 'price2', headerName: '售价', width: 80},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
sGrid.onRowClicked = function(row) {
|
||||
var selected = row.node.isSelected();
|
||||
if (selected === false) {
|
||||
row.node.setSelected(true, true);
|
||||
}
|
||||
};
|
||||
|
||||
new agGrid.Grid(sGridDiv, sGrid);
|
||||
// 读取数据
|
||||
sGrid.remoteData();
|
||||
$ref_approach_data = sGrid;
|
||||
|
||||
var data = JSON.parse('{{json_encode($search["forms"])}}');
|
||||
var search = $('#dialog-approach-search-form').searchForm({
|
||||
data: data,
|
||||
init:function(e) {}
|
||||
});
|
||||
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var query = search.serializeArray();
|
||||
$.map(query, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
|
||||
params['master'] = 1;
|
||||
mGrid.remoteData(params);
|
||||
|
||||
params['master'] = 0;
|
||||
sGrid.remoteData(params);
|
||||
return false;
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,3 @@
|
||||
<form class="form-horizontal form-controller" method="post" id="{{$form['table']}}" name="{{$form['table']}}">
|
||||
{{$form['tpl']}}
|
||||
</form>
|
||||
@@ -0,0 +1,109 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<div class="wrapper-sm" style="padding-bottom:0;">
|
||||
<div id="dialog-approach-toolbar">
|
||||
<form id="dialog-approach-search-form" name="dialog_approach_search_form" class="form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_approach" class="ag-theme-balham" style="width:100%;height:140px;"></div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_approach_data" class="ag-theme-balham" style="width:100%;height:240px;"></div>
|
||||
</div>
|
||||
<script>
|
||||
var $ref_approach = null;
|
||||
var $ref_approach_data = null;
|
||||
var params = JSON.parse('{{json_encode($query)}}');
|
||||
(function($) {
|
||||
params['master'] = 1;
|
||||
var mGridDiv = document.querySelector("#ref_approach");
|
||||
var mGrid = new agGridOptions();
|
||||
mGrid.remoteDataUrl = '{{url()}}';
|
||||
mGrid.remoteParams = params;
|
||||
mGrid.rowMultiSelectWithClick = false;
|
||||
mGrid.rowSelection = 'multiple';
|
||||
mGrid.autoColumnsToFit = false;
|
||||
mGrid.defaultColDef.suppressMenu = true;
|
||||
mGrid.defaultColDef.sortable = false;
|
||||
mGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'sn', headerName: '促销编号', minWidth: 160},
|
||||
{cellClass:'text-center', field: 'created_at', type: 'datetime', headerName: '单据日期', width: 120},
|
||||
{cellClass:'text-center', field: 'status', headerName: '状态', width: 160},
|
||||
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 160},
|
||||
{field:'customer_name', headerName: '客户名称', width: 160},
|
||||
{field:'warehouse_contact', headerName: '收货人', width: 160},
|
||||
{field:'warehouse_phone', headerName: '收货人电话', width: 160},
|
||||
{field:'warehouse_address', headerName: '收货地址', width: 260},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
mGrid.onSelectionChanged = function() {
|
||||
var rows = mGrid.api.getSelectedRows();
|
||||
var ids = [];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
params.approach_ids = ids;
|
||||
sGrid.remoteData(params);
|
||||
};
|
||||
new agGrid.Grid(mGridDiv, mGrid);
|
||||
// 读取数据
|
||||
mGrid.remoteData();
|
||||
$ref_approach = mGrid;
|
||||
|
||||
params['master'] = 0;
|
||||
var sGridDiv = document.querySelector("#ref_approach_data");
|
||||
var sGrid = new agGridOptions();
|
||||
sGrid.remoteDataUrl = '{{url()}}';
|
||||
sGrid.remoteParams = params;
|
||||
//sGrid.rowMultiSelectWithClick = true;
|
||||
sGrid.rowSelection = 'multiple';
|
||||
sGrid.autoColumnsToFit = false;
|
||||
sGrid.defaultColDef.suppressMenu = true;
|
||||
sGrid.defaultColDef.sortable = false;
|
||||
sGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'product_code', headerName: '存货编码', width: 100},
|
||||
{field: 'product_name', headerName: '商品名称', minWidth: 180},
|
||||
{cellClass:'text-center', field: 'product_spec', headerName: '商品规格', width: 140},
|
||||
{cellClass:'text-center', field: 'unit_name', headerName: '计量单位', width: 80},
|
||||
{cellClass:'text-center', field: 'discount_rate', headerName: '现存量', width: 80},
|
||||
{cellClass:'text-right', field: 'total_quantity', headerName: '促销数量', width: 80},
|
||||
{cellClass:'text-right', field: 'use_quantity', headerName: '已发数量', width: 80},
|
||||
{cellClass:'text-right', field: 'quantity', headerName: '可用数量', width: 80},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
new agGrid.Grid(sGridDiv, sGrid);
|
||||
// 读取数据
|
||||
sGrid.remoteData();
|
||||
$ref_approach_data = sGrid;
|
||||
|
||||
var data = JSON.parse('{{json_encode($search["forms"])}}');
|
||||
var search = $('#dialog-approach-search-form').searchForm({
|
||||
data: data,
|
||||
init:function(e) {}
|
||||
});
|
||||
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var query = search.serializeArray();
|
||||
$.map(query, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
|
||||
params['master'] = 1;
|
||||
mGrid.remoteData(params);
|
||||
|
||||
params['master'] = 0;
|
||||
sGrid.remoteData(params);
|
||||
return false;
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,59 @@
|
||||
{{$header["js"]}}
|
||||
|
||||
<div class="panel no-border" id="{{$header['master_table']}}-controller">
|
||||
@include('headers')
|
||||
<div class='list-jqgrid'>
|
||||
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
var table = '{{$header["master_table"]}}';
|
||||
var config = gdoo.grids[table];
|
||||
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);
|
||||
|
||||
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.edit(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')
|
||||
@@ -0,0 +1,120 @@
|
||||
<div class="form-panel">
|
||||
<div class="form-panel-header">
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
{{$form['btn']}}
|
||||
</div>
|
||||
<div class="form-panel-body panel-form-{{$form['action']}}">
|
||||
<form class="form-horizontal form-controller" method="post" id="{{$form['table']}}" name="{{$form['table']}}">
|
||||
{{$form['tpl']}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var table = '{{$form["table"]}}';
|
||||
var grid = null;
|
||||
|
||||
function get_customer_id() {
|
||||
var customer_id = $('#approach_review_customer_id').val();
|
||||
return customer_id;
|
||||
}
|
||||
|
||||
$(function($) {
|
||||
|
||||
$(document).on('click', '[data-toggle="joint"]', function(event) {
|
||||
var data = $(this).data();
|
||||
// 联查进店申请
|
||||
if (data.action == 'apply') {
|
||||
top.addTab('approach/approach/show?id=' + data.id, 'approach_approach_show', '进店申请(联查)');
|
||||
}
|
||||
// 联查费用明细
|
||||
if (data.action == 'cash_detail') {
|
||||
viewDialog({
|
||||
title: '兑现明细',
|
||||
dialogClass: 'modal-md',
|
||||
url: app.url('approach/review/feeDetail', {id: data.id}),
|
||||
close: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// grid初始化事件
|
||||
gdoo.event.set('grid.approach_review_data', {
|
||||
ready(me) {
|
||||
grid = me;
|
||||
grid.dataKey = 'product_id';
|
||||
},
|
||||
editable: {
|
||||
product_name(params) {
|
||||
var approach_id = $('#approach_review_approach_id').val();
|
||||
if (approach_id.trim() == '') {
|
||||
toastrError('请先选择申请编号');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 子表对话框
|
||||
gdoo.event.set('approach_review_data.product_id', {
|
||||
open(params) {
|
||||
params.url = 'product/product/serviceCustomer';
|
||||
},
|
||||
query(query) {
|
||||
var customer_id = $('#approach_review_customer_id').val();
|
||||
query.customer_id = customer_id;
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
$(function() {
|
||||
$('#approach_review_pay_type').on('change', function() {
|
||||
if (this.value == 1 || this.value == 3) {
|
||||
$('#approach_review_use_order').val(1);
|
||||
} else {
|
||||
$('#approach_review_use_order').val(0);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 进场核销申请编号
|
||||
gdoo.event.set('approach_review.apply_id', {
|
||||
open(params) {
|
||||
params.url = 'approach/approach/serviceReview';
|
||||
},
|
||||
query(query) {
|
||||
},
|
||||
onSelect() {
|
||||
var approach = $ref_approach.api.getSelectedRows()[0];
|
||||
var rows = $ref_approach_data.api.getSelectedRows();
|
||||
$('#approach_review_apply_id').val(approach.id);
|
||||
$('#approach_review_apply_id_text').val(approach.sn);
|
||||
$('#approach_review_apply_dt').val(approach.created_at);
|
||||
$('#approach_review_apply_money').val(approach.apply2_money);
|
||||
$('#approach_review_verification_cost').val(approach.apply2_money);
|
||||
$('#approach_review_fact_verification_cost').val(approach.apply2_money);
|
||||
$('#approach_review_market_name').val(approach.market_name);
|
||||
$('#approach_review_customer_id').val(approach.customer_id);
|
||||
$('#approach_review_customer_id_text').val(approach.customer_name);
|
||||
$('#customer_region_region_id').val(approach.region_id);
|
||||
$('#customer_region_region_id_text').val(approach.region_name);
|
||||
|
||||
grid.api.setRowData([]);
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
row.is_store = 1;
|
||||
grid.api.memoryStore.create(row);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,34 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<div id="approach_fee_detail" class="ag-theme-balham" style="width:100%;height:280px;"></div>
|
||||
|
||||
<script>
|
||||
(function($) {
|
||||
var gridDiv = document.querySelector("#approach_fee_detail");
|
||||
var grid = new agGridOptions();
|
||||
grid.remoteDataUrl = '{{url()}}';
|
||||
|
||||
var params = JSON.parse('{{json_encode($query)}}');
|
||||
|
||||
grid.remoteParams = params;
|
||||
grid.rowMultiSelectWithClick = false;
|
||||
grid.rowSelection = 'multiple';
|
||||
// grid.autoColumnsToFit = false;
|
||||
grid.defaultColDef.suppressMenu = true;
|
||||
grid.defaultColDef.sortable = false;
|
||||
grid.columnDefs = [
|
||||
{cellClass:'text-center', headerName: '', type: 'sn', width: 40},
|
||||
{cellClass:'text-center', field: 'sn', headerName: '单据编号', minWidth: 140},
|
||||
{cellClass:'text-center', field: 'date', headerName: '兑现日期', width: 100},
|
||||
{cellClass:'text-right', field:'verification_cost', headerName: '兑现金额', width: 100},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
new agGrid.Grid(gridDiv, grid);
|
||||
// 读取数据
|
||||
grid.remoteData();
|
||||
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,59 @@
|
||||
{{$header["js"]}}
|
||||
|
||||
<div class="panel no-border" id="{{$header['master_table']}}-controller">
|
||||
@include('headers')
|
||||
<div class='list-jqgrid'>
|
||||
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
var table = '{{$header["master_table"]}}';
|
||||
var config = gdoo.grids[table];
|
||||
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);
|
||||
|
||||
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')
|
||||
@@ -0,0 +1 @@
|
||||
{{$form['tpl']}}
|
||||
Reference in New Issue
Block a user