update
This commit is contained in:
parent
be2576f143
commit
8e6768df5d
@ -50,7 +50,6 @@ class CustomLogic extends BaseLogic
|
|||||||
'dept_id' => $params['dept_id'],
|
'dept_id' => $params['dept_id'],
|
||||||
'name' => $params['name'],
|
'name' => $params['name'],
|
||||||
'custom_type' => $params['custom_type'],
|
'custom_type' => $params['custom_type'],
|
||||||
'parent_company' => $params['parent_company'] ?? '',
|
|
||||||
'phone' => $params['phone'],
|
'phone' => $params['phone'],
|
||||||
'credit_rating' => $params['credit_rating'],
|
'credit_rating' => $params['credit_rating'],
|
||||||
'province' => $params['province'] ?? 0,
|
'province' => $params['province'] ?? 0,
|
||||||
@ -112,7 +111,6 @@ class CustomLogic extends BaseLogic
|
|||||||
'dept_id' => $params['dept_id'],
|
'dept_id' => $params['dept_id'],
|
||||||
'name' => $params['name'],
|
'name' => $params['name'],
|
||||||
'custom_type' => $params['custom_type'],
|
'custom_type' => $params['custom_type'],
|
||||||
'parent_company' => $params['parent_company'] ?? '',
|
|
||||||
'phone' => $params['phone'],
|
'phone' => $params['phone'],
|
||||||
'credit_rating' => $params['credit_rating'],
|
'credit_rating' => $params['credit_rating'],
|
||||||
'province' => $params['province'] ?? 0,
|
'province' => $params['province'] ?? 0,
|
||||||
@ -153,7 +151,18 @@ class CustomLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function delete(array $params): bool
|
public static function delete(array $params): bool
|
||||||
{
|
{
|
||||||
return Custom::destroy($params['id']);
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
$custom_contacts_ids = CustomContacts::where('custom_id',$params['id'])->column('id');
|
||||||
|
Custom::destroy($params['id']);
|
||||||
|
CustomContacts::destroy($custom_contacts_ids);
|
||||||
|
Db::commit();
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
self::setError($e->getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -82,7 +82,9 @@ class CustomValidate extends BaseValidate
|
|||||||
* @date 2023/11/11 22:10
|
* @date 2023/11/11 22:10
|
||||||
*/
|
*/
|
||||||
public function sceneEdit()
|
public function sceneEdit()
|
||||||
{}
|
{
|
||||||
|
return $this->remove('other_contacts',true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,12 +61,12 @@ class Custom extends BaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getCustomTypeTextAttr($value,$data){
|
public function getCustomTypeTextAttr($value,$data){
|
||||||
$dictData = DictData::where('type_value','custom_type')->column('name','value');
|
$dict = DictData::where('type_value','custom_type')->column('name','value');
|
||||||
return $dictData[$data['custom_type']];
|
return !empty($data['custom_type']) ? $dict[$data['custom_type']] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCreditRatingTextAttr($value,$data){
|
public function getCreditRatingTextAttr($value,$data){
|
||||||
$dictData = DictData::where('type_value','credit_rating')->column('name','value');
|
$dict = DictData::where('type_value','credit_rating')->column('name','value');
|
||||||
return $dictData[$data['credit_rating']];
|
return !empty($data['credit_rating']) ? $dict[$data['credit_rating']] : '';
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user