Browse Source

参数管理提交

MSY 3 years ago
parent
commit
ca3ab0835e
6 changed files with 441 additions and 50 deletions
  1. 24 21
      index.html
  2. 34 26
      src/router/index.js
  3. 11 1
      src/views/Home.vue
  4. 1 1
      src/views/Login.vue
  5. 370 0
      src/views/manager/paramMagager.vue
  6. 1 1
      src/views/sys/user.vue

+ 24 - 21
index.html

@@ -1,24 +1,27 @@
 <!DOCTYPE html>
 <html>
-  <head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <!-- 页面进入清除强制缓存 -->
-    <meta http-equiv="Pragma" content="no-cache">
-    <meta http-equiv="Cache-Control" content="no-cache">
-    <meta http-equiv="Expires"  content="0">
-    <!-- <meta name="viewport" content="width=device-width,initial-scale=1.0"> -->
-    <!-- <meta content="width=device-width,user-scalable=no" name="viewport"> -->
-    <title>全国收费公路通行费电子发票服务平台</title>
 
-  </head>
-  <body>
-    <div id="app"></div>
-    <!-- built files will be auto injected -->
-    <script src="https://s1.pstatp.com/cdn/expire-1-M/axios/0.18.0/axios.min.js"></script>
-    <script src="https://s0.pstatp.com/cdn/expire-1-M/vue/2.5.16/vue.min.js"></script>
-    <script src="https://s1.pstatp.com/cdn/expire-1-M/vue-router/3.0.1/vue-router.min.js"></script>
-    <script src="https://s1.pstatp.com/cdn/expire-1-M/element-ui/2.8.2/index.js"></script>
-    <script src="https://s3.pstatp.com/cdn/expire-1-M/moment.js/2.24.0/moment.min.js"></script>
-  </body>
-</html>
+<head>
+  <meta charset="utf-8">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <!-- 页面进入清除强制缓存 -->
+  <meta http-equiv="Pragma" content="no-cache">
+  <meta http-equiv="Cache-Control" content="no-cache">
+  <meta http-equiv="Expires" content="0">
+  <!-- <meta name="viewport" content="width=device-width,initial-scale=1.0"> -->
+  <!-- <meta content="width=device-width,user-scalable=no" name="viewport"> -->
+  <title>全国收费公路通行费电子发票后台管理系统</title>
+
+</head>
+
+<body>
+  <div id="app"></div>
+  <!-- built files will be auto injected -->
+  <script src="https://s1.pstatp.com/cdn/expire-1-M/axios/0.18.0/axios.min.js"></script>
+  <script src="https://s0.pstatp.com/cdn/expire-1-M/vue/2.5.16/vue.min.js"></script>
+  <script src="https://s1.pstatp.com/cdn/expire-1-M/vue-router/3.0.1/vue-router.min.js"></script>
+  <script src="https://s1.pstatp.com/cdn/expire-1-M/element-ui/2.8.2/index.js"></script>
+  <script src="https://s3.pstatp.com/cdn/expire-1-M/moment.js/2.24.0/moment.min.js"></script>
+</body>
+
+</html>

+ 34 - 26
src/router/index.js

@@ -1,32 +1,36 @@
 import Vue from 'vue';
 import Router from 'vue-router';
 
+import { Message } from 'element-ui';
+
 const Login = () => import('@/views/Login');
 const Home = () => import('@/views/Home');
 // 首页
 const Main = () => import('@/views/main/main');
 // 个人中心
 const Customer = () => import('@/views/customer/Customer');
-const CustomerRecharge  = () => import('@/views/customer/customerRecharge');
-const custRecTime  = () => import('@/views/customer/custRecTime');
+const CustomerRecharge = () => import('@/views/customer/customerRecharge');
+const custRecTime = () => import('@/views/customer/custRecTime');
 // 系统管理部分
 const User = () => import('@/views/sys/user');
 
-//无车部分
+// 无车部分
 const nocarRec = () => import('@/views/noCar/nocarRec.vue');
 const billway = () => import('@/views/noCar/billway.vue');
 const nocarInvoice = () => import('@/views/noCar/invoice.vue');
 const billwayException = () => import('@/views/noCar/billwayException.vue');
 const noCarCalculateInfo = () => import('@/views/noCar/calculateInfo.vue');
 const hcInvoice = () => import('@/views/noCar/hcInvoice.vue');
