|
|
|
import {agencygridtree, getCategoryTree, icEvent12345, icEventOld, icEventOldReply} from "../../utils/statisticsApi";
|
|
|
|
|
|
|
|
const config = require('../../utils/config')
|
|
|
|
Component({
|
|
|
|
properties: {
|
|
|
|
visible: {
|
|
|
|
type: Boolean,
|
|
|
|
value: false
|
|
|
|
},
|
|
|
|
eventId: {
|
|
|
|
type: String,
|
|
|
|
value: '',
|
|
|
|
observer: function (val) {
|
|
|
|
console.log(val)
|
|
|
|
this.setData({
|
|
|
|
id: val
|
|
|
|
})
|
|
|
|
this.getData()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
is12345: {
|
|
|
|
type: Boolean,
|
|
|
|
value: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data: {
|
|
|
|
value: 666,
|
|
|
|
|
|
|
|
detail: {},
|
|
|
|
agencyId: '',
|
|
|
|
id: '',
|
|
|
|
loading: true,
|
|
|
|
|
|
|
|
fileList: [],
|
|
|
|
timeLimit: [],
|
|
|
|
operationType: ["5"],
|
|
|
|
form: {
|
|
|
|
operationType: "5", //处理方式[0:已回复 5、指派 6、完成并回复]
|
|
|
|
content: "",//转办意见
|
|
|
|
timeLimit: "",//办结时限
|
|
|
|
categoryId: "",//事件分类
|
|
|
|
deptId: "", //指派部门
|
|
|
|
deptName: "",
|
|
|
|
categoryList: [],
|
|
|
|
files: [] //附件
|
|
|
|
},
|
|
|
|
|
|
|
|
orgOptions: [],
|
|
|
|
casOptions: [],
|
|
|
|
|
|
|
|
visible1: false,
|
|
|
|
visible2: false,
|
|
|
|
catField: {text: 'categoryName', value: 'id', children: 'children'},
|
|
|
|
orgField: {text: 'agencyName', value: 'agencyId', children: 'subAgencyList'},
|
|
|
|
orgName: "",
|
|
|
|
category: ""
|
|
|
|
},
|
|
|
|
ready: function () {
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
operationTypeChange(e) {
|
|
|
|
console.log(e.detail)
|
|
|
|
this.setData({
|
|
|
|
operationType: e.detail,
|
|
|
|
"form.operationType": e.detail[0]
|
|
|
|
})
|
|
|
|
},
|
|
|
|
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('/')})
|
|
|
|
},
|
|
|
|
setContent(e) {
|
|
|
|
console.log(e, 'eee')
|
|
|
|
this.setData({
|
|
|
|
"form.content": e.detail.value
|
|
|
|
})
|
|
|
|
},
|
|
|
|
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('/')})
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
getData() {
|
|
|
|
if (this.data.is12345) {
|
|
|
|
icEvent12345({icEventId: this.data.id}).then(res => {
|
|
|
|
this.getDetail(res.data);
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
icEventOld({icEventId: this.data.id}).then(res => {
|
|
|
|
this.getDetail(res.data);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
getDetail(data) {
|
|
|
|
this.setData({
|
|
|
|
detail: data,
|
|
|
|
agencyId: data.agencyId
|
|
|
|
})
|
|
|
|
this.getOrgTreeList();
|
|
|
|
this.getCategoryList();
|
|
|
|
},
|
|
|
|
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,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
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")
|
|
|
|
});
|
|
|
|
})
|
|
|
|
},
|
|
|
|
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
|
|
|
|
},
|
|
|
|
|
|
|
|
close() {
|
|
|
|
this.triggerEvent('close')
|
|
|
|
},
|
|
|
|
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`,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
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
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
sure() {
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|