migrateData.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. @<template>
  2. <section>
  3. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  4. <el-form :inline="true">
  5. <el-form-item label="数据迁移" style="margin-left:20px"></el-form-item>
  6. </el-form>
  7. </el-col>
  8. <el-col :span="24" style="padding:25px">
  9. <el-form style="width:500px;margin:0 auto" label-position="left" label-width="100px">
  10. <el-form-item label="当前公司" style="margin-top:40px">
  11. <el-input v-model="nowCompanyId" placeholder="请输入" clearable style="width:250px"></el-input>
  12. </el-form-item>
  13. <el-form-item label="当前公司超管" style="margin-top:40px">
  14. <el-input v-model="nowCompanyCg" placeholder="请输入" clearable style="width:250px"></el-input>
  15. </el-form-item>
  16. <el-form-item label="目标公司" style="margin-top:40px">
  17. <el-input v-model="toCompanyId" placeholder="请输入" clearable style="width:250px"></el-input>
  18. </el-form-item>
  19. <el-form-item label="目标公司超管" style="margin-top:40px">
  20. <el-input v-model="toCompanyCg" placeholder="请输入" clearable style="width:250px"></el-input>
  21. </el-form-item>
  22. </el-form>
  23. <div style="width:500px;margin:100px auto">
  24. <div style="width:350px;text-align:center">
  25. <el-button type="primary" @click="submit" style="margin:0 auto">立即迁移</el-button>
  26. </div>
  27. </div>
  28. </el-col>
  29. </section>
  30. </template>
  31. <script>
  32. export default {
  33. data(){
  34. return{
  35. list:[],
  36. nowCompanyId: '',
  37. toCompanyId: '',
  38. nowCompanyCg: '',
  39. toCompanyCg: ''
  40. }
  41. },
  42. mounted(){
  43. // this.getList()
  44. },
  45. methods:{
  46. getList() {
  47. this.http.post('/company/getList', {
  48. pageIndex: 1,
  49. pageSize: 9999,
  50. companyName: '',
  51. isMeal: 0
  52. },
  53. res => {
  54. if (res.code == "ok") {
  55. this.list = res.data.records;
  56. } else {
  57. this.$message({
  58. message: res.msg,
  59. type: "error"
  60. });
  61. }
  62. },
  63. error => {
  64. this.$message({
  65. message: error,
  66. type: "error"
  67. });
  68. });
  69. },
  70. submit() {
  71. this.nowCompanyId = this.nowCompanyId.trim()
  72. this.nowCompanyCg = this.nowCompanyCg.trim()
  73. this.toCompanyId = this.toCompanyId.trim()
  74. this.toCompanyCg = this.toCompanyCg.trim()
  75. if(this.nowCompanyId == ''){
  76. this.$message({
  77. message: '当前公司未输入!',
  78. type: 'warning'
  79. })
  80. return
  81. }else if(this.toCompanyId == ''){
  82. this.$message({
  83. message: '目标公司未输入!',
  84. type: 'warning'
  85. })
  86. return
  87. }else if(this.nowCompanyCg == ''){
  88. this.$message({
  89. message: '当前公司超管未输入!',
  90. type: 'warning'
  91. })
  92. return
  93. }else if(this.toCompanyCg == ''){
  94. this.$message({
  95. message: '目标公司超管未输入!',
  96. type: 'warning'
  97. })
  98. return
  99. }else if(this.nowCompanyId == this.toCompanyId){
  100. this.$message({
  101. message: '当前公司与目标公司相同!',
  102. type: 'warning'
  103. })
  104. return
  105. }
  106. this.$confirm('确认进行数据迁移吗?','提示',{
  107. confirmButtonText: '确定',
  108. cancelButtonText: '取消',
  109. type: 'warning'
  110. }).then(()=>{
  111. this.http.post('/company/dataMigration',{
  112. oldCompanyId: this.nowCompanyId,
  113. targetCompanyId: this.toCompanyId,
  114. oldUserName: this.nowCompanyCg,
  115. targetUserName: this.toCompanyCg
  116. },res => {
  117. if(res.code == 'ok'){
  118. this.$message({
  119. message: '数据迁移成功',
  120. type: 'success'
  121. })
  122. this.nowCompanyId = null
  123. this.toCompanyId = null
  124. this.getList()
  125. }else {
  126. this.$message({
  127. message: res.msg,
  128. type: 'error'
  129. })
  130. }
  131. },err => {
  132. this.$message({
  133. message: err,
  134. type: 'error'
  135. })
  136. })
  137. }).catch(()=>{
  138. this.$message({
  139. message: '已取消操作',
  140. type: 'info'
  141. })
  142. })
  143. }
  144. }
  145. }
  146. </script>
  147. <style scoped>
  148. .sidebars {
  149. height: 100%;
  150. position: absolute;
  151. border-right: 1px solid #E6E6E6;
  152. z-index: 2;
  153. top: 0;
  154. }
  155. </style>