addaduit.vue 7.6 KB

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