277 lines
11 KiB
Vue
277 lines
11 KiB
Vue
<template>
|
|
<a-card :bordered="false">
|
|
<!-- 查询区域 -->
|
|
<div class="table-page-search-wrapper">
|
|
<a-form layout="inline">
|
|
<a-row :gutter="30">
|
|
<a-col :md="20">
|
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
|
</span>
|
|
</a-col>
|
|
</a-row>
|
|
<a-row :gutter="24">
|
|
<a-col :md="4" :sm="8">
|
|
<a-form-item label="型号">
|
|
<a-select placeholder="选择型号" option-filter-prop="children" show-search :filter-option="filterOption" v-model="queryParam.shipModel" @change="changeshipModel">
|
|
<a-select-option v-for="item in shipModel" :value="item">
|
|
{{ item }}
|
|
</a-select-option>
|
|
</a-select>
|
|
</a-form-item>
|
|
</a-col>
|
|
<a-col :md="4" :sm="8">
|
|
<a-form-item label="舷号">
|
|
<a-select placeholder="选择舷号" option-filter-prop="children" show-search :filter-option="filterOption" v-model="queryParam.shipNumber" @change="changeshipNumber">
|
|
<a-select-option v-for="item in shipNumber" :value="item">
|
|
{{ item }}
|
|
</a-select-option>
|
|
</a-select>
|
|
</a-form-item>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<a-form-item label="数据类型">
|
|
<a-select placeholder="选择数据类型" option-filter-prop="children" v-model="queryParam.dataType" @change="handleTypeChange">
|
|
<a-select-option v-for="item in dataTypeList" :value="item.enName">
|
|
{{ item.cnName }}
|
|
</a-select-option>
|
|
</a-select>
|
|
</a-form-item>
|
|
</a-col>
|
|
<a-col :md="4" :sm="8">
|
|
<a-form-item label="报文名">
|
|
<a-input placeholder="请输入报文名称" v-model="queryParam.msgName" allow-clear></a-input>
|
|
</a-form-item>
|
|
</a-col>
|
|
<a-col :md="4" :sm="24">
|
|
<a-button type="primary" style="left: 10px" icon="search" @click="getQueryPage">查询</a-button>
|
|
</a-col>
|
|
<!-- <a-col :md="4" :sm="24" style="text-align: right;">
|
|
<a-button type="primary" style="right: 10px" icon="plus" @click="handleAdd">新建</a-button>
|
|
</a-col> -->
|
|
</a-row>
|
|
</a-form>
|
|
</div>
|
|
|
|
<a-row :gutter="30" style="padding: 0 10px;">
|
|
<a-col :md="24">
|
|
<div class="linese"></div>
|
|
<!-- 表格区域 -->
|
|
<div style="height:calc(100vh - 316px);background: #e6e9f1;overflow:hidden;padding: 15px;">
|
|
<a-table size="middle" bordered :columns="columns" :data-source="dataSource" :loading="loading"
|
|
:pagination="pagination" :scroll="{ y: 'calc(100vh - 420px)' }" rowKey="id"
|
|
@change="handleTableChange">
|
|
<!-- <span slot="createTime" slot-scope="text, record">
|
|
{{ moment(text).format('YYYY-MM-DD') }}
|
|
</span> -->
|
|
<template slot="duplicationType" slot-scope="text">
|
|
<span v-if="text == 1" >完全去重</span>
|
|
<span v-if="text == 2">关键列去重</span>
|
|
</template>
|
|
<span slot="action" slot-scope="text, record">
|
|
<a @click="handleEdit(record)">配置</a>
|
|
<a-divider type="vertical" v-if="record.id" />
|
|
<a v-if="record.id" @click="handleRemove(record.id)">删除</a>
|
|
</span>
|
|
</a-table>
|
|
</div>
|
|
<div class="linese"></div>
|
|
</a-col>
|
|
</a-row>
|
|
|
|
<rulesModel ref="modalForm" @fatherMethod="getQueryPage" />
|
|
</a-card>
|
|
</template>
|
|
<script>
|
|
import moment from 'moment'
|
|
import { deleteRules, queryPage } from '@/api/dataMergingRules'
|
|
import { dataTypeQueryAll } from '@/api/dataType'
|
|
import rulesModel from './rulesModel.vue'
|
|
import {getAction} from '@/api/manage'
|
|
export default {
|
|
name: "dataMergingRules",
|
|
components: {
|
|
rulesModel
|
|
},
|
|
data() {
|
|
return {
|
|
moment,
|
|
loading: false,
|
|
// 查询条件
|
|
queryParam: {
|
|
dataType: '',
|
|
msgName: null,
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
shipModel:'',
|
|
shipNumber:''
|
|
},
|
|
pagination: {
|
|
defaultCurrent: 1, // 默认当前页数
|
|
defaultPageSize: 10, // 默认当前页显示数据的大小total: 0, // 总数,必须先有
|
|
showSizeChanger: true,
|
|
showQuickJumper: false,
|
|
pageSizeOptions: ['10', '20', '30'],
|
|
showTotal: total => `总共 ${total} 个项目`, // 显示总数
|
|
onShowSizeChange: (current, pageSize) => (this.queryParam.pageSize = pageSize)
|
|
},
|
|
dataTypeList: [],
|
|
dataSource: [],
|
|
columns: [
|
|
{
|
|
title: '序号',
|
|
width: 70,
|
|
customRender: (text, record, index) => `${index + 1}`,
|
|
},
|
|
{
|
|
title: '表名',
|
|
align: "center",
|
|
dataIndex: 'tableName',
|
|
},
|
|
{
|
|
title: '报文名称',
|
|
align: "center",
|
|
dataIndex: 'msgName',
|
|
},
|
|
{
|
|
title: '合并表',
|
|
align: "center",
|
|
dataIndex: 'mergTables',
|
|
},
|
|
{
|
|
title: '创建时间',
|
|
align: "center",
|
|
dataIndex: 'createTime',
|
|
scopedSlots: { customRender: 'createTime' },
|
|
},
|
|
{
|
|
title: '操作',
|
|
key: 'action',
|
|
width: 130,
|
|
align: "center",
|
|
scopedSlots: { customRender: 'action' },
|
|
},
|
|
],
|
|
shipModel:[],
|
|
shipNumber:[],
|
|
existingDataTypes:{}
|
|
}
|
|
},
|
|
|
|
mounted() {
|
|
|
|
},
|
|
computed: {
|
|
|
|
},
|
|
created() {
|
|
this.getDataType()
|
|
},
|
|
methods: {
|
|
getDataType() {
|
|
getAction("/dataType/getExistingDataTypes", {}).then((res) => {
|
|
if (res.success) {
|
|
this.existingDataTypes = res.result.result.original
|
|
var ship = Object.keys(this.existingDataTypes)
|
|
ship.forEach((element, index) => {
|
|
this.shipModel.push(element);
|
|
});
|
|
var number = Object.keys(this.existingDataTypes[this.shipModel[0]])
|
|
number.forEach((element, index) => {
|
|
this.shipNumber.push(element);
|
|
});
|
|
this.dataTypeList =this.existingDataTypes[this.shipModel[0]][this.shipNumber[0]]
|
|
this.queryParam.shipModel = this.shipModel[0]
|
|
this.queryParam.shipNumber = this.shipNumber[0]
|
|
this.queryParam.dataType = this.dataTypeList[0].enName
|
|
this.getQueryPage()
|
|
} else {
|
|
this.$message.warning(res.message);
|
|
}
|
|
});
|
|
},
|
|
filterOption(input, option) {
|
|
return (
|
|
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
);
|
|
},
|
|
changeshipModel(value) {
|
|
this.queryParam.shipModel = value
|
|
var number = Object.keys(this.existingDataTypes[value])
|
|
this.shipNumber = []
|
|
number.forEach((element, index) => {
|
|
this.shipNumber.push(element);
|
|
});
|
|
this.dataTypeList =this.existingDataTypes[value][this.shipNumber[0]]
|
|
this.queryParam.shipNumber = this.shipNumber[0]
|
|
this.queryParam.dataType = this.dataTypeList[0].enName
|
|
this.getQueryPage()
|
|
},
|
|
changeshipNumber(value) {
|
|
this.dataTypeList =this.existingDataTypes[this.queryParam.shipModel][value]
|
|
this.queryParam.shipNumber = value
|
|
this.queryParam.dataType = this.dataTypeList[0].enName
|
|
this.getQueryPage()
|
|
},
|
|
handleTypeChange(key) {
|
|
this.queryParam.dataType = key
|
|
this.getQueryPage()
|
|
},
|
|
handleTableChange(pagination, filters, sorter) {
|
|
this.pagination = pagination
|
|
this.queryParam.pageNum = pagination.current
|
|
this.queryParam.pageSize = pagination.pageSize
|
|
this.getQueryPage()
|
|
},
|
|
getQueryPage() {
|
|
queryPage(this.queryParam).then(res => {
|
|
if (res.code == 200) {
|
|
const pagination = { ...this.pagination }
|
|
pagination.total = res.result.total
|
|
this.dataSource = res.result.rows
|
|
this.pagination = pagination
|
|
} else {
|
|
this.$notification.error({
|
|
message: '系统提示',
|
|
description: res.message
|
|
})
|
|
}
|
|
})
|
|
},
|
|
handleAdd() {
|
|
this.$refs.modalForm.add(this.queryParam);
|
|
this.$refs.modalForm.title = "新增";
|
|
},
|
|
handleEdit(record) {
|
|
this.$refs.modalForm.eidt(record, this.queryParam);
|
|
this.$refs.modalForm.title = "配置";
|
|
},
|
|
handleRemove(recordId) {
|
|
console.log('dfs', recordId)
|
|
const _that = this
|
|
_that.$confirm({
|
|
title: '你确认执行删除操作吗?',
|
|
okText: '确认',
|
|
cancelText: '取消',
|
|
onOk() {
|
|
console.log('dfs', recordId)
|
|
deleteRules({ id: recordId }).then(res => {
|
|
if (res.code === 200) {
|
|
_that.$notification.success({
|
|
message: '系统提示',
|
|
description: res.message
|
|
})
|
|
_that.getQueryPage()
|
|
} else {
|
|
_that.$notification.warning({
|
|
message: '系统提示',
|
|
description: res.message
|
|
})
|
|
}
|
|
})
|
|
},
|
|
onCancel() { }
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script> |