sample(847564): Upgrading vue showcase asset management project

This commit is contained in:
Rajapandiyan Settu 2023-09-15 14:02:38 +05:30
Родитель 3fca076437
Коммит 8b7c3f80ad
28 изменённых файлов: 1936 добавлений и 2053 удалений

Просмотреть файл

@ -1,22 +1,53 @@
# Asset Management System
A showcase application to track and visualize the software and hardware assets of an organization. This app was built using [Syncfusion Essential JS 2 Vue UI components](https://www.syncfusion.com/products/vue).
## Prerequisites
To run the application, [npm and node.js](https://docs.npmjs.com/getting-started/installing-node) are required. The node.js version 6.0.0 or above and the npm version 3.0.0 or above can be used.
# Vue Showcase Sample Configuration
## Build Setup
This application includes a sample of the Vue Showcase template along with essential configurations and router integration, designed to facilitate a seamless start for your own projects.
### Install dependencies
npm install
The Vue showcase demo can be accessed at the following location:
### Serve with hot reload at localhost:8080
Run `npm run serve` command to start the development server at http://localhost:8080. The app will be reloaded automatically when the source file is changed.
[https://npmci.syncfusion.com/development/showcase/vue/sample_template/](https://npmci.syncfusion.com/development/showcase/vue/sample_template/)
### Build for production with minification
npm run build
## package.json
## Demo
1. Should replace the name from `@syncfusion/ej2-vue-sample_template` to `@syncfusion/ej2-vue-{sample-name}`.
2. Should replace the description from `Essential JS 2 - Sample name` to `Essential JS 2 - {Your sample-Name}`.
3. Required ej2 component dependencies should be placed inside the `dependencies` section.
[Asset Management System](https://ej2.syncfusion.com/showcase/vue/assetmanagement)
### Source
Also please check out other showcase samples built using Essential JS 2 components [here](https://ej2.syncfusion.com/home/vue.html).
All components files related to your sample should be placed inside the `src` location.
## Installation
To install the application dependencies, use the following command:
```
npm install
```
### Compiles and minifies for production
To build the application, use the following command:
```
npm run build
```
### Lints and fixes files
To check the lint errors in the application, use the following command:
```
npm run lint
```
### Compiles and hot-reloads for development
To run the application in the browser, use the following command:
```
npm run serve
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

3
config.json Normal file
Просмотреть файл

@ -0,0 +1,3 @@
{
"productOwner": "Maithiliy K"
}

0
gulpfile.js Normal file
Просмотреть файл

Просмотреть файл

@ -1,7 +1,7 @@
{
"name": "@syncfusion/ej2-vue-asset-management",
"version": "1.0.0",
"description": "A Vue.js project",
"version": "0.1.0",
"description": "Essential JS 2 - Asset management",
"author": "Syncfusion Inc.",
"private": true,
"scripts": {
@ -22,9 +22,9 @@
"@syncfusion/ej2-vue-popups": "*",
"@syncfusion/ej2-vue-treemap": "*",
"core-js": "^3.8.3",
"vue-router": "^3.0.1",
"vue": "^2.6.14",
"vuex": "^3.0.1"
"vue": "^3.2.13",
"vue-router": "^4.2.4",
"vuex": "^4.1.0"
},
"devDependencies": {
"@babel/core": "^7.12.16",
@ -34,7 +34,7 @@
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"vue-template-compiler": "^2.6.14"
"vue-template-compiler": "^2.7.14"
},
"eslintConfig": {
"root": true,
@ -42,7 +42,7 @@
"node": true
},
"extends": [
"plugin:vue/essential",
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
@ -53,6 +53,7 @@
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
"not dead",
"not ie 11"
]
}

Двоичные данные
public/favicon.ico

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 4.2 KiB

После

Ширина:  |  Высота:  |  Размер: 6.4 KiB

Просмотреть файл

@ -2,13 +2,14 @@
<html lang="">
<head>
<meta charset="utf-8">
<base href="./" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>IT Asset Management - Essential JS 2 for Vue - Syncfusion</title>
<link rel="shortcut icon" href="static/favicon.ico" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.syncfusion.com/ej2/fabric.css" rel="stylesheet"/>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<link href="https://cdn.syncfusion.com/ej2/23.1.36/fabric.css" rel="stylesheet"/>
</head>
<body>
<noscript>

Просмотреть файл

@ -1,5 +1,5 @@
<template>
<div id="app" v-on:click="closeMenus" :style="{ marginLeft: marginSize }">
<div v-on:click="closeMenus" :style="{ marginLeft: marginSize }">
<div class="control-section">
<div id="wrapper">
<title>IT Asset Management</title>
@ -17,7 +17,7 @@
<!-- <span class="e-avatar e-avatar-circle"></span> -->
<div class="badge-block" v-on:click="toggleNotify()">
<div id="bell" class="sf-icon-Notification" :style="{ color: bellColor }"></div>
<span id="badge" class="e-badge e-badge-warning e-badge-notification e-badge-overlap">{{this.$store.state.activityData.length}} </span>
<span id="badge" class="e-badge e-badge-warning e-badge-notification e-badge-overlap">{{store.state.activityData.length}} </span>
</div>
</div>
</div>
@ -480,13 +480,24 @@ line-height: 1;
-moz-osx-font-smoothing: grayscale;
}
</style>
<script>
import Vue from 'vue'
import { SidebarPlugin, AccordionPlugin } from '@syncfusion/ej2-vue-navigations'
import { ListViewPlugin } from '@syncfusion/ej2-vue-lists'
import { enableRipple, Browser, L10n } from '@syncfusion/ej2-base'
import { ToastPlugin } from '@syncfusion/ej2-vue-notifications'
import Notification from '@/components/NotificationTemplate'
<script setup>
import { SidebarComponent as EjsSidebar } from '@syncfusion/ej2-vue-navigations';
import { ListViewComponent as EjsListview } from '@syncfusion/ej2-vue-lists';
import { enableRipple, Browser, L10n } from '@syncfusion/ej2-base';
import { ToastComponent as EjsToast } from '@syncfusion/ej2-vue-notifications';
import Notification from '@/components/NotificationTemplate';
import { createApp, ref } from "vue";
import { useRouter } from 'vue-router';
import { useStore } from 'vuex';
const toastRef = ref(null);
const sidebarListObj = ref(null);
const notifybarObj = ref(null);
const sidebarInstance = ref(null);
const router = useRouter();
const store = useStore();
const app = createApp();
// Added for command Column tooltip
L10n.load({
@ -495,14 +506,10 @@ L10n.load({
'edit': 'Edit'
}
}
})
});
Vue.use(ToastPlugin)
Vue.use(AccordionPlugin)
Vue.use(SidebarPlugin)
Vue.use(ListViewPlugin)
enableRipple(false)
var templateVue = Vue.component('menuTemplate', {
enableRipple(false);
var templateVue = app.component('menuTemplate', {
template: `
<div class="listWrapper" style="width: inherit;height: inherit;">
<span :class="[data.icon + ' list_svg']"></span>
@ -513,113 +520,111 @@ var templateVue = Vue.component('menuTemplate', {
data () {
return {
data: {}
}
};
}
})
export default Vue.extend({
data: function () {
return {
accountList: [
{ text: 'Profile', id: '001', icon: 'profile' },
{ text: 'Logout', id: '002', icon: 'logout' }
],
dataList: [
{ text: 'Dashboard', id: '01', messages: '', badge: '', icon: 'sf-icon-Dashboard' },
{ text: 'Hardware', id: '02', messages: '', badge: '', icon: 'sf-icon-Hardware' },
{ text: 'Software', id: '03', messages: '', badge: '', icon: 'sf-icon-Software' },
{ text: 'Issued Licenses', id: '04', messages: '', badge: '', icon: 'sf-icon-License' },
{ text: 'Requests', id: '05', messages: this.$store.getters.pendingRequests, badge: 'e-badge e-badge-warning', icon: 'sf-icon-Request' },
{ text: 'About', id: '06', messages: '', badge: '', icon: 'sf-icon-About' }
],
fields: { iconCss: 'icon', tooltip: 'text' },
template: function () {
return { template: templateVue }
},
type: Browser.isDevice ? 'Over' : 'Push',
width: '170px',
name: 'App',
dockSize: '170px',
enableDock: !Browser.isDevice,
closeOnDocumentClick: true,
position: {
});
const accountList = [
{ text: 'Profile', id: '001', icon: 'profile' },
{ text: 'Logout', id: '002', icon: 'logout' }
];
const dataList = [
{ text: 'Dashboard', id: '01', messages: '', badge: '', icon: 'sf-icon-Dashboard' },
{ text: 'Hardware', id: '02', messages: '', badge: '', icon: 'sf-icon-Hardware' },
{ text: 'Software', id: '03', messages: '', badge: '', icon: 'sf-icon-Software' },
{ text: 'Issued Licenses', id: '04', messages: '', badge: '', icon: 'sf-icon-License' },
{ text: 'Requests', id: '05', messages: store.getters.pendingRequests, badge: 'e-badge e-badge-warning', icon: 'sf-icon-Request' },
{ text: 'About', id: '06', messages: '', badge: '', icon: 'sf-icon-About' }
];
const fields = { iconCss: 'icon', tooltip: 'text' };
const template = function() {
return { template: templateVue };
};
const type = Browser.isDevice ? 'Over' : 'Push';
const width = '170px';
const dockSize = '170px';
const enableDock = !Browser.isDevice;
const closeOnDocumentClick = true;
const position = {
X: 'Right'
},
showNotifyDlg: false,
logoutPopup: false,
logoutPopupClicked: false,
notifyBellClicked: false,
sidebarClicked: false,
contextLeft: '1000px',
isDevice: Browser.isDevice,
showBackdrop: false,
sidebarTarget: Browser.isDevice ? '.content' : document.body,
sidebarPosition: Browser.isDevice ? 'absolute' : 'fixed',
marginSize: Browser.isDevice ? '0px' : '170px',
backColor: Browser.isDevice ? 'linear-gradient(-138deg, #3D8EC4 0%, #276AAB 100%)' : '#fff',
bellColor: Browser.isDevice ? '#fff' : '#999999'
};
let logoutPopup = ref(false);
let logoutPopupClicked = false;
let notifyBellClicked = false;
let sidebarClicked = false;
const isDevice = Browser.isDevice;
const showBackdrop = false;
const sidebarTarget = Browser.isDevice ? '.content' : document.body;
const sidebarPosition = Browser.isDevice ? 'absolute' : 'fixed';
//const marginSize = Browser.isDevice ? '0px' : '170px';
const marginSize = '0px';
const backColor = Browser.isDevice ? 'linear-gradient(-138deg, #3D8EC4 0%, #276AAB 100%)' : '#fff';
const bellColor = Browser.isDevice ? '#fff' : '#999999';
function onComplete (args) {
var name = router.options.history.location.split('/');
name = name.length && name[1] ? name[1] : '';
var menuText;
for (let i = 0; i < args.data.length; i++) {
if (name === '') {
menuText = 'Dashboard';
break;
}
},
methods: {
onComplete: function (args) {
var name = this.$router.currentRoute.name
var menuId
for (let i = 0; i < args.data.length; i++) {
if (args.data[i].text === name) {
menuId = args.data[i].id
}
}
this.$refs.sidebarListObj.selectItem({'id': menuId})
},
updatePendingRequests: function () {
for (let data of this.dataList) {
if (data['badge'] !== '') {
data['messages'] = this.$store.getters.pendingRequests
}
}
},
// Listview select event handler
onSelect: function (args) {
var vuePath = '/'
if (args.text !== 'Dashboard') {
vuePath += args.text.replace(' ', '')
}
this.$router.push({ path: vuePath }).catch(()=>{})
this.$refs.notifybarObj.hide()
},
openClick: function () {
this.$refs.sidebarInstance.toggle()
this.sidebarClicked = true
},
closeClick: function () {
this.$refs.sidebarInstance.hide()
},
closeMenus: function () {
if (!this.logoutPopupClicked) {
this.logoutPopup = false
}
if (!this.notifyBellClicked) {
this.$refs.notifybarObj.hide()
}
if (this.isDevice) {
if (!this.sidebarClicked) {
this.$refs.sidebarInstance.hide()
}
}
this.logoutPopupClicked = false
this.notifyBellClicked = false
this.sidebarClicked = false
},
AccountMenu: function () {
this.logoutPopup = !this.logoutPopup
this.logoutPopupClicked = true
},
toggleNotify: function () {
this.$refs.notifybarObj.toggle()
this.notifyBellClicked = true
if (args.data[i].text === name) {
menuText = args.data[i].text;
break;
}
},
components: {
Notification
}
})
sidebarListObj.value.ej2Instance.selectItem({'text': menuText});
}
// eslint-disable-next-line no-unused-vars
function updatePendingRequests() {
for (let data of dataList) {
if (data['badge'] !== '') {
data['messages'] = store.getters.pendingRequests;
}
}
}
// Listview select event handler
function onSelect(args) {
var vuePath = '/';
if (args.text !== 'Dashboard') {
vuePath += args.text.replace(' ', '');
}
router.push({ path: vuePath }).catch(()=>{});
notifybarObj.value.hide();
}
function openClick() {
sidebarInstance.value.toggle();
sidebarClicked = true;
}
// eslint-disable-next-line
function closeClick() {
sidebarInstance.value.hide();
}
function closeMenus() {
if (!logoutPopupClicked) {
logoutPopup.value = false;
}
if (!notifyBellClicked) {
notifybarObj.value.hide();
}
if (isDevice) {
if (!sidebarClicked) {
sidebarInstance.value.hide();
}
}
logoutPopupClicked = false;
notifyBellClicked = false;
sidebarClicked = false;
}
function AccountMenu() {
logoutPopup.value = !logoutPopup.value;
logoutPopupClicked = true;
}
function toggleNotify() {
notifybarObj.value.toggle();
notifyBellClicked = true;
}
</script>

Просмотреть файл

@ -60,7 +60,7 @@
</div>
<div class='control-item'>
<span class="icon-listview e-sb-icon control-icon"></span>
<a class='control-name' href="http://ej2.syncfusion.com/vue/documentation/list-view/getting-started.html" target="_blank">ListView</a>
<a class='control-name' href="http://ej2.syncfusion.com/vue/documentation/listview/getting-started.html" target="_blank">ListView</a>
</div>
<div class='control-item'>
<span class="icon-textboxes e-sb-icon control-icon"></span>
@ -85,9 +85,7 @@
</div>
</div>
</template>
<script>
export default {
}
<script setup>
</script>
<style scoped>

Просмотреть файл

@ -32,24 +32,13 @@
<template>
<div class="list-temp" >
<div class="e-avatar e-avatar-small e-avatar-circle list-img" :style="{ background: 'url(' + image + ') no-repeat center', backgroundSize: bgSize, 'vertical-align': 'middle'}"></div>
<div class="e-avatar e-avatar-small e-avatar-circle list-img" :style="{ background: 'url(' + require('@/' + data.ImgSrc) + ') no-repeat center', backgroundSize: bgSize, 'vertical-align': 'middle'}"></div>
<span id= "list-engineer">{{data.Employee}}</span>
<span id="list-timeStamp" class="sf-icon-timer" >{{data.TimeStamp}}</span>
<p id="list-message">{{data.Message}}</p>
</div>
</template>
<script>
export default {
data () {
return {
data: {},
bgSize: 'cover'
}
},
computed: {
image: function () {
return require('@/' + this.data.ImgSrc)
}
}
}
<script setup>
const data = {};
const bgSize = 'cover';
</script>

Просмотреть файл

@ -4,7 +4,7 @@
<form id="formId" class="dlg-form" novalidate="">
<div class="col-lg-12 e-input-section">
<div class="content-wrapper">
<div class="row" v-show="isEdit">
<div class="row" v-show="props.isEdit">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Task ID</label>
<input id="taskID" class="e-input" type="text" disabled>
@ -70,7 +70,7 @@
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12" v-show="showAssignee">
<!-- <div class="e-float-input"> -->
<label class="e-text">Assigned To</label>
<ejs-autocomplete id="assignee" :dataSource='this.$store.getters.empData' :fields='fields'></ejs-autocomplete>
<ejs-autocomplete id="assignee" :dataSource='store.getters.empData' :fields='fields'></ejs-autocomplete>
<!-- <span class="e-float-line"></span> -->
<!-- </div> -->
</div>
@ -93,7 +93,7 @@
<div class="row pull-right">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-6">
<ejs-button id="primarybtn" :isPrimary="true" @click.native="addRecord">{{btnName}}</ejs-button>
<ejs-button id="primarybtn" :isPrimary="true" v-on:click="addRecord">{{btnName}}</ejs-button>
</div>
</div>
</div>
@ -101,239 +101,232 @@
</form>
</ejs-dialog>
</template>
<script>
import Vue from 'vue'
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListPlugin } from '@syncfusion/ej2-vue-dropdowns'
import { DialogPlugin } from '@syncfusion/ej2-vue-popups'
import { UploaderPlugin, FormValidator } from '@syncfusion/ej2-vue-inputs'
import { ToastPlugin } from '@syncfusion/ej2-vue-notifications'
import { employeeData } from '../datasource.js'
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
<script setup>
import { onMounted, computed, getCurrentInstance, ref } from 'vue';
import { ButtonComponent as EjsButton } from '@syncfusion/ej2-vue-buttons';
import { DatePickerComponent as EjsDatepicker } from '@syncfusion/ej2-vue-calendars';
import { DropDownListComponent as EjsDropdownlist } from '@syncfusion/ej2-vue-dropdowns';
import { DialogComponent as EjsDialog } from '@syncfusion/ej2-vue-popups';
import { UploaderComponent as EjsUploader, FormValidator } from '@syncfusion/ej2-vue-inputs';
import { employeeData } from '../datasource.js';
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data';
import { useStore } from 'vuex';
Vue.use(ToastPlugin)
Vue.use(DialogPlugin)
Vue.use(DropDownListPlugin)
Vue.use(DatePickerPlugin)
Vue.use(ButtonPlugin)
Vue.use(UploaderPlugin)
export default Vue.extend({
data: function () {
return {
categoryList: [
{ id: 'cat-1', text: 'Laptop' },
{ id: 'cat-2', text: 'Monitor' },
{ id: 'cat-3', text: 'Keyboard' },
{ id: 'cat-4', text: 'Mouse' },
{ id: 'cat-5', text: 'Tablet' },
{ id: 'cat-6', text: 'Mobile' },
{ id: 'cat-7', text: 'Headset' },
{ id: 'cat-8', text: 'Miscellaneous' }
],
statusList: [
{ id: 'stat-1', text: 'Ordered' },
{ id: 'stat-2', text: 'Pending' },
{ id: 'stat-3', text: 'Assigned' },
{ id: 'stat-4', text: 'In-repair' }
],
header: 'Add New Hardware',
target: document.body,
showCloseIcon: true,
width: '500px',
btnName: 'Submit',
animationSettings: { effect: 'None' },
isModal: true,
maxDate: new Date(),
fields: {value: 'Employee'},
options: {
// Initialize the CustomPlacement.
customPlacement: function (inputElement, errorElement) {
inputElement.parentNode.appendChild(errorElement)
},
rules: {
Name: { required: true },
Serial: { required: true },
Invoice: { required: true },
DOP: { required: true, date: true }
}
},
frmObj: undefined,
showUploader: false,
showAssignee: false,
path: {
saveUrl: 'https://aspnetmvc.syncfusion.com/services/api/uploadbox/Save',
removeUrl: 'https://aspnetmvc.syncfusion.com/services/api/uploadbox/Remove'
},
dropElement: '.content-wrapper'
}
const store = useStore();
const root = getCurrentInstance();
const dialogObj = ref(null);
const categoryList = [
{ id: 'cat-1', text: 'Laptop' },
{ id: 'cat-2', text: 'Monitor' },
{ id: 'cat-3', text: 'Keyboard' },
{ id: 'cat-4', text: 'Mouse' },
{ id: 'cat-5', text: 'Tablet' },
{ id: 'cat-6', text: 'Mobile' },
{ id: 'cat-7', text: 'Headset' },
{ id: 'cat-8', text: 'Miscellaneous' }
];
const statusList = [
{ id: 'stat-1', text: 'Ordered' },
{ id: 'stat-2', text: 'Pending' },
{ id: 'stat-3', text: 'Assigned' },
{ id: 'stat-4', text: 'In-repair' }
];
let header = 'Add New Hardware';
const target = document.body;
const showCloseIcon = true;
const width = '500px';
let btnName = 'Submit';
const animationSettings = { effect: 'None' };
const isModal = true;
const maxDate = new Date();
const fields = {value: 'Employee'};
const options = {
// Initialize the CustomPlacement.
customPlacement: function (inputElement, errorElement) {
inputElement.parentNode.appendChild(errorElement)
},
mounted: function () {
this.frmObj = new FormValidator('#formId', this.options)
},
methods: {
onChange: function () {
if (document.getElementById('status').value === 'In-repair') {
this.showAssignee = false
this.showUploader = true
document.querySelector('.e-file-drop').innerHTML = ' Or Drop files here'
} else if (document.getElementById('status').value === 'Assigned') {
this.showUploader = false
this.showAssignee = true
} else {
this.showUploader = false
this.showAssignee = false
}
},
onFileRemove: function (args) {
args.postRawFile = false
},
created: function () {
},
dialogClose: function () {
this.$emit('close')
},
dialogOpen: function () {
this.frmObj.reset()
if (!this.isEdit) {
this.header = 'Add New Hardware'
this.btnName = 'Submit'
document.getElementById('name').value = ''
document.getElementById('category').value = 'Laptop'
document.getElementById('serial').value = ''
document.getElementById('invoice').value = ''
document.getElementById('dop').value = new Date().toLocaleDateString()
document.getElementById('weo').value = ''
document.getElementById('status').value = 'Ordered'
document.getElementById('assignee').value = ''
document.getElementById('note').value = ''
} else {
this.header = 'Edit Hardware'
this.btnName = 'Save'
var row = this.rowData
document.getElementById('taskID').value = row['TaskID']
document.getElementById('name').value = row['Name']
document.getElementById('category').value = row['Category']
document.getElementById('serial').value = row['SerialNo']
document.getElementById('invoice').value = row['InvoiceNo']
document.getElementById('dop').value = row['DOP'].toLocaleDateString()
document.getElementById('weo').value = row['WEO'] !== '' ? row['WEO'].toLocaleDateString() : ''
document.getElementById('status').value = row['Status']
document.getElementById('assignee').value = row['AssignedTo']
document.getElementById('note').value = row['Note']
}
if (document.getElementById('status').value === 'In-repair') {
this.showAssignee = false
this.showUploader = true
document.querySelector('.e-file-drop').innerHTML = ' Or Drop files here'
} else if (document.getElementById('status').value === 'Assigned') {
this.showUploader = false
this.showAssignee = true
} else {
this.showUploader = false
this.showAssignee = false
}
this.$refs.dialogObj.show()
},
addRecord: function () {
var grid = document.querySelector('.e-grid')['ej2_instances'][0]
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['Employee']
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['ImgSrc']
if (this.frmObj.validate()) {
var id = this.$store.state.activityData.length
if (!this.isEdit) {
grid.addRecord({
'TaskID': grid.dataSource.length + 1,
'Name': document.getElementById('name').value,
'Category': document.getElementById('category').value,
'SerialNo': document.getElementById('serial').value,
'InvoiceNo': document.getElementById('invoice').value,
'DOP': new Date(document.getElementById('dop').value),
'WEO': new Date(document.getElementById('weo').value),
'Status': document.getElementById('status').value,
'AssignedTo': document.getElementById('assignee').value,
'Note': document.getElementById('note').value
})
var activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'A new hardware ' + document.getElementById('name').value + ' has been added'
}
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
this.$root.$children[0].$refs.toastRef.show({
title: 'Successs!',
content: 'Hardware added successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
})
}).catch((reason) => {
alert(reason)
})
} else {
var data = {'TaskID': +document.getElementById('taskID').value,
'Name': document.getElementById('name').value,
'Category': document.getElementById('category').value,
'SerialNo': document.getElementById('serial').value,
'InvoiceNo': document.getElementById('invoice').value,
'DOP': new Date(document.getElementById('dop').value),
'WEO': new Date(document.getElementById('weo').value),
'Status': document.getElementById('status').value,
'AssignedTo': document.getElementById('assignee').value,
'Note': document.getElementById('note').value
}
var index = grid.selectedRowIndex
grid.editModule.updateRow(index, data)
activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'The hardware ' + document.getElementById('name').value + ' has been edited'
}
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
this.$root.$children[0].$refs.toastRef.show({
title: 'Successs!',
content: 'Hardware updated successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
})
}).catch((reason) => {
alert(reason)
})
}
this.frmObj.reset()
this.$refs.dialogObj.hide()
this.$emit('close')
// } else {
}
}
},
props: {
/** Whether the dialog is currently showing */
showing: {
type: Boolean,
required: true,
default: false
},
isEdit: {
type: Boolean,
required: true,
default: false
},
rowData: {
type: Object,
required: false,
default: null
}
},
computed: {
isShowing () {
return this.showing
}
rules: {
Name: { required: true },
Serial: { required: true },
Invoice: { required: true },
DOP: { required: true, date: true }
}
})
};
let frmObj = undefined;
let showUploader = false;
let showAssignee = false;
const path = {
saveUrl: 'https://aspnetmvc.syncfusion.com/services/api/uploadbox/Save',
removeUrl: 'https://aspnetmvc.syncfusion.com/services/api/uploadbox/Remove'
};
const dropElement = '.content-wrapper';
// eslint-disable-next-line no-undef
onMounted(() => {
frmObj = new FormValidator('#formId', options);
});
function onChange() {
if (document.getElementById('status').value === 'In-repair') {
showAssignee = false;
showUploader = true;
document.querySelector('.e-file-drop').innerHTML = ' Or Drop files here';
} else if (document.getElementById('status').value === 'Assigned') {
showUploader = false;
showAssignee = true;
} else {
showUploader = false;
showAssignee = false;
}
}
function onFileRemove(args) {
args.postRawFile = false;
}
function dialogClose() {
emit('close');
}
function dialogOpen() {
frmObj.reset();
if (!props.isEdit) {
header = 'Add New Hardware';
btnName = 'Submit';
document.getElementById('name').value = '';
document.getElementById('category').value = 'Laptop';
document.getElementById('serial').value = '';
document.getElementById('invoice').value = '';
document.getElementById('dop').value = new Date().toLocaleDateString();
document.getElementById('weo').value = '';
document.getElementById('status').value = 'Ordered';
document.getElementById('assignee').value = '';
document.getElementById('note').value = '';
} else {
header = 'Edit Hardware';
btnName = 'Save';
var row = props.rowData;
document.getElementById('taskID').value = row['TaskID'];
document.getElementById('name').value = row['Name'];
document.getElementById('category').value = row['Category'];
document.getElementById('serial').value = row['SerialNo'];
document.getElementById('invoice').value = row['InvoiceNo'];
document.getElementById('dop').value = row['DOP'].toLocaleDateString();
document.getElementById('weo').value = row['WEO'] !== '' ? row['WEO'].toLocaleDateString() : '';
document.getElementById('status').value = row['Status'];
document.getElementById('assignee').value = row['AssignedTo'];
document.getElementById('note').value = row['Note'];
}
if (document.getElementById('status').value === 'In-repair') {
showAssignee = false;
showUploader = true;
document.querySelector('.e-file-drop').innerHTML = ' Or Drop files here';
} else if (document.getElementById('status').value === 'Assigned') {
showUploader = false;
showAssignee = true;
} else {
showUploader = false;
showAssignee = false;
}
dialogObj.value.show();
}
function addRecord() {
var grid = document.querySelector('.e-grid')['ej2_instances'][0];
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['Employee'];
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['ImgSrc'];
if (frmObj.validate()) {
var id = store.state.activityData.length;
if (!props.isEdit) {
grid.addRecord({
'TaskID': grid.dataSource.length + 1,
'Name': document.getElementById('name').value,
'Category': document.getElementById('category').value,
'SerialNo': document.getElementById('serial').value,
'InvoiceNo': document.getElementById('invoice').value,
'DOP': new Date(document.getElementById('dop').value),
'WEO': new Date(document.getElementById('weo').value),
'Status': document.getElementById('status').value,
'AssignedTo': document.getElementById('assignee').value,
'Note': document.getElementById('note').value
});
var activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'A new hardware ' + document.getElementById('name').value + ' has been added'
};
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
root.root.refs.toastRef.show({
title: 'Successs!',
content: 'Hardware added successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
});
}).catch((reason) => {
alert(reason)
});
} else {
var data = {
'TaskID': +document.getElementById('taskID').value,
'Name': document.getElementById('name').value,
'Category': document.getElementById('category').value,
'SerialNo': document.getElementById('serial').value,
'InvoiceNo': document.getElementById('invoice').value,
'DOP': new Date(document.getElementById('dop').value),
'WEO': new Date(document.getElementById('weo').value),
'Status': document.getElementById('status').value,
'AssignedTo': document.getElementById('assignee').value,
'Note': document.getElementById('note').value
};
var index = grid.selectedRowIndex;
grid.editModule.updateRow(index, data);
activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'The hardware ' + document.getElementById('name').value + ' has been edited'
};
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
root.root.refs.toastRef.show({
title: 'Successs!',
content: 'Hardware updated successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
});
}).catch((reason) => {
alert(reason)
});
}
frmObj.reset();
dialogObj.value.hide();
// eslint-disable-next-line
debugger;
emit('close');
}
}
// eslint-disable-next-line no-undef
const emit = defineEmits(['close']);
// eslint-disable-next-line no-undef
const props = defineProps({
/** Whether the dialog is currently showing */
showing: {
type: Boolean,
required: true,
default: false
},
isEdit: {
type: Boolean,
required: true,
default: false
},
rowData: {
type: Object,
required: false,
default: null
}
});
const isShowing = computed(() => {
return props.showing
});
</script>
<style scoped>

