Nslb.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <div style="border: 1px solid rgba(81,233,240,0.6); box-sizing: border-box">
  3. <Title title="农事列表">
  4. <template v-slot:title-slot>
  5. </template>
  6. </Title>
  7. <div class="chatsTabs yse-events">
  8. <div class="lbtn"><div class="text" :class="[status == STATUS_ENUM.STAY_SEND ? 'active' : '']" @click="changeTabs(STATUS_ENUM.STAY_SEND)">待分发</div></div>
  9. <div class="btn"><div class="text" :class="[status == STATUS_ENUM.STAY_EXECUTE ? 'active' : '']" @click="changeTabs(STATUS_ENUM.STAY_EXECUTE)">执行中</div></div>
  10. <div class="rbtn"><div class="text" :class="[status == STATUS_ENUM.HAVE_CHECK ? 'active' : '']" @click="changeTabs(STATUS_ENUM.HAVE_CHECK)">已完成</div></div>
  11. </div>
  12. <div class="nslb yse-events">
  13. <template v-for="item in tableData" :key="item.id">
  14. <NsItem @click="selectNsItem(item.id)" :rowData="item" :style=" (activeId == item.id ? 'background:#033C49;' : '')" ></NsItem>
  15. </template>
  16. </div>
  17. <div class="btn-layout">
  18. </div>
  19. </div>
  20. </template>
  21. <script setup>
  22. import {onMounted, ref, reactive, toRefs} from "vue";
  23. import {useStore} from "vuex";
  24. import Title from "../../components/title";
  25. import {NS_RECORD_STATUS_ENUM as STATUS_ENUM} from "../../../api/enum"
  26. import NsItem from "./NsItem";
  27. const emits = defineEmits(["selectNsItem"])
  28. let store = useStore();
  29. let userInfo = store.getters.userinfo
  30. const activeId = ref(null)
  31. const tableData = ref([]);
  32. const params = reactive({
  33. organId:userInfo.curGardenId,
  34. name: "",
  35. limit: 10,
  36. page: 1,
  37. total: 0,
  38. status: STATUS_ENUM.STAY_SEND
  39. });
  40. const { name, limit, page, total , status} = toRefs(params);
  41. onMounted(async () => {
  42. getDataList()
  43. })
  44. function changeTabs(e){
  45. status.value = e
  46. getDataList()
  47. }
  48. function selectNsItem(id){
  49. if(activeId.value == id)
  50. return
  51. activeId.value = id
  52. emits("selectNsItem",id)
  53. }
  54. function reset(){
  55. getDataList()
  56. activeId.value = null
  57. }
  58. /**
  59. * @description: 获取列表数据
  60. * @param {*}
  61. * @return {*}
  62. */
  63. const getDataList = async () => {
  64. const { code, data, count } = await VE_API.nsjy.page(params);
  65. if (code == 0 || code == 1) {
  66. tableData.value = data;
  67. total.value = count;
  68. }
  69. };
  70. defineExpose({reset})
  71. </script>
  72. <style lang="scss" scoped>
  73. @import "../../../styles/chatsTabs";
  74. @import "../../../styles/index";
  75. .nslb{
  76. @include wh(auto,calc(100% - 48px - 48px - 45px));
  77. overflow-y: scroll;
  78. }
  79. .btn-layout{
  80. @include wh(auto,calc(45px));
  81. border-top: 1px solid rgba(81,233,240,0.6);
  82. display: flex;
  83. flex-direction: column;
  84. align-items: center;
  85. justify-content: space-around;
  86. .big-btn{
  87. @include wh(70%, 45px);
  88. font-size: 20px;
  89. border-radius: 5px;
  90. background: #13C4CD;
  91. border: 1px solid rgba(81,233,240,1);
  92. color: #ffffff;
  93. }
  94. }
  95. </style>