Rap 原分销系统代码Web
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

109 lignes
3.1KB

  1. <template>
  2. <el-dialog append-to-body :close-on-click-modal="false" :visible.sync="dialog" title="系统还原" width="800px">
  3. <!--工具栏-->
  4. <div class="head-container">
  5. <date-range-picker v-model="query.createTime" class="date-item" />
  6. <el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
  7. </div>
  8. <el-form size="small" label-width="80px">
  9. <!--表格渲染-->
  10. <el-table v-loading="loading" :data="data" style="width: 100%" @row-click="showRow">
  11. <el-table-column width="30px">
  12. <template slot-scope="scope">
  13. <el-radio v-model="radio" :label="scope.$index" />
  14. </template>
  15. </el-table-column>
  16. <el-table-column prop="appName" label="应用名称" />
  17. <el-table-column prop="ip" label="部署IP" />
  18. <el-table-column prop="deployDate" label="部署时间" />
  19. <el-table-column prop="deployUser" label="部署人员" />
  20. </el-table>
  21. </el-form>
  22. <div slot="footer" class="dialog-footer">
  23. <el-button type="text" @click="cancel">取消</el-button>
  24. <el-button v-permission="['admin','deploy:add']" :loading="submitLoading" type="primary" @click="doSubmit">确认</el-button>
  25. </div>
  26. <!--分页组件-->
  27. <el-pagination
  28. :total="total"
  29. :current-page="page + 1"
  30. style="margin-top: 8px"
  31. layout="total, prev, pager, next, sizes"
  32. @size-change="sizeChange"
  33. @current-change="pageChange"
  34. />
  35. </el-dialog>
  36. </template>
  37. <script>
  38. import crud from '@/mixins/crud'
  39. import { reducte } from '@/api/mnt/deployHistory'
  40. import DateRangePicker from '@/components/DateRangePicker'
  41. export default {
  42. components: { DateRangePicker },
  43. mixins: [crud],
  44. props: {
  45. appName: {
  46. type: String,
  47. default: ''
  48. }
  49. },
  50. data() {
  51. return {
  52. submitLoading: false,
  53. dialog: false,
  54. history: [],
  55. radio: '',
  56. appNames: '',
  57. selectIndex: ''
  58. }
  59. },
  60. created() {
  61. this.$nextTick(() => {
  62. this.init()
  63. })
  64. },
  65. methods: {
  66. beforeInit() {
  67. this.url = 'api/deployHistory'
  68. this.deployId = this.$parent.deployId
  69. if (this.deployId === '') {
  70. return false
  71. }
  72. this.sort = 'deployDate,desc'
  73. this.params['deployId'] = this.deployId
  74. return true
  75. },
  76. showRow(row) {
  77. this.radio = this.data.indexOf(row)
  78. this.selectIndex = row.id
  79. },
  80. cancel() {
  81. this.dialog = false
  82. this.submitLoading = false
  83. },
  84. doSubmit() {
  85. if (this.selectIndex === '') {
  86. this.$message.error('请选择要还原的备份')
  87. } else {
  88. this.submitLoading = true
  89. reducte(JSON.stringify(this.data[this.radio]))
  90. .then(res => {
  91. this.dialog = false
  92. this.submitLoading = false
  93. this.appNames = ''
  94. this.$parent.crud.toQuery()
  95. })
  96. .catch(err => {
  97. this.submitLoading = false
  98. console.log('error:' + err.response.data.message)
  99. })
  100. }
  101. }
  102. }
  103. }
  104. </script>
  105. <style scoped>
  106. </style>