taskDialog.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <el-dialog :visible.sync="visible" :show="show" class="deleteClassName public_task" title="状态变更" width="30%" :close-on-click-modal="false" :destroy-on-close="true" @close="OnClose()">
  3. <div class="blueStripe" />
  4. <div align="center">
  5. <div style=" margin-bottom: 5%; white-space:nowrap;">{{ name }}</div>
  6. <div style=" margin: 2% 3%; display: flex; justify-content: space-between; align-items: center; white-space:nowrap;">
  7. <span>{{ codeName }}:</span>
  8. <el-date-picker
  9. v-model="date"
  10. type="date"
  11. :clearable="false"
  12. format="yyyy.MM.dd"
  13. value-format="yyyy.MM.dd"
  14. style="width: 100%;"
  15. />
  16. </div>
  17. </div>
  18. <span slot="footer" class="dialog-footer">
  19. <el-button size="small" @click="OnClose">取 消</el-button>
  20. <el-button size="small" type="primary" @click="task_status_uptate(date)">确 定</el-button>
  21. </span>
  22. </el-dialog>
  23. </template>
  24. <script>
  25. import '@/styles/PublicStyle/index.scss'
  26. import { taskUpdate, taskGet } from '@/api/taskIndex' // 更新状态接口
  27. export default {
  28. name: 'TemplateDialog',
  29. props: {
  30. show: { type: Boolean, default: false }, // 弹窗展示
  31. statusName: { type: String, default: null }, // 状态name
  32. taskId: { type: [String, Number], default: null } // 任务ID
  33. },
  34. data() {
  35. return {
  36. visible: this.show,
  37. date: new Date(),
  38. name: '',
  39. task_Id: this.taskId,
  40. codeName: '',
  41. taskData: {},
  42. measurementTimeName: '实际提测时间',
  43. exitTimeName: '实际准出时间',
  44. onlineTimeName: '实际上线完成时间',
  45. measurementTime: '请确认提测报告发出后再切换任务状态为已提测!',
  46. exitTime: '请确认准出报告发出后再切换任务状态为已准出!',
  47. onlineTime: '请确认所有端或服务均已上线后再切换任务状态为已上线',
  48. userData: { id: '', ename: localStorage.getItem('username'), name: localStorage.getItem('realname') }
  49. }
  50. },
  51. watch: {
  52. show: {
  53. immediate: true,
  54. handler(show) {
  55. this.visible = this.show
  56. const date = new Date()
  57. const year = date.getFullYear()
  58. const month = date.getMonth() + 1
  59. const strDate = date.getDate()
  60. this.date = year + '.' + month + '.' + strDate
  61. }
  62. },
  63. statusName: {
  64. immediate: true,
  65. handler(statusName) {
  66. if (statusName === '已提测') {
  67. this.name = this.measurementTime
  68. this.codeName = this.measurementTimeName
  69. }
  70. if (statusName === '已准出') {
  71. this.name = this.exitTime
  72. this.codeName = this.exitTimeName
  73. }
  74. if (statusName === '已上线') {
  75. this.name = this.onlineTime
  76. this.codeName = this.onlineTimeName
  77. }
  78. }
  79. }
  80. },
  81. created() {
  82. this.getTaskData()
  83. },
  84. methods: {
  85. getTaskData() {
  86. taskGet(this.task_Id).then(res => {
  87. this.taskData = res.data
  88. })
  89. },
  90. OnClose() {
  91. this.$emit('update:show', false)
  92. this.$emit('getList')
  93. },
  94. task_status_uptate(e) {
  95. if (this.statusName === '已提测') {
  96. this.taskData.status = 70
  97. this.taskData.launchTestRealTime = e
  98. }
  99. if (this.statusName === '已准出') {
  100. this.taskData.status = 90
  101. this.taskData.testFinishRealTime = e
  102. }
  103. if (this.statusName === '已上线') {
  104. this.taskData.status = 100
  105. this.taskData.onlineRealTime = e
  106. }
  107. const taskInfoDO = this.taskData
  108. const user = this.userData
  109. taskUpdate({ taskInfoDO, user }).then(res => {
  110. if (res.code === 200) {
  111. this.$emit('update:show', false)
  112. this.$emit('getList')
  113. this.$emit('changeStatusAll')
  114. this.$message({ message: res.msg, type: 'success' })
  115. }
  116. })
  117. }
  118. }
  119. }
  120. </script>