|
|
@@ -194,13 +194,26 @@ class ItemService extends Service
|
|
|
return [true, ''];
|
|
|
}
|
|
|
|
|
|
+ public function changedCommon($user, $oldData){
|
|
|
+ //创建人 直接通过
|
|
|
+ if($user['id'] !== $oldData['crt_id']) return true;
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
public function itemFinish($data, $user){
|
|
|
if(empty($data['id'])) return [false, 'ID不能为空'];
|
|
|
$item = Item::where('id',$data['id'])
|
|
|
->where('del_time',0)
|
|
|
->first();
|
|
|
if(empty($item)) return [false, '项目不存在或已被删除'];
|
|
|
- if($item->state == Item::TYPE_THREE) return [false, '项目已完成,请勿重复操作'];
|
|
|
+ $oldData = $item->toArray();
|
|
|
+ if($oldData['state'] == Item::TYPE_THREE) return [false, '项目已完成,请勿重复操作'];
|
|
|
+
|
|
|
+ $bool = $this->changedCommon($user, $oldData);
|
|
|
+ if($bool) {
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
try {
|
|
|
DB::beginTransaction();
|
|
|
@@ -342,16 +355,17 @@ class ItemService extends Service
|
|
|
}
|
|
|
|
|
|
public function checkIsChanged($data, $user) {
|
|
|
- // 1. 获取旧数据
|
|
|
+ // 获取旧数据
|
|
|
list($status, $oldData) = $this->itemDetail($data, $user);
|
|
|
if (!$status) return [false, $oldData];
|
|
|
|
|
|
- //工时创建 直接通过
|
|
|
+ //工时修改 直接通过
|
|
|
$select_tree_type = $user['select_tree_type'];
|
|
|
if(empty($select_tree_type)) return false;
|
|
|
|
|
|
//创建人 直接通过
|
|
|
- if($user['id'] == $oldData['crt_id']) return false;
|
|
|
+ $bool = $this->changedCommon($user, $oldData);
|
|
|
+ if(! $bool) return false;
|
|
|
|
|
|
// --- 表头基础字段比对 ---
|
|
|
$fields = [
|
|
|
@@ -411,7 +425,7 @@ class ItemService extends Service
|
|
|
}
|
|
|
|
|
|
public function createDraft($data, $user, $type, $opt_type = 1) {
|
|
|
- unset($data['draft']);
|
|
|
+ if(isset($data['draft'])) unset($data['draft']);
|
|
|
Draft::insert([
|
|
|
'document_type' => $type,
|
|
|
'document_id' => $data['id'],
|
|
|
@@ -1145,7 +1159,8 @@ class ItemService extends Service
|
|
|
if (!$status) return [false, $oldData];
|
|
|
|
|
|
//创建人 直接通过
|
|
|
- if($user['id'] == $oldData['crt_id']) return false;
|
|
|
+ $bool = $this->changedCommon($user, $oldData);
|
|
|
+ if(! $bool) return false;
|
|
|
|
|
|
// --- 表头基础字段比对 ---
|
|
|
$fields = [
|
|
|
@@ -2286,7 +2301,8 @@ class ItemService extends Service
|
|
|
if (!$status) return [false, $oldData];
|
|
|
|
|
|
//创建人 直接通过
|
|
|
- if($user['id'] == $oldData['crt_id']) return false;
|
|
|
+ $bool = $this->changedCommon($user, $oldData);
|
|
|
+ if(! $bool) return false;
|
|
|
|
|
|
// --- 表头基础字段比对 ---
|
|
|
$fields = [
|