Просмотреть файл

@ -65,7 +65,7 @@
<div class="row pull-right">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-6">
<ejs-button id="primarybtn" :isPrimary="true" @click.native="addRecord">{{btnName}}</ejs-button>
<ejs-button id="primarybtn" :isPrimary="true" v-on:click="addRecord">{{btnName}}</ejs-button>
</div>
</div>
</div>
@ -73,198 +73,192 @@
</form>
</ejs-dialog>
</template>
<script>
import Vue from 'vue'
import { ButtonComponent, ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
import { NumericTextBoxPlugin, FormValidator } from '@syncfusion/ej2-vue-inputs'
import { DialogPlugin } from '@syncfusion/ej2-vue-popups'
import { employeeData } from '../datasource.js'
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
<script setup>
import { onMounted, computed, getCurrentInstance, ref } from 'vue';
import { ButtonComponent as EjsButton } from '@syncfusion/ej2-vue-buttons';
import { DatePickerComponent as EjsDatepicker } from '@syncfusion/ej2-vue-calendars';
import { DropDownListComponent as EjsDropdownlist } from '@syncfusion/ej2-vue-dropdowns';
import { NumericTextBoxComponent as EjsNumerictextbox, FormValidator } from '@syncfusion/ej2-vue-inputs';
import { DialogComponent as EjsDialog } from '@syncfusion/ej2-vue-popups';
import { employeeData } from '../datasource.js';
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data';
import { useStore } from 'vuex';
Vue.use(DialogPlugin)
Vue.component(DropDownListComponent)
Vue.use(NumericTextBoxPlugin)
Vue.use(DatePickerPlugin)
Vue.component(ButtonPlugin.name, ButtonComponent)
export default Vue.extend({
data: function () {
return {
categoryList: [
{ id: 'cat-1', text: 'Development' },
{ id: 'cat-2', text: 'Graphics' },
{ id: 'cat-3', text: 'Accounting' },
{ id: 'cat-4', text: 'HR' },
{ id: 'cat-5', text: 'Common' },
{ id: 'cat-6', text: 'Miscellaneous' }
],
LicenseList: [
{ id: 'Lic-1', text: 'Free' },
{ id: 'Lic-2', text: 'Yearly (User basis)' },
{ id: 'Lic-3', text: 'Lifetime' }
],
header: 'Add New Software',
target: document.body,
showCloseIcon: true,
btnName: 'Submit',
width: '500px',
isModal: true,
options: {
// Initialize the CustomPlacement.
customPlacement: function (inputElement, errorElement) {
inputElement.parentNode.appendChild(errorElement)
},
rules: {
Name: { required: true },
DOP: { required: true, date: true }
}
},
frmObj: undefined,
maxDate: new Date(),
animationSettings: { effect: 'None' }
}
const store = useStore();
const root = getCurrentInstance();
const dialogObj = ref(null);
const categoryList = [
{ id: 'cat-1', text: 'Development' },
{ id: 'cat-2', text: 'Graphics' },
{ id: 'cat-3', text: 'Accounting' },
{ id: 'cat-4', text: 'HR' },
{ id: 'cat-5', text: 'Common' },
{ id: 'cat-6', text: 'Miscellaneous' }
];
const LicenseList = [
{ id: 'Lic-1', text: 'Free' },
{ id: 'Lic-2', text: 'Yearly (User basis)' },
{ id: 'Lic-3', text: 'Lifetime' }
];
let header = 'Add New Software';
const target = document.body;
const showCloseIcon = true;
let btnName = 'Submit';
const width = '500px';
const isModal = true;
const options = {
// Initialize the CustomPlacement.
customPlacement: function (inputElement, errorElement) {
inputElement.parentNode.appendChild(errorElement)
},
mounted: function () {
this.frmObj = new FormValidator('#formId', this.options)
},
methods: {
dialogClose: function () {
this.$emit('close')
},
dialogOpen: function () {
this.frmObj.reset()
if (!this.isEdit) {
this.header = 'Add New Software'
this.btnName = 'Submit'
document.getElementById('name').value = ''
document.getElementById('edition').value = ''
document.getElementById('version').value = ''
document.getElementById('vendor').value = ''
document.getElementById('license-type').value = 'Free'
document.getElementById('license-count').value = 0
document.getElementById('dop').value = new Date().toLocaleDateString()
document.getElementById('expired-on').value = ''
document.getElementById('category').value = 'Development'
document.getElementById('note').value = ''
} else {
this.header = 'Edit Software'
this.btnName = 'Save'
var row = this.rowData
document.getElementById('taskID').value = row['TaskID']
document.getElementById('name').value = row['Name']
document.getElementById('edition').value = row['Edition']
document.getElementById('version').value = row['Version']
document.getElementById('vendor').value = row['Vendor']
document.getElementById('license-type').value = row['LicenseType']
document.getElementById('license-count').value = row['LicenseCount']
document.getElementById('dop').value = row['DOP'].toLocaleDateString()
document.getElementById('expired-on').value = row['ExpiredOn'] !== '' ? row['ExpiredOn'].toLocaleDateString() : ''
document.getElementById('category').value = row['Category']
document.getElementById('note').value = row['Note']
}
this.$refs.dialogObj.show()
},
addRecord: function () {
var grid = document.querySelector('.e-grid')['ej2_instances'][0]
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['Employee']
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['ImgSrc']
if (this.frmObj.validate()) {
var id = this.$store.state.activityData.length
if (!this.isEdit) {
grid.addRecord({
'TaskID': grid.dataSource.length + 1,
'Name': document.getElementById('name').value,
'Edition': document.getElementById('edition').value,
'Version': document.getElementById('version').value,
'Vendor': document.getElementById('vendor').value,
'LicenseType': document.getElementById('license-type').value,
'LicenseCount': document.getElementById('license-count').value,
'DOP': new Date(document.getElementById('dop').value),
'ExpiredOn': new Date(document.getElementById('expired-on').value),
'Category': document.getElementById('category').value,
'Note': document.getElementById('note').value
})
var activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'A new software ' + document.getElementById('name').value + ' has been added'
}
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
this.$root.$children[0].$refs.toastRef.show({
title: 'Successs!',
content: 'Software added successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
})
}).catch((reason) => {
alert(reason)
})
} else {
var data = {'TaskID': +document.getElementById('taskID').value,
'Name': document.getElementById('name').value,
'Edition': document.getElementById('edition').value,
'Version': document.getElementById('version').value,
'Vendor': document.getElementById('vendor').value,
'LicenseType': document.getElementById('license-type').value,
'LicenseCount': document.getElementById('license-count').value,
'DOP': new Date(document.getElementById('dop').value),
'ExpiredOn': new Date(document.getElementById('expired-on').value),
'Category': document.getElementById('category').value,
'Note': document.getElementById('note').value
}
var index = grid.selectedRowIndex
grid.editModule.updateRow(index, data)
activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'The Software ' + document.getElementById('name').value + ' has been updated'
}
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
this.$root.$children[0].$refs.toastRef.show({
title: 'Successs!',
content: 'Software updated successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
})
}).catch((reason) => {
alert(reason)
})
}
this.frmObj.reset()
this.$refs.dialogObj.hide()
this.$emit('close')
}
}
},
props: {
/** Whether the dialog is currently showing */
showing: {
type: Boolean,
required: true,
default: false
},
isEdit: {
type: Boolean,
required: true,
default: false
},
rowData: {
type: Object,
required: false,
default: null
}
},
computed: {
isShowing () {
return this.showing
}
rules: {
Name: { required: true },
DOP: { required: true, date: true }
}
})
};
let frmObj = undefined;
const maxDate = new Date();
const animationSettings = { effect: 'None' };
onMounted(() => {
frmObj = new FormValidator('#formId', options);
});
function dialogClose() {
emit('close');
}
function dialogOpen () {
frmObj.reset();
if (!props.isEdit) {
header = 'Add New Software';
btnName = 'Submit';
document.getElementById('name').value = '';
document.getElementById('edition').value = '';
document.getElementById('version').value = '';
document.getElementById('vendor').value = '';
document.getElementById('license-type').value = 'Free';
document.getElementById('license-count').value = 0;
document.getElementById('dop').value = new Date().toLocaleDateString();
document.getElementById('expired-on').value = '';
document.getElementById('category').value = 'Development';
document.getElementById('note').value = '';
} else {
header = 'Edit Software';
btnName = 'Save';
var row = props.rowData;
document.getElementById('taskID').value = row['TaskID'];
document.getElementById('name').value = row['Name'];
document.getElementById('edition').value = row['Edition'];
document.getElementById('version').value = row['Version'];
document.getElementById('vendor').value = row['Vendor'];
document.getElementById('license-type').value = row['LicenseType'];
document.getElementById('license-count').value = row['LicenseCount'];
document.getElementById('dop').value = row['DOP'].toLocaleDateString();
document.getElementById('expired-on').value = row['ExpiredOn'] !== '' ? row['ExpiredOn'].toLocaleDateString() : '';
document.getElementById('category').value = row['Category'];
document.getElementById('note').value = row['Note'];
}
dialogObj.value.show();
}
function addRecord() {
var grid = document.querySelector('.e-grid')['ej2_instances'][0];
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['Employee'];
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['ImgSrc'];
if (frmObj.validate()) {
var id = store.state.activityData.length;
if (!props.isEdit) {
grid.addRecord({
'TaskID': grid.dataSource.length + 1,
'Name': document.getElementById('name').value,
'Edition': document.getElementById('edition').value,
'Version': document.getElementById('version').value,
'Vendor': document.getElementById('vendor').value,
'LicenseType': document.getElementById('license-type').value,
'LicenseCount': document.getElementById('license-count').value,
'DOP': new Date(document.getElementById('dop').value),
'ExpiredOn': new Date(document.getElementById('expired-on').value),
'Category': document.getElementById('category').value,
'Note': document.getElementById('note').value
});
var activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'A new software ' + document.getElementById('name').value + ' has been added'
};
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
root.root.refs.toastRef.show({
title: 'Successs!',
content: 'Software added successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
});
}).catch((reason) => {
alert(reason);
});
} else {
var data = {
'TaskID': +document.getElementById('taskID').value,
'Name': document.getElementById('name').value,
'Edition': document.getElementById('edition').value,
'Version': document.getElementById('version').value,
'Vendor': document.getElementById('vendor').value,
'LicenseType': document.getElementById('license-type').value,
'LicenseCount': document.getElementById('license-count').value,
'DOP': new Date(document.getElementById('dop').value),
'ExpiredOn': new Date(document.getElementById('expired-on').value),
'Category': document.getElementById('category').value,
'Note': document.getElementById('note').value
};
var index = grid.selectedRowIndex;
grid.editModule.updateRow(index, data);
activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'The Software ' + document.getElementById('name').value + ' has been updated'
};
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
root.root.refs.toastRef.show({
title: 'Successs!',
content: 'Software updated successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
});
}).catch((reason) => {
alert(reason);
});
}
frmObj.reset();
dialogObj.value.hide();
emit('close');
}
}
// eslint-disable-next-line no-undef
const emit = defineEmits(['close']);
// eslint-disable-next-line no-undef
const props = defineProps({
/** Whether the dialog is currently showing */
showing: {
type: Boolean,
required: true,
default: false
},
isEdit: {
type: Boolean,
required: true,
default: false
},
rowData: {
type: Object,
required: false,
default: null
}
});
const isShowing = computed(() => {
return props.showing
});
</script>
<style scoped>

