搜索
This commit is contained in:
parent
96927278c6
commit
04de14e0f9
@ -68,8 +68,8 @@ class PackageService extends Service
|
||||
$attributes['sn'] = $attributes['sn'] ?: CommonService::generatePackageSn($attributes['type'], $attributes['carrier_operator'], $attributes['flows'], $attributes['service_months']);
|
||||
|
||||
$rule = [
|
||||
'sn' => ['required', 'between:2,32', Rule::unique($this->packageRepository->getTable(), 'sn')->ignore($attributes['id'])->where('del')],
|
||||
'name' => ['required', 'between:2,32', Rule::unique($this->packageRepository->getTable(), 'name')->ignore($attributes['id'])],
|
||||
'sn' => ['required', 'between:2,32', Rule::unique($this->packageRepository->getTable(), 'sn')->ignore($attributes['id'])->whereNUll('deleted_at')],
|
||||
'name' => ['required', 'between:2,32', Rule::unique($this->packageRepository->getTable(), 'name')->ignore($attributes['id'])->whereNUll('deleted_at')],
|
||||
'type' => ['required', 'in:0,1,2'],
|
||||
'carrier_operator' => ['required', 'in:0,1,2,3'],
|
||||
'cost_price' => ['numeric', 'min:0'],
|
||||
|
@ -51,7 +51,7 @@ export default {
|
||||
},
|
||||
{
|
||||
title: 'IP',
|
||||
width: 130,
|
||||
width: 150,
|
||||
key: 'ip'
|
||||
},
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.data && this.params.sn && !/^[A-Z0-9_]{2,32}$/.test(this.data && this.params.sn)) {
|
||||
if (this.data && this.params.sn && !/^[A-Z0-9._]{2,32}$/.test(this.data && this.params.sn)) {
|
||||
this.$Message.info('套餐编码为大写字母、数字、下划线的2-32位字符');
|
||||
return;
|
||||
}
|
||||
|
@ -95,12 +95,20 @@ trait CriteriaRepository
|
||||
if (!is_null($value)) {
|
||||
if (!is_null($relation)) {
|
||||
if ($condition == '<>' || $condition == '!=') {
|
||||
$query->whereDoesntHave($relation, function ($query) use ($field, $value) {
|
||||
$query->where($field, $value);
|
||||
$query->whereDoesntHave($relation, function ($relationQuery) use ($field, $value) {
|
||||
if (method_exists($relationQuery, 'withTrashed')) {
|
||||
$relationQuery->withTrashed();
|
||||
}
|
||||
|
||||
$relationQuery->where($field, $value);
|
||||
});
|
||||
} else {
|
||||
$query->whereHas($relation, function ($query) use ($field, $condition, $value) {
|
||||
$query->where($field, $condition, $value);
|
||||
$query->whereHas($relation, function ($relationQuery) use ($field, $condition, $value) {
|
||||
if (method_exists($relationQuery, 'withTrashed')) {
|
||||
$relationQuery->withTrashed();
|
||||
}
|
||||
|
||||
$relationQuery->where($field, $condition, $value);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
@ -127,8 +135,12 @@ trait CriteriaRepository
|
||||
} else {
|
||||
if (!is_null($value)) {
|
||||
if (!is_null($relation)) {
|
||||
$query->orWhereHas($relation, function ($query) use ($field, $condition, $value) {
|
||||
$query->where($field, $condition, $value);
|
||||
$query->orWhereHas($relation, function ($relationQuery) use ($field, $condition, $value) {
|
||||
if (method_exists($relationQuery, 'withTrashed')) {
|
||||
$relationQuery->withTrashed();
|
||||
}
|
||||
|
||||
$relationQuery->where($field, $condition, $value);
|
||||
});
|
||||
} else {
|
||||
if ($condition == 'between') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user