fix -- 修复工作流模块流程分类为空时,前端报错,导致无法显示条目。

This commit is contained in:
konbai
2022-04-25 22:23:17 +08:00
parent ee8d2d5b58
commit f203421ff7
3 changed files with 25 additions and 26 deletions

View File

@@ -79,11 +79,7 @@
</el-button>
</template>
</el-table-column>
<el-table-column label="流程分类" align="center" prop="categoryName">
<template slot-scope="scope">
<span>{{ categoryOptions.find(k => k.code === scope.row.category).categoryName }}</span>
</template>
</el-table-column>
<el-table-column label="流程分类" align="center" prop="categoryName" :formatter="categoryFormat" />
<el-table-column label="业务表单" align="center" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-button v-if="scope.row.formId" type="text" @click="handleForm(scope.row.formId)">
@@ -425,12 +421,14 @@ export default {
};
},
created() {
listCategory().then(response => {
this.categoryOptions = response.rows
})
this.getCategoryList();
this.getList();
},
methods: {
/** 查询流程分类列表 */
getCategoryList() {
listCategory().then(response => this.categoryOptions = response.rows)
},
/** 查询流程定义列表 */
getList() {
this.loading = true;
@@ -640,6 +638,9 @@ export default {
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
},
categoryFormat(row, column) {
return this.categoryOptions.find(k => k.code === row.category)?.categoryName ?? '';
}
}
};

View File

@@ -36,11 +36,7 @@
</el-button>
</template>
</el-table-column>
<el-table-column label="流程分类" align="center" prop="categoryName">
<template slot-scope="scope">
<span>{{ categoryOptions.find(k => k.code === scope.row.category).categoryName }}</span>
</template>
</el-table-column>
<el-table-column label="流程分类" align="center" prop="categoryName" :formatter="categoryFormat" />
<el-table-column label="流程版本" align="center">
<template slot-scope="scope">
<el-tag size="medium" >v{{ scope.row.version }}</el-tag>
@@ -121,15 +117,13 @@ export default {
}
},
created() {
this.getTreeselect();
this.getCategoryList();
this.getList();
},
methods: {
/** 查询流程分类列表 */
getTreeselect() {
listCategory().then(response => {
this.categoryOptions = response.rows;
})
getCategoryList() {
listCategory().then(response => this.categoryOptions = response.rows)
},
/** 查询流程定义列表 */
getList() {
@@ -168,6 +162,9 @@ export default {
deployId: row.deploymentId,
}
})
},
categoryFormat(row, column) {
return this.categoryOptions.find(k => k.code === row.category)?.categoryName ?? '';
}
}
}

View File

@@ -51,11 +51,7 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="流程编号" align="center" prop="procInsId" :show-overflow-tooltip="true"/>
<el-table-column label="流程名称" align="center" prop="procDefName" :show-overflow-tooltip="true"/>
<el-table-column label="流程类别" align="center" prop="category" width="100px">
<template slot-scope="scope">
<span>{{ categoryOptions.find(k => k.code === scope.row.category).categoryName }}</span>
</template>
</el-table-column>
<el-table-column label="流程类别" align="center" prop="category" :formatter="categoryFormat" />
<el-table-column label="流程版本" align="center" width="80px">
<template slot-scope="scope">
<el-tag size="medium" >v{{ scope.row.procDefVersion }}</el-tag>
@@ -163,12 +159,14 @@ export default {
};
},
created() {
listCategory().then(response => {
this.categoryOptions = response.rows
})
this.getCategoryList();
this.getList();
},
methods: {
/** 查询流程分类列表 */
getCategoryList() {
listCategory().then(response => this.categoryOptions = response.rows)
},
/** 查询流程定义列表 */
getList() {
this.loading = true;
@@ -263,6 +261,9 @@ export default {
}).then(response => {
this.download(response.msg);
})
},
categoryFormat(row, column) {
return this.categoryOptions.find(k => k.code === row.category)?.categoryName ?? '';
}
}
};