|
|
@ -1,4 +1,4 @@ |
|
|
|
import {agencygridtree, getCategoryTree, icEventOldReply} from "../../../../utils/statisticsApi"; |
|
|
|
import {agencyGridDepttree, getCategoryTree, icEventOldReply} from "../../../../utils/statisticsApi"; |
|
|
|
const config = require('../../../../utils/config') |
|
|
|
Page({ |
|
|
|
|
|
|
@ -20,6 +20,11 @@ Page({ |
|
|
|
fileList: [], |
|
|
|
timeLimit: [], |
|
|
|
operationType: ["0"], |
|
|
|
categoryIds:'', |
|
|
|
|
|
|
|
currentDate: new Date().getTime(), |
|
|
|
minDate: new Date(2024, 0, 1).getTime(), |
|
|
|
maxDate: new Date().getTime(), |
|
|
|
|
|
|
|
form: { |
|
|
|
operationType: "0", //处理方式[0:已回复 5、指派 6、完成并回复]
|
|
|
@ -31,6 +36,8 @@ Page({ |
|
|
|
categoryList: [], |
|
|
|
files: [] //附件
|
|
|
|
}, |
|
|
|
|
|
|
|
categoryTreeData:[] |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
@ -42,7 +49,11 @@ Page({ |
|
|
|
id: options.id, |
|
|
|
}) |
|
|
|
} |
|
|
|
console.log("eventId:"+this.data.id) |
|
|
|
if (options.categoryIds) { |
|
|
|
this.setData({ |
|
|
|
categoryIds: options.categoryIds, |
|
|
|
}) |
|
|
|
} |
|
|
|
this.getCategoryList(); |
|
|
|
this.getOrgTreeList(); |
|
|
|
}, |
|
|
@ -99,7 +110,7 @@ Page({ |
|
|
|
handleChangeType(e) { |
|
|
|
this.setData({ |
|
|
|
tabVal: e.detail.value, |
|
|
|
"form.operationType": e.detail[0] |
|
|
|
"form.operationType": e.detail.value |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
@ -108,19 +119,70 @@ Page({ |
|
|
|
let params = {}; |
|
|
|
getCategoryTree(params).then(res => { |
|
|
|
let treeDataNew = this.deepTree(res.data, "children"); |
|
|
|
console.log(treeDataNew, 'treeDataNew') |
|
|
|
// console.log('treeDataNew:'+JSON.stringify(treeDataNew))
|
|
|
|
this.setData({ |
|
|
|
casOptions: this.deleteChildren(treeDataNew, "children") |
|
|
|
casOptions: this.deleteChildren(treeDataNew, "children"), |
|
|
|
categoryTreeData:treeDataNew |
|
|
|
}); |
|
|
|
const ids = this.data.categoryIds.split(","); |
|
|
|
const categoryPath = this.getCategoryPath(treeDataNew, ids); |
|
|
|
console.log("ids:"+ids); |
|
|
|
console.log("categoryPath:"+categoryPath); |
|
|
|
this.setData({ |
|
|
|
casOptions: this.deleteChildren(treeDataNew, "children"), |
|
|
|
category:this.getCategoryPath(treeDataNew, ids) |
|
|
|
}); |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
getCategoryPath(tree, ids) { |
|
|
|
let path = []; |
|
|
|
|
|
|
|
const traverse = (node) => { |
|
|
|
// 如果当前节点的id在ids中,添加到路径数组
|
|
|
|
if (ids.includes(node.id)) { |
|
|
|
path.push(node.categoryName); |
|
|
|
|
|
|
|
// 如果当前节点是最后一个id,返回路径
|
|
|
|
if (node.id === ids[ids.length - 1]) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 递归遍历子节点
|
|
|
|
if (node.children) { |
|
|
|
for (let child of node.children) { |
|
|
|
if (traverse(child)) { |
|
|
|
return true; // 找到路径后停止遍历
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 如果当前节点不匹配或者没有找到路径,从路径中移除该节点
|
|
|
|
if (path[path.length - 1] === node.categoryName) { |
|
|
|
path.pop(); |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
}; |
|
|
|
|
|
|
|
// 遍历整个树结构,查找路径
|
|
|
|
for (let node of tree) { |
|
|
|
if (traverse(node)) { |
|
|
|
break; // 找到路径后停止遍历
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return path.join('/'); |
|
|
|
}, |
|
|
|
|
|
|
|
getOrgTreeList() { |
|
|
|
let params = { |
|
|
|
agencyId: this.data.agencyId, |
|
|
|
purpose: "query" |
|
|
|
} |
|
|
|
agencygridtree(params).then(res => { |
|
|
|
agencyGridDepttree(params).then(res => { |
|
|
|
this.setData({ |
|
|
|
orgOptions: this.deleteChildren(res.data.subAgencyList, 'subAgencyList') |
|
|
|
}) |
|
|
@ -171,6 +233,8 @@ Page({ |
|
|
|
"form.categoryList": {...params, children: null}, |
|
|
|
visible1: false |
|
|
|
}) |
|
|
|
console.log("form.categoryId:"+this.data.form.categoryId); |
|
|
|
console.log("form.categoryList:"+JSON.stringify(this.data.form.categoryList)); |
|
|
|
this.setData({category: data.selectedOptions.map(item => item.categoryName).join('/')}) |
|
|
|
}, |
|
|
|
|
|
|
@ -207,8 +271,9 @@ Page({ |
|
|
|
filePath: file.url, |
|
|
|
success: (res) => { |
|
|
|
let data = JSON.parse(res.data) |
|
|
|
console.log("data:"+JSON.stringify(file)); |
|
|
|
const fileList = this.data.fileList; |
|
|
|
fileList.push({...file, url: data.data.url}); |
|
|
|
fileList.push({...file, attachmentUrl: data.data.url,attachmentName:file.name,attachmentFormat:file.type,attachmentType:file.type}); |
|
|
|
console.log(fileList) |
|
|
|
this.setData({fileList}); |
|
|
|
}, |
|
|
@ -226,10 +291,16 @@ Page({ |
|
|
|
}, |
|
|
|
|
|
|
|
openCalendar1() { |
|
|
|
console.log("openCalendar1.....") |
|
|
|
this.setData({ |
|
|
|
showDate: true |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
closePopup() { |
|
|
|
this.setData({ showPopup: false }); |
|
|
|
}, |
|
|
|
|
|
|
|
onCloseDate() { |
|
|
|
this.setData({showDate: false}); |
|
|
|
}, |
|
|
@ -237,13 +308,26 @@ Page({ |
|
|
|
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; |
|
|
|
|
|
|
|
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; |
|
|
|
this.setData({ |
|
|
|
getData:formattedDateTime |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
onConfirmDate(e) { |
|
|
|
this.setData({ |
|
|
|
'form.timeLimit': e.detail.label + ':00', |
|
|
|
showDate: false, |
|
|
|
"form.timeLimit": `${this.formatDate(date)} 00:00:00`, |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 双向绑定 内容输入框
|
|
|
@ -256,7 +340,7 @@ Page({ |
|
|
|
|
|
|
|
submitEventReplyInfo(){ |
|
|
|
console.log("this.data.form:"+this.data.form.content); |
|
|
|
if (!this.data.form.categoryId) { |
|
|
|
if (!this.data.category) { |
|
|
|
this.showToast('事件类型不能为空') |
|
|
|
return |
|
|
|
} |
|
|
@ -274,6 +358,7 @@ Page({ |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let params = { |
|
|
|
...this.data.form, |
|
|
|
files: this.data.fileList, |
|
|
|