2025-11-03 18:07:12 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<!-- 计算项目表达式生成向导 -->
|
2025-12-12 15:49:03 +08:00
|
|
|
|
<el-dialog :model-value="visible" @update:model-value="handleVisibleChange" title="计算项目表达式生成向导" width="600px"
|
|
|
|
|
|
:close-on-click-modal="false" :draggable="true" @close="onClose" @open="onOpen">
|
2025-11-06 18:22:18 +08:00
|
|
|
|
<el-row class="input-text">
|
2025-11-07 17:50:06 +08:00
|
|
|
|
<el-input type="textarea" v-model="inputText"></el-input>
|
2025-11-06 18:22:18 +08:00
|
|
|
|
</el-row>
|
2025-11-04 15:14:07 +08:00
|
|
|
|
<el-row>
|
2025-11-06 18:22:18 +08:00
|
|
|
|
<el-col :span="12">
|
2025-12-12 15:49:03 +08:00
|
|
|
|
<CustomTable ref="tableRefs" :data="tableData" :columns="columns" :config="tableConfig" @row-click="rowHandle"
|
|
|
|
|
|
:enableColumnDrag="true" @column-drag-end="handleColumnDragEnd" />
|
2025-11-06 18:22:18 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="12" class="right">
|
|
|
|
|
|
<el-button type="" @click="bClickAdd">+ 加</el-button>
|
|
|
|
|
|
<el-button type="" @click="bClickSub">- 减</el-button>
|
|
|
|
|
|
<el-button type="" @click="bClickMul">* 乘</el-button>
|
|
|
|
|
|
<el-button type="" @click="bClickDiv">/ 除</el-button>
|
|
|
|
|
|
<el-button type="" @click="bClickLeft">(</el-button>
|
|
|
|
|
|
<el-button type="" @click="bClickRight">)</el-button>
|
|
|
|
|
|
<el-button type="" @click="bClickPower">^次方</el-button>
|
|
|
|
|
|
<el-button type="" @click="bClickSex">性别</el-button>
|
|
|
|
|
|
<el-button type="" @click="bClickAge">年龄</el-button>
|
|
|
|
|
|
<h4>说明:</h4>
|
|
|
|
|
|
<h4>1.计算公式中不可包括其他计算项目,若有需要,</h4>
|
|
|
|
|
|
<h4>一律转换为最原始的计算公式</h4>
|
|
|
|
|
|
<h4>2.所有项目代号必须使用“[”和“]”括起来</h4>
|
|
|
|
|
|
<h4>3.表达式可以为一个常数或空字符串</h4>
|
|
|
|
|
|
</el-col>
|
2025-11-03 18:07:12 +08:00
|
|
|
|
</el-row>
|
2025-11-04 15:14:07 +08:00
|
|
|
|
<!-- 底部按钮(可选) -->
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<el-button type="primary" @click="handleOk">确定</el-button>
|
2025-11-06 18:22:18 +08:00
|
|
|
|
<el-button @click="handleCancel">取消</el-button>
|
2025-11-04 15:14:07 +08:00
|
|
|
|
</template>
|
2025-11-03 18:07:12 +08:00
|
|
|
|
</el-dialog>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import CustomTable from '@/components/elTable/index.vue'
|
2025-11-06 18:22:18 +08:00
|
|
|
|
import { queryXmInfoNew } from '@/api/liswork/labItem/labItemApi'
|
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
2025-12-12 15:49:03 +08:00
|
|
|
|
formData: {
|
2025-11-06 18:22:18 +08:00
|
|
|
|
type: Object,
|
|
|
|
|
|
default: {}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2025-11-03 18:07:12 +08:00
|
|
|
|
|
2025-11-07 17:50:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-11-04 15:14:07 +08:00
|
|
|
|
let visible = ref<boolean>()
|
|
|
|
|
|
const tableData = ref()
|
2025-11-03 18:07:12 +08:00
|
|
|
|
const inputText = ref('')
|
2025-11-04 15:14:07 +08:00
|
|
|
|
const emit = defineEmits(['update:model-value', 'confirm'])
|
2025-11-03 18:07:12 +08:00
|
|
|
|
|
2025-11-04 15:14:07 +08:00
|
|
|
|
const columns = ref([
|
2025-12-12 15:49:03 +08:00
|
|
|
|
{ prop: 'xmdh', label: '项目代号', align: 'center', visible: true, width: 100 },
|
|
|
|
|
|
{ prop: 'xmmc', label: '项目名称', align: 'center', visible: true, width: 180 }
|
2025-11-04 15:14:07 +08:00
|
|
|
|
])
|
|
|
|
|
|
// 表格配置
|
|
|
|
|
|
const tableConfig = ref(
|
|
|
|
|
|
{
|
|
|
|
|
|
// stripe: true, // 斑马纹
|
|
|
|
|
|
border: true, // 边框
|
2025-11-06 18:22:18 +08:00
|
|
|
|
height: '350', // 高度
|
2025-11-04 15:14:07 +08:00
|
|
|
|
highlightCurrentRow: true, // 高亮当前行
|
|
|
|
|
|
fit: true
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
2025-11-03 18:07:12 +08:00
|
|
|
|
|
2025-11-07 17:50:06 +08:00
|
|
|
|
//向外暴露数据
|
2025-12-12 15:49:03 +08:00
|
|
|
|
defineExpose({ inputText })
|
2025-11-07 17:50:06 +08:00
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => props.formData.jsgs, // 监听的目标:formData.jsgs
|
2025-12-12 15:49:03 +08:00
|
|
|
|
(newVal: any) => {
|
2025-11-07 17:50:06 +08:00
|
|
|
|
inputText.value = newVal // 当新值变化时,更新 inputText
|
|
|
|
|
|
},
|
|
|
|
|
|
{ immediate: true } // 立即执行一次(确保初始化时也能同步)
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2025-11-04 15:14:07 +08:00
|
|
|
|
const handleColumnDragEnd = (newColumns: any) => {
|
|
|
|
|
|
columns.value = newColumns.columns
|
2025-11-03 18:07:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 18:22:18 +08:00
|
|
|
|
const rowHandle = (row: any) => {
|
2025-12-12 15:49:03 +08:00
|
|
|
|
inputText.value += '[' + row.xmdh + ']'
|
2025-11-03 18:07:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-04 15:14:07 +08:00
|
|
|
|
const onClose = () => {
|
|
|
|
|
|
emit('update:model-value', false)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleOk = () => {
|
2025-12-12 15:49:03 +08:00
|
|
|
|
emit('confirm', inputText.value) // 通知外部执行确认操作
|
2025-11-04 15:14:07 +08:00
|
|
|
|
emit('update:model-value', false) // 确认后关闭
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-03 18:07:12 +08:00
|
|
|
|
const handleCancel = () => {
|
2025-11-04 15:14:07 +08:00
|
|
|
|
emit('update:model-value', false)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleVisibleChange = (newVisible: boolean) => {
|
|
|
|
|
|
// 通知父组件:状态变为 newVisible(可能是 true 或 false)
|
|
|
|
|
|
emit('update:model-value', newVisible)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const bClickAdd = () => {
|
2025-11-06 18:22:18 +08:00
|
|
|
|
inputText.value += '+'
|
2025-11-03 18:07:12 +08:00
|
|
|
|
}
|
2025-11-04 15:14:07 +08:00
|
|
|
|
|
|
|
|
|
|
const bClickSub = () => {
|
2025-11-06 18:22:18 +08:00
|
|
|
|
inputText.value += '-'
|
2025-11-04 15:14:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const bClickMul = () => {
|
2025-11-06 18:22:18 +08:00
|
|
|
|
inputText.value += '*'
|
2025-11-04 15:14:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const bClickDiv = () => {
|
2025-11-06 18:22:18 +08:00
|
|
|
|
inputText.value += '/'
|
2025-11-04 15:14:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const bClickLeft = () => {
|
2025-11-06 18:22:18 +08:00
|
|
|
|
inputText.value += '('
|
2025-11-04 15:14:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const bClickRight = () => {
|
2025-11-06 18:22:18 +08:00
|
|
|
|
inputText.value += ')'
|
2025-11-04 15:14:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const bClickPower = () => {
|
2025-11-06 18:22:18 +08:00
|
|
|
|
inputText.value += '^'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const bClickSex = () => {
|
|
|
|
|
|
inputText.value += '[SEX]'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const bClickAge = () => {
|
|
|
|
|
|
inputText.value += '[AGE]'
|
2025-11-04 15:14:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-12 15:49:03 +08:00
|
|
|
|
const onOpen = async () => {
|
2025-11-07 17:50:06 +08:00
|
|
|
|
const res = await queryXmInfoNew(props.formData.xmgl);
|
2025-11-06 18:22:18 +08:00
|
|
|
|
tableData.value = res.data
|
|
|
|
|
|
//inputText.value = props.text
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-03 18:07:12 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
2025-11-06 18:22:18 +08:00
|
|
|
|
.input-text {
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
}
|
2025-12-12 15:49:03 +08:00
|
|
|
|
|
2025-11-06 18:22:18 +08:00
|
|
|
|
// .right {
|
|
|
|
|
|
// margin-left: 2px;
|
|
|
|
|
|
// }
|
|
|
|
|
|
.el-button {
|
|
|
|
|
|
margin-bottom: 5px;
|
|
|
|
|
|
}
|
2025-11-03 18:07:12 +08:00
|
|
|
|
</style>
|