confirmSelection.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <div>
  3. <el-button :type="disabled?'':btnType" size="mini" :disabled="disabled" @click="open" :showClose="false">{{btnTitle}}</el-button>
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name: "confirmSelection",
  9. props:{
  10. btnTitle:String,
  11. btnType:String,
  12. content:String,
  13. confirmButtonText:String,
  14. cancelButtonText:String,
  15. paramId:String,
  16. idName:String,
  17. paramContent:Object,
  18. disabled:Boolean,
  19. statusData:String
  20. },
  21. data(){
  22. return {
  23. param:{
  24. "id": 20221010164602,
  25. "content": {
  26. "sa_customersids": [5791],
  27. "status": "暂缓"
  28. }
  29. }
  30. }
  31. },
  32. methods:{
  33. open() {
  34. this.$confirm(this.$t(this.content)+'?', this.$t('提示'), {
  35. confirmButtonText: this.$t(this.confirmButtonText),
  36. cancelButtonText: this.$t(this.cancelButtonText),
  37. type: 'warning'
  38. }).then(() => {
  39. this.onSubmit()
  40. }).catch(() => {
  41. this.$message({
  42. type: 'info',
  43. message: this.$t('已取消')
  44. });
  45. });
  46. },
  47. async onSubmit(){
  48. if (this.btnTitle == '暂缓' || this.btnTitle == '取消暂缓' || this.btnTitle == '终止' || this.btnTitle == '恢复'){
  49. this.param.id = this.paramId
  50. this.param.content = {
  51. sa_customersids: [this.$route.query.id],
  52. status: this.statusData
  53. }
  54. }else {
  55. this.param.id = this.paramId
  56. this.param.content = {
  57. [this.idName]:this.$route.query.id
  58. }
  59. }
  60. const res = await this.$api.requested(this.param)
  61. this.tool.showMessage(res,()=>{
  62. this.$emit('onSuccess')
  63. })
  64. }
  65. }
  66. }
  67. </script>
  68. <style scoped>
  69. </style>