移动端
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

taskRelease.vue 3.5 KiB

3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
3 anni fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <div class="app-container">
  3. <van-nav-bar
  4. left-arrow
  5. fixed
  6. placeholder
  7. @click-left="$router.back(-1)"
  8. >
  9. <template #title>
  10. <p style="font-weight: bold;">任务发布</p>
  11. </template>
  12. </van-nav-bar>
  13. <div class="main_box">
  14. <SearchTree
  15. ref="tree"
  16. node-key="id"
  17. :data="treeList"
  18. :show-checkbox="true"
  19. :default-expand-all="true"
  20. ></SearchTree>
  21. <div style="padding: 16px 0;" v-if="allowCUD">
  22. <van-row>
  23. <van-col span="12" align="center">
  24. <van-button type="info" color="#B4B0B0" native-type="submit" class="submitButton" @click="goBack">取<i style="margin-right: 1em;"></i>消</van-button>
  25. </van-col>
  26. <van-col span="12" align="center">
  27. <van-button type="info" native-type="submit" class="submitButton" @click="goAdd">发<i style="margin-right: 1em;"></i>布</van-button>
  28. </van-col>
  29. </van-row>
  30. <div class="clear"></div>
  31. </div>
  32. </div>
  33. </div>
  34. </template>
  35. <script>
  36. import { getTree , distribute } from "@/api/onlineHome/homestead/task";
  37. import {Notify} from "vant";
  38. export default {
  39. name: "taskRelease",
  40. data() {
  41. return {
  42. treeList: [],
  43. queryParams:{
  44. list:'',
  45. id:''
  46. }
  47. };
  48. },
  49. created() {
  50. this.getTree()
  51. this.queryParams.id = this.$route.query.id;
  52. },
  53. computed: {
  54. allowCUD: function () {
  55. return this.$store.getters.businessLevel == '2'
  56. },
  57. },
  58. methods: {
  59. getTree(){
  60. getTree().then(response => {
  61. console.log(response)
  62. for(var i = 0 ; i < response.data.length ; i++){
  63. this.treeList.push({
  64. id:response.data[i].id,
  65. name:response.data[i].label,
  66. children:[]
  67. });
  68. for (var j = 0 ; j < response.data[i].children.length ; j++){
  69. this.treeList[i].children.push({
  70. id:response.data[i].children[j].id,
  71. name:response.data[i].children[j].label,
  72. children:[]
  73. })
  74. for(var z = 0 ; z < response.data[i].children[j].children.length ; z++){
  75. console.log(response.data[i].children[j].children[z].id)
  76. this.treeList[i].children[j].children.push({
  77. id:response.data[i].children[j].children[z].id,
  78. name:response.data[i].children[j].children[z].label
  79. })
  80. }
  81. }
  82. }
  83. });
  84. },
  85. goAdd(){
  86. this.queryParams.list = this.$refs.tree.getCheckedKeys().join(',');
  87. if(!this.queryParams.list)
  88. {
  89. Notify({ type: 'danger', message: '请选择发布目标' });
  90. return;
  91. }
  92. distribute(this.queryParams).then(response => {
  93. console.log(response);
  94. this.$toast.success('保存成功');
  95. setTimeout(function(){
  96. history.go(-1)
  97. },2000)
  98. });
  99. },
  100. goBack(){
  101. window.history.go(-1)
  102. }
  103. },
  104. }
  105. </script>
  106. <style scoped lang="scss">
  107. .app-container {
  108. padding: 2% 0;
  109. }
  110. .main_title{
  111. font-size: 0.4rem;
  112. color: #1D6FE9;
  113. margin: 0.2rem 6%;
  114. position: relative;
  115. }
  116. .main_box{
  117. width: 96%;
  118. margin: 0 auto;
  119. border-radius: 6px;
  120. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  121. overflow: hidden;
  122. background-color: #FFF;
  123. }
  124. .submitButton{
  125. width: 80%;
  126. margin: 0 auto;
  127. background-color: #1D6FE9;
  128. }
  129. </style>