revokeFm.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <c-modal
  3. @cancel="handleCancel"
  4. @confirm="confirm"
  5. title="请填写撤销原因"
  6. :show="showRevoke"
  7. >
  8. <view>
  9. <view class="header-tip"
  10. >撤销将按照原请假流程再次审批,通过后撤销原请假</view
  11. >
  12. <u--form
  13. labelPosition="top"
  14. :model="fmData"
  15. :rules="rules"
  16. ref="uForm"
  17. >
  18. <u-form-item prop="reason">
  19. <c-textarea
  20. v-model="fmData.reason"
  21. placeholder="请填写撤销原因"
  22. ></c-textarea>
  23. </u-form-item>
  24. </u--form>
  25. </view>
  26. </c-modal>
  27. </template>
  28. <script>
  29. import { revoke } from '@/api/approval';
  30. export default {
  31. name: 'revokeFm',
  32. props: {
  33. showRevoke: Boolean,
  34. id: Number,
  35. },
  36. data() {
  37. return {
  38. fmData: {
  39. reason: '',
  40. },
  41. rules: {
  42. reason: {
  43. type: 'string',
  44. required: true,
  45. message: '请填写撤销原因',
  46. trigger: ['blur', 'change'],
  47. },
  48. },
  49. };
  50. },
  51. methods: {
  52. handleCancel() {
  53. this.$refs.uForm.resetFields();
  54. this.$emit('update:showRevoke', false);
  55. },
  56. async confirm() {
  57. await this.$refs.uForm.validate();
  58. try {
  59. uni.$c.loading();
  60. await revoke({ id: this.id, reason: this.fmData.reason });
  61. uni.$c.toast('撤销成功');
  62. uni.hideLoading();
  63. this.handleCancel();
  64. } catch (e) {
  65. uni.hideLoading();
  66. throw new Error(e);
  67. }
  68. },
  69. },
  70. };
  71. </script>
  72. <style scoped lang="scss">
  73. .header-tip {
  74. font-size: 13px;
  75. color: $u-tips-color;
  76. }
  77. </style>