vbea 3 лет назад
Родитель
Сommit
7e1c1a73e6

BIN
Strides-Admin/src/assets/plat-android.png


BIN
Strides-Admin/src/assets/plat-ios.png


+ 18 - 0
Strides-Admin/src/http/api/notification.js

@@ -0,0 +1,18 @@
+import {get, post} from '../http'
+
+const notification = {
+  notificaitonPages: (params) => {
+    return post('notification/pages', params)
+  },
+  sendNotification: (params) => {
+    return post('notification/send', params)
+  },
+  viewNotification: (params) => {
+    return get('notification/view', params)
+  },
+  getPlatformTarget: () => {
+    return get('notification/target')
+  }
+}
+
+export default notification;

+ 2 - 1
Strides-Admin/src/http/api/transaction.js

@@ -5,7 +5,8 @@ const transaction = {
   getTransactionPages: (params) => post('transaction/getTransactionPages', params),
   getTransactionDetail: (params) => get('transaction/getTransactionDetail', params),
   downloadInvoice: (chargingPk) => download('transaction/downloadInvoice', {transactionPk: chargingPk}),
-  getMeasurandOptions: () => get('transaction/getMeasurands')
+  getMeasurandOptions: () => get('transaction/getMeasurands'),
+  endTransaction: (params) => get('transaction/endTransaction', params)
 }
 
 export default transaction;

+ 3 - 0
Strides-Admin/src/icons/svg/notification-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="M19 17V11.8C18.5 11.9 18 12 17.5 12H17V18H7V11C7 8.2 9.2 6 12 6C12.1 4.7 12.7 3.6 13.5 2.7C13.2 2.3 12.6 2 12 2C10.9 2 10 2.9 10 4V4.3C7 5.2 5 7.9 5 11V17L3 19V20H21V19L19 17ZM10 21C10 22.1 10.9 23 12 23C13.1 23 14 22.1 14 21H10ZM21 6.5C21 8.4 19.4 10 17.5 10C15.6 10 14 8.4 14 6.5C14 4.6 15.6 3 17.5 3C19.4 3 21 4.6 21 6.5Z" fill="white"/>
+</svg>

+ 3 - 0
Strides-Admin/src/icons/svg/notification.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="M19 17V11.8C18.5 11.9 18 12 17.5 12H17V18H7V11C7 8.2 9.2 6 12 6C12.1 4.7 12.7 3.6 13.5 2.7C13.2 2.3 12.6 2 12 2C10.9 2 10 2.9 10 4V4.3C7 5.2 5 7.9 5 11V17L3 19V20H21V19L19 17ZM10 21C10 22.1 10.9 23 12 23C13.1 23 14 22.1 14 21H10ZM21 6.5C21 8.4 19.4 10 17.5 10C15.6 10 14 8.4 14 6.5C14 4.6 15.6 3 17.5 3C19.4 3 21 4.6 21 6.5Z" fill="black"/>
+</svg>

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

@@ -213,6 +213,49 @@ const constantRoutes = [
         }
       }
     ],
+  },
+  {
+    path: '/notification',
+    component: Layout,
+    meta: {
+      title: 'Notification Management',
+      icon: 'notification',
+      activeIcon: 'notification-active',
+      affix: true
+    },
+    children: [
+      {
+        path: '/notification',
+        component: () => import('@/views/notification/index'),
+        name: 'notification',
+        meta: {
+          title: 'Notification Management',
+          icon: 'notification',
+          activeIcon: 'notification-active',
+          breadcrumb: false
+        }
+      },
+      {
+        path: '/notification/add',
+        component: () => import('@/views/notification/add'),
+        name: 'notification-add',
+        meta: {
+          title: 'Add Notification',
+          activeMenu: '/notification',
+          icon: 'notification',
+          activeIcon: 'notification-active'
+        }
+      },
+      {
+        path: '/notification/:id',
+        component: () => import('@/views/notification/add'),
+        name: 'notification-add',
+        meta: {
+          title: 'View Notification',
+          activeMenu: '/notification'
+        }
+      }
+    ],
   }
 ]
 

+ 265 - 0
Strides-Admin/src/views/notification/add.vue

