Skip to content

Commit

Permalink
You can edit the notes of the historical version of the page / 可以编辑页面…
Browse files Browse the repository at this point in the history
…历史版本的备注信息
  • Loading branch information
star7th committed Apr 11, 2021
1 parent 4f20398 commit 8209db2
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 8 deletions.
19 changes: 19 additions & 0 deletions server/Application/Api/Controller/PageController.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,25 @@ public function history(){

}


// 更新历史备注信息
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(){
$page_id = I("page_id/d");
Expand Down
44 changes: 38 additions & 6 deletions web_src/src/components/page/edit/HistoryVersion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,42 @@
:close-on-click-modal="false"
>
<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">
<template slot-scope="scope">
<el-button
@click="preview_diff(scope.row)"
type="text"
size="small"
>{{$t('overview')}}</el-button>
>{{ $t('overview') }}</el-button
>
<el-button
v-if="is_show_recover_btn"
type="text"
size="small"
@click="recover(scope.row)"
>{{$t('recover_to_this_version')}}</el-button>
>{{ $t('recover_to_this_version') }}</el-button
>
</template>
</el-table-column>
</el-table>
Expand All @@ -36,8 +57,7 @@
</div>
</template>

<style>
</style>
<style></style>

<script>
export default {
Expand Down Expand Up @@ -97,6 +117,18 @@ export default {
let page_id = this.page_id ? this.page_id : this.$route.params.page_id
var url = '#/page/diff/' + page_id + '/' + page_history_id
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() {}
Expand Down
3 changes: 2 additions & 1 deletion web_src/static/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ exports.default = {

copy_or_mv_cat: 'Copy or move catalog',
copy_to: 'Copy To',
move_to: 'Move To'
move_to: 'Move To',
remark: 'remark'

}
3 changes: 2 additions & 1 deletion web_src/static/lang/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,5 +410,6 @@ exports.default = {

copy_or_mv_cat: '复制或移动目录',
copy_to: '复制到',
move_to: '移动到'
move_to: '移动到',
remark: '备注'
}

0 comments on commit 8209db2

Please sign in to comment.