From 75bd3e8d9d06e53ef5fb41b5f4c022e2d24a500c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=AF=E5=B0=8F=E7=8E=8B=E5=91=80=5C24601?= <819653817@qq.com> Date: Fri, 10 May 2024 18:30:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=95=B0=E6=8D=AE=E8=BF=94?= =?UTF-8?q?=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dissatisfied/demandCheck/demandCheck.wxml | 2 +- .../safetyinspection/safetyinspection.js | 110 +++++++++++++++++- .../safetyinspection/safetyinspection.wxml | 65 ++++++----- .../safetyinspection/safetyinspection.wxss | 46 +++++++- 4 files changed, 191 insertions(+), 32 deletions(-) diff --git a/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.wxml b/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.wxml index 615ab71..6644358 100644 --- a/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.wxml +++ b/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.wxml @@ -10,7 +10,7 @@ 所属组织 - {{agencyName?agencyName:'请选择'}} + {{agencyName?agencyName:'请选择-'}} diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js index 250546e..73869e6 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js @@ -1,12 +1,21 @@ // subpages/safetyinspection/pages/safetyinspection/safetyinspection.js import { - showRecord + showRecord,addRecord,inspectionStaff } from "../../../../utils/api" +const config = require('../../../../utils/config') Page({ /** * 页面的初始数据 */ data: { + orgid:'', + orgType:'', + pageNo:'1', + pageSize:'20', + showList:[], + imageUrls:[], + remarks:'',//备注 + getData:'', gridName:'', array: ['选项1', '选项2', '选项3', '选项4'], // 选择器的数据源 result: ['a', 'b', 'c'], @@ -28,6 +37,10 @@ Page({ arr1:[ {value:"1",name:'1.车间一些软件设备出现生锈断裂情况严重'}, {value:"2",name:'2.还有部分货运车辆已过年检。'}, + ], + arr2:[ + {id:"1", data:"2024-05-06 10:20",name:'检察人员',jielun:"不合格",yinhuan:"1.车间一些软件设备出现生锈断裂情况严重",fuchashijian:'2024-01-05',fujian:"1223",beizhu:"qq","dingwei":"山东路"}, + {id:"2",data:"2024-05-06 10:20",name:'检察人员',jielun:"不合格",yinhuan:"2.车间一些软件设备出现生锈断裂情况严重",fuchashijian:'2024-01-05',fujian:"1223",beizhu:"qq","dingwei":"山东路"}, ] }, @@ -40,6 +53,7 @@ Page({ companyId: options.resiId }) this.showRecordData() + this.addRecordData() }, /** @@ -124,6 +138,20 @@ Page({ console.log(parm) showRecord(parm).then(res => { console.log(res) + this.setData({ + showList:res.data + }) + console.log(this.data.showList) + }) + }, + addRecordData(){ + + addRecord(parm).then(res => { + console.log("") + this.setData({ + showList:res.data + }) + console.log(this.data.showList) }) }, showPopup() { @@ -183,13 +211,91 @@ Page({ pickerChange: function(e) { // 更新当前选中的索引 console.log(e.detail.value), - console.log(this.data.array[e.detail.value]) this.setData({ gridName: this.data.array[e.detail.value] }); console.log(this.data.gridName) // 在这里可以根据选择的值进行相应的逻辑处理 +}, +pickerChange1: function(e) { + // 更新当前选中的索引 + console.log(e.detail.value), + this.setData({ + getData: e.detail.value + }); + console.log(this.data.getData) + // 在这里可以根据选择的值进行相应的逻辑处理 +}, +bindRemarkInput(e){ + this.setData({ + remarks: e.detail.value + }); + console.log(this.data.remarks) +}, +chooseImage() { + const that = this; + wx.chooseMedia({ + count: 1, + sizeType: ['original', 'compressed'], + sourceType: ['album', 'camera'], + success(res) { + console.log(res) + const tempFilePaths = res; + console.log(tempFilePaths); + const imageUrls = [...that.data.imageUrls] + +if (that.data.imageUrls) { + that.setData({ + imageUrls: that.data.imageUrls.concat(tempFilePaths) + }) + wx.uploadFile({ + url: `${config.BASEURL()}oss/file/uploadvariedfile`, + filePath: res.tempFiles[0].tempFilePath, + name: 'file', + header: { + 'Content-type': 'application/json;charset=UTF-8', + 'Authorization': wx.getStorageSync('token') + }, + success(fileRes) { + if (!JSON.parse(fileRes.data).data) { + that.showToast('图片上传失败,请重试~') + // 删除 + const index = that.data.imageUrls.findIndex(item => item.imageId === that.data.imageId) + if (index > -1) { + that.data.imageUrls.splice(index, 1) + that.setData({ + imageUrls: that.data.imageUrls + }) + + } + } else { + imageUrls[imageUrls.length - 1].uploaded = true + imageUrls[imageUrls.length - 1].ossUrl = JSON.parse(fileRes.data).data + that.setData({ + imageUrls + }) + } + }, + fail(fileRes) { + that.setData({ + imageUrls: [] + }) + that.showToast('图片上传失败,请重试~') + } + }) +}else{ + } + + // 将选定的图片显示在页面上 + // this.setData({ + // imageUrl: tempFilePaths[0] + // }); + } + }) + + }, + }) \ No newline at end of file diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml index c0062bc..022896c 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml @@ -20,7 +20,7 @@ - {{item.name}} + {{item.name}} @@ -50,9 +50,9 @@ * 拟复查时间 - - - {{gridName?gridName:'请选择'}} + + + {{getData?getData:'请选择'}} @@ -66,50 +66,56 @@ 备注 -