Pārlūkot izejas kodu

周报可以快速选择上次发送的人

kuaifan 5 gadi atpakaļ
vecāks
revīzija
5ad2a05136

+ 29 - 0
app/Http/Controllers/Api/ReportController.php

@@ -350,4 +350,33 @@ class ReportController extends Controller
         }
         return Base::retSuccess('success', $lists);
     }
+
+    /**
+     * 获取我上次抄送的人
+     * @return array|mixed
+     */
+    public function prevcc()
+    {
+        $user = Users::authE();
+        if (Base::isError($user)) {
+            return $user;
+        } else {
+            $user = $user['data'];
+        }
+        //
+        $rid = DB::table('report_ccuser')
+            ->join('report_lists', 'report_lists.id', '=', 'report_ccuser.rid')
+            ->where('report_lists.username', $user['username'])
+            ->value('rid');
+        if (empty($rid)) {
+            return Base::retError('没有相关数据!');
+        }
+        $lists = Base::DBC2A(DB::table('report_ccuser')->select(['username'])->where('rid', $rid)->pluck('username'));
+        if (empty($lists)) {
+            return Base::retError('没有相关数据!');
+        }
+        return Base::retSuccess('success', [
+            'lists' => $lists
+        ]);
+    }
 }

+ 28 - 0
resources/assets/js/main/components/report/add.vue

@@ -13,6 +13,7 @@
             <t-editor class="add-edit" v-model="dataDetail.content" height="100%"></t-editor>
             <div class="add-input">
                 <UserInput v-model="dataDetail.ccuser" :nousername="$A.getUserName()" :placeholder="$L('输入关键词搜索')" multiple><span slot="prepend">{{$L('抄送人')}}</span></UserInput>
+                <div class="add-prev-btn" @click="getPrevCc">{{$L('使用我上次抄送的人')}}</div>
             </div>
             <div class="add-footer">
                 <Button :loading="loadIng > 0" type="primary" @click="handleSubmit" style="margin-right:6px">{{$L('保存')}}</Button>
@@ -56,6 +57,16 @@
         .add-footer {
             margin-top: 14px;
         }
+        .add-prev-btn {
+            cursor: pointer;
+            opacity: 0.9;
+            margin-top: 8px;
+            text-decoration: underline;
+            &:hover {
+                opacity: 1;
+                color: #2d8cf0;
+            }
+        }
     }
 </style>
 <script>
@@ -146,6 +157,23 @@
                 });
             },
 
+            getPrevCc() {
+                this.loadIng++;
+                $A.apiAjax({
+                    url: 'report/prevcc',
+                    complete: () => {
+                        this.loadIng--;
+                    },
+                    success: (res) => {
+                        if (res.ret === 1) {
+                            this.dataDetail.ccuser = res.data.lists.join(',');
+                        } else {
+                            this.$Modal.error({title: this.$L('温馨提示'), content: res.msg});
+                        }
+                    }
+                });
+            },
+
             handleSubmit(send = false) {
                 this.loadIng++;
                 $A.apiAjax({

+ 1 - 0
resources/lang/en/general.js

@@ -511,4 +511,5 @@ export default {
     "拖动到这里发送给 %": "Send to drag%",
     "全部任务": "All tasks",
     "我负责的任务": "I am responsible for the task",
+    "使用我上次抄送的人": "Use the person I cc'd last time",
 }