Jelajahi Sumber

绩效规则处理

林海涛 1 tahun lalu
induk
melakukan
be3e1e8a14

+ 0 - 2
app/adminapi/lists/master_worker/MasterWorkerLists.php

@@ -76,7 +76,6 @@ class MasterWorkerLists extends BaseAdminDataLists implements ListsSearchInterfa
     {
          return MasterWorker::alias('mw')
             ->join('master_worker_register mwr', 'mwr.worker_id = mw.id')
-            ->leftjoin('service_work sw','sw.master_worker_id = mw.id ')
             ->where($this->searchWhere)
             ->where($this->queryWhere())
              ->field([
@@ -101,7 +100,6 @@ class MasterWorkerLists extends BaseAdminDataLists implements ListsSearchInterfa
     {
         return MasterWorker::alias('mw')
             ->join('master_worker_register mwr', 'mwr.worker_id = mw.id')
-            ->leftjoin('service_work sw','sw.master_worker_id = mw.id ')
             ->field([
                 'mw.*'])
             ->where($this->searchWhere)->where($this->queryWhere())

+ 85 - 77
app/adminapi/lists/performance/PerformanceRulesLists.php

@@ -1,78 +1,86 @@
-<?php
-// +----------------------------------------------------------------------
-// | likeadmin快速开发前后端分离管理后台(PHP版)
-// +----------------------------------------------------------------------
-// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
-// | 开源版本可自由商用,可去除界面版权logo
-// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
-// | github下载:https://github.com/likeshop-github/likeadmin
-// | 访问官网:https://www.likeadmin.cn
-// | likeadmin团队 版权所有 拥有最终解释权
-// +----------------------------------------------------------------------
-// | author: likeadminTeam
-// +----------------------------------------------------------------------
-
-namespace app\adminapi\lists\performance;
-
-
-use app\adminapi\lists\BaseAdminDataLists;
-use app\common\model\performance\PerformanceRules;
-use app\common\lists\ListsSearchInterface;
-
-
-/**
- * PerformanceRules列表
- * Class PerformanceRulesLists
- * @package app\adminapi\listsperformance
- */
-class PerformanceRulesLists extends BaseAdminDataLists implements ListsSearchInterface
-{
-
-
-    /**
-     * @notes 设置搜索条件
-     * @return \string[][]
-     * @author likeadmin
-     * @date 2024/07/15 17:52
-     */
-    public function setSearch(): array
-    {
-        return [
-            '=' => ['type', 'create_time', 'update_time'],
-            '%like%' => ['goods_category_ids'],

-        ];
-    }
-
-
-    /**
-     * @notes 获取列表
-     * @return array
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @author likeadmin
-     * @date 2024/07/15 17:52
-     */
-    public function lists(): array
-    {
-        return PerformanceRules::where($this->searchWhere)
-            ->field(['id', 'goods_category_ids', 'type', 'rate', 'create_time', 'update_time'])
-            ->limit($this->limitOffset, $this->limitLength)
-            ->order(['id' => 'desc'])
-            ->select()
-            ->toArray();
-    }
-
-
-    /**
-     * @notes 获取数量
-     * @return int
-     * @author likeadmin
-     * @date 2024/07/15 17:52
-     */
-    public function count(): int
-    {
-        return PerformanceRules::where($this->searchWhere)->count();
-    }
-
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\lists\performance;
+
+
+use app\adminapi\lists\BaseAdminDataLists;
+use app\common\model\goods_category\GoodsCategory;
+use app\common\model\performance\PerformanceRules;
+use app\common\lists\ListsSearchInterface;
+
+
+/**
+ * PerformanceRules列表
+ * Class PerformanceRulesLists
+ * @package app\adminapi\listsperformance
+ */
+class PerformanceRulesLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+
+
+    /**
+     * @notes 设置搜索条件
+     * @return \string[][]
+     * @author likeadmin
+     * @date 2024/07/15 17:52
+     */
+    public function setSearch(): array
+    {
+        return [
+            '=' => ['type', 'create_time', 'update_time'],
+            '%like%' => ['goods_category_ids'],
+
+        ];
+    }
+
+
+    /**
+     * @notes 获取列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author likeadmin
+     * @date 2024/07/15 17:52
+     */
+    public function lists(): array
+    {
+        $data = PerformanceRules::where($this->searchWhere)
+            ->field(['id', 'goods_category_ids', 'type', 'rate', 'create_time', 'update_time'])
+            ->limit($this->limitOffset, $this->limitLength)
+            ->order(['id' => 'desc'])
+            ->select()
+            ->toArray();
+        $goodsCategoryObj = GoodsCategory::where(['status'=>1])->order(['pid' => 'asc','weigh' => 'desc', 'id' => 'desc'])
+                        ->select();
+        foreach ($data as &$datum) {
+            $datum['goods_category_ids_str_arr'] = $goodsCategoryObj->whereIn('id',$datum['goods_category_ids'])->column('name');
+        }
+        return $data;
+    }
+
+
+    /**
+     * @notes 获取数量
+     * @return int
+     * @author likeadmin
+     * @date 2024/07/15 17:52
+     */
+    public function count(): int
+    {
+        return PerformanceRules::where($this->searchWhere)->count();
+    }
+
 }

+ 2 - 2
app/adminapi/lists/works/ServiceWorkLists.php

@@ -40,7 +40,7 @@ class ServiceWorkLists extends BaseAdminDataLists implements ListsSearchInterfac
     public function setSearch(): array
     {
         return [
-            '=' => ['work_sn', 'real_name', 'mobile', 'address', 'title', 'category_type', 'base_service_fee', 'service_fee', 'work_status', 'service_status',  'finished_images', 'master_worker_id', 'work_amount'],
+            '=' => ['work_sn', 'real_name', 'mobile', 'address', 'title', 'category_type', 'base_service_fee', 'service_fee', 'work_status', 'service_status',  'finished_images', 'master_worker_id', 'work_amount','work_type'],
 
         ];
     }
@@ -110,7 +110,7 @@ class ServiceWorkLists extends BaseAdminDataLists implements ListsSearchInterfac
         ])
             ->where($this->searchWhere)
             ->where($this->queryWhere())
-            ->field(['id', 'work_sn', 'real_name', 'mobile', 'address', 'title', 'category_type', 'goods_category_ids', 'goods_category_id', 'base_service_fee', 'service_fee', 'work_status', 'service_status', 'dispatch_time', 'receive_time', 'appointment_time', 'finished_images', 'finished_time', 'master_worker_id', 'work_amount', 'create_time', 'update_time'])
+            ->field(['id', 'work_sn', 'real_name', 'mobile', 'address', 'title', 'category_type', 'goods_category_ids', 'goods_category_id', 'base_service_fee', 'service_fee', 'work_status', 'service_status', 'dispatch_time', 'receive_time', 'appointment_time', 'finished_images', 'finished_time', 'master_worker_id', 'work_amount', 'work_type', 'create_time', 'update_time'])
             ->limit($this->limitOffset, $this->limitLength)
             ->order(['id' => 'desc'])
             ->select()

+ 10 - 1
app/common/model/performance/PerformanceRules.php

@@ -30,5 +30,14 @@ class PerformanceRules extends BaseModel
     protected $name = 'performance_rules';
     protected $deleteTime = 'delete_time';
 
-    
+    public function getGoodsCategoryIdsAttr($value)
+    {
+        $data =  empty($value) ? [] : explode(',', $value);
+        return array_map("intval", $data);
+    }
+
+    public function setGoodsCategoryIdsAttr($value)
+    {
+        return empty($value) ? null : implode(',', $value);
+    }
 }