approvalDialog.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <!-- 请示批复 -->
  2. <template>
  3. <van-popup v-model:show="visible">
  4. <van-form @submit="on_submit">
  5. <div class="van-doc-block__title">请示批复</div>
  6. <van-cell-group inset>
  7. <van-field
  8. required
  9. v-model="form.approval_content"
  10. placeholder="请填写批复内容"
  11. :rules="[{ required: true, message: '请填写批复内容' }]"
  12. rows="3"
  13. autosize
  14. type="textarea"
  15. maxlength="150"
  16. show-word-limit
  17. />
  18. </van-cell-group>
  19. <div style="margin: 3.0vmin;display: flex;
  20. flex-direction: row;
  21. justify-content: flex-end;">
  22. <div style="display: flex; flex-direction: row; justify-content: space-between;">
  23. <van-button @click="closeDialog(false)" style="margin-right:10px;">取 消</van-button>
  24. <van-button type="primary" native-type="submit">确 定</van-button>
  25. </div>
  26. </div>
  27. </van-form>
  28. </van-popup>
  29. </template>
  30. <script lang="ts" setup>
  31. import { getCurrentInstance, ref, watch, defineEmits } from 'vue';
  32. import { addApproval } from '@/api/emergencyCommandMap/JointDuty';
  33. import { showSuccessToast } from 'vant';
  34. const proxy = getCurrentInstance()?.proxy;
  35. interface Form {
  36. feeback_id: string;
  37. approval_content: string;
  38. }
  39. interface Props {
  40. modelValue: boolean;
  41. data: Form;
  42. }
  43. const form = ref<Form>({
  44. feeback_id: "",
  45. approval_content: ""
  46. });
  47. const props = withDefaults(defineProps<Props>(), {
  48. modelValue: false
  49. });
  50. const emits = defineEmits(['update:modelValue']);
  51. watch(
  52. () => props.modelValue,
  53. () => {
  54. if (props.modelValue) {
  55. form.value = props.data;
  56. }
  57. visible.value = props.modelValue;
  58. }
  59. );
  60. const visible = ref(false);
  61. const on_submit = () => {
  62. console.log('on_submit');
  63. addApproval(form.value).then((res) => {
  64. showSuccessToast(res.msg);
  65. closeDialog(true)
  66. }).catch((err) => {
  67. });
  68. };
  69. const closeDialog = (t) => {
  70. emits('update:modelValue', t);
  71. };
  72. </script>
  73. <style lang="scss" scoped>
  74. .van-doc-block__title {
  75. color: var(--van-doc-text-color-4);
  76. margin: 0px;
  77. padding: 3vmin;
  78. font-size: 4.6vmin;
  79. font-weight: 600;
  80. line-height: 6.0vmin;
  81. }
  82. </style>