Compare commits

..

No commits in common. "acd9cad23f4397c32d18b1bba9739d0c4f3b34a5" and "a5ee34e6fb4a8409645e89f4631ec5c62dc3050b" have entirely different histories.

4 changed files with 69 additions and 49 deletions

View File

@ -1,8 +1,11 @@
import axios from "axios"; import axios from "axios";
export default { export default {
addTenant(tenant){ addTenant(tenant){
const url = '/api/tenant/addTenant' const url='http://localhost:8080/addTenant'
console.log("hahahhaahhha"+tenant.phone);
const data={ const data={
symbol: tenant.symbol, symbol: tenant.symbol,
contact: tenant.contact, contact: tenant.contact,
@ -22,21 +25,24 @@ export default {
}, },
async getAll() { getAll(){
const url = '/api/tenant/getAllTenant' const url='http://localhost:8080/getAllTenant'
const response = await axios.get(url) return axios.get(url)
.then(response => {
return response.data; return response.data;
});
}, },
update(tenant){ update(tenant){
const url = '/api/tenant/updateTenant'; const url='http://localhost:8080/updateTenant';
console.log("哈哈哈哈哈哈哈啊哈哈哈哈哈"+tenant);
return axios.post(url,tenant) return axios.post(url,tenant)
.then(response => { .then(response => {
}); });
}, },
delete(tenant){ delete(tenant){
const url = '/api/tenant/deleteTenant'; const url='http://localhost:8080/deleteTenant';
return axios.post(url,tenant) return axios.post(url,tenant)
.then(response => { .then(response => {
}); });

View File

@ -1,8 +1,10 @@
import axios from "axios"; import axios from "axios";
import {ref} from "vue";
export default { export default {
addUser(user){ addUser(user){
const url='/api/user/addUser' const url='http://localhost:8080/addUser'
const data={ const data={
account: user.account, account: user.account,
name: user.name, name: user.name,
@ -24,23 +26,34 @@ export default {
}, },
async getAll() { getAll(){
const url = '/api/user/getAll' const url='http://localhost:8080/getAll'
const response = await axios.get(url) return axios.get(url)
.then(response => {
return response.data; return response.data;
});
}, },
update(user){ update(user){
const url='/api/user/update'; const url='http://localhost:8080/update';
console.log("哈哈哈哈哈哈哈啊哈哈哈哈哈"+user);
return axios.post(url,user) return axios.post(url,user)
.then(() => { .then(response => {
location.href="/userManagement"; location.href="/userManagement";
}); });
}, },
async delete(user){ delete(user){
const url='/api/user/delete'; const url='http://localhost:8080/delete';
return await axios.post(url, user) console.log("哈哈哈哈哈哈哈啊哈哈哈哈哈"+user);
return axios.post(url,user)
.then(response => {
if(response.data==boolean){
alert("删除成功");
}else
alert("删除失败");
location.href="/userManagement";
});
} }
} }

View File

@ -67,8 +67,9 @@
<script lang="ts"> <script lang="ts">
import tenantService from "../../services/tenantService.js"; import tenantService from "../../services/tenantService.js";
import {defineComponent, onMounted, ref} from 'vue'; import { onMounted, ref, defineComponent } 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;
@ -103,7 +104,8 @@ export default defineComponent({
const fetchData = async () => { const fetchData = async () => {
try { try {
tableData.value = await tenantService.getAll(); const data = await tenantService.getAll();
tableData.value = data;
} catch (error) { } catch (error) {
console.error("Error fetching organization:", error); console.error("Error fetching organization:", error);
} }
@ -127,11 +129,11 @@ export default defineComponent({
const editFinished = async () => { const editFinished = async () => {
try { try {
await tenantService.update(formData.value); await tenantService.update(formData.value);
await ElMessageBox.alert('删除成功', '提示', { 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) => { callback: (action: Action) => {
ElMessage({ ElMessage({
type: 'info', type: 'info',
message: `action: ${action}`, message: `action: ${action}`,
@ -154,18 +156,18 @@ export default defineComponent({
const handleDelete = async () => { const handleDelete = async () => {
try{ try{
await tenantService.delete(formData.value); await tenantService.delete(formData.value);
await ElMessageBox.alert('删除成功', '提示', { 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) => { callback: (action: Action) => {
ElMessage({ ElMessage({
type: 'info', type: 'info',
message: `action: ${action}`, message: `action: ${action}`,
}) })
}, },
}) })
await fetchData(); fetchData();
}catch(error){ }catch(error){
} }

View File

@ -75,8 +75,7 @@
<script lang="ts"> <script lang="ts">
import userService from "../../services/userService.js"; import userService from "../../services/userService.js";
import {defineComponent, onMounted, ref} from 'vue'; import { onMounted, ref, defineComponent } from 'vue';
import {ElMessage} from "element-plus";
interface User { interface User {
id: number; id: number;
@ -120,7 +119,8 @@ export default defineComponent({
const fetchData = async () => { const fetchData = async () => {
try { try {
tableData.value = await userService.getAll(); const data = await userService.getAll();
tableData.value = data;
} catch (error) { } catch (error) {
console.error("Error fetching organization:", error); console.error("Error fetching organization:", error);
} }
@ -161,10 +161,9 @@ export default defineComponent({
const handleDelete = async () => { const handleDelete = async () => {
try{ try{
await userService.delete(formData.value); await userService.delete(formData.value);
ElMessage.error("删除成功") fetchData();
await fetchData();
}catch(error){ }catch(error){
ElMessage.error("删除失败")
} }
}; };