no message
This commit is contained in:
parent
8847d1d10a
commit
6db6528be1
@ -656,6 +656,33 @@ class ProjectController extends AbstractController
|
|||||||
return Base::retSuccess('success', $task->taskFile);
|
return Base::retSuccess('success', $task->taskFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除任务文件(限:项目、任务负责人)
|
||||||
|
*
|
||||||
|
* @apiParam {Number} file_id 文件ID
|
||||||
|
*/
|
||||||
|
public function task__filedelete()
|
||||||
|
{
|
||||||
|
User::auth();
|
||||||
|
//
|
||||||
|
$file_id = intval(Request::input('file_id'));
|
||||||
|
//
|
||||||
|
$file = ProjectTaskFile::find($file_id);
|
||||||
|
if (empty($file)) {
|
||||||
|
return Base::retError('文件不存在或已被删除');
|
||||||
|
}
|
||||||
|
//
|
||||||
|
$task = ProjectTask::userTask($file->task_id, [], true, $project);
|
||||||
|
if (!$task->owner && !$project->owner) {
|
||||||
|
return Base::retError('仅限项目或任务负责人操作');
|
||||||
|
}
|
||||||
|
//
|
||||||
|
$task->pushMsg('filedelete', $file);
|
||||||
|
$file->delete();
|
||||||
|
//
|
||||||
|
return Base::retSuccess('success', $file);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {post} 添加任务
|
* {post} 添加任务
|
||||||
*
|
*
|
||||||
|
@ -106,7 +106,6 @@ export default {
|
|||||||
autoInterval: null,
|
autoInterval: null,
|
||||||
|
|
||||||
dialogDrag: false,
|
dialogDrag: false,
|
||||||
dialogReady: false,
|
|
||||||
|
|
||||||
msgText: '',
|
msgText: '',
|
||||||
msgNew: 0,
|
msgNew: 0,
|
||||||
@ -164,20 +163,12 @@ export default {
|
|||||||
|
|
||||||
dialogId: {
|
dialogId: {
|
||||||
handler() {
|
handler() {
|
||||||
this.dialogReady = false;
|
|
||||||
this.autoBottom = true;
|
this.autoBottom = true;
|
||||||
this.msgNew = 0;
|
this.msgNew = 0;
|
||||||
this.topId = -1;
|
this.topId = -1;
|
||||||
this.getMsg();
|
this.getMsg();
|
||||||
},
|
},
|
||||||
immediate: true
|
immediate: true
|
||||||
},
|
|
||||||
|
|
||||||
dialogs: {
|
|
||||||
handler() {
|
|
||||||
this.getMsg();
|
|
||||||
},
|
|
||||||
deep: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -186,13 +177,6 @@ export default {
|
|||||||
if (!this.dialogId) {
|
if (!this.dialogId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.dialogs.findIndex(({id}) => id == this.dialogId) === -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.dialogReady) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.dialogReady = true;
|
|
||||||
this.$store.dispatch("getDialogMsgs", this.dialogId);
|
this.$store.dispatch("getDialogMsgs", this.dialogId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -285,6 +285,7 @@
|
|||||||
<Loading v-else class="file-load"/>
|
<Loading v-else class="file-load"/>
|
||||||
<a class="file-name" :href="file.path||'javascript:;'" target="_blank">{{file.name}}</a>
|
<a class="file-name" :href="file.path||'javascript:;'" target="_blank">{{file.name}}</a>
|
||||||
<div class="file-size">{{$A.bytesToSize(file.size)}}</div>
|
<div class="file-size">{{$A.bytesToSize(file.size)}}</div>
|
||||||
|
<i class="iconfont file-delete" @click="deleteFile(file.id)"></i>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="item-content">
|
<ul class="item-content">
|
||||||
@ -1089,6 +1090,20 @@ export default {
|
|||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.modalError(msg);
|
$A.modalError(msg);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
deleteFile(file_id) {
|
||||||
|
this.$store.dispatch("forgetTaskFile", file_id)
|
||||||
|
//
|
||||||
|
this.$store.dispatch("call", {
|
||||||
|
url: 'project/task/filedelete',
|
||||||
|
data: {
|
||||||
|
file_id,
|
||||||
|
},
|
||||||
|
}).catch(({msg}) => {
|
||||||
|
$A.modalError(msg);
|
||||||
|
this.$store.dispatch("getTaskFiles", this.taskDetail.id)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,9 +105,12 @@ export default {
|
|||||||
dialogList() {
|
dialogList() {
|
||||||
const {dialogActive, dialogKey} = this;
|
const {dialogActive, dialogKey} = this;
|
||||||
if (dialogActive == '' && dialogKey == '') {
|
if (dialogActive == '' && dialogKey == '') {
|
||||||
return this.dialogs;
|
return this.dialogs.filter(({name}) => name !== undefined);
|
||||||
}
|
}
|
||||||
return this.dialogs.filter(({name, type, group_type, last_msg}) => {
|
return this.dialogs.filter(({name, type, group_type, last_msg}) => {
|
||||||
|
if (name === undefined) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (dialogActive) {
|
if (dialogActive) {
|
||||||
switch (dialogActive) {
|
switch (dialogActive) {
|
||||||
case 'project':
|
case 'project':
|
||||||
|
24
resources/assets/js/store/actions.js
vendored
24
resources/assets/js/store/actions.js
vendored
@ -874,6 +874,19 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忘记任务文件
|
||||||
|
* @param state
|
||||||
|
* @param dispatch
|
||||||
|
* @param file_id
|
||||||
|
*/
|
||||||
|
forgetTaskFile({state, dispatch}, file_id) {
|
||||||
|
let index = state.taskFiles.findIndex(({id}) => id == file_id)
|
||||||
|
if (index > -1) {
|
||||||
|
state.taskFiles.splice(index, 1)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打开任务详情页
|
* 打开任务详情页
|
||||||
* @param state
|
* @param state
|
||||||
@ -1169,9 +1182,12 @@ export default {
|
|||||||
* @param dialog_id
|
* @param dialog_id
|
||||||
*/
|
*/
|
||||||
getDialogMsgs({state, dispatch}, dialog_id) {
|
getDialogMsgs({state, dispatch}, dialog_id) {
|
||||||
const dialog = state.dialogs.find(({id}) => id == dialog_id);
|
let dialog = state.dialogs.find(({id}) => id == dialog_id);
|
||||||
if (!dialog) {
|
if (!dialog) {
|
||||||
return;
|
dialog = {
|
||||||
|
id: dialog_id,
|
||||||
|
};
|
||||||
|
state.dialogs.push(dialog);
|
||||||
}
|
}
|
||||||
if (dialog.loading) {
|
if (dialog.loading) {
|
||||||
return;
|
return;
|
||||||
@ -1369,6 +1385,7 @@ export default {
|
|||||||
// 更新最后消息
|
// 更新最后消息
|
||||||
dispatch("updateDialogLastMsg", data);
|
dispatch("updateDialogLastMsg", data);
|
||||||
if (mode === "add") {
|
if (mode === "add") {
|
||||||
|
let dialog = state.dialogs.find(({id}) => id == data.dialog_id);
|
||||||
// 更新对话列表
|
// 更新对话列表
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
// 新增未读数
|
// 新增未读数
|
||||||
@ -1443,6 +1460,9 @@ export default {
|
|||||||
case 'upload':
|
case 'upload':
|
||||||
dispatch("getTaskFiles", data.task_id)
|
dispatch("getTaskFiles", data.task_id)
|
||||||
break;
|
break;
|
||||||
|
case 'filedelete':
|
||||||
|
dispatch("forgetTaskFile", data.id)
|
||||||
|
break;
|
||||||
case 'archived':
|
case 'archived':
|
||||||
case 'delete':
|
case 'delete':
|
||||||
dispatch("forgetTask", data.id)
|
dispatch("forgetTask", data.id)
|
||||||
|
@ -180,6 +180,22 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #bbbbbb;
|
color: #bbbbbb;
|
||||||
}
|
}
|
||||||
|
.file-delete {
|
||||||
|
display: none;
|
||||||
|
padding-left: 12px;
|
||||||
|
font-size: 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #aaaaaa;
|
||||||
|
transition: color 0.3s;
|
||||||
|
&:hover {
|
||||||
|
color: #ff0000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
.file-delete {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&.subtask {
|
&.subtask {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user