Forráskód Böngészése

form对象新增更新store方法,修复自定义检测项目表单名称异常bug,部分代码格式化

cfort 3 éve
szülő
commit
ac492943e9

+ 721 - 751
src/business/platform/form/formrender/dynamic-form/dynamic-form.vue

@@ -1,774 +1,744 @@
 <template>
-  <div :class="{ 'jbd-form' : !isDialog}">
-    <div class="jbd-replce"></div>
-  <div class="dynamic-form" :class=" {'jbd-form-cont':!isDialog }">
-    <!--表头-->
-    <div v-if="hasHeader" class="form-header">
-      <div v-if="hasHeader" class="title" style="font-size:22px; font-family:SimHei;"  :class="titlePosition">{{ formDef.processName ? formDef.processName : formDef.name}}
-      <span v-if="formDef && formDef.flowName">{{formDef.flowName}}</span>
-      <relevance-table
-         v-if="titleList.length>0"
-         :list="titleList"
-         :form ="form"
-         />
-       <Statis-or-record-table
-          v-if="StaOrRec.length>0"
-          :StaOrRec="StaOrRec"
-          :form ="form"
-          />
-      </div>
-      <div v-if="hasDesc" class="desc" v-html="$utils.formatText(formDef.desc)" ></div>
+    <div :class="{ 'jbd-form': !isDialog }">
+        <div class="jbd-replce"></div>
+        <div class="dynamic-form" :class="{ 'jbd-form-cont': !isDialog }">
+            <!--表头-->
+            <div v-if="hasHeader" class="form-header">
+                <div v-if="hasHeader" class="title" style="font-size: 22px; font-family: SimHei" :class="titlePosition">
+                    {{ formDef.processName ? formDef.processName : formDef.name }}
+                    <span v-if="formDef && formDef.flowName">{{ formDef.flowName }}</span>
+                    <relevance-table
+                        v-if="titleList.length > 0 && formParams.formAttrs.customClass.includes('true')"
+                        :list="titleList"
+                        :form="form"
+                    />
+                    <Statis-or-record-table
+                        v-if="StaOrRec.length > 0"
+                        :StaOrRec="StaOrRec"
+                        :form="form"
+                    />
+                </div>
+                <div v-if="hasDesc" class="desc" v-html="$utils.formatText(formDef.desc)"></div>
+            </div>
+            <!--表单-->
+            <el-form
+                ref="form"
+                :model="models"
+                :inline="inline"
+                :label-suffix="labelSuffix"
+                :label-width="labelWidth"
+                :label-position="labelPosition"
+                :status-icon="statusIcon"
+                :size="size"
+                :hide-required-asterisk="hideRequiredAsterisk"
+                :class="customClass"
+                @submit.native.prevent
+            >
+                <template v-for="(item, index) in formDef.fields">
+                    <!--嵌套布局-->
+                    <component
+                        :is="'ibps-dynamic-form-' + item.field_type"
+                        v-if="item.field_type === 'grid' || item.field_type === 'tabs' || item.field_type === 'collapse' || item.field_type === 'steps'"
+                        :ref="'formItem' + item.name"
+                        :key="index"
+                        :models.sync="models"
+                        :rights.sync="rights"
+                        :form-data="models"
+                        :field="item"
+                        :code="code"
+                        :params="formParams"
+                        :cur-active-step.sync="activeStep"
+                    />
+                    <!--其他类型-->
+                    <ibps-dynamic-form-item
+                        v-else
+                        :ref="'formItem' + item.name"
+                        :key="index"
+                        :models.sync="models"
+                        :rights.sync="rights"
+                        :form-data="models"
+                        :field="item"
+                        :code="code"
+                        :params="formParams"
+                    />
+                </template>
+            </el-form>
+        </div>
     </div>
-    <!--表单-->
-   <el-form
-      ref="form"
-      :model="models"
-      :inline="inline"
-      :label-suffix="labelSuffix"
-      :label-width="labelWidth"
-      :label-position="labelPosition"
-      :status-icon="statusIcon"
-      :size="size"
-      :hide-required-asterisk="hideRequiredAsterisk"
-      :class="customClass"
-      @submit.native.prevent
-    >
-      <template v-for="(item,index) in formDef.fields">
-        <!--嵌套布局-->
-        <component
-          :is="'ibps-dynamic-form-'+item.field_type"
-          v-if="item.field_type === 'grid' || item.field_type === 'tabs' || item.field_type === 'collapse' || item.field_type === 'steps'"
-          :ref="'formItem'+item.name"
-          :key="index"
-          :models.sync="models"
-          :rights.sync="rights"
-          :form-data="models"
-          :field="item"
-          :code="code"
-          :params="formParams"
-          :cur-active-step.sync="activeStep"
-        />
-        <!--其他类型-->
-        <ibps-dynamic-form-item
-          v-else
-          :ref="'formItem'+item.name"
-          :key="index"
-          :models.sync="models"
-          :rights.sync="rights"
-          :form-data="models"
-          :field="item"
-          :code="code"
-          :params="formParams"
-        />
-      </template>
-    </el-form>
-  </div>
- </div>
 </template>
 
 <script>
-import Vue from 'vue'
+    import Vue from 'vue'
 
-import { nestedFieldTypes } from '@/business/platform/form/constants/fieldTypes'
-import FormOptions from '../../constants/formOptions'
-import FormUtils from '../../utils/formUtil'
-import relevanceTable from './mixins/relevanceTable'
-import StatisOrRecordTable from './mixins/StatisOrRecordTable'
+    import { nestedFieldTypes } from '@/business/platform/form/constants/fieldTypes'
+    import FormOptions from '../../constants/formOptions'
+    import FormUtils from '../../utils/formUtil'
+    import relevanceTable from './mixins/relevanceTable'
+    import StatisOrRecordTable from './mixins/StatisOrRecordTable'
 
-import DynamicFormItem from './dynamic-form-item'
-import DynamicFormField from './dynamic-form-field'
-import DynamicFormOther from './dynamic-form-other'
-import DynamicFormOpinion from './components/approval-opinion'
-import DynamicFormGrid from './dynamic-form-grid'
-import DynamicFormTabs from './dynamic-form-tabs'
-import DynamicFormSteps from './dynamic-form-steps'
-import DynamicFormCollapse from './dynamic-form-collapse'
-import DynamicFormTable from './dynamic-form-table'
-import DynamicFormTableItem from './dynamic-form-table-item'
-import DynamicFormTableBlock from './dynamic-form-table-block'
-/* import templateList from '@/views/platform/data/dataTemplate/template-list.vue' */
+    import DynamicFormItem from './dynamic-form-item'
+    import DynamicFormField from './dynamic-form-field'
+    import DynamicFormOther from './dynamic-form-other'
+    import DynamicFormOpinion from './components/approval-opinion'
+    import DynamicFormGrid from './dynamic-form-grid'
+    import DynamicFormTabs from './dynamic-form-tabs'
+    import DynamicFormSteps from './dynamic-form-steps'
+    import DynamicFormCollapse from './dynamic-form-collapse'
+    import DynamicFormTable from './dynamic-form-table'
+    import DynamicFormTableItem from './dynamic-form-table-item'
+    import DynamicFormTableBlock from './dynamic-form-table-block'
+    // import templateList from '@/views/platform/data/dataTemplate/template-list.vue'
 
-Vue.component('ibps-dynamic-form-item', DynamicFormItem)
-Vue.component('ibps-dynamic-form-field', DynamicFormField)
-Vue.component('ibps-dynamic-form-other', DynamicFormOther)
-Vue.component('ibps-dynamic-form-opinion', DynamicFormOpinion)
-Vue.component('ibps-dynamic-form-grid', DynamicFormGrid)
-Vue.component('ibps-dynamic-form-tabs', DynamicFormTabs)
-Vue.component('ibps-dynamic-form-steps', DynamicFormSteps)
-Vue.component('ibps-dynamic-form-collapse', DynamicFormCollapse)
-Vue.component('ibps-dynamic-form-table', DynamicFormTable)
-Vue.component('ibps-dynamic-form-table-item', DynamicFormTableItem)
-Vue.component('ibps-dynamic-form-table-block', DynamicFormTableBlock)
-/* Vue.component('template-list', templateList) */
+    Vue.component('ibps-dynamic-form-item', DynamicFormItem)
+    Vue.component('ibps-dynamic-form-field', DynamicFormField)
+    Vue.component('ibps-dynamic-form-other', DynamicFormOther)
+    Vue.component('ibps-dynamic-form-opinion', DynamicFormOpinion)
+    Vue.component('ibps-dynamic-form-grid', DynamicFormGrid)
+    Vue.component('ibps-dynamic-form-tabs', DynamicFormTabs)
+    Vue.component('ibps-dynamic-form-steps', DynamicFormSteps)
+    Vue.component('ibps-dynamic-form-collapse', DynamicFormCollapse)
+    Vue.component('ibps-dynamic-form-table', DynamicFormTable)
+    Vue.component('ibps-dynamic-form-table-item', DynamicFormTableItem)
+    Vue.component('ibps-dynamic-form-table-block', DynamicFormTableBlock)
+    // Vue.component('template-list', templateList)
 
