addaduit.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <view class='container'>
  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. url : item.path
  98. });
  99. }
  100. for (let i = 0; i < files.length; i++) {
  101. uni.uploadFile({
  102. url: baseUrlNew + 'appendix/api/uploadFiles',
  103. // url: baseUrlNew+'appendix/api/uploadFiles', //仅为示例,非真实的接口地址
  104. filePath: files[i].url,
  105. name: files[i].name,
  106. formData: {
  107. // fileName: chooseImageRes.tempFiles[0],
  108. companyId: pcUserInfo.compId,
  109. modelId: '',
  110. vesselId: '',
  111. },
  112. success: (uploadFileRes) => {
  113. console.log(JSON.parse(uploadFileRes.data))
  114. var data = JSON.parse(uploadFileRes.data).data
  115. data.compId = pcUserInfo.compId
  116. this.$api.doRequest('post', '/appendix/api/saveFilesApp', {
  117. newAppendixs: [data],
  118. oldAppendixIds: ""
  119. }).then(res => {
  120. this.imglist.push(res.data.data[0])
  121. console.log(res)
  122. })
  123. console.log(uploadFileRes.data);
  124. },
  125. fail(res) {
  126. console.log(res);
  127. }
  128. });
  129. }
  130. }
  131. });
  132. },
  133. deleteImg(index) {
  134. this.imglist.splice(index, 1)
  135. },
  136. getList(){
  137. this.$api.doRequest('get', '/commonSysParameter/getInfo', {
  138. constId:'EXA1'
  139. }).then(res => {
  140. this.xialaList=res.data.data
  141. })
  142. },
  143. typeselect(){
  144. this.show=true
  145. },
  146. typeconfirm(e){
  147. console.log(this.xialaList[e[0]])
  148. this.dataobj.businessType=this.xialaList[e[0]].constValue
  149. },
  150. submit() {
  151. if (!this.dataobj.businessType) {
  152. this.$api.msg('类型不能为空')
  153. return
  154. }
  155. var that = this
  156. this.dataobj.compId=uni.getStorageSync('pcUserInfo').compId
  157. this.dataobj.sponsor=this.userInfo.userName
  158. uni.showModal({
  159. content: '确定发起申请?',
  160. showCancel: true,
  161. confirmText: '提交',
  162. success: function(res) {
  163. if (res.confirm) {
  164. if (that.imglist.length > 0) {
  165. that.dataobj.addressUrl = that.imglist.toString()
  166. }
  167. uni.showLoading({
  168. title: "加载中",
  169. mask: true
  170. })
  171. that.$api.doRequest('post', '/generalAuditInfo/api/insertGeneralAuditInfo', that.dataobj)
  172. .then(res => {
  173. if (res.data.code == 200) {
  174. uni.hideLoading()
  175. that.$api.msg('提交成功')
  176. uni.navigateBack({
  177. delta: 1
  178. });
  179. } else {
  180. that.$api.msg('提交失败')
  181. }
  182. })
  183. }
  184. }
  185. })
  186. },
  187. }
  188. }
  189. </script>
  190. <style lang="scss" scoped>
  191. .container{
  192. padding-bottom: 20rpx;
  193. }
  194. page {
  195. background: #F5F6FA;
  196. }
  197. .u-form {
  198. margin: 20rpx;
  199. background: #fff;
  200. border-radius: 10px;
  201. padding: 30rpx 10px;
  202. .u-form-item {
  203. line-height: 30px;
  204. padding: 0px 0;
  205. font-size: 26rpx;
  206. color: #878C9C;
  207. }
  208. }
  209. .delete_img {
  210. position: absolute;
  211. z-index: 100;
  212. left: 84px;
  213. color: #ffffff;
  214. font-size: 24rpx;
  215. border: 1px;
  216. border-radius: 5rpx 5rpx 5rpx 20rpx;
  217. width: 32rpx;
  218. height: 32rpx;
  219. background-color: rgba(17, 26, 52, 0.5000);
  220. padding:0 3px 0 5px;
  221. text-align: center;
  222. }
  223. .title_b {
  224. margin: 20rpx 20rpx 0rpx 20rpx;
  225. padding: 20rpx 10rpx 20rpx 10rpx;
  226. font-size: 18px;
  227. font-weight: 550;
  228. }
  229. .xinxi {
  230. padding: 20rpx 30rpx;
  231. }
  232. .tubiao {
  233. margin: 0 auto;
  234. text-align: center;
  235. margin-top: 35rpx;
  236. }
  237. .biankuang {
  238. width: 100%;
  239. height: 120rpx;
  240. border-radius: 30px;
  241. margin:0 20rpx;
  242. background:#F5F9FC;
  243. color:#617AE0;
  244. }
  245. .upload {
  246. width: 80rpx;
  247. height: 80rpx;
  248. }
  249. .c-row {
  250. display: -webkit-box;
  251. display: -webkit-flex;
  252. display: flex;
  253. -webkit-box-align: center;
  254. -webkit-align-items: center;
  255. align-items: center;
  256. padding: 20rpx 30rpx;
  257. position: relative;
  258. }
  259. .con-list {
  260. -webkit-box-flex: 1;
  261. flex: 1;
  262. display: flex;
  263. -webkit-box-orient: vertical;
  264. -webkit-box-direction: normal;
  265. flex-direction: column;
  266. color: #303133;
  267. line-height: 20px;
  268. text-align: right;
  269. padding-right: 10px;
  270. justify-content: space-between;
  271. }
  272. .title {
  273. width:100%;
  274. display:flex;
  275. justify-content: space-between;
  276. }
  277. .buns_item {
  278. display: flex;
  279. padding: 80rpx 0 50rpx 0;
  280. justify-content: space-around;
  281. }
  282. .but_css {
  283. background: #22C572;
  284. width: 40%;
  285. padding: 20rpx;
  286. color: #fff;
  287. text-align: center;
  288. border-radius: 20rpx;
  289. }
  290. /deep/.u-radio-group {
  291. flex-direction: row-reverse;
  292. }
  293. .no-boder {
  294. border: 0;
  295. }
  296. .textarea {
  297. background: #F9F9FA;
  298. border: 1px solid #EEEEEE;
  299. }
  300. .remark {
  301. position: absolute;
  302. right: 10px;
  303. bottom: 20px;
  304. color: #AFB3BF;
  305. }
  306. .submit {
  307. width: 100%;
  308. background: #2c8ac5;
  309. border-radius: 10rpx;
  310. }
  311. .bottom-btn {
  312. padding: 30rpx;
  313. background: #FFFFFF;
  314. width: 100%;
  315. position: fixed;
  316. bottom: 0rpx;
  317. display: flex;
  318. z-index: 9999;
  319. }
  320. .content {
  321. overflow: hidden;
  322. }
  323. .btn {
  324. border-radius: 50rpx;
  325. padding: 20rpx 0;
  326. background: #22C572;
  327. color: #fff;
  328. font-size: 32rpx;
  329. width: 100%;
  330. box-sizing: border-box;
  331. display: flex;
  332. justify-content: center;
  333. }
  334. .margin-bottom{
  335. margin-bottom:84px;
  336. }
  337. .u-textarea-style {
  338. margin: 20rpx;
  339. background: #F9F9FA;
  340. border-radius: 10px;
  341. border: 1px solid #EEEEEE;
  342. padding: 10rpx 20rpx;
  343. position: relative;
  344. height:240px;
  345. /deep/.uni-textarea-textarea{
  346. width: 80%;
  347. }
  348. .right-bottom {
  349. position: absolute;
  350. right: 20rpx;
  351. bottom: 20rpx;
  352. color: #AFB3BF;
  353. }
  354. }
  355. .wrap{
  356. border-radius:10px;
  357. background:#fff;
  358. margin:10px 10px 80px 10px;
  359. padding:0 0 10px 0;
  360. }
  361. </style>