瀏覽代碼

新增参数配置页面+登录页bug和回车事件

zxy 3 年之前
父節點
當前提交
67ca9c5b05
共有 2 個文件被更改,包括 250 次插入1 次删除
  1. 12 1
      light-application-ui/src/views/Login.vue
  2. 238 0
      light-application-ui/src/views/page/configManage.vue

+ 12 - 1
light-application-ui/src/views/Login.vue

@@ -2,7 +2,7 @@
     <div class='login' :style="'background-image:url(' + Background + ');'">
         <el-form ref='loginForm' :model='loginForm' :rules='loginRules' label-position='left' label-width='0px'
                  class='login-form'>
-            <h3 class='title'>轻应用后台管理</h3>
+            <h3 class='title'>轻应用工具后台管理</h3>
             <el-form-item prop='username'>
                 <el-input v-model='loginForm.username' type='text' auto-complete='off' placeholder='账号'>
                     <svg-icon slot='prefix' icon-class='user' class='el-input__icon input-icon' />
@@ -80,7 +80,18 @@ export default {
         };
     },
     created() {
+        //这里先清空认证信息
+        localStorage.clear();
+        sessionStorage.clear();
+        this.$store.commit('resetState');
+        this.$store.commit('resetHasRoutes');
         this.getCaptcha();
+        // 绑定enter按下事件
+        window.addEventListener('keydown', (e)=>{
+            if(e.key == 'Enter'){
+                this.submitForm('loginForm')
+            }
+        });
     },
     methods: {
         submitForm(formName) {

+ 238 - 0
light-application-ui/src/views/page/configManage.vue

@@ -0,0 +1,238 @@
+<template>
+    <div class='container'>
+        <div class='handle-box'>
+            <el-form :inline='true'>
+                <el-form-item>
+                    <el-input
+                        v-model='searchForm.remark'
+                        placeholder='请输入配置描述'
+                        clearable>
+                    </el-input>
+                </el-form-item>
+
+                <el-form-item>
+                    <el-button @click='loadData'>搜索</el-button>
+                </el-form-item>
+
+                <el-form-item>
+                    <el-button type='primary' @click='dialogVisible = true' v-if="hasAuth('sys:user:save')">新增
+                    </el-button>
+                </el-form-item>
+            </el-form>
+        </div>
+
+        <el-table
+            ref='noticeTable'
+            :data='tableData'
+            tooltip-effect='dark'
+            style='width: 100%'
+            border
+            stripe>
+
+            <el-table-column
+                type='index'
+                label='序号'
+                width='50'>
+            </el-table-column>
+
+            <el-table-column
+                prop='configKey'
+                label='配置key'>
+            </el-table-column>
+
+            <el-table-column
+                prop='configValue'
+                label='配置value'
+                :show-overflow-tooltip='true'>
+            </el-table-column>
+
+            <el-table-column
+                prop='remark'
+                label='配置描述'
+                :show-overflow-tooltip='true'>
+            </el-table-column>
+
+            <el-table-column
+                prop='createTime'
+                width='150'
+                label='创建时间'>
+            </el-table-column>
+
+            <el-table-column
+                prop='updateTime'
+                width='150'
+                label='修改时间'>
+            </el-table-column>
+
+            <el-table-column
+                prop='icon'
+                width='180px'
+                fixed='right'
+                label='操作'>
+                <template slot-scope='scope'>
+                    <el-button type='text' @click='editHandle(scope.row)'>编辑</el-button>
+                    <el-divider direction='vertical'></el-divider>
+                    <template>
+                        <el-popconfirm title='确定删除这条数据吗?' @confirm='delHandle(scope.row.id)'>
+                            <el-button type='text' slot='reference'>删除</el-button>
+                        </el-popconfirm>
+                    </template>
+                </template>
+            </el-table-column>
+
+        </el-table>
+
+        <el-pagination
+            @size-change='handleSizeChange'
+            @current-change='handleCurrentChange'
+            layout='total, sizes, prev, pager, next, jumper'
+            :page-sizes='[10, 20, 50, 100]'
+            :current-page='current'
+            :page-size='size'
+            :total='total'>
+        </el-pagination>
+
+
+        <!--新增对话框-->
+        <el-dialog
+            title='提示'
+            :visible.sync='dialogVisible'
+            width='60%'
+            :before-close='handleClose'>
+
+            <el-form :model='editForm' :rules='editFormRules' ref='editForm'>
+                <el-row>
+                    <el-col :span='12'>
+                        <el-form-item label='配置key:' prop='configKey' label-width='100px'>
+                            <el-input v-model='editForm.configKey' autocomplete='off' placeholder='请输入配置key'></el-input>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span='12'>
+                        <el-form-item label='配置value:' prop='configValue' label-width='100px'>
+                            <el-input v-model='editForm.configValue' autocomplete='off'
+                                      placeholder='请输入配置value'></el-input>
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+                <el-row>
+                    <el-col :span='24'>
+                        <el-form-item label='配置描述:' prop='remark' label-width='100px'>
+                            <el-input type='textarea' rows='3' v-model='editForm.remark'
+                                      autocomplete='off'
+                                      placeholder='请输入配置描述'></el-input>
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+            </el-form>
+            <div slot='footer' class='dialog-footer'>
+                <el-button @click="resetForm('editForm')">取 消</el-button>
+                <el-button type='primary' @click="submitForm('editForm')">确 定</el-button>
+            </div>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+
+export default {
+    name: 'configManage',
+    data() {
+        return {
+            searchForm: {
+                title: ''
+            },
+            delBtlStatu: true,
+            total: 0,
+            size: 10,
+            current: 1,
+            dialogVisible: false,
+            editForm: {
+                configKey: '',
+                configValue: '',
+                remark: ''
+            },
+            tableData: [],
+            editFormRules: {
+                configKey: [
+                    { required: true, message: '请输入配置key', trigger: 'blur' }
+                ],
+                configValue: [
+                    { required: true, message: '请输入配置value', trigger: 'blur' }
+                ]
+            }
+        };
+    },
+    created() {
+        this.loadData();
+    },
+    methods: {
+        loadData() {
+            this.$axios.get('/api/config/list', {
+                params: {
+                    remark: this.searchForm.remark,
+                    current: this.current,
+                    size: this.size
+                }
+            }).then(res => {
+                this.tableData = res.data.data.records;
+                this.size = res.data.data.size;
+                this.current = res.data.data.current;
+                this.total = res.data.data.total;
+            });
+        },
+        handleClose() {
+            this.resetForm('editForm');
+        },
+        resetForm(formName) {
+            this.$refs[formName].resetFields();
+            this.dialogVisible = false;
+            this.editForm = {};
+        },
+        submitForm(formName) {
+            let _this = this;
+            this.$refs[formName].validate((valid) => {
+                if (valid) {
+                    _this.$axios.post('/api/config/' + (_this.editForm.id ? 'updateBean' : 'addBean'), _this.editForm)
+                        .then(res => {
+                            _this.loadData();
+                            _this.$notify({
+                                showClose: true,
+                                message: '恭喜你,操作成功',
+                                type: 'success'
+                            });
+                            _this.resetForm(formName);
+                        });
+                } else {
+                    return false;
+                }
+            });
+        },
+        editHandle(row) {
+            this.editForm = JSON.parse(JSON.stringify(row));
+            this.dialogVisible = true;
+        },
+        delHandle(id) {
+            this.$axios.post('/api/config/deleteById?id=' + id).then(res => {
+                this.$notify({
+                    showClose: true,
+                    message: '恭喜你,操作成功',
+                    type: 'success'
+                });
+                this.loadData();
+            });
+        },
+        handleSizeChange(val) {
+            this.size = val;
+            this.loadData();
+        },
+        handleCurrentChange(val) {
+            this.current = val;
+            this.loadData();
+        }
+    }
+};
+</script>
+
+<style scoped>
+
+</style>