|
|
@@ -12,6 +12,7 @@
|
|
|
@click="getPublishWorkflowDetail"
|
|
|
/>
|
|
|
<div v-if="dataMap.length">
|
|
|
+ <div class="l-flex--row has-padding o-title">{{ title }}</div>
|
|
|
<div class="l-flex--row has-padding">
|
|
|
<el-steps
|
|
|
:active="active"
|
|
|
@@ -44,19 +45,17 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="l-flex--row fl-end has-padding">
|
|
|
- <el-button
|
|
|
+ <!-- <el-button
|
|
|
v-if="active === totalStep - 2"
|
|
|
class="o-button"
|
|
|
@click="onPublish"
|
|
|
- >流程通过</el-button>
|
|
|
+ >确认发布</el-button
|
|
|
+ > -->
|
|
|
<el-button
|
|
|
- v-if="
|
|
|
- (active < totalStep && rejectInfo.length) ||
|
|
|
- active === totalStep - 2
|
|
|
- "
|
|
|
+ v-if="showTempReject && tempRejectInfo.length"
|
|
|
class="o-button"
|
|
|
@click="reject"
|
|
|
- >流程驳回</el-button>
|
|
|
+ >{{ tempRejectMap[backDataType]["text"] }}</el-button>
|
|
|
</div>
|
|
|
<schema-table
|
|
|
v-if="active < totalStep"
|
|
|
@@ -67,6 +66,7 @@
|
|
|
>
|
|
|
<preview-dialog ref="previewDialog" />
|
|
|
<review-dialog
|
|
|
+ v-if="dataMap[active] === 'minios'"
|
|
|
ref="reviewDialog"
|
|
|
:list="tableData"
|
|
|
@resolve="onResolve"
|
|
|
@@ -140,6 +140,7 @@ import {
|
|
|
EventTarget,
|
|
|
PublishType
|
|
|
} from '@/constant'
|
|
|
+// 前端命名 和后端数据命名
|
|
|
const front2back = {
|
|
|
assets: 'minios',
|
|
|
program: 'items',
|
|
|
@@ -147,13 +148,30 @@ const front2back = {
|
|
|
schedule: 'programCalendar',
|
|
|
publish: 'calendarReleaseScheduling'
|
|
|
}
|
|
|
+// 数据 是否单个还是list
|
|
|
+const singleMap = {
|
|
|
+ minios: false,
|
|
|
+ items: false,
|
|
|
+ carousels: false,
|
|
|
+ programCalendar: true,
|
|
|
+ calendarReleaseScheduling: true
|
|
|
+}
|
|
|
+// 数据 转 驳回type
|
|
|
const data2type = {
|
|
|
minios: 'minio',
|
|
|
items: 'item',
|
|
|
- carousels: 'carouse',
|
|
|
+ carousels: 'carousel',
|
|
|
programCalendar: 'program',
|
|
|
calendarReleaseScheduling: 'calendar'
|
|
|
}
|
|
|
+// label
|
|
|
+const data2label = {
|
|
|
+ minios: '媒资',
|
|
|
+ items: '节目',
|
|
|
+ carousels: '轮播',
|
|
|
+ programCalendar: '排期',
|
|
|
+ calendarReleaseScheduling: '发布'
|
|
|
+}
|
|
|
function showOpt (status) {
|
|
|
return ![2, 3].includes(status)
|
|
|
}
|
|
|
@@ -187,21 +205,37 @@ export default {
|
|
|
type: '',
|
|
|
reason: ''
|
|
|
},
|
|
|
- rejectInfo: []
|
|
|
+ tempRejectInfo: [],
|
|
|
+ tempRejectMap: {}
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ backDataType () {
|
|
|
+ return this.dataMap[this.active]
|
|
|
+ },
|
|
|
tableData () {
|
|
|
- return this.sourceMap[this.dataMap[this.active]] || []
|
|
|
+ return this.sourceMap[this.backDataType] || []
|
|
|
},
|
|
|
id () {
|
|
|
return this.$route.params.id
|
|
|
},
|
|
|
+ title () {
|
|
|
+ return this.$route.params.name
|
|
|
+ },
|
|
|
totalStep () {
|
|
|
return this.dataMap.length + 1
|
|
|
},
|
|
|
+ showTempReject () {
|
|
|
+ if (
|
|
|
+ this.tempRejectMap[this.backDataType]
|
|
|
+ && this.tempRejectMap[this.backDataType].length > 1
|
|
|
+ ) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ },
|
|
|
schema () {
|
|
|
- switch (this.dataMap[this.active]) {
|
|
|
+ switch (this.backDataType) {
|
|
|
case front2back['assets']:
|
|
|
return {
|
|
|
singlePage: true,
|
|
|
@@ -355,8 +389,24 @@ export default {
|
|
|
{ prop: 'createTime', label: '提交时间' },
|
|
|
{
|
|
|
type: 'invoke',
|
|
|
- width: 80,
|
|
|
- render: [{ label: '查看', on: this.onView }]
|
|
|
+ width: 160,
|
|
|
+ render: [
|
|
|
+ { label: '查看', on: this.onView },
|
|
|
+ {
|
|
|
+ label: '通过',
|
|
|
+ render ({ status }) {
|
|
|
+ return showOpt(status)
|
|
|
+ },
|
|
|
+ on: this.onPublish
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '驳回',
|
|
|
+ render ({ status }) {
|
|
|
+ return showOpt(status)
|
|
|
+ },
|
|
|
+ on: this.onReject
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
@@ -369,6 +419,18 @@ export default {
|
|
|
this.getPublishWorkflowDetail()
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 判断是否需要缓存驳回
|
|
|
+ calTempReject (item) {
|
|
|
+ if (!singleMap[item]) {
|
|
|
+ this.tempRejectMap[item] = {
|
|
|
+ text: `${data2label[item]}驳回`,
|
|
|
+ show:
|
|
|
+ !this.tempRejectMap.length
|
|
|
+ && this.sourceMap[item].filter(i => ![2, 3].includes(i.status))
|
|
|
+ .length
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
async getPublishWorkflowDetail () {
|
|
|
let res = await getPublishWorkflowDetail(this.id).catch(err => {
|
|
|
console.log(err)
|
|
|
@@ -396,6 +458,15 @@ export default {
|
|
|
if (this.sourceMap[item][0]) {
|
|
|
this.sourceMap[item] = this.sourceMap[item].map(row => this.transform(row, item))
|
|
|
temp.push(item)
|
|
|
+ // 处理缓存驳回初始状态
|
|
|
+ if (!singleMap[item]) {
|
|
|
+ this.tempRejectMap[item] = {
|
|
|
+ text: `${data2label[item]}驳回`,
|
|
|
+ length: this.sourceMap[item].filter(
|
|
|
+ i => ![2, 3].includes(i.status)
|
|
|
+ ).length
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
this.dataMap = temp
|
|
|
@@ -418,7 +489,7 @@ export default {
|
|
|
this.getPublishWorkflowDetail()
|
|
|
},
|
|
|
refreshStatus (item, status, review) {
|
|
|
- const list = this.sourceMap[this.dataMap[this.active]]
|
|
|
+ const list = this.sourceMap[this.backDataType]
|
|
|
const index = list.findIndex(i => i.id === item.id)
|
|
|
list[index].status = status
|
|
|
this.$refs.table.onPagination()
|
|
|
@@ -439,8 +510,8 @@ export default {
|
|
|
if (this.active === this.totalStep - 1) {
|
|
|
this.active = this.totalStep
|
|
|
}
|
|
|
- this.rejectInfo = []
|
|
|
- this.$refs.table && this.$refs.table.onPagination()
|
|
|
+ this.tempRejectInfo = []
|
|
|
+ this.tableKey++
|
|
|
},
|
|
|
next () {
|
|
|
if (this.active++ > 5) {
|
|
|
@@ -534,7 +605,7 @@ export default {
|
|
|
return ''
|
|
|
},
|
|
|
onToggle (row) {
|
|
|
- if (this.dataMap[this.active] !== 'publish') {
|
|
|
+ if (this.backDataType !== 'publish') {
|
|
|
return
|
|
|
}
|
|
|
this.$refs.table.getInst().toggleRowExpansion(row)
|
|
|
@@ -570,7 +641,7 @@ export default {
|
|
|
// 查看
|
|
|
onView (row) {
|
|
|
const { id } = row
|
|
|
- switch (this.dataMap[this.active]) {
|
|
|
+ switch (this.backDataType) {
|
|
|
case front2back['assets']:
|
|
|
this.$refs.reviewDialog.show(
|
|
|
this.tableData.findIndex(i => i.id === id)
|
|
|
@@ -586,6 +657,7 @@ export default {
|
|
|
)
|
|
|
break
|
|
|
case front2back['schedule']:
|
|
|
+ case front2back['programRecur']:
|
|
|
this.$refs.scheduleDialog.show(id)
|
|
|
break
|
|
|
case front2back['publish']:
|
|
|
@@ -599,8 +671,7 @@ export default {
|
|
|
this.$refs.previewDialog.show(asset)
|
|
|
},
|
|
|
closePreviewDialog () {
|
|
|
- debugger
|
|
|
- if (this.dataMap[this.active] === front2back['assets']) {
|
|
|
+ if (this.backDataType === front2back['assets']) {
|
|
|
this.$refs.reviewDialog.close()
|
|
|
}
|
|
|
},
|
|
|
@@ -611,12 +682,13 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
resolve (item) {
|
|
|
- switch (this.dataMap[this.active]) {
|
|
|
+ switch (this.backDataType) {
|
|
|
case front2back['assets']:
|
|
|
return resolveAsset(item)
|
|
|
case front2back['program']:
|
|
|
return resolveProgram(item)
|
|
|
case front2back['schedule']:
|
|
|
+ case front2back['programRecur']:
|
|
|
return resolveSchedule(item)
|
|
|
case front2back['publish']:
|
|
|
return resolvePublish(item)
|
|
|
@@ -650,27 +722,41 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- // 缓存驳回数据
|
|
|
- this.rejectInfo.push({
|
|
|
+ const rejectInfo = {
|
|
|
id: this.$item.id,
|
|
|
name: this.$item.name || this.$item.originalName,
|
|
|
remark: reason
|
|
|
- })
|
|
|
- this.refreshStatus(this.$item, 3, {
|
|
|
- type: this.review.type,
|
|
|
- reason: this.review.reason
|
|
|
- })
|
|
|
- done()
|
|
|
+ }
|
|
|
+ if (this.showTempReject) {
|
|
|
+ this.$confirm(`驳回 ${rejectInfo.name} ?`, {
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ // 缓存驳回数据
|
|
|
+ done()
|
|
|
+ this.tempRejectInfo.push(rejectInfo)
|
|
|
+ this.refreshStatus(this.$item, 3, {
|
|
|
+ type: this.review.type,
|
|
|
+ reason: this.review.reason
|
|
|
+ })
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ // 取最新
|
|
|
+ done()
|
|
|
+ this.reject([rejectInfo], rejectInfo.name)
|
|
|
+ }
|
|
|
},
|
|
|
// 流程驳回
|
|
|
- reject () {
|
|
|
+ reject (
|
|
|
+ rejectInfo = this.tempRejectInfo,
|
|
|
+ name = data2label[this.backDataType]
|
|
|
+ ) {
|
|
|
return calendarPublishReject(
|
|
|
this.id,
|
|
|
{
|
|
|
- type: data2type[this.dataMap[this.active]],
|
|
|
- rejectInfo: this.rejectInfo
|
|
|
+ type: data2type[this.backDataType],
|
|
|
+ rejectInfo
|
|
|
},
|
|
|
- '审核流程'
|
|
|
+ name
|
|
|
)
|
|
|
.then(() => {
|
|
|
this.$router.push({ name: 'review-list' })
|
|
|
@@ -717,6 +803,11 @@ export default {
|
|
|
padding-left: 15px;
|
|
|
}
|
|
|
}
|
|
|
+.o-title {
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #333333;
|
|
|
+}
|
|
|
.fl-end {
|
|
|
justify-content: flex-end;
|
|
|
}
|