fix:工作流配置四页(字段/工作流/流转/状态)新增弹框未重置表单,先编辑再新增会残留上一条内容;默认值提为defaultForm常量供data与新增共用

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
caoqianming 2026-07-23 14:17:16 +08:00
parent 23313d5ced
commit 37b5e3f468
4 changed files with 51 additions and 38 deletions

View File

@ -117,6 +117,18 @@
</template> </template>
<script> <script>
const defaultForm = {
field_key: '',
field_name: '',
placeholder: '',
field_type: '',
sort: '',
label: 'name',
default_value: '',
field_template: '',
field_choice: [],
is_hidden: false,
};
export default { export default {
name: "field", name: "field",
data() { data() {
@ -130,18 +142,7 @@
show: '查看' show: '查看'
}, },
// //
addForm: { addForm: Object.assign({}, defaultForm, {field_choice: []}),
field_key: '',
field_name: '',
placeholder: '',
field_type: '',
sort: '',
label: 'name',
default_value: '',
field_template: '',
field_choice: [],
is_hidden: false,
},
// //
rules: { rules: {
name: [ name: [
@ -205,6 +206,8 @@
}, },
handleAdd() { handleAdd() {
this.type = 'add'; this.type = 'add';
this.addForm = Object.assign({}, defaultForm, {field_choice: []});
this.choiceOption = [{id: null, name: ""}];
this.dialogVisible = true; this.dialogVisible = true;
}, },
submitHandle() { submitHandle() {

View File

@ -391,6 +391,15 @@
</template> </template>
<script> <script>
const defaultForm = {
name: "",
is_hidden: false,
sort: "",
type: "",
enable_retreat: false,
participant_type: 0,
distribute_type: 2, //
};
export default { export default {
name: "state", name: "state",
data() { data() {
@ -412,17 +421,10 @@ export default {
stateChange: [], stateChange: [],
fieldList: [], fieldList: [],
// //
addForm: { addForm: Object.assign({}, defaultForm, {
name: "",
is_hidden: false,
sort: "",
type: "",
participant_cc: [], participant_cc: [],
enable_retreat: false,
participant_type: 0,
distribute_type: 2, //
state_fields: {}, // state_fields: {}, //
}, }),
// //
rules: { rules: {
name: [{ required: true, message: "请输入工作流名称" }], name: [{ required: true, message: "请输入工作流名称" }],
@ -568,6 +570,11 @@ export default {
handleAdd() { handleAdd() {
this.getField(); this.getField();
this.type = "add"; this.type = "add";
this.addForm = Object.assign({}, defaultForm, {
participant_cc: [],
state_fields: {},
});
this.stateChange = [];
this.dialogVisible = true; this.dialogVisible = true;
// if(this.dialogInitNum === 0){ // if(this.dialogInitNum === 0){
// this.getUsers(); // this.getUsers();

View File

@ -142,6 +142,13 @@
<script> <script>
// import vueJsonEditor from 'vue-json-editor' // import vueJsonEditor from 'vue-json-editor'
import JsonEditorVue from 'json-editor-vue3' import JsonEditorVue from 'json-editor-vue3'
const defaultForm = {
name: '',
timer: 0,
source_state: '',
destination_state: '',
field_require_check: false,
};
export default { export default {
name: "transform", name: "transform",
components: { JsonEditorVue }, components: { JsonEditorVue },
@ -165,14 +172,7 @@
value: 3, value: 3,
label: '其他' label: '其他'
}], }],
addForm: { addForm: Object.assign({}, defaultForm, {condition_expression: {}}),
name: '',
timer: 0,
source_state: '',
destination_state: '',
condition_expression: {},
field_require_check: false,
},
stateList: [], stateList: [],
dialogVisible: false, dialogVisible: false,
} }
@ -200,6 +200,7 @@
handleAdd() { handleAdd() {
this.getStateList(); this.getStateList();
this.type = 'add'; this.type = 'add';
this.addForm = Object.assign({}, defaultForm, {condition_expression: {}});
this.dialogVisible = true; this.dialogVisible = true;
}, },
handleEdit(row) { handleEdit(row) {

View File

@ -207,6 +207,15 @@
<script> <script>
import degraDialog from "./degraD3_2.vue"; import degraDialog from "./degraD3_2.vue";
const defaultForm = {
name: "",
sn_prefix: "",
description: "",
view_permission_check: true,
display_form_str: [],
title_template: "",
content_template: "",
};
export default { export default {
name: "index", name: "index",
components: { components: {
@ -233,15 +242,7 @@ export default {
}, },
wfCateOptions: [], wfCateOptions: [],
// //
addForm: { addForm: Object.assign({}, defaultForm, { display_form_str: [] }),
name: "",
sn_prefix: "",
description: "",
view_permission_check: true,
display_form_str: [],
title_template: "",
content_template: "",
},
// //
rules: { rules: {
name: [{ required: true, message: "请输入工作流名称" }], name: [{ required: true, message: "请输入工作流名称" }],
@ -264,6 +265,7 @@ export default {
// //
handleAdd() { handleAdd() {
this.type = "add"; this.type = "add";
this.addForm = Object.assign({}, defaultForm, { display_form_str: [] });
this.limitedVisible = true; this.limitedVisible = true;
}, },