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.

129 lines
3.7 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 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" multiple :on-remove="onRemove"
  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. file: ''
  58. },
  59. }
  60. },
  61. methods: {
  62. // 初始化组件的参数
  63. init (currentRow) {
  64. // 初始化参数
  65. this.pageData = JSON.parse(JSON.stringify(currentRow))
  66. // 打开页面
  67. this.visible = true
  68. },
  69. // 上传之前
  70. beforeUploadHandle (file) {},
  71. // 选择上传文件时
  72. onChange (file) {
  73. this.fileList.push(file)
  74. },
  75. onRemove (file,fileList) {
  76. this.fileList = fileList
  77. },
  78. // 关闭modal
  79. closeDialog () {
  80. this.fileList = []
  81. this.$refs.uploadFile.clearFiles()
  82. // 关闭当前的页面
  83. this.visible = false
  84. },
  85. // 保修当前的数据
  86. saveUploadFile () {
  87. if (this.pageData.fileRemark == null) {
  88. this.pageData.fileRemark = ''
  89. }
  90. // 判断文件是否上传
  91. if (this.fileList == null || this.fileList.length === 0) {
  92. this.$message.error("请先上传文件!")
  93. return false
  94. }
  95. for (let i = 0; i < this.fileList.length; i++) {
  96. this.pageData.file[i] = this.fileList[i].raw
  97. }
  98. //this.pageData.file = this.fileList
  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>