Răsfoiți Sursa

链接组件及脚本处理同步

cyy 1 an în urmă
părinte
comite
8c93e46662

+ 1 - 1
public/config.js

@@ -1,5 +1,5 @@
 (function (global) {
-  const BASE_URL = 'http://dev1.local:5100/'
+  const BASE_URL = 'http://dev1.local/'
   global.__IBPS_CONFIG__={
     // 是否启用配置
     ENABLE_CONFIG:true,

+ 113 - 0
src/api/platform/form/seal.js

@@ -0,0 +1,113 @@
+import request from '@/utils/request'
+import { FORM_URL } from '@/api/baseUrl'
+import { BASE_SEAL_API } from '@/constant'
+import axios from 'axios'
+import Utils from '@/utils/util'
+
+const BASE_URL = process.env.VUE_APP_BASE_URL
+
+/**
+ * ca电子签章接口
+ * @param {*} params
+ */
+export const goSeal = params => {
+    return request({
+        url: FORM_URL() + '/sys/esspdf/fileSign',
+        method: 'post',
+        isLoading: true,
+        data: params
+    })
+}
+/**
+ * word 转 pdf
+ * @param {*} params
+ */
+export const wordToPdf = params => {
+    return request({
+        url: FORM_URL() + '/sys/esspdf/wordToPdf',
+        method: 'post',
+        isLoading: true,
+        data: params
+    })
+}
+
+/**
+ * 关键字盖章
+ * @param {*} data
+ */
+export const sealByKeywords = data => {
+    return request({
+        url: FORM_URL() + '/sys/esspdf/fileSignByKeyWord',
+        method: 'post',
+        isLoading: true,
+        data
+    })
+}
+
+/**
+ * 转pdf并签章
+ * @param {*} params
+ */
+export const docxToPdfAndSign = params => {
+    return request({
+        url: FORM_URL() + '/sys/esspdf/onlyOfficeToPdfAndSign',
+        method: 'post',
+        isLoading: true,
+        params
+    })
+}
+
+export const onlyOfficeToPdf = params => {
+    return request({
+        url: FORM_URL() + '/sys/esspdf/onlyOfficeToPdf',
+        method: 'post',
+        isLoading: true,
+        params
+    })
+}
+
+/* 自动微签:脚本对文件盖章 */
+export function seal (url, fileType, type) {
+    const Base64 = require('js-base64').Base64
+    const data = {
+        'signKey': 'V1FTMjAyMTEyMjFkOTVjNWM=',
+        'signSecret': 'YWQwMmY3ZjQ4ZDJmMmYwNDA=',
+        'sealUser': 'YWRtaW4=',
+        'password': 'MTIzNA==',
+        // "ruleName": "6aqR57yd56ug6KeE5YiZLOmmlumhteeblueroA==",
+        'ruleName': type,
+        'provideSigFile': Base64.encode(url),
+        'fileKey': Base64.encode(Utils.guid() + '.' + fileType)
+    }
+    return axios({
+        url: `${BASE_URL}doSeal/`,
+        method: 'post',
+        data: data
+    })
+}
+
+/* 手动微签:脚本对文件进行手动盖章-预处理 */
+export function sealPre (url, fileKey) {
+    const Base64 = require('js-base64').Base64
+    const data = {
+        'signKey': 'V1FTMjAyMTEyMjFkOTVjNWM=',
+        'signSecret': 'YWQwMmY3ZjQ4ZDJmMmYwNDA=',
+        'sealUser': 'YWRtaW4=',
+        'password': 'MTIzNA==',
+        'provideSigFile': Base64.encode(url),
+        // "getSigFile":  Base64.encode(this.$form.$getSigFile),
+        'getSigFile': Base64.encode(`${BASE_URL}#/sealCompleted`),
+        'fileKey': Base64.encode(fileKey)
+    }
+    return axios({
+        url: `${BASE_URL}preprocess/`,
+        method: 'post',
+        data: data
+    })
+}
+
+/* 手动微签:脚本对文件进行手动盖章-手动签章页面的url */
+export function getSigPageUrl (sigFile) {
+    const sigUrl = `${BASE_SEAL_API}manualSig/manualSigPage/?signKey=V1FTMjAyMTEyMjFkOTVjNWM=&signSecret=YWQwMmY3ZjQ4ZDJmMmYwNDA=&sigFile=${sigFile}`
+    return sigUrl
+}

+ 153 - 0
src/business/platform/data/index.vue

@@ -0,0 +1,153 @@
+<template>
+  <component
+    :is="templateType"
+    v-if="template"
+    ref="dataTemplate"
+    :value="value"
+    :template-type-name="templateType"
+    :template="template"
+    :data-template="dataTemplate"
+    :dynamic-params="dynamicParams"
+    :multiple="multiple"
+    :height="height"
+    :fields="fields"
+    :preview="preview"
+    :temp-search="tempSearch"
+    v-on="$listeners"
+  />
+</template>
+<script>
+import DataTemplate from './templates'
+import Vue from 'vue'
+Vue.component('ibps-data-template-formrender', () =>
+  import('@/business/platform/form/formrender/index.vue')
+)
+
+export default {
+  components: DataTemplate,
+  props: {
+    value: [String, Number, Array, Object],
+    data: {
+      type: Object
+    },
+    dynamicParams: {
+      type: Object
+    },
+    multiple: {
+      type: Boolean,
+      default: true
+    },
+    height: {
+      type: [String, Number]
+    },
+    preview: {
+      type: Boolean,
+      default: false
+    },
+    tempSearch: {
+      // 是否是数据模板使用的筛选条件
+      type: Boolean,
+      default: false
+    }
+  },
+  data() {
+    return {
+      selected: false,
+      dataTemplate: {}
+    }
+  },
+  computed: {
+    templateType() {
+      if (this.$utils.isEmpty(this.dataTemplate)) {
+        return
+      }
+      let key = ''
+      if (this.dataTemplate.type === 'valueSource') {
+        key = 'value-source'
+      } else {
+        if (this.dataTemplate.showType === 'compose') {
+          if (
+            this.dataTemplate.composeType === 'treeList' ||
+            this.dataTemplate.composeType === 'listTree'
+          ) {
+            key = 'treeList'
+          } else {
+            key = this.dataTemplate.composeType
+          }
+        } else {
+          key = this.dataTemplate.showType
+        }
+      }
+      if (this.$utils.isEmpty(key)) {
+        return
+      }
+      return 'ibps-data-template-' + key
+    },
+    template() {
+      if (this.$utils.isEmpty(this.dataTemplate)) {
+        return {}
+      }
+      const templates = this.dataTemplate.templates || []
+      if (
+        this.dataTemplate.showType === 'compose' &&
+        this.dataTemplate.composeType !== 'treeForm'
+      ) {
+        return templates
+      } else {
+        return templates.length > 0 ? templates[0] : {}
+      }
+    },
+    fields() {
+      if (this.$utils.isEmpty(this.dataTemplate)) {
+        return {}
+      }
+      const fields = {}
+      if (this.dataTemplate.datasets && this.dataTemplate.datasets.length > 0) {
+        this.dataTemplate.datasets.forEach(dataset => {
+          if (dataset.parentId !== '0') {
+            fields[dataset.name] = dataset
+          }
+        })
+      }
+      return fields
+    }
+  },
+  watch: {
+    data: {
+      handler(val, oldVal) {
+        if (val !== oldVal) {
+          this.dataTemplate = JSON.parse(JSON.stringify(val))
+        }
+      },
+      immediate: true
+    }
+  },
+  methods: {
+    // 清空选择
+    clearSelection() {
+      if (
+        this.$refs['dataTemplate'] &&
+        this.$refs['dataTemplate'].clearSelection
+      ) {
+        this.$refs['dataTemplate'].clearSelection()
+      }
+    },
+    resetSearchForm() {
+      if (
+        this.$refs['dataTemplate'] &&
+        this.$refs['dataTemplate'].resetSearchForm
+      ) {
+        this.$refs['dataTemplate'].resetSearchForm()
+      }
+    },
+    setSelectRow() {
+      if (
+        this.$refs['dataTemplate'] &&
+        this.$refs['dataTemplate'].setSelectRow
+      ) {
+        this.$refs['dataTemplate'].setSelectRow()
+      }
+    }
+  }
+}
+</script>

+ 28 - 10
src/business/platform/form/components/hyperlink/index.vue

@@ -35,7 +35,20 @@
       />
     </template>
     <template #input>
-      <ibps-link
+      <div
+        v-if="showType === 'link' && iframeShow"
+        style="box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)"
+      >
+        <iframe
+          v-if="showType === 'link' && iframeShow"
+          :height="height - 50"
+          width="100%"
+          :src="iframeUrl"
+          frameborder="0"
+          scrolling="no"
+        />
+      </div>
+      <!-- <ibps-link
         v-if="showType === 'link'"
         :underline="underline"
         :icon="'ibps-icon' + icon"
@@ -53,14 +66,14 @@
         :type="type"
         size="small"
         @click="click"
-      />
+      /> -->
       <!-- 弹窗模式 -->
-      <custom-dialog
+      <!-- <custom-dialog
         ref="userDialog"
         :visible="openDialog"
         :components="customComponents"
         @close="visible => (openDialog = visible)"
-      />
+      /> -->
     </template>
   </van-field>
 </template>
@@ -153,6 +166,9 @@ export default {
     },
     afterClick: {
       type: Function
+    },
+    formData: {
+      type: Object
     }
   },
   data() {
@@ -162,14 +178,13 @@ export default {
       openType: '',
       openDialog: false,
       show: true,
+      iframeUrl: '',
+      iframeShow: false,
+      height: document.documentElement.clientHeight,
       customComponents: {}
     }
   },
   watch: {
-    formData(val, oldVal) {
-      // 提供脚本监听属性。
-      console.info(val)
-    },
     textType: {
       handler: function(val) {
         if (!this.previewEntrance) return
@@ -181,7 +196,9 @@ export default {
     linkType: {
       handler: function(val) {
         if (!this.previewEntrance) return
-        this.setVal(val, 'link', this.link)
+        setTimeout(() => {
+          this.setVal(val, 'link', this.link)
+        }, 100)
       },
       immediate: true
     }
@@ -212,15 +229,16 @@ export default {
         reportPath: this.$reportPath,
         reportPaths: this.$reportPaths
       }
-      console.log(options, 'optionsoptionsoptionsoptions')
 
       if (this.$utils.isEmpty(scrip)) return
       const promise = new window.Promise((resolve, reject) => {
+        console.log(options, 'optionsoptionsoptionsoptions')
         new Function('options', 'resolve', scrip)(options, resolve)
       })
       promise.then(result => {
         // 本人
         if (this.showType === 'link') {
+          console.log(result, 'resultresultresultresult')
           this.iframeUrl = result[0].logic.split('url:"')[1].split('"')[0]
           this.iframeShow = true
           return

+ 572 - 561
src/business/platform/form/dynamic-form/form.vue

@@ -1,42 +1,48 @@
 <template>
-    <van-form ref="form" :colon="colon" :label-width="labelWidth" :label-align="labelPosition" :input-align="inputAlign">
-        <template v-for="(field, index) in formDef.fields">
-            <!--栅格布局-->
-            <ibps-dynamic-form-grid
-                v-if="
-                    field.field_type === 'grid' ||
-                        field.field_type === 'tabs' ||
-                        field.field_type === 'steps' ||
-                        field.field_type === 'collapse'
-                "
-                :key="field.name + index"
-                ref="formItem"
-                :models.sync="models"
-                :rights.sync="rights"
-                :field="field"
-                :code="code"
-                :form-opinion="responseFormOpinionData[field.name]"
-                :desc-position="formDef.attrs.descPosition"
-                :params="formParams"
-                :readonly-rights="readonlyRights"
-                @change-form-opinion="handleFormOpinion"
-            />
-            <ibps-dynamic-form-item
-                v-else
-                ref="formItem"
-                :key="field.name + index"
-                :models.sync="models"
-                :rights.sync="rights"
-                :field="field"
-                :code="code"
-                :form-opinion="responseFormOpinionData[field.name]"
-                :desc-position="formDef.attrs.descPosition"
-                :params="formParams"
-                :readonly-rights="readonlyRights"
-                @change-form-opinion="handleFormOpinion"
-            />
-        </template>
-    </van-form>
+  <van-form
+    ref="form"
+    :colon="colon"
+    :label-width="labelWidth"
+    :label-align="labelPosition"
+    :input-align="inputAlign"
+  >
+    <template v-for="(field, index) in formDef.fields">
+      <!--栅格布局-->
+      <ibps-dynamic-form-grid
+        v-if="
+          field.field_type === 'grid' ||
+            field.field_type === 'tabs' ||
+            field.field_type === 'steps' ||
+            field.field_type === 'collapse'
+        "
+        :key="field.name + index"
+        ref="formItem"
+        :models.sync="models"
+        :rights.sync="rights"
+        :field="field"
+        :code="code"
+        :form-opinion="responseFormOpinionData[field.name]"
+        :desc-position="formDef.attrs.descPosition"
+        :params="formParams"
+        :readonly-rights="readonlyRights"
+        @change-form-opinion="handleFormOpinion"
+      />
+      <ibps-dynamic-form-item
+        v-else
+        ref="formItem"
+        :key="field.name + index"
+        :models.sync="models"
+        :rights.sync="rights"
+        :field="field"
+        :code="code"
+        :form-opinion="responseFormOpinionData[field.name]"
+        :desc-position="formDef.attrs.descPosition"
+        :params="formParams"
+        :readonly-rights="readonlyRights"
+        @change-form-opinion="handleFormOpinion"
+      />
+    </template>
+  </van-form>
 </template>
 
 <script>
@@ -44,549 +50,554 @@ import FormOptions from '../constants/formOptions'
 import FormUtils from '../utils/formUtil'
 
 export default {
-    provide() {
-        return {
-            dynamicForm: this
-        }
+  provide() {
+    return {
+      dynamicForm: this
+    }
+  },
+  props: {
+    formDef: {
+      type: Object,
+      required: true
     },
-    props: {
-        formDef: {
-            type: Object,
-            required: true
-        },
-        value: {
-            type: Object
-        },
-        readonly: {
-            type: Boolean,
-            default: false
-        },
-        permissions: {
-            type: Object
-        },
-        columnMinWidth: {
-            type: String
-        },
-        validateImmediately: {
-            // 是否初始验证
-            type: Boolean,
-            default: true
-        },
-        initialization: {
-            type: Boolean,
-            default: false
-        },
-        // 扩展参数
-        params: Object,
-        // 当前激活步骤
-        curActiveStep: Number
-    },
-    data() {
-        return {
-            models: {}, // 表单model对象数据
-            rights: {}, // 表单权限
-            responseFormOpinionData: {},
-            responseFormula: {}, // 公式
-            responseLinkages: {},
-            responseVerifys: [], // 表单提交校验
-            responseOpinionFields: {}, // 表单的意见字段
-            responseLabelFields: {}, // 表单的文本字段
-            border: false,
-            init: false,
-            tabs: 'tabs_0',
-            steps: 'steps_0'
-        }
+    value: {
+      type: Object
     },
-    computed: {
-        formAttrs() {
-            return this.formDef ? this.formDef.attrs || {} : {}
-        },
-        colon() {
-            return !!(this.formAttrs && this.formAttrs.colon)
-        },
-        labelWidth() {
-            if (
-                this.$utils.isNotEmpty(this.formAttrs.labelWidth) &&
-          this.$utils.isNotEmpty(this.formAttrs.labelWidthUnit)
-            ) {
-                return this.formAttrs.labelWidth + this.formAttrs.labelWidthUnit
-            } else {
-                return '100px'
-            }
-        },
-        labelPosition() {
-            return this.$utils.isNotEmpty(this.formAttrs.mobileLabelPosition)
-                ? this.formAttrs.mobileLabelPosition
-                : 'right'
-        },
-        inputAlign() {
-            return this.$utils.isNotEmpty(this.formAttrs.mobileInputAlign)
-                ? this.formAttrs.mobileInputAlign
-                : 'left'
-        },
-        customClass() {
-            return this.$utils.isNotEmpty(this.formAttrs.customClass)
-                ? this.formAttrs.customClass
-                : null
-        },
-        code() {
-            return this.formDef.code
-        },
-        readonlyRights() {
-            return this.readonly
-        },
-        readonlyStyle() {
-            return this.formAttrs && this.formAttrs.read_style
-                ? this.formAttrs.read_style
-                : 'text'
-        },
-        hasScript() {
-            return this.formAttrs
-                ? this.$utils.isNotEmpty(this.formAttrs.mobile_script)
-                    ? this.$utils.isNotEmpty(this.formAttrs.mobile_script)
-                    : this.$utils.isNotEmpty(this.formAttrs.script)
-                : false
-        },
-        formParams() {
-            // 扩展参数
-            const params = {
-                code: this.code,
-                responseFormula: this.responseFormula,
-                responseLinkages: this.responseLinkages,
-                responseFormOpinionData: this.responseFormOpinionData,
-                readonly: this.readonly,
-                permissions: this.rights,
-                inputAlign: this.inputAlign
-            }
-
-            return Object.assign(params, this.params)
-        }
+    readonly: {
+      type: Boolean,
+      default: false
     },
-    watch: {
-        formDef: {
-            handler(val) {
-                this.initResponseFields()
-            },
-            deep: true,
-            immediate: true
-        },
-        models: {
-            handler(val) {
-                // 延迟验证
-                this.$nextTick(() => {
-                    this.getFormValidator()
-                        .then(() => { })
-                        .catch(() => { })
-                })
-            },
-            deep: true,
-            immediate: true
-        },
-        initialization(val) {
-            if (val && this.hasScript) {
-                this.$emit('load-script')
-            }
-        }
+    permissions: {
+      type: Object
     },
-    mounted() {
-    // 初始化脚本
+    columnMinWidth: {
+      type: String
+    },
+    validateImmediately: {
+      // 是否初始验证
+      type: Boolean,
+      default: true
+    },
+    initialization: {
+      type: Boolean,
+      default: false
+    },
+    // 扩展参数
+    params: Object,
+    // 当前激活步骤
+    curActiveStep: Number
+  },
+  data() {
+    return {
+      models: {}, // 表单model对象数据
+      rights: {}, // 表单权限
+      responseFormOpinionData: {},
+      responseFormula: {}, // 公式
+      responseLinkages: {},
+      responseVerifys: [], // 表单提交校验
+      responseOpinionFields: {}, // 表单的意见字段
+      responseLabelFields: {}, // 表单的文本字段
+      border: false,
+      init: false,
+      tabs: 'tabs_0',
+      steps: 'steps_0'
+    }
+  },
+  computed: {
+    formAttrs() {
+      return this.formDef ? this.formDef.attrs || {} : {}
+    },
+    colon() {
+      return !!(this.formAttrs && this.formAttrs.colon)
+    },
+    labelWidth() {
+      if (
+        this.$utils.isNotEmpty(this.formAttrs.labelWidth) &&
+        this.$utils.isNotEmpty(this.formAttrs.labelWidthUnit)
+      ) {
+        return this.formAttrs.labelWidth + this.formAttrs.labelWidthUnit
+      } else {
+        return '100px'
+      }
+    },
+    labelPosition() {
+      return this.$utils.isNotEmpty(this.formAttrs.mobileLabelPosition)
+        ? this.formAttrs.mobileLabelPosition
+        : 'right'
+    },
+    inputAlign() {
+      return this.$utils.isNotEmpty(this.formAttrs.mobileInputAlign)
+        ? this.formAttrs.mobileInputAlign
+        : 'left'
+    },
+    customClass() {
+      return this.$utils.isNotEmpty(this.formAttrs.customClass)
+        ? this.formAttrs.customClass
+        : null
+    },
+    code() {
+      return this.formDef.code
+    },
+    readonlyRights() {
+      return this.readonly
+    },
+    readonlyStyle() {
+      return this.formAttrs && this.formAttrs.read_style
+        ? this.formAttrs.read_style
+        : 'text'
+    },
+    hasScript() {
+      return this.formAttrs
+        ? this.$utils.isNotEmpty(this.formAttrs.mobile_script)
+          ? this.$utils.isNotEmpty(this.formAttrs.mobile_script)
+          : this.$utils.isNotEmpty(this.formAttrs.script)
+        : false
+    },
+    formParams() {
+      // 扩展参数
+      const params = {
+        code: this.code,
+        responseFormula: this.responseFormula,
+        responseLinkages: this.responseLinkages,
+        responseFormOpinionData: this.responseFormOpinionData,
+        readonly: this.readonly,
+        permissions: this.rights,
+        inputAlign: this.inputAlign
+      }
+
+      return Object.assign(params, this.params)
+    }
+  },
+  watch: {
+    formDef: {
+      handler(val) {
+        this.initResponseFields()
+      },
+      deep: true,
+      immediate: true
+    },
+    models: {
+      handler(val) {
+        // 延迟验证
         this.$nextTick(() => {
-            if (this.validateImmediately) {
-                this.getFormValidator()
-                    .then(() => { })
-                    .catch(() => { })
-            }
+          this.getFormValidator()
+            .then(() => {})
+            .catch(() => {})
         })
+      },
+      deep: true,
+      immediate: true
     },
-    methods: {
+    initialization(val) {
+      if (val && this.hasScript) {
+        this.$emit('load-script')
+      }
+    }
+  },
+  mounted() {
+    // 初始化脚本
+    console.log(this, 'thisthis')
+    this.$nextTick(() => {
+      if (this.validateImmediately) {
+        this.getFormValidator()
+          .then(() => {})
+          .catch(() => {})
+      }
+    })
+  },
+  methods: {
     /**
-       * 初始化字段
-       */
-        async initResponseFields() {
-            const fields = this.formDef.fields
-            if (!fields) {
-                return
-            }
-            await this.generateModles(fields)
-            // 初始化运行公式计算
-            await this.initRunCalFormula()
-            // 初始化表单意见
-            await this.initResponseOpinionData()
-        },
-        /**
-       * 生成modles
-       */
-        async generateModles(fields) {
-            for (let i = 0; i < fields.length; i++) {
-                const field = fields[i]
-                const fieldName = field.name
-                const fieldType = field.field_type
-                const fieldOptions = field.field_options
+     * 初始化字段
+     */
+    async initResponseFields() {
+      const fields = this.formDef.fields
+      if (!fields) {
+        return
+      }
+      await this.generateModles(fields)
+      // 初始化运行公式计算
+      await this.initRunCalFormula()
+      // 初始化表单意见
+      await this.initResponseOpinionData()
+    },
+    /**
+     * 生成modles
+     */
+    async generateModles(fields) {
+      for (let i = 0; i < fields.length; i++) {
+        const field = fields[i]
+        const fieldName = field.name
+        const fieldType = field.field_type
+        const fieldOptions = field.field_options
 
-                if (FormOptions.t.NESTED_FIELD_TYPES.includes(fieldType)) {
-                    // 嵌套布局
-                    if (
-                        this.$utils.isNotEmpty(fieldOptions) &&
-              this.$utils.isNotEmpty(fieldOptions.columns)
-                    ) {
-                        // 循环遍历所有字段
-                        fieldOptions.columns.forEach(item => {
-                            this.generateModles(item.fields)
-                        })
-                    }
-                } else if (fieldType === 'table') {
-                    // 子表单
-                    const data = this.value ? this.value[fieldName] : []
-                    if (fieldOptions.mode === 'block') {
-                        if (this.$utils.isEmpty(data)) {
-                            this.$set(this.models, fieldName, [])
-                            const defaultValue = await FormUtils.getTableDefaultData(field)
-                            this.models[fieldName].push(
-                                JSON.parse(JSON.stringify(defaultValue))
-                            )
-                        } else {
-                            this.models[fieldName] = data || []
-                        }
-                    } else {
-                        this.models[fieldName] = data || []
-                    }
-                    // 初始化表单扩展参数
-                    this.initFormFieldParameter(field)
-                } else if (fieldType === 'approval_opinion') {
-                    // 审批意见
-                    this.models[fieldName] = ''
-                    this.responseOpinionFields[fieldName] = field
-                    // ====== 初始化表单权限
-                    this.initFormApprovalOpinionRights(field)
-                } else {
-                    if (fieldType === 'label') {
-                        // 文本字段
-                        this.responseLabelFields[fieldName] = field
-                    }
-                    // 不是只读字段
-                    if (!FormOptions.t.NON_MODEL_FIELD_TYPES.includes(fieldType)) {
-                        // 空值默认
-                        const defaultValueEmpty = this.$utils.toBoolean(
-                            fieldOptions.default_value_empty,
-                            true
-                        )
-                        if (this.value && Object.keys(this.value).indexOf(fieldName) >= 0) {
-                            // 有值
-                            const data = this.value[fieldName]
-                            if (this.$utils.isEmpty(data)) {
-                                if (defaultValueEmpty) {
-                                    // this.models[fieldName] = await FormUtils.getFieldDefaultValue(
-                                    //   field
-                                    // )
-                                    const defaultValue = await FormUtils.getFieldDefaultValue(field)
-                                    this.models[fieldName] = defaultValue
-                                }
-                            } else {
-                                this.models[fieldName] = await this.getInitData(field, data)
-                            }
-                        } else {
-                            // 默认值
-                            // this.models[fieldName] = await FormUtils.getFieldDefaultValue(
-                            //   field
-                            // )
-                            this.models[fieldName] = await FormUtils.getFieldDefaultValue(field)
-                            if (this.dynamicParams && this.dynamicParams[field.field_name]) {
-                                this.models[fieldName] = this.dynamicParams[field.field_name]
-                            }
-                        }
-                    } else {
-                        // 自定义组件单独处理
-                        if (fieldType === 'component') {
-                            this.models[fieldName] = this.value[fieldName]
-                        }
-                    }
-                    // 初始化表单扩展参数
-                    this.initFormFieldParameter(field)
-                }
-            }
-        },
-        async getInitData(field, data) {
-            const fieldType = field.field_type
-            const copyFlow = this.$utils.toBoolean(
-                this.formParams ? this.formParams.copyFlow : false,
-                false
-            )
-            if (fieldType === 'autoNumber' && copyFlow) {
-                // 复制流程初始化数据
-                return await FormUtils.getFieldDefaultValue(field)
-            }
-            return data
-        },
-        /**
-       *  初始化表单扩展参数
-       */
-        initFormFieldParameter(field) {
-            // ====== 初始化表单权限
-            this.initFormRights(field)
-            // ====== 初始化需要进行公式计算的字段
-            this.initResponseFormula(field)
-            // ======  初始化需要进行联动数据的字段
-            this.initResponseLinkages(field)
-        },
-        initFormApprovalOpinionRights(field) {
-            this.rights[field.name] =
-          FormUtils.getDefaultApprovalOpinionRigths(field, this.params) ||
-          this.getPermissions(this.permissions, field) ||
-          FormUtils.getDefaultRigths(field)
-        },
-        /**
-       *  初始化表单权限
-       */
-        initFormRights(field) {
-            this.rights[field.name] =
-          this.getPermissions(this.permissions, field) ||
-          FormUtils.getDefaultRigths(field)
-        },
-        // 获取权限
-        getPermissions(permissions, field) {
-            if (this.$utils.isEmpty(permissions)) {
-                return
-            }
-            const fieldType = field.field_type
-            const name = field.name
-            let rightsValue = null
-            const isNonInputField = FormOptions.t.NON_INPUT_FIELD_TYPES.includes(
-                fieldType
-            )
-            let isSpecial = false
-            if (isNonInputField && permissions.fields) {
-                // 非输入字段
-                rightsValue = permissions.fields[name] ? permissions.fields[name] : null
-            } else if (fieldType === 'approval_opinion' && permissions.opinions) {
-                // 意见 特殊处理
-                rightsValue = permissions.opinions[name]
-                    ? permissions.opinions[name]
-                    : null
-            } else if (fieldType === 'table' && permissions.tables) {
-                // 子表
-                isSpecial = true
-                rightsValue = permissions.tables[name] ? permissions.tables[name] : null
+        if (FormOptions.t.NESTED_FIELD_TYPES.includes(fieldType)) {
+          // 嵌套布局
+          if (
+            this.$utils.isNotEmpty(fieldOptions) &&
+            this.$utils.isNotEmpty(fieldOptions.columns)
+          ) {
+            // 循环遍历所有字段
+            fieldOptions.columns.forEach(item => {
+              this.generateModles(item.fields)
+            })
+          }
+        } else if (fieldType === 'table') {
+          // 子表单
+          const data = this.value ? this.value[fieldName] : []
+          if (fieldOptions.mode === 'block') {
+            if (this.$utils.isEmpty(data)) {
+              this.$set(this.models, fieldName, [])
+              const defaultValue = await FormUtils.getTableDefaultData(field)
+              this.models[fieldName].push(
+                JSON.parse(JSON.stringify(defaultValue))
+              )
             } else {
-                // 字段
-                rightsValue = permissions.fields[name] ? permissions.fields[name] : null
+              this.models[fieldName] = data || []
             }
-            if (this.readonly && !isNonInputField && !isSpecial) {
-                // 只读权限
-                // 修复空权限默认值的bug
-                if (this.$utils.isEmpty(rightsValue)) {
-                    rightsValue = FormUtils.getDefaultRigths(field)
-                }
-                rightsValue =
-            rightsValue !== FormOptions.t.PERMISSIONS.HIDE
-                ? FormOptions.t.PERMISSIONS.READ
-                : rightsValue
-            }
-            return rightsValue
-        },
-        // 初始化需要进行公式计算的字段
-        initResponseFormula(item) {
-            FormUtils.setResponseFormula(this.responseFormula, item, this.code)
-        },
-        // 初始化运行公式计算
-        initRunCalFormula() {
-            // 不需要字段的进行公式计算 比如获取但其当前时间
-            FormUtils.runCalFormula(
-                this,
-                this.responseFormula[FormUtils.NOT_NEED_FIELD],
-                this.formDef.code
+          } else {
+            this.models[fieldName] = data || []
+          }
+          // 初始化表单扩展参数
+          this.initFormFieldParameter(field)
+        } else if (fieldType === 'approval_opinion') {
+          // 审批意见
+          this.models[fieldName] = ''
+          this.responseOpinionFields[fieldName] = field
+          // ====== 初始化表单权限
+          this.initFormApprovalOpinionRights(field)
+        } else {
+          if (fieldType === 'label') {
+            // 文本字段
+            this.responseLabelFields[fieldName] = field
+          }
+          // 不是只读字段
+          if (!FormOptions.t.NON_MODEL_FIELD_TYPES.includes(fieldType)) {
+            // 空值默认
+            const defaultValueEmpty = this.$utils.toBoolean(
+              fieldOptions.default_value_empty,
+              true
             )
-        },
-        // 初始化联动数据
-        initResponseLinkages(item) {
-            FormUtils.setResponseLinkages(this.responseLinkages, item, this.code)
-        },
-        // 初始化表单意见
-        initResponseOpinionData() {
-            this.responseFormOpinionData = {}
-            const opinionData = this.params ? this.params.formOpinionData || {} : {}
-            if (this.$utils.isEmpty(opinionData) || !this.hasFormOpinion()) {
-                return
-            }
-            const hasBindNode = opinionData.hasBindNode
-            const formOpinionConfig = opinionData.formOpinionConfig
-            if (hasBindNode) {
-                // 1、有流程节点绑定的流程意见
-                const nodeData = opinionData.formOpinionNodeData
-                for (const key in this.responseOpinionFields) {
-                    if (this.responseOpinionFields.hasOwnProperty(key)) {
-                        if (formOpinionConfig[key]) {
-                            this.responseFormOpinionData[key] = nodeData[key]
-                        } else {
-                            this.responseFormOpinionData[key] = opinionData.opinionList
-                        }
-                    }
+            if (this.value && Object.keys(this.value).indexOf(fieldName) >= 0) {
+              // 有值
+              const data = this.value[fieldName]
+              if (this.$utils.isEmpty(data)) {
+                if (defaultValueEmpty) {
+                  // this.models[fieldName] = await FormUtils.getFieldDefaultValue(
+                  //   field
+                  // )
+                  const defaultValue = await FormUtils.getFieldDefaultValue(
+                    field
+                  )
+                  this.models[fieldName] = defaultValue
                 }
+              } else {
+                this.models[fieldName] = await this.getInitData(field, data)
+              }
             } else {
-                for (const key in this.responseOpinionFields) {
-                    if (this.responseOpinionFields.hasOwnProperty(key)) {
-                        this.responseFormOpinionData[key] = opinionData.opinionList
-                    }
-                }
+              // 默认值
+              // this.models[fieldName] = await FormUtils.getFieldDefaultValue(
+              //   field
+              // )
+              this.models[fieldName] = await FormUtils.getFieldDefaultValue(
+                field
+              )
+              if (this.dynamicParams && this.dynamicParams[field.field_name]) {
+                this.models[fieldName] = this.dynamicParams[field.field_name]
+              }
             }
-        },
-        handleInput(data) {
-            // 这里没有上报event,直接就是value了
-            this.models = data
-        },
-        handleFormOpinion(opinionData) {
-            let data = ''
-            // 如果有多个,取最后一个
-            if (this.$utils.isNotEmpty(opinionData)) {
-                for (const o in opinionData) {
-                    data = opinionData[o] || ''
-                }
-            }
-            this.opinionData = data
-        },
-        /**
-       * 表单提交校验
-       */
-        formSubmitVerify(callback) {
-            let flag = true
-            const verifys = this.formAttrs ? this.formAttrs.verifys : []
-            if (this.$utils.isEmpty(verifys)) {
-                callback(flag)
-                return
-            }
-            const formData = this.getFormData()
-            for (let i = 0; i < verifys.length; i++) {
-                const verify = verifys[i]
-                if (
-                    !FormUtils.runFormSubmitVerify(
-                        verify.formula,
-                        formData,
-                        this.formDef.code
-                    )
-                ) {
-                    flag = false
-                    callback(flag, verify.msg)
-                    return
-                }
+          } else {
+            // 自定义组件单独处理
+            if (fieldType === 'component') {
+              this.models[fieldName] = this.value[fieldName]
             }
-            flag = true
-            callback(flag)
-        },
-        /**
-       * 获取表单数据
-       */
-        getFormData() {
-            const data = {}
-            // 去除文本字段,表单意见字段
-            for (var key in this.models) {
-                if (
-                    !this.responseOpinionFields[key] &&
-            !this.responseLabelFields[key]
-                ) {
-                    data[key] = this.models[key]
-                }
+          }
+          // 初始化表单扩展参数
+          this.initFormFieldParameter(field)
+        }
+      }
+    },
+    async getInitData(field, data) {
+      const fieldType = field.field_type
+      const copyFlow = this.$utils.toBoolean(
+        this.formParams ? this.formParams.copyFlow : false,
+        false
+      )
+      if (fieldType === 'autoNumber' && copyFlow) {
+        // 复制流程初始化数据
+        return await FormUtils.getFieldDefaultValue(field)
+      }
+      return data
+    },
+    /**
+     *  初始化表单扩展参数
+     */
+    initFormFieldParameter(field) {
+      // ====== 初始化表单权限
+      this.initFormRights(field)
+      // ====== 初始化需要进行公式计算的字段
+      this.initResponseFormula(field)
+      // ======  初始化需要进行联动数据的字段
+      this.initResponseLinkages(field)
+    },
+    initFormApprovalOpinionRights(field) {
+      this.rights[field.name] =
+        FormUtils.getDefaultApprovalOpinionRigths(field, this.params) ||
+        this.getPermissions(this.permissions, field) ||
+        FormUtils.getDefaultRigths(field)
+    },
+    /**
+     *  初始化表单权限
+     */
+    initFormRights(field) {
+      this.rights[field.name] =
+        this.getPermissions(this.permissions, field) ||
+        FormUtils.getDefaultRigths(field)
+    },
+    // 获取权限
+    getPermissions(permissions, field) {
+      if (this.$utils.isEmpty(permissions)) {
+        return
+      }
+      const fieldType = field.field_type
+      const name = field.name
+      let rightsValue = null
+      const isNonInputField = FormOptions.t.NON_INPUT_FIELD_TYPES.includes(
+        fieldType
+      )
+      let isSpecial = false
+      if (isNonInputField && permissions.fields) {
+        // 非输入字段
+        rightsValue = permissions.fields[name] ? permissions.fields[name] : null
+      } else if (fieldType === 'approval_opinion' && permissions.opinions) {
+        // 意见 特殊处理
+        rightsValue = permissions.opinions[name]
+          ? permissions.opinions[name]
+          : null
+      } else if (fieldType === 'table' && permissions.tables) {
+        // 子表
+        isSpecial = true
+        rightsValue = permissions.tables[name] ? permissions.tables[name] : null
+      } else {
+        // 字段
+        rightsValue = permissions.fields[name] ? permissions.fields[name] : null
+      }
+      if (this.readonly && !isNonInputField && !isSpecial) {
+        // 只读权限
+        // 修复空权限默认值的bug
+        if (this.$utils.isEmpty(rightsValue)) {
+          rightsValue = FormUtils.getDefaultRigths(field)
+        }
+        rightsValue =
+          rightsValue !== FormOptions.t.PERMISSIONS.HIDE
+            ? FormOptions.t.PERMISSIONS.READ
+            : rightsValue
+      }
+      return rightsValue
+    },
+    // 初始化需要进行公式计算的字段
+    initResponseFormula(item) {
+      FormUtils.setResponseFormula(this.responseFormula, item, this.code)
+    },
+    // 初始化运行公式计算
+    initRunCalFormula() {
+      // 不需要字段的进行公式计算 比如获取但其当前时间
+      FormUtils.runCalFormula(
+        this,
+        this.responseFormula[FormUtils.NOT_NEED_FIELD],
+        this.formDef.code
+      )
+    },
+    // 初始化联动数据
+    initResponseLinkages(item) {
+      FormUtils.setResponseLinkages(this.responseLinkages, item, this.code)
+    },
+    // 初始化表单意见
+    initResponseOpinionData() {
+      this.responseFormOpinionData = {}
+      const opinionData = this.params ? this.params.formOpinionData || {} : {}
+      if (this.$utils.isEmpty(opinionData) || !this.hasFormOpinion()) {
+        return
+      }
+      const hasBindNode = opinionData.hasBindNode
+      const formOpinionConfig = opinionData.formOpinionConfig
+      if (hasBindNode) {
+        // 1、有流程节点绑定的流程意见
+        const nodeData = opinionData.formOpinionNodeData
+        for (const key in this.responseOpinionFields) {
+          if (this.responseOpinionFields.hasOwnProperty(key)) {
+            if (formOpinionConfig[key]) {
+              this.responseFormOpinionData[key] = nodeData[key]
+            } else {
+              this.responseFormOpinionData[key] = opinionData.opinionList
             }
-            return data
-        },
-        /**
-       * 设置表单字段数据
-       */
-        setFieldData(name, value) {
-            this.models[name] = value
-        },
-        /**
-           * 设置表单权限
-           */
-        getFormRights(name) {
-            return this.rights[name]
-        },
-        /**
-       * 设置表单权限
-       */
-        setFormRights(name, value) {
-            this.rights[name] = value
-        },
-        // 表单关联
-        getTableList(list) {
-            this.titleList = list
-        },
-        // 将对象参数传入, 进行渲染
-        getStatisOrRecord(type) {
-            this.record = type
-        },
-        /**
-       *  是否有审批意见字段
-       */
-        hasFormOpinion() {
-            return this.$utils.isNotEmpty(this.responseOpinionFields)
-        },
-        /**
-       * 获取审批意见数据
-       */
-        getFormOpinionData() {
-            const data = {}
-            for (var key in this.models) {
-                if (
-                    this.responseOpinionFields[key] &&
-            (this.$utils.isEmpty(this.rights[key]) ||
-              this.rights[key] ===
+          }
+        }
+      } else {
+        for (const key in this.responseOpinionFields) {
+          if (this.responseOpinionFields.hasOwnProperty(key)) {
+            this.responseFormOpinionData[key] = opinionData.opinionList
+          }
+        }
+      }
+    },
+    handleInput(data) {
+      // 这里没有上报event,直接就是value了
+      this.models = data
+    },
+    handleFormOpinion(opinionData) {
+      let data = ''
+      // 如果有多个,取最后一个
+      if (this.$utils.isNotEmpty(opinionData)) {
+        for (const o in opinionData) {
+          data = opinionData[o] || ''
+        }
+      }
+      this.opinionData = data
+    },
+    /**
+     * 表单提交校验
+     */
+    formSubmitVerify(callback) {
+      let flag = true
+      const verifys = this.formAttrs ? this.formAttrs.verifys : []
+      if (this.$utils.isEmpty(verifys)) {
+        callback(flag)
+        return
+      }
+      const formData = this.getFormData()
+      for (let i = 0; i < verifys.length; i++) {
+        const verify = verifys[i]
+        if (
+          !FormUtils.runFormSubmitVerify(
+            verify.formula,
+            formData,
+            this.formDef.code
+          )
+        ) {
+          flag = false
+          callback(flag, verify.msg)
+          return
+        }
+      }
+      flag = true
+      callback(flag)
+    },
+    /**
+     * 获取表单数据
+     */
+    getFormData() {
+      const data = {}
+      // 去除文本字段,表单意见字段
+      for (var key in this.models) {
+        if (
+          !this.responseOpinionFields[key] &&
+          !this.responseLabelFields[key]
+        ) {
+          data[key] = this.models[key]
+        }
+      }
+      return data
+    },
+    /**
+     * 设置表单字段数据
+     */
+    setFieldData(name, value) {
+      this.models[name] = value
+    },
+    /**
+     * 设置表单权限
+     */
+    getFormRights(name) {
+      return this.rights[name]
+    },
+    /**
+     * 设置表单权限
+     */
+    setFormRights(name, value) {
+      this.rights[name] = value
+    },
+    // 表单关联
+    getTableList(list) {
+      this.titleList = list
+    },
+    // 将对象参数传入, 进行渲染
+    getStatisOrRecord(type) {
+      this.record = type
+    },
+    /**
+     *  是否有审批意见字段
+     */
+    hasFormOpinion() {
+      return this.$utils.isNotEmpty(this.responseOpinionFields)
+    },
+    /**
+     * 获取审批意见数据
+     */
+    getFormOpinionData() {
+      const data = {}
+      for (var key in this.models) {
+        if (
+          this.responseOpinionFields[key] &&
+          (this.$utils.isEmpty(this.rights[key]) ||
+            this.rights[key] ===
               (FormOptions.t.PERMISSIONS.EDIT ||
                 FormOptions.t.PERMISSIONS.REQUIRED))
-                ) {
-                    data[key] = this.models[key]
-                }
-            }
-            return data
-        },
-        /**
-       * 获取审批意见验证
-       */
-        formOpinionValidate(callback, flag = false) {
-            if (this.$utils.isEmpty(this.responseOpinionFields)) {
-                callback(true)
-                return
-            }
-            let i = 0
-            if (flag) {
-                for (const key in this.responseOpinionFields) {
-                    if (
-                        this.$utils.isEmpty(this.models[key]) &&
-              (this.$utils.isEmpty(this.rights[key]) ||
-                this.rights[key] === FormOptions.t.PERMISSIONS.EDIT ||
-                this.rights[key] === FormOptions.t.PERMISSIONS.REQUIRED)
-                    ) {
-                        i++
-                    }
-                }
-            } else {
-                for (const key in this.responseOpinionFields) {
-                    if (
-                        this.$utils.isEmpty(this.models[key]) &&
-              this.rights[key] === FormOptions.t.PERMISSIONS.REQUIRED
-                    ) {
-                        i++
-                    }
-                }
-            }
-
-            if (i > 0) {
-                callback(false)
-            } else {
-                callback(true)
-            }
-        },
-        /**
-       * 表单验证
-       */
-        getFormValidator() {
-            this.$refs.form.resetValidation()
-            return this.$refs.form.validate()
-        },
-        /**
-       * 表单验证错误信息
-       */
-        scrollToField(name) {
-            return this.$refs.form.scrollToField(name)
+        ) {
+          data[key] = this.models[key]
+        }
+      }
+      return data
+    },
+    /**
+     * 获取审批意见验证
+     */
+    formOpinionValidate(callback, flag = false) {
+      if (this.$utils.isEmpty(this.responseOpinionFields)) {
+        callback(true)
+        return
+      }
+      let i = 0
+      if (flag) {
+        for (const key in this.responseOpinionFields) {
+          if (
+            this.$utils.isEmpty(this.models[key]) &&
+            (this.$utils.isEmpty(this.rights[key]) ||
+              this.rights[key] === FormOptions.t.PERMISSIONS.EDIT ||
+              this.rights[key] === FormOptions.t.PERMISSIONS.REQUIRED)
+          ) {
+            i++
+          }
         }
+      } else {
+        for (const key in this.responseOpinionFields) {
+          if (
+            this.$utils.isEmpty(this.models[key]) &&
+            this.rights[key] === FormOptions.t.PERMISSIONS.REQUIRED
+          ) {
+            i++
+          }
+        }
+      }
+
+      if (i > 0) {
+        callback(false)
+      } else {
+        callback(true)
+      }
+    },
+    /**
+     * 表单验证
+     */
+    getFormValidator() {
+      this.$refs.form.resetValidation()
+      return this.$refs.form.validate()
+    },
+    /**
+     * 表单验证错误信息
+     */
+    scrollToField(name) {
+      return this.$refs.form.scrollToField(name)
     }
+  }
 }
 </script>

+ 4 - 0
src/business/platform/form/utils/JForm.js

@@ -12,6 +12,8 @@ import _ from 'lodash'
 import Vue from 'vue'
 import request from '@/utils/request'
 import common from '@/utils/common'
+import dialog from '@/utils/dialog'
+import sealApi from '@/utils/seal'
 import store from '@/store'
 const _import = require('@/utils/util.import.' + process.env.NODE_ENV)
 import router from '@/router'
@@ -36,7 +38,9 @@ _.extend(JForm, {
         this.$form = form
         this.$vue = Vue
         this.$request = request
+        this.$dialog = dialog
         this.$common = common
+        this.$sealApi = sealApi
         this.$router = router
         this.$store = store
         this.$import = _import

+ 60 - 54
src/constant.js

@@ -2,57 +2,63 @@
  * 常量配置
  *
  */
-import env from '@/env'
-/**
- * 读取静态配置
- * @private
- */
-const __IBPS_CONFIG__ = window.__IBPS_CONFIG__ || {}
-
-export default __IBPS_CONFIG__
-
-const enableConfig = __IBPS_CONFIG__.ENABLE_CONFIG || false
-
-/**
- * 接口服务器
- * @type {*|string}
- */
-export const BASE_API = enableConfig ? (__IBPS_CONFIG__.BASE_API || env.VUE_APP_BASE_API) : env.VUE_APP_BASE_API
-export const BASE_GATEWAY_API = enableConfig ? (__IBPS_CONFIG__.BASE_GATEWAY_API || env.VUE_APP_BASE_GATEWAY_API) : env.VUE_APP_BASE_GATEWAY_API
-export const BASE_WEBSOCKET = enableConfig ? (__IBPS_CONFIG__.BASE_WEBSOCKET || env.VUE_APP_BASE_WEBSOCKET) : env.VUE_APP_BASE_WEBSOCKET
-export const BASE_REPORT_API = enableConfig ? (__IBPS_CONFIG__.BASE_REPORT_API || env.VUE_APP_BASE_REPORT_API) : env.VUE_APP_BASE_REPORT_API
-
-export const SINGLE = __IBPS_CONFIG__.SINGLE || false
-export const API_DOMAIN_NAMES = __IBPS_CONFIG__.API_DOMAIN_NAMES || []
-export const MULTIPLE_DOMAIN = __IBPS_CONFIG__.MULTIPLE_DOMAIN || false
-export const IS_WECHAT_LOGIN = __IBPS_CONFIG__.IS_WECHAT_LOGIN || false
-
-// ================认证中心=====================
-
-export const GRANT_TYPE = __IBPS_CONFIG__.GRANT_TYPE || ''
-export const CLIENT_ID = __IBPS_CONFIG__.CLIENT_ID || ''
-export const CLIENT_SECRET = __IBPS_CONFIG__.CLIENT_SECRET || ''
-
-// ================请求头=====================
-export const HEADER_TOKEN_KEY = __IBPS_CONFIG__.HEADER_TOKEN_KEY || 'X-Authorization-access_token'
-export const HEADER_SYSTEM_ID = __IBPS_CONFIG__.HEADER_SYSTEM_ID || 'X-Authorization-systemid'
-export const HEADER_TENANT_ID = __IBPS_CONFIG__.HEADER_TENANT_ID || 'X-Authorization-tenantid'
-export const FORM_TOKEN_KEY = __IBPS_CONFIG__.TOKEN_KEY || 'access_token'
-export const TENANT_ID = __IBPS_CONFIG__.TENANT_ID || 'tenant_id'
-
-// ================Cookies 存储=====================
-export const UUID_KEY = __IBPS_CONFIG__.UUID_KEY || 'uuid'
-export const LANG_KEY = __IBPS_CONFIG__.LANG_KEY || 'lang'
-
-export const TOKEN_STORE = __IBPS_CONFIG__.TOKEN_STORE || 'default'
-export const TOKEN_DOMAIN = __IBPS_CONFIG__.TOKEN_DOMAIN || 'bpmhome.cn'
-export const TOKEN_STORE_PREFIX = __IBPS_CONFIG__.TOKEN_STORE_PREFIX || 'default'
-export const TOKEN_STORE_KEY = __IBPS_CONFIG__.TOKEN_STORE_KEY || 'token'
-export const REFRESH_TOKEN_STORE_KEY = __IBPS_CONFIG__.REFRESH_TOKEN_STORE_KEY || 'refresh_token'
-
-export const TRANSFER_DATA = __IBPS_CONFIG__.TRANSFER_DATA || 'transfer'
-
-export const I18N_LOCALE = __IBPS_CONFIG__.I18N_LOCALE || 'zh-CN'
-export const I18N_FALLBACK_LOCALE = __IBPS_CONFIG__.I18N_FALLBACK_LOCALE || 'zh-CN'
-
-export const ELEMENT_COLOR = __IBPS_CONFIG__.ELEMENT_COLOR || '#409EFF'
+ import env from '@/env'
+ /**
+  * 读取静态配置
+  * @private
+  */
+ const __IBPS_CONFIG__ = window.__IBPS_CONFIG__ || {}
+ 
+ export default __IBPS_CONFIG__
+ 
+ const enableConfig = __IBPS_CONFIG__.ENABLE_CONFIG || false
+ 
+ /**
+  * 接口服务器
+  * @type {*|string}
+  */
+ export const BASE_URL = enableConfig ? (__IBPS_CONFIG__.BASE_URL || env.VUE_APP_BASE_URL) : env.VUE_APP_BASE_URL
+ export const BASE_API = enableConfig ? (__IBPS_CONFIG__.BASE_API || env.VUE_APP_BASE_API) : env.VUE_APP_BASE_API
+ export const BASE_GATEWAY_API = enableConfig ? (__IBPS_CONFIG__.BASE_GATEWAY_API || env.VUE_APP_BASE_GATEWAY_API) : env.VUE_APP_BASE_GATEWAY_API
+ export const BASE_WEBSOCKET = enableConfig ? (__IBPS_CONFIG__.BASE_WEBSOCKET || env.VUE_APP_BASE_WEBSOCKET) : env.VUE_APP_BASE_WEBSOCKET
+ export const BASE_REPORT_API = enableConfig ? (__IBPS_CONFIG__.BASE_REPORT_API || env.VUE_APP_BASE_REPORT_API) : env.VUE_APP_BASE_REPORT_API
+ export const BASE_SEAL_API = __IBPS_CONFIG__.BASE_SEAL_API || ''
+ 
+ export const SINGLE = __IBPS_CONFIG__.SINGLE || false
+ export const API_DOMAIN_NAMES = __IBPS_CONFIG__.API_DOMAIN_NAMES || []
+ export const MULTIPLE_DOMAIN = __IBPS_CONFIG__.MULTIPLE_DOMAIN || false
+ export const IS_WECHAT_LOGIN = __IBPS_CONFIG__.IS_WECHAT_LOGIN || false
+ 
+ // ================认证中心=====================
+ 
+ export const GRANT_TYPE = __IBPS_CONFIG__.GRANT_TYPE || ''
+ export const CLIENT_ID = __IBPS_CONFIG__.CLIENT_ID || ''
+ export const CLIENT_SECRET = __IBPS_CONFIG__.CLIENT_SECRET || ''
+ 
+ // ================请求头=====================
+ export const HEADER_TOKEN_KEY = __IBPS_CONFIG__.HEADER_TOKEN_KEY || 'X-Authorization-access_token'
+ export const HEADER_SYSTEM_ID = __IBPS_CONFIG__.HEADER_SYSTEM_ID || 'X-Authorization-systemid'
+ export const HEADER_TENANT_ID = __IBPS_CONFIG__.HEADER_TENANT_ID || 'X-Authorization-tenantid'
+ export const FORM_TOKEN_KEY = __IBPS_CONFIG__.TOKEN_KEY || 'access_token'
+ export const TENANT_ID = __IBPS_CONFIG__.TENANT_ID || 'tenant_id'
+ 
+ // ================Cookies 存储=====================
+ export const UUID_KEY = __IBPS_CONFIG__.UUID_KEY || 'uuid'
+ export const LANG_KEY = __IBPS_CONFIG__.LANG_KEY || 'lang'
+ 
+ export const TOKEN_STORE = __IBPS_CONFIG__.TOKEN_STORE || 'default'
+ export const TOKEN_DOMAIN = __IBPS_CONFIG__.TOKEN_DOMAIN || 'bpmhome.cn'
+ export const TOKEN_STORE_PREFIX = __IBPS_CONFIG__.TOKEN_STORE_PREFIX || 'default'
+ export const TOKEN_STORE_KEY = __IBPS_CONFIG__.TOKEN_STORE_KEY || 'token'
+ export const REFRESH_TOKEN_STORE_KEY = __IBPS_CONFIG__.REFRESH_TOKEN_STORE_KEY || 'refresh_token'
+ 
+ export const TRANSFER_DATA = __IBPS_CONFIG__.TRANSFER_DATA || 'transfer'
+ 
+ export const I18N_LOCALE = __IBPS_CONFIG__.I18N_LOCALE || 'zh-CN'
+ export const I18N_FALLBACK_LOCALE = __IBPS_CONFIG__.I18N_FALLBACK_LOCALE || 'zh-CN'
+ 
+ export const ELEMENT_COLOR = __IBPS_CONFIG__.ELEMENT_COLOR || '#409EFF'
+ 
+ export const REPORT_PATH = __IBPS_CONFIG__.REPORT_PATH || '金通医学实验室管理系统'
+ export const SYSTEM_NAME = __IBPS_CONFIG__.SYSTEM_NAME || '金通医学实验室标准化数智化管理平台'
+ 

+ 4 - 0
src/main.js

@@ -20,9 +20,13 @@ import common from "./utils/common"; // 通用请求
 import methCommon from "./utils/meth.js"
 import env from "@/env";
 import ActionUtils from "@/utils/action";
+// 核心插件
+import ibps from './plugins/ibps'
 
 import Vant from "vant";
 
+// 核心插件
+Vue.use(ibps)
 Vue.use(Vant); // 导入vant
 Vue.prototype.$action = ActionUtils; // 全局action
 Vue.prototype.$utils = utils; // 全局帮助类

+ 123 - 0
src/plugins/ibps/index.js

@@ -0,0 +1,123 @@
+// Element
+// import ElementUI from 'element-ui'
+// import 'element-ui/lib/theme-chalk/index.css'
+// A modern alternative to CSS resets
+import 'normalize.css/normalize.css'
+// flex 布局库
+// import 'flex.css'
+// ibps平台字体库
+// import '@/assets/fonts/iconfont.css'
+// :focus-visible https://github.com/WICG/focus-visible/blob/master/explainer.md
+// import 'focus-visible'
+// Internationalization 国际化
+import i18n from '@/i18n'
+// store
+import store from '@/store'
+// 工具类
+import Utils from '@/utils/util'
+// 全局方法
+import common from '@/utils'
+// global filters 全局过滤
+import * as filters from '@/filters'
+// 拼音指令
+// import pinyin from '@/directives/pinyin'
+// 置顶
+// import sticky from '@/directives/sticky'
+// 加载更多
+// import loadMore from '@/directives/load-more'
+
+import { getToken } from '@/utils/auth'
+// 通用组件
+// import '@/components'
+// svg 图标
+// import '@/assets/svg-icons'
+
+// 功能插件
+// import pluginError from '@/plugins/error'
+// import pluginLog from '@/plugins/log'
+// import pluginOpen from '@/plugins/open'
+// 平台配置文件
+import setting from '@/setting.js'
+import { BASE_URL, BASE_SEAL_API, REPORT_PATH } from '@/constant'
+import env from '@/env'
+
+export default {
+    async install (Vue, options) {
+        // 设置为 false 以阻止 vue 在启动时生成生产提示。
+        // https://cn.vuejs.org/v2/api/#productionTip
+        Vue.config.productionTip = false
+        // 当前环境
+        Vue.prototype.$nodeEnv = env.NODE_ENV
+        // 当前环境变量
+        Vue.prototype.$env = env
+
+        // 当前的 baseUrl   简化代码中 env.VUE_APP_PUBLIC_PATH 取值
+        Vue.prototype.$baseUrl = env.VUE_APP_PUBLIC_PATH || '/'
+        // 构建时间
+        Vue.prototype.$buildTime = env.VUE_APP_BUILD_TIME
+
+        Vue.prototype.$ibpsUrl = env.VUE_APP_BASE_API_0_0_TEST
+        Vue.prototype.$reportFilePath = REPORT_PATH
+        // 格式化参数
+        const getParams = (params) => {
+            const parts = params.split('&')
+            const result = []
+            parts.forEach((item, index) => {
+                const [key, value] = item.split('=')
+                // 第一个参数转换=为%3D,后续参数不转换=
+                if (index === 0) {
+                    result.push(`${key}%3D${encodeURIComponent(value)}`)
+                } else {
+                    result.push(`${key}=${encodeURIComponent(value)}`)
+                }
+            })
+            return result.join('&')
+        }
+        const downloadReport = (src, where, type = 6) => {
+            // 目前可用type    6:生成报表的pdf文件【默认】   7:生成报表的word文件   3:生成报表的excel文件
+            return `${BASE_URL}demo/reportServlet?action=${type}&file=${encodeURIComponent(REPORT_PATH + '/' + src)}&print=1&srcType=file&paramString=${getParams(where)}`
+        }
+        const timer = setInterval(() => { // 定时循环添加参数
+            if (getToken()) {
+                // 报表路径
+                Vue.prototype.$reportPath = `${BASE_URL}demo/reportJsp/showReport.jsp?access_token=${getToken()}&rpx=${REPORT_PATH}/`
+                Vue.prototype.$getReportFile = downloadReport // 通过方法函数,拼接url,并将字符串格式化
+                Vue.prototype.$getSealUri = `${BASE_SEAL_API}no/getSealFile/` // 微签 回显获取文件地址
+                Vue.prototype.$getFileDow = `${BASE_URL}ibps/platform/v3/file/download?attachmentId=` // 文件下载地址
+                clearInterval(timer) // 添加成功后即删除定时任务
+            }
+        }, 500)
+
+        // 获得用户设置的全局尺寸
+        const size = await store.dispatch('ibps/db/get', {
+            dbName: 'sys',
+            path: 'size.value',
+            defaultValue: setting.system.size,
+            user: true
+        })
+
+        // 注册Element UI
+        // Vue.use(ElementUI, {
+        //     size,
+        //     i18n: (key, value) => i18n.t(key, value)
+        // })
+        // 注册全局过滤器(register global utility filters. )
+        Object.keys(filters).forEach(key => {
+            Vue.filter(key, filters[key])
+        })
+        // 设置拼音指令
+        // Vue.directive('pinyin', pinyin)
+        // Vue.directive('sticky', sticky)
+        // Vue.directive('load-more', loadMore)
+
+        // 插件
+        // Vue.use(pluginError)
+        // Vue.use(pluginLog)
+        // Vue.use(pluginOpen)
+        // 使用帮助类
+        Vue.prototype.$utils = Utils
+        Vue.prototype.$common = common
+        // 快速打印 log
+        Vue.prototype.$log = Utils.log
+    }
+}

+ 10 - 0
src/setting.js

@@ -7,6 +7,16 @@ export default {
     version: version,
     api: ''// 更新版本的api
   },
+  system: {
+    size: 'small',
+    language: 'zh-CN',
+    languageList: [
+        { value: 'zh-CN', label: '简体中文' },
+        { value: 'zh-TW', label: '繁体中文' },
+        { value: 'en', label: 'English' },
+        { value: 'ja', label: '日本語' }
+    ]
+  },
   // 全局key
   globalKey: 'ibps-app-' + version,
   /**

+ 79 - 0
src/utils/dialog.js

@@ -0,0 +1,79 @@
+import Vue from 'vue'
+
+export default function (component, options = { dialog: {}}, cb) {
+    return new Promise(async (resolve, reject) => {
+        const dialog = {
+            appendToBody: true, // 对话框遮罩层是否插入至 body 元素上
+            scrollToTop: false,
+            ...options.dialog
+        }
+        // const footer = options.footer
+
+        const template = Vue.extend({
+            components: {
+                'ibps-dialog-component': component
+            },
+            data () {
+                return {
+                    visible: true,
+                    wrap: null
+                }
+            },
+            methods: {
+                onSubmit (data) {
+                    resolve(this, data)
+                },
+                onCancel (data) {
+                    reject(this, data)
+                },
+                onClose (done) {
+                    done()
+                    this.onCancel()
+                },
+                scrollToTop () {
+                    if (this.wrap.scrollTop) {
+                        this.wrap.scrollTop -= 200
+                        requestAnimationFrame(this.scrollToTop)
+                    }
+                },
+                toTop () {
+                    this.wrap = document.querySelector('.el-dialog__wrapper')
+                    this.scrollToTop()
+                }
+            },
+            render () {
+                var h = arguments[0]
+                return h('el-dialog', {
+                    'attrs': {
+                        ...dialog,
+                        class: dialog.className,
+                        visible: this.visible,
+                        beforeClose: this.onClose
+                    }
+                }, [h('ibps-dialog-component',
+                    {
+                        'on': {
+                            'submit': this.onSubmit,
+                            'cancel': this.onCancel
+                        }
+                    })]
+                )
+
+                // (
+                //   <el-dialog
+                //     {...{ attrs: data }}
+                //     class={data.className}
+                //     visible={this.visible}
+                //     beforeClose={this.close}
+                //   >
+                //     <ibps-dialog-component onSubmit={this.submit} onCancel={this.cancel} {...options} />
+                //     <div v-if={footer} slot='footer' >
+                //       测试
+                //     </div>
+                //   </el-dialog>
+                // )
+            }
+        })
+        cb && cb(template)
+    })
+}

+ 5 - 0
src/utils/index.js

@@ -0,0 +1,5 @@
+import common from './common'
+
+export default {
+    ...common
+}

+ 9 - 0
src/utils/seal.js

@@ -0,0 +1,9 @@
+// 微签接口
+
+import { seal,sealPre,getSigPageUrl } from '@/api/platform/form/seal'
+
+export default {
+    seal,
+    sealPre,
+    getSigPageUrl
+}