-// Vue.component('ibps-dynamic-form-layout-table', DynamicFormLayoutTable)
+    // Vue.component('ibps-dynamic-form-layout-table', DynamicFormLayoutTable)
 
-export default {
-  components:{
-    relevanceTable,
-    StatisOrRecordTable
-    },
-  provide() {
-    return {
-      dynamicForm: this
-    }
-  },
-  props: {
-    isDialog: {
-      type: Boolean,
-      default: false
-    },
-    form:{
-       type: Object
-    },
-    dynamicParams:{
-       type: Object
-      },
-    formDef: {
-      type: Object,
-      required: true
-    },
-    value: {
-      type: Object
-    },
-    readonly: {
-      type: Boolean,
-      default: false
-    },
-    permissions: {
-      type: Object
-    },
-    BpmnForm:{
-      type: Boolean,
-      default: false
-    },
-    validateImmediately: { // 是否初始验证
-      type: Boolean,
-      default: true
-    },
-    initialization: {
-      type: Boolean,
-      default: false
-    },
-    // 扩展参数
-    params: Object,
-    // 当前激活步骤
-    curActiveStep: Number
-  },
-  data() {
-    return {
-      models: {}, // 表单model对象数据
-      rights: {}, // 表单权限
-      responseFormula: {}, // 公式
-      responseLinkages: {}, // 联动数据
-      responseVerifys: [], // 表单提交校验
-      responseOpinionFields: {}, // 表单的意见字段
-      responseFormOpinionData: {}, // 已填写的表单意见
-      responseLabelFields: {}, // 表单的文本字段
-      invalidFields: {},
-      activeStep: 0,
-      titleList:[],
-      StaOrRec:[],
-    }
-  },
-  computed: {
-    formAttrs() {
-      return this.formDef ? this.formDef.attrs || {} : {}
-    },
-    hasHeader() {
-      return this.formAttrs && !this.formAttrs.hide_name
-    },
-    hasDesc() {
-      return this.formAttrs && !this.formAttrs.hide_desc && this.formDef.desc
-    },
-    titlePosition() {
-      if (this.formAttrs.title_position === 'center') {
-        return 'ibps-tc'
-      } else if (this.formAttrs.title_position === 'right') {
-        return 'ibps-tr'
-      } else {
-        return ''
-      }
-    },
-    size() {
-      return this.formAttrs.size || (this.$ELEMENT || {}).size
-    },
-    inline() {
-      return this.formAttrs.inline || false
-    },
-    labelSuffix() {
-      return this.formAttrs ? (this.formAttrs.colon ? this.formAttrs.labelSuffix || ':' : '') : ''
-    },
-    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.labelPosition) ? this.formAttrs.labelPosition : 'right'
-    },
-    descPosition() {
-      return this.$utils.isNotEmpty(this.formAttrs.descPosition) ? this.formAttrs.descPosition || 'inline' : 'inline'
-    },
-    customClass() {
-      return this.$utils.isNotEmpty(this.formAttrs.customClass) ? this.formAttrs.customClass : null
-    },
-    statusIcon() {
-      return this.$utils.isNotEmpty(this.formAttrs.statusIcon) ? this.formAttrs.statusIcon : false
-    },
-    hideRequiredAsterisk() {
-      return this.$utils.toBoolean(this.formAttrs.hideRequiredAsterisk, false)
-    },
-    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.script) : false
-    },
-    formParams() {
-      const params = {
-        responseFormula: this.responseFormula,
-        responseLinkages: this.responseLinkages,
-        responseFormOpinionData: this.responseFormOpinionData,
-        readonly: this.readonly,
-        readonlyStyle: this.readonlyStyle,
-        labelWidth: this.labelWidth,
-        labelSuffix: this.labelSuffix,
-        descPosition: this.descPosition,
-        formAttrs: this.formAttrs,
-        invalidFields: this.invalidFields
-      }
-      return Object.assign(params, this.params)
-    }
-  },
-  watch: {
-    formDef: {
-      handler(val) {
-        this.initResponseFields()
-      },
-      deep: true,
-      immediate: true
-    },
-    /* models: {
-      handler(val) {
-        // 延迟验证
-        this.$nextTick(() => {
-          this.validate(() => {})
-        })
-      },
-      deep: true
-    },
-    initialization(val) {
-      if (val && this.hasScript) {
-        this.$emit('load-script')
-      }
-    },
-    curActiveStep(val) {
-      this.activeStep = val
-    },
-    activeStep(val, oldVal) {
-      if (val !== oldVal) {
-        this.$emit('update:cur-active-step', val)
-      }
-    }
-  },
-
-  mounted() {
-    // 初始化脚本
-   /* this.$nextTick(() => {
-      if (this.validateImmediately) {
-        this.validate(() => {})
-      }
-    }) */
-  },
-  mounted() {
-   this.titleList=[]
-   this.StaOrRec=[]
-   /*   form:{
-       type: Object
-    },
-    dynamicParams:{
-       type: Object
-      },
-    formDef: {
-      type: Object,
-      required: true
-    },
-    value: {
-      type: Object
-    },
-    readonly: {
-      type: Boolean,
-      default: false
-    },
-    permissions: {
-      type: Object
-    },
-    BpmnForm:{
-      type: Boolean,
-      default: false
-    },*/
-  },
-  methods: {
-    /**
-     * 初始化字段
-     */
-    async initResponseFields() {
-      let fields
-      if(this.formDef && this.formDef.fields) 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 (nestedFieldTypes.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 || []
+    export default {
+        components: {
+            relevanceTable,
+            StatisOrRecordTable
+        },
+        provide() {
+            return {
+                dynamicForm: this
             }
-          } 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) {
-                  const defaultValue = await FormUtils.getFieldDefaultValue(field)
-                  this.models[fieldName] = defaultValue
+        },
+        props: {
+            isDialog: {
+                type: Boolean,
+                default: false
+            },
+            form: {
+                type: Object
+            },
+            dynamicParams: {
+                type: Object
+            },
+            formDef: {
+                type: Object,
+                required: true
+            },
+            value: {
+                type: Object
+            },
+            readonly: {
+                type: Boolean,
+                default: false
+            },
+            permissions: {
+                type: Object
+            },
+            BpmnForm: {
+                type: Boolean,
+                default: false
+            },
+            validateImmediately: {
+                // 是否初始验证
+                type: Boolean,
+                default: true
+            },
+            initialization: {
+                type: Boolean,
+                default: false
+            },
+            // 扩展参数
+            params: Object,
+            // 当前激活步骤
+            curActiveStep: Number
+        },
+        data() {
+            return {
+                models: {}, // 表单model对象数据
+                rights: {}, // 表单权限
+                responseFormula: {}, // 公式
+                responseLinkages: {}, // 联动数据
+                responseVerifys: [], // 表单提交校验
+                responseOpinionFields: {}, // 表单的意见字段
+                responseFormOpinionData: {}, // 已填写的表单意见
+                responseLabelFields: {}, // 表单的文本字段
+                invalidFields: {},
+                activeStep: 0,
+                titleList: [],
+                StaOrRec: []
+            }
+        },
+        computed: {
+            formAttrs() {
+                return this.formDef ? this.formDef.attrs || {} : {}
+            },
+            hasHeader() {
+                return this.formAttrs && !this.formAttrs.hide_name
+            },
+            hasDesc() {
+                return this.formAttrs && !this.formAttrs.hide_desc && this.formDef.desc
+            },
+            titlePosition() {
+                if (this.formAttrs.title_position === 'center') {
+                    return 'ibps-tc'
+                } else if (this.formAttrs.title_position === 'right') {
+                    return 'ibps-tr'
+                } else {
+                    return ''
+                }
+            },
+            size() {
+                return this.formAttrs.size || (this.$ELEMENT || {}).size
+            },
+            inline() {
+                return this.formAttrs.inline || false
+            },
+            labelSuffix() {
+                return this.formAttrs ? (this.formAttrs.colon ? this.formAttrs.labelSuffix || ':' : '') : ''
+            },
+            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.labelPosition) ? this.formAttrs.labelPosition : 'right'
+            },
+            descPosition() {
+                return this.$utils.isNotEmpty(this.formAttrs.descPosition) ? this.formAttrs.descPosition || 'inline' : 'inline'
+            },
+            customClass() {
+                return this.$utils.isNotEmpty(this.formAttrs.customClass) ? this.formAttrs.customClass : null
+            },
+            statusIcon() {
+                return this.$utils.isNotEmpty(this.formAttrs.statusIcon) ? this.formAttrs.statusIcon : false
+            },
+            hideRequiredAsterisk() {
+                return this.$utils.toBoolean(this.formAttrs.hideRequiredAsterisk, false)
+            },
+            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.script) : false
+            },
+            formParams() {
+                const params = {
+                    responseFormula: this.responseFormula,
+                    responseLinkages: this.responseLinkages,
+                    responseFormOpinionData: this.responseFormOpinionData,
+                    readonly: this.readonly,
+                    readonlyStyle: this.readonlyStyle,
+                    labelWidth: this.labelWidth,
+                    labelSuffix: this.labelSuffix,
+                    descPosition: this.descPosition,
+                    formAttrs: this.formAttrs,
+                    invalidFields: this.invalidFields
                 }
-              } else {
-                this.models[fieldName] = await this.getInitData(field, data)
-              }
-            } else { // 默认值
-              this.models[fieldName]  = await FormUtils.getFieldDefaultValue(field)
-              if(this.dynamicParams && this.dynamicParams[field.field_name]){
-                  this.models[fieldName] = this.dynamicParams[field.field_name]
-                  }
+                return Object.assign(params, this.params)
             }
