teamTypeMultiple.vue 6.1 KB

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