Commit 4961d0651fdf575b0ab0302a3731c952afdb28db
1 parent
a76c38ed
公告管理 操作日志
Showing
13 changed files
with
543 additions
and
19 deletions
src/api/notify/index.ts
0 → 100644
| 1 | +import request from '../request' | ||
| 2 | +import { deleteEmptyParam } from '@/utils/tool' | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * @description 公告列表 | ||
| 6 | + * @function notifyList | ||
| 7 | + */ | ||
| 8 | +export const notifyList = async ( params: any ) => { | ||
| 9 | + let res: any = await request.get( '/notify/list', deleteEmptyParam(params) ) | ||
| 10 | + return res | ||
| 11 | +} | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * @description 公告详情 | ||
| 15 | + * @function notifyDetail | ||
| 16 | + */ | ||
| 17 | + export const notifyDetail = async ( params: any ) => { | ||
| 18 | + let res: any = await request.get( '/notify/getNotify', {params} ) | ||
| 19 | + return res | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * @description 新增公告 | ||
| 24 | + * @function notifyAdd | ||
| 25 | + */ | ||
| 26 | +export function notifyAdd (data: any) { | ||
| 27 | + return request({ | ||
| 28 | + method: 'post', | ||
| 29 | + url: '/notify/add', | ||
| 30 | + data: data | ||
| 31 | + }) | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +/** | ||
| 35 | + * @description 删除公告 | ||
| 36 | + * @function notifyDelete | ||
| 37 | + */ | ||
| 38 | +export function notifyDelete (params: any) { | ||
| 39 | + return request({ | ||
| 40 | + method: 'delete', | ||
| 41 | + url: '/notify/deleteNotify', | ||
| 42 | + params: params | ||
| 43 | + }) | ||
| 44 | +} | ||
| 0 | \ No newline at end of file | 45 | \ No newline at end of file |
src/api/user/user/index.ts
| 1 | import request from '../../request' | 1 | import request from '../../request' |
| 2 | -import {formDataWrapper} from '@/utils/tool' | 2 | +import { formDataWrapper, deleteEmptyParam } from '@/utils/tool' |
| 3 | 3 | ||
| 4 | /** | 4 | /** |
| 5 | * @description 用户列表 | 5 | * @description 用户列表 |
| @@ -9,7 +9,7 @@ export const userList = async ( params: any ) => { | @@ -9,7 +9,7 @@ export const userList = async ( params: any ) => { | ||
| 9 | let res: any = await request({ | 9 | let res: any = await request({ |
| 10 | url: '/user/list', | 10 | url: '/user/list', |
| 11 | method: 'get', | 11 | method: 'get', |
| 12 | - params: params | 12 | + params: deleteEmptyParam(params) |
| 13 | }) | 13 | }) |
| 14 | return res | 14 | return res |
| 15 | } | 15 | } |
src/layout/header.vue
| @@ -70,11 +70,9 @@ onMounted(() => { | @@ -70,11 +70,9 @@ onMounted(() => { | ||
| 70 | <!-- TIP 控制菜单collapse的按钮结束 --> | 70 | <!-- TIP 控制菜单collapse的按钮结束 --> |
| 71 | <!-- TIP 功能键 --> | 71 | <!-- TIP 功能键 --> |
| 72 | <div class="right-buttons"> | 72 | <div class="right-buttons"> |
| 73 | - <el-button type="text">站内消息</el-button> | ||
| 74 | <el-button type="text"><router-link to="/">首页</router-link></el-button> | 73 | <el-button type="text"><router-link to="/">首页</router-link></el-button> |
| 75 | - <el-button type="text">帮助</el-button> | ||
| 76 | <el-button type="text" | 74 | <el-button type="text" |
| 77 | - >当前用户:<b>{{ asyncData.userInfo }}</b></el-button | 75 | + >当前用户:<b>{{ asyncData.userInfo? asyncData.userInfo: '超级管理员' }}</b></el-button |
| 78 | > | 76 | > |
| 79 | <el-button type="text" @click="handleLogout">退出</el-button> | 77 | <el-button type="text" @click="handleLogout">退出</el-button> |
| 80 | </div> | 78 | </div> |
src/pinia/modules/login.ts
| @@ -3,12 +3,15 @@ import { logout } from '@/api/user/login'; | @@ -3,12 +3,15 @@ import { logout } from '@/api/user/login'; | ||
| 3 | import { ElMessage } from "element-plus"; | 3 | import { ElMessage } from "element-plus"; |
| 4 | interface LoginUser { | 4 | interface LoginUser { |
| 5 | token: string, | 5 | token: string, |
| 6 | - organizationId: number, | ||
| 7 | - id: number, | 6 | + organizationId?: number, |
| 7 | + id?: number, | ||
| 8 | userName: string, | 8 | userName: string, |
| 9 | - organizationType: number | null, | 9 | + organizationType?: number | null, |
| 10 | organizationName: string, | 10 | organizationName: string, |
| 11 | - organizationLogo: string | 11 | + organizationLogo: string, |
| 12 | + oId?: number, | ||
| 13 | + userId?: number, | ||
| 14 | + oType?: number | ||
| 12 | } | 15 | } |
| 13 | const id: string = 'login' | 16 | const id: string = 'login' |
| 14 | const state: Function = () => ({ | 17 | const state: Function = () => ({ |
| @@ -53,11 +56,11 @@ const getters = { | @@ -53,11 +56,11 @@ const getters = { | ||
| 53 | const actions = { | 56 | const actions = { |
| 54 | setUserInfo(obj: LoginUser) { | 57 | setUserInfo(obj: LoginUser) { |
| 55 | this.token = obj.token | 58 | this.token = obj.token |
| 56 | - this.organizationId = obj.organizationId | ||
| 57 | - this.id = obj.id | 59 | + this.organizationId = obj.organizationId? obj.organizationId: obj.oId |
| 60 | + this.id = obj.id? obj.id: obj.userId | ||
| 58 | this.userName = obj.userName | 61 | this.userName = obj.userName |
| 59 | this.organizationName = obj.organizationName | 62 | this.organizationName = obj.organizationName |
| 60 | - this.organizationType = obj.organizationType | 63 | + this.organizationType = obj.organizationType? obj.organizationType: obj.oType |
| 61 | this.organizationLogo = obj.organizationLogo | 64 | this.organizationLogo = obj.organizationLogo |
| 62 | }, | 65 | }, |
| 63 | removeToken(msg: string | null) { | 66 | removeToken(msg: string | null) { |
src/router/index.ts
| 1 | import { createRouter, createWebHashHistory } from 'vue-router' | 1 | import { createRouter, createWebHashHistory } from 'vue-router' |
| 2 | +import Notify from './modules/notify' | ||
| 2 | import System from './modules/system' | 3 | import System from './modules/system' |
| 3 | import Permission from './modules/permission' | 4 | import Permission from './modules/permission' |
| 4 | import Role from "./modules/role" | 5 | import Role from "./modules/role" |
| @@ -21,6 +22,7 @@ const routes: Array<any> = [ | @@ -21,6 +22,7 @@ const routes: Array<any> = [ | ||
| 21 | meta: { title: '欢迎访问' } | 22 | meta: { title: '欢迎访问' } |
| 22 | }] | 23 | }] |
| 23 | }, | 24 | }, |
| 25 | + Notify, | ||
| 24 | System, | 26 | System, |
| 25 | Permission, | 27 | Permission, |
| 26 | Role, | 28 | Role, |
src/router/modules/notify.ts
0 → 100644
| 1 | +import Layout from '@/layout/enter.vue' | ||
| 2 | +const notify = { | ||
| 3 | + path: '/', | ||
| 4 | + component: Layout, | ||
| 5 | + name: 'Notify', | ||
| 6 | + children: [{ | ||
| 7 | + path: 'notify', | ||
| 8 | + name: 'notify', | ||
| 9 | + component: () => import('@/views/notify/index.vue'), | ||
| 10 | + meta: { title: '公告管理' } | ||
| 11 | + }, { | ||
| 12 | + path: '/notify/edit', | ||
| 13 | + name: 'notifyEdit', | ||
| 14 | + component: () => import('@/views/notify/edit.vue'), | ||
| 15 | + meta: { title: '公告编辑' } | ||
| 16 | + }] | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +export default notify |
src/views/dashboard/index.vue
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | import {ref} from 'vue' | 2 | import {ref} from 'vue' |
| 3 | import {propertyList } from '@/api/property' | 3 | import {propertyList } from '@/api/property' |
| 4 | import router from '@/router' | 4 | import router from '@/router' |
| 5 | +import * as store from "@/pinia/index"; | ||
| 5 | const title = ref(import.meta.env.VITE_APP_TITLE).value | 6 | const title = ref(import.meta.env.VITE_APP_TITLE).value |
| 6 | // propertyList().then(res => { | 7 | // propertyList().then(res => { |
| 7 | // console.log(res) | 8 | // console.log(res) |
src/views/notify/edit.vue
0 → 100644
| 1 | +<script setup lang="ts"> | ||
| 2 | +import { reactive, ref, getCurrentInstance, onMounted } from "vue"; | ||
| 3 | +import { notifyAdd, notifyDetail } from "@/api/notify"; | ||
| 4 | +import { getTableList } from "@/api/community/residence"; | ||
| 5 | +import { useRoute } from "vue-router"; | ||
| 6 | +import { back } from "@/utils/tool"; | ||
| 7 | +import * as store from "@/pinia/index"; | ||
| 8 | +import type { ElForm } from "element-plus"; | ||
| 9 | +let form = reactive({ | ||
| 10 | + data: { | ||
| 11 | + title: "", | ||
| 12 | + status: "0", | ||
| 13 | + oId: store?.family?.loginStore()?.organizationId, | ||
| 14 | + neighborHoodId: null, | ||
| 15 | + neighborHoodName: "", | ||
| 16 | + id: null, | ||
| 17 | + content: "", | ||
| 18 | + buildingIds: "", | ||
| 19 | + }, | ||
| 20 | + dataType: "", | ||
| 21 | + neighborhoods: [], | ||
| 22 | +}); | ||
| 23 | +const ruleFormRef = ref<InstanceType<typeof ElForm>>(); | ||
| 24 | +let instance: ComponentInternalInstance | null = getCurrentInstance(); | ||
| 25 | +/** | ||
| 26 | + * 表单验证规则 | ||
| 27 | + */ | ||
| 28 | +const rules = reactive({ | ||
| 29 | + title: [ | ||
| 30 | + { | ||
| 31 | + required: true, | ||
| 32 | + message: "请填写公告标题", | ||
| 33 | + trigger: "change", | ||
| 34 | + }, | ||
| 35 | + ], | ||
| 36 | + content: [ | ||
| 37 | + { | ||
| 38 | + required: true, | ||
| 39 | + message: "请填写公告内容", | ||
| 40 | + trigger: "change", | ||
| 41 | + }, | ||
| 42 | + ], | ||
| 43 | + status: [ | ||
| 44 | + { | ||
| 45 | + required: true, | ||
| 46 | + message: "请选择发布类型", | ||
| 47 | + trigger: "change", | ||
| 48 | + }, | ||
| 49 | + ], | ||
| 50 | +}); | ||
| 51 | +/** | ||
| 52 | + * 表单重置 | ||
| 53 | + */ | ||
| 54 | +const resetForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | ||
| 55 | + if (!formEl) return; | ||
| 56 | + formEl.resetFields(); | ||
| 57 | +}; | ||
| 58 | +/** | ||
| 59 | + * 表单提交 | ||
| 60 | + */ | ||
| 61 | +const submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | ||
| 62 | + if (!formEl) return; | ||
| 63 | + formEl.validate(async (valid) => { | ||
| 64 | + if (valid) { | ||
| 65 | + notifyAdd(form.data) | ||
| 66 | + .then((res) => { | ||
| 67 | + if (res) { | ||
| 68 | + instance?.proxy?.$message.success("操作成功"); | ||
| 69 | + history.go(-1); | ||
| 70 | + } | ||
| 71 | + }) | ||
| 72 | + .catch((error) => { | ||
| 73 | + console.log(error); | ||
| 74 | + }); | ||
| 75 | + } else { | ||
| 76 | + instance?.proxy?.$message.error("请检查表单格式"); | ||
| 77 | + return false; | ||
| 78 | + } | ||
| 79 | + }); | ||
| 80 | +}; | ||
| 81 | +/** | ||
| 82 | + * 选小区,给小区名赋值 | ||
| 83 | + * @param {number | null} data 选中的小区id | ||
| 84 | + */ | ||
| 85 | +const handleNeighborhoodChange = async (data: number | null) => { | ||
| 86 | + form.data.neighborHoodName = form.neighborhoods.find((i) => i.id === data)[ | ||
| 87 | + "name" | ||
| 88 | + ]; | ||
| 89 | +}; | ||
| 90 | +/** | ||
| 91 | + * 小区列表 | ||
| 92 | + * @param {number | null} pageSize 一次请求多少条数据 | ||
| 93 | + */ | ||
| 94 | +const getNeighborhoods = async (pageSize: number = 20) => { | ||
| 95 | + try { | ||
| 96 | + const res = await getTableList({ | ||
| 97 | + page: 1, | ||
| 98 | + type: 0, | ||
| 99 | + pageSize: pageSize, | ||
| 100 | + }); | ||
| 101 | + form.neighborhoods = res?.data?.data?.list; | ||
| 102 | + if (res?.data?.data?.total > pageSize) { | ||
| 103 | + getNeighborhoods(res?.data?.data?.total); | ||
| 104 | + } | ||
| 105 | + } catch (e) { | ||
| 106 | + console.log(e); | ||
| 107 | + } | ||
| 108 | +}; | ||
| 109 | +onMounted(() => { | ||
| 110 | + getNeighborhoods(); | ||
| 111 | + if (JSON.stringify(useRoute().query) === "{}") { | ||
| 112 | + form.dataType = "add"; | ||
| 113 | + } else { | ||
| 114 | + form.dataType = useRoute().query.dataType; | ||
| 115 | + form.data = useRoute().query; | ||
| 116 | + form.data.neighborHoodId = ~~useRoute().query.neighborHoodId; | ||
| 117 | + } | ||
| 118 | +}); | ||
| 119 | +</script> | ||
| 120 | + | ||
| 121 | +<template> | ||
| 122 | + <div class="page-container"> | ||
| 123 | + <el-card class="form_card" style="max-width: 1303px"> | ||
| 124 | + <h1 v-show="form.dataType === 'add'">新增公告</h1> | ||
| 125 | + <h1 v-show="form.dataType === 'edit'">编辑公告</h1> | ||
| 126 | + <h1 v-show="form.dataType === 'detail'">公告详情</h1> | ||
| 127 | + <el-form | ||
| 128 | + :inline="true" | ||
| 129 | + :model="form.data" | ||
| 130 | + :rules="rules" | ||
| 131 | + ref="ruleFormRef" | ||
| 132 | + label-width="120px" | ||
| 133 | + class="card-form" | ||
| 134 | + :disabled="form.dataType === 'detail'" | ||
| 135 | + > | ||
| 136 | + <el-form-item label="小区" prop="neighborHoodId" style="width: 100%"> | ||
| 137 | + <el-select | ||
| 138 | + v-model="form.data.neighborHoodId" | ||
| 139 | + placeholder="请选择小区" | ||
| 140 | + @change="handleNeighborhoodChange" | ||
| 141 | + > | ||
| 142 | + <el-option | ||
| 143 | + :label="item.name" | ||
| 144 | + :value="item.id" | ||
| 145 | + v-for="(item, index) in form.neighborhoods" | ||
| 146 | + :key="index" | ||
| 147 | + ></el-option> | ||
| 148 | + </el-select> | ||
| 149 | + </el-form-item> | ||
| 150 | + <el-form-item label="公告标题" prop="title" style="width: 100%"> | ||
| 151 | + <el-input | ||
| 152 | + v-model.trim="form.data.title" | ||
| 153 | + placeholder="请填写公告标题" | ||
| 154 | + maxlength="32" | ||
| 155 | + /> | ||
| 156 | + </el-form-item> | ||
| 157 | + <el-form-item label="公告内容" prop="content" style="width: 100%"> | ||
| 158 | + <el-input | ||
| 159 | + type="textarea" | ||
| 160 | + v-model.trim="form.data.content" | ||
| 161 | + placeholder="富文本组件整理中,后续会替换,先用文本框走流程" | ||
| 162 | + maxlength="1500" | ||
| 163 | + show-word-limit | ||
| 164 | + /> | ||
| 165 | + </el-form-item> | ||
| 166 | + <el-form-item label="发布类型" prop="status" style="width: 100%"> | ||
| 167 | + <el-radio-group v-model="form.data.status"> | ||
| 168 | + <el-radio label="0">存草稿</el-radio> | ||
| 169 | + <el-radio label="1">发布</el-radio> | ||
| 170 | + </el-radio-group> | ||
| 171 | + </el-form-item> | ||
| 172 | + <el-form-item style="width: 100%" v-show="form.dataType !== 'detail'"> | ||
| 173 | + <el-button type="primary" @click="submitForm(ruleFormRef)" | ||
| 174 | + >提交</el-button | ||
| 175 | + > | ||
| 176 | + <el-button | ||
| 177 | + type="info" | ||
| 178 | + @click="resetForm(ruleFormRef)" | ||
| 179 | + v-show="form.dataType === 'add'" | ||
| 180 | + >取消</el-button | ||
| 181 | + > | ||
| 182 | + <el-button type="info" @click="back">返回</el-button> | ||
| 183 | + </el-form-item> | ||
| 184 | + </el-form> | ||
| 185 | + <!-- 查看详情时表单不能编辑,禁用表单会把按钮也禁用掉,所以单列出来一个返回按钮 --> | ||
| 186 | + <el-button type="info" @click="back" v-if="form.dataType === 'detail'" | ||
| 187 | + >返回</el-button | ||
| 188 | + > | ||
| 189 | + </el-card> | ||
| 190 | + </div> | ||
| 191 | +</template> |
src/views/notify/index.vue
0 → 100644
| 1 | +<script setup lang="ts"> | ||
| 2 | +import { reactive, ref, onMounted } from "vue"; | ||
| 3 | +import { notifyList, notifyDelete } from "@/api/notify"; | ||
| 4 | +import { parseTime } from "@/utils/tool"; | ||
| 5 | +import Pagination from "@/components/Pagination/index.vue"; | ||
| 6 | +import { ElMessageBox, ElMessage } from "element-plus"; | ||
| 7 | +import type { ElTable } from "element-plus"; | ||
| 8 | +interface Form { | ||
| 9 | + page: number; | ||
| 10 | + pageSize: number; | ||
| 11 | + startTime: string; | ||
| 12 | + endTime: string; | ||
| 13 | +} | ||
| 14 | +interface Params { | ||
| 15 | + total: number; | ||
| 16 | + query: Form; | ||
| 17 | +} | ||
| 18 | +interface Data { | ||
| 19 | + loading: boolean; | ||
| 20 | + list: any[] | null; | ||
| 21 | + params: Params; | ||
| 22 | +} | ||
| 23 | +const multipleTableRef = ref<InstanceType<typeof ElTable>>(); | ||
| 24 | +let multipleSelection = ref<any[]>([]); | ||
| 25 | +const value1 = ref([]); | ||
| 26 | +let data = reactive({ | ||
| 27 | + list: [], | ||
| 28 | + loading: false, | ||
| 29 | + params: { | ||
| 30 | + total: 0, | ||
| 31 | + query: { | ||
| 32 | + page: 1, | ||
| 33 | + pageSize: 10, | ||
| 34 | + startTime: "", | ||
| 35 | + endTime: "", | ||
| 36 | + }, | ||
| 37 | + }, | ||
| 38 | +}); | ||
| 39 | +/** | ||
| 40 | + * 状态值 | ||
| 41 | + * @enum {number} | ||
| 42 | + */ | ||
| 43 | +enum statusEnum { | ||
| 44 | + "草稿" = 0, | ||
| 45 | + "已发布", | ||
| 46 | +} | ||
| 47 | +/** | ||
| 48 | + * 列表 | ||
| 49 | + */ | ||
| 50 | +const getList = async () => { | ||
| 51 | + data.loading = true; | ||
| 52 | + try { | ||
| 53 | + const res = await notifyList(data.params.query); | ||
| 54 | + data.list = res?.data?.data?.list; | ||
| 55 | + data.params.total = res?.data?.data?.total; | ||
| 56 | + } catch (e) { | ||
| 57 | + console.log(e); | ||
| 58 | + } finally { | ||
| 59 | + data.loading = false; | ||
| 60 | + } | ||
| 61 | +}; | ||
| 62 | +/** | ||
| 63 | + * 分页回调 | ||
| 64 | + * @param {number} page 当前页码 | ||
| 65 | + * @param {number} size 每页内容条数 | ||
| 66 | + */ | ||
| 67 | +const handlePageChange = (page, size) => { | ||
| 68 | + data.params.query.page = page; | ||
| 69 | + data.params.query.pageSize = size; | ||
| 70 | + getList(); | ||
| 71 | +}; | ||
| 72 | +/** | ||
| 73 | + * 查询 | ||
| 74 | + */ | ||
| 75 | +const handleSearch = () => { | ||
| 76 | + getList(); | ||
| 77 | +}; | ||
| 78 | +/** | ||
| 79 | + * 表格选中响应 | ||
| 80 | + * @param {array} data 选中的一条数据 | ||
| 81 | + */ | ||
| 82 | +const handleSelectionChange = (data: array) => { | ||
| 83 | + multipleSelection.value = data; | ||
| 84 | +}; | ||
| 85 | +/** | ||
| 86 | + * 时间组件回调 | ||
| 87 | + * @param {array} value [开始时间, 结束时间] | ||
| 88 | + */ | ||
| 89 | +const handleTimeChange = (value: array) => { | ||
| 90 | + console.log(value); | ||
| 91 | + data.params.query.startTime = value ? value[0] : ""; | ||
| 92 | + data.params.query.endTime = value ? value[1] : ""; | ||
| 93 | + getList(); | ||
| 94 | +}; | ||
| 95 | +/** | ||
| 96 | + * 删除 | ||
| 97 | + * @param {object} obj 要删除的数据对象 | ||
| 98 | + */ | ||
| 99 | +const handleDelete = (obj: any) => { | ||
| 100 | + ElMessageBox.confirm("确认删除吗?", "警告", { | ||
| 101 | + confirmButtonText: "确认", | ||
| 102 | + cancelButtonText: "取消", | ||
| 103 | + type: "warning", | ||
| 104 | + }) | ||
| 105 | + .then(async () => { | ||
| 106 | + try { | ||
| 107 | + let res = await notifyDelete({ | ||
| 108 | + ids: obj.id, | ||
| 109 | + }); | ||
| 110 | + if (res?.data) { | ||
| 111 | + ElMessage({ | ||
| 112 | + type: "success", | ||
| 113 | + message: "操作成功", | ||
| 114 | + }); | ||
| 115 | + getList(); | ||
| 116 | + } else { | ||
| 117 | + ElMessage({ | ||
| 118 | + type: "error", | ||
| 119 | + message: "操作失败", | ||
| 120 | + }); | ||
| 121 | + } | ||
| 122 | + } catch (e) { | ||
| 123 | + console.log(e); | ||
| 124 | + } | ||
| 125 | + }) | ||
| 126 | + .catch(() => { | ||
| 127 | + console.log("取消"); | ||
| 128 | + }); | ||
| 129 | +}; | ||
| 130 | +onMounted(() => { | ||
| 131 | + getList(); | ||
| 132 | +}); | ||
| 133 | +</script> | ||
| 134 | + | ||
| 135 | +<template> | ||
| 136 | + <div class="page-container"> | ||
| 137 | + <h1>公告列表</h1> | ||
| 138 | + <el-row style="padding-bottom: 20px"> | ||
| 139 | + <el-form :inline="true" label-width="70px"> | ||
| 140 | + <el-form-item label="时间"> | ||
| 141 | + <el-date-picker | ||
| 142 | + v-model="value1" | ||
| 143 | + type="datetimerange" | ||
| 144 | + range-separator="至" | ||
| 145 | + format="YYYY-MM-DD HH:mm:ss" | ||
| 146 | + value-format="YYYY-MM-DD HH:mm:ss" | ||
| 147 | + start-placeholder="开始时间" | ||
| 148 | + end-placeholder="结束时间" | ||
| 149 | + @change="handleTimeChange" | ||
| 150 | + > | ||
| 151 | + </el-date-picker> | ||
| 152 | + </el-form-item> | ||
| 153 | + <el-form-item> | ||
| 154 | + <el-button type="primary" @click="handleSearch">查询</el-button> | ||
| 155 | + <el-button type="primary"> | ||
| 156 | + <router-link to="/notify/edit">添加公告</router-link> | ||
| 157 | + </el-button> | ||
| 158 | + <el-button | ||
| 159 | + type="danger" | ||
| 160 | + @click=" | ||
| 161 | + handleDelete({ id: multipleSelection.map((i) => i.id).join(',') }) | ||
| 162 | + " | ||
| 163 | + :disabled="!multipleSelection.length" | ||
| 164 | + >批量删除</el-button | ||
| 165 | + > | ||
| 166 | + </el-form-item> | ||
| 167 | + </el-form> | ||
| 168 | + </el-row> | ||
| 169 | + <el-table | ||
| 170 | + :data="data.list" | ||
| 171 | + style="width: 100%" | ||
| 172 | + border | ||
| 173 | + v-loading="data.loading" | ||
| 174 | + align="center" | ||
| 175 | + element-loading-text="拼命加载中" | ||
| 176 | + ref="multipleTableRef" | ||
| 177 | + @selection-change="handleSelectionChange" | ||
| 178 | + > | ||
| 179 | + <el-table-column type="selection" align="center" /> | ||
| 180 | + <el-table-column prop="id" label="ID" align="center"></el-table-column> | ||
| 181 | + <el-table-column | ||
| 182 | + prop="title" | ||
| 183 | + label="标题" | ||
| 184 | + align="center" | ||
| 185 | + ></el-table-column> | ||
| 186 | + <el-table-column | ||
| 187 | + prop="content" | ||
| 188 | + label="内容" | ||
| 189 | + align="center" | ||
| 190 | + ></el-table-column> | ||
| 191 | + <el-table-column | ||
| 192 | + prop="neighborHoodName" | ||
| 193 | + label="小区" | ||
| 194 | + align="center" | ||
| 195 | + ></el-table-column> | ||
| 196 | + <el-table-column prop="status" label="状态" align="center"> | ||
| 197 | + <template #default="scope"> | ||
| 198 | + {{ statusEnum[scope.row.status] }} | ||
| 199 | + </template> | ||
| 200 | + </el-table-column> | ||
| 201 | + <el-table-column prop="createTime" label="发布时间" align="center"> | ||
| 202 | + <template #default="scope"> | ||
| 203 | + {{ parseTime(new Date(scope.row.createTime).getTime()) }} | ||
| 204 | + </template> | ||
| 205 | + </el-table-column> | ||
| 206 | + <el-table-column label="操作" align="center"> | ||
| 207 | + <template #default="scope"> | ||
| 208 | + <el-button type="text" | ||
| 209 | + ><router-link | ||
| 210 | + :to="{ | ||
| 211 | + path: '/notify/edit', | ||
| 212 | + query: { ...scope.row, ...{ dataType: 'edit' } }, | ||
| 213 | + }" | ||
| 214 | + >编辑</router-link | ||
| 215 | + ></el-button | ||
| 216 | + > | ||
| 217 | + <el-button type="text" | ||
| 218 | + ><router-link | ||
| 219 | + :to="{ | ||
| 220 | + path: '/notify/edit', | ||
| 221 | + query: { ...scope.row, ...{ dataType: 'detail' } }, | ||
| 222 | + }" | ||
| 223 | + >详情</router-link | ||
| 224 | + ></el-button | ||
| 225 | + > | ||
| 226 | + <el-button type="text" @click="handleDelete(scope.row)" | ||
| 227 | + >删除</el-button | ||
| 228 | + > | ||
| 229 | + </template> | ||
| 230 | + </el-table-column> | ||
| 231 | + </el-table> | ||
| 232 | + <Pagination | ||
| 233 | + :total="data.params.total" | ||
| 234 | + :currentPage="data.params.query.page" | ||
| 235 | + :pageSize="data.params.query.pageSize" | ||
| 236 | + @pageChange="handlePageChange" | ||
| 237 | + ></Pagination> | ||
| 238 | + </div> | ||
| 239 | +</template> |
src/views/property/edit.vue
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | import { reactive, ref, getCurrentInstance, onMounted } from "vue"; | 2 | import { reactive, ref, getCurrentInstance, onMounted } from "vue"; |
| 3 | import { propertyAdd } from "@/api/property"; | 3 | import { propertyAdd } from "@/api/property"; |
| 4 | import { useRoute } from "vue-router"; | 4 | import { useRoute } from "vue-router"; |
| 5 | +import { back } from '@/utils/tool'; | ||
| 5 | import { validMobile } from "@/utils/validate"; | 6 | import { validMobile } from "@/utils/validate"; |
| 6 | import type { ElForm } from "element-plus"; | 7 | import type { ElForm } from "element-plus"; |
| 7 | const { | 8 | const { |
| @@ -233,7 +234,7 @@ onMounted(() => { | @@ -233,7 +234,7 @@ onMounted(() => { | ||
| 233 | /> | 234 | /> |
| 234 | </el-form-item> | 235 | </el-form-item> |
| 235 | <el-form-item label="类型" prop="type" style="width: 50%"> | 236 | <el-form-item label="类型" prop="type" style="width: 50%"> |
| 236 | - <el-select v-model="form.data.type"> | 237 | + <el-select v-model="form.data.type" :disabled="form.dataType === 'edit'"> |
| 237 | <el-option label="物业" value="1"></el-option> | 238 | <el-option label="物业" value="1"></el-option> |
| 238 | <el-option label="公益" value="2"></el-option> | 239 | <el-option label="公益" value="2"></el-option> |
| 239 | </el-select> | 240 | </el-select> |
| @@ -245,6 +246,9 @@ onMounted(() => { | @@ -245,6 +246,9 @@ onMounted(() => { | ||
| 245 | <el-button type="info" @click="resetForm(ruleFormRef)" | 246 | <el-button type="info" @click="resetForm(ruleFormRef)" |
| 246 | >取消</el-button | 247 | >取消</el-button |
| 247 | > | 248 | > |
| 249 | + <el-button type="info" @click="back" | ||
| 250 | + >返回</el-button | ||
| 251 | + > | ||
| 248 | </el-form-item> | 252 | </el-form-item> |
| 249 | </el-form> | 253 | </el-form> |
| 250 | </el-card> | 254 | </el-card> |
src/views/property/index.vue
| @@ -2,6 +2,8 @@ | @@ -2,6 +2,8 @@ | ||
| 2 | import { reactive, ref, onMounted, getCurrentInstance } from "vue"; | 2 | import { reactive, ref, onMounted, getCurrentInstance } from "vue"; |
| 3 | import { propertyList, propertyStatus } from "@/api/property"; | 3 | import { propertyList, propertyStatus } from "@/api/property"; |
| 4 | import { userProxy } from '@/api/user/user'; | 4 | import { userProxy } from '@/api/user/user'; |
| 5 | +import { menuData } from "@/api/user/login"; | ||
| 6 | +import * as store from "@/pinia/index"; | ||
| 5 | import { parseTime } from "@/utils/tool"; | 7 | import { parseTime } from "@/utils/tool"; |
| 6 | import Pagination from "@/components/Pagination/index.vue"; | 8 | import Pagination from "@/components/Pagination/index.vue"; |
| 7 | const { | 9 | const { |
| @@ -91,16 +93,33 @@ const handleStatus = async (obj) => { | @@ -91,16 +93,33 @@ const handleStatus = async (obj) => { | ||
| 91 | const handleProxy = (obj) => { | 93 | const handleProxy = (obj) => { |
| 92 | userProxy({oId: obj.id}).then(res => { | 94 | userProxy({oId: obj.id}).then(res => { |
| 93 | if(res?.data) { | 95 | if(res?.data) { |
| 96 | + console.log('代理成功的回调') | ||
| 97 | + console.log(res.data) | ||
| 94 | globalProperties.$message.success("代理成功"); | 98 | globalProperties.$message.success("代理成功"); |
| 95 | - setTimeout(() => { | ||
| 96 | - location.href = '/' | ||
| 97 | - }, 500) | 99 | + getMenu().then(() => { |
| 100 | + console.log('got menu data') | ||
| 101 | + setTimeout(() => { | ||
| 102 | + location.href = '/' | ||
| 103 | + console.log('跳') | ||
| 104 | + }, 2000) | ||
| 105 | + }) | ||
| 98 | } else { | 106 | } else { |
| 99 | globalProperties.$message.error("代理失败"); | 107 | globalProperties.$message.error("代理失败"); |
| 100 | } | 108 | } |
| 101 | }) | 109 | }) |
| 102 | } | 110 | } |
| 103 | /** | 111 | /** |
| 112 | + * 获取权限菜单 | ||
| 113 | + */ | ||
| 114 | +const getMenu = async () => { | ||
| 115 | + try { | ||
| 116 | + let res = await menuData(); | ||
| 117 | + store.family.menuStore().setMenuList(res?.data?.data); | ||
| 118 | + } catch (e) { | ||
| 119 | + console.log(e); | ||
| 120 | + } | ||
| 121 | +}; | ||
| 122 | +/** | ||
| 104 | * 状态值 | 123 | * 状态值 |
| 105 | * @enum {number} | 124 | * @enum {number} |
| 106 | */ | 125 | */ |
src/views/system/log.vue
| @@ -151,13 +151,16 @@ onMounted(() => { | @@ -151,13 +151,16 @@ onMounted(() => { | ||
| 151 | > | 151 | > |
| 152 | <el-table-column prop="id" label="ID" align="center"> </el-table-column> | 152 | <el-table-column prop="id" label="ID" align="center"> </el-table-column> |
| 153 | <el-table-column prop="ip" label="IP" align="center"> </el-table-column> | 153 | <el-table-column prop="ip" label="IP" align="center"> </el-table-column> |
| 154 | - <el-table-column prop="type" label="类型" align="center"> | ||
| 155 | - </el-table-column> | ||
| 156 | <el-table-column prop="model" label="模块" align="center"> | 154 | <el-table-column prop="model" label="模块" align="center"> |
| 157 | </el-table-column> | 155 | </el-table-column> |
| 156 | + <el-table-column prop="type" label="类型" align="center"> | ||
| 157 | + </el-table-column> | ||
| 158 | <el-table-column prop="themeName" label="内容" align="center"> | 158 | <el-table-column prop="themeName" label="内容" align="center"> |
| 159 | </el-table-column> | 159 | </el-table-column> |
| 160 | <el-table-column prop="time" label="操作时间" align="center"> | 160 | <el-table-column prop="time" label="操作时间" align="center"> |
| 161 | + <template #default="scope"> | ||
| 162 | + {{ parseTime(new Date(scope.row.time).getTime()) }} | ||
| 163 | + </template> | ||
| 161 | </el-table-column> | 164 | </el-table-column> |
| 162 | <el-table-column prop="userName" label="操作人" align="center"> | 165 | <el-table-column prop="userName" label="操作人" align="center"> |
| 163 | </el-table-column> | 166 | </el-table-column> |
src/views/user/edit.vue
| @@ -107,7 +107,8 @@ const submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | @@ -107,7 +107,8 @@ const submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | ||
| 107 | password: form.data.password, | 107 | password: form.data.password, |
| 108 | roleIds: form.data.roleIds, | 108 | roleIds: form.data.roleIds, |
| 109 | userId: form.data.id, | 109 | userId: form.data.id, |
| 110 | - userName: form.data.userName | 110 | + userName: form.data.userName, |
| 111 | + neighborhoodIds: form.data.neighborhoodIds | ||
| 111 | }); | 112 | }); |
| 112 | } | 113 | } |
| 113 | } catch (e) { | 114 | } catch (e) { |