Commit a67c8c94081aa1d0be54d99d4e92af94358900f5
1 parent
5309d8b2
栏目管理 表单项提示语句全局样式
Showing
10 changed files
with
463 additions
and
33 deletions
src/api/property/channel.ts renamed to src/api/property/column.ts
| @@ -26,7 +26,11 @@ export function columnAdd (data) { | @@ -26,7 +26,11 @@ export function columnAdd (data) { | ||
| 26 | * @function columnStatus | 26 | * @function columnStatus |
| 27 | */ | 27 | */ |
| 28 | export const columnStatus = async ( params: any ) => { | 28 | export const columnStatus = async ( params: any ) => { |
| 29 | - let res: any = await request.put( '/column/status', params ) | 29 | + let res: any = await request({ |
| 30 | + method: 'put', | ||
| 31 | + url: '/column/status', | ||
| 32 | + params: params | ||
| 33 | + }) | ||
| 30 | return res | 34 | return res |
| 31 | } | 35 | } |
| 32 | 36 | ||
| @@ -45,6 +49,10 @@ export const columnStatus = async ( params: any ) => { | @@ -45,6 +49,10 @@ export const columnStatus = async ( params: any ) => { | ||
| 45 | * @function columnSort | 49 | * @function columnSort |
| 46 | */ | 50 | */ |
| 47 | export const columnSort = async ( params: any ) => { | 51 | export const columnSort = async ( params: any ) => { |
| 48 | - let res: any = await request.put( '/column/sort', params ) | 52 | + let res: any = await request({ |
| 53 | + method: 'put', | ||
| 54 | + url: '/column/sort', | ||
| 55 | + params: params | ||
| 56 | + }) | ||
| 49 | return res | 57 | return res |
| 50 | } | 58 | } |
| 51 | \ No newline at end of file | 59 | \ No newline at end of file |
src/components/Uploader/index.vue
| @@ -148,10 +148,6 @@ const emit = defineEmits<{ | @@ -148,10 +148,6 @@ const emit = defineEmits<{ | ||
| 148 | .avatar { | 148 | .avatar { |
| 149 | display: block; | 149 | display: block; |
| 150 | } | 150 | } |
| 151 | -.tip { | ||
| 152 | - color: #606266; | ||
| 153 | - font-size: 12px; | ||
| 154 | -} | ||
| 155 | 151 | ||
| 156 | .square { | 152 | .square { |
| 157 | width: 178px; | 153 | width: 178px; |
src/router/modules/property.ts
| @@ -14,12 +14,12 @@ const property= { | @@ -14,12 +14,12 @@ const property= { | ||
| 14 | component: () => import('@/views/property/edit.vue'), | 14 | component: () => import('@/views/property/edit.vue'), |
| 15 | meta: { title: '物业编辑' } | 15 | meta: { title: '物业编辑' } |
| 16 | }, { | 16 | }, { |
| 17 | - path: '/property/column', | 17 | + path: 'column', |
| 18 | name: 'column', | 18 | name: 'column', |
| 19 | component: () => import('@/views/column/index.vue'), | 19 | component: () => import('@/views/column/index.vue'), |
| 20 | meta: { title: '栏目管理' } | 20 | meta: { title: '栏目管理' } |
| 21 | }, { | 21 | }, { |
| 22 | - path: '/property/column/edit', | 22 | + path: '/column/edit', |
| 23 | name: 'columnEdit', | 23 | name: 'columnEdit', |
| 24 | component: () => import('@/views/column/edit.vue'), | 24 | component: () => import('@/views/column/edit.vue'), |
| 25 | meta: { title: '栏目编辑' } | 25 | meta: { title: '栏目编辑' } |
src/style/element.scss
src/utils/tool.ts
| @@ -144,12 +144,12 @@ export function formatTime(time, option) { | @@ -144,12 +144,12 @@ export function formatTime(time, option) { | ||
| 144 | * @returns {string} | 144 | * @returns {string} |
| 145 | */ | 145 | */ |
| 146 | interface EnumData { | 146 | interface EnumData { |
| 147 | - value: number, | 147 | + value: number | string, |
| 148 | label: string | 148 | label: string |
| 149 | } | 149 | } |
| 150 | export function globalFilters (value: number, groupData: EnumData[]) { | 150 | export function globalFilters (value: number, groupData: EnumData[]) { |
| 151 | - if(groupData.length && (value === 0 || !!value)) { | ||
| 152 | - return groupData.find(item => item.value === value)['label'] | 151 | + if(groupData.length && (~~value === 0 || !!value)) { |
| 152 | + return groupData.find(item => ~~item.value === ~~value)['label'] | ||
| 153 | } else { | 153 | } else { |
| 154 | return value | 154 | return value |
| 155 | } | 155 | } |
src/views/column/config.ts
0 → 100644
| 1 | +interface Type { | ||
| 2 | + label: string, | ||
| 3 | + value: string | ||
| 4 | +} | ||
| 5 | + | ||
| 6 | +// 栏目类型 | ||
| 7 | +export const types: Type[] = [ | ||
| 8 | + { | ||
| 9 | + label: '权威咨询', | ||
| 10 | + value: '1' | ||
| 11 | + }, { | ||
| 12 | + label: '公益活动', | ||
| 13 | + value: '2' | ||
| 14 | + }, { | ||
| 15 | + label: '服务', | ||
| 16 | + value: '3' | ||
| 17 | + } | ||
| 18 | +] | ||
| 0 | \ No newline at end of file | 19 | \ No newline at end of file |
src/views/column/edit.vue
| 1 | -<template>栏目编辑</template> | ||
| 2 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +<script setup lang="ts"> | ||
| 3 | +import { reactive, ref, getCurrentInstance, onMounted } from "vue"; | ||
| 4 | +import { columnAdd, columnEdit } from "@/api/property/column"; | ||
| 5 | +import { useRoute } from "vue-router"; | ||
| 6 | +import { back } from "@/utils/tool"; | ||
| 7 | +import { types } from "./config"; | ||
| 8 | +import Uploader from "@/components/Uploader/index.vue"; | ||
| 9 | +import type { ElForm } from "element-plus"; | ||
| 10 | +const { | ||
| 11 | + appContext: { | ||
| 12 | + config: { globalProperties }, | ||
| 13 | + }, | ||
| 14 | +} = getCurrentInstance(); | ||
| 15 | +let form = reactive({ | ||
| 16 | + data: { | ||
| 17 | + columnName: "", | ||
| 18 | + columnImg: "", | ||
| 19 | + cmsColumnId: "", | ||
| 20 | + cmsPageId: "", | ||
| 21 | + cmsPageType: "", | ||
| 22 | + parentColumnId: "", | ||
| 23 | + sort: "", | ||
| 24 | + status: "0", | ||
| 25 | + type: "", | ||
| 26 | + parentColumnId: "", | ||
| 27 | + }, | ||
| 28 | + loading: false, | ||
| 29 | + dataType: "", | ||
| 30 | +}); | ||
| 31 | +const ruleFormRef = ref<InstanceType<typeof ElForm>>(); | ||
| 32 | +/** | ||
| 33 | + * 表单验证规则 | ||
| 34 | + */ | ||
| 35 | +const rules = reactive({ | ||
| 36 | + columnName: [ | ||
| 37 | + { | ||
| 38 | + required: true, | ||
| 39 | + message: "请填写栏目名称", | ||
| 40 | + trigger: "blur", | ||
| 41 | + }, | ||
| 42 | + ], | ||
| 43 | +}); | ||
| 44 | +/** | ||
| 45 | + * 表单重置 | ||
| 46 | + */ | ||
| 47 | +const resetForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | ||
| 48 | + if (!formEl) return; | ||
| 49 | + form.data.status = "0"; | ||
| 50 | + formEl.resetFields(); | ||
| 51 | +}; | ||
| 52 | +/** | ||
| 53 | + * 表单提交 | ||
| 54 | + */ | ||
| 55 | +const submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | ||
| 56 | + form.loading = true; | ||
| 57 | + if (!formEl) return; | ||
| 58 | + formEl.validate(async (valid) => { | ||
| 59 | + if (valid) { | ||
| 60 | + let res: any; | ||
| 61 | + try { | ||
| 62 | + if (["add", "subColumn"].includes(form.dataType)) { | ||
| 63 | + res = await columnAdd(form.data); | ||
| 64 | + } else if (form.dataType === "edit") { | ||
| 65 | + res = await columnEdit(form.data); | ||
| 66 | + } | ||
| 67 | + } catch (e) { | ||
| 68 | + console.log(e); | ||
| 69 | + } finally { | ||
| 70 | + if (res?.data) { | ||
| 71 | + globalProperties.$message.success("操作成功"); | ||
| 72 | + history.go(-1); | ||
| 73 | + } | ||
| 74 | + form.loading = false; | ||
| 75 | + } | ||
| 76 | + } else { | ||
| 77 | + globalProperties.$message.error("请检查表单格式"); | ||
| 78 | + form.loading = false; | ||
| 79 | + return false; | ||
| 80 | + } | ||
| 81 | + }); | ||
| 82 | +}; | ||
| 83 | +/** | ||
| 84 | + * 图片上传组件回调 | ||
| 85 | + * @param {string} url 回调的图片url | ||
| 86 | + * @param {string} tagName 标签 | ||
| 87 | + */ | ||
| 88 | +const handleImageChange = (url: string, tagName: string) => { | ||
| 89 | + form.data[tagName] = url; | ||
| 90 | +}; | ||
| 91 | +onMounted(() => { | ||
| 92 | + form.dataType = useRoute().query.dataType; | ||
| 93 | + switch (form.dataType) { | ||
| 94 | + case "edit": | ||
| 95 | + form.data = useRoute().query; | ||
| 96 | + break; | ||
| 97 | + case "subColumn": | ||
| 98 | + form.data.parentColumnId = useRoute().query.parentColumnId; | ||
| 99 | + break; | ||
| 100 | + } | ||
| 101 | +}); | ||
| 102 | +</script> | ||
| 103 | + | ||
| 104 | +<template> | ||
| 105 | + <div class="page-container"> | ||
| 106 | + <el-card class="form_card" style="max-width: 1303px"> | ||
| 107 | + <h1 v-show="form.dataType === 'add'">新增栏目</h1> | ||
| 108 | + <h1 v-show="form.dataType === 'edit'">编辑栏目</h1> | ||
| 109 | + <h1 v-show="form.dataType === 'subColumn'">新增子栏目</h1> | ||
| 110 | + <el-form | ||
| 111 | + :inline="true" | ||
| 112 | + :model="form.data" | ||
| 113 | + :rules="rules" | ||
| 114 | + ref="ruleFormRef" | ||
| 115 | + label-width="120px" | ||
| 116 | + class="card-form" | ||
| 117 | + > | ||
| 118 | + <el-form-item label="栏目名称" prop="columnName" style="width: 100%"> | ||
| 119 | + <el-input | ||
| 120 | + v-model.trim="form.data.columnName" | ||
| 121 | + placeholder="请填写栏目名称" | ||
| 122 | + maxlength="15" | ||
| 123 | + /> | ||
| 124 | + </el-form-item> | ||
| 125 | + <!-- 仅一级栏目有type选择 --> | ||
| 126 | + <el-form-item | ||
| 127 | + label="栏目类型" | ||
| 128 | + prop="type" | ||
| 129 | + style="width: 50%" | ||
| 130 | + v-show="!form.data.parentColumnId" | ||
| 131 | + > | ||
| 132 | + <el-select v-model="form.data.type" placeholder="请选择栏目类型"> | ||
| 133 | + <el-option | ||
| 134 | + v-for="(item, index) in types" | ||
| 135 | + :key="index" | ||
| 136 | + :label="item.label" | ||
| 137 | + :value="item.value" | ||
| 138 | + ></el-option> | ||
| 139 | + </el-select> | ||
| 140 | + </el-form-item> | ||
| 141 | + <el-form-item label="状态" prop="status" style="width: 50%"> | ||
| 142 | + <el-radio-group v-model="form.data.status"> | ||
| 143 | + <el-radio label="1">显示</el-radio> | ||
| 144 | + <el-radio label="0">隐藏</el-radio> | ||
| 145 | + </el-radio-group> | ||
| 146 | + </el-form-item> | ||
| 147 | + <el-form-item label="缩略图" prop="columnImg" style="width: 100%"> | ||
| 148 | + <Uploader | ||
| 149 | + :defaultUrl="{ value: form.data.columnImg }" | ||
| 150 | + tagName="columnImg" | ||
| 151 | + @imageChange="handleImageChange" | ||
| 152 | + ></Uploader> | ||
| 153 | + </el-form-item> | ||
| 154 | + <el-form-item label="排序" prop="sort" style="width: 50%"> | ||
| 155 | + <el-input | ||
| 156 | + v-model.trim="form.data.sort" | ||
| 157 | + placeholder="请填写排序值" | ||
| 158 | + maxlength="15" | ||
| 159 | + /> | ||
| 160 | + <span class="tip">注意:排序值越大栏目越靠前</span> | ||
| 161 | + </el-form-item> | ||
| 162 | + <el-form-item label="CMS页面类型" prop="cmsPageType" style="width: 50%"> | ||
| 163 | + <el-input | ||
| 164 | + v-model.trim="form.data.cmsPageType" | ||
| 165 | + placeholder="请填写CMS页面类型" | ||
| 166 | + maxlength="15" | ||
| 167 | + /> | ||
| 168 | + <span class="tip">注意:请填写数字</span> | ||
| 169 | + </el-form-item> | ||
| 170 | + <el-form-item label="CMS栏目ID" prop="cmsColumnId" style="width: 50%"> | ||
| 171 | + <el-input | ||
| 172 | + v-model.trim="form.data.cmsColumnId" | ||
| 173 | + placeholder="请填写CMS栏目ID" | ||
| 174 | + maxlength="15" | ||
| 175 | + /> | ||
| 176 | + </el-form-item> | ||
| 177 | + <el-form-item label="CMS页面ID" prop="cmsPageId" style="width: 50%"> | ||
| 178 | + <el-input | ||
| 179 | + v-model.trim="form.data.cmsPageId" | ||
| 180 | + placeholder="请填写CMS页面ID" | ||
| 181 | + maxlength="15" | ||
| 182 | + /> | ||
| 183 | + </el-form-item> | ||
| 184 | + <el-form-item style="width: 100%"> | ||
| 185 | + <el-button | ||
| 186 | + type="primary" | ||
| 187 | + @click="submitForm(ruleFormRef)" | ||
| 188 | + :loading="form.loading" | ||
| 189 | + >提交</el-button | ||
| 190 | + > | ||
| 191 | + <el-button | ||
| 192 | + type="info" | ||
| 193 | + @click="resetForm(ruleFormRef)" | ||
| 194 | + v-show="form.dataType === 'add'" | ||
| 195 | + >取消</el-button | ||
| 196 | + > | ||
| 197 | + <el-button type="info" @click="back">返回</el-button> | ||
| 198 | + </el-form-item> | ||
| 199 | + </el-form> | ||
| 200 | + </el-card> | ||
| 201 | + </div> | ||
| 202 | +</template> |
src/views/column/index.vue
| 1 | -<template>栏目列表</template> | ||
| 2 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +<script setup lang="ts"> | ||
| 3 | +import { reactive, ref, onMounted, getCurrentInstance } from "vue"; | ||
| 4 | +import { columnList, columnStatus, columnSort } from "@/api/property/column"; | ||
| 5 | +import Pagination from "@/components/Pagination/index.vue"; | ||
| 6 | +import { ElMessageBox } from "element-plus"; | ||
| 7 | +import { types } from "./config"; | ||
| 8 | +import { globalFilters } from "@/utils/tool"; | ||
| 9 | +interface Form { | ||
| 10 | + page: number; | ||
| 11 | + pageSize: number; | ||
| 12 | +} | ||
| 13 | +interface Params { | ||
| 14 | + total: number; | ||
| 15 | + query: Form; | ||
| 16 | +} | ||
| 17 | +interface Data { | ||
| 18 | + loading: boolean; | ||
| 19 | + list: any[]; | ||
| 20 | + types: any[]; | ||
| 21 | + params: Params; | ||
| 22 | +} | ||
| 23 | +let instance: ComponentInternalInstance | null = getCurrentInstance(); | ||
| 24 | +let data: Data = reactive({ | ||
| 25 | + list: [], | ||
| 26 | + types: types, | ||
| 27 | + loading: false, | ||
| 28 | + params: { | ||
| 29 | + total: 0, | ||
| 30 | + query: { | ||
| 31 | + page: 1, | ||
| 32 | + pageSize: 10, | ||
| 33 | + }, | ||
| 34 | + }, | ||
| 35 | +}); | ||
| 36 | +/** | ||
| 37 | + * 列表 | ||
| 38 | + */ | ||
| 39 | +const getList = async () => { | ||
| 40 | + data.loading = true; | ||
| 41 | + try { | ||
| 42 | + const res = await columnList(data.params.query); | ||
| 43 | + data.list = res?.data?.data?.list; | ||
| 44 | + data.params.total = res?.data?.data?.total; | ||
| 45 | + } catch (e) { | ||
| 46 | + console.log(e); | ||
| 47 | + } finally { | ||
| 48 | + data.loading = false; | ||
| 49 | + } | ||
| 50 | +}; | ||
| 51 | +/** | ||
| 52 | + * 修改 | ||
| 53 | + * @param {object} obj 要操作的数据对象 | ||
| 54 | + * @param {string} type 操作类型 => 排序sort 修改状态status 删除delete | ||
| 55 | + */ | ||
| 56 | +const handleUpdate = async (obj: any, type: string) => { | ||
| 57 | + let res: any; | ||
| 58 | + try { | ||
| 59 | + switch (type) { | ||
| 60 | + case "delete": | ||
| 61 | + return ElMessageBox.confirm("确认删除吗?", "警告", { | ||
| 62 | + confirmButtonText: "确认", | ||
| 63 | + cancelButtonText: "取消", | ||
| 64 | + type: "warning", | ||
| 65 | + }) | ||
| 66 | + .then(async () => { | ||
| 67 | + res = await columnStatus({ id: obj.id, status: 2 }); | ||
| 68 | + if (res?.data) { | ||
| 69 | + instance?.proxy?.$message.success("操作成功"); | ||
| 70 | + getList(); | ||
| 71 | + } else { | ||
| 72 | + instance?.proxy?.$message.error("操作失败"); | ||
| 73 | + } | ||
| 74 | + }) | ||
| 75 | + .catch((error) => { | ||
| 76 | + console.log("取消"); | ||
| 77 | + }); | ||
| 78 | + break; | ||
| 79 | + case "sort": | ||
| 80 | + res = await columnSort({ id: obj.id, sort: obj.sort }); | ||
| 81 | + break; | ||
| 82 | + case "status": | ||
| 83 | + res = await columnStatus({ | ||
| 84 | + id: obj.id, | ||
| 85 | + status: obj.status ? 0 : 1, | ||
| 86 | + }); | ||
| 87 | + break; | ||
| 88 | + } | ||
| 89 | + if (res?.data) { | ||
| 90 | + instance?.proxy?.$message.success("操作成功"); | ||
| 91 | + getList(); | ||
| 92 | + } else { | ||
| 93 | + instance?.proxy?.$message.error("操作失败"); | ||
| 94 | + } | ||
| 95 | + } catch (e) { | ||
| 96 | + console.log(e); | ||
| 97 | + } | ||
| 98 | +}; | ||
| 99 | +/** | ||
| 100 | + * 状态值 | ||
| 101 | + * @enum {number} | ||
| 102 | + */ | ||
| 103 | +enum statusEnum { | ||
| 104 | + "隐藏" = 0, | ||
| 105 | + "显示", | ||
| 106 | + "删除", | ||
| 107 | +} | ||
| 108 | +onMounted(() => { | ||
| 109 | + getList(); | ||
| 110 | +}); | ||
| 111 | +</script> | ||
| 112 | + | ||
| 113 | +<template> | ||
| 114 | + <div class="page-container"> | ||
| 115 | + <h1>栏目列表</h1> | ||
| 116 | + <el-row style="padding-bottom: 20px"> | ||
| 117 | + <el-form :inline="true" label-width="70px"> | ||
| 118 | + <el-form-item> | ||
| 119 | + <el-button type="primary" | ||
| 120 | + ><router-link | ||
| 121 | + :to="{ path: '/column/edit', query: { dataType: 'add' } }" | ||
| 122 | + >创建栏目</router-link | ||
| 123 | + ></el-button | ||
| 124 | + > | ||
| 125 | + </el-form-item> | ||
| 126 | + </el-form> | ||
| 127 | + </el-row> | ||
| 128 | + <el-table | ||
| 129 | + :data="data.list" | ||
| 130 | + style="width: 100%" | ||
| 131 | + border | ||
| 132 | + v-loading="data.loading" | ||
| 133 | + row-key="id" | ||
| 134 | + :indent="30" | ||
| 135 | + :tree-props="{ children: 'contentColumnList' }" | ||
| 136 | + align="center" | ||
| 137 | + element-loading-text="拼命加载中" | ||
| 138 | + > | ||
| 139 | + <el-table-column prop="id" label="ID" align="center"></el-table-column> | ||
| 140 | + <el-table-column | ||
| 141 | + prop="columnName" | ||
| 142 | + label="栏目名称" | ||
| 143 | + align="center" | ||
| 144 | + ></el-table-column> | ||
| 145 | + <el-table-column prop="type" label="栏目类型" align="center"> | ||
| 146 | + <template #default="scope"> | ||
| 147 | + {{ | ||
| 148 | + scope.row.type | ||
| 149 | + ? globalFilters(~~scope.row.type, data.types) | ||
| 150 | + : scope.row.type | ||
| 151 | + }} | ||
| 152 | + </template> | ||
| 153 | + </el-table-column> | ||
| 154 | + <el-table-column prop="columnImg" label="缩略图" align="center"> | ||
| 155 | + <template #default="scope"> | ||
| 156 | + <el-image | ||
| 157 | + :src=" | ||
| 158 | + scope.row.columnImg | ||
| 159 | + ? scope.row.columnImg | ||
| 160 | + : instance?.proxy?.$defaultImage | ||
| 161 | + " | ||
| 162 | + fit="contain" | ||
| 163 | + lazy | ||
| 164 | + style="height: 100px" | ||
| 165 | + ></el-image> | ||
| 166 | + </template> | ||
| 167 | + </el-table-column> | ||
| 168 | + <el-table-column prop="sort" label="排序" align="center"> | ||
| 169 | + <template #default="scope"> | ||
| 170 | + <el-input | ||
| 171 | + v-model="scope.row.sort" | ||
| 172 | + placeholder="排序值" | ||
| 173 | + @change="handleUpdate(scope.row, 'sort')" | ||
| 174 | + /> | ||
| 175 | + </template> | ||
| 176 | + </el-table-column> | ||
| 177 | + <el-table-column prop="status" label="状态" align="center"> | ||
| 178 | + <template #default="scope"> | ||
| 179 | + {{ statusEnum[scope.row.status] }} | ||
| 180 | + </template> | ||
| 181 | + </el-table-column> | ||
| 182 | + <el-table-column label="操作" align="center"> | ||
| 183 | + <template #default="scope"> | ||
| 184 | + <el-button type="text"> | ||
| 185 | + <router-link | ||
| 186 | + :to="{ | ||
| 187 | + path: '/column/edit', | ||
| 188 | + query: { ...scope.row, ...{ dataType: 'edit' } }, | ||
| 189 | + }" | ||
| 190 | + >编辑</router-link | ||
| 191 | + > | ||
| 192 | + </el-button> | ||
| 193 | + <el-button type="text" v-show="!scope.row.parentColumnId"> | ||
| 194 | + <!-- 栏目一共可以有两层 --> | ||
| 195 | + <router-link | ||
| 196 | + :to="{ | ||
| 197 | + path: '/column/edit', | ||
| 198 | + query: { dataType: 'subColumn', parentColumnId: scope.row.id }, | ||
| 199 | + }" | ||
| 200 | + >子栏目</router-link | ||
| 201 | + > | ||
| 202 | + </el-button> | ||
| 203 | + <el-button type="text" @click="handleUpdate(scope.row, 'status')">{{ | ||
| 204 | + scope.row.status ? "隐藏" : "显示" | ||
| 205 | + }}</el-button> | ||
| 206 | + <el-button type="text" @click="handleUpdate(scope.row, 'delete')" | ||
| 207 | + >删除</el-button | ||
| 208 | + > | ||
| 209 | + </template> | ||
| 210 | + </el-table-column> | ||
| 211 | + </el-table> | ||
| 212 | + <Pagination | ||
| 213 | + :total="data.params.total" | ||
| 214 | + v-model:currentPage="data.params.query.page" | ||
| 215 | + v-model:pageSize="data.params.query.pageSize" | ||
| 216 | + @pageChange="getList" | ||
| 217 | + ></Pagination> | ||
| 218 | + </div> | ||
| 219 | +</template> |
src/views/property/edit.vue
| @@ -29,6 +29,11 @@ let form = reactive({ | @@ -29,6 +29,11 @@ let form = reactive({ | ||
| 29 | status: 0, | 29 | status: 0, |
| 30 | }, | 30 | }, |
| 31 | }); | 31 | }); |
| 32 | +/** | ||
| 33 | + * 图片上传组件回调 | ||
| 34 | + * @param {string} url 回调的图片url | ||
| 35 | + * @param {string} tagName 标签 | ||
| 36 | + */ | ||
| 32 | const handleImageChange = (url: string, tagName: string) => { | 37 | const handleImageChange = (url: string, tagName: string) => { |
| 33 | form.data[tagName] = url; | 38 | form.data[tagName] = url; |
| 34 | }; | 39 | }; |
src/views/repair/index.vue
| @@ -64,26 +64,6 @@ const getList = async () => { | @@ -64,26 +64,6 @@ const getList = async () => { | ||
| 64 | } | 64 | } |
| 65 | }; | 65 | }; |
| 66 | /** | 66 | /** |
| 67 | - * 状态 | ||
| 68 | - * @param {object} obj 要操作的数据对象 | ||
| 69 | - */ | ||
| 70 | -const handleStatus = async (obj) => { | ||
| 71 | - try { | ||
| 72 | - const res = await roleStatus({ | ||
| 73 | - roleId: obj.id, | ||
| 74 | - status: obj.status ? 0 : 1, | ||
| 75 | - }); | ||
| 76 | - if (res?.data) { | ||
| 77 | - globalProperties.$message.success("操作成功"); | ||
| 78 | - getList(); | ||
| 79 | - } else { | ||
| 80 | - globalProperties.$message.error("操作失败"); | ||
| 81 | - } | ||
| 82 | - } catch (e) { | ||
| 83 | - console.log(e); | ||
| 84 | - } | ||
| 85 | -}; | ||
| 86 | -/** | ||
| 87 | * 时间组件回调 | 67 | * 时间组件回调 |
| 88 | * @param {array} value [开始时间, 结束时间] | 68 | * @param {array} value [开始时间, 结束时间] |
| 89 | */ | 69 | */ |