epmet 工作端 小程序
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.
 

255 lines
7.5 KiB

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: [],
header: {
'Content-type': 'application/json;charset=UTF-8',
'Authorization': wx.getStorageSync('token')
},
url: `${config.BASEURL()}oss/file/uploadvariedfile`,
form: {
operationType: "5", //处理方式[0:已回复 5、指派 6、完成并回复]
content: "",//转办意见
timeLimit: "",//办结时限
categoryId: "",//事件分类
deptId: "", //指派部门
deptName: "",
categoryList: [],
files: [] //附件
},
orgOptions: [],
casOptions: [],
visible1: false,
visible2: false,
catField: {label: 'categoryName', value: 'id', children: 'children'},
orgField: {label: 'agencyName', value: 'agencyId', children: 'subAgencyList'},
orgName: "",
category: ""
},
ready: function () {
},
methods: {
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.cols[data.cols.length - 1][data.selectedIndex[data.selectedIndex.length - 1]]
this.setData({
"form.categoryId": params.id,
"form.categoryList": {...params, children: null}
})
this.setData({category: data.displayValue.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
console.log('onConfirm2', e.detail)
let params = data.cols[data.cols.length - 1][data.selectedIndex[data.selectedIndex.length - 1]]
this.setData({
"form.deptId": params.agencyId,
"form.deptName": params.agencyName,
"form.orgType": params.level
})
this.setData({orgName: data.displayValue.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: res.data.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: treeDataNew
});
})
},
close() {
this.triggerEvent('close')
},
openCalendar1() {
this.selectComponent('#wux-calendar').open({
// $wuxCalendar('#wux-calendar1').open({
value: this.data.value1,
onChange: (values, displayValues) => {
console.log('onChange', values, displayValues)
this.setData({
value1: displayValues,
})
},
})
},
onChange(e) {
console.log('onChange', e)
const {file, fileList} = e.detail
if (file.status === 'uploading') {
this.setData({
progress: 0,
})
wx.showLoading()
} else if (file.status === 'done') {
this.setData({
imageUrl: file.url,
})
}
// Controlled state should set fileList
this.setData({fileList})
},
onSuccess(e) {
console.log('onSuccess', e)
},
onFail(e) {
console.log('onFail', e)
},
onComplete(e) {
console.log('onComplete', e)
wx.hideLoading()
},
onProgress(e) {
console.log('onProgress', e)
this.setData({
progress: e.detail.file.progress,
})
},
onPreview(e) {
console.log('onPreview', e)
const {file, fileList} = e.detail
wx.previewImage({
current: file.url,
urls: fileList.map((n) => n.url),
})
},
onRemove(e) {
const {file, fileList} = e.detail
wx.showModal({
content: '确定删除?',
success: (res) => {
if (res.confirm) {
this.setData({
fileList: fileList.filter((n) => n.uid !== file.uid),
})
}
},
})
},
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)
}
}
});