plm前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
4.4 KiB

  1. <template>
  2. <div class="customer-css">
  3. <el-dialog :title="pageData.titleCon" :close-on-click-modal="false" :visible.sync="visible" width="390px" style="height: 520px;" class="customer-dialog">
  4. <el-form :inline="true" label-position="top" label-width="80px">
  5. <el-row>
  6. <el-col :span="12">
  7. <el-form-item class="customer-item" label="申请单号:" >
  8. <el-input v-model="pageData.quotationNo" readonly style="width: 120px"></el-input>
  9. <!-- <el-select v-model="pageData.quotationNo" placeholder="请选择" style="width: 120px;">-->
  10. <!-- <el-option-->
  11. <!-- v-for = "item in options"-->
  12. <!-- :key = "item.key"-->
  13. <!-- :label = "item.value"-->
  14. <!-- :value = "item.value">-->
  15. <!-- </el-option>-->
  16. <!-- </el-select>-->
  17. </el-form-item>
  18. </el-col>
  19. </el-row>
  20. <el-row>
  21. <el-col :span="24">
  22. <el-upload class="customer-upload" drag
  23. action="javascript:void(0);" ref="uploadFile" :limit="1"
  24. :before-upload="beforeUploadHandle" :on-change="onChange"
  25. accept="*" :auto-upload="false"
  26. style="text-align: left;">
  27. <i class="el-icon-upload"></i>
  28. <div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
  29. </el-upload>
  30. </el-col>
  31. </el-row>
  32. <el-row>
  33. <el-col :span="24" style="margin-bottom: 30px;">
  34. <el-form-item class="customer-item" label="备注:" >
  35. <el-input type="textarea" style="width: 360px;" placeholder="请输入内容" v-model="pageData.fileRemark"></el-input>
  36. </el-form-item>
  37. </el-col>
  38. </el-row>
  39. <el-row>
  40. </el-row>
  41. </el-form>
  42. <span slot="footer" class="dialog-footer">
  43. <el-button type="primary" @click="saveUploadFile()">保存</el-button>
  44. <el-button type="primary" @click="closeDialog">关闭</el-button>
  45. </span>
  46. </el-dialog>
  47. </div>
  48. </template>
  49. <script>
  50. import {
  51. uploadFile // 文件上传
  52. } from '@/api/quotation/quotationInformation.js'
  53. export default {
  54. data() {
  55. return {
  56. folder: '',
  57. visible: false,
  58. fileList: [],
  59. pageData: {
  60. titleCon: '',
  61. site: this.$store.state.user.site,
  62. createBy: this.$store.state.user.name,
  63. quotationNo: '',
  64. fileRemark: '',
  65. folder: '',
  66. // options: []
  67. },
  68. // options: [],
  69. dataListLoading: false,
  70. }
  71. },
  72. methods: {
  73. // 初始化组件的参数
  74. init(currentRow) {
  75. // 初始化参数
  76. this.pageData = JSON.parse(JSON.stringify(currentRow))
  77. // this.options = this.pageData.options
  78. this.folder = this.pageData.folder
  79. // 打开页面
  80. this.visible = true
  81. },
  82. // 上传之前
  83. beforeUploadHandle(file) {},
  84. /*选择上传文件时*/
  85. onChange(file){
  86. this.fileList.push(file)
  87. },
  88. /*关闭modal*/
  89. closeDialog(){
  90. this.fileList = []
  91. // 刷新报工的页面
  92. this.$emit('refreshPageTables')
  93. //关闭当前的页面
  94. this.visible = false
  95. },
  96. /*保修当前的数据*/
  97. saveUploadFile(){
  98. let remark = this.pageData.fileRemark
  99. if(remark == null || remark == undefined){
  100. remark = ''
  101. }
  102. /*判断文件是否上传*/
  103. if(this.fileList == null || this.fileList.length === 0){
  104. this.$message.error("请先上传文件!")
  105. return false
  106. }
  107. // if(this.pageData.quotationNo === '' || this.pageData.quotationNo == null){
  108. // this.$message.error("请选择申请单号!")
  109. // return false
  110. // }
  111. const formData = new FormData()
  112. //片接文件
  113. formData.append("file", this.fileList[0].raw)
  114. formData.append("folder", this.folder)
  115. formData.append("orderRef1", this.pageData.site)
  116. formData.append("orderRef2", this.pageData.quotationNo)
  117. formData.append("fileRemark", remark)
  118. uploadFile(formData).then(({data}) => {
  119. if (data.code === 0) {
  120. this.$message.success(data.msg)
  121. // 清空文件上传记录
  122. this.$refs.uploadFile.clearFiles()
  123. this.pageData.fileRemark = ''
  124. this.fileList = []
  125. }else {
  126. this.$message.warning(data.msg)
  127. }
  128. })
  129. }
  130. },
  131. }
  132. </script>
  133. <style scoped lang="scss">
  134. </style>