From 31f0e0e5cb6668ef277663c6ac97f6f13f69a9a0 Mon Sep 17 00:00:00 2001 From: wyw <571921741@qq.com> Date: Wed, 23 Apr 2025 11:23:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=20=E6=B7=BB=E5=8A=A0=20qrcod?= =?UTF-8?q?e=5Furl=20onReady()=20=E6=B3=A8=E9=87=8A=20=E5=90=84=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=20=E5=8A=9F=E8=83=BD=E5=AE=9E=E7=8E=B0=20=20=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E4=BC=A0=E5=8F=82=20=E6=A0=B9=E6=8D=AE=E4=BC=A0?= =?UTF-8?q?=E5=8F=82=20=E8=8E=B7=E5=8F=96=E4=BF=A1=E6=81=AF=20=E5=85=AC?= =?UTF-8?q?=E5=85=B1=E6=96=B9=E6=B3=95=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/common.js | 14 +- pages/apply/complete.vue | 2 +- pages/apply/index.vue | 20 ++- pages/apply/qrcodeMake.vue | 2 +- pages/apply/user.vue | 11 +- pages/apply/viewCheck.vue | 8 +- pages/apply/viewEvaluation.vue | 8 +- pages/apply/viewRisk.vue | 9 +- pages/apply/viewVideo.vue | 8 +- pages/index/index.vue | 278 ++++++++++++++++++++++----------- utils/request.js | 24 +-- 11 files changed, 244 insertions(+), 140 deletions(-) diff --git a/config/common.js b/config/common.js index 14d5300..76900fb 100644 --- a/config/common.js +++ b/config/common.js @@ -101,7 +101,8 @@ if (process.env.CUSTOM_PLATFORM === "dev") { uni_app_web_api_url: "http://localhost", // 请求接口的地址 uni_app_web_source_url: "http://localhost:3199", // 资源地址 uni_app_web_local_api_url: "http://localhost", // 请求接口的地址 - uni_app_url: "http://47.122.43.22:9100" + uni_app_url: "http://47.122.43.22:9100", + qrcode_url: "http://47.122.43.22:9201" } } else if (process.env.CUSTOM_PLATFORM === "test") { //测试环境 @@ -115,7 +116,8 @@ if (process.env.CUSTOM_PLATFORM === "dev") { uni_app_web_api_url: "http://47.122.43.22", // 请求接口的地址 uni_app_web_source_url: "http://47.122.43.22:3199", // 资源地址 uni_app_web_local_api_url: "http://47.122.43.22", // 请求接口的地址 - uni_app_url: "http://47.122.43.22:9100" + uni_app_url: "http://47.122.43.22:9100", + qrcode_url: "http://47.122.43.22:9201" } } else //生产环境 发布等 @@ -128,9 +130,11 @@ if (process.env.CUSTOM_PLATFORM === "dev") { uni_app_web_url: "", uni_app_web_api_url: APP_ENV === 'release' ? "http://xmmhe.com" : "http://47.122.43.22", uni_app_web_source_url: APP_ENV === 'release' ? "http://xmmhe.com:3199" : "http://47.122.43.22:3199", - uni_app_web_local_api_url: APP_ENV === 'release' ? "http://xmmhe.com" : "http://47.122.43.22", //打包测试: 47.122.43.22 开发可 localhost - uni_app_url: APP_ENV === 'release' ? "http://xmmhe.com:9100" : "http:// 47.122.43.22:9100" //打包测试: 47.122.43.22 开发可 localhost - + qrcode_url: APP_ENV === 'release' ? "http://xmmhe.com:9201" : "http://47.122.43.22:9201", + uni_app_url: APP_ENV === 'release' ? "http://xmmhe.com:9100" : + "http://47.122.43.22:9100", //打包测试: 47.122.43.22 开发可 localhost + uni_app_web_local_api_url: APP_ENV === 'release' ? "http://xmmhe.com" : + "http://47.122.43.22" //打包测试: 47.122.43.22 开发可 localhost } export default configURL \ No newline at end of file diff --git a/pages/apply/complete.vue b/pages/apply/complete.vue index ff4a575..5baf1fd 100644 --- a/pages/apply/complete.vue +++ b/pages/apply/complete.vue @@ -45,7 +45,7 @@ } }, - onReady() {}, + // onReady() {}, methods: { submit() { // uni.navigateBack({ diff --git a/pages/apply/index.vue b/pages/apply/index.vue index 42b7219..4621e50 100644 --- a/pages/apply/index.vue +++ b/pages/apply/index.vue @@ -131,7 +131,25 @@ switchVal: false } }, - onLoad() {}, + + onLoad(option) { + // this.model.ID = option.ID + // this.model.TaskID = option.taskID + // this.TaskID = option.taskID + // this.tableKey = option.tableKey + // this.ORG_ID = uni.getStorageSync('orgId') + // if (option.ID != null && option.ID != 'null') { + // this.loadData() + // } else { + // this.isLoadOK = true + // this.model.ID = guid() + // this.model.ORG_ID = this.ORG_ID + // this.isDIY = true + // this.listPropValUpload.push(this.model.ID) + // // this.model.Nav_ListSafeCheckDetail = null + // } + }, + onReady() { //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。 this.$refs.uForm.setRules(this.rules) diff --git a/pages/apply/qrcodeMake.vue b/pages/apply/qrcodeMake.vue index bdbf2ae..13e111e 100644 --- a/pages/apply/qrcodeMake.vue +++ b/pages/apply/qrcodeMake.vue @@ -102,7 +102,7 @@ AREA_NAME: '', AREA_ID: '', Nav_Area: {}, - Url: config.uni_app_web_api_url, + Url: config.qrcode_url, listQrCode: [{ TITLE: '', qrCode: '' diff --git a/pages/apply/user.vue b/pages/apply/user.vue index 6dbb5bd..b57992d 100644 --- a/pages/apply/user.vue +++ b/pages/apply/user.vue @@ -186,13 +186,14 @@ onLoad(option) { this.model.DEPARTMENT_ID = option.DEPARTMENT_ID // 'B18F95F4-572A-E521-1412-FA8CE50DC98A' this.OrgId = option.OrgId // 'B043B28B-BBC3-C452-6052-4FBA1457ABFA' - this.WorkerScheduling() + if (!this.model.DEPARTMENT_ID && this.model.DEPARTMENT_ID.length > 1) + this.WorkerScheduling() }, - onReady() { - //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。 - this.$refs.uForm.setRules(this.rules) - }, + // onReady() { + // //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。 + // this.$refs.uForm.setRules(this.rules) + // }, methods: { WorkerScheduling() { const modelRequest = { diff --git a/pages/apply/viewCheck.vue b/pages/apply/viewCheck.vue index db2b2c1..fbafd4e 100644 --- a/pages/apply/viewCheck.vue +++ b/pages/apply/viewCheck.vue @@ -139,10 +139,10 @@ }) } }, - onReady() { - //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。 - this.$refs.uForm.setRules(this.rules) - }, + // onReady() { + // //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。 + // this.$refs.uForm.setRules(this.rules) + // }, methods: { PagedCheckMain(paginate) { this.pageIndex++ diff --git a/pages/apply/viewEvaluation.vue b/pages/apply/viewEvaluation.vue index e2cd49f..b56c6c7 100644 --- a/pages/apply/viewEvaluation.vue +++ b/pages/apply/viewEvaluation.vue @@ -137,10 +137,10 @@ }) } }, - onReady() { - //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。 - this.$refs.uForm.setRules(this.rules) - }, + // onReady() { + // //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。 + // this.$refs.uForm.setRules(this.rules) + // }, methods: { PagedCheckMain(paginate) { this.pageIndex++ diff --git a/pages/apply/viewRisk.vue b/pages/apply/viewRisk.vue index 431f48a..17c7c30 100644 --- a/pages/apply/viewRisk.vue +++ b/pages/apply/viewRisk.vue @@ -127,7 +127,6 @@ if (this.model.RISK_AREA_ID != undefined && this.model.RISK_AREA_ID != '') { this.PagedRisk() //扫二维码 默认赋值 - const json = initFilter(this.OrgId, null, "NAME", 0, 1); json.IgnoreDataRule = true json.Limit = 2 @@ -139,10 +138,10 @@ }) } }, - onReady() { - //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。 - this.$refs.uForm.setRules(this.rules) - }, + // onReady() { + // //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。 + // this.$refs.uForm.setRules(this.rules) + // }, methods: { PagedRisk(paginate) { this.pageIndex++ diff --git a/pages/apply/viewVideo.vue b/pages/apply/viewVideo.vue index facdccb..92c4763 100644 --- a/pages/apply/viewVideo.vue +++ b/pages/apply/viewVideo.vue @@ -137,10 +137,10 @@ }) } }, - onReady() { - //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。 - this.$refs.uForm.setRules(this.rules) - }, + // onReady() { + // //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。 + // this.$refs.uForm.setRules(this.rules) + // }, methods: { PagedCheckMain(paginate) { this.pageIndex++ diff --git a/pages/index/index.vue b/pages/index/index.vue index 31216b4..8c578c0 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,19 +1,31 @@ @@ -26,43 +38,94 @@ export default { data() { return { - DEPARTMENT_ID: '',//'B18F95F4-572A-E521-1412-FA8CE50DC98A', - RISK_AREA_ID: '',//8EB0A653-E785-46D9-B65E-17F49E77121E', + DEPARTMENT_ID: '', //'B18F95F4-572A-E521-1412-FA8CE50DC98A', + RISK_AREA_ID: '', //8EB0A653-E785-46D9-B65E-17F49E77121E', + POST_ID: '', OrgId: '', - baseList: [{ - name: "新增用户", - iconName: "man-add" - }, - // { - // name: "风险区域明细", - // iconName: "order" - // }, - // { - // name: "区域风险四色图", - // iconName: "list-dot" - // }, - // { - // name: "区域隐患数量", - // iconName: "info-circle" - // }, - ], - company: '' + NAME: '', + createType: '', + uni_app_web_local_api_url: config.uni_app_web_local_api_url, + baseList: [], + company: '', + dataLists: [{ + name: '行洛坑', + code: 'XLK', + id: 'B043B28B-BBC3-C452-6052-4FBA1457ABFA', + tenantId: '0001' + }, { + name: '都昌金鼎', + code: 'DCJD', + id: '8B3C41AA-51B1-7CE9-1879-248A038C1B5C', + tenantId: 'A0000025' + }, { + name: '洛阳豫鹭', + code: 'LYYL', + id: 'D9871BA8-0EEC-9E4A-BB87-7D5A540D8913', + tenantId: 'A0000024' + }, { + name: '广西博白', + code: 'GXBB', + id: '3EFD5276-632B-E379-9FF3-7A7546591FCA', + tenantId: 'A0000028' + }], + selectorInfo: { + showPopup: false, + title: '检查人员', + itemData: {}, + index: 0, + dataLists: [], + defaultText: '', + defaultValue: '', + name: '', + defaultChecked: [] + }, } }, - onShow() { - const pages = getCurrentPages() - const currentPage = pages[pages.length - 1] - const Options = currentPage.options - uni.setStorageSync('Company', Options.Company ? Options.Company : 'XLK') + // onShow() { + // const pages = getCurrentPages() + // const currentPage = pages[pages.length - 1] + // const Options = currentPage.options + // uni.setStorageSync('Company', Options.Company ? Options.Company : 'XLK') + // }, + onLoad(option) { + if (option.OrgId && option.OrgId.length > 0) { + this.OrgId = option.OrgId + this.createType = option.createType + this.RISK_AREA_ID = option.AREA_ID + this.DEPARTMENT_ID = option.DEPARTMENT_ID + this.POST_ID = option.POST_ID + } else { + var paraString = location.search; //.substring(1, location.search.length - 1); + if (paraString && paraString.length > 1) { + var paras = paraString.split("&"); + paras.forEach(e => { + if (e.indexOf("OrgId") > -1) { + this.OrgId = e.split('=')[1] + } else if (e.indexOf("createType") > -1) { + this.createType = e.split('=')[1] + } else if (e.indexOf("AREA_ID") > -1) { + this.RISK_AREA_ID = e.split('=')[1] + } else if (e.indexOf("DEPARTMENT_ID") > -1) { + this.DEPARTMENT_ID = e.split('=')[1] + } else if (e.indexOf("POST_ID") > -1) { + this.POST_ID = e.split('=')[1] + } + }) + } else { + //出现公司选择 + } + } + // createType '区域'10 '岗位'20 + if (this.OrgId && this.OrgId.length > 1) + this.getCaidan() }, - onLoad() { - this.getCaidan() - }, + //页面跳转到APP onNavigationBarButtonTap(e) { - let url = 'http://47.122.43.22:9100/' + let urlTo = this.uni_app_web_local_api_url + ':9100/' + //let urlTo ='http://localhost:8000/' //本地是8000 uni.navigateTo({ - url: '/pages/webview/webview?url=' + url + url: '/pages/webview/webview?url=' + urlTo }) }, methods: { @@ -80,53 +143,52 @@ menuClick(menuInfo) { uni.navigateTo({ - url: menuInfo.url + '?DEPARTMENT_ID=' + this.DEPARTMENT_ID + '&OrgId=' + menuInfo.ORG_ID+'&RISK_AREA_ID='+this.RISK_AREA_ID + url: menuInfo.url + '?OrgId=' + menuInfo.ORG_ID + + '&RISK_AREA_ID=' + this.RISK_AREA_ID + '&DEPARTMENT_ID=' + this.DEPARTMENT_ID }) }, - goCamera() { - // uni.chooseImage({ - // count: 6, //默认9 - // sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 - // sourceType: ['camera'], - // success: (res) => { - // const url = config.serviceHost('/PF/File/UploadFile') - // request.upload(url, res.tempFilePaths).then((result) => { - // if (result.IsSuccessful) { - // // TODO: 目前只支持一张照片 - // store.commit('updateImageLists', [{ - // IMG_FILE_ID: result.Data.imgFileID, - // IMG_FILE_PATH: result.Data.imgFilePath - // }]); - // uni.showActionSheet({ - // title: '选择上报类型', - // itemList: ['随手拍', '隐患上报'], - // success: (e) => { - // if (e.tapIndex === 0) { - // uni.navigateTo({ - // url: '/pages/camera/index' - // }) - // } else { - // uni.navigateTo({ - // url: '/pages/apply/subPages/riskReport' - // }) - // } - // } - // }) - // } - // }).catch((error) => { - // console.log(error) - // }); - // }, - // complete: function(com) { - // console.log('choose image complete', com) - // } - // }) - }, + // goCamera() { + // // uni.chooseImage({ + // // count: 6, //默认9 + // // sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + // // sourceType: ['camera'], + // // success: (res) => { + // // const url = config.serviceHost('/PF/File/UploadFile') + // // request.upload(url, res.tempFilePaths).then((result) => { + // // if (result.IsSuccessful) { + // // // TODO: 目前只支持一张照片 + // // store.commit('updateImageLists', [{ + // // IMG_FILE_ID: result.Data.imgFileID, + // // IMG_FILE_PATH: result.Data.imgFilePath + // // }]); + // // uni.showActionSheet({ + // // title: '选择上报类型', + // // itemList: ['随手拍', '隐患上报'], + // // success: (e) => { + // // if (e.tapIndex === 0) { + // // uni.navigateTo({ + // // url: '/pages/camera/index' + // // }) + // // } else { + // // uni.navigateTo({ + // // url: '/pages/apply/subPages/riskReport' + // // }) + // // } + // // } + // // }) + // // } + // // }).catch((error) => { + // // console.log(error) + // // }); + // // }, + // // complete: function(com) { + // // console.log('choose image complete', com) + // // } + // // }) + // }, getCaidan() { const json = { - Company: uni.getStorageSync('Company'), - Post: '搬运工', - Type: 1 + OrgId: this.OrgId } getMenu(json).then((res) => { this.baseList = res.data @@ -136,15 +198,52 @@ icon: 'none' }) }) - } + }, + //显示组件 + handleChange() { + if (!this.OrgId || this.OrgId.length < 2) { + this.selectorInfo.showPopup = true + this.selectorInfo.title = '公司选择' + this.handleSearch() + } + }, + + //数据加载 + handleSearch(val) { + this.selectorInfo.dataLists = this.dataLists + // const orgId = uni.getStorageSync('orgId') + // const json = initFilter(orgId, "", "", 0) + // if (val) { + // extendRule(json, 'NAME', 9, val); + // } + // OrderPagedUseful2(json).then(res => { + // this.selectorInfo.dataLists = res.Data.map(i => { + // return { + // ...i, + // name: i.NAME, + // code: i.CODE + // } + // }) + // }) + }, + + handleSelected(e) { + this.selectorInfo.showPopup = false + this.OrgId = e.id + this.NAME = e.name + uni.setStorageSync('tenantId', e.tenantId) + if (this.OrgId && this.OrgId.length > 1) + this.getCaidan() + } } }