diff --git a/app/view/component/tpl/formItemListGenerator.html b/app/view/component/tpl/formItemListGenerator.html
index 575d3d7..95f9e45 100644
--- a/app/view/component/tpl/formItemListGenerator.html
+++ b/app/view/component/tpl/formItemListGenerator.html
@@ -64,7 +64,7 @@
mdi-content-copy复制
+ @click.stop="doUiAction('formItemDelete', formItem)">
mdi-delete-outline删除
@@ -166,6 +166,11 @@ Vue.component("form-item-list-generator", {
default: [],
required: true,
},
+ workflow: {
+ type: Object,
+ default: {},
+ required: true,
+ },
},
data: () => ({
componentList: [
@@ -199,6 +204,17 @@ Vue.component("form-item-list-generator", {
async created() {
},
methods: {
+ async doUiAction(uiActionId, uiActionData) {
+ switch (uiActionId) {
+ case 'formItemDelete':
+ await this.confirmFormItemDeleteDialog(uiActionData);
+ await this.formItemDelete(uiActionData);
+ break;
+ default:
+ console.error("[doUiAction] uiActionId not find", {uiActionId});
+ break;
+ }
+ },
cloneComponent(component) {
this.tempComponent = component;
},
@@ -235,7 +251,22 @@ Vue.component("form-item-list-generator", {
emptyCanva() {
this.formItemList.splice(0, this.formItemList.length);
},
- formItemDelete(id) {
+ async confirmFormItemDeleteDialog({id}) {
+ const { nodeList } = this.workflow
+ var hasItem = false
+
+ hasItem = nodeList.some(node => {
+ const conditionList = node.properties.conditionList;
+ return _.some(conditionList, c => c.id === id); // 使用lodash的some方法
+ });
+
+ if(hasItem){
+ await window.vtoast.fail('流程设置存在条件节点使用该题目!')
+ throw new Error("[confirmFormItemDeleteDialog] 流程设置存在条件节点使用该题目!");
+ }
+
+ },
+ formItemDelete({id}) {
const index = this.formItemList.findIndex((item) => item.id === id);
if (index > -1) {
this.formItemList.splice(index, 1);
diff --git a/app/view/component/tpl/tplFormDesign.html b/app/view/component/tpl/tplFormDesign.html
index fa5c697..629189c 100644
--- a/app/view/component/tpl/tplFormDesign.html
+++ b/app/view/component/tpl/tplFormDesign.html
@@ -3,6 +3,7 @@
@@ -18,6 +19,12 @@
default: () => {
return []
}
+ },
+ workflow: {
+ type: Object,
+ default: () => {
+ return {}
+ }
}
},
data: () => ({