diff --git a/public/background.jpg b/public/background.jpg new file mode 100644 index 0000000..3a4d7fb Binary files /dev/null and b/public/background.jpg differ diff --git a/src/assets/global.css b/src/assets/global.css new file mode 100644 index 0000000..75c1da0 --- /dev/null +++ b/src/assets/global.css @@ -0,0 +1,17 @@ +body { + background-image: url('/public/background.jpg'); + background-size: contain; + background-repeat: no-repeat; + background-position: center; + background-attachment: fixed; + margin: 0; + padding: 0; + width: 100%; + height: 100%; +} + +@media (min-width: 768px) { + body { + background-size: cover; + } +} diff --git a/src/main.js b/src/main.js index afdbb60..4bab5b3 100644 --- a/src/main.js +++ b/src/main.js @@ -8,6 +8,7 @@ import ElementPlus from 'element-plus' import 'element-plus/dist/index.css' import App from './App.vue' + import './assets/global.css' const app = createApp(App) app.use(ElementPlus) diff --git a/src/router/index.js b/src/router/index.js index e849c72..ed9a3dd 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -13,8 +13,6 @@ import UserManagement from "../view/UserManagement.vue"; import TenantManagement from "../view/TenantManagement.vue"; import AddUser from "../view/AddUser.vue"; import AddTenant from "../view/AddTenant.vue"; -import EditTenant from "../view/EditTenant.vue"; -import EditUser from "../view/EditUser.vue"; import test from "../test.vue"; const routes = [ { path: '/', component: Home}, @@ -36,25 +34,11 @@ const routes = [ name: 'AddTenant', component: AddTenant }, - { path: '/editTenant', - name: 'EditTenant', - component: EditTenant - }, - { path: '/editUser', - name: 'EditUser', - component: EditUser - }, { path: '/test', name: 'Test', component: test }, { path: '/userManagement', name: 'UM', component:UserManagement } - // ...authenticationRoutes, - // ...courseManagementRoutes, - // ...meetingManagementRoutes, - // ...newsManagementRoutes, - // ...organizationManagementRoutes, - // ...userManagementRoutes, ] const router = createRouter({ diff --git a/src/services/authenticationService.js b/src/services/authenticationService.js index 2f51654..2aa8adf 100644 --- a/src/services/authenticationService.js +++ b/src/services/authenticationService.js @@ -28,7 +28,6 @@ alert("登录失败"); } // 处理登录成功的逻辑 - console.log(response.data); return response.data; }); diff --git a/src/services/tenantService.js b/src/services/tenantService.js new file mode 100644 index 0000000..16dac4b --- /dev/null +++ b/src/services/tenantService.js @@ -0,0 +1,51 @@ +import axios from "axios"; + + + +export default { + addTenant(tenant){ + const url='http://localhost:8080/addTenant' + console.log("hahahhaahhha"+tenant.phone); + const data={ + symbol: tenant.symbol, + contact: tenant.contact, + phone: tenant.phone, + manager: tenant.manager, + name: tenant.name, + } + return axios.post(url, data) + .then(response => { + if(response.data!=null){ + alert("新增成功"); + }else + alert("新增失败"); + location.href="/tenantManagement"; + }); + + }, + + + getAll(){ + const url='http://localhost:8080/getAllTenant' + return axios.get(url) + .then(response => { + return response.data; + }); + }, + + update(tenant){ + const url='http://localhost:8080/updateTenant'; + console.log("哈哈哈哈哈哈哈啊哈哈哈哈哈"+tenant); + return axios.post(url,tenant) + .then(response => { + }); + }, + + delete(tenant){ + const url='http://localhost:8080/deleteTenant'; + return axios.post(url,tenant) + .then(response => { + }); + } + +} \ No newline at end of file diff --git a/src/services/userService.js b/src/services/userService.js index 038b4c0..68e4985 100644 --- a/src/services/userService.js +++ b/src/services/userService.js @@ -26,14 +26,6 @@ export default { }, - editUser(){ - - }, - - searchUser(){ - - }, - getAll(){ const url='http://localhost:8080/getAll' return axios.get(url) @@ -47,10 +39,19 @@ export default { console.log("哈哈哈哈哈哈哈啊哈哈哈哈哈"+user); return axios.post(url,user) .then(response => { - if(response.data!=null){ - console.log(response.data) + location.href="/userManagement"; + }); + }, + + delete(user){ + const url='http://localhost:8080/delete'; + console.log("哈哈哈哈哈哈哈啊哈哈哈哈哈"+user); + return axios.post(url,user) + .then(response => { + if(response.data==boolean){ + alert("删除成功"); }else - console.log("更新失败"); + alert("删除失败"); location.href="/userManagement"; }); } diff --git a/src/view/AddTenant.vue b/src/view/AddTenant.vue index f79cdd8..58b48a6 100644 --- a/src/view/AddTenant.vue +++ b/src/view/AddTenant.vue @@ -1,11 +1,107 @@ - - - \ No newline at end of file +const manager = ref(''); +const phone = ref(''); +const contact = ref(''); +const name = ref(''); +const symbol = ref(''); + + +const addFinished = () => { + const tenant = { + symbol: symbol.value, + name: name.value, + contact: contact.value, + manager: manager.value, + phone: phone.value, + }; + tenantService.addTenant(tenant); +}; + + + diff --git a/src/view/AddUser.vue b/src/view/AddUser.vue index 34cb978..999537a 100644 --- a/src/view/AddUser.vue +++ b/src/view/AddUser.vue @@ -1,51 +1,89 @@ - \ No newline at end of file +.form-container { + background-color: #333; /* 深色背景 */ + color: white; /* 确保文本颜色与深色背景有对比 */ + padding: 20px; + border-radius: 10px; + width: 400px; +} + +.el-text { + color: white; /* 确保文本颜色与深色背景有对比 */ +} + +.el-input { + width: 100%; +} + diff --git a/src/view/EditTenant.vue b/src/view/EditTenant.vue deleted file mode 100644 index f79cdd8..0000000 --- a/src/view/EditTenant.vue +++ /dev/null @@ -1,11 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/view/EditUser.vue b/src/view/EditUser.vue deleted file mode 100644 index 55472ce..0000000 --- a/src/view/EditUser.vue +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/view/Home.vue b/src/view/Home.vue index 4ee6cc4..e455af5 100644 --- a/src/view/Home.vue +++ b/src/view/Home.vue @@ -1,33 +1,64 @@ - + diff --git a/src/view/Register.vue b/src/view/Register.vue index 6252d8e..0e61cdb 100644 --- a/src/view/Register.vue +++ b/src/view/Register.vue @@ -1,31 +1,34 @@ @@ -43,12 +46,10 @@ const gender = ref(''); const phone = ref(''); const email = ref(''); const organization = ref(''); -const account = ref(''); - +const account = ref(''); const router = useRouter(); - const open = () => { const user = { account: account.value, @@ -74,8 +75,34 @@ const open = () => { }, }); }; - diff --git a/src/view/TenantManagement.vue b/src/view/TenantManagement.vue index 5f8e094..756fca0 100644 --- a/src/view/TenantManagement.vue +++ b/src/view/TenantManagement.vue @@ -1,11 +1,230 @@ - - - \ No newline at end of file +interface Tenant { + symbol: string; + contact: string; + phone: string; + name: string; + manager: string; +} + +export default defineComponent({ + setup() { + const searchSymbol = ref(''); + const searchContact = ref(''); + const searchPhone = ref(''); + const searchName = ref(''); + const tableData = ref([]); + + const selectedRows = ref([]); + const formData = ref({ + symbol: '', + contact: '', + phone: '', + name: '', + manager: '', + }); + + const dialogVisible = ref(false); + + const handleClose = (done: () => void) => { + done(); + }; + + const fetchData = async () => { + try { + const data = await tenantService.getAll(); + tableData.value = data; + } catch (error) { + console.error("Error fetching organization:", error); + } + }; + + const handleSelectionChange = (rows) => { + selectedRows.value = rows; + if (rows.length === 1) { + formData.value = { ...rows[0] }; + } else { + formData.value = { + symbol: '', + contact: '', + phone: '', + name: '', + manager: '', + }; + } + }; + + const editFinished = async () => { + try { + await tenantService.update(formData.value); + ElMessageBox.alert('删除成功', '提示', { + // if you want to disable its autofocus + // autofocus: false, + confirmButtonText: 'OK', + callback: (action: Action) => { + ElMessage({ + type: 'info', + message: `action: ${action}`, + }) + }, + }) + dialogVisible.value = false; + location.href="/tenantManagement"; + fetchData(); + } catch (error) { + console.error("Error updating user:", error); + } + }; + + const handleAdd = () => { + location.href = '/addTenant'; + }; + + + const handleDelete = async () => { + try{ + await tenantService.delete(formData.value); + ElMessageBox.alert('删除成功', '提示', { + // if you want to disable its autofocus + // autofocus: false, + confirmButtonText: 'OK', + callback: (action: Action) => { + ElMessage({ + type: 'info', + message: `action: ${action}`, + }) + }, + }) + fetchData(); + }catch(error){ + + } + }; + + + + const handleSearch = async () => { + tableData.value =tableData.value.filter( + (data) => { + const isNameValid = searchName.value; + const isSymbolValid =searchSymbol.value; + const isPhoneValid = searchPhone.value; + const isContactValid = searchContact.value; + // search.value && search.value. + + return (!isNameValid || data.name.toLowerCase().includes(searchName.value.toLowerCase())) && + (!isPhoneValid || data.phone.toLowerCase().includes(searchPhone.value.toLowerCase()) )&& + (!isSymbolValid || data.symbol.toLowerCase().includes(searchSymbol.value.toLowerCase()))&& + (!isContactValid || data.contact.toLowerCase().includes(searchContact.value.toLowerCase())) + } + ) + }; + + + const handleReset=()=>{ + location.href = '/tenantManagement'; + }; + + onMounted(() => { + fetchData(); + }); + + return { + tableData, + handleAdd, + formData, + dialogVisible, + handleClose, + selectedRows, + handleSelectionChange, + editFinished, + handleDelete, + searchPhone, + searchSymbol, + searchName, + searchContact, + handleSearch, + handleReset + + }; + } +}); + + + diff --git a/src/view/UserManagement.vue b/src/view/UserManagement.vue index af0b344..22445d1 100644 --- a/src/view/UserManagement.vue +++ b/src/view/UserManagement.vue @@ -1,204 +1,3 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -