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.

130 lines
3.8 KiB

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