vbea 3 лет назад
Родитель
Сommit
88af89568f

+ 27 - 0
Strides-Admin/src/http/api/rfid.js

@@ -0,0 +1,27 @@
+import { get, post, download } from '../http'
+
+const rfid = {
+  getCardTypeList() {
+    return get('rfid/card/type')
+  },
+  getRfidUserList(email) {
+    return get('rfid/user', {email})
+  },
+  getRfidPages(params) {
+    return post('rfid/pages', params)
+  },
+  addRfidCard(params) {
+    return post('rfid/add', params)
+  },
+  updateRfidCard(params) {
+    return post('rfid/update', params)
+  },
+  viewRfidCard(params) {
+    return get('rfid/detail', params)
+  },
+  deleteRfidCard(params) {
+    return get('rfid/logical/delete', params)
+  }
+}
+
+export default rfid

+ 3 - 0
Strides-Admin/src/icons/svg/rfid-card-active.svg

@@ -0,0 +1,3 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M7 12C9.2 12 11 10.2 11 8C11 5.8 9.2 4 7 4C4.8 4 3 5.8 3 8C3 10.2 4.8 12 7 12ZM11 20V14.7C9.9 14.3 8.5 14 7 14C3.1 14 0 15.8 0 18V20H11ZM22 4H15C13.9 4 13 4.9 13 6V18C13 19.1 13.9 20 15 20H22C23.1 20 24 19.1 24 18V6C24 4.9 23.1 4 22 4ZM18 18H16V6H18V18Z" fill="white"/>
+</svg>

+ 3 - 0
Strides-Admin/src/icons/svg/rfid-card.svg

@@ -0,0 +1,3 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M7 12C9.2 12 11 10.2 11 8C11 5.8 9.2 4 7 4C4.8 4 3 5.8 3 8C3 10.2 4.8 12 7 12ZM11 20V14.7C9.9 14.3 8.5 14 7 14C3.1 14 0 15.8 0 18V20H11ZM22 4H15C13.9 4 13 4.9 13 6V18C13 19.1 13.9 20 15 20H22C23.1 20 24 19.1 24 18V6C24 4.9 23.1 4 22 4ZM18 18H16V6H18V18Z" fill="black"/>
+</svg>

+ 44 - 0
Strides-Admin/src/router/PosRouter.js

@@ -0,0 +1,44 @@
+import Layout from '@/layout'
+
+export default {
+  path: '/pos-device',
+  component: Layout,
+  meta: {
+    title: 'POS Device Management',
+    icon: 'pos-device',
+    activeIcon: 'pos-device-active',
+    affix: true
+  },
+  children: [
+    {
+      path: '/pos-device',
+      component: () => import('@/views/posDevice/index'),
+      name: 'pos-device-index',
+      meta: {
+        title: 'POS Device Management',
+        icon: 'pos-device',
+        activeIcon: 'pos-device-active',
+        breadcrumb: false,
+        additional: true
+      }
+    },
+    {
+      path: '/pos-device/add',
+      component: () => import('@/views/posDevice/detail'),
+      name: 'pos-device-add',
+      meta: {
+        title: 'Add Device',
+        activeMenu: '/pos-device'
+      }
+    },
+    {
+      path: '/pos-device/:deviceId',
+      component: () => import('@/views/posDevice/detail'),
+      name: 'pos-device-edit',
+      meta: {
+        title: 'Edit Device',
+        activeMenu: '/pos-device'
+      }
+    }
+  ]
+}

+ 44 - 0
Strides-Admin/src/router/RfidRouter.js

@@ -0,0 +1,44 @@
+import Layout from '@/layout'
+
+export default {
+  path: '/rfid-management',
+  component: Layout,
+  meta: {
+    title: 'RFID Card Management',
+    icon: 'rfid-card',
+    activeIcon: 'rfid-card-active',
+    affix: true
+  },
+  children: [
+    {
+      path: '/rfid-management',
+      component: () => import('@/views/rfid/index'),
+      name: 'rfid-management-index',
+      meta: {
+        title: 'RFID Card Management',
+        icon: 'rfid-card',
+        activeIcon: 'rfid-card-active',
+        breadcrumb: false,
+        additional: true
+      }
+    },
+    {
+      path: '/rfid-management/add',
+      component: () => import('@/views/rfid/detail'),
+      name: 'rfid-management-add',
+      meta: {
+        title: 'Add User',
+        activeMenu: '/rfid-management'
+      }
+    },
+    {
+      path: '/rfid-management/:id',
+      component: () => import('@/views/rfid/detail'),
+      name: 'rfid-management-edit',
+      meta: {
+        title: 'Edit User',
+        activeMenu: '/rfid-management'
+      }
+    }
+  ]
+}