-//自有车部分
+// 自有车部分
 
 const selfcarRec = () => import('@/views/selfCar/selfcarRec.vue');
 const selfCarTrade = () => import('@/views/selfCar/selfCarTrade.vue');
 const selfInvoice = () => import('@/views/selfCar/invoice.vue');
 const selfCarTradeException = () => import('@/views/selfCar/selfCarTradeException.vue');
 const SelfCalculateInfo = () => import('@/views/selfCar/calculateInfo.vue');
-import { Message } from 'element-ui';
+
+// 参数管理
+const paramMagager = () => import('@/views/manager/paramMagager.vue');
 
 Vue.use(Router);
 
@@ -34,33 +38,37 @@ const router = new Router({
   base: '/jkcredit/',
   mode: 'history',
   routes: [
-    {name: 'Login', path: '/login', component: Login},
-    {name: 'Home',
+    { name: 'Login', path: '/login', component: Login },
+    {
+      name: 'Home',
       path: '/',
       component: Home,
       redirect: '/main',
-      children:[
+      children: [
         // 首页
-        {name: 'Main', path: '/main',component: Main},
-        //客户管理
-        {name: 'Customer', path: '/customer',component: Customer},
-        {name: 'customerRecharge', path: '/CustomerRecharge',component: CustomerRecharge},
-        {name: 'custRecTime', path: '/custRecTime',component: custRecTime},
+        { name: 'Main', path: '/main', component: Main },
+        // 客户管理
+        { name: 'Customer', path: '/customer', component: Customer },
+        { name: 'customerRecharge', path: '/CustomerRecharge', component: CustomerRecharge },
+        { name: 'custRecTime', path: '/custRecTime', component: custRecTime },
         // 系统管理部分
-        {name: 'User', path: '/user', component: User},
+        { name: 'User', path: '/user', component: User },
         // 无车部分
-        {name: 'nocarRec', path: '/nocarRec', component: nocarRec},
-        {name: 'billway', path: '/billway', component: billway},
-        {name: 'nocarInvoice', path: '/nocarInvoice', component: nocarInvoice},
-        {name: 'billwayException', path: '/billwayException', component: billwayException},
-        {name: 'noCarCalculateInfo', path: '/noCarCalculateInfo', component: noCarCalculateInfo},
-        {name: 'hcInvoice', path: '/hcInvoice', component: hcInvoice},
-        //自有车部分
-        {name: 'selfcarRec', path: '/selfcarRec', component: selfcarRec},
-        {name: 'selfInvoice', path: '/selfInvoice', component: selfInvoice},
-        {name: 'selfCarTrade', path: '/selfCarTrade', component: selfCarTrade},
-        {name: 'selfCarTradeException', path: '/selfCarTradeException', component: selfCarTradeException},
-        {name: 'SelfCalculateInfo', path: '/SelfCalculateInfo', component: SelfCalculateInfo}
+        { name: 'nocarRec', path: '/nocarRec', component: nocarRec },
+        { name: 'billway', path: '/billway', component: billway },
+        { name: 'nocarInvoice', path: '/nocarInvoice', component: nocarInvoice },
+        { name: 'billwayException', path: '/billwayException', component: billwayException },
+        { name: 'noCarCalculateInfo', path: '/noCarCalculateInfo', component: noCarCalculateInfo },
+        { name: 'hcInvoice', path: '/hcInvoice', component: hcInvoice },
+        // 自有车部分
+        { name: 'selfcarRec', path: '/selfcarRec', component: selfcarRec },
+        { name: 'selfInvoice', path: '/selfInvoice', component: selfInvoice },
+        { name: 'selfCarTrade', path: '/selfCarTrade', component: selfCarTrade },
+        { name: 'selfCarTradeException', path: '/selfCarTradeException', component: selfCarTradeException },
+        { name: 'SelfCalculateInfo', path: '/SelfCalculateInfo', component: SelfCalculateInfo },
+
+        // 参数管理
+        { name: 'paramMagager', path: '/paramMagager', component: paramMagager }
       ]
     }
   ]

+ 11 - 1
src/views/Home.vue

@@ -5,7 +5,7 @@
         <div>
           <div class="logo">
 <!--            <img src="../assets/image/logo.jpg">-->
-            <h3>全国收费公路通行费电子发票服务平台</h3>
+            <h3>全国收费公路通行费电子发票后台管理系统</h3>
           </div>
 
           <div class="message">
@@ -238,6 +238,16 @@ export default {
               authName:"无车计费查询"
             }
           ]
+         },{
+          id: 7,
+          authName:"参数管理",
+          children:[
+            {
+              id:1,
+              path:"paramMagager",
+              authName:"参数管理"
+            }
+          ]
          }
       ],
       roleId: '',

+ 1 - 1
src/views/Login.vue

@@ -4,7 +4,7 @@
     <!-- <div>
     </div> -->
     <div>
-      <h1>全国收费公路通行费电子发票服务平台</h1>
+      <h1>全国收费公路通行费电子发票后台管理系统</h1>
     </div>
     <div class="login">
       <div class="record">

+ 370 - 0
src/views/manager/paramMagager.vue

@@ -0,0 +1,370 @@
+<template>
+  <div class="system-paramMagager">
+    <!-- 头部细节部分 -->
+      <div class="title">
+        <el-row>
+          <el-col :span="24">
+            <div class="top">
+              <el-input  placeholder="参数名称" class="input-demo" v-model="paramName"></el-input>
+              <el-input  placeholder="参数值" class="input-demo" v-model="paramValue"></el-input>
+              <el-input  placeholder="备注信息" class="input-demo" v-model="paramNote"></el-input>
+               <el-button type="success" style="margin-left: 1%;" @click="queryLook">查询</el-button>
+                <el-button type="success" style="margin-left: 1%;" @click="addParamList = true">添加</el-button>
+                <el-button type="primary" style="margin-left: 1%;" @click="exportExcel">导出报表</el-button>
+
+            </div>
+          </el-col>
+        </el-row>
+      </div>
+    <!-- 头部细节部分结束 -->
+    <!-- 表格部分 -->
+      <template>
+        <el-table
+         class="table"
+          v-loading="loading"
+          ref="multipleTable"
+          :data="usertable"
+           height="370px"
+          border
+          tooltip-effect="dark">
+          <el-table-column
+            label="参数名称"
+            prop="paramName"
+            show-overflow-tooltip>
+          </el-table-column>
+           <el-table-column
+            prop="paramValue"
+            label="参数值"
+            show-overflow-tooltip>
+          </el-table-column>
+          <el-table-column
+            prop="paramNote"
+            label="备注信息"
+            show-overflow-tooltip>
+          </el-table-column>
+            <el-table-column
+            label="操作"
+            width="280">
+            <template slot-scope="scope" show-overflow-tooltip>
+              <el-link style="cursor:pointer;color: blue;" @click="openChange(scope.row)">修改</el-link>
+            </template>
+          </el-table-column>
+        </el-table>
+      </template>
+
+    <!-- 分页 -->
+      <div class="block">
+        <el-pagination
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+        :current-page="current"
+        :page-sizes="[6, 8, 10, 20, 50 ,100]"
+        :page-size="pagesize"
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="total">
+        </el-pagination>
+      </div>
+
+
+
+       <!-- 新增参数 -->
+      <el-dialog
+        @close="handleEditDialogClose"
+        :visible.sync="addParamList"
+        style="font-size: 0px;">
+        <div class="tou">参数--添加</div>
+        <div class="line"></div>
+        <el-form
+          label-position="right"
+          label-width="80px"
+          :rules="rules"
+          ref="ruleForm"
+          :model="formParamList">
+          <el-form-item label="参数名称" prop="paramName">
+            <el-input v-model="formParamList.paramName" auto-complete="off" placeholder="请输入参数名称"></el-input>
+          </el-form-item>
+
+          <el-form-item label="参数值" prop="paramValue">
+            <el-input v-model="formParamList.paramValue" auto-complete="off" placeholder="请输入参数值"></el-input>
+          </el-form-item>
+
+          <el-form-item label="备注信息" prop="paramNote">
+            <el-input v-model="formParamList.paramNote" auto-complete="off" placeholder="请输入备注信息"></el-input>
+          </el-form-item>
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+          <el-button @click="addParamList = false" type="info">取 消</el-button>
+          <el-button type="primary" @click="addData('ruleForm')">新 增</el-button>
+        </div>
+      </el-dialog>
+
+
+         <!-- 修改参数 -->
+      <el-dialog
+        @close="handleEditDialogClose"
+        :visible.sync="changeParam"
+        style="font-size: 0px;">
+        <div class="tou">参数--修改</div>
+        <div class="line"></div>
+        <el-form
+          label-position="right"
+          label-width="80px"
+          :model="formParamList">
+
+          <el-form-item label="参数名称">
+            <el-input v-model="formParamList.paramName" auto-complete="off" placeholder="请输入参数名称"></el-input>
+          </el-form-item>
+          <el-form-item label="参数值">
+            <el-input v-model="formParamList.paramValue" auto-complete="off" placeholder="请输入参数值"></el-input>
+          </el-form-item>
+          <el-form-item label="备注信息">
+            <el-input v-model="formParamList.paramNote" auto-complete="off" placeholder="请输入备注信息"></el-input>
+          </el-form-item>
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+          <el-button @click="changeParam = false" type="info">取 消</el-button>
+          <el-button type="primary" @click="changeData">修 改</el-button>
+        </div>
+      </el-dialog>
+
+  </div>
+</template>
+
+<script type="text/javascript">
+import axios from 'axios';
+import FileSaver from "file-saver";
+import XLSX from "xlsx";
+export default{
+  data() {
+    return {
+      loading: true,
+      rules: {
+          paramName: [
+            { required: true, message: '请输入参数名称', trigger: 'blur' },
+            { min: 3, max: 15, message: '长度在 3 到 15 个字符', trigger: 'blur' }
+          ],
+          paramValue: [
+            { required: true, message: '请输入参数值', trigger: 'blur' },
+            { min: 1, max: 16, message: '长度在 1 到 16 个字符', trigger: 'blur' }
+          ],
+          paramNote: [
+            { required: true, message: '请输入备注信息', trigger: 'blur' },
+            { min: 2, max: 15, message: '长度在 2 到 15 个字符', trigger: 'blur' }
+          ]
+        },
+      paramName: '',
+      paramValue: '',
+      paramNote: '',
+      current: 1,
+      pagesize: 8,
+      formParamList: {
+        "paramName":"",
+        "paramValue": "",
+        "id":"",
+        "paramNote": ""
+      },
+      // 总共有多少条数据
+      total: 0,
+      addParamList: false,
+      changeParam: false,
+    }
+  },
+  created() {
+    this.loadData();
+  },
+  methods: {
+
+    // 列表展示
+    async loadData() {
+      const formData = new FormData();
+      formData.append('current', this.current);
+      formData.append('size', this.pagesize);
+      const response = await this.$http.post(`param/page`, formData);
+      if (response.data.code === 0) {
+        this.loading = false;
+        this.usertable = response.data.data.records;
+        this.total = response.data.data.total;
+      }
+    },
+    //查询
+    async queryLook() {
+      const formData = new FormData();
+      formData.append('current', this.current);
+      formData.append('size', this.pagesize);
+      formData.append('paramName', this.paramName);
+      formData.append('paramValue', this.paramValue);
+      formData.append('paramNote', this.paramNote);
+      const response = await this.$http.post(`param/page`, formData);
+      if (response.data.code === 0) {
+        this.loading = false;
+        this.usertable = response.data.data.records;
+        this.total = response.data.data.total;
+      }
+    },
+    // 新增参数
+    addData(formName) {
+      this.$refs[formName].validate(async (valid) => {
+        if(valid) {
+          const response = await this.$http.post(`param`, this.formParamList);
+          if(response.data.code === 0) {
+            this.loadData();
+            this.addParamList = false;
+            this.$message({
+              type: 'success',
+              message: '添加成功'
+            });
+          }else {
+            this.$message({
+              type: 'error',
+              message: '添加失败'
+            });
+          }
+        }else {
+          this.$message.error('请查看是否有选项未填写或填错项');
+          return false;
+        }
+      })
+    },
+    // 打开修改并赋予信息
+    openChange(param) {
+      this.changeParam = true;
+      this.formParamList.paramName = param.paramName;
+      this.formParamList.id = param.id;
+      this.formParamList.paramValue = param.paramValue;
+      this.formParamList.paramNote = param.paramNote;
+    },
+    // 修改参数
+  async  changeData() {
+      const response = await this.$http.post(`param/updateParam`, this.formParamList);
+      if(response.data.code === 0) {
+        this.loadData();
+        this.changeParam = false;
+        this.$message({
+          type: 'success',
+          message: '修改成功'
+        });
+      }else {
+        this.$message({
+          type: 'error',
+          message: '修改失败'
+        });
+        }
+    },
+
+    // 清空表单数据
+    handleEditDialogClose() {
+      for (var key in this.formParamList) {
+        this.formParamList[key] = '';
+      };
+      this.current = 1;
+      this.pagesize = 8;
+    },
+    // 分页方法
+    handleSizeChange(val) {
+      this.pagesize = val;
+      if(this.userName !== '' || this.company !== '') {
+        this.queryLook();
+      }else{
+        this.loadData();
+      };
+      console.log(`每页 ${val} 条`);
+    },
+    handleCurrentChange(val) {
+      this.current = val;
+      if(this.userName !== '' || this.company !== '') {
+        this.queryLook();
+      }else{
+        this.loadData();
+      };
+      console.log(`当前页: ${val}`);
+    },
+        // 导出表格所用
+    exportExcel() {
+      // 设置当前日期
+      let time = new Date();
+      //console.log(time);
+      let year = time.getFullYear();
+      let month = time.getMonth() + 1;
+      let day = time.getDate();
+      let name = "用户列表_"+year + "" + month + "" + day;
+      // console.log(name)
+      /* generate workbook object from table */
+      //  .table要导出的是哪一个表格
+      var wb = XLSX.utils.table_to_book(document.querySelector(".table"));
+      /* get binary string as output */
+      var wbout = XLSX.write(wb, {
+        bookType: "xlsx",
+        bookSST: true,
+        type: "array"
+      });
+      try {
+        //  name+'.xlsx'表示导出的excel表格名字
+        FileSaver.saveAs(
+          new Blob([wbout], { type: "application/octet-stream" }),
+          name + ".xlsx"
+        );
+      } catch (e) {
+        if (typeof console !== "undefined") console.log(e, wbout);
+      }
+      return wbout;
+    },
+
+  }
+};
+</script>
+
+<style>
+.system-paramMagager {
+  border: 1px solid #d9d9d9;
+  border-radius: 10px;
+}
+.system-paramMagager .title {
+  font-size: 5px;
+  margin-bottom: 20px;
+}
+.system-paramMagager .top {
+  padding-top: 20px;
+  padding-left: 20px;
+}
+.system-paramMagager .text {
+  display: inline-block;
+  color: #000;
+  font-size: 16px ;
+  margin-left: 1%;
+}
+.system-paramMagager .input-demo {
+  display: inline-block;
+  width: 20%;
+  margin-left: 1%;
+}
+.system-paramMagager .block {
+  font-size: 5px;
+  text-align: center;
+  margin-top: 25px;
+  margin-bottom: 25px;
+}
+.system-paramMagager .el-dialog {
+  width: 60%;
+}
+.system-paramMagager .el-dialog__header, .el-dialog__body {
+  padding: 0 20px;
+}
+.system-paramMagager .tou {
+  font-size: 20px;
+  height: 30px;
+  line-height: 30px;
+  padding-top: 15px;
+}
+.system-paramMagager .line {
+  margin-top: 15px;
+  margin-bottom: 15px;
+  width: 100%;
+  height: 2px;
+  background-color: #d9d9d9;
+}
+.system-paramMagager .xinxi {
+  text-align: center;
+  margin: 15px auto;
+  font-size: 18px;
+}
+</style>

+ 1 - 1
src/views/sys/user.vue

@@ -526,7 +526,7 @@ export default{
     // 修改用户
     async changeData() {
       this.formUserList.price = this.formUserList.price * 100;
-      const response = await this.$http.put(`user`, this.formUserList);
+      const response = await this.$http.post(`user/updateUser`, this.formUserList);
       if(response.data.code === 0) {
         this.loadData();
         this.changeUser = false;