版本更新

This commit is contained in:
Zhang.WH
2025-09-03 15:54:41 +08:00
parent 0b93d16b64
commit 8f82322d10
3290 changed files with 154339 additions and 23829 deletions

View File

@@ -0,0 +1,13 @@
<template>
<div>
<svg-icon icon-class="question" @click="goto" />
</div>
</template>
<script setup>
// const url = ref('http://doc.ruoyi.vip/ruoyi-vue');
function goto() {
// window.open(url.value)
}
</script>

View File

@@ -0,0 +1,231 @@
<template>
<el-dialog
title="药品追溯码"
v-model="props.openDialog"
width="842"
append-to-body
destroy-on-close
:draggable="true"
@close="cancel"
@opened="
() => {
console.log(123);
traceNoTempRef.focus();
}
"
>
<div>
<div style="font-size: 16px">
<div style="margin-bottom: 15px">药品名称 {{ props.ypName }}</div>
扫描追溯码
<el-input
ref="traceNoTempRef"
type="textarea"
:rows="1"
v-model="traceNoTemp"
style="width: 180px; margin-right: 20px"
@input="throttledGetList(traceNoTemp)"
/>
输入追溯码
<el-input
v-model="traceNoInput"
style="width: 180px; margin-right: 20px"
@keyup.enter="handelTraceNo(traceNoInput)"
/>
<el-button type="primary" plain icon="CircleClose" @click="handleReturn"> 撤回 </el-button>
<el-button type="danger" plain icon="CircleClose" @click="handleClear"> 清除 </el-button>
</div>
<!-- <el-input
ref="inputRef"
v-model="traceNo"
type="textarea"
:rows="15"
disabled
@input="throttledGetList"
style="width: 100%; margin-top: 10px; margin-right: 20px"
/> -->
<div
style="
background: #f5f7fa;
margin-top: 10px;
padding: 10px;
width: 780px;
height: 350px;
border: solid 1px #ebeef5;
overflow-y: auto;
"
>
<div style="display: flex; flex-wrap: wrap; gap: 8px">
<div
v-for="(item, index) in traceNoList"
:key="item + index"
style="
display: inline-flex;
align-items: center;
background: white;
padding: 4px 8px 4px 12px;
border-radius: 12px;
"
>
<span style="margin-right: 6px">
[{{ index + 1 }}]
<template v-if="index < 9">&nbsp;</template>
<template v-else></template>
{{ item }}
</span>
<div
@click="removeTraceNo(index)"
style="
display: flex;
align-items: center;
justify-content: center;
width: 16px;
height: 16px;
background: #f56c6c;
border-radius: 50%;
cursor: pointer;
"
>
<el-icon size="10" color="white">
<Close />
</el-icon>
</div>
</div>
</div>
</div>
<div>
追溯码{{ existenceTraceNoList[rowData.itemId] }}
</div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submit"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</template>
<script setup>
import { watch } from 'vue';
import { searchTraceNo } from '@/api/public';
import { debounce } from 'lodash-es';
const props = defineProps({
openDialog: {
type: Boolean,
default: false,
},
ypName: {
type: String,
default: '',
},
rowData: {
type: Object,
default: () => {},
},
});
const openTraceNo = ref(false);
const traceNo = ref('');
const traceNoList = ref([]);
const existenceTraceNoList = ref([]);
const traceNoTemp = ref('');
const traceNoInput = ref('');
const traceNoTempRef = ref();
const emit = defineEmits(['submit', 'cancel']);
watch(
() => props.rowData,
async (newRowData) => {
if (newRowData && Object.keys(newRowData).length > 0) {
const { itemType, itemId, locationId, lotNumber } = newRowData;
try {
const response = await searchTraceNo({
itemType,
itemId,
locationId,
lotNumber,
});
// 处理返回数据,例如更新 traceNoList
existenceTraceNoList.value = response.data || [];
} catch (error) {
console.error('获取追溯码失败:', error);
}
}
},
{ deep: true, immediate: true }
);
// 撤回最后一条追溯码
function handleReturn() {
if (traceNoList.value.length !== 0) {
// 1. 从数组中移除最后一项
traceNoList.value.pop();
// 2. 重新构建显示文本
traceNo.value = traceNoList.value
.map((item, index) => {
return index < 9 ? `[${index + 1}] ${item}` : `[${index + 1}] ${item}`;
})
.join(', ');
if (traceNoList.value != 0) {
traceNo.value += '\n';
}
}
traceNoTempRef.value.focus();
}
function removeTraceNo(index) {
traceNoList.value.splice(index, 1);
traceNoTempRef.value.focus();
}
function formatValue(index) {
if (index >= 10) {
return `&nbsp;&nbsp;`;
} else {
return `&nbsp;`;
}
}
function handleClear() {
traceNo.value = '';
traceNoList.value = [];
}
const throttledGetList = debounce(handelTraceNo, 500);
function handelTraceNo(value) {
let list = value.trim().split('\n');
list.forEach((item) => {
traceNoList.value.push(item);
});
traceNo.value = traceNoList.value
.map((item, index) => {
return index < 9 ? `[${index + 1}] ${item}` : `[${index + 1}] ${item}`;
})
.join(', ');
if (traceNoList.value != 0) {
traceNo.value += '\n';
}
traceNoTemp.value = '';
traceNoInput.value = '';
// let saveValue = value.substring(inputValue.length + 5, value.length);
// inputValue = value;
// console.log(value);
// console.log(saveValue);
// traceNoList.value.push(saveValue);
// traceNo.value = value + '[' + (traceNoList.value.length + 1) + ']' + ' ';
}
function cancel() {
emit('cancel');
traceNoList.value = [];
traceNo.value = '';
}
function submit() {
emit('submit', traceNoList.value.join(','));
openTraceNo.value = false;
traceNoList.value = [];
traceNo.value = '';
}
</script>

View File

@@ -0,0 +1,84 @@
<template>
<el-popover
:popper-style="{ padding: '0' }"
:placement="placement"
:visible="isPopoverVisible"
trigger="manual"
:width="width"
>
<slot name="popover-content" :row="row" :index="index">
<div>列表内容</div>
</slot>
<template #reference>
<el-input
v-model="inputValue"
:placeholder="placeholder"
@input="handleInput"
@focus="handleFocus"
@blur="handleBlur"
/>
</template>
</el-popover>
</template>
<script setup>
const props = defineProps({
modelValue: {
type: String,
default: '',
},
row: {
type: Object,
default: () => ({}),
},
index: {
type: Number,
default: -1,
},
placeholder: {
type: String,
default: '',
},
placement: {
type: String,
default: 'bottom-start',
},
width: {
type: Number,
default: 800,
},
});
const emit = defineEmits(['update:modelValue', 'selsect-advice-base', 'focus', 'blur']);
const isPopoverVisible = ref(false);
const inputValue = ref(props.modelValue);
// 同步外部modelValue变化
watch(
() => props.modelValue,
(newVal) => {
inputValue.value = newVal;
}
);
const handleInput = (value) => {
emit('search', value);
};
const handleFocus = () => {
isPopoverVisible.value = true;
emit('focus', props.row, props.index);
};
const handleBlur = () => {
// 延迟隐藏以允许选择操作完成
isPopoverVisible.value = false;
emit('blur', props.row);
};
const handleSelectAdvice = (payload) => {
isPopoverVisible.value = false;
emit('selsect-advice-base', payload);
};
</script>