diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/app.json b/app.json index 2a047d0..8c4f813 100644 --- a/app.json +++ b/app.json @@ -1,9 +1,10 @@ { "pages": [ - "pages/production/production", "pages/index/index", + "pages/production/production", "pages/energy/energy", - "pages/energyInfo/energyInfo" + "pages/energyInfo/energyInfo", + "pages/my/my" ], "tabBar": { "custom": true, @@ -19,6 +20,9 @@ }, { "pagePath": "pages/production/production" + }, + { + "pagePath": "pages/my/my" } ] }, diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index 80bcb9d..4b636d5 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -18,9 +18,9 @@ Component({ pages:['pages/energy/energy','pages/energyInfo/energyInfo'] }, { - pagePath: '/pages/info/info', + pagePath: '/pages/my/my', text: '我的', - pages:[' x'] + pages:['/pages/my/my'] }, ] }, diff --git a/image/downIcon.png b/image/downIcon.png new file mode 100644 index 0000000..08951cc Binary files /dev/null and b/image/downIcon.png differ diff --git a/image/right.png b/image/right.png new file mode 100644 index 0000000..f798a95 Binary files /dev/null and b/image/right.png differ diff --git a/pages/my/my.js b/pages/my/my.js new file mode 100644 index 0000000..a441309 --- /dev/null +++ b/pages/my/my.js @@ -0,0 +1,97 @@ +import { + request +} from '../../utils/request' +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + info: {} + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + async onReady() { + + await request({ + url: '/auth/login', + method: 'post', + headers: { + isToken: false, + isEncrypt: true, + repeatSubmit: false + }, + data: { + username: 'admin', + password: 'admin123', + clientId: '428a8310cd442757ae699df5d894f051', + grantType: 'password', + rememberMe: false, + tenantId: "000000", + } + }).then(e => { + app.globalData.token = e.data.access_token + }) + request({ + url: '/system/user/getInfo', + method: 'get', + }).then(e => { + console.log(e.data); + this.setData({ + info: e.data + }) + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/my/my.json b/pages/my/my.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/my/my.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/my/my.wxml b/pages/my/my.wxml new file mode 100644 index 0000000..3c8bcb0 --- /dev/null +++ b/pages/my/my.wxml @@ -0,0 +1,16 @@ + + + + + + {{info.user.nickName}} + + + 修改密码 + + + + 退出登录 + + + \ No newline at end of file diff --git a/pages/my/my.wxss b/pages/my/my.wxss new file mode 100644 index 0000000..43676a0 --- /dev/null +++ b/pages/my/my.wxss @@ -0,0 +1,48 @@ +.avatar { + width: 30vw; + height: 30vw; + margin-top: 5vh; + border-radius: 50%; + margin-left: 35vw; + overflow: hidden; +} + +.name { + width: 100%; + margin-top: 1vh; + text-align: center; + font-size: 32rpx; + font-weight: 600; +} +.passwordUpdate{ + margin-top: 3vh; + width: calc(100% - 40rpx); + padding: 0 20rpx; + font-size: 26rpx; + height: 100rpx; + line-height: 100rpx; + background-color: #fff; + border-bottom: 1px solid #0003; + position: relative; +} +.exit{ + margin-top: 1vh; + width: calc(100% - 40rpx); + padding: 0 20rpx; + font-size: 26rpx; + height: 100rpx; + line-height: 100rpx; + background-color: #fff; + border-bottom: 1px solid #0003; + position: relative; +} +.icon{ +position: absolute; +top: 50%; +right: 20rpx; +font-size: 26rpx; +height: 30rpx; +z-index: 3; +width: 30rpx; +transform: translateY(-50%); +} \ No newline at end of file diff --git a/pages/production/production.js b/pages/production/production.js index 1423809..fc1dcf6 100644 --- a/pages/production/production.js +++ b/pages/production/production.js @@ -4,32 +4,165 @@ import { } from '../../utils/request' const app = getApp() Page({ - data: { - optionsRow: [], - options: [], - selectedIndex: 0 + options1Row: [], + options1: [], + selectedIndex1: 13, + options2Row: [], + options2: [], + selectedIndex2: null, + options3Row: [], + options3: [], + selectedIndex3: null, + options4Row: [], + options4: [], + selectedIndex4: null, + open: false, + selectForm: { + pageNum: 1, + pageSize: 10, + processId: 18 + }, + list: [], + total:0 }, - onChange(e) { + toggle() { this.setData({ - selectedIndex: e.detail.value - }) - let id = this.data.optionsRow.find(v => v.label === this.data.options[e.detail.value])?.value || '' - console.log(id); + open: !this.data.open + }) + }, + onSearch() { + let data = this.data.selectForm + Object.keys(data).forEach(key => { + if (!data[key]) delete data[key] + }) + data.pageNum = 1 + request({ + url: '/mes/prodReport/planCompletionRateReport', + method: 'get', + data: data + }).then(e => { + this.setData({ + list: e.rows.map(v => { + return { + ...v, + completionRate: parseFloat(v.completionRate) + } + }), + total:e.total + }) + }) + }, + onChange(e) { + this.setData({ + selectedIndex1: e.detail.value + }) + let id = this.data.options1Row.find(v => v.label === this.data.options1[e.detail.value])?.value || '' + this.setData({ + selectedIndex2: null, + 'selectForm.processId': id + }) + this.setData({ + 'selectForm.machineId': null + }) + request({ + url: '/mes/prodBaseMachineInfo/getProdBaseMachineInfoList', + method: 'get', + data: { + processId: id + } + }).then(e => { + this.setData({ + options2Row: JSON.parse(JSON.stringify(e.data)).map(v => { + return { + value: v.machineId, + label: v.machineName, + } + }), + options2: e.data.map(v => v.machineName), + }) + }) + }, + onChange1(e) { + this.setData({ + selectedIndex2: e.detail.value + }) + let id = this.data.options2Row.find(v => v.label === this.data.options2[e.detail.value])?.value || '' + this.setData({ + 'selectForm.machineId': id + }) + }, + onChange2(e) { + this.setData({ + selectedIndex3: e.detail.value + }) + let id = this.data.options3Row.find(v => v.label === this.data.options3[e.detail.value])?.value || '' + this.setData({ + 'selectForm.shiftId': id + }) + }, + onChange3(e) { + this.setData({ + selectedIndex4: e.detail.value + }) + let id = this.data.options4Row.find(v => v.label === this.data.options4[e.detail.value])?.value || '' + this.setData({ + 'selectForm.classTeamId': id + }) + }, + onChange4(e) { + this.setData({ + 'selectForm.planCode': e.detail.value + }) + }, + onChange5(e) { + this.setData({ + 'selectForm.materialName': e.detail.value + }) + }, + reset() { + this.setData({ + selectForm: { + pageNum: 1, + pageSize: 10, + processId: 18 + }, + selectedIndex1: 13, + selectedIndex2: null, + selectedIndex3: null, + selectedIndex4: null, + }) + request({ + url: '/mes/prodBaseMachineInfo/getProdBaseMachineInfoList', + method: 'get', + data: { + processId: 18 + } + }).then(e => { + this.setData({ + options2Row: JSON.parse(JSON.stringify(e.data)).map(v => { + return { + value: v.machineId, + label: v.machineName, + } + }), + options2: e.data.map(v => v.machineName), + }) + }) + }, + onStartChange(e) { + this.setData({ + 'selectForm.beginDate': e.detail.value + }) + }, + onEndChange(e) { + this.setData({ + 'selectForm.endDate': e.detail.value + }) }, - onLoad(options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, /** * 生命周期函数--监听页面显示 @@ -60,24 +193,93 @@ Page({ }).then(e => { app.globalData.token = e.data.access_token }) - await request({ + request({ url: '/mes/baseProcessInfo/getProcessInfoList', method: 'get', }).then(e => { this.setData({ - optionsRow: JSON.parse(JSON.stringify(e.data)).map(v => { + options1Row: JSON.parse(JSON.stringify(e.data)).map(v => { return { - value : v.processId, - label : v.processName, + value: v.processId, + label: v.processName, } }), - options: e.data.map(v => v.processName), + options1: e.data.map(v => v.processName), }) }) + request({ + url: '/mes/prodBaseMachineInfo/getProdBaseMachineInfoList', + method: 'get', + data: { + processId: 18 + } + }).then(e => { + this.setData({ + options2Row: JSON.parse(JSON.stringify(e.data)).map(v => { + return { + value: v.machineId, + label: v.machineName, + } + }), + options2: e.data.map(v => v.machineName), + }) + }) + + request({ + url: '/mes/baseShiftInfo/getBaseShiftInfoList', + method: 'get', + }).then(e => { + this.setData({ + options3Row: JSON.parse(JSON.stringify(e.data)).map(v => { + return { + value: v.shiftId, + label: v.shiftName, + } + }), + options3: e.data.map(v => v.shiftName), + }) + }) + + request({ + url: '/mes/baseClassTeamInfo/getBaseClassTeamInfoList', + method: 'get', + }).then(e => { + this.setData({ + options4Row: JSON.parse(JSON.stringify(e.data)).map(v => { + return { + value: v.classTeamId, + label: v.teamName, + } + }), + options4: e.data.map(v => v.teamName), + }) + }) }, - + onReachBottom() { + if(this.data.selectForm.pageNum * this.data.selectForm.pageSize < this.data.total){ + let data = this.data.selectForm + Object.keys(data).forEach(key => { + if (!data[key]) delete data[key] + }) + data.pageNum += 1 + request({ + url: '/mes/prodReport/planCompletionRateReport', + method: 'get', + data: data + }).then(e => { + this.setData({ + list: [...this.data.list, ...e.rows.map(v => { + return { + ...v, + completionRate: parseFloat(v.completionRate) + } + })] + }) + }) + } + }, /** * 生命周期函数--监听页面隐藏 */ @@ -99,12 +301,6 @@ Page({ }, - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, /** * 用户点击右上角分享 diff --git a/pages/production/production.wxml b/pages/production/production.wxml index 8df8ea5..ef7d6d5 100644 --- a/pages/production/production.wxml +++ b/pages/production/production.wxml @@ -1,11 +1,141 @@ - - - - - {{ options[selectedIndex] || '请选择工序名称' }} + + + + + + {{ options1[selectedIndex1] || '请选择工序名称' }} + + + 搜索 + + + + + 计划日期 + + + + {{selectForm.beginDate || '请选择'}} + + + + + + + + {{selectForm.endDate || '请选择'}} + + - - - 搜索 + + + 工序名称 + + + + {{ options1[selectedIndex1] || '请选择工序名称' }} + + + + + + 机台名称 + + + + {{ options2[selectedIndex2] || '请选择机台名称' }} + + + + + + 班次名称 + + + + {{ options3[selectedIndex3] || '请选择班次名称' }} + + + + + + 班组名称 + + + + {{ options4[selectedIndex4] || '请选择班组名称' }} + + + + + + 计划编号 + + + + + + 物料名称 + + + + + 搜索 + 重置 + + + + + + + + + + + {{item.materialName || ' '}} + + + + + 计划数量: + + + {{item.planNumber}} + + + + + 完成数量: + + + {{item.actualNumber}} + + + + + 偏差数量: + + + {{item.deviationNumber}} + + + + + 完成率: + + + + + + + {{item.completionRate}}% + + + \ No newline at end of file diff --git a/pages/production/production.wxss b/pages/production/production.wxss index 6a0aac1..f2e9ae8 100644 --- a/pages/production/production.wxss +++ b/pages/production/production.wxss @@ -4,6 +4,8 @@ height: 80rpx; background-color: #fff; border-radius: 40rpx; + position: relative; + transition: height 0.3s ease; } .picker { @@ -30,4 +32,126 @@ background-color: #419EFF; color: #fff; border-radius: 40rpx; +} +.down{ + position: absolute; + top: 100%; + left: 50%; + width: 200rpx; + height: 50rpx; + border-bottom-left-radius: 50rpx; + border-bottom-right-radius: 50rpx; + background-color: #eaeaea; + transform: translateX(-50%); +} +.downIcon{ + position: absolute; + left: 50%; + top: 50%; + width: 30rpx; + height: 30rpx; + transform: translate(-50%,-50%); + z-index: 11; +} +.item{ + margin-top: 10rpx; +} +.label{ + margin-top: 15rpx; + width: 18vw; + padding-left: 2vw; + height: 50rpx; + line-height: 50rpx; + display: inline-block; + font-size: 4vw; + color: #000; + vertical-align: top; +} +.selectInput{ + width: 66vw; + height: 50rpx; + padding-left: 2vw; + line-height: 50rpx; + display: inline-block; + margin-top: 15rpx; + margin-left: 2vw; + border-radius: 25rpx; + background-color: #0001; + color: #666; +} +.datePicker{ + width: 29vw; + height: 50rpx; + padding-left: 2vw; + display: inline-block; + line-height: 50rpx; + background-color: #0001; + border-radius: 25rpx; + color: #666; +} +.split{ + width: 6vw; + height: 50rpx; + display: inline-block; + line-height: 50rpx; + text-align: center; + color: #666; +} +.search-btn1{ + vertical-align: top; + display: inline-block; + margin-top: 15rpx; + margin-left: 2vw; + text-align: center; + width: 15vw; + height: 50rpx; + line-height: 50rpx; + background-color: #419EFF; + color: #fff; + border-radius: 40rpx; +} +.list{ + margin-top: 80rpx; +} +.listItem{ + margin-top: 30rpx; +width: calc(94vw - 50rpx); +margin-left: 3vw; +padding: 30rpx; +border-radius: 30rpx; +background-color: #fff; +} +.head{ + font-size: 32rpx; + font-weight: 700; +} +.text{ + display: inline-block; + color: #000; + font-size: 28rpx; +} +.num{ + display: inline-block; + color: #666; + font-size: 28rpx; +} +.itemInfo{ + margin-top: 20rpx; +} +.p{ + display: inline-block; + width: calc(100% - 120rpx - 150rpx); + height: 28rpx; + background-color: #eee; + margin-right: 20rpx; + border-radius: 14rpx; + overflow: hidden; + position: relative; +} +.i{ + position: absolute; + height: 100%; + top: 0; + left: 0; + background-color: #409EFF; } \ No newline at end of file diff --git a/project.config.json b/project.config.json index 273d008..fecb1e4 100644 --- a/project.config.json +++ b/project.config.json @@ -1,7 +1,7 @@ { "appid": "wxe88cfe782a5ab21f", "compileType": "miniprogram", - "libVersion": "trial", + "libVersion": "3.13.2", "packOptions": { "ignore": [], "include": [] diff --git a/project.private.config.json b/project.private.config.json index 6f22715..fff9bc7 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -1,6 +1,6 @@ { "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", - "projectname": "mom", + "projectname": "mom-wx", "setting": { "compileHotReLoad": true, "skylineRenderEnable": true, @@ -18,5 +18,6 @@ "checkInvalidKey": true, "ignoreDevUnusedFiles": true }, - "libVersion": "3.13.2" + "libVersion": "3.13.2", + "condition": {} } \ No newline at end of file