配置 添加 qrcode_url

onReady() 注释
各页面 功能实现  动态传参 根据传参 获取信息
公共方法 优化
This commit is contained in:
wyw 2025-04-23 11:23:34 +08:00
parent 8b56fdc24e
commit 31f0e0e5cb
11 changed files with 244 additions and 140 deletions

View File

@ -101,7 +101,8 @@ if (process.env.CUSTOM_PLATFORM === "dev") {
uni_app_web_api_url: "http://localhost", // 请求接口的地址 uni_app_web_api_url: "http://localhost", // 请求接口的地址
uni_app_web_source_url: "http://localhost:3199", // 资源地址 uni_app_web_source_url: "http://localhost:3199", // 资源地址
uni_app_web_local_api_url: "http://localhost", // 请求接口的地址 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") { } 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_api_url: "http://47.122.43.22", // 请求接口的地址
uni_app_web_source_url: "http://47.122.43.22:3199", // 资源地址 uni_app_web_source_url: "http://47.122.43.22:3199", // 资源地址
uni_app_web_local_api_url: "http://47.122.43.22", // 请求接口的地址 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 } else
//生产环境 发布等 //生产环境 发布等
@ -128,9 +130,11 @@ if (process.env.CUSTOM_PLATFORM === "dev") {
uni_app_web_url: "", uni_app_web_url: "",
uni_app_web_api_url: APP_ENV === 'release' ? "http://xmmhe.com" : "http://47.122.43.22", 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_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 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_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 export default configURL

View File

@ -45,7 +45,7 @@
} }
}, },
onReady() {}, // onReady() {},
methods: { methods: {
submit() { submit() {
// uni.navigateBack({ // uni.navigateBack({

View File

@ -131,7 +131,25 @@
switchVal: false 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() { onReady() {
//setRules //setRules
this.$refs.uForm.setRules(this.rules) this.$refs.uForm.setRules(this.rules)

View File

@ -102,7 +102,7 @@
AREA_NAME: '', AREA_NAME: '',
AREA_ID: '', AREA_ID: '',
Nav_Area: {}, Nav_Area: {},
Url: config.uni_app_web_api_url, Url: config.qrcode_url,
listQrCode: [{ listQrCode: [{
TITLE: '', TITLE: '',
qrCode: '' qrCode: ''

View File

@ -186,13 +186,14 @@
onLoad(option) { onLoad(option) {
this.model.DEPARTMENT_ID = option.DEPARTMENT_ID // 'B18F95F4-572A-E521-1412-FA8CE50DC98A' this.model.DEPARTMENT_ID = option.DEPARTMENT_ID // 'B18F95F4-572A-E521-1412-FA8CE50DC98A'
this.OrgId = option.OrgId // 'B043B28B-BBC3-C452-6052-4FBA1457ABFA' 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() { // onReady() {
//setRules // //setRules
this.$refs.uForm.setRules(this.rules) // this.$refs.uForm.setRules(this.rules)
}, // },
methods: { methods: {
WorkerScheduling() { WorkerScheduling() {
const modelRequest = { const modelRequest = {

View File

@ -139,10 +139,10 @@
}) })
} }
}, },
onReady() { // onReady() {
//setRules // //setRules
this.$refs.uForm.setRules(this.rules) // this.$refs.uForm.setRules(this.rules)
}, // },
methods: { methods: {
PagedCheckMain(paginate) { PagedCheckMain(paginate) {
this.pageIndex++ this.pageIndex++

View File

@ -137,10 +137,10 @@
}) })
} }
}, },
onReady() { // onReady() {
//setRules // //setRules
this.$refs.uForm.setRules(this.rules) // this.$refs.uForm.setRules(this.rules)
}, // },
methods: { methods: {
PagedCheckMain(paginate) { PagedCheckMain(paginate) {
this.pageIndex++ this.pageIndex++

View File

@ -127,7 +127,6 @@
if (this.model.RISK_AREA_ID != undefined && this.model.RISK_AREA_ID != '') { if (this.model.RISK_AREA_ID != undefined && this.model.RISK_AREA_ID != '') {
this.PagedRisk() // this.PagedRisk() //
const json = initFilter(this.OrgId, null, "NAME", 0, 1); const json = initFilter(this.OrgId, null, "NAME", 0, 1);
json.IgnoreDataRule = true json.IgnoreDataRule = true
json.Limit = 2 json.Limit = 2
@ -139,10 +138,10 @@
}) })
} }
}, },
onReady() { // onReady() {
//setRules // //setRules
this.$refs.uForm.setRules(this.rules) // this.$refs.uForm.setRules(this.rules)
}, // },
methods: { methods: {
PagedRisk(paginate) { PagedRisk(paginate) {
this.pageIndex++ this.pageIndex++

View File

@ -137,10 +137,10 @@
}) })
} }
}, },
onReady() { // onReady() {
//setRules // //setRules
this.$refs.uForm.setRules(this.rules) // this.$refs.uForm.setRules(this.rules)
}, // },
methods: { methods: {
PagedCheckMain(paginate) { PagedCheckMain(paginate) {
this.pageIndex++ this.pageIndex++

View File

@ -1,19 +1,31 @@
<template> <template>
<view class="content"> <view class="content">
<view class="list"> <u-form>
<u-grid :border="false" :col="2"> <!-- @click="click" --> <view>
<u-grid-item v-for="(baseListItem,baseListIndex) in baseList" :key="baseListIndex" bgColor="#fff">
<u-icon :customStyle="{paddingTop:20+'rpx'}" :name="baseListItem.iconName" :size="42"
@click="menuClick(baseListItem)" color="#304ffe"></u-icon>
<text class="grid-text">{{baseListItem.name}}</text>
</u-grid-item>
</u-grid>
<view style="display: flex;flex-direction: row;" class="home-button">
<!-- <u-button type="primary" @click="reset" color="#3d4b70" :plain="true" style="margin-right: 5px;">重置</u-button> -->
<u-button type="primary" @click="goCamera" color="#3d4b70">隐患随手拍</u-button>
</view>
</view> <u-form-item label="公司名称" @click="handleChange()" label-width='150px' style="margin: 0 20px 0 30px;"
prop="OrgId" borderBottom>
<u--input disabledColor="#fff" v-model="NAME" placeholder="请选择公司名称" border="none"
inputAlign="right"></u--input>
<u-icon v-if="!OrgId||OrgId.length<1" style="margin-left: 4px;" slot="right"
name="arrow-down"></u-icon>
</u-form-item>
</view>
<view class="list">
<u-grid :border="false" :col="2">
<u-grid-item v-for="(baseListItem,baseListIndex) in baseList" :key="baseListIndex" bgColor="#fff">
<u-icon :customStyle="{paddingTop:20+'rpx'}" :name="baseListItem.iconName" :size="42"
@click="menuClick(baseListItem)" color="#304ffe"></u-icon>
<text class="grid-text">{{baseListItem.name}}</text>
</u-grid-item>
</u-grid>
</view>
</u-form>
<query-selector :show="selectorInfo.showPopup" :defaultChecked="selectorInfo.defaultChecked"
:title="selectorInfo.title" :lists="selectorInfo.dataLists" @search="handleSearch" @select="handleSelected"
@close="selectorInfo.showPopup=false" />
</view> </view>
</template> </template>
@ -26,43 +38,94 @@
export default { export default {
data() { data() {
return { return {
DEPARTMENT_ID: '',//'B18F95F4-572A-E521-1412-FA8CE50DC98A', DEPARTMENT_ID: '', //'B18F95F4-572A-E521-1412-FA8CE50DC98A',
RISK_AREA_ID: '',//8EB0A653-E785-46D9-B65E-17F49E77121E', RISK_AREA_ID: '', //8EB0A653-E785-46D9-B65E-17F49E77121E',
POST_ID: '',
OrgId: '', OrgId: '',
baseList: [{ NAME: '',
name: "新增用户", createType: '',
iconName: "man-add" uni_app_web_local_api_url: config.uni_app_web_local_api_url,
}, baseList: [],
// { company: '',
// name: "", dataLists: [{
// iconName: "order" name: '行洛坑',
// }, code: 'XLK',
// { id: 'B043B28B-BBC3-C452-6052-4FBA1457ABFA',
// name: "", tenantId: '0001'
// iconName: "list-dot" }, {
// }, name: '都昌金鼎',
// { code: 'DCJD',
// name: "", id: '8B3C41AA-51B1-7CE9-1879-248A038C1B5C',
// iconName: "info-circle" tenantId: 'A0000025'
// }, }, {
], name: '洛阳豫鹭',
company: '' 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() { // onShow() {
const pages = getCurrentPages() // const pages = getCurrentPages()
const currentPage = pages[pages.length - 1] // const currentPage = pages[pages.length - 1]
const Options = currentPage.options // const Options = currentPage.options
uni.setStorageSync('Company', Options.Company ? Options.Company : 'XLK') // 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) { 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({ uni.navigateTo({
url: '/pages/webview/webview?url=' + url url: '/pages/webview/webview?url=' + urlTo
}) })
}, },
methods: { methods: {
@ -80,53 +143,52 @@
menuClick(menuInfo) { menuClick(menuInfo) {
uni.navigateTo({ 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() { // goCamera() {
// uni.chooseImage({ // // uni.chooseImage({
// count: 6, //9 // // count: 6, //9
// sizeType: ['original', 'compressed'], // // // sizeType: ['original', 'compressed'], //
// sourceType: ['camera'], // // sourceType: ['camera'],
// success: (res) => { // // success: (res) => {
// const url = config.serviceHost('/PF/File/UploadFile') // // const url = config.serviceHost('/PF/File/UploadFile')
// request.upload(url, res.tempFilePaths).then((result) => { // // request.upload(url, res.tempFilePaths).then((result) => {
// if (result.IsSuccessful) { // // if (result.IsSuccessful) {
// // TODO: // // // TODO:
// store.commit('updateImageLists', [{ // // store.commit('updateImageLists', [{
// IMG_FILE_ID: result.Data.imgFileID, // // IMG_FILE_ID: result.Data.imgFileID,
// IMG_FILE_PATH: result.Data.imgFilePath // // IMG_FILE_PATH: result.Data.imgFilePath
// }]); // // }]);
// uni.showActionSheet({ // // uni.showActionSheet({
// title: '', // // title: '',
// itemList: ['', ''], // // itemList: ['', ''],
// success: (e) => { // // success: (e) => {
// if (e.tapIndex === 0) { // // if (e.tapIndex === 0) {
// uni.navigateTo({ // // uni.navigateTo({
// url: '/pages/camera/index' // // url: '/pages/camera/index'
// }) // // })
// } else { // // } else {
// uni.navigateTo({ // // uni.navigateTo({
// url: '/pages/apply/subPages/riskReport' // // url: '/pages/apply/subPages/riskReport'
// }) // // })
// } // // }
// } // // }
// }) // // })
// } // // }
// }).catch((error) => { // // }).catch((error) => {
// console.log(error) // // console.log(error)
// }); // // });
// }, // // },
// complete: function(com) { // // complete: function(com) {
// console.log('choose image complete', com) // // console.log('choose image complete', com)
// } // // }
// }) // // })
}, // },
getCaidan() { getCaidan() {
const json = { const json = {
Company: uni.getStorageSync('Company'), OrgId: this.OrgId
Post: '搬运工',
Type: 1
} }
getMenu(json).then((res) => { getMenu(json).then((res) => {
this.baseList = res.data this.baseList = res.data
@ -136,15 +198,52 @@
icon: 'none' 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()
}
} }
} }
</script> </script>
<style> <style>
.content { .content {
background-color: #f4f7ff; /* background-color: #f4f7ff; */
background-color: rgb(246, 250, 255);
width: 100%; width: 100%;
/* #ifndef APP-PLUS */ /* #ifndef APP-PLUS */
height: calc(100vh - 44px - 50px); // APP height: calc(100vh - 44px - 50px); // APP
@ -178,7 +277,8 @@
width: 100%; width: 100%;
padding: 10px 36px; padding: 10px 36px;
box-sizing: border-box; box-sizing: border-box;
background: #f4f7ff; /* background: #f4f7ff; */
background: rgb(246, 250, 255);
z-index: 999; z-index: 999;
} }

View File

@ -5,22 +5,9 @@ import handle401 from './handle401'
export default { export default {
send(params) { send(params) {
const pages = getCurrentPages() let tenantId = uni.getStorageSync('tenantId')
const currentPage = pages[pages.length - 1] if (!tenantId || tenantId.length < 2)
const Options = currentPage.options
let Company = Options.Company ? Options.Company : 'XLK'
let tenantId = ''
if (Company == 'DCJD') {
tenantId = 'A0000025'
} else if (Company == 'GXBB') {
tenantId = 'A0000028'
} else if (Company == 'LYYL') {
tenantId = 'A0000024'
} else if (Company == 'LYXT') {
tenantId = '0002'
} else {
tenantId = '0001' tenantId = '0001'
}
let url = params.url; let url = params.url;
let method = params.method || "get"; let method = params.method || "get";
let data = params.data || {}; let data = params.data || {};
@ -28,11 +15,7 @@ export default {
if (params.isAll) if (params.isAll)
isAll = params.isAll isAll = params.isAll
let header = { let header = {
// 'Blade-Auth': uni.getStorageSync('token') || '', 'Content-Type': params.method === 'post' ? 'application/json' : 'application/json;charset=UTF-8',
// 'Content-Type': type === 'post' ? 'application/json' : 'application/x-www-form-urlencoded',// 'Content-Type': 'application/json;charset=UTF-8',
// 'Content-Type': 'application/json;charset=UTF-8',
'Content-Type': params.method === 'post' ? 'application/json' : 'application/json;charset=UTF-8',
// 'Authorization': 'Basic c2FiZXI6c2FiZXJfc2VjcmV0',
'Tenant': tenantId, // avue配置相关 'Tenant': tenantId, // avue配置相关
...params.header ...params.header
} }
@ -47,7 +30,6 @@ export default {
const res = response const res = response
// 根据返回的状态码做出对应的操作 // 根据返回的状态码做出对应的操作
//获取成功 //获取成功
// console.log(res.statusCode);
if (res.statusCode == 200) { if (res.statusCode == 200) {
if (isAll) if (isAll)
resolve(res); resolve(res);