二维码

This commit is contained in:
hezhengao 2024-04-19 09:41:48 +08:00
parent 20299daade
commit 89be263ca7
3 changed files with 45 additions and 84 deletions

View File

@ -56,6 +56,7 @@
"vue-count-to": "1.0.13", "vue-count-to": "1.0.13",
"vue-cropper": "0.5.5", "vue-cropper": "0.5.5",
"vue-meta": "2.4.0", "vue-meta": "2.4.0",
"vue-print-nb": "^1.7.5",
"vue-qr": "^4.0.9", "vue-qr": "^4.0.9",
"vue-router": "3.4.9", "vue-router": "3.4.9",
"vuedraggable": "2.24.3", "vuedraggable": "2.24.3",

View File

@ -75,17 +75,20 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 二维码 --> <!-- 二维码 -->
<el-dialog :visible.sync="codeOpen" width="250px" append-to-body> <el-dialog :visible.sync="codeOpen" width="450px" append-to-body>
<div id="printdata"> <div id="printdata">
<div>
<div>项目名称<span>{{ this.titles }}</span></div> <div>项目名称<span>{{ this.titles }}</span></div>
<div> <div>
<vue-qr ref="qrCode" :text="texturl" :logoSrc="logoSrc" :color-dark="randomColor"></vue-qr> <vue-qr :width="400" ref="qrCode" :text="texturl" :logoSrc="logoSrc" :color-dark="randomColor" ></vue-qr>
</div> </div>
</div> </div>
</div>
<div slot="footer"> <div slot="footer">
<el-button type="primary" @click="() => { codeOpen = false }">确定</el-button> <el-button type="primary" @click="() => { codeOpen = false }">确定</el-button>
<el-button type="text" @click="handlePrint" v-print="'#printdata'" >打印二维码</el-button> <el-button type="primary" @click="handlePrint" v-print="'#printdata'" >打印二维码</el-button>
</div> </div>
</el-dialog> </el-dialog>
@ -308,4 +311,21 @@ export default {
margin-bottom: 20px; margin-bottom: 20px;
} }
} }
@media print {
@page {
size: auto; /* 设置打印页面大小为自动 */
margin: 0; /* 设置打印页面的页边距为0去除默认页眉和页脚 */
}
#printdata {
display: flex;
justify-content: center; /* 水平居中 */
align-items: center; /* 垂直居中 */
height: 100vh; /* 设置高度为视口高度,使内容居中显示 */
transform: scale(3); /* 设置二维码放大倍数这里是放大2倍可以根据需要调整 */
}
/* 如果需要额外样式,可以在这里添加 */
}
</style> </style>

View File

@ -3,7 +3,7 @@
<el-row :gutter="20"> <el-row :gutter="20">
<!--部门数据--> <!--部门数据-->
<el-col :span="4" :xs="20"> <el-col :span="4" :xs="20">
<div class="head-container"> <!-- <div class="head-container">
<el-input <el-input
v-model="deptName" v-model="deptName"
placeholder="请输入部门名称" placeholder="请输入部门名称"
@ -12,8 +12,8 @@
prefix-icon="el-icon-search" prefix-icon="el-icon-search"
style="margin-bottom: 20px" style="margin-bottom: 20px"
/> />
</div> </div> -->
<div class="head-container"> <!-- <div class="head-container">
<el-tree <el-tree
:data="deptOptions" :data="deptOptions"
:props="defaultProps" :props="defaultProps"
@ -25,7 +25,7 @@
highlight-current highlight-current
@node-click="handleNodeClick" @node-click="handleNodeClick"
/> />
</div> </div> -->
</el-col> </el-col>
<!--用户数据--> <!--用户数据-->
<el-col :span="20" :xs="24"> <el-col :span="20" :xs="24">
@ -113,7 +113,7 @@
v-hasPermi="['system:user:remove']" v-hasPermi="['system:user:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button <el-button
type="info" type="info"
plain plain
@ -122,7 +122,7 @@
@click="handleImport" @click="handleImport"
v-hasPermi="['system:user:import']" v-hasPermi="['system:user:import']"
>导入</el-button> >导入</el-button>
</el-col> </el-col> -->
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
@ -138,11 +138,10 @@
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="25" align="center" /> <el-table-column type="selection" width="25" align="center" />
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" width="80"/>
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" /> <el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" /> <!-- <el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" /> -->
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" /> <!-- <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" /> -->
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" /> <!-- <el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" /> -->
<el-table-column label="OpenID" align="center" prop="openid" v-if="columns[5].visible" :show-overflow-tooltip="true"/> <el-table-column label="OpenID" align="center" prop="openid" v-if="columns[5].visible" :show-overflow-tooltip="true"/>
<el-table-column label="状态" align="center" key="status" v-if="columns[6].visible"> <el-table-column label="状态" align="center" key="status" v-if="columns[6].visible">
<template slot-scope="scope"> <template slot-scope="scope">
@ -211,58 +210,24 @@
</el-row> </el-row>
<!-- 添加或修改用户配置对话框 --> <!-- 添加或修改用户配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="300px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="24">
<el-form-item label="用户昵称" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入用户昵称" maxlength="30" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="归属部门" prop="deptId">
<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="手机号码" prop="phonenumber">
<el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName"> <el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName">
<el-input v-model="form.userName" placeholder="请输入用户名称" maxlength="30" /> <el-input v-model="form.userName" placeholder="请输入用户名称" maxlength="30" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="24">
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password"> <el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password/> <el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="24">
<el-form-item label="用户性别">
<el-select v-model="form.sex" placeholder="请选择性别">
<el-option
v-for="dict in dict.type.sys_user_sex"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态"> <el-form-item label="状态">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">
<el-radio <el-radio
@ -273,22 +238,7 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> <el-col :span="24">
<el-row>
<el-col :span="12">
<el-form-item label="岗位">
<el-select v-model="form.postIds" multiple placeholder="请选择岗位">
<el-option
v-for="item in postOptions"
:key="item.postId"
:label="item.postName"
:value="item.postId"
:disabled="item.status == 1"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="角色"> <el-form-item label="角色">
<el-select v-model="form.roleIds" multiple placeholder="请选择角色"> <el-select v-model="form.roleIds" multiple placeholder="请选择角色">
<el-option <el-option
@ -302,20 +252,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="12">
<el-form-item label="OpenID" prop="openid">
<el-input v-model="form.openid" placeholder="请输入OpenID" maxlength="50" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -593,8 +530,11 @@ export default {
this.form.password = this.initPassword; this.form.password = this.initPassword;
}); });
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
console.log(row);
this.reset(); this.reset();
const userId = row.userId || this.ids; const userId = row.userId || this.ids;
getUser(userId).then(response => { getUser(userId).then(response => {