addaduit.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <template>
  2. <view>
  3. <view>
  4. <u-form :model="dataobj" ref="uForm">
  5. <u-form-item class='typeform' :border-bottom='false' label="类型"><view style='color:#000;width:100%;text-align:right;' @click='typeselect'>{{dataobj.businessType?dataobj.businessType:'请选择类型 >'}}</view></u-form-item>
  6. </u-form>
  7. <u-form :model="dataobj" ref="uForm">
  8. <u-form-item :border-bottom='false' :label-position='"top"' label="备注">
  9. <view class="u-textarea-style">
  10. <view class="right-bottom">
  11. {{dataobj.remark.length}}/2000个字
  12. </view>
  13. <!-- <u-input class="" v-model='auditMind' placeholder="请在此输入审核意见" type="textarea" height="414"
  14. maxlength="100" /> -->
  15. <textarea style='font-size:12px;' maxlength="2000" v-model='dataobj.remark' placeholder="请输入备注信息" name="" id="" cols="30" rows="11"></textarea>
  16. </view>
  17. </u-form-item>
  18. </u-form>
  19. <view class='wrap'>
  20. <view class="c-row">
  21. <view class="title">
  22. <view>附件</view><view><text style='color:#617AE0;'>{{imglist2.length}}</text>/20</view></view>
  23. </view>
  24. <view style="display: flex;flex-wrap: wrap;">
  25. <view v-for='(item,index) in imglist2' v-if="imglist2 && imglist2.length > 0"
  26. style="position: relative;margin:20rpx 0 20rpx 20rpx;">
  27. <view class="delete_img" @click="deleteImg(index)">X</view>
  28. <image :src="item.appendixPath" mode="" style="width: 100px;height: 100px;"></image>
  29. </view>
  30. <view class="biankuang" @click="uploadClick" v-if="imglist2.length < 20">
  31. <view class="tubiao">
  32. 上传附件
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <u-picker @confirm='typeconfirm' :range="xialaList" mode="selector" v-model="show" range-key="constValue" :default-selector="[0]"></u-picker>
  38. </view>
  39. <u-toast ref="uToast" />
  40. <view class="bottom-btn">
  41. <view @click="submit()" class="btn">提交</view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import {
  47. mapState
  48. } from 'vuex';
  49. import * as config from '../../config'
  50. export default {
  51. data() {
  52. return {
  53. xialaList:[],
  54. show:false,
  55. dataobj:{remark:''},
  56. imglist:[],
  57. imglist2:[]
  58. }
  59. },
  60. onShow(){
  61. this.getList()
  62. },
  63. computed: {
  64. ...mapState(['hasLogin', 'userInfo']),
  65. },
  66. watch: {
  67. imglist: {
  68. handler: function() {
  69. this.$api.doRequest('get', 'appendix/query/getFileList', {
  70. appendixIds: this.imglist.toString()
  71. }).then(res => {
  72. this.imglist2 = res.data.data
  73. })
  74. },
  75. deep: true
  76. }
  77. },
  78. methods: {
  79. async uploadClick() {
  80. let baseUrlNew = config.def().baseUrlNew
  81. console.log('baseUrlNew',baseUrlNew)
  82. let pcUserInfo = uni.getStorageSync('pcUserInfo')
  83. if(!pcUserInfo){
  84. uni.showToast({
  85. title:"登录已失效,请重新登录"
  86. })
  87. return
  88. }
  89. uni.chooseImage({
  90. count:10,
  91. success: (chooseImageRes) => {
  92. console.log('chooseImageRes',chooseImageRes)
  93. let files = []
  94. for (let item of chooseImageRes.tempFiles) {
  95. files.push({
  96. name: 'fileName',
  97. uri : item.path
  98. });
  99. }
  100. uni.uploadFile({
  101. url: baseUrlNew + 'appendix/api/uploadFiles',
  102. // url: baseUrlNew+'appendix/api/uploadFiles', //仅为示例,非真实的接口地址
  103. files: files,
  104. formData: {
  105. // fileName: chooseImageRes.tempFiles[0],
  106. companyId: pcUserInfo.compId,
  107. modelId: '',
  108. vesselId: '',
  109. },
  110. success: (uploadFileRes) => {
  111. console.log(JSON.parse(uploadFileRes.data))
  112. var data = JSON.parse(uploadFileRes.data).data
  113. data.compId = pcUserInfo.compId
  114. this.$api.doRequest('post', '/appendix/api/saveFilesApp', {
  115. newAppendixs: [data],
  116. oldAppendixIds: ""
  117. }).then(res => {
  118. this.imglist.push(res.data.data[0])
  119. console.log(res)
  120. })
  121. console.log(uploadFileRes.data);
  122. },
  123. fail(res) {
  124. console.log(res);
  125. }
  126. });
  127. }
  128. });
  129. },
  130. deleteImg(index) {
  131. this.imglist.splice(index, 1)
  132. },
  133. getList(){
  134. this.$api.doRequest('get', '/commonSysParameter/getInfo', {
  135. constId:'EXA1'
  136. }).then(res => {
  137. this.xialaList=res.data.data
  138. })
  139. },
  140. typeselect(){
  141. this.show=true
  142. },
  143. typeconfirm(e){
  144. console.log(this.xialaList[e[0]])
  145. this.dataobj.businessType=this.xialaList[e[0]].constValue
  146. },
  147. submit() {
  148. if (!this.dataobj.businessType) {
  149. this.$api.msg('类型不能为空')
  150. return
  151. }
  152. var that = this
  153. this.dataobj.compId=uni.getStorageSync('pcUserInfo').compId
  154. this.dataobj.sponsor=this.userInfo.userName
  155. uni.showModal({
  156. content: '确定发起申请?',
  157. showCancel: true,
  158. confirmText: '提交',
  159. success: function(res) {
  160. if (res.confirm) {
  161. if (that.imglist.length > 0) {
  162. that.dataobj.addressUrl = that.imglist.toString()
  163. }
  164. uni.showLoading({
  165. title: "加载中",
  166. mask: true
  167. })
  168. that.$api.doRequest('post', '/generalAuditInfo/api/insertGeneralAuditInfo', that.dataobj)
  169. .then(res => {
  170. if (res.data.code == 200) {
  171. uni.hideLoading()
  172. that.$api.msg('提交成功')
  173. uni.navigateBack({
  174. delta: 1
  175. });
  176. } else {
  177. that.$api.msg('提交失败')
  178. }
  179. })
  180. }
  181. }
  182. })
  183. },
  184. }
  185. }
  186. </script>
  187. <style lang="scss" scoped>
  188. page {
  189. background: #F5F6FA;
  190. }
  191. .u-form {
  192. margin: 20rpx;
  193. background: #fff;
  194. border-radius: 10px;
  195. padding: 30rpx 10px;
  196. .u-form-item {
  197. line-height: 30px;
  198. padding: 0px 0;
  199. font-size: 26rpx;
  200. color: #878C9C;
  201. }
  202. }
  203. .delete_img {
  204. position: absolute;
  205. z-index: 100;
  206. left: 84px;
  207. color: #ffffff;
  208. font-size: 24rpx;
  209. border: 1px;
  210. border-radius: 5rpx 5rpx 5rpx 20rpx;
  211. width: 32rpx;
  212. height: 32rpx;
  213. background-color: rgba(17, 26, 52, 0.5000);
  214. padding:0 3px 0 5px;
  215. text-align: center;
  216. }
  217. .title_b {
  218. margin: 20rpx 20rpx 0rpx 20rpx;
  219. padding: 20rpx 10rpx 20rpx 10rpx;
  220. font-size: 18px;
  221. font-weight: 550;
  222. }
  223. .xinxi {
  224. padding: 20rpx 30rpx;
  225. }
  226. .tubiao {
  227. margin: 0 auto;
  228. text-align: center;
  229. margin-top: 35rpx;
  230. }
  231. .biankuang {
  232. width: 100%;
  233. height: 120rpx;
  234. border-radius: 30px;
  235. margin:0 20rpx;
  236. background:#F5F9FC;
  237. color:#617AE0;
  238. }
  239. .upload {
  240. width: 80rpx;
  241. height: 80rpx;
  242. }
  243. .c-row {
  244. display: -webkit-box;
  245. display: -webkit-flex;
  246. display: flex;
  247. -webkit-box-align: center;
  248. -webkit-align-items: center;
  249. align-items: center;
  250. padding: 20rpx 30rpx;
  251. position: relative;
  252. }
  253. .con-list {
  254. -webkit-box-flex: 1;
  255. flex: 1;
  256. display: flex;
  257. -webkit-box-orient: vertical;
  258. -webkit-box-direction: normal;
  259. flex-direction: column;
  260. color: #303133;
  261. line-height: 20px;
  262. text-align: right;
  263. padding-right: 10px;
  264. justify-content: space-between;
  265. }
  266. .title {
  267. width:100%;
  268. display:flex;
  269. justify-content: space-between;
  270. }
  271. .buns_item {
  272. display: flex;
  273. padding: 80rpx 0 50rpx 0;
  274. justify-content: space-around;
  275. }
  276. .but_css {
  277. background: #22C572;
  278. width: 40%;
  279. padding: 20rpx;
  280. color: #fff;
  281. text-align: center;
  282. border-radius: 20rpx;
  283. }
  284. /deep/.u-radio-group {
  285. flex-direction: row-reverse;
  286. }
  287. .no-boder {
  288. border: 0;
  289. }
  290. .textarea {
  291. background: #F9F9FA;
  292. border: 1px solid #EEEEEE;
  293. }
  294. .remark {
  295. position: absolute;
  296. right: 10px;
  297. bottom: 20px;
  298. color: #AFB3BF;
  299. }
  300. .submit {
  301. width: 100%;
  302. background: #2c8ac5;
  303. border-radius: 10rpx;
  304. }
  305. .bottom-btn {
  306. padding: 30rpx;
  307. background: #FFFFFF;
  308. width: 100%;
  309. position: fixed;
  310. bottom: 0rpx;
  311. display: flex;
  312. z-index: 9999;
  313. }
  314. .content {
  315. overflow: hidden;
  316. }
  317. .btn {
  318. border-radius: 50rpx;
  319. padding: 20rpx 0;
  320. background: #22C572;
  321. color: #fff;
  322. font-size: 32rpx;
  323. width: 100%;
  324. box-sizing: border-box;
  325. display: flex;
  326. justify-content: center;
  327. }
  328. .margin-bottom{
  329. margin-bottom:84px;
  330. }
  331. .u-textarea-style {
  332. margin: 20rpx;
  333. background: #F9F9FA;
  334. border-radius: 10px;
  335. border: 1px solid #EEEEEE;
  336. padding: 10rpx 20rpx;
  337. position: relative;
  338. height:240px;
  339. /deep/.uni-textarea-textarea{
  340. width: 80%;
  341. }
  342. .right-bottom {
  343. position: absolute;
  344. right: 20rpx;
  345. bottom: 20rpx;
  346. color: #AFB3BF;
  347. }
  348. }
  349. .wrap{
  350. border-radius:10px;
  351. background:#fff;
  352. margin:10px 10px 80px 10px;
  353. padding:0 0 10px 0;
  354. }
  355. </style>