| | |
| | | |
| | | <el-table v-loading="loading" :data="qrcodeList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="二维码ID" align="center" prop="qrcodeId" /> |
| | | |
| | | <el-table-column label="车牌号" align="center" prop="vehicleNo" /> |
| | | <el-table-column label="二维码URL" align="center" prop="qrcodeUrl" width="200"> |
| | | <template slot-scope="scope"> |
| | |
| | | <el-input v-model="form.vehicleNo" placeholder="请输入车牌号" /> |
| | | </el-form-item> |
| | | <el-form-item label="二维码URL" prop="qrcodeUrl"> |
| | | <el-input v-model="form.qrcodeUrl" placeholder="请输入二维码URL" /> |
| | | <el-input v-model="form.qrcodeUrl" placeholder="可选,留空则使用默认URL" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <!-- 批量生成二维码对话框 --> |
| | | <el-dialog title="批量生成二维码" :visible.sync="batchOpen" width="600px" append-to-body> |
| | | <el-form ref="batchForm" :model="batchForm" :rules="batchRules" label-width="100px"> |
| | | <el-form-item label="车牌号" prop="vehicleNos"> |
| | | <el-input |
| | | v-model="batchForm.vehicleNos" |
| | | type="textarea" |
| | | :rows="6" |
| | | placeholder="请输入车牌号,多个车牌号用逗号分隔,例如:粤A12345,粤B67890,粤C11111" /> |
| | | </el-form-item> |
| | | <el-form-item label="二维码URL" prop="qrcodeUrl"> |
| | | <el-input v-model="batchForm.qrcodeUrl" placeholder="可选,留空则使用默认URL" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitBatchForm">确 定</el-button> |
| | | <el-button @click="cancelBatch">取 消</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <!-- 二维码详情对话框 --> |
| | | <el-dialog title="二维码详情" :visible.sync="viewOpen" width="600px" append-to-body> |
| | | <el-descriptions :column="2" border> |
| | | <el-descriptions-item label="二维码ID">{{ viewForm.qrcodeId }}</el-descriptions-item> |
| | | |
| | | <el-descriptions-item label="车牌号">{{ viewForm.vehicleNo }}</el-descriptions-item> |
| | | <el-descriptions-item label="二维码URL" :span="2"> |
| | | <el-link :href="viewForm.qrcodeUrl" target="_blank" type="primary">{{ viewForm.qrcodeUrl }}</el-link> |
| | |
| | | title: "", |
| | | // 是否显示弹出层 |
| | | open: false, |
| | | // 是否显示批量生成弹出层 |
| | | batchOpen: false, |
| | | // 是否显示查看弹出层 |
| | | viewOpen: false, |
| | | // 查询参数 |
| | |
| | | }, |
| | | // 表单参数 |
| | | form: {}, |
| | | // 批量生成表单参数 |
| | | batchForm: {}, |
| | | // 查看表单参数 |
| | | viewForm: {}, |
| | | // 表单校验 |
| | |
| | | { required: true, message: "车牌号不能为空", trigger: "blur" } |
| | | ], |
| | | qrcodeUrl: [ |
| | | { required: true, message: "二维码URL不能为空", trigger: "blur" }, |
| | | { type: 'url', message: '请输入正确的URL格式', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | // 批量生成表单校验 |
| | | batchRules: { |
| | | vehicleNos: [ |
| | | { required: true, message: "车牌号不能为空", trigger: "blur" } |
| | | ], |
| | | qrcodeUrl: [ |
| | | { type: 'url', message: '请输入正确的URL格式', trigger: 'blur' } |
| | | ] |
| | | } |
| | |
| | | }; |
| | | this.resetForm("form"); |
| | | }, |
| | | // 批量表单重置 |
| | | resetBatch() { |
| | | this.batchForm = { |
| | | vehicleNos: null, |
| | | qrcodeUrl: null |
| | | }; |
| | | this.resetForm("batchForm"); |
| | | }, |
| | | /** 搜索按钮操作 */ |
| | | handleQuery() { |
| | | this.queryParams.pageNum = 1; |
| | |
| | | if (valid) { |
| | | const params = { |
| | | vehicleNo: this.form.vehicleNo, |
| | | qrcodeUrl: this.form.qrcodeUrl |
| | | qrcodeUrl: this.form.qrcodeUrl || null |
| | | }; |
| | | generateQrcode(params).then(response => { |
| | | this.$modal.msgSuccess("生成成功"); |
| | |
| | | }, |
| | | /** 批量生成按钮操作 */ |
| | | handleBatchGenerate() { |
| | | this.$modal.confirm('是否确认批量生成所有车辆的二维码?').then(function() { |
| | | return batchGenerateQrcode(); |
| | | }).then(() => { |
| | | this.resetBatch(); |
| | | this.batchOpen = true; |
| | | }, |
| | | // 取消批量生成 |
| | | cancelBatch() { |
| | | this.batchOpen = false; |
| | | this.resetBatch(); |
| | | }, |
| | | /** 批量提交按钮 */ |
| | | submitBatchForm() { |
| | | this.$refs["batchForm"].validate(valid => { |
| | | if (valid) { |
| | | const vehicleNos = this.batchForm.vehicleNos.split(',').map(no => no.trim()).filter(no => no); |
| | | if (vehicleNos.length === 0) { |
| | | this.$modal.msgError("请输入有效的车牌号"); |
| | | return; |
| | | } |
| | | |
| | | console.log('批量生成车牌号列表:', vehicleNos); |
| | | |
| | | const params = { |
| | | vehicleNos: vehicleNos, |
| | | qrcodeUrl: this.batchForm.qrcodeUrl || null |
| | | }; |
| | | |
| | | console.log('批量生成参数:', params); |
| | | |
| | | batchGenerateQrcode(params).then(response => { |
| | | console.log('批量生成响应:', response); |
| | | if (response.code === 200) { |
| | | this.$modal.msgSuccess(response.msg || "批量生成成功"); |
| | | } else { |
| | | this.$modal.msgError(response.msg || "批量生成失败"); |
| | | } |
| | | this.batchOpen = false; |
| | | this.getList(); |
| | | this.$modal.msgSuccess("批量生成成功"); |
| | | }).catch(() => {}); |
| | | }).catch(error => { |
| | | console.error('批量生成失败:', error); |
| | | this.$modal.msgError("批量生成失败,请重试"); |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | /** 查看按钮操作 */ |
| | | handleView(row) { |