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.

225 lines
7.5 KiB
Vue

1 month ago
<template>
1 month ago
<el-dialog v-model="visible" title="设置勾绘参数" @close="handleClose" width="800px">
<el-tabs v-model="activeLeftName" position="top">
<el-tab-pane label="参数显示" name="params">
<el-table ref="drawParamRef" :data="drawParams"
@selection-change="handleSelectionChange" class="param-table" row-key="PillarName">
<el-table-column type="selection" width="40" fixed></el-table-column>
<el-table-column prop="PillarName" label="名称" width="150" fixed></el-table-column>
<el-table-column prop="GridCount" width="60" label="数目">
<template #default="scope">
<el-input v-model="scope.row.GridCount" size="small"
@input="handleInputChange(scope.row, 'GridCount')" />
</template>
</el-table-column>
<!-- 加密列可编辑 -->
<el-table-column prop="Times" width="60" label="加密">
<template #default="scope">
<el-input v-model="scope.row.Times" size="small"
@input="handleInputChange(scope.row, 'Times')" />
</template>
</el-table-column>
<!-- 平滑列可编辑 -->
<el-table-column prop="Smooth" width="60" label="平滑">
<template #default="scope">
<el-input v-model="scope.row.Smooth" size="small"
@input="handleInputChange(scope.row, 'Smooth')" />
</template>
</el-table-column>
<!-- 算法列枚举下拉选择框 -->
<el-table-column prop="Algor" label="算法" width="150">
<template #default="scope">
<el-select v-model="scope.row.Algor" size="small" placeholder="请选择算法"
@change="handleAlgorChange(scope.row)">
<el-option v-for="option in algorOptions" :key="option.value"
:label="option.label" :value="option.value" />
</el-select>
</template>
</el-table-column>
<!-- 等值线间隔列可编辑 -->
<el-table-column prop="LableSpace" label="等值线间隔" width="100">
<template #default="scope">
<el-input v-model="scope.row.LableSpace" size="small"
@input="handleInputChange(scope.row, 'LableSpace')" />
</template>
</el-table-column>
<!-- 步长列可编辑 -->
<el-table-column prop="CurveSpace" label="步长">
<template #default="scope">
<el-input v-model="scope.row.CurveSpace" size="small"
@input="handleInputChange(scope.row, 'CurveSpace')" />
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="井显示" name="wells">
<el-table ref="drawWellRef" :data="wellData" @selection-change="handleWellSelectionChange" class="param-table" row-key="JH">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="JH" label="井号"></el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
<div class="oper">
<el-button type="primary" :icon="Select" @click="handleConfirm"></el-button>
</div>
</el-dialog>
1 month ago
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { Select } from "@element-plus/icons-vue";
import { emitter } from "~/utils/eventBus";
const { $toastMessage } = useNuxtApp();
1 month ago
import { fetchFlatGridParamData, fetchFlatGridWellData, generateFlatResults} from '~/services/drawParamService'
1 month ago
// 绘制参数
const drawParams = ref(null);
const drawParamRef = ref(null);
const wellData = ref(null);
const drawWellRef = ref(null);
// const selectedWells = computed(()=>{selectedWellRows.value.map(row => row.JH)});
const props = defineProps({
showSetParam: {
type: Boolean,
default: false,
required: true
}
});
const visible = ref(props.showSetParam);
const algorOptions = [
{ label: '最小张力', value: '最小张力' },
{ label: '反距离加权', value: '反距离加权' },
{ label: '自然临近', value: '自然临近' },
{ label: '最小曲率', value: '最小曲率' },
{ label: '快速网格化', value: '快速网格化' }
];
const activeLeftName = ref("params");
const selectedParamsRows = ref([]);
const selectedWellRows = ref([]);
const emit = defineEmits(['update:changeShowSetParam']);
watchEffect(() => {
if (props.showSetParam) {
if (drawParamRef.value) {
drawParamRef.value.toggleAllSelection();
}
if (drawWellRef.value) {
const checkWells = wellData.value.filter(item => item.Check == true);
checkWells.forEach(item => {
if (item.Check) {
drawWellRef.value.toggleRowSelection(item, true);
}
});
}
}
});
const handleClose = () => {
visible.value = false;
// visible.value = false;
emit("update:changeShowSetParam", false);
};
// 获取选中项
const handleSelectionChange = (selection) => {
1 month ago
selectedParamsRows.value = selection;
1 month ago
};
const handleWellSelectionChange = (selection) => {
selectedWellRows.value = selection;
1 month ago
console.log("WellData选中的数据", selection);
1 month ago
};
// 获取参数
const getParams = async () => {
const response = await fetchFlatGridParamData();
1 month ago
console.log("获取参数结果:", response);
1 month ago
if (!response) {
$toastMessage.error("获取参数失败!");
return;
}
1 month ago
drawParams.value = response;
1 month ago
};
// 获取井数据
const getWellDatas = async () => {
const response = await fetchFlatGridWellData();
1 month ago
console.log("获取井结果:", response);
1 month ago
if (!response) {
$toastMessage.error("获取井数据失败!");
return;
}
wellData.value = response;
1 month ago
1 month ago
};
// 确定按钮事件
1 month ago
const handleConfirm = async() => {
1 month ago
if (!selectedParamsRows.value) {
$toastMessage.warning('请选择绘制参数!');
return;
}
if (!selectedWellRows.value) {
$toastMessage.warning('请选择井数据!');
return;
}
const selectedWells = selectedWellRows.value.map(item => item.JH);
1 month ago
console.log("选中的井数据:", selectedWells, selectedWellRows.value);
1 month ago
const generateRequest = {
JHs: selectedWells,
FlatGridParameter: selectedParamsRows.value
};
const response = await generateFlatResults(generateRequest);
if (response) {
1 month ago
console.log("执行结果:", response);
emitter.emit('confirmDraw', selectedParamsRows.value);
1 month ago
handleClose();
}
else {
$toastMessage.error("勾绘失败,请稍后重试!");
return;
}
1 month ago
1 month ago
};
onMounted(() => {
nextTick();
getParams();
getWellDatas();
});
</script>
<style scoped>
1 month ago
.tabs{
1 month ago
margin: 0;
1 month ago
padding:0;
border: solid 1px #ccc;
1 month ago
}
.param-table {
width: 100%;
overflow: auto;
height: 500px;
border: solid 1px #ccc;
margin: 0;
padding: 0;
}
1 month ago
.oper{
1 month ago
display: flex;
justify-content: right;
flex-flow: inline-end;
margin-top: 15px;
}
</style>