补充流程列表测算利率联表查询
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
<el-table-column label="客户类型" align="center" prop="custType" width="100" />
|
||||
<el-table-column label="担保方式" align="center" prop="guarType" width="100" />
|
||||
<el-table-column label="申请金额(元)" align="center" prop="applyAmt" width="120" />
|
||||
<el-table-column label="测算利率(%)" align="center" prop="calculateRate" width="100" />
|
||||
<el-table-column label="执行利率(%)" align="center" prop="executeRate" width="100" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
|
||||
<template slot-scope="scope">
|
||||
@@ -130,6 +131,9 @@ export default {
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
activated() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
/** 查询利率定价流程列表 */
|
||||
getList() {
|
||||
|
||||
52
ruoyi-ui/tests/workflow-index-refresh.test.js
Normal file
52
ruoyi-ui/tests/workflow-index-refresh.test.js
Normal file
@@ -0,0 +1,52 @@
|
||||
const assert = require('assert')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const vm = require('vm')
|
||||
|
||||
function loadComponentOptions(filePath) {
|
||||
const source = fs.readFileSync(filePath, 'utf8')
|
||||
const scriptMatch = source.match(/<script>([\s\S]*?)<\/script>/)
|
||||
|
||||
if (!scriptMatch) {
|
||||
throw new Error('未找到组件脚本内容')
|
||||
}
|
||||
|
||||
const importNames = []
|
||||
const importPattern = /^import\s+([A-Za-z0-9_]+)\s+from\s+.*$/gm
|
||||
let importMatch = importPattern.exec(scriptMatch[1])
|
||||
while (importMatch) {
|
||||
importNames.push(importMatch[1])
|
||||
importMatch = importPattern.exec(scriptMatch[1])
|
||||
}
|
||||
|
||||
const stubImports = importNames.map(name => `const ${name} = {};`).join('\n')
|
||||
const transformed = `${stubImports}\n${scriptMatch[1]}`
|
||||
.replace(/^import .*$/gm, '')
|
||||
.replace(/export default/, 'module.exports =')
|
||||
|
||||
const sandbox = {
|
||||
module: { exports: {} },
|
||||
exports: {},
|
||||
require,
|
||||
console
|
||||
}
|
||||
|
||||
vm.runInNewContext(transformed, sandbox, { filename: filePath })
|
||||
return sandbox.module.exports
|
||||
}
|
||||
|
||||
const filePath = path.resolve(__dirname, '../src/views/loanPricing/workflow/index.vue')
|
||||
const component = loadComponentOptions(filePath)
|
||||
|
||||
assert.strictEqual(typeof component.activated, 'function', '流程列表页应在激活时刷新数据')
|
||||
|
||||
let refreshCount = 0
|
||||
component.activated.call({
|
||||
getList() {
|
||||
refreshCount += 1
|
||||
}
|
||||
})
|
||||
|
||||
assert.strictEqual(refreshCount, 1, '流程列表页激活时应调用一次 getList')
|
||||
|
||||
console.log('workflow-index-refresh test passed')
|
||||
Reference in New Issue
Block a user