addSignDialog.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. showOrderDesc: {
  43. type: Boolean,
  44. default: true
  45. },
  46. // 1-审核 2-复审 3-审核,复审 ,第一版默认审核
  47. linkType: {
  48. type: String,
  49. default: '1'
  50. },
  51. taskId: {
  52. type: String,
  53. default: undefined
  54. }
  55. })
  56. const btnDisabled = ref(false)
  57. const form = reactive({
  58. deliverTo: '',
  59. review: '',
  60. attachment: []
  61. })
  62. const formRef = ref(null)
  63. const uploadLoading = ref(false)
  64. const options = [
  65. {
  66. value: 'Option1',
  67. label: 'Option1'
  68. },
  69. {
  70. value: 'Option2',
  71. label: 'Option2'
  72. },
  73. {
  74. value: 'Option3',
  75. label: 'Option3'
  76. },
  77. {
  78. value: 'Option4',
  79. label: 'Option4'
  80. },
  81. {
  82. value: 'Option5',
  83. label: 'Option5'
  84. }
  85. ]
  86. const $myEmit = defineEmits(['update:modelValue', 'confirm'])
  87. const submitForm = () => {
  88. btnDisabled.value = true
  89. const formData = { ...form }
  90. formRef.value
  91. .validate()
  92. .then(valid => {
  93. if (valid) {
  94. emit('confirm', formData)
  95. btnDisabled.value = false
  96. }
  97. })
  98. .catch(err => {
  99. console.error('挂起订单表单拦截', err)
  100. btnDisabled.value = false
  101. })
  102. }
  103. const closeDialog = () => {
  104. $myEmit('update:modelValue', false)
  105. }
  106. const reviewVisibleDialog = computed({
  107. get() {
  108. return props.modelValue
  109. },
  110. set(val) {
  111. $myEmit('update:modelValue', val)
  112. }
  113. })
  114. const clearValidate = () => {}
  115. </script>
  116. <style scoped>
  117. .example-img-box {
  118. width: 100% !important;
  119. }
  120. .example-img-box .el-form-item__content {
  121. display: block;
  122. }
  123. </style>