-          }
-          // 初始化表单扩展参数
-          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
-            } */
-          }
-        }
-      } else {
-        for (const key in this.responseOpinionFields) {
-          if (this.responseOpinionFields.hasOwnProperty(key)) {
-            this.responseFormOpinionData[key] = opinionData.opinionList
-          }
-        }
-      }
-    },
-    /**
-     * 表单提交校验
-     */
-    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
-    },
-    /**
-     *  是否有审批意见字段
-     */
-    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 ||
-        this.rights[key] === 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)) {
-             this.models[key] = '退回修改 / 驳回'
-          }
-        }
-      } else {
-        for (const key in this.responseOpinionFields) {
-          if (this.$utils.isEmpty(this.models[key]) && this.rights[key] === FormOptions.t.PERMISSIONS.REQUIRED) {
-            i++
-          }
-        }
-      }
+        },
+        watch: {
+            formDef: {
+                handler(val) {
+                    this.initResponseFields()
+                },
+                deep: true,
+                immediate: true
+            },
+            // models: {
+            //     handler (val) {
+            //         // 延迟验证
+            //         this.$nextTick(() => {
+            //             this.validate(() => { })
+            //         })
+            //     },
+            //     deep: true
+            // },
+            // initialization (val) {
+            //     if (val && this.hasScript) {
+            //         this.$emit('load-script')
+            //     }
+            // },
+            // curActiveStep (val) {
+            //     this.activeStep = val
+            // },
+            // activeStep (val, oldVal) {
+            //     if (val !== oldVal) {
+            //         this.$emit('update:cur-active-step', val)
+            //     }
+            // }
+        },
+        mounted() {
+            // 初始化脚本
+            // this.$nextTick(() => {
+            //     if (this.validateImmediately) {
+            //         this.validate(() => {})
+            //     }
+            // }) 
+            this.titleList = []
+            this.StaOrRec = []
+        },
+        methods: {
+            /**
+             * 初始化字段
+             */
+            async initResponseFields() {
+                let fields
+                if (this.formDef && this.formDef.fields) 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 (i > 0) {
-        callback(false)
-      } else {
-        callback(true)
-      }
-    },
-    /**
-     * 表单验证
-     */
-    validate(callback) {
-      // 先移除校验再进行校验
-     this.$refs.form.clearValidate()
-      this.$refs.form.validate((valid, invalidFields) => {
-        this.invalidFields = invalidFields
-        if (callback) callback(valid, invalidFields)
-      })
-    },
-    //表单关联
-    getTableList(list){
-          this.titleList = list
-      },
-      /* 将对象参数传入, 进行渲染 */
-    getStatisOrRecord(type){
-          this.StaOrRec = type
-    },
-    /**
-     * 获取表单字段的具体控件组件实例
-     */
-  /*  getRefsField(fieldName) {
-      const refs = this.getRefs(fieldName)
-      if (this.$utils.isEmpty(refs) || this.$utils.isEmpty(refs[0]) || this.$utils.isEmpty(refs[0].$refs) || this.$utils.isEmpty(refs[0].$refs['formField'])) {
-        return null
-      }
-      return refs[0].$refs.formField
-    },
-    getRefs(fieldName) {
-      const key = 'formItem' + fieldName
-      return this.getDynamicRefs(this.$refs, key)
-    },
-    getDynamicRefs(formRefs, key) {
-      if (this.$utils.isEmpty(formRefs)) {
-        return
-      }
-      for (const refKey in formRefs) {
-        const formRef = formRefs[refKey]
-        if (refKey === key) { return formRef }
-        for (let j = 0; j < formRef.length; j++) {
-          const refs = formRef[j]
-          const v = this.getDynamicRefs(refs.$refs, key)
-          if (v) {
-            return v
-          }
+                    if (nestedFieldTypes.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) {
+                                        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)
+                                if (this.dynamicParams && this.dynamicParams[field.field_name]) {
+                                    this.models[fieldName] = this.dynamicParams[field.field_name]
+                                }
+                            }
+                        }
+                        // 初始化表单扩展参数
+                        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
+                            } */
+                        }
+                    }
+                } else {
+                    for (const key in this.responseOpinionFields) {
+                        if (this.responseOpinionFields.hasOwnProperty(key)) {
+                            this.responseFormOpinionData[key] = opinionData.opinionList
+                        }
+                    }
+                }
+            },
+            /**
+             * 表单提交校验
+             */
+            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
+            },
+            /**
+             *  是否有审批意见字段
+             */
+            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 || this.rights[key] === 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)) {
+                            this.models[key] = '退回修改 / 驳回'
+                        }
+                    }
+                } 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)
+                }
+            },
+            /**
+             * 表单验证
+             */
+            validate(callback) {
+                // 先移除校验再进行校验
+                this.$refs.form.clearValidate()
+                this.$refs.form.validate((valid, invalidFields) => {
+                    this.invalidFields = invalidFields
+                    if (callback) callback(valid, invalidFields)
+                })
+            },
+            //表单关联
+            getTableList(list) {
+                this.titleList = list
+            },
+            // 将对象参数传入, 进行渲染
+            getStatisOrRecord(type) {
+                this.StaOrRec = type
+            }
+            /**
+             * 获取表单字段的具体控件组件实例
+             */
+            // getRefsField (fieldName) {
+            //     const refs = this.getRefs(fieldName)
+            //     if (this.$utils.isEmpty(refs) || this.$utils.isEmpty(refs[0]) || this.$utils.isEmpty(refs[0].$refs) || this.$utils.isEmpty(refs[0].$refs['formField'])) {
+            //         return null
+            //     }
+            //     return refs[0].$refs.formField
+            // },
+            // getRefs (fieldName) {
+            //     const key = 'formItem' + fieldName
+            //     return this.getDynamicRefs(this.$refs, key)
+            // },
+            // getDynamicRefs (formRefs, key) {
+            //     if (this.$utils.isEmpty(formRefs)) {
+            //         return
+            //     }
+            //     for (const refKey in formRefs) {
+            //         const formRef = formRefs[refKey]
+            //         if (refKey === key) { return formRef }
+            //         for (let j = 0; j < formRef.length; j++) {
+            //             const refs = formRef[j]
+            //             const v = this.getDynamicRefs(refs.$refs, key)
+            //             if (v) {
+            //                 return v
+            //             }
+            //         }
+            //     }
+            // }
         }
-      }
-    } */
-  }
-}
+    }
 </script>
 
 <style lang="scss">