Просмотреть файл

@ -1,13 +1,13 @@
<template id="view-hardware">
<div class="container-fluid">
<div id="dialog" style="padding:10px;position:absolute;">
<add-hardware :showing="dlgShow" :isEdit="isEditing" :rowData="rowData" @close="onDlgClose">
<add-hardware :showing="dlgShow" :isEdit="isEditing" :rowData="rowData" :close="onDlgClose">
</add-hardware>
</div>
<div class="row top-row">
<div class="col-xs-12 col-sm-12 col-lg-7 col-md-12"><h3>View Hardware</h3></div>
<div class="col-xs-12 col-sm-6 col-lg-2 col-md-6">
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click.native="AddBtnClick"> <span class="e-add-icon"></span> Add New Hardware</ejs-button>
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click="AddBtnClick"> <span class="e-add-icon"></span> Add New Hardware</ejs-button>
</div>
<div class="col-xs-12 col-sm-6 col-lg-3 col-md-6 daterange overview-range-picker">
<ejs-daterangepicker ref='dateRangePickerObject' class="e-input-group e-input-custom-tag e-control-wrapper e-date-range-wrapper" id='date-wrapper' :placeholder="waterMark" :change="dateRangeChanged">
@ -16,7 +16,7 @@
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
<ejs-grid ref="gridObj" class="r-space" :load="onGridLoad" :toolbarClick="editToolClicked" :actionBegin='onActionBegin' :actionComplete='onload' :toolbar="toolbar" :dataSource='gridData' :query='query' :allowSorting='true' :allowSelection='true' :selectionSettings='selectionSettings' :allowFiltering='true' :allowPaging='true' :allowGrouping='false' :pageSettings='pageSettings' :editSettings='editSettings' :filterSettings='filterSettings'>
<ejs-grid ref="gridObj" class="r-space" :load="onGridLoad" :toolbarClick="editToolClicked" :actionBegin='onActionBegin' :toolbar="toolbar" :dataSource='gridData' :query='query' :allowSorting='true' :allowSelection='true' :selectionSettings='selectionSettings' :allowFiltering='true' :allowPaging='true' :allowGrouping='false' :pageSettings='pageSettings' :editSettings='editSettings' :filterSettings='filterSettings'>
<e-columns>
<e-column field='TaskID' headerText='Task ID' textAlign='Right' width=90 :isPrimaryKey='true'></e-column>
<e-column field='Name' headerText='Hardware' :filter='filter' width=90 clipMode='EllipsisWithTooltip' :required='true'></e-column>
@ -35,123 +35,104 @@
</div>
</div>
</template>
<script>
import Vue from 'vue'
import { GridPlugin, Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids'
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin, DateRangePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
import AddHardware from '@/components/AddHardware'
import { hardwareData } from '../datasource.js'
import { TooltipPlugin, Tooltip } from '@syncfusion/ej2-vue-popups'
import { Browser } from '@syncfusion/ej2-base'
<script setup>
import { ref, provide } from 'vue';
import { GridComponent as EjsGrid, ColumnsDirective as EColumns, ColumnDirective as EColumn, Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids';
import { ButtonComponent as EjsButton } from '@syncfusion/ej2-vue-buttons';
import { DateRangePickerComponent as EjsDaterangepicker } from '@syncfusion/ej2-vue-calendars';
import AddHardware from '@/components/AddHardware';
import { hardwareData } from '../datasource.js';
import { Tooltip } from '@syncfusion/ej2-vue-popups';
import { Browser } from '@syncfusion/ej2-base';
Vue.use(DateRangePickerPlugin)
Vue.use(GridPlugin)
Vue.component(DropDownListComponent)
Vue.use(DatePickerPlugin)
Vue.use(ButtonPlugin)
Vue.use(TooltipPlugin)
const gridObj = ref(null);
const dlgShow = ref(false);
const isEditing = ref(false);
const rowData = ref(null);
export default Vue.extend({
data: function () {
return {
dlgShow: false,
isEditing: false,
rowData: null,
waterMark: 'Select a range',
gridData: hardwareData,
tooltip: '',
editSettings: { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' },
toolbar: undefined,
editparams: { params: { popupHeight: '300px' } },
pageSettings: { pageCount: 5, pageSize: 10 },
filterSettings: { type: 'Menu', columns: [] },
filter: { type: 'CheckBox' },
selectionSettings: { persistSelection: true },
query: '',
commands: [{ type: 'edit', buttonOption: { iconCss: 'e-icons e-edit', cssClass: 'e-flat e-noback', click: this.editBtnClick } },
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }]
const waterMark = 'Select a range';
const gridData = hardwareData;
// eslint-disable-next-line no-unused-vars
let tooltip;
const editSettings = { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' };
let toolbar = undefined;
const pageSettings = { pageCount: 5, pageSize: 10 };
let filterSettings = { type: 'Menu', columns: [] };
const filter = { type: 'CheckBox' };
const selectionSettings = { persistSelection: true };
const query = '';
const commands = [{ type: 'edit', buttonOption: { iconCss: 'e-icons e-edit', cssClass: 'e-flat e-noback', click: editBtnClick } },
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }];
function onGridLoad() {
if (Browser.isDevice) {
toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete'];
gridObj.value.ej2Instances.columns[10].visible = false;
}
}
function onActionBegin(args) {
if (args.requestType === 'beginEdit') {
editBtnClick(args);
args.cancel = true;
}
}
function dateRangeChanged(args) {
// check wheather the value is empty or not
if (args.startDate && args.endDate) {
var filter = [
{ field: 'DOP', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
{ field: 'DOP', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
];
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: filter };
} else {
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: [] };
}
}
function AddBtnClick() {
dlgShow.value = !dlgShow.value;
isEditing.value = false;
}
function editToolClicked(args) {
if (args.item.id === 'editTool') {
isEditing.value = true;
var rows = gridObj.value.ej2Instances.getSelectedRows()[0];
if (!rows) {
gridObj.value.ej2Instances.editModule.showDialog('EditOperationAlert', gridObj.value.ej2Instances.editModule.alertDObj);
return;
}
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'));
rowData.value = rowObj.data;
dlgShow.value = !dlgShow.value;
}
}
function editBtnClick(args) {
isEditing.value = true;
dlgShow.value = !dlgShow.value;
if (args.type === 'actionBegin') {
rowData.value = args.rowData;
return;
}
var target = args.target;
if (target.classList.contains('e-edit')) {
target = target.parentElement;
}
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'));
rowData.value = rowObj.data;
}
function onDlgClose () {
dlgShow.value = false;
}
// eslint-disable-next-line no-unused-vars
function showTooltip(args) {
tooltip = new Tooltip({
beforeOpen: (e) => {
if (e.target.classList.contains('e-unboundcell') || e.target.lastChild.classList.contains('e-unboundcell')) {
// e.cancel = true;
}
},
methods: {
onGridLoad: function () {
if (Browser.isDevice) {
this.toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete']
this.$refs.gridObj.ej2Instances.columns[10].visible = false
}
},
onload: function () {
},
onActionBegin: function (args) {
if (args.requestType === 'beginEdit') {
this.editBtnClick(args)
args.cancel = true
}
},
dateRangeChanged: function (args) {
// check wheather the value is empty or not
if (args.startDate && args.endDate) {
var filter = [
{ field: 'DOP', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
{ field: 'DOP', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
]
this.filterSettings = {type: 'Menu', columns: filter}
} else {
this.filterSettings = {type: 'Menu', columns: []}
}
},
AddBtnClick: function () {
this.dlgShow = !this.dlgShow
this.isEditing = false
},
editToolClicked: function (args) {
if (args.item.id === 'editTool') {
this.isEditing = true
var rows = this.$refs.gridObj.ej2Instances.getSelectedRows()[0]
if (!rows) {
this.$refs.gridObj.ej2Instances.editModule.showDialog('EditOperationAlert', this.$refs.gridObj.ej2Instances.editModule.alertDObj)
return
}
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'))
this.rowData = rowObj.data
this.dlgShow = !this.dlgShow
}
},
editBtnClick: function (args) {
this.isEditing = true
this.dlgShow = !this.dlgShow
if (args.type === 'actionBegin') {
this.rowData = args.rowData
return
}
var target = args.target
if (target.classList.contains('e-edit')) {
target = target.parentElement
}
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'))
this.rowData = rowObj.data
},
onDlgClose () {
this.dlgShow = false
},
showTooltip: function (args) {
this.tooltip = new Tooltip({
beforeOpen: (e) => {
if (e.target.classList.contains('e-unboundcell') || e.target.lastChild.classList.contains('e-unboundcell')) {
// e.cancel = true
}
},
content: args.data['Note'].toString() }, args.row)
}
},
provide: {
grid: [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]
},
components: {
AddHardware
}
})
content: args.data['Note'].toString() }, args.row);
}
provide('grid', [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]);
</script>
<style scoped>

Просмотреть файл

@ -7,7 +7,7 @@
<div class="row top-row">
<div class="col-xs-12 col-sm-12 col-lg-7 col-md-12"><h3>View Issued Licenses</h3></div>
<div class="col-xs-12 col-sm-6 col-lg-2 col-md-6">
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click.native="AddBtnClick"> <span class="e-add-icon"></span> Issue License</ejs-button>
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click="AddBtnClick"> <span class="e-add-icon"></span> Issue License</ejs-button>
</div>
<div class="col-xs-12 col-sm-6 col-lg-3 col-md-6 daterange overview-range-picker">
<ejs-daterangepicker ref='dateRangePickerObject' class="e-input-group e-input-custom-tag e-control-wrapper e-date-range-wrapper" id='date-wrapper' :placeholder="waterMark" :change="dateRangeChanged">
@ -32,110 +32,91 @@
</div>
</div>
</template>
<script>
import Vue from 'vue'
import { GridPlugin, Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids'
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin, DateRangePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
import IssueLicense from '@/components/IssueLicense'
import { licenseData } from '../datasource.js'
import { Browser } from '@syncfusion/ej2-base'
<script setup>
import { ref, provide } from 'vue';
import { GridComponent as EjsGrid, ColumnsDirective as EColumns, ColumnDirective as EColumn,
Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids';
import { ButtonComponent as EjsButton } from '@syncfusion/ej2-vue-buttons';
import { DateRangePickerComponent as EjsDaterangepicker } from '@syncfusion/ej2-vue-calendars';
import IssueLicense from '@/components/IssueLicense';
import { licenseData } from '../datasource.js';
import { Browser } from '@syncfusion/ej2-base';
Vue.use(DateRangePickerPlugin)
Vue.use(GridPlugin)
Vue.component(DropDownListComponent)
Vue.use(DatePickerPlugin)
Vue.use(ButtonPlugin)
const gridObj = ref(null);
const dlgShow = ref(false);
const isEditing = ref(false);
const rowData = ref(null);
const waterMark = 'Select a range';
const gridData = licenseData;
const editSettings = { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' };
let toolbar = undefined;
const pageSettings = { pageCount: 5, pageSize: 10 };
let filterSettings = { type: 'Menu', columns: [] };
const filter = { type: 'CheckBox' };
const selectionSettings = { persistSelection: true };
const commands = [{ type: 'edit', buttonOption: { iconCss: 'e-icons e-edit', cssClass: 'e-flat e-noback', click: editBtnClick } },
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }];
export default Vue.extend({
data: function () {
return {
dlgShow: false,
isEditing: false,
rowData: null,
waterMark: 'Select a range',
gridData: licenseData,
editSettings: { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' },
toolbar: undefined,
editparams: { params: { popupHeight: '300px' } },
pageSettings: { pageCount: 5, pageSize: 10 },
filterSettings: { type: 'Menu', columns: [] },
filter: { type: 'CheckBox' },
selectionSettings: { persistSelection: true },
commands: [{ type: 'edit', buttonOption: { iconCss: 'e-icons e-edit', cssClass: 'e-flat e-noback', click: this.editBtnClick } },
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }]
}
},
methods: {
onGridLoad: function () {
if (Browser.isDevice) {
this.toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete']
this.$refs.gridObj.ej2Instances.columns[7].visible = false
}
},
onload: function () {
},
onActionBegin: function (args) {
if (args.requestType === 'beginEdit') {
this.editBtnClick(args)
args.cancel = true
}
},
dateRangeChanged: function (args) {
// check wheather the value is empty or not
if (args.startDate && args.endDate) {
var filter = [
{ field: 'IssuedOn', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
{ field: 'IssuedOn', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
]
this.filterSettings = {type: 'Menu', columns: filter}
} else {
this.filterSettings = {type: 'Menu', columns: []}
}
},
AddBtnClick: function () {
this.dlgShow = !this.dlgShow
this.isEditing = false
},
editToolClicked: function (args) {
if (args.item.id === 'editTool') {
this.isEditing = true
var rows = this.$refs.gridObj.ej2Instances.getSelectedRows()[0]
if (!rows) {
this.$refs.gridObj.ej2Instances.editModule.showDialog('EditOperationAlert', this.$refs.gridObj.ej2Instances.editModule.alertDObj)
return
}
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'))
this.rowData = rowObj.data
this.dlgShow = !this.dlgShow
}
},
editBtnClick: function (args) {
this.isEditing = true
this.dlgShow = !this.dlgShow
if (args.type === 'actionBegin') {
this.rowData = args.rowData
return
}
var target = args.target
if (target.classList.contains('e-edit')) {
target = target.parentElement
}
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'))
this.rowData = rowObj.data
},
onDlgClose () {
this.dlgShow = false
}
},
provide: {
grid: [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]
},
components: {
IssueLicense
function onGridLoad() {
if (Browser.isDevice) {
toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete'];
gridObj.value.ej2Instances.columns[7].visible = false;
}
})
}
function onActionBegin(args) {
if (args.requestType === 'beginEdit') {
editBtnClick(args);
args.cancel = true;
}
}
function dateRangeChanged(args) {
// check wheather the value is empty or not
if (args.startDate && args.endDate) {
var filter = [
{ field: 'IssuedOn', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
{ field: 'IssuedOn', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
];
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: filter };
} else {
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: [] };
}
}
function AddBtnClick() {
dlgShow.value = !dlgShow.value;
isEditing.value = false;
}
function editToolClicked(args) {
if (args.item.id === 'editTool') {
isEditing.value = true;
var rows = gridObj.value.ej2Instances.getSelectedRows()[0];
if (!rows) {
gridObj.value.ej2Instances.editModule.showDialog('EditOperationAlert', gridObj.value.ej2Instances.editModule.alertDObj);
return;
}
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'));
rowData.value = rowObj.data;
dlgShow.value = !this.dlgShow;
}
}
function editBtnClick(args) {
isEditing.value = true;
dlgShow.value = !dlgShow.value;
if (args.type === 'actionBegin') {
rowData.value = args.rowData;
return;
}
var target = args.target;
if (target.classList.contains('e-edit')) {
target = target.parentElement;
}
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'));
rowData.value = rowObj.data;
}
function onDlgClose () {
dlgShow.value = false;
}
provide('grid', [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]);
</script>
<style scoped>

Просмотреть файл

@ -7,7 +7,7 @@
<div class="row top-row">
<div class="col-xs-12 col-sm-12 col-lg-7 col-md-12"><h3>View Request</h3></div>
<div class="col-xs-12 col-sm-6 col-lg-2 col-md-6">
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click.native="AddBtnClick"> <span class="e-add-icon"></span> Create Request</ejs-button>
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click="AddBtnClick"> <span class="e-add-icon"></span> Create Request</ejs-button>
</div>
<div class="col-xs-12 col-sm-6 col-lg-3 col-md-6 daterange overview-range-picker">
<ejs-daterangepicker ref='dateRangePickerObject' class="e-input-group e-input-custom-tag e-control-wrapper e-date-range-wrapper" id='date-wrapper' :placeholder="waterMark" :change="dateRangeChanged">
@ -16,17 +16,17 @@
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
<ejs-grid class="r-space" ref="gridObj" :rowDataBound="setStyle" :load="onGridLoad" :actionBegin='onActionBegin' :toolbarClick="editToolClicked" :toolbar="toolbar" :actionComplete='onload' :dataSource='gridData' :allowSorting='true' :allowSelection='true' :selectionSettings='selectionSettings' :allowFiltering='true' :allowPaging='true' :allowGrouping='false' :pageSettings='pageSettings' :editSettings='editSettings' :filterSettings='filterSettings'>
<ejs-grid class="r-space" ref="gridObj" :rowDataBound="setStyle" :load="onGridLoad" :actionBegin='onActionBegin' :toolbarClick="editToolClicked" :toolbar="toolbar" :dataSource='gridData' :allowSorting='true' :allowSelection='true' :selectionSettings='selectionSettings' :allowFiltering='true' :allowPaging='true' :allowGrouping='false' :pageSettings='pageSettings' :editSettings='editSettings' :filterSettings='filterSettings'>
<e-columns>
<e-column field='TaskID' headerText='Task ID' textAlign='Right' width=60 :isPrimaryKey='true'></e-column>
<e-column field='TaskID' headerText='Task ID' textAlign='Right' width=80 :isPrimaryKey='true'></e-column>
<e-column field='Employee' headerText='Employee' clipMode='EllipsisWithTooltip' width=120></e-column>
<e-column field='RequestType' headerText='Request Type' :filter='filter' width=90></e-column>
<e-column field='RequestedItem' headerText='Requested Item' :filter='filter' clipMode='EllipsisWithTooltip' width=120></e-column>
<e-column field='RequestedOn' headerText='RequestedOn' textAlign='Right' type='date' editType='datepickeredit' format='yMd' width=90></e-column>
<e-column field='Priority' headerText='Priority' :filter='filter' width=70></e-column>
<e-column field='Priority' headerText='Priority' :filter='filter' width=80></e-column>
<e-column field='Status' headerText='Status' width=70 :visible='false'></e-column>
<e-column field='Note' headerText='Notes' :visible='false'></e-column>
<e-column headerText='' width='60' :commands='commands' textAlign='left'></e-column>
<e-column headerText='' width='70' :commands='commands' textAlign='left'></e-column>
<e-column headerText='' width='150' :commands='labelCommands' textAlign='left' ></e-column>
</e-columns>
</ejs-grid>
@ -34,198 +34,179 @@
</div>
</div>
</template>
<script>
import Vue from 'vue'
import { GridPlugin, Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids'
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin, DateRangePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
import RequestForm from '@/components/RequestForm'
import { requestData, employeeData } from '../datasource.js'
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
import { Browser } from '@syncfusion/ej2-base'
<script setup>
import { ref, provide, getCurrentInstance } from 'vue';
import { GridComponent as EjsGrid, ColumnsDirective as EColumns, ColumnDirective as EColumn,
Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids';
import { ButtonComponent as EjsButton } from '@syncfusion/ej2-vue-buttons';
import { DateRangePickerComponent as EjsDaterangepicker } from '@syncfusion/ej2-vue-calendars';
import RequestForm from '@/components/RequestForm';
import { requestData, employeeData } from '../datasource.js';
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data';
import { Browser } from '@syncfusion/ej2-base';
import { useStore } from 'vuex';
Vue.use(DateRangePickerPlugin)
Vue.use(GridPlugin)
Vue.component(DropDownListComponent)
Vue.use(DatePickerPlugin)
Vue.use(ButtonPlugin)
const store = useStore();
const root = getCurrentInstance();
const gridObj = ref(null);
const dlgShow = ref(false);
const isEditing = ref(false);
const rowData = ref(null);
const waterMark = 'Select a range';
const gridData = requestData;
const editSettings = { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' };
let toolbar = undefined;
const pageSettings = { pageCount: 5, pageSize: 10 };
let filterSettings = { type: 'Menu', columns: [] };
const filter = { type: 'CheckBox' };
const selectionSettings = { persistSelection: true };
const commands = [{ type: 'edit', buttonOption: { iconCss: ' e-icons e-edit', cssClass: 'e-flat e-noback', click: editBtnClick } },
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }];
const labelCommands= [{ buttonOption: { content: 'Approve', iconCss: '', cssClass: 'e-flat e-approve', click: approveClick } },
{ buttonOption: { content: 'Reject', iconCss: '', cssClass: 'e-flat e-reject', click: rejectClick } }];
export default Vue.extend({
data: function () {
return {
dlgShow: false,
isEditing: false,
rowData: null,
waterMark: 'Select a range',
gridData: requestData,
editSettings: { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' },
toolbar: undefined,
editparams: { params: { popupHeight: '300px' } },
pageSettings: { pageCount: 5, pageSize: 10 },
filterSettings: { type: 'Menu', columns: [] },
filter: { type: 'CheckBox' },
selectionSettings: { persistSelection: true },
commands: [{ type: 'edit', buttonOption: { iconCss: ' e-icons e-edit', cssClass: 'e-flat e-noback', click: this.editBtnClick } },
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }],
labelCommands: [{ buttonOption: { content: 'Approve', iconCss: '', cssClass: 'e-flat e-approve', click: this.approveClick } },
{ buttonOption: { content: 'Reject', iconCss: '', cssClass: 'e-flat e-reject', click: this.rejectClick } }]
}
},
methods: {
onGridLoad: function () {
if (Browser.isDevice) {
this.toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete']
this.$refs.gridObj.ej2Instances.columns[8].visible = false
}
},
onload: function () {
},
onActionBegin: function (args) {
if (args.requestType === 'beginEdit') {
this.editBtnClick(args)
args.cancel = true
}
},
dateRangeChanged: function (args) {
// check wheather the value is empty or not
if (args.startDate && args.endDate) {
var filter = [
{ field: 'RequestedOn', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
{ field: 'RequestedOn', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
]
this.filterSettings = {type: 'Menu', columns: filter}
} else {
this.filterSettings = {type: 'Menu', columns: []}
}
},
AddBtnClick: function () {
this.dlgShow = !this.dlgShow
this.isEditing = false
// this.$refs.dialogObj.show()
},
editToolClicked: function (args) {
if (args.item.id === 'editTool') {
this.isEditing = true
var rows = this.$refs.gridObj.ej2Instances.getSelectedRows()[0]
if (!rows) {
this.$refs.gridObj.ej2Instances.editModule.showDialog('EditOperationAlert', this.$refs.gridObj.ej2Instances.editModule.alertDObj)
return
}
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'))
this.rowData = rowObj.data
this.dlgShow = !this.dlgShow
}
},
editBtnClick: function (args) {
this.isEditing = true
this.dlgShow = !this.dlgShow
if (args.type === 'actionBegin') {
this.rowData = args.rowData
return
}
var target = args.target
if (target.classList.contains('e-edit')) {
target = target.parentElement
}
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'))
this.rowData = rowObj.data
},
setStyle: function (args) {
var status = args.data['Status'].toString()
if (status === 'Approved') {
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-reject')
args.row.querySelectorAll('.e-unboundcell')[1].classList.add('row-approve')
args.row.querySelector('.e-approve').classList.add('e-hide')
args.row.querySelector('.e-reject').classList.add('e-hide')
} else if (status === 'Rejected') {
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-approve')
args.row.querySelectorAll('.e-unboundcell')[1].classList.add('row-reject')
args.row.querySelector('.e-approve').classList.add('e-hide')
args.row.querySelector('.e-reject').classList.add('e-hide')
} else {
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-approve')
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-reject')
args.row.querySelector('.e-approve').classList.remove('e-hide')
args.row.querySelector('.e-reject').classList.remove('e-hide')
}
},
onDlgClose () {
this.dlgShow = false
},
approveClick: function (args) {
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['Employee']
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['ImgSrc']
var target = args.target
if (target.classList.contains('e-approve')) {
target = target.parentElement
}
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.getAttribute('data-uid'))
var row = rowObj.data
var grid = document.querySelector('.e-grid')['ej2_instances'][0]
var index = parseInt(args.target.closest('td').getAttribute('index'))
grid.editModule.updateRow(index, {'TaskID': row['TaskID'], 'Status': 'Approved'})
var activity = {
'id': this.$store.state.activityData.length,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'A new request for ' + row['RequestedItem'] + ' has been approved'
}
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
this.$root.$children[0].$refs.toastRef.show({
title: 'Successs!',
content: 'Request approved successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
})
}).catch((reason) => {
alert(reason)
})
this.$root.$children[0].updatePendingRequests()
},
rejectClick: function (args) {
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['Employee']
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['ImgSrc']
var target = args.target
if (target.classList.contains('e-reject')) {
target = target.parentElement
}
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.getAttribute('data-uid'))
var row = rowObj.data
var grid = document.querySelector('.e-grid')['ej2_instances'][0]
var index = grid.selectedRowIndex
grid.editModule.updateRow(index, {'TaskID': row['TaskID'], 'Status': 'Rejected'})
var activity = {
'id': this.$store.state.activityData.length,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'A new request for ' + row['RequestedItem'] + ' has been rejected'
}
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
this.$root.$children[0].$refs.toastRef.show({
title: 'Successs!',
content: 'Request rejected successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
})
}).catch((reason) => {
alert(reason)
})
this.$root.$children[0].updatePendingRequests()
}
},
provide: {
grid: [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]
},
components: {
RequestForm
function onGridLoad() {
if (Browser.isDevice) {
toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete'];
gridObj.value.ej2Instances.columns[8].visible = false;
}
})
}
function onActionBegin(args) {
if (args.requestType === 'beginEdit') {
editBtnClick(args);
args.cancel = true;
}
}
function dateRangeChanged(args) {
// check wheather the value is empty or not
if (args.startDate && args.endDate) {
var filter = [
{ field: 'RequestedOn', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
{ field: 'RequestedOn', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
];
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: filter };
} else {
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: [] };
}
}
function AddBtnClick() {
dlgShow.value = !dlgShow.value;
isEditing.value = false;
// dialogObj.value.show();
}
function editToolClicked(args) {
if (args.item.id === 'editTool') {
isEditing.value = true;
var rows = gridObj.value.ej2Instances.getSelectedRows()[0];
if (!rows) {
gridObj.value.ej2Instances.editModule.showDialog('EditOperationAlert', gridObj.value.ej2Instances.editModule.alertDObj);
return;
}
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'));
rowData.value = rowObj.data;
dlgShow.value = !dlgShow.value;
}
}
function editBtnClick(args) {
isEditing.value = true;
dlgShow.value = !dlgShow.value;
if (args.type === 'actionBegin') {
rowData.value = args.rowData;
return;
}
var target = args.target;
if (target.classList.contains('e-edit')) {
target = target.parentElement;
}
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'));
rowData.value = rowObj.data;
}
function setStyle(args) {
var status = args.data['Status'].toString();
if (status === 'Approved') {
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-reject');
args.row.querySelectorAll('.e-unboundcell')[1].classList.add('row-approve');
args.row.querySelector('.e-approve').classList.add('e-hide');
args.row.querySelector('.e-reject').classList.add('e-hide');
} else if (status === 'Rejected') {
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-approve');
args.row.querySelectorAll('.e-unboundcell')[1].classList.add('row-reject');
args.row.querySelector('.e-approve').classList.add('e-hide');
args.row.querySelector('.e-reject').classList.add('e-hide');
} else {
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-approve');
args.row.querySelectorAll('.e-unboundcell')[1].classList.remove('row-reject');
args.row.querySelector('.e-approve').classList.remove('e-hide');
args.row.querySelector('.e-reject').classList.remove('e-hide');
}
}
function onDlgClose () {
dlgShow.value = false;
}
function approveClick(args) {
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['Employee'];
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['ImgSrc'];
var target = args.target;
if (target.classList.contains('e-approve')) {
target = target.parentElement;
}
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.getAttribute('data-uid'));
var row = rowObj.data;
var grid = document.querySelector('.e-grid')['ej2_instances'][0];
var index = parseInt(args.target.closest('td').getAttribute('index'));
grid.editModule.updateRow(index, {'TaskID': row['TaskID'], 'Status': 'Approved'});
var activity = {
'id': store.state.activityData.length,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'A new request for ' + row['RequestedItem'] + ' has been approved'
};
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
root.root.refs.toastRef.show({
title: 'Successs!',
content: 'Request approved successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
});
}).catch((reason) => {
alert(reason);
});
root.root.devtoolsRawSetupState.updatePendingRequests();
}
function rejectClick(args) {
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['Employee'];
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['ImgSrc'];
var target = args.target;
if (target.classList.contains('e-reject')) {
target = target.parentElement;
}
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.getAttribute('data-uid'));
var row = rowObj.data;
var grid = document.querySelector('.e-grid')['ej2_instances'][0];
var index = parseInt(args.target.closest('td').getAttribute('index'));
grid.editModule.updateRow(index, {'TaskID': row['TaskID'], 'Status': 'Rejected'});
var activity = {
'id': store.state.activityData.length,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'A new request for ' + row['RequestedItem'] + ' has been rejected'
};
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
root.root.refs.toastRef.show({
title: 'Successs!',
content: 'Request rejected successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
});
}).catch((reason) => {
alert(reason);
});
root.root.devtoolsRawSetupState.updatePendingRequests();
}
provide('grid', [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]);
</script>
<style>

Просмотреть файл

@ -7,7 +7,7 @@
<div class="row top-row">
<div class="col-xs-12 col-sm-12 col-lg-7 col-md-12"><h3>View Software</h3></div>
<div class="col-xs-12 col-sm-6 col-lg-2 col-md-6">
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click.native="AddBtnClick"> <span class="e-add-icon"></span> Add New Software</ejs-button>
<ejs-button id="primarybtn" class="asset-btn" :isPrimary="true" v-on:click="AddBtnClick"> <span class="e-add-icon"></span> Add New Software</ejs-button>
</div>
<div class="col-xs-12 col-sm-6 col-lg-3 col-md-6 daterange overview-range-picker">
<ejs-daterangepicker ref='dateRangePickerObject' class="e-input-group e-input-custom-tag e-control-wrapper e-date-range-wrapper" id='date-wrapper' :placeholder="waterMark" :change="dateRangeChanged">
@ -16,7 +16,7 @@
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-12 col-md-12">
<ejs-grid class="r-space" ref="gridObj" :dataSource='gridData' :load="onGridLoad" :actionBegin='onActionBegin' :toolbarClick="editToolClicked" :toolbar="toolbar" :actionComplete='onload' :allowSorting='true' :allowSelection='true' :selectionSettings='selectionSettings' :allowFiltering='true' :allowPaging='true' :allowGrouping='false' :pageSettings='pageSettings' :editSettings='editSettings' :filterSettings='filterSettings'>
<ejs-grid class="r-space" ref="gridObj" :dataSource='gridData' :load="onGridLoad" :actionBegin='onActionBegin' :toolbarClick="editToolClicked" :toolbar="toolbar" :allowSorting='true' :allowSelection='true' :selectionSettings='selectionSettings' :allowFiltering='true' :allowPaging='true' :allowGrouping='false' :pageSettings='pageSettings' :editSettings='editSettings' :filterSettings='filterSettings'>
<e-columns>
<e-column field='TaskID' headerText='Task ID' textAlign='Right' width=90 :isPrimaryKey='true'></e-column>
<e-column field='Name' headerText='Software Name' :filter='filter' clipMode='EllipsisWithTooltip' width=120></e-column>
@ -36,110 +36,91 @@
</div>
</div>
</template>
<script>
import Vue from 'vue'
import { GridPlugin, Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids'
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin, DateRangePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
import AddSoftware from '@/components/AddSoftware'
import { softwareData } from '../datasource.js'
import { Browser } from '@syncfusion/ej2-base'
<script setup>
import { ref, provide } from 'vue';
import { GridComponent as EjsGrid, ColumnsDirective as EColumns, ColumnDirective as EColumn,
Edit, Filter, Group, Page, Selection, CommandColumn, Toolbar } from '@syncfusion/ej2-vue-grids';
import { ButtonComponent as EjsButton } from '@syncfusion/ej2-vue-buttons';
import { DateRangePickerComponent as EjsDaterangepicker } from '@syncfusion/ej2-vue-calendars';
import AddSoftware from '@/components/AddSoftware';
import { softwareData } from '../datasource.js';
import { Browser } from '@syncfusion/ej2-base';
Vue.use(DateRangePickerPlugin)
Vue.use(GridPlugin)
Vue.component(DropDownListComponent)
Vue.use(DatePickerPlugin)
Vue.use(ButtonPlugin)
const gridObj = ref(null);
const dlgShow = ref(false);
const isEditing = ref(false);
const rowData = ref(null);
const waterMark = 'Select a range';
const gridData = softwareData;
const editSettings = { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' };
let toolbar = undefined;
const pageSettings= { pageCount: 5, pageSize: 10 };
let filterSettings = { type: 'Menu', columns: [] };
const filter= { type: 'CheckBox' };
const selectionSettings= { persistSelection: true };
const commands= [{ type: 'edit', buttonOption: { iconCss: ' e-icons e-edit', cssClass: 'e-flat e-noback', click: editBtnClick } },
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }];
export default Vue.extend({
data: function () {
return {
dlgShow: false,
isEditing: false,
rowData: null,
waterMark: 'Select a range',
gridData: softwareData,
editSettings: { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' },
toolbar: undefined,
editparams: { params: { popupHeight: '300px' } },
pageSettings: { pageCount: 5, pageSize: 10 },
filterSettings: { type: 'Menu', columns: [] },
filter: { type: 'CheckBox' },
selectionSettings: { persistSelection: true },
commands: [{ type: 'edit', buttonOption: { iconCss: ' e-icons e-edit', cssClass: 'e-flat e-noback', click: this.editBtnClick } },
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat e-noback' } }]
}
},
methods: {
onGridLoad: function () {
if (Browser.isDevice) {
this.toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete']
this.$refs.gridObj.ej2Instances.columns[11].visible = false
}
},
onload: function () {
},
onActionBegin: function (args) {
if (args.requestType === 'beginEdit') {
this.editBtnClick(args)
args.cancel = true
}
},
dateRangeChanged: function (args) {
// check wheather the value is empty or not
if (args.startDate && args.endDate) {
var filter = [
{ field: 'DOP', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
{ field: 'DOP', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
]
this.filterSettings = {type: 'Menu', columns: filter}
} else {
this.filterSettings = {type: 'Menu', columns: []}
}
},
AddBtnClick: function () {
this.dlgShow = !this.dlgShow
this.isEditing = false
},
editToolClicked: function (args) {
if (args.item.id === 'editTool') {
this.isEditing = true
var rows = this.$refs.gridObj.ej2Instances.getSelectedRows()[0]
if (!rows) {
this.$refs.gridObj.ej2Instances.editModule.showDialog('EditOperationAlert', this.$refs.gridObj.ej2Instances.editModule.alertDObj)
return
}
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'))
this.rowData = rowObj.data
this.dlgShow = !this.dlgShow
}
},
editBtnClick: function (args) {
this.isEditing = true
this.dlgShow = !this.dlgShow
if (args.type === 'actionBegin') {
this.rowData = args.rowData
return
}
var target = args.target
if (target.classList.contains('e-edit')) {
target = target.parentElement
}
let rowObj = this.$refs.gridObj.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'))
this.rowData = rowObj.data
},
onDlgClose () {
this.dlgShow = false
}
},
provide: {
grid: [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]
},
components: {
AddSoftware
function onGridLoad() {
if (Browser.isDevice) {
toolbar = [{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'editTool' }, 'Delete'];
gridObj.value.ej2Instances.columns[11].visible = false;
}
})
}
function onActionBegin(args) {
if (args.requestType === 'beginEdit') {
editBtnClick(args);
args.cancel = true;
}
}
function dateRangeChanged (args) {
// check wheather the value is empty or not
if (args.startDate && args.endDate) {
var filter = [
{ field: 'DOP', operator: 'greaterthanorequal', predicate: 'and', value: args.startDate },
{ field: 'DOP', operator: 'lessthanorequal', predicate: 'and', value: args.endDate }
];
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: filter };
} else {
gridObj.value.ej2Instance.filterSettings = { type: 'Menu', columns: [] };
}
}
function AddBtnClick () {
dlgShow.value = !dlgShow.value;
isEditing.value = false;
}
function editToolClicked(args) {
if (args.item.id === 'editTool') {
isEditing.value = true;
var rows = gridObj.value.ej2Instances.getSelectedRows()[0];
if (!rows) {
gridObj.value.ej2Instances.editModule.showDialog('EditOperationAlert', gridObj.value.ej2Instances.editModule.alertDObj);
return;
}
let rowObj =gridObj.value.ej2Instances.getRowObjectFromUID(rows.getAttribute('data-uid'));
rowData.value = rowObj.data;
dlgShow.value = !dlgShow.value;
}
}
function editBtnClick(args) {
isEditing.value = true;
dlgShow.value = !dlgShow.value;
if (args.type === 'actionBegin') {
rowData.value = args.rowData;
return;
}
var target = args.target;
if (target.classList.contains('e-edit')) {
target = target.parentElement;
}
let rowObj = gridObj.value.ej2Instances.getRowObjectFromUID(target.parentElement.parentElement.parentElement.getAttribute('data-uid'));
rowData.value = rowObj.data;
}
function onDlgClose () {
dlgShow.value = false;
}
provide('grid', [Edit, Group, Filter, Page, Selection, CommandColumn, Toolbar]);
</script>
<style scoped>

Просмотреть файл

@ -10,7 +10,7 @@
<div tabindex="0" class="e-card" id="card-request" @click="requestClick($event)">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">{{this.$store.getters.requests}}</div>
<div class="e-card-header-title">{{store.getters.requests}}</div>
<div class="e-card-sub-title">Requests Processed</div>
</div>
</div>
@ -20,7 +20,7 @@
<div tabindex="0" class="e-card" id="card-license" @click="licenseClick($event)">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">{{this.$store.getters.licenses}}</div>
<div class="e-card-header-title">{{store.getters.licenses}}</div>
<div class="e-card-sub-title">Licenses Issued</div>
</div>
</div>
@ -69,55 +69,45 @@
</div>
<div class="col-lg-4 list-surface">
<div class="list-area">
<ejs-listview id='listview_template' ref='list_template' :fields='fields' :dataSource='data' :showHeader='header' :headerTitle='listTitle' :actionComplete='onComplete' :template='ltemplate'></ejs-listview>
<ejs-listview id='listview_template' ref='list_template' :fields='fields' :dataSource='data' :showHeader='header' :headerTitle='listTitle' :template='ltemplate'></ejs-listview>
</div>
</div>
<!-- </div> -->
</div>
</div>
</template>
<script>
import Vue from 'vue'
import { ListViewPlugin } from '@syncfusion/ej2-vue-lists'
import ActivityTemplate from './ActivityTemplate.vue'
import SoftwareLicenseChart from '@/components/dashboard/SoftwareLicenseChart'
import HardwareStatusChart from '@/components/dashboard/HardwareStatusChart'
import HardwareCategoryChart from '@/components/dashboard/HardwareCategoryChart'
import SoftwareCategoryChart from '@/components/dashboard/SoftwareCategoryChart'
<script setup>
import { ListViewComponent as EjsListview } from '@syncfusion/ej2-vue-lists';
import ActivityTemplate from './ActivityTemplate.vue';
import SoftwareLicenseChart from '@/components/dashboard/SoftwareLicenseChart';
import HardwareStatusChart from '@/components/dashboard/HardwareStatusChart';
import HardwareCategoryChart from '@/components/dashboard/HardwareCategoryChart';
import SoftwareCategoryChart from '@/components/dashboard/SoftwareCategoryChart';
import { createApp } from "vue";
import { useRouter } from 'vue-router';
import { useStore } from 'vuex';
const router = useRouter();
const store = useStore();
const app = createApp();
const header = true;
const data = store.state.activityData;
const ltemplate = function () {
return { template: app.component("dashboardListTemplate", ActivityTemplate) };
};
const listTitle = 'Recent Activities';
const fields = { 'id': 'Employee' };
function requestClick() {
router.push({ path: '/Requests' });
// this.$root.$children[0].$refs.sidebarListObj.selectItem({id: '05'});
}
function licenseClick() {
router.push({ path: '/IssuedLicenses' });
// this.$root.$children[0].$refs.sidebarListObj.selectItem({id: '04'});
}
Vue.use(ListViewPlugin)
export default Vue.extend({
data: function () {
return {
header: true,
data: this.$store.state.activityData,
// eslint-disable-next-line
ltemplate: function () {
return {template: ActivityTemplate}
},
listTitle: 'Recent Activities',
fields: { 'id': 'Employee' }
}
},
methods: {
requestClick: function () {
this.$router.push({ path: '/Requests' })
this.$root.$children[0].$refs.sidebarListObj.selectItem({id: '05'})
},
licenseClick: function () {
this.$router.push({ path: '/IssuedLicenses' })
this.$root.$children[0].$refs.sidebarListObj.selectItem({id: '04'})
},
onComplete: function () {
}
},
components: {
SoftwareLicenseChart,
HardwareStatusChart,
HardwareCategoryChart,
SoftwareCategoryChart
}
})
</script>
<style>

Просмотреть файл

@ -12,12 +12,12 @@
<div class="row">
<div class="col-xs-6 col-sm-6 col-lg-6 col-md-6">
<label class="e-text">Employee Name</label>
<ejs-autocomplete id="employee" name="Emp" data-msg-containerid="errorEmp" v-model="value" v-bind:value="value" ref='employeeInstance' :dataSource='this.$store.getters.empData' :fields='fields'></ejs-autocomplete>
<ejs-autocomplete id="employee" name="Emp" data-msg-containerid="errorEmp" v-model="value" v-bind:value="value" ref='employeeInstance' :dataSource='store.getters.empData' :fields='fields'></ejs-autocomplete>
<div id="errorEmp"></div>
</div>
<div class="col-xs-6 col-sm-6 col-lg-6 col-md-6">
<label class="e-text">Software</label>
<ejs-dropdownlist id="software" name="Name" :dataSource ="this.$store.getters.softwareNames" :fields='softwareFields'></ejs-dropdownlist>
<ejs-dropdownlist id="software" name="Name" :dataSource ="store.getters.softwareNames" :fields='softwareFields'></ejs-dropdownlist>
</div>
</div>
<div class="row">
@ -46,7 +46,7 @@
<div class="row pull-right">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-6">
<ejs-button id="primarybtn" :isPrimary="true" @click.native="addRecord">{{btnName}}</ejs-button>
<ejs-button id="primarybtn" :isPrimary="true" v-on:click="addRecord">{{btnName}}</ejs-button>
</div>
</div>
</div>
@ -54,170 +54,170 @@
</form>
</ejs-dialog>
</template>
<script>
import Vue from 'vue'
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListComponent } from '@syncfusion/ej2-vue-dropdowns'
import { FormValidator } from '@syncfusion/ej2-vue-inputs'
import { employeeData } from '../datasource.js'
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
<script setup>
import { onMounted, computed, getCurrentInstance, ref } from 'vue';
import { DialogComponent as EjsDialog } from '@syncfusion/ej2-vue-popups';
import { ButtonComponent as EjsButton } from '@syncfusion/ej2-vue-buttons';
import { DatePickerComponent as EjsDatepicker } from '@syncfusion/ej2-vue-calendars';
import { DropDownListComponent as EjsDropdownlist, AutoCompleteComponent as EjsAutocomplete } from '@syncfusion/ej2-vue-dropdowns';
import { FormValidator } from '@syncfusion/ej2-vue-inputs';
import { employeeData } from '../datasource.js';
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data';
import { useStore } from 'vuex';
Vue.component(DropDownListComponent)
Vue.use(DatePickerPlugin)
Vue.use(ButtonPlugin)
export default Vue.extend({
data: function () {
return {
fields: {value: 'Employee'},
softwareFields: { text: 'Name', value: 'TaskID' },
header: 'Issue License',
target: document.body,
showCloseIcon: true,
width: '500px',
btnName: 'Submit',
isModal: true,
maxDate: new Date(),
options: {
// Initialize the CustomPlacement.
customPlacement: function (inputElement, errorElement) {
inputElement.parentElement.nextElementSibling.appendChild(errorElement)
},
rules: {
Emp: { required: true },
DOI: { required: true, date: true }
}
},
frmObj: undefined,
value: null,
animationSettings: { effect: 'None' }
}
const store = useStore();
const root = getCurrentInstance();
const dialogObj = ref(null);
const employeeInstance = ref(null);
const fields = {value: 'Employee'};
const softwareFields = { text: 'Name', value: 'TaskID' };
let header = 'Issue License';
const target = document.body;
const showCloseIcon = true;
const width = '500px';
let btnName = 'Submit';
const isModal = true;
const maxDate = new Date();
const options = {
// Initialize the CustomPlacement.
customPlacement: function (inputElement, errorElement) {
inputElement.parentElement.nextElementSibling.appendChild(errorElement);
},
mounted: function () {
this.frmObj = new FormValidator('#formId', this.options)
},
methods: {
dialogClose: function () {
this.$emit('close')
},
dialogOpen: function () {
this.frmObj.reset()
if (!this.isEdit) {
this.header = 'Issue License'
this.btnName = 'Submit'
document.getElementById('employee').value = ''
document.getElementById('software').value = ''
document.getElementById('license-count').value = '0'
document.getElementById('license-key').value = ''
document.getElementById('issue-date').value = new Date().toLocaleDateString()
document.getElementById('note').value = ''
} else {
this.header = 'Edit Issued license'
this.btnName = 'Save'
var row = this.rowData
document.getElementById('taskID').value = row['TaskID']
this.$refs.employeeInstance.ej2Instances.value = row['Employee']
this.$refs.employeeInstance.ej2Instances.dataBind()
document.getElementById('software').value = row['Software']
document.getElementById('license-count').value = '10' // row['InvoiceNo']
document.getElementById('license-key').value = row['LicenseKey']
document.getElementById('issue-date').value = row['IssuedOn'].toLocaleDateString()
document.getElementById('note').value = row['Note']
}
this.$refs.dialogObj.show()
},
addRecord: function () {
var grid = document.querySelector('.e-grid')['ej2_instances'][0]
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['Employee']
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['ImgSrc']
if (this.frmObj.validate()) {
if (!this.isEdit) {
var id = this.$store.state.activityData.length
grid.addRecord({
'TaskID': grid.dataSource.length + 1,
'Employee': document.getElementById('employee').value,
'Email': 'paul.henriot@sample.com',
'Software': document.getElementById('software').value,
'LicenseKey': document.getElementById('license-key').value,
'IssuedOn': new Date(document.getElementById('issue-date').value),
'Note': document.getElementById('note').value
})
var activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'A new License for software' + document.getElementById('software').value + ' has been issued'
}
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
this.$root.$children[0].$refs.toastRef.show({
title: 'Successs!',
content: 'License Issued successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
})
}).catch((reason) => {
alert(reason)
})
} else {
var data = {'TaskID': +document.getElementById('taskID').value,
'Employee': document.getElementById('employee').value,
'Email': 'paul.henriot@sample.com',
'Software': document.getElementById('software').value,
'LicenseKey': document.getElementById('license-key').value,
'IssuedOn': new Date(document.getElementById('issue-date').value),
'Note': document.getElementById('note').value
}
var index = grid.selectedRowIndex
grid.editModule.updateRow(index, data)
activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'The License for software ' + document.getElementById('software').value + ' has been edited'
}
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
this.$root.$children[0].$refs.toastRef.show({
title: 'Successs!',
content: 'License updated successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
})
}).catch((reason) => {
alert(reason)
})
}
this.frmObj.reset()
this.$refs.dialogObj.hide()
this.$emit('close')
}
}
},
props: {
/** Whether the dialog is currently showing */
showing: {
type: Boolean,
required: true,
default: false
},
isEdit: {
type: Boolean,
required: true,
default: false
},
rowData: {
type: Object,
required: false,
default: null
}
},
computed: {
isShowing () {
return this.showing
}
rules: {
Emp: { required: true },
DOI: { required: true, date: true }
}
};
let frmObj = undefined;
const value = null;
const animationSettings = { effect: 'None' };
// eslint-disable-next-line no-undef
onMounted(() => {
frmObj = new FormValidator('#formId', options);
})
function dialogClose() {
emit('close');
}
function dialogOpen () {
frmObj.reset();
if (!props.isEdit) {
header = 'Issue License';
btnName = 'Submit';
document.getElementById('employee').value = '';
document.getElementById('software').value = '';
document.getElementById('license-count').value = '0';
document.getElementById('license-key').value = '';
document.getElementById('issue-date').value = new Date().toLocaleDateString();
document.getElementById('note').value = '';
} else {
header = 'Edit Issued license';
btnName = 'Save';
var row = props.rowData;
document.getElementById('taskID').value = row['TaskID'];
employeeInstance.value.ej2Instances.value = row['Employee'];
employeeInstance.value.ej2Instances.dataBind();
document.getElementById('software').value = row['Software'];
document.getElementById('license-count').value = '10' // row['InvoiceNo'];
document.getElementById('license-key').value = row['LicenseKey'];
document.getElementById('issue-date').value = row['IssuedOn'].toLocaleDateString();
document.getElementById('note').value = row['Note'];
}
dialogObj.value.show();
}
function addRecord() {
var grid = document.querySelector('.e-grid')['ej2_instances'][0];
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['Employee'];
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['ImgSrc'];
if (frmObj.validate()) {
if (!props.isEdit) {
var id = store.state.activityData.length;
grid.addRecord({
'TaskID': grid.dataSource.length + 1,
'Employee': document.getElementById('employee').value,
'Email': 'paul.henriot@sample.com',
'Software': document.getElementById('software').value,
'LicenseKey': document.getElementById('license-key').value,
'IssuedOn': new Date(document.getElementById('issue-date').value),
'Note': document.getElementById('note').value
});
var activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'A new License for software' + document.getElementById('software').value + ' has been issued'
};
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
root.root.refs.toastRef.show({
title: 'Successs!',
content: 'License Issued successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
});
}).catch((reason) => {
alert(reason);
});
} else {
var data = {
'TaskID': +document.getElementById('taskID').value,
'Employee': document.getElementById('employee').value,
'Email': 'paul.henriot@sample.com',
'Software': document.getElementById('software').value,
'LicenseKey': document.getElementById('license-key').value,
'IssuedOn': new Date(document.getElementById('issue-date').value),
'Note': document.getElementById('note').value
};
var index = grid.selectedRowIndex;
grid.editModule.updateRow(index, data);
activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'The License for software ' + document.getElementById('software').value + ' has been edited'
};
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
root.root.refs.toastRef.show({
title: 'Successs!',
content: 'License updated successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
});
}).catch((reason) => {
alert(reason);
});
}
frmObj.reset();
dialogObj.value.hide();
emit('close');
}
}
// eslint-disable-next-line no-undef
const emit = defineEmits(['close']);
// eslint-disable-next-line no-undef
const props = defineProps({
/** Whether the dialog is currently showing */
showing: {
type: Boolean,
required: true,
default: false
},
isEdit: {
type: Boolean,
required: true,
default: false
},
rowData: {
type: Object,
required: false,
default: null
}
});
const isShowing = computed(() => {
return props.showing;
});
</script>
<style scoped>

