Compare commits
3 Commits
a5ee34e6fb
...
acd9cad23f
| Author | SHA1 | Date | |
|---|---|---|---|
| acd9cad23f | |||
| bb6dc0999f | |||
| 5a52a58c0c |
@ -1,12 +1,9 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
addTenant(tenant){
|
addTenant(tenant) {
|
||||||
const url='http://localhost:8080/addTenant'
|
const url = '/api/tenant/addTenant'
|
||||||
console.log("hahahhaahhha"+tenant.phone);
|
const data = {
|
||||||
const data={
|
|
||||||
symbol: tenant.symbol,
|
symbol: tenant.symbol,
|
||||||
contact: tenant.contact,
|
contact: tenant.contact,
|
||||||
phone: tenant.phone,
|
phone: tenant.phone,
|
||||||
@ -15,35 +12,32 @@ export default {
|
|||||||
}
|
}
|
||||||
return axios.post(url, data)
|
return axios.post(url, data)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if(response.data!=null){
|
if (response.data != null) {
|
||||||
alert("新增成功");
|
alert("新增成功");
|
||||||
}else
|
} else
|
||||||
alert("新增失败");
|
alert("新增失败");
|
||||||
location.href="/tenantManagement";
|
location.href = "/tenantManagement";
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
getAll(){
|
async getAll() {
|
||||||
const url='http://localhost:8080/getAllTenant'
|
const url = '/api/tenant/getAllTenant'
|
||||||
return axios.get(url)
|
const response = await axios.get(url)
|
||||||
.then(response => {
|
return response.data;
|
||||||
return response.data;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
update(tenant){
|
update(tenant) {
|
||||||
const url='http://localhost:8080/updateTenant';
|
const url = '/api/tenant/updateTenant';
|
||||||
console.log("哈哈哈哈哈哈哈啊哈哈哈哈哈"+tenant);
|
return axios.post(url, tenant)
|
||||||
return axios.post(url,tenant)
|
|
||||||
.then(response => {
|
.then(response => {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
delete(tenant){
|
delete(tenant) {
|
||||||
const url='http://localhost:8080/deleteTenant';
|
const url = '/api/tenant/deleteTenant';
|
||||||
return axios.post(url,tenant)
|
return axios.post(url, tenant)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
import {ref} from "vue";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
addUser(user){
|
addUser(user){
|
||||||
const url='http://localhost:8080/addUser'
|
const url='/api/user/addUser'
|
||||||
const data={
|
const data={
|
||||||
account: user.account,
|
account: user.account,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
@ -26,34 +24,23 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
getAll(){
|
async getAll() {
|
||||||
const url='http://localhost:8080/getAll'
|
const url = '/api/user/getAll'
|
||||||
return axios.get(url)
|
const response = await axios.get(url)
|
||||||
.then(response => {
|
return response.data;
|
||||||
return response.data;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
update(user){
|
update(user){
|
||||||
const url='http://localhost:8080/update';
|
const url='/api/user/update';
|
||||||
console.log("哈哈哈哈哈哈哈啊哈哈哈哈哈"+user);
|
|
||||||
return axios.post(url,user)
|
return axios.post(url,user)
|
||||||
.then(response => {
|
.then(() => {
|
||||||
location.href="/userManagement";
|
location.href="/userManagement";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
delete(user){
|
async delete(user){
|
||||||
const url='http://localhost:8080/delete';
|
const url='/api/user/delete';
|
||||||
console.log("哈哈哈哈哈哈哈啊哈哈哈哈哈"+user);
|
return await axios.post(url, user)
|
||||||
return axios.post(url,user)
|
|
||||||
.then(response => {
|
|
||||||
if(response.data==boolean){
|
|
||||||
alert("删除成功");
|
|
||||||
}else
|
|
||||||
alert("删除失败");
|
|
||||||
location.href="/userManagement";
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -67,9 +67,8 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import tenantService from "../../services/tenantService.js";
|
import tenantService from "../../services/tenantService.js";
|
||||||
import { onMounted, ref, defineComponent } from 'vue';
|
import {defineComponent, onMounted, ref} from 'vue';
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||||
import type { Action } from 'element-plus'
|
|
||||||
|
|
||||||
interface Tenant {
|
interface Tenant {
|
||||||
symbol: string;
|
symbol: string;
|
||||||
@ -104,8 +103,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
try {
|
try {
|
||||||
const data = await tenantService.getAll();
|
tableData.value = await tenantService.getAll();
|
||||||
tableData.value = data;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching organization:", error);
|
console.error("Error fetching organization:", error);
|
||||||
}
|
}
|
||||||
@ -129,11 +127,11 @@ export default defineComponent({
|
|||||||
const editFinished = async () => {
|
const editFinished = async () => {
|
||||||
try {
|
try {
|
||||||
await tenantService.update(formData.value);
|
await tenantService.update(formData.value);
|
||||||
ElMessageBox.alert('删除成功', '提示', {
|
await ElMessageBox.alert('删除成功', '提示', {
|
||||||
// if you want to disable its autofocus
|
// if you want to disable its autofocus
|
||||||
// autofocus: false,
|
// autofocus: false,
|
||||||
confirmButtonText: 'OK',
|
confirmButtonText: 'OK',
|
||||||
callback: (action: Action) => {
|
callback: (action) => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: `action: ${action}`,
|
message: `action: ${action}`,
|
||||||
@ -156,18 +154,18 @@ export default defineComponent({
|
|||||||
const handleDelete = async () => {
|
const handleDelete = async () => {
|
||||||
try{
|
try{
|
||||||
await tenantService.delete(formData.value);
|
await tenantService.delete(formData.value);
|
||||||
ElMessageBox.alert('删除成功', '提示', {
|
await ElMessageBox.alert('删除成功', '提示', {
|
||||||
// if you want to disable its autofocus
|
// if you want to disable its autofocus
|
||||||
// autofocus: false,
|
// autofocus: false,
|
||||||
confirmButtonText: 'OK',
|
confirmButtonText: 'OK',
|
||||||
callback: (action: Action) => {
|
callback: (action) => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: `action: ${action}`,
|
message: `action: ${action}`,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
fetchData();
|
await fetchData();
|
||||||
}catch(error){
|
}catch(error){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,7 +75,8 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import userService from "../../services/userService.js";
|
import userService from "../../services/userService.js";
|
||||||
import { onMounted, ref, defineComponent } from 'vue';
|
import {defineComponent, onMounted, ref} from 'vue';
|
||||||
|
import {ElMessage} from "element-plus";
|
||||||
|
|
||||||
interface User {
|
interface User {
|
||||||
id: number;
|
id: number;
|
||||||
@ -119,8 +120,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
try {
|
try {
|
||||||
const data = await userService.getAll();
|
tableData.value = await userService.getAll();
|
||||||
tableData.value = data;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching organization:", error);
|
console.error("Error fetching organization:", error);
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ export default defineComponent({
|
|||||||
const handleSelectionChange = (rows) => {
|
const handleSelectionChange = (rows) => {
|
||||||
selectedRows.value = rows;
|
selectedRows.value = rows;
|
||||||
if (rows.length === 1) {
|
if (rows.length === 1) {
|
||||||
formData.value = { ...rows[0] };
|
formData.value = {...rows[0]};
|
||||||
} else {
|
} else {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
id: null,
|
id: null,
|
||||||
@ -159,34 +159,35 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDelete = async () => {
|
const handleDelete = async () => {
|
||||||
try{
|
try {
|
||||||
await userService.delete(formData.value);
|
await userService.delete(formData.value);
|
||||||
fetchData();
|
ElMessage.error("删除成功")
|
||||||
}catch(error){
|
await fetchData();
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error("删除失败")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const handleSearch = async () => {
|
const handleSearch = async () => {
|
||||||
tableData.value =tableData.value.filter(
|
tableData.value = tableData.value.filter(
|
||||||
(data) => {
|
(data) => {
|
||||||
const isNameValid = searchName.value;
|
const isNameValid = searchName.value;
|
||||||
const isOrganizationValid =searchOrganization.value;
|
const isOrganizationValid = searchOrganization.value;
|
||||||
const isPhoneValid = searchPhone.value;
|
const isPhoneValid = searchPhone.value;
|
||||||
// search.value && search.value.
|
// search.value && search.value.
|
||||||
|
|
||||||
return (!isNameValid || data.name.toLowerCase().includes(searchName.value.toLowerCase())) &&
|
return (!isNameValid || data.name.toLowerCase().includes(searchName.value.toLowerCase())) &&
|
||||||
(!isPhoneValid || data.phone.toLowerCase().includes(searchPhone.value.toLowerCase()) )&&
|
(!isPhoneValid || data.phone.toLowerCase().includes(searchPhone.value.toLowerCase())) &&
|
||||||
(!isOrganizationValid || data.organization.toLowerCase().includes(searchOrganization.value.toLowerCase()))
|
(!isOrganizationValid || data.organization.toLowerCase().includes(searchOrganization.value.toLowerCase()))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const handleReset=()=>{
|
const handleReset = () => {
|
||||||
location.href = '/userManagement';
|
location.href = '/userManagement';
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchData();
|
fetchData();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user