loseSignDialog.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <!-- 减签审批弹窗 -->
  3. <el-dialog v-model="reviewVisibleDialog" title="审批减签" width="700" destroy-on-close>
  4. <el-form ref="formRef" v-loading="uploadLoading" label-position="top" element-loading-text="图片上传中..." :model="form" label-width="80px">
  5. <el-form-item label="给谁减签" prop="review" :rules="[{ required: true, message: '请选择减签人员' }]">
  6. <el-select v-model="form.deliverTo" placeholder="请选择减签人员">
  7. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  8. </el-select>
  9. </el-form-item>
  10. <el-form-item label="审批意见" prop="review">
  11. <el-input v-model="form.review" type="textarea" placeholder="请输入内容" maxlength="64" show-word-limit> </el-input>
  12. </el-form-item>
  13. <el-form-item prop="attachment" label="附件" class="example-img-box">
  14. <!--'.docx', '.doc', '.pptx', '.ppt', '.xlsx', '.xls', '.zip', '.csv', '.pdf', '.png', '.jpg' 因前端不支持图片以外格式,所以注释 -->
  15. <FileUpload
  16. v-model="form.attachment"
  17. source="project"
  18. return="array"
  19. :limit="5"
  20. :file-size="10"
  21. :accept="['.png', '.jpg']"
  22. @success="clearValidate"
  23. />
  24. </el-form-item>
  25. </el-form>
  26. <template #footer>
  27. <span class="dialog-footer">
  28. <el-button :loading="btnDisabled" @click="closeDialog">取 消</el-button>
  29. <el-button type="primary" :loading="btnDisabled" :disabled="uploadLoading" @click="submitForm">确 定</el-button>
  30. </span>
  31. </template>
  32. </el-dialog>
  33. </template>
  34. <script setup>
  35. import { computed, reactive, ref } from 'vue'
  36. import FileUpload from '@/components/FileUpload.vue'
  37. const props = defineProps({
  38. modelValue: {
  39. type: Boolean,
  40. default: false
  41. },
  42. taskId: {
  43. type: String,
  44. default: undefined
  45. }
  46. })
  47. const btnDisabled = ref(false)
  48. const form = reactive({
  49. deliverTo: '',
  50. review: '',
  51. attachment: []
  52. })
  53. const formRef = ref(null)
  54. const uploadLoading = ref(false)
  55. const options = [
  56. {
  57. value: 'Option1',
  58. label: 'Option1'
  59. },
  60. {
  61. value: 'Option2',
  62. label: 'Option2'
  63. },
  64. {
  65. value: 'Option3',
  66. label: 'Option3'
  67. },
  68. {
  69. value: 'Option4',
  70. label: 'Option4'
  71. },
  72. {
  73. value: 'Option5',
  74. label: 'Option5'
  75. }
  76. ]
  77. const $myEmit = defineEmits(['update:modelValue', 'successCb'])
  78. const submitForm = () => {
  79. btnDisabled.value = true
  80. const formData = { ...form }
  81. formRef.value
  82. .validate()
  83. .then(valid => {
  84. if (valid) {
  85. emit('successCb', formData)
  86. btnDisabled.value = false
  87. }
  88. })
  89. .catch(err => {
  90. console.error('挂起订单表单拦截', err)
  91. btnDisabled.value = false
  92. })
  93. }
  94. const closeDialog = () => {
  95. $myEmit('successCb')
  96. $myEmit('update:modelValue', false)
  97. }
  98. const reviewVisibleDialog = computed({
  99. get() {
  100. return props.modelValue
  101. },
  102. set(val) {
  103. $myEmit('update:modelValue', val)
  104. }
  105. })
  106. const clearValidate = () => {}
  107. </script>
  108. <style scoped>
  109. .example-img-box {
  110. width: 100% !important;
  111. }
  112. .example-img-box .el-form-item__content {
  113. display: block;
  114. }
  115. </style>