Просмотреть файл

@ -3,43 +3,45 @@
<ejs-listview id='listview_notification' :fields='fields' ref='list_notification' :dataSource='data' :showHeader='header' :headerTitle='listTitle' :template='ltemplate' :select='onComplete'></ejs-listview>
</ejs-sidebar>
</template>
<script>
import Vue from 'vue'
import { ListViewPlugin } from '@syncfusion/ej2-vue-lists'
import ActivityTemplate from './ActivityTemplate.vue'
<script setup>
import { ListViewComponent as EjsListview } from '@syncfusion/ej2-vue-lists';
import { SidebarComponent as EjsSidebar } from '@syncfusion/ej2-vue-navigations';
import ActivityTemplate from './ActivityTemplate.vue';
import { createApp, ref } from "vue";
import { useStore } from 'vuex';
Vue.use(ListViewPlugin)
export default Vue.extend({
data: function () {
return {
header: true,
data: this.$store.state.activityData,
// eslint-disable-next-line
ltemplate: function () {
return {template: ActivityTemplate}
},
fields: { 'id': 'Employee' },
listTitle: 'Notifications',
type: 'Over',
width: '300px',
enableDock: false,
closeOnDocumentClick: true,
showBackdrop: false,
sidebarTarget: navigator.userAgent.indexOf('Firefox') !== -1 ? 'body' : '.content',
position: 'Right'
}
},
methods: {
toggle: function () {
this.$refs.list_notification.ej2Instances.reRender()
this.$refs.notifybarInstance.toggle()
},
hide: function () {
this.$refs.notifybarInstance.hide()
},
onComplete: function () {
}
}
const store = useStore();
const list_notification = ref(null);
const notifybarInstance = ref(null);
const app = createApp();
const header = true;
const data = store.state.activityData;
const ltemplate = function () {
return {template: app.component("notificationListTemplate", ActivityTemplate)};
};
const fields = { 'id': 'Employee' };
const listTitle = 'Notifications';
const type = 'Over';
const width = '300px';
const enableDock = false;
const showBackdrop = false;
const sidebarTarget = navigator.userAgent.indexOf('Firefox') !== -1 ? 'body' : '.content';
const position = 'Right';
function toggle() {
list_notification.value.ej2Instances.reRender()
notifybarInstance.value.toggle()
}
// eslint-disable-next-line
function hide() {
notifybarInstance.value.hide()
}
function onComplete() {
}
// eslint-disable-next-line no-undef
defineExpose({
hide,
toggle
})
</script>

Просмотреть файл

@ -12,7 +12,7 @@
<div class="row">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Employee Name</label>
<ejs-autocomplete id="employee" name="Emp" data-msg-containerid="errorEmp" v-model="value" v-bind:value="value" ref='employeeInstance' :dataSource='this.$store.getters.empData' :fields='fields' required></ejs-autocomplete>
<ejs-autocomplete id="employee" name="Emp" data-msg-containerid="errorEmp" v-model="value" v-bind:value="value" ref='employeeInstance' :dataSource='store.getters.empData' :fields='fields' required></ejs-autocomplete>
<div id="errorEmp"></div>
</div>
</div>
@ -29,13 +29,13 @@
<div v-show="isHardware">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Hardware</label>
<ejs-dropdownlist id="Hardware" name="Hardware" :dataSource ="this.$store.getters.hardwareNames" :fields='hardwareFields'></ejs-dropdownlist>
<ejs-dropdownlist id="Hardware" name="Hardware" :dataSource ="store.getters.hardwareNames" :fields='hardwareFields'></ejs-dropdownlist>
</div>
</div>
<div v-show="!isHardware">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-12">
<label class="e-text">Software</label>
<ejs-dropdownlist id="Software" name="Software" :dataSource ="this.$store.getters.softwareNames" :fields='softwareFields'></ejs-dropdownlist>
<ejs-dropdownlist id="Software" name="Software" :dataSource ="$store.getters.softwareNames" :fields='softwareFields'></ejs-dropdownlist>
</div>
</div>
</div>
@ -59,7 +59,7 @@
<div class="row pull-right">
<div class="col-xs-12 col-sm-12 col-lg-6 col-md-6">
<ejs-button id="primarybtn" :isPrimary="true" @click.native="addRecord">{{btnName}}</ejs-button>
<ejs-button id="primarybtn" :isPrimary="true" v-on:click="addRecord">{{btnName}}</ejs-button>
</div>
</div>
</div>
@ -67,200 +67,197 @@
</form>
</ejs-dialog>
</template>
<script>
import Vue from 'vue'
import { ButtonPlugin, RadioButtonPlugin } from '@syncfusion/ej2-vue-buttons'
import { DatePickerPlugin } from '@syncfusion/ej2-vue-calendars'
import { DropDownListComponent, AutoCompletePlugin } from '@syncfusion/ej2-vue-dropdowns'
import { DialogPlugin } from '@syncfusion/ej2-vue-popups'
import { employeeData } from '../datasource.js'
import { FormValidator } from '@syncfusion/ej2-vue-inputs'
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
<script setup>
// eslint-disable-next-line no-unused-vars
import { onMounted, computed, watch, ref, getCurrentInstance } from 'vue';
import { ButtonComponent as EjsButton, RadioButtonComponent as EjsRadiobutton } from '@syncfusion/ej2-vue-buttons';
import { DatePickerComponent as EjsDatepicker } from '@syncfusion/ej2-vue-calendars';
import { DropDownListComponent as EjsDropdownlist, AutoCompleteComponent as EjsAutocomplete } from '@syncfusion/ej2-vue-dropdowns';
import { DialogComponent as EjsDialog } from '@syncfusion/ej2-vue-popups';
import { employeeData } from '../datasource.js';
import { FormValidator } from '@syncfusion/ej2-vue-inputs';
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data';
import { useStore } from 'vuex';
Vue.use(DialogPlugin)
Vue.use(RadioButtonPlugin)
Vue.component(DropDownListComponent)
Vue.use(DatePickerPlugin)
Vue.component(ButtonPlugin)
Vue.use(AutoCompletePlugin)
export default Vue.extend({
data: function () {
return {
priortyList: [
{ id: 'stat-1', text: 'Low' },
{ id: 'stat-2', text: 'Normal' },
{ id: 'stat-3', text: 'High' },
{ id: 'stat-4', text: 'Critical' }
],
softwareFields: { text: 'Name', value: 'TaskID' },
hardwareFields: { text: 'Name', value: 'TaskID' },
selectedType: 'Hardware',
isHardware: true,
header: 'Request Form',
target: document.body,
showCloseIcon: true,
btnName: 'Submit Request',
width: '500px',
isModal: true,
fields: {value: 'Employee'},
query: new Query().select(['id', 'Employee']),
enableDate: true,
maxDate: new Date(),
options: {
// Initialize the CustomPlacement.
customPlacement: function (inputElement, errorElement) {
inputElement.parentElement.nextElementSibling.appendChild(errorElement)
},
rules: {
Emp: { required: true },
DOR: { required: true, date: true }
}
},
frmObj: undefined,
animationSettings: { effect: 'None' },
value: null
}
const store = useStore();
const root = getCurrentInstance();
const dialogObj = ref(null);
const employeeInstance = ref(null);
const priortyList = [
{ id: 'stat-1', text: 'Low' },
{ id: 'stat-2', text: 'Normal' },
{ id: 'stat-3', text: 'High' },
{ id: 'stat-4', text: 'Critical' }
];
const softwareFields = { text: 'Name', value: 'TaskID' };
const hardwareFields = { text: 'Name', value: 'TaskID' };
// eslint-disable-next-line
const selectedType = ref('Hardware');
let isHardware = true;
let header = 'Request Form';
const target = document.body;
const showCloseIcon = true;
let btnName = 'Submit Request';
const width = '500px';
const isModal = true;
const fields = {value: 'Employee'};
// eslint-disable-next-line
let enableDate = true;
const maxDate = new Date();
const options = {
// Initialize the CustomPlacement.
customPlacement: function (inputElement, errorElement) {
inputElement.parentElement.nextElementSibling.appendChild(errorElement)
},
watch: {
selectedType: function (newType) {
this.$dispatch('selectedType', newType)
}
},
mounted: function () {
this.frmObj = new FormValidator('#formId', this.options)
},
methods: {
getType: function () {
this.isHardware = document.getElementById('HardwareRB').checked
},
dialogClose: function () {
this.$emit('close')
},
dialogOpen: function () {
this.frmObj.reset()
this.enableDate = true
if (!this.isEdit) {
this.header = 'Request Form'
this.btnName = 'Submit Request'
document.getElementById('employee').value = ''
document.getElementById('HardwareRB').checked = true
this.getType()
document.getElementById('Hardware').value = ''
document.getElementById('requested-on').value = new Date().toLocaleDateString()
document.getElementById('priority').value = 'Normal'
document.getElementById('note').value = ''
} else {
this.header = 'Edit Request'
this.btnName = 'Save'
var row = this.rowData
var type = row['RequestType']
document.getElementById('taskID').value = row['TaskID']
this.$refs.employeeInstance.ej2Instances.value = row['Employee']
this.$refs.employeeInstance.ej2Instances.dataBind()
document.getElementById(type + 'RB').checked = true
this.getType()
document.getElementById('requested-on').value = row['RequestedOn'].toLocaleDateString()
document.getElementById(type).value = row['RequestedItem']
document.getElementById('priority').value = row['Priority']
document.getElementById('note').value = row['Note']
}
this.$refs.dialogObj.show()
},
addRecord: function () {
var grid = document.querySelector('.e-grid')['ej2_instances'][0]
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['Employee']
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', this.$store.state.currentUserID)))[0]['ImgSrc']
if (this.frmObj.validate()) {
var id = this.$store.state.activityData.length
var type = document.querySelector('input[name=type]:checked').value
if (!this.isEdit) {
grid.addRecord({
'TaskID': grid.dataSource.length + 1,
'Employee': document.getElementById('employee').value,
'RequestType': type,
'RequestedItem': document.getElementById(type).value,
'Priority': document.getElementById('priority').value,
'Status': 'Pending',
'Note': document.getElementById('note').value,
'RequestedOn': new Date(document.getElementById('requested-on').value)
})
var activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'A new request for ' + document.getElementById(type).value + ' has been generated'
}
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
this.$root.$children[0].$refs.toastRef.show({
title: 'Successs!',
content: 'Request generated successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
})
}).catch((reason) => {
alert(reason)
})
} else {
var data = {'TaskID': +document.getElementById('taskID').value,
'Employee': document.getElementById('employee').value,
'RequestType': type,
'RequestedItem': document.getElementById(type).value,
'Priority': document.getElementById('priority').value,
'Note': document.getElementById('note').value,
'RequestedOn': new Date(document.getElementById('requested-on').value),
'Status': this.rowData['Status']
}
var index = grid.selectedRowIndex
grid.editModule.updateRow(index, data)
activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'The request for ' + document.getElementById(type).value + ' has been updated'
}
this.$store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
this.$root.$children[0].$refs.toastRef.show({
title: 'Successs!',
content: 'Request updated successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
})
}).catch((reason) => {
alert(reason)
})
}
this.frmObj.reset()
this.$refs.dialogObj.hide()
this.$emit('close')
}
}
},
props: {
/** Whether the dialog is currently showing */
showing: {
type: Boolean,
required: true,
default: false
},
isEdit: {
type: Boolean,
required: true,
default: false
},
rowData: {
type: Object,
required: false,
default: null
}
},
computed: {
isShowing () {
return this.showing
}
rules: {
Emp: { required: true },
DOR: { required: true, date: true }
}
};
let frmObj = undefined;
const animationSettings = { effect: 'None' };
let value = null;
// watch(selectedType, ( newValue, oldValue ) => {
// this.$dispatch('selectedType', newValue)
// })
// eslint-disable-next-line no-undef
onMounted(() => {
frmObj = new FormValidator('#formId', options);
})
function getType() {
isHardware = document.getElementById('HardwareRB').checked;
}
function dialogClose() {
emit('close');
}
function dialogOpen() {
frmObj.reset();
enableDate = true;
if (!props.isEdit) {
header = 'Request Form';
btnName = 'Submit Request';
document.getElementById('employee').value = '';
document.getElementById('HardwareRB').checked = true;
getType();
document.getElementById('Hardware').value = '';
document.getElementById('requested-on').value = new Date().toLocaleDateString();
document.getElementById('priority').value = 'Normal';
document.getElementById('note').value = '';
} else {
header = 'Edit Request';
btnName = 'Save';
var row = props.rowData;
var type = row['RequestType'];
document.getElementById('taskID').value = row['TaskID'];
employeeInstance.value.ej2Instances.value = row['Employee'];
employeeInstance.value.ej2Instances.dataBind();
document.getElementById(type + 'RB').checked = true;
getType();
document.getElementById('requested-on').value = row['RequestedOn'].toLocaleDateString();
document.getElementById(type).value = row['RequestedItem'];
document.getElementById('priority').value = row['Priority'];
document.getElementById('note').value = row['Note'];
}
dialogObj.value.show();
}
function addRecord() {
var grid = document.querySelector('.e-grid')['ej2_instances'][0];
var userName = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['Employee'];
var userImg = new DataManager(employeeData).executeLocal(new Query().where(new Predicate('id', 'equal', store.state.currentUserID)))[0]['ImgSrc'];
if (frmObj.validate()) {
var id = store.state.activityData.length;
var type = document.querySelector('input[name=type]:checked').value;
if (!props.isEdit) {
grid.addRecord({
'TaskID': grid.dataSource.length + 1,
'Employee': document.getElementById('employee').value,
'RequestType': type,
'RequestedItem': document.getElementById(type).value,
'Priority': document.getElementById('priority').value,
'Status': 'Pending',
'Note': document.getElementById('note').value,
'RequestedOn': new Date(document.getElementById('requested-on').value)
});
var activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'A new request for ' + document.getElementById(type).value + ' has been generated'
};
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
root.root.refs.toastRef.show({
title: 'Successs!',
content: 'Request generated successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
});
}).catch((reason) => {
alert(reason);
});
} else {
var data = {
'TaskID': +document.getElementById('taskID').value,
'Employee': document.getElementById('employee').value,
'RequestType': type,
'RequestedItem': document.getElementById(type).value,
'Priority': document.getElementById('priority').value,
'Note': document.getElementById('note').value,
'RequestedOn': new Date(document.getElementById('requested-on').value),
'Status': props.rowData['Status']
};
var index = grid.selectedRowIndex;
grid.editModule.updateRow(index, data);
activity = {
'id': id,
'Employee': userName,
'ImgSrc': userImg,
'TimeStamp': new Date().toLocaleDateString(),
'Message': 'The request for ' + document.getElementById(type).value + ' has been updated'
};
store.dispatch('addActivity', Object.assign({}, activity)).then(() => {
root.root.refs.toastRef.show({
title: 'Successs!',
content: 'Request updated successfully',
cssClass: 'e-toast-success',
icon: 'e-success toast-icons'
});
}).catch((reason) => {
alert(reason);
});
}
frmObj.reset();
dialogObj.value.hide();
emit('close');
}
}
// eslint-disable-next-line no-undef
const emit = defineEmits(['close']);
// eslint-disable-next-line no-undef
const props = defineProps({
/** Whether the dialog is currently showing */
showing: {
type: Boolean,
required: true,
default: false
},
isEdit: {
type: Boolean,
required: true,
default: false
},
rowData: {
type: Object,
required: false,
default: null
}
});
const isShowing = computed(() => {
return props.showing;
});
</script>
<style scoped>

