Demo 适配 1.3.2.SR 接口

develop
pnoker 3 years ago
parent e6fed5d652
commit 9e9f3fe185

@ -1,13 +1,12 @@
{
"name": "dc3-web",
"version": "1.2.3",
"version": "1.3.2",
"private": true,
"author": "pnoker",
"description": "IOT DC3 Demo Application UI",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
"build": "vue-cli-service build"
},
"dependencies": {
"@antv/g2": "^4.0.12",
@ -30,51 +29,15 @@
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.4.6",
"@vue/cli-plugin-eslint": "^4.4.6",
"@vue/cli-plugin-router": "^4.4.6",
"@vue/cli-plugin-vuex": "^4.4.6",
"@vue/cli-service": "^4.4.6",
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
"eslint-plugin-vue": "^6.2.2",
"webpack": "^4.43.0",
"node-sass": "^4.14.1",
"sass-loader": "^8.0.2",
"vue-cli-plugin-element": "^1.0.1",
"vue-template-compiler": "^2.6.11"
},
"lint-staged": {
"*.js": [
"vue-cli-service lint",
"git add"
],
"*.vue": [
"vue-cli-service lint",
"git add"
]
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {
"no-console": "off",
"no-debugger": "off"
},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",

@ -1,5 +0,0 @@
module.exports = {
plugins: {
autoprefixer: {}
}
};

@ -205,12 +205,8 @@ export const dictionaryApi = {
url: 'manager_api/manager/dictionary/point_attribute',
method: 'get'
}),
groupDictionary: () => request({
url: 'manager_api/manager/dictionary/group',
method: 'get'
}),
deviceDictionary: (parent) => request({
url: 'manager_api/manager/dictionary/device/' + parent,
deviceDictionary: () => request({
url: 'manager_api/manager/dictionary/device',
method: 'get'
}),
pointDictionary: (parent) => request({
@ -243,4 +239,4 @@ export const statusApi = {
method: 'post',
data: device
})
};
};

@ -1,25 +0,0 @@
import request from '@/config/axios'
export const generateSalt = (name) => request({
url: 'user_api/auth/token/salt',
method: 'post',
data: name
});
export const generateToken = (login) => request({
url: 'user_api/auth/token/generate',
method: 'post',
data: login
});
export const checkTokenValid = (login) => request({
url: 'user_api/auth/token/check',
method: 'post',
data: login
});
export const cancelToken = (name) => request({
url: 'user_api/auth/token/cancel',
method: 'post',
data: name
});

@ -1,6 +1,4 @@
import axios from 'axios'
import router from '@/router/router'
import store from '@/store/store';
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import {failMessage} from '@/util/util'
@ -33,11 +31,7 @@ axios.interceptors.response.use(res => {
const ok = res.data.ok || false, status = res.status || 200, message = res.data.message || 'Internal Server Error!';
if (!ok) {
if (status === 401) {
store.dispatch('ClearToken').then(() => router.push({path: '/login'}));
} else {
failMessage(message);
}
failMessage(message);
return Promise.reject(new Error(message));
}

@ -25,8 +25,8 @@ console.log(
'| ( <_> ) | / /_/ \\ \\___ / \\\n' +
'|__|\\____/|__| \\____ |\\___ >______ /\n' +
' \\/ \\/ \\/\n' +
' https://dc3.site\n' +
' 开发文档:https://dc3.site\n' +
' https://gitee.com/pnoker/iot-dc3\n' +
' https://github.com/pnoker/iot-dc3\n' +
' DC3 IOT Platform V3.0 Pnoker Authors'
' DC3 IOT Platform V1.3.2.SR Pnoker Authors'
);

@ -1,13 +1,4 @@
export default [
{
name: 'login',
path: '/login',
meta: {
isAuth: false,
title: 'DC3 物联万物,智控未来!'
},
component: () => import('@/views/login/Login')
},
{
name: '403',
path: '/403',

@ -7,7 +7,7 @@ import NProgress from "nprogress";
Vue.use(VueRouter);
const router = new VueRouter({
scrollBehavior(to, from, savedPosition) {
scrollBehavior: (to, from, savedPosition) => {
if (savedPosition) {
return savedPosition
} else {

@ -69,15 +69,6 @@ export default [
},
component: () => import('@/views/point/Point')
},
{
name: 'group',
path: '/group',
meta: {
isAuth: true,
title: '分组'
},
component: () => import('@/views/group/Group')
},
{
name: 'device',
path: '/device',

@ -1,6 +0,0 @@
const getters = {
token: state => state.user.token,
user: state => state.user.user,
};
export default getters

@ -1,67 +0,0 @@
import md5 from 'js-md5';
import {getStore, removeCookies, removeStore, setCookies, setStore} from '@/util/store'
import {cancelToken, generateSalt, generateToken} from '@/api/user'
import website from "@/config/website";
const user = {
state: {},
actions: {
GenerateSalt({commit}, name) {
return new Promise((resolve, reject) => {
generateSalt(name).then(res => {
resolve(res.data);
}).catch(error => {
reject(error);
})
});
},
GenerateToken({commit}, form) {
let login = {
tenant: form.tenant,
name: form.name,
salt: form.salt,
password: md5(md5(form.password) + form.salt)
};
return new Promise((resolve, reject) => {
generateToken(login).then(res => {
const data = res.data;
commit('SET_TOKEN',
{
tenant: login.tenant,
name: login.name,
salt: login.salt,
token: data
}
);
resolve();
}).catch(error => {
reject(error);
});
});
},
ClearToken({commit}) {
return new Promise((resolve) => {
let token = getStore(website.token_header);
if (token && token.name) {
cancelToken(token.name);
}
commit('REMOVE_TOKEN');
resolve();
});
}
},
mutations: {
SET_TOKEN: (state, token) => {
setCookies(website.token_header, token);
setStore(website.token_header, token);
},
REMOVE_TOKEN: () => {
removeCookies(website.token_header);
removeStore(website.token_header);
}
}
};
export default user

@ -1,16 +1,11 @@
import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
import common from './modules/common'
import getters from './getters'
Vue.use(Vuex);
const store = new Vuex.Store({
modules: {
common, user
},
getters
modules: {common}
});
export default store

@ -1,20 +0,0 @@
import Cookies from 'js-cookie'
import website from "@/config/website";
const keyName = website.key + '-';
const TokenKey = keyName + 'auth-token';
// 360分钟360 * 60 * 1000
const expiration = new Date(new Date().getTime() + 360 * 60 * 1000);
export function getTokenCookies() {
return Cookies.get(TokenKey);
}
export function setTokenCookies(token) {
return Cookies.set(TokenKey, token, {expires: expiration});
}
export function removeTokenCookies() {
return Cookies.remove(TokenKey);
}

@ -1,136 +0,0 @@
import {isNull} from './validate';
import website from '@/config/website';
import Cookies from "js-cookie";
import {decode, encode} from 'js-base64'
const keyName = website.key + '-';
export function getCookies(key) {
return JSON.parse(decode(Cookies.get(key)));
}
export function setCookies(key, value) {
return Cookies.set(key, encode(JSON.stringify(value)));
}
export function removeCookies(key) {
return Cookies.remove(key);
}
/**
* 存储 localStorage
* @param params
*/
export const setStore = (params = {}) => {
let {
name,
content,
type,
} = params;
name = keyName + name;
let obj = {
dataType: typeof (content),
content: content,
type: type,
datetime: new Date().getTime()
};
if (type) window.sessionStorage.setItem(name, JSON.stringify(obj));
else window.localStorage.setItem(name, JSON.stringify(obj));
};
/**
* 获取 localStorage
* @param params
*/
export const getStore = (params = {}) => {
let {
name,
debug
} = params;
name = keyName + name;
let obj = {}, content;
obj = window.sessionStorage.getItem(name);
if (isNull(obj)) obj = window.localStorage.getItem(name);
if (isNull(obj)) return;
try {
obj = JSON.parse(obj);
} catch {
return obj;
}
if (debug) {
return obj;
}
if (obj.dataType === 'string') {
content = obj.content;
} else if (obj.dataType === 'number') {
content = Number(obj.content);
} else if (obj.dataType === 'boolean') {
content = eval(obj.content);
} else if (obj.dataType === 'object') {
content = obj.content;
}
return content;
};
/**
* 删除 localStorage
* @param params
*/
export const removeStore = (params = {}) => {
let {
name,
type
} = params;
name = keyName + name;
if (type) {
window.sessionStorage.removeItem(name);
} else {
window.localStorage.removeItem(name);
}
};
/**
* 获取全部 localStorage
* @param params
*/
export const getAllStore = (params = {}) => {
let list = [];
let {
type
} = params;
if (type) {
for (let i = 0; i <= window.sessionStorage.length; i++) {
list.push({
name: window.sessionStorage.key(i),
content: getStore({
name: window.sessionStorage.key(i),
type: 'session'
})
})
}
} else {
for (let i = 0; i <= window.localStorage.length; i++) {
list.push({
name: window.localStorage.key(i),
content: getStore({
name: window.localStorage.key(i),
})
})
}
}
return list;
};
/**
* 清空全部 localStorage
* @param params
*/
export const clearStore = (params = {}) => {
let {type} = params;
if (type) {
window.sessionStorage.clear();
} else {
window.localStorage.clear()
}
};

@ -82,7 +82,7 @@
index: true,
stripe: true,
border: true,
height: 664,
height: 725,
align: 'center',
column: [
{
@ -90,7 +90,7 @@
prop: 'name',
span: 24,
search: true,
searchSpan: 8,
searchSpan: 16,
rules: [
{
required: true,
@ -107,8 +107,8 @@
}
]
}, {
label: '所属模板',
prop: 'profileId',
label: '所属驱动',
prop: 'driverId',
span: 8,
search: true,
searchSpan: 8,
@ -118,25 +118,22 @@
rules: [
{
required: true,
message: '请选择使用模板',
message: '请选择使用驱动',
trigger: 'click'
}
]
}, {
label: '所属分组',
prop: 'groupId',
width: 180,
label: '包含模板',
prop: 'profileIds',
span: 8,
search: true,
searchSpan: 8,
type: 'select',
filterable: true,
searchFilterable: true,
type: 'tree',
dicData: [],
multiple: true,
defaultExpandAll: true,
rules: [
{
required: true,
message: '请选择所属分组',
message: '请选择使用模板',
trigger: 'click'
}
]
@ -198,21 +195,19 @@
}, {
label: '修改日期',
prop: 'updateTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}, {
label: '创建日期',
prop: 'createTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}
]
},
@ -225,7 +220,7 @@
}
},
created() {
this.group();
this.driver();
this.profile();
},
methods:
@ -260,15 +255,15 @@
this.loading = false;
});
},
group() {
dictionaryApi.groupDictionary().then(res => {
this.findObject(this.listOption.column, 'groupId').dicData = res.data;
driver() {
dictionaryApi.driverDictionary().then(res => {
this.findObject(this.listOption.column, 'driverId').dicData = res.data;
}).catch(() => {
});
},
profile() {
dictionaryApi.profileDictionary().then(res => {
this.findObject(this.listOption.column, 'profileId').dicData = res.data;
this.findObject(this.listOption.column, 'profileIds').dicData = res.data;
}).catch(() => {
});
},

@ -47,7 +47,7 @@
addBtn: false,
editBtn: false,
delBtn: false,
height: 664,
height: 725,
align: 'center',
column: [
{
@ -118,21 +118,19 @@
}, {
label: '修改日期',
prop: 'updateTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}, {
label: '创建日期',
prop: 'createTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}
]
},

@ -42,7 +42,7 @@
viewBtn: false,
editBtn: false,
delBtn: false,
height: 664,
height: 725,
align: 'center',
column: [
{
@ -168,21 +168,19 @@
}, {
label: '修改日期',
prop: 'updateTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}, {
label: '创建日期',
prop: 'createTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}
]
},

@ -37,12 +37,12 @@
index: true,
stripe: true,
border: true,
height: 664,
height: 725,
align: 'center',
column: [
{
label: '所属模板',
prop: 'profileId',
label: '所属设备',
prop: 'deviceId',
span: 24,
search: true,
searchSpan: 12,
@ -100,21 +100,19 @@
}, {
label: '修改日期',
prop: 'updateTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}, {
label: '创建日期',
prop: 'createTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}
]
},
@ -127,7 +125,7 @@
}
},
created() {
this.profile();
this.device();
this.driverAttribute();
},
methods:
@ -148,15 +146,15 @@
this.loading = false;
});
},
profile() {
dictionaryApi.profileDictionary().then(res => {
this.findObject(this.listOption.column,'profileId').dicData = res.data;
device() {
dictionaryApi.deviceDictionary().then(res => {
this.findObject(this.listOption.column, 'deviceId').dicData = res.data;
}).catch(() => {
});
},
driverAttribute() {
dictionaryApi.driverAttributeDictionary().then(res => {
this.findObject(this.listOption.column,'driverAttributeId').dicData = res.data;
this.findObject(this.listOption.column, 'driverAttributeId').dicData = res.data;
}).catch(() => {
});
},

@ -49,7 +49,7 @@
addBtn: false,
delBtn: false,
editBtn: false,
height: 664,
height: 725,
align: 'center',
defaultExpandAll: true,
column: [

@ -1,177 +0,0 @@
<template>
<el-col :span="24">
<base-card>
<avue-crud :option="listOption"
:data="listData"
:page="page"
:table-loading="loading"
ref="crud"
v-model="listForm"
@on-load="list"
@row-save="listAdd"
@row-del="listDelete"
@row-update="listUpdate"
@search-reset="searchReset"
@search-change="searchChange"
@refresh-change="refreshChange"
@size-change="sizeChange"
@current-change="currentChange"
>
</avue-crud>
</base-card>
</el-col>
</template>
<script>
import {groupApi} from '@/api/manager'
import {successMessage} from "@/util/util";
export default {
data() {
return {
query: {},
listForm: {},
listData: [],
listOption: {
tip: false,
index: true,
stripe: true,
border: true,
height: 664,
align: 'center',
column: [
{
label: '分组',
prop: 'name',
span: 24,
search: true,
searchSpan: 24,
rules: [
{
required: true,
message: '请输入 分组名称',
trigger: 'blur'
}, {
min: 2,
max: 32,
message: '请输入 2~32 位字长的分组名称',
trigger: 'blur'
}, {
pattern: /^[A-Za-z0-9\u4e00-\u9fa5][A-Za-z0-9\u4e00-\u9fa5-_]*$/,
message: '请输入 正确格式的分组名称'
}
]
}, {
label: '备注',
prop: 'description',
span: 24,
type: 'textarea',
overHidden: true,
rules: [
{
max: 380,
message: '最多输入380个字符',
trigger: 'blur'
}
]
}, {
label: '修改日期',
prop: 'updateTime',
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
}, {
label: '创建日期',
prop: 'createTime',
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
}
]
},
loading: true,
page: {
total: 0,
pageSize: 20,
currentPage: 1
}
}
},
methods:
{
list(page) {
this.loading = true;
groupApi.list(Object.assign({
page: {
current: page.currentPage,
size: page.pageSize
}
}, this.query)).then(res => {
const data = res.data;
this.page.total = data.total;
this.listData = data.records;
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
listAdd(row, done, loading) {
groupApi.add(row).then(() => {
loading();
this.list(this.page);
successMessage();
}).catch(() => {
}).finally(() => {
done();
});
},
listDelete(row) {
this.$confirm('是否删除该条数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
return groupApi.delete(row.id);
}).then(() => {
this.list(this.page);
successMessage();
});
},
listUpdate(row, index, done, loading) {
groupApi.update(row).then(() => {
loading();
this.list(this.page);
successMessage();
}).catch(() => {
}).finally(() => {
done();
});
},
refreshChange() {
this.list(this.page);
},
currentChange(page) {
this.page.currentPage = page;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
searchChange(params, done) {
this.query = params;
this.list(this.page);
done();
},
searchReset() {
this.query = {};
this.list(this.page);
}
}
}
</script>
<style lang="scss">
</style>

@ -66,6 +66,6 @@
position: relative;
width: 100%;
overflow: hidden;
height: 875px;
height: 945px;
}
</style>

@ -14,19 +14,12 @@
<el-menu-item index="/driver_attribute">驱动属性</el-menu-item>
<el-menu-item index="/point_attribute">位号属性</el-menu-item>
<el-menu-item index="/profile">模板</el-menu-item>
<el-menu-item index="/driver_info">驱动配置</el-menu-item>
<el-menu-item index="/point">位号</el-menu-item>
<el-menu-item index="/group">分组</el-menu-item>
<el-menu-item index="/device">设备</el-menu-item>
<el-menu-item index="/driver_info">驱动配置</el-menu-item>
<el-menu-item index="/point_info">位号配置</el-menu-item>
<el-menu-item index="/point_value">数据</el-menu-item>
<el-menu-item index="/device_event">事件</el-menu-item>
<!--<el-menu-item index="/now">实时</el-menu-item>
<el-menu-item index="/history">历史</el-menu-item>
<el-menu-item index="/video">视频</el-menu-item>
<el-menu-item index="/alarm">报警</el-menu-item>
<el-menu-item index="/setting">设置</el-menu-item>
<el-menu-item index="/about">关于</el-menu-item>-->
</el-menu>
</el-col>
<el-col :span="2" class="header_item">
@ -42,8 +35,8 @@
</el-avatar>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="profile">个人信息</el-dropdown-item>
<el-dropdown-item command="help">帮助</el-dropdown-item>
<el-dropdown-item disabled>仅供测试1.3.2.SR接口使用</el-dropdown-item>
<el-dropdown-item command="logout" divided disabled>退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
@ -71,14 +64,8 @@
this.$message('click on message');
},
handleCommand(command) {
if (command === 'logout') {
this.$store.dispatch('ClearToken').then((res) => {
if (res.ok) {
this.$router.push('/login');
}
});
} else {
this.$message('click on item ' + command);
if (command === 'help') {
window.open('https://doc.dc3.site');
}
}
}

@ -1,124 +0,0 @@
<template>
<div class="login-container">
<div class="login-wrapper-left animated bounceInDown">
<div class="login-left">
<img class="img" src="images/logo/logo-white.png">
</div>
</div>
<particles/>
<div class="login-wrapper-right animated bounceInDown">
<div class="login-border">
<div class="login-main">
<h4 class="login-title">
Demo Application
</h4>
<p style="text-align: center;">基于 DC3 1.2.3.SR 接口开发的 demo 应用<br/>仅供演示和测试用途!</p>
<el-form class="login-form"
status-icon
:rules="loginRules"
ref="loginForm"
:model="loginForm"
label-width="0">
<el-form-item prop="tenant">
<el-input size="small"
@keyup.enter.native="handleLogin"
v-model="loginForm.tenant"
auto-complete="off"
placeholder="请输入租户名">
<i slot="prefix" class="el-icon-suitcase"/>
</el-input>
</el-form-item>
<el-form-item prop="name">
<el-input size="small"
@keyup.enter.native="handleLogin"
v-model="loginForm.name"
auto-complete="off"
placeholder="请输入用户名">
<i slot="prefix" class="el-icon-user"/>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input size="small"
@keyup.enter.native="handleLogin"
:type="passwordType"
v-model="loginForm.password"
auto-complete="off"
placeholder="请输入密码">
<i class="el-icon-view el-input__icon" slot="suffix" @click="showPassword"/>
<i slot="prefix" class="el-icon-lock"/>
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary"
size="small"
@click.native.prevent="handleLogin"
class="login-submit">登录
</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</div>
</template>
<script>
import particles from "@/components/particles/particles";
export default {
name: "login",
components: {particles},
data() {
return {
loginForm: {
tenant: "default",
name: "pnoker",
password: "dc3dc3dc3"
},
loginRules: {
tenant: [
{required: true, message: "请输入租户名", trigger: "blur"}
],
name: [
{required: true, message: "请输入用户名", trigger: "blur"}
],
password: [
{required: true, message: "请输入密码", trigger: "blur"},
{min: 1, message: "密码长度最少为6位", trigger: "blur"}
]
},
passwordType: "password"
};
},
methods: {
showPassword() {
this.passwordType === ""
? (this.passwordType = "password")
: (this.passwordType = "");
},
handleLogin() {
this.$refs.loginForm.validate(valid => {
if (valid) {
let loading = this.$loading({
lock: true,
text: '登录中,请稍后。。。',
spinner: "el-icon-loading"
});
this.$store.dispatch("GenerateSalt", this.loginForm.name).then((salt) => {
this.$store.dispatch("GenerateToken", {salt, ...this.loginForm}).then(() => {
this.$router.push({path: '/'}).then(() => loading.close());
}).catch(() => {
loading.close();
});
}).catch(() => {
loading.close();
});
}
});
}
}
};
</script>
<style lang="scss">
@import "~@/assets/styles/login.scss";
</style>

@ -38,7 +38,7 @@
stripe: true,
border: true,
viewBtn: true,
height: 664,
height: 725,
align: 'center',
column: [
{
@ -272,21 +272,19 @@
}, {
label: '修改日期',
prop: 'updateTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}, {
label: '创建日期',
prop: 'createTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}
]
},

@ -42,7 +42,7 @@
viewBtn: false,
editBtn: false,
delBtn: false,
height: 664,
height: 725,
align: 'center',
column: [
{
@ -168,21 +168,19 @@
}, {
label: '修改日期',
prop: 'updateTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}, {
label: '创建日期',
prop: 'createTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}
]
},

@ -37,7 +37,7 @@
index: true,
stripe: true,
border: true,
height: 664,
height: 725,
align: 'center',
column: [
{
@ -116,21 +116,19 @@
}, {
label: '修改日期',
prop: 'updateTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}, {
label: '创建日期',
prop: 'createTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}
]
},
@ -166,7 +164,7 @@
});
},
device() {
dictionaryApi.deviceDictionary('group').then(res => {
dictionaryApi.deviceDictionary().then(res => {
this.findObject(this.listOption.column,'deviceId').dicData = res.data;
}).catch(() => {
});

@ -16,7 +16,7 @@
@current-change="currentChange"
>
<template slot="interval" slot-scope="scope">
{{scope.row.createTime-scope.row.originTime||""}}
{{interval(scope.row.createTime,scope.row.originTime)||""}}
</template>
</avue-crud>
</base-card>
@ -43,7 +43,7 @@
addBtn: false,
delBtn: false,
editBtn: false,
height: 664,
height: 725,
align: 'center',
defaultExpandAll: true,
column: [
@ -100,9 +100,9 @@
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}, {
label: '延时(毫秒)',
label: 'Debug延时(ms)',
prop: 'interval',
width: 90,
width: 120,
span: 4,
slot: true
}, {
@ -151,7 +151,7 @@
});
},
device() {
dictionaryApi.deviceDictionary('group').then(res => {
dictionaryApi.deviceDictionary().then(res => {
this.findObject(this.listOption.column, 'deviceId').dicData = res.data;
}).catch(() => {
});
@ -186,6 +186,11 @@
searchReset() {
this.query = {};
this.list(this.page);
},
interval(date1, date2) {
let tempDate1 = new Date(date1);
let tempDate2 = new Date(date2);
return tempDate1.getTime() - tempDate2.getTime();
}
}
}

@ -37,7 +37,7 @@
index: true,
stripe: true,
border: true,
height: 664,
height: 725,
align: 'center',
column: [
{
@ -45,7 +45,7 @@
prop: 'name',
span: 24,
search: true,
searchSpan: 12,
searchSpan: 24,
rules: [
{
required: true,
@ -61,50 +61,6 @@
message: '请输入 正确格式的模板名称'
}
]
}, {
label: '公/私有',
prop: 'share',
width: 100,
search: true,
searchSpan: 6,
type: 'select',
searchFilterable: true,
value: false,
dicData: [
{
label: '私有',
value: false
},
{
label: '公有',
value: true,
disabled: true
}
],
rules: [
{
required: true,
message: '请选择模板共享类型',
trigger: 'click'
}
]
}, {
label: '所属驱动',
prop: 'driverId',
search: true,
searchSpan: 6,
type: 'select',
filterable: true,
searchFilterable: true,
dicData: [],
rules: [
{
required: true,
message: '请选择所属驱动',
trigger: 'click'
}
]
}, {
label: '备注',
prop: 'description',
@ -122,21 +78,19 @@
}, {
label: '修改日期',
prop: 'updateTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}, {
label: '创建日期',
prop: 'createTime',
width: 155,
width: 180,
span: 12,
disabled: true,
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss'
format: 'yyyy-MM-dd HH:mm:ss.SSS'
}
]
},

Loading…
Cancel
Save