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.
307 lines
7.8 KiB
307 lines
7.8 KiB
import {agencygridtree, getCategoryTree, icEventOldReply} from "../../../../utils/statisticsApi";
|
|
const config = require('../../../../utils/config')
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
tabVal: "0",
|
|
category: "",
|
|
uploadImageList: [], //图片上传的数组
|
|
visible1: false,
|
|
visible2: false,
|
|
orgOptions: [],
|
|
casOptions: [],
|
|
catField: {text: 'categoryName', value: 'id', children: 'children'},
|
|
orgField: {text: 'agencyName', value: 'agencyId', children: 'subAgencyList'},
|
|
|
|
id: '',
|
|
fileList: [],
|
|
timeLimit: [],
|
|
operationType: ["0"],
|
|
|
|
form: {
|
|
operationType: "0", //处理方式[0:已回复 5、指派 6、完成并回复]
|
|
content: "",//转办意见
|
|
timeLimit: "",//办结时限
|
|
categoryId: "",//事件分类
|
|
deptId: "", //指派部门
|
|
deptName: "",
|
|
categoryList: [],
|
|
files: [] //附件
|
|
},
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
if (options.id) {
|
|
this.setData({
|
|
id: options.id,
|
|
})
|
|
}
|
|
console.log("eventId:"+this.data.id)
|
|
this.getCategoryList();
|
|
this.getOrgTreeList();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
},
|
|
|
|
handleChangeType(e) {
|
|
this.setData({
|
|
tabVal: e.detail.value,
|
|
"form.operationType": e.detail[0]
|
|
})
|
|
},
|
|
|
|
getCategoryList() {
|
|
console.log("getCategoryList.......");
|
|
let params = {};
|
|
getCategoryTree(params).then(res => {
|
|
let treeDataNew = this.deepTree(res.data, "children");
|
|
console.log(treeDataNew, 'treeDataNew')
|
|
this.setData({
|
|
casOptions: this.deleteChildren(treeDataNew, "children")
|
|
});
|
|
})
|
|
},
|
|
|
|
getOrgTreeList() {
|
|
let params = {
|
|
agencyId: this.data.agencyId,
|
|
purpose: "query"
|
|
}
|
|
agencygridtree(params).then(res => {
|
|
this.setData({
|
|
orgOptions: this.deleteChildren(res.data.subAgencyList, 'subAgencyList')
|
|
})
|
|
})
|
|
},
|
|
|
|
//重构树,去除网格
|
|
deepTree(arr, children) {
|
|
if (Array.isArray(arr) && arr.length > 0) {
|
|
return arr.map((item) => {
|
|
return {
|
|
...item,
|
|
[children]:
|
|
(item[children] &&
|
|
item[children].length > 0 &&
|
|
this.deepTree(item[children], children)) ||
|
|
null,
|
|
};
|
|
});
|
|
}
|
|
},
|
|
|
|
deleteChildren(node, key) {
|
|
node.forEach(item => {
|
|
if (key in item && !item[key]) {
|
|
delete item[key]
|
|
} else if (key in item && item[key].length) {
|
|
this.deleteChildren(item[key], key)
|
|
}
|
|
})
|
|
return node
|
|
},
|
|
|
|
onOpen1() {
|
|
this.setData({visible1: true})
|
|
},
|
|
onClose1() {
|
|
this.setData({visible1: false})
|
|
console.log('onClose1')
|
|
},
|
|
|
|
onConfirm1(e) {
|
|
console.log('onConfirm1', e.detail)
|
|
let data = e.detail
|
|
let params = data.selectedOptions[data.selectedOptions.length - 1]
|
|
this.setData({
|
|
"form.categoryId": params.id,
|
|
"form.categoryList": {...params, children: null},
|
|
visible1: false
|
|
})
|
|
this.setData({category: data.selectedOptions.map(item => item.categoryName).join('/')})
|
|
},
|
|
|
|
onOpen2() {
|
|
this.setData({visible2: true})
|
|
},
|
|
onClose2() {
|
|
this.setData({visible2: false})
|
|
console.log('onClose2')
|
|
},
|
|
onConfirm2(e) {
|
|
let data = e.detail
|
|
|
|
let params = data.selectedOptions[data.selectedOptions.length - 1]
|
|
this.setData({
|
|
"form.deptId": params.agencyId,
|
|
"form.deptName": params.agencyName,
|
|
"form.orgType": params.level,
|
|
visible2: false
|
|
})
|
|
this.setData({orgName: data.selectedOptions.map(item => item.agencyName).join('/')})
|
|
},
|
|
|
|
afterRead(event) {
|
|
const {file} = event.detail;
|
|
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
|
|
wx.uploadFile({
|
|
url: `${config.BASEURL()}oss/file/uploadvariedfile`,
|
|
name: 'file',
|
|
header: {
|
|
'Content-type': 'application/json;charset=UTF-8',
|
|
'Authorization': wx.getStorageSync('token')
|
|
},
|
|
filePath: file.url,
|
|
success: (res) => {
|
|
let data = JSON.parse(res.data)
|
|
const fileList = this.data.fileList;
|
|
fileList.push({...file, url: data.data.url});
|
|
console.log(fileList)
|
|
this.setData({fileList});
|
|
},
|
|
});
|
|
},
|
|
|
|
deleteFile(e) {
|
|
console.log(e)
|
|
let index = e.detail.index
|
|
let fileList = this.data.fileList
|
|
fileList.splice(index, 1)
|
|
this.setData({
|
|
fileList
|
|
})
|
|
},
|
|
|
|
openCalendar1() {
|
|
this.setData({
|
|
showDate: true
|
|
})
|
|
},
|
|
onCloseDate() {
|
|
this.setData({showDate: false});
|
|
},
|
|
formatDate(date) {
|
|
date = new Date(date);
|
|
return `${date.getFullYear()}-${date.getMonth() + 1 > 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1)}-${date.getDate() > 10 ? date.getDate() : '0' + date.getDate()}`;
|
|
},
|
|
onConfirmDate(event) {
|
|
console.log(event)
|
|
const date = event.detail;
|
|
this.setData({
|
|
showDate: false,
|
|
"form.timeLimit": `${this.formatDate(date)} 00:00:00`,
|
|
});
|
|
},
|
|
|
|
// 双向绑定 内容输入框
|
|
bindTextareaInput(e) {
|
|
this.setData({
|
|
'form.content': e.detail.value
|
|
})
|
|
console.log(this.data.fmData);
|
|
},
|
|
|
|
submitEventReplyInfo(){
|
|
console.log("this.data.form:"+this.data.form.content);
|
|
if (!this.data.form.categoryId) {
|
|
this.showToast('事件类型不能为空')
|
|
return
|
|
}
|
|
if (!this.data.form.content) {
|
|
this.showToast('回复意见不能为空')
|
|
return
|
|
}
|
|
|
|
if (!this.data.form.timeLimit && (this.data.tabVal==0 || this.data.tabVal==5)) {
|
|
this.showToast('办结时限不能为空')
|
|
return
|
|
}
|
|
if (!this.data.form.deptId && this.data.tabVal==5) {
|
|
this.showToast('指派部门不能为空')
|
|
return
|
|
}
|
|
|
|
let params = {
|
|
...this.data.form,
|
|
files: this.data.fileList,
|
|
icEventId: this.data.id,
|
|
status: "processing",
|
|
// timeLimit: this.data.value1 && this.data.value1.length ? this.data.value1[0] : ""
|
|
}
|
|
icEventOldReply(params).then(res => {
|
|
wx.showToast({
|
|
icon: 'success',
|
|
title: '操作成功'
|
|
})
|
|
this.close()
|
|
})
|
|
console.log(params)
|
|
},
|
|
|
|
close() {
|
|
this.triggerEvent('close')
|
|
},
|
|
|
|
// 代码简化,弹窗统一封装
|
|
showToast(title) {
|
|
wx.showToast({
|
|
title: title,
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
},
|
|
|
|
})
|