Commit 668ef9f89fd8c38181715762cec69c0f1e5abaf8
1 parent
2c5bc8de
debug
Showing
4 changed files
with
54 additions
and
29 deletions
README.md
| @@ -6,6 +6,7 @@ cnlive-community-web-vue 中国网+智慧社区平台 | @@ -6,6 +6,7 @@ cnlive-community-web-vue 中国网+智慧社区平台 | ||
| 6 | + 技术栈 | 6 | + 技术栈 |
| 7 | * vue3.x (vite) | 7 | * vue3.x (vite) |
| 8 | * node v12.0.0+ | 8 | * node v12.0.0+ |
| 9 | + * vite v2.7.0+ | ||
| 9 | * element-plus v1.0.0+ | 10 | * element-plus v1.0.0+ |
| 10 | 11 | ||
| 11 | ## 项目特点 | 12 | ## 项目特点 |
| @@ -27,15 +28,17 @@ cnlive-community-web-vue 中国网+智慧社区平台 | @@ -27,15 +28,17 @@ cnlive-community-web-vue 中国网+智慧社区平台 | ||
| 27 | + 测试: | 28 | + 测试: |
| 28 | + test.community.api.cnlive.com | 29 | + test.community.api.cnlive.com |
| 29 | + test.community.web.cnlive.com | 30 | + test.community.web.cnlive.com |
| 31 | + | ||
| 32 | +## 测试账号(超管) | ||
| 33 | + * 账号 123 | ||
| 34 | + * 密码 cmnt123 | ||
| 35 | + | ||
| 36 | +## 发布方式 | ||
| 30 | + 服务器地址:120.92.119.11 | 37 | + 服务器地址:120.92.119.11 |
| 31 | + 服务器项目位置:cd /cnlive/cnlive-community-web-vue | 38 | + 服务器项目位置:cd /cnlive/cnlive-community-web-vue |
| 32 | + 账号:root | 39 | + 账号:root |
| 33 | + 密码:du=K0dB1z | 40 | + 密码:du=K0dB1z |
| 34 | 41 | ||
| 35 | -## 测试账号 | ||
| 36 | - | ||
| 37 | -## 发布方式 | ||
| 38 | - | ||
| 39 | ## 试用地址 | 42 | ## 试用地址 |
| 40 | * [测试环境](http://testweb.community.cnlive.com/#/dashboard "测试环境") | 43 | * [测试环境](http://testweb.community.cnlive.com/#/dashboard "测试环境") |
| 41 | 44 | ||
| @@ -73,9 +76,15 @@ cnlive-community-web-vue 中国网+智慧社区平台 | @@ -73,9 +76,15 @@ cnlive-community-web-vue 中国网+智慧社区平台 | ||
| 73 | * validate.ts 格式验证方法 | 76 | * validate.ts 格式验证方法 |
| 74 | * scroll.ts 页面滚动 | 77 | * scroll.ts 页面滚动 |
| 75 | * views 业务逻辑页面 | 78 | * views 业务逻辑页面 |
| 79 | + * community 小区管理 | ||
| 76 | * dashboard 欢迎页 | 80 | * dashboard 欢迎页 |
| 77 | - * user 用户管理 包含登录注册 | ||
| 78 | * error 错误提示页面 如404页 | 81 | * error 错误提示页面 如404页 |
| 82 | + * ownerManagement 业主管理 | ||
| 83 | + * permission 权限管理 | ||
| 84 | + * property 物业管理 | ||
| 85 | + * role 角色管理 | ||
| 86 | + * system 系统设置 | ||
| 87 | + * user 用户管理 包含登录注册 | ||
| 79 | * .env.development 本地开发环境配置 | 88 | * .env.development 本地开发环境配置 |
| 80 | * .env.production 线上部署正式环境配置 | 89 | * .env.production 线上部署正式环境配置 |
| 81 | * .env.staging 线上部署测试环境配置 | 90 | * .env.staging 线上部署测试环境配置 |
src/views/dashboard/index.vue
| 1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
| 2 | import {ref} from 'vue' | 2 | import {ref} from 'vue' |
| 3 | -import {propertyList } from '@/api/tengxi' | ||
| 4 | import router from '@/router' | 3 | import router from '@/router' |
| 5 | const title = ref(import.meta.env.VITE_APP_TITLE).value | 4 | const title = ref(import.meta.env.VITE_APP_TITLE).value |
| 6 | -propertyList().then(res => { | ||
| 7 | - console.log(res) | ||
| 8 | -}).catch(error => { | ||
| 9 | - console.log(error) | ||
| 10 | -}) | ||
| 11 | console.log(router.getRoutes()) | 5 | console.log(router.getRoutes()) |
| 12 | </script> | 6 | </script> |
| 13 | 7 |
src/views/permission/edit.vue
| @@ -80,6 +80,9 @@ onMounted(() => { | @@ -80,6 +80,9 @@ onMounted(() => { | ||
| 80 | form.dataType = useRoute().query.dataType; | 80 | form.dataType = useRoute().query.dataType; |
| 81 | if (form.dataType === "add") { | 81 | if (form.dataType === "add") { |
| 82 | form.data.parentId = useRoute().query.id; | 82 | form.data.parentId = useRoute().query.id; |
| 83 | + if(useRoute().query.type.toString() === '1') { | ||
| 84 | + form.data.type = '2' | ||
| 85 | + } | ||
| 83 | } else { | 86 | } else { |
| 84 | Object.keys(form.data).map((key) => { | 87 | Object.keys(form.data).map((key) => { |
| 85 | form.data[key] = useRoute().query[key]; | 88 | form.data[key] = useRoute().query[key]; |
| @@ -141,7 +144,7 @@ onMounted(() => { | @@ -141,7 +144,7 @@ onMounted(() => { | ||
| 141 | /> | 144 | /> |
| 142 | </el-form-item> | 145 | </el-form-item> |
| 143 | <!-- 不支持创建一级菜单,编辑的时候不可以修改菜单类型 --> | 146 | <!-- 不支持创建一级菜单,编辑的时候不可以修改菜单类型 --> |
| 144 | - <!-- 一级菜单下只能创建二级菜单 --> | 147 | + <!-- 一级菜单下只能创建二级菜单,这时候默认选中 --> |
| 145 | <!-- 二级菜单可以创建三级菜单或者按钮 --> | 148 | <!-- 二级菜单可以创建三级菜单或者按钮 --> |
| 146 | <!-- 三级菜单只能创建按钮 --> | 149 | <!-- 三级菜单只能创建按钮 --> |
| 147 | <el-form-item label="权限类型" prop="type" style="width: 100%"> | 150 | <el-form-item label="权限类型" prop="type" style="width: 100%"> |
src/views/user/edit.vue
| 1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
| 2 | import { reactive, ref, getCurrentInstance, onMounted } from "vue"; | 2 | import { reactive, ref, getCurrentInstance, onMounted } from "vue"; |
| 3 | -import { userAdd } from "@/api/user/user"; | 3 | +import { userEdit, userAdd } from "@/api/user/user"; |
| 4 | import { roleList } from "@/api/user/role"; | 4 | import { roleList } from "@/api/user/role"; |
| 5 | import { getTableList } from "@/api/community/residence"; | 5 | import { getTableList } from "@/api/community/residence"; |
| 6 | import { useRoute } from "vue-router"; | 6 | import { useRoute } from "vue-router"; |
| @@ -17,14 +17,14 @@ let form = reactive({ | @@ -17,14 +17,14 @@ let form = reactive({ | ||
| 17 | cellphone: "", | 17 | cellphone: "", |
| 18 | password: "", | 18 | password: "", |
| 19 | roleIds: "", | 19 | roleIds: "", |
| 20 | - cIds: "", | 20 | + neighborhoodIds: "", |
| 21 | userId: "", | 21 | userId: "", |
| 22 | }, | 22 | }, |
| 23 | dataType: "", | 23 | dataType: "", |
| 24 | roles: [], | 24 | roles: [], |
| 25 | communities: [], | 25 | communities: [], |
| 26 | checkList: [], | 26 | checkList: [], |
| 27 | - communityList: [] | 27 | + communityList: [], |
| 28 | }); | 28 | }); |
| 29 | const ruleFormRef = ref<InstanceType<typeof ElForm>>(); | 29 | const ruleFormRef = ref<InstanceType<typeof ElForm>>(); |
| 30 | /** | 30 | /** |
| @@ -81,6 +81,7 @@ const rules = reactive({ | @@ -81,6 +81,7 @@ const rules = reactive({ | ||
| 81 | const resetForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | 81 | const resetForm = (formEl: InstanceType<typeof ElForm> | undefined) => { |
| 82 | if (!formEl) return; | 82 | if (!formEl) return; |
| 83 | form.checkList = []; | 83 | form.checkList = []; |
| 84 | + form.communityList = []; | ||
| 84 | formEl.resetFields(); | 85 | formEl.resetFields(); |
| 85 | }; | 86 | }; |
| 86 | /** | 87 | /** |
| @@ -88,18 +89,30 @@ const resetForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | @@ -88,18 +89,30 @@ const resetForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | ||
| 88 | */ | 89 | */ |
| 89 | const submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | 90 | const submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { |
| 90 | if (!formEl) return; | 91 | if (!formEl) return; |
| 91 | - formEl.validate((valid) => { | 92 | + formEl.validate(async (valid) => { |
| 92 | if (valid) { | 93 | if (valid) { |
| 93 | - userAdd(form.data) | ||
| 94 | - .then((res) => { | ||
| 95 | - if (res) { | ||
| 96 | - globalProperties.$message.success("操作成功"); | ||
| 97 | - history.go(-1); | ||
| 98 | - } | ||
| 99 | - }) | ||
| 100 | - .catch((error) => { | ||
| 101 | - console.log(error); | ||
| 102 | - }); | 94 | + let res; |
| 95 | + try { | ||
| 96 | + // 用户编辑和用户增加的接口不一样!参数也不一样! | ||
| 97 | + if (form.dataType === "add") { | ||
| 98 | + res = await userAdd(form.data); | ||
| 99 | + } else if (form.dataType === "edit") { | ||
| 100 | + res = await userEdit({ | ||
| 101 | + cellphone: form.data.cellphone, | ||
| 102 | + password: form.data.password, | ||
| 103 | + roleIds: form.data.roleIds, | ||
| 104 | + userId: form.data.id, | ||
| 105 | + userName: form.data.userName | ||
| 106 | + }); | ||
| 107 | + } | ||
| 108 | + } catch (e) { | ||
| 109 | + console.log(e); | ||
| 110 | + } finally { | ||
| 111 | + if (res?.data) { | ||
| 112 | + globalProperties.$message.success("操作成功"); | ||
| 113 | + history.go(-1); | ||
| 114 | + } | ||
| 115 | + } | ||
| 103 | } else { | 116 | } else { |
| 104 | globalProperties.$message.error("请检查表单格式"); | 117 | globalProperties.$message.error("请检查表单格式"); |
| 105 | return false; | 118 | return false; |
| @@ -151,7 +164,8 @@ onMounted(() => { | @@ -151,7 +164,8 @@ onMounted(() => { | ||
| 151 | form.dataType = "add"; | 164 | form.dataType = "add"; |
| 152 | } else { | 165 | } else { |
| 153 | form.dataType = "edit"; | 166 | form.dataType = "edit"; |
| 154 | - form.checkList = form.data.roleIds.split(",").map((v) => v / 1); | 167 | + form.checkList = form.data.roleIds? form.data.roleIds?.split(",").map((v) => v / 1): [] |
| 168 | + form.communityList = form.data.neighborhoodIds? form.data.neighborhoodIds.split(",").map((v) => v / 1): [] | ||
| 155 | } | 169 | } |
| 156 | }); | 170 | }); |
| 157 | </script> | 171 | </script> |
| @@ -183,7 +197,12 @@ onMounted(() => { | @@ -183,7 +197,12 @@ onMounted(() => { | ||
| 183 | maxlength="15" | 197 | maxlength="15" |
| 184 | /> | 198 | /> |
| 185 | </el-form-item> | 199 | </el-form-item> |
| 186 | - <el-form-item label="密码" prop="password" style="width: 100%"> | 200 | + <el-form-item |
| 201 | + label="密码" | ||
| 202 | + prop="password" | ||
| 203 | + style="width: 100%" | ||
| 204 | + v-show="form.dataType === 'add'" | ||
| 205 | + > | ||
| 187 | <el-input | 206 | <el-input |
| 188 | v-model.trim="form.data.password" | 207 | v-model.trim="form.data.password" |
| 189 | placeholder="请填写密码" | 208 | placeholder="请填写密码" |
| @@ -206,7 +225,7 @@ onMounted(() => { | @@ -206,7 +225,7 @@ onMounted(() => { | ||
| 206 | <el-form-item label="小区" style="width: 100%"> | 225 | <el-form-item label="小区" style="width: 100%"> |
| 207 | <el-checkbox-group | 226 | <el-checkbox-group |
| 208 | v-model="form.communityList" | 227 | v-model="form.communityList" |
| 209 | - @change="(data) => (form.data.cIds = data.join(','))" | 228 | + @change="(data) => (form.data.neighborhoodIds = data.join(','))" |
| 210 | > | 229 | > |
| 211 | <el-checkbox | 230 | <el-checkbox |
| 212 | v-for="(item, index) in form.communities" | 231 | v-for="(item, index) in form.communities" |