You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
848 lines
25 KiB
848 lines
25 KiB
import {
|
|
$wuxActionSheet
|
|
} from '../../../../components/dist/index'
|
|
const config = require('../../../../utils/config')
|
|
const QQMapWX = require('../../../../utils/qqmap-wx-jssdk')
|
|
const App = getApp()
|
|
import {timestampToTime} from "../../../../utils/index"
|
|
import {
|
|
addRecord,
|
|
securityCheckk,
|
|
inspectionStaff,
|
|
showRecord,
|
|
Enterpriseambiguity
|
|
} from "../../../../utils/api"
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
orderDate:"",
|
|
selectedEnterpriseNames:[],
|
|
EnterpriseName:[],
|
|
companyList:[],
|
|
showtime:false,
|
|
checkboxOptions:[],
|
|
hiddenDangeList: [],
|
|
newObj:[],
|
|
addRecord: [],
|
|
attachmentUrl: '',
|
|
reviewTime: '',
|
|
checkResultFlag: '',
|
|
checkPersonsIdList: [],
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
id: 0,
|
|
addressContent: '',
|
|
showqiye:false,
|
|
fmData: {
|
|
gridId: '',
|
|
attachmentList: [], //图片
|
|
voiceList: [],
|
|
latitude: "",
|
|
longitude: "",
|
|
resiId: "",
|
|
happenTime: "",
|
|
content: "", //内容
|
|
address: "", //地址
|
|
checkPersons: ''
|
|
},
|
|
imageUrl: '',
|
|
remarks: '', //备注
|
|
getData: '',
|
|
checkResultName: '',
|
|
array: ['不合格', '合格'], // 选择器的数据源
|
|
arrlist: [],
|
|
fileList: [],
|
|
companyId: '',
|
|
showPopup: false, // 控制弹出层显示/隐藏的状态
|
|
selectedOptions: [], // 选中的复选框项
|
|
selectedNames: [], //显示检察人员
|
|
// 用于存放复选框选择的结果
|
|
result: [],
|
|
// 用于存放输入框的值
|
|
hazardDesc: '',
|
|
hazardDesc2:'',
|
|
uploadImageList: [],
|
|
imageId: 1,
|
|
arr: [],
|
|
arr1: [],
|
|
addHiddenDangeList:[],
|
|
checkboxValue:[],
|
|
newContent:'',
|
|
currentDate: new Date().getTime(),
|
|
minDate: new Date(2020, 0, 1).getTime(),
|
|
maxDate: new Date(2030, 11, 31).getTime(),
|
|
searchKeyword:"",
|
|
showscroll:false
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
this.setData({
|
|
companyId: options.resiId
|
|
})
|
|
this.data.qqMapWX = new QQMapWX({
|
|
key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ'
|
|
})
|
|
this.reverseLocation()
|
|
this.getList()
|
|
|
|
},
|
|
showTime(){
|
|
this.setData({
|
|
showtime:true
|
|
})
|
|
},
|
|
inputChange(val){
|
|
console.log(val.detail.value);
|
|
this.setData({
|
|
searchKeyword: val.detail.value // 更新搜索关键词
|
|
});
|
|
let parm = {
|
|
name: this.data.searchKeyword,
|
|
pageSize:this.data.pageSize,
|
|
pageNo:this.data.pageNo
|
|
}
|
|
Enterpriseambiguity(parm).then(res => {
|
|
console.log(res.data.list);
|
|
this.setData({
|
|
companyList:res.data.list,
|
|
// showqiye:true
|
|
})
|
|
console.log( this.data.companyList);
|
|
|
|
|
|
|
|
})
|
|
// clearTimeout(this.data.timer);
|
|
// this.data.timer = setTimeout(() => {
|
|
// // 调用后台接口或者模拟数据获取搜索结果
|
|
// // this.pickerChange2(e);
|
|
// }, 300); // 设置延迟时间,比如300毫秒
|
|
},
|
|
onInputChange(e){
|
|
const index = e.currentTarget.dataset.index;
|
|
const value = e.detail.value;
|
|
let addHiddenDangeList = this.data.addHiddenDangeList;
|
|
addHiddenDangeList[index].hazardDesc = value;
|
|
this.setData({
|
|
addHiddenDangeList: addHiddenDangeList
|
|
});
|
|
console.log(this.data.addHiddenDangeList);
|
|
},
|
|
async showRecordData() {
|
|
console.log(this.data.checkboxOptions);
|
|
this.setData({
|
|
checkboxOptions:[]
|
|
})
|
|
let parm = {
|
|
id: this.data.companyId
|
|
}
|
|
await showRecord(parm).then(res => {
|
|
if(res.data[0].hiddenDangeList){
|
|
let checkboxOptions = res.data[0].hiddenDangeList.filter(item=>item.hazardStatus === 0).map(item=>({hazardDesc:item.hazardDesc,hazardStatus:0}));
|
|
this.setData({
|
|
checkboxOptions: checkboxOptions || [],
|
|
beforeFlag: res.data[0].checkResultFlag
|
|
})
|
|
console.log(this.data.beforeFlag);
|
|
console.log(this.data.checkboxOptions);
|
|
}else{
|
|
this.setData({
|
|
beforeFlag: res.data[0].checkResultFlag
|
|
})
|
|
console.log(this.data.beforeFlag)
|
|
}
|
|
})
|
|
console.log(this.data.checkboxOptions);
|
|
},
|
|
getCurrentDateTime() {
|
|
const now = new Date();
|
|
const year = now.getFullYear();
|
|
const month = (now.getMonth() + 1).toString().padStart(2, '0');
|
|
const day = now.getDate().toString().padStart(2, '0');
|
|
const hours = now.getHours().toString().padStart(2, '0');
|
|
const minutes = now.getMinutes().toString().padStart(2, '0');
|
|
const seconds = now.getSeconds().toString().padStart(2, '0');
|
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
},
|
|
submitBiao() {
|
|
if(!this.data.companyId){
|
|
wx.showToast({
|
|
title: '请选择企业',
|
|
icon:'none'
|
|
})
|
|
return false
|
|
}
|
|
if(this.data.selectedOptions.length === 0){
|
|
wx.showToast({
|
|
title: '请选择检查人员',
|
|
icon:'none'
|
|
})
|
|
return false
|
|
}
|
|
if(!this.data.checkResultFlag){
|
|
wx.showToast({
|
|
title: '请选择检查结论',
|
|
icon:'none'
|
|
})
|
|
return false
|
|
}
|
|
if(this.data.checkResultFlag == 0 && !this.data.currentDateShow){
|
|
wx.showToast({
|
|
title: '请选择拟复查时间',
|
|
icon:'none'
|
|
})
|
|
return false
|
|
}
|
|
|
|
if(this.data.checkResultFlag == 0 && this.data.checkboxValue.length<1&&this.data.addHiddenDangeList<1&&!this.data.newContent){
|
|
wx.showToast({
|
|
title: '隐患明细最少输入一条',
|
|
icon:'none'
|
|
})
|
|
return false
|
|
}
|
|
// if (this.data.checkboxOptions) {
|
|
// console.log(this.data.checkboxOptions)
|
|
// this.data.checkboxOptions.forEach(item => {
|
|
// console.log(item)
|
|
// console.log(this.data.checkboxValue)
|
|
// if(this.data.checkboxValue.findIndex(itemC=>itemC === item.value) == -1){
|
|
// item.hazardStatus = '1';
|
|
// }else{
|
|
// item.hazardStatus = '0';
|
|
// }
|
|
// })
|
|
// }
|
|
|
|
|
|
if (this.data.newContent) {
|
|
let newArr = this.data.addHiddenDangeList.concat({
|
|
hazardDesc: this.data.newContent,
|
|
hazardStatus: 0
|
|
});
|
|
console.log(newArr)
|
|
this.setData({
|
|
addHiddenDangeList: newArr,
|
|
newContent:''
|
|
});
|
|
}
|
|
console.log(this.data.addHiddenDangeList);
|
|
if (this.data.hazardDesc2) {
|
|
let newArr = this.data.addHiddenDangeList.concat({
|
|
hazardDesc: this.data.hazardDesc2,
|
|
hazardStatus: 2
|
|
});
|
|
console.log(newArr)
|
|
this.setData({
|
|
addHiddenDangeList: newArr,
|
|
hazardDesc2:""
|
|
});
|
|
}
|
|
let form={
|
|
companyId: this.data.companyId,
|
|
checkTime: this.getCurrentDateTime(),
|
|
checkPersonsIdList: this.data.checkPersonsIdList,
|
|
checkResultFlag: this.data.checkResultFlag,
|
|
reviewTime:this.data.currentDateShow,
|
|
hiddenDangeList:this.data.checkboxOptions.concat(this.data.addHiddenDangeList),
|
|
attachmentUrls:this.data.uploadImageList.map(item=>({fileName:item.originFileName,attachmentUrl:item.ossUrl.url})),
|
|
remark: this.data.remarks,
|
|
reviewAddress:this.data.addressContent
|
|
}
|
|
this.setData({
|
|
checkboxValue:''
|
|
})
|
|
// if (!this.data.reviewTime) {
|
|
// form.reviewTime=null
|
|
// }
|
|
console.log(form)
|
|
addRecord(
|
|
form
|
|
).then(
|
|
res => {
|
|
if(res.code == 0){
|
|
wx.showToast({
|
|
title: '新增成功',
|
|
duration:2000,
|
|
success:function(){
|
|
setTimeout(()=>{
|
|
wx.navigateBack({
|
|
delta: 1
|
|
})
|
|
},2000)
|
|
}
|
|
})
|
|
}
|
|
});
|
|
|
|
},
|
|
|
|
getList() {
|
|
// securityCheckk({
|
|
// pageNo: this.data.pageNo,
|
|
// pageSize: this.data.pageSize,
|
|
// }).then(({
|
|
// data
|
|
// }) => {
|
|
// console.log(data.list)
|
|
// this.setData({
|
|
// companyList: data.list,
|
|
// });
|
|
// });
|
|
inspectionStaff({
|
|
orgId: App.globalData.user.agencyId,
|
|
orgType: 'agency',
|
|
pageNo: 1,
|
|
pageSize: 100
|
|
}).then(({
|
|
data
|
|
}) => {
|
|
this.setData({
|
|
arr: data.staffList
|
|
})
|
|
});
|
|
console.log(arr,"wdsfsd");
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
this.reverseLocation
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {},
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {},
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {},
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {},
|
|
onChange(event) {
|
|
console.log(event);
|
|
console.log(event.detail);
|
|
console.log(this.data.checkboxOptions);
|
|
this.data.checkboxOptions.forEach((item,index)=>{
|
|
if(event.detail.findIndex(item=>item==index) != -1){
|
|
console.log(item,"还是0");
|
|
item.hazardStatus = 0
|
|
}else{
|
|
console.log(item,"皆苦额了");
|
|
item.hazardStatus = 1
|
|
}
|
|
})
|
|
console.log(this.data.checkboxOptions);
|
|
this.setData({
|
|
checkboxValue:event.detail,
|
|
})
|
|
console.log(this.data.checkboxOptions);
|
|
},
|
|
afterRead(event) {
|
|
const {
|
|
file
|
|
} = event.detail;
|
|
console.log(file)
|
|
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
|
|
wx.uploadFile({
|
|
url: 'https://example.weixin.qq.com/upload', // 仅为示例,非真实的接口地址
|
|
filePath: file.url,
|
|
name: 'file',
|
|
formData: {
|
|
user: 'test'
|
|
},
|
|
success(res) {
|
|
// 上传完成需要更新 fileList
|
|
const {
|
|
fileList = []
|
|
} = this.data;
|
|
fileList.push({
|
|
...file,
|
|
url: res.data
|
|
});
|
|
this.setData({
|
|
fileList
|
|
});
|
|
},
|
|
});
|
|
},
|
|
|
|
showPopup() {
|
|
this.setData({
|
|
showPopup: true
|
|
}); // 点击按钮显示弹出层
|
|
},
|
|
onClose() {
|
|
let names = []
|
|
this.setData({
|
|
showqiye:false
|
|
})
|
|
this.data.arr.forEach(item=>{
|
|
if(this.data.selectedOptions.findIndex(itemC=>itemC === item.staffId) != -1){
|
|
names.push(item.name)
|
|
}
|
|
})
|
|
this.setData({
|
|
showPopup: false,
|
|
selectedNames: names,
|
|
checkPersonsIdList:this.data.selectedOptions,
|
|
selectedEnterpriseNames:[]
|
|
}); // 关闭弹出层
|
|
},
|
|
onCloseTime(){
|
|
|
|
},
|
|
onChange1(event) {
|
|
console.log(event)
|
|
this.setData({
|
|
selectedOptions: event.detail
|
|
});
|
|
|
|
},
|
|
handleBlur(){
|
|
this.setData({
|
|
showscroll:false,
|
|
companyList:[]
|
|
})
|
|
},
|
|
handleFocus(){
|
|
console.log(this.data.showscroll);
|
|
this.setData({
|
|
showscroll:true
|
|
})
|
|
let parm = {
|
|
name: this.data.searchKeyword,
|
|
pageSize:this.data.pageSize,
|
|
pageNo:this.data.pageNo
|
|
}
|
|
Enterpriseambiguity(parm).then(res => {
|
|
console.log(res.data.list);
|
|
this.setData({
|
|
companyList:res.data.list,
|
|
// showqiye:true
|
|
})
|
|
console.log( this.data.companyList);
|
|
this.data.companyList.forEach(item=>{
|
|
this.data.orderDate=item.orderDate;
|
|
const currentDate = new Date();
|
|
const currentMonth = currentDate.getMonth() + 1;
|
|
const targetMonth = parseInt(item.orderDate.substring(5, 7), 10);
|
|
console.log(currentMonth,targetMonth);
|
|
if (targetMonth === currentMonth) {
|
|
console.log("turedv");
|
|
item.inspectIf=true
|
|
} else {
|
|
item.inspectIf=false
|
|
}
|
|
|
|
})
|
|
console.log(this.data.companyList);
|
|
// let names = []
|
|
// res.data.list.forEach(item=>{
|
|
// names.push(item.name)
|
|
// })
|
|
// console.log(names);
|
|
// this.data.EnterpriseName=names
|
|
})
|
|
// this.onChange2()
|
|
},
|
|
onChange2(event) {
|
|
|
|
let item = event.currentTarget.dataset.item;
|
|
console.log(item);
|
|
this.setData({
|
|
searchKeyword:item.name,
|
|
companyList:item,
|
|
companyId:item.companyId,
|
|
showscroll:false,
|
|
companyList:[]
|
|
});
|
|
|
|
this.showRecordData()
|
|
},
|
|
confirmSelection() {
|
|
// 点击确定按钮后触发,处理选中的复选框项
|
|
console.log("选中的项:", this.data.selectedOptions);
|
|
let names = []
|
|
this.data.arr.forEach(item=>{
|
|
if(this.data.selectedOptions.findIndex(itemC=>itemC === item.staffId) != -1){
|
|
names.push(item.name)
|
|
}
|
|
})
|
|
this.setData({
|
|
showPopup: false,
|
|
selectedNames: names,
|
|
checkPersonsIdList:this.data.selectedOptions
|
|
});
|
|
},
|
|
changeHazardDesc(e) {
|
|
this.setData({
|
|
hazardDesc: e.detail.value
|
|
});
|
|
},
|
|
changeHazardDescStatus2(e){
|
|
this.setData({
|
|
hazardDesc2: e.detail.value
|
|
});
|
|
console.log(this.data.hazardDesc2)
|
|
},
|
|
changenewContent(e){
|
|
this.setData({
|
|
newContent: e.detail.value
|
|
});
|
|
},
|
|
addAnother() {
|
|
let newArr = this.data.addHiddenDangeList.concat({ hazardDesc: this.data.newContent, hazardStatus: 0});
|
|
this.setData({
|
|
addHiddenDangeList: newArr,
|
|
newContent: '', // 清空输入框的值
|
|
});
|
|
console.log('添加后的数组:', this.data.addHiddenDangeList);
|
|
|
|
},
|
|
pickerChange: function (e) {
|
|
this.setData({
|
|
checkResultName: this.data.array[e.detail.value],
|
|
checkResultFlag:e.detail.value
|
|
});
|
|
},
|
|
pickerChange1: function (e) {
|
|
// 更新当前选中的索引
|
|
console.log(e.detail.value),
|
|
this.setData({
|
|
getData: e.detail.value
|
|
});
|
|
this.data.reviewTime = e.detail.value
|
|
console.log(this.data.getData)
|
|
// 在这里可以根据选择的值进行相应的逻辑处理
|
|
},
|
|
// pickerChange2: function (e) {
|
|
// // 更新当前选中的索引
|
|
// this.setData({
|
|
// gridNName: this.data.companyList[e.detail.value].name,
|
|
// companyId:this.data.companyList[e.detail.value].id,
|
|
// checkboxValue:[]
|
|
// });
|
|
// this.showRecordData()
|
|
// },
|
|
bindRemarkInput(e) {
|
|
this.setData({
|
|
remarks: e.detail.value
|
|
});
|
|
console.log(this.data.remarks)
|
|
},
|
|
chooseImage() {
|
|
if (this.data.uploadImageList.length > 3) {
|
|
wx.showToast({
|
|
title: "最多上传3张照片",
|
|
icon: "none"
|
|
})
|
|
return
|
|
}
|
|
const _this = this
|
|
|
|
$wuxActionSheet().showSheet({
|
|
buttons: [{
|
|
text: '拍照'
|
|
},
|
|
{
|
|
text: '从相册中获取',
|
|
openType: null,
|
|
},
|
|
|
|
],
|
|
className: 'dialog-class',
|
|
// 进入到这里的方法 index是buttons中的选项的索引值
|
|
buttonClicked(index) {
|
|
console.log(index)
|
|
if (index === 0) {
|
|
wx.chooseMedia({
|
|
//具体属性看文档
|
|
count: 1, //最多选择的数量
|
|
sizeType: ['original', 'compressed'], //文件的类型
|
|
sourceType: ['camera'], //可以用进行选择拍摄
|
|
success(res) {
|
|
console.log(res);
|
|
// 将照片的长度赋值给他
|
|
let deleteLength = _this.data.uploadImageList.length
|
|
// .将this中的uploadImageList重新赋值给uploadImageList
|
|
const uploadImageList = [..._this.data.uploadImageList]
|
|
// 判断数据的大小
|
|
if (res.tempFiles[0].size <= 5 * 1024 * 1024) {
|
|
//uploadImageList
|
|
uploadImageList.push({
|
|
// 已上传关闭
|
|
uploaded: false,
|
|
// ossUrl服务器
|
|
ossUrl: {
|
|
// 获取请求中的地址
|
|
url: res.tempFiles[0].tempFilePath
|
|
},
|
|
// 图片地址
|
|
imgUrl: res.tempFiles[0].tempFilePath,
|
|
// 将data里边的imageId自动加1
|
|
imageId: ++_this.data.imageId,
|
|
//获取路径的后三位,res.tempFiles[0].tempFilePath.length - 3, 3 从第三个为值截取,截取长度为3
|
|
type: res.tempFiles[0].tempFilePath.substr(res.tempFiles[0].tempFilePath.length - 3, 3),
|
|
//格式,图片
|
|
format: "image",
|
|
// 设置标识符
|
|
name: 'wximage'
|
|
})
|
|
} else {
|
|
_this.showToast('图片上限5M,请压缩后重试~')
|
|
return false
|
|
}
|
|
// 将uploadImageList赋值给uploadImageList
|
|
_this.setData({
|
|
uploadImageList
|
|
})
|
|
// 上传到服务器
|
|
wx.uploadFile({
|
|
// 服务器的地址
|
|
url: `${config.BASEURL()}oss/file/uploadvariedfile`,
|
|
//上传的本地路径
|
|
filePath: res.tempFiles[0].tempFilePath,
|
|
//文件都相应的key
|
|
name: 'file',
|
|
// 头部标识
|
|
header: {
|
|
'Content-type': 'application/json;charset=UTF-8',
|
|
'Authorization': wx.getStorageSync('token')
|
|
},
|
|
success(fileRes) {
|
|
//不懂
|
|
console.log("执行了")
|
|
console.log(fileRes)
|
|
// 这段代码片段中 !JSON.parse(fileRes.data).data 是一个条件表达式,它用于判断 fileRes.data 中是否包含 data 属性的值。
|
|
//fileRes将json转化为一个javascript对象
|
|
if (!JSON.parse(fileRes.data).data) {
|
|
_this.showToast('图片上传失败,请重试~')
|
|
// 删除上传失败的图片
|
|
// findIndex是找到符合条件的第一个索引
|
|
const index = _this.data.uploadImageList.findIndex(item => item.imageId === _this.data.imageId)
|
|
if (index > -1) {
|
|
// 删掉splice索引为1
|
|
_this.data.uploadImageList.splice(index, 1)
|
|
//更新uploadImageList
|
|
_this.setData({
|
|
uploadImageList: _this.data.uploadImageList
|
|
})
|
|
}
|
|
} else {
|
|
// 上传uploaded为true
|
|
uploadImageList[uploadImageList.length - 1].uploaded = true
|
|
// ossUrl为data
|
|
uploadImageList[uploadImageList.length - 1].ossUrl = JSON.parse(fileRes.data).data
|
|
_this.setData({
|
|
uploadImageList
|
|
})
|
|
}
|
|
},
|
|
fail(fileRes) {
|
|
_this.setData({
|
|
uploadImageList: []
|
|
})
|
|
_this.showToast('图片上传失败,请重试~')
|
|
}
|
|
})
|
|
}
|
|
})
|
|
} else if (index === 1) {
|
|
wx.chooseMedia({
|
|
count: 1,
|
|
type: 'image', //类型是图片
|
|
sourceType: ['album'], //允许从相册李删选
|
|
success(res) {
|
|
console.log(res, '图片上传的res');
|
|
let deleteLength = _this.data.uploadImageList.length
|
|
const uploadImageList = []
|
|
const endIndex = _this.data.uploadImageList.length
|
|
res.tempFiles.forEach((item, index) => {
|
|
if (item.size <= 5 * 1024 * 1024) {
|
|
uploadImageList.push({
|
|
uploaded: false,
|
|
ossUrl: {
|
|
url: item.tempFilePath
|
|
},
|
|
imgUrl: item.tempFilePath,
|
|
imageId: ++_this.data.imageId,
|
|
format: "image",
|
|
type: item.tempFilePath.substr(item.tempFilePath.length - 3, 3),
|
|
originFileName: 'image' + index + 1
|
|
})
|
|
console.log(uploadImageList)
|
|
} else {
|
|
_this.showToast('图片上限5M,请压缩后重试~')
|
|
}
|
|
})
|
|
_this.setData({
|
|
uploadImageList: [..._this.data.uploadImageList, ...uploadImageList]
|
|
})
|
|
console.log(_this.data.uploadImageList)
|
|
console.log(uploadImageList)
|
|
uploadImageList.forEach((item, index) => {
|
|
return (function (index) {
|
|
wx.uploadFile({
|
|
url: `${config.BASEURL()}oss/file/uploadvariedfile`,
|
|
filePath: res.tempFiles[index].tempFilePath,
|
|
name: 'file',
|
|
header: {
|
|
'Content-type': 'application/json;charset=UTF-8',
|
|
'Authorization': wx.getStorageSync('token')
|
|
},
|
|
success(fileRes) {
|
|
if (!JSON.parse(fileRes.data).data) {
|
|
_this.showToast('图片上传失败,请重试~')
|
|
_this.data.uploadImageList.splice(deleteLength, _this.data.uploadImageList.length - deleteLength)
|
|
_this.setData({
|
|
uploadImageList: _this.data.uploadImageList
|
|
})
|
|
} else {
|
|
uploadImageList[index].uploaded = true
|
|
uploadImageList[index].ossUrl = JSON.parse(fileRes.data).data
|
|
_this.data.uploadImageList = _this.data.uploadImageList.slice(0, endIndex)
|
|
_this.setData({
|
|
uploadImageList: [..._this.data.uploadImageList, ...uploadImageList]
|
|
})
|
|
}
|
|
},
|
|
fail(fileRes) {
|
|
_this.setData({
|
|
uploadImageList: []
|
|
})
|
|
_this.showToast('图片上传失败,请重试~')
|
|
}
|
|
})
|
|
})(index)
|
|
})
|
|
}
|
|
})
|
|
}
|
|
return true
|
|
},
|
|
cancelText: '取消',
|
|
//cancel():当用户点击取消按钮时触发的回调函数。你可以在这个回调函数中执行相应的操作,比如关闭弹出框或者执行其他逻辑。
|
|
|
|
//destructiveButtonClicked():当用户点击了破坏性按钮(如果有)时触发的回调函数。破坏性按钮通常用于执行一些危险操作,比如删除或者清除数据等。
|
|
cancel() {},
|
|
destructiveButtonClicked() {},
|
|
})
|
|
},
|
|
// 删除选中的图片
|
|
deleteImage(e) {
|
|
const index = this.data.uploadImageList.findIndex(item => item.imageId === e.currentTarget.dataset.imageid)
|
|
if (index > -1) {
|
|
this.data.uploadImageList.splice(index, 1)
|
|
this.setData({
|
|
uploadImageList: this.data.uploadImageList
|
|
})
|
|
}
|
|
},
|
|
//跳转地图选点
|
|
toughGetLocation() {
|
|
// this.getLocation(false);
|
|
wx.chooseLocation({
|
|
success: res => {
|
|
console.log('resadddres', res)
|
|
const {
|
|
fmData
|
|
} = this.data;
|
|
this.setData({
|
|
fmData: {
|
|
...fmData,
|
|
address: res.address,
|
|
longitude: res.longitude,
|
|
latitude: res.latitude
|
|
},
|
|
addressContent: res.address
|
|
});
|
|
console.log(this.data.fmData);
|
|
}
|
|
})
|
|
},
|
|
//
|
|
reverseLocation() {
|
|
const _this = this
|
|
this.data.qqMapWX.reverseGeocoder({
|
|
success(res) {
|
|
console.log(res);
|
|
_this.setData({
|
|
addressContent: res.result.address,
|
|
'fmData.address': res.result.address,
|
|
'fmData.longitude': res.result.location.lng,
|
|
'fmData.latitude': res.result.location.lat,
|
|
})
|
|
},
|
|
fail(err) {
|
|
console.debug(err)
|
|
}
|
|
})
|
|
},
|
|
closePopup() {
|
|
this.setData({ showPopup: false });
|
|
},
|
|
handelConfirmDate(value){
|
|
this.setData({
|
|
showtime:false,
|
|
currentDateShow:timestampToTime(value.detail,1),
|
|
currentDate:value.detail
|
|
|
|
})
|
|
},
|
|
onInput(event) {
|
|
var date = new Date(event.detail);
|
|
var year = date.getFullYear();
|
|
var month = ("0" + (date.getMonth() + 1)).slice(-2);
|
|
var day = ("0" + date.getDate()).slice(-2);
|
|
var hour = ("0" + date.getHours()).slice(-2);
|
|
var minute = ("0" + date.getMinutes()).slice(-2);
|
|
var second = ("0" + date.getSeconds()).slice(-2);
|
|
var formattedDateTime = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
|
|
console.log(formattedDateTime);
|
|
this.setData({
|
|
getData:formattedDateTime
|
|
})
|
|
console.log(this.data.getData)
|
|
},
|
|
|
|
|
|
onConfirm(event) {
|
|
const { value } = event.detail;
|
|
this.setData({
|
|
currentDate: value,
|
|
showtime: false
|
|
});
|
|
console.log('选中的日期时间:', new Date(value));
|
|
},
|
|
|
|
onCancel() {
|
|
this.setData({ showtime: false });
|
|
},
|
|
input122(event){
|
|
console.log(event);
|
|
}
|
|
})
|