电子合格证

This commit is contained in:
bb_pan 2025-08-06 15:53:27 +08:00
parent 1eeae6b949
commit b9116e4010
5 changed files with 25 additions and 11 deletions

View File

@ -241,15 +241,19 @@ const props = defineProps({
type: String, type: String,
default: '', default: '',
}, },
maId: {
type: [String, Number],
default: '',
},
}) })
// props.maCode // props.maId
watch( watch(
() => props.maCode, () => props.maId,
(newValue) => { (newValue) => {
console.log('newValue', newValue) console.log('newValue', newValue)
if (newValue) { if (newValue) {
maCodeTwo.value = newValue maCodeTwo.value = props.maCode
changeTag() changeTag()
} }
}, },
@ -265,7 +269,7 @@ const changeTag = async () => {
if (!maCodeTwo.value) return if (!maCodeTwo.value) return
try { try {
const response = await getListTag({ maCode: maCodeTwo.value }) const response = await getListTag({ maCode: maCodeTwo.value, maId: props.maId })
if (response.data && response.data.length !== 0) { if (response.data && response.data.length !== 0) {
tagInfo.value = response.data[0] tagInfo.value = response.data[0]
isJj.value = tagInfo.value.isJj isJj.value = tagInfo.value.isJj
@ -282,6 +286,9 @@ const changeTag = async () => {
drawStamp(stampText, companyName, canvasId) drawStamp(stampText, companyName, canvasId)
}) })
} else {
console.log('未找到标签信息')
isJj.value = null
} }
} catch (error) { } catch (error) {
console.error('获取标签信息失败', error) console.error('获取标签信息失败', error)

View File

@ -101,7 +101,7 @@
</view> </view>
</view> </view>
<ElectronicSeal :maCode="formData?.maCode" /> <ElectronicSeal :maCode="formData?.maCode" :maId="formData?.maId" />
</scroll-view> </scroll-view>
</view> </view>
</template> </template>

View File

@ -100,7 +100,7 @@
</uni-forms> </uni-forms>
</view> </view>
</view> </view>
<ElectronicSeal v-if="codeData?.maCode && !showCamera" :maCode="codeData?.maCode" /> <ElectronicSeal v-if="codeData?.maCode && !showCamera" :maCode="codeData?.maCode" :maId="codeData?.maId" />
<!-- 相机预览页面 --> <!-- 相机预览页面 -->
<view v-if="showCamera" class="camera-container"> <view v-if="showCamera" class="camera-container">

View File

@ -75,7 +75,7 @@
</view> </view>
<ElectronicSeal :maCode="codeData?.maCode" /> <ElectronicSeal :maCode="codeData?.maCode" :maId="codeData?.maId" />
</scroll-view> </scroll-view>
</view> </view>
</template> </template>

View File

@ -14,7 +14,7 @@
<div v-if="optionList.length > 0" class="select-container"> <div v-if="optionList.length > 0" class="select-container">
<uni-data-select <uni-data-select
v-model="maCodeTwo" v-model="maId"
:localdata="optionList" :localdata="optionList"
@change="changeTag" @change="changeTag"
placeholder="请选择相关联编号" placeholder="请选择相关联编号"
@ -245,6 +245,7 @@ import { getListTag, getSelectionList } from '@/services/stquery/stquery.js'
// //
const code = ref<string>('') const code = ref<string>('')
const isJj = ref<number | null>(null) const isJj = ref<number | null>(null)
const maId = ref<string | number>('')
const maCodeTwo = ref<string>('') const maCodeTwo = ref<string>('')
const optionList = ref<Array<{ value: string; text: string }>>([]) const optionList = ref<Array<{ value: string; text: string }>>([])
const tagInfo = ref({ const tagInfo = ref({
@ -279,7 +280,7 @@ const handQuery = () => {
getSelectionList({ maCode: code.value }).then((response) => { getSelectionList({ maCode: code.value }).then((response) => {
if (response.data && response.data.length !== 0) { if (response.data && response.data.length !== 0) {
optionList.value = response.data.map((option) => ({ optionList.value = response.data.map((option) => ({
value: option.maCode, value: option.maId,
text: option.maCode, text: option.maCode,
})) }))
} else { } else {
@ -293,11 +294,17 @@ const handQuery = () => {
} }
// //
const changeTag = async () => { const changeTag = async (e) => {
console.log('🚀 ~ changeTag ~ e:', e)
// maId optionList.value maCode
maCodeTwo.value = optionList.value.find(
(item) => item.value === maId.value,
)?.text || ''
console.log('🚀 ~ changeTag ~ maCodeTwo:', maCodeTwo.value)
if (!maCodeTwo.value) return if (!maCodeTwo.value) return
try { try {
const response = await getListTag({ maCode: maCodeTwo.value }) const response = await getListTag({ maCode: maCodeTwo.value, maId: maId.value })
if (response.data && response.data.length !== 0) { if (response.data && response.data.length !== 0) {
tagInfo.value = response.data[0] tagInfo.value = response.data[0]
isJj.value = tagInfo.value.isJj isJj.value = tagInfo.value.isJj