teamTypeMultiple.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. <view class="list-item adfac" @click="show=true" v-if="znShow">
  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. </view>
  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="#002846" :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: #002846;" :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. znShow:false,
  45. show:false,
  46. type:'',
  47. title:'选择团队职能类型',
  48. list:[],
  49. name:'',
  50. remark:''
  51. }
  52. },
  53. onLoad(options) {
  54. this.type = options.type;
  55. if(this.type==='function'){
  56. this.znShow = true;
  57. this.getTeamFunctionList()
  58. }
  59. else if(this.type==='architecture'){
  60. this.znShow = false;
  61. this.title = '选择团队模式类型';
  62. this.getTeamArchitecturelist()
  63. }
  64. },
  65. methods:{
  66. getTeamFunctionList(){
  67. this.$api.get('/core/function/list').then(({data:res})=>{
  68. if(res.code!==0) return this.$showToast(res.msg)
  69. this.list = res.data;
  70. this.list.forEach((l,i)=>{
  71. this.$set(this.list[i],'select',false)
  72. })
  73. })
  74. },
  75. getTeamArchitecturelist(){
  76. this.$api.get('/core/organization/list').then(({data:res})=>{
  77. if(res.code!==0) return this.$showToast(res.msg)
  78. this.list = res.data;
  79. this.list.forEach((l,i)=>{
  80. this.$set(this.list[i],'select',false)
  81. })
  82. })
  83. },
  84. handleSelect(item,index){
  85. this.$set(this.list[index],'select',!this.list[index].select)
  86. },
  87. handleAdd(){
  88. if(!this.name) return this.$showToast(`请输入团队${this.type==='function'?'职能':'模式'}类型名称`)
  89. if(!this.remark) return this.$showToast(`请输入团队${this.type==='function'?'职能':'模式'}类型备注`)
  90. if(this.type==='function'){
  91. this.$api.post('/core/function',{
  92. functionName:this.name,
  93. remark:this.remark
  94. }).then(({data:res})=>{
  95. if(res.code!==0) return this.$showToast(res.msg)
  96. this.show = false;
  97. this.getTeamFunctionList();
  98. })
  99. }else{
  100. this.$api.post('/core/organization',{
  101. orgName:this.name,
  102. remark:this.remark
  103. }).then(({data:res})=>{
  104. if(res.code!==0) return this.$showToast(res.msg)
  105. this.show = false;
  106. this.getTeamArchitecturelist();
  107. })
  108. }
  109. },
  110. confirm(){
  111. if(this.list.filter(l=>l.select).length===0) return this.$showToast(`请至少选择一种团队${this.type==='function'?'职能':'模式'}类型`)
  112. this.getOpenerEventChannel().emit('selectConfirm',{
  113. type:this.type,
  114. ids:this.list.filter(l=>l.select).map(l=>l.id),
  115. names:this.list.filter(l=>l.select).map(l=>l[this.type==='function'?'functionName':'orgName'])
  116. })
  117. uni.navigateBack()
  118. }
  119. }
  120. }
  121. </script>
  122. <style scoped lang="scss">
  123. ::v-deep .u-textarea{
  124. padding: 0 !important;
  125. }
  126. .default_page{
  127. padding: 0 30rpx;
  128. background: #FFFFFF;
  129. box-sizing: border-box;
  130. .list{
  131. flex: 1;
  132. overflow-y: auto;
  133. &-item{
  134. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #E6EAED;
  135. padding: 35rpx 0;
  136. &>image{
  137. width: 28rpx;
  138. height: 28rpx;
  139. }
  140. &-info{
  141. width: calc(100% - 52rpx);
  142. margin-left: 24rpx;
  143. &>view{
  144. font-family: PingFang-SC, PingFang-SC;
  145. font-weight: bold;
  146. font-size: 28rpx;
  147. color: #002846;
  148. line-height: 32rpx;
  149. &.tip{
  150. font-family: PingFangSC, PingFang SC;
  151. font-weight: 400;
  152. font-size: 24rpx;
  153. color: #95A5B1;
  154. line-height: 32rpx;
  155. margin-top: 20rpx;
  156. }
  157. }
  158. }
  159. }
  160. }
  161. .zt_btn{
  162. margin: 40rpx 0 80rpx;
  163. }
  164. .dialog{
  165. position: fixed;
  166. left: 0;
  167. right: 0;
  168. top: 0;
  169. bottom: 0;
  170. z-index: 1000;
  171. background: rgba(0, 0, 0, .4);
  172. .box{
  173. min-height: 1000rpx;
  174. width: 100%;
  175. border-radius: 24rpx 24rpx 0 0;
  176. background: #FFFFFF;
  177. padding: 36rpx 36rpx 100rpx;
  178. box-sizing: border-box;
  179. position: absolute;
  180. bottom: 0;
  181. left: 0;
  182. &-top{
  183. &-btn{
  184. font-family: PingFangSC, PingFang SC;
  185. font-weight: 400;
  186. font-size: 30rpx;
  187. line-height: 42rpx;
  188. width: 80rpx;
  189. &.cancel{
  190. color: #002846;
  191. }
  192. &.add{
  193. color: #009191;
  194. text-align: right;
  195. }
  196. }
  197. &-title{
  198. flex: 1;
  199. font-family: PingFang-SC, PingFang-SC;
  200. font-weight: bold;
  201. font-size: 36rpx;
  202. color: #002846;
  203. line-height: 50rpx;
  204. text-align: center;
  205. }
  206. }
  207. &-inp{
  208. margin-top: 98rpx;
  209. padding-bottom: 30rpx;
  210. border-bottom: 1rpx solid #E2E2E2;
  211. }
  212. &-textarea{
  213. margin-top: 30rpx;
  214. padding-bottom: 30rpx;
  215. border-bottom: 1rpx solid #E2E2E2;
  216. }
  217. }
  218. }
  219. }
  220. </style>