|
|
@@ -19,7 +19,7 @@
|
|
|
name="2"
|
|
|
/>
|
|
|
<el-tab-pane
|
|
|
- label="被驳回"
|
|
|
+ label="驳回"
|
|
|
name="3"
|
|
|
/>
|
|
|
</el-tabs>
|
|
|
@@ -41,235 +41,79 @@
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
- getPublishWorkflows,
|
|
|
+ getMyWorkflows,
|
|
|
calendarPublishRestart,
|
|
|
- viewHistory
|
|
|
+ viewHistory,
|
|
|
+ deleteWorkflow
|
|
|
} from '@/api/workflow'
|
|
|
-
|
|
|
import {
|
|
|
- PublishType, EventPriority, State, EventTarget
|
|
|
+ PublishType,
|
|
|
+ EventPriority,
|
|
|
+ State,
|
|
|
+ EventTarget
|
|
|
} from '@/constant'
|
|
|
import { getEventDescription } from '@/utils/event'
|
|
|
-// const data2label = {
|
|
|
-// minio: '媒资',
|
|
|
-// item: '节目',
|
|
|
-// carousel: '轮播',
|
|
|
-// program: '排期',
|
|
|
-// calendar: '发布'
|
|
|
-// }
|
|
|
+
|
|
|
+const Type = {
|
|
|
+ minio: '媒资',
|
|
|
+ item: '节目',
|
|
|
+ carousel: '轮播',
|
|
|
+ program: '排期',
|
|
|
+ calendar: '发布'
|
|
|
+}
|
|
|
+
|
|
|
export default {
|
|
|
- name: 'MyWorkflow',
|
|
|
+ name: 'MyWorkflows',
|
|
|
data () {
|
|
|
- // eslint-disable-next-line consistent-this
|
|
|
- const _this1 = this
|
|
|
return {
|
|
|
- active: '1',
|
|
|
- schema: {
|
|
|
- condition: { self: true, status: 1, name: '' },
|
|
|
- list: getPublishWorkflows,
|
|
|
+ active: `${State.SUBMITTED}`,
|
|
|
+ workflowId: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ schema () {
|
|
|
+ const isRejected = this.active === `${State.REJECTED}`
|
|
|
+
|
|
|
+ return {
|
|
|
+ condition: { status: Number(this.active) },
|
|
|
+ list: getMyWorkflows,
|
|
|
transform: this.transform,
|
|
|
cols: [
|
|
|
- {
|
|
|
- prop: 'expand',
|
|
|
- type: 'expand',
|
|
|
- render (row, h) {
|
|
|
- let base = [
|
|
|
- h('div', null, row.desc),
|
|
|
- h('div', null, `设备:${row.device}`)
|
|
|
- ]
|
|
|
- if (
|
|
|
- row.status === State.REJECTED
|
|
|
- && row.rejectEvent
|
|
|
- && row.rejectEvent.length
|
|
|
- ) {
|
|
|
- base = base.concat(h('div', { style: { height: '10px' } }))
|
|
|
- if (
|
|
|
- row.rejectEvent.length === 1
|
|
|
- && row.rejectEvent[0].type === 'calendar'
|
|
|
- ) {
|
|
|
- base = base.concat(h('em', '发布驳回'))
|
|
|
- } else {
|
|
|
- base = base.concat([
|
|
|
- h('em', { style: { verticalAlign: 'top' } }, '驳回对象:'),
|
|
|
- h(
|
|
|
- 'ul',
|
|
|
- {
|
|
|
- staticClass: 'c-reject',
|
|
|
- style: { display: 'inline-block' }
|
|
|
- },
|
|
|
- row.rejectEvent
|
|
|
- .filter(i => i.type !== 'calendar')
|
|
|
- .map(item => h(
|
|
|
- 'li',
|
|
|
- {
|
|
|
- staticClass: 'c-reject__item',
|
|
|
- class:
|
|
|
- item.type === 'minio'
|
|
|
- ? ''
|
|
|
- : 'c-table__btn u-pointer',
|
|
|
- // 'o-link c-table__btn u-pointer',
|
|
|
- on: {
|
|
|
- click ($event) {
|
|
|
- $event.stopPropagation()
|
|
|
- if (item.type === 'minio') {
|
|
|
- return
|
|
|
- }
|
|
|
- _this1.onHandleReject(item, false)
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- `${item.name}`
|
|
|
- ))
|
|
|
- )
|
|
|
- ])
|
|
|
- }
|
|
|
- }
|
|
|
- return h(
|
|
|
- 'div',
|
|
|
- {
|
|
|
- staticClass: 'o-info'
|
|
|
- },
|
|
|
- base
|
|
|
- )
|
|
|
- }
|
|
|
- },
|
|
|
+ { type: 'expand', render: this.renderRelative },
|
|
|
{ prop: 'type', label: '类型', width: 100 },
|
|
|
{ prop: 'name', label: '名称', 'min-width': 100 },
|
|
|
{ prop: 'resolutionRatio', label: '分辨率' },
|
|
|
- { prop: 'createTime', label: '提交时间' },
|
|
|
- {
|
|
|
- label: '审核状态',
|
|
|
- type: 'tag',
|
|
|
- render ({ status }) {
|
|
|
- return {
|
|
|
- type: ['', 'warning', 'success', 'danger'][status],
|
|
|
- label: ['草稿', '待审核', '通过', '驳回'][status]
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- null,
|
|
|
- {
|
|
|
- type: 'invoke',
|
|
|
- width: 200,
|
|
|
- render: [
|
|
|
- { label: '查看', on: this.onView },
|
|
|
- { label: '流程', on: this.onViewHistory },
|
|
|
- {
|
|
|
- label: '编辑',
|
|
|
- render ({ status }) {
|
|
|
- return status === State.REJECTED
|
|
|
- },
|
|
|
- on: this.onEdit
|
|
|
- },
|
|
|
- {
|
|
|
- label: '提交',
|
|
|
- render ({ status }) {
|
|
|
- return status === State.REJECTED
|
|
|
- },
|
|
|
- on: this.restart
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
+ { prop: 'createTime', label: '创建时间' },
|
|
|
+ isRejected ? { prop: 'reason', label: '驳回原因', 'min-width': 100 } : null,
|
|
|
+ { type: 'invoke', width: isRejected ? 200 : 120, render: [
|
|
|
+ isRejected ? { label: '编辑', on: this.onEdit } : { label: '查看', on: this.onView },
|
|
|
+ isRejected ? { label: '重提交', on: this.onResubmit } : null,
|
|
|
+ { label: '历史', on: this.onViewHistory },
|
|
|
+ isRejected ? { label: '删除', on: this.onDel } : null
|
|
|
+ ].filter(Boolean) }
|
|
|
]
|
|
|
- },
|
|
|
- temp: {
|
|
|
- workflowId: ''
|
|
|
}
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
+ },
|
|
|
historySchema () {
|
|
|
- // eslint-disable-next-line consistent-this
|
|
|
- const _this1 = this
|
|
|
return {
|
|
|
- props: {
|
|
|
- rowClassName: this.isShowExpend
|
|
|
- },
|
|
|
- condition: { workflowId: this.temp.workflowId },
|
|
|
+ props: { rowClassName: this.isShowExpend },
|
|
|
+ listeners: { 'row-click': this.onToggleHistory },
|
|
|
+ condition: { workflowId: this.workflowId },
|
|
|
list: viewHistory,
|
|
|
transform: row => {
|
|
|
return { ...row, rejectEvent: JSON.parse(row.rejectEvent) }
|
|
|
},
|
|
|
cols: [
|
|
|
- {
|
|
|
- prop: 'expand',
|
|
|
- type: 'expand',
|
|
|
- render: (row, h) => {
|
|
|
- if (row.rejectEvent && row.rejectEvent.length) {
|
|
|
- if (
|
|
|
- row.rejectEvent.length === 1
|
|
|
- && row.rejectEvent[0].type === 'calendar'
|
|
|
- ) {
|
|
|
- return h(
|
|
|
- 'div',
|
|
|
- {
|
|
|
- staticClass: 'o-info'
|
|
|
- },
|
|
|
- [h('em', '发布驳回')]
|
|
|
- )
|
|
|
- }
|
|
|
- let isView = true
|
|
|
- if (row.index === 0 && row.status === State.REJECTED) {
|
|
|
- isView = false
|
|
|
- }
|
|
|
-
|
|
|
- return h(
|
|
|
- 'div',
|
|
|
- {
|
|
|
- staticClass: 'o-info'
|
|
|
- },
|
|
|
- [
|
|
|
- h('em', { style: { verticalAlign: 'top' } }, '驳回对象:'),
|
|
|
- h(
|
|
|
- 'ul',
|
|
|
- {
|
|
|
- staticClass: 'c-reject',
|
|
|
- style: { display: 'inline-block' }
|
|
|
- },
|
|
|
- row.rejectEvent
|
|
|
- .filter(i => i.type !== 'calendar')
|
|
|
- .map(item => h(
|
|
|
- 'li',
|
|
|
- {
|
|
|
- staticClass: 'c-reject__item',
|
|
|
- class:
|
|
|
- item.type === 'minio'
|
|
|
- ? ''
|
|
|
- : 'c-table__btn u-pointer',
|
|
|
- // 'o-link c-table__btn u-pointer',
|
|
|
- on: {
|
|
|
- click ($event) {
|
|
|
- $event.stopPropagation()
|
|
|
- if (item.type === 'minio') {
|
|
|
- return
|
|
|
- }
|
|
|
- _this1.onHandleReject(item, isView)
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- `${item.name}`
|
|
|
- ))
|
|
|
- )
|
|
|
- ]
|
|
|
- )
|
|
|
- }
|
|
|
- return ''
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- { prop: 'handledBy', label: '审核人', width: 100 },
|
|
|
+ { type: 'expand', render: this.renderReason },
|
|
|
+ { prop: 'handledBy', label: '处理人', width: 100 },
|
|
|
{ prop: 'createTime', label: '时间' },
|
|
|
- {
|
|
|
- label: '状态',
|
|
|
- type: 'tag',
|
|
|
- render ({ status }) {
|
|
|
- return {
|
|
|
- type: ['', 'warning', 'success', 'danger'][status],
|
|
|
- label: ['草稿', '开始审核', '通过', '驳回'][status]
|
|
|
- }
|
|
|
+ { label: '状态', type: 'tag', render ({ status }) {
|
|
|
+ return {
|
|
|
+ type: ['', 'primary', 'success', 'danger'][status],
|
|
|
+ label: ['草稿', '提交', '通过', '驳回'][status]
|
|
|
}
|
|
|
- },
|
|
|
- { prop: 'reason', label: '原因' }
|
|
|
+ } },
|
|
|
+ { prop: 'reason', label: '备注' }
|
|
|
]
|
|
|
}
|
|
|
}
|
|
|
@@ -281,39 +125,77 @@ export default {
|
|
|
}
|
|
|
return ''
|
|
|
},
|
|
|
- onViewAsset (asset) {
|
|
|
- this.$refs.previewDialog.show(asset)
|
|
|
+ renderRelative (row, h) {
|
|
|
+ return h('div', { staticClass: 'o-info' }, [
|
|
|
+ h('div', null, row.desc),
|
|
|
+ h('div', { staticClass: 'c-sibling-item--v' }, `设备:${row.device}`),
|
|
|
+ ...this.renderRelativeItems(row, h, false)
|
|
|
+ ])
|
|
|
},
|
|
|
- onViewHistory ({ workflowId }) {
|
|
|
- this.temp = {
|
|
|
- workflowId
|
|
|
+ renderReason (row, h) {
|
|
|
+ return h('div', { staticClass: 'o-info' }, [
|
|
|
+ ...this.renderRelativeItems(row, h)
|
|
|
+ ])
|
|
|
+ },
|
|
|
+ renderRelativeItems (row, h, isView = true) {
|
|
|
+ const children = []
|
|
|
+ if (
|
|
|
+ row.status === State.REJECTED
|
|
|
+ && row.rejectEvent?.length
|
|
|
+ ) {
|
|
|
+ if (
|
|
|
+ row.rejectEvent.length === 1
|
|
|
+ && row.rejectEvent[0].type === 'calendar'
|
|
|
+ ) {
|
|
|
+ children.push(h('div', {
|
|
|
+ staticClass: 'c-sibling-item--v u-color--error'
|
|
|
+ }, '发布驳回'))
|
|
|
+ } else {
|
|
|
+ children.push(h('div', {
|
|
|
+ staticClass: 'c-sibling-item--v'
|
|
|
+ }, '驳回对象:'))
|
|
|
+ children.push(
|
|
|
+ h('div', {
|
|
|
+ staticClass: 'l-flex--col',
|
|
|
+ staticStyle: { 'align-items': 'flex-start' }
|
|
|
+ }, row.rejectEvent
|
|
|
+ .filter(i => i.type !== 'calendar')
|
|
|
+ .map(item => h('div', {
|
|
|
+ staticClass: isView || item.type === 'minio' ? 'u-color--black' : 'u-color--blue u-pointer',
|
|
|
+ staticStyle: { padding: '4px 0' },
|
|
|
+ on: isView || item.type === 'minio'
|
|
|
+ ? null
|
|
|
+ : {
|
|
|
+ click: $event => {
|
|
|
+ $event.stopPropagation()
|
|
|
+ this.onViewOrEditItem(item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, `${Type[item.type]} ${item.name}`)))
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
+ return children
|
|
|
+ },
|
|
|
+ onViewHistory ({ workflowId }) {
|
|
|
+ this.workflowId = workflowId
|
|
|
this.$refs.tableDialog.show()
|
|
|
},
|
|
|
onTabClick ({ name: active }) {
|
|
|
if (this.active !== active) {
|
|
|
this.active = active
|
|
|
- if (Number(active) === State.REJECTED) {
|
|
|
- this.$set(this.schema.cols, 6, {
|
|
|
- prop: 'reason',
|
|
|
- label: '驳回原因'
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.$set(this.schema.cols, 6, null)
|
|
|
- }
|
|
|
- this.$refs.table.mergeCondition({ status: Number(active) })
|
|
|
}
|
|
|
},
|
|
|
- transform (item) {
|
|
|
- const same = this.getSame(item.calendarRelease)
|
|
|
- const diff = this.getDiff(item.calendarRelease)
|
|
|
+ transform ({ id, status, reason, calendarRelease, rejectEvent }) {
|
|
|
+ const same = this.getSame(calendarRelease)
|
|
|
+ const diff = this.getDiff(calendarRelease)
|
|
|
return {
|
|
|
...same,
|
|
|
...diff,
|
|
|
- workflowId: item.id,
|
|
|
- status: item.status,
|
|
|
- reason: item.reason,
|
|
|
- rejectEvent: JSON.parse(item.rejectEvent)
|
|
|
+ workflowId: id,
|
|
|
+ status,
|
|
|
+ reason,
|
|
|
+ rejectEvent: JSON.parse(rejectEvent)
|
|
|
}
|
|
|
},
|
|
|
getSame ({
|
|
|
@@ -356,10 +238,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
getDesc (target) {
|
|
|
- if (
|
|
|
- target.type === PublishType.EVENT
|
|
|
- && target.detail.priority === EventPriority.INSERTED
|
|
|
- ) {
|
|
|
+ if (target.type === PublishType.EVENT && target.detail.priority === EventPriority.INSERTED) {
|
|
|
return getEventDescription(target.detail)
|
|
|
}
|
|
|
return ''
|
|
|
@@ -367,14 +246,19 @@ export default {
|
|
|
onToggle (row) {
|
|
|
this.$refs.table.getInst().toggleRowExpansion(row)
|
|
|
},
|
|
|
+ onToggleHistory (row) {
|
|
|
+ if (row.status === State.REJECTED) {
|
|
|
+ this.$refs.tableDialog.getTable().getInst().toggleRowExpansion(row)
|
|
|
+ }
|
|
|
+ },
|
|
|
onView ({ target: { type, detail } }) {
|
|
|
switch (type) {
|
|
|
case PublishType.CALENDAR:
|
|
|
- this.viewSchedule(detail)
|
|
|
+ this.$refs.scheduleDialog.show(detail)
|
|
|
break
|
|
|
case PublishType.EVENT:
|
|
|
if (detail.target.type === EventTarget.RECUR) {
|
|
|
- this.viewSchedule(detail.target.id)
|
|
|
+ this.$refs.scheduleDialog.show(detail.target.id)
|
|
|
} else {
|
|
|
this.$refs.programDialog.show(detail.target.id)
|
|
|
}
|
|
|
@@ -386,61 +270,56 @@ export default {
|
|
|
onEdit ({ target: { type, detail } }) {
|
|
|
switch (type) {
|
|
|
case PublishType.CALENDAR:
|
|
|
- this.editSchedule(detail, 'schedule-design')
|
|
|
+ this.$router.push({
|
|
|
+ name: 'schedule-design',
|
|
|
+ params: { id: detail }
|
|
|
+ })
|
|
|
break
|
|
|
case PublishType.EVENT:
|
|
|
if (detail.target.type === EventTarget.RECUR) {
|
|
|
- this.editSchedule(detail.target.id, 'recur-design')
|
|
|
+ this.$router.push({
|
|
|
+ name: 'recur-design',
|
|
|
+ params: { id: detail.target.id }
|
|
|
+ })
|
|
|
} else {
|
|
|
- this.editProgram(detail.target.id)
|
|
|
+ this.$designProgram(detail.target.id)
|
|
|
}
|
|
|
break
|
|
|
default:
|
|
|
break
|
|
|
}
|
|
|
},
|
|
|
- onHandleReject (row, isView = true) {
|
|
|
+ onViewOrEditItem (row) {
|
|
|
switch (row.type) {
|
|
|
case 'minio':
|
|
|
- this.onViewAsset(row)
|
|
|
+ this.$refs.previewDialog.show(row)
|
|
|
break
|
|
|
case 'item':
|
|
|
- isView
|
|
|
- ? this.$refs.programDialog.show(row.id)
|
|
|
- : this.editProgram(row.id)
|
|
|
+ this.$designProgram(row.id)
|
|
|
break
|
|
|
case 'carousel':
|
|
|
- isView
|
|
|
- ? this.viewSchedule(row.id)
|
|
|
- : this.editSchedule(row.id, 'recur-design')
|
|
|
+ this.$router.push({
|
|
|
+ name: 'recur-design',
|
|
|
+ params: { id: row.id }
|
|
|
+ })
|
|
|
break
|
|
|
- // 排期
|
|
|
case 'program':
|
|
|
- isView
|
|
|
- ? this.viewSchedule(row.id)
|
|
|
- : this.editSchedule(row.id, 'schedule-design')
|
|
|
- break
|
|
|
- // 发布
|
|
|
- case 'calendar':
|
|
|
+ this.$router.push({
|
|
|
+ name: 'schedule-design',
|
|
|
+ params: { id: row.id }
|
|
|
+ })
|
|
|
break
|
|
|
default:
|
|
|
break
|
|
|
}
|
|
|
},
|
|
|
- viewSchedule (id) {
|
|
|
- this.$refs.scheduleDialog.show(id)
|
|
|
- },
|
|
|
- editSchedule (id, redirect) {
|
|
|
- this.$router.push({
|
|
|
- name: redirect,
|
|
|
- params: { id: `${id}` }
|
|
|
+ onResubmit (item) {
|
|
|
+ calendarPublishRestart(item.workflowId, item.name).then(() => {
|
|
|
+ this.$refs.table.decrease(1)
|
|
|
})
|
|
|
},
|
|
|
- editProgram (id) {
|
|
|
- this.$designProgram(id)
|
|
|
- },
|
|
|
- restart (item) {
|
|
|
- calendarPublishRestart(item.workflowId, item.name).then(() => {
|
|
|
+ onDel ({ workflowId }) {
|
|
|
+ deleteWorkflow(workflowId).then(() => {
|
|
|
this.$refs.table.decrease(1)
|
|
|
})
|
|
|
}
|