@@ -0,0 +1,265 @@
+<template>
+  <div class="card-container">
+    <div class="card-content">
+      <el-form
+        v-loading="loading"
+        :model="formInfo"
+        :rules="rules"
+        ref="addForm"
+        label-width="200px"
+        label-position="right">
+        <div class="section-title">Send Notification</div>
+        <el-row :gutter="20">
+          <el-col :xs="24" :md="12">
+            <el-form-item
+              label="Notification Title"
+              prop="title">
+              <el-input
+                class="add-text"
+                v-model="formInfo.title"
+                placeholder="Add text"
+                maxlength="30"
+                :readonly="!isEdit"/>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="22" :md="12">
+            <el-form-item
+              label="Target"
+              prop="targets">
+              <el-select
+                class="add-text"
+                v-model="formInfo.targets"
+                :disabled="!isEdit"
+                multiple>
+                <el-option
+                  v-for="(item, index) in targetOptions"
+                  :key="index"
+                  :label="item"
+                  :value="item"/>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :xs="24" :md="12">
+            <el-form-item
+              label="Notification Message"
+              prop="message">
+              <el-input
+                class="add-text"
+                v-model="formInfo.message"
+                placeholder="Add text"
+                :autosize="autosize"
+                :readonly="!isEdit"
+                type="textarea"
+                maxlength="300"/>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <div class="sparator" style="margin: 10px -80px;"></div>
+        <div class="buttons" v-if="isEdit">
+          <el-button
+            class="cancel-button"
+            type="primary"
+            @click="onBack">
+            Cancel
+          </el-button>
+          <el-button
+            class="confirm-button"
+            type="primary"
+            @click="onSend">
+            Save
+          </el-button>
+        </div>
+        <div class="buttons" v-else>
+          <el-button
+            class="cancel-button"
+            type="primary"
+            @click="onBack">
+            Back
+          </el-button>
+        </div>
+      </el-form>
+    </div>
+  </div>
+</template>
+
+<script>
+import api from '../../http/api/notification'
+export default {
+  data() {
+    return {
+      loading: false,
+      formInfo: {
+        title: "",
+        message: "",
+        targets: []
+      },
+      autosize: {
+        minRows: 3,
+        maxRows: 10,
+      },
+      targetOptions: [],
+      rules: {
+        title: {
+          required: true,
+          trigger: 'blur',
+          message: 'Please input title'
+        },
+        message: {
+          required: true,
+          trigger: 'blur',
+          message: 'Please input message'
+        },
+        targets: {
+          required: true,
+          trigger: 'change',
+          message: 'Please select target platform'
+        }
+      },
+      isEdit: true
+    }
+  },
+  created() {
+    this.getTargets();
+    if (this.$route.params.id) {
+      this.isEdit = false;
+      this.viewNotification()
+    }
+  },
+  methods: {
+    onBack() {
+      this.$router.push('/notification')
+    },
+    onSend() {
+      this.$refs['addForm'].validate(result => {
+        if (result) {
+          this.$confirm("Confirm to send the notificaton?", "Notification").then(res => {
+            this.sendNotification();
+          })
+        }
+      })
+    },
+    getTargets() {
+      this.loading = true;
+      api.getPlatformTarget().then(res => {
+        if (res.data) {
+          this.targetOptions = res.data
+        }
+      }).catch(err =>{
+        
+      }).finally(() => {
+        this.loading = false;
+      })
+    },
+    viewNotification() {
+      this.loading = true;
+      api.viewNotification({
+        notificationId: this.$route.params.id
+      }).then(res => {
+        if (res.data) {
+          this.formInfo = res.data
+        }
+      }).catch(err => {
+        this.$message({
+          type: 'error',
+          message: err
+        })
+      }).finally(() => {
+        this.loading = false;
+      })
+    },
+    sendNotification() {
+      this.loading = true;
+      api.sendNotification(this.formInfo).then(res => {
+        this.$message({
+          type: 'success',
+          message: "Send successfully!"
+        })
+        setTimeout(() => this.onBack(), 300);
+      }).catch(err => {
+        this.$message({
+          type: 'error',
+          message: err
+        })
+      }).finally(() => {
+        this.loading = false;
+      })
+    }
+  }
+}
+</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 {
+    padding: 15px 80px;
+    border-radius: 6px;
+    background-color: white;
+  }
+  .section-title {
+    color: #333;
+    margin-top: 20px;
+    margin-bottom: 30px;
+    font-size: 16px;
+    user-select: none;
+    line-height: 24px;
+    font-weight: 500;
+    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: 20px -80px;
+    background-color: #F0F5FC;
+  }
+  .rate-list-view {
+    display: flex;
+    flex-wrap: wrap;
+    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 40px;
+    }
+  }
+  .form-unit ::v-deep .el-form-item__label {
+    line-height: 30px;
+  }
+</style>

+ 158 - 0
Strides-Admin/src/views/notification/index.vue

