274 lines
6.4 KiB
JavaScript
274 lines
6.4 KiB
JavaScript
|
|
// pageage/samplingRetestingDeliver/index.js
|
|
const app = getApp()
|
|
|
|
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
educationTypeList:[
|
|
{
|
|
text:'项目11',
|
|
id:'1'
|
|
},
|
|
{
|
|
text:'项目22',
|
|
id:'2'
|
|
},
|
|
],
|
|
id:"",
|
|
projectId:"",
|
|
retestListData:[],
|
|
retestDataInfo:{},
|
|
maxDate:new Date(2100,1,1).getTime(),
|
|
typeFlag:"1",
|
|
inspectionTime:"",
|
|
sampleTime:"",
|
|
loadShow:false
|
|
},
|
|
|
|
/**
|
|
* 获取复试类型数据
|
|
*/
|
|
getRetestListChange(){
|
|
let retestListData = []
|
|
var that = this
|
|
wx.request({
|
|
url: app.globalData.szhUrl + '/system/dict/data/listData',
|
|
method:"post",
|
|
data:{
|
|
dictType:"fslx_value"
|
|
},
|
|
header: {
|
|
'content-type': 'application/x-www-form-urlencoded' //修改此处即可
|
|
},
|
|
success(res){
|
|
if(res.data.code == 0){
|
|
let {rows} = res.data
|
|
rows.forEach(item=>{
|
|
retestListData.push({
|
|
id:item.dictValue,
|
|
text:item.dictLabel
|
|
})
|
|
})
|
|
that.setData({
|
|
retestListData
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 选择复试类型类型
|
|
*/
|
|
onRetestListChange(e){
|
|
let {id} = e.detail
|
|
this.setData({
|
|
typeFlag:id
|
|
})
|
|
},
|
|
/**
|
|
* 选择送检时间
|
|
*/
|
|
onInspectionTime(e){
|
|
|
|
let value = e.detail
|
|
|
|
this.setData({
|
|
inspectionTime:value
|
|
})
|
|
},
|
|
/**
|
|
* 选择取样时间
|
|
*/
|
|
onSampleTime(e){
|
|
let value = e.detail
|
|
this.setData({
|
|
sampleTime:value
|
|
})
|
|
},
|
|
add_btn_qx(e){
|
|
wx.navigateTo({
|
|
url: '../samplingRetesting/index',
|
|
})
|
|
},
|
|
/**
|
|
* 数据提交
|
|
*/
|
|
formSubmit(e){
|
|
let that = this
|
|
let {laboratoryName,materialName,positionName,qualifiedFlag,represenNum,sampleBy,sampleNum,witnessBy} = e.detail.value
|
|
let {id,projectId,inspectionTime,typeFlag,sampleTime} = this.data
|
|
//数据校验
|
|
if(!that.checkRetestDataInfo(e.detail.value,this.data)){
|
|
return;
|
|
}
|
|
that.setData({
|
|
loadShow:true
|
|
})
|
|
wx.request({
|
|
url: app.globalData.szhUrl + '/system/retestinfo/add',
|
|
method:"Post",
|
|
data:{
|
|
//部门id
|
|
deptId:131,
|
|
//项目id
|
|
projectId,
|
|
//取样类型
|
|
typeFlag,
|
|
//取样时间
|
|
sampleTime,
|
|
//送检时间
|
|
inspectionTime,
|
|
//实验室名称
|
|
laboratoryName,
|
|
//物料名称
|
|
materialName,
|
|
//使用部位
|
|
positionName,
|
|
//是否提供合格证
|
|
qualifiedFlag,
|
|
//代表数量
|
|
represenNum,
|
|
//取样人
|
|
sampleBy,
|
|
//取样数量(组)
|
|
sampleNum,
|
|
//见证人
|
|
witnessBy,
|
|
//状态
|
|
resultStr:'待检'
|
|
},
|
|
header:{
|
|
'content-type': 'application/x-www-form-urlencoded'
|
|
},
|
|
success(res){
|
|
that.setData({
|
|
loadShow:false
|
|
})
|
|
if(res.code == "0"){
|
|
app.toast("保存成功!")
|
|
}
|
|
setTimeout(()=>{
|
|
wx.navigateTo({
|
|
url: '../samplingRetesting/index',
|
|
})
|
|
},1200)
|
|
}
|
|
})
|
|
console.log(e);
|
|
},
|
|
|
|
|
|
/**
|
|
* 数据校验
|
|
* @param {}} options
|
|
*/
|
|
checkRetestDataInfo({laboratoryName,materialName,positionName,qualifiedFlag,represenNum,sampleBy,sampleNum,witnessBy},{inspectionTime,typeFlag,sampleTime}){
|
|
|
|
if(!laboratoryName || laboratoryName.length <= 0){
|
|
app.toast("实验室名称不能为空!")
|
|
return false;
|
|
}
|
|
|
|
if(!materialName || materialName.length <= 0){
|
|
app.toast("物料名称不能为空!")
|
|
return false;
|
|
}
|
|
|
|
if(!positionName || positionName.length <= 0){
|
|
app.toast("使用部位名称不能为空!")
|
|
return false;
|
|
}
|
|
|
|
if(!qualifiedFlag || qualifiedFlag.length <= 0){
|
|
app.toast("是否提供合格证不能为空!")
|
|
return false;
|
|
}
|
|
if(!sampleNum || sampleNum.length <=0){
|
|
app.toast("实验室名称不能为空!")
|
|
return false;
|
|
}
|
|
|
|
if(!represenNum || represenNum.length <= 0){
|
|
app.toast("取样数量不能为空!")
|
|
return false;
|
|
}
|
|
|
|
if(!sampleBy || sampleBy.length <= 0){
|
|
app.toast("取样人名称不能为空!")
|
|
return false;
|
|
}
|
|
|
|
if(!witnessBy || witnessBy.length <= 0){
|
|
app.toast("见证人名称不能为空!")
|
|
return false;
|
|
}
|
|
|
|
if(!inspectionTime || inspectionTime.length <= 0){
|
|
app.toast("送检时间不能为空!")
|
|
return false;
|
|
}
|
|
|
|
if(!typeFlag || typeFlag.length <= 0){
|
|
app.toast("复试类型不能为空!")
|
|
return false;
|
|
}
|
|
|
|
if(!sampleTime || sampleTime.length <= 0){
|
|
app.toast("送检时间不能为空!")
|
|
return false;
|
|
}
|
|
return true
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
let {szhId} = options;
|
|
this.setData({
|
|
projectId:szhId
|
|
})
|
|
this.getRetestListChange()
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
* 置换名称
|
|
*/
|
|
convertRetesingName(item){
|
|
let typeName = ""
|
|
let typeFlag = item.typeFlag
|
|
switch(typeFlag){
|
|
case 1:
|
|
typeName = "钢筋原材料取样复试"
|
|
break;
|
|
case 2:
|
|
typeName = "钢筋试拉件取样复试"
|
|
break;
|
|
case 3:
|
|
typeName = "钢筋试拉件取样复试"
|
|
break;
|
|
case 4:
|
|
typeName = "混凝土试件取样复试"
|
|
break;
|
|
case 5:
|
|
typeName = "混凝土试件取样复试"
|
|
break;
|
|
|
|
}
|
|
return typeName;
|
|
},
|
|
|
|
}) |