采样登记界面调整
This commit is contained in:
parent
97039793f0
commit
eba694d33d
@ -9,7 +9,6 @@
|
|||||||
@clear="handleClear"
|
@clear="handleClear"
|
||||||
@dblclick="handleDblClick"
|
@dblclick="handleDblClick"
|
||||||
>
|
>
|
||||||
<<<<<<< HEAD
|
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<el-icon v-if="isDictLoading" size="16"><Loading /></el-icon>
|
<el-icon v-if="isDictLoading" size="16"><Loading /></el-icon>
|
||||||
</template>
|
</template>
|
||||||
@ -52,55 +51,6 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
=======
|
|
||||||
<template #prefix>
|
|
||||||
<el-icon v-if="isDictLoading" size="16"><Loading /></el-icon>
|
|
||||||
</template>
|
|
||||||
<template #suffix>
|
|
||||||
<el-icon @click="openDictSelector" size="16" class="select-icon">
|
|
||||||
<ArrowDown />
|
|
||||||
</el-icon>
|
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
|
|
||||||
<!-- 字典选择弹窗(Vue3 中使用 v-model 控制显示) -->
|
|
||||||
<el-dialog
|
|
||||||
v-model="dialogVisible"
|
|
||||||
:title="dialogTitle"
|
|
||||||
width="500px"
|
|
||||||
@close="handleDialogClose"
|
|
||||||
>
|
|
||||||
<el-input
|
|
||||||
v-model="searchKey"
|
|
||||||
placeholder="搜索字典项..."
|
|
||||||
class="mb-4"
|
|
||||||
clearable
|
|
||||||
@clear="filterDictData"
|
|
||||||
@input="filterDictData"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<el-table
|
|
||||||
:data="filteredDictData"
|
|
||||||
height="300px"
|
|
||||||
border
|
|
||||||
@row-click="selectItem"
|
|
||||||
@row-dblclick="selectItem"
|
|
||||||
>
|
|
||||||
<el-table-column prop="value" label="编码" width="100" />
|
|
||||||
<el-table-column prop="label" label="名称" width="200" />
|
|
||||||
<el-table-column label="操作" width="100">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button
|
|
||||||
size="small"
|
|
||||||
type="primary"
|
|
||||||
@click="selectItem(scope.row)"
|
|
||||||
>
|
|
||||||
选择
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
>>>>>>> e1f19883e37f969d4e8ada6a3137ba399ebfc6df
|
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -109,7 +59,6 @@
|
|||||||
import { ref, computed, watch, onMounted } from 'vue';
|
import { ref, computed, watch, onMounted } from 'vue';
|
||||||
import { Loading, ArrowDown } from '@element-plus/icons-vue';
|
import { Loading, ArrowDown } from '@element-plus/icons-vue';
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
import { getFirstLetter } from '@/api/pinyin.js'; // 引入拼音处理工具
|
import { getFirstLetter } from '@/api/pinyin.js'; // 引入拼音处理工具
|
||||||
// 组件参数
|
// 组件参数
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -140,64 +89,6 @@ const displayValue = computed({
|
|||||||
return labelValue.value || tempValue.value || props.modelValue || '';
|
return labelValue.value || tempValue.value || props.modelValue || '';
|
||||||
},
|
},
|
||||||
set(newValue) {
|
set(newValue) {
|
||||||
=======
|
|
||||||
// 组件参数(Vue3 语法)
|
|
||||||
const props = defineProps({
|
|
||||||
modelValue: { // 双向绑定的原始值
|
|
||||||
type: [String, Number],
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
dictType: { // 字典类型
|
|
||||||
type: String,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
placeholder: {
|
|
||||||
type: String,
|
|
||||||
default: '请输入或双击选择'
|
|
||||||
},
|
|
||||||
clearable: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
disabled: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
fetchDict: { // 获取字典的方法(需返回 Promise)
|
|
||||||
type: Function,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
dialogTitle: {
|
|
||||||
type: String,
|
|
||||||
default: '选择字典项'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 组件事件(Vue3 语法)
|
|
||||||
const emit = defineEmits([
|
|
||||||
'update:modelValue', // 同步原始值
|
|
||||||
'update:labelValue', // 同步标签值
|
|
||||||
'select' // 选中事件
|
|
||||||
]);
|
|
||||||
|
|
||||||
// 内部状态(Vue3 ref 响应式)
|
|
||||||
const tempValue = ref(''); // 临时输入值
|
|
||||||
const labelValue = ref(''); // 映射后的标签
|
|
||||||
const dictData = ref([]); // 完整字典数据
|
|
||||||
const filteredDictData = ref([]); // 过滤后的字典数据
|
|
||||||
const isDictLoading = ref(true); // 字典加载状态
|
|
||||||
const dialogVisible = ref(false); // 弹窗显示状态
|
|
||||||
const searchKey = ref(''); // 搜索关键词
|
|
||||||
|
|
||||||
// 显示值计算(Vue3 computed)
|
|
||||||
const displayValue = computed({
|
|
||||||
get() {
|
|
||||||
// 优先显示标签,无则显示原始值
|
|
||||||
return labelValue.value || tempValue.value || props.modelValue || '';
|
|
||||||
},
|
|
||||||
set(newValue) {
|
|
||||||
// 用户输入时更新临时值,并清除旧标签
|
|
||||||
>>>>>>> e1f19883e37f969d4e8ada6a3137ba399ebfc6df
|
|
||||||
tempValue.value = newValue;
|
tempValue.value = newValue;
|
||||||
if (labelValue.value && newValue !== labelValue.value) {
|
if (labelValue.value && newValue !== labelValue.value) {
|
||||||
labelValue.value = '';
|
labelValue.value = '';
|
||||||
@ -206,7 +97,6 @@ const displayValue = computed({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
|
|
||||||
// 加载字典数据(并添加简拼字段)
|
// 加载字典数据(并添加简拼字段)
|
||||||
@ -221,16 +111,6 @@ const loadDictData = async () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
filteredDictData.value = [...dictData.value];
|
filteredDictData.value = [...dictData.value];
|
||||||
=======
|
|
||||||
// 加载字典数据
|
|
||||||
const loadDictData = async () => {
|
|
||||||
try {
|
|
||||||
isDictLoading.value = true;
|
|
||||||
// 调用父组件传入的字典获取方法
|
|
||||||
const data = await props.fetchDict(props.dictType);
|
|
||||||
dictData.value = data || [];
|
|
||||||
filteredDictData.value = [...dictData.value]; // 初始化过滤数据
|
|
||||||
>>>>>>> e1f19883e37f969d4e8ada6a3137ba399ebfc6df
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`加载${props.dictType}字典失败:`, error);
|
console.error(`加载${props.dictType}字典失败:`, error);
|
||||||
dictData.value = [];
|
dictData.value = [];
|
||||||
@ -240,7 +120,6 @@ const loadDictData = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
// 核心搜索逻辑(支持模糊搜索+简拼搜索)
|
// 核心搜索逻辑(支持模糊搜索+简拼搜索)
|
||||||
const filterDictData = () => {
|
const filterDictData = () => {
|
||||||
const key = searchKey.value.trim().toLowerCase();
|
const key = searchKey.value.trim().toLowerCase();
|
||||||
@ -260,28 +139,11 @@ const filterDictData = () => {
|
|||||||
// 满足任一条件即匹配
|
// 满足任一条件即匹配
|
||||||
return matchLabel || matchValue || matchPinyin;
|
return matchLabel || matchValue || matchPinyin;
|
||||||
});
|
});
|
||||||
=======
|
|
||||||
// 过滤字典数据(搜索功能)
|
|
||||||
const filterDictData = () => {
|
|
||||||
if (!searchKey.value) {
|
|
||||||
filteredDictData.value = [...dictData.value];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const key = searchKey.value.toLowerCase();
|
|
||||||
filteredDictData.value = dictData.value.filter(item =>
|
|
||||||
item.label.toLowerCase().includes(key) ||
|
|
||||||
String(item.value).toLowerCase().includes(key)
|
|
||||||
);
|
|
||||||
>>>>>>> e1f19883e37f969d4e8ada6a3137ba399ebfc6df
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 双击事件处理
|
// 双击事件处理
|
||||||
const handleDblClick = () => {
|
const handleDblClick = () => {
|
||||||
if (!props.disabled && !isDictLoading.value) {
|
if (!props.disabled && !isDictLoading.value) {
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
console.log('双击触发弹窗');
|
|
||||||
>>>>>>> e1f19883e37f969d4e8ada6a3137ba399ebfc6df
|
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -290,19 +152,13 @@ const handleDblClick = () => {
|
|||||||
const openDictSelector = () => {
|
const openDictSelector = () => {
|
||||||
if (!props.disabled && !isDictLoading.value) {
|
if (!props.disabled && !isDictLoading.value) {
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
<<<<<<< HEAD
|
|
||||||
searchKey.value = '';
|
searchKey.value = '';
|
||||||
filterDictData();
|
filterDictData();
|
||||||
=======
|
|
||||||
searchKey.value = ''; // 重置搜索
|
|
||||||
filterDictData(); // 重置过滤
|
|
||||||
>>>>>>> e1f19883e37f969d4e8ada6a3137ba399ebfc6df
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 选择字典项
|
// 选择字典项
|
||||||
const selectItem = (item) => {
|
const selectItem = (item) => {
|
||||||
<<<<<<< HEAD
|
|
||||||
emit('update:modelValue', item.value);
|
emit('update:modelValue', item.value);
|
||||||
emit('update:labelValue', item.label);
|
emit('update:labelValue', item.label);
|
||||||
emit('select', item);
|
emit('select', item);
|
||||||
@ -316,60 +172,10 @@ const handleBlur = () => { /* ... */
|
|||||||
};
|
};
|
||||||
const handleClear = () => { /* ... */
|
const handleClear = () => { /* ... */
|
||||||
};
|
};
|
||||||
=======
|
|
||||||
// 同步原始值和标签值到父组件
|
|
||||||
emit('update:modelValue', item.value);
|
|
||||||
emit('update:labelValue', item.label);
|
|
||||||
emit('select', item); // 触发选中事件
|
|
||||||
|
|
||||||
// 更新内部状态
|
|
||||||
tempValue.value = item.value;
|
|
||||||
labelValue.value = item.label;
|
|
||||||
|
|
||||||
// 关闭弹窗
|
|
||||||
dialogVisible.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 失焦时自动映射
|
|
||||||
const handleBlur = () => {
|
|
||||||
const value = tempValue.value.trim() || props.modelValue;
|
|
||||||
if (!value) {
|
|
||||||
emit('update:modelValue', '');
|
|
||||||
emit('update:labelValue', '');
|
|
||||||
labelValue.value = '';
|
|
||||||
tempValue.value = '';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查找匹配的字典项
|
|
||||||
const matched = dictData.value.find(
|
|
||||||
item => String(item.value) === String(value)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (matched) {
|
|
||||||
emit('update:labelValue', matched.label);
|
|
||||||
labelValue.value = matched.label;
|
|
||||||
} else {
|
|
||||||
emit('update:labelValue', value); // 无匹配时用原始值
|
|
||||||
labelValue.value = value;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 清空输入
|
|
||||||
const handleClear = () => {
|
|
||||||
tempValue.value = '';
|
|
||||||
labelValue.value = '';
|
|
||||||
emit('update:modelValue', '');
|
|
||||||
emit('update:labelValue', '');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 关闭弹窗
|
|
||||||
>>>>>>> e1f19883e37f969d4e8ada6a3137ba399ebfc6df
|
|
||||||
const handleDialogClose = () => {
|
const handleDialogClose = () => {
|
||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
// 监听初始值变化
|
// 监听初始值变化
|
||||||
watch(() => props.modelValue, (newVal) => {
|
watch(() => props.modelValue, (newVal) => {
|
||||||
tempValue.value = newVal || '';
|
tempValue.value = newVal || '';
|
||||||
@ -379,26 +185,6 @@ watch(() => props.modelValue, (newVal) => {
|
|||||||
emit('update:labelValue', labelValue.value);
|
emit('update:labelValue', labelValue.value);
|
||||||
}
|
}
|
||||||
}, {immediate: true});
|
}, {immediate: true});
|
||||||
=======
|
|
||||||
// 监听父组件传入的初始值
|
|
||||||
watch(
|
|
||||||
() => props.modelValue,
|
|
||||||
(newVal) => {
|
|
||||||
if (newVal === tempValue.value) return; // 避免重复更新
|
|
||||||
tempValue.value = newVal || '';
|
|
||||||
|
|
||||||
// 初始值自动映射标签
|
|
||||||
if (newVal && !isDictLoading.value) {
|
|
||||||
const matched = dictData.value.find(
|
|
||||||
item => String(item.value) === String(newVal)
|
|
||||||
);
|
|
||||||
labelValue.value = matched?.label || newVal;
|
|
||||||
emit('update:labelValue', labelValue.value);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true } // 初始化时执行一次
|
|
||||||
);
|
|
||||||
>>>>>>> e1f19883e37f969d4e8ada6a3137ba399ebfc6df
|
|
||||||
|
|
||||||
// 组件挂载时加载字典
|
// 组件挂载时加载字典
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
@ -407,10 +193,7 @@ onMounted(async () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
<<<<<<< HEAD
|
|
||||||
/* 样式保持不变 */
|
/* 样式保持不变 */
|
||||||
=======
|
|
||||||
>>>>>>> e1f19883e37f969d4e8ada6a3137ba399ebfc6df
|
|
||||||
.dict-input-wrapper {
|
.dict-input-wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
@ -419,23 +202,12 @@ onMounted(async () => {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: #666;
|
color: #666;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
<<<<<<< HEAD
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.select-icon:hover {
|
.select-icon:hover {
|
||||||
color: #409eff;
|
color: #409eff;
|
||||||
}
|
}
|
||||||
|
|
||||||
=======
|
|
||||||
transition: color 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.select-icon:hover {
|
|
||||||
color: #409eff; /* 鼠标悬停变色 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 修复输入框后缀图标与清除按钮的间距 */
|
|
||||||
>>>>>>> e1f19883e37f969d4e8ada6a3137ba399ebfc6df
|
|
||||||
:deep(.el-input__suffix) {
|
:deep(.el-input__suffix) {
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<el-row :gutter="5" class="compact-form" :span="24" >
|
<el-row :gutter="5" class="compact-form" :span="24" >
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-position="left" >
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-position="left" >
|
||||||
<el-col :span="24" :xs="24">
|
<el-col :span="24" :xs="24">
|
||||||
<el-form-item class="compact-form" label="" label-width="0px" prop="brdh" >
|
<el-form-item label="" label-width="0px" prop="brdh" >
|
||||||
|
|
||||||
<el-col :span="6">
|
<el-col :span="6">
|
||||||
<div> 就诊卡号/病历号/磁卡号: </div>
|
<div> 就诊卡号/病历号/磁卡号: </div>
|
||||||
@ -97,7 +97,7 @@
|
|||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table class="compact-form" :data="reqmainList" @selection-change="handleSelectionChange" height="550px">
|
<el-table ref="tableRef" class="compact-form my-table" :data="reqmainList" @selection-change="handleSelectionChange" @select="handleSelect" height="530px" :cell-style="tableCellStyle">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="项目名称" align="center" prop="sqxmmc" width="200" show-overflow-tooltip/>
|
<el-table-column label="项目名称" align="center" prop="sqxmmc" width="200" show-overflow-tooltip/>
|
||||||
<el-table-column label="项目代码" align="center" prop="sqxmdh" width="100" show-overflow-tooltip/>
|
<el-table-column label="项目代码" align="center" prop="sqxmdh" width="100" show-overflow-tooltip/>
|
||||||
@ -145,6 +145,21 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<!-- 汇总行 -->
|
||||||
|
<div class="table-summary">
|
||||||
|
<div class="summary-item">
|
||||||
|
<span class="summary-label">条码数:</span>
|
||||||
|
<span class="summary-value">{{ idsnew.length }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="summary-item">
|
||||||
|
<span class="summary-label">项目数:</span>
|
||||||
|
<span class="summary-value">{{ totalRows }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="summary-item">
|
||||||
|
<span class="summary-label">合计金额:</span>
|
||||||
|
<span class="summary-value">{{ totalPrice.toFixed(2) }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -153,7 +168,7 @@ import { querySQD, getReqmain, delReqmain, addReqmain, updateReqmain } from "@/a
|
|||||||
const comDict = inject('comDict');
|
const comDict = inject('comDict');
|
||||||
// 字典数据存储
|
// 字典数据存储
|
||||||
const dictData = ref({});
|
const dictData = ref({});
|
||||||
|
const tableRef = ref(null);
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
// 选中的行
|
// 选中的行
|
||||||
const selectedRows = ref([]);
|
const selectedRows = ref([]);
|
||||||
@ -162,6 +177,10 @@ const open = ref(false);
|
|||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const showSearch = ref(true);
|
const showSearch = ref(true);
|
||||||
const ids = ref([]);
|
const ids = ref([]);
|
||||||
|
// 新增:计算属性,返回去重后的ids数组
|
||||||
|
const idsnew = computed(() => {
|
||||||
|
return [...new Set(ids.value)];
|
||||||
|
});
|
||||||
const single = ref(true);
|
const single = ref(true);
|
||||||
const freesingle = ref(true);
|
const freesingle = ref(true);
|
||||||
const cardtypeOptions = ref([{"label": "就诊卡","value": 1},{"label": "医保卡","value": 2},{"label": "电子医保卡","value": 3},{"label": "身份证", "value": 4}])
|
const cardtypeOptions = ref([{"label": "就诊卡","value": 1},{"label": "医保卡","value": 2},{"label": "电子医保卡","value": 3},{"label": "身份证", "value": 4}])
|
||||||
@ -188,7 +207,37 @@ const data = reactive({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data);
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
// 标志位:是否是程序自动勾选(避免循环触发事件)
|
||||||
|
const isAutoSelect = ref(false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监听单选勾选/取消事件
|
||||||
|
* @param {Array} selection 目前已选中的行
|
||||||
|
* @param {Object} row 当前操作的行数据
|
||||||
|
* @param {Boolean} selected 是否勾选(true=勾选,false=取消)
|
||||||
|
*/
|
||||||
|
const handleSelect = (selection, row, selected) => {
|
||||||
|
if (isAutoSelect.value) return;
|
||||||
|
|
||||||
|
const targetSqh = row.sqh;
|
||||||
|
const targetxh = row.xh;
|
||||||
|
if (!targetSqh) return;
|
||||||
|
|
||||||
|
// 先收集需要自动勾选的行(避免在循环中修改数据)
|
||||||
|
const rowsToSelect = reqmainList.value.filter(
|
||||||
|
item => item.sqh === targetSqh && item.xh !== targetxh
|
||||||
|
);
|
||||||
|
|
||||||
|
// 如果有需要自动勾选的行,才开启标志位
|
||||||
|
if (rowsToSelect.length > 0) {
|
||||||
|
|
||||||
|
rowsToSelect.forEach(item => {
|
||||||
|
tableRef.value.toggleRowSelection(item, selected);
|
||||||
|
isAutoSelect.value = true;
|
||||||
|
});
|
||||||
|
setTimeout(() => isAutoSelect.value = false, 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
// 字典格式化方法
|
// 字典格式化方法
|
||||||
const formatDict =(dictType) => {
|
const formatDict =(dictType) => {
|
||||||
return (row, column, value) => {
|
return (row, column, value) => {
|
||||||
@ -244,7 +293,13 @@ function getList() {
|
|||||||
reqmainList.value = response.data;
|
reqmainList.value = response.data;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
single.value=false;
|
single.value=false;
|
||||||
|
// 新增:数据加载完成后触发全选
|
||||||
|
// 延迟执行(确保DOM已更新)
|
||||||
|
setTimeout(() => {
|
||||||
|
if (tableRef.value) {
|
||||||
|
tableRef.value.toggleAllSelection(); // 调用全选方法
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,21 +370,22 @@ function resetQuery() {
|
|||||||
|
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
|
if (isAutoSelect.value) return;
|
||||||
selectedRows.value = selection;
|
selectedRows.value = selection;
|
||||||
ids.value = selection.map(item => item.sqh);
|
ids.value = selection.map(item => item.sqh);
|
||||||
console.log('ids:', ids.value);
|
//console.log('ids:', ids.value);
|
||||||
console.log('selectedRows:', selectedRows.value);
|
// console.log('selectedRows:', selectedRows.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** 打印选择 */
|
/** 打印选择 */
|
||||||
function printAll(row) {
|
function printAll(row) {
|
||||||
|
console.log('idsnew:', idsnew.value);
|
||||||
if (selectedRows.length === 0) {
|
if (idsnew.value.length=== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
apiprintAll(ids.value).then(response => {
|
apiprintAll(idsnew.value).then(response => {
|
||||||
proxy.$modal.msgSuccess("打印成功");
|
proxy.$modal.msgSuccess("打印成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
freesingle.value=false;
|
freesingle.value=false;
|
||||||
@ -338,10 +394,10 @@ function printAll(row) {
|
|||||||
}
|
}
|
||||||
/** 单打条码*/
|
/** 单打条码*/
|
||||||
function printSigne(row) {
|
function printSigne(row) {
|
||||||
if (selectedRows.length === 0) {
|
if (idsnew.value.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
apiprintAll(ids.value).then(response => {
|
apiprintAll(idsnew.value).then(response => {
|
||||||
proxy.$modal.msgSuccess("打印成功");
|
proxy.$modal.msgSuccess("打印成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
freesingle.value=false;
|
freesingle.value=false;
|
||||||
@ -352,10 +408,10 @@ function printSigne(row) {
|
|||||||
|
|
||||||
/** 打印回单 */
|
/** 打印回单 */
|
||||||
function printBackpaper(row) {
|
function printBackpaper(row) {
|
||||||
if (selectedRows.length === 0) {
|
if (idsnew.value.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
apiprintAll(ids.value).then(response => {
|
apiprintAll(idsnew.value).then(response => {
|
||||||
proxy.$modal.msgSuccess("打印成功");
|
proxy.$modal.msgSuccess("打印成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
@ -363,6 +419,17 @@ function printBackpaper(row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const totalRows = computed(() => {
|
||||||
|
return reqmainList.value.length || 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
const totalPrice = computed(() => {
|
||||||
|
return reqmainList.value.reduce((sum, row) => {
|
||||||
|
const price = parseFloat(row.dj) || 0;
|
||||||
|
return sum + price;
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// 组件挂载时加载字典
|
// 组件挂载时加载字典
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
@ -378,7 +445,63 @@ onMounted(async () => {
|
|||||||
AU: toRaw(dictRefs.AU.value) || []
|
AU: toRaw(dictRefs.AU.value) || []
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 表格单元格样式(仅作用于“项目类别”列)
|
||||||
|
const tableCellStyle = ({ row, column }) => {
|
||||||
|
// 只对“项目类别”列生效
|
||||||
|
if (column.label === '项目类别') {
|
||||||
|
// 1. 转换颜色(十进制→十六进制)
|
||||||
|
const bgColor = decimalToHexColor(row.cp_color);
|
||||||
|
// 2. 自动计算文字颜色(确保和背景色对比度足够)
|
||||||
|
const textColor = getContrastTextColor(bgColor);
|
||||||
|
|
||||||
|
return {
|
||||||
|
backgroundColor: bgColor, // 背景色(转换后的值)
|
||||||
|
color: textColor, // 文字色(自动适配)
|
||||||
|
textAlign: 'center', // 文字居中
|
||||||
|
fontWeight: '500' // 文字加粗(提升可读性)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {}; // 其他列保持默认样式
|
||||||
|
};
|
||||||
|
|
||||||
|
// 十进制颜色值转十六进制颜色码(适配BGR转RGB)
|
||||||
|
const decimalToHexColor = (decimal) => {
|
||||||
|
if (!decimal && decimal !== 0) return '#FFFFFF'; // 空值默认白色
|
||||||
|
|
||||||
|
// 1. 十进制转十六进制(去除前缀0x,大写)
|
||||||
|
let hex = parseInt(decimal, 10).toString(16).toUpperCase();
|
||||||
|
|
||||||
|
// 2. 不足6位则前面补0(确保是6位)
|
||||||
|
if (hex.length < 6) {
|
||||||
|
hex = hex.padStart(6, '0'); // 例如:192→"C0"→补0为"0000C0"
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. BGR转RGB(反转字节顺序:前两位和后两位交换)
|
||||||
|
// 例:80FFFF → 拆分为80、FF、FF → 反转后FF、FF、80 → FFFF80
|
||||||
|
const r = hex.substring(4, 6); // 取后两位
|
||||||
|
const g = hex.substring(2, 4); // 取中间两位
|
||||||
|
const b = hex.substring(0, 2); // 取前两位
|
||||||
|
const rgbHex = r + g + b;
|
||||||
|
|
||||||
|
return `#${rgbHex}`; // 最终颜色码
|
||||||
|
};
|
||||||
|
// 辅助函数:根据背景色计算文字颜色(黑/白)
|
||||||
|
const getContrastTextColor = (bgColor) => {
|
||||||
|
// 提取RGB值(如#FFFF80 → R=255, G=255, B=128)
|
||||||
|
const r = parseInt(bgColor.slice(1, 3), 16);
|
||||||
|
const g = parseInt(bgColor.slice(3, 5), 16);
|
||||||
|
const b = parseInt(bgColor.slice(5, 7), 16);
|
||||||
|
|
||||||
|
// 计算亮度(标准公式)
|
||||||
|
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
||||||
|
// 亮度>0.5用黑色,否则用白色(确保清晰)
|
||||||
|
return luminance > 0.5 ? '#333333' : '#FFFFFF';
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.compact-form .el-form-item {
|
.compact-form .el-form-item {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
@ -388,6 +511,29 @@ onMounted(async () => {
|
|||||||
.compact-form .el-form-item__label {
|
.compact-form .el-form-item__label {
|
||||||
padding-bottom: 0px;
|
padding-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
::v-deep .my-table .el-table__row td {
|
||||||
|
padding: 1px 0; /* 减小行高 */
|
||||||
|
}
|
||||||
|
::v-deep .my-table .el-table__header-wrapper th {
|
||||||
|
padding: 6px 0; /* 表头内边距 */
|
||||||
|
background-color: #b3d8ff !important; /* 表头背景色(保留之前的设置) */
|
||||||
|
color: #333; /* 文字颜色加深,提升可读性 */
|
||||||
|
font-weight: 500; /* 文字加粗 */
|
||||||
|
}
|
||||||
|
::v-deep .my-table .el-table__cell {
|
||||||
|
padding: 0 2px; /* 减小列间距 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 可选:调整表格整体样式 */
|
||||||
|
::v-deep .my-table {
|
||||||
|
font-size: 13px; /* 适当减小字体 */
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .my-table .el-table__cell,
|
||||||
|
::v-deep .my-table .el-table__header-wrapper th {
|
||||||
|
border-width: 1px;
|
||||||
|
border-color: #ebeef5;
|
||||||
|
}
|
||||||
.card-content {
|
.card-content {
|
||||||
max-height: 450px; /* 设置最大高度 */
|
max-height: 450px; /* 设置最大高度 */
|
||||||
overflow-y: auto; /* 超出高度时显示垂直滚动条 */
|
overflow-y: auto; /* 超出高度时显示垂直滚动条 */
|
||||||
@ -399,4 +545,38 @@ onMounted(async () => {
|
|||||||
color: blue;
|
color: blue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/* 汇总行样式 */
|
||||||
|
.table-summary {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
padding: 6px 16px;
|
||||||
|
margin-top: 8px;
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 24px; /* 汇总行文字行高 */
|
||||||
|
.summary-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-left: 24px;
|
||||||
|
|
||||||
|
.summary-label {
|
||||||
|
color: #606266;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-value {
|
||||||
|
color: #303133;
|
||||||
|
min-width: 40px;
|
||||||
|
text-align: left;/* 核心:数值左对齐 */
|
||||||
|
}
|
||||||
|
/* 单独设置"单价合计"的值为红色 */
|
||||||
|
&:nth-child(3) .summary-value {
|
||||||
|
color: #f56c6c; /* Element UI 红色主题色 */
|
||||||
|
font-weight: 600; /* 可选:加粗字体 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user