|
|
|
@ -1,195 +1,224 @@ |
|
|
|
|
<template> |
|
|
|
|
<div> |
|
|
|
|
<el-card shadow="hover" class="mgb20"> |
|
|
|
|
<div class="flex-between"> |
|
|
|
|
<div class="per_title" v-preventReClick @click="$router.back()"> |
|
|
|
|
<i class="el-icon-arrow-left"></i> |
|
|
|
|
<span class="per_back">返回</span> |
|
|
|
|
<span class="per_school">{{ platformName }}日志管理</span> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</el-card> |
|
|
|
|
<div class="page"> |
|
|
|
|
<div class="inner"> |
|
|
|
|
<div class="tool"> |
|
|
|
|
<div class="filters"> |
|
|
|
|
<h6>日志更新</h6> |
|
|
|
|
<div class="filter"> |
|
|
|
|
<label>版本查询</label> |
|
|
|
|
<el-select v-model="versionName" size="small" placeholder="请选择版本" filterable @change="verChange"> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in vers" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item.id"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div> |
|
|
|
|
<el-button type="primary" @click="add" v-auth="'/system:日志更新:管理:新增日志'">新增日志</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<el-timeline class="timeline"> |
|
|
|
|
<el-timeline-item placement="top" v-for="(item, i) in listData" :key="i" :class="['item' + i, {draft: item.draft}]"> |
|
|
|
|
<p class="sign">{{ item.draft ? '未发布' : item.draftTime }}</p> |
|
|
|
|
<div class="ver"> |
|
|
|
|
<div> |
|
|
|
|
{{ item.versionName + (item.draft ? '(草稿)' : '') }} |
|
|
|
|
<span class="action"> |
|
|
|
|
<i class="el-icon-edit-outline" @click="edit(item)" v-auth="'/system:日志更新:管理:编辑日志'"></i> |
|
|
|
|
<i class="el-icon-delete" @click="del(item)" v-auth="'/system:日志更新:管理:删除日志'"></i> |
|
|
|
|
</span> |
|
|
|
|
</div> |
|
|
|
|
<div> |
|
|
|
|
<template v-if="!i && item.withdrawNum !== 1 && item.draft !== 1"> |
|
|
|
|
<span class="withdraw" v-if="item.withdraw && item.open">已撤回</span> |
|
|
|
|
<el-button v-else style="margin-right: 10px" type="primary" size="small" @click="revoke(item)">撤销</el-button> |
|
|
|
|
</template> |
|
|
|
|
<el-switch v-model="item.open" :active-value="0" :inactive-value="1" @change="switchOff($event, item)" v-auth="'/system:日志更新:管理:开启日志'"></el-switch> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<ul class="detail"> |
|
|
|
|
<li v-for="(item, i) in item.logContents" :key="i"> |
|
|
|
|
<p class="name"><img :src="require('@/assets/img/' + funcList.find(e => e.id === item.type).icon + '.png')" alt=""> {{ funcList.find(e => e.id === item.type).name }}</p> |
|
|
|
|
<div class="val"> |
|
|
|
|
<p class="" v-for="(item, i) in item.content" :key="i">{{ item }}</p> |
|
|
|
|
</div> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
</el-timeline-item> |
|
|
|
|
</el-timeline> |
|
|
|
|
<div> |
|
|
|
|
<el-card shadow="hover" |
|
|
|
|
class="mgb20"> |
|
|
|
|
<div class="flex-between"> |
|
|
|
|
<div class="per_title" |
|
|
|
|
v-preventReClick |
|
|
|
|
@click="$router.back()"> |
|
|
|
|
<i class="el-icon-arrow-left"></i> |
|
|
|
|
<span class="per_back">返回</span> |
|
|
|
|
<span class="per_school">{{ platformName }}日志管理</span> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</el-card> |
|
|
|
|
<div class="page"> |
|
|
|
|
<div class="inner"> |
|
|
|
|
<div class="tool"> |
|
|
|
|
<div class="filters"> |
|
|
|
|
<h6>日志更新</h6> |
|
|
|
|
<div class="filter"> |
|
|
|
|
<label>版本查询</label> |
|
|
|
|
<el-select v-model="versionName" |
|
|
|
|
size="small" |
|
|
|
|
placeholder="请选择版本" |
|
|
|
|
filterable |
|
|
|
|
@change="verChange"> |
|
|
|
|
<el-option v-for="item in vers" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item.id"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div> |
|
|
|
|
<el-button type="primary" |
|
|
|
|
@click="add" |
|
|
|
|
v-auth="'/system:日志更新:管理:新增日志'">新增日志</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<el-timeline class="timeline"> |
|
|
|
|
<el-timeline-item placement="top" |
|
|
|
|
v-for="(item, i) in listData" |
|
|
|
|
:key="i" |
|
|
|
|
:class="['item' + i, {draft: item.draft}]"> |
|
|
|
|
<p class="sign">{{ item.draft ? '未发布' : item.draftTime }}</p> |
|
|
|
|
<div class="ver"> |
|
|
|
|
<div> |
|
|
|
|
{{ item.versionName + (item.draft ? '(草稿)' : '') }} |
|
|
|
|
<span class="action"> |
|
|
|
|
<i class="el-icon-edit-outline" |
|
|
|
|
@click="edit(item)" |
|
|
|
|
v-auth="'/system:日志更新:管理:编辑日志'"></i> |
|
|
|
|
<i class="el-icon-delete" |
|
|
|
|
@click="del(item)" |
|
|
|
|
v-auth="'/system:日志更新:管理:删除日志'"></i> |
|
|
|
|
</span> |
|
|
|
|
</div> |
|
|
|
|
<div> |
|
|
|
|
<template v-if="!i && item.withdrawNum !== 1 && item.draft !== 1"> |
|
|
|
|
<span class="withdraw" |
|
|
|
|
v-if="item.withdraw && item.open">已撤回</span> |
|
|
|
|
<el-button v-else |
|
|
|
|
style="margin-right: 10px" |
|
|
|
|
type="primary" |
|
|
|
|
size="small" |
|
|
|
|
@click="revoke(item)">撤销</el-button> |
|
|
|
|
</template> |
|
|
|
|
<el-switch v-model="item.open" |
|
|
|
|
:active-value="0" |
|
|
|
|
:inactive-value="1" |
|
|
|
|
@change="switchOff($event, item)" |
|
|
|
|
v-auth="'/system:日志更新:管理:开启日志'"></el-switch> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<ul class="detail"> |
|
|
|
|
<li v-for="(item, i) in item.logContents" |
|
|
|
|
:key="i"> |
|
|
|
|
<p v-if="!isNaN(item.type)" |
|
|
|
|
class="name"><img :src="require('@/assets/img/' + funcList.find(e => e.id === item.type).icon + '.png')" |
|
|
|
|
alt=""> {{ funcList.find(e => e.id === item.type).name }}</p> |
|
|
|
|
<div class="val"> |
|
|
|
|
<p class="" |
|
|
|
|
v-for="(item, i) in item.content" |
|
|
|
|
:key="i">{{ item }}</p> |
|
|
|
|
</div> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
</el-timeline-item> |
|
|
|
|
</el-timeline> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import Setting from '@/setting' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
platformId: this.$route.query.platformId, |
|
|
|
|
platformName: '', |
|
|
|
|
versionName: '', |
|
|
|
|
vers: [], |
|
|
|
|
listData: [], |
|
|
|
|
funcList: [ |
|
|
|
|
{ |
|
|
|
|
id: 0, |
|
|
|
|
name: '新功能', |
|
|
|
|
icon: 'func' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '修复', |
|
|
|
|
icon: 'bug' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 2, |
|
|
|
|
name: '优化', |
|
|
|
|
icon: 'optimize' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 获取列表 |
|
|
|
|
getData() { |
|
|
|
|
this.$get(`${this.api.platformLogList}?platformId=${this.platformId}&versionName=${this.versionName}`).then(res => { |
|
|
|
|
const { logList } = res |
|
|
|
|
this.listData = logList |
|
|
|
|
if (logList.length) { |
|
|
|
|
const vers = [] |
|
|
|
|
const platformName = Setting.platformList.find(e => e.id === logList[0].platformId).name |
|
|
|
|
this.platformName = platformName |
|
|
|
|
logList.map((e, i) => { |
|
|
|
|
e.logContents.map(n => { |
|
|
|
|
n.content = n.content.split('\n') |
|
|
|
|
}) |
|
|
|
|
vers.push({ |
|
|
|
|
id: i, |
|
|
|
|
name: e.versionName |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.vers = vers |
|
|
|
|
} |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 新增日志 |
|
|
|
|
add() { |
|
|
|
|
if (this.listData.find(e => e.draft)) { |
|
|
|
|
this.$confirm("当前有未发布的版本,是否要新增版本?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$router.push(`/addLog?platformId=${this.platformId}`) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
} else { |
|
|
|
|
this.$router.push(`/addLog?platformId=${this.platformId}`) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 编辑 |
|
|
|
|
edit(item) { |
|
|
|
|
this.$router.push(`/addLog?platformId=${this.platformId}&id=${item.logId}&draft=${item.draft}`) |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
|
platformId: this.$route.query.platformId, |
|
|
|
|
platformName: '', |
|
|
|
|
versionName: '', |
|
|
|
|
vers: [], |
|
|
|
|
listData: [], |
|
|
|
|
funcList: [ |
|
|
|
|
{ |
|
|
|
|
id: 0, |
|
|
|
|
name: '新功能', |
|
|
|
|
icon: 'func' |
|
|
|
|
}, |
|
|
|
|
// 删除日志 |
|
|
|
|
del(item) { |
|
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(`${this.api.logDel}?logId=${item.logId}`).then(res => { |
|
|
|
|
this.$message.success("删除成功") |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '修复', |
|
|
|
|
icon: 'bug' |
|
|
|
|
}, |
|
|
|
|
// 撤销 |
|
|
|
|
revoke(item) { |
|
|
|
|
this.$confirm("确定要撤销吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$get(`${this.api.logWithdrawal}?platformId=${this.platformId}&logId=${item.logId}`).then(res => { |
|
|
|
|
this.$message.success('撤销成功') |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
}, |
|
|
|
|
changeStatus(logId, open, draft) { |
|
|
|
|
this.$post(this.api.listUpdate, { |
|
|
|
|
logId, |
|
|
|
|
open, |
|
|
|
|
draft |
|
|
|
|
}).then(res => { |
|
|
|
|
this.$message.success(open ? '禁用成功' : '启用成功') |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 禁用启用 |
|
|
|
|
switchOff(val, row) { |
|
|
|
|
const logId = row.logId |
|
|
|
|
if (row.draft && !val) { |
|
|
|
|
this.$confirm('是否要发布该日志?', '提示', { |
|
|
|
|
type: 'success' |
|
|
|
|
}).then(() => { |
|
|
|
|
this.changeStatus(logId, val, 0) |
|
|
|
|
}).catch(() => { |
|
|
|
|
this.changeStatus(logId, val, 1) |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
this.changeStatus(logId, val, row.draft) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 版本切换 |
|
|
|
|
verChange(i) { |
|
|
|
|
window.scrollTo({ |
|
|
|
|
top: document.querySelector(`.item${i}`).offsetTop, |
|
|
|
|
behavior: 'smooth' |
|
|
|
|
{ |
|
|
|
|
id: 2, |
|
|
|
|
name: '优化', |
|
|
|
|
icon: 'optimize' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 获取列表 |
|
|
|
|
getData () { |
|
|
|
|
this.$get(`${this.api.platformLogList}?platformId=${this.platformId}&versionName=${this.versionName}`).then(res => { |
|
|
|
|
const { logList } = res |
|
|
|
|
this.listData = logList |
|
|
|
|
if (logList.length) { |
|
|
|
|
const vers = [] |
|
|
|
|
const platformName = Setting.platformList.find(e => e.id === logList[0].platformId).name |
|
|
|
|
this.platformName = platformName |
|
|
|
|
logList.map((e, i) => { |
|
|
|
|
e.logContents.map(n => { |
|
|
|
|
n.content = n.content.split('\n') |
|
|
|
|
}) |
|
|
|
|
vers.push({ |
|
|
|
|
id: i, |
|
|
|
|
name: e.versionName |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.vers = vers |
|
|
|
|
} |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
// 新增日志 |
|
|
|
|
add () { |
|
|
|
|
if (this.listData.find(e => e.draft)) { |
|
|
|
|
this.$confirm("当前有未发布的版本,是否要新增版本?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$router.push(`/addLog?platformId=${this.platformId}`) |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
} else { |
|
|
|
|
this.$router.push(`/addLog?platformId=${this.platformId}`) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 编辑 |
|
|
|
|
edit (item) { |
|
|
|
|
this.$router.push(`/addLog?platformId=${this.platformId}&id=${item.logId}&draft=${item.draft}`) |
|
|
|
|
}, |
|
|
|
|
// 删除日志 |
|
|
|
|
del (item) { |
|
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(`${this.api.logDel}?logId=${item.logId}`).then(res => { |
|
|
|
|
this.$message.success("删除成功") |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
}, |
|
|
|
|
// 撤销 |
|
|
|
|
revoke (item) { |
|
|
|
|
this.$confirm("确定要撤销吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$get(`${this.api.logWithdrawal}?platformId=${this.platformId}&logId=${item.logId}`).then(res => { |
|
|
|
|
this.$message.success('撤销成功') |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
}, |
|
|
|
|
changeStatus (logId, open, draft) { |
|
|
|
|
this.$post(this.api.listUpdate, { |
|
|
|
|
logId, |
|
|
|
|
open, |
|
|
|
|
draft |
|
|
|
|
}).then(res => { |
|
|
|
|
this.$message.success(open ? '禁用成功' : '启用成功') |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
// 禁用启用 |
|
|
|
|
switchOff (val, row) { |
|
|
|
|
const logId = row.logId |
|
|
|
|
if (row.draft && !val) { |
|
|
|
|
this.$confirm('是否要发布该日志?', '提示', { |
|
|
|
|
type: 'success' |
|
|
|
|
}).then(() => { |
|
|
|
|
this.changeStatus(logId, val, 0) |
|
|
|
|
}).catch(() => { |
|
|
|
|
this.changeStatus(logId, val, 1) |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
this.changeStatus(logId, val, row.draft) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 版本切换 |
|
|
|
|
verChange (i) { |
|
|
|
|
window.scrollTo({ |
|
|
|
|
top: document.querySelector(`.item${i}`).offsetTop, |
|
|
|
|
behavior: 'smooth' |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
<style lang="scss" scoped> |
|
|
|
@ -218,25 +247,26 @@ export default { |
|
|
|
|
padding-left: 20%; |
|
|
|
|
overflow: hidden; |
|
|
|
|
.el-timeline-item__node--normal { |
|
|
|
|
top: 30px; |
|
|
|
|
top: 30px; |
|
|
|
|
} |
|
|
|
|
.el-timeline-item__wrapper { |
|
|
|
|
top: 15px; |
|
|
|
|
padding-left: 40px; |
|
|
|
|
top: 15px; |
|
|
|
|
padding-left: 40px; |
|
|
|
|
} |
|
|
|
|
.el-timeline-item__tail { |
|
|
|
|
height: 250%; |
|
|
|
|
border-left-width: 1px; |
|
|
|
|
height: 250%; |
|
|
|
|
border-left-width: 1px; |
|
|
|
|
} |
|
|
|
|
.sign { |
|
|
|
|
position: relative; |
|
|
|
|
display: inline-block; |
|
|
|
|
margin-left: -22%; |
|
|
|
|
font-size: 14px; |
|
|
|
|
color: #9076FF; |
|
|
|
|
color: #9076ff; |
|
|
|
|
} |
|
|
|
|
.draft { |
|
|
|
|
.ver, .sign { |
|
|
|
|
.ver, |
|
|
|
|
.sign { |
|
|
|
|
color: #b1b1b1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -247,23 +277,23 @@ export default { |
|
|
|
|
padding-bottom: 10px; |
|
|
|
|
margin: -19px 0 20px; |
|
|
|
|
font-size: 18px; |
|
|
|
|
color: #9076FF; |
|
|
|
|
color: #9076ff; |
|
|
|
|
border-bottom: 1px dashed #bfbfbf; |
|
|
|
|
} |
|
|
|
|
.withdraw { |
|
|
|
|
margin-right: 10px; |
|
|
|
|
font-size: 13px; |
|
|
|
|
color: #979797; |
|
|
|
|
margin-right: 10px; |
|
|
|
|
font-size: 13px; |
|
|
|
|
color: #979797; |
|
|
|
|
} |
|
|
|
|
.action { |
|
|
|
|
margin-left: 15px; |
|
|
|
|
i { |
|
|
|
|
margin-left: 8px; |
|
|
|
|
font-size: 14px; |
|
|
|
|
color: #9076FF; |
|
|
|
|
color: #9076ff; |
|
|
|
|
cursor: pointer; |
|
|
|
|
&:hover { |
|
|
|
|
opacity: .9; |
|
|
|
|
opacity: 0.9; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -287,18 +317,18 @@ export default { |
|
|
|
|
line-height: 1.8; |
|
|
|
|
white-space: pre-wrap; |
|
|
|
|
p { |
|
|
|
|
position: relative; |
|
|
|
|
color: #6a6a6a; |
|
|
|
|
&:before { |
|
|
|
|
content: ''; |
|
|
|
|
display: inline-block; |
|
|
|
|
width: 5px; |
|
|
|
|
height: 5px; |
|
|
|
|
margin: 0 10px 0 5px; |
|
|
|
|
vertical-align: middle; |
|
|
|
|
border-radius: 20px; |
|
|
|
|
background-color: #c5b8ff; |
|
|
|
|
} |
|
|
|
|
position: relative; |
|
|
|
|
color: #6a6a6a; |
|
|
|
|
&:before { |
|
|
|
|
content: ''; |
|
|
|
|
display: inline-block; |
|
|
|
|
width: 5px; |
|
|
|
|
height: 5px; |
|
|
|
|
margin: 0 10px 0 5px; |
|
|
|
|
vertical-align: middle; |
|
|
|
|
border-radius: 20px; |
|
|
|
|
background-color: #c5b8ff; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|