+ 25 - 4
Strides-Admin/src/router/UserRouter.js

@@ -15,11 +15,32 @@ export default {
       name: 'user-management',
       hidden: true,
       meta: {
-        breadcrumb: false,
-        title: 'User Management',
-        icon: 'user-management',
-        activeIcon: 'user-management-active',
+        title: 'Public User',
+        icon: 'sidebar-submenu-item',
+        activeIcon: 'sidebar-submenu-item-active',
+      },
+    },
+    {
+      path: '/driver',
+      component: () => import('@/views/driver/index'),
+      name: 'DriverList',
+      meta: {
+        title: 'PH Driver',
+        icon: 'sidebar-submenu-item',
+        activeIcon: 'sidebar-submenu-item-active',
+      },
+      hidden: true
+    },
+    {
+      path: '/driver/driver-detail',
+      component: () => import('@/views/driver/DriverDetail'),
+      name: 'DriverDetail',
+      meta: {
+        title: 'Driver Detail',
+        breadcrumb: true,
+        activeMenu: '/driver'
       },
+      hidden: true
     },
     {
       path: 'add-user',

+ 5 - 43
Strides-Admin/src/router/index.js

@@ -13,6 +13,8 @@ import driver from './driver'
 import fleetCompanyRoute from './fleetCompany'
 import CreditLimit from './CreditLimit'
 import FinancialRouter from './FinancialRouter'
+import PosRouter from './PosRouter'
+import RfidRouter from './RfidRouter'
 
 Vue.use(VueRouter)
 
@@ -124,7 +126,7 @@ const constantRoutes = [
   ChargingProfile,
   FinancialRouter,
   UserRouter,
-  driver,
+  //driver,
   {
     path: '/feedback-management',
     component: Layout,
@@ -218,48 +220,8 @@ const constantRoutes = [
   ProviderRouter,
   fleetCompanyRoute,
   CreditLimit,
-  {
-    path: '/pos-device',
-    component: Layout,
-    meta: {
-      title: 'POS Device Management',
-      icon: 'pos-device',
-      activeIcon: 'pos-device-active',
-      affix: true
-    },
-    children: [
-      {
-        path: '/pos-device',
-        component: () => import('@/views/posDevice/index'),
-        name: 'pos-device-index',
-        meta: {
-          title: 'POS Device Management',
-          icon: 'pos-device',
-          activeIcon: 'pos-device-active',
-          breadcrumb: false,
-          additional: true
-        }
-      },
-      {
-        path: '/pos-device/add',
-        component: () => import('@/views/posDevice/detail'),
-        name: 'pos-device-add',
-        meta: {
-          title: 'Add Device',
-          activeMenu: '/pos-device'
-        }
-      },
-      {
-        path: '/pos-device/:deviceId',
-        component: () => import('@/views/posDevice/detail'),
-        name: 'pos-device-edit',
-        meta: {
-          title: 'Edit Device',
-          activeMenu: '/pos-device'
-        }
-      }
-    ]
-  },
+  PosRouter,
+  RfidRouter
   /*OCPI*/
 ]
 

+ 1 - 1
Strides-Admin/src/views/charging/components/DialogClearProfiles.vue

@@ -188,7 +188,7 @@ export default {
         this.hideDialog(true);
         this.loading = false;
         if (res.data.taskId) {
-          this.$openRoute("/ocpp-operations/result/" + res.data.taskId, true);
+          this.$openRoute("/ocpp-operations/result/" + res.data.taskId);
           //this.$router.push({path: '/ocpp-operations/result/' + res.data.taskId});
         }
       }).catch(err => {

+ 1 - 1
Strides-Admin/src/views/charging/components/DialogSetProfiles.vue

@@ -130,7 +130,7 @@ export default {
         this.hideDialog(true);
         this.loading = false;
         if (res.data.taskId) {
-          this.$openRoute("/ocpp-operations/result/" + res.data.taskId, true);
+          this.$openRoute("/ocpp-operations/result/" + res.data.taskId);
           //this.$router.push({path: '/ocpp-operations/result/' + res.data.taskId});
         }
       }).catch(err => {

+ 330 - 0
Strides-Admin/src/views/rfid/detail.vue

@@ -0,0 +1,330 @@
+<template>
+  <div class="card-container">
+    <el-form
+      :model="form"
+      :rules="rule"
+      v-loading="loading"
+      ref="addForm"
+      label-position="right"
+      label-width="130px">
+      <div class="card-content">
+        <div class="section-title">RFID CARD DETAILS</div>
+        <el-form-item
+          label="RFID number:"
+          prop="rfidNumber">
+          <el-input
+            class="add-text"
+            v-model="form.rfidNumber"
+            placeholder="Add text"
+            maxlength="20"/>
+        </el-form-item>
+        <el-form-item
+          label="Email Address:"
+          prop="email">
+          <el-select
+            class="add-text"
+            v-model="form.email"
+            filterable
+            remote
+            :remote-method="filterEmail"
+            placeholder="Search with user email"
+            @change="changeEmail">
+            <el-option
+              v-for="(item, index) in userList"
+              :key="index"
+              :label="item.email"
+              :value="item"/>
+          </el-select>
+        </el-form-item>
+        <el-form-item
+          label="User Name:"
+          v-if="form.userName">
+          <span>{{form.userName}}</span>
+        </el-form-item>
+        <el-form-item
+          label="User Contact No:"
+          v-if="form.phone">
+          <span>{{form.phone}}</span>
+        </el-form-item>
+        <el-form-item
+          label="User Type:"
+          v-if="form.userType">
+          <span>{{form.userType}}</span>
+        </el-form-item>
+        <el-form-item
+          label="Fleet (If any):"
+          v-if="form.fleet">
+          <span>{{form.fleet}}</span>
+        </el-form-item>
+        <el-form-item
+          label="Card Type:"
+          prop="cardType">
+          <el-select
+            class="add-text"
+            v-model="form.cardType"
+            placeholder="Select">
+            <el-option
+              v-for="(item, index) in cardTypeOptions"
+              :key="index"
+              :label="item"
+              :value="item"/>
+          </el-select>
+        </el-form-item>
+        <el-form-item
+          label="Valid Till:"
+          prop="validTill">
+          <el-date-picker
+            class="add-text"
+            v-model="form.validTill"
+            type="date"
+            format="yyyy-MM-dd"
+            value-format="yyyy-MM-dd"
+            placeholder="Select date"/>
+        </el-form-item>
+      </div>
+      <div class="card-content flexcr">
+        <div class="buttons">
+          <el-button
+            type="primary"
+            class="cancel-button"
+            @click="handleClickCancleButton">
+            Cancel
+          </el-button>
+          <el-button
+            style="margin-left: 20px;"
+            type="primary"
+            native-type="submit"
+            @click="handleClickSaveButton">
+            Save
+          </el-button>
+        </div>
+        <div
+          class="update-by"
+          v-if="isEdit">
+          <span
+            class="add-text"
+            :title='"CREATED BY " + form.createdBy + " ON " + form.createdOn'>
+            LAST UPDATED BY {{form.updatedBy}} TIMESTAMP: {{form.updatedOn}}
+          </span>
+        </div>
+      </div>
+    </el-form>
+  </div>
+</template>
+
+<script>
+import api from '../../http/api/rfid.js'
+export default {
+  data() {
+    return {
+      loading: false,
+      showProvider: false,
+      form: {
+        userPk: "",
+        rfidNumber: '',
+        email: '',
+        validTill: '',
+        cardType: []
+      },
+      rule: {
+        rfidNumber: [{
+          required: true,
+          trigger: 'blur',
+          message: 'Please input RFID number'
+        },{
+          pattern: /^\d{1,}$/,
+          trigger: 'blur',
+          message: 'Please type a number'
+        }],
+        email: {
+          required: true,
+          trigger: 'change',
+          message: 'Please input user email address'
+        }
+      },
+      userList: [],
+      cardTypeOptions: [],
+      isEdit: false
+    }
+  },
+  async created() {
+    this.loading = true;
+    this.getCardTypeOptions();
+    if (this.$route.params.id) {
+      this.isEdit = true;
+      await this.getCardDetails(this.$route.params.id)
+    } else {
+      
+    }
+  },
+  methods: {
+    filterEmail(email) {
+      api.getRfidUserList(email).then(res => {
+        if (res.data) {
+          this.userList = res.data
+        }
+      }).catch(err => {
+        this.userList = []
+      })
+    },
+    changeEmail(email) {
+      console.log(email);
+      this.form.email = email.email
+      this.form.userPk = email.userPk
+    },
+    getCardTypeOptions() {
+      api.getCardTypeList().then(res => {
+        if (res.data) {
+          this.cardTypeOptions = res.data
+        }
+      }).finally(() => {
+        this.loading = false;
+      })
+    },
+    getCardDetails(id) {
+      api.viewRfidCard({
+        ocppTagPk: id
+      }).then(res => {
+        if (res.data) {
+          this.form = res.data
+        }
+      }).catch(err => {
+        this.$message({
+          message: err,
+          type: 'error'
+        })
+      });
+    },
+    addRfidCard() {
+      this.loading = true;
+      api.addRfidCard(this.form).then(res => {
+        this.loading = false;
+        this.$message({
+          message: 'Add user successfully!',
+          type: 'success'
+        });
+        setTimeout(() => {
+          this.handleClickCancleButton()
+        }, 500);
+      }).catch(err => {
+        this.loading = false;
+        this.$message({
+          message: err,
+          type: 'error'
+        })
+      });
+    },
+    editRfidCard() {
+      this.loading = true;
+      api.updateRfidCard(this.form).then(res => {
+        this.loading = false;
+        this.$message({
+          message: 'Update user successfully!',
+          type: 'success'
+        });
+        setTimeout(() => {
+          this.handleClickCancleButton()
+        }, 500);
+      }).catch(err => {
+        this.loading = false;
+        this.$message({
+          message: err,
+          type: 'error'
+        })
+      });
+    },
+    handleClickCancleButton() {
+      this.$router.push({path: '/rfid-management'});
+    },
+    handleClickSaveButton() {
+      this.$refs['addForm'].validate(result => {
+        if (result) {
+          if (this.isEdit) {
+            this.editRfidCard()
+          } else {
+            this.addRfidCard()
+          }
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped="scoped" lang='scss'>
+  @import '../../styles/variables.scss';
+  
+  .card-container {
+    width: 100%;
+    padding: 20px 60px;
+    min-height: $mainAppMinHeight;
+    background-color: #F0F5FC;
+  }
+  .card-content {
+    margin: 0 8px 16px;
+    padding: 15px 80px;
+    border-radius: 6px;
+    background-color: white;
+  }
+  .section-title {
+    color: #333;
+    margin-top: 20px;
+    margin-bottom: 30px;
+    font-size: 15px;
+    user-select: none;
+    line-height: 24px;
+    font-weight: bold;
+    font-family: sans-serif;
+    text-transform: uppercase;
+  }
+  .add-text {
+    width: 100%;
+    max-width: 300px;
+  }
+  .add-text ::v-deep .el-textarea__inner {
+    font-family: sans-serif;
+  }
+  .hr {
+    height: 2px;
+    margin: 10px -40px;
+    background-color: #F0F5FC;
+  }
+  .hr-full {
+    height: 2px;
+    margin: 80px -80px 30px;
+    background-color: #F0F5FC;
+  }
+  .rate-list-view {
+    display: flex;
+    align-items: center;
+  }
+  .rate-text {
+    max-width: 150px;
+    padding-right: 14px;
+  }
+  .list-item-icon {
+    width: 30px;
+    height: 30px;
+    cursor: pointer;
+    margin: 0 10px 22px;
+  }
+  .buttons {
+    padding-top: 15px;
+    padding-bottom: 30px;
+  }
+  @media screen and (max-width: 500px) {
+    .card-container {
+      padding: 0px;
+    }
+    .card-content {
+      padding: 15px 30px;
+    }
+  }
+  .item-unit {
+    top: 12px;
+    left: -40px;
+    font-size: 12px;
+    user-select: none;
+    position: absolute;
+  }
+</style>

+ 173 - 0
Strides-Admin/src/views/rfid/index.vue

@@ -0,0 +1,173 @@
+<template>
+  <div class="app-container">
+    <div class="filter-container right">
+      <div class="filter-view">
+        <el-input
+          style="flex: 1; min-width: 300px;"
+          v-model="params.pageVo.criteria"
+          placeholder="Search by Name, Email, Contact or Login ID"
+          @keyup.enter.native="getList" />
+        <el-button
+          type="primary"
+          icon="el-icon-search"
+          @click="getList">
+          Search
+        </el-button>
+        <div class="flex1"></div>
+        <el-button
+          class="filter-item"
+          type="primary"
+          icon="el-icon-plus"
+          @click="addRfid">
+            Add
+        </el-button>
+      </div>
+    </div>
+    <el-table
+      v-loading="table.loading"
+      :data="table.data"
+      fit
+      style="width: 100%;min-height: 65vh;">
+      <!--el-table-column
+        label="RFID No."
+        align="center"
+        class-name="fixed-width">
+        <template slot-scope="{row}">
+          <a class="link-detail" href="javascript:void(0);" @click="viewDevice(row)">{{ row.rfidNumber }}</a>
+        </template>
+      </el-table-column-->
+      <el-table-column
+        label="RFID No."
+        align="center"
+        prop="rfidNumber">
+      </el-table-column>
+      <el-table-column
+        label="Email Address"
+        align="center"
+        prop="email"
+        class-name="fixed-width">
+      </el-table-column>
+      <el-table-column
+        label="User ID"
+        align="center"
+        prop="userPk">
+      </el-table-column>
+      <el-table-column
+        label="User Type"
+        align="center"
+        prop="userType">
+      </el-table-column>
+      <el-table-column
+        label="Fleet"
+        align="center"
+        prop="fleet">
+      </el-table-column>
+      <el-table-column
+        label="Status"
+        align="center"
+        prop="status"
+        width="100px">
+      </el-table-column>
+      <el-table-column
+        label="Action"
+        align="center"
+        class-name="fixed-width">
+        <template slot-scope="{row}">
+          <TableAction
+            @edit="viewDevice(row)"
+            @delete="handleDelete(row)"/>
+        </template>
+      </el-table-column>
+    </el-table>
+    <div class="right">
+      <Pagination
+        v-show="table.total > 0"
+        :total="table.total"
+        :page.sync="params.pageNo"
+        :limit.sync="params.pageSize"
+        @pagination="handlePageChange" />
+    </div>
+  </div>
+</template>
+
+<script>
+import Pagination from '@/components/Pagination'
+import TableAction from '@/components/TableAction.vue'
+import api from '../../http/api/rfid.js'
+export default {
+  data() {
+    return {
+      table: {
+        data: [],
+        total: 0,
+        loading: false
+      },
+      params: {
+        pageNo: 1,
+        pageSize: 10,
+        pageVo: {
+          criteria: ""
+        }
+      }
+    }
+  },
+  components: { Pagination, TableAction },
+  created() {
+    this.getList();
+  },
+  methods: {
+    getList() {
+      this.table.loading = true;
+      api.getRfidPages(this.params).then(res => {
+        this.table.loading = false;
+        this.table.total = res.total;
+        this.table.data = res.data
+      }).catch(err => {
+        this.table.loading = false;
+        this.$message.error(err)
+      });
+    },
+    addRfid() {
+      this.$router.push({path: '/rfid-management/add'});
+    },
+    viewDevice({ocppTagPk}) {
+      this.$router.push(`rfid-management/${ocppTagPk}`);
+    },
+    handleDelete(row) {
+      this.$confirm('Are you sure you want to delete this rfid?', 'Delete', {
+        confirmButtonText: 'OK',
+        cancelButtonText: 'Cancel',
+        type: 'warning'
+      }).then(res => {
+        this.deleteRfid(row.ocppTagPk)
+      })
+    },
+    deleteRfid(id) {
+      this.table.loading = true;
+      api.deleteRfidCard({ocppTagPk: id}).then(res => {
+        this.$message({
+          message: 'Delete successfully!',
+          type: 'success'
+        });
+        this.getList();
+      }).catch(err => {
+        this.$message({
+          message: err,
+          type: 'error'
+        });
+        this.table.loading = false;
+      })
+    },
+    handlePageChange() {
+      this.table.loading = true;
+      this.getList();
+    }
+  }
+}
+</script>
+
+<style>
+  .link-detail {
+    text-decoration: underline;
+  }
+</style>