approvalFm.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <c-modal
  3. @confirm="handleConfirm"
  4. @cancel="handleClose"
  5. :show="isShow"
  6. title="审批信息"
  7. >
  8. <view class="w-100">
  9. <u--form
  10. labelPosition="top"
  11. :model="fmData"
  12. :rules="rules"
  13. ref="uForm"
  14. >
  15. <u-form-item prop="agree">
  16. <uni-data-select
  17. v-model="fmData.agree"
  18. :localdata="sionList"
  19. placeholder="请选择审批结论"
  20. ></uni-data-select>
  21. </u-form-item>
  22. <u-form-item>
  23. <c-textarea
  24. v-model="fmData.message"
  25. placeholder="请输入内容"
  26. maxlength="1000"
  27. ></c-textarea>
  28. </u-form-item>
  29. </u--form>
  30. </view>
  31. </c-modal>
  32. </template>
  33. <script>
  34. import { audited } from '@/api/approval/index.js';
  35. export default {
  36. name: 'approvalFm',
  37. props: {
  38. isShow: Boolean,
  39. rId: Number,
  40. },
  41. data() {
  42. return {
  43. fmData: {
  44. agree: '',
  45. message: '',
  46. },
  47. rules: {
  48. agree: {
  49. type: 'string',
  50. required: true,
  51. message: '请选择审批结论',
  52. trigger: ['change'],
  53. },
  54. },
  55. sionList: [
  56. { value: '1', text: '通过' },
  57. { value: '0', text: '驳回' },
  58. ],
  59. };
  60. },
  61. methods: {
  62. async handleConfirm() {
  63. try {
  64. uni.$c.loading();
  65. await this.$refs.uForm.validate();
  66. await audited({ id: this.rId, ...this.fmData });
  67. uni.hideLoading();
  68. uni.$c.toast({
  69. title: '审批成功',
  70. icon: 'success',
  71. });
  72. this.handleClose();
  73. this.$emit('reload');
  74. } catch (e) {
  75. uni.hideLoading();
  76. throw new Error(e);
  77. }
  78. },
  79. handleClose() {
  80. this.$refs.uForm.resetFields();
  81. this.fmData.agree = '';
  82. this.fmData.message = '';
  83. this.$emit('update:isShow', false);
  84. },
  85. },
  86. };
  87. </script>
  88. <style scoped></style>