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