Component({ mixins: [], data: { task: { title: '', excutor: '' } }, props: { currentTask: {}, action: 'update' }, didMount() { console.log(this.props) }, didUpdate() { }, didUnmount() { }, methods: { //编辑才有 CheckChange(e) { const status = e.target.dataset.status; if (status !== this.props.currentTask.status) { this.props.onCheckChange(status); } }, inputChange(e) { //更新操作立即保存 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) { this.setData({ 'task.title': value }); } }, handleExcutorChange(e) { const userId = e.target.dataset.userId; //执行人页面可删除执行人 if (userId) { dd.navigateTo({ url: `../../pages/excutorList/excutorList?userId=${userId}&action=${this.props.action}` }) } //参会人列表页面可选择参会人 else { dd.navigateTo({ url: `../../pages/attendeeList/attendeeList?action=${this.props.action}` }) } }, //新建才有完成按钮 complete() { const { task } = this.data; if (!task.title) { return } console.log(task) this.props.onComplete(task) }, //删除任务 handleDelete() { dd.confirm({ title: '删除任务', content: '确认删除任务吗?', confirmButtonText: '确定', cancelButtonText: '取消', success: (res) => { if (res.confirm) { this.props.onDeleteTask(task) } } }) } }, });