4ed0bb8deb3cfb112b322eb46d69d4cb8ecf7bc9.svn-base 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <el-form ref="problemForm" :rules="rules" :model="problemForm" label-width="100px">
  3. <el-form-item label="详细描述" prop="inspPblmDesc">
  4. <el-input
  5. type="textarea"
  6. :rows="2"
  7. placeholder="请输入内容"
  8. v-model="problemForm.inspPblmDesc"
  9. required
  10. ></el-input>
  11. </el-form-item>
  12. <el-form-item label="列为典型问题" style="text-align:left">
  13. <el-radio v-model="problemForm.ifCasePblm" label="1">是</el-radio>
  14. <el-radio v-model="problemForm.ifCasePblm" label="0">否</el-radio>
  15. </el-form-item>
  16. <el-form-item label="上传照片">
  17. <upload
  18. ref="uploadFile"
  19. :url="`/pdcApi/file/insert?bizId=`"
  20. @uploadOver="removeNewSupervision"
  21. ></upload>
  22. </el-form-item>
  23. <el-form-item style="margin-top: 50px">
  24. <el-button type="primary" @click="onSubmit('problemForm')" style="width: 100px;float:right">保存</el-button>
  25. </el-form-item>
  26. </el-form>
  27. </template>
  28. <script>
  29. import request from '@util/gw_ajax_request.js'
  30. import {
  31. submitUpload
  32. } from "@api/duChaAPI.js"
  33. export default {
  34. props: ['objId', 'objName', 'villType', 'objType', 'problemMiddleType', 'problemSmallType', 'engId', 'currentObjectRgstrId', 'problData'],
  35. data () {
  36. return {
  37. problemForm: {
  38. objId: "",
  39. regid: '',
  40. objType: "",
  41. inspPblmDesc: "",
  42. ifCasePblm: '0',
  43. recPers: "",
  44. gwComFiles: [{
  45. id: "",
  46. filePath: "",
  47. bizId: ""
  48. }]
  49. },
  50. imgList: [],
  51. videoList: [],
  52. audioList: [],
  53. pblmStat: '',
  54. gwComFiles: [],
  55. rules: {
  56. inspPblmDesc: [{
  57. required: true,
  58. message: '请输入描述',
  59. trigger: 'blur'
  60. },
  61. ],
  62. }
  63. }
  64. },
  65. components: {
  66. upload: resolve => {
  67. require(["../../../widgets/uploadFile.vue"], resolve)
  68. },
  69. },
  70. computed: {
  71. recPers () {
  72. return localStorage.getItem('userid') ? localStorage.getItem('userid') : ''
  73. }
  74. },
  75. created () {
  76. },
  77. methods: {
  78. onSubmit (problemForm) {
  79. this.$refs[problemForm].validate((valid) => {
  80. if (valid) {
  81. this.problemForm.recPers = this.recPers
  82. this.problemForm.objId = this.objId
  83. this.problemForm.regid = this.currentObjectRgstrId
  84. this.problemForm.objType = this.objType
  85. this.problemForm.inspPblmType = 2
  86. this.problemForm.inspPblmName = this.objName
  87. console.log(this.problemForm)
  88. if (!this.problemForm.inspPblmDesc) {
  89. this.$message.info('请填写详细描述')
  90. return
  91. }
  92. request.post('/dc/insp/pblm', this.problemForm).then(res => {
  93. if (res.success) {
  94. this.pblmId = res.data.pblmId
  95. this.gwComFiles = []
  96. this.pblmStat = res.data.pblmStat
  97. if (this.$refs.uploadFile.submitUpload(res.data.pblmId)) {
  98. this.removeNewSupervision()
  99. }
  100. this.$message.success('保存成功')
  101. this.$emit('closeDialog')
  102. }
  103. })
  104. } else {
  105. console.log('error submit!!')
  106. return false
  107. }
  108. })
  109. },
  110. // 文件上传
  111. submitUpload () {
  112. this.$refs.upload.submit()
  113. },
  114. updatefilelist (arg) {
  115. request.post('/dc/insp/pblm/update', {
  116. pblmId: this.pblmId,
  117. gwComFiles: arg,
  118. pblmStat: this.pblmStat
  119. }).then(res => {
  120. this.removeNewSupervision()
  121. this.$message.success('保存成功')
  122. this.$emit('closeDialog')
  123. this.gwComFiles = []
  124. this.$refs.uploadFile.init()
  125. })
  126. },
  127. removeNewSupervision (arg) {
  128. if (arg) {
  129. console.log(arg)
  130. var args = this.gwComFiles.concat(arg)
  131. this.updatefilelist(args)
  132. }
  133. },
  134. },
  135. watch: {
  136. },
  137. }
  138. </script>
  139. <style>
  140. .media_item {
  141. float: left;
  142. width: 60px;
  143. font-size: 32px;
  144. }
  145. </style>