Commit 99298078b425ac8b63b29c0ecc8f9284ebc97975

Authored by 杨泽宇
1 parent 55e05791

活动分类回显

src/api/event/index.ts
@@ -2,7 +2,7 @@ import request from '../request' @@ -2,7 +2,7 @@ import request from '../request'
2 import { deleteEmptyParam } from '@/utils/tool' 2 import { deleteEmptyParam } from '@/utils/tool'
3 3
4 /** 4 /**
5 - * @description 公益分类 5 + * @description 活动分类
6 * @function eventCategory 6 * @function eventCategory
7 */ 7 */
8 export const eventCategory = async ( params: any ) => { 8 export const eventCategory = async ( params: any ) => {
@@ -15,7 +15,7 @@ export const eventCategory = async ( params: any ) => { @@ -15,7 +15,7 @@ export const eventCategory = async ( params: any ) => {
15 } 15 }
16 16
17 /** 17 /**
18 - * @description 公益编辑 18 + * @description 活动编辑
19 * @function eventCategoryEdit 19 * @function eventCategoryEdit
20 */ 20 */
21 export const eventCategoryEdit = async ( data: any ) => { 21 export const eventCategoryEdit = async ( data: any ) => {
@@ -28,7 +28,7 @@ export const eventCategory = async ( params: any ) => { @@ -28,7 +28,7 @@ export const eventCategory = async ( params: any ) => {
28 } 28 }
29 29
30 /** 30 /**
31 - * @description 公益删除 31 + * @description 活动删除
32 * @function eventCategoryOmit 32 * @function eventCategoryOmit
33 */ 33 */
34 export const eventCategoryOmit = async ( params: any ) => { 34 export const eventCategoryOmit = async ( params: any ) => {
@@ -41,7 +41,7 @@ export const eventCategory = async ( params: any ) => { @@ -41,7 +41,7 @@ export const eventCategory = async ( params: any ) => {
41 } 41 }
42 42
43 /** 43 /**
44 - * @description 公益详情 44 + * @description 活动详情
45 * @function eventCategoryDetail 45 * @function eventCategoryDetail
46 */ 46 */
47 export const eventCategoryDetail = async ( params: any ) => { 47 export const eventCategoryDetail = async ( params: any ) => {
@@ -120,7 +120,7 @@ export const signupList = async (params: any) => { @@ -120,7 +120,7 @@ export const signupList = async (params: any) => {
120 } 120 }
121 121
122 /** 122 /**
123 - * @description 报名信息 123 + * @description 移除报名信息
124 * @function cancelSignup 124 * @function cancelSignup
125 */ 125 */
126 export const cancelSignup = async (params: any) => { 126 export const cancelSignup = async (params: any) => {
src/views/event/category/index.vue
@@ -54,7 +54,7 @@ const rules = reactive({ @@ -54,7 +54,7 @@ const rules = reactive({
54 name: [ 54 name: [
55 { 55 {
56 required: true, 56 required: true,
57 - message: "请填写公益名称", 57 + message: "请填写活动名称",
58 trigger: "change", 58 trigger: "change",
59 }, 59 },
60 ], 60 ],
@@ -189,7 +189,7 @@ onMounted(() => { @@ -189,7 +189,7 @@ onMounted(() => {
189 189
190 <template> 190 <template>
191 <div class="page-container"> 191 <div class="page-container">
192 - <!-- <h1>公益分类</h1> --> 192 + <!-- <h1>活动分类</h1> -->
193 <el-row style="padding-bottom: 20px"> 193 <el-row style="padding-bottom: 20px">
194 <el-form :inline="true" label-width="70px"> 194 <el-form :inline="true" label-width="70px">
195 <el-form-item label="名称"> 195 <el-form-item label="名称">
src/views/event/handwork/edit.vue
@@ -20,7 +20,7 @@ let form = reactive({ @@ -20,7 +20,7 @@ let form = reactive({
20 unitPrice: null, 20 unitPrice: null,
21 description: "", 21 description: "",
22 id: null, 22 id: null,
23 - oid: null, 23 + oid: useLoginStore()?.getOid ?? 0,
24 organizer: "", 24 organizer: "",
25 personLimit: null, 25 personLimit: null,
26 publicityPic: "", 26 publicityPic: "",
@@ -186,7 +186,9 @@ const submitForm = ( @@ -186,7 +186,9 @@ const submitForm = (
186 if (!formEl) return; 186 if (!formEl) return;
187 formEl.validate(async (valid) => { 187 formEl.validate(async (valid) => {
188 if (valid) { 188 if (valid) {
189 - form.data.publicityPic = form.publicityPic.map(item => item.url).join(',') 189 + form.data.publicityPic = form.publicityPic
  190 + .map((item) => item.url)
  191 + .join(",");
190 handworkEdit(form.data) 192 handworkEdit(form.data)
191 .then((res) => { 193 .then((res) => {
192 if (res) { 194 if (res) {
@@ -210,7 +212,7 @@ const submitForm = ( @@ -210,7 +212,7 @@ const submitForm = (
210 }); 212 });
211 }; 213 };
212 /** 214 /**
213 - * 公益分类 215 + * 活动分类
214 * @param {number | null} pageSize 一次请求多少条数据 216 * @param {number | null} pageSize 一次请求多少条数据
215 */ 217 */
216 const getCategory = async (pageSize: number = 20) => { 218 const getCategory = async (pageSize: number = 20) => {
@@ -260,6 +262,7 @@ onMounted(() =&gt; { @@ -260,6 +262,7 @@ onMounted(() =&gt; {
260 if (JSON.stringify(useRoute().query) === "{}") { 262 if (JSON.stringify(useRoute().query) === "{}") {
261 form.dataType = "add"; 263 form.dataType = "add";
262 } else { 264 } else {
  265 + console.log(useRoute().query);
263 form.dataType = "edit"; 266 form.dataType = "edit";
264 form.data = useRoute().query; 267 form.data = useRoute().query;
265 form.data.craftId = ~~useRoute().query.craftId; 268 form.data.craftId = ~~useRoute().query.craftId;
@@ -336,7 +339,11 @@ onMounted(() =&gt; { @@ -336,7 +339,11 @@ onMounted(() =&gt; {
336 @change="handleTimeChange" 339 @change="handleTimeChange"
337 ></el-date-picker> 340 ></el-date-picker>
338 </el-form-item> 341 </el-form-item>
339 - <el-form-item label="报名时间" prop="signupStartTime" style="width: 100%"> 342 + <el-form-item
  343 + label="报名时间"
  344 + prop="signupStartTime"
  345 + style="width: 100%"
  346 + >
340 <el-date-picker 347 <el-date-picker
341 v-model="form.value2" 348 v-model="form.value2"
342 type="datetimerange" 349 type="datetimerange"
@@ -439,7 +446,7 @@ onMounted(() =&gt; { @@ -439,7 +446,7 @@ onMounted(() =&gt; {
439 <el-form-item label="小区" prop="neighborhoodId" style="width: 100%"> 446 <el-form-item label="小区" prop="neighborhoodId" style="width: 100%">
440 <el-checkbox-group 447 <el-checkbox-group
441 v-model="form.communityList" 448 v-model="form.communityList"
442 - @change="(data) => (form.data.neighborhoodIds = data.join(','))" 449 + @change="(data) => (form.data.neighborhoodId = data.join(','))"
443 v-if="form.communities.length" 450 v-if="form.communities.length"
444 > 451 >
445 <el-checkbox 452 <el-checkbox
src/views/event/handwork/index.vue
1 <script setup lang="ts"> 1 <script setup lang="ts">
2 import { reactive, ref, onMounted } from "vue"; 2 import { reactive, ref, onMounted } from "vue";
3 -import { handworkList } from "@/api/event"; 3 +import { handworkList, eventCategory } from "@/api/event";
4 import { parseTime } from "@/utils/tool"; 4 import { parseTime } from "@/utils/tool";
5 import { statusData } from "./../config"; 5 import { statusData } from "./../config";
6 import { useLoginStore } from "@/pinia/login"; 6 import { useLoginStore } from "@/pinia/login";
@@ -23,11 +23,13 @@ interface Params { @@ -23,11 +23,13 @@ interface Params {
23 interface Data { 23 interface Data {
24 loading: boolean; 24 loading: boolean;
25 list: any[] | null; 25 list: any[] | null;
  26 + category: any[] | null;
26 params: Params; 27 params: Params;
27 } 28 }
28 const value1 = ref([]); 29 const value1 = ref([]);
29 let data = reactive({ 30 let data = reactive({
30 list: [], 31 list: [],
  32 + category: [],
31 loading: false, 33 loading: false,
32 params: { 34 params: {
33 total: 0, 35 total: 0,
@@ -67,8 +69,28 @@ const handleTimeChange = (value: array) =&gt; { @@ -67,8 +69,28 @@ const handleTimeChange = (value: array) =&gt; {
67 data.params.query.endTime = value ? value[1] : ""; 69 data.params.query.endTime = value ? value[1] : "";
68 getList(); 70 getList();
69 }; 71 };
  72 +/**
  73 + * 活动分类
  74 + * @param {number | null} pageSize 一次请求多少条数据
  75 + */
  76 +const getCategory = async (pageSize: number = 20) => {
  77 + try {
  78 + const res = await eventCategory({
  79 + page: 1,
  80 + pageSize: pageSize,
  81 + oId: useLoginStore()?.getOid ?? 0,
  82 + });
  83 + data.category = res?.data?.data?.list;
  84 + if (res?.data?.data?.total > pageSize) {
  85 + getCategory(res?.data?.data?.total);
  86 + }
  87 + } catch (e) {
  88 + console.log(e);
  89 + }
  90 +};
70 onMounted(() => { 91 onMounted(() => {
71 getList(); 92 getList();
  93 + getCategory();
72 }); 94 });
73 </script> 95 </script>
74 96
@@ -134,11 +156,14 @@ onMounted(() =&gt; { @@ -134,11 +156,14 @@ onMounted(() =&gt; {
134 label="活动名称" 156 label="活动名称"
135 align="center" 157 align="center"
136 ></el-table-column> 158 ></el-table-column>
137 - <el-table-column  
138 - prop="craftId"  
139 - label="活动分类"  
140 - align="center"  
141 - ></el-table-column> 159 + <el-table-column prop="craftId" label="活动分类" align="center">
  160 + <template #default="scope">
  161 + {{
  162 + data.category.find((item) => ~~item.id === ~~scope.row.craftId)
  163 + ?.name
  164 + }}
  165 + </template>
  166 + </el-table-column>
142 <el-table-column 167 <el-table-column
143 prop="organizer" 168 prop="organizer"
144 label="发布人" 169 label="发布人"
@@ -182,15 +207,17 @@ onMounted(() =&gt; { @@ -182,15 +207,17 @@ onMounted(() =&gt; {
182 <el-table-column label="操作" align="center"> 207 <el-table-column label="操作" align="center">
183 <template #default="scope"> 208 <template #default="scope">
184 <el-button type="text" :disabled="~~scope.row.status !== 0" 209 <el-button type="text" :disabled="~~scope.row.status !== 0"
185 - ><router-link :to="{ path: '/event/handwork/edit', query: scope.row }" 210 + ><router-link
  211 + :to="{ path: '/event/handwork/edit', query: scope.row }"
186 >编辑</router-link 212 >编辑</router-link
187 ></el-button 213 ></el-button
188 > 214 >
189 - <el-button type="text">删除</el-button>  
190 - <el-button type="text"><router-link :to="{ path: '/event/handwork/signup', query: scope.row }" 215 + <el-button type="text"
  216 + ><router-link
  217 + :to="{ path: '/event/signup', query: { id: scope.row.id } }"
191 >查看人员</router-link 218 >查看人员</router-link
192 - ></el-button>  
193 - <el-button type="text">编辑/查看/发布活动总结</el-button> 219 + ></el-button
  220 + >
194 </template> 221 </template>
195 </el-table-column> 222 </el-table-column>
196 </el-table> 223 </el-table>
src/views/event/handwork/signup.vue
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 import { reactive, ref, onMounted } from "vue"; 2 import { reactive, ref, onMounted } from "vue";
3 import { signupList, cancelSignup } from "@/api/event"; 3 import { signupList, cancelSignup } from "@/api/event";
4 import { parseTime } from "@/utils/tool"; 4 import { parseTime } from "@/utils/tool";
  5 +import { useRoute } from "vue-router";
5 import Pagination from "@/components/Pagination/index.vue"; 6 import Pagination from "@/components/Pagination/index.vue";
6 import { ElMessageBox, ElMessage } from "element-plus"; 7 import { ElMessageBox, ElMessage } from "element-plus";
7 interface Form { 8 interface Form {
@@ -30,7 +31,7 @@ let data = reactive({ @@ -30,7 +31,7 @@ let data = reactive({
30 pageSize: 10, 31 pageSize: 10,
31 name: "", 32 name: "",
32 mobile: "", 33 mobile: "",
33 - handworkId: 4, 34 + handworkId: useRoute().query.id,
34 }, 35 },
35 }, 36 },
36 }); 37 });