modelSure.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <Modal v-model="modals" class="paymentFooter" scrollable width="400" :z-index="99999" v-if="delfromData">
  3. <p slot="header" style="color: #f60">
  4. <Icon type="md-alert" />
  5. <span>{{ `${delfromData.title}` }}</span>
  6. </p>
  7. <div>
  8. <p>{{ `您确定要${delfromData.title}吗?` }}</p>
  9. <p v-if="delfromData.info !== undefined">{{ `${delfromData.info}` }}</p>
  10. </div>
  11. <div slot="footer" class="acea-row row-right">
  12. <Button type="warning" :loading="modal_loading" @click="ok">确定</Button>
  13. <Button type="primary" @click="cancel">取消</Button>
  14. </div>
  15. </Modal>
  16. </template>
  17. <script>
  18. import { tableDelApi } from '@/api/common';
  19. export default {
  20. name: 'modelSure',
  21. props: {
  22. title: String,
  23. delfromData: {
  24. type: Object,
  25. default: null,
  26. },
  27. },
  28. data() {
  29. return {
  30. modals: false,
  31. modal_loading: false,
  32. };
  33. },
  34. methods: {
  35. ok() {
  36. this.modal_loading = true;
  37. setTimeout(() => {
  38. tableDelApi(this.delfromData)
  39. .then(async (res) => {
  40. this.$Message.success(res.msg);
  41. this.modal_loading = false;
  42. this.modals = false;
  43. this.$emit('submitModel');
  44. })
  45. .catch((res) => {
  46. this.modal_loading = false;
  47. this.$Message.error(res.msg);
  48. this.modals = false;
  49. });
  50. }, 2000);
  51. },
  52. cancel() {
  53. this.modals = false;
  54. },
  55. },
  56. };
  57. </script>
  58. <style scoped lang="stylus">
  59. .acea-row >>> .ivu-btn-primary
  60. background-color: rgb(170, 170, 170);
  61. border-color: rgb(170, 170, 170);
  62. </style>