演示版?
This commit is contained in:
parent
ef704a17f5
commit
541b092691
@ -2,7 +2,7 @@ import axios from "axios";
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
login(account, password){
|
login(account, password){
|
||||||
const url = `http://localhost:8080/users/checkLogin`
|
const url = `api/users/checkLogin`
|
||||||
const data = {
|
const data = {
|
||||||
account: account,
|
account: account,
|
||||||
password: password
|
password: password
|
||||||
@ -13,7 +13,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
register(user){
|
register(user){
|
||||||
const url = `http://localhost:8080/users/checkRegister`
|
const url = `api/users/checkRegister`
|
||||||
return axios.post(url, user)
|
return axios.post(url, user)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
return response.data;
|
return response.data;
|
||||||
|
|||||||
@ -1,10 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="department-management" v-if="showTable">
|
<div class="department-management" v-if="showTable">
|
||||||
<el-breadcrumb separator="/">
|
|
||||||
<el-breadcrumb-item :to="{ path: '/login' }">登录界面</el-breadcrumb-item>
|
|
||||||
<el-breadcrumb-item :to="{ path: '/' }">Hello world</el-breadcrumb-item>
|
|
||||||
<el-breadcrumb-item :to="{ path: '/organization' }">部门管理</el-breadcrumb-item>
|
|
||||||
</el-breadcrumb>
|
|
||||||
<el-row :gutter="20" class="toolbar">
|
<el-row :gutter="20" class="toolbar">
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
<el-input v-model="search.name" placeholder="请输入部门名称"></el-input>
|
<el-input v-model="search.name" placeholder="请输入部门名称"></el-input>
|
||||||
@ -101,43 +96,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 用户显示界面-->
|
|
||||||
<!-- <el-dialog v-model="show" title="就职信息" width="80%">-->
|
|
||||||
<!-- <el-form :model="dialogFormPerson">-->
|
|
||||||
<!-- <el-form-item label="上级部门" :label-width="formLabelWidth">-->
|
|
||||||
<!-- <el-text>{{dialogFormPerson.}}</el-text>-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
<!-- <el-form-item prop="organizationName" label="部门名称" :label-width="formLabelWidth">-->
|
|
||||||
<!-- <el-input v-model="dialogFormAdd.organizationName"></el-input>-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
<!-- <el-form-item prop="displayOrder" label="显示排列" :label-width="formLabelWidth">-->
|
|
||||||
<!-- <el-input-number v-model="dialogFormAdd.displayOrder" :min=1 :max="100"></el-input-number>-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
<!-- <el-form-item prop="leader" label="负责人" :label-width="formLabelWidth">-->
|
|
||||||
<!-- <el-input v-model="dialogFormAdd.leader"></el-input>-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
<!-- <el-form-item prop="contactPhone" label="联系电话" :label-width="formLabelWidth">-->
|
|
||||||
<!-- <el-input v-model="dialogFormAdd.contactPhone"></el-input>-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
<!-- <el-form-item prop="email" label="邮箱" :label-width="formLabelWidth">-->
|
|
||||||
<!-- <el-input v-model="dialogFormAdd.email"></el-input>-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
<!-- <el-form-item label="部门状态" :label-width="formLabelWidth">-->
|
|
||||||
<!-- <el-switch v-model="dialogFormAdd.organizationStatus" active-value="true" active-text="启用" inactive-value="false" inactive-text="禁用"></el-switch>-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
<!-- </el-form>-->
|
|
||||||
<!-- <div class="dialog-footer">-->
|
|
||||||
<!-- <span slot="footer">-->
|
|
||||||
<!-- <el-button @click="showDialogAdd = false">取消</el-button>-->
|
|
||||||
<!-- <el-button type="primary" @click="submitForm">提交</el-button>-->
|
|
||||||
<!-- </span>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </el-dialog>-->
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {ref, onMounted, defineComponent} from 'vue';
|
import {ref, onMounted, defineComponent} from 'vue';
|
||||||
import organizationService from '../../services/organizationService';
|
import organizationService from '../../services/organizationService';
|
||||||
|
import {useStore} from 'vuex';
|
||||||
|
import {ElMessage, ElMessageBox} from "element-plus";
|
||||||
|
|
||||||
|
|
||||||
interface Organization {
|
interface Organization {
|
||||||
@ -155,6 +120,7 @@ interface Organization {
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
setup() {
|
setup() {
|
||||||
|
const store = useStore();
|
||||||
const showTable = ref(true);
|
const showTable = ref(true);
|
||||||
const show = ref(false);
|
const show = ref(false);
|
||||||
const showDialogAdd = ref(false);
|
const showDialogAdd = ref(false);
|
||||||
@ -172,17 +138,21 @@ export default defineComponent({
|
|||||||
organizationStatus: true,
|
organizationStatus: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const dialogFormPerson = ref({
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
const originTableData = ref<Organization[]>([]);
|
const originTableData = ref<Organization[]>([]);
|
||||||
const tableData = ref<Organization[]>([]);
|
const tableData = ref<Organization[]>([]);
|
||||||
const treeData = ref();
|
const treeData = ref();
|
||||||
const noChildrenData = ref();
|
const noChildrenData = ref();
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
// const token = store.getters['authentication/toke'];
|
|
||||||
try {
|
try {
|
||||||
tableData.value=[];
|
tableData.value=[];
|
||||||
const data = await organizationService.getAllOrganizations(); // 假设此函数可以获取后端数据
|
const data = await organizationService.getAllOrganizations();
|
||||||
|
if(data.lenth===1){
|
||||||
|
|
||||||
|
}
|
||||||
console.log('获取到的部门信息', data);
|
console.log('获取到的部门信息', data);
|
||||||
originTableData.value = data;
|
originTableData.value = data;
|
||||||
console.log(originTableData.value);
|
console.log(originTableData.value);
|
||||||
@ -239,6 +209,10 @@ export default defineComponent({
|
|||||||
const submitForm = () => {
|
const submitForm = () => {
|
||||||
console.log('提交表单' , dialogFormAdd.value);
|
console.log('提交表单' , dialogFormAdd.value);
|
||||||
organizationService.addOrganization(dialogFormAdd.value);
|
organizationService.addOrganization(dialogFormAdd.value);
|
||||||
|
ElMessage({
|
||||||
|
type: 'success',
|
||||||
|
message: `添加成功`,
|
||||||
|
})
|
||||||
showDialogAdd.value = false;
|
showDialogAdd.value = false;
|
||||||
|
|
||||||
dialogFormAdd.value = {
|
dialogFormAdd.value = {
|
||||||
@ -255,8 +229,32 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const deleteOrganization = (organizationId:number) => {
|
const deleteOrganization = (organizationId:number) => {
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'将删除该部门,确定?',
|
||||||
|
'注意!!!',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
center: true,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
organizationService.deleteOrganization(organizationId);
|
organizationService.deleteOrganization(organizationId);
|
||||||
fetchData();
|
fetchData();
|
||||||
|
ElMessage({
|
||||||
|
type: 'success',
|
||||||
|
message: '删除成功',
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
ElMessage({
|
||||||
|
type: 'info',
|
||||||
|
message: 'Delete canceled',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleUpdate = (organizationId:number) => {
|
const handleUpdate = (organizationId:number) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user