diff --git a/04.系统编码/Frontend/.idea/workspace.xml b/04.系统编码/Frontend/.idea/workspace.xml index 36f7437..2812014 100644 --- a/04.系统编码/Frontend/.idea/workspace.xml +++ b/04.系统编码/Frontend/.idea/workspace.xml @@ -3,6 +3,8 @@ <component name="ChangeListManager"> <list default="true" id="4b7d7b72-f5b8-41e4-85d5-6267bdc12fc5" name="默认变更列表" comment=""> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/src/components/Login.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/Login.vue" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/src/components/Shared/Header.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/Shared/Header.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/components/SystemManagement.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/SystemManagement.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/uilts/axios.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/uilts/axios.ts" afterDir="false" /> </list> @@ -31,12 +33,16 @@ <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" /> <property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> <property name="WebServerToolWindowFactoryState" value="false" /> + <property name="last_opened_file_path" value="$PROJECT_DIR$/src" /> <property name="nodejs_package_manager_path" value="npm" /> <property name="settings.editor.selected.configurable" value="preferences.pluginManager" /> <property name="ts.external.directory.path" value="D:\project\NanJingLamanRadarProject\04.系统编码\Frontend\node_modules\typescript\lib" /> <property name="vue.rearranger.settings.migration" value="true" /> </component> <component name="RecentsManager"> + <key name="CopyFile.RECENT_KEYS"> + <recent name="D:\project\NanJingLamanRadarProject\04.系统编码\Frontend\src" /> + </key> <key name="MoveFile.RECENT_KEYS"> <recent name="D:\project\NanJingLamanRadarProject\04.系统编码\Frontend\src\uilts" /> <recent name="D:\project\NanJingLamanRadarProject\04.系统编码\Frontend\public\images" /> @@ -79,7 +85,7 @@ <workItem from="1638441956659" duration="5371000" /> <workItem from="1638447904778" duration="262000" /> <workItem from="1638496246090" duration="1527000" /> - <workItem from="1638497917929" duration="1734000" /> + <workItem from="1638497917929" duration="11910000" /> </task> <task id="LOCAL-00001" summary="2021 12 01"> <created>1638357539757</created> diff --git a/04.系统编码/Frontend/src/components/Login.vue b/04.系统编码/Frontend/src/components/Login.vue index ad9041e..181c6ec 100644 --- a/04.系统编码/Frontend/src/components/Login.vue +++ b/04.系统编码/Frontend/src/components/Login.vue @@ -23,6 +23,7 @@ import {reactive, toRefs} from "vue"; import { post } from "./../uilts/axios"; import { useRouter } from "vue-router" import { ElMessage } from 'element-plus' +import { setStaff } from "../uilts/storage"; export default { name: 'Login', @@ -61,7 +62,7 @@ export default { type: 'error' }); }else { - console.log(res) + setStaff('login_staff', res.data) router.push("/MicrowaveRadiation") } }) diff --git a/04.系统编码/Frontend/src/components/Shared/Header.vue b/04.系统编码/Frontend/src/components/Shared/Header.vue index 0003d26..e33e201 100644 --- a/04.系统编码/Frontend/src/components/Shared/Header.vue +++ b/04.系统编码/Frontend/src/components/Shared/Header.vue @@ -11,18 +11,20 @@ <div class="nav-item" @click="onNavClick('DecisionSupport')" :class="{'active': currentPath === 'DecisionSupport'}">决策支持</div> <div class="nav-item" @click="onNavClick('SystemManagement')" :class="{'active': currentPath === 'SystemManagement'}">系统管理</div> </div> + + <span @click="Logout">退出登录</span> </div> </template> <script lang="ts"> import { reactive, onMounted, toRefs } from "vue"; import { useRouter } from 'vue-router'; + import { clear } from "../../uilts/storage"; export default { name: 'Header', setup() { const router = useRouter(); - let options = reactive({ currentPath: 'MicrowaveRadiation' }) @@ -32,9 +34,15 @@ router.push({path: path}); } + const Logout = () => { + clear() + router.replace('/Login') + } + return { ...toRefs(options), - onNavClick + onNavClick, + Logout } } } @@ -47,6 +55,13 @@ display: flex; align-items: center; color: #ffffff; + span{ + padding: 10px; + cursor: pointer; + border: 1px solid grey; + background-color: #498DF0; + border-radius: 10px; + } .logo { margin-left: 0.2rem; display: flex; diff --git a/04.系统编码/Frontend/src/components/SystemManagement.vue b/04.系统编码/Frontend/src/components/SystemManagement.vue index 3293109..9132363 100644 --- a/04.系统编码/Frontend/src/components/SystemManagement.vue +++ b/04.系统编码/Frontend/src/components/SystemManagement.vue @@ -1,391 +1,395 @@ <template> - <div class="tabs"> - </div> - <div class="main"> - <div class="container system-container panel"> - <div class="box"> - <div class="left"> - <h1>用户姓名:</h1> - <input type="text" v-model="state1" class="textInput"/> - <div><img src="/images/search.png" @click="onSearch"></div> - </div> - <div class="right"> - <span @click="onAddClick">添加新用户</span> - </div> - </div> - - <div class="tableMessage"> - <el-table :data="tableData" border style="color: black;"> - <el-table-column type="index" label="序号" align="center" width="100px"/> - <el-table-column prop="userName" label="用户姓名" align="center"/> - <el-table-column prop="userAccountNumber" label="用户账号" align="center"/> - <el-table-column prop="userPhone" label="电话" align="center"/> - <el-table-column prop="userEmail" label="邮箱" align="center"/> - <el-table-column prop="operation" label="操作" align="center"> - <template #default="scope"> - <div class="operation"> - <span @click.prevent="onAmendClick(scope.$index, tableData)">修改信息</span> - <!--删除--> - <el-popconfirm - confirm-button-text="确认" - cancel-button-text="取消" - @confirm="confirmEvent(scope.$index, tableData)" - title="确认删除?"> - <template #reference> - <span>删除用户</span> - </template> - </el-popconfirm> - </div> - </template> - </el-table-column> - </el-table> - <!---分页--> - <div class="pagination"> - <el-pagination background - layout="prev, pager, next" - :total="total" - @prev-click="prev" - @next-click="next" - @current-change="changEnum"> - </el-pagination> - </div> - </div> + <div class="tabs"> + </div> + <div class="main"> + <div class="container system-container panel"> + <div class="box"> + + <div class="left"> + <h1>用户姓名:</h1> + <input type="text" v-model="state1" class="textInput"/> + <div><img src="/images/search.png" @click="onSearch"></div> + </div> + + <div class="right"> + <span @click="onAddClick">添加新用户</span> </div> - <!--弹出框---> - <el-dialog v-model="dialogFormVisible" :title="title" center=true width="900px" top="17%"> - <el-form :model="form"> - <el-form-item label="用户账号:" :label-width="formLabelWidth" > - <el-input v-model="form.userAccountNumber" autocomplete="off" style="width: 260px" :disabled="isDisabled"></el-input> - </el-form-item> - <el-form-item label="用户密码:" :label-width="formLabelWidth"> - <el-input v-model="form.userPassword" autocomplete="off" style="width: 260px" type="password"></el-input> - </el-form-item> - <el-form-item label="电话:" :label-width="formLabelWidth"> - <el-input v-model="form.userPhone" autocomplete="off" style="width: 260px"></el-input> - </el-form-item> - <el-form-item label="邮箱:" :label-width="formLabelWidth"> - <el-input v-model="form.userEmail" autocomplete="off" style="width: 260px"></el-input> - </el-form-item> - <el-form-item label="用户姓名:" :label-width="formLabelWidth"> - <el-input v-model="form.userName" autocomplete="off" style="width: 260px"></el-input> - </el-form-item> - </el-form> - <template #footer> + </div> + + <div class="tableMessage"> + <el-table :data="tableData" border style="color: black;"> + <el-table-column type="index" label="序号" align="center" width="100px"/> + <el-table-column prop="userName" label="用户姓名" align="center"/> + <el-table-column prop="userAccountNumber" label="用户账号" align="center"/> + <el-table-column prop="userPhone" label="电话" align="center"/> + <el-table-column prop="userEmail" label="邮箱" align="center"/> + <el-table-column prop="operation" label="操作" align="center"> + <template #default="scope"> + <div class="operation"> + <span @click.prevent="onAmendClick(scope.$index, tableData)">修改信息</span> + <!--删除--> + <el-popconfirm + confirm-button-text="确认" + cancel-button-text="取消" + @confirm="confirmEvent(scope.$index, tableData)" + title="确认删除?"> + <template #reference> + <span>删除用户</span> + </template> + </el-popconfirm> + </div> + </template> + </el-table-column> + </el-table> + <!---分页--> + <div class="pagination"> + <el-pagination background + layout="prev, pager, next" + :total="total" + hide-on-single-page="hide-on-single-page" + @prev-click="prev" + @next-click="next" + @current-change="changEnum"> + </el-pagination> + </div> + </div> + </div> + + <!--弹出框---> + <el-dialog v-model="dialogFormVisible" :title="title" center=center width="900px" top="17%"> + <el-form :model="form"> + <el-form-item label="用户账号:" :label-width="formLabelWidth"> + <el-input v-model="form.userAccountNumber" autocomplete="off" style="width: 260px" + :disabled="isDisabled"></el-input> + </el-form-item> + <el-form-item label="用户密码:" :label-width="formLabelWidth"> + <el-input v-model="form.userPassword" autocomplete="off" style="width: 260px" type="password"></el-input> + </el-form-item> + <el-form-item label="电话:" :label-width="formLabelWidth"> + <el-input v-model="form.userPhone" autocomplete="off" style="width: 260px"></el-input> + </el-form-item> + <el-form-item label="邮箱:" :label-width="formLabelWidth"> + <el-input v-model="form.userEmail" autocomplete="off" style="width: 260px"></el-input> + </el-form-item> + <el-form-item label="用户姓名:" :label-width="formLabelWidth"> + <el-input v-model="form.userName" autocomplete="off" style="width: 260px"></el-input> + </el-form-item> + </el-form> + <template #footer> <span class="dialog-footer"> <el-button type="primary" @click="submit" style="color:#FFFFFF;">保存</el-button> - <el-button @click="dialogFormVisible = false">取消</el-button> + <el-button @click="dialogFormVisible = false">取消</el-button> </span> - </template> - </el-dialog> + </template> + </el-dialog> - </div> + </div> </template> +<script lang="ts"> + import {onMounted, reactive, toRefs} from 'vue'; + import {post} from "../uilts/axios"; + import {ElMessage} from 'element-plus' + import {format} from '../uilts/String'; -<script lang="ts"> -import {onMounted, reactive, toRefs} from 'vue'; -import { post } from "../uilts/axios"; -import { ElMessage } from 'element-plus' -import { format } from '../uilts/String'; export default { - name: 'SystemManagement', - setup() { - let option = reactive({ - state1:'', - dialogFormVisible:false, - isDisabled:false, - title:'', - formLabelWidth:"100px", - total:null, - current:1, - size:10, - form:{ - userName:'', - userAccountNumber:'', - userPhone:'', - userEmail:'', - userPassword:'' - }, - tableData:[] - }) - - onMounted(() => { - findAllUser(); - }) - - const findAllUser = ()=>{ - return post("user/findUserByUserName",{ - userName: option.state1.trim(), - current:option.current, - size:option.size - }).then((res:any)=>{ - option.tableData= res.data.records; - option.total = res.data.total; - }) - } + name: 'SystemManagement', + setup() { + let option = reactive({ + state1: '', + dialogFormVisible: false, + isDisabled: false, + title: '', + formLabelWidth: "100px", + total: null, + current: 1, + size: 10, + form: { + userName: '', + userAccountNumber: '', + userPhone: '', + userEmail: '', + userPassword: '' + }, + tableData: [] + }) + + onMounted(() => { + findAllUser(); + }) + + const findAllUser = () => { + return post("user/findUserByUserName", { + userName: option.state1.trim(), + current: option.current, + size: option.size + }).then((res: any) => { + option.tableData = res.data.records; + option.total = res.data.total; + }) + } - //添加用户 - const onAddClick = ()=> { - option.isDisabled=false - option.title = '添加用户' - option.dialogFormVisible = true - option.form = { - userName:'', - userAccountNumber:'', - userPhone:'', - userEmail:'', - userPassword:'' - } - } + //添加用户 + const onAddClick = () => { + option.isDisabled = false + option.title = '添加用户' + option.dialogFormVisible = true + option.form = { + userName: '', + userAccountNumber: '', + userPhone: '', + userEmail: '', + userPassword: '' + } + } - //修改用户 - const onAmendClick = (index, rows)=>{ - option.isDisabled = true - option.title = '修改信息' - option.dialogFormVisible = true - option.form = JSON.parse(JSON.stringify(rows[index])) - } + //修改用户 + const onAmendClick = (index, rows) => { + option.isDisabled = true + option.title = '修改信息' + option.dialogFormVisible = true + option.form = JSON.parse(JSON.stringify(rows[index])) + } - //删除用户 - const confirmEvent = (index, rows)=>{ - console.log(rows[index].userAccountNumber) - post('user/delUser',{ - userAccountNumber:rows[index].userAccountNumber - }).then((res:any)=>{ - if (res.error != 0){ - ElMessage.error({ - message: "删除失败", - type: 'error' - }); - return; - }else { - findAllUser() - ElMessage.success({ - message: "删除成功", - type: 'success' - }); - } - }) - } + //删除用户 + const confirmEvent = (index, rows) => { + post('user/delUser', { + userAccountNumber: rows[index].userAccountNumber + }).then((res: any) => { + if (res.error != 0) { + ElMessage.error({ + message: "删除失败", + type: 'error' + }); + return; + } else { + findAllUser() + ElMessage.success({ + message: "删除成功", + type: 'success' + }); + } + }) + } - //图片搜索 - const onSearch = ()=> { - post("user/findUserByUserName",{ - current: option.current, - size: option.size, - userName: option.state1 - }).then((res:any) => { - option.tableData= res.data.records; - option.total = res.data.total; - console.log(res) - }) - } + //图片搜索 + const onSearch = () => { + post("user/findUserByUserName", { + current: option.current, + size: option.size, + userName: option.state1 + }).then((res: any) => { + option.tableData = res.data.records; + option.total = res.data.total; + }) + } - const prev = (e)=>{ - option.current= e - findAllUser() - } + const prev = (e) => { + option.current = e + findAllUser() + } - const next = (e)=>{ - option.current= e - findAllUser() - } + const next = (e) => { + option.current = e + findAllUser() + } - const changEnum = (e)=> { - option.current = e; - findAllUser() - } + const changEnum = (e) => { + option.current = e; + findAllUser() + } + + const verify = () => { + let errors = []; + if (option.form.userAccountNumber == null || option.form.userAccountNumber.trim() == "") { + errors.push("用户账号"); + } + if (option.form.userPassword == null || option.form.userPassword.trim() == "") { + errors.push("用户密码"); + } + if (option.form.userName == null || option.form.userName.trim() == "") { + errors.push("用户姓名"); + } + if (errors.length > 0) { + ElMessage.error({ + message: format("{0}不能为空", errors.join(", ")), + type: 'error' + }); + } + return errors.length > 0; + } - const verify = () => { - let errors = []; - if (option.form.userAccountNumber == null || option.form.userAccountNumber.trim() == ""){ - errors.push("用户账号"); - } - if (option.form.userPassword == null || option.form.userPassword.trim() == ""){ - errors.push("用户密码"); - } - if (option.form.userName == null || option.form.userName.trim() == ""){ - errors.push("用户姓名"); - } - if (errors.length > 0){ - ElMessage.error({ - message: format("{0}不能为空", errors.join(", ")), - type: 'error' - }); - } - return errors.length > 0; + const submit = () => { + if (verify()) return; + if (option.title === '修改信息') { + post("user/updateUser", option.form, "application/json").then((res: any) => { + option.dialogFormVisible = false + if (res.error != 0) { + ElMessage.error({ + message: "修改失败", + type: 'error' + }); + return; + } else { + findAllUser() + ElMessage.success({ + message: "修改成功", + type: 'success' + }); } + }) + } - const submit = ()=> { - if (verify()) return; - if(option.title === '修改信息'){ - post("user/updateUser", option.form, "application/json").then((res: any) => { - option.dialogFormVisible=false - if (res.error != 0){ - ElMessage.error({ - message: "修改失败", - type: 'error' - }); - return; - }else { - findAllUser() - ElMessage.success({ - message: "修改成功", - type: 'success' - }); - } - }) - } - - if(option.title === '添加用户'){ - if (verify()) return; - post("user/insertUser",option.form,"application/json").then((res:any)=>{ - option.dialogFormVisible = false - if (res.error != 0){ - ElMessage.error({ - message: "修改失败", - type: 'error' - }); - return; - }else { - findAllUser() - ElMessage.success({ - message: "修改成功", - type: 'success' - }); - } - }) - } + if (option.title === '添加用户') { + if (verify()) return; + post("user/insertUser", option.form, "application/json").then((res: any) => { + option.dialogFormVisible = false + if (res.error != 0) { + ElMessage.error({ + message: "修改失败", + type: 'error' + }); + return; + } else { + findAllUser() + ElMessage.success({ + message: "修改成功", + type: 'success' + }); } + }) + } + } - return { - ...toRefs(option), - onAddClick, - onAmendClick, - onSearch, - submit, - findAllUser, - confirmEvent, - prev, - next, - changEnum - } - } + return { + ...toRefs(option), + onAddClick, + onAmendClick, + onSearch, + submit, + findAllUser, + confirmEvent, + prev, + next, + changEnum } + } +} </script> <style lang="less" scoped> - .system-container { - width: 100%; - margin-left: 0; +.system-container { + width: 100%; + margin-left: 0; - .pagination{ - margin-top: 10px; - display: flex; - justify-content: flex-end; - } + .pagination { + margin-top: 10px; + display: flex; + justify-content: flex-end; + } - .box{ - padding: 28px 20px 0px ; - display: flex; - justify-content: space-between; - - .left{ - display: flex; - justify-content: space-between; - align-items: center; - - .textInput{ - width: 305px; - height: 35px; - line-height: 35px; - font-size: 20px; - text-indent: 10px; - } - - h1{ - width: 100px; - height: 26px; - font-size: 20px; - font-weight: bold; - line-height: 26px; - color: #000000; - opacity: 1; - } - - img{ - width: 44px; - height: 44px; - margin-left: 10px; - padding-top: 4px; - cursor: pointer; - } - } + .box { + padding: 28px 20px 0px; + display: flex; + justify-content: space-between; - .right{ - width: 100px; - height: 26px; - font-size: 20px; - font-weight: bold; - line-height: 26px; - color: #498DF0; - opacity: 1; - - span{ - width: 96px; - height: 0px; - border-bottom: 1px solid #498DF0; - opacity: 1; - cursor: pointer; - } - } + .left { + display: flex; + justify-content: space-between; + align-items: center; + + .textInput { + width: 305px; + height: 35px; + line-height: 35px; + font-size: 20px; + text-indent: 10px; } - .tableMessage{ - padding: 36px 20px 20px; - font-size: 18px; + h1 { + width: 100px; + height: 26px; + font-size: 20px; + font-weight: bold; + line-height: 26px; + color: #000000; + opacity: 1; + } - .operation { - display: flex; - justify-content: space-evenly; + img { + width: 44px; + height: 44px; + margin-left: 10px; + padding-top: 4px; + cursor: pointer; + } + } - span { - border-bottom: 1px solid #000000; - opacity: 1; - cursor: pointer; - font-weight: 400; - } + .right { + width: 100px; + height: 26px; + font-size: 20px; + font-weight: bold; + line-height: 26px; + color: #498DF0; + opacity: 1; - } - :deep(.el-table thead){ - color: black; + span { + width: 96px; + height: 0px; + border-bottom: 1px solid #498DF0; + opacity: 1; + cursor: pointer; } } - } + } - :deep(.el-form-item__label){ - text-align: left; - color: #000000; - } + .tableMessage { + padding: 36px 20px 20px; + font-size: 18px; - :deep(.el-form){ + .operation { display: flex; - flex-wrap: wrap; - justify-content: space-between; - margin: 0 auto; - width: 90%; - //align-content: flex-start; + justify-content: space-evenly; + + span { + border-bottom: 1px solid #000000; + opacity: 1; + cursor: pointer; + font-weight: 400; + } + } - :deep(.el-button){ - width: 159px; - height: 44px; - opacity: 1; - border-radius: 4px; - border: 1px solid #498DF0; - font-weight: 400; - color: #498DF0; + :deep(.el-table thead) { + color: black; } + } +} + +:deep(.el-form-item__label) { + text-align: left; + color: #000000; +} + +:deep(.el-form) { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + margin: 0 auto; + width: 90%; + //align-content: flex-start; +} + +:deep(.el-button) { + width: 159px; + height: 44px; + opacity: 1; + border-radius: 4px; + border: 1px solid #498DF0; + font-weight: 400; + color: #498DF0; +} </style> diff --git a/04.系统编码/Frontend/src/uilts/axios.ts b/04.系统编码/Frontend/src/uilts/axios.ts index a3de2a4..d69de39 100644 --- a/04.系统编码/Frontend/src/uilts/axios.ts +++ b/04.系统编码/Frontend/src/uilts/axios.ts @@ -10,6 +10,7 @@ const service = axios.create({ }) service.interceptors.request.use(config => { + loading = ElLoading.service({ customClass: 'loading', spinner: 'el-icon-loading',