@@ -0,0 +1,158 @@
+<template>
+  <div class="app-container">
+    <div class="filter-container">
+      <div class="flexcwr bottom10">
+        <div></div>
+        <div>
+          <el-button
+            @click="creatNotification"
+            icon="el-icon-plus"
+            type="primary">
+            Create Notification
+          </el-button>
+        </div>
+      </div>
+    </div>
+    <el-table :data="table.list" v-loading="table.loading">
+      <el-table-column
+        align="center"
+        label="Notificaiton ID"
+        width="200">
+        <template v-slot="{row}">
+          <div
+            class="link-type"
+            @click="viewNotification(row)">
+            {{ row.notificationId }}
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column
+        align="center"
+        label="Notification Title"
+        prop="title"/>
+      <el-table-column
+        align="center"
+        label="Notification Message"
+        prop="message"
+        width="300">
+        <template v-slot="{row}">
+          <div class="message" :title="row.message">
+            {{ row.message }}
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column
+        align="center"
+        label="Time Sent"
+        prop="createdOn"
+        width="150"/>
+      <el-table-column
+        align="center"
+        label="Target">
+        <template v-slot="{row}">
+          <div class="flexcc">
+            <img
+              class="img-platform"
+              v-for="item in row.targets"
+              :key="item"
+              :src='"../../assets/plat-" + item + ".png"'/>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column
+        align="center"
+        label="Status"
+        prop="status"
+        width="100"/>
+      <el-table-column
+        label="Action"
+        align="center"
+        class-name="fixed-width">
+          <template slot-scope="{row}">
+            <TableAction
+              :showDel="false"
+              :showIcon="false"
+              editText="View"
+              @edit="viewNotification(row)"/>
+          </template>
+      </el-table-column>
+    </el-table>
+    <div class="right">
+      <Pagination
+        v-show="table.total > 0"
+        :total="table.total"
+        :page.sync="table.pageNo"
+        :limit.sync="table.pageSize"
+        @pagination="handlePageChange" />
+    </div>
+  </div>
+</template>
+
+<script>
+import Pagination from '@/components/Pagination'
+import TableAction from '@/components/TableAction.vue'
+import api from '../../http/api/notification'
+export default {
+  data() {
+    return {
+      table: {
+        list: [],
+        total: 0,
+        pageNo: 1,
+        pageSize: 10,
+        loading: false
+      }
+    }
+  },
+  components: { Pagination, TableAction },
+  created() {
+    this.getTableData();
+  },
+  methods: {
+    getTableData() {
+      this.table.loading = true;
+      api.notificaitonPages({
+        pageNo: this.table.pageNo,
+        pageSize: this.table.pageSize,
+        pageVo: {criteria: ""}
+      }).then(res => {
+        this.table.list = res.data
+      }).catch(err => {
+        this.$message({
+          type: 'error',
+          message: err
+        })
+      }).finally(() => {
+        this.table.loading = false;
+      })
+    },
+    creatNotification() {
+      this.$router.push('/notification/add')
+    },
+    viewNotification(row) {
+      this.$router.push('/notification/' + row.notificationId)
+    },
+    handlePageChange() {
+      this.getTableData();
+    }
+  }
+}
+</script>
+
+<style scoped>
+  .bottom10 {
+    padding-bottom: 10px;
+  }
+  .img-platform {
+    width: 28px;
+    height: 28px;
+    margin: 0 5px;
+  }
+  .message {
+    display: block;
+    overflow: hidden;
+    max-height: 50px;
+    text-align: center;
+    text-overflow: ellipsis;
+  }
+</style>

+ 4 - 3
Strides-Admin/src/views/site/AddSite.vue

@@ -659,8 +659,8 @@
           type="primary"
           @click="handleClickConfigUpateButton">
           Save
-          </el-button>
-        </div>
+        </el-button>
+      </div>
       </el-form>
     </div>
 
@@ -1229,7 +1229,8 @@ export default {
           street,
           city,
           country,
-          zipCode: postalCode,
+          countryCode: country,
+          zipCode: postalCode
         },
         chargeRates,
         whitelistUser,

+ 4 - 3
Strides-Admin/src/views/site/UpdateSite.vue

@@ -191,7 +191,7 @@
           </el-row>
         </el-form>
         <div class="sparator"></div>
-        <div class="section-title">
+        <!-- <div class="section-title">
           TIME CONFIGURATION
         </div>
         <el-table
@@ -233,7 +233,7 @@
             </template>
           </el-table-column>
         </el-table>
-        <div class="sparator"></div>
+        <div class="sparator"></div> -->
         <div class="section-title">
           ADDRESS
         </div>
@@ -1487,7 +1487,8 @@ export default {
           street,
           city,
           country,
-          zipCode: postalCode,
+          countryCode: country,
+          zipCode: postalCode
         },
         chargeRates,
         whitelistUser,

+ 30 - 2
Strides-Admin/src/views/transaction/view_transaction.vue

@@ -133,8 +133,16 @@
             </el-form-item>
           </el-col>
         </el-row>
-        <div class="flexcwr">
-          <div class="section-title">Intermediate Meter Values</div>
+        <div class="flexcr" style="margin: 10px 0;">
+          <div class="section-title" style="margin: 20px 0;">Intermediate Meter Values</div>
+          <el-button
+            type="primary"
+            style="margin: 0 10px;"
+            v-if="!details.endDateTime"
+            @click="endTransaction">
+            End Transaction
+          </el-button>
+          <div class="flex1"></div>
           <el-select v-model="measurand" @change="getDeatil">
             <el-option
               value=""
@@ -242,6 +250,7 @@
         listData: [],
         loading: false,
         measurand: "",
+        endLoading: false,
         optionsMeasurand: []
       }
     },
@@ -285,6 +294,25 @@
           this.loading = false
         })
       },
+      endTransaction() {
+        this.endLoading = true;
+        api.endTransaction({
+          transactionPk: this.$route.params.id
+        }).then(res => {
+          this.$message({
+            type: 'success',
+            message: 'Operation Successfully!'
+          })
+          this.getDeatil()
+        }).catch(err => {
+          this.$message({
+            type: 'error',
+            message: err
+          })
+        }).finally(() => {
+          this.endLoading = false
+        })
+      },
       handlePageChange() {
         this.listData = []
         var i = (this.page - 1) * this.pageSize