shenqilong пре 1 година
родитељ
комит
d2fa1ee673

+ 57 - 53
src/business/platform/data/templaterender/preview/dialog.vue

@@ -1,67 +1,71 @@
 <template>
-  <data-template-render-preview
-    :visible="dialogVisible"
-    :data="dataTemplate"
-    :dynamic-params="dynamicParams"
-    @close="handleClose"
-    @action-event="handleActionEvent"
-  />
+    <data-template-render-preview
+        :visible="dialogVisible"
+        :data="dataTemplate"
+        :dynamic-params="dynamicParams"
+        :temp-search="true"
+        @close="handleClose"
+        @action-event="handleActionEvent"
+    />
 </template>
 <script>
 import { getByKey } from '@/api/platform/data/dataTemplate'
 import DataTemplateRenderPreview from './index'
 export default {
-  components: {
-    DataTemplateRenderPreview
-  },
-  props: {
-    visible: {
-      type: Boolean,
-      default: false
+    components: {
+        DataTemplateRenderPreview
     },
-    templateKey: {
-      type: String
+    props: {
+        visible: {
+            type: Boolean,
+            default: false
+        },
+        templateKey: {
+            type: String
+        },
+        dynamicParams: {
+            type: Object
+        },
+        previousDataTemplate: {
+            type: Object
+        }
     },
-    dynamicParams: {
-      type: Object
-    }
-  },
-  data() {
-    return {
-      dialogVisible: false,
-      dataTemplate: {}
-    }
-  },
-  watch: {
-    visible: {
-      handler: function(val, oldVal) {
-        if (val) {
-          this.loadData()
-        } else {
-          this.dataTemplate = {}
+    data () {
+        return {
+            dialogVisible: false,
+            dataTemplate: {}
         }
-      },
-      immediate: true
-    }
-  },
-  methods: {
-    loadData() {
-      this.dataTemplate = {}
-      getByKey({
-        dataTemplateKey: this.templateKey
-      }).then(response => {
-        // 从后台获取数据
-        this.dataTemplate = this.$utils.parseData(response.data)
-        this.dialogVisible = true
-      }).catch(() => {
-      })
     },
-    handleClose(visible) {
-      this.$emit('close', visible)
+    watch: {
+        visible: {
+            handler: function (val, oldVal) {
+                if (val) {
+                    this.loadData()
+                } else {
+                    this.dataTemplate = {}
+                }
+            },
+            immediate: true
+        }
     },
-    handleActionEvent(key, data) {
-      this.$emit('action-event', key, data)
+    methods: {
+        loadData () {
+            this.dataTemplate = {}
+            getByKey({
+                dataTemplateKey: this.templateKey
+            }).then(response => {
+                // 从后台获取数据
+                this.dataTemplate = this.$utils.parseData(response.data)
+                this.dialogVisible = true
+            }).catch(() => {
+            })
+        },
+        handleClose (visible) {
+            this.$emit('close', visible, this.previousDataTemplate)
+        },
+        handleActionEvent (key, data) {
+            this.$emit('action-event', key, data)
+        }
     }
-  }
 }
 </script>

+ 13 - 13
src/business/platform/data/templaterender/preview/index.vue

@@ -126,7 +126,7 @@ export default {
         }
     },
     methods: {
-        // 关闭当前窗口
+    // 关闭当前窗口
         closeDialog () {
             this.$emit('close', false)
         },
@@ -197,16 +197,16 @@ export default {
 }
 </script>
 <style lang="scss" >
-.data-template-renderer-dialog{
-.el-dialog__header{
-  padding: 0;
-  border-bottom:0;
-}
-.el-dialog__body {
-  padding: 0;
-}
-.el-dialog__headerbtn{
-  z-index: 99999;
-}
-}
+  .data-template-renderer-dialog{
+    .el-dialog__header{
+      padding: 0;
+      border-bottom:0;
+    }
+    .el-dialog__body {
+      padding: 0;
+    }
+    .el-dialog__headerbtn{
+      z-index: 99999;
+    }
+  }
 </style>

+ 92 - 93
src/business/platform/data/templaterender/preview/mixins/preview.js

@@ -3,102 +3,101 @@ import { getDynamicParamsConditions, buildLabelTitle } from '@/business/platform
 import { getByKey } from '@/api/platform/data/dataTemplate'
 
 export default {
-  data() {
-    return {
-      templateRendererDialogVisible: false,
-      dynamicParamsDialogVisible: false,
-      previewDialogVisible: false,
+    data () {
+        return {
+            templateRendererDialogVisible: false,
+            dynamicParamsDialogVisible: false,
+            previewDialogVisible: false,
 
-      selectedValue: this.multiple ? [] : {},
-      multiple: true,
-      labelKey: '',
-      previewFormData: {},
-      conditions: {}, // 动态条件
-      dynamicParams: {},
-      dataByKeyData: ''
-    }
-  },
-  methods: {
-    getDataByKey(params) {
-      getByKey({
-        dataTemplateKey: params
-      }).then(response => {
-        this.dataByKeyData = this.$utils.parseJSON(response.data)
-      }).catch(() => {})
-      return this.dataByKeyData
-    },
-    previewTemplate() {
-      if (this.$utils.isEmpty(this.dataTemplate)) {
-        this.$message({
-          showClose: true,
-          message: '数据模版为空!',
-          type: 'warning'
-        })
-        return
-      }
-      let hasBindTempate = true
-      if (this.dataTemplate.showType === 'compose' && this.dataTemplate.composeType !== 'treeForm') {
-        if (this.$utils.isEmpty(this.dataTemplate.templates)) {
-          hasBindTempate = false
-        } else {
-          this.dataTemplate.templates.forEach(d => {
-            if (this.$utils.isEmpty(d.attrs) || this.$utils.isEmpty(d.attrs.bind_template_key)) {
-              hasBindTempate = false
-            }
-          })
+            selectedValue: this.multiple ? [] : {},
+            multiple: true,
+            labelKey: '',
+            previewFormData: {},
+            conditions: {}, // 动态条件
+            dynamicParams: {},
+            dataByKeyData: ''
         }
-      }
-      if (!hasBindTempate) {
-        this.$message({
-          showClose: true,
-          message: '请检查数据模板是否绑定!',
-          type: 'warning'
-        })
-        return
-      }
-      // 判断是否有 动态参数
-      const conditions = getDynamicParamsConditions(this.dataTemplate, this.getDataByKey)
-      if (this.dataTemplate.type === 'dialog') {
-        const dialogs = this.dataTemplate.dialogs
-        this.multiple = dialogs && dialogs.attrs ? dialogs.attrs.multi !== 'N' : true
-        this.labelKey = buildLabelTitle(this.dataTemplate)
-        this.previewSelectedValue = this.multiple ? [] : {}
-      } else {
-        this.multiple = true
-      }
-      if (this.$utils.isEmpty(conditions)) {
-        this.templateRendererDialogVisible = true
-      } else {
-        this.conditions = conditions
-        this.dynamicParamsDialogVisible = true
-      }
     },
+    methods: {
+        getDataByKey (params) {
+            getByKey({
+                dataTemplateKey: params
+            }).then(response => {
+                this.dataByKeyData = this.$utils.parseJSON(response.data)
+            }).catch(() => {})
+            return this.dataByKeyData
+        },
+        previewTemplate () {
+            if (this.$utils.isEmpty(this.dataTemplate)) {
+                this.$message({
+                    showClose: true,
+                    message: '数据模版为空!',
+                    type: 'warning'
+                })
+                return
+            }
+            let hasBindTempate = true
+            if (this.dataTemplate.showType === 'compose' && this.dataTemplate.composeType !== 'treeForm') {
+                if (this.$utils.isEmpty(this.dataTemplate.templates)) {
+                    hasBindTempate = false
+                } else {
+                    this.dataTemplate.templates.forEach(d => {
+                        if (this.$utils.isEmpty(d.attrs) || this.$utils.isEmpty(d.attrs.bind_template_key)) {
+                            hasBindTempate = false
+                        }
+                    })
+                }
+            }
+            if (!hasBindTempate) {
+                this.$message({
+                    showClose: true,
+                    message: '请检查数据模板是否绑定!',
+                    type: 'warning'
+                })
+                return
+            }
+            // 判断是否有 动态参数
+            const conditions = getDynamicParamsConditions(this.dataTemplate, this.getDataByKey)
+            if (this.dataTemplate.type === 'dialog') {
+                const dialogs = this.dataTemplate.dialogs
+                this.multiple = dialogs && dialogs.attrs ? dialogs.attrs.multi !== 'N' : true
+                this.labelKey = buildLabelTitle(this.dataTemplate)
+                this.previewSelectedValue = this.multiple ? [] : {}
+            } else {
+                this.multiple = true
+            }
+            if (this.$utils.isEmpty(conditions)) {
+                this.templateRendererDialogVisible = true
+            } else {
+                this.conditions = conditions
+                this.dynamicParamsDialogVisible = true
+            }
+        },
 
-
-    handleDynamicParams(data) {
-      this.dynamicParams = data
-      this.templateRendererDialogVisible = true
-    },
-    handleTemplaterenderActionEvent(key, data) {
-      switch (key) {
-        case 'cancel':
-          this.templateRendererDialogVisible = false
-          this.selectedValue = this.multiple ? [] : {}
-          break
-        case 'clean':
-          break
-        case 'cleanClose':
-          this.previewFormData = data
-          this.previewSelectedValue = data
-          this.templateRendererDialogVisible = false
-          this.previewDialogVisible = true
-          break
-        default:
-          this.previewFormData = data
-          this.previewSelectedValue = data
-          this.previewDialogVisible = true
-          break
-      }
+        handleDynamicParams (data) {
+            this.dynamicParams = data
+            this.templateRendererDialogVisible = true
+        },
+        handleTemplaterenderActionEvent (key, data) {
+            switch (key) {
+                case 'cancel':
+                    this.templateRendererDialogVisible = false
+                    this.selectedValue = this.multiple ? [] : {}
+                    break
+                case 'clean':
+                    break
+                case 'cleanClose':
+                    this.previewFormData = data
+                    this.previewSelectedValue = data
+                    this.templateRendererDialogVisible = false
+                    this.previewDialogVisible = true
+                    break
+                default:
+                    this.previewFormData = data
+                    this.previewSelectedValue = data
+                    this.previewDialogVisible = true
+                    break
+            }
+        }
     }
-  }
 }

+ 201 - 196
src/business/platform/data/templaterender/preview/types/dialog.vue

@@ -26,6 +26,7 @@
                 :multiple="multiple"
                 :height="dialogHeight"
                 :preview="preview"
+                :temp-search="tempSearch"
                 @close="closeDialog"
                 @selected="handleSelectChange"
             />
@@ -33,225 +34,229 @@
     </ibps-selector-dialog>
 </template>
 <script>
-    import TypeMixin from '../mixins/types'
-    import { buildLabelTitle } from '../../utils'
-    import JDialog from '../../utils/JDialogTemplate' // 自定义脚本
-    // import ActionUtils from '@/utils/action'
+import TypeMixin from '../mixins/types'
+import { buildLabelTitle } from '../../utils'
+import JDialog from '../../utils/JDialogTemplate' // 自定义脚本
+// import ActionUtils from '@/utils/action'
 
-    import IbpsSelectorDialog from '@/components/ibps-selector/dialog'
-    import Vue from 'vue'
-    Vue.component('ibps-data-template-render', () =>
-        import('@/business/platform/data/templaterender/index.vue')
-    )
+import IbpsSelectorDialog from '@/components/ibps-selector/dialog'
+import Vue from 'vue'
+Vue.component('ibps-data-template-render', () =>
+    import('@/business/platform/data/templaterender/index.vue')
+)
 
-    export default {
-        components: {
-            IbpsSelectorDialog
+export default {
+    components: {
+        IbpsSelectorDialog
+    },
+    mixins: [TypeMixin],
+    props: {
+        visible: {
+            type: Boolean,
+            default: false
         },
-        mixins: [TypeMixin],
-        props: {
-            visible: {
-                type: Boolean,
-                default: false
-            },
-            data: {
-                type: Object
-            },
-            dynamicParams: {
-                type: Object
-            },
-            value: {
-                type: [Object, Array]
-            },
-            title: String,
-            width: {
-                type: [String, Number],
-                default: '80%'
-            },
-            height: {
-                type: [String, Number],
-                default: '100%'
-            },
-            dialogHeight: {
-                type: [String, Number],
-                default: 400
-            },
-            multiple: {
-                type: Boolean,
-                default: false
-            },
-            toolbars: {
-                type: Array
-            },
-            labelKey: {
-                type: [String, Function]
-            },
-            preview: {
-                type: Boolean,
-                default: false
-            }
+        data: {
+            type: Object
         },
-        data() {
-            return {
-                dialogVisible: this.visible,
-                selectedValue: this.multiple ? [] : {},
-                dataTemplate: {},
-                initialization: false,
-                showLabel: this.labelKey
-            }
+        dynamicParams: {
+            type: Object
         },
-        computed: {
-            marginTop() {
-                if (this.height === '100%' || this.height === 100) {
-                    return '0'
-                } else {
-                    return '5vh'
-                }
-            }
+        value: {
+            type: [Object, Array]
         },
-        watch: {
-            visible: {
-                handler: function (val, oldVal) {
-                    this.dialogVisible = val
-                    if (val) {
-                        this.initUI()
-                        this.getFormData()
-                    }
-                },
-                immediate: true
-            },
-            value(val) {
-                this.selectedValue = val
-            },
-            selectedValue: {
-                handler(val, oldVal) {
-                    if (val !== oldVal) {
-                        this.$emit('update:value', val)
-                    }
-                },
-                deep: true
-            },
-            labelKey: {
-                handler: function (val, oldVal) {
-                    if (val) {
-                        this.showLabel = val
-                    }
-                },
-                immediate: true
-            }
+        title: String,
+        width: {
+            type: [String, Number],
+            default: '80%'
         },
-        methods: {
-            // 关闭当前窗口
-            closeDialog() {
-                this.JDialogTemplate()
-                this.$emit('close', false)
-                this.$emit('update:value', {})
+        height: {
+            type: [String, Number],
+            default: '100%'
+        },
+        dialogHeight: {
+            type: [String, Number],
+            default: 400
+        },
+        multiple: {
+            type: Boolean,
+            default: false
+        },
+        toolbars: {
+            type: Array
+        },
+        labelKey: {
+            type: [String, Function]
+        },
+        preview: {
+            type: Boolean,
+            default: false
+        },
+        tempSearch: { // 是否是数据模板使用的筛选条件
+            type: Boolean,
+            default: false
+        }
+    },
+    data () {
+        return {
+            dialogVisible: this.visible,
+            selectedValue: this.multiple ? [] : {},
+            dataTemplate: {},
+            initialization: false,
+            showLabel: this.labelKey
+        }
+    },
+    computed: {
+        marginTop () {
+            if (this.height === '100%' || this.height === 100) {
+                return '0'
+            } else {
+                return '5vh'
+            }
+        }
+    },
+    watch: {
+        visible: {
+            handler: function (val, oldVal) {
+                this.dialogVisible = val
+                if (val) {
+                    this.initUI()
+                    this.getFormData()
+                }
             },
-            getFormData() {
-                this.initData(JSON.parse(JSON.stringify(this.data)))
+            immediate: true
+        },
+        value (val) {
+            this.selectedValue = val
+        },
+        selectedValue: {
+            handler (val, oldVal) {
+                if (val !== oldVal) {
+                    this.$emit('update:value', val)
+                }
             },
-            setSelectRow() {
-                this.$refs['dataTemplate'].setSelectRow()
+            deep: true
+        },
+        labelKey: {
+            handler: function (val, oldVal) {
+                if (val) {
+                    this.showLabel = val
+                }
             },
-            handleSelectChange(val, dataTemplate) {
-                // if (typeof this.labelKey === 'function') {
-                //     if (this.$utils.isNotEmpty(val)) {
-                //         ActionUtils.warning('配置错误,请设置一个返回字段')
-                //         this.clearSelection()
-                //         return
-                //     }
-                // } else if (typeof this.labelKey === 'string') {
-                //     return data[config]
-                // } else if (typeof this.labelKey === 'undefined') {
+            immediate: true
+        }
+    },
+    methods: {
+        // 关闭当前窗口
+        closeDialog () {
+            this.JDialogTemplate()
+            this.$emit('close', false)
+            this.$emit('update:value', {})
+        },
+        getFormData () {
+            this.initData(JSON.parse(JSON.stringify(this.data)))
+        },
+        setSelectRow () {
+            this.$refs['dataTemplate'].setSelectRow()
+        },
+        handleSelectChange (val, dataTemplate) {
+            // if (typeof this.labelKey === 'function') {
+            //     if (this.$utils.isNotEmpty(val)) {
+            //         ActionUtils.warning('配置错误,请设置一个返回字段')
+            //         this.clearSelection()
+            //         return
+            //     }
+            // } else if (typeof this.labelKey === 'string') {
+            //     return data[config]
+            // } else if (typeof this.labelKey === 'undefined') {
 
-                // }
-                if (this.dataTemplate.type !== 'dialog' && !this.dataTemplate.templates[0].result_columns) {
+            // }
+            if (this.dataTemplate.type !== 'dialog' && !this.dataTemplate.templates[0].result_columns) {
+                this.$message({
+                    message: '请检查是否设置返回字段!',
+                    type: 'warning'
+                })
+                return
+            } else if (dataTemplate) {
+                if (!dataTemplate.templates[0].result_columns) {
                     this.$message({
                         message: '请检查是否设置返回字段!',
                         type: 'warning'
                     })
                     return
-                } else if (dataTemplate) {
-                    if (!dataTemplate.templates[0].result_columns) {
-                        this.$message({
-                            message: '请检查是否设置返回字段!',
-                            type: 'warning'
-                        })
-                        return
-                    } else {
-                        this.showLabel = buildLabelTitle(dataTemplate)
-                    }
-                }
-                this.selectedValue = val
-            },
-            clearSelection() {
-                this.$refs['dataTemplate'].clearSelection()
-            },
-            initUI() {
-                this.initialization = false
-                if (!this.initialization) {
-                    this.JDialogTemplate()
-                    this.initialization = true
+                } else {
+                    this.showLabel = buildLabelTitle(dataTemplate)
                 }
-            },
-            /**
+            }
+            this.selectedValue = val
+        },
+        clearSelection () {
+            this.$refs['dataTemplate'].clearSelection()
+        },
+        initUI () {
+            this.initialization = false
+            if (!this.initialization) {
+                this.JDialogTemplate()
+                this.initialization = true
+            }
+        },
+        /**
              * 初始化脚本
              */
-            JDialogTemplate() {
-                const dialogId = 'JDialog'
-                let script = document.getElementById(dialogId)
-                if (script) {
-                    script.parentNode.removeChild(script)
-                }
-                if (this.data.dialogs.attrs && this.data.dialogs.attrs.script) {
-                    const codeScript = this.data.dialogs.attrs.script
-                    script = document.createElement('script')
-                    script.type = 'text/javascript'
-                    script.id = dialogId
-                    document.body.appendChild(script)
-                    try {
-                        script.appendChild(document.createTextNode(codeScript))
-                    } catch (ex) {
-                        console.error(ex)
-                        script.text = codeScript
-                    }
-                    document.body.appendChild(script)
-                    setTimeout(() => {
-                        this.loadScript()
-                    }, 10)
-                }
-            },
-            // 处理脚本
-            hasScript() {
-                return true
-            },
-            // 加载脚本
-            loadScript() {
-                if (!this.hasScript()) {
-                    return
-                }
-                JDialog._onLoad(this)
-            },
-            // 前置脚本
-            beforeScript(action, position, selection, data, callback) {
-                if (!this.hasScript()) {
-                    const flag = true
-                    callback(flag)
-                    return
-                }
-                JDialog._beforeSubmit(this, action, position, selection, data, callback)
-            },
-            // 后置脚本
-            afterScript(action, position, selection, data, callback) {
-                if (!this.hasScript()) {
-                    const flag = true
-                    callback(flag)
-                    return
+        JDialogTemplate () {
+            const dialogId = 'JDialog'
+            let script = document.getElementById(dialogId)
+            if (script) {
+                script.parentNode.removeChild(script)
+            }
+            if (this.data.dialogs.attrs && this.data.dialogs.attrs.script) {
+                const codeScript = this.data.dialogs.attrs.script
+                script = document.createElement('script')
+                script.type = 'text/javascript'
+                script.id = dialogId
+                document.body.appendChild(script)
+                try {
+                    script.appendChild(document.createTextNode(codeScript))
+                } catch (ex) {
+                    console.error(ex)
+                    script.text = codeScript
                 }
-                JDialog._afterSubmit(this, action, position, selection, data, callback)
+                document.body.appendChild(script)
+                setTimeout(() => {
+                    this.loadScript()
+                }, 10)
+            }
+        },
+        // 处理脚本
+        hasScript () {
+            return true
+        },
+        // 加载脚本
+        loadScript () {
+            if (!this.hasScript()) {
+                return
+            }
+            JDialog._onLoad(this)
+        },
+        // 前置脚本
+        beforeScript (action, position, selection, data, callback) {
+            if (!this.hasScript()) {
+                const flag = true
+                callback(flag)
+                return
+            }
+            JDialog._beforeSubmit(this, action, position, selection, data, callback)
+        },
+        // 后置脚本
+        afterScript (action, position, selection, data, callback) {
+            if (!this.hasScript()) {
+                const flag = true
+                callback(flag)
+                return
             }
+            JDialog._afterSubmit(this, action, position, selection, data, callback)
         }
     }
+}
 </script>
 <style lang="scss">
     .preview-type-dialog {

+ 116 - 114
src/business/platform/data/templaterender/preview/types/value-source.vue

@@ -1,23 +1,23 @@
 <template>
-  <!--值来源-->
-  <el-dialog
-    :title="title"
-    :visible.sync="dialogVisible"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    class="data-template-renderer-value-source-dialog"
-    append-to-body
-    @open="getFormData"
-    @close="closeDialog"
-  >
-    <el-alert type="warning" :closable="false"> 实际是会返回数据到表单下拉:</el-alert>
+    <!--值来源-->
+    <el-dialog
+        :title="title"
+        :visible.sync="dialogVisible"
+        :close-on-click-modal="false"
+        :close-on-press-escape="false"
+        class="data-template-renderer-value-source-dialog"
+        append-to-body
+        @open="getFormData"
+        @close="closeDialog"
+    >
+        <el-alert type="warning" :closable="false"> 实际是会返回数据到表单下拉:</el-alert>
 
-    <ibps-highlight>{{ dataResult }}</ibps-highlight>
-    <ibps-pagination
-      :pagination="pagination"
-      @pagination-change="handlePaginationChange"
-    />
-  </el-dialog>
+        <ibps-highlight v-loading="loading">{{ dataResult }}</ibps-highlight>
+        <ibps-pagination
+            :pagination="pagination"
+            @pagination-change="handlePaginationChange"
+        />
+    </el-dialog>
 </template>
 <script>
 import { queryDataTable } from '@/api/platform/data/dataTemplate'
@@ -26,111 +26,113 @@ import TypeMixin from '../mixins/types'
 import IbpsPagination from '@/components/ibps-pagination'
 
 export default {
-  components: {
-    IbpsPagination
-  },
-  mixins: [TypeMixin],
-  props: {
-    visible: {
-      type: Boolean,
-      default: false
+    components: {
+        IbpsPagination
     },
-    data: {
-      type: Object
+    mixins: [TypeMixin],
+    props: {
+        visible: {
+            type: Boolean,
+            default: false
+        },
+        data: {
+            type: Object
+        },
+        dynamicParams: Object
     },
-    dynamicParams: Object
-  },
-  data() {
-    return {
-      dialogVisible: this.visible,
-      dataTemplate: {},
-      template: {},
-      dataResult: [],
-      filterConditionKey: '',
-      treeData: [],
-      defaultPagination: {
-        page: 1,
-        limit: 20,
-        totalCount: 0
-      },
-      pagination: {
-        page: 1,
-        limit: 20
-      }
-    }
-  },
-  computed: {
-    title() {
-      return this.dataTemplate.name || '值来源'
-    },
-    pkKey() {
-      return this.dataTemplate.unique || 'id_'
-    }
-  },
-  watch: {
-    visible: {
-      handler: function(val, oldVal) {
-        this.dialogVisible = val
-      },
-      immediate: true
-    }
-  },
-  created() {
-    this.pagination = JSON.parse(JSON.stringify(this.defaultPagination))
-  },
-  methods: {
-    // 关闭当前窗口
-    closeDialog() {
-      this.$emit('close', false)
+    data () {
+        return {
+            loading: false,
+            dialogVisible: this.visible,
+            dataTemplate: {},
+            template: {},
+            dataResult: [],
+            filterConditionKey: '',
+            treeData: [],
+            defaultPagination: {
+                page: 1,
+                limit: 20,
+                totalCount: 0
+            },
+            pagination: {
+                page: 1,
+                limit: 20
+            }
+        }
     },
-    getFormData() {
-      this.dataTemplate = JSON.parse(JSON.stringify(this.data))
-      const templates = this.dataTemplate.templates || []
-      this.template = templates[0] || {}
-      this.loadData()
+    computed: {
+        title () {
+            return this.dataTemplate.name || '值来源'
+        },
+        pkKey () {
+            return this.dataTemplate.unique || 'id_'
+        }
     },
-    /**
-     * 加载数据
-     */
-    loadData() {
-      this.loading = true
-      queryDataTable(this.getFormatParams()).then(response => {
-        this.loading = false
-        const data = response.data
-        this.dataResult = data.dataResult || []
-        this.pagination = data.pageResult || {}
-      }).catch(() => {
-        this.loading = false
-      })
+    watch: {
+        visible: {
+            handler: function (val, oldVal) {
+                this.dialogVisible = val
+            },
+            immediate: true
+        }
     },
-    handlePaginationChange({ page, limit }) {
-      this.pagination.page = page
-      this.pagination.limit = limit
-      this.loadData()
+    created () {
+        this.pagination = JSON.parse(JSON.stringify(this.defaultPagination))
+        this.getFormData()
     },
-    /**
-     * 获取格式化参数
-     */
-    getFormatParams() {
-      let formParams = {}
-      if (this.$refs['searchForm']) {
-        formParams = this.$refs['searchForm'].getSearcFormData() || {}
-      }
-      const responseData = JSON.parse(JSON.stringify(this.template))
-      responseData.datasetKey = this.dataTemplate.datasetKey
-      responseData.unique = this.pkKey
-      responseData['dynamic_params'] = this.dynamicParams
-      formParams['response_data'] = JSON.stringify(responseData)
-      formParams['filter_condition_key'] = this.filterConditionKey
-      return ActionUtils.formatParams(formParams, this.pagination)
+    methods: {
+        // 关闭当前窗口
+        closeDialog () {
+            this.$emit('close', false)
+        },
+        getFormData () {
+            this.dataTemplate = JSON.parse(JSON.stringify(this.data))
+            const templates = this.dataTemplate.templates || []
+            this.template = templates[0] || {}
+            this.loadData()
+        },
+        /**
+   * 加载数据
+   */
+        loadData () {
+            this.loading = true
+            queryDataTable(this.getFormatParams()).then(response => {
+                this.loading = false
+                const data = response.data
+                this.dataResult = data.dataResult || []
+                this.pagination = data.pageResult || {}
+            }).catch(() => {
+                this.loading = false
+            })
+        },
+        handlePaginationChange ({ page, limit }) {
+            this.pagination.page = page
+            this.pagination.limit = limit
+            this.loadData()
+        },
+        /**
+   * 获取格式化参数
+   */
+        getFormatParams () {
+            let formParams = {}
+            if (this.$refs['searchForm']) {
+                formParams = this.$refs['searchForm'].getSearcFormData() || {}
+            }
+            const responseData = JSON.parse(JSON.stringify(this.template))
+            responseData.datasetKey = this.dataTemplate.datasetKey
+            responseData.unique = this.pkKey
+            responseData['dynamic_params'] = this.dynamicParams
+            formParams['response_data'] = JSON.stringify(responseData)
+            formParams['filter_condition_key'] = this.filterConditionKey
+            return ActionUtils.formatParams(formParams, this.pagination)
+        }
     }
-  }
 }
 </script>
 <style lang="scss" >
-  .data-template-renderer-value-source-dialog{
-    .el-dialog__body {
-       height:  calc(70vh - 110px) !important;
-    }
+.data-template-renderer-value-source-dialog{
+  .el-dialog__body {
+     height:  calc(70vh - 110px) !important;
   }
+}
 </style>

Разлика између датотеке није приказан због своје велике величине
+ 355 - 194
src/business/platform/data/templaterender/templates/list.vue


+ 4 - 16
src/business/platform/data/templaterender/utils/JComposeTemplate.js

@@ -1,13 +1,6 @@
 
 /**
  * 数据模版--封装自定义代码扩展接口
- *
- * <pre>
- * 作者:hugh zhuang
- * 邮箱:3378340995@qq.com
- * 日期:2017-10-01-下午3:29:34
- * 版权:广州流辰信息技术有限公司
- * </pre>
  */
 import _ from 'lodash'
 import Vue from 'vue'
@@ -15,10 +8,8 @@ import request from '@/utils/request'
 import dialog from '@/utils/dialog'
 import common from '@/utils/common'
 const _import = require('@/utils/util.import.' + process.env.NODE_ENV)
-import getserial from '../../../form/utils/custom/serialNumber' // 编码规则
-import pintText from '../../../form/utils/custom/pintText.js' // 打印规则
-import repostCurd from '../../../form/utils/custom/joinCURD.js' // 增删改查规则
-import getDate from '../../../form/utils/custom/getDateRule.js' // 获取年月日
+import store from '@/store'
+import router from '@/router'
 
 // 定义全局
 var JComposeTemplate
@@ -42,13 +33,10 @@ _.extend(JComposeTemplate, {
         this.$request = request
         this.$dialog = dialog
         this.$common = common
+        this.$router = router
+        this.$store = store
         this.$import = _import
         this._ = _
-        this.$getDate = getDate // 获取封装好的年月日
-        this.$getNumBer = getserial // 封装获取流水号
-        this.$getPint = pintText // 封装打开报表
-        this.$curdPost = repostCurd // 封装通用增删改查
-
         this._isInitialization = true
     },
 

+ 4 - 16
src/business/platform/data/templaterender/utils/JDialogTemplate.js

@@ -1,13 +1,5 @@
-
 /**
  * 数据模版--封装自定义代码扩展接口
- *
- * <pre>
- * 作者:hugh zhuang
- * 邮箱:3378340995@qq.com
- * 日期:2017-10-01-下午3:29:34
- * 版权:广州流辰信息技术有限公司
- * </pre>
  */
 import _ from 'lodash'
 import Vue from 'vue'
@@ -15,10 +7,8 @@ import request from '@/utils/request'
 import dialog from '@/utils/dialog'
 import common from '@/utils/common'
 const _import = require('@/utils/util.import.' + process.env.NODE_ENV)
-import getserial from '../../../form/utils/custom/serialNumber' // 编码规则
-import pintText from '../../../form/utils/custom/pintText.js' // 打印规则
-import repostCurd from '../../../form/utils/custom/joinCURD.js' // 增删改查规则
-import getDate from '../../../form/utils/custom/getDateRule.js' // 获取年月日
+import store from '@/store'
+import router from '@/router'
 
 // 定义全局
 var JDialog
@@ -42,11 +32,9 @@ _.extend(JDialog, {
         this.$request = request
         this.$dialog = dialog
         this.$common = common
+        this.$router = router
+        this.$store = store
         this.$import = _import
-        this.$getDate = getDate // 获取封装好的年月日
-        this.$getNumBer = getserial // 封装获取流水号
-        this.$getPint = pintText // 封装打开报表
-        this.$curdPost = repostCurd // 封装通用增删改查
         this._ = _
         this._isInitialization = true
     },

+ 5 - 19
src/business/platform/data/templaterender/utils/JTemplate.js

@@ -1,13 +1,5 @@
-
 /**
  * 数据模版--封装自定义代码扩展接口
- *
- * <pre>
- * 作者:hugh zhuang
- * 邮箱:3378340995@qq.com
- * 日期:2017-10-01-下午3:29:34
- * 版权:广州流辰信息技术有限公司
- * </pre>
  */
 import _ from 'lodash'
 import Vue from 'vue'
@@ -15,11 +7,8 @@ import request from '@/utils/request'
 import dialog from '@/utils/dialog'
 import common from '@/utils/common'
 const _import = require('@/utils/util.import.' + process.env.NODE_ENV)
-import getserial from '../../../form/utils/custom/serialNumber' // 编码规则
-import pintText from '../../../form/utils/custom/pintText.js' // 打印规则
-import repostCurd from '../../../form/utils/custom/joinCURD.js' // 增删改查规则
-import getDate from '../../../form/utils/custom/getDateRule.js' // 获取年月日
 import store from '@/store'
+import router from '@/router'
 
 // 定义全局
 var JTemplate
@@ -29,8 +18,8 @@ if (!window.JTemplate) {
     JTemplate = window.JTemplate
 }
 /**
-   * 封装自定义代码扩展接口
-   */
+ * 封装自定义代码扩展接口
+ */
 _.extend(JTemplate, {
     // 已经初始化
     _isInitialization: false,
@@ -43,14 +32,11 @@ _.extend(JTemplate, {
         this.$request = request
         this.$dialog = dialog
         this.$common = common
+        this.$router = router
+        this.$store = store
         this.$import = _import
-        this.$getDate = getDate // 获取封装好的年月日
-        this.$getNumBer = getserial // 封装获取流水号
-        this.$getPint = pintText // 封装打开报表
-        this.$curdPost = repostCurd // 封装通用增删改查
         this._ = _
         this._isInitialization = true
-        this.$store = store
     },
 
     // 页面加载

+ 4 - 16
src/business/platform/data/templaterender/utils/JTreeTemplate.js

@@ -1,13 +1,5 @@
-
 /**
  * 数据模版--封装自定义代码扩展接口
- *
- * <pre>
- * 作者:hugh zhuang
- * 邮箱:3378340995@qq.com
- * 日期:2017-10-01-下午3:29:34
- * 版权:广州流辰信息技术有限公司
- * </pre>
  */
 import _ from 'lodash'
 import Vue from 'vue'
@@ -15,10 +7,8 @@ import request from '@/utils/request'
 import dialog from '@/utils/dialog'
 import common from '@/utils/common'
 const _import = require('@/utils/util.import.' + process.env.NODE_ENV)
-import getserial from '../../../form/utils/custom/serialNumber' // 编码规则
-import pintText from '../../../form/utils/custom/pintText.js' // 打印规则
-import repostCurd from '../../../form/utils/custom/joinCURD.js' // 增删改查规则
-import getDate from '../../../form/utils/custom/getDateRule.js' // 获取年月日
+import store from '@/store'
+import router from '@/router'
 
 // 定义全局
 var JTreeTemplate
@@ -42,11 +32,9 @@ _.extend(JTreeTemplate, {
         this.$request = request
         this.$dialog = dialog
         this.$common = common
+        this.$router = router
+        this.$store = store
         this.$import = _import
-        this.$getDate = getDate // 获取封装好的年月日
-        this.$getNumBer = getserial // 封装获取流水号
-        this.$getPint = pintText // 封装打开报表
-        this.$curdPost = repostCurd // 封装通用增删改查
         this._ = _
         this._isInitialization = true
     },

+ 3 - 2
src/business/platform/form/utils/custom/requestType.js

@@ -5,7 +5,8 @@ export const requestType = {
     selects: 'selectDatasContextTable',
     delete: 'deleteDataContextTable',
     add: 'addDataContextTable',
-    update: 'updateDataContextTable',
+    // update: 'updateDataContextTable',
+    update: 'updatesBatchContextTable',
     // 批量修改
     updates: 'updateDatasContextTable',
     // 批量修改 修改多条数据各自对应的值
@@ -36,4 +37,4 @@ export const requestPath = {
     sendNotice: 'platform/v3/msg/innerMessage/save',
     // 保存表单数据
     saveFormData: 'business/v3/bpm/task/save/task'
-}
+}

+ 239 - 236
src/components/ibps-selector/dialog.vue

@@ -1,250 +1,253 @@
 <template>
-  <el-dialog
-    v-if="dialogVisible"
-    ref="dialog"
-    :show-close="showClose"
-    :close-on-click-modal="closeOnClickModal"
-    :close-on-press-escape="closeOnPressEscape"
-    :visible.sync="dialogVisible"
-    :width="width"
-    :top="marginTop"
-    lock-scroll
-    append-to-body
-    custom-class="ibps-selector-dialog"
-    class="ibps-selector-dialog__wrapper"
-    @close="handleClose"
-  >
-    <slot slot="title" name="title" />
-    <div
-      :style="{
-        height:multiple?'35px':'35px'
-      }"
-      class="ibps-selector-header"
+    <el-dialog
+        v-if="dialogVisible"
+        ref="dialog"
+        :show-close="showClose"
+        :close-on-click-modal="closeOnClickModal"
+        :close-on-press-escape="closeOnPressEscape"
+        :visible.sync="dialogVisible"
+        :width="width"
+        :top="marginTop"
+        lock-scroll
+        append-to-body
+        custom-class="ibps-selector-dialog"
+        class="ibps-selector-dialog__wrapper"
+        @close="handleClose"
     >
-      <el-tag
-        v-for="(item,index) in selectedItems"
-        :key="index"
-        closable
-        @close="handleRemove(index,true)"
-      >{{ item }}</el-tag>
-    </div>
-    <div>
-      <slot
-        :multiple="multiple"
-        :height="height"
-        :value="value"
-      />
-    </div>
-    <div
-      v-if="buttonGroup && buttonGroup.length >0"
-      slot="footer"
-      class="el-dialog--center"
-    >
-      <el-button
-        v-for="(button,index) in buttonGroup"
-        :key="index"
-        :type="button.type"
-        :icon="button.icon"
-        :disabled="button.key==='confirm'?isDisabled:false"
-        @click="button.action"
-      >
-        {{ button.label }}
-      </el-button>
-    </div>
-  </el-dialog>
+        <slot slot="title" name="title" />
+        <div :style="{height:multiple?'35px':'35px'}" class="ibps-selector-header">
+            <el-tag
+                v-for="(item,index) in selectedItems"
+                :key="index"
+                closable
+                @close="handleRemove(index,true)"
+            >{{ item }}</el-tag>
+        </div>
+        <div>
+            <slot
+                :multiple="multiple"
+                :height="height"
+                :value="value"
+            />
+        </div>
+        <div
+            v-if="buttonGroup && buttonGroup.length >0"
+            slot="footer"
+            class="el-dialog--center"
+        >
+            <el-button
+                v-for="(button,index) in buttonGroup"
+                :key="index"
+                :type="button.type"
+                :icon="button.icon"
+                :disabled="button.key==='confirm'?isDisabled:false"
+                @click="button.action"
+            >
+                {{ button.label }}
+            </el-button>
+        </div>
+    </el-dialog>
 </template>
 <script>
 import ActionUtils from '@/utils/action'
 export default {
-  props: {
-    visible: Boolean, // 是否可见
-    title: { // 标题
-      type: String,
-      default: '选择器'
-    },
-    marginTop: { // Dialog CSS 中的 margin-top 值
-      type: String,
-      default: '5vh'
-    },
-    width: { // 宽
-      type: String,
-      default: '60%'
-    },
-    height: { // 高
-      type: String,
-      default: '400px'
-    },
-    closeOnClickModal: { // 是否可以通过点击 modal 关闭 Dialog
-      type: Boolean,
-      default: false
-    },
-    closeOnPressEscape: { // 是否可以通过按下 ESC 关闭 Dialog
-      type: Boolean,
-      default: false
-    },
-    showClose: { // 是否显示关闭按钮
-      type: Boolean,
-      default: true
-    },
-    beforeClose: { // 关闭前的回调,会暂停 Dialog 的关闭
-      type: Function
-    },
-    fullscreen: { // 是否为全屏 Dialog
-      type: Boolean,
-      default: false
-    },
-    labelKey: { // 展示的值
-      type: [String, Function],
-      default: 'name'
-    },
-    value: { // 值
-      type: [Object, Array],
-      default() { return this.multiple ? [] : {} }
-    },
-    cleanClose: { // 按钮清空并关闭
-      type: Boolean,
-      default: false
-    },
-    defaultButton: {
-      type: Boolean,
-      default: true
-    },
-    buttons: { // 按钮组
-      type: Array,
-      default() {
-        return []
-      }
-    },
-    confirmButtonText: {
-      type: String
-    },
-    cleanButtonText: {
-      type: String
-    },
-    cancelButtonText: {
-      type: String
-    },
-    multiple: { // 是否多选
-      type: Boolean,
-      default: false
-    },
-    isDisabled: { // 是否多选
-      type: Boolean,
-      default: false
-    }
-  },
-  data() {
-    return {
-      dialogVisible: this.visible
-    }
-  },
-  computed: {
-    selectedItems() {
-      if (this.$utils.isEmpty(this.value)) { return [] }
-      if (this.multiple) {
-        const items = []
-        this.value.forEach(item => {
-          items.push(this.handleLabel(item))
-        })
-        return items
-      } else {
-        return [this.handleLabel(this.value)]
-      }
-    },
-    bodyStyle() {
-      return {
-        height: this.height,
-        overflow: 'hidden'
-      }
-    },
-    buttonGroup() {
-      let buttons = []
-      if (this.$utils.isEmpty(this.buttons) && this.defaultButton) {
-        buttons = buttons.concat([
-          { key: 'confirm', label: this.confirmButtonText || '确定', icon: 'ibps-icon-ok', type: 'primary', action: () => this.handleOk() },
-          { key: 'clean', label: this.cleanButtonText || '清空', icon: 'ibps-icon-clean', type: 'info', action: () => this.handleClean() },
-          { key: 'cancel', label: this.cancelButtonText || '取消', icon: 'ibps-icon-cancel', action: () => this.handleCancel() }
-        ])
-      } else {
-        buttons = this.buttons
-      }
-      if (this.$utils.isEmpty(buttons)) {
-        return []
-      }
-      return buttons.map(button => {
-        if (button.action) {
-          const action = button.action
-          button.action = (e) => action(() => {}, this, e)
+    props: {
+        visible: Boolean, // 是否可见
+        title: { // 标题
+            type: String,
+            default: '选择器'
+        },
+        marginTop: { // Dialog CSS 中的 margin-top 值
+            type: String,
+            default: '5vh'
+        },
+        width: { // 宽
+            type: String,
+            default: '60%'
+        },
+        height: { // 高
+            type: String,
+            default: '400px'
+        },
+        closeOnClickModal: { // 是否可以通过点击 modal 关闭 Dialog
+            type: Boolean,
+            default: false
+        },
+        closeOnPressEscape: { // 是否可以通过按下 ESC 关闭 Dialog
+            type: Boolean,
+            default: false
+        },
+        showClose: { // 是否显示关闭按钮
+            type: Boolean,
+            default: true
+        },
+        beforeClose: { // 关闭前的回调,会暂停 Dialog 的关闭
+            type: Function
+        },
+        fullscreen: { // 是否为全屏 Dialog
+            type: Boolean,
+            default: false
+        },
+        labelKey: { // 展示的值
+            type: [String, Function],
+            default: 'name'
+        },
+        value: { // 值
+            type: [Object, Array],
+            default () { return this.multiple ? [] : {} }
+        },
+        cleanClose: { // 按钮清空并关闭
+            type: Boolean,
+            default: false
+        },
+        defaultButton: {
+            type: Boolean,
+            default: true
+        },
+        buttons: { // 按钮组
+            type: Array,
+            default () {
+                return []
+            }
+        },
+        confirmButtonText: {
+            type: String
+        },
+        cleanButtonText: {
+            type: String
+        },
+        cancelButtonText: {
+            type: String
+        },
+        multiple: { // 是否多选
+            type: Boolean,
+            default: false
+        },
+        isDisabled: { // 是否多选
+            type: Boolean,
+            default: false
         }
-        return button
-      })
-    }
-  },
-  watch: {
-    visible: {
-      handler: function(val, oldVal) {
-        this.dialogVisible = this.visible
-      },
-      immediate: true
-    }
-  },
-  methods: {
-    handleLabel(data) {
-      const config = this.labelKey
-      if (typeof config === 'function') {
-        return config(data)
-      } else if (typeof config === 'string') {
-        return data[config]
-      } else if (typeof config === 'undefined') {
-        const dataProp = data['name']
-        return dataProp === undefined ? '' : dataProp
-      }
     },
-    // 确定
-    handleOk() {
-      const data = this.multiple ? this.value.slice(0) : this.value
-      if (this.$utils.isEmpty(data)) {
-        ActionUtils.warning('请选择记录!')
-        return
-      }
-      this.$emit('input', data)
-      this.$emit('action-event', 'confirm', data)
-    },
-    // 清空
-    handleClean() {
-      const data = this.multiple ? [] : {}
-      if (!this.cleanClose) {
-        this.$emit('input', data)
-      }
-      this.$emit('action-event', 'clean', data)
+    data () {
+        return {
+            dialogVisible: this.visible
+        }
     },
-    // 取消
-    handleCancel() {
-      this.handleClose()
-      this.$emit('action-event', 'cancel')
+    computed: {
+        selectedItems () {
+            if (this.$utils.isEmpty(this.value)) { return [] }
+            if (this.multiple) {
+                const items = []
+                this.value.forEach(item => {
+                    items.push(this.handleLabel(item))
+                })
+                return items
+            } else {
+                return [this.handleLabel(this.value)]
+            }
+        },
+        bodyStyle () {
+            return {
+                height: this.height,
+                overflow: 'hidden'
+            }
+        },
+        buttonGroup () {
+            let buttons = []
+            if (this.$utils.isEmpty(this.buttons) && this.defaultButton) {
+                buttons = buttons.concat([
+                    { key: 'confirm', label: this.confirmButtonText || '确定', icon: 'ibps-icon-ok', type: 'primary', action: () => this.handleOk() },
+                    { key: 'clean', label: this.cleanButtonText || '清空', icon: 'ibps-icon-clean', type: 'info', action: () => this.handleClean() },
+                    { key: 'cleanAndClose', label: '清空并关闭', icon: 'ibps-icon-clean', type: 'warning', action: () => this.handleCleanAndClose() },
+                    { key: 'cancel', label: this.cancelButtonText || '取消', icon: 'ibps-icon-cancel', action: () => this.handleCancel() }
+                ])
+            } else {
+                buttons = this.buttons
+            }
+            if (this.$utils.isEmpty(buttons)) {
+                return []
+            }
+            return buttons.map(button => {
+                if (button.action) {
+                    const action = button.action
+                    button.action = (e) => action(() => {}, this, e)
+                }
+                return button
+            })
+        }
     },
-    // 关闭窗口
-    handleClose() {
-      this.$emit('close', false)
+    watch: {
+        visible: {
+            handler: function (val, oldVal) {
+                this.dialogVisible = this.visible
+            },
+            immediate: true
+        }
     },
-    /**
-     * 删除
-     */
-    handleRemove(index, bool) {
-      let res
-      let removeValue
-      if (this.multiple) {
-        const selected = JSON.parse(JSON.stringify(this.value))
-        selected.splice(index, 1)
-        res = selected
-        removeValue = this.value[index]
-      } else {
-        res = {}
-        removeValue = res
-      }
-      this.$emit('input', res)
-      this.$emit('remove-select', removeValue)
+    methods: {
+        handleLabel (data) {
+            const config = this.labelKey
+            if (typeof config === 'function') {
+                return config(data)
+            } else if (typeof config === 'string') {
+                return data[config]
+            } else if (typeof config === 'undefined') {
+                const dataProp = data['name']
+                return dataProp === undefined ? '' : dataProp
+            }
+        },
+        // 确定
+        handleOk () {
+            const data = this.multiple ? this.value.slice(0) : this.value
+            if (this.$utils.isEmpty(data)) {
+                ActionUtils.warning('请选择记录!')
+                return
+            }
+            this.$emit('input', data)
+            this.$emit('action-event', 'confirm', data)
+        },
+        // 清空
+        handleClean () {
+            const data = this.multiple ? [] : {}
+            if (!this.cleanClose) {
+                this.$emit('input', data)
+            }
+            this.$emit('action-event', 'clean', data)
+        },
+        // 清空并关闭
+        handleCleanAndClose () {
+            const data = this.multiple ? [] : {}
+            this.$emit('input', data)
+            this.$emit('action-event', 'confirm', data)
+            this.handleClose()
+        },
+        // 取消
+        handleCancel () {
+            this.handleClose()
+            this.$emit('action-event', 'cancel')
+        },
+        // 关闭窗口
+        handleClose () {
+            this.$emit('close', false)
+        },
+        /**
+   * 删除
+   */
+        handleRemove (index, bool) {
+            let res
+            let removeValue
+            if (this.multiple) {
+                const selected = JSON.parse(JSON.stringify(this.value))
+                selected.splice(index, 1)
+                res = selected
+                removeValue = this.value[index]
+            } else {
+                res = {}
+                removeValue = res
+            }
+            this.$emit('input', res)
+            this.$emit('remove-select', removeValue)
+        }
     }
-  }
 }
 </script>

+ 298 - 294
src/utils/action.js

@@ -14,309 +14,313 @@ import I18n from '@/utils/i18n'
 import common from '@/constants/common.js'
 
 const action = {
-  msg: function(message, options) {
-    Message.closeAll()
-    if (!options) {
-      options = options || {}
-    }
-    options.message = message
-    Message(options)
-  },
-  /**
-   * 操作警告提示
-   */
-  warning: function(message) {
-    this.msg(message, {
-      type: 'warning'
-    })
-  },
-  /**
-   * 操作成功提示
-   */
-  success: function(message) {
-    this.msg(message, {
-      type: 'success'
-    })
-  },
-  error: function(message) {
-    this.msg(message, {
-      type: 'error'
-    })
-  },
-  /**
-   * 默认操作成功提示
-   *  @param {*} message
-   */
-  successMessage: function(message = I18n.t('common.dialog.operateSuccess')) {
-    this.success(message)
-  },
-  /**
-   * 删除成功提示
-   * @param {*} message
-   */
-  removeSuccessMessage: function(message = I18n.t('common.dialog.removeSuccess')) {
-    this.success(message)
-  },
-  /**
- * 获取选择行的id
- * @param {*} rows
- * @param {*} pkKey
- */
-  getSelectedIds: function(rows, pkKey = 'id') {
-    const ids = []
-    rows.forEach(row => {
-      ids.push(row[pkKey])
-    })
-    return ids
-  },
-  /**
- * 选择记录
- * 只能选择一个记录
- * [一般用于编辑、明细等只选择一个记录]
- *
- * @param {*} selection
- */
-  selectedRecord: function(selection) {
-    return new Promise((resolve, reject) => {
-      if (Utils.isEmpty(selection)) {
-        this.warning(I18n.t('common.dialog.selectedRecords'))
-        return reject(selection)
-      }
-      if (Array.isArray(selection) && selection.length > 1) {
-        this.warning(I18n.t('common.dialog.multipleSelected'))
-        return reject(selection)
-      }
-      if (Array.isArray(selection)) {
-        resolve(selection[0])
-      } else {
-        resolve(selection)
-      }
-    })
-  },
-  /**
- * 选择多个记录
- * [一般用于删除等选择多个记录]
- *
- * @param {*} selection 选中的值
- * @param {*} isArray 是否数组格式返回 默认 false
- * @param {*} separator 分割符 默认 `,`
- */
-  selectedMultiRecord: function(selection, isArray = false, separator = ',') {
-    return new Promise((resolve, reject) => {
-      if (Utils.isEmpty(selection)) {
-        this.warning(I18n.t('common.dialog.selectedRecords'))
-        return reject(selection)
-      }
+    msg: function (message, options) {
+        Message.closeAll()
+        if (!options) {
+            options = options || {}
+        }
+        options.message = message
+        Message(options)
+    },
+    /**
+     * 操作警告提示
+     */
+    warning: function (message) {
+        this.msg(message, {
+            type: 'warning'
+        })
+    },
+    /**
+     * 操作成功提示
+     */
+    success: function (message) {
+        this.msg(message, {
+            type: 'success'
+        })
+    },
+    error: function (message) {
+        this.msg(message, {
+            type: 'error'
+        })
+    },
+    /**
+     * 默认操作成功提示
+     *  @param {*} message
+     */
+    successMessage: function (message = I18n.t('common.dialog.operateSuccess')) {
+        this.success(message)
+    },
+    /**
+     * 删除成功提示
+     * @param {*} message
+     */
+    removeSuccessMessage: function (message = I18n.t('common.dialog.removeSuccess')) {
+        this.success(message)
+    },
+    /**
+    * 没有权限编辑提示
+    * @param {*} message
+    */
+    noPowerMessage: function (message = I18n.t('common.dialog.noPower')) {
+        this.warning(message)
+    },
+    /**
+     * 获取选择行的id
+     * @param {*} rows
+     * @param {*} pkKey
+     */
+    getSelectedIds: function (rows, pkKey = 'id') {
+        const ids = []
+        rows.forEach(row => {
+            ids.push(row[pkKey])
+        })
+        return ids
+    },
+    /**
+     * 选择记录
+     * 只能选择一个记录
+     * [一般用于编辑、明细等只选择一个记录]
+     *
+     * @param {*} selection
+     */
+    selectedRecord: function (selection) {
+        return new Promise((resolve, reject) => {
+            if (Utils.isEmpty(selection)) {
+                this.warning(I18n.t('common.dialog.selectedRecords'))
+                return reject(selection)
+            }
+            if (Array.isArray(selection) && selection.length > 1) {
+                this.warning(I18n.t('common.dialog.multipleSelected'))
+                return reject(selection)
+            }
+            if (Array.isArray(selection)) {
+                resolve(selection[0])
+            } else {
+                resolve(selection)
+            }
+        })
+    },
+    /**
+     * 选择多个记录
+     * [一般用于删除等选择多个记录]
+     *
+     * @param {*} selection 选中的值
+     * @param {*} isArray 是否数组格式返回 默认 false
+     * @param {*} separator 分割符 默认 `,`
+     */
+    selectedMultiRecord: function (selection, isArray = false, separator = ',') {
+        return new Promise((resolve, reject) => {
+            if (Utils.isEmpty(selection)) {
+                this.warning(I18n.t('common.dialog.selectedRecords'))
+                return reject(selection)
+            }
 
-      if (!Array.isArray(selection)) {
-        selection = selection.split(separator)
-      }
-      if (!isArray) { // 不是数组返回
-        selection = selection.join(separator)
-      }
-      resolve(selection)
-    })
-  },
-  /**
- * 删除记录
- * @param {*} rows
- * @param {*} pkKey
- */
-  removeRecord: function(selection, confirmMsg = I18n.t('common.dialog.removeRecord'), isArray = false, separator = ',') {
-    return new Promise((resolve, reject) => {
-      if (Utils.isEmpty(selection)) {
-        this.warning(I18n.t('common.dialog.selectedRecords'))
-        return reject(selection)
-      }
+            if (!Array.isArray(selection)) {
+                selection = selection.split(separator)
+            }
+            if (!isArray) { // 不是数组返回
+                selection = selection.join(separator)
+            }
+            resolve(selection)
+        })
+    },
+    /**
+     * 删除记录
+     * @param {*} rows
+     * @param {*} pkKey
+     */
+    removeRecord: function (selection, confirmMsg = I18n.t('common.dialog.removeRecord'), isArray = false, separator = ',') {
+        return new Promise((resolve, reject) => {
+            if (Utils.isEmpty(selection)) {
+                this.warning(I18n.t('common.dialog.selectedRecords'))
+                return reject(selection)
+            }
 
-      if (!Array.isArray(selection)) {
-        selection = selection.split(separator)
-      }
-      if (!isArray) { // 不是数组返回
-        selection = selection.join(separator)
-      }
+            if (!Array.isArray(selection)) {
+                selection = selection.split(separator)
+            }
+            if (!isArray) { // 不是数组返回
+                selection = selection.join(separator)
+            }
 
-      MessageBox.confirm(confirmMsg, I18n.t('common.dialog.title'), {
-        type: 'warning'
-      }).then(() => {
-        resolve(selection)
-      }).catch((err) => {
-        reject(err)
-      })
-    })
-  },
+            MessageBox.confirm(confirmMsg, I18n.t('common.dialog.title'), {
+                type: 'warning'
+            }).then(() => {
+                resolve(selection)
+            }).catch((err) => {
+                reject(err)
+            })
+        })
+    },
+    /**
+     * 保存成功提示
+     */
+    saveSuccessMessage: function (message = I18n.t('common.dialog.operateSuccess'), callback) {
+        message = Utils.isNotEmpty(message) ? message : I18n.t('common.dialog.operateSuccess')
+        MessageBox.confirm(message,
+            I18n.t('common.dialog.title'),
+            {
+                type: 'success',
+                confirmButtonText: I18n.t('common.dialog.saveConfirmButtonText'),
+                cancelButtonText: I18n.t('common.dialog.saveCancelButtonText'),
+                closeOnClickModal: false,
+                callback: (action) => {
+                    const flag = action !== 'confirm'
+                    callback(flag)
+                }
+            })
+    },
 
-  /**
- * 保存成功提示
- */
-  saveSuccessMessage: function(message = I18n.t('common.dialog.operateSuccess'), callback) {
-    message = Utils.isNotEmpty(message) ? message : I18n.t('common.dialog.operateSuccess')
-    MessageBox.confirm(message,
-      I18n.t('common.dialog.title'),
-      {
-        type: 'success',
-        confirmButtonText: I18n.t('common.dialog.saveConfirmButtonText'),
-        cancelButtonText: I18n.t('common.dialog.saveCancelButtonText'),
-        closeOnClickModal: false,
-        callback: (action) => {
-          const flag = action !== 'confirm'
-          callback(flag)
-        }
-      })
-  },
+    /**
+     * 保存成功提示
+     */
+    saveSuccessAlert: function (message = I18n.t('common.dialog.operateSuccess'), callback) {
+        MessageBox.alert(message,
+            I18n.t('common.dialog.title'),
+            {
+                type: 'success',
+                closeOnClickModal: false,
+                showClose: false,
+                callback: (action) => {
+                    callback(action)
+                }
+            })
+    },
+    /**
+     * 保存失败
+     */
+    saveErrorMessage: function (message, callback) {
+        this.warning(message || I18n.t('common.dialog.saveError'))
+        if (callback) { callback() }
+    },
+    /**
+     * 处理列表数据
+     * @param vm 当前对象
+     * @param data 后台返回的列表数据
+     * @param options 参数
+     *   dataResultKey 默认 dataResult
+     *  pageResultKey 默认 pageResult
+     *  resultKey 结果key 默认 listData
+     *  pageKey 分页key 默认 pagination
+     */
+    handleListData: function (vm, data, options = {}) {
+        const dataResultKey = options.dataResultKey || 'dataResult'
+        const pageResultKey = options.pageResultKey || 'pageResult'
+        const resultKey = options.resultKey || 'listData'
+        const pageKey = options.pageKey || 'pagination'
+        vm[resultKey] = data ? data[dataResultKey] || [] : []
+        vm[pageKey] = data ? data[pageResultKey] || {} : {}
+    },
 
-  /**
- * 保存成功提示
- */
-  saveSuccessAlert: function(message = I18n.t('common.dialog.operateSuccess'), callback) {
-    MessageBox.alert(message,
-      I18n.t('common.dialog.title'),
-      {
-        type: 'success',
-        closeOnClickModal: false,
-        showClose: false,
-        callback: (action) => {
-          callback(action)
+    /**
+     *  设置分页设置
+     */
+    setPagination: function (pagination, defaultPagination) {
+        // 修复通过查询
+        if (!defaultPagination) {
+            defaultPagination = {
+                page: common.PAGE,
+                limit: pagination.limit || common.LIMIT
+            }
         }
-      })
-  },
-  /**
- * 保存失败
- */
-  saveErrorMessage: function(message, callback) {
-    this.warning(message || I18n.t('common.dialog.saveError'))
-    if (callback) { callback() }
-  },
-  /**
- * 处理列表数据
- * @param vm 当前对象
- * @param data 后台返回的列表数据
- * @param options 参数
- *   dataResultKey 默认 dataResult
- *  pageResultKey 默认 pageResult
- *  resultKey 结果key 默认 listData
- *  pageKey 分页key 默认 pagination
- */
-  handleListData: function(vm, data, options = {}) {
-    const dataResultKey = options.dataResultKey || 'dataResult'
-    const pageResultKey = options.pageResultKey || 'pageResult'
-    const resultKey = options.resultKey || 'listData'
-    const pageKey = options.pageKey || 'pagination'
-    vm[resultKey] = data ? data[dataResultKey] || [] : []
-    vm[pageKey] = data ? data[pageResultKey] || {} : {}
-  },
-
-  /**
- *  设置分页设置
- */
-  setPagination: function(pagination, defaultPagination) {
-    // 修复通过查询
-    if (!defaultPagination) {
-      defaultPagination = {
-        page: common.PAGE,
-        limit: pagination.limit || common.LIMIT
-      }
-    }
-    pagination.page = defaultPagination ? (defaultPagination.page || common.PAGE) : (pagination.page || common.PAGE)
-    pagination.limit = defaultPagination ? (defaultPagination.limit || common.LIMIT) : (pagination.limit || common.LIMIT)
-  },
-  /**
-   * 设置分页第一页设置
-   * @param {*} pagination
-   * @param {*} defaultPagination
-   */
-  setFirstPagination: function(pagination) {
-    pagination.page = common.PAGE
-  },
-  /**
- * 设置排序
- */
-  setSorts: function(sorts, sort, defaultSorts = {}) {
-    const defaultSortsData = function() {
-      for (const key in defaultSorts) {
-        sorts[key] = defaultSorts[key]
-      }
-    }
-    // 清空属性
-    for (const key in sorts) {
-      delete sorts[key]
-    }
-    if (sort) {
-      const { name, sortBy, order } = sort
-      if (name && order) {
-        sorts[name] = order === 'ascending' ? 'ASC' : 'DESC'
-      } else if (sortBy && order) {
-        sorts[sortBy] = order === 'ascending' ? 'ASC' : 'DESC'
-      } else {
-        defaultSortsData()
-      }
-    } else {
-      defaultSortsData()
-    }
-  },
-
-  /**
- * 格式分页数据
- * @param {} params 查询的参数
- * @param {} page 分页
- * @param {} sorts 排序
- */
-  formatParams: function(params, page, sorts) {
-    const results = {}
-    if (params) {
-      results.parameters = Object.keys(params).map((k) => {
-          return k === 'arg' ? params[k] : {
-              'key': k,
-              'value': params[k]
-          }
-      })
-  }
-    if (page) {
-      results.requestPage = {
-        'pageNo': page.page || common.PAGE,
-        'limit': page.limit || common.LIMIT
-      }
-      if (Utils.isNotEmpty(page.totalCount)) { // mock 数据时候要传
-        results.requestPage['totalCount'] = page.totalCount
-      }
-    }
-    if (sorts) {
-      results.sorts = Object.keys(sorts).map((k) => {
-        return {
-          'field': k,
-          'order': sorts[k]
+        pagination.page = defaultPagination ? (defaultPagination.page || common.PAGE) : (pagination.page || common.PAGE)
+        pagination.limit = defaultPagination ? (defaultPagination.limit || common.LIMIT) : (pagination.limit || common.LIMIT)
+    },
+    /**
+     * 设置分页第一页设置
+     * @param {*} pagination
+     * @param {*} defaultPagination
+     */
+    setFirstPagination: function (pagination) {
+        pagination.page = common.PAGE
+    },
+    /**
+     * 设置排序
+     */
+    setSorts: function (sorts, sort, defaultSorts = {}) {
+        const defaultSortsData = function () {
+            for (const key in defaultSorts) {
+                sorts[key] = defaultSorts[key]
+            }
+        }
+        // 清空属性
+        for (const key in sorts) {
+            delete sorts[key]
+        }
+        if (sort) {
+            const { name, sortBy, order } = sort
+            if (name && order) {
+                sorts[name] = order === 'ascending' ? 'ASC' : 'DESC'
+            } else if (sortBy && order) {
+                sorts[sortBy] = order === 'ascending' ? 'ASC' : 'DESC'
+            } else {
+                defaultSortsData()
+            }
+        } else {
+            defaultSortsData()
+        }
+    },
+    /**
+     * 格式分页数据
+     * @param {} params 查询的参数
+     * @param {} page 分页
+     * @param {} sorts 排序
+     */
+    formatParams: function (params, page, sorts) {
+        const results = {}
+        if (params) {
+            results.parameters = Object.keys(params).map((k) => {
+                return k === 'arg' ? params[k] : {
+                    'key': k,
+                    'value': params[k]
+                }
+            })
+        }
+        if (page) {
+            results.requestPage = {
+                'pageNo': page.page || common.PAGE,
+                'limit': page.limit || common.LIMIT
+            }
+            if (Utils.isNotEmpty(page.totalCount)) { // mock 数据时候要传
+                results.requestPage['totalCount'] = page.totalCount
+            }
+        }
+        if (sorts) {
+            results.sorts = Object.keys(sorts).map((k) => {
+                return {
+                    'field': k,
+                    'order': sorts[k]
+                }
+            })
         }
-      })
-    }
 
-    return results
-  },
-  /**
- * 下载
- */
-  download: function(data, fileName, responseType = 'application/octet-stream') {
-    const blob = data instanceof Blob ? data : new Blob([data], { type: responseType })
-    if ('download' in document.createElement('a')) { // 非IE下载
-      const url = window.URL.createObjectURL(blob)
-      const link = document.createElement('a')
-      link.style.display = 'none'
-      link.href = url
-      link.setAttribute('download', fileName)
-      document.body.appendChild(link)
-      link.click()
-      window.URL.revokeObjectURL(link.href)
-      document.body.removeChild(link)
-    } else { // IE10+下载
-      navigator.msSaveBlob(blob, fileName)
+        return results
+    },
+    /**
+     * 下载
+     */
+    download: function (data, fileName, responseType = 'application/octet-stream') {
+        const blob = data instanceof Blob ? data : new Blob([data], { type: responseType })
+        if ('download' in document.createElement('a')) { // 非IE下载
+            const url = window.URL.createObjectURL(blob)
+            const link = document.createElement('a')
+            link.style.display = 'none'
+            link.href = url
+            link.setAttribute('download', fileName)
+            document.body.appendChild(link)
+            link.click()
+            window.URL.revokeObjectURL(link.href)
+            document.body.removeChild(link)
+        } else { // IE10+下载
+            navigator.msSaveBlob(blob, fileName)
+        }
+    },
+    /**
+     * 导出文件
+     */
+    exportFile: function (data, fileName, responseType = 'application/octet-stream') {
+        this.download(data, fileName, responseType)
     }
-  },
-
-  /**
- * 导出文件
- */
-  exportFile: function(data, fileName, responseType = 'application/octet-stream') {
-    this.download(data, fileName, responseType)
-  }
 
 }
 

+ 65 - 46
src/utils/util.js

@@ -15,7 +15,6 @@
 import log from './util.log.js'
 import cookies from './util.cookies.js'
 import XSS from 'xss'
-import { mapValues } from 'lodash'
 const rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g
 
 const util = {
@@ -25,7 +24,7 @@ const util = {
      * 判断是否为空
      * @param {*} obj
      */
-    isEmpty: function (obj, allowBlank = false) {
+    isEmpty (obj, allowBlank = false) {
         if (util.isNull(obj)) return true
         if (util.isArray(obj)) return obj.length === 0
         if (util.isString(obj)) return (!(allowBlank || obj.length > 0))
@@ -37,14 +36,14 @@ const util = {
      * 判断是否不为空
      * @param {*} obj
      */
-    isNotEmpty: function (obj, allowBlank = false) {
+    isNotEmpty (obj, allowBlank = false) {
         return !util.isEmpty(obj, allowBlank)
     },
     /**
      * 判断是否为空对象
      * @param {*} obj
      */
-    isEmptyObject: function (obj) {
+    isEmptyObject (obj) {
         if (!obj) return true
         for (const name in obj) {
             return false
@@ -55,42 +54,42 @@ const util = {
      * 判断是否为不空对象
      * @param {*} obj
      */
-    isNotEmptyObject: function (obj) {
+    isNotEmptyObject (obj) {
         return util.isNotEmptyObject(obj)
     },
     /**
      * 是否是对象
      * @param {*} input
      */
-    isObject: function (input) {
+    isObject (input) {
         return Object.prototype.toString.call(input) === '[object Object]'
     },
     /**
      * 是否是数组
      * @param {*} input
      */
-    isArray: function (input) {
+    isArray (input) {
         return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'
     },
-    isDate: function (input) {
+    isDate (input) {
         return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'
     },
-    isNumber: function (input) {
+    isNumber (input) {
         return input instanceof Number || Object.prototype.toString.call(input) === '[object Number]'
     },
-    isString: function (input) {
+    isString (input) {
         return input instanceof String || Object.prototype.toString.call(input) === '[object String]'
     },
-    isBoolean: function (input) {
+    isBoolean (input) {
         return typeof input === 'boolean'
     },
-    isFunction: function (input) {
+    isFunction (input) {
         return typeof input === 'function'
     },
-    isNull: function (input) {
+    isNull (input) {
         return input === undefined || input === null
     },
-    isNum: function (input) {
+    isNum (input) {
         if (util.isEmpty(input)) {
             return false
         } else {
@@ -103,10 +102,10 @@ const util = {
             return util.isNumber(input)
         }
     },
-    isValidNumber: function (t) {
+    isValidNumber (t) {
         return typeof t === 'number' && !isNaN(t) && isFinite(t)
     },
-    isPlainObject: function (obj) {
+    isPlainObject (obj) {
         if (obj && Object.prototype.toString.call(obj) === '[object Object]' && obj.constructor === Object && !hasOwnProperty.call(obj, 'constructor')) {
             var key
             for (var k in obj) {
@@ -116,7 +115,7 @@ const util = {
         }
         return false
     },
-    isJSON: function (str) {
+    isJSON (str) {
         if (util.isString(str)) {
             try {
                 const obj = JSON.parse(str)
@@ -127,13 +126,13 @@ const util = {
         }
         return false
     },
-    trim: function (text) {
+    trim (text) {
         return text == null ? '' : (text + '').replace(rtrim, '')
     },
     /**
      * 判断参数是否是其中之一
      */
-    oneOf: function (value, validList) {
+    oneOf (value, validList) {
         for (let i = 0; i < validList.length; i++) {
             if (value === validList[i]) {
                 return true
@@ -144,7 +143,7 @@ const util = {
     /**
      * 判断参数是否是数组对象其中之一
      */
-    oneOfObj: function (value, validList, key) {
+    oneOfObj (value, validList, key) {
         for (let i = 0; i < validList.length; i++) {
             if (value === validList[i][key]) {
                 return true
@@ -155,7 +154,7 @@ const util = {
     /**
      * 全局唯一标识符
      */
-    guid: function () {
+    guid () {
         return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
             const r = Math.random() * 16 | 0
             const v = c === 'x' ? r : (r & 0x3 | 0x8)
@@ -167,7 +166,7 @@ const util = {
      * @param {*} obj
      * @param {*} defaultValue
      */
-    toBoolean: function (obj, defaultValue = false) {
+    toBoolean (obj, defaultValue = false) {
         if (util.isEmpty(obj)) {
             return defaultValue
         }
@@ -178,7 +177,7 @@ const util = {
      * @param {*} data
      * @param {*} defaultValue
      */
-    newData: function (data, defaultValue) {
+    newData (data, defaultValue) {
         return util.isNotEmpty(data) ? JSON.parse(JSON.stringify(data)) : (defaultValue || data)
     },
     /**
@@ -186,7 +185,7 @@ const util = {
      * @param {*} data
      * @param {*} defaultValue
      */
-    parseData: function (data, defaultValue) {
+    parseData (data, defaultValue) {
         if (util.isNotEmpty(data)) {
             // eslint-disable-next-line no-eval
             return util.isPlainObject(data) || util.isArray(data) ? data : window.eval('(' + data + ')')
@@ -199,7 +198,7 @@ const util = {
      * @param {*} data
      * @param {*} defaultValue
      */
-    parseJSON: function (data, defaultValue) {
+    parseJSON (data, defaultValue) {
         if (util.isNotEmpty(data)) {
             return util.isJSON(data) ? JSON.parse(data) : data
         } else {
@@ -209,8 +208,8 @@ const util = {
     /**
      * eval 数据
      */
-    evalData: function (data) {
-        // eslint-disable-next-line no-eval
+    evalData (data) {
+    // eslint-disable-next-line no-eval
         return window.eval(data)
     },
     /**
@@ -230,7 +229,7 @@ const util = {
      * console.log( util.formatSize( 1024 * 1024 * 1024 ) );    // => 1.00G
      * console.log( util.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) );    // => 1024MB
      */
-    formatSize: function (size, pointLength, units) {
+    formatSize (size, pointLength, units) {
         units = units || ['B', 'K', 'M', 'G', 'TB']
         let unit
         while ((unit = units.shift()) && size > 1024) {
@@ -242,14 +241,14 @@ const util = {
      * 格式化文本
      * @param {*} text
      */
-    formatText: function (text) {
+    formatText (text) {
         return text !== null ? ('' + XSS(text)).replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + '<br />' + '$2') : ''
     },
     /**
      * @description 打开新页面
      * @param {String} url 地址
      */
-    open: function (url) {
+    open (url) {
         var a = document.createElement('a')
         a.setAttribute('href', url)
         a.setAttribute('target', '_blank')
@@ -264,7 +263,7 @@ const util = {
      * @param {*} predicate
      * @param {*} result
      */
-    flatten: function (ary, predicate, result) {
+    flatten (ary, predicate, result) {
         result = result || []
         if (ary) {
             for (let i = 0; i < ary.length; i++) {
@@ -279,26 +278,46 @@ const util = {
         return result
     },
     /**
-     * 替换对象中的null为空字符串
-     * @param  {Object} obj 目标对象
+     * 在字符串oldIds里增加或者剔除fixId
+     * @param {*} type
+     * @param {*} oldIds
+     * @param {*} fixId
+     * @returns
      */
-    replaceNullWithEmpty: function (obj) {
-        function replaceValue(value) {
-            if (value === null) {
-                return ''
-            } else if (typeof value === 'object') {
-                if (Array.isArray(value)) {
-                    return value.map(item => replaceValue(item))
-                } else {
-                    return mapValues(value, v => replaceValue(v))
+    addOrDelString (type, oldIds, fixId) {
+        const oldIdsArr = oldIds.split(',')
+        if (type === 'remove') {
+            oldIdsArr.splice(oldIdsArr.indexOf(fixId), 1)
+            oldIds = oldIdsArr.join(',')
+        } else {
+            if (oldIds && oldIds.indexOf(fixId) < 0) {
+                oldIdsArr.push(fixId)
+                oldIds = oldIdsArr.join(',')
+            } else if (!oldIds) {
+                oldIds = fixId
+            }
+        }
+        return oldIds
+    },
+    /**
+     * 有些浏览器不支持indexOf属性
+     * @param {*} arr 数组
+     * @param {*} item 被检索的字符串
+     * @returns
+     */
+    getIndexOf (arr, item) {
+        if (Array.prototype.indexOf) {
+            return arr.indexOf(item)
+        } else {
+            for (var i = 0; i < arr.length; i++) {
+                if (arr[i] === item) {
+                    return i
                 }
-            } else {
-                return value
             }
         }
-        return replaceValue(obj)
+        return -1
     }
-    
+
 }
 
 export default util

Неке датотеке нису приказане због велике количине промена