You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fu-hsi-web/src/views/ruleEngine/atomicIndex/index.vue

293 lines
8.5 KiB
Vue

10 months ago
<!--
* @description: 原子指标
* @fileName: index
* @author: 17076
* @date: 2024/6/28-上午10:03
* @version: V1.0.0
-->
<template>
<div class="content">
<cs-search title="原子指标" :data="searchData" :span="8" direction="row" @onSearch="onSearch" @getData="onSearch" />
10 months ago
<div class="index-content">
<div class="header">
<el-button type="primary" icon="el-icon-circle-plus-outline" @click="handleAdd"></el-button>
</div>
<vxe-grid v-bind="gridOptions" style="margin-top: 20px">
<template #operate="{row}">
<el-button type="text" icon="el-icon-edit" @click="handleEdit(row)" />
<el-button type="text" icon="el-icon-view" title="查看明细" @click="handleView(row)" />
<el-button type="text" style="color: red" icon="el-icon-delete" @click="handleDel(row)" />
10 months ago
</template>
</vxe-grid>
<div style="text-align: center">
<cs-page
:page.sync="queryForm.page"
:limit.sync="queryForm.size"
:total="queryForm.total"
@pagination="fetchData"
/>
</div>
</div>
<el-dialog
:visible.sync="dialogVisible"
width="500px"
append-to-body
:before-close="handleClose"
>
<template>
<div class="del-folder">
<div class="header">
<img src="@/assets/record/error.png" alt="">
<span>确认删除原子指标</span>
</div>
<div v-if="atomicList.length > 0" class="content-text"></div>
<div v-if="atomicList.length === 0" class="content-text">
无关联案件模型确定永久删除?
</div>
<div class="atomic-list">
<span v-for="(item,index) in atomicList" :key="index">
{{ `${item.modelName}${item.atomicIndexName}` }}
</span>
</div>
<div class="footer-btns">
<div class="btn" @click="delItem"></div>
<div class="reset_btn" @click="handleClose"></div>
</div>
</div>
</template>
</el-dialog>
10 months ago
<!--编辑弹窗-->
<edit-atomic ref="edit" @reloadData="fetchData" />
</div>
</template>
<script>
import ChangeRules from '@/views/ruleEngine/indexRule/components/ChangeRules.vue'
import IndexAtlas from '@/views/ruleEngine/indexRule/components/IndexAtlas.vue'
import mixin from '@/views/mixin'
import EditAtomic from '@/views/ruleEngine/atomicIndex/components/EditAtomic.vue'
import { queryAtomicIndex, delAtomicIndex } from '@/api/atomicIndex'
import { queryAtomicUsed } from '@/api/indexRule/index'
10 months ago
export default {
name: 'Index',
components: { EditAtomic, IndexAtlas, ChangeRules },
mixins: [mixin],
data() {
return {
// 筛选数据
searchData: [
{ label: '原子指标', model: 'name', type: 'input' },
// { label: '指标分类', model: 'indexType', type: 'select', option: JSON.parse(sessionStorage.getItem('index_type')) },
10 months ago
{ label: '指标来源', model: 'indexSource', type: 'select', option: JSON.parse(sessionStorage.getItem('index_source')) },
{ label: '最新时间', model: 'updateTime', type: 'datetimerange' }
10 months ago
],
dialogVisible: false,
atomicList: [],
selectAtomic: '',
10 months ago
// 表格配置
gridOptions: {
...mixin.data().gridOptions,
// 指标名称单元格添加样式
cellClassName: ({ column }) => {
if (column.field === 'indexName') {
return 'text-blue'
}
return null
},
columns: [
{ title: '序号', type: 'seq', width: '50px' },
10 months ago
{ title: '原子指标', field: 'name' },
// { title: '案件类型', field: 'caseTypeName', sortable: true },
10 months ago
{ title: '指标来源', field: 'indexSourceName', sortable: true },
// { title: '状态', field: 'connectStatus' },
{ title: '最新时间', field: 'updateTime', sortable: true },
{ title: '操作', slots: { default: 'operate' }, fixed: 'right', width: '150px' }
],
data: []
}
}
},
mounted() {
this.tableHeight(390)
10 months ago
},
methods: {
// 原子指标查询
fetchData() {
const params = JSON.parse(JSON.stringify(this.searchFormData))
if (this.searchFormData.updateTime) {
this.$set(params, 'updateStartTime', this.searchFormData.updateTime[0])
this.$set(params, 'updateEndTime', this.searchFormData.updateTime[1])
delete params['updateTime']
}
queryAtomicIndex(params, this.queryForm.page, this.queryForm.size).then(res => {
this.gridOptions.data = res.data.result
this.queryForm.total = res.data.total
})
},
async delItem() {
const { code, msg } = await delAtomicIndex(this.selectAtomic)
code === 200 ? this.$baseMessage.success(msg || '删除成功!') : this.$baseMessage.error(msg || '删除失败!')
this.fetchData()
this.dialogVisible = false
},
handleClose() {
this.dialogVisible = false
},
10 months ago
// 新增
handleAdd() {
this.$refs.edit.show()
},
// 变更
handleChange() {
this.$refs.change.show()
},
// 编辑
handleEdit(row) {
this.$refs.edit.show(row, true)
},
// 查看明细
handleView(row) {
this.$refs.edit.show(row, false)
},
// 查询原子指标被使用情况
async getAtomicUsed(val) {
const res = await queryAtomicUsed({ atomicIndexId: val })
if (res.code === 200) {
this.atomicList = res.data
}
},
10 months ago
// 删除
handleDel(row) {
this.dialogVisible = true
this.getAtomicUsed(row.id)
this.selectAtomic = row.id
// this.$baseConfirm('确定要删除吗?', null, async() => {
// const { code, msg } = await delAtomicIndex(row.id)
// code === 200 ? this.$baseMessage.success(msg || '删除成功!') : this.$baseMessage.error(msg || '删除失败!')
// this.fetchData()
// })
10 months ago
},
// 筛选
onSearch(data, callback) {
this.searchFormData = Object.assign({}, data)
this.queryForm.page = 1
this.fetchData()
if (callback) callback(true)
}
}
}
</script>
<style scoped lang="scss">
.content {
height: 100%;
.index-content {
border-radius: 8px;
background: white;
padding: 20px;
box-sizing: border-box;
margin-top: 10px;
height: calc(100% - 123px);
10 months ago
}
.expand-details {
background: #F6F6F6;
padding: 8px 20px;
10 months ago
box-sizing: border-box;
}
6 months ago
.header {
display: flex;
flex-direction: row-reverse;
}
10 months ago
}
::v-deep {
.text-blue {
color: #005AA8;
}
.header-blue {
background: #F2F6FA;
}
}
</style>
<style lang="scss" scoped>
.dialog-content {
border-radius: 5px;
padding: 20px;
box-sizing: border-box;
}
::v-deep .el-dialog__header {
padding: 0;
}
::v-deep .el-dialog__body {
padding: 0 !important;
}
::v-deep .el-dialog {
// background: linear-gradient(to bottom, #E1ECFE, #FFFFFF);
}
.del-folder {
padding: 24px;
.header {
display: flex;
img {
width: 28px;
height: 28px;
margin-right: 16px;
}
font-weight: bold;
font-size: 20px;
color: #333333;
}
.content-text {
margin-top: 12px;
font-weight: 400;
font-size: 16px;
color: #666666;
line-height: 25px;
padding-left: 45px;
}
.atomic-list {
display: flex;
flex-direction: column;
padding-left: 45px;
margin-top: 8px;
span {
font-size: 14px;
color: #666666;
margin-top: 4px;
}
}
.footer-btns {
padding-top: 24px;
display: flex;
flex-direction: row-reverse;
.btn {
padding: 8px 24px;
background: #3763FF;
box-shadow: 0px 2px 0px 0px rgba(0,0,0,0.04);
border-radius: 6px 6px 6px 6px;
text-align: center;
font-size: 16px;
color: #FFFFFF;
cursor: pointer;
margin-left: 16px;
}
.reset_btn {
padding: 8px 24px;
background: #FFFFFF;
box-shadow: 0px 2px 0px 0px rgba(0,0,0,0.04);
border-radius: 6px 6px 6px 6px;
border: 1px solid #3763FF;
text-align: center;
font-size: 16px;
color: #3763FF;
cursor: pointer;
margin-left: 16px;
}
}
}
</style>