Просмотреть файл

@ -4,62 +4,54 @@
<ejs-chart style='display:block' align='center' id='chart002' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'
:chartArea='chartArea' :tooltip='tooltip'>
<e-series-collection>
<e-series :dataSource='this.$store.getters.laptopData' :query='laptopQuery' type='Column' xName='key' yName='count' name='Laptop' :marker='marker' fill='#A6DC7E'> </e-series>
<e-series :dataSource='this.$store.getters.monitorData' :query='monitorQuery' type='Column' xName='key' yName='count' name='Monitor' :marker='marker' fill='#6EB5D0'> </e-series>
<e-series :dataSource='this.$store.getters.tabletData' :query='tabletQuery' type='Column' xName='key' yName='count' name='Tablet' :marker='marker' fill='#7E7EDC'> </e-series>
<e-series :dataSource='this.$store.getters.miscData' :query='miscQuery' type='Column' xName='key' yName='count' name='Miscellaneous' :marker='marker' fill='#D075C6'> </e-series>
<e-series :dataSource='store.getters.laptopData' :query='laptopQuery' type='Column' xName='key' yName='count' name='Laptop' :marker='marker' fill='#A6DC7E'> </e-series>
<e-series :dataSource='store.getters.monitorData' :query='monitorQuery' type='Column' xName='key' yName='count' name='Monitor' :marker='marker' fill='#6EB5D0'> </e-series>
<e-series :dataSource='store.getters.tabletData' :query='tabletQuery' type='Column' xName='key' yName='count' name='Tablet' :marker='marker' fill='#7E7EDC'> </e-series>
<e-series :dataSource='store.getters.miscData' :query='miscQuery' type='Column' xName='key' yName='count' name='Miscellaneous' :marker='marker' fill='#D075C6'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import Vue from 'vue'
import { ChartPlugin, ColumnSeries, Category, DataLabel, Tooltip, Legend } from '@syncfusion/ej2-vue-charts'
import { Query } from '@syncfusion/ej2-data'
<script setup>
import { provide } from 'vue';
import { ChartComponent as EjsChart, SeriesCollectionDirective as ESeriesCollection,
SeriesDirective as ESeries, ColumnSeries, Category, DataLabel, Tooltip, Legend } from '@syncfusion/ej2-vue-charts';
import { Query } from '@syncfusion/ej2-data';
import { useStore } from 'vuex';
Vue.use(ChartPlugin)
export default Vue.extend({
data: function () {
return {
laptopQuery: new Query().take(this.$store.getters.laptopData.length),
monitorQuery: new Query().take(this.$store.getters.monitorData.length),
tabletQuery: new Query().take(this.$store.getters.tabletData.length),
miscQuery: new Query().take(this.$store.getters.miscData.length),
// Initializing Primary X Axis
primaryXAxis: {
const store = useStore();
const laptopQuery = new Query().take(store.getters.laptopData.length);
const monitorQuery = new Query().take(store.getters.monitorData.length);
const tabletQuery = new Query().take(store.getters.tabletData.length);
const miscQuery = new Query().take(store.getters.miscData.length);
// Initializing Primary X Axis
const primaryXAxis = {
valueType: 'Category', interval: 0, majorGridLines: { width: 0 }
},
chartArea: { border: { width: 0 } },
};
const chartArea = { border: { width: 0 } };
// Initializing Primary Y Axis
primaryYAxis:
{
minimum: 0,
maximum: 8,
interval: 10,
majorGridLines: { width: 0 },
majorTickLines: { width: 0 },
lineStyle: { width: 0 },
labelStyle: { color: 'transparent' }
},
theme: 'Fabric',
width: '100%',
marker:
{ dataLabel:
{ visible: true, position: 'Top', font: { fontWeight: '600' }
}
},
tooltip: {
// Initializing Primary Y Axis
const primaryYAxis =
{
minimum: 0,
maximum: 8,
interval: 10,
majorGridLines: { width: 0 },
majorTickLines: { width: 0 },
lineStyle: { width: 0 },
labelStyle: { color: 'transparent' }
};
const marker = {
dataLabel: { visible: true, position: 'Top', font: { fontWeight: '600' }}
};
const tooltip = {
enable: true
},
title: 'Statistics by Hardware Category',
enableSmartLabels: true
}
},
provide: {
chart: [ColumnSeries, Legend, DataLabel, Category, Tooltip]
}
})
};
provide('chart', [ColumnSeries, Legend, DataLabel, Category, Tooltip]);
</script>
<style scoped>

