Commit aa7bf2a9 by xiexiaoqin

任务相关接口对接

parent 91dd8c3a
...@@ -17,8 +17,8 @@ Component({ ...@@ -17,8 +17,8 @@ Component({
didMount() { didMount() {
this.getPages(1) this.getPages(1)
}, },
didUpdate() {}, didUpdate() { },
didUnmount() {}, didUnmount() { },
methods: { methods: {
getPages(current) { getPages(current) {
let that = this let that = this
...@@ -27,13 +27,16 @@ Component({ ...@@ -27,13 +27,16 @@ Component({
size: 10 size: 10
} }
getDynamicList(data).then(res => { getDynamicList(data).then(res => {
if (!res.data.data) {
return
}
// 第一层日程数据处理 // 第一层日程数据处理
let dynamicList = res.data.data.records.map((item,index) => { let dynamicList = res.data.data.records.map((item, index) => {
// 第二层日程下的动态数据处理 // 第二层日程下的动态数据处理
let meetingLogResourceList = item.meetingLogDataList.map((item2,index2) => { let meetingLogResourceList = item.meetingLogDataList.map((item2, index2) => {
if (item2.category === '2') { if (item2.category === '2') {
// 第三层处理动态下的文件或者任务数据 // 第三层处理动态下的文件或者任务数据
let meetingLogResourceList = item2.meetingLogResourceList.map((item3,index3) => { let meetingLogResourceList = item2.meetingLogResourceList.map((item3, index3) => {
return { return {
...item3, ...item3,
fileInfos: item3.fileInfos ? JSON.parse(item3.fileInfos) : '' fileInfos: item3.fileInfos ? JSON.parse(item3.fileInfos) : ''
...@@ -73,36 +76,36 @@ Component({ ...@@ -73,36 +76,36 @@ Component({
} }
}) })
}, },
touchstart(e){ touchstart(e) {
this.setData({ this.setData({
startX: e.changedTouches[0].clientX, startX: e.changedTouches[0].clientX,
startY: e.changedTouches[0].clientY, startY: e.changedTouches[0].clientY,
isTouchMove : this.data.isTouchMove ? !this.data.isTouchMove : this.data.isTouchMove isTouchMove: this.data.isTouchMove ? !this.data.isTouchMove : this.data.isTouchMove
}) })
}, },
touchmove(e) { touchmove(e) {
var that = this, var that = this,
startX = that.data.startX,//开始X坐标 startX = that.data.startX,//开始X坐标
startY = that.data.startY,//开始Y坐标 startY = that.data.startY,//开始Y坐标
touchMoveX = e.changedTouches[0].clientX,//滑动变化坐标 touchMoveX = e.changedTouches[0].clientX,//滑动变化坐标
touchMoveY = e.changedTouches[0].clientY,//滑动变化坐标 touchMoveY = e.changedTouches[0].clientY,//滑动变化坐标
//获取滑动角度 //获取滑动角度
angle = that.angle({ X: startX, Y: startY }, { X: touchMoveX, Y: touchMoveY }); angle = that.angle({ X: startX, Y: startY }, { X: touchMoveX, Y: touchMoveY });
var isTouchMove var isTouchMove
//滑动超过30度角 return //滑动超过30度角 return
if (Math.abs(angle) > 30) return; if (Math.abs(angle) > 30) return;
if (touchMoveX > startX){ //右滑 if (touchMoveX > startX) { //右滑
isTouchMove = false isTouchMove = false
}else{ //左滑 } else { //左滑
isTouchMove = true isTouchMove = true
} }
//更新数据 //更新数据
that.setData({ that.setData({
isTouchMove : isTouchMove, isTouchMove: isTouchMove,
touchMoveId: e.currentTarget.dataset.id touchMoveId: e.currentTarget.dataset.id
}) })
}, },
angle (start, end) { angle(start, end) {
var _X = end.X - start.X, var _X = end.X - start.X,
_Y = end.Y - start.Y _Y = end.Y - start.Y
//返回角度 /Math.atan()返回数字的反正切值 //返回角度 /Math.atan()返回数字的反正切值
......
import { login } from './login' import { login } from './login'
export default function http (data) { export default function http(data) {
if (getApp().globalData.token !== '') { if (getApp().globalData.token !== '') {
return new Promise((resolve, rejects) => { return new Promise((resolve, rejects) => {
dd.httpRequest({ dd.httpRequest({
...@@ -12,10 +12,13 @@ export default function http (data) { ...@@ -12,10 +12,13 @@ export default function http (data) {
method: data.method, method: data.method,
dataType: 'json', dataType: 'json',
data: data.data, data: data.data,
success: function(res) { success: function (res) {
resolve(res) if (res.data.code == 0) {
resolve(res);
}
}, },
fail: function(res) { fail: function (res) {
rejects(res) rejects(res)
console.log(res) console.log(res)
} }
...@@ -24,10 +27,12 @@ export default function http (data) { ...@@ -24,10 +27,12 @@ export default function http (data) {
} else { } else {
return new Promise((resolve, rejects) => { return new Promise((resolve, rejects) => {
login().then(res => { login().then(res => {
const { oapiUser } = res.data.data;
getApp().globalData.token = res.data.data.accessToken.access_token getApp().globalData.token = res.data.data.accessToken.access_token
getApp().globalData.name = res.data.data.oapiUser.name getApp().globalData.name = res.data.data.oapiUser.name
getApp().globalData.userid = res.data.data.oapiUser.userid getApp().globalData.userid = res.data.data.oapiUser.userid
getApp().globalData.avatar = res.data.data.oapiUser.avatar getApp().globalData.avatar = res.data.data.oapiUser.avatar
getApp().globalData.userInfo = JSON.stringify({ username: oapiUser.name, userId: oapiUser.userid, headUrl: oapiUser.avatar, "platform": "dingtalk" })
dd.httpRequest({ dd.httpRequest({
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
...@@ -37,10 +42,10 @@ export default function http (data) { ...@@ -37,10 +42,10 @@ export default function http (data) {
method: data.method, method: data.method,
data: data.data, data: data.data,
dataType: 'json', dataType: 'json',
success: function(res) { success: function (res) {
resolve(res) resolve(res)
}, },
fail: function(res) { fail: function (res) {
console.log(res) console.log(res)
} }
}) })
......
...@@ -248,49 +248,33 @@ export function isParticipate(data) { ...@@ -248,49 +248,33 @@ export function isParticipate(data) {
export function getMeetingRoomAffairs(id) { export function getMeetingRoomAffairs(id) {
return $http({ return $http({
method: 'get', method: 'get',
url: `/meet/meeting-log/datail/4902` url: `/meet/meeting-log/detail/${id}`
}) })
} }
//会议室创建新任务 //会议室创建新任务
export function createMeetingTask() { export function createMeetingTask(data) {
return $http({ return $http({
method: 'post', method: 'post',
data: JSON.stringify(data), data: JSON.stringify(data),
url: `/meet/schedule/confirm` url: `/meet/meeting-log-resource/save`
})
}
// 修改任务状态
export function updateTaskStatus() {
return $http({
method: 'put',
data: JSON.stringify(data),
url: `/meet/schedule/confirm`
})
}
// 修改任务标题
export function updateTaskTitle() {
return $http({
method: 'put',
data: JSON.stringify(data),
url: `/meet/schedule/confirm`
}) })
} }
// 添加任务执行人 //会议室修改任务
export function addTaskExcutor() { export function updateMeetingTask(data) {
return $http({ return $http({
method: 'post', method: 'post',
data: JSON.stringify(data), data: JSON.stringify(data),
url: `/meet/schedule/confirm` url: `/meet/meeting-log-resource/update`
}) })
} }
//删除任务 //删除任务
export function deleteMeetingTask() { export function deleteMeetingTask(id) {
return $http({ return $http({
method: 'delete', method: 'get',
data: JSON.stringify(data), url: `/meet/meeting-log-resource/remove/${id}`
url: `/meet/schedule/confirm`
}) })
}// 测试的首页api }
// 测试的首页api
export function getHomeUserSchedule1(data) { export function getHomeUserSchedule1(data) {
return $http({ return $http({
method: 'POST', method: 'POST',
......
...@@ -19,6 +19,7 @@ App({ ...@@ -19,6 +19,7 @@ App({
avatar: '', avatar: '',
userid: '', userid: '',
name: '', name: '',
userInfo: '',
// globalUrl:'https://gateway2.mingwork.com', // 线上地址 // globalUrl:'https://gateway2.mingwork.com', // 线上地址
globalUrl: 'https://gateway-beta.mingwork.com' //beta地址 globalUrl: 'https://gateway-beta.mingwork.com' //beta地址
// globalUrl:'http://139.196.213.18:9999' //beta地址 // globalUrl:'http://139.196.213.18:9999' //beta地址
......
{ {
"pages": [ "pages": [
"pages/meetingDetail/meetingDetail", "pages/index/index",
"demo/index/index", "demo/index/index",
"pages/meetingDetail/meetingDetail",
"pages/excutorList/excutorList", "pages/excutorList/excutorList",
"demo/sideslipping/sideslipping", "demo/sideslipping/sideslipping",
"pages/index/index",
"pages/editMeeting/editMeeting", "pages/editMeeting/editMeeting",
"pages/createMeeting/createMeeting", "pages/createMeeting/createMeeting",
"pages/outLookContact/outLookContact", "pages/outLookContact/outLookContact",
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
"pages/participantsDetail/participantsDetail", "pages/participantsDetail/participantsDetail",
"pages/createOrEditSchedule/createOrEditSchedule", "pages/createOrEditSchedule/createOrEditSchedule",
"pages/applicationDetails/applicationDetails", "pages/applicationDetails/applicationDetails",
"pages/attendeeList/attendeeList", "pages/attendeeList/attendeeList"
"pages/scheduleList/scheduleList"
] ]
} }
\ No newline at end of file
...@@ -35,9 +35,7 @@ Component({ ...@@ -35,9 +35,7 @@ Component({
cancelButtonText: '取消', cancelButtonText: '取消',
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
// delFile().then(res => { this.props.deleteTaskFile()
// this.props.onReload();
// })
} }
} }
}) })
...@@ -48,6 +46,5 @@ Component({ ...@@ -48,6 +46,5 @@ Component({
}) })
dd.navigateTo({ url: `./../editFile/editFile?file=${JSON.stringify(e.target.dataset.file)}` }) dd.navigateTo({ url: `./../editFile/editFile?file=${JSON.stringify(e.target.dataset.file)}` })
} }
}, },
}); });
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
<import src="../../template/checkbox/index.axml"/> <import src="../../template/checkbox/index.axml"/>
<view class="task-list"> <view class="task-list">
<view class="task-box" a:for='{{taskList}}'> <view class="task-box" a:for='{{taskList}}'>
<template is="checkbox" data="{{status: item.taskStatus}}"></template> <template is="checkbox" data="{{ status: item.taskStatus, id: item.id }}"></template>
<view class="task-title" data-pop="{{title: '会议任务', type: 'updateTask'}}" onTap="showPop" data-task="{{item}}">{{item.taskInfos.taskTitle}} <view class="task-title" data-pop="{{title: '会议任务', type: 'updateTask'}}" onTap="showPop" data-task="{{item}}">{{item.taskInfos.taskTitle}}
<template is="avater" data="{{item: item.acceptorInfo}}"/> <template is="avater" a:if="{{item.acceptorInfo}}" data="{{item: item.acceptorInfo}}"/>
</view> </view>
</view> </view>
</view> </view>
\ No newline at end of file
// import create from 'dd-store';
// import pageStore from '../../pages/meetingDetail/store';
Component({ Component({
// store: pageStore,
mixins: [], mixins: [],
data: { data: {
show: false, show: false
// currentTask: null,
// actionList: null
}, },
props: { props: {
isCanEdit: true isCanEdit: true
...@@ -19,7 +14,6 @@ Component({ ...@@ -19,7 +14,6 @@ Component({
methods: { methods: {
showPop(e) { showPop(e) {
if (this.props.isCanEdit) { if (this.props.isCanEdit) {
console.log(e.target.dataset.task)
this.props.onShowPop(e); this.props.onShowPop(e);
this.props.onSetCurrentTask(e.target.dataset.task); this.props.onSetCurrentTask(e.target.dataset.task);
} }
...@@ -29,8 +23,14 @@ Component({ ...@@ -29,8 +23,14 @@ Component({
show: false show: false
}) })
}, },
CheckChange(e) { checkChange(e) {
this.props.onCheckChange(e.detail.value) let { status, id } = e.target.dataset;
if (status == '0') {
status = '1'
} else {
status = '0'
}
this.props.onChangeTaskStatusOnList({ status, id })
} }
}, },
}); });
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
<import src="../../template/checkbox/index.axml"/> <import src="../../template/checkbox/index.axml"/>
<view a:if="{{action == 'create'}}" class="picker-complete" onTap='complete'>完成</view> <view a:if="{{action == 'create'}}" class="picker-complete" onTap='complete'>完成</view>
<view class="task-column edit-column"> <view class="task-column edit-column">
<template a:if="{{action == 'update'}}" is="checkbox" data="{{status: currentTask.taskStatus}}"></template> <template a:if="{{action == 'update'}}" is="checkbox" data="{{status: currentTask.taskStatus, id:currentTask.id}}"></template>
<input onBlur="inputChange" value="{{currentTask.taskInfos.taskTitle}}" placeholder="请输入任务标题"/> <input onInput="inputChange" value="{{currentTask.taskInfos.taskTitle}}" placeholder="请输入任务标题"/>
</view> </view>
<view class="margin-bottom"> <view class="margin-bottom">
<view class="task-column participator-top"> <view class="task-column participator-top">
<text class="iconicon_attender iconfont icon"></text> <text class="iconicon_attender iconfont icon"></text>
<text class="participator-title">{{currentTask.acceptorInfo ? '执行人' : '设置执行人'}}</text> <text class="participator-title">{{currentTask.acceptorInfo ? '执行人' : '设置执行人'}}</text>
<text class="iconright iconfont icon" data-acceptorInfo="{{currentTask.acceptorInfo}}" onTap="handleExcutorChange"></text> <text class="iconright iconfont icon" data-acceptorId="{{currentTask.acceptorId}}" onTap="handleExcutorChange"></text>
</view> </view>
<view class="participator-bottom" a:if="{{currentTask.acceptorInfo}}"> <view class="participator-bottom" a:if="{{currentTask.acceptorInfo}}">
<view class="people"> <view class="people">
......
Component({ import create from 'dd-store';
import pageStore from '../../pages/meetingDetail/store';
import { debounce } from '../../utils/utils';
create.Component({
store: pageStore,
mixins: [], mixins: [],
data: { data: {
task: { currentTask: null //store
title: '',
excutor: '',
}
}, },
props: { props: {
currentTask: {}, action: ''
action: 'update'
}, },
didMount() { didMount() {
console.log(this.props)
}, },
didUpdate() { }, didUpdate() {
didUnmount() { }, },
didUnmount() {
},
methods: { methods: {
//编辑才有 //编辑
CheckChange(e) { checkChange(e) {
const status = e.target.dataset.status; let { status, id } = e.target.dataset;
if (status !== this.props.currentTask.status) { if (status == '0') {
this.props.onCheckChange(status); status = '1'
} else {
status = '0'
} }
this.store.data.currentTask.taskStatus = status;
this.update();
// this.props.onCheckChange({ status, id });
}, },
inputChange(e) { inputChange(e) {
//更新操作立即保存
const value = e.detail.value; const value = e.detail.value;
if (this.props.action === 'update') {
if (value !== this.props.currentTask.title) {
return this.props.onInputChange(e.detail.value);
}
}
// 创建操作保存到data
if (value) { if (value) {
this.setData({ this.store.data.currentTask.taskInfos = { taskTitle: value };
'task.title': value this.update();
});
} }
}, },
// inputChange: debounce(function (e) {
// const value = e.detail.value;
// if (value) {
// this.store.data.currentTask.taskInfos = { taskTitle: value };
// this.update();
// //更新要调用更新接口
// // if (this.props.action === 'update') {
// // if (value !== this.props.oldTask.taskInfos.taskTitle) {
// // this.store.data.isEditTaskTitle = true;
// // // this.props.onInputChange(value);
// // }
// // }
// }
// }, 1000),
handleExcutorChange(e) { handleExcutorChange(e) {
const acceptorInfo = e.target.dataset.acceptorInfo; //执行人页面删除执行人
//执行人页面可删除执行人 if (e.target.dataset.acceptorId) {
if (acceptorInfo) { dd.navigateTo({ url: `../../pages/excutorList/excutorList` })
dd.navigateTo({ url: `../../pages/excutorList/excutorList?acceptorInfo=${JSON.stringify(acceptorInfo)}&action=${this.props.action}` })
} }
//参会人列表页面选择参会人 //参会人列表页面选择参会人
else { else {
dd.navigateTo({ url: `../../pages/attendeeList/attendeeList?action=${this.props.action}` }) dd.navigateTo({ url: `../../pages/attendeeList/attendeeList` })
} }
}, },
//新建才有完成按钮 //新建才有完成按钮
complete() { complete() {
const { task } = this.data; const { currentTask } = this.store.data;
if (!task.title) { if (!currentTask.taskInfos) {
return return
} }
this.props.onComplete()
console.log(task)
this.props.onComplete(task)
}, },
//删除任务 //删除任务
handleDelete() { handleDelete() {
...@@ -70,11 +78,10 @@ Component({ ...@@ -70,11 +78,10 @@ Component({
cancelButtonText: '取消', cancelButtonText: '取消',
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
this.props.onDeleteTask(task) this.props.onDeleteTask()
} }
} }
}) })
} }
}, },
}); });
<import src="../../template/avater/index.axml"/> <import src="../../template/avater/index.axml"/>
<view class="column" a:for="{{$data.participatorList}}"> <view class="column" a:for="{{$data.participatorList}}">
<template is="radio" data="{{status: item.userId == userId, userId: item.userId}}"/> <template is="radio" data="{{status: item.userId == currentTask.acceptorId, item: item}}"/>
<template is="avater" data="{{item}}"/> <template is="avater" data="{{item}}"/>
<view class="name">{{item.username}}</view> <view class="name">{{item.username}}</view>
</view> </view>
<!-- radio模板 {status: status, userId: userId}--> <!-- radio模板 {status: status, userId: userId}-->
<template name='radio'> <template name='radio'>
<view class="radio {{status ? 'radio-checked' : 'radio-uncheck'}}" data-userId="{{userId}}" onTap="radioChange"> <view class="radio {{status ? 'radio-checked' : 'radio-uncheck'}}" data-item="{{item}}" onTap="radioChange">
<text a:if="{{status}}" class="iconfont iconicon_ok"></text> <text a:if="{{status}}" class="iconfont iconicon_ok"></text>
</view> </view>
</template> </template>
\ No newline at end of file
...@@ -8,38 +8,24 @@ create.Page({ ...@@ -8,38 +8,24 @@ create.Page({
$data: { $data: {
participatorList: null, participatorList: null,
}, },
action: '', currentTask: null, //store
excutor: '' //store // action: ''
}, },
onLoad(query) { onLoad(query) {
console.log(this) // this.setData({
const { user, action } = query; // action: query.action
console.log('onLoad') // })
console.log(query)
this.setData({
...query
})
}, },
radioChange(e) { radioChange(e) {
const userId9 = e.target.dataset.userId; const item = e.target.dataset.item;
this.setData({ this.store.data.currentTask.acceptorInfo = item;
userId this.store.data.currentTask.acceptorId = item.userId;
});
//更新页面,执行添加执行人操作 // //更新保存添加标示
if (this.data.action == 'update') { // if (this.data.action == 'update') {
addTaskExcutor().then(res => { // this.store.data.isAddAcceptorInfo = true;
getMeetingRoomAffairs().then(res => { // }
this.store.data.affairList = res.data.data; this.update();
this.update(); dd.navigateBack();
})
})
}
// 创建页面保存选中的执行人
else if (this.data.action == 'create') {
this.store.data.excutor = userId;
this.update();
dd.navigateBack();
}
} }
}); });
<import src="../../template/avater/index.axml"/> <import src="../../template/avater/index.axml"/>
<view class="column"> <view class="column" a:if="{{item: currentTask.acceptorInfo}}">
<template is="avater" data="{{item: acceptorInfo}}"/> <template is="avater" data="{{item: currentTask.acceptorInfo}}"/>
<view class="name">{{acceptorInfo.username}} <view class="name">{{currentTask.acceptorInfo.username}}
<text class="iconfont iconicon_close" onTap="deleteExcutor"></text> <text class="iconfont iconicon_close" onTap="deleteExcutor"></text>
</view> </view>
</view> </view>
\ No newline at end of file
...@@ -3,34 +3,33 @@ import pageStore from '../meetingDetail/store'; ...@@ -3,34 +3,33 @@ import pageStore from '../meetingDetail/store';
create.Page({ create.Page({
store: pageStore, store: pageStore,
data: { data: {
action: "", // action: "",
acceptorInfo: '' currentTask: '',//store
}, },
onLoad(query) { onLoad(query) {
this.setData({ // this.setData({
action: query.action, // action: query.action
acceptorInfo: JSON.parse(query.acceptorInfo) // })
})
}, },
deleteExcutor() { deleteExcutor() {
//编辑调用删除接口 dd.confirm({
if (this.data.action == 'update') { title: '删除执行人',
dd.confirm({ content: '确认删除执行人吗?',
title: '删除执行人', confirmButtonText: '确定',
content: '确认删除执行人吗?', cancelButtonText: '取消',
confirmButtonText: '确定', success: (res) => {
cancelButtonText: '取消', if (res.confirm) {
success: (res) => { this.store.data.currentTask.acceptorInfo = null;
if (res.confirm) { this.store.data.currentTask.acceptorId = '';
dd.navigateBack(); // //更新保存添加标示
} // if (this.data.action == 'update') {
// this.store.data.isDeleteAcceptorInfo = true;
// }
this.update();
dd.navigateBack();
} }
}) }
} });
//更新通知任务模板
else {
}
} }
}); });
...@@ -288,7 +288,8 @@ Page({ ...@@ -288,7 +288,8 @@ Page({
}, },
nextDetail: throttle(function (e) { nextDetail: throttle(function (e) {
let item = e.target.dataset.item let item = e.target.dataset.item
dd.navigateTo({ url: `./../editMeeting/editMeeting?scheduleItem=${JSON.stringify(item)}` }) // dd.navigateTo({ url: `./../editMeeting/editMeeting?scheduleItem=${JSON.stringify(item)}` });
dd.navigateTo({ url: `./../meetingDetail/meetingDetail?scheduleItem=${JSON.stringify(item)}` })
}, 1000), }, 1000),
// nextPage: throttle(function (e) { // nextPage: throttle(function (e) {
// console.log(11111111) // console.log(11111111)
......
<import src="../../template/avater/index.axml"/> <import src="../../template/avater/index.axml"/>
<view class="list"> <view class="list">
<block a:for="{{affairList}}"> <block a:for="{{affairList}}">
<view a:if="{{item.logType == 'task_add' && item.taskViewList}}" class='compose-column'> <view a:if="{{item.category == '3' && item.taskViewList}}" class='compose-column'>
<view class="avater task-avater"> <view class="avater task-avater">
<text class="iconfont iconicon_task1"></text> <text class="iconfont iconicon_task1"></text>
</view> </view>
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
会议任务 会议任务
<text>{{item.createTime}}</text> <text>{{item.createTime}}</text>
</view> </view>
<task-list onShowPop="showPop" onSetCurrentTask="setCurrentTask" taskList="{{item.taskViewList}}" onCheckChange="checkChange"/> <task-list onShowPop="showPop" onSetCurrentTask="setCurrentTask" taskList="{{item.taskViewList}}" onChangeTaskStatusOnList="changeTaskStatusOnList"/>
</view> </view>
<view a:if="{{item.logType == 'schedule_accessory_add' && item.fileView.fileInfos}}" class='compose-column'> <view a:if="{{item.logType == '2' && item.fileView.fileInfos}}" class='compose-column'>
<template is="avater" data="{{item: item.fileView.creatorInfo}}"/> <template is="avater" data="{{item: item.fileView.creatorInfo}}"/>
<view class="title"> <view class="title">
{{item.fileView.creatorInfo.username}} {{item.fileView.creatorInfo.username}}
...@@ -26,17 +26,20 @@ ...@@ -26,17 +26,20 @@
</block> </block>
</view> </view>
<view class="footer"> <view class="footer">
<view onTap="showPop" data-pop="{{title: '创建任务', type: 'createTask'}}"> <view onTap="showCreateTask" data-pop="{{title: '创建任务', type: 'createTask'}}">
<text class="iconfont iconicon_task1"></text>任务</view> <text class="iconfont iconicon_task1"></text>任务
<view> </view>
<text class="iconfont iconicon_data"></text>文件</view> <view onTap="addMeetingFile">
<text class="iconfont iconicon_data"></text>文件
</view>
<text class="devider"></text> <text class="devider"></text>
<view> <view>
<text class="iconfont iconicon_share1"></text></view> <text class="iconfont iconicon_share1"></text>
</view>
</view> </view>
<popup show="{{show}}" onClose="closePop" title="{{pop.title}}"> <popup show="{{show}}" onClose="closePop" title="{{pop.title}}">
<!-- 任务创建弹出框 --> <!-- 任务创建弹出框 -->
<task-panel a:if="{{pop.type === 'createTask'}}" onComplete="Complete" action='create'/> <task-panel a:if="{{pop.type === 'createTask'}}" onComplete="complete" action='create'/>
<!-- 任务修改弹出框 --> <!-- 任务修改弹出框 -->
<task-panel a:if="{{pop.type === 'updateTask'}}" action='update' currentTask="{{currentTask}}" onDeleteTask="deleteTask" onInputChange="inputChange" onCheckChange="checkChange"/> <task-panel a:if="{{pop.type === 'updateTask'}}" action='update' onDeleteTask="deleteTask"/>
</popup> </popup>
\ No newline at end of file
import create from 'dd-store'; import create from 'dd-store';
import pageStore from './store'; import pageStore from './store';
import { getMeetingRoomAffairs, createMeetingTask, deleteMeetingTask, updateTaskTitle, updateTaskStatus } from '../../api/request'; import { getScheduleDetail, getMeetingRoomAffairs, createMeetingTask, deleteMeetingTask, updateMeetingTask, uploadPermissions } from '../../api/request';
create.Page({ create.Page({
store: pageStore, store: pageStore,
data: { data: {
affairList: null, //store affairList: null, //store,页面用到的变量需要在这里声明
show: false, //pop show: false, //pop
oldTask: null,
pop: { pop: {
title: '', title: '',
type: '' type: ''
}, }
currentTask: {}
}, },
onLoad(query) { onLoad(query) {
this.reload(); this.setData({
scheduleItem: JSON.parse(query.scheduleItem),
})
this.getDetail();
},
// 获取详情
getDetail() {
let data = {
id: this.data.scheduleItem.id,
scheduleTemplateId: this.data.scheduleItem.scheduleTemplateId,
planDate: this.data.scheduleItem.planDate
}
getScheduleDetail(data).then(res => {
if (res.data.code === 0) {
let participatorList = []
let originUsers = []
let participatorUserId = []
let repeatListMap = new Map()
for (let value of res.data.data.userList) {
participatorList.push(value.participator)
participatorUserId.push(value.participator.userId)
originUsers.push(value.participator)
}
// for (let item of this.data.comListData.repeatList) {
// if (item.recurrenceModel.recurrenceModel !== 'weekly') {
// repeatListMap.set(item.recurrenceModel.model, item.id)
// }
// }
// console.log(repeatListMap, 111)
this.setData({
confirmAttendance: res.data.data.confirmAttendance,
organizer: res.data.data.organizer,
originUsers: originUsers,
'comListData.meetingWayModelId': res.data.data.meetingWayModel === 'dingtalk' ? 2 : (res.data.data.meetingWayModel === 'zoom' ? 1 : 0),
'scheduleItem.id': res.data.data.id,
'scheduleItem.groupId': res.data.data.groupId,
repeatable: res.data.data.repeatable,
recurrenceModel: res.data.data.repeatable ? { model: res.data.data.recurrenceModel.model, daysOfMonth: res.data.data.recurrenceModel.daysOfMonth, interval: 1, initialTime: res.data.data.recurrenceModel.initialTime, terminateTime: res.data.data.recurrenceModel.terminateTime, weekDayList: res.data.data.recurrenceModel.weekDayList } : { model: 'no_repeat' },
originalData: res.data.data,
title: res.data.data.title,
remark: res.data.data.remark,
isShowRemark: res.data.data.remark ? true : false,
// week: this.data.weekList[new Date(res.data.data.startTime.replace(/'-'/g, "\/")).getDay()]
})
// if (res.data.data.repeatable) {
// this.setData({
// 'comListData.comSelectListId': res.data.data.recurrenceModel.model === 'weekly' ? (res.data.data.recurrenceModel.weekDayList.length > 1 ? 3 : 2) : repeatListMap.get(res.data.data.recurrenceModel.model),
// })
// }
// this.$store.$data.locationName = res.data.data.location.locationName
// this.$store.$data.roomId = res.data.data.meetingRoomId < 0 ? '' : res.data.data.meetingRoomId
// this.$store.$data.startTime = res.data.data.startTime.replace(/'-'/g, "\/")
// this.$store.$data.endTime = res.data.data.endTime.replace(/'-'/g, "\/")
// this.$store.$data.participatorList = participatorList
// this.$store.$data.participatorUserId = participatorUserId
// this.$store.update();
// this.conflictPeople()
this.reload(this.data.scheduleItem.id);
}
})
}, },
//获取动态列表 //获取动态列表
reload() { reload(id) {
getMeetingRoomAffairs().then(res => { getMeetingRoomAffairs(id).then(res => {
const affairList = res.data.data; const affairList = res.data.data;
const newAffairList = affairList.map(it => { const newAffairList = affairList.map(it => {
if (it.logType == 'schedule_accessory_add') { if (it.logType == '2') {
if (it.fileView.creatorInfo) { if (it.fileView.creatorInfo) {
it.fileView.creatorInfo = JSON.parse(it.fileView.creatorInfo); it.fileView.creatorInfo = JSON.parse(it.fileView.creatorInfo);
} }
...@@ -30,7 +89,7 @@ create.Page({ ...@@ -30,7 +89,7 @@ create.Page({
} }
return it return it
} }
else if (it.logType === 'task_add') { else if (it.category === '3' && it.taskViewList) {
it.taskViewList.map(o => { it.taskViewList.map(o => {
if (o.acceptorInfo) { if (o.acceptorInfo) {
o.acceptorInfo = JSON.parse(o.acceptorInfo) o.acceptorInfo = JSON.parse(o.acceptorInfo)
...@@ -47,12 +106,13 @@ create.Page({ ...@@ -47,12 +106,13 @@ create.Page({
} }
return it return it
}) })
console.log(newAffairList)
this.store.data.affairList = newAffairList; this.store.data.affairList = newAffairList;
//重置
this.store.data.isNeedReloadList = false;
this.update(); this.update();
}) })
}, },
showPop(e) { showPop(e) {
this.setData({ this.setData({
pop: e.target.dataset.pop, pop: e.target.dataset.pop,
...@@ -62,43 +122,198 @@ create.Page({ ...@@ -62,43 +122,198 @@ create.Page({
closePop() { closePop() {
this.setData({ this.setData({
show: false show: false
}) });
if (this.data.pop.type == 'updateTask') {
const { currentTask } = this.store.data;
const { oldTask } = this.data;
//添加执行人
if (!oldTask.acceptorId && currentTask.acceptorId) {
this.addTaskExcutor();
}
///删除执行人
else if (oldTask.acceptorId && !currentTask.acceptorId) {
this.deleteTaskExcutor();
}
//修改执行人
else if ((oldTask.acceptorId && currentTask.acceptorId) && (oldTask.acceptorId !== currentTask.acceptorId)) {
this.updateTaskExcutor();
}
//修改任务标题
if (currentTask.taskInfos.taskTitle !== oldTask.taskInfos.taskTitle) {
this.editTaskTitle();
}
//修改任务状态
if (currentTask.taskStatus !== oldTask.taskStatus) {
this.changeTaskStatus();
}
//刷新列表,这里为什么不在promie后执行
setTimeout(() => {
console.log(this.store.data.isNeedReloadList)
if (this.store.data.isNeedReloadList) {
this.reload(this.data.scheduleItem.id);
}
})
}
},
//出现任务弹窗
showCreateTask(e) {
//重置
this.store.data.currentTask = {};
this.update();
this.showPop(e)
}, },
//设置修改任务弹框中当前任务 //设置修改任务弹框中当前任务
setCurrentTask(currentTask) { setCurrentTask(currentTask) {
this.setData({ this.setData({
currentTask oldTask: JSON.parse(JSON.stringify(currentTask))
})
this.store.data.currentTask = currentTask;
this.update();
},
// 添加文件
addMeetingFile() {
decodeURI.navagac
},
// 文件上传
addMeetingFile() {
let data = {
ddUserId: getApp().globalData.userid,
type: 'add',
projectName: 'MING_MEETING'
}
uploadPermissions(data).then(res => {
if (res.data.code === 0) {
const _that = this
dd.uploadAttachmentToDingTalk({
image: { multiple: true, compress: true, max: 9, spaceId: res.data.data },
space: { spaceId: res.data.data, compress: true, isCopy: 1, max: 9 },
types: ["photo", "camera", "space"],
success: (res) => {
dd.navigateTo({ url: `./../uploadFile/uploadFile?scheduleItem=${JSON.stringify(_that.data.scheduleItem)}&upLoadInfo=${encodeURIComponent(JSON.stringify(res))}` })
},
fail: (err) => {
}
})
}
})
},
// 修改文件描述
updateMeetingFile() {
},
// 删除文件
deleteMeetingFile() {
},
// 删除执行人
deleteTaskExcutor() {
this.updateTask({
"logType": "task_remove_acceptor",
acceptorInfo: JSON.stringify(this.data.oldTask.acceptorInfo),
acceptorId: this.data.oldTask.acceptorId
})
},
// 添加执行人
addTaskExcutor() {
this.updateTask({
"logType": "task_add_acceptor",
acceptorInfo: JSON.stringify(this.store.data.currentTask.acceptorInfo),
acceptorId: this.store.data.currentTask.acceptorId
})
},
//修改执行人
updateTaskExcutor() {
this.updateTask({
"logType": "task_modify_acceptor",
acceptorInfo: JSON.stringify(this.store.data.currentTask.acceptorInfo),
acceptorId: this.store.data.currentTask.acceptorId
}) })
}, },
//修改任务标题 //修改任务标题
inputChange(value) { editTaskTitle(value) {
console.log(value); this.updateTask({
updateTaskTitle({}).then(res => { "logType": "task_modify_title",
this.reload(); "taskInfos": JSON.stringify(this.store.data.currentTask.taskInfos)
}) })
}, },
//修改任务状态 //列表修改任务状态
CheckChange(value) { changeTaskStatusOnList(task) {
console.log(value) this.updateTask({
updateTaskStatus({}).then(res => { "logType": "task_status_modify",
this.reload(); "taskStatus": task.status,
'id': task.id
}, () => {
this.reload(this.data.scheduleItem.id);
}) })
}, },
//创建任务完成 //弹窗修改任务状态
Complete(data) { changeTaskStatus() {
console.log(data) this.updateTask({
const excutor = this.store.data.excutor; "logType": "task_status_modify",
console.log(this.store.data) "taskStatus": this.store.data.currentTask.taskStatus
createMeetingTask(data).then(res => { })
if (res.data.data.success) { },
this.reload(); //删除任务
this.closePop(); deleteTask(id) {
this.updateTask({
"logType": "task_remove",
}, () => {
this.closePop();
this.reload(this.data.scheduleItem.id);
})
},
//修改任务
updateTask(taskData, callBack) {
const postData = {
"groupId": this.data.scheduleItem.groupId,
"scheduleId": this.data.scheduleItem.id,
"resourceType": "task",
"creatorId": getApp().globalData.userid,
"creatorInfo": getApp().globalData.userInfo,
"id": this.store.data.currentTask.id,
...taskData
}
updateMeetingTask(postData).then(res => {
if (res.data.code == 0) {
if (callBack) {
callBack();
} else {
this.store.data.isNeedReloadList = true;
this.update();
}
} }
}) })
}, },
deleteTask() { //创建任务
deleteMeetingTask({}).then(res => { complete() {
this.reload(); const { currentTask } = this.store.data;
const postData = {
"groupId": this.data.scheduleItem.groupId,
"scheduleId": this.data.scheduleItem.id,
"resourceType": "task",
"creatorId": getApp().globalData.userid,
"creatorInfo": getApp().globalData.userInfo,
"logType": "task_add",
"taskInfos": JSON.stringify(currentTask.taskInfos),
"taskStatus": '0',
"description": ""
}
if (currentTask.acceptorId) {
postData.acceptorId = currentTask.acceptorId;
postData.acceptorInfo = JSON.stringify(currentTask.acceptorInfo);
}
createMeetingTask(postData).then(res => {
if (res.data.code == 0) {
this.reload(this.data.scheduleItem.id);
this.closePop();
//重置
this.store.data.currentTask = {};
this.update();
}
}) })
} }
}); });
class Store { class Store {
data = { data = {
affairList: [], affairList: [],
excutor: '' currentTask: {
id: '',
acceptorInfo: null,
acceptorId: '',
taskStatus: '',
taskInfos: null
},
// isAddAcceptorInfo: false,
// isDeleteAcceptorInfo: false,
isNeedReloadList: false,
// isEditTaskTitle: false
} }
} }
export default new Store() export default new Store()
\ No newline at end of file
class Store { class Store {
data = { data = {
participatorList: [], // 参会人列表 participatorList: [
{ headUrl: "", platform: "dingtalk", userId: "134410161020791052", username: "冯召玉" },
{ headUrl: "", platform: "dingtalk", userId: "30024743652146348302", username: "王五117" },
{ headUrl: "https://static.dingtalk.com/media/lADOCi4ohM0C7s0C7A_748_750.jpg", platform: "dingtalk", userId: "03282029482102674671", username: "楚德朋(小鹏)" },
{ headUrl: "https://static.dingtalk.com/media/lADPDgQ9rVfXAB7NC9XNC9A_3024_3029.jpg", platform: "dingtalk", userId: "2866151654752072", username: "小号" },
{ headUrl: "", platform: "dingtalk", userId: "2168192627-2054385182", username: "诙是诙谐的诙" },
{ headUrl: "https://static.dingtalk.com/media/lADPGoGu60TX5w3NAdrNAdo_474_474.jpg", platform: "dingtalk", userId: "0906633440812257", username: "指月" },
{ headUrl: "https://static.dingtalk.com/media/lADPDgQ9rB3t4ozNBQDNBQA_1280_1280.jpg", platform: "dingtalk", userId: "0307652433971147", username: "皮特" },
{ headUrl: "https://static.dingtalk.com/media/lADPDgQ9qyCUTczNAeDNAeA_480_480.jpg", platform: "dingtalk", userId: "2269350140-286520467", username: "陆宜(测试)" },
{ headUrl: "", platform: "outlook", userId: "2303907784@qq.com", username: "2303907784@qq.com" }
], // 参会人列表
locationName: '', locationName: '',
participatorUserId: [], // 参会人的userId participatorUserId: [], // 参会人的userId
userList: [], userList: [],
......
...@@ -3,4 +3,10 @@ ...@@ -3,4 +3,10 @@
background: #3070F2; background: #3070F2;
color: white; color: white;
text-align: center; text-align: center;
}
.avater>image {
border-radius: 50%;
width: 100%;
height: 100%;
} }
\ No newline at end of file
<!-- checkbox模板 {status: status}--> <!-- checkbox模板 {status: status}-->
<template name="checkbox"> <template name="checkbox">
<view class="checkbox {{status ? 'checkbox-active': ''}}" data-status="{{status}}" onTap="CheckChange"> <view class="checkbox {{status == '1' ? 'checkbox-active': ''}}" data-id="{{id}}" data-status="{{status}}" onTap="checkChange">
<text a:if="{{status}}" class="iconfont iconicon_ok"></text> <text a:if="{{status == '1'}}" class="iconfont iconicon_ok"></text>
</view> </view>
</template> </template>
\ No newline at end of file
...@@ -13,10 +13,20 @@ export function throttle(fn, gapTime) { ...@@ -13,10 +13,20 @@ export function throttle(fn, gapTime) {
} }
} }
export function debounce(fn, delay) {
let timeout = null;
return function () {
clearTimeout(timeout);
timeout = setTimeout(() => {
fn.apply(this, arguments);
}, delay);
};
}
// 判断时间 刚刚 五分钟以内 十分钟以内 正常时间年月日 // 判断时间 刚刚 五分钟以内 十分钟以内 正常时间年月日
export function dealFileTime(time) { export function dealFileTime(time) {
let result = '' let result = ''
let argumentsTime= new Date(time.replace(/\-/g, "/")).getTime() let argumentsTime = new Date(time.replace(/\-/g, "/")).getTime()
let nowTime = new Date().getTime() let nowTime = new Date().getTime()
let diffValue = nowTime - argumentsTime let diffValue = nowTime - argumentsTime
let minute = 1000 * 60; //把分,时,天,周,半个月,一个月用毫秒表示 let minute = 1000 * 60; //把分,时,天,周,半个月,一个月用毫秒表示
...@@ -25,27 +35,27 @@ export function dealFileTime(time) { ...@@ -25,27 +35,27 @@ export function dealFileTime(time) {
let week = day * 7; let week = day * 7;
let halfamonth = day * 15; let halfamonth = day * 15;
let month = day * 30; let month = day * 30;
if(diffValue < 0){ if (diffValue < 0) {
return; return;
} }
let minC = diffValue/minute; //计算时间差的分,时,天,周,月 let minC = diffValue / minute; //计算时间差的分,时,天,周,月
let hourC = diffValue/hour; let hourC = diffValue / hour;
let dayC = diffValue/day; let dayC = diffValue / day;
let weekC = diffValue/week; let weekC = diffValue / week;
let monthC = diffValue/month; let monthC = diffValue / month;
if(monthC >= 1 && monthC <= 3){ if (monthC >= 1 && monthC <= 3) {
result = " " + parseInt(monthC) + "月前" result = " " + parseInt(monthC) + "月前"
}else if(weekC >= 1 && weekC <= 3){ } else if (weekC >= 1 && weekC <= 3) {
result = " " + parseInt(weekC) + "周前" result = " " + parseInt(weekC) + "周前"
}else if(dayC >= 1 && dayC <= 6){ } else if (dayC >= 1 && dayC <= 6) {
result = " " + parseInt(dayC) + "天前" result = " " + parseInt(dayC) + "天前"
}else if(hourC >= 1 && hourC <= 23){ } else if (hourC >= 1 && hourC <= 23) {
result = " " + parseInt(hourC) + "小时前" result = " " + parseInt(hourC) + "小时前"
}else if(minC >= 1 && minC <= 59){ } else if (minC >= 1 && minC <= 59) {
result =" " + parseInt(minC) + "分钟前" result = " " + parseInt(minC) + "分钟前"
}else if(diffValue >= 0 && diffValue <= minute){ } else if (diffValue >= 0 && diffValue <= minute) {
result = "刚刚" result = "刚刚"
}else { } else {
let datetime = new Date(); let datetime = new Date();
datetime.setTime(time); datetime.setTime(time);
let Nyear = datetime.getFullYear(); let Nyear = datetime.getFullYear();
...@@ -64,21 +74,21 @@ export function dealFileTime(time) { ...@@ -64,21 +74,21 @@ export function dealFileTime(time) {
format 格式 yyyyMMdd HH:mm:ss, yyyyMMdd, HH:mm:ss format 格式 yyyyMMdd HH:mm:ss, yyyyMMdd, HH:mm:ss
Symbol 分隔符号 Symbol 分隔符号
*/ */
export function getFormatDate (time, format, symbol) { export function getFormatDate(time, format, symbol) {
time = typeof(time) === 'object' ? time : new Date(time) time = typeof (time) === 'object' ? time : new Date(time)
format = format ? format : 'yyyyMMdd HH:mm:ss' format = format ? format : 'yyyyMMdd HH:mm:ss'
symbol = symbol ? symbol : '' symbol = symbol ? symbol : ''
let year = time.getFullYear() let year = time.getFullYear()
let month = time.getMonth() > 9 ? time.getMonth() + 1 : '0' + (time.getMonth() + 1) let month = time.getMonth() > 9 ? time.getMonth() + 1 : '0' + (time.getMonth() + 1)
let day = time.getDate() < 10 ? '0' + time.getDate() : time.getDate() let day = time.getDate() < 10 ? '0' + time.getDate() : time.getDate()
let hour = time.getHours() < 10 ? '0' + time.getHours() : time.getHours() let hour = time.getHours() < 10 ? '0' + time.getHours() : time.getHours()
let minutes = time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes() let minutes = time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes()
let seconds = time.getSeconds() < 10 ? '0' + time.getSeconds() : time.getSeconds() let seconds = time.getSeconds() < 10 ? '0' + time.getSeconds() : time.getSeconds()
if (format === 'yyyyMMdd HH:mm:ss') { if (format === 'yyyyMMdd HH:mm:ss') {
return symbol ? `${year}${symbol}${month}${symbol}${day} ${hour}:${minutes}:${seconds}` : `${year}/${month}/${day} ${hour}:${minutes}:${seconds}` return symbol ? `${year}${symbol}${month}${symbol}${day} ${hour}:${minutes}:${seconds}` : `${year}/${month}/${day} ${hour}:${minutes}:${seconds}`
} else if (format === 'yyyyMMdd') { } else if (format === 'yyyyMMdd') {
return symbol ? `${year}${symbol}${month}${symbol}${day}` : `${year}/${month}/${day}` return symbol ? `${year}${symbol}${month}${symbol}${day}` : `${year}/${month}/${day}`
} else if (format === 'HH:mm:ss') { } else if (format === 'HH:mm:ss') {
return `${hour}:${minutes}:${seconds}` return `${hour}:${minutes}:${seconds}`
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment