Compare commits
No commits in common. "26af0d10349ce5d487d3ff2c3b1a5f09aedbb2ba" and "dde16d4d0212c13b282cb9df9a5a12639bcb2596" have entirely different histories.
26af0d1034
...
dde16d4d02
@ -1,21 +0,0 @@
|
||||
//收费项目报告项目对照
|
||||
// @ts-ignore
|
||||
import request from "@/utils/request";
|
||||
|
||||
//查询申请信息列表
|
||||
export function queryListService(params: any) {
|
||||
return request({
|
||||
url: "/vsReportitem/queryList",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
//查询项目明细
|
||||
export function queryDetailService(params: any) {
|
||||
return request({
|
||||
url: "/vsReportitem/query",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
<template>
|
||||
<SelectTable v-model:data="modelValue" :fields="fields" :tableData="instrOptions" label="yqmc" :size="props.size"
|
||||
value="yq" objKey="yq" :border="true" :width="props.width" placeholder="请选择仪器" :clearable="props.clearable"
|
||||
@getDataValue="getDataValue" v-bind="$attrs" />
|
||||
@getDataValue="getDataValue" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
@ -1,54 +1,135 @@
|
||||
<template>
|
||||
<div class="dynamic-input-container">
|
||||
<!-- 1. 开关组件(替代原单选框 type=0:是/否 → 开启/关闭) -->
|
||||
<el-switch class="custom-switch" v-if="type === '0'" v-model="innerValue" active-color="#13ce66"
|
||||
inactive-color="#ff4949" active-value="1" inactive-value="0" @change="handleSwitchChange" />
|
||||
<el-switch
|
||||
class="custom-switch"
|
||||
v-if="type === '0'"
|
||||
v-model="innerValue"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
@change="handleSwitchChange"
|
||||
/>
|
||||
|
||||
<!-- 2. 下拉框(1):直接绑定value -->
|
||||
<el-select v-else-if="type === '1'" v-model="innerValue" size="small" clearable @change="handleValueChange">
|
||||
<el-option v-for="item in dictOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
<el-select
|
||||
v-else-if="type === '1'"
|
||||
v-model="innerValue"
|
||||
size="small"
|
||||
clearable
|
||||
@change="handleValueChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dictOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
|
||||
<!-- 3. 字典单选(2):绑定zddh(value),显示zdmc(label) -->
|
||||
<el-select v-else-if="type === '2'" v-model="innerValue" size="small" clearable @change="handleValueChange"
|
||||
v-loading="dictLoading">
|
||||
<el-option v-for="item in dictOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
<el-select
|
||||
v-else-if="type === '2'"
|
||||
v-model="innerValue"
|
||||
size="small"
|
||||
clearable
|
||||
@change="handleValueChange"
|
||||
v-loading="dictLoading"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dictOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
|
||||
<!-- 4. 字典多选(3):数组↔逗号分隔字符串 → 修复核心:仅绑定multipleValue,移除冗余逻辑 -->
|
||||
<el-select v-else-if="type === '3'" v-model="multipleValue" size="small" multiple @change="handleMultipleChange"
|
||||
v-loading="dictLoading" clearable>
|
||||
<el-option v-for="item in dictOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
<el-select
|
||||
v-else-if="type === '3'"
|
||||
v-model="multipleValue"
|
||||
size="small"
|
||||
multiple
|
||||
@change="handleMultipleChange"
|
||||
v-loading="dictLoading"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dictOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
|
||||
<!-- 5. 特殊(4) -->
|
||||
<el-input v-else-if="type === '4'" v-model="innerValue" size="small" disabled @change="handleValueChange" />
|
||||
<el-input
|
||||
v-else-if="type === '4'"
|
||||
v-model="innerValue"
|
||||
size="small"
|
||||
disabled
|
||||
@change="handleValueChange"
|
||||
/>
|
||||
|
||||
<!-- 6. 文本框(5) -->
|
||||
<el-input v-else-if="type === '5'" v-model="innerValue" size="small" :placeholder="placeholder"
|
||||
@change="handleValueChange" />
|
||||
<el-input
|
||||
v-else-if="type === '5'"
|
||||
v-model="innerValue"
|
||||
size="small"
|
||||
:placeholder="placeholder"
|
||||
@change="handleValueChange"
|
||||
/>
|
||||
|
||||
<!-- 7. 数字框(6):支持dictData定义小数位数,空值初始化 -->
|
||||
<el-input-number v-else-if="type === '6'" v-model="innerValue" size="small" :min="minNum"
|
||||
:precision="finalPrecision" controls-position="right" @change="handleValueChange"
|
||||
:placeholder="placeholder || '请输入数字'" />
|
||||
<el-input-number
|
||||
v-else-if="type === '6'"
|
||||
v-model="innerValue"
|
||||
size="small"
|
||||
:min="minNum"
|
||||
:precision="finalPrecision"
|
||||
controls-position="right"
|
||||
@change="handleValueChange"
|
||||
:placeholder="placeholder || '请输入数字'"
|
||||
/>
|
||||
|
||||
<!-- 8. 日期框(7):适配yyyy/mm/dd -->
|
||||
<el-date-picker v-else-if="type === '7'" v-model="innerValue" size="small" type="date" format="YYYY/MM/DD"
|
||||
value-format="YYYY-MM-DD" :placeholder="placeholder" @change="handleValueChange" />
|
||||
<el-date-picker
|
||||
v-else-if="type === '7'"
|
||||
v-model="innerValue"
|
||||
size="small"
|
||||
type="date"
|
||||
format="YYYY/MM/DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
:placeholder="placeholder"
|
||||
@change="handleValueChange"
|
||||
/>
|
||||
|
||||
<!-- 9. 时间框(8):适配hh:mm(修复标签闭合问题) -->
|
||||
<el-time-picker v-else-if="type === '8'" v-model="innerValue" size="small" format="HH:mm" value-format="HH:mm:ss"
|
||||
:placeholder="placeholder" @change="handleValueChange"
|
||||
:picker-options="{ selectableRange: '00:00:00 - 23:59:59' }" />
|
||||
<el-time-picker
|
||||
v-else-if="type === '8'"
|
||||
v-model="innerValue"
|
||||
size="small"
|
||||
format="HH:mm"
|
||||
value-format="HH:mm:ss"
|
||||
:placeholder="placeholder"
|
||||
@change="handleValueChange"
|
||||
:picker-options="{ selectableRange: '00:00:00 - 23:59:59' }"
|
||||
/>
|
||||
|
||||
<!-- 兜底:默认文本框 -->
|
||||
<el-input v-else v-model="innerValue" size="small" :placeholder="placeholder" @change="handleValueChange" />
|
||||
<el-input
|
||||
v-else
|
||||
v-model="innerValue"
|
||||
size="small"
|
||||
:placeholder="placeholder"
|
||||
@change="handleValueChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="DynamicInput">
|
||||
//import { ref, watch, defineProps, defineEmits, onMounted, computed } from "vue";
|
||||
import { ref, watch, defineProps, defineEmits, onMounted, computed } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { getoptionselect } from "@/api/liswork/xtwh/localconfigApi.ts";
|
||||
|
||||
@ -96,18 +177,18 @@ const finalPrecision = computed(() => {
|
||||
watch(() => props.modelValue, (newVal) => {
|
||||
const val = newVal; // 移除兜底空值,保留原始值
|
||||
switch (props.type) {
|
||||
// 开关组件(替代原单选框):后端1/0 → 前端"1"/"0"
|
||||
// 开关组件(替代原单选框):后端1/0 → 前端"1"/"0"
|
||||
case "0":
|
||||
innerValue.value = (val === 1 || val === "1" || val === true) ? "1" : "0";
|
||||
break;
|
||||
|
||||
// 下拉框/字典单选:直接绑定value(zddh)
|
||||
// 下拉框/字典单选:直接绑定value(zddh)
|
||||
case "1":
|
||||
case "2":
|
||||
innerValue.value = val === null || val === undefined ? "" : String(val);
|
||||
break;
|
||||
|
||||
// 字典多选:核心修复 → 严格过滤空值/无效值,杜绝默认0
|
||||
// 字典多选:核心修复 → 严格过滤空值/无效值,杜绝默认0
|
||||
case "3":
|
||||
// 1. 空值/0/空字符串 → 空数组
|
||||
if (val === null || val === undefined || val === "" || val === 0) {
|
||||
@ -128,7 +209,7 @@ watch(() => props.modelValue, (newVal) => {
|
||||
// 移除innerValue同步(避免干扰多选)
|
||||
break;
|
||||
|
||||
// 数字框:空值处理,支持小数位数
|
||||
// 数字框:空值处理,支持小数位数
|
||||
case "6":
|
||||
// 空值/非数字 → 空(null),否则转为数字
|
||||
if (val === null || val === undefined || val === "" || isNaN(Number(val))) {
|
||||
@ -138,21 +219,21 @@ watch(() => props.modelValue, (newVal) => {
|
||||
}
|
||||
break;
|
||||
|
||||
// 日期框:后端 yyyy/mm/dd → 前端 yyyy-MM-dd
|
||||
// 日期框:后端 yyyy/mm/dd → 前端 yyyy-MM-dd
|
||||
case "7":
|
||||
innerValue.value = typeof val === "string" && val.includes("/")
|
||||
? val.replace(/\//g, "-")
|
||||
: val || null;
|
||||
? val.replace(/\//g, "-")
|
||||
: val || null;
|
||||
break;
|
||||
|
||||
// 时间框:后端 hh:mm → 前端 hh:mm:ss
|
||||
// 时间框:后端 hh:mm → 前端 hh:mm:ss
|
||||
case "8":
|
||||
innerValue.value = typeof val === "string" && val.includes(":") && val.split(":").length === 2
|
||||
? `${val}:00`
|
||||
: val || null;
|
||||
? `${val}:00`
|
||||
: val || null;
|
||||
break;
|
||||
|
||||
// 其他类型:保留原始值(空值则为null)
|
||||
// 其他类型:保留原始值(空值则为null)
|
||||
default:
|
||||
innerValue.value = val === null || val === undefined ? "" : val;
|
||||
break;
|
||||
@ -299,21 +380,16 @@ onMounted(() => {
|
||||
<style scoped>
|
||||
.dynamic-input-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
/* 关键:占满表格单元格高度 */
|
||||
height: 100%; /* 关键:占满表格单元格高度 */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
/* 垂直居中 */
|
||||
justify-content: center;
|
||||
/* 水平居中 */
|
||||
padding: 0 2px;
|
||||
/* 轻微内边距,避免贴边 */
|
||||
align-items: center; /* 垂直居中 */
|
||||
justify-content: center; /* 水平居中 */
|
||||
padding: 0 2px; /* 轻微内边距,避免贴边 */
|
||||
}
|
||||
|
||||
/* 开关组件样式优化 */
|
||||
:deep(.el-switch) {
|
||||
margin: 0 auto;
|
||||
/* 开关水平居中 */
|
||||
margin: 0 auto; /* 开关水平居中 */
|
||||
}
|
||||
|
||||
/* 深度选择器强制覆盖激活颜色 */
|
||||
@ -360,7 +436,6 @@ onMounted(() => {
|
||||
/* 多选下拉样式优化:避免高度溢出 */
|
||||
:deep(.el-select--multiple .el-select__tags) {
|
||||
flex-wrap: wrap;
|
||||
min-height: 32px;
|
||||
/* 匹配small尺寸高度 */
|
||||
min-height: 32px; /* 匹配small尺寸高度 */
|
||||
}
|
||||
</style>
|
||||
@ -1,116 +0,0 @@
|
||||
<template>
|
||||
<!-- 收费项目,报告项目对照 -->
|
||||
<div class="app-container">
|
||||
<el-form ref="form" :model="formData" label-width="80px" inline>
|
||||
<el-form-item label="仪器" prop="yq">
|
||||
<YQSelectTable v-model:data="formData.yq" width="200px" placeholder="请输入仪器名称" @get-data-value="getList" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目" prop="xmdh">
|
||||
<el-input placeholder="请输入项目名称" v-model="formData.xmdh" style="width: 200px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-checkbox v-model="checked" label="只看仪器对照收费项目" :value="xmValue"></el-checkbox>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row>
|
||||
<el-button type="primary" icon="Plus" @click="onClickAdd">新增</el-button>
|
||||
<el-button type="primary" icon="Delete" @click="onClickDel">删除</el-button>
|
||||
<el-button type="primary" icon="Edit" @click="onClickSave">保存</el-button>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<CustomTable ref="tableRefLeft" :data="dataListLeft" :columns="columnsLeft" :enable-column-drag="true"
|
||||
@column-drag-end="handleColumnDragEnd" :config="tableConfig" @row-click="rowClickLeft" />
|
||||
</el-col>
|
||||
<el-col :span="18">
|
||||
<CustomTable ref="tableRefRight" :data="dataListRight" :columns="columnsRight" :enable-column-drag="true"
|
||||
@column-drag-end="handleColumnDragEnd" :config="tableConfig">
|
||||
<template #xmdh="{ row }">
|
||||
{{ row.xmdh }} {{ row.xmmc }}
|
||||
</template>
|
||||
<template #tdh="{ row }">
|
||||
<el-input placeholder="" v-model="row.tdh" class="full-width-input"></el-input>
|
||||
</template>
|
||||
<template #mrz="{ row }">
|
||||
<el-input v-model="row.mrz" class="full-width-input"></el-input>
|
||||
</template>
|
||||
<template #def="{ row }">
|
||||
<el-checkbox v-model="row.def" true-value="1" false-value="0" />
|
||||
</template>
|
||||
</CustomTable>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { queryListService, queryDetailService } from '@/api/liswork/xtwh/xmReqItemVsApi';
|
||||
import YQSelectTable from '@/components/SelectTable/YQSelectTable/index.vue';
|
||||
import CustomTable from '@/components/elTable/index.vue'
|
||||
|
||||
const formData = ref({
|
||||
yq: '',
|
||||
xmdh: ''
|
||||
})
|
||||
const dataListLeft = ref([])
|
||||
const dataListRight = ref([])
|
||||
const checked = ref(false);
|
||||
const xmValue = '1';
|
||||
|
||||
|
||||
//退拽属性
|
||||
const handleColumnDragEnd = (data: any) => {
|
||||
// 更新列配置
|
||||
columnsLeft.value = data.columns;
|
||||
columnsRight.value = data.columns;
|
||||
}
|
||||
|
||||
const tableConfig = ref({
|
||||
border: true, // 边框
|
||||
height: '76vh', // 高度
|
||||
highlightCurrentRow: true, // 高亮当前行
|
||||
// cellStyle: cellStyleHd
|
||||
})
|
||||
|
||||
const columnsLeft = ref([
|
||||
{ prop: 'sqxmmc', label: '申请/收费项目名称', visible: true, align: 'center', width: 200 },
|
||||
{ prop: 'sqxmdh', label: '申请/收费项目代号', visible: true, align: 'center', width: 130 },
|
||||
]);
|
||||
|
||||
const columnsRight = ref([
|
||||
{ prop: 'xmdh', label: '报告项目', visible: true, align: 'center', width: 300, slot: 'xmdh' },
|
||||
{ prop: 'tdh', label: '双工代号', visible: true, align: 'center', width: 100, slot: 'tdh' },
|
||||
{ prop: 'mrz', label: '默认值', visible: true, align: 'center', width: 100, slot: 'mrz' },
|
||||
{ prop: 'seq', label: '序号', visible: true, align: 'center', width: 100 },
|
||||
{ prop: 'def', label: '非必做', visible: true, align: 'center', width: 100, slot: 'def' },
|
||||
]);
|
||||
|
||||
// 获取数据列表
|
||||
const getList = async () => {
|
||||
const res = await queryListService({ yq: formData.value.yq })
|
||||
dataListLeft.value = res.data
|
||||
}
|
||||
|
||||
const onClickAdd = () => {
|
||||
// TODO 新增
|
||||
}
|
||||
|
||||
const onClickDel = () => {
|
||||
// TODO 删除
|
||||
}
|
||||
|
||||
const onClickSave = () => {
|
||||
// TODO 保存
|
||||
}
|
||||
|
||||
//点击事件
|
||||
const rowClickLeft = async (row: any) => {
|
||||
const res = await queryDetailService({ sqxmdh: row.sqxmdh, sqxmmc: row.sqxmmc, yq: formData.value.yq })
|
||||
dataListRight.value = res.rows
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
Loading…
x
Reference in New Issue
Block a user