-  .jbd-form{
-    padding: 0;
-    margin: 0;
-   margin-top: 85px !important;
-  }
-
-  .jbd-form-cont{
-    background-color: #FFFFFF;
-    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-    margin:0 auto;
-    padding: 10px;
-    min-height: 92vh;
-    width:84%;
-  }
-.jbd-replce{
-  height: 5px;
-}
-.dynamic-form {
-  .el-input{
-    width: 100%;
-  }
-  .el-select{
-    width: 100%;
-  }
-
-  .el-collapse-item__header.is-active{
-    border-bottom: 1px solid #EBEEF5;
-    margin-bottom: 5px;
-  }
-  .form-header {
-    border-bottom: 1px solid #2b34410d;
-    margin-bottom: 5px;
-    .title {
-      font-weight: bold;
-      color: #222;
-      text-align: left;
-      padding: 8px 10px 10px;
-      margin: 0;
-    }
-    .desc {
-      word-wrap: break-word;
-      word-break: normal;
-      text-indent: 0;
-      line-height: 1.6;
-      margin: 0 0 11px;
-      padding: 3px 30px 8px;
-    }
-  }
-  .dynamic-form-table-item__readonly{
-     margin-bottom: 0;
-  }
-
-//===================border-form====================
-    .ibps-border-form {
-      border: 1px solid #cfd7e5;
-
-      .el-form-item{
-        border-top: 1px solid #cfd7e5;
-      }
-
-      .el-form-item__content:before {
-        width: 1px;
-        background: #cfd7e5;
-        display: block;
-        content: "";
-        position: absolute;
-        left: 0;
-        top: 0;
-        bottom:-20px;
-      }
-
-    .el-form-item__content .el-form-item__error {
-      left: 5px
-    }
-
-    .el-form--label-top .el-form-item__content:before,
-    .no-label-form-item .el-form-item__content:before {
-      background: transparent
-    }
-
-    .el-row+.el-row {
-      border-top: 1px solid #cfd7e5
-    }
-
-    .el-col+.el-col {
-      border-left: 1px solid #cfd7e5
-    }
-
-    .el-col {
-      overflow: hidden
+    .jbd-form {
+        padding: 0;
+        margin: 0;
+        margin-top: 85px !important;
     }
-
-    .el-form-item__content {
-      padding: 5px;
-      padding-bottom: 0
+    .jbd-form-cont {
+        background-color: #ffffff;
+        box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+        margin: 0 auto;
+        padding: 10px;
+        min-height: 92vh;
+        width: 84%;
     }
-
-    .el-form-item__label {
-      padding: 5px
+    .jbd-replce {
+        height: 5px;
     }
-
-    .el-table{
-      .el-form-item{
-          border-top: 0;
-      }
-      .el-form-item__content:before {
-        width: 0;
-      }
-      .el-form-item__content {
-        padding: 0;
-      }
-
+    .dynamic-form {
+        .el-input {
+            width: 100%;
+        }
+        .el-select {
+            width: 100%;
+        }
+        .el-collapse-item__header.is-active {
+            border-bottom: 1px solid #ebeef5;
+            margin-bottom: 5px;
+        }
+        .form-header {
+            border-bottom: 1px solid #2b34410d;
+            margin-bottom: 5px;
+            .title {
+                font-weight: bold;
+                color: #222;
+                text-align: left;
+                padding: 8px 10px 10px;
+                margin: 0;
+            }
+            .desc {
+                word-wrap: break-word;
+                word-break: normal;
+                text-indent: 0;
+                line-height: 1.6;
+                margin: 0 0 11px;
+                padding: 3px 30px 8px;
+            }
+        }
+        .dynamic-form-table-item__readonly {
+            margin-bottom: 0;
+        }
+        //===================border-form====================
+        .ibps-border-form {
+            border: 1px solid #cfd7e5;
+            .el-form-item {
+                border-top: 1px solid #cfd7e5;
+            }
+            .el-form-item__content:before {
+                width: 1px;
+                background: #cfd7e5;
+                display: block;
+                content: '';
+                position: absolute;
+                left: 0;
+                top: 0;
+                bottom: -20px;
+            }
+            .el-form-item__content .el-form-item__error {
+                left: 5px;
+            }
+            .el-form--label-top .el-form-item__content:before,
+            .no-label-form-item .el-form-item__content:before {
+                background: transparent;
+            }
+            .el-row + .el-row {
+                border-top: 1px solid #cfd7e5;
+            }
+            .el-col + .el-col {
+                border-left: 1px solid #cfd7e5;
+            }
+            .el-col {
+                overflow: hidden;
+            }
+            .el-form-item__content {
+                padding: 5px;
+                padding-bottom: 0;
+            }
+            .el-form-item__label {
+                padding: 5px;
+            }
+            .el-table {
+                .el-form-item {
+                    border-top: 0;
+                }
+                .el-form-item__content:before {
+                    width: 0;
+                }
+                .el-form-item__content {
+                    padding: 0;
+                }
+            }
+        }
     }
-
-  }
-
-}
 </style>

+ 567 - 578
src/business/platform/form/formrender/index.vue

@@ -1,596 +1,585 @@
 <template>
-  <div v-if="formPage">
-    <ibps-watermark :disabled="!enableWatermark" :text="watermarkText">
-      <!--顶部按钮-->
-      <template v-if="hasActions">
-        <div
-          v-sticky="{stickyTop:marginTop}"
-          class="form-toolbar hidden-print"
-        >
-          <div
-            :class="['ibps-toolbar--' +$ELEMENT.size]"
-            class="ibps-toolbar"
-          >
-             <panle/>
-
-            <div class="header" style="height: 30px;">
-              <div class="buttons" style="float: right;margin-right:8%;">
-                <ibps-toolbar
-                  ref="toolbar"
-                  :actions="actions.reverse()"
-                  @action-event="handleButtonEvent"
-                />
-              </div>
-              <!--步骤条按钮-->
-              <div v-if="hasStepButton" class="buttons ibps-pr-10 ibps-fr-important">
-                <el-button
-                  v-for="button in stepButtons"
-                  :key="button.key"
-                  :size="button.size||$ELEMENT.size"
-                  :icon="'ibps-icon-'+button.icon"
-                  :autofocus="false"
-                  :disabled="disabledStepButton(button.key)"
-                  :loading="stepLoading"
-                  @click="()=>{ handleStepButtonEvent(button)}"
-                >{{ button.label }}
-                </el-button>
-              </div>
-            </div>
-          </div>
-        </div>
-      </template>
-      <!--表单-->
-      <dynamic-form
-        ref="dynamicForm"
-        v-model="formData"
-        :form-def="formDefData"
-        :form = "this"
-        :permissions="permissions"
-        :readonly="readonly"
-        :params="params"
-        :dynamicParams = "dynamicParams"
-        :initialization="initialization"
-        :cur-active-step.sync="curActiveStep"
-        :isDialog="isDialog"
-        class="form-container"
-        :style="{
-          marginTop:hasActions? marginTop+'px':'0'
-        }"
-      />
-      <component
-        :is="dialogTemplate"
-        v-if="dialogTemplate"
-        ref="dialogTemplate"
-        v-bind="dialogTemplateAtts"
-      />
-      <component
-        :is="customComponent"
-        v-if="customComponent"
-        ref="customComponent"
-        v-bind="customComponentAtts"
-      />
-    </ibps-watermark>
-  </div>
+    <div v-if="formPage">
+        <ibps-watermark :disabled="!enableWatermark" :text="watermarkText">
+            <!--顶部按钮-->
+            <template v-if="hasActions">
+                <div v-sticky="{ stickyTop: marginTop }" class="form-toolbar hidden-print">
+                    <div :class="['ibps-toolbar--' + $ELEMENT.size]" class="ibps-toolbar">
+                        <panle />
+                        <div class="header" style="height: 30px">
+                            <div class="buttons" style="float: right; margin-right: 8%">
+                                <ibps-toolbar
+                                    ref="toolbar"
+                                    :actions="actions.reverse()"
+                                    @action-event="handleButtonEvent"
+                                />
+                            </div>
+                            <!--步骤条按钮-->
+                            <div v-if="hasStepButton" class="buttons ibps-pr-10 ibps-fr-important">
+                                <el-button
+                                    v-for="button in stepButtons"
+                                    :key="button.key"
+                                    :size="button.size || $ELEMENT.size"
+                                    :icon="'ibps-icon-' + button.icon"
+                                    :autofocus="false"
+                                    :disabled="disabledStepButton(button.key)"
+                                    :loading="stepLoading"
+                                    @click="() => { handleStepButtonEvent(button) }"
+                                >
+                                    {{ button.label }}
+                                </el-button>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </template>
+            <!--表单-->
+            <dynamic-form
+                ref="dynamicForm"
+                v-model="formData"
+                :form-def="formDefData"
+                :form="this"
+                :permissions="permissions"
+                :readonly="readonly"
+                :params="params"
+                :dynamicParams="dynamicParams"
+                :initialization="initialization"
+                :cur-active-step.sync="curActiveStep"
+                :isDialog="isDialog"
+                class="form-container"
+                :style="{ marginTop: hasActions ? marginTop + 'px' : '0' }"
+            />
+            <component
+                :is="dialogTemplate"
+                v-if="dialogTemplate"
+                ref="dialogTemplate"
+                v-bind="dialogTemplateAtts"
+            />
+            <component
+                :is="customComponent"
+                v-if="customComponent"
+                ref="customComponent"
+                v-bind="customComponentAtts"
+            />
+        </ibps-watermark>
+    </div>
 </template>
 
 <script>
-import ActionUtils from '@/utils/action'
-import JForm from '../utils/JForm'// 自定义脚本
-import DynamicForm from './dynamic-form/dynamic-form'
-import IbpsWatermark from '@/components/ibps-watermark'
-import panle from '@/components/jbd-panel'
+    import ActionUtils from '@/utils/action'
+    import JForm from '../utils/JForm' // 自定义脚本
+    import DynamicForm from './dynamic-form/dynamic-form'
+    import IbpsWatermark from '@/components/ibps-watermark'
+    import panle from '@/components/jbd-panel'
 
-const JFormId = 'JForm'
+    const JFormId = 'JForm'
 
-export default {
-  components: {
-    DynamicForm,
-     panle,
-    IbpsWatermark
-  },
-  props: {
-    isDialog: {
-        type: Boolean,
-        default: false
-      },
-    formDef: {
-      type: Object,
-      required: true
-    },
-    dynamicParams:{
-      type: Object
-    },
-    addDataCont: { // 表单参数
-      type: Object
-    },
-    data: {
-      type: Object
-    },
-    /**
-     * @description 工具栏
-     */
-    buttons: {
-      type: Array
-    },
-    /**
-     * 是否只读 (流程实例时候控制)
-     */
-    readonly: {
-      type: Boolean,
-      default: false
-    },
-    /**
-     *  @description 扩展参数 比如流程id等
-     *流程相关信息:
-     * taskId:任务id
-     * instanceId:流程实例
-     * defId:定义Id
-     * formOpinionData: 流程意见配置及已经审批的意见数据
-     */
-    params: {
-      type: Object
-    },
-    mode: { // 表单模式
-      type: String
-    }
-  },
-  data() {
-    return {
-      formPage:true,
-      loading: false,
-      formData: {},
-      permissions: null,
-      // actions: [],
-      initialization: false,
-      marginTop: 50,
-      curActiveStep: 0,
-      formParams: {},
-      curTime: new Date().getTime(),
-      stepLoading: false,
-      dialogTemplate: null,
-      dialogTemplateAtts: {},
-       number:0,
-      // 个性定制
-      customComponent: null,
-      customComponentAtts: {}
-    }
-  },
-  computed: {
-    formDefData() {
-      return JSON.parse(JSON.stringify(this.formDef))
-    },
-    hasActions() {
-      return this.hasStepButton || this.actions && this.actions.length > 0
-    },
-    dynamicForm() {
-      return this.$refs ? this.$refs.dynamicForm : null
-    },
-    hasStepButton() {
-      return this.$utils.isNotEmpty(this.stepButtons) && this.mode !== 'dialog'
-    },
-    stepNum() {
-      if (this.$utils.isEmpty(this.step)) {
-        return 0
-      }
-      return this.step.field_options.columns.length
-    },
-    finishStep() {
-      return this.stepNum - 1 === this.curActiveStep
-    },
-    actions() {
-      return this.getActions()
-    },
-    stepButtons() {
-      return this.getStepButtons()
-    },
-    step() {
-      return this.getFormStep()
-    },
-    enableWatermark() {
+    export default {
+        components: {
+            DynamicForm,
+            panle,
+            IbpsWatermark
+        },
+        props: {
+            isDialog: {
+                type: Boolean,
+                default: false
+            },
+            formDef: {
+                type: Object,
+                required: true
+            },
+            dynamicParams: {
+                type: Object
+            },
+            // 表单参数
+            addDataCont: {
+                type: Object
+            },
+            data: {
+                type: Object
+            },
+            /**
+             * @description 工具栏
+             */
+            buttons: {
+                type: Array
+            },
+            /**
+             * 是否只读 (流程实例时候控制)
+             */
+            readonly: {
+                type: Boolean,
+                default: false
+            },
+            /**
+             *  @description 扩展参数 比如流程id等
+             * 流程相关信息:
+             * taskId:任务id
+             * instanceId:流程实例
+             * defId:定义Id
+             * formOpinionData: 流程意见配置及已经审批的意见数据
+             */
+            params: {
+                type: Object
+            },
+            mode: {
+                // 表单模式
+                type: String
+            }
+        },
+        data() {
+            return {
+                formPage: true,
+                loading: false,
+                formData: {},
+                permissions: null,
+                // actions: [],
+                initialization: false,
+                marginTop: 50,
+                curActiveStep: 0,
+                formParams: {},
+                curTime: new Date().getTime(),
+                stepLoading: false,
+                dialogTemplate: null,
+                dialogTemplateAtts: {},
+                number: 0,
+                // 个性定制
+                customComponent: null,
+                customComponentAtts: {}
+            }
+        },
+        computed: {
+            formDefData() {
+                return JSON.parse(JSON.stringify(this.formDef))
+            },
+            hasActions() {
+                return this.hasStepButton || (this.actions && this.actions.length > 0)
+            },
+            dynamicForm() {
+                return this.$refs ? this.$refs.dynamicForm : null
+            },
+            hasStepButton() {
+                return this.$utils.isNotEmpty(this.stepButtons) && this.mode !== 'dialog'
+            },
+            stepNum() {
+                if (this.$utils.isEmpty(this.step)) {
+                    return 0
+                }
+                return this.step.field_options.columns.length
+            },
+            finishStep() {
+                return this.stepNum - 1 === this.curActiveStep
+            },
+            actions() {
+                return this.getActions()
+            },
+            stepButtons() {
+                return this.getStepButtons()
+            },
+            step() {
+                return this.getFormStep()
+            },
+            enableWatermark() {
       return this.formDefData ? (this.formDefData.attrs.watermark || false) : false
-    },
-    watermarkText() {
-      if (this.enableWatermark) {
-        return this.formDefData.attrs.watermarkText || ''
-      }
-      return ''
-    }
-
-  },
-  watch: {
-    formDef: {
-      handler: function(val, oldVal) {
-        if (val && val !== oldVal) {
-          this.initialization = false
-          this.initUI()
-        }
-      },
-      immediate: true
-    },
-    data: {
-      handler: function(val, oldVal) {
-        if (val && val !== oldVal) {
-          const data = JSON.parse(JSON.stringify(val))
-          // 表单数据
-          this.formData = data.responses || {}
-          if( this.addDataCont) this.formData["addDataCont"] = this.addDataCont
-          // 表单权限
-          this.permissions = data.permissions || null
-        }
-      },
-      immediate: true,
-      deep: true
-    },
-    curActiveStep() {
-      this.$emit('cur-active-step', this.curActiveStep)
-    }
-  },
-  created() {
-    this.initUI()
-  },
-  beforeDestroy() {
-    this.formPage = false
-    const script = document.getElementById(JFormId)
-    if (script) {
-      script.parentNode.removeChild(script)
-    }
-   /*清除缓存 */
-    if(this.formDef.key){
-      JForm.cleanEvents()
-    }
-  },
-  methods: {
-    initUI() {
-      if (!this.initialization) {
-        this.initJForm()
-        this.initialization = true
-        this.$nextTick(() => {
-          setTimeout(() => {
-            this.loadScript()
-          }, 10)
-        })
-      }
-    },
-    getActions() {
-      if (this.$utils.isEmpty(this.buttons)) {
-        return []
-      }
-      const actions = []
-      this.buttons.forEach((btn, i) => {
-        const key = btn.getAlias()
-        let disabled = false
-        let hidden = false
-        if (btn.getAlias() !== 'close' && this.hasStepButton && !this.finishStep) {
-          disabled = true
-        }
-
-        hidden = this.onLoadActions(key, btn, 'hidden', hidden)
-        disabled = this.onLoadActions(key, btn, 'disabled', disabled)
-        const this_ = this
-        const button = {
-          key: key,
-          label: btn.getLabel(),
-          icon: btn.getIcon(),
-          type: btn.getType(),
-          disabled: disabled,
-          hidden: hidden,
-          callback: () => {
-
-                     if(btn.key =="agree"){
-                     // 前置事件
-                     this_.$confirm(
-                     			  `确认任务 [ 提交 ] 操作 ?`,
-                     			  "提示:",
-                     			  {
-                     				confirmButtonText: "确定",
-                     				cancelButtonText: "取消",
-                     				type: "warning"
-                     			  }
-                     			).then(() => {
-                                 this.beforeScript(btn.getAlias(), (result) => {
-                                   if (result) {
-                                     return btn.action.apply(this, [btn])
-                                   }
-                                 })
-
-                     			  }).catch(() => {
-                     			   });
+            },
+            watermarkText() {
+                if (this.enableWatermark) {
+                    return this.formDefData.attrs.watermarkText || ''
+                }
+                return ''
+            }
+        },
+        watch: {
+            formDef: {
+                handler: function (val, oldVal) {
+                    if (val && val !== oldVal) {
+                        this.initialization = false
+                        this.initUI()
+                    }
+                },
+                immediate: true
+            },
+            data: {
+                handler: function (val, oldVal) {
+                    if (val && val !== oldVal) {
+                        const data = JSON.parse(JSON.stringify(val))
+                        // 表单数据
+                        this.formData = data.responses || {}
+                        if (this.addDataCont) this.formData['addDataCont'] = this.addDataCont
+                        // 表单权限
+                        this.permissions = data.permissions || null
+                    }
+                },
+                immediate: true,
+                deep: true
+            },
+            curActiveStep() {
+                this.$emit('cur-active-step', this.curActiveStep)
+            }
+        },
+        created() {
+            this.initUI()
+        },
+        beforeDestroy() {
+            this.formPage = false
+            const script = document.getElementById(JFormId)
+            if (script) {
+                script.parentNode.removeChild(script)
+            }
+            /*清除缓存 */
+            if (this.formDef.key) {
+                JForm.cleanEvents()
+            }
+        },
+        methods: {
+            initUI() {
+                if (!this.initialization) {
+                    this.initJForm()
+                    this.initialization = true
+                    this.$nextTick(() => {
+                        setTimeout(() => {
+                            this.loadScript()
+                        }, 10)
+                    })
+                }
+            },
+            getActions() {
+                if (this.$utils.isEmpty(this.buttons)) {
+                    return []
+                }
+                const actions = []
+                this.buttons.forEach((btn, i) => {
+                    const key = btn.getAlias()
+                    let disabled = false
+                    let hidden = false
+                    if (btn.getAlias() !== 'close' && this.hasStepButton && !this.finishStep) {
+                        disabled = true
+                    }
 
-                     }else{
+                    hidden = this.onLoadActions(key, btn, 'hidden', hidden)
+                    disabled = this.onLoadActions(key, btn, 'disabled', disabled)
+                    const this_ = this
+                    const button = {
+                        key: key,
+                        label: btn.getLabel(),
+                        icon: btn.getIcon(),
+                        type: btn.getType(),
+                        disabled: disabled,
+                        hidden: hidden,
+                        callback: () => {
+                            if (btn.key == 'agree') {
+                                // 前置事件
+                                this_.$confirm(`确认任务 [ 提交 ] 操作 ?`, '提示:', {
+                                    confirmButtonText: '确定',
+                                    cancelButtonText: '取消',
+                                    type: 'warning'
+                                }).then(() => {
+                                    this.beforeScript(btn.getAlias(), result => {
+                                        if (result) {
+                                            return btn.action.apply(this, [btn])
+                                        }
+                                    })
+                                }).catch(() => {})
+                            } else {
+                                this.beforeScript(btn.getAlias(), result => {
+                                    if (result) {
+                                        return btn.action.apply(this, [btn])
+                                    }
+                                })
+                            }
+                        }
+                    }
+                    actions.push(button)
+                })
+                return actions
+            },
+            // 自定义格式数据事件
+            onLoadActions: function (key, button, type, defaultVal) {
+                const buttonActionResult = JForm._onLoadActions(this, key, button, type)
+                if (typeof buttonActionResult !== 'undefined' && buttonActionResult) {
+                    return true
+                }
+                return defaultVal
+            },
+            handleButtonEvent(button, position, data, index) {
+                const action = this.actions.find(action => {
+                    return button.key === action.key
+                })
+                if (action) {
+                    action.callback()
+                }
+            },
+            handleActionEvent(actionKey, args = {}) {
+                this.$emit('action-event', actionKey, args)
+            },
+            disabledStepButton(key) {
+                if (key === 'prev') {
+                    return this.curActiveStep === 0
+                } else {
+                    return this.stepNum - 1 === this.curActiveStep
+                }
+            },
+            /** **Step 处理 */
+            getStepButtons() {
+                if (this.$utils.isEmpty(this.step)) {
+                    return []
+                }
+                if (this.$utils.isNotEmpty(this.step.field_options.buttons)) {
+                    return this.step.field_options.buttons
+                } else {
+                    const defaultButtons = [
+                        {
+                            key: 'prev',
+                            icon: 'angle-left',
+                            label: '上一步'
+                        },
+                        {
+                            key: 'next',
+                            icon: 'angle-right',
+                            label: '下一步'
+                        }
+                    ]
+                    return defaultButtons
+                }
+            },
+            getFormStep() {
+                const step = {}
+                if (this.$utils.isEmpty(this.formDef)) {
+                    return
+                }
+                for (let i = 0; i < this.formDef.fields.length; i++) {
+                    const field = this.formDef.fields[i]
+                    if (field.field_type === 'steps') {
+                        return field
+                    }
+                }
+                return step
+            },
+            handleStepButtonEvent(button) {
+                const key = button.key
+                if (key === 'next' && this.curActiveStep === this.stepNum - 1) {
+                    ActionUtils.warning('没有更多')
+                    return
+                }
+                if (key === 'prev' && this.curActiveStep === 0) {
+                    ActionUtils.warning('没有上一步')
+                    return
+                }
+                this.stepLoading = true
+                const curDate = new Date().getTime()
+                let time = 0
+                if (this.curTime + 1500 >= curDate) {
+                    time = 1000
+                }
+                this.curTime = curDate
+                setTimeout(() => {
+                    if (key === 'next') {
+                        this.validate(valid => {
+                            if (valid) {
+                                this.curActiveStep++
+                            } else {
+                                this.formErrorToast()
+                            }
+                        })
+                    } else {
+                        this.curActiveStep--
+                    }
+                    this.stepLoading = false
+                }, time)
+            },
+            callback() {
+                this.$emit('callback')
+            },
+            closeDialog() {
+                this.$emit('close')
+            },
+            getForm() {
+                return this.$refs.dynamicForm
+            },
+            /**
+             * 获取表单验证
+             */
+            validate(callback) {
+                this.getForm().validate((valid, invalidFields) => {
+                    callback(valid, invalidFields)
+                })
+            },
+            formErrorToast(msg) {
+                ActionUtils.saveErrorMessage(msg)
+            },
+            // 处理表单提交验证
+            formSubmitVerify(callback) {
+                if (!this.hasScript()) {
+                    if (callback) {
+                        this.getForm().formSubmitVerify(callback)
+                    }
+                    return
+                }
 
-                           this.beforeScript(btn.getAlias(), (result) => {
-                             if (result) {
-                               return btn.action.apply(this, [btn])
-                             }
-                           })
-                     }
-                   }
-       }
-        actions.push(button)
-      })
-      return actions
-    },
-    // 自定义格式数据事件
-    onLoadActions: function(key, button, type, defaultVal) {
-      const buttonActionResult = JForm._onLoadActions(this, key, button, type)
-      if (typeof (buttonActionResult) !== 'undefined' && buttonActionResult) {
-        return true
-      }
-      return defaultVal
-    },
-    handleButtonEvent(button, position, data, index) {
-      const action = this.actions.find((action) => {
-        return button.key === action.key
-      })
-      if (action) {
-        action.callback()
-      }
-    },
-    handleActionEvent(actionKey, args = {}) {
-      this.$emit('action-event', actionKey, args)
-    },
-    disabledStepButton(key) {
-      if (key === 'prev') {
-        return this.curActiveStep === 0
-      } else {
-        return this.stepNum - 1 === this.curActiveStep
-      }
-    },
-    /** **Step 处理 */
-    getStepButtons() {
-      if (this.$utils.isEmpty(this.step)) {
-        return []
-      }
-      if (this.$utils.isNotEmpty(this.step.field_options.buttons)) {
-        return this.step.field_options.buttons
-      } else {
-        const defaultButtons = [
-          {
-            key: 'prev',
-            icon: 'angle-left',
-            label: '上一步'
-          },
-          {
-            key: 'next',
-            icon: 'angle-right',
-            label: '下一步'
-          }]
-        return defaultButtons
-      }
-    },
-    getFormStep() {
-      const step = {}
-      if (this.$utils.isEmpty(this.formDef)) {
-        return
-      }
-      for (let i = 0; i < this.formDef.fields.length; i++) {
-        const field = this.formDef.fields[i]
-        if (field.field_type === 'steps') {
-          return field
-        }
-      }
-      return step
-    },
-    handleStepButtonEvent(button) {
-      const key = button.key
-      if (key === 'next' && this.curActiveStep === this.stepNum - 1) {
-        ActionUtils.warning('没有更多')
-        return
-      }
-      if (key === 'prev' && this.curActiveStep === 0) {
-        ActionUtils.warning('没有上一步')
-        return
-      }
-      this.stepLoading = true
-      const curDate = new Date().getTime()
-      let time = 0
-      if (this.curTime + 1500 >= curDate) {
-        time = 1000
-      }
-      this.curTime = curDate
-      setTimeout(() => {
-        if (key === 'next') {
-          this.validate(valid => {
-            if (valid) {
-              this.curActiveStep++
-            } else {
-              this.formErrorToast()
+                JForm._onValidate(this, (result, errorMsg) => {
+                    if (!result) {
+                        return callback(result, errorMsg || '验证不通过,请检查表单')
+                    }
+                    this.getForm().formSubmitVerify(callback)
+                })
+            },
+            /**
+             * 获取表单数据
+             */
+            getFormData() {
+                return this.getForm().getFormData()
+            },
+            /**
+             * 获取字段数据
+             */
+            getData(name) {
+                const data = this.getFormData()
+                return data[name]
+            },
+            /**
+             * 设置字段数据
+             */
+            setData(name, value) {
+                return this.getForm().setFieldData(name, value)
+            },
+            /**
+             * 设置表单权限
+             */
+            getFormRights(name) {
+                return this.getForm().getFormRights(name)
+            },
+            /**
+             * 设置表单权限
+             */
+            setFormRights(name, value) {
+                return this.getForm().setFormRights(name, value)
+            },
+            hasFormOpinion() {
+                return this.getForm().hasFormOpinion()
+            },
+            /**
+             * 表单意见数据
+             */
+            getFormOpinionData() {
+                return this.getForm().getFormOpinionData()
+            },
+            /**
+             * 获取审批意见验证
+             */
+            formOpinionValidate(calback, flag) {
+                this.getForm().formOpinionValidate(calback, flag)
+            },
+            /**
+             * 获取表单字段组件实例
+             */
+            getRefs(fieldName) {
+                return this.getForm().getRefs(fieldName)
+            },
+            /**
+             * 获取表单字段的具体控件组件实例
+             */
+            getRefsField(fieldName) {
+                return this.getForm().getRefsField(fieldName)
+            },
+            /* 给与表头赋值关联对话框及数据*/
+            getTableList(list) {
+                return this.getForm().getTableList(list)
+            },
+            /* 获取统计页面或记录页面*/
+            getStatisOrRecord(type) {
+                return this.getForm().getStatisOrRecord(type)
+            },
+            /* 表头点击事件*/
+            clickTableHeand(a) {
+                return this.getForm().clickTableHeand(a)
+            },
+            /**
+             * 初始化脚本
+             */
+            initJForm() {
+                let script = document.getElementById(JFormId)
+                if (script) {
+                    script.parentNode.removeChild(script)
+                }
+                if (this.formDef.attrs && this.formDef.attrs.script) {
+                    const codeScript = this.formDef.attrs.script
+                    script = document.createElement('script')
+                    script.type = 'text/javascript'
+                    script.id = JFormId
+                    document.body.appendChild(script)
+                    try {
+                        script.appendChild(document.createTextNode(codeScript))
+                    } catch (ex) {
+                        console.error(ex)
+                        script.text = codeScript
+                    }
+                    document.body.appendChild(script)
+                }
+            },
+            // 处理脚本
+            hasScript() {
+                return this.getForm().hasScript
+            },
+            // 加载脚本
+            loadScript() {
+                this.$emit('load', this)
+                if (!this.hasScript()) {
+                    return
+                }
+                JForm._onLoad(this, this.getForm)
+            },
+            // 前置脚本
+            beforeScript(action, callback) {
+                if (!this.hasScript()) {
+                    if (callback) {
+                        const flag = true
+                        callback(flag)
+                    }
+                    return
+                }
+                JForm._beforeSubmit(this, action, this.getFormData(), callback)
+            },
+            // 后置脚本
+            afterScript(action, params, callback) {
+                this.formParams = params
+                if (!this.hasScript()) {
+                    if (callback) {
+                        const flag = true
+                        callback(flag)
+                    }
+                    return
+                }
+                JForm._afterSubmit(this, action, this.getFormData(), callback)
+            },
+            // 更新store
+            updateStore(action, data) {
+                this.$store.dispatch(action, data)
             }
-          })
-        } else {
-          this.curActiveStep--
         }
-        this.stepLoading = false
-      }, time)
-    },
-    callback() {
-      this.$emit('callback')
-    },
-    closeDialog() {
-      this.$emit('close')
-    },
-    getForm() {
-      return this.$refs.dynamicForm
-    },
-    /**
-     * 获取表单验证
-     */
-    validate(callback) {
-      this.getForm().validate((valid, invalidFields) => {
-        callback(valid, invalidFields)
-      })
-    },
-    formErrorToast(msg) {
-      ActionUtils.saveErrorMessage(msg)
-    },
-    // 处理表单提交验证
-    formSubmitVerify(callback) {
-      if (!this.hasScript()) {
-        if (callback) {
-          this.getForm().formSubmitVerify(callback)
-        }
-        return
-      }
-
-      JForm._onValidate(this, (result, errorMsg) => {
-        if (!result) {
-          return callback(result, errorMsg || '验证不通过,请检查表单')
-        }
-        this.getForm().formSubmitVerify(callback)
-      })
-    },
-    /**
-     * 获取表单数据
-     */
-    getFormData() {
-      return this.getForm().getFormData()
-    },
-    /**
-     * 获取字段数据
-     */
-    getData(name) {
-      const data = this.getFormData()
-      return data[name]
-    },
-    /**
-     * 设置字段数据
-     */
-    setData(name, value) {
-      return this.getForm().setFieldData(name, value)
-    },
-    /**
-     * 设置表单权限
-     */
-    getFormRights(name) {
-      return this.getForm().getFormRights(name)
-    },
-    /**
-     * 设置表单权限
-     */
-    setFormRights(name, value) {
-      return this.getForm().setFormRights(name, value)
-    },
-    hasFormOpinion() {
-      return this.getForm().hasFormOpinion()
-    },
-    /**
-     * 表单意见数据
-     */
-    getFormOpinionData() {
-      return this.getForm().getFormOpinionData()
-    },
-    /**
-     * 获取审批意见验证
-     */
-    formOpinionValidate(calback, flag) {
-      this.getForm().formOpinionValidate(calback, flag)
-    },
-    /**
-     * 获取表单字段组件实例
-     */
-    getRefs(fieldName) {
-      return this.getForm().getRefs(fieldName)
-    },
-    /**
-     * 获取表单字段的具体控件组件实例
-     */
-    getRefsField(fieldName) {
-      return this.getForm().getRefsField(fieldName)
-    },
-    /* 给与表头赋值关联对话框及数据*/
-    getTableList(list){
-      return this.getForm().getTableList(list)
-      },
-    /* 获取统计页面或记录页面*/
-    getStatisOrRecord(type){
-      return this.getForm().getStatisOrRecord(type)
-    },
-    /* 表头点击事件*/
-    clickTableHeand(a){
-      return this.getForm().clickTableHeand(a)
-    },
-    /**
-     * 初始化脚本
-     */
-    initJForm() {
-      let script = document.getElementById(JFormId)
-      if (script) {
-        script.parentNode.removeChild(script)
-      }
-      if (this.formDef.attrs && this.formDef.attrs.script) {
-        const codeScript = this.formDef.attrs.script
-        script = document.createElement('script')
-        script.type = 'text/javascript'
-        script.id = JFormId
-        document.body.appendChild(script)
-        try {
-          script.appendChild(document.createTextNode(codeScript))
-        } catch (ex) {
-          console.error(ex)
-          script.text = codeScript
-        }
-        document.body.appendChild(script)
-      }
-    },
-    // 处理脚本
-    hasScript() {
-      return this.getForm().hasScript
-    },
-    // 加载脚本
-    loadScript() {
-      this.$emit('load', this)
-      if (!this.hasScript()) {
-        return
-      }
-      JForm._onLoad(this, this.getForm)
-    },
-    // 前置脚本
-    beforeScript(action, callback) {
-      if (!this.hasScript()) {
-        if (callback) {
-          const flag = true
-          callback(flag)
-        }
-        return
-      }
-      JForm._beforeSubmit(this, action, this.getFormData(), callback)
-    },
-    // 后置脚本
-    afterScript(action, params, callback) {
-      this.formParams = params
-      if (!this.hasScript()) {
-        if (callback) {
-          const flag = true
-          callback(flag)
-        }
-        return
-      }
-      JForm._afterSubmit(this, action, this.getFormData(), callback)
     }
-  }
-}
 </script>
 <style lang="scss" scoped>
-  .form-toolbar{
-    position: fixed;
-    width: 100%;
-    margin-top: -50px;
-  }
-  .form-container{
-    margin: 0 10px 10px 10px;
-  }
-  @media print {
-    .dynamic-form{
-      margin-top:0 !important;
+    .form-toolbar {
+        position: fixed;
+        width: 100%;
+        margin-top: -50px;
     }
-    .el-dialog__headerbtn {
-      display: none !important;
-      padding: 0;
-      margin:  0;
+    .form-container {
+        margin: 0 10px 10px 10px;
     }
-    .hidden-print{
-      padding: 0;
-      margin:  0;
+    @media print {
+        .dynamic-form {
+            margin-top: 0 !important;
+        }
+        .el-dialog__headerbtn {
+            display: none !important;
+            padding: 0;
+            margin: 0;
+        }
+        .hidden-print {
+            padding: 0;
+            margin: 0;
+        }
     }
-  }
 </style>

+ 15 - 15
src/views/component/uploadTxt.vue

@@ -1,19 +1,19 @@
 <template>
-  <div>
-    <label for="uploadTxt" :class="$style.upload">
-      <el-tooltip class="item" effect="dark" content="请选择格式为txt的原始数据文件" placement="top">
-        <div :class="$style.btn"><i class="el-icon-upload" />选择文件</div>
-      </el-tooltip>
-      <span :class="$style.file">{{ fileName }}</span>
-      <input
-        id="uploadTxt"
-        type="file"
-        accept=".txt"
-        hidden
-        @change="onChange"
-      >
-    </label>
-  </div>
+    <div>
+        <label for="uploadTxt" :class="$style.upload">
+            <el-tooltip class="item" effect="dark" content="请选择格式为txt的原始数据文件" placement="top">
+                <div :class="$style.btn"><i class="el-icon-upload"/>选择文件</div>
+            </el-tooltip>
+            <span :class="$style.file">{{ fileName }}</span>
+            <input
+                id="uploadTxt"
+                type="file"
+                accept=".txt"
+                hidden
+                @change="onChange"
+            >
+        </label>
+    </div>
 </template>
 <script>
     export default {

+ 73 - 24
src/views/platform/bpmn/bpmTask/list.vue

@@ -77,9 +77,7 @@
         },
         mixins: [FixHeight],
         data() {
-            const { testingList } = this.$store.getters
             return {
-                testingList,
                 dialogFormVisible: false, // 弹窗
                 bpmnFormrenderDialogVisible: false, // 表单
                 editId: '', // 编辑dialog需要使用
@@ -98,27 +96,81 @@
                 sorts: {},
                 listConfig: {
                     toolbars: [
-                        { key: 'search' },
-                        { key: 'agree', label: '同意', icon: 'ibps-icon-check-square-o' },
-                        { key: 'stop', label: '终止', icon: 'ibps-icon-stop' },
-                        { key: 'suspend', label: '挂起', icon: 'ibps-icon-ioxhost' },
-                        { key: 'recover', label: '恢复', icon: 'ibps-icon-ioxhost' },
-                        { key: 'assignee', label: '指定执行人', icon: 'ibps-icon-cog' }
+                        {
+                            key: 'search'
+                        },
+                        {
+                            key: 'agree',
+                            label: '同意',
+                            icon: 'ibps-icon-check-square-o'
+                        },
+                        {
+                            key: 'stop',
+                            label: '终止',
+                            icon: 'ibps-icon-stop'
+                        },
+                        {
+                            key: 'suspend',
+                            label: '挂起',
+                            icon: 'ibps-icon-ioxhost'
+                        },
+                        {
+                            key: 'recover',
+                            label: '恢复',
+                            icon: 'ibps-icon-ioxhost'
+                        },
+                        {
+                            key: 'assignee',
+                            label: '指定执行人',
+                            icon: 'ibps-icon-cog'
+                        }
                     ],
                     searchForm: {
                         forms: [
-                            { prop: 'Q^subject_^SL', label: '请求标题' },
-                            { prop: 'Q^NAME_^SL', label: '当前节点' },
-                            { prop: ['Q^CREATE_TIME_^DL', 'Q^CREATE_TIME_^DG'], label: '创建时间', fieldType: 'daterange' }
+                            {
+                                prop: 'Q^subject_^SL',
+                                label: '请求标题'
+                            },
+                            {
+                                prop: 'Q^NAME_^SL',
+                                label: '当前节点'
+                            },
+                            {
+                                prop: ['Q^CREATE_TIME_^DL', 'Q^CREATE_TIME_^DG'],
+                                label: '创建时间',
+                                fieldType: 'daterange'
+                            }
                         ]
                     },
                     // 表格字段配置
                     columns: [
-                        { prop: 'subject', label: '请求标题', link: 'dialog' },
-                        { prop: 'name', label: '当前节点', width: 200 },
-                        { prop: 'ownerName', label: '候选人', width: 200, headerName: 'headerIcon' },
-                        { prop: 'partyTypeName', label: '候选人范围', width: 200 },
-                        { prop: 'createTime', label: '创建时间', sortable: 'custom', width: 150 }
+                        {
+                            prop: 'subject',
+                            label: '请求标题',
+                            link: 'dialog'
+                        },
+                        {
+                            prop: 'name',
+                            label: '当前节点',
+                            width: 200
+                        },
+                        {
+                            prop: 'ownerName',
+                            label: '候选人',
+                            width: 200,
+                            headerName: 'headerIcon'
+                        },
+                        {
+                            prop: 'partyTypeName',
+                            label: '候选人范围',
+                            width: 200
+                        },
+                        {
+                            prop: 'createTime',
+                            label: '创建时间',
+                            sortable: 'custom',
+                            width: 150
+                        }
                     ],
                     rowHandle: {
                         actions: [
@@ -297,7 +349,6 @@
              * 审批
              */
             handleApprove(id) {
-                let this_ = this
                 // this_.editId = id
                 // this_.bpmnFormrenderDialogVisible = true
                 // return
@@ -324,11 +375,11 @@
                     data: JSON.stringify({ taskId: id })
                 }).then(response => {
                     if (response.data != 'N') {
-                        this_.editId = id
-                        this_.bpmnFormrenderDialogVisible = true
+                        this.editId = id
+                        this.bpmnFormrenderDialogVisible = true
                     } else {
                         ActionUtils.success('任务生成中、请稍后重试...!')
-                        this_.search()
+                        this.search()
                     }
                 })
 
@@ -355,10 +406,8 @@
             },
             // 获取检测流程对应的检测项目名称
             getProjectName(v) {
-                if (!this.testingList.length) {
-                    this.testingList = this.$store.getters.testingList
-                }
-                let res = this.testingList.find(item => item.processKey === v)
+                const { testingList } = this.$store.getters
+                let res = testingList.find(item => item.processKey === v)
                 return res ? res.name : ''
             }
         }

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 21 - 8
src/views/system/dashboard/components/new-home.vue


+ 1 - 1
src/views/system/dashboard/page.vue

@@ -510,7 +510,7 @@
                     return
                 } else {
                     // let sql = 'select xiang_mu_ming_ as name, liu_cheng_bian_ha as processKey from t_jcxmlcpzb'
-                    let sql = 'select jian_ce_xiang_mu_ as name, defkey_ as processKey from t_mjjcnlfw order by xiang_mu_bian_hao + 0 asc'
+                    let sql = 'select jian_ce_xiang_mu_ as name, defkey_ as processKey from t_mjjcnlfw where length(defkey_) > 0 order by xiang_mu_bian_hao + 0 asc'
                     curdPost('sql', sql).then(res => {
                         const { data } = res.variables
                         this.$store.dispatch('ibps/param/setTestingList', data)

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott