diff --git a/frontend/pc/src/utils/use-modal-close-confirmation.js b/frontend/pc/src/utils/use-modal-close-confirmation.js index 38ce219b6..eaa8eb584 100644 --- a/frontend/pc/src/utils/use-modal-close-confirmation.js +++ b/frontend/pc/src/utils/use-modal-close-confirmation.js @@ -1,11 +1,9 @@ -import i18n from '@/i18n/index.js'; - export default function useModalCloseConfirmation(title, subTitle) { return new Promise(resolve => { window.app.$bkInfo({ - title: title || i18n.$t('m["确定离开当前页?"]'), - subTitle: subTitle || i18n.$t('m["离开将会导致未保存信息丢失"]'), - okText: i18n.$t('m["离开"]'), + title: title || '确定离开当前页?', + subTitle: subTitle || '离开将会导致未保存信息丢失', + okText: '离开', confirmFn: () => resolve(true), cancelFn: () => resolve(false), }); diff --git a/frontend/pc/src/views/commonMix/mixins_api.js b/frontend/pc/src/views/commonMix/mixins_api.js index 6ce1e6b26..30d8e492d 100644 --- a/frontend/pc/src/views/commonMix/mixins_api.js +++ b/frontend/pc/src/views/commonMix/mixins_api.js @@ -40,7 +40,7 @@ export default { checkInfo: false, key, type: valueJsonData.type || '', - desc: valueJsonData.description.toString(), + desc: valueJsonData.description || valueJsonData.desc, default: (valueJsonData.default !== undefined && valueJsonData.default.toString()) ? valueJsonData.default : '', is_necessary: !level @@ -109,7 +109,7 @@ export default { const valueList = {}; valueList[item.key] = { type: item.type, - description: item.desc.toString(), + description: item.desc || item.description, required: (item.children && item.children.length) ? item.children.filter(item => item.is_necessary).map(ite => ite.key) : [], }; diff --git a/frontend/pc/src/views/processManagement/publicTrigger/addTrigger.vue b/frontend/pc/src/views/processManagement/publicTrigger/addTrigger.vue index 1659b7346..280b606b0 100644 --- a/frontend/pc/src/views/processManagement/publicTrigger/addTrigger.vue +++ b/frontend/pc/src/views/processManagement/publicTrigger/addTrigger.vue @@ -873,7 +873,12 @@ key: field.key, value: {}, }; - valueInfo.value = this.treeToJson(field.apiContent.bodyTableData.filter(item => (!item.level))); + console.log(response); + if (!['POST', 'PATCH', 'PUT'].includes(field.apiContent.method)) { + valueInfo.value = field.value; + } else { + valueInfo.value = this.treeToJson(field.apiContent.bodyTableData.filter(item => (!item.level))); + } // 使用递归来取值 // const checkInfo = (arr, parentKey) => { // arr.forEach(itemArr => { diff --git a/frontend/pc/src/views/processManagement/publicTrigger/apiContent/getParams.vue b/frontend/pc/src/views/processManagement/publicTrigger/apiContent/getParams.vue new file mode 100644 index 000000000..1291a729a --- /dev/null +++ b/frontend/pc/src/views/processManagement/publicTrigger/apiContent/getParams.vue @@ -0,0 +1,170 @@ + + + + + + + diff --git a/frontend/pc/src/views/processManagement/publicTrigger/apiContent/inputParams.vue b/frontend/pc/src/views/processManagement/publicTrigger/apiContent/postParams.vue similarity index 94% rename from frontend/pc/src/views/processManagement/publicTrigger/apiContent/inputParams.vue rename to frontend/pc/src/views/processManagement/publicTrigger/apiContent/postParams.vue index 58ecbf633..b2764b0d5 100644 --- a/frontend/pc/src/views/processManagement/publicTrigger/apiContent/inputParams.vue +++ b/frontend/pc/src/views/processManagement/publicTrigger/apiContent/postParams.vue @@ -112,7 +112,7 @@ import { deepClone } from '../../../../utils/util'; import { mapState } from 'vuex'; export default { - name: 'inputParams', + name: 'postParams', mixins: [mixins], props: { itemInfo: { @@ -162,9 +162,9 @@ this.variableList = this.triggerVariables; }, methods: { - async initData() { + initData() { this.$set(this.itemInfo.apiContent, 'treeDataList', {}); - this.itemInfo.apiContent.treeDataList = await this.jsonschemaToList({ + this.itemInfo.apiContent.treeDataList = this.jsonschemaToList({ root: JSON.parse(JSON.stringify(this.itemInfo.apiContent.req_body)), }); // 如果数据已经存在,则进行表格初始化赋值 @@ -172,7 +172,7 @@ this.itemInfo.apiContent.treeDataList = this.jsonValueTreeList(this.itemInfo.value, JSON.parse(JSON.stringify(this.itemInfo.apiContent.treeDataList))); } // 生成table表格数据 - this.itemInfo.apiContent.bodyTableData = await this.treeToTableList(JSON.parse(JSON.stringify(this.itemInfo.apiContent.treeDataList[0].children))); + this.itemInfo.apiContent.bodyTableData = this.treeToTableList(JSON.parse(JSON.stringify(this.itemInfo.apiContent.treeDataList[0].children))); const bodyTableData = JSON.parse(JSON.stringify(this.itemInfo.apiContent.bodyTableData)); // 加入/引用变量 bodyTableData.forEach((item) => { @@ -184,7 +184,7 @@ }); // 多层列表数据 关联 table表格数据 this.recordChildren(bodyTableData); - this.itemInfo.apiContent.bodyTableData = await bodyTableData; + this.itemInfo.apiContent.bodyTableData = bodyTableData; }, jsonValueTreeList(jsonData, treeDataList) { const listToJsonStep = function (lastObject, insertObject, key, item, lastType) { @@ -324,7 +324,7 @@ return item.children.length === 1; }, // 计算所有子孙元素 - async countChildren(dataOri) { + countChildren(dataOri) { let count = 0; const countChildrenStep = function (data) { if (data.children && data.children.length) { @@ -334,11 +334,11 @@ } } }; - await countChildrenStep(dataOri); + countChildrenStep(dataOri); return count; }, // 清除变量值 - async cleanValue(item) { + cleanValue(item) { const copyItem = JSON.parse(JSON.stringify(item)); const countChildrenStep = function (data) { data.value = ''; @@ -349,29 +349,29 @@ } } }; - await countChildrenStep(copyItem); + countChildrenStep(copyItem); return copyItem; }, // 添加 array 列表元素 - async addChildren(itemChildren) { + addChildren(itemChildren) { const item = this.itemInfo.apiContent.bodyTableData.filter(ite => (ite.level === itemChildren.level - 1 && ite.primaryKey === itemChildren.parentPrimaryKey && ite.ancestorsList.toString() === itemChildren.ancestorsList.slice(0, -1).toString()))[0]; const index = this.itemInfo.apiContent.bodyTableData.indexOf(item) + 1; - const count = await this.countChildren(item); - const copyItem = await this.cleanValue(item.children[0]); - const insertList = await this.treeToTableList( + const count = this.countChildren(item); + const copyItem = this.cleanValue(item.children[0]); + const insertList = this.treeToTableList( JSON.parse(JSON.stringify([...item.children, copyItem])), item.level + 1, item.primaryKey, 'array', item.ancestorsList ); - await insertList.forEach((ite) => { + insertList.forEach((ite) => { ite.children = []; }); item.children = insertList.filter(ite => ite.level === item.level + 1); - await this.recordChildren(insertList, item.level + 1); + this.recordChildren(insertList, item.level + 1); this.itemInfo.apiContent.bodyTableData.splice(index, count, ...insertList); }, // 删除元素 - async deletChildren(item) { + deletChildren(item) { if (this.countSon(item)) { return; } @@ -381,7 +381,7 @@ } currentObj.splice(currentObj.indexOf(item), 1); const index = this.itemInfo.apiContent.bodyTableData.indexOf(item); - const count = await this.countChildren(item); + const count = this.countChildren(item); this.itemInfo.apiContent.bodyTableData.splice(index, count + 1); }, }, diff --git a/frontend/pc/src/views/processManagement/publicTrigger/components/apiCall.vue b/frontend/pc/src/views/processManagement/publicTrigger/components/apiCall.vue index f1d00c11c..14f000d91 100644 --- a/frontend/pc/src/views/processManagement/publicTrigger/components/apiCall.vue +++ b/frontend/pc/src/views/processManagement/publicTrigger/components/apiCall.vue @@ -57,9 +57,14 @@ @@ -68,12 +73,14 @@