!21 #Close fix 修复流程定义界面内查看流程图时因缓存问题而不更新数据、流程定义界面内的导入操作以及上传地址错误,并添加数据验证

* 修复流程定义界面内查看流程图时因缓存问题而不更新数据、流程定义界面内的导入操作以及上传地址错误,并添加数据验证
This commit is contained in:
Siri
2022-05-18 14:44:50 +00:00
committed by KonBAI
parent 4257e4460e
commit a49e1b0187
2 changed files with 54 additions and 25 deletions

View File

@@ -90,6 +90,20 @@ export default {
hoverTimer: null hoverTimer: null
} }
}, },
watch: {
xml: {
handler(newXml) {
this.importXML(newXml);
},
immediate: true
},
finishedInfo: {
handler(newInfo) {
this.setProcessStatus(newInfo);
},
immediate: true
}
},
created() { created() {
this.$nextTick(() => { this.$nextTick(() => {
this.importXML(this.xml) this.importXML(this.xml)
@@ -188,7 +202,6 @@ export default {
await this.bpmnViewer.importXML(xml); await this.bpmnViewer.importXML(xml);
this.addCustomDefs(); this.addCustomDefs();
} catch (e) { } catch (e) {
console.error(e);
this.clearViewer(); this.clearViewer();
} finally { } finally {
this.isLoading = false; this.isLoading = false;
@@ -237,21 +250,7 @@ export default {
}, },
destroyed() { destroyed() {
this.clearViewer(); this.clearViewer();
}, }
// watch: {
// xml: {
// handler(newXml) {
// this.importXML(newXml);
// },
// immediate: true
// },
// finishedInfo: {
// handler(newInfo) {
// this.setProcessStatus(newInfo);
// },
// immediate: true
// }
// }
} }
</script> </script>

View File

@@ -151,7 +151,7 @@
/> />
<!-- bpmn20.xml导入对话框 --> <!-- bpmn20.xml导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body> <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body @close="cancel('uploadForm')">
<el-upload <el-upload
ref="upload" ref="upload"
:limit="1" :limit="1"
@@ -170,14 +170,23 @@
<em>点击上传</em> <em>点击上传</em>
</div> </div>
<div class="el-upload__tip" slot="tip"> <div class="el-upload__tip" slot="tip">
流程名称<el-input v-model="upload.name"/> <el-form ref="uploadForm" :model="upload" size="mini" :rules="rules" label-width="80px">
流程分类<el-input v-model="upload.category"/> <el-form-item label="流程名称" prop="name">
<el-input v-model="upload.name" clearable/>
</el-form-item>
<el-form-item label="流程分类" prop="category">
<el-select v-model="upload.category" placeholder="请选择" clearable style="width:100%">
<el-option v-for="item in categoryOptions" :key="item.categoryId" :label="item.categoryName"
:value="item.code"/>
</el-select>
</el-form-item>
</el-form>
</div> </div>
<div class="el-upload__tip" style="color:red" slot="tip">提示仅允许导入bpmn20.xml格式文件</div> <div class="el-upload__tip" style="color:red" slot="tip">提示仅允许导入bpmn20.xml格式文件</div>
</el-upload> </el-upload>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button> <el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button> <el-button @click="cancel('uploadForm')"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
@@ -368,7 +377,7 @@ export default {
// 设置上传的请求头部 // 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() }, headers: { Authorization: "Bearer " + getToken() },
// 上传的地址 // 上传的地址
url: process.env.VUE_APP_BASE_API + "/flowable/definition/import" url: process.env.VUE_APP_BASE_API + "/workflow/definition/import"
}, },
// 查询参数 // 查询参数
queryParams: { queryParams: {
@@ -398,6 +407,14 @@ export default {
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {
name: [
{ required: true, message: "流程定义名称不能为空", trigger: "blur" }
],
category: [{
required: true,
message: '请选择任意一项',
trigger: 'change'
}],
} }
}; };
}, },
@@ -427,6 +444,14 @@ export default {
this.publish.loading = false; this.publish.loading = false;
}) })
}, },
// 点击取消时关闭dialog并且清空form表格的数据
cancel (form) {
// 重置form表单
this.$refs[form].resetFields()
this.$refs['upload'].clearFiles()
// 关闭dialog
this.upload.open = false
},
// 表单重置 // 表单重置
reset() { reset() {
this.form = { this.form = {
@@ -486,8 +511,8 @@ export default {
// 发送请求获取xml // 发送请求获取xml
readXml(definitionId).then(res => { readXml(definitionId).then(res => {
this.processView.xmlData = res.data; this.processView.xmlData = res.data;
this.processView.open = true;
}) })
this.processView.open = true;
}, },
/** 挂载表单弹框 */ /** 挂载表单弹框 */
handleAddForm(row){ handleAddForm(row){
@@ -567,6 +592,7 @@ export default {
}).then(function() { }).then(function() {
return delDeployment(params); return delDeployment(params);
}).then(() => { }).then(() => {
this.getList();
this.getPublishList(); this.getPublishList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}) })
@@ -598,12 +624,16 @@ export default {
this.upload.open = false; this.upload.open = false;
this.upload.isUploading = false; this.upload.isUploading = false;
this.$refs.upload.clearFiles(); this.$refs.upload.clearFiles();
this.$message(response.msg); this.$message.success(response.msg);
this.getList(); this.getList();
}, },
// 提交上传文件 // 提交上传文件
submitFileForm() { submitFileForm() {
this.$refs.uploadForm.validate(valid => {
if (valid) {
this.$refs.upload.submit(); this.$refs.upload.submit();
}
});
}, },
categoryFormat(row, column) { categoryFormat(row, column) {
return this.categoryOptions.find(k => k.code === row.category)?.categoryName ?? ''; return this.categoryOptions.find(k => k.code === row.category)?.categoryName ?? '';