selectApprovers.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view class="list">
  3. <view class="search"><u-search placeholder="输入姓名按回车搜索" :animation="true" v-model="param.name" @search="search()"></u-search></view>
  4. <view class="item" v-for="(item, index) in list" :key="index" @click="select(item)">
  5. <view class="icon select check" v-if="item.check">&#xe600;</view>
  6. <view class="icon select" v-else>&#xe8bb;</view>
  7. <view class="title">{{ item.name }}</view>
  8. <view class="icon more">&#xe631;</view>
  9. <view class="clear"></view>
  10. </view>
  11. <view class="footer">
  12. <button class="btn ws" @click="back">确定({{ selects.length }})</button>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. data() {
  19. return {
  20. list: [],
  21. selects: {}, //选中
  22. id: '',
  23. flowId:'',
  24. nodeId:'',
  25. selectId:'',
  26. param: {
  27. }
  28. };
  29. },
  30. onLoad(e) {
  31. this.param=JSON.parse(e.item);
  32. console.log('this.param' + JSON.stringify(this.param));
  33. this.flowId=this.param.flowId;
  34. this.nodeId=this.param.nodeid;
  35. this.id=this.param.document.id;
  36. this.getData();
  37. },
  38. methods: {
  39. getData() {
  40. this.http.request({
  41. url: this.http.urls.documents + this.id+'/workflows/'+ this.flowId+'/selectApprovers?nodeId='+ this.nodeId+'&type=3&selectId='+ this.selectId,
  42. //data: this.param,
  43. method: 'GET',
  44. success: res => {
  45. console.log('res.data.data.page===' + JSON.stringify(res));
  46. res.data.data.datas.forEach(item => {
  47. this.list.push(item);
  48. });
  49. }
  50. });
  51. },
  52. //搜索
  53. search() {
  54. //console.log("asd:"+this.param.keyword);
  55. //this.param.name=this.param.keyword;
  56. this.list=[];
  57. this.selectId=this.param.name;
  58. this.getData();
  59. },
  60. //选择
  61. select(item) {
  62. item.check = !item.check;
  63. console.log('this.item===' + JSON.stringify(item));
  64. //this.selects = item;
  65. //uni.$emit('select', this.selects);
  66. //uni.navigateBack();
  67. //this.selects = this.list.filter(item => item.check);
  68. item.nodeId=this.nodeId;
  69. //console.log("this.item==="+JSON.stringify(item));
  70. this.selects = this.list.filter(item => item.check);
  71. },
  72. //选中并返回
  73. back() {
  74. uni.$emit('selectu', this.selects);
  75. uni.navigateBack();
  76. }
  77. }
  78. };
  79. </script>
  80. <style lang="scss">
  81. .list {
  82. padding: 10px;
  83. .item {
  84. padding: 13px;
  85. background-color: white;
  86. border-bottom: 1px solid #efecec;
  87. .select {
  88. float: left;
  89. padding-right: 7px;
  90. margin-top: 1px;
  91. font-size: 20px;
  92. }
  93. .check {
  94. color: #4581fb;
  95. }
  96. .more {
  97. float: right;
  98. margin-top: -18px;
  99. color: darkgray;
  100. }
  101. }
  102. }
  103. </style>