Commit c23b70bd44d9e2d2907a6beb2a80b716fd71d6c4
1 parent
0ddea150
手工活动 公益分类
Showing
8 changed files
with
392 additions
and
128 deletions
src/api/event/index.ts
| ... | ... | @@ -14,6 +14,45 @@ export const eventCategory = async ( params: any ) => { |
| 14 | 14 | return res |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | +/** | |
| 18 | + * @description 公益编辑 | |
| 19 | + * @function eventCategoryEdit | |
| 20 | + */ | |
| 21 | + export const eventCategoryEdit = async ( data: any ) => { | |
| 22 | + let res: any = await request({ | |
| 23 | + method: 'post', | |
| 24 | + url: '/craft/insertOrUpdate', | |
| 25 | + data: data | |
| 26 | + }) | |
| 27 | + return res | |
| 28 | +} | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * @description 公益删除 | |
| 32 | + * @function eventCategoryOmit | |
| 33 | + */ | |
| 34 | + export const eventCategoryOmit = async ( params: any ) => { | |
| 35 | + let res: any = await request({ | |
| 36 | + method: 'delete', | |
| 37 | + url: '/craft/deleteCraftById', | |
| 38 | + params: params | |
| 39 | + }) | |
| 40 | + return res | |
| 41 | +} | |
| 42 | + | |
| 43 | +/** | |
| 44 | + * @description 公益详情 | |
| 45 | + * @function eventCategoryDetail | |
| 46 | + */ | |
| 47 | + export const eventCategoryDetail = async ( params: any ) => { | |
| 48 | + let res: any = await request({ | |
| 49 | + method: 'get', | |
| 50 | + url: '/craft/getCraftById', | |
| 51 | + params: params | |
| 52 | + }) | |
| 53 | + return res | |
| 54 | +} | |
| 55 | + | |
| 17 | 56 | |
| 18 | 57 | /** |
| 19 | 58 | * @description 手工活动列表 | ... | ... |
src/router/modules/event.ts
| ... | ... | @@ -6,17 +6,17 @@ const event = { |
| 6 | 6 | children: [{ |
| 7 | 7 | path: '/event/category', |
| 8 | 8 | name: 'eventCategory', |
| 9 | - component: () => import('@/views/event/index.vue'), | |
| 9 | + component: () => import('@/views/event/category/index.vue'), | |
| 10 | 10 | meta: { title: '公益分类' } |
| 11 | 11 | }, { |
| 12 | 12 | path: '/event/handwork', |
| 13 | 13 | name: 'handwork', |
| 14 | - component: () => import('@/views/event/handwork.vue'), | |
| 14 | + component: () => import('@/views/event/handwork/index.vue'), | |
| 15 | 15 | meta: { title: '手工活动' } |
| 16 | 16 | }, { |
| 17 | 17 | path: '/event/handwork/edit', |
| 18 | 18 | name: 'handworkEdit', |
| 19 | - component: () => import('@/views/event/edit.vue'), | |
| 19 | + component: () => import('@/views/event/handwork/edit.vue'), | |
| 20 | 20 | meta: { title: '手工活动编辑' } |
| 21 | 21 | }] |
| 22 | 22 | } | ... | ... |
src/views/event/category/index.vue
0 → 100644
| 1 | +<script setup lang="ts"> | |
| 2 | +import { reactive, ref, onMounted, getCurrentInstance } from "vue"; | |
| 3 | +import { | |
| 4 | + eventCategory, | |
| 5 | + eventCategoryEdit, | |
| 6 | + eventCategoryOmit, | |
| 7 | + eventCategoryDetail, | |
| 8 | +} from "@/api/event"; | |
| 9 | +import { parseTime } from "@/utils/tool"; | |
| 10 | +import * as store from "@/pinia/index"; | |
| 11 | +import Pagination from "@/components/Pagination/index.vue"; | |
| 12 | +import { ElMessageBox } from "element-plus"; | |
| 13 | +import type { ElForm } from "element-plus"; | |
| 14 | +interface Form { | |
| 15 | + page: number; | |
| 16 | + pageSize: number; | |
| 17 | + name: string; | |
| 18 | +} | |
| 19 | +interface Params { | |
| 20 | + total: number; | |
| 21 | + query: Form; | |
| 22 | +} | |
| 23 | +interface Data { | |
| 24 | + loading: boolean; | |
| 25 | + list: any[] | null; | |
| 26 | + params: Params; | |
| 27 | +} | |
| 28 | +let data = reactive({ | |
| 29 | + list: [], | |
| 30 | + loading: false, | |
| 31 | + params: { | |
| 32 | + total: 0, | |
| 33 | + query: { | |
| 34 | + page: 1, | |
| 35 | + pageSize: 10, | |
| 36 | + name: "", | |
| 37 | + }, | |
| 38 | + }, | |
| 39 | +}); | |
| 40 | +let form = reactive({ | |
| 41 | + name: "", | |
| 42 | + status: "0", | |
| 43 | + id: null, | |
| 44 | + createTime: "", | |
| 45 | + deleteFlag: "", | |
| 46 | + oid: store?.family?.loginStore()?.organizationId ?? 0, | |
| 47 | +}); | |
| 48 | +/** | |
| 49 | + * 表单验证规则 | |
| 50 | + */ | |
| 51 | +const rules = reactive({ | |
| 52 | + name: [ | |
| 53 | + { | |
| 54 | + required: true, | |
| 55 | + message: "请填写公益名称", | |
| 56 | + trigger: "change", | |
| 57 | + }, | |
| 58 | + ], | |
| 59 | +}); | |
| 60 | +const dialogFormVisible = ref(false); | |
| 61 | +const loading = ref(false); | |
| 62 | +const ruleFormRef = ref<InstanceType<typeof ElForm>>(); | |
| 63 | +let instance: ComponentInternalInstance | null = getCurrentInstance(); | |
| 64 | +/** | |
| 65 | + * 状态值 | |
| 66 | + * @enum {number} | |
| 67 | + */ | |
| 68 | +enum statusEnum { | |
| 69 | + "禁用" = 0, | |
| 70 | + "启用", | |
| 71 | +} | |
| 72 | +/** | |
| 73 | + * 列表 | |
| 74 | + */ | |
| 75 | +const getList = async () => { | |
| 76 | + data.loading = true; | |
| 77 | + try { | |
| 78 | + const res = await eventCategory(data.params.query); | |
| 79 | + data.list = res?.data?.data?.list; | |
| 80 | + data.params.total = res?.data?.data?.total; | |
| 81 | + } catch (e) { | |
| 82 | + console.log(e); | |
| 83 | + } finally { | |
| 84 | + data.loading = false; | |
| 85 | + } | |
| 86 | +}; | |
| 87 | +/** | |
| 88 | + * 表单重置 | |
| 89 | + */ | |
| 90 | +const resetForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | |
| 91 | + dialogFormVisible.value = false; | |
| 92 | + if (!formEl) return; | |
| 93 | + formEl.resetFields(); | |
| 94 | +}; | |
| 95 | +/** | |
| 96 | + * 表单提交 | |
| 97 | + */ | |
| 98 | +const submitForm = ( | |
| 99 | + formEl: InstanceType<typeof ElForm> | undefined, | |
| 100 | + type: number | |
| 101 | +) => { | |
| 102 | + loading.value = true; | |
| 103 | + if (!formEl) return; | |
| 104 | + formEl.validate(async (valid) => { | |
| 105 | + if (valid) { | |
| 106 | + eventCategoryEdit(form) | |
| 107 | + .then((res) => { | |
| 108 | + if (res) { | |
| 109 | + instance?.proxy?.$message.success("操作成功"); | |
| 110 | + dialogFormVisible.value = false; | |
| 111 | + getList(); | |
| 112 | + } else { | |
| 113 | + instance?.proxy?.$message.error("操作失败"); | |
| 114 | + } | |
| 115 | + }) | |
| 116 | + .catch((error) => { | |
| 117 | + console.log(error); | |
| 118 | + }) | |
| 119 | + .finally(() => { | |
| 120 | + loading.value = false; | |
| 121 | + }); | |
| 122 | + } else { | |
| 123 | + instance?.proxy?.$message.error("请检查表单格式"); | |
| 124 | + loading.value = false; | |
| 125 | + return false; | |
| 126 | + } | |
| 127 | + }); | |
| 128 | +}; | |
| 129 | +/** | |
| 130 | + * 编辑 | |
| 131 | + */ | |
| 132 | +const handleEdit = (obj: any) => { | |
| 133 | + eventCategoryDetail({ id: obj.id }).then((res) => { | |
| 134 | + form.id = res?.data?.data?.id; | |
| 135 | + form.name = res?.data?.data?.name; | |
| 136 | + form.status = res?.data?.data?.status?.toString(); | |
| 137 | + form.oid = res?.data?.data?.oid; | |
| 138 | + form.createTime = res?.data?.data?.createTime; | |
| 139 | + form.deleteFlag = res?.data?.data?.deleteFlag; | |
| 140 | + dialogFormVisible.value = true; | |
| 141 | + }); | |
| 142 | +}; | |
| 143 | +/** | |
| 144 | + * 删除 | |
| 145 | + */ | |
| 146 | +const handleDelete = (obj: any) => { | |
| 147 | + ElMessageBox.confirm("确认删除吗?", "警告", { | |
| 148 | + confirmButtonText: "确认", | |
| 149 | + cancelButtonText: "取消", | |
| 150 | + type: "warning", | |
| 151 | + }) | |
| 152 | + .then(async () => { | |
| 153 | + try { | |
| 154 | + let res = await eventCategoryOmit({ | |
| 155 | + id: obj.id, | |
| 156 | + }); | |
| 157 | + if (res?.data) { | |
| 158 | + instance?.proxy?.$message.success("操作成功"); | |
| 159 | + getList(); | |
| 160 | + } else { | |
| 161 | + instance?.proxy?.$message.error("操作失败"); | |
| 162 | + } | |
| 163 | + } catch (e) { | |
| 164 | + console.log(e); | |
| 165 | + } | |
| 166 | + }) | |
| 167 | + .catch(() => { | |
| 168 | + console.log("取消"); | |
| 169 | + }); | |
| 170 | +}; | |
| 171 | +/** | |
| 172 | + * 弹框关闭 | |
| 173 | + */ | |
| 174 | +const dialogClose: void = () => { | |
| 175 | + form.id = null; | |
| 176 | + form.name = ""; | |
| 177 | + form.deleteFlag = ""; | |
| 178 | + form.createTime = ""; | |
| 179 | + form.oid = store?.family?.loginStore()?.organizationId ?? 0; | |
| 180 | + form.status = "0"; | |
| 181 | +}; | |
| 182 | +onMounted(() => { | |
| 183 | + getList(); | |
| 184 | +}); | |
| 185 | +</script> | |
| 186 | + | |
| 187 | +<template> | |
| 188 | + <div class="page-container"> | |
| 189 | + <h1>公益分类</h1> | |
| 190 | + <el-row style="padding-bottom: 20px"> | |
| 191 | + <el-form :inline="true" label-width="70px"> | |
| 192 | + <el-form-item label="名称"> | |
| 193 | + <el-input | |
| 194 | + v-model.trim="data.params.query.name" | |
| 195 | + placeholder="请填写名称" | |
| 196 | + maxlength="15" | |
| 197 | + @change="getList" | |
| 198 | + /> | |
| 199 | + </el-form-item> | |
| 200 | + <el-form-item> | |
| 201 | + <el-button type="primary" @click="getList">查询</el-button> | |
| 202 | + <el-button type="primary" @click="dialogFormVisible = true" | |
| 203 | + >添加公益</el-button | |
| 204 | + > | |
| 205 | + </el-form-item> | |
| 206 | + </el-form> | |
| 207 | + </el-row> | |
| 208 | + <el-table | |
| 209 | + :data="data.list" | |
| 210 | + style="width: 100%" | |
| 211 | + border | |
| 212 | + v-loading="data.loading" | |
| 213 | + align="center" | |
| 214 | + element-loading-text="拼命加载中" | |
| 215 | + > | |
| 216 | + <el-table-column prop="id" label="ID" align="center"></el-table-column> | |
| 217 | + <el-table-column | |
| 218 | + prop="name" | |
| 219 | + label="活动名称" | |
| 220 | + align="center" | |
| 221 | + ></el-table-column> | |
| 222 | + <el-table-column prop="createTime" label="添加时间" align="center"> | |
| 223 | + <template #default="scope"> | |
| 224 | + {{ parseTime(new Date(scope.row.createTime).getTime()) }} | |
| 225 | + </template> | |
| 226 | + </el-table-column> | |
| 227 | + <el-table-column prop="status" label="状态" align="center"> | |
| 228 | + <template #default="scope"> | |
| 229 | + {{ statusEnum[scope.row.status] }} | |
| 230 | + </template> | |
| 231 | + </el-table-column> | |
| 232 | + <el-table-column label="操作" align="center"> | |
| 233 | + <template #default="scope"> | |
| 234 | + <el-button type="text" @click="handleEdit(scope.row)">编辑</el-button> | |
| 235 | + <el-button type="text" @click="handleDelete(scope.row)" | |
| 236 | + >删除</el-button | |
| 237 | + > | |
| 238 | + </template> | |
| 239 | + </el-table-column> | |
| 240 | + </el-table> | |
| 241 | + <Pagination | |
| 242 | + :total="data.params.total" | |
| 243 | + v-model:currentPage="data.params.query.page" | |
| 244 | + v-model:pageSize="data.params.query.pageSize" | |
| 245 | + @pageChange="getList" | |
| 246 | + ></Pagination> | |
| 247 | + | |
| 248 | + <el-dialog | |
| 249 | + v-model="dialogFormVisible" | |
| 250 | + title="编辑公益" | |
| 251 | + @close="dialogClose" | |
| 252 | + > | |
| 253 | + <el-form | |
| 254 | + :model="form" | |
| 255 | + label-width="120px" | |
| 256 | + ref="ruleFormRef" | |
| 257 | + :rules="rules" | |
| 258 | + > | |
| 259 | + <el-form-item label="公益名称" prop="name"> | |
| 260 | + <el-input | |
| 261 | + v-model.trim="form.name" | |
| 262 | + placeholder="请填写名称" | |
| 263 | + autocomplete="off" | |
| 264 | + maxlength="15" | |
| 265 | + ></el-input> | |
| 266 | + </el-form-item> | |
| 267 | + <el-form-item label="状态" prop="status"> | |
| 268 | + <el-radio-group v-model="form.status"> | |
| 269 | + <el-radio label="1">启用</el-radio> | |
| 270 | + <el-radio label="0">禁用</el-radio> | |
| 271 | + </el-radio-group> | |
| 272 | + </el-form-item> | |
| 273 | + </el-form> | |
| 274 | + <template #footer> | |
| 275 | + <span class="dialog-footer"> | |
| 276 | + <el-button @click="resetForm(ruleFormRef)">取消</el-button> | |
| 277 | + <el-button | |
| 278 | + type="primary" | |
| 279 | + @click="submitForm(ruleFormRef)" | |
| 280 | + :loading="form.loading" | |
| 281 | + >确认</el-button | |
| 282 | + > | |
| 283 | + </span> | |
| 284 | + </template> | |
| 285 | + </el-dialog> | |
| 286 | + </div> | |
| 287 | +</template> | ... | ... |
src/views/event/edit.vue renamed to src/views/event/handwork/edit.vue
| ... | ... | @@ -3,6 +3,7 @@ import { reactive, ref, getCurrentInstance, onMounted } from "vue"; |
| 3 | 3 | import { eventCategory, handworkEdit } from "@/api/event"; |
| 4 | 4 | import { useRoute } from "vue-router"; |
| 5 | 5 | import { back } from "@/utils/tool"; |
| 6 | +import * as store from "@/pinia"; | |
| 6 | 7 | import type { ElForm } from "element-plus"; |
| 7 | 8 | let form = reactive({ |
| 8 | 9 | data: { |
| ... | ... | @@ -20,6 +21,7 @@ let form = reactive({ |
| 20 | 21 | publicityPic: "", |
| 21 | 22 | status: 0, |
| 22 | 23 | }, |
| 24 | + category: [], | |
| 23 | 25 | dataType: "", |
| 24 | 26 | loading: false, |
| 25 | 27 | }); |
| ... | ... | @@ -102,6 +104,8 @@ const submitForm = ( |
| 102 | 104 | if (res) { |
| 103 | 105 | instance?.proxy?.$message.success("操作成功"); |
| 104 | 106 | back(); |
| 107 | + } else { | |
| 108 | + instance?.proxy?.$message.error("操作失败"); | |
| 105 | 109 | } |
| 106 | 110 | }) |
| 107 | 111 | .catch((error) => { |
| ... | ... | @@ -117,11 +121,33 @@ const submitForm = ( |
| 117 | 121 | } |
| 118 | 122 | }); |
| 119 | 123 | }; |
| 124 | +/** | |
| 125 | + * 公益分类 | |
| 126 | + * @param {number | null} pageSize 一次请求多少条数据 | |
| 127 | + */ | |
| 128 | +const getCategory = async (pageSize: number = 20) => { | |
| 129 | + try { | |
| 130 | + const res = await eventCategory({ | |
| 131 | + page: 1, | |
| 132 | + pageSize: pageSize, | |
| 133 | + oid: store?.family?.loginStore()?.organizationId ?? 0, | |
| 134 | + }); | |
| 135 | + form.category = res?.data?.data?.list; | |
| 136 | + if (res?.data?.data?.total > pageSize) { | |
| 137 | + getCategory(res?.data?.data?.total); | |
| 138 | + } | |
| 139 | + } catch (e) { | |
| 140 | + console.log(e); | |
| 141 | + } | |
| 142 | +}; | |
| 120 | 143 | onMounted(() => { |
| 144 | + getCategory() | |
| 121 | 145 | if (JSON.stringify(useRoute().query) === "{}") { |
| 122 | 146 | form.dataType = "add"; |
| 123 | 147 | } else { |
| 124 | 148 | form.dataType = "edit"; |
| 149 | + form.data = useRoute().query | |
| 150 | + form.data.craftId = ~~useRoute().query.craftId | |
| 125 | 151 | } |
| 126 | 152 | }); |
| 127 | 153 | </script> |
| ... | ... | @@ -149,7 +175,7 @@ onMounted(() => { |
| 149 | 175 | </el-form-item> |
| 150 | 176 | <el-form-item label="活动分类" prop="craftId" style="width: 50%"> |
| 151 | 177 | <el-select v-model="form.data.craftId" placeholder="请选择活动分类"> |
| 152 | - <el-option label="分类" value="1000"></el-option> | |
| 178 | + <el-option v-for="(item, index) in form.category" :key="index" :label="item.name" :value="item.id"></el-option> | |
| 153 | 179 | </el-select> |
| 154 | 180 | </el-form-item> |
| 155 | 181 | <el-form-item label="开始时间" prop="startTime" style="width: 50%"> |
| ... | ... | @@ -162,12 +188,18 @@ onMounted(() => { |
| 162 | 188 | </el-date-picker> |
| 163 | 189 | </el-form-item> |
| 164 | 190 | <el-form-item label="活动时长" prop="duration" style="width: 50%"> |
| 165 | - <el-input v-model.trim="form.data.duration" placeholder="请填写活动时长"> | |
| 191 | + <el-input | |
| 192 | + v-model.trim="form.data.duration" | |
| 193 | + placeholder="请填写活动时长" | |
| 194 | + > | |
| 166 | 195 | <template #append>小时</template> |
| 167 | 196 | </el-input> |
| 168 | 197 | </el-form-item> |
| 169 | 198 | <el-form-item label="活动单价" prop="unitPrice" style="width: 50%"> |
| 170 | - <el-input v-model.trim="form.data.unitPrice" placeholder="请填写活动单价"> | |
| 199 | + <el-input | |
| 200 | + v-model.trim="form.data.unitPrice" | |
| 201 | + placeholder="请填写活动单价" | |
| 202 | + > | |
| 171 | 203 | <template #append>元</template> |
| 172 | 204 | </el-input> |
| 173 | 205 | </el-form-item> | ... | ... |
src/views/event/handwork.vue renamed to src/views/event/handwork/index.vue
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | import { reactive, ref, onMounted } from "vue"; |
| 3 | 3 | import { handworkList } from "@/api/event"; |
| 4 | 4 | import { parseTime } from "@/utils/tool"; |
| 5 | -import { statusData } from './config'; | |
| 5 | +import { statusData } from "./../config"; | |
| 6 | 6 | import Pagination from "@/components/Pagination/index.vue"; |
| 7 | 7 | import { ElMessageBox, ElMessage } from "element-plus"; |
| 8 | 8 | interface Form { |
| ... | ... | @@ -34,11 +34,11 @@ let data = reactive({ |
| 34 | 34 | page: 1, |
| 35 | 35 | pageSize: 10, |
| 36 | 36 | oid: 0, |
| 37 | - startTime: '', | |
| 38 | - endTime: '', | |
| 39 | - name: '', | |
| 37 | + startTime: "", | |
| 38 | + endTime: "", | |
| 39 | + name: "", | |
| 40 | 40 | status: null, |
| 41 | - duration: null | |
| 41 | + duration: null, | |
| 42 | 42 | }, |
| 43 | 43 | }, |
| 44 | 44 | }); |
| ... | ... | @@ -90,8 +90,17 @@ onMounted(() => { |
| 90 | 90 | </el-date-picker> |
| 91 | 91 | </el-form-item> |
| 92 | 92 | <el-form-item label="活动状态"> |
| 93 | - <el-select v-model="data.params.query.status" placeholder="请选择活动状态" @change="getList" clearable> | |
| 94 | - <el-option v-for="(item, index) in statusData" :label="item.status" :value="item.value"></el-option> | |
| 93 | + <el-select | |
| 94 | + v-model="data.params.query.status" | |
| 95 | + placeholder="请选择活动状态" | |
| 96 | + @change="getList" | |
| 97 | + clearable | |
| 98 | + > | |
| 99 | + <el-option | |
| 100 | + v-for="(item, index) in statusData" | |
| 101 | + :label="item.status" | |
| 102 | + :value="item.value" | |
| 103 | + ></el-option> | |
| 95 | 104 | </el-select> |
| 96 | 105 | </el-form-item> |
| 97 | 106 | <el-form-item label="名称"> |
| ... | ... | @@ -139,11 +148,7 @@ onMounted(() => { |
| 139 | 148 | label="参与人数" |
| 140 | 149 | align="center" |
| 141 | 150 | ></el-table-column> |
| 142 | - <el-table-column | |
| 143 | - prop="startTime" | |
| 144 | - label="开始时间" | |
| 145 | - align="center" | |
| 146 | - > | |
| 151 | + <el-table-column prop="startTime" label="开始时间" align="center"> | |
| 147 | 152 | <template #default="scope"> |
| 148 | 153 | {{ parseTime(new Date(scope.row.startTime).getTime()) }} |
| 149 | 154 | </template> |
| ... | ... | @@ -163,27 +168,23 @@ onMounted(() => { |
| 163 | 168 | label="活动地址" |
| 164 | 169 | align="center" |
| 165 | 170 | ></el-table-column> |
| 166 | - <el-table-column | |
| 167 | - prop="status" | |
| 168 | - label="活动状态" | |
| 169 | - align="center" | |
| 170 | - > | |
| 171 | + <el-table-column prop="status" label="活动状态" align="center"> | |
| 171 | 172 | <template #default="scope"> |
| 172 | - {{statusData.find(u => u.value === scope.row.status)['status']}} | |
| 173 | + {{ statusData.find((u) => u.value === scope.row.status)["status"] }} | |
| 173 | 174 | </template> |
| 174 | 175 | </el-table-column> |
| 175 | - <el-table-column | |
| 176 | - prop="status" | |
| 177 | - label="发布总结" | |
| 178 | - align="center" | |
| 179 | - > | |
| 176 | + <el-table-column prop="status" label="发布总结" align="center"> | |
| 180 | 177 | <template #default="scope"> |
| 181 | - {{statusData.find(u => u.value === scope.row.status)['publish']}} | |
| 178 | + {{ statusData.find((u) => u.value === scope.row.status)["publish"] }} | |
| 182 | 179 | </template> |
| 183 | 180 | </el-table-column> |
| 184 | 181 | <el-table-column label="操作" align="center"> |
| 185 | 182 | <template #default="scope"> |
| 186 | - <el-button type="text">编辑</el-button> | |
| 183 | + <el-button type="text" :disabled="~~scope.row.status !== 0" | |
| 184 | + ><router-link :to="{ path: '/event/handwork/edit', query: scope.row }" | |
| 185 | + >编辑</router-link | |
| 186 | + ></el-button | |
| 187 | + > | |
| 187 | 188 | <el-button type="text">删除</el-button> |
| 188 | 189 | <el-button type="text">查看人员</el-button> |
| 189 | 190 | <el-button type="text">编辑/查看/发布活动总结</el-button> | ... | ... |
src/views/event/index.vue deleted
100644 → 0
| 1 | -<script setup lang="ts"> | |
| 2 | -import { reactive, ref, onMounted } from "vue"; | |
| 3 | -import { eventCategory } from '@/api/event'; | |
| 4 | -import { parseTime } from "@/utils/tool"; | |
| 5 | -import Pagination from "@/components/Pagination/index.vue"; | |
| 6 | -import { ElMessageBox, ElMessage } from "element-plus"; | |
| 7 | -interface Form { | |
| 8 | - page: number; | |
| 9 | - pageSize: number; | |
| 10 | -} | |
| 11 | -interface Params { | |
| 12 | - total: number; | |
| 13 | - query: Form; | |
| 14 | -} | |
| 15 | -interface Data { | |
| 16 | - loading: boolean; | |
| 17 | - list: any[] | null; | |
| 18 | - params: Params; | |
| 19 | -} | |
| 20 | -let data = reactive({ | |
| 21 | - list: [], | |
| 22 | - loading: false, | |
| 23 | - params: { | |
| 24 | - total: 0, | |
| 25 | - query: { | |
| 26 | - page: 1, | |
| 27 | - pageSize: 10 | |
| 28 | - }, | |
| 29 | - }, | |
| 30 | -}); | |
| 31 | -/** | |
| 32 | - * 列表 | |
| 33 | - */ | |
| 34 | -const getList = async () => { | |
| 35 | - data.loading = true; | |
| 36 | - try { | |
| 37 | - const res = await eventCategory(data.params.query); | |
| 38 | - data.list = res?.data?.data?.list; | |
| 39 | - data.params.total = res?.data?.data?.total; | |
| 40 | - } catch (e) { | |
| 41 | - console.log(e); | |
| 42 | - } finally { | |
| 43 | - data.loading = false; | |
| 44 | - } | |
| 45 | -}; | |
| 46 | -onMounted(() => { | |
| 47 | - getList(); | |
| 48 | -}); | |
| 49 | -</script> | |
| 50 | - | |
| 51 | -<template> | |
| 52 | - <div class="page-container"> | |
| 53 | - <h1>公益分类</h1> | |
| 54 | - <el-table | |
| 55 | - :data="data.list" | |
| 56 | - style="width: 100%" | |
| 57 | - border | |
| 58 | - v-loading="data.loading" | |
| 59 | - align="center" | |
| 60 | - element-loading-text="拼命加载中" | |
| 61 | - > | |
| 62 | - <el-table-column prop="id" label="ID" align="center"></el-table-column> | |
| 63 | - <el-table-column prop="name" label="活动名称" align="center"></el-table-column> | |
| 64 | - <el-table-column prop="createTime" label="添加时间" align="center"></el-table-column> | |
| 65 | - <el-table-column prop="status" label="状态" align="center"></el-table-column> | |
| 66 | - <el-table-column label="操作" align="center"></el-table-column> | |
| 67 | - </el-table> | |
| 68 | - <Pagination | |
| 69 | - :total="data.params.total" | |
| 70 | - v-model:currentPage="data.params.query.page" | |
| 71 | - v-model:pageSize="data.params.query.pageSize" | |
| 72 | - @pageChange="getList" | |
| 73 | - ></Pagination> | |
| 74 | - </div> | |
| 75 | -</template> |
src/views/repair/config.ts
| ... | ... | @@ -4,28 +4,6 @@ interface Option { |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | - * 维修项目 | |
| 8 | - */ | |
| 9 | -export const projects: Option[] = [ | |
| 10 | - { | |
| 11 | - label: '马桶疏通', | |
| 12 | - value: 1 | |
| 13 | - }, | |
| 14 | - { | |
| 15 | - label: '下水道疏通', | |
| 16 | - value: 2 | |
| 17 | - }, | |
| 18 | - { | |
| 19 | - label: '水龙头维修', | |
| 20 | - value: 3 | |
| 21 | - }, | |
| 22 | - { | |
| 23 | - label: '更换灯泡', | |
| 24 | - value: 4 | |
| 25 | - } | |
| 26 | -] | |
| 27 | - | |
| 28 | -/** | |
| 29 | 7 | * 工单状态 |
| 30 | 8 | */ |
| 31 | 9 | export const status: Option[] = [ | ... | ... |
src/views/repair/edit.vue
| ... | ... | @@ -236,6 +236,7 @@ onMounted(() => { |
| 236 | 236 | /> |
| 237 | 237 | </el-form-item> |
| 238 | 238 | <el-form-item label="报修项目" prop="repairProject" style="width: 100%"> |
| 239 | + <!-- 启用状态的报修项目可选 --> | |
| 239 | 240 | <el-checkbox-group |
| 240 | 241 | v-model="form.checkList" |
| 241 | 242 | @change="(data) => (form.data.repairProject = data.join(','))" |
| ... | ... | @@ -245,6 +246,7 @@ onMounted(() => { |
| 245 | 246 | v-for="(item, index) in form.projects" |
| 246 | 247 | :key="index" |
| 247 | 248 | :label="item.id" |
| 249 | + :disabled="!item.status" | |
| 248 | 250 | >{{ item.name }}</el-checkbox |
| 249 | 251 | > |
| 250 | 252 | </el-checkbox-group> | ... | ... |