addaduit.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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. 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. page {
  192. background: #F5F6FA;
  193. }
  194. .u-form {
  195. margin: 20rpx;
  196. background: #fff;
  197. border-radius: 10px;
  198. padding: 30rpx 10px;
  199. .u-form-item {
  200. line-height: 30px;
  201. padding: 0px 0;
  202. font-size: 26rpx;
  203. color: #878C9C;
  204. }
  205. }
  206. .delete_img {
  207. position: absolute;
  208. z-index: 100;
  209. left: 84px;
  210. color: #ffffff;
  211. font-size: 24rpx;
  212. border: 1px;
  213. border-radius: 5rpx 5rpx 5rpx 20rpx;
  214. width: 32rpx;
  215. height: 32rpx;
  216. background-color: rgba(17, 26, 52, 0.5000);
  217. padding:0 3px 0 5px;
  218. text-align: center;
  219. }
  220. .title_b {
  221. margin: 20rpx 20rpx 0rpx 20rpx;
  222. padding: 20rpx 10rpx 20rpx 10rpx;
  223. font-size: 18px;
  224. font-weight: 550;
  225. }
  226. .xinxi {
  227. padding: 20rpx 30rpx;
  228. }
  229. .tubiao {
  230. margin: 0 auto;
  231. text-align: center;
  232. margin-top: 35rpx;
  233. }
  234. .biankuang {
  235. width: 100%;
  236. height: 120rpx;
  237. border-radius: 30px;
  238. margin:0 20rpx;
  239. background:#F5F9FC;
  240. color:#617AE0;
  241. }
  242. .upload {
  243. width: 80rpx;
  244. height: 80rpx;
  245. }
  246. .c-row {
  247. display: -webkit-box;
  248. display: -webkit-flex;
  249. display: flex;
  250. -webkit-box-align: center;
  251. -webkit-align-items: center;
  252. align-items: center;
  253. padding: 20rpx 30rpx;
  254. position: relative;
  255. }
  256. .con-list {
  257. -webkit-box-flex: 1;
  258. flex: 1;
  259. display: flex;
  260. -webkit-box-orient: vertical;
  261. -webkit-box-direction: normal;
  262. flex-direction: column;
  263. color: #303133;
  264. line-height: 20px;
  265. text-align: right;
  266. padding-right: 10px;
  267. justify-content: space-between;
  268. }
  269. .title {
  270. width:100%;
  271. display:flex;
  272. justify-content: space-between;
  273. }
  274. .buns_item {
  275. display: flex;
  276. padding: 80rpx 0 50rpx 0;
  277. justify-content: space-around;
  278. }
  279. .but_css {
  280. background: #22C572;
  281. width: 40%;
  282. padding: 20rpx;
  283. color: #fff;
  284. text-align: center;
  285. border-radius: 20rpx;
  286. }
  287. /deep/.u-radio-group {
  288. flex-direction: row-reverse;
  289. }
  290. .no-boder {
  291. border: 0;
  292. }
  293. .textarea {
  294. background: #F9F9FA;
  295. border: 1px solid #EEEEEE;
  296. }
  297. .remark {
  298. position: absolute;
  299. right: 10px;
  300. bottom: 20px;
  301. color: #AFB3BF;
  302. }
  303. .submit {
  304. width: 100%;
  305. background: #2c8ac5;
  306. border-radius: 10rpx;
  307. }
  308. .bottom-btn {
  309. padding: 30rpx;
  310. background: #FFFFFF;
  311. width: 100%;
  312. position: fixed;
  313. bottom: 0rpx;
  314. display: flex;
  315. z-index: 9999;
  316. }
  317. .content {
  318. overflow: hidden;
  319. }
  320. .btn {
  321. border-radius: 50rpx;
  322. padding: 20rpx 0;
  323. background: #22C572;
  324. color: #fff;
  325. font-size: 32rpx;
  326. width: 100%;
  327. box-sizing: border-box;
  328. display: flex;
  329. justify-content: center;
  330. }
  331. .margin-bottom{
  332. margin-bottom:84px;
  333. }
  334. .u-textarea-style {
  335. margin: 20rpx;
  336. background: #F9F9FA;
  337. border-radius: 10px;
  338. border: 1px solid #EEEEEE;
  339. padding: 10rpx 20rpx;
  340. position: relative;
  341. height:240px;
  342. /deep/.uni-textarea-textarea{
  343. width: 80%;
  344. }
  345. .right-bottom {
  346. position: absolute;
  347. right: 20rpx;
  348. bottom: 20rpx;
  349. color: #AFB3BF;
  350. }
  351. }
  352. .wrap{
  353. border-radius:10px;
  354. background:#fff;
  355. margin:10px 10px 80px 10px;
  356. padding:0 0 10px 0;
  357. }
  358. </style>