insert.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view>
  3. <my_form ref="form" :form="form" @isUncomplete="isUncomplete" @onUploading="onUploading" />
  4. <view class="footer">
  5. <view class="but" :class="(uncomplete || onUpload) ? 'forbidden' : ''" hover-class="navigator-hover"
  6. @click="(uncomplete || onUpload) ? '' : submit()">
  7. 立即提交
  8. </view>
  9. </view>
  10. <view style="height: 75px;" />
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. data() {
  16. return {
  17. form: [],
  18. uncomplete: true,
  19. pageType: 4,
  20. onUpload: false,
  21. isSubmit: false,
  22. }
  23. },
  24. onUnload() {
  25. if (!this.isSubmit) this.$refs.form.deleteFiles()
  26. },
  27. onLoad(options) {
  28. this.pageType = options.pageType == '设计' ? 4 : 5
  29. uni.setNavigationBarTitle({
  30. title: '意见反馈'
  31. });
  32. this.initForm()
  33. },
  34. methods: {
  35. async initForm() {
  36. this.form = [{
  37. key: "type",
  38. type: "customClass",
  39. label: "选择反馈类型",
  40. isMust: true,//是否必填
  41. isMultipleChoice: false,//是否多选
  42. value: '',
  43. list: [{remarks:'建议',value:'建议'},{remarks:'投诉',value:'投诉'}],
  44. marginTop: 10
  45. }, {
  46. key: "remarks",
  47. type: "textarea2",
  48. label: "反馈描述",
  49. isMust: true,//是否必填
  50. value: '',
  51. unBorBot:true,
  52. marginTop: 10,
  53. },{
  54. key: "attachmentids",
  55. type: "upload",
  56. label: "图片/视频",
  57. placeholder: "上传凭证(图片/视频)",
  58. accept: "media",
  59. ownertable: "temporary",
  60. ownerid: 999,
  61. usetype: 'default',
  62. allowUpload: true,
  63. allowDelete: true,
  64. value: [],
  65. marginTop: 10
  66. }]
  67. },
  68. isUncomplete(uncomplete) {
  69. this.uncomplete = uncomplete;
  70. },
  71. submit() {
  72. this.$refs.form.submit().then(data => {
  73. this.onUpload = true;
  74. this.$Http.basic({
  75. "id": 20240517102502,
  76. "content": {
  77. "sa_feedbackid": 0,
  78. "type": data.type,
  79. "remarks": data.remarks
  80. },
  81. }).then(async res => {
  82. this.onUpload = false;
  83. console.log("新建", res)
  84. if (this.cutoff(res.msg)) return;
  85. if (data.files.temporarys.length) {
  86. this.onUpload = true;
  87. await this.$Http.basic({
  88. "classname": "system.attachment.Attachment",
  89. "method": "createFileLink",
  90. "content": {
  91. ownertable: 'sa_feedback',
  92. ownerid: res.data.sa_feedbackid,
  93. usetype: 'default',
  94. attachmentids: data.files.temporarys
  95. }
  96. }).then(async s => {
  97. this.isSubmit = true;
  98. this.onUpload = false;
  99. console.log("绑定附加", s)
  100. if (this.cutoff(s.msg)) return;
  101. })
  102. };
  103. uni.navigateBack()
  104. if (this.$Http.updateList) return this.$Http.updateList(res.data);
  105. })
  106. console.log("页面", data)
  107. })
  108. },
  109. onUploading(ing) {
  110. this.onUpload = ing;
  111. },
  112. },
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. .footer {
  117. position: fixed;
  118. bottom: 0;
  119. width: 375px;
  120. height: 65px;
  121. background: #FFFFFF;
  122. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  123. border-radius: 0px 0px 0px 0px;
  124. .but {
  125. width: 355px;
  126. height: 45px;
  127. background: #C30D23;
  128. border-radius: 5px;
  129. margin: 5px auto;
  130. text-align: center;
  131. line-height: 45px;
  132. font-size: 14px;
  133. color: #FFFFFF;
  134. }
  135. .forbidden {
  136. opacity: .6;
  137. }
  138. }
  139. </style>