finish.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <el-dialog title="反馈" :visible.sync="dialogFormVisible" @close="close">
  3. <el-form ref="form" :model="form" :rules="rules">
  4. <el-row :gutter="20">
  5. <!-- <el-col :span="24">
  6. <el-form-item label="讲解时长" prop="explainDuration">
  7. <el-input v-model="form.explainDuration" />
  8. </el-form-item>
  9. </el-col> -->
  10. <el-col :span="24">
  11. <el-form-item label="提问记录" prop="questionRecord">
  12. <el-input v-model="form.questionRecord" :rows="2" type="textarea" />
  13. </el-form-item>
  14. </el-col>
  15. <el-col :span="24">
  16. <el-form-item label="培训效果总结" prop="trainSummary">
  17. <el-input v-model="form.trainSummary" :rows="2" type="textarea" />
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="24">
  21. <el-form-item label="下一步工作计划" prop="nextStep">
  22. <el-upload
  23. ref="uploadRef"
  24. action="#"
  25. :before-upload="
  26. (file) => {
  27. return beforeAvatarUpload(file)
  28. }
  29. "
  30. :http-request="uploadRequest"
  31. :limit="1">
  32. <el-button size="mini" type="primary">点击上传</el-button>
  33. </el-upload>
  34. </el-form-item>
  35. </el-col>
  36. </el-row>
  37. </el-form>
  38. <template #footer>
  39. <el-button @click="close">取 消</el-button>
  40. <el-button type="primary" @click="save">确 定</el-button>
  41. </template>
  42. </el-dialog>
  43. </template>
  44. <script>
  45. import Api from '@/api/work/trainSale'
  46. import axios from 'axios'
  47. import asyncUploadFile from '@/utils/uploadajax'
  48. export default {
  49. name: 'WorkOrderFeedback',
  50. data() {
  51. return {
  52. fileList: [],
  53. fileSettings: {
  54. // 文件配置信息
  55. fileSize: 52428800,
  56. fileTypes: '.pdf,.doc,.docx,.zip,.xls,.xlsx,.rar,.jpg,.jpeg,.gif,.png,.jfif,.txt',
  57. pictureSize: 52428800,
  58. pictureTypes: '.jpg,.jpeg,.gif,.png,.jfif,.txt',
  59. types: '.pdf,.doc,.docx,.zip,.xls,.xlsx,.rar,.jpg,.jpeg,.gif,.png,.jfif,.mp4,.txt',
  60. videoSize: 104857600,
  61. videoType: '.mp4',
  62. },
  63. form: {
  64. orderId: undefined,
  65. explainDuration: undefined,
  66. questionRecord: undefined,
  67. trainSummary: undefined,
  68. nextStep: undefined,
  69. },
  70. rules: {
  71. explainDuration: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
  72. questionRecord: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
  73. trainSummary: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
  74. },
  75. dialogFormVisible: false,
  76. }
  77. },
  78. mounted() {},
  79. methods: {
  80. // 上传附件
  81. beforeAvatarUpload(file) {
  82. let flag1 = file.size < this.fileSettings.fileSize
  83. if (!flag1) {
  84. this.$message.warning('文件过大,请重新选择!')
  85. return false
  86. }
  87. let flag2 = this.fileSettings.fileTypes.split(',').includes('.' + file.name.split('.').pop())
  88. if (!flag2) {
  89. this.$message.warning('文件类型不符合,请重新选择!')
  90. return false
  91. }
  92. return true
  93. },
  94. // 上传
  95. uploadRequest(option) {
  96. let _this = this
  97. let url = process.env.VUE_APP_UPLOAD_WEED
  98. axios
  99. .post(url)
  100. .then(function (res) {
  101. if (res.data && res.data.fid && res.data.fid !== '') {
  102. option.action = `${process.env.VUE_APP_PROTOCOL}${res.data.publicUrl}/${res.data.fid}`
  103. asyncUploadFile(option).then(() => {
  104. _this.form.fileName = option.file.name
  105. _this.form.fileUrl = `${process.env.VUE_APP_PROTOCOL}${res.data.publicUrl}/${res.data.fid}` // 资料存储url
  106. })
  107. } else {
  108. _this.$message({
  109. type: 'warning',
  110. message: '未上传成功!请刷新界面重新上传!',
  111. })
  112. }
  113. })
  114. .catch(function () {
  115. _this.$message({
  116. type: 'warning',
  117. message: '未上传成功!请重新上传!',
  118. })
  119. })
  120. },
  121. showEdit(row) {
  122. this.form = {
  123. applyId: row.id,
  124. explainDuration: undefined,
  125. questionRecord: undefined,
  126. trainSummary: undefined,
  127. nextStep: undefined,
  128. }
  129. this.dialogFormVisible = true
  130. },
  131. close() {
  132. this.$refs['form'].resetFields()
  133. this.form = this.$options.data().form
  134. this.dialogFormVisible = false
  135. },
  136. save() {
  137. this.$refs['form'].validate(async (valid) => {
  138. if (valid) {
  139. console.log(this.form)
  140. this.form.nextStep = this.form.fileUrl
  141. const { msg } = await Api.doAddSummary(this.form)
  142. this.$baseMessage(msg, 'success', 'vab-hey-message-success')
  143. this.$emit('fetch-data')
  144. this.close()
  145. }
  146. })
  147. },
  148. },
  149. }
  150. </script>