14 changed files with 1781 additions and 80 deletions
@ -0,0 +1,307 @@ |
|||
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 |
|||
}) |
|||
}, |
|||
|
|||
}) |
@ -0,0 +1,8 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"van-cascader": "@vant/weapp/cascader/index", |
|||
"van-popup": "@vant/weapp/popup/index", |
|||
"van-calendar": "@vant/weapp/calendar/index", |
|||
"van-uploader": "@vant/weapp/uploader/index" |
|||
} |
|||
} |
@ -0,0 +1,113 @@ |
|||
<view class="complete-info" > |
|||
<view class="content"> |
|||
<view class="personal-info"> |
|||
<view class="basic-info"> |
|||
<view class="item"> |
|||
<view class="field" > |
|||
<text class="must">*</text> |
|||
<view class="field-text">处理方式</view> |
|||
</view> |
|||
<view class="value"> |
|||
<radio-group class="radio-group" bind:change="handleChangeType"> |
|||
<radio checked="{{tabVal === '0'}}" value="0" checked="true" color="#4193fe" class="radio small-radio" style="font-size: 12px;">回复</radio> |
|||
<radio checked="{{tabVal === '5'}}" value="5" color="#4193fe" class="radio small-radio" style="font-size: 12px;">指派</radio> |
|||
<radio checked="{{tabVal === '6'}}" value="6" color="#4193fe" class="radio small-radio" style="font-size: 12px;">完成并回复</radio> |
|||
</radio-group> |
|||
</view> |
|||
</view> |
|||
<view class="item"> |
|||
<view class="field" > |
|||
<text class="must">*</text> |
|||
<view class="field-text">事件分类</view> |
|||
</view> |
|||
<view class="value-dl" bind:tap="onOpen1"> |
|||
<view class="di-name">{{category?category:'请选择'}}</view> |
|||
<image class="di-but" src="../../../../images/right.png" mode="aspectFit" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="item" wx:if="{{tabVal == 5}}"> |
|||
<view class="field"> |
|||
<text class="must">*</text> |
|||
<view class="field-text">处理部门</view> |
|||
</view> |
|||
<view class="value-dl" bind:tap="onOpen2"> |
|||
<view class="{{orgName?'di-name':'di-name1'}}">{{orgName?orgName:'请选择'}}</view> |
|||
|
|||
<image class="di-but" src="../../../../images/right.png" mode="aspectFit" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="add-issue"> |
|||
<view class="issue-content"> |
|||
<view class="item"> |
|||
<view class="field"> |
|||
<text class="must">*</text> |
|||
<view class="field-text">{{tabVal === '5'?'转办意见':'回复内容'}}</view> |
|||
</view> |
|||
</view> |
|||
<textarea maxlength="500" value="{{form.content}}" bindblur="bindTextareaInput" bindinput="bindTextareaInput" bindfocus="bindTextareaFocus" placeholder="请输入事件描述(不超过500字)"> |
|||
</textarea> |
|||
</view> |
|||
</view> |
|||
<!-- 上传附件 --> |
|||
<view class="item" wx:if="{{tabVal == 5 || tabVal==6}}"> |
|||
<view class="field"> |
|||
<text class="must"></text> |
|||
<view class="field-text">附件</view> |
|||
</view> |
|||
<view> |
|||
<van-uploader file-list="{{ fileList }}" bind:delete="deleteFile" max-count="4" bind:after-read="afterRead" /> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="item" wx:if="{{tabVal == 0 || tabVal==5}}" bind:tap="openCalendar1"> |
|||
<view class="field"> |
|||
<text class="must">*</text> |
|||
<view class="field-text">办结时限</view> |
|||
</view> |
|||
<view class="value flex {{form.timeLimit?'':'gray'}}"> |
|||
{{form.timeLimit ? form.timeLimit : '请选择'}} |
|||
<van-icon name="arrow" /> |
|||
</view> |
|||
</view> |
|||
|
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="submit-button"> |
|||
<button bindtap="submitEventReplyInfo" hover-class="hover-submit" >保存</button> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<van-popup show="{{ visible1 }}" round position="bottom"> |
|||
<van-cascader |
|||
wx:if="{{ visible1 }}" |
|||
default-value="{{ value1 }}" |
|||
title="事件分类" |
|||
options="{{ casOptions }}" |
|||
bind:close="onClose1" |
|||
bind:finish="onConfirm1" |
|||
field-names="{{catField}}" |
|||
/> |
|||
</van-popup> |
|||
|
|||
<van-popup show="{{ visible2 }}" round position="bottom"> |
|||
<van-cascader |
|||
wx:if="{{ visible2 }}" |
|||
default-value="{{ value2 }}" |
|||
title="处理部门" |
|||
options="{{ orgOptions }}" |
|||
bind:close="onClose2" |
|||
bind:finish="onConfirm2" |
|||
field-names="{{orgField}}" |
|||
/> |
|||
</van-popup> |
|||
|
|||
<van-calendar |
|||
show="{{ showDate }}" |
|||
bind:close="onCloseDate" |
|||
bind:confirm="onConfirmDate" |
|||
/> |
File diff suppressed because it is too large
@ -1,7 +1,9 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"load-more": "../../../../components/loadMore/loadMore", |
|||
"no-data": "../../../../components/noData/nodata" |
|||
"no-data": "../../../../components/noData/nodata", |
|||
"van-tab": "@vant/weapp/tab/index", |
|||
"van-tabs": "@vant/weapp/tabs/index" |
|||
}, |
|||
"navigationBarTitleText": "我摸排的诉求" |
|||
} |
Loading…
Reference in new issue