sparkles: 条形码打印
Some checks failed
Release / lint (push) Successful in 28s
Release / Release (push) Failing after 34s

This commit is contained in:
my_ong 2024-12-13 13:22:23 +08:00
parent d089737967
commit ac86a8896c

View File

@ -46,7 +46,7 @@
编辑 编辑
</a-button> </a-button>
<a-button type="link" :style="{ color: token.colorPrimary }"> <a-button type="link" :style="{ color: token.colorPrimary }" @click="showPrintModal(record.id)">
<template #icon> <template #icon>
<icon-font type="icon-print" /> <icon-font type="icon-print" />
</template> </template>
@ -74,6 +74,17 @@
:title="modalTitle" :title="modalTitle"
@ok="doSave" @ok="doSave"
/> />
<!-- 打印条码弹窗 -->
<a-modal
v-model:open="openPrint"
title="条形码打印"
width="100%"
wrap-class-name="full-modal"
@ok="openPrint = false"
@cancel="openPrint = false"
>
<printCode :material-id="materialIdRef"></printCode>
</a-modal>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -83,12 +94,15 @@
import { notification, theme } from 'ant-design-vue' import { notification, theme } from 'ant-design-vue'
import { config, formItems } from './form' import { config, formItems } from './form'
import { FormDataType } from '@/components/form-render/form-render-types' import { FormDataType } from '@/components/form-render/form-render-types'
import printCode from './print-code.vue'
const { useToken } = theme const { useToken } = theme
const { token } = useToken() const { token } = useToken()
const searchKey = ref('') const searchKey = ref('')
const openPrint = ref(false)
const materialPage = ref<IPage<material.Material>>() const materialPage = ref<IPage<material.Material>>()
const loading = ref(false) const loading = ref(false)
const materialIdRef = ref<number>()
// //
const loadData = async (page = 1, size = 10) => { const loadData = async (page = 1, size = 10) => {
@ -110,6 +124,12 @@
title: '物料编码', title: '物料编码',
dataIndex: 'code', dataIndex: 'code',
}, },
{
title: '物料ID',
dataIndex: 'id',
},
{ {
title: '物料名称', title: '物料名称',
dataIndex: 'name', dataIndex: 'name',
@ -167,7 +187,6 @@
return material.value.id ? '编辑物料' : '添加物料' return material.value.id ? '编辑物料' : '添加物料'
}) })
//, //,
const addOrEdit = (u?: Record<string, unknown>) => { const addOrEdit = (u?: Record<string, unknown>) => {
/* /*
@ -184,7 +203,7 @@
这是为了避免因访问不存在的对象属性而引发错误 这是为了避免因访问不存在的对象属性而引发错误
*/ */
// material.value = { ...(u ?? { channels: 3 }) } // material.value = { ...(u ?? { channels: 3 }) }
material.value = { ...u}; // u 使 u 使 {} material.value = { ...u } // u 使 u 使 {}
formDrawer.value?.show() formDrawer.value?.show()
} }
@ -199,8 +218,7 @@
loadData(1) loadData(1)
}, },
}) })
}); })
} }
// //
@ -215,4 +233,9 @@
}) })
}) })
} }
const showPrintModal = (applyId: number) => {
openPrint.value = true
materialIdRef.value = applyId
}
</script> </script>