requestSeal.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="seal-list">
  3. <view class="seal-item" v-for="(item,index) in sealData" :key="item.id" @click="requestSeal(item)">
  4. <image class="seal-image" :src="item.fileNode.node.url" mode="aspectFit"></image>
  5. <view class="content">
  6. <view class="title">
  7. {{item.name}}
  8. </view>
  9. <view class="article">
  10. {{item.comment}}
  11. </view>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import {
  18. getSealList,
  19. requestSeal
  20. } from '@/request/api/organization.js'
  21. import {
  22. insertDocumentData
  23. } from '@/request/api/contract.js'
  24. export default {
  25. data() {
  26. return {
  27. sealData: [],
  28. userInfo: {},
  29. body: {}
  30. }
  31. },
  32. onLoad(body) {
  33. this.body = body;
  34. this.userInfo = this.$store.getters.user;
  35. console.log(this.userInfo);
  36. getSealList(this.$store.getters.organization.id).then(res => {
  37. if (res.code === 200) {
  38. this.sealData = res.data;
  39. console.log(this.sealData);
  40. }
  41. })
  42. },
  43. onShow() {
  44. },
  45. methods: {
  46. requestSeal(item) {
  47. uni.showModal({
  48. title: '有极提示',
  49. content: '确实使用该印章?',
  50. success: res => {
  51. if (res.confirm) {
  52. uni.showLoading();
  53. requestSeal({
  54. sealId: item.id,
  55. requestUserName: this.userInfo.userName,
  56. requestUserId: this.userInfo.userId,
  57. documentId: this.body.documentId,
  58. keyWord: this.body.sealDomId,
  59. projectId: this.$store.getters.project.id
  60. }).then(data => {
  61. if (data.code === 200) {
  62. let seal = {};
  63. seal[this.body.sealDomId] = this.body.sealDomId;
  64. insertDocumentData({
  65. data: JSON.stringify({
  66. seal: seal
  67. }),
  68. documentId: this.body.documentId,
  69. userId: this.userInfo.userId
  70. }).then(res => {
  71. if (res.code === 200) {
  72. this.$toast('申请成功');
  73. uni.$emit('reloadElement');
  74. setTimeout(() => {
  75. uni.hideLoading();
  76. this.$navigateBack();
  77. }, 400)
  78. } else {
  79. uni.hideLoading();
  80. }
  81. })
  82. } else {
  83. uni.hideLoading();
  84. }
  85. });
  86. }
  87. }
  88. });
  89. }
  90. }
  91. }
  92. </script>
  93. <style lang="scss">
  94. .seal-list {
  95. padding: 30rpx;
  96. .seal-item {
  97. height: 140rpx;
  98. background-color: #ffffff;
  99. border-radius: 16rpx;
  100. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  101. display: flex;
  102. align-items: center;
  103. padding: 0 30rpx;
  104. margin-bottom: 20rpx;
  105. }
  106. .seal-image {
  107. width: 100rpx;
  108. height: 100rpx;
  109. }
  110. .content {
  111. flex: 1;
  112. width: 0;
  113. margin-left: 20rpx;
  114. }
  115. .title {
  116. font-weight: 500;
  117. font-size: 32rpx;
  118. }
  119. .article {
  120. color: $uni-secondary-color;
  121. margin-top: 10rpx;
  122. }
  123. }
  124. </style>