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