teamTypeMultiple.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view class="default_page adffc" :style="{'height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header :title='title'></cus-header>
  4. <view class="list">
  5. <view class="list-item adfac" v-for="(item,index) in list" :key="item.id" @click="handleSelect(item,index)">
  6. <image :src="imgBase+'dx_selected.png'" v-if="item.select"></image>
  7. <image :src="imgBase+'dx_not_select.png'" v-else></image>
  8. <view class="list-item-info adffc">
  9. <view v-if="type==='function'">{{item.functionName}}</view>
  10. <view v-else-if="type==='architecture'">{{item.orgName}}</view>
  11. <view class="tip">{{item.remark}}</view>
  12. </view>
  13. </view>
  14. <div class="list-item adfac" @click="show=true">
  15. <image :src="imgBase+'dx_not_select.png'"></image>
  16. <view class="list-item-info adffc">
  17. <view>其他</view>
  18. <view class="tip">支持用户自定义</view>
  19. </view>
  20. </div>
  21. </view>
  22. <view class="zt_btn" @click="confirm">确定</view>
  23. <div class="dialog adffc" v-if="show">
  24. <div class="box">
  25. <div class="box-top adfac">
  26. <div class="box-top-btn cancel" @click="show=false">取消</div>
  27. <div class="box-top-title">其他自定义</div>
  28. <div class="box-top-btn add" @click="handleAdd">添加</div>
  29. </div>
  30. <div class="box-inp">
  31. <u--input type="text" v-model="name" border="none" fontSize="30rpx" color="@B3BFC8" :placeholder="'请输入自定义团队'+(type==='function'?'职能':'架构')+'类型'" maxlength="20" clearable showWordLimit></u--input>
  32. </div>
  33. <div class="box-textarea">
  34. <u-textarea v-model="remark" height="100rpx" border="none" style="font-size: 30rpx;color: #B3BFC8;" :placeholder="'请输入自定义团队'+(type==='function'?'职能':'架构')+'类型的备注'" maxlength="100" count></u-textarea>
  35. </div>
  36. </div>
  37. </div>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data(){
  43. return {
  44. show:false,
  45. type:'',
  46. title:'选择团队职能类型',
  47. list:[],
  48. name:'',
  49. remark:''
  50. }
  51. },
  52. onLoad(options) {
  53. this.type = options.type;
  54. if(this.type==='function') this.getTeamFunctionList()
  55. else if(this.type==='architecture') this.getTeamArchitecturelist()
  56. },
  57. methods:{
  58. getTeamFunctionList(){
  59. this.$api.get('/core/function/list').then(({data:res})=>{
  60. if(res.code!==0) return this.$showToast(res.msg)
  61. this.list = res.data;
  62. this.list.forEach((l,i)=>{
  63. this.$set(this.list[i],'select',false)
  64. })
  65. })
  66. },
  67. getTeamArchitecturelist(){
  68. this.$api.get('/core/organization/list').then(({data:res})=>{
  69. if(res.code!==0) return this.$showToast(res.msg)
  70. this.list = res.data;
  71. this.list.forEach((l,i)=>{
  72. this.$set(this.list[i],'select',false)
  73. })
  74. })
  75. },
  76. handleSelect(item,index){
  77. this.$set(this.list[index],'select',!this.list[index].select)
  78. },
  79. handleAdd(){
  80. if(!this.name) return this.$showToast(`请输入${this.type==='function'?'职能':'结构'}类型名称`)
  81. if(!this.remark) return this.$showToast(`请输入${this.type==='function'?'职能':'结构'}类型备注`)
  82. if(this.type==='function'){
  83. this.$api.post('/core/function',{
  84. functionName:this.name,
  85. remark:this.remark
  86. }).then(({data:res})=>{
  87. if(res.code!==0) return this.$showToast(res.msg)
  88. this.show = false;
  89. this.getTeamFunctionList();
  90. })
  91. }else{
  92. this.$api.post('/core/organization',{
  93. orgName:this.name,
  94. remark:this.remark
  95. }).then(({data:res})=>{
  96. if(res.code!==0) return this.$showToast(res.msg)
  97. this.show = false;
  98. this.getTeamArchitecturelist();
  99. })
  100. }
  101. },
  102. confirm(){
  103. if(this.list.filter(l=>l.select).length===0) return this.$showToast(`请至少选择一种团队${this.type==='function'?'职能':'结构'}类型`)
  104. this.getOpenerEventChannel().emit('selectConfirm',{
  105. type:this.type,
  106. ids:this.list.filter(l=>l.select).map(l=>l.id),
  107. names:this.list.filter(l=>l.select).map(l=>l[this.type==='function'?'functionName':'orgName'])
  108. })
  109. uni.navigateBack()
  110. }
  111. }
  112. }
  113. </script>
  114. <style scoped lang="scss">
  115. ::v-deep .u-textarea{
  116. padding: 0 !important;
  117. }
  118. .default_page{
  119. padding: 0 30rpx;
  120. background: #FFFFFF;
  121. box-sizing: border-box;
  122. .list{
  123. flex: 1;
  124. overflow-y: auto;
  125. &-item{
  126. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #E6EAED;
  127. padding: 35rpx 0;
  128. &>image{
  129. width: 28rpx;
  130. height: 28rpx;
  131. }
  132. &-info{
  133. width: calc(100% - 52rpx);
  134. margin-left: 24rpx;
  135. &>view{
  136. font-family: PingFang-SC, PingFang-SC;
  137. font-weight: bold;
  138. font-size: 28rpx;
  139. color: #002846;
  140. line-height: 32rpx;
  141. &.tip{
  142. font-family: PingFangSC, PingFang SC;
  143. font-weight: 400;
  144. font-size: 24rpx;
  145. color: #95A5B1;
  146. line-height: 32rpx;
  147. margin-top: 20rpx;
  148. }
  149. }
  150. }
  151. }
  152. }
  153. .zt_btn{
  154. margin: 40rpx 0 80rpx;
  155. }
  156. .dialog{
  157. position: fixed;
  158. left: 0;
  159. right: 0;
  160. top: 0;
  161. bottom: 0;
  162. z-index: 1000;
  163. background: rgba(0, 0, 0, .4);
  164. .box{
  165. width: 100%;
  166. border-radius: 24rpx 24rpx 0 0;
  167. background: #FFFFFF;
  168. padding: 36rpx 36rpx 100rpx;
  169. box-sizing: border-box;
  170. position: absolute;
  171. bottom: 0;
  172. left: 0;
  173. &-top{
  174. &-btn{
  175. font-family: PingFangSC, PingFang SC;
  176. font-weight: 400;
  177. font-size: 30rpx;
  178. line-height: 42rpx;
  179. width: 80rpx;
  180. &.cancel{
  181. color: #002846;
  182. }
  183. &.add{
  184. color: #009191;
  185. text-align: right;
  186. }
  187. }
  188. &-title{
  189. flex: 1;
  190. font-family: PingFang-SC, PingFang-SC;
  191. font-weight: bold;
  192. font-size: 36rpx;
  193. color: #002846;
  194. line-height: 50rpx;
  195. text-align: center;
  196. }
  197. }
  198. &-inp{
  199. margin-top: 98rpx;
  200. padding-bottom: 30rpx;
  201. border-bottom: 1rpx solid #E2E2E2;
  202. }
  203. &-textarea{
  204. margin-top: 30rpx;
  205. padding-bottom: 30rpx;
  206. border-bottom: 1rpx solid #E2E2E2;
  207. }
  208. }
  209. }
  210. }
  211. </style>