no message
This commit is contained in:
parent
c88584125e
commit
6ca8c7456d
@ -702,24 +702,29 @@ class ProjectController extends AbstractController
|
||||
//
|
||||
$task = ProjectTask::userTask($task_id);
|
||||
//
|
||||
$updateComplete = false;
|
||||
if (Base::isDate($data['complete_at'])) {
|
||||
// 标记已完成
|
||||
if ($task->complete_at) {
|
||||
return Base::retError('任务已完成');
|
||||
}
|
||||
$result = $task->completeTask(Carbon::now());
|
||||
$updateComplete = true;
|
||||
} elseif (Arr::exists($data, 'complete_at')) {
|
||||
// 标记未完成
|
||||
if (!$task->complete_at) {
|
||||
return Base::retError('未完成任务');
|
||||
}
|
||||
$result = $task->completeTask(null);
|
||||
$updateComplete = true;
|
||||
} else {
|
||||
// 更新任务
|
||||
$result = $task->updateTask($data);
|
||||
}
|
||||
if (Base::isSuccess($result)) {
|
||||
$result['data'] = $task->toArray();
|
||||
$result['data']['is_update_complete'] = $updateComplete;
|
||||
$task->pushMsg('update', $result['data']);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@ -773,8 +778,10 @@ class ProjectController extends AbstractController
|
||||
'userid' => $user->userid,
|
||||
]);
|
||||
$file->save();
|
||||
$file = $file->find($file->id);
|
||||
$task->addLog("上传文件:" . $file->name);
|
||||
return Base::retSuccess("上传成功", $file->find($file->id));
|
||||
$task->pushMsg('upload', $file->toArray());
|
||||
return Base::retSuccess("上传成功", $file);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
ref="upload"
|
||||
accept="image/*"
|
||||
:action="actionUrl"
|
||||
:headers="uploadHeaders"
|
||||
:data="uploadParams"
|
||||
:show-upload-list="false"
|
||||
:max-size="maxSize"
|
||||
@ -75,6 +76,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState} from "vuex";
|
||||
|
||||
export default {
|
||||
name: 'ImgUpload',
|
||||
props: {
|
||||
@ -107,7 +110,6 @@
|
||||
return {
|
||||
actionUrl: this.$store.state.method.apiUrl('system/imgupload'),
|
||||
params: {
|
||||
token: this.$store.state.userToken,
|
||||
width: this.width,
|
||||
height: this.height
|
||||
},
|
||||
@ -163,6 +165,15 @@
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userToken']),
|
||||
|
||||
uploadHeaders() {
|
||||
return {
|
||||
fd: this.$store.state.method.getStorageString("userWsFd"),
|
||||
token: this.userToken,
|
||||
}
|
||||
},
|
||||
|
||||
uploadParams() {
|
||||
if (Object.keys(this.otherParams).length > 0) {
|
||||
return Object.assign(this.params, this.otherParams);
|
||||
@ -263,7 +274,6 @@
|
||||
$A.noticeWarning(this.$L('最多只能上传 ' + this.maxNum + ' 张图片。'));
|
||||
}
|
||||
this.params = {
|
||||
token: this.$store.state.userToken,
|
||||
width: this.width,
|
||||
height: this.height
|
||||
};
|
||||
|
@ -19,7 +19,7 @@
|
||||
ref="fileUpload"
|
||||
class="upload-control"
|
||||
:action="actionUrl"
|
||||
:data="params"
|
||||
:headers="headers"
|
||||
multiple
|
||||
:format="uploadFormat"
|
||||
:show-upload-list="false"
|
||||
@ -53,6 +53,7 @@
|
||||
<script>
|
||||
import tinymce from 'tinymce/tinymce';
|
||||
import ImgUpload from "./ImgUpload";
|
||||
import {mapState} from "vuex";
|
||||
|
||||
export default {
|
||||
name: 'TEditor',
|
||||
@ -129,7 +130,6 @@
|
||||
uploadIng: 0,
|
||||
uploadFormat: ['jpg', 'jpeg', 'png', 'gif', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'esp', 'pdf', 'rar', 'zip', 'gz'],
|
||||
actionUrl: this.$store.state.method.apiUrl('system/fileupload'),
|
||||
params: { token: this.$store.state.userToken },
|
||||
maxSize: 10240
|
||||
};
|
||||
},
|
||||
@ -148,6 +148,16 @@
|
||||
this.spinShow = true;
|
||||
$A(this.$refs.myTextarea).show();
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userToken']),
|
||||
|
||||
headers() {
|
||||
return {
|
||||
fd: this.$store.state.method.getStorageString("userWsFd"),
|
||||
token: this.userToken,
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
value(newValue) {
|
||||
if (newValue == null) {
|
||||
@ -481,9 +491,6 @@
|
||||
|
||||
handleBeforeUpload() {
|
||||
//上传前判断
|
||||
this.params = {
|
||||
token: this.$store.state.userToken,
|
||||
};
|
||||
return true;
|
||||
},
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
name="files"
|
||||
ref="upload"
|
||||
:action="actionUrl"
|
||||
:headers="headers"
|
||||
:data="params"
|
||||
multiple
|
||||
:format="uploadFormat"
|
||||
@ -37,10 +38,16 @@ export default {
|
||||
computed: {
|
||||
...mapState(['userToken', 'dialogId']),
|
||||
|
||||
headers() {
|
||||
return {
|
||||
fd: this.$store.state.method.getStorageString("userWsFd"),
|
||||
token: this.userToken,
|
||||
}
|
||||
},
|
||||
|
||||
params() {
|
||||
return {
|
||||
dialog_id: this.dialogId,
|
||||
token: this.userToken,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -3,6 +3,7 @@
|
||||
name="files"
|
||||
ref="upload"
|
||||
:action="actionUrl"
|
||||
:headers="headers"
|
||||
:data="params"
|
||||
multiple
|
||||
:format="uploadFormat"
|
||||
@ -37,12 +38,18 @@ export default {
|
||||
computed: {
|
||||
...mapState(['userToken', 'projectOpenTask']),
|
||||
|
||||
headers() {
|
||||
return {
|
||||
fd: this.$store.state.method.getStorageString("userWsFd"),
|
||||
token: this.userToken,
|
||||
}
|
||||
},
|
||||
|
||||
params() {
|
||||
return {
|
||||
task_id: this.projectOpenTask.id,
|
||||
token: this.userToken,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
@ -54,25 +61,19 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
handleSuccess(res, file) {
|
||||
handleSuccess({ret, data, msg}, file) {
|
||||
//上传完成
|
||||
let index = this.projectOpenTask.files.findIndex(({tempId}) => tempId == file.tempId);
|
||||
if (res.ret === 1) {
|
||||
if (index > -1) {
|
||||
this.projectOpenTask.files.splice(index, 1, res.data);
|
||||
this.$store.dispatch("saveTask", {
|
||||
id: this.projectOpenTask.id,
|
||||
file_num: this.projectOpenTask.files.length,
|
||||
});
|
||||
}
|
||||
if (index > -1) {
|
||||
this.projectOpenTask.files.splice(index, 1);
|
||||
}
|
||||
if (ret === 1) {
|
||||
this.$store.commit("taskUploadSuccess", data)
|
||||
} else {
|
||||
if (index > -1) {
|
||||
this.projectOpenTask.files.splice(index, 1);
|
||||
}
|
||||
this.$refs.upload.fileList.pop();
|
||||
$A.modalWarning({
|
||||
title: '发送失败',
|
||||
content: '文件 ' + file.name + ' 发送失败,' + res.msg
|
||||
content: '文件 ' + file.name + ' 发送失败,' + msg
|
||||
});
|
||||
}
|
||||
},
|
||||
|
22
resources/assets/js/store/actions.js
vendored
22
resources/assets/js/store/actions.js
vendored
@ -671,27 +671,21 @@ export default {
|
||||
* 更新任务
|
||||
* @param state
|
||||
* @param dispatch
|
||||
* @param commit
|
||||
* @param data
|
||||
* @returns {Promise<unknown>}
|
||||
*/
|
||||
taskUpdate({state, dispatch}, data) {
|
||||
taskUpdate({state, dispatch, commit}, data) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
const post = state.method.cloneJSON(state.method.date2string(data));
|
||||
if (state.method.isArray(post.owner)) {
|
||||
post.owner = post.owner.find((id) => id)
|
||||
}
|
||||
if (state.method.isArray(post.owner)) post.owner = post.owner.find((id) => id)
|
||||
//
|
||||
dispatch("call", {
|
||||
url: 'project/task/update',
|
||||
data: post,
|
||||
method: 'post',
|
||||
}).then(result => {
|
||||
if (result.data.parent_id) {
|
||||
dispatch("getTaskBasic", result.data.parent_id);
|
||||
}
|
||||
if (typeof post.complete_at !== "undefined") {
|
||||
dispatch("getProjectBasic", {id: result.data.project_id});
|
||||
}
|
||||
dispatch("saveTask", result.data);
|
||||
commit("taskUpdateSuccess", result.data)
|
||||
resolve(result)
|
||||
}).catch(result => {
|
||||
dispatch("getTaskBasic", post.task_id);
|
||||
@ -1169,6 +1163,12 @@ export default {
|
||||
case 'add':
|
||||
commit("taskAddSuccess", data)
|
||||
break;
|
||||
case 'update':
|
||||
commit("taskUpdateSuccess", data)
|
||||
break;
|
||||
case 'upload':
|
||||
commit("taskUploadSuccess", data)
|
||||
break;
|
||||
case 'archived':
|
||||
case 'delete':
|
||||
commit("taskDeleteSuccess", data)
|
||||
|
45
resources/assets/js/store/mutations.js
vendored
45
resources/assets/js/store/mutations.js
vendored
@ -93,6 +93,51 @@ export default {
|
||||
this.dispatch("saveTask", task);
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新任务
|
||||
* @param state
|
||||
* @param data
|
||||
*/
|
||||
taskUpdateSuccess(state, data) {
|
||||
if (data.parent_id) {
|
||||
this.dispatch("getTaskBasic", data.parent_id);
|
||||
}
|
||||
if (data.is_update_complete) {
|
||||
this.dispatch("getProjectBasic", {id: data.project_id});
|
||||
}
|
||||
this.dispatch("saveTask", data);
|
||||
},
|
||||
|
||||
/**
|
||||
* 任务上传附件
|
||||
* @param state
|
||||
* @param data
|
||||
*/
|
||||
taskUploadSuccess(state, data) {
|
||||
if (state.projectOpenTask.id == data.task_id) {
|
||||
let index = state.projectOpenTask.files.findIndex(({id}) => id == data.id);
|
||||
if (index > -1) {
|
||||
state.projectOpenTask.files.splice(index, 1, data);
|
||||
} else {
|
||||
state.projectOpenTask.files.push(data)
|
||||
}
|
||||
}
|
||||
state.projectDetail.project_column.some(({project_task}) => {
|
||||
let task = project_task.find(({id}) => id === data.task_id);
|
||||
if (task) {
|
||||
if (!state.method.isJson(task._file_tmp)) task._file_tmp = {}
|
||||
if (task._file_tmp[data.id] !== true) {
|
||||
task._file_tmp[data.id] = true;
|
||||
this.dispatch("saveTask", {
|
||||
id: task.id,
|
||||
file_num: task.file_num + 1,
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除任务
|
||||
* @param state
|
||||
|
Loading…
x
Reference in New Issue
Block a user