Browse Source

去除无效引用

master
常熟吴彦祖 4 weeks ago
parent
commit
387787fb19
  1. 2390
      package-lock.json
  2. 8
      package.json
  3. 7
      src/api/heihu/heihuApiLog.js
  4. 231
      src/views/modules/api/heihuSfdcLog.vue
  5. 27
      test/e2e/custom-assertions/elementCount.js
  6. 46
      test/e2e/nightwatch.conf.js
  7. 48
      test/e2e/runner.js
  8. 19
      test/e2e/specs/test.js
  9. 11
      test/unit/specs/HelloWorld.spec.js

2390
package-lock.json
File diff suppressed because it is too large
View File

8
package.json

@ -8,9 +8,8 @@
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js --host 0.0.0.0",
"start": "npm run dev",
"unit": "jest --config test/unit/jest.conf.js --coverage",
"e2e": "node test/e2e/runner.js",
"test": "npm run unit && npm run e2e",
"lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs",
"test": "npm run unit",
"lint": "eslint --ext .js,.vue src test/unit/specs",
"build": "gulp"
},
"dependencies": {
@ -56,7 +55,6 @@
"babel-preset-stage-2": "6.22.0",
"babel-register": "6.22.0",
"chalk": "2.3.0",
"chromedriver": "^2.27.2",
"copy-webpack-plugin": "4.0.1",
"cross-spawn": "5.0.1",
"css-loader": "0.28.0",
@ -78,7 +76,6 @@
"jest-serializer-vue": "0.3.0",
"less": "^4.1.3",
"less-loader": "^7.3.0",
"nightwatch": "0.9.12",
"node-notifier": "5.1.2",
"optimize-css-assets-webpack-plugin": "3.2.0",
"ora": "1.2.0",
@ -87,7 +84,6 @@
"postcss-loader": "2.0.8",
"rimraf": "2.6.0",
"script-loader": "^0.7.2",
"selenium-server": "3.0.1",
"semver": "5.3.0",
"shelljs": "0.7.6",
"uglifyjs-webpack-plugin": "1.1.1",

7
src/api/heihu/heihuApiLog.js

@ -0,0 +1,7 @@
import { createAPI } from '@/utils/httpRequest.js'
// 报工接口调用记录分页查询
export const heihuApiLogSearch = data => createAPI('/api/heihulog/heihuApiLogSearch', 'post', data)
// 报工接口调用记录导出
export const heihuApiLogExport = data => createAPI('/api/heihulog/heihuApiLogExport', 'post', data, 'download')

231
src/views/modules/api/heihuSfdcLog.vue

@ -0,0 +1,231 @@
<template>
<div class="mod-config">
<el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="searchHandle">
<el-form-item label="调用日期">
<el-date-picker
v-model="searchData.startDate"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
clearable
placeholder="开始日期"
style="width: 130px">
</el-date-picker>
-
<el-date-picker
v-model="searchData.endDate"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
clearable
placeholder="结束日期"
style="width: 130px">
</el-date-picker>
</el-form-item>
<el-form-item label="黑湖参数">
<el-input
v-model="searchData.searchInParamJson"
clearable
placeholder="支持模糊查询"
style="width: 360px">
</el-input>
</el-form-item>
<el-form-item label="是否处理成功">
<el-select v-model="searchData.searchSuccess" clearable placeholder="全部" style="width: 120px">
<el-option label="成功" value="Y"></el-option>
<el-option label="失败" value="N"></el-option>
</el-select>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="searchHandle">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
<el-button type="primary" :loading="exportLoading" @click="exportHandle">导出</el-button>
</el-form-item>
</el-form>
<el-table
:height="tableHeight"
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
prop="id"
header-align="center"
align="center"
width="90"
label="ID">
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
width="180"
label="调用时间">
</el-table-column>
<el-table-column
prop="inParamJson"
header-align="center"
align="left"
min-width="420"
:show-overflow-tooltip="true"
label="黑湖参数">
</el-table-column>
<el-table-column
prop="success"
header-align="center"
align="center"
width="120"
label="是否处理成功">
<template slot-scope="scope">
<span>{{ scope.row.success === 'Y' ? '成功' : (scope.row.success === 'N' ? '失败' : scope.row.success) }}</span>
</template>
</el-table-column>
<el-table-column
prop="errorMessage"
header-align="center"
align="left"
min-width="260"
:show-overflow-tooltip="true"
label="错误记录">
</el-table-column>
<el-table-column
prop="durationMs"
header-align="center"
align="center"
width="140"
label="处理时间(毫秒)">
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100, 200, 500]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
</div>
</template>
<script>
import { heihuApiLogSearch, heihuApiLogExport } from '@/api/heihu/heihuApiLog'
export default {
name: 'heihuSfdcLog',
data () {
return {
searchData: {
startDate: '',
endDate: '',
searchInParamJson: '',
searchSuccess: ''
},
dataList: [],
dataListLoading: false,
exportLoading: false,
pageIndex: 1,
pageSize: 20,
totalPage: 0,
tableHeight: 200
}
},
created () {
this.getDataList()
},
mounted () {
this.$nextTick(() => {
this.tableHeight = window.innerHeight - 260
})
},
methods: {
searchHandle () {
this.pageIndex = 1
this.getDataList()
},
resetHandle () {
this.searchData.startDate = ''
this.searchData.endDate = ''
this.searchData.searchInParamJson = ''
this.searchData.searchSuccess = ''
this.pageIndex = 1
this.getDataList()
},
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
buildQuery () {
return {
startDate: this.searchData.startDate,
endDate: this.searchData.endDate,
searchInParamJson: this.searchData.searchInParamJson,
searchSuccess: this.searchData.searchSuccess,
page: this.pageIndex,
limit: this.pageSize
}
},
getDataList () {
this.dataListLoading = true
heihuApiLogSearch(this.buildQuery())
.then(({ data }) => {
if (data && data.code === 0 && data.page) {
this.dataList = data.page.list || []
this.pageIndex = data.page.currPage || this.pageIndex
this.pageSize = data.page.pageSize || this.pageSize
this.totalPage = data.page.totalCount || 0
} else {
this.dataList = []
this.totalPage = 0
this.$message.error((data && data.msg) ? data.msg : '查询失败')
}
})
.catch(() => {
this.$message.error('查询失败')
this.dataList = []
this.totalPage = 0
})
.finally(() => {
this.dataListLoading = false
})
},
exportHandle () {
if (this.exportLoading) {
return
}
this.exportLoading = true
heihuApiLogExport(this.buildQuery())
.then((response) => {
const blob = new Blob([response.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = '报工接口调用记录.xlsx'
link.click()
window.URL.revokeObjectURL(url)
})
.catch(() => {
this.$message.error('导出失败')
})
.finally(() => {
this.exportLoading = false
})
}
}
}
</script>
<style scoped>
.mod-config /deep/ .el-input__inner,
.mod-config /deep/ .el-textarea__inner {
box-sizing: border-box;
}
</style>

27
test/e2e/custom-assertions/elementCount.js

@ -1,27 +0,0 @@
// A custom Nightwatch assertion.
// The assertion name is the filename.
// Example usage:
//
// browser.assert.elementCount(selector, count)
//
// For more information on custom assertions see:
// http://nightwatchjs.org/guide#writing-custom-assertions
exports.assertion = function (selector, count) {
this.message = 'Testing if element <' + selector + '> has count: ' + count
this.expected = count
this.pass = function (val) {
return val === this.expected
}
this.value = function (res) {
return res.value
}
this.command = function (cb) {
var self = this
return this.api.execute(function (selectorToCount) {
return document.querySelectorAll(selectorToCount).length
}, [selector], function (res) {
cb.call(self, res)
})
}
}

46
test/e2e/nightwatch.conf.js

@ -1,46 +0,0 @@
require('babel-register')
var config = require('../../config')
// http://nightwatchjs.org/gettingstarted#settings-file
module.exports = {
src_folders: ['test/e2e/specs'],
output_folder: 'test/e2e/reports',
custom_assertions_path: ['test/e2e/custom-assertions'],
selenium: {
start_process: true,
server_path: require('selenium-server').path,
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver': require('chromedriver').path
}
},
test_settings: {
default: {
selenium_port: 4444,
selenium_host: 'localhost',
silent: true,
globals: {
devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port)
}
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true
}
},
firefox: {
desiredCapabilities: {
browserName: 'firefox',
javascriptEnabled: true,
acceptSslCerts: true
}
}
}
}

