From 64ca9137cba5d270de81ace201ed6716bc873e17 Mon Sep 17 00:00:00 2001 From: chen <2659004835@qq.com> Date: Thu, 31 Mar 2022 18:34:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=B7=A5=E5=8D=95=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=AD=BE=E5=88=B0=E6=89=A7=E8=A1=8C=E9=9D=99=E6=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=B0=83=E5=8F=96=E3=80=81=E5=A1=AB=E5=86=99?= =?UTF-8?q?=E7=BB=B4=E4=BF=9D=E5=8D=95=E9=9D=99=E6=80=81=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=B0=83=E5=8F=96=E3=80=81=E9=85=8D=E4=BB=B6=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=9D=99=E6=80=81=E6=95=B0=E6=8D=AE=E8=B0=83=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dates/yy-mm-dd-hh-ss.vue | 283 ++++++++++++++++++++++++++ jsFile/requst.js | 10 +- jsFile/tools.js | 69 ++++++- pages/mountingsList/mountingsList.vue | 196 ++++++++++-------- pages/workOrder/workOrder.vue | 90 ++++---- pages/workOrder/workorderTwo.vue | 129 ++++++------ 6 files changed, 582 insertions(+), 195 deletions(-) create mode 100644 components/dates/yy-mm-dd-hh-ss.vue diff --git a/components/dates/yy-mm-dd-hh-ss.vue b/components/dates/yy-mm-dd-hh-ss.vue new file mode 100644 index 0000000..920196a --- /dev/null +++ b/components/dates/yy-mm-dd-hh-ss.vue @@ -0,0 +1,283 @@ + + + + + diff --git a/jsFile/requst.js b/jsFile/requst.js index 325795e..bc5446b 100644 --- a/jsFile/requst.js +++ b/jsFile/requst.js @@ -63,6 +63,7 @@ const request = (method, url, options) => { methods = 'GET' headers = { 'Content-Type': 'application/json; charset=UTF-8', + 'Authorization': 'Bearer '+uni.getStorageSync('token') || '', 'token':uni.getStorageSync('token') || '' } break; @@ -70,14 +71,16 @@ const request = (method, url, options) => { methods = 'POST' headers = { 'Content-Type': 'application/json; charset=UTF-8', - 'Authorization': 'Bearer '+uni.getStorageSync('token') || '' + 'Authorization': 'Bearer '+uni.getStorageSync('token') || '', + 'token':uni.getStorageSync('token') || '' } break; case 'postForm': methods = 'POST' headers = { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', - 'Authorization': 'Bearer '+uni.getStorageSync('token') || '' + 'Authorization': 'Bearer '+uni.getStorageSync('token') || '', + 'token':uni.getStorageSync('token') || '' } break; } @@ -124,7 +127,8 @@ const uploadFile = (url, options) => { formData: tempData, header: { 'Content-Type': 'multipart/form-data;charset=UTF-8', - 'Authorization': 'Bearer '+uni.getStorageSync('token') || '' + 'Authorization': 'Bearer '+uni.getStorageSync('token') || '', + 'token':uni.getStorageSync('token') || '' }, success: res => { if (res.statusCode == 200) { diff --git a/jsFile/tools.js b/jsFile/tools.js index 263e8e3..af51ea1 100644 --- a/jsFile/tools.js +++ b/jsFile/tools.js @@ -229,6 +229,65 @@ const tools = { // console.log(time2);//1398250549123 // console.log(time3);//1398250549000 }, + // 返回当前时间 + returnCurrentTime(format,type) { + let date = new Date(); + let year = date.getFullYear(); // 年 + let month = date.getMonth() + 1; // 月 + let day = date.getDate(); // 日 + let time = date.getHours(); // 时 + let minu = date.getSeconds(); // 分 + let second = date.getMinutes(); // 秒 + + let newTime = ''; + switch (type){ + case 0: + newTime = `${year}${format}${month < 10? '0' + month : month}${format}${day < 10 ? '0' + day : day} ${time < 10 ? '0' + time : time}:${minu < 10 ? '0' + minu : minu}`; // 2022-03-31 16:05 + break; + case 1: + newTime = `${year}${format}${month < 10? '0' + month : month}${format}${day < 10 ? '0' + day : day} ${time < 10 ? '0' + time : time}:${minu < 10 ? '0' + minu : minu}:${second < 10 ? '0' + second : second}`; // 2022-03-31 16:10:07 + break; + } + return newTime; + }, + // 返回时间xx天xx小时xx分钟 + returnTimeFormat(startTime,endTime){ + console.log(startTime,endTime); + let newTimeFormat = ''; + let currentTimestamp = this.timeToTimestamp(endTime) - this.timeToTimestamp(startTime); + return this.returnTimestampToTime(currentTimestamp); + }, + // 返回时间戳转时、分对象 + returnTimestampToTime(timestamp){ + let timeStr = ''; + var day = parseInt((timestamp % (1000 * 60 * 60 * 24 * 12)) / (1000 * 60 * 60 * 24)); + var hours = parseInt((timestamp % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); + var seconds = parseInt((timestamp % (1000 * 60 * 60)) / (1000 * 60)); + day = day < 10 ? ('0' + day) : day; + hours = hours < 10 ? ('0' + hours) : hours; + seconds = seconds < 10 ? ('0' + seconds) : seconds; + if(day*1==0) { + if(hours*1==0) { + seconds*1==0 ? timeStr = 0 : timeStr = `${seconds}分钟`; + } else { + timeStr = `${hours}小时${seconds}分钟`; + } + } else { + timeStr = `${day}天${hours}小时${seconds}分钟`; + } + return timeStr; + }, + // 时间戳转时分秒 00 : 00 : 00 + formatDuring: function(mss) { + // let dangTime = Math.round(new Date()/1000)//获取当前时间戳 + var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); + var seconds = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60)); + var minutes = (mss % (1000 * 60)) / 1000; + hours = hours < 10 ? ('0' + hours) : hours; + seconds = seconds < 10 ? ('0' + seconds) : seconds; + minutes = minutes < 10 ? ('0' + minutes) : minutes; + return hours + ' : ' + seconds + ' : ' + minutes; + }, // 随机数生成 randomStr(){ var strData = ""; @@ -281,16 +340,6 @@ const tools = { duration:newTime }) }, - formatDuring: function(mss) { - // let dangTime = Math.round(new Date()/1000)//获取当前时间戳 - var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); - var minutes = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60)); - var seconds = (mss % (1000 * 60)) / 1000; - hours = hours < 10 ? ('0' + hours) : hours; - minutes = minutes < 10 ? ('0' + minutes) : minutes; - seconds = seconds < 10 && seconds >= 1 ? ('0' + seconds) : seconds; - return hours + ' : ' + minutes + ' : ' + seconds; - }, // 富文本 escape2Html(str) { var arrEntities = { 'lt': '<', 'gt': '>', 'nbsp': ' ', 'amp': '&', 'quot': '"' }; diff --git a/pages/mountingsList/mountingsList.vue b/pages/mountingsList/mountingsList.vue index fd90ad7..539972a 100644 --- a/pages/mountingsList/mountingsList.vue +++ b/pages/mountingsList/mountingsList.vue @@ -3,129 +3,149 @@ - - - - - + + + + + + + + + + + + + + {{item.name}} + + + + + + 配件品牌:{{item.brand}} + 规格型号{{item.model}} + + 已用数量:{{item.remark}}张 + + - + {{item.num}} + + + + + + + + *请注意规格型号的选择,不同型号不同价格。 + 费用合计:¥{{item.sum}} + + + + - - - - - - - - - - - - {{item.name}} - - - - - - - - - - 配件品牌:{{item.brand}} - - - 规格型号{{item.model}} - - - - - 已用数量:{{item.remark}}张 - - - - - - - - {{item.num}} - - - + - - - - - - - - *请注意规格型号的选择,不同型号不同价格。 - - - 费用合计:¥{{item.sum}} - - - - - - - + diff --git a/pages/workOrder/workOrder.vue b/pages/workOrder/workOrder.vue index 3d5b9d9..140cdfc 100644 --- a/pages/workOrder/workOrder.vue +++ b/pages/workOrder/workOrder.vue @@ -17,47 +17,46 @@ 结算审核 - 工单编号: - + 项目编号: - + 项目名称: - + 产品类型: - + 安装位置: - + 故障类型: - + 紧急程度: - + 故障说明: -