Skip to content

Commit

Permalink
bugfix: 公共流程模版列表和普通流程模版列表数据源做区分 #115 (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
luofann authored and pagezz-canway committed Apr 14, 2019
1 parent 7bb955c commit 06c7b73
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
3 changes: 0 additions & 3 deletions pipeline/blueflow/src/pages/home/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ export default {
...mapActions('taskList/', [
'loadTaskList'
]),
...mapMutations('templateList/', [
'setTemplateListData'
]),
async getData () {
this.loading = true
Promise.all([
Expand Down
15 changes: 10 additions & 5 deletions pipeline/blueflow/src/pages/template/TemplateList/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
</tr>
</thead>
<tbody>
<tr v-for="item in templateList" :key="item.id">
<tr v-for="item in listData" :key="item.id">
<td class="template-id">{{item.id}}</td>
<td class="template-name">
<router-link
Expand Down Expand Up @@ -195,7 +195,7 @@
</bk-dropdown-menu>
</td>
</tr>
<tr v-if="!templateList || !templateList.length" class="empty-tr">
<tr v-if="!listData || !listData.length" class="empty-tr">
<td colspan="7">
<div class="empty-data"><NoData :message="i18n.empty" /></div>
</td>
Expand Down Expand Up @@ -372,10 +372,14 @@ export default {
...mapState({
'site_url': state => state.site_url,
'templateList': state => state.templateList.templateListData,
'commonTemplateData': state => state.templateList.commonTemplateData,
'businessBaseInfo': state => state.template.businessBaseInfo,
'v1_import_flag': state => state.v1_import_flag,
'businessTimezone': state => state.businessTimezone
})
}),
listData () {
return this.common === 1 ? this.commonTemplateData : this.templateList
}
},
created () {
this.getTemplateList()
Expand Down Expand Up @@ -404,6 +408,7 @@ export default {
this.editStartTime = undefined
}
this.listLoading = true
const isCommon = this.common === 1
try {
const data = {
limit: this.countPerPage,
Expand All @@ -415,7 +420,7 @@ export default {
subprocess_has_update: this.isSubprocessUpdated,
has_subprocess: this.isHasSubprocess
}
if (this.templateType === 'common') {
if (isCommon) {
// 公共流程
data['common'] = 1
this.isNewTaskCommonTemplate = true
Expand All @@ -435,7 +440,7 @@ export default {
}
const templateListData = await this.loadTemplateList(data)
const list = templateListData.objects
this.setTemplateListData(list)
this.setTemplateListData({list, isCommon})
this.totalCount = templateListData.meta.total_count
const totalPage = Math.ceil( this.totalCount / this.countPerPage)
if (!totalPage) {
Expand Down
12 changes: 9 additions & 3 deletions pipeline/blueflow/src/store/modules/templateList.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ import api from "@/api"
const templateList = {
namespaced: true,
state: {
templateListData: []
templateListData: [],
commonTemplateData: []
},
mutations: {
setTemplateListData (state, data) {
state.templateListData = data
setTemplateListData (state, payload) {
const {list, isCommon} = payload
if (isCommon) {
state.commonTemplateData = list
} else {
state.templateListData = list
}
}
},
actions: {
Expand Down

0 comments on commit 06c7b73

Please sign in to comment.