Просмотр исходного кода

feat: 新增脚本 接口后置回调afterHttp

johnsen 8 месяцев назад
Родитель
Сommit
4fb9b3ada1

+ 13 - 0
src/api/platform/bpmn/bpmTask.js

@@ -144,6 +144,19 @@ export function deployTask(params) {
     data: params
     data: params
   })
   })
 }
 }
+/**
+ * 获取代码分支
+ * @param {*} params
+ */
+export function getBranch(params) {
+  console.log('getBranch')
+  return request({
+    url: '/devops/getBranch',
+    method: 'post',
+    isLoading: false,
+    data: params
+  })
+}
 
 
 /**
 /**
  * 保存加签
  * 保存加签

+ 2 - 0
src/business/platform/data/templaterender/templates/list.vue

@@ -830,6 +830,8 @@ export default {
       queryDataTable(this.getFormatParams(outerKey), this.dataTemplate.type)
       queryDataTable(this.getFormatParams(outerKey), this.dataTemplate.type)
         .then((response) => {
         .then((response) => {
           this.loading = false
           this.loading = false
+          JTemplate._afterHttp(response.data)
+          // console.log('2222222222222222222', response.data)
           ActionUtils.handleListData(this, response.data)
           ActionUtils.handleListData(this, response.data)
           // 回调查询不再选中原有数据
           // 回调查询不再选中原有数据
           if (type !== 'callback') {
           if (type !== 'callback') {

+ 6 - 1
src/business/platform/data/templaterender/utils/JTemplate.js

@@ -77,7 +77,11 @@ _.extend(JTemplate, {
       callback(flag)
       callback(flag)
     }
     }
   },
   },
-
+  _afterHttp: function (response) {
+    if (_.isFunction(this.afterHttp)) {
+      return this.afterHttp(response)
+    }
+  },
   // 按钮提交后事件
   // 按钮提交后事件
   _afterSubmit: function (
   _afterSubmit: function (
     template,
     template,
@@ -117,6 +121,7 @@ _.extend(JTemplate, {
     this.beforeSubButton = null
     this.beforeSubButton = null
     this.summaryMethod = null
     this.summaryMethod = null
     this.afterSubmit = null
     this.afterSubmit = null
+    this.afterHttp = null
     this.beforeSubmit = null
     this.beforeSubmit = null
     this.customFormatter = null
     this.customFormatter = null
     this._isInitialization = false
     this._isInitialization = false

+ 6 - 5
src/business/platform/form/formrender/dynamic-form/dynamic-form.vue

@@ -303,7 +303,6 @@ export default {
       handler(val) {
       handler(val) {
         this.initResponseFields()
         this.initResponseFields()
       },
       },
-      deep: true,
       immediate: true
       immediate: true
     },
     },
     timeModification() {
     timeModification() {
@@ -419,8 +418,9 @@ export default {
               const data = this.value[fieldName]
               const data = this.value[fieldName]
               if (this.$utils.isEmpty(data)) {
               if (this.$utils.isEmpty(data)) {
                 if (defaultValueEmpty) {
                 if (defaultValueEmpty) {
-                  const defaultValue =
-                    await FormUtils.getFieldDefaultValue(field)
+                  const defaultValue = await FormUtils.getFieldDefaultValue(
+                    field
+                  )
                   this.models[fieldName] = defaultValue
                   this.models[fieldName] = defaultValue
                 }
                 }
               } else {
               } else {
@@ -428,8 +428,9 @@ export default {
               }
               }
             } else {
             } else {
               // 默认值
               // 默认值
-              this.models[fieldName] =
-                await FormUtils.getFieldDefaultValue(field)
+              this.models[fieldName] = await FormUtils.getFieldDefaultValue(
+                field
+              )
               if (this.dynamicParams && this.dynamicParams[field.field_name]) {
               if (this.dynamicParams && this.dynamicParams[field.field_name]) {
                 this.models[fieldName] = this.dynamicParams[field.field_name]
                 this.models[fieldName] = this.dynamicParams[field.field_name]
               }
               }

+ 2 - 1
src/utils/common.js

@@ -13,7 +13,7 @@ import {
 } from '@/api/platform/system/identity'
 } from '@/api/platform/system/identity'
 import { save as sendMsg } from '@/api/platform/message/innerMessage'
 import { save as sendMsg } from '@/api/platform/message/innerMessage'
 import { save as saveNews, manage, internal } from '@/api/platform/system/news'
 import { save as saveNews, manage, internal } from '@/api/platform/system/news'
-import { bpmTaskSave, buildTask, deployTask } from '@/api/platform/bpmn/bpmTask'
+import { bpmTaskSave, buildTask, deployTask, getBranch } from '@/api/platform/bpmn/bpmTask'
 import { onlyOfficeToPdf } from '@/api/platform/form/seal'
 import { onlyOfficeToPdf } from '@/api/platform/form/seal'
 import { downloadFile as download } from '@/business/platform/file/utils'
 import { downloadFile as download } from '@/business/platform/file/utils'
 import { removeFormData } from '@/api/platform/data/dataTemplate'
 import { removeFormData } from '@/api/platform/data/dataTemplate'
@@ -237,6 +237,7 @@ export default {
   bpmTaskSave,
   bpmTaskSave,
   buildTask,
   buildTask,
   deployTask,
   deployTask,
+  getBranch,
   getDate,
   getDate,
   getDateNow,
   getDateNow,
   getFormatDate,
   getFormatDate,