Browse Source
* add task group * modify task group * add task group queue * add task group queue * add task group queue * add task group queue * add task group priority * fix a few issue with api * add task group queue * modify task group queue * modify task group * fix a little bit issue * fix a little bug in the page of managing task group3.0.0/version-upgrade
calvin
3 years ago
committed by
GitHub
25 changed files with 1300 additions and 27 deletions
@ -0,0 +1,86 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
<template> |
||||
<el-select |
||||
:disabled="isDetails" |
||||
@change="_onChange" |
||||
v-model="selectedValue" |
||||
size="small" |
||||
clearable |
||||
style="width: 180px"> |
||||
<el-option |
||||
v-for="item in taskGroupList" |
||||
:key="item.id" |
||||
:value="item.id" |
||||
:label="item.name"> |
||||
</el-option> |
||||
</el-select> |
||||
</template> |
||||
<script> |
||||
import disabledState from '@/module/mixin/disabledState' |
||||
export default { |
||||
name: 'form-task-group', |
||||
data () { |
||||
return { |
||||
selectedValue: this.value, |
||||
taskGroupList: [] |
||||
} |
||||
}, |
||||
mixins: [disabledState], |
||||
props: { |
||||
projectCode: { |
||||
type: Number |
||||
}, |
||||
value: { |
||||
type: Number |
||||
} |
||||
}, |
||||
model: { |
||||
prop: 'value', |
||||
event: 'taskGroupIdEvent' |
||||
}, |
||||
methods: { |
||||
_onChange (o) { |
||||
this.$emit('taskGroupIdEvent', o) |
||||
} |
||||
}, |
||||
watch: { |
||||
value (val) { |
||||
this.selectedValue = val |
||||
} |
||||
}, |
||||
created () { |
||||
let stateTaskGroupList = this.store.state.resource.taskGroupListAll || [] |
||||
if (stateTaskGroupList.length) { |
||||
this.taskGroupList = stateTaskGroupList |
||||
} else { |
||||
let params = { |
||||
pageNo: 1, |
||||
pageSize: 2147483647, |
||||
projectCode: this.projectCode |
||||
} |
||||
this.store.dispatch('resource/getTaskGroupListPagingByProjectCode', params).then(res => { |
||||
this.$nextTick(() => { |
||||
if (res.totalList) { |
||||
this.taskGroupList = res.totalList |
||||
} |
||||
}) |
||||
}) |
||||
} |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,24 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
<template> |
||||
<router-view></router-view> |
||||
</template> |
||||
<script> |
||||
export default { |
||||
name: 'task-group-option-index' |
||||
} |
||||
</script> |
@ -0,0 +1,202 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
<template> |
||||
<m-popover ref="popover" :ok-text="item && item.name ? $t('Edit') : $t('Submit')" @ok="_ok" @close="close"> |
||||
<template slot="content"> |
||||
<div class="create-task-group-model"> |
||||
<m-list-box-f> |
||||
<template slot="name"><strong>*</strong>{{$t('Task group name')}}</template> |
||||
<template slot="content"> |
||||
<el-input |
||||
type="input" |
||||
v-model="name" |
||||
maxlength="60" |
||||
size="mini" |
||||
:placeholder="$t('Please enter name')"> |
||||
</el-input> |
||||
</template> |
||||
</m-list-box-f> |
||||
<m-list-box-f> |
||||
<template slot="name"><strong>*</strong>{{$t('Project Name')}}</template> |
||||
<template slot="content"> |
||||
<el-select |
||||
:disabled="item.modalType==='edit'" |
||||
v-model="projectCode" |
||||
size="mini" |
||||
collapse-tags |
||||
style="display: block;" |
||||
:placeholder="$t('Please select project')"> |
||||
<el-option |
||||
v-for="item in projectOptions" |
||||
:key="item.code" |
||||
:label="item.name" |
||||
:value="item.code"> |
||||
</el-option> |
||||
</el-select> |
||||
</template> |
||||
</m-list-box-f> |
||||
<m-list-box-f> |
||||
<template slot="name"><strong>*</strong>{{$t('Task group resource pool size')}}</template> |
||||
<template slot="content"> |
||||
<el-input |
||||
type="input" |
||||
v-model="groupSize" |
||||
maxlength="60" |
||||
size="mini" |
||||
:placeholder="$t('Please enter task group resource pool size')"> |
||||
</el-input> |
||||
</template> |
||||
</m-list-box-f> |
||||
<m-list-box-f> |
||||
<template slot="name"><strong>*</strong>{{$t('Task group desc')}}</template> |
||||
<template slot="content"> |
||||
<el-input |
||||
type="input" |
||||
v-model="description" |
||||
maxlength="60" |
||||
size="mini" |
||||
:placeholder="$t('Please enter task group desc')"> |
||||
</el-input> |
||||
</template> |
||||
</m-list-box-f> |
||||
</div> |
||||
</template> |
||||
</m-popover> |
||||
</template> |
||||
<script> |
||||
import _ from 'lodash' |
||||
import { mapActions } from 'vuex' |
||||
import i18n from '@/module/i18n' |
||||
import store from '@/conf/home/store' |
||||
import mPopover from '@/module/components/popup/popover' |
||||
import mListBoxF from '@/module/components/listBoxF/listBoxF' |
||||
|
||||
export default { |
||||
name: 'create-task-group', |
||||
data () { |
||||
return { |
||||
store, |
||||
name: '', |
||||
projectCode: '', |
||||
groupSize: 10, |
||||
projects: [], |
||||
project: [], |
||||
projectOptions: [], |
||||
description: '' |
||||
} |
||||
}, |
||||
props: { |
||||
item: Object |
||||
}, |
||||
methods: { |
||||
...mapActions('projects', ['getProjectsList']), |
||||
_getProjectList () { |
||||
this.getProjectsList().then(res => { |
||||
this.projects = res |
||||
}) |
||||
}, |
||||
_ok () { |
||||
if (!this._verification()) { |
||||
return |
||||
} |
||||
|
||||
let param = { |
||||
name: _.trim(this.name), |
||||
projectCode: this.projectCode, |
||||
groupSize: _.trim(this.groupSize), |
||||
description: _.trim(this.description) |
||||
} |
||||
|
||||
let $then = (res) => { |
||||
this.$emit('onUpdate') |
||||
this.$message.success(res.msg) |
||||
this.$refs.popover.spinnerLoading = false |
||||
} |
||||
|
||||
let $catch = (e) => { |
||||
this.$message.error(e.msg || '') |
||||
this.$refs.popover.spinnerLoading = false |
||||
} |
||||
|
||||
if (this.item && this.item.name) { |
||||
this.$refs.popover.spinnerLoading = true |
||||
let updateParam = { |
||||
id: this.item.id, |
||||
name: _.trim(this.name), |
||||
groupSize: _.trim(this.groupSize), |
||||
description: _.trim(this.description) |
||||
} |
||||
this.store.dispatch('resource/updateTaskGroup', updateParam).then(res => { |
||||
$then(res) |
||||
}).catch(e => { |
||||
$catch(e) |
||||
}) |
||||
} else { |
||||
this.$refs.popover.spinnerLoading = true |
||||
this.store.dispatch('resource/createTaskGroup', param).then(res => { |
||||
$then(res) |
||||
}).catch(e => { |
||||
$catch(e) |
||||
}) |
||||
} |
||||
}, |
||||
_verification () { |
||||
if (!this.name || !this.name.replace(/\s*/g, '')) { |
||||
this.$message.warning(`${i18n.$t('Please enter name')}`) |
||||
return false |
||||
} |
||||
if (this.groupSize < 1) { |
||||
this.$message.warning(`${i18n.$t('Task group resource pool size be a number')}`) |
||||
return false |
||||
} |
||||
if (!this.description || !this.description.replace(/\s*/g, '')) { |
||||
this.$message.warning(`${i18n.$t('Please enter task group desc')}`) |
||||
return false |
||||
} |
||||
return true |
||||
}, |
||||
close () { |
||||
this.$emit('close') |
||||
} |
||||
}, |
||||
watch: { |
||||
item: { |
||||
handler (val, oldVal) { |
||||
this.name = val.name |
||||
this.projectCode = val.projectCode |
||||
this.groupSize = val.groupSize |
||||
this.description = val.description |
||||
this.projectOptions = val.projectOptions |
||||
this.modalType = val.modalType |
||||
}, |
||||
deep: true |
||||
} |
||||
}, |
||||
created () { |
||||
if (this.item && this.item.name) { |
||||
this.name = this.item.name |
||||
this.projectCode = this.item.projectCode |
||||
this.groupSize = this.item.groupSize |
||||
this.description = this.item.description |
||||
} |
||||
this.projectOptions = this.item.projectOptions |
||||
}, |
||||
mounted () { |
||||
}, |
||||
components: { mPopover, mListBoxF } |
||||
} |
||||
</script> |
@ -0,0 +1,135 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
<template> |
||||
<div class="list-model"> |
||||
<div class="table-box"> |
||||
<el-table :data="list" size="mini" style="width: 100%"> |
||||
<el-table-column type="index" :label="$t('#')" width="50"></el-table-column> |
||||
<el-table-column prop="name" :label="$t('Task group name')" width="150"></el-table-column> |
||||
<el-table-column prop="projectName" :label="$t('Project Name')"></el-table-column> |
||||
<el-table-column prop="groupSize" :label="$t('Task group resource pool size')" min-width="50"></el-table-column> |
||||
<el-table-column prop="useSize" :label="$t('Task group resource used pool size')" min-width="50"></el-table-column> |
||||
<el-table-column prop="description" :label="$t('Task group desc')" min-width="50"></el-table-column> |
||||
<el-table-column :label="$t('Create Time')" min-width="50"> |
||||
<template slot-scope="scope"> |
||||
<span>{{scope.row.createTime | formatDate}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column :label="$t('Update Time')" min-width="50"> |
||||
<template slot-scope="scope"> |
||||
<span>{{scope.row.updateTime | formatDate}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="status" :label="$t('Task group status')" min-width="50"> |
||||
<template slot-scope="scope"> |
||||
<el-tooltip :content="scope.row.status? $t('Task group enable status'):$t('Task group disable status')" placement="top"> |
||||
<el-switch |
||||
v-model="scope.row.status" |
||||
active-color="#13ce66" |
||||
inactive-color="#ff4949" |
||||
@change="_switchTaskGroupStatus(scope.row)"/> |
||||
</el-tooltip> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column :label="$t('Operation')" width="100"> |
||||
<template slot-scope="scope"> |
||||
<el-tooltip :content="$t('Edit')" placement="top"> |
||||
<el-button type="primary" size="mini" icon="el-icon-edit-outline" @click="_edit(scope.row)" circle></el-button> |
||||
</el-tooltip> |
||||
<el-tooltip :content="$t('View task group queue')" placement="top"> |
||||
<el-button type="success" size="mini" icon="el-icon-tickets" @click="_switchTaskGroupQueue(scope.row)" circle></el-button> |
||||
</el-tooltip> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import { mapActions } from 'vuex' |
||||
|
||||
export default { |
||||
name: 'task-group-list', |
||||
data () { |
||||
return { |
||||
list: [], |
||||
switchValue: true |
||||
} |
||||
}, |
||||
props: { |
||||
taskGroupList: Array, |
||||
pageNo: Number, |
||||
pageSize: Number |
||||
}, |
||||
methods: { |
||||
...mapActions('resource', ['closeTaskGroup', 'startTaskGroup']), |
||||
_switchTaskGroupStatus (item, i) { |
||||
if (item.status) { |
||||
this.startTaskGroup({ |
||||
id: item.id |
||||
}).then(res => { |
||||
let newList = [] |
||||
this.list.forEach(item => { |
||||
if (item.id !== i) { |
||||
newList.push(item) |
||||
} |
||||
}) |
||||
this.list = newList |
||||
this.$message.success(res.msg) |
||||
}).catch(e => { |
||||
this.$message.error(e.msg || '') |
||||
}) |
||||
} else { |
||||
this.closeTaskGroup({ |
||||
id: item.id |
||||
}).then(res => { |
||||
let newList = [] |
||||
this.list.forEach(item => { |
||||
if (item.id !== i) { |
||||
newList.push(item) |
||||
} |
||||
}) |
||||
this.list = newList |
||||
this.$message.success(res.msg) |
||||
}).catch(e => { |
||||
this.$message.error(e.msg || '') |
||||
}) |
||||
} |
||||
}, |
||||
_switchTaskGroupQueue (item) { |
||||
this.$router.push({ path: `/resource/task-group-queue?id=${item.id}` }) |
||||
}, |
||||
_edit (item) { |
||||
this.$emit('on-edit', item) |
||||
} |
||||
}, |
||||
watch: { |
||||
taskGroupList (a) { |
||||
this.list = [] |
||||
setTimeout(() => { |
||||
this.list = a |
||||
}) |
||||
} |
||||
}, |
||||
created () { |
||||
this.list = this.taskGroupList |
||||
}, |
||||
mounted () { |
||||
}, |
||||
components: { } |
||||
} |
||||
</script> |
@ -0,0 +1,176 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
<template> |
||||
<m-list-construction :title="$t('Task group option')"> |
||||
<template slot="conditions"> |
||||
<m-conditions @on-conditions="_onConditions"> |
||||
<template slot="button-group" v-if="isADMIN"> |
||||
<el-button size="mini" @click="_create()">{{$t('Create task group')}}</el-button> |
||||
<el-dialog |
||||
:title="item && item.name ? $t('Edit task group') : $t('Create task group')" |
||||
:v-if="createTaskGroupDialog" |
||||
:visible.sync="createTaskGroupDialog" |
||||
width="auto"> |
||||
<m-create-task-group :item="item" @onUpdate="onUpdate" @close="close"></m-create-task-group> |
||||
</el-dialog> |
||||
</template> |
||||
</m-conditions> |
||||
</template> |
||||
|
||||
<template slot="content"> |
||||
<template v-if="taskGroupList.length || total>0"> |
||||
<m-list @on-edit="_onEdit" |
||||
:task-group-list="taskGroupList" |
||||
:page-no="searchParams.pageNo" |
||||
:page-size="searchParams.pageSize"> |
||||
|
||||
</m-list> |
||||
<div class="page-box"> |
||||
<el-pagination |
||||
background |
||||
@current-change="_page" |
||||
@size-change="_pageSize" |
||||
:page-size="searchParams.pageSize" |
||||
:current-page.sync="searchParams.pageNo" |
||||
:page-sizes="[10, 30, 50]" |
||||
layout="sizes, prev, pager, next, jumper" |
||||
:total="total"> |
||||
</el-pagination> |
||||
</div> |
||||
</template> |
||||
<template v-if="!taskGroupList.length && total<=0"> |
||||
<m-no-data></m-no-data> |
||||
</template> |
||||
<m-spin :is-spin="isLoading" :is-left="isLeft"></m-spin> |
||||
</template> |
||||
</m-list-construction> |
||||
</template> |
||||
<script> |
||||
import _ from 'lodash' |
||||
import { mapActions } from 'vuex' |
||||
import mList from './_source/list' |
||||
import store from '@/conf/home/store' |
||||
import mSpin from '@/module/components/spin/spin' |
||||
import mCreateTaskGroup from './_source/createTaskGroup' |
||||
import mNoData from '@/module/components/noData/noData' |
||||
import listUrlParamHandle from '@/module/mixin/listUrlParamHandle' |
||||
import mConditions from '@/module/components/conditions/conditions' |
||||
import mListConstruction from '@/module/components/listConstruction/listConstruction' |
||||
|
||||
export default { |
||||
name: 'task-group-index', |
||||
data () { |
||||
return { |
||||
total: null, |
||||
isLoading: true, |
||||
modalType: 'create', |
||||
taskGroupList: [], |
||||
projectList: [], |
||||
environmentWorkerGroupRelationList: [], |
||||
searchParams: { |
||||
pageSize: 10, |
||||
pageNo: 1, |
||||
searchVal: '' |
||||
}, |
||||
isLeft: true, |
||||
isADMIN: store.state.user.userInfo.userType === 'ADMIN_USER', |
||||
item: {}, |
||||
createTaskGroupDialog: false |
||||
} |
||||
}, |
||||
mixins: [listUrlParamHandle], |
||||
props: {}, |
||||
methods: { |
||||
...mapActions('projects', ['getProjectsList']), |
||||
...mapActions('resource', ['getTaskGroupListPaging']), |
||||
/** |
||||
* Query |
||||
*/ |
||||
_onConditions (o) { |
||||
this.searchParams = _.assign(this.searchParams, o) |
||||
this.searchParams.pageNo = 1 |
||||
this.searchParams.name = this.searchParams.searchVal |
||||
this._getList(false) |
||||
}, |
||||
_page (val) { |
||||
this.searchParams.pageNo = val |
||||
}, |
||||
_pageSize (val) { |
||||
this.searchParams.pageSize = val |
||||
}, |
||||
_onEdit (item) { |
||||
this.item = item |
||||
this.item.modalType = 'edit' |
||||
this.createTaskGroupDialog = true |
||||
}, |
||||
_create () { |
||||
this.item = { projectOptions: this.projectList, modalType: 'create' } |
||||
this.createTaskGroupDialog = true |
||||
}, |
||||
onUpdate () { |
||||
this._debounceGET('false') |
||||
this.createTaskGroupDialog = false |
||||
}, |
||||
close () { |
||||
this.createTaskGroupDialog = false |
||||
}, |
||||
_getList (flag) { |
||||
const projectSearchParams = { |
||||
pageNo: 1, |
||||
pageSize: 2147483647 |
||||
} |
||||
if (sessionStorage.getItem('isLeft') === 0) { |
||||
this.isLeft = false |
||||
} else { |
||||
this.isLeft = true |
||||
} |
||||
this.isLoading = !flag |
||||
Promise.all([this.getTaskGroupListPaging(this.searchParams), this.getProjectsList(projectSearchParams)]).then((values) => { |
||||
if (this.searchParams.pageNo > 1 && values[0].totalList.length === 0) { |
||||
this.searchParams.pageNo = this.searchParams.pageNo - 1 |
||||
} else { |
||||
this.taskGroupList = [] |
||||
this.taskGroupList = values[0].totalList |
||||
this.total = values[0].total |
||||
this.isLoading = false |
||||
} |
||||
if (values[1] && values[1].totalList) { |
||||
this.projectList = values[1].totalList |
||||
} |
||||
this.taskGroupList.forEach(item => { |
||||
item.status = item.status === 1 |
||||
item.projectOptions = this.projectList |
||||
item.projectName = _.find(this.projectList, { code: item.projectCode }).name |
||||
}) |
||||
}).catch(e => { |
||||
this.isLoading = false |
||||
}) |
||||
} |
||||
}, |
||||
watch: { |
||||
// router |
||||
'$route' (a) { |
||||
// url no params get instance list |
||||
this.searchParams.pageNo = _.isEmpty(a.query) ? 1 : a.query.pageNo |
||||
} |
||||
}, |
||||
beforeDestroy () { |
||||
sessionStorage.setItem('isLeft', 1) |
||||
}, |
||||
components: { mList, mListConstruction, mConditions, mSpin, mNoData, mCreateTaskGroup } |
||||
} |
||||
</script> |
@ -0,0 +1,154 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
<template> |
||||
<div class="list-model"> |
||||
<div class="table-box"> |
||||
<el-table :data="list" size="mini" style="width: 100%"> |
||||
<el-table-column type="index" :label="$t('#')" width="50"></el-table-column> |
||||
<el-table-column prop="projectName" :label="$t('Project Name')" width="120"></el-table-column> |
||||
<el-table-column prop="taskName" :label="$t('Task Name')" width="120"></el-table-column> |
||||
<el-table-column prop="processInstanceName" :label="$t('Process Instance')" min-width="120"></el-table-column> |
||||
<el-table-column prop="taskGroupName" :label="$t('Task group name')" width="120"></el-table-column> |
||||
<el-table-column prop="priority" :label="$t('Task group queue priority')" min-width="70"></el-table-column> |
||||
<el-table-column prop="forceStart" :label="$t('Task group queue force starting status')" min-width="100"></el-table-column> |
||||
<el-table-column prop="inQueue" :label="$t('Task group in queue')" min-width="100"></el-table-column> |
||||
<el-table-column prop="status" :label="$t('Task group queue status')" min-width="70"></el-table-column> |
||||
<el-table-column :label="$t('Create Time')" min-width="50"> |
||||
<template slot-scope="scope"> |
||||
<span>{{scope.row.createTime | formatDate}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column :label="$t('Update Time')" min-width="50"> |
||||
<template slot-scope="scope"> |
||||
<span>{{scope.row.updateTime | formatDate}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column :label="$t('Operation')" width="100"> |
||||
<template slot-scope="scope"> |
||||
<el-tooltip :content="$t('Modify task group queue priority')" placement="top"> |
||||
<el-button type="primary" size="mini" icon="el-icon-edit-outline" @click="_edit(scope.row)" circle></el-button> |
||||
</el-tooltip> |
||||
<el-tooltip :content="$t('Force to start task')" placement="top"> |
||||
<el-button type="primary" size="mini" icon="el-icon-video-play" @click="_forceStart(scope.row)" circle></el-button> |
||||
</el-tooltip> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<el-dialog |
||||
v-if="dialogVisible" |
||||
:title="$t('Modify task group queue priority')" |
||||
:visible.sync="dialogVisible" |
||||
width="25%" |
||||
center |
||||
modal> |
||||
<el-form :model="priorityForm" ref="priorityForm"> |
||||
<el-form-item prop="priority" :label="$t('Task group queue priority')" :rules="[{ required: true, message: notEmptyMessage }, { type: 'number', message: mustBeNumberMessage}]"> |
||||
<el-input |
||||
type="input" |
||||
v-model.number="priorityForm.priority" |
||||
maxlength="60" |
||||
autocomplete="off" |
||||
size="mini"> |
||||
</el-input> |
||||
</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button @click="dialogVisible = false">{{ $t('Cancel') }}</el-button> |
||||
<el-button type="primary" @click="_editPriority()">{{ $t('Confirm') }}</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import { mapActions } from 'vuex' |
||||
import _ from 'lodash' |
||||
import i18n from '@/module/i18n' |
||||
|
||||
export default { |
||||
name: 'task-group-list', |
||||
data () { |
||||
return { |
||||
list: [], |
||||
switchValue: true, |
||||
dialogVisible: false, |
||||
notEmptyMessage: $t('Priority not empty'), |
||||
mustBeNumberMessage: $t('Priority must be number'), |
||||
priorityForm: { |
||||
priority: 0, |
||||
queueId: 0 |
||||
} |
||||
} |
||||
}, |
||||
props: { |
||||
taskGroupQueue: Array, |
||||
pageNo: Number, |
||||
pageSize: Number |
||||
}, |
||||
methods: { |
||||
...mapActions('resource', ['modifyPriority', 'forceStartTaskInQueue']), |
||||
...mapActions('resource', ['getTaskListInTaskGroupQueueById']), |
||||
_edit (item) { |
||||
this.priorityForm.priority = item.priority |
||||
this.priorityForm.queueId = item.id |
||||
this.dialogVisible = true |
||||
this.$emit('on-edit', item) |
||||
}, |
||||
_editPriority () { |
||||
if (this.priorityForm.priority >= 0 || _.parseInt(this.priorityForm.priority) >= 0) { |
||||
const params = { |
||||
queueId: this.priorityForm.queueId, |
||||
priority: this.priorityForm.priority |
||||
} |
||||
this.modifyPriority(params).then(res => { |
||||
this.$emit('on-edit-priority') |
||||
this.$message.success(res.msg) |
||||
}).catch(e => { |
||||
this.$message.error(e.msg || '') |
||||
}) |
||||
} else { |
||||
this.$message.warning(`${i18n.$t('Task group queue priority be a number')}`) |
||||
} |
||||
}, |
||||
_forceStart (item) { |
||||
const params = { |
||||
queueId: item.id |
||||
} |
||||
this.forceStartTaskInQueue(params).then(res => { |
||||
this.$emit('on-force-start', item) |
||||
this.$message.success(res.msg) |
||||
}).catch(e => { |
||||
this.$message.error(e.msg || '') |
||||
}) |
||||
} |
||||
}, |
||||
watch: { |
||||
taskGroupList (a) { |
||||
this.list = [] |
||||
setTimeout(() => { |
||||
this.list = a |
||||
}) |
||||
} |
||||
}, |
||||
created () { |
||||
this.list = this.taskGroupQueue |
||||
}, |
||||
mounted () { |
||||
}, |
||||
components: { } |
||||
} |
||||
</script> |
@ -0,0 +1,211 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
<template> |
||||
<m-list-construction :title="$t('Task group queue')"> |
||||
<template slot="conditions"> |
||||
<m-conditions @on-conditions="_onConditions"> |
||||
<template slot="search-group"> |
||||
<div class="list"> |
||||
<el-button size="mini" @click="_ckQuery" icon="el-icon-search"></el-button> |
||||
</div> |
||||
<div class="list"> |
||||
<el-input v-model="instanceName" style="width: 140px;" size="mini" :placeholder="$t('Process Instance')" clearable></el-input> |
||||
</div> |
||||
<div class="list"> |
||||
<el-input v-model="processName" style="width: 160px;" size="mini" :placeholder="$t('Process Name')" clearable></el-input> |
||||
</div> |
||||
<div class="list"> |
||||
<el-select style="width: 140px;" v-model="groupId" :placeholder="$t('Task group name')" size="mini" clearable> |
||||
<el-option |
||||
v-for="taskGroup in taskGroupList" |
||||
:key="taskGroup.id" |
||||
:value="taskGroup.id" |
||||
:label="taskGroup.name"> |
||||
</el-option> |
||||
</el-select> |
||||
</div> |
||||
</template> |
||||
</m-conditions> |
||||
</template> |
||||
<template slot="content"> |
||||
<template v-if="taskGroupQueue.length || total>0"> |
||||
<m-list @on-edit="_onEdit" |
||||
@on-force-start="_onForceStart" |
||||
@on-edit-priority="_onEditPriority" |
||||
:task-group-queue="taskGroupQueue" |
||||
:page-no="searchParams.pageNo" |
||||
:page-size="searchParams.pageSize"> |
||||
|
||||
</m-list> |
||||
<div class="page-box"> |
||||
<el-pagination |
||||
background |
||||
@current-change="_page" |
||||
@size-change="_pageSize" |
||||
:page-size="searchParams.pageSize" |
||||
:current-page.sync="searchParams.pageNo" |
||||
:page-sizes="[10, 30, 50]" |
||||
layout="sizes, prev, pager, next, jumper" |
||||
:total="total"> |
||||
</el-pagination> |
||||
</div> |
||||
</template> |
||||
<template v-if="!taskGroupList.length && total<=0"> |
||||
<m-no-data></m-no-data> |
||||
</template> |
||||
<m-spin :is-spin="isLoading" :is-left="isLeft"></m-spin> |
||||
</template> |
||||
</m-list-construction> |
||||
</template> |
||||
<script> |
||||
import _ from 'lodash' |
||||
import { mapActions } from 'vuex' |
||||
import mList from './_source/list' |
||||
import store from '@/conf/home/store' |
||||
import mSpin from '@/module/components/spin/spin' |
||||
import mNoData from '@/module/components/noData/noData' |
||||
import listUrlParamHandle from '@/module/mixin/listUrlParamHandle' |
||||
import mConditions from '@/module/components/conditions/conditions' |
||||
import mListConstruction from '@/module/components/listConstruction/listConstruction' |
||||
|
||||
export default { |
||||
name: 'task-group-queue-index', |
||||
data () { |
||||
return { |
||||
total: null, |
||||
isLoading: true, |
||||
modalType: 'create', |
||||
taskGroupList: [], |
||||
taskGroupQueue: [], |
||||
groupId: '', |
||||
instanceName: '', |
||||
processName: '', |
||||
searchParams: { |
||||
pageSize: 10, |
||||
pageNo: 1 |
||||
}, |
||||
isLeft: true, |
||||
isADMIN: store.state.user.userInfo.userType === 'ADMIN_USER', |
||||
item: {}, |
||||
createTaskGroupDialog: false |
||||
} |
||||
}, |
||||
mixins: [listUrlParamHandle], |
||||
props: {}, |
||||
methods: { |
||||
...mapActions('resource', ['getTaskListInTaskGroupQueueById']), |
||||
...mapActions('resource', ['getTaskGroupListPaging']), |
||||
/** |
||||
* Query |
||||
*/ |
||||
_onConditions (o) { |
||||
this.searchParams = _.assign(this.searchParams, o) |
||||
this.searchParams.pageNo = 1 |
||||
}, |
||||
_ckQuery () { |
||||
console.log(this.groupId) |
||||
this.searchParams.groupId = this.groupId |
||||
this.searchParams.instanceName = this.instanceName |
||||
this.searchParams.processName = this.processName |
||||
this._getList(false) |
||||
}, |
||||
_page (val) { |
||||
this.searchParams.pageNo = val |
||||
}, |
||||
_pageSize (val) { |
||||
this.searchParams.pageSize = val |
||||
}, |
||||
_onEdit (item) { |
||||
this.item = item |
||||
this.item.modalType = 'edit' |
||||
this.createTaskGroupDialog = true |
||||
}, |
||||
_onForceStart (item) { |
||||
this._getList(false) |
||||
}, |
||||
_onEditPriority () { |
||||
this._getList(false) |
||||
}, |
||||
_create () { |
||||
this.item = { projectOptions: this.projectList, modalType: 'create' } |
||||
this.createTaskGroupDialog = true |
||||
}, |
||||
onUpdate () { |
||||
this._debounceGET('false') |
||||
this.createTaskGroupDialog = false |
||||
}, |
||||
close () { |
||||
this.createTaskGroupDialog = false |
||||
}, |
||||
_getList (flag) { |
||||
const taskGroupSearchParams = { |
||||
pageNo: 1, |
||||
pageSize: 2147483647 |
||||
} |
||||
if (sessionStorage.getItem('isLeft') === 0) { |
||||
this.isLeft = false |
||||
} else { |
||||
this.isLeft = true |
||||
} |
||||
this.isLoading = !flag |
||||
this.getTaskGroupListPaging(taskGroupSearchParams).then((values) => { |
||||
this.taskGroupList = [] |
||||
this.taskGroupList = values.totalList |
||||
if (this.taskGroupList) { |
||||
if (this.searchParams.id) { |
||||
this.groupId = _.parseInt(this.searchParams.id) |
||||
this.searchParams.groupId = _.parseInt(this.searchParams.id) |
||||
} |
||||
this.getTaskListInTaskGroupQueueById(this.searchParams).then((res) => { |
||||
if (this.searchParams.pageNo > 1 && values.totalList.length === 0) { |
||||
this.searchParams.pageNo = this.searchParams.pageNo - 1 |
||||
} else { |
||||
this.taskGroupQueue = [] |
||||
if (res.data.totalList) { |
||||
this.taskGroupQueue = res.data.totalList |
||||
} |
||||
this.taskGroupQueue.forEach(item => { |
||||
const taskGroup = _.find(this.taskGroupList, { id: item.groupId }) |
||||
if (taskGroup) { |
||||
item.taskGroupName = taskGroup.name |
||||
} |
||||
}) |
||||
this.total = res.data.total |
||||
this.isLoading = false |
||||
} |
||||
}).catch(e => { |
||||
this.isLoading = false |
||||
}) |
||||
} |
||||
}).catch(e => { |
||||
this.isLoading = false |
||||
}) |
||||
} |
||||
}, |
||||
watch: { |
||||
// router |
||||
'$route' (a) { |
||||
// url no params get instance list |
||||
this.searchParams.pageNo = _.isEmpty(a.query) ? 1 : a.query.pageNo |
||||
} |
||||
}, |
||||
beforeDestroy () { |
||||
sessionStorage.setItem('isLeft', 1) |
||||
}, |
||||
components: { mList, mListConstruction, mConditions, mSpin, mNoData } |
||||
} |
||||
</script> |
Loading…
Reference in new issue