mirror of https://github.com/veops/cmdb.git
Merge branch 'master' of https://github.com/pycook/cmdb
This commit is contained in:
commit
66e93e73af
2
Pipfile
2
Pipfile
|
@ -19,7 +19,7 @@ redis = "==3.2.1"
|
||||||
Flask-Migrate = "==2.5.2"
|
Flask-Migrate = "==2.5.2"
|
||||||
# Deployment
|
# Deployment
|
||||||
gevent = "==1.4.0"
|
gevent = "==1.4.0"
|
||||||
gunicorn = ">=19.1.1"
|
gunicorn = "==19.5.0"
|
||||||
supervisor = "==4.0.3"
|
supervisor = "==4.0.3"
|
||||||
# Auth
|
# Auth
|
||||||
Flask-Login = "==0.4.1"
|
Flask-Login = "==0.4.1"
|
||||||
|
|
|
@ -56,9 +56,11 @@ cp api/settings.py.example api/settings.py
|
||||||
- 浏览器打开: [http://127.0.0.1:8000](http://127.0.0.1:8000)
|
- 浏览器打开: [http://127.0.0.1:8000](http://127.0.0.1:8000)
|
||||||
- 如果是非本机访问, 要修改**ui/.env**里**VUE_APP_API_BASE_URL**里的IP地址为后端服务的ip地址
|
- 如果是非本机访问, 要修改**ui/.env**里**VUE_APP_API_BASE_URL**里的IP地址为后端服务的ip地址
|
||||||
|
|
||||||
docker运行
|
docker 一键构建和运行
|
||||||
----
|
----
|
||||||
进入主目录
|
- 进入主目录(首次镜像的构建需要**10分钟**左右,视网络情况而定)
|
||||||
```
|
```
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- 浏览器打开: [http://localhost:8000](http://localhost:8000)
|
||||||
|
|
|
@ -15,4 +15,3 @@ RUN yum install -y epel-release && yum clean all\
|
||||||
&& pip install --no-cache-dir -r docs/requirements.txt
|
&& pip install --no-cache-dir -r docs/requirements.txt
|
||||||
|
|
||||||
CMD ["bash", "-c", "cp api/settings.py.example api/settings.py && sed -i 's#{user}:{password}@127.0.0.1:3306/{db}#:@127.0.0.1:3306/cmdb#g' api/settings.py && flask run"]
|
CMD ["bash", "-c", "cp api/settings.py.example api/settings.py && sed -i 's#{user}:{password}@127.0.0.1:3306/{db}#:@127.0.0.1:3306/cmdb#g' api/settings.py && flask run"]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# -*- coding:utf-8 -*-
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
@ -37,8 +40,8 @@ type_map = {
|
||||||
'deserialize': {
|
'deserialize': {
|
||||||
Attribute.INT: string2int,
|
Attribute.INT: string2int,
|
||||||
Attribute.FLOAT: float,
|
Attribute.FLOAT: float,
|
||||||
Attribute.TEXT: escape,
|
Attribute.TEXT: lambda x: escape(x).encode('utf-8').decode('utf-8'),
|
||||||
Attribute.TIME: escape,
|
Attribute.TIME: lambda x: escape(x).encode('utf-8').decode('utf-8'),
|
||||||
Attribute.DATETIME: str2datetime,
|
Attribute.DATETIME: str2datetime,
|
||||||
Attribute.DATE: str2datetime,
|
Attribute.DATE: str2datetime,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
# -*- coding:utf-8 -*-
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import markupsafe
|
import markupsafe
|
||||||
from flask import abort
|
from flask import abort
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,6 @@
|
||||||
version: '3.4'
|
version: '3.4'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
cmdb-ui:
|
|
||||||
build:
|
|
||||||
context: ./ui
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
image: cmdb-ui:0.1
|
|
||||||
container_name: cmdb-ui
|
|
||||||
command: ["sh", "-c", "sed -i 's#http://127.0.0.1:5000##g' .env && yarn run serve"]
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:5000"]
|
|
||||||
interval: 5s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 100
|
|
||||||
start_period: 10s
|
|
||||||
depends_on:
|
|
||||||
- cmdb-api
|
|
||||||
networks:
|
|
||||||
- new
|
|
||||||
|
|
||||||
cmdb-api:
|
cmdb-api:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
|
@ -67,17 +49,16 @@ services:
|
||||||
aliases:
|
aliases:
|
||||||
- redis
|
- redis
|
||||||
|
|
||||||
cmdb-proxy:
|
cmdb-ui:
|
||||||
image: nginx:latest
|
build:
|
||||||
container_name: cmdb-proxy
|
context: ./ui
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
image: cmdb-ui:0.1
|
||||||
|
container_name: cmdb-ui
|
||||||
depends_on:
|
depends_on:
|
||||||
- cmdb-api
|
- cmdb-api
|
||||||
- cmdb-ui
|
|
||||||
volumes:
|
|
||||||
- "$PWD/conf.d:/etc/nginx/conf.d"
|
|
||||||
environment:
|
environment:
|
||||||
CMDB_API_HOST: cmdb-api:5000
|
CMDB_API_HOST: cmdb-api:5000
|
||||||
CMDB_UI_HOST: cmdb-ui:8000
|
|
||||||
NGINX_PORT: 80
|
NGINX_PORT: 80
|
||||||
volumes:
|
volumes:
|
||||||
- ./docs/nginx.cmdb.conf.example:/etc/nginx/conf.d/nginx.cmdb.conf.example
|
- ./docs/nginx.cmdb.conf.example:/etc/nginx/conf.d/nginx.cmdb.conf.example
|
||||||
|
@ -85,14 +66,14 @@ services:
|
||||||
- /bin/bash
|
- /bin/bash
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
envsubst '$$CMDB_API_HOST $$CMDB_UI_HOST $$NGINX_PORT' < /etc/nginx/conf.d/nginx.cmdb.conf.example > /etc/nginx/conf.d/cmdb.conf
|
envsubst '$$CMDB_API_HOST $$NGINX_PORT' < /etc/nginx/conf.d/nginx.cmdb.conf.example > /etc/nginx/conf.d/cmdb.conf
|
||||||
rm -f /etc/nginx/conf.d/default.conf
|
rm -f /etc/nginx/conf.d/default.conf
|
||||||
|
curl http://cmdb-api:5000/api/v0.1/ci/flush
|
||||||
nginx -g 'daemon off;'
|
nginx -g 'daemon off;'
|
||||||
curl http://localhost/api/v0.1/ci/flush
|
|
||||||
networks:
|
networks:
|
||||||
- new
|
- new
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "8000:80"
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
db-data:
|
db-data:
|
||||||
|
|
|
@ -25,9 +25,12 @@ server {
|
||||||
application/xml
|
application/xml
|
||||||
application/rss+xml
|
application/rss+xml
|
||||||
image/svg+xml;
|
image/svg+xml;
|
||||||
|
|
||||||
|
root /etc/nginx/html;
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://${CMDB_UI_HOST};
|
root /etc/nginx/html;
|
||||||
proxy_set_header Host $host;
|
index index.html;
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
location /api {
|
location /api {
|
||||||
proxy_pass http://${CMDB_API_HOST};
|
proxy_pass http://${CMDB_API_HOST};
|
||||||
|
@ -41,4 +44,11 @@ server {
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
}
|
}
|
||||||
|
location ~* \.(css|js)$ {
|
||||||
|
access_log off;
|
||||||
|
add_header Pragma public;
|
||||||
|
add_header Cache-Control "public, max-age=7776000";
|
||||||
|
#add_header Cache-Control "public,no-cache, max-age=0";
|
||||||
|
add_header X-Asset "yes";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,10 @@ SQLAlchemy ==1.3.5
|
||||||
PyMySQL ==0.9.3
|
PyMySQL ==0.9.3
|
||||||
redis ==3.2.1
|
redis ==3.2.1
|
||||||
# Migrations
|
# Migrations
|
||||||
Flask-Migrate ==2.5.2
|
Flask-Migrate == 2.5.2
|
||||||
# Deployment
|
# Deployment
|
||||||
gevent ==1.4.0
|
gevent ==1.4.0
|
||||||
gunicorn>=19.1.1
|
gunicorn == 19.5.0
|
||||||
supervisor ==4.0.3
|
supervisor ==4.0.3
|
||||||
# Auth
|
# Auth
|
||||||
Flask-Login ==0.4.1
|
Flask-Login ==0.4.1
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
FROM alpine:3.9
|
FROM node:alpine as builder
|
||||||
|
|
||||||
LABEL description="cmdb-ui"
|
LABEL description="cmdb-ui"
|
||||||
|
|
||||||
RUN mkdir -p /data/apps/cmdb-ui/logs
|
|
||||||
|
|
||||||
COPY . /data/apps/cmdb-ui
|
COPY . /data/apps/cmdb-ui
|
||||||
|
|
||||||
WORKDIR /data/apps/cmdb-ui
|
WORKDIR /data/apps/cmdb-ui
|
||||||
|
|
||||||
RUN apk add yarn && yarn install
|
RUN sed -i 's#http://127.0.0.1:5000##g' .env && yarn install && yarn build
|
||||||
|
|
||||||
CMD ["sh", "-c", "yarn run serve"]
|
|
||||||
|
FROM nginx:latest
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y curl && apt-get clean
|
||||||
|
|
||||||
|
RUN mkdir /etc/nginx/html
|
||||||
|
|
||||||
|
COPY --from=builder /data/apps/cmdb-ui/dist /etc/nginx/html/
|
||||||
|
|
|
@ -12,7 +12,7 @@ import config from '@/config/defaultSettings'
|
||||||
* @param parameter
|
* @param parameter
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
export function login(parameter) {
|
export function login (parameter) {
|
||||||
return axios({
|
return axios({
|
||||||
url: api.Login,
|
url: api.Login,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -20,7 +20,7 @@ export function login(parameter) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSmsCaptcha(parameter) {
|
export function getSmsCaptcha (parameter) {
|
||||||
return axios({
|
return axios({
|
||||||
url: api.SendSms,
|
url: api.SendSms,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -28,7 +28,7 @@ export function getSmsCaptcha(parameter) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getInfo() {
|
export function getInfo () {
|
||||||
return axios({
|
return axios({
|
||||||
url: api.UserInfo,
|
url: api.UserInfo,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
@ -38,7 +38,7 @@ export function getInfo() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function logout() {
|
export function logout () {
|
||||||
console.log('logout........')
|
console.log('logout........')
|
||||||
if (config.useSSO) {
|
if (config.useSSO) {
|
||||||
window.location.replace(api.Logout)
|
window.location.replace(api.Logout)
|
||||||
|
@ -51,14 +51,13 @@ export function logout() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get user 2step code open?
|
* get user 2step code open?
|
||||||
* @param parameter {*}
|
* @param parameter {*}
|
||||||
*/
|
*/
|
||||||
export function get2step(parameter) {
|
export function get2step (parameter) {
|
||||||
return axios({
|
return axios({
|
||||||
url: api.twoStepCode,
|
url: api.twoStepCode,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
|
|
||||||
import { UserLayout, BasicLayout, RouteView, PageView } from '@/layouts'
|
import { UserLayout, BasicLayout, RouteView } from '@/layouts'
|
||||||
import { getPreference } from '@/api/cmdb/preference'
|
import { getPreference } from '@/api/cmdb/preference'
|
||||||
|
|
||||||
const cmdbRouter = [
|
const cmdbRouter = [
|
||||||
|
@ -68,7 +68,7 @@ const cmdbRouter = [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
function copyArray(arr) {
|
function copyArray (arr) {
|
||||||
return arr.map((e) => {
|
return arr.map((e) => {
|
||||||
if (typeof e === 'object') {
|
if (typeof e === 'object') {
|
||||||
return Object.assign({}, e)
|
return Object.assign({}, e)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import 'nprogress/nprogress.css' // progress bar style
|
||||||
import notification from 'ant-design-vue/es/notification'
|
import notification from 'ant-design-vue/es/notification'
|
||||||
import { setDocumentTitle, domTitle } from '@/utils/domUtil'
|
import { setDocumentTitle, domTitle } from '@/utils/domUtil'
|
||||||
import config from '@/config/defaultSettings'
|
import config from '@/config/defaultSettings'
|
||||||
import { ACCESS_TOKEN } from './store/mutation-types';
|
import { ACCESS_TOKEN } from './store/mutation-types'
|
||||||
|
|
||||||
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
||||||
|
|
||||||
|
@ -44,15 +44,13 @@ router.beforeEach((to, from, next) => {
|
||||||
store.dispatch('Logout')
|
store.dispatch('Logout')
|
||||||
}, 3000)
|
}, 3000)
|
||||||
})
|
})
|
||||||
|
|
||||||
} else if (to.path === '/user/login' && !config.useSSO && store.getters.roles.length !== 0) {
|
} else if (to.path === '/user/login' && !config.useSSO && store.getters.roles.length !== 0) {
|
||||||
next({ path: '/' })
|
next({ path: '/' })
|
||||||
NProgress.done()
|
NProgress.done()
|
||||||
} else if (!config.useSSO && !Vue.ls.get(ACCESS_TOKEN) && to.path !== "/user/login") {
|
} else if (!config.useSSO && !Vue.ls.get(ACCESS_TOKEN) && to.path !== '/user/login') {
|
||||||
next({ path: '/user/login', query: { redirect: to.fullPath } })
|
next({ path: '/user/login', query: { redirect: to.fullPath } })
|
||||||
NProgress.done()
|
NProgress.done()
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -107,7 +107,7 @@ export default {
|
||||||
CreateInstanceForm,
|
CreateInstanceForm,
|
||||||
CiDetail
|
CiDetail
|
||||||
},
|
},
|
||||||
data() {
|
data () {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
loadTip: '',
|
loadTip: '',
|
||||||
|
@ -185,25 +185,25 @@ export default {
|
||||||
},
|
},
|
||||||
optionAlertShow: false,
|
optionAlertShow: false,
|
||||||
watch: {
|
watch: {
|
||||||
'$route.path': function(newPath, oldPath) {
|
'$route.path': function (newPath, oldPath) {
|
||||||
this.reload()
|
this.reload()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created () {
|
||||||
this.tableOption()
|
this.tableOption()
|
||||||
this.loadColumns()
|
this.loadColumns()
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$route.path': function(newPath, oldPath) {
|
'$route.path': function (newPath, oldPath) {
|
||||||
this.reload()
|
this.reload()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
inject: ['reload'],
|
inject: ['reload'],
|
||||||
methods: {
|
methods: {
|
||||||
setColumnWidth() {
|
setColumnWidth () {
|
||||||
let rows = []
|
let rows = []
|
||||||
try {
|
try {
|
||||||
rows = document.querySelector('.ant-table-body').childNodes[0].childNodes[2].childNodes[0].childNodes
|
rows = document.querySelector('.ant-table-body').childNodes[0].childNodes[2].childNodes[0].childNodes
|
||||||
|
@ -225,7 +225,7 @@ export default {
|
||||||
document.querySelector('.ant-table-fixed-right').offsetWidth
|
document.querySelector('.ant-table-fixed-right').offsetWidth
|
||||||
this.scrollY = window.innerHeight - this.$refs.table.$el.offsetTop - 300
|
this.scrollY = window.innerHeight - this.$refs.table.$el.offsetTop - 300
|
||||||
},
|
},
|
||||||
tableOption() {
|
tableOption () {
|
||||||
if (!this.optionAlertShow) {
|
if (!this.optionAlertShow) {
|
||||||
this.options = {
|
this.options = {
|
||||||
alert: {
|
alert: {
|
||||||
|
@ -258,7 +258,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
loadColumns() {
|
loadColumns () {
|
||||||
getSubscribeAttributes(this.$router.currentRoute.meta.typeId).then(res => {
|
getSubscribeAttributes(this.$router.currentRoute.meta.typeId).then(res => {
|
||||||
const prefAttrList = res.attributes
|
const prefAttrList = res.attributes
|
||||||
this.preferenceAttrList = prefAttrList
|
this.preferenceAttrList = prefAttrList
|
||||||
|
@ -294,16 +294,16 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelectChange(selectedRowKeys, selectedRows) {
|
onSelectChange (selectedRowKeys, selectedRows) {
|
||||||
this.selectedRowKeys = selectedRowKeys
|
this.selectedRowKeys = selectedRowKeys
|
||||||
this.selectedRows = selectedRows
|
this.selectedRows = selectedRows
|
||||||
},
|
},
|
||||||
|
|
||||||
refreshTable(bool = false) {
|
refreshTable (bool = false) {
|
||||||
this.$refs.table.refresh(bool)
|
this.$refs.table.refresh(bool)
|
||||||
},
|
},
|
||||||
|
|
||||||
onCellChange(key, dataIndex, event, oldValue) {
|
onCellChange (key, dataIndex, event, oldValue) {
|
||||||
const value = event[0]
|
const value = event[0]
|
||||||
const payload = {}
|
const payload = {}
|
||||||
payload[dataIndex] = value
|
payload[dataIndex] = value
|
||||||
|
@ -317,14 +317,14 @@ export default {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async batchDownload() {
|
async batchDownload () {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.loadTip = '正在下载 ...'
|
this.loadTip = '正在下载 ...'
|
||||||
const promises = this.selectedRowKeys.map(ciId => {
|
const promises = this.selectedRowKeys.map(ciId => {
|
||||||
return searchCI(`q=_id:${ciId}`).then(res => {
|
return searchCI(`q=_id:${ciId}`).then(res => {
|
||||||
let ciMap = {}
|
const ciMap = {}
|
||||||
Object.keys(res.result[0]).forEach(k => {
|
Object.keys(res.result[0]).forEach(k => {
|
||||||
if (!["ci_type", "_id", "ci_type_alias", "_type"].includes(k)) {
|
if (!['ci_type', '_id', 'ci_type_alias', '_type'].includes(k)) {
|
||||||
ciMap[k] = res.result[0][k]
|
ciMap[k] = res.result[0][k]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -337,12 +337,12 @@ export default {
|
||||||
|
|
||||||
return results
|
return results
|
||||||
},
|
},
|
||||||
batchUpdate(values) {
|
batchUpdate (values) {
|
||||||
const that = this
|
const that = this
|
||||||
this.$confirm({
|
this.$confirm({
|
||||||
title: '警告',
|
title: '警告',
|
||||||
content: '确认要批量修改吗 ?',
|
content: '确认要批量修改吗 ?',
|
||||||
onOk() {
|
onOk () {
|
||||||
that.loading = true
|
that.loading = true
|
||||||
that.loadTip = '正在批量修改 ...'
|
that.loadTip = '正在批量修改 ...'
|
||||||
const payload = {}
|
const payload = {}
|
||||||
|
@ -379,12 +379,12 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
batchDelete() {
|
batchDelete () {
|
||||||
const that = this
|
const that = this
|
||||||
this.$confirm({
|
this.$confirm({
|
||||||
title: '警告',
|
title: '警告',
|
||||||
content: '真的要删除吗 ?',
|
content: '真的要删除吗 ?',
|
||||||
onOk() {
|
onOk () {
|
||||||
that.loading = true
|
that.loading = true
|
||||||
that.loadTip = '正在删除 ...'
|
that.loadTip = '正在删除 ...'
|
||||||
const promises = that.selectedRowKeys.map(ciId => {
|
const promises = that.selectedRowKeys.map(ciId => {
|
||||||
|
@ -412,12 +412,12 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
deleteCI(record) {
|
deleteCI (record) {
|
||||||
const that = this
|
const that = this
|
||||||
this.$confirm({
|
this.$confirm({
|
||||||
title: '警告',
|
title: '警告',
|
||||||
content: '真的要删除吗 ?',
|
content: '真的要删除吗 ?',
|
||||||
onOk() {
|
onOk () {
|
||||||
deleteCI(record.key)
|
deleteCI(record.key)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
that.$refs.table.refresh(true)
|
that.$refs.table.refresh(true)
|
||||||
|
|
|
@ -130,7 +130,7 @@ export default {
|
||||||
this.form.validateFields((err, values) => {
|
this.form.validateFields((err, values) => {
|
||||||
Object.keys(values).forEach(k => {
|
Object.keys(values).forEach(k => {
|
||||||
if (typeof values[k] === 'object') {
|
if (typeof values[k] === 'object') {
|
||||||
values[k] = values[k].format("YYYY-MM-DD HH:mm:ss")
|
values[k] = values[k].format('YYYY-MM-DD HH:mm:ss')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (!err) {
|
if (!err) {
|
||||||
|
|
Loading…
Reference in New Issue