风控bug代码优化:基础指标,SQL指标,常量指标,衍生指标页面

This commit is contained in:
admin
2025-01-15 10:33:21 +08:00
parent 0430e8d010
commit ca6466d59a
5 changed files with 299 additions and 244 deletions

View File

@@ -2,8 +2,7 @@
<template>
<div class="cont_cont">
<!-- <div class="cont_left" v-loading="leftloading">
<!-- <div class="cont_left" v-loading="leftloading">
<div class="cont_header">
<p class="cont_header_title">{{title}}</p>
<p class="cont_header_subtitle">{{title}}</p>
@@ -15,21 +14,27 @@
@updatafilelist="updatafilelist" @delectFun="delectFun">
</fileHome>
</div>
</div>-->
<div class="cont_right" v-loading="contloading" @click="tempHintLeft=null;tempHintTop=null;">
</div> -->
<div
class="cont_right"
v-loading="contloading"
@click="tempHintLeft = null; tempHintTop = null;">
<div v-if="!listRedact" class="search-form">
<el-form :model="searchForm" label-width="100px">
<el-row :gutter="20">
<!-- 用户名查询 -->
<el-col :span="6" v-for="item in getSearch">
<el-col :span="6" v-for="item in getSearch" :key="item.name">
<el-form-item :label="item.name">
<el-input v-if="item.type==='1'" v-model="searchForm[item.key]" placeholder="请输入用户名"></el-input>
<el-input
v-if="item.type==='1'"
v-model="searchForm[item.key]"
placeholder="请输入用户名"></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 角色查询 -->
<!-- <el-col :span="6">
<!-- <el-col :span="6">
<el-form-item label="字段中文名">
<el-input v-model="searchForm.username" placeholder="请输入用户名"></el-input>
</el-form-item>
@@ -53,7 +58,7 @@
</el-select>
</el-form-item>
</el-col>
</el-row>-->
</el-row> -->
<!-- 查询和重置按钮放在一行 -->
<el-row>
<el-col :span="24" class="button-container">
@@ -66,25 +71,40 @@
</el-form>
</div>
<div v-if="!listRedact">
<div v-if="showRight===false" class="cont_right_hint">
<div v-if="showRight === false" class="cont_right_hint">
请先选择左侧文件夹
</div>
<div v-else>
<div class="cont_right_top">
<div>
<!-- <el-button typeof="primary" @click="listRedact=true" :disabled="currid!=99999999?false:'disabled'">新增</el-button>-->
<!-- <el-button typeof="primary" @click="listRedact=true" :disabled="currid!=99999999?false:'disabled'">新增</el-button> -->
<el-button type="primary" @click="listRedact=true">新增</el-button>
<el-button type="danger" @click="using(-1)" :disabled="this.selection.length>0?false:'disabled'">删除</el-button>
<el-button type="success" @click="using(1)" :disabled="this.selection.length>0?false:'disabled'">启用</el-button>
<el-button type="warning" @click="using(0)" :disabled="this.selection.length>0?false:'disabled'">停用</el-button>
<!-- <el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;" :disabled="this.selection.length>0?false:'disabled'" filterable @change="mixinMoveChange"> -->
<!-- <el-select v-model="tempMove" placeholder="移动到:" style="margin-left: 10px;" :disabled="this.selection.length>0?false:'disabled'"
filterable @change="moveChange">
<el-option v-for="value in listunfold" :key="value.id" :label="value.name" :value="value.id" v-show="value.id!=99999999"></el-option>
</el-select>-->
<!-- <el-select
v-model="tempMove"
placeholder="移动到:"
style="margin-left: 10px;"
:disabled="this.selection.length > 0 ? false : 'disabled'"
filterable
@change="mixinMoveChange"> -->
<!-- <el-select
v-model="tempMove"
placeholder="移动到:"
style="margin-left: 10px;"
:disabled="this.selection.length > 0 ? false : 'disabled'"
filterable @change="moveChange">
<el-option
v-for="value in listunfold"
:key="value.id"
:label="value.name"
:value="value.id"
v-show="value.id != 99999999"></el-option>
</el-select> -->
<!-- 断点 准备移动 -->
</div>
<div v-if="getData.type==1">
<div v-if="getData.type == 1">
<el-button @click="upShow=true">批量导入</el-button>
<el-button @click="down">模板下载</el-button>
</div>
@@ -95,26 +115,35 @@
:cell-style="{padding: '10px'}">
<el-table-column type="selection" width="70">
</el-table-column>
<el-table-column v-for="item in getData.row" :key="item.id" :prop="item.row" :label="item.label" align="center">
<el-table-column
v-for="item in getData.row"
:key="item.id"
:prop="item.row"
:label="item.label"
align="center">
<template slot-scope="scope">
<span v-if="item.type==='Blooen'">
{{scope.row[item.row]?"":""}}
</span>
<span v-else-if="item.type==='State'">
{{scope.row[item.row]=="1"?'启用':'未启用'}}
</span>
<span v-else-if="item.type==='type'">
{{scope.row[item.row]=="1"?'':(scope.row[item.row]=="2"?'字符型':(scope.row[item.row]=="3"?'枚举型':(scope.row[item.row]=="4"?'小数型':(scope.row[item.row]=="5"?'数组型':(scope.row[item.row]=="6"?'JSON型':'')))))}}
</span>
<span v-else-if="item.fn">
{{item.fn(scope.row[item.row])}}
</span>
<span v-else-if="item.type==='Time'" style="white-space: nowrap;" class="contText">{{
new Date(scope.row[item.row]).toLocaleDateString().replace(/\//g, "-") + " " + new Date(scope.row[item.row]).toTimeString().substr(0, 8)
}}</span>
<span class="contText" v-else>
{{scope.row[item.row]}}
<span v-if="item.type === 'Blooen'">{{ scope.row[item.row] ? "是" : "否" }}</span>
<span v-else-if="item.type === 'State'">{{ scope.row[item.row] == "1" ? '启用' : '未启用' }}</span>
<span v-else-if="item.type === 'type'">
{{ scope.row[item.row] == "1"
? '数值型' : (scope.row[item.row] == "2"
? '字符型' : (scope.row[item.row] == "3"
? '枚举型' : (scope.row[item.row] == "4"
? '数型' : (scope.row[item.row] == "5"
? '数组型' : (scope.row[item.row] == "6"
? 'JSON型' : '')))))}}
</span>
<span v-else-if="item.fn">{{ item.fn(scope.row[item.row]) }}</span>
<span
v-else-if="item.type === 'Time'"
style="white-space: nowrap;"
class="contText">
{{ new Date(scope.row[item.row]).toLocaleDateString().replace(/\//g, "-")
+ " " +
new Date(scope.row[item.row]).toTimeString().substr(0, 8)
}}
</span>
<span class="contText" v-else>{{ scope.row[item.row] }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" size="s">
@@ -123,29 +152,43 @@
</template>
</el-table-column>
</el-table>
<el-pagination style="float: right;margin-right: 40px;margin-top: 40px;" :current-page="currPage"
@current-change="clickpage" background layout="prev, pager, next" :total="data.data.pager.total">
<el-pagination
style="float: right; margin-right: 40px; margin-top: 40px;"
:current-page="currPage"
@current-change="clickpage"
background
layout="prev, pager, next"
:total="data.data.pager.total">
</el-pagination>
</div>
</div>
</div>
</div>
<template v-else>
<dataManageRedact @close="listRedact=false;tempRedactId=0" @Ok="listRedact=false;tempRedactId=0;getlist();currPage=1"
:updata="getData.updatafield" :id='tempRedactId' :fieldTypeId="currid" :setsave="getData.setsave" :getInfo="getData.getInfo"
<dataManageRedact
@close="listRedact=false;tempRedactId=0"
@Ok="listRedact=false;tempRedactId=0;getlist();currPage=1"
:updata="getData.updatafield"
:id='tempRedactId'
:fieldTypeId="currid"
:setsave="getData.setsave"
:getInfo="getData.getInfo"
:ftype="getData.type"></dataManageRedact>
</template>
</div>
<el-dialog title="上传文件" :visible.sync="upShow" width="30%" :before-close="upShowClose">
<div style="margin: 0 auto;display: flex;justify-content: center;">
<el-upload class="upload-demo" ref="upload" action="doUpload" :limit="1" :file-list="fileList" :before-upload="beforeUpload"
v-loading="Uploadloading">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<div slot="tip" class="el-upload__tip">只能上传excel文件且不超过5MB</div>
<div slot="tip" class="el-upload-list__item-name">{{fileName}}</div>
<el-upload
class="upload-demo"
ref="upload" action="doUpload"
:limit="1"
:file-list="fileList"
:before-upload="beforeUpload"
v-loading="Uploadloading">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<div slot="tip" class="el-upload__tip">只能上传excel文件且不超过5MB</div>
<div slot="tip" class="el-upload-list__item-name">{{fileName}}</div>
</el-upload>
</div>
<span slot="footer" class="dialog-footer">
@@ -169,13 +212,14 @@
mixins: [
contmixin
],
components: {
fileHome,
dataManageRedact,
updateFieldFolder,
contNewFule
},
props: {
title: {
type: String,
@@ -189,8 +233,8 @@
type: Array,
default: null
},
},
watch: {
list() {
if (this.list.length > 0) {
@@ -198,6 +242,7 @@
}
}
},
data() {
return {
list: [],
@@ -222,6 +267,7 @@
searchForm: {}
}
},
created() {
this.getData.getTree({
type: this.getData.type
@@ -230,6 +276,7 @@
this.clickCurrid(99999999)
})
},
methods: {
moveChange(e) { //移动文件夹
let arr = this.selection.map((value) => {
@@ -255,7 +302,6 @@
})
this.tempMove = ""
},
down() {
window.open(window.origin + '/Riskmanage/v2/datamanage/field/downTemplate')
},
@@ -275,12 +321,9 @@
type: 'success',
message: '删除成功!'
});
this.deepGetCurr(id, this.list, (value, item, index) => {
item.splice(index, 1)
})
}
this.leftloading = false
this.currid = 99999999
@@ -294,7 +337,6 @@
updatafilelist(params) {
this.leftloading = true
let tempNum = null
this.deepGetCurr(params.id, this.list, (value) => {
tempNum = value.parentId
})
@@ -324,8 +366,6 @@
this.leftloading = false
})
},
getlist() {
this.contloading = true
this.listRedact = false
@@ -338,7 +378,6 @@
this.data = res
this.contloading = false
})
},
clickpage(e) {
this.currPage = e
@@ -357,7 +396,6 @@
})
},
using(id) {
let arr = this.selection.map((value) => {
return value.id
})
@@ -365,23 +403,58 @@
this.$message.error('未选择任何文件');
return
}
let params = {
status: id,
ids: arr.join(','),
fieldTypeId: this.currid
}
this.getData.fieldusing(params).then(res => {
if (res.status == "1") {
this.$message({
message: '操作成功',
type: 'success'
});
this.getlist()
this.selection = []
this.$store.dispatch('reGetfielduser')
}
})
const operations = {
'-1': '删除',
'1': '启用',
'0': '停用'
};
let operationText = operations[id.toString()] || '未知操作';
this.$confirm(`此操作将永久${operationText}, 是否继续?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = {
status: id,
ids: arr.join(','),
fieldTypeId: this.currid
}
this.getData.fieldusing(params).then(res => {
if (res.status == "1") {
this.$message({
message: '操作成功',
type: 'success'
});
this.getlist()
this.selection = []
this.$store.dispatch('reGetfielduser')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: `已取消${operationText}`
});
});
// let params = {
// status: id,
// ids: arr.join(','),
// fieldTypeId: this.currid
// }
// this.getData.fieldusing(params).then(res => {
// if (res.status == "1") {
// this.$message({
// message: '操作成功',
// type: 'success'
// });
// this.getlist()
// this.selection = []
// this.$store.dispatch('reGetfielduser')
// }
// })
},
newFileSure() {
this.leftloading = true
@@ -397,10 +470,13 @@
}
this.mixnewFileSure(params)
}
},
handleSearch() {
},
handleReset() {
},
}
}
</script>

View File

@@ -1,17 +1,22 @@
<template>
<div>
<cont title="指标管理" :getData="getDataFun"></cont>
</div>
</template>
<script>
import cont from '@/components/common/cont.vue'
import {
getfieldList,addfieldList,getfieldListTree,updatafieldList,getfieldsave,getfieldInfo,updatafield,fieldusing,fielddownTemplate,fieldupdata
getfieldList,
addfieldList,
getfieldListTree,
updatafieldList,
getfieldsave,
getfieldInfo,
updatafield,
fieldusing,
fielddownTemplate,
fieldupdata,
} from '@/api/index.js'
export default {
@@ -23,31 +28,33 @@
return {
getDataFun: {
type:1,
row: [ {
label: '序号',
row: 'id'
}, {
label: '字段名称',
row: 'fieldEn'
}, {
label: '字段中文名',
row: 'fieldCn'
}, {
label: '字段类型',
row: 'valueType',
type: 'type'
}, {
label: '状态',
row: 'status',
type: 'State'
}, {
label: '创建人',
row: 'nickName'
},{
label: '创建时间',
row: 'created',
type: 'Time'
} ],
row: [
{
label: '序号',
row: 'id'
}, {
label: '字段名称',
row: 'fieldEn'
}, {
label: '字段中文名',
row: 'fieldCn'
}, {
label: '字段类型',
row: 'valueType',
type: 'type'
}, {
label: '状态',
row: 'status',
type: 'State'
}, {
label: '创建人',
row: 'nickName'
}, {
label: '创建时间',
row: 'created',
type: 'Time'
}
],
redact: "dataManageRedact",
async getTree(e){
return await getfieldListTree(e).then(res => {
@@ -66,44 +73,36 @@
})
},
async updatalist(e) {
return await updatafieldList(e).then(res => {
return res
})
},
async setsave(e) {
return await getfieldsave(e).then(res => {
return res
})
},
async getInfo(e) {
// console.log(e)
return await getfieldInfo(e).then(res => {
return res
})
},
async updatafield(e) {
return await updatafield(e).then(res => {
return res
})
},
async fieldusing(e) {
return await fieldusing(e).then(res => {
return res
})
},
async down(e) {
return await fielddownTemplate(e).then(res => {
return res
})
},
async fieldsubmit(e) {
return await fieldupdata(e).then(res => {
return res
})
@@ -112,8 +111,4 @@
};
}
};
</script>
<style>
</style>
</script>

View File

@@ -28,31 +28,33 @@
return {
getDataFun: {
type: 3,
row: [{
label: '序号',
row: 'id'
}, {
label: '字段名称',
row: 'fieldEn'
}, {
label: '字段中文名',
row: 'fieldCn'
}, {
label: '字段类型',
row: 'valueType',
type:'type'
}, {
label: '状态',
row: 'status',
type: 'State'
}, {
label: '创建人',
row: 'nickName'
}, {
label: '创建时间',
row: 'created',
type: 'Time'
}, ],
row: [
{
label: '序号',
row: 'id'
}, {
label: '字段名称',
row: 'fieldEn'
}, {
label: '字段中文名',
row: 'fieldCn'
}, {
label: '字段类型',
row: 'valueType',
type:'type'
}, {
label: '状态',
row: 'status',
type: 'State'
}, {
label: '创建人',
row: 'nickName'
}, {
label: '创建时间',
row: 'created',
type: 'Time'
}
],
redact: "dataManageRedact",
async getTree(e){
return await getfieldListTree(e).then(res => {
@@ -66,49 +68,41 @@
})
},
async addlist(e) {
return await addfieldList(e).then(res => {
return res
})
},
async updatalist(e) {
return await updatafieldList(e).then(res => {
return res
})
},
async setsave(e) {
return await getfieldsave(e).then(res => {
return res
})
},
async getInfo(e) {
return await getfieldInfo(e).then(res => {
return res
})
},
async updatafield(e) {
return await updatafield(e).then(res => {
return res
})
},
async fieldusing(e) {
return await fieldusing(e).then(res => {
return res
})
},
async down(e) {
return await fielddownTemplate(e).then(res => {
return res
})
},
async fieldsubmit(e) {
return await fieldupdata(e).then(res => {
return res
})
@@ -117,8 +111,4 @@
};
}
};
</script>
<style>
</style>
</script>

View File

@@ -1,17 +1,22 @@
<template>
<div>
<cont title="数据源指标" :getData="getDataFun"></cont>
</div>
</template>
<script>
import cont from '@/components/common/cont.vue'
import {
getfieldList,addfieldList,getfieldListTree,updatafieldList,getfieldsave,getfieldInfo,updatafield,fieldusing,fielddownTemplate,fieldupdata
getfieldList,
addfieldList,
getfieldListTree,
updatafieldList,
getfieldsave,
getfieldInfo,
updatafield,
fieldusing,
fielddownTemplate,
fieldupdata
} from '@/api/index.js'
export default {
@@ -24,39 +29,40 @@
return {
getDataFun: {
type:2,
row: [ {
label: '序号',
row: 'id'
}, {
label: '字段名称',
row: 'fieldEn'
}, {
label: '字段中文名',
row: 'fieldCn'
}, {
label: '数据源类型',
row: 'dataSourceId',
fn:(res)=>{
let obj = this.$store.state.Sourcelist.find(x=>x.id==res)
return obj&&obj.type
},
}, {
label: '字段类型',
row: 'valueType',
type:'type'
}, {
label: '状态',
row: 'status',
type:'State'
}, {
label: '创建人',
row: 'nickName'
},{
label: '创建时间',
row: 'created',
type:'Time'
},],
row: [
{
label: '序号',
row: 'id'
}, {
label: '字段名称',
row: 'fieldEn'
}, {
label: '字段中文名',
row: 'fieldCn'
}, {
label: '数据源类型',
row: 'dataSourceId',
fn: (res) => {
let obj = this.$store.state.Sourcelist.find(x=>x.id == res)
return obj && obj.type
},
}, {
label: '字段类型',
row: 'valueType',
type:'type'
}, {
label: '状态',
row: 'status',
type:'State'
}, {
label: '创建人',
row: 'nickName'
},{
label: '创建时间',
row: 'created',
type:'Time'
}
],
redact:"dataManageRedact",
async getTree(e){
return await getfieldListTree(e).then(res => {
@@ -70,49 +76,41 @@
})
},
async addlist(e) {
return await addfieldList(e).then(res => {
return res
})
},
async updatalist(e) {
return await updatafieldList(e).then(res => {
return res
})
},
async setsave(e) {
return await getfieldsave(e).then(res => {
return res
})
},
async getInfo(e){
return await getfieldInfo(e).then(res=>{
return res
})
},
async updatafield(e){
return await updatafield(e).then(res=>{
return res
})
},
async fieldusing(e){
return await fieldusing(e).then(res=>{
return res
})
},
async down(e){
return await fielddownTemplate(e).then(res=>{
return res
})
},
async fieldsubmit(e){
return await fieldupdata(e).then(res=>{
return res
})

View File

@@ -1,17 +1,22 @@
<template>
<div>
<cont title="常量指标" :getData="getDataFun" :getSearch="getSearchForm"></cont>
</div>
</template>
<script>
import cont from '@/components/common/cont.vue'
import {
getfieldList,addfieldList,getfieldListTree,updatafieldList,getfieldsave,getfieldInfo,updatafield,fieldusing,fielddownTemplate,fieldupdata
getfieldList,
addfieldList,
getfieldListTree,
updatafieldList,
getfieldsave,
getfieldInfo,
updatafield,
fieldusing,
fielddownTemplate,
fieldupdata
} from '@/api/index.js'
export default {
@@ -24,31 +29,33 @@
return {
getDataFun: {
type:5,
row: [ {
label: '序号',
row: 'id'
}, {
label: '字段名称',
row: 'fieldEn'
}, {
label: '字段中文名',
row: 'fieldCn'
}, {
label: '字段类型',
row: 'valueType',
type: 'type'
}, {
label: '状态',
row: 'status',
type: 'State'
}, {
label: '创建人',
row: 'nickName'
},{
label: '创建时间',
row: 'created',
type: 'Time'
} ],
row: [
{
label: '序号',
row: 'id'
}, {
label: '字段名称',
row: 'fieldEn'
}, {
label: '字段中文名',
row: 'fieldCn'
}, {
label: '字段类型',
row: 'valueType',
type: 'type'
}, {
label: '状态',
row: 'status',
type: 'State'
}, {
label: '创建人',
row: 'nickName'
},{
label: '创建时间',
row: 'created',
type: 'Time'
}
],
redact:"dataManageRedact",
async getTree(e){
return await getfieldListTree(e).then(res => {
@@ -62,49 +69,41 @@
})
},
async addlist(e) {
return await addfieldList(e).then(res => {
return res
})
},
async updatalist(e) {
return await updatafieldList(e).then(res => {
return res
})
},
async setsave(e) {
return await getfieldsave(e).then(res => {
return res
})
},
async getInfo(e){
return await getfieldInfo(e).then(res=>{
return res
})
},
async updatafield(e){
return await updatafield(e).then(res=>{
return res
})
},
async fieldusing(e){
return await fieldusing(e).then(res=>{
return res
})
},
async down(e){
return await fielddownTemplate(e).then(res=>{
return res
})
},
async fieldsubmit(e){
return await fieldupdata(e).then(res=>{
return res
})
@@ -134,14 +133,11 @@
],
};
}
};
</script>
<style>
.button-container {
text-align: right; /* 使按钮右对齐 */
}
</style>