Browse Source

私设聚会接口测试

LuChongMei 2 years ago
parent
commit
27ed1d0e7a

+ 30 - 0
src/api/privateparty/PrivatePartyPointService.js

@@ -0,0 +1,30 @@
+import request from '@/utils/request'
+
+export default class PrivatePartyPointService {
+    save(inputForm) {
+        return request.post(
+            '/privateparty/privatePartyPoint/save',
+            inputForm
+        )
+    }
+
+    // delete(ids) {
+    //     return request({
+    //         url: '/privateparty/privatePartyPoint/delete',
+    //         method: 'delete',
+    //         params: { ids: ids }
+    //     })
+    // }
+
+    queryById(id) {
+        return request.get(
+            '/privateparty/privatePartyPoint/queryById', { id: id }
+        )
+    }
+    list(params) {
+        return request.get(
+            '/privateparty/privatePartyPoint/list',
+            params
+        )
+    }
+}

+ 2 - 18
src/views/activityMan/placeactivity/placeActivityList.vue

@@ -31,7 +31,7 @@
               <p style="color: #c4c4c4">{{ item.activityTime }}</p>
               <p style="color: red">待审核</p>
             </div>
-            <van-cell is-link to="placeActivityInfo">
+            <van-cell is-link>
               <template #title>
                 {{ item.reporter.name }}申请于{{ item.placeDel }}举办{{
                   item.activityName
@@ -72,7 +72,7 @@
               <p style="color: #c4c4c4">{{ item.activityTime }}</p>
               <p style="color: red">已审核</p>
             </div>
-            <van-cell is-link to="placeActivityInfo">
+            <van-cell is-link>
               <template #title>
                 {{ item.reporter.name }}申请于{{ item.placeDel }}举办{{
                   item.activityName
@@ -197,22 +197,6 @@ export default {
 body {
   background: #f5f5f5;
 }
-.nav_tab {
-  width: 100vw;
-  display: flex;
-  text-align: center;
-  background: #fff;
-  margin: 10px 0;
-}
-.tab {
-  flex: 1;
-  line-height: 40px;
-  font-size: 14px;
-}
-.active {
-  background: #36a7f3;
-  color: #fff;
-}
 .van-list {
   height: 80%;
   margin-top: 5px;

+ 163 - 64
src/views/activityMan/selfMeetingReport/selfMeetingList.vue

@@ -8,43 +8,85 @@
     @click-right="onClickRight"
   />
   <van-search v-model="value" shape="round" placeholder="请输入搜索关键词" />
-  <van-list
-    v-model:loading="loading"
-    :finished="finished"
-    finished-text="没有更多了"
-    @load="onLoad"
+  <van-tabs
+    v-model:active="active"
+    title-inactive-color="#bdbdbd"
+    title-active-color="#36a7f3"
+    @click-tab="onClickTab"
   >
-    <!-- tab切换 -->
-    <div class="nav_tab">
-      <div class="tab active">未审核</div>
-      <div class="tab">已审核</div>
-    </div>
-    <van-swipe-cell v-for="item in list" :key="item">
-      <div class="list_item">
-        <!-- <div class="item-left">
-          <p style="color: #c4c4c4">{{ item.activityTime }}</p>
-          <p style="color: red">待审核</p>
-        </div> -->
-        <van-cell is-link :title="item">
-          <!-- <template #title>
-            {{ item.portname }}申请于{{ item.place }}举办{{ item.activity }}活动
+    <van-tab title="未审核" name="0">
+      <van-list
+        v-model:loading="loading"
+        :finished="finished"
+        finished-text="没有更多了"
+        @load="onLoad"
+      >
+        <van-swipe-cell
+          v-for="item in list"
+          :key="item"
+          :before-close="beforeClose"
+        >
+          <div class="list_item" @click="goInfo(item.id)">
+            <div class="item-left">
+              <p style="color: #c4c4c4">{{ item.partyTime }}</p>
+              <p style="color: red">待审核</p>
+            </div>
+            <van-cell is-link>
+              <template #title>
+                <p>地点:{{ item.placeSelectName }}</p>
+                <p>相关人员:{{ item.relatedPersons.name }}</p>
+                <p>频次:{{ item.frequency }}</p>
+              </template>
+            </van-cell>
+          </div>
+          <template #right>
+            <van-button square type="danger" text="删除" class="button" />
+            <van-button
+              square
+              type="primary"
+              text="修改"
+              class="button"
+              @click="updateItem(item)"
+            />
           </template>
-          <template #label>
-            {{ item.activityPlace + " " + item.address }}
-          </template> -->
-        </van-cell>
-      </div>
-      <template #right>
-        <van-button square type="danger" text="删除" class="button" />
-        <van-button square type="primary" text="修改" class="button" />
-      </template>
-    </van-swipe-cell>
-  </van-list>
+        </van-swipe-cell>
+      </van-list>
+    </van-tab>
+    <van-tab title="已审核" name="1">
+      <van-list
+        v-model:loading="loading"
+        :finished="finished"
+        finished-text="没有更多了"
+        @load="onLoad"
+      >
+        <van-swipe-cell
+          v-for="item in list"
+          :key="item"
+          :before-close="beforeClose"
+        >
+          <div class="list_item" @click="goInfo(item.id)">
+            <div class="item-left">
+              <p style="color: #c4c4c4">{{ item.partyTime }}</p>
+              <p style="color: red">已审核</p>
+            </div>
+            <van-cell is-link>
+              <template #title>
+                <p>地点:{{ item.placeSelectName }}</p>
+                <p>相关人员:{{ item.relatedPersons.name }}</p>
+                <p>频次:{{ item.frequency }}</p>
+              </template>
+            </van-cell>
+          </div>
+        </van-swipe-cell>
+      </van-list>
+    </van-tab>
+  </van-tabs>
 </template>
   
   <script>
 import { ref } from "vue";
-import router from "@/router";
+import PrivatePartyPointService from "@/api/privateparty/PrivatePartyPointService";
+import { useRouter } from "vue-router";
 export default {
   name: "placeActivityList",
   setup() {
@@ -55,56 +97,113 @@ export default {
     const onClickRight = () => {
       router.push("/selfMeeting");
     };
-    const value = ref('');
-    const list = ref([]);
+    const value = ref("");
+    // 切换
+    let active = ref(0);
+    const onClickTab = (val) => {
+      // 清空列表数据
+      finished.value = false;
+      list.value = [];
+      // 重新加载数据
+      // 将 loading 设置为 true,表示处于加载状态
+      loading.value = true;
+      if (val.name == 0) {
+        onLoad(0);
+      } else {
+        onLoad(1);
+      }
+    };
+    // 列表
+    let list = ref([]);
     const loading = ref(false);
     const finished = ref(false);
-
-    const onLoad = () => {
+    let index = 0;
+    const onLoad = (val) => {
       // 异步更新数据
-      // setTimeout 仅做示例,真实场景中一般为 ajax 请求
-      setTimeout(() => {
-        for (let i = 0; i < 10; i++) {
-          list.value.push(list.value.length + 1);
-        }
-
-        // 加载状态结束
-        loading.value = false;
-
-        // 数据全部加载完成
-        if (list.value.length >= 10) {
-          finished.value = true;
-        }
-      }, 1000);
+      new PrivatePartyPointService()
+        .list({
+          current: index + 1,
+          size: 10,
+          assessment: val ? val : 0,
+        })
+        .then((res) => {
+          list.value.push(...res.records);
+          // 加载状态结束
+          loading.value = false;
+          // 数据全部加载完成
+          if (res.records.length < 10) {
+            finished.value = true;
+          }
+          index++;
+        });
+    };
+    // 删除确认
+    const beforeClose = ({ position }) => {
+      switch (position) {
+        case "left":
+        case "cell":
+        case "outside":
+          return true;
+        case "right":
+          return new Promise((resolve) => {
+            showConfirmDialog({
+              title: "确定删除吗?",
+            }).then(resolve);
+          });
+      }
+    };
+    let router = useRouter();
+    // 修改跳转
+    const updateItem = (val) => {
+      router.push({
+        path: "/selfMeeting",
+        query: { id: val.id },
+      });
+    };
+    // 详情跳转
+    const goInfo = (val) => {
+      router.push({
+        path: "/selfMeetingInfo",
+        query: { id: val },
+      });
     };
     return {
+      active,
+      onClickTab,
       onClickLeft,
-      onClickRight,
-      value,
       list,
       onLoad,
       loading,
       finished,
+      value,
+      onClickRight,
+      beforeClose,
+      updateItem,
+      goInfo,
     };
   },
 };
-</script>
+</script >
   
-  <style>
-.nav_tab {
-  width: 100vw;
+<style scope>
+.van-list {
+  height: 80%;
+  margin-top: 5px;
+}
+.list_item {
   display: flex;
-  text-align: center;
   background: #fff;
-  margin: 10px 0;
 }
-.tab {
-  flex: 1;
-  line-height: 40px;
-  font-size: 14px;
+.list_item p{
+  line-height: 1;
+}
+.item-left {
+  text-align: center;
+  width: 30%;
+  font-size: 12px;
+  border-right: 1px solid #eee;
 }
-.active {
-  background: #36a7f3;
-  color: #fff;
+.button {
+  height: 100%;
 }
 </style>

+ 26 - 3
src/views/activityMan/selfMeetingReport/selfMeetingView.vue

@@ -5,7 +5,8 @@
     left-arrow
     @click-left="onClickLeft"
   />
-  <div class="main">
+  <van-loading size="16px" v-if="isLoading">加载中...</van-loading>
+  <div class="main" v-if="!isLoading">
     <p class="title">私设聚会点上报</p>
     <div class="formArea">
       <p class="miniTitle">基础信息</p>
@@ -119,14 +120,16 @@
 </template>
   
   <script>
-import { ref } from "vue";
+import { ref ,onMounted} from "vue";
 import personList from "../personList.vue";
 import tools from "@/api/sys/tools";
-import UserManage from "@/api/user/UserManage";
+import PrivatePartyPointService from "@/api/privateparty/PrivatePartyPointService";
 import { useRoute } from "vue-router";
 export default {
   components: { personList },
   setup() {
+    // 加载
+    let isLoading = ref(true);
     // 返回
     const onClickLeft = () => {
       history.back();
@@ -151,6 +154,25 @@ export default {
       state: "0",
       assessment: "0",
     });
+    // 根据路由初始化
+    let route = useRoute();
+    onMounted(() => {
+      if (route.query.id) {
+        new PrivatePartyPointService().queryById(route.query.id).then((data) => {
+          inputForm.value = data;
+          // let ids = data.knownList.id.split(",");
+          // inputForm.value.knownList.name = "";
+          // ids.forEach((item) => {
+          //   new UserManage().queryById(item).then((data) => {
+          //     inputForm.value.knownList.name += data.name + ",";
+          //   });
+          // });
+          isLoading.value = false;
+        });
+      } else {
+        isLoading.value = false;
+      }
+    });
     // 获取活动时间
     let showAct = ref(false);
     let currentDate = ref(["" + new Date().getFullYear(), "01", "01"]);
@@ -205,6 +227,7 @@ export default {
         .join("/");
     };
     return {
+      isLoading,
       inputForm,
       // 活动时间
       showAct,