修改
This commit is contained in:
parent
c39e3c01da
commit
7dd30af6ad
|
|
@ -6,6 +6,7 @@ namespace app\admin\controller;
|
|||
|
||||
use app\admin\controller\orders\DispatchLogic;
|
||||
use app\admin\model\Admin;
|
||||
use app\admin\model\AuthGroupAccess;
|
||||
use app\admin\model\Message;
|
||||
use app\admin\model\OrderDispatch;
|
||||
use app\admin\model\Worker;
|
||||
|
|
@ -26,8 +27,12 @@ class AutoDispatchLogic
|
|||
// dd($worker_id);
|
||||
if (!$worker_id) {
|
||||
$area_id = substr($order->area_id, 0, 4);
|
||||
$res = Admin::where('area_ids', 'like', '%' . $area_id . '%')
|
||||
$res_worker = Admin::where('area_ids', 'like', '%' . $area_id . '%')
|
||||
|
||||
->column('id');
|
||||
$res_admin = AuthGroupAccess::whereIn('group_id', [1,11])
|
||||
->column('uid');
|
||||
$res = array_values(array_unique(array_merge($res_worker,$res_admin)));
|
||||
$insert = [];
|
||||
foreach ($res as $re) {
|
||||
$insert [] = [
|
||||
|
|
|
|||
|
|
@ -28,84 +28,7 @@ class Dashboard extends Backend
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
\think\Db::execute("SET @@sql_mode='';");
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
$column = [];
|
||||
$starttime = Date::unixtime('day', -6);
|
||||
$endtime = Date::unixtime('day', 0, 'end');
|
||||
$joinlist = Db("user")->where('jointime', 'between time', [$starttime, $endtime])
|
||||
->field('jointime, status, COUNT(*) AS nums, DATE_FORMAT(FROM_UNIXTIME(jointime), "%Y-%m-%d") AS join_date')
|
||||
->group('join_date')
|
||||
->select();
|
||||
for ($time = $starttime; $time <= $endtime;) {
|
||||
$column[] = date("Y-m-d", $time);
|
||||
$time += 86400;
|
||||
}
|
||||
$userlist = array_fill_keys($column, 0);
|
||||
foreach ($joinlist as $k => $v) {
|
||||
$userlist[$v['join_date']] = $v['nums'];
|
||||
}
|
||||
|
||||
$dbTableList = Db::query("SHOW TABLE STATUS");
|
||||
$addonList = get_addon_list();
|
||||
$totalworkingaddon = 0;
|
||||
$totaladdon = count($addonList);
|
||||
foreach ($addonList as $index => $item) {
|
||||
if ($item['state']) {
|
||||
$totalworkingaddon += 1;
|
||||
}
|
||||
}
|
||||
|
||||
$today = [
|
||||
(new Carbon())->now()->startOfDay(),
|
||||
(new Carbon())->now()->endOfDay(),
|
||||
];
|
||||
|
||||
$this->view->assign([
|
||||
'totaluser' => User::count(),
|
||||
'totaladdon' => $totaladdon,
|
||||
'totaladmin' => Admin::count(),
|
||||
// 'totalcategory' => \app\common\model\Category::count(),
|
||||
'todayusersignup' => User::whereTime('jointime', 'today')->count(),
|
||||
'todayuserlogin' => User::whereTime('logintime', 'today')->count(),
|
||||
'sevendau' => User::whereTime('jointime|logintime|prevtime', '-7 days')->count(),
|
||||
'thirtydau' => User::whereTime('jointime|logintime|prevtime', '-30 days')->count(),
|
||||
'threednu' => User::whereTime('jointime', '-3 days')->count(),
|
||||
'sevendnu' => User::whereTime('jointime', '-7 days')->count(),
|
||||
'dbtablenums' => count($dbTableList),
|
||||
'dbsize' => array_sum(array_map(function ($item) {
|
||||
return $item['Data_length'] + $item['Index_length'];
|
||||
}, $dbTableList)),
|
||||
'totalworkingaddon' => $totalworkingaddon,
|
||||
'attachmentnums' => Attachment::count(),
|
||||
'attachmentsize' => Attachment::sum('filesize'),
|
||||
'picturenums' => Attachment::where('mimetype', 'like', 'image/%')->count(),
|
||||
'picturesize' => Attachment::where('mimetype', 'like', 'image/%')->sum('filesize'),
|
||||
|
||||
'new_order_count' => model('order')
|
||||
->whereBetween('create_time',$today)
|
||||
->where('admin_id',$this->auth->id)->count(),
|
||||
'dispatch_order_count' => model('order_dispatch')
|
||||
->whereBetween('create_time',$today)
|
||||
->where('admin_id',$this->auth->id)
|
||||
->count(),
|
||||
'doing_order_count' => model('order_dispatch')
|
||||
->whereBetween('create_time',$today)
|
||||
->where('status','>=',\app\admin\model\Order::STATUS_DRAFT)
|
||||
->where('admin_id',$this->auth->id)->count(),
|
||||
'ending_order_count' => model('order_dispatch')
|
||||
->whereBetween('create_time',$today)
|
||||
->where('status','=',\app\admin\model\Order::STATUS_FINISHED)
|
||||
->where('admin_id',$this->auth->id)->count(),
|
||||
|
||||
]);
|
||||
$this->assignconfig('column', array_keys($userlist));
|
||||
$this->assignconfig('userdata', array_values($userlist));
|
||||
|
||||
return $this->view->fetch();
|
||||
$this->redirect('orderplan/dashboard');
|
||||
}
|
||||
|
||||
public function task()
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ use function Symfony\Component\Clock\now;
|
|||
class Order extends Backend
|
||||
{
|
||||
use CustomerInfoExtractor;
|
||||
|
||||
/**
|
||||
* Order模型对象
|
||||
* @var \app\admin\model\Order
|
||||
|
|
@ -175,11 +176,11 @@ class Order extends Backend
|
|||
$build->whereIn('item_id', $item_ids);
|
||||
}
|
||||
if (!is_null($is_timeout)) {
|
||||
if ($is_timeout == 1){
|
||||
if ($is_timeout == 1) {
|
||||
$build->where('status', '>=', \app\admin\model\Order::STATUS_DISPATCHING)
|
||||
->where('create_time', '<=', (new Carbon())->subMinutes(20)
|
||||
->format('Y-m-d H:i:s'));
|
||||
}else{
|
||||
} else {
|
||||
$build->where('status', '>=', \app\admin\model\Order::STATUS_DISPATCHING)
|
||||
->where('create_time', '>', (new Carbon())->subMinutes(20)
|
||||
->format('Y-m-d H:i:s'));
|
||||
|
|
@ -189,12 +190,12 @@ class Order extends Backend
|
|||
|
||||
if ($type == 1) {
|
||||
$build->where('status', '>=', 0);
|
||||
}elseif ($type == 2) {
|
||||
} elseif ($type == 2) {
|
||||
$build->where('status', '<', 0);
|
||||
}elseif ($type == 3){
|
||||
} elseif ($type == 3) {
|
||||
$build->where('status', '>=', \app\admin\model\Order::STATUS_DISPATCHING)
|
||||
->where('create_time', '<=', (new Carbon())->subMinutes(20)
|
||||
->format('Y-m-d H:i:s'));
|
||||
->where('create_time', '<=', (new Carbon())->subMinutes(20)
|
||||
->format('Y-m-d H:i:s'));
|
||||
}
|
||||
if ($group == 2 || $group == 6) {
|
||||
// 生成 SQL 语句
|
||||
|
|
@ -216,22 +217,33 @@ class Order extends Backend
|
|||
|
||||
$list = $build
|
||||
->with(['user' => function ($q) {
|
||||
$q->field('id,nickname');
|
||||
}, 'area' => function ($q) {
|
||||
$q->field('id,area_code,merge_name');
|
||||
}, 'phone' => function ($q) {
|
||||
$q->field('id,model');
|
||||
}, 'coupon' => function ($q) {
|
||||
$q->field('id,code,description');
|
||||
}])
|
||||
$q->field('id,nickname');
|
||||
}, 'area' => function ($q) {
|
||||
$q->field('id,area_code,merge_name');
|
||||
}, 'phone' => function ($q) {
|
||||
$q->field('id,model');
|
||||
}, 'coupon' => function ($q) {
|
||||
$q->field('id,code,description');
|
||||
}, 'source' => [
|
||||
'parent' => function ($q) {
|
||||
$q->field('id,title');
|
||||
}
|
||||
]]
|
||||
)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as &$item) {
|
||||
foreach ($list as $item) {
|
||||
$item->aftersale_btn = false;
|
||||
if ($item->aftersale_id == 0 && $this->auth->check('aftersales/aftersale/add') && $item->status == \app\admin\model\Order::STATUS_FINISHED) { //$item->status == \app\admin\model\Order::STATUS_FINISHED &&
|
||||
$item->aftersale_btn = true;
|
||||
}
|
||||
if (isset($item->getRelation('source')->parent->title)){
|
||||
$item->source_total_name = '【' . $item->getRelation('source')->parent->title . '】' . ($item->getRelation('source')->title??'');
|
||||
}else{
|
||||
$item->source_total_name = ($item->getRelation('source')->title??'');
|
||||
}
|
||||
unset($item->source);
|
||||
}
|
||||
|
||||
$result = ['total' => $list->total(), 'rows' => $list->items()];
|
||||
|
|
@ -283,7 +295,7 @@ class Order extends Backend
|
|||
$sources = array_column($sources, 'title', 'id');
|
||||
$params['source_shop'] = $sources[$params['source']] ?? null;
|
||||
|
||||
$itemIds = explode(',', $params['item_id']?? '');
|
||||
$itemIds = explode(',', $params['item_id'] ?? '');
|
||||
$params['item_id'] = end($itemIds);
|
||||
$params['item_title'] = $this->findElementByValue($this->itemsformattedTree, $params['item_id'] ?? null);
|
||||
|
||||
|
|
@ -301,11 +313,24 @@ class Order extends Backend
|
|||
|
||||
$result = $this->model->allowField(true)->save($params);
|
||||
$auth = clone $this->auth;
|
||||
$order = \app\admin\model\Order::get($this->model->id);
|
||||
$order = \app\admin\model\Order::where('id',$this->model->id)->with(['source' => [
|
||||
'parent' => function ($q) {
|
||||
$q->field('id,title');
|
||||
}
|
||||
]]
|
||||
)->find();
|
||||
// dd($order);
|
||||
if (isset($order->getRelation('source')->parent->title)){
|
||||
$order->source_total_name = '【' . $order->getRelation('source')->parent->title . '】' .
|
||||
($order->getRelation('source')->title??'');
|
||||
}else{
|
||||
$order->source_total_name = ($order->getRelation('source')->title??'');
|
||||
}
|
||||
unset($order->source);
|
||||
//日志
|
||||
$hookparams['order'] = $order;
|
||||
$hookparams['role'] = 1;
|
||||
$hookparams['auth'] = $auth;
|
||||
$hookparams['auth'] = $auth;
|
||||
$hookparams['remark'] = '录入订单';
|
||||
Hook::listen('order_change', $hookparams);
|
||||
|
||||
|
|
@ -313,14 +338,15 @@ class Order extends Backend
|
|||
AutoDispatchLogic::autoDispatch($this->model, $this->auth);
|
||||
}
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
throw $e;
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
$this->success(data:$order);
|
||||
$this->success(data: $order);
|
||||
}
|
||||
|
||||
public function edit($ids = null)
|
||||
|
|
@ -436,6 +462,7 @@ class Order extends Backend
|
|||
}
|
||||
|
||||
use AmapTrait;
|
||||
|
||||
public function smart()
|
||||
{
|
||||
// $titles = Item::where('status',1)->column('title');
|
||||
|
|
@ -443,22 +470,22 @@ class Order extends Backend
|
|||
// dd($res);
|
||||
$data = Address::smart(request()->post('str'));
|
||||
|
||||
if ($data['item']['id'] ?? 0){
|
||||
if ($data['item']['id'] ?? 0) {
|
||||
$data['item']['item'] = $this->findElementByValue($this->itemsformattedTree, $data['item']['id'] ?? null);
|
||||
}
|
||||
preg_match('/\b(1[3-9]\d{9})\b/',$data['mobile'],$match);
|
||||
preg_match('/\b(1[3-9]\d{9})\b/', $data['mobile'], $match);
|
||||
// dd($data);
|
||||
$data['mobile'] = $match[0] ?? $data['mobile'];
|
||||
|
||||
if ($data['addr'] && $data['addr']!=''){
|
||||
if ($data['addr'] && $data['addr'] != '') {
|
||||
$address = $this->getAddressByKeyword($data['addr']);
|
||||
if ($address){
|
||||
if ($address) {
|
||||
$data['area_id'] = $address['adcode'];
|
||||
$location = explode(',',$address['location']);
|
||||
$location = explode(',', $address['location']);
|
||||
$data['lng'] = $location[0];
|
||||
$data['lat'] = $location[1];
|
||||
}else{
|
||||
$data['addr'] ='';
|
||||
} else {
|
||||
$data['addr'] = '';
|
||||
}
|
||||
}
|
||||
// dd($data);
|
||||
|
|
@ -629,7 +656,7 @@ class Order extends Backend
|
|||
|
||||
$result = \model('order_abnormal')->insert($insert);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
throw $e;
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
|
|
@ -651,7 +678,7 @@ class Order extends Backend
|
|||
$op[] = ['id' => $option->id, 'title' => $option->title];
|
||||
}
|
||||
$order = model('order')->get($ids);
|
||||
if (!$order){
|
||||
if (!$order) {
|
||||
$this->error('Not Find');
|
||||
}
|
||||
return $this->fetch('delete', ['row' => $order, 'options' => $op]);
|
||||
|
|
@ -682,15 +709,15 @@ class Order extends Backend
|
|||
if (!empty($order->dispatch->id)) {
|
||||
$orderLogic = new OrderLogic();
|
||||
$orderLogic->cancelOrderDispatch($order->dispatch, $this->auth, '订单被取消', false);
|
||||
//日志
|
||||
$hookparams['order'] = $order;
|
||||
$hookparams['role'] = 1;
|
||||
$hookparams['auth'] = $this->auth;
|
||||
$hookparams['remark'] = $params['remark'] ?? '取消订单';
|
||||
Hook::listen('order_change', $hookparams);
|
||||
}
|
||||
//日志
|
||||
$hookparams['order'] = $order;
|
||||
$hookparams['role'] = 1;
|
||||
$hookparams['auth'] = $this->auth;
|
||||
$hookparams['remark'] = $params['remark'] ?? '取消订单';
|
||||
Hook::listen('order_change', $hookparams);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
|
|
@ -736,7 +763,7 @@ class Order extends Backend
|
|||
$params['status'] = \app\admin\model\Order::STATUS_CANCEL;
|
||||
$result = $order->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
|
|
@ -776,7 +803,7 @@ class Order extends Backend
|
|||
$params['invoice_method'] = 1;
|
||||
$result = (new Invoice())->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
|
|
@ -866,7 +893,7 @@ class Order extends Backend
|
|||
$index = 0;
|
||||
|
||||
foreach ($filter as $k => $v) {
|
||||
if ($k == 'user.nickname' || $k =='is_timeout') continue;
|
||||
if ($k == 'user.nickname' || $k == 'is_timeout') continue;
|
||||
if (!preg_match('/^[a-zA-Z0-9_\-\.]+$/', $k)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1012,10 +1039,10 @@ class Order extends Backend
|
|||
|
||||
if (false === $this->request->isAjax()) {
|
||||
//page2变更日志
|
||||
$orderLogs = OrderLog::where('order_id',$ids)->order('id','desc')->select();
|
||||
$orderLogs = OrderLog::where('order_id', $ids)->order('id', 'desc')->select();
|
||||
|
||||
$this->view->assign('logs',json_encode($orderLogs));
|
||||
$this->view->assign('cdnurl',config('upload.cdnurl'));
|
||||
$this->view->assign('logs', json_encode($orderLogs));
|
||||
$this->view->assign('cdnurl', config('upload.cdnurl'));
|
||||
return $this->fetch('orders/dispatchlog/index');
|
||||
}
|
||||
//如果发送的来源是 Selectpage,则转发到 Selectpage
|
||||
|
|
@ -1025,7 +1052,7 @@ class Order extends Backend
|
|||
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
|
||||
$list = $this->model
|
||||
->where($where)
|
||||
->where('dispatch_id',$dispatch_id)
|
||||
->where('dispatch_id', $dispatch_id)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
$result = ['total' => $list->total(), 'rows' => $list->items()];
|
||||
|
|
|
|||
|
|
@ -43,6 +43,11 @@ class Source extends Model
|
|||
return $list[$value] ?? '';
|
||||
}
|
||||
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(Source::class,'pid','id');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<div class="value">
|
||||
<select id="c-source" data-live-search="true" title="请选择订单渠道" name="row[source]" class="form-control selectpicker show-tick">
|
||||
{foreach $sources as $item}
|
||||
<option data-subtext="{$item['ptitle']}" value="{$item['id']}">{$item['title']}</option>
|
||||
<option value="{$item['id']}">【{$item['ptitle']}】{$item['title']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
|
|
@ -175,8 +175,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="submit-ctr flex-sb">
|
||||
<button id="mysubmit" class="btn btn-default submit">录入并清空</button>
|
||||
<button id="mybuttom" class="btn btn-success submit-continue">录入并保留信息</button>
|
||||
<button id="mybuttom" class="btn btn-default submit-continue">录入并保留信息</button>
|
||||
<button id="mysubmit" class="btn btn-success submit">录入并清空</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<div class="value">
|
||||
<select id="c-source" data-live-search="true" title="请选择订单渠道" name="row[source]" class="form-control selectpicker show-tick">
|
||||
{foreach $sources as $item}
|
||||
<option {if $item['id'] == $row.source} selected {/if} data-subtext="{$item['ptitle']}" value="{$item['id']}">{$item['title']}</option>
|
||||
<option {if $item['id'] == $row.source} selected {/if} value="{$item['id']}">【{$item['ptitle']}】{$item['title']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<div class="value">
|
||||
<select id="c-source" data-live-search="true" title="请选择订单渠道" name="row[source]" class="form-control selectpicker show-tick">
|
||||
{foreach $sources as $item}
|
||||
<option {if $item['id'] == $row.source} selected {/if} data-subtext="{$item['ptitle']}" value="{$item['id']}">{$item['title']}</option>
|
||||
<option {if $item['id'] == $row.source} selected {/if} value="{$item['id']}">【{$item['ptitle']}】{$item['title']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -65,12 +65,6 @@
|
|||
<input id="c-update_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[plan_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-4"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
<input style="display: none" class="form-control" name="row[order_id]" type="text" value="{$row->id}">
|
||||
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@
|
|||
|
||||
<script>
|
||||
const logs = {$logs}; // 后端传入的数据,格式保持和你的一致
|
||||
|
||||
const cdnurl = '{$cdnurl}';
|
||||
|
||||
function getRoleLabel(role) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
|||
function assembleOrderMessage(data) {
|
||||
let message = '';
|
||||
if (!data.coupon) {
|
||||
message = `订单编号: ${data.order_no} (${data.source_shop})
|
||||
message = `订单编号: ${data.order_no}
|
||||
渠道来源:${data.source_total_name}
|
||||
服务名称: ${data.item_title}
|
||||
客户昵称: ${data.customer}
|
||||
客户电话: ${data.tel}
|
||||
|
|
@ -41,7 +42,8 @@ ${data.receive_type == 1 ? '已收定金' : '已收全款'}
|
|||
预约时间: ${data.plan_time || '无'}
|
||||
`;
|
||||
} else {
|
||||
message = `订单编号: ${data.order_no} (${data.source_shop})
|
||||
message = `订单编号: ${data.order_no}
|
||||
渠道来源:${data.source_total_name}
|
||||
服务名称: ${data.item_title}
|
||||
客户昵称: ${data.customer}
|
||||
客户电话: ${data.tel}
|
||||
|
|
@ -522,9 +524,9 @@ ${data.receive_type == 1 ? '已收定金' : '已收全款'}
|
|||
if (res) {
|
||||
Form.api.submit($("form[role=form]"), function (data) {
|
||||
copyToClipboard(assembleOrderMessage(data));
|
||||
Toastr.success('录入成功');
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
} else {
|
||||
Toastr.success('请选择有效地址');
|
||||
|
|
@ -541,6 +543,7 @@ ${data.receive_type == 1 ? '已收定金' : '已收全款'}
|
|||
Form.api.submit($("form[role=form]"), function (data, ret) {
|
||||
clearInfo();
|
||||
copyToClipboard(assembleOrderMessage(data));
|
||||
Toastr.success('录入成功');
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,7 +276,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'layer', 'cascader'],
|
|||
// {field: 'deposit_amount', title: __('Deposit_amount'), operate:'BETWEEN'},
|
||||
{
|
||||
field: 'id', title: '操作', formatter: function (id) {
|
||||
return `<p class="btn btn-primary tab_chose" data-id="${id}">选择</p>`;
|
||||
return `<p class="btn btn-primary tab_chose" data-id="${id}">选择</p>
|
||||
<p class="btn btn-info tab_dispatch" data-id="${id}">派单</p>`;
|
||||
}
|
||||
},
|
||||
]
|
||||
|
|
@ -333,6 +334,33 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'layer', 'cascader'],
|
|||
$('#c-worker_name').val(worker.name + '--' + worker.tel).trigger('input').trigger('change');
|
||||
$('#c-worker_id').val(worker.id).trigger('input').trigger('change');
|
||||
});
|
||||
|
||||
$(document).on('click', '.tab_dispatch', function () {
|
||||
var dataId = $(this).data('id'); // 获取 data-id 的值
|
||||
const worker = Table.api.getrowbyid(table, dataId);
|
||||
$('#c-worker_name').val(worker.name + '--' + worker.tel).trigger('input').trigger('change');
|
||||
$('#c-worker_id').val(worker.id).trigger('input').trigger('change');
|
||||
|
||||
// 弹出确认框
|
||||
Layer.confirm("确认派单给 " + worker.name + " 吗?", {
|
||||
icon: 3,
|
||||
title: '确认派单'
|
||||
}, function (index) {
|
||||
// 用户确认后再进行校验和提交
|
||||
const res = $("#add-form").isValid();
|
||||
if (res) {
|
||||
Form.api.submit($("#add-form"), function (data) {
|
||||
var index = parent.Layer.getFrameIndex(window.name);
|
||||
parent.Layer.close(index); // 关闭当前弹窗
|
||||
parent.table.bootstrapTable('refresh'); // 刷新父页面表格
|
||||
});
|
||||
} else {
|
||||
Toastr.error('请完整填写表单');
|
||||
}
|
||||
Layer.close(index); // 关闭确认弹窗
|
||||
});
|
||||
});
|
||||
|
||||
$('#add_worker').on('click',function (){
|
||||
Fast.api.open('workers/worker/add?type=2', '添加工人',{
|
||||
callback: function (value) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user