problem_feedback.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="wrap">
  3. <uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="300" label-position="top">
  4. <uni-forms-item label="问题描述" name="remark">
  5. <uni-easyinput v-model="formData.snapshotContent" type="textarea" :maxlength="-1" autoHeight placeholder="备注" />
  6. </uni-forms-item>
  7. <!-- <uni-forms-item label="处理人员" name="accountId" required >
  8. <uni-data-select v-model="formData.accountId" :localdata="userList"></uni-data-select>
  9. </uni-forms-item> -->
  10. <uni-file-picker v-model="formData.attachList"
  11. fileMediatype="image"
  12. title="附件"
  13. limit="1"
  14. @select="uploadSuccess"
  15. @delete="deleteFile"></uni-file-picker>
  16. </uni-forms>
  17. <button type="primary" @click="onSubmit" class="submit-BT">提交</button>
  18. </view>
  19. </template>
  20. <script>
  21. import {upload} from '@/api/system/upload.js'
  22. import {getUserList} from '@/api/system/user.js'
  23. import { createSnapshot } from '@/api/aqpt/snapshotApi'
  24. export default {
  25. data() {
  26. return {
  27. formData:{
  28. snapshotContent:"",
  29. attachList:[]
  30. },
  31. userList:[],
  32. rules:{},
  33. snapshot:{}
  34. }
  35. },
  36. onLoad() {
  37. this.init()
  38. },
  39. methods: {
  40. init(){
  41. this.getUserList()
  42. },
  43. async onSubmit() {
  44. let attachList=[]
  45. for(let i=0;i<this.formData.attachList.length;i++){
  46. let filePath=this.formData.attachList[i].url
  47. let fileresq=await upload({filePath})
  48. fileresq=JSON.parse(fileresq)
  49. attachList.push(fileresq.data)
  50. }
  51. let qrcode=uni.getStorageSync('qrcode')
  52. let qrcode_target={
  53. targetId:qrcode.targetId,
  54. targetType:qrcode.targetType,
  55. targetTitle:qrcode.targetTitle,
  56. targetGroupId:qrcode.groupId,
  57. targetGroupName:qrcode.groupName,
  58. }
  59. // let flow=this.userList.filter(item=>this.formData.accountId===item.accountId)[0]
  60. // this.handleSelectUser(flow)
  61. await createSnapshot({
  62. ...this.formData,
  63. ...qrcode_target,
  64. attachList:attachList
  65. }).then(()=>{
  66. uni.showToast({
  67. icon:'none',
  68. title:"提交成功!",
  69. complete() {
  70. uni.$emit('type',5)
  71. uni.switchTab({
  72. url:'/pages/history/history?type=snapshot'
  73. })
  74. }
  75. })
  76. })
  77. .catch(()=>{
  78. uni.showToast({
  79. icon:'none',
  80. title:"提交失败!"
  81. })
  82. })
  83. },
  84. uploadSuccess(e){
  85. let attachList=JSON.parse(JSON.stringify(this.formData.attachList))
  86. attachList.push(e.tempFiles[0])
  87. this.formData.attachList=attachList
  88. },
  89. deleteFile(e){
  90. let attachList=JSON.parse(JSON.stringify(this.formData.attachList))
  91. attachList.filter(item=>item.uuid!==e.tempFile.uuid)
  92. this.formData.attachList=attachList
  93. },
  94. handleSelectUser(item) {
  95. this.formData.handleAccountId = item.accountId
  96. this.formData.handleAccountName = item.accountName
  97. this.formData.handlePositionId = item.positionId
  98. this.formData.handlePositionName = item.positionName
  99. this.formData.handleGroupId = item.groupId
  100. this.formData.handleGroupName = item.groupName
  101. },
  102. getUserList(){
  103. getUserList().then((res)=>{
  104. var userList=[]
  105. for (var i = 0; i < res.data.length; i++) {
  106. userList.push({
  107. value: -i,
  108. text: res.data[i].name,
  109. disable:true
  110. })
  111. for(let j = 0; j < res.data[i].children.length; j++){
  112. userList.push({
  113. ...res.data[i].children[j],
  114. value: res.data[i].children[j].accountId,
  115. text: res.data[i].children[j].accountName
  116. })
  117. }
  118. }
  119. this.userList=userList
  120. })
  121. }
  122. },
  123. onUnload() {
  124. uni.removeStorageSync('hazard')
  125. }
  126. }
  127. </script>
  128. <style lang="scss" scoped>
  129. .wrap{
  130. padding: 32rpx;
  131. padding-bottom: 200rpx;
  132. .submit-BT {
  133. width: 750rpx;
  134. height:156rpx;
  135. line-height:88rpx;
  136. color: #4D73FF;
  137. text-align: center;
  138. font-size: 32rpx;
  139. padding-bottom: 68rpx;
  140. background-color: #fff;
  141. position: fixed;
  142. left: 0;
  143. bottom: 0;
  144. z-index: 99;
  145. box-shadow: 0px 0px 12px 0px #0000000A;
  146. border-radius: 8px 8px 0px 0px
  147. }
  148. }
  149. </style>