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