Browse Source

You can edit the notes of the historical version of the page / 可以编辑页面历史版本的备注信息

star7th 4 years ago
parent
commit
8209db271d

+ 19 - 0
server/Application/Api/Controller/PageController.class.php

@@ -181,6 +181,25 @@ class PageController extends BaseController {
 
 
     }
     }
 
 
+
+    // 更新历史备注信息
+    public function updateHistoryComments(){
+        $login_user = $this->checkLogin(false);
+        $page_id = I("page_id/d") ? I("page_id/d") : 0 ;
+        $page_comments = I("page_comments") ;
+        $page_history_id = I("page_history_id/d") ? I("page_history_id/d") : 0 ;
+        $page = M("Page")->where(" page_id = '$page_id' ")->find();
+        if (!$this->checkItemPermn($login_user['uid'] , $page['item_id'])) {
+            $this->sendError(10103);
+            return;
+        }
+        $res = D("PageHistory")->where(" page_history_id = '$page_history_id' ")->save(array(
+            "page_comments"=>$page_comments
+        ));
+        $this->sendResult($res);
+    }
+
+
     //返回当前页面和历史某个版本的页面以供比较
     //返回当前页面和历史某个版本的页面以供比较
     public function diff(){
     public function diff(){
         $page_id = I("page_id/d");
         $page_id = I("page_id/d");

+ 38 - 6
web_src/src/components/page/edit/HistoryVersion.vue

@@ -11,21 +11,42 @@
         :close-on-click-modal="false"
         :close-on-click-modal="false"
       >
       >
         <el-table :data="content">
         <el-table :data="content">
-          <el-table-column property="addtime" :label="$t('update_time')" width="170"></el-table-column>
-          <el-table-column property="author_username" :label="$t('update_by_who')"></el-table-column>
+          <el-table-column
+            property="addtime"
+            :label="$t('update_time')"
+            width="170"
+          ></el-table-column>
+          <el-table-column
+            property="author_username"
+            :label="$t('update_by_who')"
+          ></el-table-column>
+          <el-table-column property="page_comments" :label="$t('remark')">
+            <template slot-scope="scope">
+              {{ scope.row.page_comments }}
+              <el-button
+                v-if="is_show_recover_btn"
+                @click="editComments(scope.row)"
+                type="text"
+                size="small"
+                >{{ $t('edit') }}</el-button
+              >
+            </template>
+          </el-table-column>
           <el-table-column label="操作" width="150">
           <el-table-column label="操作" width="150">
             <template slot-scope="scope">
             <template slot-scope="scope">
               <el-button
               <el-button
                 @click="preview_diff(scope.row)"
                 @click="preview_diff(scope.row)"
                 type="text"
                 type="text"
                 size="small"
                 size="small"
-              >{{$t('overview')}}</el-button>
+                >{{ $t('overview') }}</el-button
+              >
               <el-button
               <el-button
                 v-if="is_show_recover_btn"
                 v-if="is_show_recover_btn"
                 type="text"
                 type="text"
                 size="small"
                 size="small"
                 @click="recover(scope.row)"
                 @click="recover(scope.row)"
-              >{{$t('recover_to_this_version')}}</el-button>
+                >{{ $t('recover_to_this_version') }}</el-button
+              >
             </template>
             </template>
           </el-table-column>
           </el-table-column>
         </el-table>
         </el-table>
@@ -36,8 +57,7 @@
   </div>
   </div>
 </template>
 </template>
 
 
-<style>
-</style>
+<style></style>
 
 
 <script>
 <script>
 export default {
 export default {
@@ -97,6 +117,18 @@ export default {
       let page_id = this.page_id ? this.page_id : this.$route.params.page_id
       let page_id = this.page_id ? this.page_id : this.$route.params.page_id
       var url = '#/page/diff/' + page_id + '/' + page_history_id
       var url = '#/page/diff/' + page_id + '/' + page_history_id
       window.open(url)
       window.open(url)
+    },
+    editComments(row) {
+      let page_id = this.page_id ? this.page_id : this.$route.params.page_id
+      this.$prompt('', ' ', {}).then(data => {
+        this.request('/api/page/updateHistoryComments', {
+          page_id: page_id,
+          page_history_id: row.page_history_id,
+          page_comments: data.value
+        }).then(() => {
+          this.get_content()
+        })
+      })
     }
     }
   },
   },
   mounted() {}
   mounted() {}

+ 2 - 1
web_src/static/lang/en.js

@@ -420,6 +420,7 @@ exports.default = {
 
 
   copy_or_mv_cat: 'Copy or move catalog',
   copy_or_mv_cat: 'Copy or move catalog',
   copy_to: 'Copy To',
   copy_to: 'Copy To',
-  move_to: 'Move To'
+  move_to: 'Move To',
+  remark: 'remark'
 
 
 }
 }

+ 2 - 1
web_src/static/lang/zh-CN.js

@@ -410,5 +410,6 @@ exports.default = {
 
 
   copy_or_mv_cat: '复制或移动目录',
   copy_or_mv_cat: '复制或移动目录',
   copy_to: '复制到',
   copy_to: '复制到',
-  move_to: '移动到'
+  move_to: '移动到',
+  remark: '备注'
 }
 }