48
test/e2e/runner.js

@ -1,48 +0,0 @@
// 1. start the dev server using production config
process.env.NODE_ENV = 'testing'
const webpack = require('webpack')
const DevServer = require('webpack-dev-server')
const webpackConfig = require('../../build/webpack.prod.conf')
const devConfigPromise = require('../../build/webpack.dev.conf')
let server
devConfigPromise.then(devConfig => {
const devServerOptions = devConfig.devServer
const compiler = webpack(webpackConfig)
server = new DevServer(compiler, devServerOptions)
const port = devServerOptions.port
const host = devServerOptions.host
return server.listen(port, host)
})
.then(() => {
// 2. run the nightwatch test suite against it
// to run in additional browsers:
// 1. add an entry in test/e2e/nightwatch.conf.json under "test_settings"
// 2. add it to the --env flag below
// or override the environment flag, for example: `npm run e2e -- --env chrome,firefox`
// For more information on Nightwatch's config file, see
// http://nightwatchjs.org/guide#settings-file
let opts = process.argv.slice(2)
if (opts.indexOf('--config') === -1) {
opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js'])
}
if (opts.indexOf('--env') === -1) {
opts = opts.concat(['--env', 'chrome'])
}
const spawn = require('cross-spawn')
const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' })
runner.on('exit', function (code) {
server.close()
process.exit(code)
})
runner.on('error', function (err) {
server.close()
throw err
})
})

19
test/e2e/specs/test.js

@ -1,19 +0,0 @@
// For authoring Nightwatch tests, see
// http://nightwatchjs.org/guide#usage
module.exports = {
'default e2e tests': function (browser) {
// automatically uses dev Server port from /config.index.js
// default: http://localhost:8080
// see nightwatch.conf.js
const devServer = browser.globals.devServerURL
browser
.url(devServer)
.waitForElementVisible('#app', 5000)
.assert.elementPresent('.hello')
.assert.containsText('h1', 'Welcome to Your Vue.js App')
.assert.elementCount('img', 1)
.end()
}
}

11
test/unit/specs/HelloWorld.spec.js

@ -1,11 +0,0 @@
import Vue from 'vue'
import HelloWorld from '@/components/HelloWorld'
describe('HelloWorld.vue', () => {
it('should render correct contents', () => {
const Constructor = Vue.extend(HelloWorld)
const vm = new Constructor().$mount()
expect(vm.$el.querySelector('.hello h1').textContent)
.toEqual('Welcome to Your Vue.js App')
})
})
Loading…
Cancel
Save