修改
This commit is contained in:
parent
c1ac4bf315
commit
b96fc31bc6
|
|
@ -42,7 +42,29 @@ class Index extends Backend
|
||||||
}
|
}
|
||||||
|
|
||||||
$order = new \app\admin\model\Order();
|
$order = new \app\admin\model\Order();
|
||||||
|
$user = \model('admin')->find($this->auth->id);
|
||||||
|
|
||||||
|
$group = \model('auth_group_access')->where('uid',$this->auth->id)->find()->group_id ?? 0;
|
||||||
|
|
||||||
|
if ($group == 2 || $group == 6) {
|
||||||
|
// 生成 SQL 语句
|
||||||
|
$ids = $user->area_ids??'';
|
||||||
|
if ($ids == ''){
|
||||||
|
$to_dispatch = 0;
|
||||||
|
}else{
|
||||||
|
$ids = explode(',',$ids);
|
||||||
|
$area_codes = $this->filterAreaCodes($ids);
|
||||||
|
|
||||||
|
$order->where(function ($q) use ($area_codes) {
|
||||||
|
foreach ($area_codes as $area_code) {
|
||||||
|
$q->whereOr('area_id', 'like', $area_code . '%');
|
||||||
|
}
|
||||||
|
});
|
||||||
$to_dispatch = $order->where('status',\app\admin\model\Order::STATUS_DISPATCHING)->count();
|
$to_dispatch = $order->where('status',\app\admin\model\Order::STATUS_DISPATCHING)->count();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$to_dispatch = $order->where('status',\app\admin\model\Order::STATUS_DISPATCHING)->count();
|
||||||
|
}
|
||||||
//待跟进
|
//待跟进
|
||||||
$to_follow = OrderDispatch::where('follow',0)->auth($this->auth)->count();
|
$to_follow = OrderDispatch::where('follow',0)->auth($this->auth)->count();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ use think\exception\DbException;
|
||||||
use think\exception\PDOException;
|
use think\exception\PDOException;
|
||||||
use think\exception\ValidateException;
|
use think\exception\ValidateException;
|
||||||
use think\Hook;
|
use think\Hook;
|
||||||
|
use think\Loader;
|
||||||
use think\Model;
|
use think\Model;
|
||||||
use function Symfony\Component\Clock\now;
|
use function Symfony\Component\Clock\now;
|
||||||
|
|
||||||
|
|
@ -119,7 +120,7 @@ class Order extends Backend
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->request->filter(['strip_tags', 'trim']);
|
$this->request->filter(['strip_tags', 'trim']);
|
||||||
$group = \model('auth_group_access')->find($this->auth->id)->group_id ?? 0;
|
$group = \model('auth_group_access')->where('uid',$this->auth->id)->find()->group_id ?? 0;
|
||||||
$user = \model('admin')->find($this->auth->id);
|
$user = \model('admin')->find($this->auth->id);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -144,6 +145,13 @@ class Order extends Backend
|
||||||
'aftersale_id'
|
'aftersale_id'
|
||||||
])
|
])
|
||||||
->where($where);
|
->where($where);
|
||||||
|
$filter = (array)json_decode(input()['filter'] ?? '', true);
|
||||||
|
$admin_filter = $filter['user.nickname'] ?? false;
|
||||||
|
|
||||||
|
if ($admin_filter){
|
||||||
|
$admin_ids = Admin::where('nickname','like','%'.$admin_filter.'%')->column('id');
|
||||||
|
$build->whereIn('admin_id',$admin_ids);
|
||||||
|
}
|
||||||
|
|
||||||
if ($type == 1){
|
if ($type == 1){
|
||||||
$build->where('status','>=', 0);
|
$build->where('status','>=', 0);
|
||||||
|
|
@ -152,10 +160,15 @@ class Order extends Backend
|
||||||
if ($type == 2){
|
if ($type == 2){
|
||||||
$build->where('status','<', 0);
|
$build->where('status','<', 0);
|
||||||
}
|
}
|
||||||
|
if ($group == 2 || $group == 6) {
|
||||||
if ($group == 2) {
|
|
||||||
// 生成 SQL 语句
|
// 生成 SQL 语句
|
||||||
$area_codes = $this->filterAreaCodes(explode(',', $user->area_ids));
|
$ids = $user->area_ids??'';
|
||||||
|
if ($ids == ''){
|
||||||
|
return ['total' => 0, 'rows' => []];
|
||||||
|
}
|
||||||
|
$ids = explode(',',$ids);
|
||||||
|
$area_codes = $this->filterAreaCodes($ids);
|
||||||
|
|
||||||
$build->where(function ($q) use ($area_codes) {
|
$build->where(function ($q) use ($area_codes) {
|
||||||
foreach ($area_codes as $area_code) {
|
foreach ($area_codes as $area_code) {
|
||||||
$q->whereOr('area_id', 'like', $area_code . '%');
|
$q->whereOr('area_id', 'like', $area_code . '%');
|
||||||
|
|
@ -356,7 +369,7 @@ class Order extends Backend
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function autoDispatch($order)
|
public function autoDispatch($order)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// if ($order->dispatch_type != 2) {
|
// if ($order->dispatch_type != 2) {
|
||||||
|
|
@ -643,36 +656,6 @@ class Order extends Backend
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function filterAreaCodes(array $area_codes)
|
|
||||||
{
|
|
||||||
// 提取所有两位区号
|
|
||||||
$prefix_2_digits = [];
|
|
||||||
foreach ($area_codes as $code) {
|
|
||||||
if (strlen($code) == 2) {
|
|
||||||
$prefix_2_digits[] = $code;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 过滤数组
|
|
||||||
$filtered_codes = array_filter($area_codes, function ($code) use ($prefix_2_digits) {
|
|
||||||
// 如果是两位区号,直接保留
|
|
||||||
if (strlen($code) == 2) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// 检查是否有对应的两位前缀,如果有,则排除四位区号
|
|
||||||
foreach ($prefix_2_digits as $prefix) {
|
|
||||||
if (strpos($code, $prefix) === 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 如果没有匹配的两位前缀,则保留
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 重新索引数组
|
|
||||||
return array_values($filtered_codes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
*
|
*
|
||||||
|
|
@ -734,4 +717,185 @@ class Order extends Backend
|
||||||
return null; // 如果找不到返回 null
|
return null; // 如果找不到返回 null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function buildparams($searchfields = null, $relationSearch = null)
|
||||||
|
{
|
||||||
|
$searchfields = is_null($searchfields) ? $this->searchFields : $searchfields;
|
||||||
|
$relationSearch = is_null($relationSearch) ? $this->relationSearch : $relationSearch;
|
||||||
|
$search = $this->request->get("search", '');
|
||||||
|
$filter = $this->request->get("filter", '');
|
||||||
|
$op = $this->request->get("op", '', 'trim');
|
||||||
|
$sort = $this->request->get("sort", !empty($this->model) && $this->model->getPk() ? $this->model->getPk() : 'id');
|
||||||
|
$order = $this->request->get("order", "DESC");
|
||||||
|
$offset = max(0, $this->request->get("offset/d", 0));
|
||||||
|
$limit = max(0, $this->request->get("limit/d", 0));
|
||||||
|
$limit = $limit ?: 999999;
|
||||||
|
//新增自动计算页码
|
||||||
|
$page = $limit ? intval($offset / $limit) + 1 : 1;
|
||||||
|
if ($this->request->has("page")) {
|
||||||
|
$page = max(0, $this->request->get("page/d", 1));
|
||||||
|
}
|
||||||
|
$this->request->get([config('paginate.var_page') => $page]);
|
||||||
|
$filter = (array)json_decode($filter, true);
|
||||||
|
$op = (array)json_decode($op, true);
|
||||||
|
$filter = $filter ? $filter : [];
|
||||||
|
$where = [];
|
||||||
|
$alias = [];
|
||||||
|
$bind = [];
|
||||||
|
$name = '';
|
||||||
|
$aliasName = '';
|
||||||
|
if (!empty($this->model) && $relationSearch) {
|
||||||
|
$name = $this->model->getTable();
|
||||||
|
$alias[$name] = Loader::parseName(basename(str_replace('\\', '/', get_class($this->model))));
|
||||||
|
$aliasName = $alias[$name] . '.';
|
||||||
|
}
|
||||||
|
$sortArr = explode(',', $sort);
|
||||||
|
foreach ($sortArr as $index => & $item) {
|
||||||
|
$item = stripos($item, ".") === false ? $aliasName . trim($item) : $item;
|
||||||
|
}
|
||||||
|
unset($item);
|
||||||
|
$sort = implode(',', $sortArr);
|
||||||
|
$adminIds = $this->getDataLimitAdminIds();
|
||||||
|
if (is_array($adminIds)) {
|
||||||
|
$where[] = [$aliasName . $this->dataLimitField, 'in', $adminIds];
|
||||||
|
}
|
||||||
|
if ($search) {
|
||||||
|
$searcharr = is_array($searchfields) ? $searchfields : explode(',', $searchfields);
|
||||||
|
foreach ($searcharr as $k => &$v) {
|
||||||
|
$v = stripos($v, ".") === false ? $aliasName . $v : $v;
|
||||||
|
}
|
||||||
|
unset($v);
|
||||||
|
$where[] = [implode("|", $searcharr), "LIKE", "%{$search}%"];
|
||||||
|
}
|
||||||
|
$index = 0;
|
||||||
|
|
||||||
|
foreach ($filter as $k => $v) {
|
||||||
|
if ($k == 'user.nickname') continue;
|
||||||
|
if (!preg_match('/^[a-zA-Z0-9_\-\.]+$/', $k)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$sym = $op[$k] ?? '=';
|
||||||
|
if (stripos($k, ".") === false) {
|
||||||
|
$k = $aliasName . $k;
|
||||||
|
}
|
||||||
|
$v = !is_array($v) ? trim($v) : $v;
|
||||||
|
$sym = strtoupper($op[$k] ?? $sym);
|
||||||
|
//null和空字符串特殊处理
|
||||||
|
if (!is_array($v)) {
|
||||||
|
if (in_array(strtoupper($v), ['NULL', 'NOT NULL'])) {
|
||||||
|
$sym = strtoupper($v);
|
||||||
|
}
|
||||||
|
if (in_array($v, ['""', "''"])) {
|
||||||
|
$v = '';
|
||||||
|
$sym = '=';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($sym) {
|
||||||
|
case '=':
|
||||||
|
case '<>':
|
||||||
|
$where[] = [$k, $sym, (string)$v];
|
||||||
|
break;
|
||||||
|
case 'LIKE':
|
||||||
|
case 'NOT LIKE':
|
||||||
|
case 'LIKE %...%':
|
||||||
|
case 'NOT LIKE %...%':
|
||||||
|
$where[] = [$k, trim(str_replace('%...%', '', $sym)), "%{$v}%"];
|
||||||
|
break;
|
||||||
|
case '>':
|
||||||
|
case '>=':
|
||||||
|
case '<':
|
||||||
|
case '<=':
|
||||||
|
$where[] = [$k, $sym, intval($v)];
|
||||||
|
break;
|
||||||
|
case 'FINDIN':
|
||||||
|
case 'FINDINSET':
|
||||||
|
case 'FIND_IN_SET':
|
||||||
|
$v = is_array($v) ? $v : explode(',', str_replace(' ', ',', $v));
|
||||||
|
$findArr = array_values($v);
|
||||||
|
foreach ($findArr as $idx => $item) {
|
||||||
|
$bindName = "item_" . $index . "_" . $idx;
|
||||||
|
$bind[$bindName] = $item;
|
||||||
|
$where[] = "FIND_IN_SET(:{$bindName}, `" . str_replace('.', '`.`', $k) . "`)";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'IN':
|
||||||
|
case 'IN(...)':
|
||||||
|
case 'NOT IN':
|
||||||
|
case 'NOT IN(...)':
|
||||||
|
$where[] = [$k, str_replace('(...)', '', $sym), is_array($v) ? $v : explode(',', $v)];
|
||||||
|
break;
|
||||||
|
case 'BETWEEN':
|
||||||
|
case 'NOT BETWEEN':
|
||||||
|
$arr = array_slice(explode(',', $v), 0, 2);
|
||||||
|
if (stripos($v, ',') === false || !array_filter($arr, function ($v) {
|
||||||
|
return $v != '' && $v !== false && $v !== null;
|
||||||
|
})) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
//当出现一边为空时改变操作符
|
||||||
|
if ($arr[0] === '') {
|
||||||
|
$sym = $sym == 'BETWEEN' ? '<=' : '>';
|
||||||
|
$arr = $arr[1];
|
||||||
|
} elseif ($arr[1] === '') {
|
||||||
|
$sym = $sym == 'BETWEEN' ? '>=' : '<';
|
||||||
|
$arr = $arr[0];
|
||||||
|
}
|
||||||
|
$where[] = [$k, $sym, $arr];
|
||||||
|
break;
|
||||||
|
case 'RANGE':
|
||||||
|
case 'NOT RANGE':
|
||||||
|
$v = str_replace(' - ', ',', $v);
|
||||||
|
$arr = array_slice(explode(',', $v), 0, 2);
|
||||||
|
if (stripos($v, ',') === false || !array_filter($arr)) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
//当出现一边为空时改变操作符
|
||||||
|
if ($arr[0] === '') {
|
||||||
|
$sym = $sym == 'RANGE' ? '<=' : '>';
|
||||||
|
$arr = $arr[1];
|
||||||
|
} elseif ($arr[1] === '') {
|
||||||
|
$sym = $sym == 'RANGE' ? '>=' : '<';
|
||||||
|
$arr = $arr[0];
|
||||||
|
}
|
||||||
|
$tableArr = explode('.', $k);
|
||||||
|
if (count($tableArr) > 1 && $tableArr[0] != $name && !in_array($tableArr[0], $alias)
|
||||||
|
&& !empty($this->model) && $this->relationSearch) {
|
||||||
|
//修复关联模型下时间无法搜索的BUG
|
||||||
|
$relation = Loader::parseName($tableArr[0], 1, false);
|
||||||
|
$alias[$this->model->$relation()->getTable()] = $tableArr[0];
|
||||||
|
}
|
||||||
|
$where[] = [$k, str_replace('RANGE', 'BETWEEN', $sym) . ' TIME', $arr];
|
||||||
|
break;
|
||||||
|
case 'NULL':
|
||||||
|
case 'IS NULL':
|
||||||
|
case 'NOT NULL':
|
||||||
|
case 'IS NOT NULL':
|
||||||
|
$where[] = [$k, strtolower(str_replace('IS ', '', $sym))];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$index++;
|
||||||
|
}
|
||||||
|
if (!empty($this->model)) {
|
||||||
|
$this->model->alias($alias);
|
||||||
|
}
|
||||||
|
$model = $this->model;
|
||||||
|
$where = function ($query) use ($where, $alias, $bind, &$model) {
|
||||||
|
if (!empty($model)) {
|
||||||
|
$model->alias($alias);
|
||||||
|
$model->bind($bind);
|
||||||
|
}
|
||||||
|
foreach ($where as $k => $v) {
|
||||||
|
if (is_array($v)) {
|
||||||
|
call_user_func_array([$query, 'where'], $v);
|
||||||
|
} else {
|
||||||
|
$query->where($v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return [$where, $sort, $order, $offset, $limit, $page, $alias, $bind];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ class Worker extends Backend
|
||||||
$q->withField(['id','username']);
|
$q->withField(['id','username']);
|
||||||
}])
|
}])
|
||||||
->where($where)
|
->where($where)
|
||||||
->field('worker.id,admin_id,type,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,rate,rate_remark,remark,images')
|
||||||
->order($sort, $order);
|
->order($sort, $order);
|
||||||
if ($keyword) {
|
if ($keyword) {
|
||||||
$build->where(function ($q) use ($keyword) {
|
$build->where(function ($q) use ($keyword) {
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ class Order extends Model
|
||||||
*/
|
*/
|
||||||
public function scopeAreaauth($query,Auth $auth,string $area_id_field='area_id'){
|
public function scopeAreaauth($query,Auth $auth,string $area_id_field='area_id'){
|
||||||
if(!$auth->isSuperAdmin()){
|
if(!$auth->isSuperAdmin()){
|
||||||
$areaIds = array_unique(array_filter(explode(',',trim($auth->area_ids))));
|
$areaIds = array_unique(array_filter(explode(',',trim($auth->area_ids??''))));
|
||||||
if(!in_array('*',$areaIds)){
|
if(!in_array('*',$areaIds)){
|
||||||
$query->whereIn('fa_order.'.$area_id_field,$areaIds);
|
$query->whereIn('fa_order.'.$area_id_field,$areaIds);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,20 +13,6 @@
|
||||||
<input id="c-tel" data-rule="required" class="form-control" name="row[tel]" type="text" value="">
|
<input id="c-tel" data-rule="required" class="form-control" name="row[tel]" type="text" value="">
|
||||||
</div>
|
</div>
|
||||||
</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-rate" data-rule="required" min="0" max="1" step="1" class="form-control" name="row[rate]" type="number" 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">
|
|
||||||
<input id="c-rate_remark" data-rule="required" class="form-control" name="row[rate_remark]" type="text" value="">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Area_id')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Area_id')}:</label>
|
||||||
<div class='col-xs-12 col-sm-8'>
|
<div class='col-xs-12 col-sm-8'>
|
||||||
|
|
@ -57,7 +43,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">师傅分成:</label>
|
<label class="control-label col-xs-12 col-sm-2">师傅分成(%):</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input data-rule="required" class="form-control" step="0.01" name="row[rate]" type="number" value="0.00">
|
<input data-rule="required" class="form-control" step="0.01" name="row[rate]" type="number" value="0.00">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -16,19 +16,6 @@
|
||||||
</div>
|
</div>
|
||||||
</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-rate" data-rule="required" min="0" max="1" step="1" class="form-control" name="row[rate]" type="number" value="{$row.rate|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-rate_remark" data-rule="required" class="form-control" name="row[rate_remark]" type="text" value="{$row.rate_remark|htmlentities}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
|
@ -74,7 +61,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">师傅分成:</label>
|
<label class="control-label col-xs-12 col-sm-2">师傅分成(%):</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input data-rule="required" class="form-control" step="0.01" name="row[rate]" type="number" value="{$row.rate|htmlentities}">
|
<input data-rule="required" class="form-control" step="0.01" name="row[rate]" type="number" value="{$row.rate|htmlentities}">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -664,4 +664,34 @@ class Backend extends Controller
|
||||||
|
|
||||||
return $formattedTree;
|
return $formattedTree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function filterAreaCodes(array $area_codes)
|
||||||
|
{
|
||||||
|
// 提取所有两位区号
|
||||||
|
$prefix_2_digits = [];
|
||||||
|
foreach ($area_codes as $code) {
|
||||||
|
if (strlen($code) == 2) {
|
||||||
|
$prefix_2_digits[] = $code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 过滤数组
|
||||||
|
$filtered_codes = array_filter($area_codes, function ($code) use ($prefix_2_digits) {
|
||||||
|
// 如果是两位区号,直接保留
|
||||||
|
if (strlen($code) == 2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 检查是否有对应的两位前缀,如果有,则排除四位区号
|
||||||
|
foreach ($prefix_2_digits as $prefix) {
|
||||||
|
if (strpos($code, $prefix) === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果没有匹配的两位前缀,则保留
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 重新索引数组
|
||||||
|
return array_values($filtered_codes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@
|
||||||
top: 0;
|
top: 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #c0c4cc;
|
color: #c0c4cc;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zd-input__suffix-inner {
|
.zd-input__suffix-inner {
|
||||||
|
|
|
||||||
|
|
@ -352,7 +352,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'layer', 'cascader'],
|
||||||
// console.log(data,allPathData);
|
// console.log(data,allPathData);
|
||||||
$('#item_id').data('myvalue', data.value);
|
$('#item_id').data('myvalue', data.value);
|
||||||
},
|
},
|
||||||
defaultValue:$('#item_id_name').val()
|
defaultValue:$('#item_id_name').val(),
|
||||||
|
clear:true,
|
||||||
|
clickParent:true
|
||||||
});
|
});
|
||||||
|
|
||||||
// 为表格绑定事件
|
// 为表格绑定事件
|
||||||
|
|
|
||||||
|
|
@ -270,7 +270,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs'
|
||||||
onChange: function ($this, data, allPathData) {
|
onChange: function ($this, data, allPathData) {
|
||||||
// console.log(data,allPathData);
|
// console.log(data,allPathData);
|
||||||
$('#item_id_value').val(data.value);
|
$('#item_id_value').val(data.value);
|
||||||
}
|
},
|
||||||
|
clear:true,
|
||||||
|
clickParent: true
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'],
|
||||||
//{field: 'lng', title: __('Lng'), operate:'BETWEEN'},
|
//{field: 'lng', title: __('Lng'), operate:'BETWEEN'},
|
||||||
//{field: 'lat', title: __('Lat'), operate:'BETWEEN'},
|
//{field: 'lat', title: __('Lat'), operate:'BETWEEN'},
|
||||||
{field: 'area.short_merge_name', title: __('Area.short_merge_name'), searchable: false},
|
{field: 'area.short_merge_name', title: __('Area.short_merge_name'), searchable: false},
|
||||||
|
{field: 'rate', title: '分成'},
|
||||||
|
{field: 'rate_remark', title: '分成备注'},
|
||||||
|
{field: 'remark', title: '备注'},
|
||||||
{field: 'deposit_amount', title: __('Deposit_amount'), operate: 'BETWEEN'},
|
{field: 'deposit_amount', title: __('Deposit_amount'), operate: 'BETWEEN'},
|
||||||
{field: 'star', title: __('Star'), operate: 'BETWEEN'},
|
{field: 'star', title: __('Star'), operate: 'BETWEEN'},
|
||||||
|
{
|
||||||
|
field: 'images',
|
||||||
|
title: __('Images'),
|
||||||
|
operate: false,
|
||||||
|
events: Table.api.events.image,
|
||||||
|
formatter: Table.api.formatter.images
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'create_time',
|
field: 'create_time',
|
||||||
title: __('Create_time'),
|
title: __('Create_time'),
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@
|
||||||
data: null, //支持格式[{value:"",label:"",children:[{value:"",label:""}]}]
|
data: null, //支持格式[{value:"",label:"",children:[{value:"",label:""}]}]
|
||||||
range: ' / ', //分割符
|
range: ' / ', //分割符
|
||||||
search: true, //搜索
|
search: true, //搜索
|
||||||
|
clickParent: false, //是否可以选中父级
|
||||||
|
clear: false, //是否可以关闭
|
||||||
onChange: function (data) {}
|
onChange: function (data) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,13 +73,13 @@
|
||||||
this.$container = this.$el.wrap(`<div class="${this.CLASS.wrap}"></div>`)
|
this.$container = this.$el.wrap(`<div class="${this.CLASS.wrap}"></div>`)
|
||||||
.wrap(`<div class="${this.CLASS.inputwrap}"></div>`).addClass(this.CLASS.input).prop('readonly', !this.options.search).closest('.' + this.CLASS.wrap);
|
.wrap(`<div class="${this.CLASS.inputwrap}"></div>`).addClass(this.CLASS.input).prop('readonly', !this.options.search).closest('.' + this.CLASS.wrap);
|
||||||
|
|
||||||
this.$closeBtn = $(`<span class="zd-input__close">
|
if (this.options.clear){
|
||||||
<svg style="height: 100%" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
this.$closeBtn = $(`<span class="zd-input__close"><svg style="height: 100%" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||||
<line x1="18" y1="6" x2="6" y2="18" />
|
<line x1="18" y1="6" x2="6" y2="18" />
|
||||||
<line x1="6" y1="6" x2="18" y2="18" />
|
<line x1="6" y1="6" x2="18" y2="18" />
|
||||||
</svg>
|
</svg></span>`).insertAfter(this.$el);
|
||||||
|
}
|
||||||
|
|
||||||
</span>`).insertAfter(this.$el);
|
|
||||||
//文本框右侧图标
|
//文本框右侧图标
|
||||||
this.$arrow = $(`<span class="zd-input__suffix">
|
this.$arrow = $(`<span class="zd-input__suffix">
|
||||||
<span class="zd-input__suffix-inner">
|
<span class="zd-input__suffix-inner">
|
||||||
|
|
@ -114,9 +116,15 @@
|
||||||
this.$container.removeClass(this.CLASS.checkClass.wrapFocus);
|
this.$container.removeClass(this.CLASS.checkClass.wrapFocus);
|
||||||
}, this));
|
}, this));
|
||||||
|
|
||||||
|
if (this.options.clickParent){
|
||||||
this.$container.on('click.item', '.' + this.CLASS.menuNode, $.proxy(this._nodeClick, this))
|
this.$container.on('click.item', '.' + this.CLASS.menuNode, $.proxy(this._nodeClick, this))
|
||||||
.on('click.item', '.' + 'zd-input__close', $.proxy(this._clear, this))
|
.on('click.item', '.' + 'zd-input__close', $.proxy(this._clear, this))
|
||||||
.on('dblclick.item', '.' + this.CLASS.menuNode, $.proxy(this._nodeDoubleClick, this));
|
.on('dblclick.item', '.' + this.CLASS.menuNode, $.proxy(this._nodeDoubleClick, this));
|
||||||
|
}else {
|
||||||
|
this.$container.on('click.item', '.' + this.CLASS.menuNode, $.proxy(this._nodeClick, this))
|
||||||
|
.on('click.item', '.' + 'zd-input__close', $.proxy(this._clear, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.$el.on('keyup.wrap', $.proxy(this._keyup, this));
|
this.$el.on('keyup.wrap', $.proxy(this._keyup, this));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user