From 8b6d3c8d029d77e0fbb165e2c25e14d3e3650b62 Mon Sep 17 00:00:00 2001 From: zhangdi <15053473693@163.com> Date: Thu, 21 Nov 2024 15:53:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 11 +- api/api.js | 20 +++- common/betone_components/betone-new-input.vue | 39 +++++-- common/betone_components/betone-upload.vue | 44 ++++++-- pages/register/index.vue | 106 ++++++++++++------ pages/register/registerSuccess.vue | 15 ++- pages/submission/components/subForm.vue | 12 +- pages/submission/index.vue | 1 + pages/submission/recordsdetails.vue | 5 + pages/submission/sendOrders.vue | 104 ++++++++++++----- utils/request.js | 22 ++-- utils/tabbar.js | 2 +- utils/website.js | 45 +------- 13 files changed, 268 insertions(+), 158 deletions(-) diff --git a/App.vue b/App.vue index bc7d070..0500363 100644 --- a/App.vue +++ b/App.vue @@ -2,11 +2,6 @@ export default { onLaunch: function (options) { uni.hideTabBar() - }, - onReady() { - - }, - onShow: function () { console.log("App Show"); const value = uni.getStorageSync("token"); console.log("App Launch", !value); @@ -22,6 +17,12 @@ export default { // 处理用户数据 this.$store.dispatch("changeTabbar", userInfo.role_id); } + }, + onReady() { + + }, + onShow: function () { + }, onHide: function () { diff --git a/api/api.js b/api/api.js index 736718f..a4a9908 100644 --- a/api/api.js +++ b/api/api.js @@ -9,7 +9,17 @@ const install = (Vue, vm) => { let login = (params) => http.post('/blade-auth/oauth/token?' + params) // 退出 let logout = () => http.get('/blade-auth/oauth/logout') - let register = (params, config = {}) => http.post('/blade-auth/oauth/token', params, config) + // 注册 + let registerUser = (params) => http.post('/blade-system/user/register/save-user', params, { + authorization: false, + isparams: true + }) + + // 发送验证码 / + let sendVerify = (params) => http.get('/blade-system/user/register/send-verify-code', params, { + authorization: false, + isparams: true + }) // 首页 let getworkbench = () => http.post('/blade-auth/oauth/token', params, config) @@ -133,23 +143,23 @@ const install = (Vue, vm) => { }) // 需求编辑 editData - let editData = (params) => http.post('/workOrder/update', params, { + let editData = (params) => http.post('/workOrder/update', params, { authorization: false, isparams: false }) // 维修人员驳回 / - let repairReject = (params) => http.post('/workOrder/repairReject', params, { + let repairReject = (params) => http.post('/workOrder/repairReject', params, { authorization: false, isparams: false }) // 申领单提交 / - let applySave = (params) => http.post('/apply/save', params, { + let applySave = (params) => http.post('/apply/save', params, { authorization: false, isparams: false }) // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下 - vm.$u.api = { getTenantInfo, login, logout, register, getworkbench, getLoginRecords, getEditRecords, subEditRecords, getChildList, getDeviceList, workOrderSave, getWorkOrderRecords, getBreakdownInfo, workOrderupdate, evaluateSign, getRepairPersons, getGoodsList, getDictionaryList, getUserList, workList, deviceList,upkeepStat,pieStat,getUserInfo,overview,sendOrders,cloneOrder,editData,repairReject,applySave }; + vm.$u.api = { getTenantInfo, login, logout, registerUser, getworkbench, getLoginRecords, getEditRecords, subEditRecords, getChildList, getDeviceList, workOrderSave, getWorkOrderRecords, getBreakdownInfo, workOrderupdate, evaluateSign, getRepairPersons, getGoodsList, getDictionaryList, getUserList, workList, deviceList, upkeepStat, pieStat, getUserInfo, overview, sendOrders, cloneOrder, editData, repairReject, applySave,sendVerify }; } export default { diff --git a/common/betone_components/betone-new-input.vue b/common/betone_components/betone-new-input.vue index b713fcc..4fc43b6 100644 --- a/common/betone_components/betone-new-input.vue +++ b/common/betone_components/betone-new-input.vue @@ -144,18 +144,19 @@ export default { }, getCode() { if (this.$refs.uCode.canGetCode) { - // 模拟向后端请求验证码 - uni.showLoading({ - title: "正在获取验证码", - }); - setTimeout(() => { - uni.hideLoading(); - // 这里此提示会被this.start()方法中的提示覆盖 - uni.$u.toast("验证码已发送"); - this.$emit("ch"); - // 通知验证码组件内部开始倒计时 - this.$refs.uCode.start(); - }, 2000); + this.$emit("ch"); + // // 模拟向后端请求验证码 + // uni.showLoading({ + // title: "正在获取验证码", + // }); + // setTimeout(() => { + // uni.hideLoading(); + // // 这里此提示会被this.start()方法中的提示覆盖 + // uni.$u.toast("验证码已发送"); + + // // 通知验证码组件内部开始倒计时 + // this.$refs.uCode.start(); + // }, 2000); } else { uni.$u.toast("倒计时结束后再发送"); } @@ -164,8 +165,22 @@ export default { // uni.$u.toast("倒计时结束"); }, start() { + // this.$refs.uCode.start(); // uni.$u.toast("倒计时开始"); }, + sendSuceess(){ + uni.showLoading({ + title: "正在获取验证码", + }); + setTimeout(() => { + uni.hideLoading(); + // 这里此提示会被this.start()方法中的提示覆盖 + uni.$u.toast("验证码已发送"); + + // 通知验证码组件内部开始倒计时 + this.$refs.uCode.start(); + }, 2000); + }, // 数据改变 ch(e) { this.$emit("changevalue", e); diff --git a/common/betone_components/betone-upload.vue b/common/betone_components/betone-upload.vue index 869b441..e9e2279 100644 --- a/common/betone_components/betone-upload.vue +++ b/common/betone_components/betone-upload.vue @@ -8,7 +8,7 @@ - + @@ -79,7 +79,15 @@ export default { success: (res) => { this.$refs.BetLoading.show() // 成功选择图片后的回调 - this.uploadFile(res.tempFilePaths[0]); + const tempFilePaths = res.tempFilePaths; + uni.compressImage({ + src: tempFilePaths[0], // 图片路径 + quality: 50, // 压缩质量,范围为0 - 100,100为不压缩 + success: (compressRes) => { + const compressedFilePath = compressRes.tempFilePath; + this.uploadFile(compressedFilePath); + } + }) }, }); }, @@ -89,20 +97,28 @@ export default { sourceType: ["album", "camera"], success: (res) => { this.$refs.BetLoading.show() + const tempFilePaths = res.tempFilePaths; // 成功选择视频后的回调 - this.uploadFile(res.tempFilePath); + // this.uploadFile(res.tempFilePath); + uni.compressVideo({ //压缩视频 + src:tempFilePaths, + quality:1, + success:(compressRes)=>{ + this.uploadFile(compressRes.tempFilePath); + }, + }) }, }); }, uploadFile(filePath) { uni.uploadFile({ - url: website.baseUrl+"/blade-resource/oss/endpoint/put-file", // 服务器上传接口 + url: website.baseUrl + "/blade-resource/oss/endpoint/put-file", // 服务器上传接口 filePath: filePath, name: "file", // 必须填写,后台用来接收文件 formData: {}, success: (res) => { let info = JSON.parse(res.data); - // console.log("上传成功", info); // 上传成功后的操作 + console.log("上传成功", info); // 上传成功后的操作 this.fileList.push({ 'link': info.data.link, @@ -157,14 +173,16 @@ export default { overflow: hidden; margin-right: 30rpx; position: relative; - // margin-top: 32rpx; + margin-bottom: 32rpx; background: #fff; border: 1px solid rgba(217, 217, 217, 1); + image { width: 100%; height: 100%; } - .video-img{ + + .video-img { width: 50%; height: 50%; margin: auto; @@ -174,6 +192,7 @@ export default { right: 0; bottom: 0; } + .del-icon { position: absolute; top: 8rpx; @@ -197,10 +216,11 @@ export default { border-radius: 10rpx; margin-bottom: 32rpx; } - .icon-close{ - position: absolute; - top: 40rpx; - right: 40rpx; - } + + .icon-close { + position: absolute; + top: 40rpx; + right: 40rpx; + } } \ No newline at end of file diff --git a/pages/register/index.vue b/pages/register/index.vue index 804a8a6..c0ec5fe 100644 --- a/pages/register/index.vue +++ b/pages/register/index.vue @@ -3,41 +3,42 @@ - + - + - + - + - + + + + - + - - - - + + 我已阅读并接受《注册服务协议》及《隐私权政策》 - + 注册 @@ -46,7 +47,7 @@ :showResetting='mapInfo.showResetting' :listIco='mapInfo.listIco' :orientationIco='mapInfo.orientationIco' :resettingIco='mapInfo.resettingIco'> - + \ No newline at end of file diff --git a/pages/submission/index.vue b/pages/submission/index.vue index 0e3801b..c5eb147 100644 --- a/pages/submission/index.vue +++ b/pages/submission/index.vue @@ -37,5 +37,6 @@ export default { background: #efefef; display: flex; flex-direction: column; + } \ No newline at end of file diff --git a/pages/submission/recordsdetails.vue b/pages/submission/recordsdetails.vue index 1d36925..ea0577b 100644 --- a/pages/submission/recordsdetails.vue +++ b/pages/submission/recordsdetails.vue @@ -384,6 +384,11 @@ export default { uni.showToast({ title: "请选择需要申领的物料信息", icon: "none" }); return false } + // 申领物料 数量的判断 + if (this.selectGoodsList.find(item => item.goodsNum == 0)) { + uni.showToast({ title: "申领数量不能为0", icon: "none" }); + return false + } this.selectGoodsList.forEach((item, index) => { data.push({ orderId: this.detailForm.id, diff --git a/pages/submission/sendOrders.vue b/pages/submission/sendOrders.vue index a2e6de4..1e82580 100644 --- a/pages/submission/sendOrders.vue +++ b/pages/submission/sendOrders.vue @@ -105,7 +105,8 @@ - + @@ -166,7 +167,12 @@ export default { data() { return { - userInfo:{},//用户信息 + disabledDates: { + to: new Date() // 禁用今天之前的日期 + }, + minDate: null, + maxDate: null, + userInfo: {},//用户信息 orderId: '',//需求提报id detailForm: {},//详情信息 rules: {}, @@ -232,11 +238,12 @@ export default { this.getRepairPersons()//获取维修人员列表 this.orderId = this.$route.query.id this.getDtails() - this.userInfo = uni.getStorageSync("userinfo"); + this.userInfo = uni.getStorageSync("userinfo"); // 维修人员 获取物料选择 if (this.dataTypes == 4) { this.getGoodsList() } + this.initDate() }, methods: { getDtails() { @@ -394,35 +401,39 @@ export default { customerOpinion: this.detailForm.customerOpinion } // 判断是否申领物料 调用申领接口 - if (this.sendOrder.isNeedMaterials == 1) { - // 申领物料 数量的判断 - // if (this.sendOrder.materialsData.find(item => item.goodsNum == 0)) { - // uni.showToast({ title: "申领数量不能为0", icon: "none" }); - // } - let data = [] - console.log('this.materialsData', this.sendOrder.materialsData) - this.sendOrder.materialsData.map(item => { - data.push({ - productId: item.productName,//物资id - productName: item.name, //物资名称 - brand: item.brand,//品牌 - xh: item.xh,//型号 - rule: item.rule,//参数 - applyNum: item.applyNum,//领用数量 - }) - }) - let query1 = { - details: data, - applyUserId: this.userInfo.user_id, //申领人Id - applyUser: this.userInfo.user_name, //申领人 - applyTime: dateFormat("yyyy-MM-dd hh:mm:ss", new Date()),//申领时间(yyyy-MM-dd HH:mm:ss) - status: 0, - workId: this.orderId, - } - this.$u.api.applySave(query1).then(res => { - + if (this.sendOrder.isNeedMaterials == 1 && this.sendOrder.materialsData.length <= 0) { + uni.showToast({ title: "请选择需要的申领材料", icon: "none" }); + return false + } + // 申领物料 数量的判断 + if (this.sendOrder.materialsData.find(item => item.goodsNum == 0)) { + uni.showToast({ title: "申领数量不能为0", icon: "none" }); + return false + } + let data = [] + console.log('this.materialsData', this.sendOrder.materialsData) + this.sendOrder.materialsData.map(item => { + data.push({ + productId: item.productName,//物资id + productName: item.name, //物资名称 + brand: item.brand,//品牌 + xh: item.xh,//型号 + rule: item.rule,//参数 + applyNum: item.applyNum,//领用数量 }) + }) + let query1 = { + details: data, + applyUserId: this.userInfo.user_id, //申领人Id + applyUser: this.userInfo.user_name, //申领人 + applyTime: dateFormat("yyyy-MM-dd hh:mm:ss", new Date()),//申领时间(yyyy-MM-dd HH:mm:ss) + status: 0, + workId: this.orderId, } + this.$u.api.applySave(query1).then(res => { + + }) + this.$u.api.editData(query).then(res => { if (res.code == 200) { uni.showToast({ title: "派单成功", icon: "none" }); @@ -454,6 +465,39 @@ export default { }) }, + initDate() { + + let date = new Date(); + let year = date.getFullYear(); + + let month = date.getMonth() + 1; + + let day = date.getDate(); + + if (month < 10) { + + month = "0" + month; + + } + + if (day < 10) { + + day = "0" + day; + } + + let minyear = year - 1; + + this.minDate = minyear + "-" + month + "-" + day; + + //let maxyear = year + 1; + + this.maxDate = year + 1 + "-" + month + "-" + day; // 最大日期可选到一年后 + + //this.maxDate = year  + '-'+ month +'-' + day; // 最大日期可选到今天 + + }, + + } } diff --git a/utils/request.js b/utils/request.js index 8b9413e..f25083b 100644 --- a/utils/request.js +++ b/utils/request.js @@ -56,9 +56,11 @@ const install = (Vue, vm) => { // 响应拦截,判断状态码是否通过 Vue.prototype.$u.http.interceptor.response = (res) => { - const data = res.data - let status = res.data ? res.data.code : (res.error_code ? res.error_code : ''); - const message = res.data ? res.data.msg || res.error_description || '未知错误' : ''; + console.log('接口返回拦截',res) + const data = res + let status = res.code || res.status; + const message = res.msg || res.error_description || '未知错误'; + if (!!res.error_code) { uni.showToast({ title: res.error_description, @@ -81,13 +83,13 @@ const install = (Vue, vm) => { // return false; // } // // 如果请求为非200否者默认统一处理 - // if (status !== 200) { - // uni.showToast({ - // title: message, - // icon: 'none' - // }); - // return false; - // } + if (status !== 200) { + uni.showToast({ + title: message, + icon: 'none' + }); + return false; + } return res; // if(res.code == 200) { // // res为服务端返回值,可能有code,result等字段 diff --git a/utils/tabbar.js b/utils/tabbar.js index 3a2be92..125d178 100644 --- a/utils/tabbar.js +++ b/utils/tabbar.js @@ -55,7 +55,7 @@ const repair = [{ }, { iconPath: "setting", selectedIconPath: "setting-fill", - text: "维修任务", + text: "维保任务", pagePath: "/pages/inspection/quest", }, { iconPath: "account", diff --git a/utils/website.js b/utils/website.js index c93636c..6accd01 100644 --- a/utils/website.js +++ b/utils/website.js @@ -2,51 +2,12 @@ * 全局配置文件 */ export default { - baseUrl:'http://124.221.142.15:8088/lab', - title: "", - logo: "S", - key: "saber", //配置主键,目前用于存储 + // baseUrl: 'http://124.221.142.15:8088/lab', + baseUrl:'http://192.168.0.111:80', indexTitle: "科研医疗建筑运维平台", clientId: "saber", // 客户端id clientSecret: "saber_secret", // 客户端密钥 - tenantMode: true, // 是否开启租户模式 - tenantId: "000000", // 管理组租户编号 - captchaMode: true, // 是否开启验证码模式 - switchMode: false, // 是否开启部门切换模式 - lockPage: "/lock", tokenTime: 3000, tokenHeader: "Blade-Auth", - //http的status默认放行列表 - statusWhiteList: [], - //配置首页不可关闭 - isFirstPage: false, - fistPage: { - label: "首页", - value: "/wel/index", - params: {}, - query: {}, - meta: { - i18n: "dashboard", - }, - group: [], - close: false, - }, - //配置菜单的属性 - menu: { - iconDefault: "iconfont icon-caidan", - props: { - label: "name", - path: "path", - icon: "source", - children: "children", - }, - }, - // 第三方系统授权地址 - authUrl: "http://localhost/blade-auth/oauth/render", - // 报表设计器地址(cloud端口为8108,boot端口为80) - reportUrl: "http://localhost:8108/ureport", - // 单点登录系统认证(blade-auth服务的地) - ssoUrl: "http://localhost:8100/oauth/authorize?client_id=saber&response_type=code&redirect_uri=", - // 单点登录回调地址(Saber服务的地址) - redirectUri: "http://localhost:1888", + }; \ No newline at end of file