WorkflowDetailDialog.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <c-dialog
  3. ref="dialog"
  4. size="lg"
  5. title="详情"
  6. >
  7. <template #default>
  8. <div class="c-sibling-item--v u-font-size--sm u-color--black u-bold">上播内容</div>
  9. <schema-table
  10. class="l-flex__none c-sibling-item--v"
  11. :schema="schema"
  12. />
  13. <div class="c-sibling-item--v u-font-size--sm u-color--black u-bold">目标设备</div>
  14. <schema-table
  15. class="c-sibling-item--v"
  16. :schema="deviceSchema"
  17. />
  18. <material-dialog ref="materialDialog" />
  19. </template>
  20. </c-dialog>
  21. </template>
  22. <script>
  23. import { State } from '@/constant'
  24. export default {
  25. name: 'WorkflowDetailDialog',
  26. data () {
  27. return {
  28. schema: {
  29. list: this.getList,
  30. cols: [
  31. { prop: 'priority', label: '优先级', width: 80, align: 'center' },
  32. { prop: 'priorityInfo', label: '', width: 80, align: 'center' },
  33. { prop: 'targetInfo', label: '上播内容', width: 80, align: 'center' },
  34. { prop: 'targetName', label: '' },
  35. { prop: 'desc', label: '上播时间', 'min-width': 160 },
  36. { type: 'invoke', render: [
  37. { label: '查看', on: this.onView }
  38. ] }
  39. ]
  40. },
  41. deviceSchema: {
  42. nonPagination: true,
  43. list: this.getWorkflowDevices,
  44. cols: [
  45. { prop: 'deviceName', label: '设备名称' },
  46. { label: '发布状态', type: 'tag', render: ({ singlePublishState }) => {
  47. switch (singlePublishState) {
  48. case State.SUBMITTED:
  49. return {
  50. type: 'primary',
  51. label: '发布中'
  52. }
  53. case State.RESOLVED:
  54. return {
  55. type: 'success',
  56. label: '已发布'
  57. }
  58. case State.CANCEL:
  59. return {
  60. type: 'danger',
  61. label: '已下架'
  62. }
  63. case 5:
  64. return {
  65. type: 'warning',
  66. label: '发布失败'
  67. }
  68. default:
  69. return null
  70. }
  71. } }
  72. ]
  73. }
  74. }
  75. },
  76. methods: {
  77. show (workflow) {
  78. this.workflow = workflow
  79. this.$refs.dialog.show()
  80. },
  81. getList () {
  82. return Promise.resolve({ data: [this.workflow] })
  83. },
  84. getWorkflowDevices () {
  85. return Promise.resolve({ data: this.workflow.devices })
  86. },
  87. onView ({ target }) {
  88. this.$refs.materialDialog.showPublishTarget(target)
  89. }
  90. }
  91. }
  92. </script>