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.

375 lines
12 KiB

// pages/school/projectHandle/index.js
const app = getApp()
Page({
//文件预览
filePreview(e) {
if (e.currentTarget.dataset.typeid == '2') {
wx.previewImage({
urls: [app.globalData.serverUrl + e.currentTarget.dataset.fileurl]
});
} else {
let _suffix = e.currentTarget.dataset.suffix
wx.downloadFile({
url: app.globalData.serverUrl + e.currentTarget.dataset.fileurl,
success: function (res) {
if (res.statusCode === 200) {
var Path = res.tempFilePath
wx.openDocument({
fileType: _suffix,
filePath: Path,
success: function (res) {
console.log('打开文件成功');
}
})
}
},
fail: function (res) {
console.log(res); //失败
}
})
}
},
toastShow(msgTitle) {
const toast = this.selectComponent('#submitToast');
toast.linShow({
title: msgTitle,
duration: 5000
});
},
toastHide(msgType) {
const toast = this.selectComponent('#submitToast');
toast.linHide();
if (msgType == '1') {
wx.navigateBack({});
}
},
//审核
check(e) {
let _checkType = e.currentTarget.dataset.type;
let _dataType = [];
if (this.data.stepCode == '02') {
_dataType = this.data.zbcgData;
} else {
_dataType = this.data.ssysData;
}
let _documentTypeId = _dataType.list[_dataType.currentStepNum].stepDocuemntTypeList[0].document_type_id;
let _progressId = this.data.progressId;
wx.navigateTo({
url: '/pages/project/check/index?checkType=' + _checkType + '&documentTypeId=' + _documentTypeId + '&progressId=' + _progressId
});
},
//监听输入框内容
onInputValue(e) {
this.setData({
inputValue: e.detail.value
});
},
//单选框的选择项
onRadioChange(e) {
this.setData({
radioId: e.detail.currentKey
});
},
//提交
submit() {
let that = this;
wx.request({
url: app.globalData.serverUrl + '/baseService/gtzz/submitStep',
method: "POST",
header: {
'content-type': 'application/x-www-form-urlencoded',
'cookie': wx.getStorageSync('sessionid')
},
data: {
progress_id: this.data.progressId,
radio_id: this.data.radioId,
input_value: this.data.inputValue
},
success(res) {
if (res.data.success) {
that.toastShow('提交成功!');
setTimeout(function () {
that.toastHide('1')
}, 1500);
} else {
that.toastShow(res.data.message);
setTimeout(function () {
that.toastHide('0')
}, 3000);
}
}
});
},
//删除上传的文件
delFile(e) {
this.setData({
dialogShow: true,
delFileId: e.currentTarget.dataset.fileid
});
},
//删除上传文件的删除提示
onConfirmTap(e) {
this.deleteProgressFile(this.data.delFileId);
},
//上传文件
uploadFile(e) {
let documentTypeId = e.currentTarget.dataset.doctype;
let that = this;
wx.chooseMessageFile({
success(res) {
const tempFiles = res.tempFiles
for (let i = 0; i < tempFiles.length; i++) {
let _path = tempFiles[i].path;
let _name = tempFiles[i].name;
if (tempFiles[i] == 'image') {
_name = '图片文件.jpg';
}
wx.uploadFile({
url: app.globalData.serverUrl + '/baseService/gtzz/uploadFile',
filePath: _path,
name: 'file',
formData: {
'progress_id': that.data.progressId,
'document_type_id': documentTypeId,
'fileName': _name
},
success(res) {
if (that.data.stepCode == '02') {
that.getZbcgTimeLineData();
} else {
that.getSsysTimeLineData();
}
}
});
}
}
});
},
//上传图片
uploadImg(e) {
let documentTypeId = e.currentTarget.dataset.doctype;
let that = this;
wx.chooseImage({
success(res) {
const tempFilePaths = res.tempFilePaths
for (let i = 0; i < tempFilePaths.length; i++) {
let tempFilePath = tempFilePaths[i];
wx.uploadFile({
url: app.globalData.serverUrl + '/baseService/gtzz/uploadFile',
filePath: tempFilePath,
name: 'file',
formData: {
'progress_id': that.data.progressId,
'document_type_id': documentTypeId,
'fileName': '图片文件.jpg'
},
success(res) {
if (that.data.stepCode == '02') {
that.getZbcgTimeLineData();
} else {
that.getSsysTimeLineData();
}
}
});
}
}
});
},
//获取招标采购的时间线数据
getZbcgTimeLineData() {
let that = this;
wx.request({
url: app.globalData.serverUrl + '/baseService/gtzz/getTimeLineData',
method: "GET",
header: {
'content-type': 'application/json; charset=utf-8',
'cookie': wx.getStorageSync('sessionid')
},
data: {
progress_id: this.data.progressId,
step_code: '02',
can_do:this.data.canDo
},
success(res) {
that.setData({
zbcgData: res.data
})
}
});
},
//获取实施验收的时间线数据
getSsysTimeLineData() {
let that = this;
wx.request({
url: app.globalData.serverUrl + '/baseService/gtzz/getTimeLineData',
method: "GET",
header: {
'content-type': 'application/json; charset=utf-8',
'cookie': wx.getStorageSync('sessionid')
},
data: {
progress_id: this.data.progressId,
step_code: '03',
can_do:this.data.canDo
},
success(res) {
that.setData({
ssysData: res.data
})
}
});
},
//获取指定项目的信息
getSubjectExtInfo() {
let that = this;
wx.request({
url: app.globalData.serverUrl + '/baseService/gtzz/getSubjectExtInfo',
method: "GET",
header: {
'content-type': 'application/json; charset=utf-8',
'cookie': wx.getStorageSync('sessionid')
},
data: {
progress_id: this.data.progressId
},
success(res) {
that.setData({
piSubjectTypeName: res.data.subject_type_name,
piExSendOrgName: res.data.ex_send_org_name,
piTaskYear: res.data.task_year,
piCreateTime: res.data.create_time,
piXmjj:res.data.xmjj,
piZtz: res.data.ztz
})
}
});
},
//删除指定步骤下的文件
deleteProgressFile(fileId) {
let that = this;
wx.request({
url: app.globalData.serverUrl + '/baseService/gtzz/deleteProgressFile',
method: "POST",
header: {
'content-type': 'application/x-www-form-urlencoded',
'cookie': wx.getStorageSync('sessionid')
},
data: {
progress_id: this.data.progressId,
file_id: fileId
},
success(res) {
if (that.data.stepCode == '02') {
that.getZbcgTimeLineData();
} else {
that.getSsysTimeLineData();
}
}
});
},
//获取指定流水号对应步骤的配置数据
getStepInfoByProgressId() {
let that = this;
wx.request({
url: app.globalData.serverUrl + '/baseService/gtzz/getStepInfoByProgressId',
method: "GET",
header: {
'content-type': 'application/json; charset=utf-8',
'cookie': wx.getStorageSync('sessionid')
},
data: {
progress_id: this.data.progressId
},
success(res) {
that.setData({
submitBtn: res.data
})
}
});
},
/**
* 页面的初始数据
*/
data: {
canDo:0,
progressId: 0,
stepCode: '',
radioId: 0,
inputValue: '',
collapseExpandId: [],
//招标采购数据
zbcgData: {},
//实施验收数据
ssysData: {},
dialogShow: false,
delFileId: '',
collapseSsysDisable: true,
collapseXmbfDisable: true,
submitBtn: {},
loadingHidden: false,
piSubjectTypeName:'',
piExSendOrgName:'',
piTaskYear:'',
piCreateTime:'',
piXmjj:'',
piZtz:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let expandId = ''
let _stepCode = options.stepCode;
let _canDo = options.canDo;
if (_stepCode == '02') {
expandId = '2'
} else {
expandId = '3'
}
this.setData({
progressId: options.progressId,
stepCode: _stepCode,
canDo:_canDo,
collapseExpandId: [expandId]
});
this.getSubjectExtInfo();
this.getZbcgTimeLineData();
if (_stepCode == '03') {
this.getSsysTimeLineData();
this.setData({
collapseSsysDisable: false
});
}
this.getStepInfoByProgressId();
this.setData({
loadingHidden: true
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
}
})