2025-10-21 17:43:57 +08:00
|
|
|
<template>
|
2025-12-05 17:44:21 +08:00
|
|
|
<!-- 常见描述 -->
|
|
|
|
|
<div>
|
|
|
|
|
<div class="modifyClass">
|
|
|
|
|
<el-button type="primary" @click="onAddClick">增加</el-button>
|
|
|
|
|
<el-button type="primary" @click="onDelClick">删除</el-button>
|
|
|
|
|
</div>
|
2025-12-15 18:06:42 +08:00
|
|
|
<CustomTable ref="tableRef" :data="modelParam.commonDescriptionsData" :columns="columns" :config="tableConfig"
|
|
|
|
|
@row-click="rowClick">
|
2025-12-05 17:44:21 +08:00
|
|
|
<template #textresult="{ row }">
|
|
|
|
|
<el-input type="textarea" v-model="row.textresult" class="full-width-input" autosize></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</CustomTable>
|
2025-10-28 16:22:44 +08:00
|
|
|
</div>
|
2025-10-21 17:43:57 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
2025-10-24 15:37:24 +08:00
|
|
|
<script setup lang="ts">
|
2025-10-28 16:22:44 +08:00
|
|
|
import CustomTable from '@/components/elTable/index.vue'
|
2025-11-25 18:05:50 +08:00
|
|
|
import { XmTextresultNew } from '@/types';
|
2025-12-12 18:02:04 +08:00
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
2025-10-28 16:22:44 +08:00
|
|
|
import { ref } from 'vue';
|
2025-12-02 18:14:03 +08:00
|
|
|
import { delXmTextresultNew } from '@/api/liswork/labItem/labItemApi';
|
2025-10-24 15:37:24 +08:00
|
|
|
|
2025-12-02 18:14:03 +08:00
|
|
|
const modelParam = defineModel<any>()
|
2025-10-28 16:22:44 +08:00
|
|
|
|
2025-12-12 18:02:04 +08:00
|
|
|
watch(() => modelParam.value.commonDescriptionsData, (val) => {
|
|
|
|
|
selectRow.value = null
|
|
|
|
|
})
|
2025-11-25 18:05:50 +08:00
|
|
|
const tableRef = ref();
|
2025-10-28 16:22:44 +08:00
|
|
|
const columns = ref([
|
2025-12-05 17:44:21 +08:00
|
|
|
{ prop: 'textresult', label: '文字描述', visible: true, align: 'center', slot: 'textresult', width: 500, showOverflowTooltip: false },
|
2025-10-28 16:22:44 +08:00
|
|
|
]);
|
|
|
|
|
const tableConfig = ref({
|
|
|
|
|
border: true, // 边框
|
2025-12-08 17:49:43 +08:00
|
|
|
height: '78vh', // 高度
|
2025-12-15 18:06:42 +08:00
|
|
|
highlightCurrentRow: true, // 高亮当前行
|
2025-10-28 16:22:44 +08:00
|
|
|
// cellStyle: cellStyleHd
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
2025-12-15 18:06:42 +08:00
|
|
|
|
2025-11-25 18:05:50 +08:00
|
|
|
|
|
|
|
|
const selectRow = ref()
|
2025-12-02 18:14:03 +08:00
|
|
|
const emit = defineEmits(['refreshTabData'])
|
2025-11-25 18:05:50 +08:00
|
|
|
|
|
|
|
|
//序号最大值
|
|
|
|
|
const maxXh = computed(() => {
|
2025-12-08 17:49:43 +08:00
|
|
|
return modelParam.value.commonDescriptionsData.length > 0 ? modelParam.value.commonDescriptionsData.length + 1 : 0;
|
2025-11-25 18:05:50 +08:00
|
|
|
});
|
|
|
|
|
|
2025-12-05 17:44:21 +08:00
|
|
|
const rowClick = (row: any) => {
|
2025-11-25 18:05:50 +08:00
|
|
|
selectRow.value = row
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const onAddClick = () => {
|
|
|
|
|
const newData: XmTextresultNew = {
|
2025-12-02 18:14:03 +08:00
|
|
|
xmid: modelParam.value.basicData.xmid,
|
|
|
|
|
xmdh: modelParam.value.basicData.xmdh,
|
2025-12-12 18:02:04 +08:00
|
|
|
xh: maxXh.value,
|
|
|
|
|
textresult: ''
|
2025-11-25 18:05:50 +08:00
|
|
|
}
|
2025-12-05 17:44:21 +08:00
|
|
|
modelParam.value.commonDescriptionsData.push(newData)
|
2025-11-25 18:05:50 +08:00
|
|
|
}
|
|
|
|
|
|
2025-12-12 18:02:04 +08:00
|
|
|
const onDelClick = () => {
|
|
|
|
|
if (!selectRow.value) return ElMessage.warning('请选择要删除的数据!');
|
|
|
|
|
ElMessageBox.confirm('是否要删除选中的数据?', '警告',
|
|
|
|
|
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', }).then(() => {
|
|
|
|
|
delXmTextresultNew({ xmid: modelParam.value.basicData.xmid, xh: selectRow.value.xh }).then((res: any) => {
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
modelParam.value.commonDescriptionsData = modelParam.value.commonDescriptionsData.filter((item: any) => item.xh != selectRow.value.xh)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
2025-11-25 18:05:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
:deep(.el-table .cell) {
|
|
|
|
|
padding: 0;
|
|
|
|
|
}
|
|
|
|
|
</style>
|