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