优化了一些代码
This commit is contained in:
parent
02eb386155
commit
21e618cca2
@ -623,6 +623,8 @@ class FileController extends AbstractController
|
||||
'asp', 'properties', 'gitignore', 'log', 'bas', 'prg', 'python', 'ftl', 'aspx' => "code",
|
||||
'mp3', 'wav', 'mp4', 'flv',
|
||||
'avi', 'mov', 'wmv', 'mkv', '3gp', 'rm' => "media",
|
||||
'xmind' => "xmind",
|
||||
'rp' => "axure",
|
||||
default => "",
|
||||
};
|
||||
$file = File::createInstance([
|
||||
|
@ -1328,72 +1328,6 @@ class ProjectController extends AbstractController
|
||||
return Base::retSuccess('修改成功', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {post} api/project/task/upload 27. 上传文件
|
||||
*
|
||||
* @apiDescription 需要token身份(限:项目、任务负责人)
|
||||
* @apiVersion 1.0.0
|
||||
* @apiGroup project
|
||||
* @apiName task__upload
|
||||
*
|
||||
* @apiParam {Number} task_id 任务ID
|
||||
* @apiParam {String} [filename] post-文件名称
|
||||
* @apiParam {String} [image64] post-base64图片(二选一)
|
||||
* @apiParam {File} [files] post-文件对象(二选一)
|
||||
*
|
||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||
* @apiSuccess {Object} data 返回数据
|
||||
*/
|
||||
public function task__upload()
|
||||
{
|
||||
$user = User::auth();
|
||||
//
|
||||
$task_id = Base::getPostInt('task_id');
|
||||
//
|
||||
$task = ProjectTask::userTask($task_id, true, true);
|
||||
//
|
||||
$path = "uploads/task/" . $task->id . "/";
|
||||
$image64 = Base::getPostValue('image64');
|
||||
$fileName = Base::getPostValue('filename');
|
||||
if ($image64) {
|
||||
$data = Base::image64save([
|
||||
"image64" => $image64,
|
||||
"path" => $path,
|
||||
"fileName" => $fileName,
|
||||
]);
|
||||
} else {
|
||||
$data = Base::upload([
|
||||
"file" => Request::file('files'),
|
||||
"type" => 'file',
|
||||
"path" => $path,
|
||||
"fileName" => $fileName,
|
||||
]);
|
||||
}
|
||||
//
|
||||
if (Base::isError($data)) {
|
||||
return Base::retError($data['msg']);
|
||||
} else {
|
||||
$fileData = $data['data'];
|
||||
$file = ProjectTaskFile::createInstance([
|
||||
'project_id' => $task->project_id,
|
||||
'task_id' => $task->id,
|
||||
'name' => $fileData['name'],
|
||||
'size' => $fileData['size'] * 1024,
|
||||
'ext' => $fileData['ext'],
|
||||
'path' => $fileData['path'],
|
||||
'thumb' => Base::unFillUrl($fileData['thumb']),
|
||||
'userid' => $user->userid,
|
||||
]);
|
||||
$file->save();
|
||||
//
|
||||
$file = ProjectTaskFile::find($file->id);
|
||||
$task->addLog("上传文件:" . $file->name);
|
||||
$task->pushMsg('upload', $file);
|
||||
return Base::retSuccess("上传成功", $file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} api/project/task/dialog 28. 创建/获取聊天室
|
||||
*
|
||||
@ -1653,7 +1587,7 @@ class ProjectController extends AbstractController
|
||||
/**
|
||||
* @api {get} api/project/flow/list 33. 工作流列表
|
||||
*
|
||||
* @apiDescription 需要token身份(限:项目负责人)
|
||||
* @apiDescription 需要token身份
|
||||
* @apiVersion 1.0.0
|
||||
* @apiGroup project
|
||||
* @apiName flow__list
|
||||
@ -1669,9 +1603,8 @@ class ProjectController extends AbstractController
|
||||
User::auth();
|
||||
//
|
||||
$project_id = intval(Request::input('project_id'));
|
||||
$is_filter = intval(Request::input('is_filter',0));
|
||||
//
|
||||
$project = Project::userProject($project_id, true, true, $is_filter);
|
||||
$project = Project::userProject($project_id, true);
|
||||
//
|
||||
$list = ProjectFlow::with(['ProjectFlowItem'])->whereProjectId($project->id)->get();
|
||||
return Base::retSuccess('success', $list);
|
||||
|
@ -354,11 +354,10 @@ class Project extends AbstractModel
|
||||
* 获取项目信息(用于判断会员是否存在项目内)
|
||||
* @param int $project_id
|
||||
* @param null|bool $archived true:仅限未归档, false:仅限已归档, null:不限制
|
||||
* @param null $mustOwner true:仅限项目负责人, false:仅限非项目负责人, null:不限制
|
||||
* @param int $is_filter 是否是用筛选列表
|
||||
* @param null|bool $mustOwner true:仅限项目负责人, false:仅限非项目负责人, null:不限制
|
||||
* @return self
|
||||
*/
|
||||
public static function userProject($project_id, $archived = true, $mustOwner = null, $is_filter = 0)
|
||||
public static function userProject($project_id, $archived = true, $mustOwner = null)
|
||||
{
|
||||
$project = self::authData()->where('projects.id', intval($project_id))->first();
|
||||
if (empty($project)) {
|
||||
@ -370,10 +369,10 @@ class Project extends AbstractModel
|
||||
if ($archived === false && $project->archived_at == null) {
|
||||
throw new ApiException('项目未归档', [ 'project_id' => $project_id ]);
|
||||
}
|
||||
if ($mustOwner === true && !$project->owner && $is_filter === 0) {
|
||||
if ($mustOwner === true && !$project->owner) {
|
||||
throw new ApiException('仅限项目负责人操作', [ 'project_id' => $project_id ]);
|
||||
}
|
||||
if ($mustOwner === false && $project->owner && $is_filter === 0) {
|
||||
if ($mustOwner === false && $project->owner) {
|
||||
throw new ApiException('禁止项目负责人操作', [ 'project_id' => $project_id ]);
|
||||
}
|
||||
return $project;
|
||||
|
@ -46,9 +46,6 @@ class WebSocketDialogMsg extends AbstractModel
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
const MSG_TYPE_TEXT = "text";
|
||||
const MSG_TYPE_FILE = "file";
|
||||
|
||||
/**
|
||||
* 阅读占比
|
||||
* @return int|mixed
|
||||
|
@ -2263,7 +2263,8 @@ class Base
|
||||
'asp', 'properties', 'gitignore', 'log', 'bas', 'prg', 'python', 'ftl', 'aspx',
|
||||
'mp3', 'wav', 'mp4', 'flv',
|
||||
'avi', 'mov', 'wmv', 'mkv', '3gp', 'rm',
|
||||
'xmind', 'rp',
|
||||
'xmind',
|
||||
'rp',
|
||||
];
|
||||
break;
|
||||
default:
|
||||
|
@ -13,15 +13,8 @@
|
||||
<Input v-if="$Electron && cacheServerUrl" :value="$A.getDomain(cacheServerUrl)" prefix="ios-globe-outline" size="large" readonly clearable @on-clear="clearServerUrl"/>
|
||||
|
||||
<Input v-model="email" prefix="ios-mail-outline" :placeholder="$L('输入您的电子邮件')" size="large" @on-enter="onLogin" @on-blur="onBlur" />
|
||||
<Input v-if="loginType=='login'"
|
||||
v-model="password" prefix="ios-lock-outline" :placeholder="$L('输入您的密码')" type="password"
|
||||
size="large"
|
||||
@on-enter="onLogin" />
|
||||
<Poptip v-else :content="$L('密码必须包含数字,字母大小写或者特殊字符的组合,长度在6~32位之间')" :transfer="true">
|
||||
<Input v-model="password" prefix="ios-lock-outline" :placeholder="$L('输入您的密码')" type="password"
|
||||
size="large"
|
||||
@on-enter="onLogin" />
|
||||
</Poptip>
|
||||
|
||||
<Input v-model="password" prefix="ios-lock-outline" :placeholder="$L('输入您的密码')" type="password" size="large" @on-enter="onLogin" />
|
||||
|
||||
<Input v-if="loginType=='reg'" v-model="password2" prefix="ios-lock-outline" :placeholder="$L('输入确认密码')" type="password" size="large" @on-enter="onLogin" />
|
||||
<Input v-if="loginType=='reg' && needInvite" v-model="invite" class="login-code" :placeholder="$L('请输入注册邀请码')" type="text" size="large" @on-enter="onLogin"><span slot="prepend"> {{$L('邀请码')}} </span></Input>
|
||||
@ -252,7 +245,7 @@ export default {
|
||||
}
|
||||
if (this.loginType == 'reg') {
|
||||
if (this.password != this.password2) {
|
||||
$A.noticeError("确认密码输入不一致");
|
||||
$A.messageWarning("确认密码输入不一致");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -276,10 +269,7 @@ export default {
|
||||
});
|
||||
}).catch(({data, msg}) => {
|
||||
this.loadIng--;
|
||||
$A.noticeError({
|
||||
desc: msg,
|
||||
duration: 10
|
||||
});
|
||||
$A.modalError(msg);
|
||||
if (data.code === 'need') {
|
||||
this.reCode();
|
||||
this.codeNeed = true;
|
||||
|
@ -451,6 +451,12 @@ export default {
|
||||
}, 5000)
|
||||
},
|
||||
|
||||
workReportShow(show) {
|
||||
if (show) {
|
||||
this.getReportUnread(0);
|
||||
}
|
||||
},
|
||||
|
||||
unreadTotal: {
|
||||
handler(num) {
|
||||
if (this.$Electron) {
|
||||
@ -550,7 +556,6 @@ export default {
|
||||
if (this.reportUnreadNumber > 0) {
|
||||
this.reportTabs = "receive";
|
||||
}
|
||||
this.getReportUnread(0);
|
||||
this.workReportShow = true;
|
||||
return;
|
||||
case 'clearCache':
|
||||
|
@ -35,13 +35,17 @@
|
||||
<li v-if="dialogData.hasMorePages" class="history" @click="loadNextPage">{{$L('加载历史消息')}}</li>
|
||||
<li v-else-if="dialogData.loading > 0 && dialogMsgList.length === 0" class="loading"><Loading/></li>
|
||||
<li v-else-if="dialogMsgList.length === 0" class="nothing">{{$L('暂无消息')}}</li>
|
||||
<DialogList
|
||||
<li
|
||||
v-for="item in dialogMsgList"
|
||||
:dialogMsg="item"
|
||||
:topId="topId"
|
||||
:id="'view_' + item.id"
|
||||
:key="item.id"
|
||||
:dialogData="dialogData"
|
||||
/>
|
||||
:class="{self:item.userid == userId, 'history-tip': topId == item.id}">
|
||||
<em v-if="topId == item.id" class="history-text">{{$L('历史消息')}}</em>
|
||||
<div class="dialog-avatar">
|
||||
<UserAvatar :userid="item.userid" :tooltipDisabled="item.userid == userId" :size="30"/>
|
||||
</div>
|
||||
<DialogView :msg-data="item" :dialog-type="dialogData.type"/>
|
||||
</li>
|
||||
<li
|
||||
v-for="item in tempMsgList"
|
||||
:id="'tmp_' + item.id"
|
||||
@ -108,12 +112,11 @@ import ScrollerY from "../../../components/ScrollerY";
|
||||
import {mapState} from "vuex";
|
||||
import DialogView from "./DialogView";
|
||||
import DialogUpload from "./DialogUpload";
|
||||
import DialogList from "./DialogList";
|
||||
import {Store} from "le5le-store";
|
||||
|
||||
export default {
|
||||
name: "DialogWrapper",
|
||||
components: {DialogList, DialogUpload, DialogView, ScrollerY, DragInput},
|
||||
components: {DialogUpload, DialogView, ScrollerY, DragInput},
|
||||
props: {
|
||||
dialogId: {
|
||||
type: Number,
|
||||
|
@ -72,20 +72,15 @@
|
||||
<div class="project-subbox">
|
||||
<div class="project-subtitle">{{projectData.desc}}</div>
|
||||
<div class="project-switch">
|
||||
<div v-if="completedCount > 0" class="project-checkbox">
|
||||
<Checkbox :value="projectParameter('completedTask')" @on-change="toggleCompleted">{{$L('显示已完成')}}</Checkbox>
|
||||
</div>
|
||||
<div v-if="flowList && flowList.length > 0" class="project-select">
|
||||
<div class="title">{{$L('进度')}}</div>
|
||||
<Select
|
||||
v-model="flowId"
|
||||
style="width:100%"
|
||||
:placeholder="this.$L('全部')"
|
||||
>
|
||||
<Select v-model="flowId" :placeholder="this.$L('进度')">
|
||||
<Option value="0">{{this.$L('全部')}}</Option>
|
||||
<Option v-for="item in flowList" :value="item.id" :key="item.id">{{ item.name }}</Option>
|
||||
</Select>
|
||||
</div>
|
||||
<div v-if="completedCount > 0" class="project-checkbox">
|
||||
<Checkbox :value="projectParameter('completedTask')" @on-change="toggleCompleted">{{$L('显示已完成')}}</Checkbox>
|
||||
</div>
|
||||
<div :class="['project-switch-button', !projectParameter('card') ? 'menu' : '']" @click="$store.dispatch('toggleProjectParameter', 'card')">
|
||||
<div><i class="taskfont"></i></div>
|
||||
<div><i class="taskfont"></i></div>
|
||||
@ -507,8 +502,9 @@ export default {
|
||||
archivedTaskShow: false,
|
||||
|
||||
projectDialogSubscribe: null,
|
||||
|
||||
flowId: 0,
|
||||
flowList: [],
|
||||
flowId: 0
|
||||
}
|
||||
},
|
||||
|
||||
@ -572,23 +568,21 @@ export default {
|
||||
},
|
||||
|
||||
panelTask() {
|
||||
const {searchText,flowId} = this;
|
||||
const {searchText, flowId} = this;
|
||||
return function (list) {
|
||||
if (!this.projectParameter('completedTask')) {
|
||||
list = list.filter(({complete_at}) => {
|
||||
return !complete_at;
|
||||
});
|
||||
}
|
||||
if (flowId > 0) {
|
||||
list = list.filter(({flow_item_id}) => flow_item_id === flowId);
|
||||
}
|
||||
if (searchText) {
|
||||
list = list.filter(({name, desc}) => {
|
||||
return $A.strExists(name, searchText) || $A.strExists(desc, searchText);
|
||||
});
|
||||
}
|
||||
if(flowId > 0){
|
||||
list = list.filter(({flow_item_id}) => {
|
||||
return flow_item_id === flowId;
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
},
|
||||
@ -624,7 +618,7 @@ export default {
|
||||
})).sort((a, b) => {
|
||||
let at1 = $A.Date(a.complete_at),
|
||||
at2 = $A.Date(b.complete_at);
|
||||
if(at1 || at2){
|
||||
if (at1 || at2) {
|
||||
return at1 - at2;
|
||||
}
|
||||
if (a.sort != b.sort) {
|
||||
@ -691,14 +685,14 @@ export default {
|
||||
if (task.project_id != projectId || task.parent_id > 0) {
|
||||
return false;
|
||||
}
|
||||
if (flowId > 0 && task.flow_item_id !== flowId) {
|
||||
return false;
|
||||
}
|
||||
if (searchText) {
|
||||
if (!$A.strExists(task.name, searchText) && !$A.strExists(task.desc, searchText)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(task.flow_item_id !== flowId && flowId > 0){
|
||||
return false;
|
||||
}
|
||||
return !task.complete_at;
|
||||
});
|
||||
return array.sort((a, b) => {
|
||||
@ -725,14 +719,14 @@ export default {
|
||||
if (task.project_id != projectId || task.parent_id > 0) {
|
||||
return false;
|
||||
}
|
||||
if (flowId > 0 && task.flow_item_id !== flowId) {
|
||||
return false;
|
||||
}
|
||||
if (searchText) {
|
||||
if (!$A.strExists(task.name, searchText) && !$A.strExists(task.desc, searchText)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(task.flow_item_id !== flowId && flowId > 0){
|
||||
return false;
|
||||
}
|
||||
return task.complete_at;
|
||||
});
|
||||
return array.sort((a, b) => {
|
||||
@ -762,10 +756,11 @@ export default {
|
||||
},
|
||||
projectId: {
|
||||
handler(val) {
|
||||
if (val) {
|
||||
if (val > 0) {
|
||||
this.getFlowData();
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
|
||||
@ -1158,21 +1153,20 @@ export default {
|
||||
|
||||
taskIsHidden(task) {
|
||||
const {name, desc, complete_at} = task;
|
||||
const {searchText,flowId} = this;
|
||||
const {searchText, flowId} = this;
|
||||
if (!this.projectParameter('completedTask')) {
|
||||
if (complete_at) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (flowId > 0 && task.flow_item_id !== flowId) {
|
||||
return false;
|
||||
}
|
||||
if (searchText) {
|
||||
if (!($A.strExists(name, searchText) || $A.strExists(desc, searchText))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(task.flow_item_id !== flowId && flowId > 0){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
@ -1200,6 +1194,22 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
getFlowData() {
|
||||
this.$store.dispatch("call", {
|
||||
url: 'project/flow/list',
|
||||
data: {
|
||||
project_id: this.projectId,
|
||||
},
|
||||
}).then(({data}) => {
|
||||
let flowList = data.map(({project_flow_item}) => project_flow_item);
|
||||
if (flowList) {
|
||||
this.flowList = flowList[0];
|
||||
}
|
||||
}).catch(() => {
|
||||
this.flowList = [];
|
||||
});
|
||||
},
|
||||
|
||||
inviteCopy() {
|
||||
if (!this.inviteData.url) {
|
||||
return;
|
||||
@ -1253,14 +1263,14 @@ export default {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (this.flowId > 0 && task.flow_item_id !== this.flowId) {
|
||||
return false;
|
||||
}
|
||||
if (this.searchText) {
|
||||
if (!$A.strExists(task.name, this.searchText) && !$A.strExists(task.desc, this.searchText)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(task.flow_item_id !== this.flowId && this.flowId > 0){
|
||||
return false;
|
||||
}
|
||||
return task.owner;
|
||||
},
|
||||
|
||||
@ -1276,37 +1286,20 @@ export default {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (this.flowId > 0 && task.flow_item_id !== this.flowId) {
|
||||
return false;
|
||||
}
|
||||
if (this.searchText) {
|
||||
if (!$A.strExists(task.name, this.searchText) && !$A.strExists(task.desc, this.searchText)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(task.flow_item_id !== this.flowId && this.flowId > 0){
|
||||
return false;
|
||||
}
|
||||
return task.task_user && task.task_user.find(({userid, owner}) => userid == this.userId && owner == 0);
|
||||
},
|
||||
|
||||
expiresFormat(date) {
|
||||
return $A.countDownFormat(date, this.nowTime)
|
||||
},
|
||||
getFlowData() {
|
||||
this.$store.dispatch("call", {
|
||||
url: 'project/flow/list',
|
||||
data: {
|
||||
project_id: this.projectId,
|
||||
is_filter: 1
|
||||
},
|
||||
}).then(({data}) => {
|
||||
let flowList = data.map(item => {
|
||||
return item.project_flow_item;
|
||||
});
|
||||
this.flowList = flowList[0];
|
||||
}).catch(({msg}) => {
|
||||
this.flowList = [];
|
||||
return false;
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -103,16 +103,10 @@ export default {
|
||||
if (this.id > 0) {
|
||||
this.getDetail(val);
|
||||
}else{
|
||||
this.userInputShow = false;
|
||||
this.reportData.offset = 0;
|
||||
this.reportData.type = "weekly";
|
||||
this.reportData.receive = [];
|
||||
this.getTemplate();
|
||||
setTimeout(() => {
|
||||
// 如果不做异步,直接重新赋值的话会导致组件无法重新加载
|
||||
// 组件不销毁重新渲染,会导致UserInput组件无法重新拉取所有人的列表
|
||||
this.userInputShow = true;
|
||||
}, 50)
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -473,10 +473,6 @@ export default {
|
||||
return;
|
||||
}
|
||||
this.loadIng++;
|
||||
// 处理栏目变更
|
||||
if ( this.addData.cascader.length > 0 ) {
|
||||
this.addData.column_id = this.addData.cascader[1];
|
||||
}
|
||||
this.$store.dispatch("taskAdd", this.addData).then(({msg}) => {
|
||||
this.loadIng--;
|
||||
$A.messageSuccess(msg);
|
||||
|
@ -417,7 +417,8 @@ export default {
|
||||
'asp', 'properties', 'gitignore', 'log', 'bas', 'prg', 'python', 'ftl', 'aspx',
|
||||
'mp3', 'wav', 'mp4', 'flv',
|
||||
'avi', 'mov', 'wmv', 'mkv', '3gp', 'rm',
|
||||
'xmind', 'rp',
|
||||
'xmind',
|
||||
'rp',
|
||||
],
|
||||
uploadAccept: '',
|
||||
maxSize: 204800,
|
||||
|
@ -136,14 +136,18 @@
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
.project-select{
|
||||
.project-select {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 14px;
|
||||
opacity: 0.9;
|
||||
z-index: 1000;
|
||||
.title{
|
||||
width:50px;
|
||||
.ivu-select-single {
|
||||
.ivu-select-selection {
|
||||
height: 30px;
|
||||
.ivu-select-selected-value {
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.project-switch-button {
|
||||
@ -957,16 +961,6 @@
|
||||
.project-switch {
|
||||
margin-left: 0;
|
||||
justify-content: flex-end;
|
||||
.project-select{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 14px;
|
||||
opacity: 0.9;
|
||||
z-index: 1000;
|
||||
.title{
|
||||
width:50px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user