Просмотреть файл

@ -4,49 +4,43 @@
<ejs-accumulationchart ref='hardware-pie' :theme='theme' style='display:block' align='center' id='chart001'
:legendSettings='legendSettings' :tooltip='tooltip' enableSmartLables='true'>
<e-accumulation-series-collection>
<e-accumulation-series :dataSource='this.$store.getters.hardwareStatus' :query='queries' xName='key' yName='count' :dataLabel='dataLabel' :startAngle='startAngle' :endAngle='endAngle' :explodeOffset='explodeOffset' :explodeIndex='explodeIndex' :radius='radius' name='Hardware' innerRadius='0%' explode='true' width=2 :palettes="colors"> </e-accumulation-series>
<e-accumulation-series :dataSource='store.getters.hardwareStatus' :query='queries' xName='key' yName='count' :dataLabel='dataLabel' :startAngle='startAngle' :endAngle='endAngle' :explodeOffset='explodeOffset' :explodeIndex='explodeIndex' :radius='radius' name='Hardware' innerRadius='0%' explode='true' width=2 :palettes="colors"> </e-accumulation-series>
</e-accumulation-series-collection>
</ejs-accumulationchart>
</div>
</template>
<script>
import Vue from 'vue'
import { AccumulationChartPlugin, AccumulationTooltip, PieSeries, AccumulationDataLabel, AccumulationLegend } from '@syncfusion/ej2-vue-charts'
import { Query } from '@syncfusion/ej2-data'
<script setup>
import { provide } from 'vue';
import { AccumulationChartComponent as EjsAccumulationchart, AccumulationSeriesCollectionDirective as EAccumulationSeriesCollection,
AccumulationSeriesDirective as EAccumulationSeries, AccumulationTooltip, PieSeries, AccumulationDataLabel, AccumulationLegend } from '@syncfusion/ej2-vue-charts';
import { Query } from '@syncfusion/ej2-data';
import { useStore } from 'vuex';
Vue.use(AccumulationChartPlugin)
export default Vue.extend({
data: function () {
return {
theme: 'Fabric',
queries: new Query().take(this.$store.getters.hardwareStatus.length),
title: 'Statistics by Hardware Status',
enableSmartLabels: true,
legendSettings: {
visible: true,
position: 'Bottom'
},
tooltip: { enable: true },
startAngle: '0',
endAngle: '360',
radius: '90%',
explodeOffset: '5%',
explodeIndex: 0,
colors: ['#7F9FD2', '#81B8B3', '#7FD29F', '#AEEB8E'],
dataLabel: {
visible: true,
position: 'Inside',
name: 'text',
font: {
fontWeight: '600'
}
}
}
},
provide: {
accumulationchart: [AccumulationLegend, PieSeries, AccumulationTooltip, AccumulationDataLabel]
const store = useStore();
const theme = 'Fabric';
const queries = new Query().take(store.getters.hardwareStatus.length);
const legendSettings= {
visible: true,
position: 'Bottom'
};
const tooltip = { enable: true };
const startAngle = '0';
const endAngle = '360';
const radius = '90%';
const explodeOffset = '5%';
const explodeIndex = 0;
const colors = ['#7F9FD2', '#81B8B3', '#7FD29F', '#AEEB8E'];
const dataLabel = {
visible: true,
position: 'Inside',
name: 'text',
font: {
fontWeight: '600'
}
})
};
provide('accumulationchart', [AccumulationLegend, PieSeries, AccumulationTooltip, AccumulationDataLabel]);
</script>
<style scoped>

Просмотреть файл

@ -8,45 +8,39 @@
</ejs-treemap>
</div>
</template>
<script>
import Vue from 'vue'
import { TreeMapPlugin, TreeMapTooltip, TreeMapLegend } from '@syncfusion/ej2-vue-treemap'
<script setup>
import { provide } from 'vue';
import { TreeMapComponent as EjsTreemap, TreeMapTooltip, TreeMapLegend } from '@syncfusion/ej2-vue-treemap';
import { useStore } from 'vuex';
Vue.use(TreeMapPlugin)
export default Vue.extend({
data: function () {
return {
useGroupingSeparator: true,
dataSource: this.$store.state.softwareInput,
legendSettings: {
visible: true,
position: 'Bottom',
shape: 'Rectangle',
shapeHeight: 7,
shapeWidth: 7
},
palette: ['#AEEB8E', '#D075C6', '#7E7EDC', '#7EC9DC', '#D6DC7E'],
tooltipSettings: {
visible: true,
// eslint-disable-next-line
format: '${Name}<br>License Count : ${LicenseCount}'
},
leafItemSettings: {
labelPath: 'Name',
border: { color: '#000000', width: 0.5 }
},
weightValuePath: 'LicenseCount',
levels: [
{
groupPath: 'Category', border: 'none' // { color: 'white', width: 0.5 }
}
]
const store = useStore();
const useGroupingSeparator = true;
const dataSource = store.state.softwareInput;
const legendSettings = {
visible: true,
position: 'Bottom',
shape: 'Rectangle',
shapeHeight: 7,
shapeWidth: 7
};
const palette = ['#AEEB8E', '#D075C6', '#7E7EDC', '#7EC9DC', '#D6DC7E'];
const tooltipSettings = {
visible: true,
// eslint-disable-next-line
format: '${Name}<br>License Count : ${LicenseCount}'
};
const leafItemSettings = {
labelPath: 'Name',
border: { color: '#000000', width: 0.5 }
};
const weightValuePath = 'LicenseCount';
const levels = [
{
groupPath: 'Category', border: 'none' // { color: 'white', width: 0.5 }
}
},
provide: {
treemap: [TreeMapTooltip, TreeMapLegend]
}
})
];
provide('treemap', [TreeMapTooltip, TreeMapLegend]);
</script>
<style scoped>

Просмотреть файл

@ -9,44 +9,40 @@
</ejs-accumulationchart>
</div>
</template>
<script>
import Vue from 'vue'
import { AccumulationChartPlugin, AccumulationTooltip, PieSeries, AccumulationDataLabel, AccumulationLegend } from '@syncfusion/ej2-vue-charts'
import { Query } from '@syncfusion/ej2-data'
<script setup>
import { provide } from 'vue';
import { AccumulationChartComponent as EjsAccumulationchart,
AccumulationSeriesCollectionDirective as EAccumulationSeriesCollection,
AccumulationSeriesDirective as EAccumulationSeries, AccumulationTooltip,
PieSeries, AccumulationDataLabel, AccumulationLegend } from '@syncfusion/ej2-vue-charts';
import { Query } from '@syncfusion/ej2-data';
import { useStore } from 'vuex';
Vue.use(AccumulationChartPlugin)
export default Vue.extend({
data: function () {
return {
theme: 'Fabric',
queries: new Query().take(this.$store.getters.softwareLicense.length),
title: 'Statistics by Software License Type',
enableSmartLabels: true,
legendSettings: {
visible: true,
position: 'Bottom'
},
tooltip: { enable: true },
startAngle: '0',
endAngle: '360',
radius: '90%',
explodeOffset: '5%',
explodeIndex: 0,
colors: ['#FDC288', '#A483D5', '#CB85AA'],
dataLabel: {
visible: true,
position: 'Inside',
name: 'text',
font: {
fontWeight: '600'
}
}
}
},
provide: {
accumulationchart: [AccumulationLegend, PieSeries, AccumulationTooltip, AccumulationDataLabel]
const store = useStore();
const theme = 'Fabric';
const queries= new Query().take(store.getters.softwareLicense.length);
const legendSettings= {
visible: true,
position: 'Bottom'
};
const tooltip = { enable: true };
const startAngle ='0';
const endAngle = '360';
const radius = '90%';
const explodeOffset = '5%';
const explodeIndex = 0;
const colors = ['#FDC288', '#A483D5', '#CB85AA'];
const dataLabel = {
visible: true,
position: 'Inside',
name: 'text',
font: {
fontWeight: '600'
}
})
};
provide('accumulationchart', [AccumulationLegend, PieSeries, AccumulationTooltip, AccumulationDataLabel]);
</script>
<style scoped>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,18 +1,148 @@
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import { createApp } from 'vue'
import App from './App.vue'
import { createRouter, createWebHashHistory } from 'vue-router'
import { createStore } from 'vuex';
import { requestData, licenseData, hardwareData, softwareData, listData, employeeData } from './datasource'
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
Vue.config.productionTip = false
Vue.config.devtools = true
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
store,
components: { App },
template: '<App/>',
data: {}
})
import AddHardware from './components/AddHardware.vue'
import AddSoftware from './components/AddSoftware.vue'
import RequestForm from './components/RequestForm.vue'
import IssueLicense from './components/IssueLicense.vue'
import AllHardware from './components/AllHardware.vue'
import dashboard from './components/DashboardTemplate.vue'
import AllSoftware from './components/AllSoftware.vue'
import AllRequests from './components/AllRequests.vue'
import AllIssuedLicenses from './components/AllIssuedLicenses.vue'
import About from './components/AboutTemplate.vue'
const routes = [
{
path: '/',
name: 'Dashboard',
component: dashboard
},
{
path: '/About',
name: 'About',
component: About
},
{
path: '/Software',
name: 'Software',
component: AllSoftware
},
{
path: '/Hardware',
name: 'Hardware',
component: AllHardware
},
{
path: '/AddHardware',
name: 'AddHardware',
component: AddHardware
},
{
path: '/AddSoftware',
name: 'AddSoftware',
component: AddSoftware
},
{
path: '/RequestForm',
name: 'RequestForm',
component: RequestForm
},
{
path: '/Requests',
name: 'Requests',
component: AllRequests
},
{
path: '/IssuedLicenses',
name: 'Issued Licenses',
component: AllIssuedLicenses
},
{
path: '/IssueLicense',
name: 'IssueLicense',
component: IssueLicense
}
]
const store = createStore({
state: {
requestInput: requestData,
licensesInput: licenseData,
hardwareInput: hardwareData,
softwareInput: softwareData,
activityData: listData,
empInput: employeeData,
currentUserID: 2
},
getters: {
requests: state => {
return new DataManager(state.requestInput).executeLocal(new Query().where(new Predicate('Status', 'notequal', 'Pending'))).length
},
pendingRequests: state => {
return new DataManager(state.requestInput).executeLocal(new Query().where(new Predicate('Status', 'equal', 'Pending'))).length
},
licenses: state => {
return state.licensesInput.length
},
hardwareNames: state => {
return new DataManager(state.hardwareInput).executeLocal(new Query().select(['Name', 'TaskID']))
},
hardwareStatus: state => {
return new DataManager(state.hardwareInput).executeLocal(new Query().group('Status'))
},
laptopData: state => {
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Laptop')).group('Status'))
},
monitorData: state => {
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Monitor')).group('Status'))
},
tabletData: state => {
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Tablet')).group('Status'))
},
miscData: state => {
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Miscellaneous')).group('Status'))
},
softwareNames: state => {
return new DataManager(state.softwareInput).executeLocal(new Query().select(['Name', 'TaskID']))
},
softwareLicense: state => {
return new DataManager(state.softwareInput).executeLocal(new Query().group('LicenseType'))
},
softwareCategory: state => {
return new DataManager(state.softwareInput).executeLocal(new Query().group('Category'))
},
empData: state => {
return new DataManager(state.empInput).executeLocal(new Query().select(['id', 'Employee']))
}
},
mutations: {
addActivity (state, activity) {
state.activityData.push(activity)
}
},
actions: {
addActivity (context, activity) {
return new Promise((resolve, reject) => {
var userExist = context.state.empInput.find((user) => {
return user.Employee === activity.Employee
})
if (!userExist) {
reject(new Error('No such user found!'))
} else if (activity.Employee === '') {
reject(new Error('User name cannot be empty!'))
} else {
context.commit('addActivity', activity)
resolve(Object.assign({}, userExist))
}
})
}
}
})
const router = createRouter({ history: createWebHashHistory(), routes })
createApp(App).use(router).use(store).mount('#app')

Просмотреть файл

@ -1,70 +0,0 @@
import Vue from 'vue'
import Router from 'vue-router'
import AddHardware from '@/components/AddHardware'
import AddSoftware from '@/components/AddSoftware'
import RequestForm from '@/components/RequestForm'
import IssueLicense from '@/components/IssueLicense'
import AllHardware from '@/components/AllHardware'
import dashboard from '@/components/DashboardTemplate'
import AllSoftware from '@/components/AllSoftware'
import AllRequests from '@/components/AllRequests'
import AllIssuedLicenses from '@/components/AllIssuedLicenses'
import About from '@/components/AboutTemplate'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'Dashboard',
component: dashboard
},
{
path: '/About',
name: 'About',
component: About
},
{
path: '/Software',
name: 'Software',
component: AllSoftware
},
{
path: '/Hardware',
name: 'Hardware',
component: AllHardware
},
{
path: '/AddHardware',
name: 'AddHardware',
component: AddHardware
},
{
path: '/AddSoftware',
name: 'AddSoftware',
component: AddSoftware
},
{
path: '/RequestForm',
name: 'RequestForm',
component: RequestForm
},
{
path: '/Requests',
name: 'Requests',
component: AllRequests
},
{
path: '/IssuedLicenses',
name: 'Issued Licenses',
component: AllIssuedLicenses
},
{
path: '/IssueLicense',
name: 'IssueLicense',
component: IssueLicense
}
]
})

