kuaifan 5 лет назад
Родитель
Сommit
d24ac1d41f

+ 15 - 1
app/Http/Controllers/Api/ReportController.php

@@ -27,7 +27,21 @@ class ReportController extends Controller
     }
 
     /**
-     * 获取
+     * 获取内容
+     *
+     * @apiParam {Number} id           数据ID
+     */
+    public function content()
+    {
+        $row = Base::DBC2A(DB::table('report_content')->select(['rid', 'content'])->where('rid', intval(Request::input('id')))->first());
+        if (empty($row)) {
+            return Base::retError('内容不存在或已被删除!');
+        }
+        return Base::retSuccess('success', $row);
+    }
+
+    /**
+     * 获取模板、保存、发送、删除
      *
      * @apiParam {String} type           类型
      * - 日报

+ 1 - 0
package.json

@@ -2,6 +2,7 @@
     "private": true,
     "scripts": {
         "ide-helper": "php artisan ide-helper:generate",
+        "laravels-start": "php bin/laravels start",
         "dev": "npm run development",
         "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
         "watch": "npm run development -- --watch",

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

@@ -16,7 +16,7 @@
             </div>
             <div class="add-footer">
                 <Button :loading="loadIng > 0" type="primary" @click="handleSubmit" style="margin-right:6px">保 存</Button>
-                <Button v-if="dataDetail.status=='已发送'" :loading="loadIng > 0" type="success" icon="md-checkmark-circle-outline" ghost @click="handleSubmit(true)">已保存发送</Button>
+                <Button v-if="dataDetail.status=='已发送'" :loading="loadIng > 0" type="success" icon="md-checkmark-circle-outline" ghost @click="handleSubmit(true)">已发送</Button>
                 <Button v-else :loading="loadIng > 0" @click="handleSubmit(true)">保存并发送</Button>
             </div>
         </div>

+ 52 - 0
resources/assets/js/main/components/report/content.vue

@@ -0,0 +1,52 @@
+<template>
+    <iframe class="report-content" :style="{height: contentHeight + 'px'}"></iframe>
+</template>
+
+<style lang="scss" scoped>
+    .report-content {
+        background: 0 0;
+        border: 0;
+        float: none;
+        margin: 6px 0;
+        max-width: none;
+        outline: 0;
+        padding: 0;
+        position: static;
+        width: 100%;
+    }
+</style>
+<script>
+    /**
+     * 预览内容
+     */
+    export default {
+        name: 'ReportContent',
+        props: {
+            content: {
+                default: ''
+            },
+        },
+        data() {
+            return {
+                contentHeight: 50,
+            }
+        },
+        mounted() {
+            this.setContent(this.content);
+        },
+        watch: {
+            content(val) {
+                this.setContent(val);
+            }
+        },
+        methods: {
+            setContent(val) {
+                let $d = this.$el.contentWindow.document;
+                $A("body", $d).html('<link type="text/css" rel="stylesheet" href="' + window.location.origin + '/js/build/skins/ui/oxide/content.min.css"><style>html,body{padding:0;margin:0}</style><div id="content">' + val + '</div>');
+                this.$nextTick(() => {
+                    this.contentHeight = $d.getElementById("content").scrollHeight;
+                });
+            }
+        }
+    }
+</script>

+ 36 - 1
resources/assets/js/main/components/report/my.vue

@@ -11,6 +11,14 @@
         <Drawer v-model="addDrawerShow" width="70%">
             <report-add :canload="addDrawerShow" :id="addDrawerId" @on-success="addDrawerSuccess"></report-add>
         </Drawer>
+        <Modal
+            v-model="contentShow"
+            :title="contentTitle"
+            width="80%"
+            :styles="{top: '35px', paddingBottom: '35px'}"
+            footerHide>
+            <report-content :content="contentText"></report-content>
+        </Modal>
     </drawer-tabs-container>
 </template>
 
@@ -25,13 +33,14 @@
 <script>
     import DrawerTabsContainer from "../DrawerTabsContainer";
     import ReportAdd from "./add";
