Accept Merge Request #23: (feature/hant -> develop)
Merge Request: 调整 Created By: @todayswind Accepted By: @todayswind URL: https://g-bcrc3009.coding.net/p/allocatr/d/allocatr/git/merge/23
This commit is contained in:
commit
6ab546b78f
|
|
@ -34,6 +34,7 @@ class Order extends Backend
|
|||
protected $model = null;
|
||||
protected $sources = null;
|
||||
protected $items = null;
|
||||
protected $itemsformattedTree = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
|
|
@ -81,6 +82,7 @@ class Order extends Backend
|
|||
->select();
|
||||
|
||||
$this->items = $items;
|
||||
$this->itemsformattedTree = $formattedTree;
|
||||
|
||||
|
||||
$coupons = Db::name('coupons')
|
||||
|
|
@ -206,11 +208,12 @@ class Order extends Backend
|
|||
}
|
||||
|
||||
$sources = $this->sources;
|
||||
$items = $this->items;
|
||||
$sources = array_column($sources, 'title', 'id');
|
||||
$items = array_column($items, 'title', 'id');
|
||||
$params['source_shop'] = $sources[$params['source']] ?? null;
|
||||
$params['item_title'] = $items[$params['item_id']] ?? null;
|
||||
|
||||
$params['item_title'] = $this->findElementByValue($this->itemsformattedTree,$params['item_id'] ?? null);
|
||||
|
||||
|
||||
$params['admin_id'] = ($params['admin_id'] ?? -1) == -1 ? $this->auth->id : $params['admin_id'];
|
||||
if (empty($params['admin_id'])) {
|
||||
$params['admin_id'] = $this->auth->id;
|
||||
|
|
@ -277,15 +280,13 @@ class Order extends Backend
|
|||
$items = $this->items;
|
||||
|
||||
$sources = array_column($sources, 'title', 'id');
|
||||
$items = array_column($items, 'title', 'id');
|
||||
|
||||
$params['admin_id'] = ($params['admin_id'] == -1) ? $this->auth->id : $params['admin_id'];
|
||||
if (empty($params['admin_id'])) {
|
||||
$params['admin_id'] = $this->auth->id;
|
||||
}
|
||||
$params['source_shop'] = $sources[$params['source']] ?? null;
|
||||
$params['item_title'] = $items[$params['item_id']] ?? null;
|
||||
|
||||
$params['item_title'] = $this->findElementByValue($this->itemsformattedTree,$params['item_id'] ?? null);
|
||||
// $params['create_time'] = date('Y-m-d H:i:s');
|
||||
$params['update_time'] = date('Y-m-d H:i:s');
|
||||
|
||||
|
|
@ -620,4 +621,25 @@ class Order extends Backend
|
|||
}
|
||||
$this->success();
|
||||
}
|
||||
|
||||
function findElementByValue($data, $targetValue, $path = []) {
|
||||
foreach ($data as $item) {
|
||||
// 将当前节点的 label 添加到路径中
|
||||
$newPath = array_merge($path, [$item['label']]);
|
||||
|
||||
// 如果找到目标值,返回路径
|
||||
if ($item['value'] == $targetValue) {
|
||||
return implode(' / ', $newPath);
|
||||
}
|
||||
|
||||
// 如果当前节点有 children,递归搜索
|
||||
if (isset($item['children']) && is_array($item['children'])) {
|
||||
$result = $this->findElementByValue($item['children'], $targetValue, $newPath);
|
||||
if ($result) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null; // 如果找不到返回 null
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,19 +84,25 @@ class Aftersale extends Backend
|
|||
* @return string
|
||||
* @throws \think\Exception
|
||||
*/
|
||||
public function add()
|
||||
public function add($ids = null)
|
||||
{
|
||||
if (false === $this->request->isPost()) {
|
||||
|
||||
$order_id = $this->request->param('order_id');
|
||||
if(empty($order_id)){
|
||||
$this->error('请选择订单');
|
||||
if ($ids){
|
||||
$order = model('order')->get($ids);
|
||||
$this->view->assign('order',$order);
|
||||
}else{
|
||||
$order_id = $this->request->param('order_id');
|
||||
if(empty($order_id)){
|
||||
$this->error('请选择订单');
|
||||
}
|
||||
$order = Order::get($order_id);
|
||||
if(empty($order)){
|
||||
$this->error('订单不存在');
|
||||
}
|
||||
$this->assign('order',$order);
|
||||
}
|
||||
$order = Order::get($order_id);
|
||||
if(empty($order)){
|
||||
$this->error('订单不存在');
|
||||
}
|
||||
$this->assign('order',$order);
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
$params = $this->request->post('row/a');
|
||||
|
|
@ -141,7 +147,8 @@ class Aftersale extends Backend
|
|||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
throw $e;
|
||||
// $this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace app\admin\controller\workers;
|
|||
|
||||
use app\admin\model\AuthGroup;
|
||||
use app\admin\model\Item;
|
||||
use app\admin\model\Order;
|
||||
use app\common\controller\Backend;
|
||||
use fast\Tree;
|
||||
use think\Db;
|
||||
|
|
@ -81,22 +82,24 @@ class Worker extends Backend
|
|||
$item_id = request()->get('item_id');
|
||||
$keyword = request()->get('keyword');
|
||||
$build = $this->model
|
||||
->with(['area'])
|
||||
->with(['area','admin' => function($q){
|
||||
$q->withField(['id','username']);
|
||||
}])
|
||||
->where($where)
|
||||
->field('worker.id,name,tel,area_id,create_time,deposit_amount,update_time,status,star')
|
||||
->field('worker.id,admin_id,type,name,tel,area_id,create_time,deposit_amount,update_time,status,star')
|
||||
->order($sort, $order);
|
||||
if ($keyword){
|
||||
if ($keyword) {
|
||||
$build->where(function ($q) use ($keyword) {
|
||||
$q->where('name','like','%'.$keyword.'%')->whereOr('tel','like','%'.$keyword.'%');
|
||||
$q->where('name', 'like', '%' . $keyword . '%')->whereOr('tel', 'like', '%' . $keyword . '%');
|
||||
});
|
||||
}
|
||||
if ($item_id){
|
||||
$build->join('worker_item','worker_item.worker_id = worker.id','left');
|
||||
$build->where('worker_item.item_id',$item_id);
|
||||
if ($item_id) {
|
||||
$build->join('worker_item', 'worker_item.worker_id = worker.id', 'left');
|
||||
$build->where('worker_item.item_id', $item_id);
|
||||
}
|
||||
|
||||
if ($area_code){
|
||||
$build->where('area_id','like',$this->getSelectAreaCode($area_code).'%');
|
||||
if ($area_code) {
|
||||
$build->where('area_id', 'like', $this->getSelectAreaCode($area_code) . '%');
|
||||
}
|
||||
|
||||
$list = $build
|
||||
|
|
@ -107,22 +110,22 @@ class Worker extends Backend
|
|||
return json($result);
|
||||
}
|
||||
|
||||
$items = Db::name('item')
|
||||
->where('status',1)
|
||||
->field(['id','title','key_word','pid'])
|
||||
->order('pid','asc')
|
||||
->order('sort','desc')
|
||||
$items = Db::name('item')
|
||||
->where('status', 1)
|
||||
->field(['id', 'title', 'key_word', 'pid'])
|
||||
->order('pid', 'asc')
|
||||
->order('sort', 'desc')
|
||||
->select();
|
||||
$filtered = array_filter($items, function($item) {
|
||||
$filtered = array_filter($items, function ($item) {
|
||||
return $item['pid'] == 0;
|
||||
});
|
||||
|
||||
$pid_map = array_column($filtered,null,'id');
|
||||
$pid_map = array_column($filtered, null, 'id');
|
||||
$res_items = [];
|
||||
foreach ($items as $item){
|
||||
if ($item['pid'] != 0 && isset($pid_map[$item['pid']])){
|
||||
foreach ($items as $item) {
|
||||
if ($item['pid'] != 0 && isset($pid_map[$item['pid']])) {
|
||||
$res_items [] = [
|
||||
...$item,'ptitle' => $pid_map[$item['pid']]['title']
|
||||
...$item, 'ptitle' => $pid_map[$item['pid']]['title']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -154,9 +157,10 @@ class Worker extends Backend
|
|||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
|
||||
$this->model->validateFailException()->validate($validate);
|
||||
}
|
||||
$params['admin_id'] = $this->auth->id;
|
||||
$result = $this->model->allowField(true)->save($params);
|
||||
$item_map = model('item')->getAll();
|
||||
$item_map = array_column($item_map,'level','id');
|
||||
$item_map = array_column($item_map, 'level', 'id');
|
||||
if ($result) {
|
||||
$items = explode(',', $params['rules']);
|
||||
if ($items) {
|
||||
|
|
@ -173,7 +177,7 @@ class Worker extends Backend
|
|||
}
|
||||
|
||||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
|
|
@ -188,12 +192,12 @@ class Worker extends Backend
|
|||
{
|
||||
|
||||
if (!$ids) {
|
||||
if (request()->isPost()){
|
||||
if (request()->isPost()) {
|
||||
$ids = input('id');
|
||||
if (!$ids){
|
||||
if (!$ids) {
|
||||
$this->error('缺少订单ID');
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$this->error('缺少订单ID');
|
||||
}
|
||||
}
|
||||
|
|
@ -210,7 +214,7 @@ class Worker extends Backend
|
|||
$params = input('post.row/a');
|
||||
|
||||
$item_map = model('item')->getAll();
|
||||
$item_map = array_column($item_map,'level','id');
|
||||
$item_map = array_column($item_map, 'level', 'id');
|
||||
if ($ids) {
|
||||
$items = explode(',', $params['rules']);
|
||||
if ($items) {
|
||||
|
|
@ -222,7 +226,7 @@ class Worker extends Backend
|
|||
'item_path_id' => $item_map[$item] ?? 0
|
||||
];
|
||||
}
|
||||
model('WorkerItem')->where('worker_id',$ids)->delete();
|
||||
model('WorkerItem')->where('worker_id', $ids)->delete();
|
||||
model('WorkerItem')->insertAll($insert);
|
||||
}
|
||||
}
|
||||
|
|
@ -234,14 +238,14 @@ class Worker extends Backend
|
|||
$this->success('更新成功', 'index');
|
||||
}
|
||||
$area_name = model('area')->getNameByCode($worker->area_id);
|
||||
$worker->area_name = str_replace(',','/',$area_name);
|
||||
$worker->area_name = str_replace(',', '/', $area_name);
|
||||
|
||||
|
||||
$select_ids = model('WorkerItem')->where('worker_id',$ids)->field('item_id')
|
||||
$select_ids = model('WorkerItem')->where('worker_id', $ids)->field('item_id')
|
||||
->select();
|
||||
$select_ids = array_column($select_ids,'item_id');
|
||||
foreach ($this->tree as $index=>$item){
|
||||
if (in_array($item['parent'],$select_ids)){
|
||||
$select_ids = array_column($select_ids, 'item_id');
|
||||
foreach ($this->tree as $index => $item) {
|
||||
if (in_array($item['parent'], $select_ids)) {
|
||||
$this->tree[$index]['state']['selected'] = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -253,23 +257,32 @@ class Worker extends Backend
|
|||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function dispatchList(){
|
||||
public function dispatchList()
|
||||
{
|
||||
|
||||
$area_id = request()->get('area_id');
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$build = model('worker')
|
||||
->where('status',1)
|
||||
->where('status', 1)
|
||||
->with(['area'])
|
||||
->field(['id','name','tel','area_id','lng','lat']);
|
||||
->withCount(['myorder' => function ($query) {
|
||||
$query->where('status', Order::STATUS_FINISHED);
|
||||
return 'finish_order';
|
||||
},])
|
||||
->withCount(['myorder' => function ($query) {
|
||||
$query->where('status', '<', Order::STATUS_FINISHED)
|
||||
->where('status', '>=', Order::STATUS_DRAFT);
|
||||
return 'doing_order';
|
||||
}])
|
||||
->field(['id', 'name', 'tel', 'area_id', 'lng', 'lat']);
|
||||
|
||||
if ($area_id){
|
||||
if ($area_id) {
|
||||
$code = $this->getSelectAreaCode(substr_replace($area_id, '00', -2));
|
||||
$build->where('area_id','like', $code.'%');
|
||||
$build->where('area_id', 'like', $code . '%');
|
||||
}
|
||||
$list = $build
|
||||
->paginate($limit);
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
|
|
|
|||
|
|
@ -50,4 +50,16 @@ class Worker extends BaseModel
|
|||
return $this->belongsTo('Area', 'area_id', 'area_code');
|
||||
}
|
||||
|
||||
public function admin()
|
||||
{
|
||||
return $this->belongsTo('admin', 'admin_id');
|
||||
}
|
||||
|
||||
|
||||
public function myorder(){
|
||||
|
||||
return $this->hasMany(OrderDispatch::class, 'worker_id');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
|
||||
<input type="hidden" name="row[order_id]" value="{$order.id}">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('订单编号')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
{if isset($order)}
|
||||
<input id="c-order_sn" disabled data-rule="required" value="{$order.order_no}" class="form-control" type="text" >
|
||||
<input id="c-order_id" value="{$order.id}" style="display: none" class="form-control" name="row[order_id]" type="text" >
|
||||
{else /}value3
|
||||
<input id="c-order_no" readonly data-rule="required" class="form-control" type="text" value="{$order.order_no}">
|
||||
<input type="hidden" name="row[order_id]" value="{$order.id}">
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,24 @@
|
|||
<input id="c-username" class="form-control" name="row[username]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">昵称:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-nickname" class="form-control" name="row[nickname]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">电话:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-phone" class="form-control" name="row[phone]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">地址:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<textarea id="c-address" class="form-control " rows="5" name="row[address]" cols="50"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Reason')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
|
|
|||
|
|
@ -6,12 +6,33 @@
|
|||
<input id="c-username" class="form-control" name="row[username]" type="text" value="{$row.username|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">昵称:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-nickname" class="form-control" value="{$row.nickname|htmlentities}" name="row[nickname]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">电话:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-phone" class="form-control" value="{$row.phone|htmlentities}" name="row[phone]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">地址:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<textarea id="c-address" class="form-control " rows="5" name="row[address]" cols="50">{$row.address|htmlentities}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Reason')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<textarea id="c-reason" class="form-control " rows="5" name="row[reason]" cols="50">{$row.reason|htmlentities}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@
|
|||
<label class="control-label col-xs-12 col-sm-3">派单方式:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<select data-live-search="true" value="" name="row[dispatch_type]" class="form-control selectpicker show-tick">
|
||||
<option {if 1 == $row.dispatch_type} value="1">手动派单</option>
|
||||
<option {if 2 == $row.dispatch_type} value="2">自动派单</option>
|
||||
<option {if 1 == $row.dispatch_type} selected {/if} value="1">手动派单</option>
|
||||
<option {if 2 == $row.dispatch_type} selected {/if} value="2">自动派单</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -67,8 +67,8 @@
|
|||
<label class="control-label col-xs-12 col-sm-3">收款方式:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<select name="row[receive_type]" class="form-control selectpicker">
|
||||
<option {if 1 == $row.receive_type} value="1">已收定金</option>
|
||||
<option {if 2 == $row.receive_type} value="2">已收全款</option>
|
||||
<option {if 1 == $row.receive_type} selected {/if} value="1">已收定金</option>
|
||||
<option {if 2 == $row.receive_type} selected {/if} value="2">已收全款</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-2" style="text-align: left;padding-left: 0px;">工种:</label>
|
||||
<div style="width: 300px;display: inline-block;">
|
||||
<input type="text" id="item_id" name="item_id" data-value="{$row.item_title}" value="{$row.item_id}" class="zd-input__inner">
|
||||
<input type="text" id="item_id" name="item_id" value="{$row.item_title}" class="zd-input__inner">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
class="form-control">
|
||||
<option selected value="1">异常类型</option>
|
||||
<option value="2">取消类型</option>
|
||||
<option value="3">报错类型</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
<ul class="nav nav-tabs" data-field="type">
|
||||
<li class="{:$Think.get.type === (string)1 ? 'active' : ''}"><a href="#t-1" data-value="1" data-toggle="tab">异常类型</a></li>
|
||||
<li class="{:$Think.get.type === (string)2 ? 'active' : ''}"><a href="#t-2" data-value="2" data-toggle="tab">取消类型</a></li>
|
||||
<li class="{:$Think.get.type === (string)2 ? 'active' : ''}"><a href="#t-3" data-value="3" data-toggle="tab">报错类型</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
|
|
|||
|
|
@ -20,6 +20,15 @@
|
|||
<input id="area_id" style="display: none" class="form-control" name="row[area_id]" hidden type="text" value="" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">师傅归属:</label>
|
||||
<div class='col-xs-12 col-sm-8'>
|
||||
<select data-live-search="true" name="row[type]" class="form-control">
|
||||
<option selected value="1">自营</option>
|
||||
<option value="2">非自营</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Deposit_amount')}:</label>
|
||||
|
|
@ -35,7 +44,7 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Items')}:</label>
|
||||
<label class="control-label col-xs-12 col-sm-2">师傅技能:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<span class="text-muted"><input type="checkbox" name="" id="checkall" /> <label for="checkall"><span>{:__('Check all')}</span></label></span>
|
||||
<span class="text-muted"><input type="checkbox" name="" id="expandall" /> <label for="expandall"><span>{:__('Expand all')}</span></label></span>
|
||||
|
|
|
|||
|
|
@ -37,6 +37,15 @@
|
|||
value="{$row.area_id}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">师傅归属:</label>
|
||||
<div class='col-xs-12 col-sm-8'>
|
||||
<select data-live-search="true" name="row[type]" class="form-control">
|
||||
<option {if 1 == $row.type} selected {/if} value="1">自营</option>
|
||||
<option {if 2 == $row.type} selected {/if} value="2">非自营</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Deposit_amount')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
|
@ -51,7 +60,7 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Items')}:</label>
|
||||
<label class="control-label col-xs-12 col-sm-2">师傅技能:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<span class="text-muted"><input type="checkbox" name="" id="checkall"/> <label for="checkall"><span>{:__('Check all')}</span></label></span>
|
||||
<span class="text-muted"><input type="checkbox" name="" id="expandall"/> <label for="expandall"><span>{:__('Expand all')}</span></label></span>
|
||||
|
|
|
|||
|
|
@ -30,16 +30,16 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('workers/worker/recyclebin')?'':'hide'}" href="workers/worker/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>
|
||||
<!-- <a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('workers/worker/recyclebin')?'':'hide'}" href="workers/worker/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>-->
|
||||
|
||||
<form id="select-form" style="padding-left: 15px;margin-top: 10px" role="form" class="form-horizontal" data-toggle="validator" method="POST" action="">
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <label class="col-xs-12 col-sm-2" style="padding-left: 0px;text-align: left">区域:</label>-->
|
||||
<!-- <div style="display: inline-block;width: 300px;position: absolute">-->
|
||||
<!-- <input id="c-city-search" data-rule="required" class="form-control" data-toggle="city-picker" type="text" />-->
|
||||
<!-- <input id="area_id" style="display: none" class="form-control" name="area_id" hidden type="text" />-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3" style="padding-left: 0px;text-align: left">区域:</label>
|
||||
<div style="display: inline-block;width: 300px;position: absolute">
|
||||
<input id="c-city-search" data-rule="required" class="form-control" data-toggle="city-picker" type="text" />
|
||||
<input id="area_id" style="display: none" class="form-control" name="area_id" hidden type="text" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <label class="col-xs-12 col-sm-2" style="text-align: left;padding-left: 0px;">工种:</label>-->
|
||||
<!-- <div style="width: 300px;display: inline-block;">-->
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-2" style="padding-left: 0px;text-align: left">关键字:</label>
|
||||
<label class="col-xs-12 col-sm-3" style="padding-left: 0px;text-align: left">关键字:</label>
|
||||
<div style="display: inline-block;width: 300px;position: absolute">
|
||||
<input id="keyword" class="form-control" style="width: 100%;height: 32px" placeholder="名称或电话号码搜索" name="keyword" type="text" value="" />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -26,12 +26,36 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user.nickname', title: __('User_id')},
|
||||
{field: 'username', title: __('Username'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'user.nickname', title: '创建人'},
|
||||
{field: 'username', title: '账号', operate: 'LIKE', formatter: Table.api.formatter.content},
|
||||
{field: 'nickname', title: '昵称'},
|
||||
{field: 'phone', title: '电话'},
|
||||
{field: 'address', title: '地址'},
|
||||
{field: 'reason', title: '原因'},
|
||||
{field: 'remarks', title: '备注'},
|
||||
{field: 'added_time', title: __('Added_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'removed_time', title: __('Removed_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'status', title: __('Status'), searchList: {"active":__('Active'),"removed":__('Removed')}, formatter: Table.api.formatter.status},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
{field: 'operate', title: __('Operate'), table: table,
|
||||
buttons:[
|
||||
{
|
||||
name: 'edit',
|
||||
text: "修改",
|
||||
icon: 'fa fa-pencil',
|
||||
title: __('Edit'),
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
classname: 'btn btn-xs btn-info btn-editone',
|
||||
},
|
||||
{
|
||||
name: 'del',
|
||||
text: "删除",
|
||||
icon: 'fa fa-trash',
|
||||
title: __('Delete'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-danger btn-delone',
|
||||
},
|
||||
],
|
||||
events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
|
|
|||
|
|
@ -186,18 +186,24 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
|||
buttons: [
|
||||
{
|
||||
name: 'edit',
|
||||
text: "编辑",
|
||||
text: "修改",
|
||||
icon: 'fa fa-pencil',
|
||||
title: __('Edit'),
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
classname: 'btn btn-xs btn-info btn-editone',
|
||||
visible: function (row) {
|
||||
if (row.status != 60) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
},
|
||||
{
|
||||
name: 'push',
|
||||
icon: 'fa fa-copy',
|
||||
title: '复制',
|
||||
text: "复制",
|
||||
title: '复制订单',
|
||||
text: "复制订单",
|
||||
url: 'order/copy',
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
classname: 'btn btn-dialog',
|
||||
|
|
@ -268,14 +274,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
|||
}
|
||||
}, {
|
||||
name: 'delete',
|
||||
text: '取消',
|
||||
title: '取消',
|
||||
text: '取消订单',
|
||||
title: '取消订单',
|
||||
classname: 'btn btn-dialog',
|
||||
icon: 'fa fa-trash',
|
||||
url: 'order/delete',
|
||||
dropdown: "更多",
|
||||
visible: function (row) {
|
||||
if (row.status >= 0) {
|
||||
if (row.status >= 0 && row.status < 60) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -291,6 +297,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
|||
url: 'order/addAbnormal',
|
||||
refresh:true,
|
||||
dropdown: "更多",
|
||||
visible: function (row) {
|
||||
if (row.status != 60) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'invoice',
|
||||
|
|
@ -302,26 +314,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
|||
dropdown: "更多",
|
||||
|
||||
visible: function (row) {
|
||||
if (row.status >= 0) {
|
||||
if (row.status == 60) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: 'saleafter',
|
||||
name: 'aftersale',
|
||||
text: '申请售后',
|
||||
title: '申请售后',
|
||||
classname: 'btn btn-dialog',
|
||||
icon: 'fa fa-pencil',
|
||||
url: function(row){
|
||||
return 'aftersales/aftersale/add?order_id='+row.id;
|
||||
},
|
||||
icon: 'fa fa-phone-square',
|
||||
url: 'aftersales/aftersale/add',
|
||||
dropdown: "更多",
|
||||
|
||||
visible: function (row) {
|
||||
if (row.aftersale_btn) {
|
||||
if (row.status === 60) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -435,6 +443,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
|||
});
|
||||
},
|
||||
edit: function () {
|
||||
var _data = items;
|
||||
|
||||
$('#item_id').zdCascader({
|
||||
data: _data,
|
||||
onChange: function ($this, data, allPathData) {
|
||||
// console.log(data,allPathData);
|
||||
$('#item_id_value').val(data.value);
|
||||
}
|
||||
});
|
||||
$('#item_id').val($('#item_id').data('value')).focus();
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
copy: function () {
|
||||
|
|
@ -452,13 +470,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
|||
});
|
||||
},
|
||||
delete: function () {
|
||||
console.log('delete');
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
invoice: function () {
|
||||
function toggleInvoiceFields() {
|
||||
const type = $('#c-source').val();
|
||||
console.log(type);
|
||||
if (type === '1') {
|
||||
// 公司发票
|
||||
$('#c-tax_number').closest('.form-group').show();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer','cascader'], function ($, undefined, Backend, Table, Form) {
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'layer', 'cascader'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
|
|
@ -32,50 +32,121 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer','cascader'], f
|
|||
|
||||
{field: 'order.order_no', title: __('Order.order_no'), operate: 'LIKE'},
|
||||
|
||||
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"10":__('Status 10'),"20":__('Status 20'),"25":__('Status 25'),"30":__('Status 30'),"60":__('Status 60'),"-10":__('Status -10'),"-20":__('Status -20'),"-30":__('Status -30')}, formatter: Table.api.formatter.status},
|
||||
{
|
||||
field: 'status',
|
||||
title: __('Status'),
|
||||
searchList: {
|
||||
"0": __('Status 0'),
|
||||
"10": __('Status 10'),
|
||||
"20": __('Status 20'),
|
||||
"25": __('Status 25'),
|
||||
"30": __('Status 30'),
|
||||
"60": __('Status 60'),
|
||||
"-10": __('Status -10'),
|
||||
"-20": __('Status -20'),
|
||||
"-30": __('Status -30')
|
||||
},
|
||||
formatter: Table.api.formatter.status
|
||||
},
|
||||
|
||||
// {field: 'worker_id', title: __('Worker_id')},
|
||||
{field: 'worker_name', title: __('Worker_name'), operate: 'LIKE'},
|
||||
{field: 'worker_tel', title: __('Worker_tel'), operate: 'LIKE'},
|
||||
|
||||
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1')}, formatter: Table.api.formatter.normal},
|
||||
|
||||
{
|
||||
field: 'type',
|
||||
title: __('Type'),
|
||||
searchList: {"1": __('Type 1')},
|
||||
formatter: Table.api.formatter.normal
|
||||
},
|
||||
|
||||
|
||||
{field: 'order.source_shop', title: __('Order.source_shop'), operate: 'LIKE'},
|
||||
{field: 'order.source', title: __('Order.source')},
|
||||
{field: 'order.customer', title: __('Order.customer'), operate: 'LIKE'},
|
||||
{field: 'order.tel', title: __('Order.tel'), operate: 'LIKE'},
|
||||
{field: 'order.address', title: __('Order.address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{
|
||||
field: 'order.address',
|
||||
title: __('Order.address'),
|
||||
operate: 'LIKE',
|
||||
table: table,
|
||||
class: 'autocontent',
|
||||
formatter: Table.api.formatter.content
|
||||
},
|
||||
|
||||
{field: 'order.item_title', title: __('Order.item_title'), operate: 'LIKE'},
|
||||
{field: 'order.detail', title: __('Order.detail'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{
|
||||
field: 'order.detail',
|
||||
title: __('Order.detail'),
|
||||
operate: 'LIKE',
|
||||
table: table,
|
||||
class: 'autocontent',
|
||||
formatter: Table.api.formatter.content
|
||||
},
|
||||
|
||||
{field: 'order.images', title: __('Order.images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
|
||||
{
|
||||
field: 'order.images',
|
||||
title: __('Order.images'),
|
||||
operate: false,
|
||||
events: Table.api.events.image,
|
||||
formatter: Table.api.formatter.images
|
||||
},
|
||||
|
||||
{field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{
|
||||
field: 'remark',
|
||||
title: __('Remark'),
|
||||
operate: 'LIKE',
|
||||
table: table,
|
||||
class: 'autocontent',
|
||||
formatter: Table.api.formatter.content
|
||||
},
|
||||
|
||||
{field: 'plan_time', title: __('Plan_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{
|
||||
field: 'plan_time',
|
||||
title: __('Plan_time'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
autocomplete: false
|
||||
},
|
||||
// {field: 'is_notice', title: __('Is_notice'), searchList: {"0":__('Is_notice 0'),"1":__('Is_notice 1')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'finish_time', title: __('Finish_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
// {field: 'admin_id', title: __('Admin_id')},
|
||||
{
|
||||
field: 'finish_time',
|
||||
title: __('Finish_time'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
autocomplete: false
|
||||
},
|
||||
// {field: 'admin_id', title: __('Admin_id')},
|
||||
{field: 'admin_user', title: __('Admin_user'), operate: 'LIKE'},
|
||||
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{
|
||||
field: 'create_time',
|
||||
title: __('Create_time'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
autocomplete: false
|
||||
},
|
||||
{
|
||||
field: 'update_time',
|
||||
title: __('Update_time'),
|
||||
operate: 'RANGE',
|
||||
addclass: 'datetimerange',
|
||||
autocomplete: false
|
||||
},
|
||||
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
|
||||
{
|
||||
field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate,
|
||||
buttons: [
|
||||
{
|
||||
name: 'edit',
|
||||
text:"修改",
|
||||
title:"修改",
|
||||
text: "修改",
|
||||
title: "修改",
|
||||
icon: 'fa fa-pencil',
|
||||
//title: __('Edit'),
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
classname: 'btn btn-xs btn-success btn-editone',
|
||||
visible:function(row){
|
||||
if(row.btn_edit){
|
||||
visible: function (row) {
|
||||
if (row.btn_edit) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -83,37 +154,37 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer','cascader'], f
|
|||
},
|
||||
|
||||
{
|
||||
name:"income",
|
||||
text:"新增收款",
|
||||
title:"新增收款",
|
||||
classname:"btn-view btn-dialog",
|
||||
name: "income",
|
||||
text: "新增收款",
|
||||
title: "新增收款",
|
||||
classname: "btn-view btn-dialog",
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
icon:'fa fa-money',
|
||||
url: function(row){
|
||||
return 'orders/income/add?order_id='+row.order_id;
|
||||
icon: 'fa fa-money',
|
||||
url: function (row) {
|
||||
return 'orders/income/add?order_id=' + row.order_id;
|
||||
},
|
||||
dropdown:"更多",
|
||||
visible:function(row){
|
||||
if(row.btn_income){
|
||||
dropdown: "更多",
|
||||
visible: function (row) {
|
||||
if (row.btn_income) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
refresh:true,
|
||||
refresh: true,
|
||||
},
|
||||
{
|
||||
name:"abnormal",
|
||||
text:"创建异常",
|
||||
title:"创建异常",
|
||||
classname:"btn-add btn-dialog",
|
||||
name: "abnormal",
|
||||
text: "创建异常",
|
||||
title: "创建异常",
|
||||
classname: "btn-add btn-dialog",
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
icon:'fa fa-question',
|
||||
url:function(row) {
|
||||
return "orders/abnormal/add?order_id="+row.order_id
|
||||
icon: 'fa fa-question',
|
||||
url: function (row) {
|
||||
return "orders/abnormal/add?order_id=" + row.order_id
|
||||
},
|
||||
dropdown:"更多",
|
||||
visible:function(row){
|
||||
if(row.btn_income){
|
||||
dropdown: "更多",
|
||||
visible: function (row) {
|
||||
if (row.btn_income) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -122,38 +193,38 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer','cascader'], f
|
|||
},
|
||||
{
|
||||
name: 'del',
|
||||
text:"取消任务",
|
||||
title:"取消任务",
|
||||
text: "取消任务",
|
||||
title: "取消任务",
|
||||
icon: 'fa fa-trash red',
|
||||
//title: __('Del'),
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
classname: '',
|
||||
dropdown:"更多",
|
||||
click: function (data, row) {
|
||||
dropdown: "更多",
|
||||
click: function (data, row) {
|
||||
layer.prompt({
|
||||
formType: 1,
|
||||
value: '',
|
||||
title: '请输入备注',
|
||||
maxlength: 140,
|
||||
},function(value, index, elem) {
|
||||
formType: 1,
|
||||
value: '',
|
||||
title: '请输入备注',
|
||||
maxlength: 140,
|
||||
}, function (value, index, elem) {
|
||||
var url = 'orders/dispatch/del' + row.id;
|
||||
var options = {url: url, data: {remark: value}};
|
||||
Fast.api.ajax(options, function (data, ret) {
|
||||
// table.trigger("uncheckbox");
|
||||
table.bootstrapTable('refresh');
|
||||
})
|
||||
},function (data, ret) {
|
||||
var error = $(this).data("error") || $.noop;
|
||||
if (typeof error === 'function') {
|
||||
if (false === error.call(this, data, ret)) {
|
||||
return false;
|
||||
}, function (data, ret) {
|
||||
var error = $(this).data("error") || $.noop;
|
||||
if (typeof error === 'function') {
|
||||
if (false === error.call(this, data, ret)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
layer.close(index);
|
||||
},
|
||||
visible:function(row){
|
||||
if(row.btn_cancel){
|
||||
visible: function (row) {
|
||||
if (row.btn_cancel) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -183,16 +254,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer','cascader'], f
|
|||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url + '?'+ getQueryData(),
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url + '?' + getQueryData(),
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
fixedColumns: true,
|
||||
fixedColumns: false,
|
||||
fixedRightNumber: 1,
|
||||
columns: [
|
||||
[
|
||||
// {checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'finish_order', title: '接单总数'},
|
||||
{field: 'doing_order', title: '当前服务订单数'},
|
||||
{field: 'star', title: '星级'},
|
||||
{field: 'tel', title: '电话', operate: 'LIKE'},
|
||||
// {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
||||
//{field: 'area_id', title: __('Area_id')},
|
||||
|
|
@ -200,77 +274,81 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer','cascader'], f
|
|||
//{field: 'lat', title: __('Lat'), operate:'BETWEEN'},
|
||||
{field: 'area.short_merge_name', title: '区域', operate: 'LIKE'},
|
||||
// {field: 'deposit_amount', title: __('Deposit_amount'), operate:'BETWEEN'},
|
||||
{field: 'id', title: '操作',formatter:function (id) {
|
||||
{
|
||||
field: 'id', title: '操作', formatter: function (id) {
|
||||
return `<p class="btn btn-primary tab_chose" data-id="${id}">选择</p>`;
|
||||
}},
|
||||
}
|
||||
},
|
||||
]
|
||||
],
|
||||
search:false,
|
||||
commonSearch:false,
|
||||
search: false,
|
||||
commonSearch: false,
|
||||
});
|
||||
function getQueryData(){
|
||||
|
||||
function getQueryData() {
|
||||
const
|
||||
area_id = $('#area_id').val(),
|
||||
item_id = $('#item_id').data('myvalue'),
|
||||
keyword = $('#keyword').val()
|
||||
;
|
||||
let res = '';
|
||||
if (area_id && area_id !== ''){
|
||||
if (area_id && area_id !== '') {
|
||||
res += '&area_id=' + area_id;
|
||||
}
|
||||
if (item_id && item_id !== ''){
|
||||
if (item_id && item_id !== '') {
|
||||
res += '&item_id=' + item_id;
|
||||
}
|
||||
if (keyword && keyword !== ''){
|
||||
if (keyword && keyword !== '') {
|
||||
res += '&keyword=' + keyword;
|
||||
}
|
||||
console.log(res);
|
||||
return res;
|
||||
}
|
||||
$("#c-city-search").on("cp:updated", function() {
|
||||
|
||||
$("#c-city-search").on("cp:updated", function () {
|
||||
var citypicker = $(this).data("citypicker");
|
||||
var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
|
||||
// table.bootstrapTable('refresh',{query: {area_code: code}});
|
||||
$('#area_id').val(code);
|
||||
});
|
||||
$("#search_btn").on("click", function() {
|
||||
console.log($.fn.bootstrapTable.defaults.extend.index_url +'?' + getQueryData());
|
||||
table.bootstrapTable('refresh',{
|
||||
url:$.fn.bootstrapTable.defaults.extend.index_url +'?' + getQueryData(),
|
||||
$("#search_btn").on("click", function () {
|
||||
console.log($.fn.bootstrapTable.defaults.extend.index_url + '?' + getQueryData());
|
||||
table.bootstrapTable('refresh', {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url + '?' + getQueryData(),
|
||||
});
|
||||
});
|
||||
$("#reset_btn").on("click", function() {
|
||||
var _data = items;
|
||||
$("#reset_btn").on("click", function () {
|
||||
$("#c-city-search").citypicker('reset');
|
||||
$("#area_id").val('');
|
||||
$("#test").val('');
|
||||
$("#test").data('myvalue','');
|
||||
$("#test").data('myvalue', '');
|
||||
$("#keyword").val('');
|
||||
table.bootstrapTable('refresh',{
|
||||
url:$.fn.bootstrapTable.defaults.extend.index_url +'?' + getQueryData(),
|
||||
$('#item_id').zdCascader.reload(_data,true);
|
||||
table.bootstrapTable('refresh', {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url + '?' + getQueryData(),
|
||||
});
|
||||
});
|
||||
Form.events.citypicker($("#select-form"));
|
||||
|
||||
$(document).on('click', '.tab_chose', function() {
|
||||
$(document).on('click', '.tab_chose', function () {
|
||||
var dataId = $(this).data('id'); // 获取 data-id 的值
|
||||
const worker = Table.api.getrowbyid(table ,dataId);
|
||||
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');
|
||||
});
|
||||
|
||||
|
||||
var _data = items;
|
||||
$(function(){
|
||||
$('#item_id').zdCascader({
|
||||
data:_data,
|
||||
onChange: function ($this,data,allPathData) {
|
||||
// console.log(data,allPathData);
|
||||
$('#item_id').data('myvalue',data.value);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#item_id').zdCascader({
|
||||
data: _data,
|
||||
onChange: function ($this, data, allPathData) {
|
||||
// console.log(data,allPathData);
|
||||
$('#item_id').data('myvalue', data.value);
|
||||
},
|
||||
defaultValue:$('#item_id_name').val()
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
|
||||
|
|
@ -281,7 +359,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer','cascader'], f
|
|||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("#add-form"),null,null,function (data) {
|
||||
Form.api.bindevent($("#add-form"), null, null, function (data) {
|
||||
// Form.api.submit($("#add-form"));
|
||||
// return false;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -55,7 +55,27 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
{field: 'recipient_phone', title: __('Recipient_phone'), operate: 'LIKE'},
|
||||
{field: 'issued_at', title: __('Issued_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
{field: 'operate', title: __('Operate'), table: table,
|
||||
events: Table.api.events.operate,
|
||||
buttons:[
|
||||
{
|
||||
name: 'edit',
|
||||
text: "修改",
|
||||
icon: 'fa fa-pencil',
|
||||
title: __('Edit'),
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
classname: 'btn btn-xs btn-info btn-editone',
|
||||
},
|
||||
{
|
||||
name: 'del',
|
||||
text: "删除",
|
||||
icon: 'fa fa-trash',
|
||||
title: __('Delete'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-danger btn-delone',
|
||||
},
|
||||
],
|
||||
formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
|
|
|||
|
|
@ -33,7 +33,26 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
}},
|
||||
{field: 'title', title: __('Title'), operate: 'LIKE'},
|
||||
{field: 'sort', title: __('Sort'),sortable:true},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
{field: 'operate', title: __('Operate'), table: table,
|
||||
buttons:[
|
||||
{
|
||||
name: 'edit',
|
||||
text: "修改",
|
||||
icon: 'fa fa-pencil',
|
||||
title: __('Edit'),
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
classname: 'btn btn-xs btn-info btn-editone',
|
||||
},
|
||||
{
|
||||
name: 'del',
|
||||
text: "删除",
|
||||
icon: 'fa fa-trash',
|
||||
title: __('Delete'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-danger btn-delone',
|
||||
},
|
||||
],
|
||||
events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
|
|
|||
|
|
@ -43,7 +43,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jstree'],
|
|||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'admin.username', title:'创建人'},
|
||||
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||||
{field: 'type', title: '师傅归属', formatter: function (val){
|
||||
return val === 1 ? '自营':'非自营';
|
||||
}},
|
||||
{field: 'tel', title: __('Tel'), operate: 'LIKE'},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
||||
//{field: 'area_id', title: __('Area_id')},
|
||||
|
|
@ -54,7 +58,27 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jstree'],
|
|||
{field: 'star', title: __('Star'), operate:'BETWEEN'},
|
||||
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
{field: 'operate', title: __('Operate'),
|
||||
buttons:[
|
||||
{
|
||||
name: 'edit',
|
||||
text: "修改",
|
||||
icon: 'fa fa-pencil',
|
||||
title: __('Edit'),
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
classname: 'btn btn-xs btn-info btn-editone',
|
||||
},
|
||||
{
|
||||
name: 'del',
|
||||
text: "删除",
|
||||
icon: 'fa fa-trash',
|
||||
title: __('Delete'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-danger btn-delone',
|
||||
},
|
||||
],
|
||||
table: table, events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@
|
|||
ZdCascader.DEFAULTS = {
|
||||
data: null, //支持格式[{value:"",label:"",children:[{value:"",label:""}]}]
|
||||
range: ' / ', //分割符
|
||||
onChange: function (data) {}
|
||||
onChange: function (data) {},
|
||||
defaultValue: null // 新增 defaultValue 属性
|
||||
}
|
||||
|
||||
ZdCascader.METHODS = ['reload', 'destroy'];
|
||||
|
|
@ -84,6 +85,7 @@
|
|||
</svg>
|
||||
</span>
|
||||
</span>`).insertAfter(this.$el);
|
||||
|
||||
//下拉列表
|
||||
this.$dropdownWrap = $(`<div class="${this.CLASS.dropdownPanel}"></div>`).appendTo(this.$container).wrap(`<div class="${this.CLASS.dropdownWrap}"></div>`);
|
||||
|
||||
|
|
@ -145,6 +147,7 @@
|
|||
$that.prepend($(`<span class="${this.CLASS.checkClass.nodeSelectedIcon}">√</span>`));
|
||||
this.$el.data('bindData', data);
|
||||
this.$el.data('bindPathData', allPathData);
|
||||
console.log(allPathData);
|
||||
if (this.options.onChange && typeof this.options.onChange === "function")
|
||||
this.options.onChange(this, data, allPathData);
|
||||
event.stopPropagation();
|
||||
|
|
@ -212,9 +215,11 @@
|
|||
this.$el.remove();
|
||||
}
|
||||
//重新加载下拉数据
|
||||
ZdCascader.prototype.reload = function (data) {
|
||||
ZdCascader.prototype.reload = function (data,clear = false) {
|
||||
data = data || this.options.data;
|
||||
this.$el.val('').removeData('bindData').removeData('bindPathData');
|
||||
if (clear){
|
||||
this.$el.val('').removeData('bindData').removeData('bindPathData');
|
||||
}
|
||||
this.$dropdownWrap.empty();
|
||||
var selectedData = this.$el.data('bindData');
|
||||
var $firstWrap = $(`<div class="zd-scrollbar ${this.CLASS.menuWrap}">
|
||||
|
|
@ -240,16 +245,16 @@
|
|||
</svg>`);
|
||||
$li.append($label).data('bindData', m);
|
||||
if (m.children && m.children.length > 0) $li.append($icon);
|
||||
else if (selectedData && m.value == selectedData.value) {
|
||||
else if (this.options.defaultValue && m.value == this.options.defaultValue) {
|
||||
this.$dropdownWrap.find('.' + this.CLASS.checkClass.nodeSelectedIcon).remove();
|
||||
$li.prepend($(`<span class="${this.CLASS.checkClass.nodeSelectedIcon}">√</span>`));
|
||||
this.$el.val(m.label);
|
||||
}
|
||||
$ul.append($li);
|
||||
});
|
||||
this.$dropdownWrap.find('li.' + this.CLASS.checkClass.nodeAnchor).removeClass(this.CLASS.checkClass.nodeAnchor);
|
||||
this.$dropdownWrap.append($firstWrap).find(this.CLASS.menuNode).eq(0).focus().addClass(this.CLASS.checkClass
|
||||
.nodeAnchor);
|
||||
this.$dropdownWrap.append($firstWrap);
|
||||
}
|
||||
|
||||
ZdCascader.prototype._keyup = function (event) {
|
||||
var keycode = event.which;
|
||||
switch (keycode) {
|
||||
|
|
@ -359,38 +364,22 @@
|
|||
this.$el.focus();
|
||||
}
|
||||
|
||||
$.fn.zdCascader = function (option) {
|
||||
var value,
|
||||
args = Array.prototype.slice.call(arguments, 1);
|
||||
|
||||
this.each(function () {
|
||||
var $this = $(this),
|
||||
data = $this.data('zdCascader'),
|
||||
options = $.extend({}, ZdCascader.DEFAULTS, $this.data(),
|
||||
typeof option === 'object' && option);
|
||||
|
||||
if (typeof option === 'string') {
|
||||
if ($.inArray(option, ZdCascader.METHODS) < 0) {
|
||||
throw new Error("Unknown method: " + option);
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
|
||||
value = data[option].apply(data, args);
|
||||
|
||||
if (option === 'destroy') {
|
||||
$this.removeData('zdCascader');
|
||||
}
|
||||
}
|
||||
|
||||
$.fn.zdCascader = function (options) {
|
||||
options = $.extend({}, ZdCascader.DEFAULTS, options);
|
||||
return this.each(function () {
|
||||
var $this = $(this);
|
||||
var data = $this.data('zdCascader');
|
||||
if (!data) {
|
||||
$this.data('zdCascader', (data = new ZdCascader(this, options)));
|
||||
data = new ZdCascader(this, options);
|
||||
$this.data('zdCascader', data);
|
||||
}
|
||||
if (typeof options === 'string') {
|
||||
if (ZdCascader.METHODS.indexOf(options) > -1) {
|
||||
data[options]();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return typeof value === 'undefined' ? this : value;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
Loading…
Reference in New Issue
Block a user