From db42d47f5692ef64e5436c5a6d29dcb537b44596 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期一, 26 一月 2026 16:36:13 +0800
Subject: [PATCH] 浪潮对接单点登录:mis调整
---
src/views/equipmentManagement/inspectionManagement/components/qrCodeDia.vue | 132 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 132 insertions(+), 0 deletions(-)
diff --git a/src/views/equipmentManagement/inspectionManagement/components/qrCodeDia.vue b/src/views/equipmentManagement/inspectionManagement/components/qrCodeDia.vue
new file mode 100644
index 0000000..136c18c
--- /dev/null
+++ b/src/views/equipmentManagement/inspectionManagement/components/qrCodeDia.vue
@@ -0,0 +1,132 @@
+<template>
+ <div>
+ <el-dialog :title="operationType === 'add' ? '鏂板浜岀淮鐮�' : '缂栬緫浜岀淮鐮�'"
+ v-model="dialogVisitable" width="500px" @close="cancel">
+ <el-form :model="form" :rules="rules" ref="formRef" label-width="120px">
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="璁惧鍚嶇О" prop="deviceName">
+ <el-input v-model="form.deviceName" placeholder="璇疯緭鍏ヨ澶囧悕绉�" maxlength="30" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="鎵�鍦ㄤ綅缃弿杩�" prop="location">
+ <el-input v-model="form.location" placeholder="璇疯緭鍏ユ墍鍦ㄤ綅缃弿杩�" maxlength="30"/>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <div>
+ <el-button type="primary" @click="submitForm">鐢熸垚骞舵墦鍗颁簩缁寸爜</el-button>
+ </div>
+ <div v-if="isShowQrCode" class="print-section" ref="qrCodeContainer" id="qrCodeContainer">
+ <vue-qrcode :value="qrCodeValue" :width="qrCodeSize"></vue-qrcode>
+ </div>
+ </el-dialog>
+ </div>
+</template>
+
+<script setup>
+import useUserStore from "@/store/modules/user.js";
+import {reactive, ref} from "vue";
+import printJS from 'print-js';
+import {addOrEditQrCode} from "@/api/inspectionUpload/index.js";
+
+const { proxy } = getCurrentInstance()
+const emit = defineEmits()
+const userStore = useUserStore()
+const dialogVisitable = ref(false);
+const isShowQrCode = ref(false);
+const operationType = ref('add');
+
+const qrCodeValue = ref('');
+const qrCodeSize = ref(100);
+const data = reactive({
+ form: {
+ deviceName: '',
+ location: '',
+ qrCodeId: '',
+ id: ''
+ },
+ rules: {
+ deviceName: [{ required: true, message: '璇疯緭鍏ヨ澶囧悕绉�', trigger: 'blur' }],
+ location: [{ required: true, message: '璇疯緭鍏ュ湴鐐�', trigger: 'blur' }]
+ }
+})
+const { form, rules } = toRefs(data)
+
+
+// 鎵撳紑寮规
+const openDialog = async (type, row) => {
+ dialogVisitable.value = true
+ qrCodeValue.value = ''
+ isShowQrCode.value = false;
+ if (type === 'edit') {
+ form.value.id = row.id
+ form.value.qrCodeId = row.id
+ form.value.deviceName = row.deviceName
+ form.value.location = row.location
+ // 灏嗚〃鍗曟暟鎹浆涓� JSON 瀛楃涓蹭綔涓轰簩缁寸爜鍐呭
+ qrCodeValue.value = JSON.stringify(form.value);
+ isShowQrCode.value = true;
+ }
+}
+// 鎻愪氦鍚堝苟琛ㄥ崟
+const submitForm = () => {
+ proxy.$refs["formRef"].validate(valid => {
+ if (valid) {
+ addOrEditQrCode(form.value).then((res) => {
+ form.value.qrCodeId = res.data
+ })
+ // 灏嗚〃鍗曟暟鎹浆涓� JSON 瀛楃涓蹭綔涓轰簩缁寸爜鍐呭
+ qrCodeValue.value = JSON.stringify(form.value);
+ isShowQrCode.value = true;
+ showQrCode()
+ }
+ })
+}
+const showQrCode = () => {
+ // 寤惰繜鎵ц鎵撳嵃锛岄伩鍏� DOM 鏇存柊鍓嶅氨璋冪敤鎵撳嵃
+ setTimeout(() => {
+ printJS({
+ printable: 'qrCodeContainer',//椤甸潰
+ type: "html",//鏂囨。绫诲瀷
+ maxWidth: 360,
+ style: `@page {
+ margin:0;
+ size: 400px 75px collapse;
+ margin-top:3px;
+ &:first-of-type{
+ margin-top:0 !important;
+ }
+ }
+ html{
+ zoom:100%;
+ }
+ @media print{
+ width: 400px;
+ height: 75px;
+ margin:0;
+ }`,
+ targetStyles: ["*"], // 浣跨敤dom鐨勬墍鏈夋牱寮忥紝寰堥噸瑕�
+ font_size: '0.20cm',
+ });
+ }, 300);
+}
+// 鍏抽棴鍚堝苟琛ㄥ崟
+const cancel = () => {
+ proxy.resetForm("formRef")
+ dialogVisitable.value = false
+ emit('closeDia')
+}
+defineExpose({ openDialog })
+</script>
+
+<style scoped>
+.print-section {
+ text-align: center;
+ margin-top: 30px;
+}
+</style>
\ No newline at end of file
--
Gitblit v1.9.3