|
|
@@ -73,7 +73,7 @@
|
|
|
</van-button>
|
|
|
<van-button
|
|
|
style="width: 70px; height: 30px; margin: 0; font-size: 14px"
|
|
|
- type="primary"
|
|
|
+ type="success"
|
|
|
size="small"
|
|
|
v-if="item.status == 10"
|
|
|
@click.native.stop="onConfirm(item.id)"
|
|
|
@@ -87,6 +87,7 @@
|
|
|
</van-list>
|
|
|
</div>
|
|
|
<van-floating-bubble v-model:offset="offset" icon="plus" @click="onAdd" axis="y" />
|
|
|
+ <van-floating-bubble v-model:offset="offsetScan" icon="scan" @click="scan" axis="y" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -98,11 +99,16 @@
|
|
|
import { useRepairReportApi } from '/@/api/instr/repairReport'
|
|
|
import { showImagePreview, showConfirmDialog, showNotify } from 'vant'
|
|
|
import 'vant/es/image-preview/style'
|
|
|
+ import { useUserInfo } from '/@/stores/userInfo'
|
|
|
+ import { useInstrApi } from '/@/api/instr/index'
|
|
|
|
|
|
const repairReportApi = useRepairReportApi()
|
|
|
+ const instApi = useInstrApi()
|
|
|
+
|
|
|
const router = useRouter()
|
|
|
const route = useRoute()
|
|
|
const offset = ref({ x: -80, y: 450 })
|
|
|
+ const offsetScan = ref({ x: -80, y: 540 })
|
|
|
const state = reactive({
|
|
|
queryParams: {
|
|
|
equipmentName: '',
|
|
|
@@ -171,6 +177,33 @@
|
|
|
const onConfirm = (id: number) => {
|
|
|
router.push('/inst/repairReport/confirm?id=' + id)
|
|
|
}
|
|
|
+
|
|
|
+ const scan = async () => {
|
|
|
+ // decodeInstInfo('8f1117b76dc380334e00b6d980bde73d04a5a0f82c1f06b70d0e82108e8df201d9bcb81674cdf004c9b9046948e12b1b93467a058aec66a0f8b3f42e')
|
|
|
+ // return
|
|
|
+ const res = await useUserInfo().scanCode()
|
|
|
+ if (res) {
|
|
|
+ decodeInstInfo(res as string)
|
|
|
+ } else {
|
|
|
+ showNotify({ type: 'danger', message: '扫码失败,请重试' })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const decodeInstInfo = async (content: string) => {
|
|
|
+ const [err, res]: ToResponse = await to(instApi.decode({ content }))
|
|
|
+ if (err) return
|
|
|
+ const instInfo = JSON.parse(res?.data.content || '{}')
|
|
|
+ if (instInfo) {
|
|
|
+ router.push({
|
|
|
+ path: '/instr-detail',
|
|
|
+ query: {
|
|
|
+ id: Number(instInfo.id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ showNotify({ type: 'danger', message: '无法识别的设备信息' })
|
|
|
+ }
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|