Просмотреть файл

@ -1,82 +0,0 @@
import Vue from 'vue'
import Vuex from 'vuex'
import { requestData, licenseData, hardwareData, softwareData, listData, employeeData } from '../datasource.js'
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
requestInput: requestData,
licensesInput: licenseData,
hardwareInput: hardwareData,
softwareInput: softwareData,
activityData: listData,
empInput: employeeData,
currentUserID: 2
},
getters: {
requests: state => {
return new DataManager(state.requestInput).executeLocal(new Query().where(new Predicate('Status', 'notequal', 'Pending'))).length
},
pendingRequests: state => {
return new DataManager(state.requestInput).executeLocal(new Query().where(new Predicate('Status', 'equal', 'Pending'))).length
},
licenses: state => {
return state.licensesInput.length
},
hardwareNames: state => {
return new DataManager(state.hardwareInput).executeLocal(new Query().select(['Name', 'TaskID']))
},
hardwareStatus: state => {
return new DataManager(state.hardwareInput).executeLocal(new Query().group('Status'))
},
laptopData: state => {
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Laptop')).group('Status'))
},
monitorData: state => {
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Monitor')).group('Status'))
},
tabletData: state => {
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Tablet')).group('Status'))
},
miscData: state => {
return new DataManager(state.hardwareInput).executeLocal(new Query().where(new Predicate('Category', 'equal', 'Miscellaneous')).group('Status'))
},
softwareNames: state => {
return new DataManager(state.softwareInput).executeLocal(new Query().select(['Name', 'TaskID']))
},
softwareLicense: state => {
return new DataManager(state.softwareInput).executeLocal(new Query().group('LicenseType'))
},
softwareCategory: state => {
return new DataManager(state.softwareInput).executeLocal(new Query().group('Category'))
},
empData: state => {
return new DataManager(state.empInput).executeLocal(new Query().select(['id', 'Employee']))
}
},
mutations: {
addActivity (state, activity) {
state.activityData.push(activity)
}
},
actions: {
addActivity (context, activity) {
return new Promise((resolve, reject) => {
var userExist = context.state.empInput.find((user) => {
return user.Employee === activity.Employee
})
if (!userExist) {
reject(new Error('No such user found!'))
} else if (activity.Employee === '') {
reject(new Error('User name cannot be empty!'))
} else {
context.commit('addActivity', activity)
resolve(Object.assign({}, userExist))
}
})
}
}
})

Просмотреть файл

@ -1,5 +1,6 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
publicPath: '',
transpileDependencies: true,
runtimeCompiler: true
})