From 8b56fdc24e8f80c1bcfdb2d364efe3a73e13c0bd Mon Sep 17 00:00:00 2001 From: wyw <571921741@qq.com> Date: Fri, 18 Apr 2025 14:19:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E6=A3=80=E6=9F=A5=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E7=94=9F=E6=88=90=E4=BA=8C=E7=BB=B4=E7=A0=81=20=20=E6=9C=89?= =?UTF-8?q?=E9=80=89=E5=8C=BA=E5=9F=9F=E5=B0=B1=E5=8D=95=E7=8B=AC=E7=94=9F?= =?UTF-8?q?=E6=88=90=EF=BC=8C=20=E5=90=A6=E5=88=99=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=85=A8=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/apply/qrcodeMake.vue | 166 ++++++++++++++++++++++++++----------- services/common.js | 9 ++ 2 files changed, 127 insertions(+), 48 deletions(-) diff --git a/pages/apply/qrcodeMake.vue b/pages/apply/qrcodeMake.vue index 37cd736..bdbf2ae 100644 --- a/pages/apply/qrcodeMake.vue +++ b/pages/apply/qrcodeMake.vue @@ -8,31 +8,28 @@ * 参数信息 - - - - - + - - + + + + @@ -41,6 +38,9 @@ border="none" fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 9px"> + + + @@ -54,7 +54,7 @@ - 生成 @@ -76,49 +76,37 @@ import { DepartmentOrderPaged, UserPostOrderPaged, - DepartmentPostEntities + DepartmentPostEntities, + AreaEntities } from '../../services/common' import { initFilter, extendRule } from '../../utils/common' - + import config from '../../config/common' - + export default { data() { return { qrCodeSrc: '', OrgId: '', - sourceUrl: config.uni_app_web_source_url, model: { + discrib: '', + createType: null, OrgId: '', DEPARTMENT_ID: '', POST_ID: '', Nav_Post: {}, Nav_Department: {}, - Url:config.uni_app_web_local_api_url, + AREA_NAME: '', + AREA_ID: '', + Nav_Area: {}, + Url: config.uni_app_web_api_url, listQrCode: [{ TITLE: '', qrCode: '' }] - - // typeEnum: [{ - // value: true, - // name: '组织' - // }, { - // value: false, - // name: '岗位' - // }], - // downEnum: [{ - // value: true, - // name: '向下包含' - // }, { - // value: false, - // name: '当前组织' - // }], - // typeEnumValue: true, - // downEnumValue: true, }, selectorInfo: { showPopup: false, @@ -132,6 +120,14 @@ name: '', defaultChecked: [] }, + + listRadioType: [{ + name: '区域', + value: 10 + }, { + name: '岗位', + value: 20 + }] } }, onLoad(option) { @@ -144,7 +140,54 @@ }, methods: { async generateQRCode() { - try { + if (this.model.createType == null) + return false + var url = this.model.Url + '?OrgId=' + this.OrgId + '&createType=' + this.model.createType + this.model.discrib = '' + if (this.model.createType == 10) { + //区域 如果没有选择区域 全部生成 + //如果有选择区域 生成单个 + if (this.model.AREA_ID && this.model.AREA_ID.length > 2) { + url += '&AREA_ID=' + this.model.AREA_ID + const qrCodeData = await QRCode.toDataURL(url); + this.model.listQrCode = [] + this.model.listQrCode.push({ + TITle: '区域:' + this.model.Nav_Area.NAME, + qrCode: qrCodeData + }) + } else { + //获取所有区域 逐个生成 + const json = initFilter(this.OrgId, null, "NAME", 0, 1); + json.IgnoreDataRule = true + json.Limit = 10000 + extendRule(json, "STATUS", 1, 0) + json.Keyword = this.model.AREA_ID + var listResult = await AreaEntities(json).then(res => { + // this.selectorInfo.totalCount = res.TotalCount + if (res != undefined && res.Data.length > 0) { + return res.Data + } else { + uni.showToast({ + title: '未获取到区域!', + icon: 'none' + }) + } + }); + + if (listResult && listResult.length > 0) { + this.model.listQrCode = [] + this.model.discrib = '区域共计:' + listResult.length + '个' + for (let i = 0; i < listResult.length; i++) { + var qrCodeData = await QRCode.toDataURL(url + "&AREA_ID=" + listResult[i].ID); + this.model.listQrCode.push({ + TITle: '区域:' + listResult[i].NAME, + qrCode: qrCodeData + }) + } + } + } + } else if (this.model.createType == 20) { + //岗位 if (!this.model.DEPARTMENT_ID || this.model.DEPARTMENT_ID.length < 2) { uni.showToast({ title: '请选择班组!', @@ -152,13 +195,12 @@ }) return false } - var url = this.model.Url + '?OrgId=' + this.OrgId if (this.model.POST_ID && this.model.POST_ID.length > 2) { url += '&DEPARTMENT_ID=' + this.model.DEPARTMENT_ID + "&POST_ID=" + this.model.POST_ID const qrCodeData = await QRCode.toDataURL(url); this.model.listQrCode = [] this.model.listQrCode.push({ - TITle: this.model.Nav_Department.NAME + ':' + this.model.Nav_Post.NAME, + TITle: '岗位:' + this.model.Nav_Department.NAME + ':' + this.model.Nav_Post.NAME, qrCode: qrCodeData }) } else { @@ -180,6 +222,7 @@ if (listResult && listResult.length > 0) { this.model.listQrCode = [] + this.model.discrib = '区域共计:' + listResult.length + '个' for (let i = 0; i < listResult.length; i++) { var qrCodeData = await QRCode.toDataURL(url + '&DEPARTMENT_ID=' + this.model.DEPARTMENT_ID + "&POST_ID=" + listResult[i].ID); @@ -190,11 +233,8 @@ } } } - } catch (error) { - console.error('生成二维码失败:', error); } }, - closePicker() { this.comPickerInfo = { showSheet: false, @@ -204,7 +244,20 @@ formIndex: undefined } }, + groupChange(rv) { + this.model.createType = rv + this.model.Nav_Post = {} + this.model.Nav_Department = {} + this.model.Nav_Area = {} + this.model.discrib = '' + this.model.DEPARTMENT_NAME = '' + this.model.AREA_NAME = '' + this.model.POST_NAME = '' + this.model.DEPARTMENT_ID = '' + this.model.POST_ID = '' + this.model.AREA_ID = '' + }, //显示组件 handleChange() { this.selectorInfo.showPopup = true @@ -270,6 +323,18 @@ } return res.Data }) + } else if (p.name == 'AREA_NAME') { + extendRule(json, "STATUS", 1, 0) + dataSelect = await AreaEntities(json).then(res => { + this.selectorInfo.totalCount = res.TotalCount + if (res != undefined && res.Data.length > 0) { + for (let i = 0; i < res.Data.length; i++) { + res.Data[i].name = res.Data[i].NAME + res.Data[i].code = res.Data[i].CODE + } + } + return res.Data + }) } @@ -298,6 +363,11 @@ this.model.POST_NAME = e.NAME this.model.POST_ID = e.ID this.model.Nav_Post = e + } else if (this.selectorInfo.name == 'AREA_NAME') { + this.model.AREA_NAME = e.NAME + this.model.AREA_ID = e.ID + this.model.Nav_Area = e + this.model.listQrCode = [] } } } diff --git a/services/common.js b/services/common.js index 44c1476..76c81cf 100644 --- a/services/common.js +++ b/services/common.js @@ -26,4 +26,13 @@ export const DepartmentPostEntities = (params) => { method: 'post', data: params, }) +} +//区域信息 +export const AreaEntities = (params) => { + params.isAll=true + return request.send({ + url: '/BI/H5Controller/AreaEntities', + method: 'post', + data: params, + }) } \ No newline at end of file