feat: 加入【项目管理】任务列表流程筛选被回滚功能
This commit is contained in:
parent
a8c0978f0d
commit
11d1f26724
@ -1579,8 +1579,9 @@ 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);
|
||||
$project = Project::userProject($project_id, true, true, $is_filter);
|
||||
//
|
||||
$list = ProjectFlow::with(['ProjectFlowItem'])->whereProjectId($project->id)->get();
|
||||
return Base::retSuccess('success', $list);
|
||||
|
@ -354,10 +354,11 @@ class Project extends AbstractModel
|
||||
* 获取项目信息(用于判断会员是否存在项目内)
|
||||
* @param int $project_id
|
||||
* @param null|bool $archived true:仅限未归档, false:仅限已归档, null:不限制
|
||||
* @param null|bool $mustOwner true:仅限项目负责人, false:仅限非项目负责人, null:不限制
|
||||
* @param null $mustOwner true:仅限项目负责人, false:仅限非项目负责人, null:不限制
|
||||
* @param int $is_filter 是否是用筛选列表
|
||||
* @return self
|
||||
*/
|
||||
public static function userProject($project_id, $archived = true, $mustOwner = null)
|
||||
public static function userProject($project_id, $archived = true, $mustOwner = null, $is_filter = 0)
|
||||
{
|
||||
$project = self::authData()->where('projects.id', intval($project_id))->first();
|
||||
if (empty($project)) {
|
||||
@ -369,10 +370,10 @@ class Project extends AbstractModel
|
||||
if ($archived === false && $project->archived_at == null) {
|
||||
throw new ApiException('项目未归档', [ 'project_id' => $project_id ]);
|
||||
}
|
||||
if ($mustOwner === true && !$project->owner) {
|
||||
if ($mustOwner === true && !$project->owner && $is_filter === 0) {
|
||||
throw new ApiException('仅限项目负责人操作', [ 'project_id' => $project_id ]);
|
||||
}
|
||||
if ($mustOwner === false && $project->owner) {
|
||||
if ($mustOwner === false && $project->owner && $is_filter === 0) {
|
||||
throw new ApiException('禁止项目负责人操作', [ 'project_id' => $project_id ]);
|
||||
}
|
||||
return $project;
|
||||
|
@ -72,6 +72,17 @@
|
||||
<div class="project-subbox">
|
||||
<div class="project-subtitle">{{projectData.desc}}</div>
|
||||
<div class="project-switch">
|
||||
<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('全部')"
|
||||
>
|
||||
<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>
|
||||
@ -495,6 +506,8 @@ export default {
|
||||
archivedTaskShow: false,
|
||||
|
||||
projectDialogSubscribe: null,
|
||||
flowList: [],
|
||||
flowId: 0
|
||||
}
|
||||
},
|
||||
|
||||
@ -558,7 +571,7 @@ export default {
|
||||
},
|
||||
|
||||
panelTask() {
|
||||
const {searchText} = this;
|
||||
const {searchText,flowId} = this;
|
||||
return function (list) {
|
||||
if (!this.projectParameter('completedTask')) {
|
||||
list = list.filter(({complete_at}) => {
|
||||
@ -570,6 +583,11 @@ export default {
|
||||
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;
|
||||
}
|
||||
},
|
||||
@ -603,6 +621,11 @@ export default {
|
||||
}
|
||||
return task.column_id == column.id;
|
||||
})).sort((a, b) => {
|
||||
let at1 = $A.Date(a.complete_at),
|
||||
at2 = $A.Date(b.complete_at);
|
||||
if(at1 || at2){
|
||||
return at1 - at2;
|
||||
}
|
||||
if (a.sort != b.sort) {
|
||||
return a.sort - b.sort;
|
||||
}
|
||||
@ -659,7 +682,7 @@ export default {
|
||||
},
|
||||
|
||||
unList() {
|
||||
const {projectId, cacheTasks, searchText, sortField, sortType} = this;
|
||||
const {projectId, cacheTasks, searchText, sortField, sortType, flowId} = this;
|
||||
const array = cacheTasks.filter(task => {
|
||||
if (task.archived_at) {
|
||||
return false;
|
||||
@ -672,6 +695,9 @@ export default {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(task.flow_item_id !== flowId && flowId > 0){
|
||||
return false;
|
||||
}
|
||||
return !task.complete_at;
|
||||
});
|
||||
return array.sort((a, b) => {
|
||||
@ -690,7 +716,7 @@ export default {
|
||||
},
|
||||
|
||||
completedList() {
|
||||
const {projectId, cacheTasks, searchText} = this;
|
||||
const {projectId, cacheTasks, searchText, flowId} = this;
|
||||
const array = cacheTasks.filter(task => {
|
||||
if (task.archived_at) {
|
||||
return false;
|
||||
@ -703,6 +729,9 @@ export default {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(task.flow_item_id !== flowId && flowId > 0){
|
||||
return false;
|
||||
}
|
||||
return task.complete_at;
|
||||
});
|
||||
return array.sort((a, b) => {
|
||||
@ -729,7 +758,14 @@ export default {
|
||||
watch: {
|
||||
projectData() {
|
||||
this.sortData = this.getSort();
|
||||
}
|
||||
},
|
||||
projectId: {
|
||||
handler(val) {
|
||||
if (val) {
|
||||
this.getFlowData();
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
@ -1121,7 +1157,7 @@ export default {
|
||||
|
||||
taskIsHidden(task) {
|
||||
const {name, desc, complete_at} = task;
|
||||
const {searchText} = this;
|
||||
const {searchText,flowId} = this;
|
||||
if (!this.projectParameter('completedTask')) {
|
||||
if (complete_at) {
|
||||
return true;
|
||||
@ -1132,6 +1168,10 @@ export default {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(task.flow_item_id !== flowId && flowId > 0){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
@ -1196,6 +1236,9 @@ export default {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(task.flow_item_id !== this.flowId && this.flowId > 0){
|
||||
return false;
|
||||
}
|
||||
return task.owner;
|
||||
},
|
||||
|
||||
@ -1216,12 +1259,32 @@ export default {
|
||||
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>
|
||||
|
@ -136,6 +136,16 @@
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
.project-select{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 14px;
|
||||
opacity: 0.9;
|
||||
z-index: 1000;
|
||||
.title{
|
||||
width:50px;
|
||||
}
|
||||
}
|
||||
.project-switch-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -947,6 +957,16 @@
|
||||
.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