index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view class="page_v u-flex-col">
  3. <view class="u-m-t-20 u-m-b-20">
  4. <JnpfAlert type="warning" :title="description" effect="dark" />
  5. </view>
  6. <view class="organization_box u-m-b-20" v-if="show" v-for="(item,index) in list" :key="index"
  7. :class="item.isDefault ? 'active' : '' " @click="clickRadio(item)">
  8. <view class="icon-checked-box" v-if="item.isDefault">
  9. <text>默认</text>
  10. <view class="icon-checked">
  11. <u-icon name="checkbox-mark" color="#fff" size="28"></u-icon>
  12. </view>
  13. </view>
  14. <view class="list_inner u-flex-col">
  15. <view class="inner_item">
  16. <text>所属组织</text>
  17. <text class="txt u-line-1"
  18. :style="{color:item.isDefault ? '#2979FF' : ''}">{{item.orgTreeName}}</text>
  19. </view>
  20. <view class="inner_item">
  21. <text>任职岗位</text>
  22. <text class="txt u-line-1" :style="{color:item.isDefault ? '#2979FF' : ''}">{{item.fullName}}</text>
  23. </view>
  24. <view class="inner_item">
  25. <text>上级岗位</text>
  26. <text class="txt u-line-1"
  27. :style="{color:item.isDefault ? '#2979FF' : ''}">{{ item.parentName || '-' }}</text>
  28. </view>
  29. <view class="inner_item">
  30. <text>上级责任人</text>
  31. <text class="txt u-line-1"
  32. :style="{color:item.isDefault ? '#2979FF' : ''}">{{item.managerName}}</text>
  33. </view>
  34. </view>
  35. </view>
  36. <JnpfEmpty v-if="!show"></JnpfEmpty>
  37. </view>
  38. </template>
  39. <script>
  40. import {
  41. getUserPositions,
  42. setMajor,
  43. } from '@/api/common'
  44. export default {
  45. data() {
  46. return {
  47. list: [],
  48. majorType: '',
  49. show: true,
  50. disabled: false,
  51. userInfo: {},
  52. description: '默认组织仅逐级审批时使用'
  53. }
  54. },
  55. onLoad(e) {
  56. this.userInfo = uni.getStorageSync('userInfo') || {}
  57. this.majorType = e.majorType
  58. this.getUserPositions()
  59. uni.setNavigationBarTitle({
  60. title: this.$t('app.my.organization')
  61. })
  62. },
  63. methods: {
  64. getUserPositions() {
  65. getUserPositions().then(res => {
  66. let data = res.data || []
  67. if (!data.length) return this.show = this.list.length > 0
  68. this.list = JSON.parse(JSON.stringify(data));
  69. this.show = this.list.length > 0
  70. this.list.map(o => {
  71. if (o.currentStanding) o.isDefault = true
  72. })
  73. })
  74. },
  75. clickRadio(item) {
  76. if (this.disabled || item.isDefault) return
  77. this.changeMajor(item.id)
  78. },
  79. change(id) {
  80. this.list.map((o, i) => {
  81. o.isDefault = false;
  82. if (o.id === id) o.isDefault = true;
  83. })
  84. },
  85. changeMajor(majorId) {
  86. let query = {
  87. majorId,
  88. majorType: this.majorType
  89. }
  90. setMajor(query).then(res => {
  91. this.$u.toast(res.msg)
  92. if (res.code === 200) {
  93. setTimeout(() => {
  94. uni.reLaunch({
  95. url: "/pages/index/index"
  96. })
  97. }, 500)
  98. }
  99. }).catch(() => {})
  100. },
  101. }
  102. }
  103. </script>
  104. <style lang="scss">
  105. page {
  106. background-color: #f0f2f6;
  107. }
  108. .page_v {
  109. /* #ifdef MP */
  110. background-color: #f0f2f6;
  111. /* #endif */
  112. padding: 0 20rpx;
  113. .active {
  114. border: 1rpx solid #2979FF;
  115. color: #2979FF;
  116. }
  117. .organization_box {
  118. width: 100%;
  119. border-radius: 8rpx;
  120. position: relative;
  121. display: flex;
  122. flex-direction: column;
  123. justify-content: center;
  124. background-color: #FFFFFF;
  125. .icon-checked-box {
  126. position: absolute;
  127. display: flex;
  128. width: 140rpx;
  129. height: 80rpx;
  130. transform: scale(0.9);
  131. right: -4rpx;
  132. bottom: -2rpx;
  133. flex-direction: row;
  134. align-items: center;
  135. .icon-checked {
  136. width: 44rpx;
  137. height: 44rpx;
  138. border: 40rpx solid #1890ff;
  139. border-left: 40rpx solid transparent;
  140. border-top: 40rpx solid transparent;
  141. border-bottom-right-radius: 12rpx;
  142. position: absolute;
  143. transform: scale(0.95);
  144. right: -8rpx;
  145. bottom: -6rpx;
  146. }
  147. }
  148. .list_inner {
  149. width: 100%;
  150. min-height: 160rpx;
  151. padding: 0 20rpx;
  152. align-items: flex-start;
  153. .inner_item {
  154. width: 100%;
  155. padding: 20rpx 0;
  156. display: table-row;
  157. }
  158. .txt {
  159. flex: 1.2;
  160. white-space: nowrap;
  161. color: #606266;
  162. width: 400rpx;
  163. overflow-x: auto;
  164. display: inline-flex;
  165. margin-left: 40rpx;
  166. }
  167. }
  168. }
  169. }
  170. </style>