Commit 34615b132562dc4a66199ff7e0e2a9f318a6fc9f
1 parent
3be06ee0
debug notify
Showing
5 changed files
with
106 additions
and
64 deletions
src/router/index.ts
| @@ -10,6 +10,11 @@ import OwnerManagement from "./modules/ownerManagement" | @@ -10,6 +10,11 @@ import OwnerManagement from "./modules/ownerManagement" | ||
| 10 | import Housekeeper from "./modules/housekeeper" | 10 | import Housekeeper from "./modules/housekeeper" |
| 11 | import Layout from '@/layout/enter.vue' | 11 | import Layout from '@/layout/enter.vue' |
| 12 | const routes: Array<any> = [ | 12 | const routes: Array<any> = [ |
| 13 | + { | ||
| 14 | + path: '/login', | ||
| 15 | + name: 'Login', | ||
| 16 | + component: () => import(/* webpackChunkName: "About" */ '@/views/user/login.vue') | ||
| 17 | + }, | ||
| 13 | { path: '/', redirect: { path: '/dashboard' } }, | 18 | { path: '/', redirect: { path: '/dashboard' } }, |
| 14 | { | 19 | { |
| 15 | path: '/', | 20 | path: '/', |
| @@ -32,11 +37,6 @@ const routes: Array<any> = [ | @@ -32,11 +37,6 @@ const routes: Array<any> = [ | ||
| 32 | OwnerManagement, | 37 | OwnerManagement, |
| 33 | Housekeeper, | 38 | Housekeeper, |
| 34 | { | 39 | { |
| 35 | - path: '/login', | ||
| 36 | - name: 'Login', | ||
| 37 | - component: () => import(/* webpackChunkName: "About" */ '@/views/user/login.vue') | ||
| 38 | - }, | ||
| 39 | - { | ||
| 40 | path: '/404', | 40 | path: '/404', |
| 41 | name: 'Error', | 41 | name: 'Error', |
| 42 | component: () => import(/* webpackChunkName: "Error" */ '@/views/error/404.vue'), | 42 | component: () => import(/* webpackChunkName: "Error" */ '@/views/error/404.vue'), |
src/views/dashboard/index.vue
| 1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
| 2 | -import {ref} from 'vue' | ||
| 3 | -import {propertyList } from '@/api/property' | ||
| 4 | -import router from '@/router' | 2 | +import { ref } from "vue"; |
| 3 | +import { propertyList } from "@/api/property"; | ||
| 4 | +import router from "@/router"; | ||
| 5 | import * as store from "@/pinia/index"; | 5 | import * as store from "@/pinia/index"; |
| 6 | -const title = ref(import.meta.env.VITE_APP_TITLE).value | ||
| 7 | -// propertyList().then(res => { | ||
| 8 | -// console.log(res) | ||
| 9 | -// }).catch(error => { | ||
| 10 | -// console.log(error) | ||
| 11 | -// }) | ||
| 12 | -console.log(router.getRoutes()) | 6 | +const title = ref(import.meta.env.VITE_APP_TITLE).value; |
| 7 | +propertyList() | ||
| 8 | + .then((res) => { | ||
| 9 | + console.log(res); | ||
| 10 | + }) | ||
| 11 | + .catch((error) => { | ||
| 12 | + console.log(error); | ||
| 13 | + }); | ||
| 14 | +console.log(router.getRoutes()); | ||
| 13 | </script> | 15 | </script> |
| 14 | 16 | ||
| 15 | <template> | 17 | <template> |
| 16 | <div class="dashboard-container"> | 18 | <div class="dashboard-container"> |
| 17 | <div class="dashboard-logo"></div> | 19 | <div class="dashboard-logo"></div> |
| 18 | - <h1>欢迎访问 -- {{title}}</h1> | 20 | + <h1>欢迎访问 -- {{ title }}</h1> |
| 21 | + <!-- {{ store.family }} | ||
| 22 | + {{ store.family.menuStore() }} | ||
| 23 | + {{ store.family.menuStore().menuList }} --> | ||
| 19 | </div> | 24 | </div> |
| 20 | </template> | 25 | </template> |
| 21 | 26 | ||
| @@ -28,11 +33,11 @@ console.log(router.getRoutes()) | @@ -28,11 +33,11 @@ console.log(router.getRoutes()) | ||
| 28 | text-align: center; | 33 | text-align: center; |
| 29 | } | 34 | } |
| 30 | &-logo { | 35 | &-logo { |
| 31 | - width: 200px; | ||
| 32 | - height: 200px; | 36 | + width: 200px; |
| 37 | + height: 200px; | ||
| 33 | margin: 0 auto; | 38 | margin: 0 auto; |
| 34 | - background-color: pink; | ||
| 35 | - background-image: url('@/assets/logo.png'); | 39 | + background-color: pink; |
| 40 | + background-image: url("@/assets/logo.png"); | ||
| 36 | background-repeat: no-repeat; | 41 | background-repeat: no-repeat; |
| 37 | background-size: contain; | 42 | background-size: contain; |
| 38 | background-position: 0; | 43 | background-position: 0; |
src/views/notify/edit.vue
| @@ -5,11 +5,12 @@ import { getTableList } from "@/api/community/residence"; | @@ -5,11 +5,12 @@ import { getTableList } from "@/api/community/residence"; | ||
| 5 | import { useRoute } from "vue-router"; | 5 | import { useRoute } from "vue-router"; |
| 6 | import { back } from "@/utils/tool"; | 6 | import { back } from "@/utils/tool"; |
| 7 | import * as store from "@/pinia/index"; | 7 | import * as store from "@/pinia/index"; |
| 8 | +import { ElMessageBox } from "element-plus"; | ||
| 8 | import type { ElForm } from "element-plus"; | 9 | import type { ElForm } from "element-plus"; |
| 9 | let form = reactive({ | 10 | let form = reactive({ |
| 10 | data: { | 11 | data: { |
| 11 | title: "", | 12 | title: "", |
| 12 | - status: "0", | 13 | + status: null, |
| 13 | oId: store?.family?.loginStore()?.organizationId, | 14 | oId: store?.family?.loginStore()?.organizationId, |
| 14 | neighborHoodId: null, | 15 | neighborHoodId: null, |
| 15 | neighborHoodName: "", | 16 | neighborHoodName: "", |
| @@ -40,13 +41,6 @@ const rules = reactive({ | @@ -40,13 +41,6 @@ const rules = reactive({ | ||
| 40 | trigger: "change", | 41 | trigger: "change", |
| 41 | }, | 42 | }, |
| 42 | ], | 43 | ], |
| 43 | - status: [ | ||
| 44 | - { | ||
| 45 | - required: true, | ||
| 46 | - message: "请选择发布类型", | ||
| 47 | - trigger: "change", | ||
| 48 | - }, | ||
| 49 | - ], | ||
| 50 | }); | 44 | }); |
| 51 | /** | 45 | /** |
| 52 | * 表单重置 | 46 | * 表单重置 |
| @@ -58,20 +52,33 @@ const resetForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | @@ -58,20 +52,33 @@ const resetForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | ||
| 58 | /** | 52 | /** |
| 59 | * 表单提交 | 53 | * 表单提交 |
| 60 | */ | 54 | */ |
| 61 | -const submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | 55 | +const submitForm = ( |
| 56 | + formEl: InstanceType<typeof ElForm> | undefined, | ||
| 57 | + type: number | ||
| 58 | +) => { | ||
| 62 | if (!formEl) return; | 59 | if (!formEl) return; |
| 63 | formEl.validate(async (valid) => { | 60 | formEl.validate(async (valid) => { |
| 64 | if (valid) { | 61 | if (valid) { |
| 65 | - notifyAdd(form.data) | ||
| 66 | - .then((res) => { | ||
| 67 | - if (res) { | ||
| 68 | - instance?.proxy?.$message.success("操作成功"); | ||
| 69 | - history.go(-1); | 62 | + form.data.status = type; |
| 63 | + if (type) { | ||
| 64 | + ElMessageBox.confirm( | ||
| 65 | + "是否确定发布?(确认发布后将不可进行修改)", | ||
| 66 | + "提示", | ||
| 67 | + { | ||
| 68 | + confirmButtonText: "确认", | ||
| 69 | + cancelButtonText: "取消", | ||
| 70 | + type: "warning", | ||
| 70 | } | 71 | } |
| 71 | - }) | ||
| 72 | - .catch((error) => { | ||
| 73 | - console.log(error); | ||
| 74 | - }); | 72 | + ) |
| 73 | + .then((res) => { | ||
| 74 | + postApi(type); | ||
| 75 | + }) | ||
| 76 | + .catch((error) => { | ||
| 77 | + console.log(error); | ||
| 78 | + }); | ||
| 79 | + } else { | ||
| 80 | + postApi(type); | ||
| 81 | + } | ||
| 75 | } else { | 82 | } else { |
| 76 | instance?.proxy?.$message.error("请检查表单格式"); | 83 | instance?.proxy?.$message.error("请检查表单格式"); |
| 77 | return false; | 84 | return false; |
| @@ -79,6 +86,22 @@ const submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | @@ -79,6 +86,22 @@ const submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | ||
| 79 | }); | 86 | }); |
| 80 | }; | 87 | }; |
| 81 | /** | 88 | /** |
| 89 | + * 表单提交接口 | ||
| 90 | + * @param {number} type 1发布 0存草稿 | ||
| 91 | + */ | ||
| 92 | +const postApi = async (type: number) => { | ||
| 93 | + notifyAdd(form.data) | ||
| 94 | + .then((res) => { | ||
| 95 | + if (res) { | ||
| 96 | + instance?.proxy?.$message.success(type ? "发布成功" : "已存为草稿"); | ||
| 97 | + history.go(-1); | ||
| 98 | + } | ||
| 99 | + }) | ||
| 100 | + .catch((error) => { | ||
| 101 | + console.log(error); | ||
| 102 | + }); | ||
| 103 | +}; | ||
| 104 | +/** | ||
| 82 | * 选小区,给小区名赋值 | 105 | * 选小区,给小区名赋值 |
| 83 | * @param {number | null} data 选中的小区id | 106 | * @param {number | null} data 选中的小区id |
| 84 | */ | 107 | */ |
| @@ -163,15 +186,12 @@ onMounted(() => { | @@ -163,15 +186,12 @@ onMounted(() => { | ||
| 163 | show-word-limit | 186 | show-word-limit |
| 164 | /> | 187 | /> |
| 165 | </el-form-item> | 188 | </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'"> | 189 | <el-form-item style="width: 100%" v-show="form.dataType !== 'detail'"> |
| 173 | - <el-button type="primary" @click="submitForm(ruleFormRef)" | ||
| 174 | - >提交</el-button | 190 | + <el-button type="primary" @click="submitForm(ruleFormRef, 1)" |
| 191 | + >发布</el-button | ||
| 192 | + > | ||
| 193 | + <el-button type="primary" @click="submitForm(ruleFormRef, 0)" | ||
| 194 | + >存为草稿</el-button | ||
| 175 | > | 195 | > |
| 176 | <el-button | 196 | <el-button |
| 177 | type="info" | 197 | type="info" |
src/views/notify/index.vue
| @@ -93,6 +93,13 @@ const handleTimeChange = (value: array) => { | @@ -93,6 +93,13 @@ const handleTimeChange = (value: array) => { | ||
| 93 | getList(); | 93 | getList(); |
| 94 | }; | 94 | }; |
| 95 | /** | 95 | /** |
| 96 | + * 表格每一行是否可选中 | ||
| 97 | + * @param {array} row 每一行数据对象 | ||
| 98 | + */ | ||
| 99 | +const isSelectable = (row: any) => { | ||
| 100 | + return row.status === 0; | ||
| 101 | +}; | ||
| 102 | +/** | ||
| 96 | * 删除 | 103 | * 删除 |
| 97 | * @param {object} obj 要删除的数据对象 | 104 | * @param {object} obj 要删除的数据对象 |
| 98 | */ | 105 | */ |
| @@ -176,7 +183,11 @@ onMounted(() => { | @@ -176,7 +183,11 @@ onMounted(() => { | ||
| 176 | ref="multipleTableRef" | 183 | ref="multipleTableRef" |
| 177 | @selection-change="handleSelectionChange" | 184 | @selection-change="handleSelectionChange" |
| 178 | > | 185 | > |
| 179 | - <el-table-column type="selection" align="center" /> | 186 | + <el-table-column |
| 187 | + type="selection" | ||
| 188 | + align="center" | ||
| 189 | + :selectable="isSelectable" | ||
| 190 | + /> | ||
| 180 | <el-table-column prop="id" label="ID" align="center"></el-table-column> | 191 | <el-table-column prop="id" label="ID" align="center"></el-table-column> |
| 181 | <el-table-column | 192 | <el-table-column |
| 182 | prop="title" | 193 | prop="title" |
| @@ -204,8 +215,9 @@ onMounted(() => { | @@ -204,8 +215,9 @@ onMounted(() => { | ||
| 204 | </template> | 215 | </template> |
| 205 | </el-table-column> | 216 | </el-table-column> |
| 206 | <el-table-column label="操作" align="center"> | 217 | <el-table-column label="操作" align="center"> |
| 218 | + <!-- 已发布状态的公告不可以被修改、删除 --> | ||
| 207 | <template #default="scope"> | 219 | <template #default="scope"> |
| 208 | - <el-button type="text" | 220 | + <el-button type="text" v-show="scope.row.status === 0" |
| 209 | ><router-link | 221 | ><router-link |
| 210 | :to="{ | 222 | :to="{ |
| 211 | path: '/notify/edit', | 223 | path: '/notify/edit', |
| @@ -223,7 +235,10 @@ onMounted(() => { | @@ -223,7 +235,10 @@ onMounted(() => { | ||
| 223 | >详情</router-link | 235 | >详情</router-link |
| 224 | ></el-button | 236 | ></el-button |
| 225 | > | 237 | > |
| 226 | - <el-button type="text" @click="handleDelete(scope.row)" | 238 | + <el-button |
| 239 | + type="text" | ||
| 240 | + @click="handleDelete(scope.row)" | ||
| 241 | + v-show="scope.row.status === 0" | ||
| 227 | >删除</el-button | 242 | >删除</el-button |
| 228 | > | 243 | > |
| 229 | </template> | 244 | </template> |
src/views/property/index.vue
| 1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
| 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"; | 5 | import { menuData } from "@/api/user/login"; |
| 6 | import * as store from "@/pinia/index"; | 6 | import * as store from "@/pinia/index"; |
| 7 | import { parseTime } from "@/utils/tool"; | 7 | import { parseTime } from "@/utils/tool"; |
| @@ -68,7 +68,7 @@ const handleSearch = () => { | @@ -68,7 +68,7 @@ const handleSearch = () => { | ||
| 68 | }; | 68 | }; |
| 69 | /** | 69 | /** |
| 70 | * 切换状态 | 70 | * 切换状态 |
| 71 | - * @param {object} 单条数据对象 | 71 | + * @param {object} 单条数据对象 |
| 72 | */ | 72 | */ |
| 73 | const handleStatus = async (obj) => { | 73 | const handleStatus = async (obj) => { |
| 74 | try { | 74 | try { |
| @@ -91,23 +91,23 @@ const handleStatus = async (obj) => { | @@ -91,23 +91,23 @@ const handleStatus = async (obj) => { | ||
| 91 | * @param {object} 单条数据对象 | 91 | * @param {object} 单条数据对象 |
| 92 | */ | 92 | */ |
| 93 | const handleProxy = (obj) => { | 93 | const handleProxy = (obj) => { |
| 94 | - userProxy({oId: obj.id}).then(res => { | ||
| 95 | - if(res?.data) { | ||
| 96 | - console.log('代理成功的回调') | ||
| 97 | - console.log(res.data) | 94 | + userProxy({ oId: obj.id }).then((res) => { |
| 95 | + if (res?.data) { | ||
| 96 | + console.log("代理成功的回调"); | ||
| 97 | + console.log(res.data); | ||
| 98 | globalProperties.$message.success("代理成功"); | 98 | globalProperties.$message.success("代理成功"); |
| 99 | getMenu().then(() => { | 99 | getMenu().then(() => { |
| 100 | - console.log('got menu data') | 100 | + console.log("got menu data"); |
| 101 | setTimeout(() => { | 101 | setTimeout(() => { |
| 102 | - location.href = '/' | ||
| 103 | - console.log('跳') | ||
| 104 | - }, 2000) | ||
| 105 | - }) | 102 | + // location.href = '/' |
| 103 | + console.log("跳"); | ||
| 104 | + }, 2000); | ||
| 105 | + }); | ||
| 106 | } else { | 106 | } else { |
| 107 | globalProperties.$message.error("代理失败"); | 107 | globalProperties.$message.error("代理失败"); |
| 108 | } | 108 | } |
| 109 | - }) | ||
| 110 | -} | 109 | + }); |
| 110 | +}; | ||
| 111 | /** | 111 | /** |
| 112 | * 获取权限菜单 | 112 | * 获取权限菜单 |
| 113 | */ | 113 | */ |
| @@ -121,7 +121,7 @@ const getMenu = async () => { | @@ -121,7 +121,7 @@ const getMenu = async () => { | ||
| 121 | }; | 121 | }; |
| 122 | /** | 122 | /** |
| 123 | * 状态值 | 123 | * 状态值 |
| 124 | - * @enum {number} | 124 | + * @enum {number} |
| 125 | */ | 125 | */ |
| 126 | enum statusEnum { | 126 | enum statusEnum { |
| 127 | "禁用" = 0, | 127 | "禁用" = 0, |
| @@ -205,7 +205,9 @@ onMounted(() => { | @@ -205,7 +205,9 @@ onMounted(() => { | ||
| 205 | >编辑</router-link | 205 | >编辑</router-link |
| 206 | ></el-button | 206 | ></el-button |
| 207 | > | 207 | > |
| 208 | - <el-button type="text" @click="handleProxy(scope.row)">代理登录</el-button> | 208 | + <el-button type="text" @click="handleProxy(scope.row)" |
| 209 | + >代理登录</el-button | ||
| 210 | + > | ||
| 209 | <el-button type="text" @click="handleStatus(scope.row)">{{ | 211 | <el-button type="text" @click="handleStatus(scope.row)">{{ |
| 210 | scope.row.status ? "禁用" : "启用" | 212 | scope.row.status ? "禁用" : "启用" |
| 211 | }}</el-button> | 213 | }}</el-button> |