+    import ReportContent from "./content";
 
     /**
      * 我的汇报
      */
     export default {
         name: 'ReportMy',
-        components: {ReportAdd, DrawerTabsContainer},
+        components: {ReportContent, ReportAdd, DrawerTabsContainer},
         props: {
             canload: {
                 type: Boolean,
@@ -53,6 +62,10 @@
 
                 addDrawerId: 0,
                 addDrawerShow: false,
+
+                contentShow: false,
+                contentTitle: '',
+                contentText: '内容加载中.....',
             }
         },
         created() {
@@ -88,6 +101,7 @@
                         style: {padding: '0 2px', fontSize: '12px'},
                         on: {
                             click: () => {
+                                this.contentReport(params.row);
                             }
                         }
                     }, '查看'));
@@ -188,6 +202,27 @@
                 this.getLists(true);
             },
 
+            contentReport(row) {
+                this.contentShow = true;
+                this.contentTitle = row.title;
+                this.contentText = '详细内容加载中.....';
+                $A.aAjax({
+                    url: 'report/content?id=' + row.id,
+                    error: () => {
+                        alert(this.$L('网络繁忙,请稍后再试!'));
+                        this.contentShow = false;
+                    },
+                    success: (res) => {
+                        if (res.ret === 1) {
+                            this.contentText = res.data.content;
+                        } else {
+                            this.contentShow = false;
+                            this.$Modal.error({title: this.$L('温馨提示'), content: res.msg});
+                        }
+                    }
+                });
+            },
+
             sendReport(row) {
                 this.$Modal.confirm({
                     title: '发送汇报',

+ 43 - 4
resources/assets/js/main/components/report/receive.vue

@@ -1,7 +1,6 @@
 <template>
     <drawer-tabs-container>
         <div class="report-receive">
-
             <!-- 搜索 -->
             <Row class="sreachBox">
                 <div class="item">
@@ -33,8 +32,15 @@
 
             <!-- 分页 -->
             <Page class="pageBox" :total="listTotal" :current="listPage" :disabled="loadIng > 0" @on-change="setPage" @on-page-size-change="setPageSize" :page-size-opts="[10,20,30,50,100]" placement="top" show-elevator show-sizer show-total transfer></Page>
-
         </div>
+        <Modal
+            v-model="contentShow"
+            :title="contentTitle"
+            width="80%"
+            :styles="{top: '35px', paddingBottom: '35px'}"
+            footerHide>
+            <report-content :content="contentText"></report-content>
+        </Modal>
     </drawer-tabs-container>
 </template>
 <style lang="scss" scoped>
@@ -48,13 +54,14 @@
 
 <script>
     import DrawerTabsContainer from "../DrawerTabsContainer";
+    import ReportContent from "./content";
 
     /**
      * 收到的汇报
      */
     export default {
         name: 'ReportReceive',
-        components: {DrawerTabsContainer},
+        components: {ReportContent, DrawerTabsContainer},
         props: {
             canload: {
                 type: Boolean,
@@ -79,6 +86,10 @@
                 listPage: 1,
                 listTotal: 0,
                 noDataText: "数据加载中.....",
+
+                contentShow: false,
+                contentTitle: '',
+                contentText: '内容加载中.....',
             }
         },
 
@@ -111,7 +122,14 @@
                 "width": 80,
                 "align": 'center',
                 render: (h, params) => {
-                    return h('a', '查看');
+                    return h('a', {
+                        style: {padding: '0 2px', fontSize: '12px'},
+                        on: {
+                            click: () => {
+                                this.contentReport(params.row);
+                            }
+                        }
+                    }, '查看');
                 }
             }];
         },
@@ -189,6 +207,27 @@
                     }
                 });
             },
+
+            contentReport(row) {
+                this.contentShow = true;
+                this.contentTitle = row.title;
+                this.contentText = '详细内容加载中.....';
+                $A.aAjax({
+                    url: 'report/content?id=' + row.id,
+                    error: () => {
+                        alert(this.$L('网络繁忙,请稍后再试!'));
+                        this.contentShow = false;
+                    },
+                    success: (res) => {
+                        if (res.ret === 1) {
+                            this.contentText = res.data.content;
+                        } else {
+                            this.contentShow = false;
+                            this.$Modal.error({title: this.$L('温馨提示'), content: res.msg});
+                        }
+                    }
+                });
+            },
         }
     }
 </script>