Преглед изворни кода

模板过滤条件同步(在其中)

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

+ 41 - 40
src/components/ibps-query-builder/constants/index.js

@@ -10,14 +10,14 @@ const QueryBuilder = {
  * @private
  */
 QueryBuilder.TYPES = {
-  'string': 'string',
-  'integer': 'number',
-  'double': 'number',
-  'number': 'number',
-  'date': 'datetime',
-  'time': 'datetime',
-  'datetime': 'datetime',
-  'boolean': 'boolean'
+    'string': 'string',
+    'integer': 'number',
+    'double': 'number',
+    'number': 'number',
+    'date': 'datetime',
+    'time': 'datetime',
+    'datetime': 'datetime',
+    'boolean': 'boolean'
 }
 
 /**
@@ -28,15 +28,15 @@ QueryBuilder.TYPES = {
  * @private
  */
 QueryBuilder.INPUTS = [
-  'text',
-  'number',
-  'textarea',
-  'radio',
-  'checkbox',
-  'select',
-  'date',
-  'datetime',
-  'custom'
+    'text',
+    'number',
+    'textarea',
+    'radio',
+    'checkbox',
+    'select',
+    'date',
+    'datetime',
+    'custom'
 ]
 
 /**
@@ -47,31 +47,32 @@ QueryBuilder.INPUTS = [
  *  apply_to :应用
  */
 QueryBuilder.OPERATORS = {
-  equal: { type: 'equal', nb_inputs: 1, multiple: false, apply_to: ['string', 'number', 'datetime', 'boolean'] },
-  not_equal: { type: 'not_equal', nb_inputs: 1, multiple: false, apply_to: ['string', 'number', 'datetime', 'boolean'] },
-  in: { type: 'in', nb_inputs: 1, multiple: true, apply_to: ['string', 'number', 'datetime'] },
-  not_in: { type: 'not_in', nb_inputs: 1, multiple: true, apply_to: ['string', 'number', 'datetime'] },
-  less: { type: 'less', nb_inputs: 1, multiple: false, apply_to: ['number', 'datetime'] },
-  less_or_equal: { type: 'less_or_equal', nb_inputs: 1, multiple: false, apply_to: ['number', 'datetime'] },
-  greater: { type: 'greater', nb_inputs: 1, multiple: false, apply_to: ['number', 'datetime'] },
-  greater_or_equal: { type: 'greater_or_equal', nb_inputs: 1, multiple: false, apply_to: ['number', 'datetime'] },
-  between: { type: 'between', nb_inputs: 2, multiple: false, apply_to: ['number', 'datetime'] },
-  not_between: { type: 'not_between', nb_inputs: 2, multiple: false, apply_to: ['number', 'datetime'] },
-  begins_with: { type: 'begins_with', nb_inputs: 1, multiple: false, apply_to: ['string'] },
-  not_begins_with: { type: 'not_begins_with', nb_inputs: 1, multiple: false, apply_to: ['string'] },
-  contains: { type: 'contains', nb_inputs: 1, multiple: false, apply_to: ['string'] },
-  not_contains: { type: 'not_contains', nb_inputs: 1, multiple: false, apply_to: ['string'] },
-  ends_with: { type: 'ends_with', nb_inputs: 1, multiple: false, apply_to: ['string'] },
-  not_ends_with: { type: 'not_ends_with', nb_inputs: 1, multiple: false, apply_to: ['string'] },
-  is_empty: { type: 'is_empty', nb_inputs: 0, multiple: false, apply_to: ['string'] },
-  is_not_empty: { type: 'is_not_empty', nb_inputs: 0, multiple: false, apply_to: ['string'] },
-  is_null: { type: 'is_null', nb_inputs: 0, multiple: false, apply_to: ['string', 'number', 'datetime', 'boolean'] },
-  is_not_null: { type: 'is_not_null', nb_inputs: 0, multiple: false, apply_to: ['string', 'number', 'datetime', 'boolean'] }
+    equal: { type: 'equal', nb_inputs: 1, multiple: false, apply_to: ['string', 'number', 'datetime', 'boolean'] },
+    not_equal: { type: 'not_equal', nb_inputs: 1, multiple: false, apply_to: ['string', 'number', 'datetime', 'boolean'] },
+    in: { type: 'in', nb_inputs: 1, multiple: true, apply_to: ['string', 'number', 'datetime'] },
+    not_in: { type: 'not_in', nb_inputs: 1, multiple: true, apply_to: ['string', 'number', 'datetime'] },
+    less: { type: 'less', nb_inputs: 1, multiple: false, apply_to: ['number', 'datetime'] },
+    less_or_equal: { type: 'less_or_equal', nb_inputs: 1, multiple: false, apply_to: ['number', 'datetime'] },
+    greater: { type: 'greater', nb_inputs: 1, multiple: false, apply_to: ['number', 'datetime'] },
+    greater_or_equal: { type: 'greater_or_equal', nb_inputs: 1, multiple: false, apply_to: ['number', 'datetime'] },
+    between: { type: 'between', nb_inputs: 2, multiple: false, apply_to: ['number', 'datetime'] },
+    not_between: { type: 'not_between', nb_inputs: 2, multiple: false, apply_to: ['number', 'datetime'] },
+    begins_with: { type: 'begins_with', nb_inputs: 1, multiple: false, apply_to: ['string'] },
+    not_begins_with: { type: 'not_begins_with', nb_inputs: 1, multiple: false, apply_to: ['string'] },
+    contains: { type: 'contains', nb_inputs: 1, multiple: false, apply_to: ['string'] },
+    not_contains: { type: 'not_contains', nb_inputs: 1, multiple: false, apply_to: ['string'] },
+    ends_with: { type: 'ends_with', nb_inputs: 1, multiple: false, apply_to: ['string'] },
+    not_ends_with: { type: 'not_ends_with', nb_inputs: 1, multiple: false, apply_to: ['string'] },
+    is_empty: { type: 'is_empty', nb_inputs: 0, multiple: false, apply_to: ['string'] },
+    is_not_empty: { type: 'is_not_empty', nb_inputs: 0, multiple: false, apply_to: ['string'] },
+    is_null: { type: 'is_null', nb_inputs: 0, multiple: false, apply_to: ['string', 'number', 'datetime', 'boolean'] },
+    is_not_null: { type: 'is_not_null', nb_inputs: 0, multiple: false, apply_to: ['string', 'number', 'datetime', 'boolean'] },
+    find_in_set: { type: 'find_in_set', nb_inputs: 1, multiple: false, apply_to: ['string', 'number', 'datetime', 'boolean'] }
 }
 QueryBuilder.SOURCES = {
-  'fixed': 'fixed',
-  'script': 'script',
-  'dynamic': 'dynamic'
+    'fixed': 'fixed',
+    'script': 'script',
+    'dynamic': 'dynamic'
 }
 
 export default QueryBuilder

+ 6 - 4
src/locales/en.json

@@ -28,7 +28,7 @@
 			"removeAllToken": "Delete all tokens",
 			"removeToken": "Delete token",
 			"resetSearch": "Reset",
-			"delete":"Delete",
+			"delete": "Delete",
 			"save": "Save",
 			"search": "Search",
 			"toBottom": "Move last",
@@ -179,7 +179,8 @@
 				"not_contains": "Does not contain the following",
 				"not_ends_with": "Do not end with",
 				"not_equal": "Not equal to",
-				"not_in": "Not In"
+				"not_in": "Not In",
+				"find_in_set": "In it"
 			},
 			"remove_group": "Delete Group",
 			"remove_rule": "Delete",
@@ -750,7 +751,8 @@
 					"name": "Name",
 					"orgPath": "Org path",
 					"status": "Status",
-					"wcAccount": "WeChat account"
+					"wcAccount": "WeChat account",
+					"job": "Role"
 				},
 				"title": "Staff"
 			},
@@ -862,4 +864,4 @@
 		"zip": "Please enter the correct postal code."
 	},
 	"welcome": "Welcome to the IBPS platform"
-}
+}

+ 6 - 4
src/locales/ja.json

@@ -28,7 +28,7 @@
 			"removeAllToken": "すべてのトークンを削除",
 			"removeToken": "トークンを削除",
 			"resetSearch": "リセットする",
-			"delete":"削除",
+			"delete": "削除",
 			"save": "保存する",
 			"search": "検索する",
 			"toBottom": "最後の壱条に移る",
@@ -179,7 +179,8 @@
 				"not_contains": "以下を含まない",
 				"not_ends_with": "で終わらないでください",
 				"not_equal": "等しくない",
-				"not_in": "ではない"
+				"not_in": "ではない",
+				"find_in_set": "その中で"
 			},
 			"remove_group": "グループを削除",
 			"remove_rule": "削除する",
@@ -750,7 +751,8 @@
 					"name": "お名前",
 					"orgPath": "帰属組織パス",
 					"status": "州",
-					"wcAccount": "企業のWeChatアカウント"
+					"wcAccount": "企業のWeChatアカウント",
+					"job": "ポジションです"
 				},
 				"title": "従業員"
 			},
@@ -862,4 +864,4 @@
 		"zip": "正しい郵便番号を入力してください。"
 	},
 	"welcome": "IBPSプラットフォームへようこそ"
-}
+}

+ 11 - 8
src/locales/zh-CN.json

@@ -28,7 +28,7 @@
 			"removeAllToken": "删除全部令牌",
 			"removeToken": "删除令牌",
 			"resetSearch": "重置",
-			"delete":"删除",
+			"delete": "删除",
 			"save": "保存",
 			"search": "查询",
 			"toBottom": "移至最后一条",
@@ -39,6 +39,7 @@
 		"copyright": "版权所有",
 		"dialog": {
 			"multipleSelected": "已经选择了多项,请选择一项进行操作!",
+			"noPower":"非管理员没有权限编辑他人数据!",
 			"operateSuccess": "操作成功",
 			"removeRecord": "此操作将永久删除该数据, 是否确定?",
 			"removeSuccess": "删除成功!",
@@ -179,7 +180,8 @@
 				"not_contains": "不包含以下内容",
 				"not_ends_with": "不以...结束",
 				"not_equal": "不等于",
-				"not_in": "不在...之內"
+				"not_in": "不在...之內",
+				"find_in_set": "在其中"
 			},
 			"remove_group": "删除组",
 			"remove_rule": "删除",
@@ -643,7 +645,7 @@
 			"male": "男"
 		},
 		"logIn": "登录",
-		"logOut": "注销",
+		"logOut": "退出登录",
 		"method": {
 			"smsCode": "短信验证码",
 			"thirdparty": "第三方授权登录",
@@ -674,8 +676,8 @@
 	},
 	"logout": {
 		"cancelButtonText": "放弃",
-		"confirmButtonText": "确定注销",
-		"message": "注销当前账户吗? 打开的标签页和用户设置将会被保存。",
+		"confirmButtonText": "确定退出",
+		"message": "退出当前登录账户吗? 打开的标签页和用户设置将会被保存。",
 		"title": "确认操作"
 	},
 	"navbar": {
@@ -687,7 +689,7 @@
 		"fullscreen": "全屏",
 		"language": "语言",
 		"lockScreen": "锁屏",
-		"logOut": "注销",
+		"logOut": "退出登录",
 		"logo": {
 			"title": "IBPS 开发平台"
 		},
@@ -750,7 +752,8 @@
 					"name": "姓名",
 					"orgPath": "归属组织路径",
 					"status": "状态",
-					"wcAccount": "企业微信账户"
+					"wcAccount": "企业微信账户",
+					"job": "角色"
 				},
 				"title": "员工"
 			},
@@ -875,4 +878,4 @@
 		"zip": "请输入正确邮政编码."
 	},
 	"welcome": "欢迎使用 IBPS 平台"
-}
+}

+ 6 - 4
src/locales/zh-TW.json

@@ -28,7 +28,7 @@
 			"removeAllToken": "刪除全部令牌",
 			"removeToken": "刪除令牌",
 			"resetSearch": "重置",
-			"delete":"删除",
+			"delete": "删除",
 			"save": "保存",
 			"search": "查询",
 			"toBottom": "移至最後壹條",
@@ -179,7 +179,8 @@
 				"not_contains": "不包含以下內容",
 				"not_ends_with": "不以...結束",
 				"not_equal": "不等於",
-				"not_in": "不在...之內"
+				"not_in": "不在...之內",
+				"find_in_set": "在其中"
 			},
 			"remove_group": "刪除組",
 			"remove_rule": "刪除",
@@ -750,7 +751,8 @@
 					"name": "姓名",
 					"orgPath": "歸屬組織路徑",
 					"status": "狀態",
-					"wcAccount": "企業微信賬戶"
+					"wcAccount": "企業微信賬戶",
+					"job": "角色"
 				},
 				"title": "員工"
 			},
@@ -862,4 +864,4 @@
 		"zip": "請輸入正確郵政編碼."
 	},
 	"welcome": "歡迎使用 IBPS 平台"
-}
+}

+ 250 - 223
src/views/platform/data/dataTemplate/template-list.vue

@@ -1,12 +1,12 @@
 <template>
-  <div v-if="$utils.isNotEmpty(dataTemplate)">
-    <data-template-render
-      :data="dataTemplate"
-      :height="height"
-      :dynamic-params="dynamicParams"
-    />
-  </div>
-  <div v-else class="ibps-container-frame" />
+    <div v-if="$utils.isNotEmpty(dataTemplate)">
+        <data-template-render
+            :data="dataTemplate"
+            :height="height"
+            :dynamic-params="dynamicParams"
+        />
+    </div>
+    <div v-else class="ibps-container-frame" />
 </template>
 <script>
 import { getBuildDataById } from '@/api/platform/data/dataTemplate'
@@ -16,247 +16,274 @@ import DataTemplateRender from '@/business/platform/data/templaterender'
 import { buildFelds } from '@/business/platform/data/templaterender/utils'
 
 export default {
-  components: {
-    DataTemplateRender
-  },
-  props: {
-      height: [String, Number],
-      dynamicParams: {
-          type: Object
-      },
-      filterParams: {
-          type: Array
-      },
-      templateId: {
-          type: String,
-          default: ''
-      },
-      typeName: {
-          type: String,
-          default: ''
-      },
-      typeId: {
-          type: String,
-          default: ''
-      }
-   },
-  data() {
-    return {
-      dataTemplate: {},
-      dataTemplateId: ''
-    }
-  },
-  watch: {
-    '$route': {
-      handler(val, oldVal) {
-        if (val === oldVal) {
-          return
-        }
-        this.$nextTick(() => {
-          const defaultUrl = this.$route.meta.defaultUrl
-          const isDashboard = this.$route.name
-          if (this.$utils.isNotEmpty(defaultUrl)) {
-            // 判断地址是否正确
-            const url = defaultUrl.split('/')
-            this.dataTemplateId = url[url.length - 1]
-          } else if (isDashboard === 'dashboard') {
-            this.dataTemplateId = this.templateId
-          } else {
-            const params = this.$route.params
-            this.dataTemplateId = params.id
-          }
-          if (this.$utils.isEmpty(this.dataTemplateId)) {
-            this.$alert('参数错误,未获取模版ID')
-            return
-          }
-          this.loadDataTemplate()
-        })
-      },
-      deep: true,
-      immediate: true
+    components: {
+        DataTemplateRender
     },
-  },
-  methods: {
-    loadDataTemplate() {
-      const loading = this.$loading({
-        lock: false,
-        background: 'transparent'
-      })
-      this.dataTemplate = {}
-      getBuildDataById({
-        dataTemplateId: this.templateId || this.dataTemplateId,
-        isFilterForm: false,
-        isRightsFilter: true
-      }).then(response => {
-        // 从后台获取数据
-        const data = this.$utils.parseData(response.data)
-        if (data && data.attrs && this.$utils.isNotEmpty(data.attrs.form_key)) {
-          getFormDataByFormKey({
-            formKey: data.attrs.form_key
-          }).then(response => {
-            const formData = this.$utils.parseData(response.data)
-            const datasets = buildFelds(formData.fields, data.datasets)
-            data.datasets = datasets
-            this.dataTemplate = data
-            setTimeout(() => {
-              loading.close()
-            }, 1000)
-          }).catch(() => {
-            loading.close()
-          })
-        } else {
-          this.dataTemplate = data
-          setTimeout(() => {
-            loading.close()
-          }, 1000)
+    props: {
+        height: [String, Number],
+        dynamicParams: {
+            type: Object
+        },
+        filterParams: {
+            type: Array
+        },
+        templateId: {
+            type: String,
+            default: ''
+        },
+        typeName: {
+            type: String,
+            default: ''
+        },
+        typeId: {
+            type: String,
+            default: ''
         }
-      }).catch(() => {
-        loading.close()
-      })
     },
-    buildFelds(fields, datasets) {
-      const fieldMap = {}
-      fields.forEach(field => {
-        if (field.field_type === 'grid' || field.field_type === 'tabs') {
-          field.field_options.columns.forEach(column => {
-            column.fields.forEach(cfield => {
-              fieldMap[cfield.field_name] = cfield
-            })
-          })
-        } else {
-          fieldMap[field.field_name] = field
-        }
-      })
-      const rtn = []
-      datasets.forEach(dataset => {
-        const field = fieldMap[dataset.name]
-        if (this.$utils.isNotEmpty(field)) {
-          dataset.field_type = field.field_type
-          dataset.field_options = field.field_options
+    data () {
+        return {
+            dataTemplate: {},
+            dataTemplateId: ''
         }
-        rtn.push(dataset)
-      })
-      return rtn
     },
-    dealData ({ showType, templates }) {
-                if (showType !== 'list') {
-                    return templates
+    watch: {
+        '$route': {
+            handler (val, oldVal) {
+                if (val === oldVal) {
+                    return
+                }
+                this.$nextTick(() => {
+                    const defaultUrl = this.$route.meta.defaultUrl
+                    const isDashboard = this.$route.name
+                    if (this.$utils.isNotEmpty(defaultUrl)) {
+                        // 判断地址是否正确
+                        const url = defaultUrl.split('/')
+                        this.dataTemplateId = url[url.length - 1]
+                    } else if (isDashboard === 'dashboard') {
+                        this.dataTemplateId = this.templateId
+                    } else {
+                        const params = this.$route.params
+                        this.dataTemplateId = params.id
+                    }
+                    if (this.$utils.isEmpty(this.dataTemplateId) && this.$utils.isEmpty(this.templateId)) {
+                        this.$alert('参数错误,未获取模版ID')
+                        return
+                    }
+                    this.loadDataTemplate()
+                })
+            },
+            deep: true,
+            immediate: true
+        },
+        // 不同的 typeId 可能会有相同的 templateId
+        // templateId: {
+        //     handler (val) {
+        //         console.log('templateId', val)
+        //         if (this.$utils.isNotEmpty(val)) {
+        //             this.dataTemplateId = val
+        //             this.loadDataTemplate()
+        //         }
+        //     },
+        //     immediate: true
+        // },
+        typeId: {
+            handler (val) {
+                if (this.$utils.isNotEmpty(val)) {
+                    this.dataTemplateId = this.templateId
+                    this.loadDataTemplate()
                 }
-                const data = templates[0]
-                // 替换列表标题
-                data.attrs.display_field = this.typeName
-                // 替换按钮
-                data.buttons.function_buttons = this.dealButtom(data.buttons.function_buttons)
-                // 增加过滤信息
-                data.filter_conditions = this.dealFilter(data.filter_conditions)
-                // 处理查询条件默认值,数据模板中的查询条件默认值如果与模板归档中的配置冲突,则优先使用归档中的配置
-                data.query_columns = this.dealQueryColumns(data.query_columns)
-                return [data]
             },
-    dealButtom (buttons) {
-        const keys = ['search', 'remove', 'consult', 'detail']
-        if (!buttons.length) {
-            return []
+            immediate: true
         }
-        const defaultBtn = buttons.filter(i => keys.includes(i.button_type))
-        const customBtn = buttons.filter(i => i.show_on_record === 'Y')
-        return [...defaultBtn, ...customBtn]
     },
-    dealFilter (dataList) {
-                // 1.去除原过滤条件中的编制部门在其中
-                // 2.追加数据模板归档中的过滤条件
-                // 3.增加地点过滤(若为第一层级用户,则过滤出所有一二级地点数据;若为第二级用户,则过滤当前地点数据)
-                const levelFilter = this.getLevelFilter()
-                if (!dataList.length) {
-                    // 无过滤条件时默认地点过滤
-                    return [
-                        {
-                            label: '默认条件',
-                            key: this.$utils.guid(),
-                            type: 'condition',
-                            rights: [{ type: 'all' }],
-                            filter: {
-                                condition: 'AND',
-                                rules: [levelFilter]
-                            }
+    // created () {
+    //     this.loadDataTemplate()
+    // },
+    methods: {
+        loadDataTemplate () {
+            const loading = this.$loading({
+                lock: false,
+                background: 'transparent'
+            })
+            this.dataTemplate = {}
+            getBuildDataById({
+                dataTemplateId: this.templateId || this.dataTemplateId,
+                isFilterForm: false,
+                isRightsFilter: true
+            }).then(response => {
+                // 从后台获取数据
+                const data = this.$utils.parseData(response.data)
+                if (data && data.attrs && this.$utils.isNotEmpty(data.attrs.form_key)) {
+                    getFormDataByFormKey({
+                        formKey: data.attrs.form_key
+                    }).then(response => {
+                        const formData = this.$utils.parseData(response.data)
+                        const datasets = buildFelds(formData.fields, data.datasets)
+                        data.datasets = datasets
+                        this.dataTemplate = data
+                        if (this.typeName) {
+                            this.dataTemplate.templates = this.dealData(this.dataTemplate)
                         }
-                    ]
+                        setTimeout(() => {
+                            loading.close()
+                        }, 1000)
+                    }).catch(() => {
+                        loading.close()
+                    })
+                } else {
+                    this.dataTemplate = data
+                    setTimeout(() => {
+                        loading.close()
+                    }, 1000)
                 }
-                const newDataList = dataList.map(data => {
-                    const rules = data.filter.rules.filter(i => i.id !== 'find_in_set' && !i.value.includes('cscript.findPositionId'))
-                    const newRules = [
-                        ...this.filterParams.map(item => ({
-                            id: item.field,
-                            type: 'string',
-                            input: 'text',
-                            ...item
-                        })),
-                        ...rules,
-                        levelFilter
-                    ]
-                    // 关联关系固定为AND
-                    return { ...data, filter: { ...data.filter, condition: 'AND', rules: newRules.filter(i => i) }}
-                })
-                return newDataList
-            },
-    dealQueryColumns (data) {
-        if (!data || !data.length || !this.filterParams || !this.filterParams.length) {
-            return data || []
-        }
-        const allParamsKey = this.filterParams.map(i => i.field)
-        data.forEach(item => {
-            if (allParamsKey.includes(item.name)) {
-                item.default_value = undefined
+            }).catch(() => {
+                loading.close()
+            })
+        },
+        buildFelds (fields, datasets) {
+            const fieldMap = {}
+            fields.forEach(field => {
+                if (field.field_type === 'grid' || field.field_type === 'tabs') {
+                    field.field_options.columns.forEach(column => {
+                        column.fields.forEach(cfield => {
+                            fieldMap[cfield.field_name] = cfield
+                        })
+                    })
+                } else {
+                    fieldMap[field.field_name] = field
+                }
+            })
+            const rtn = []
+            datasets.forEach(dataset => {
+                const field = fieldMap[dataset.name]
+                if (this.$utils.isNotEmpty(field)) {
+                    dataset.field_type = field.field_type
+                    dataset.field_options = field.field_options
+                }
+                rtn.push(dataset)
+            })
+            return rtn
+        },
+        dealData ({ showType, templates }) {
+            if (showType !== 'list') {
+                return templates
             }
-        })
-        return data
-    },
-     getLevelFilter () {
-        const { second = '' } = this.$store.getters.level
-        const { deptList = [] } = this.$store.getters
-        // 当参数中含有地点配置时,无需再额外处理
-        const hasLocationParams = this.filterParams.some(i => i.id === 'di_dian_' && i.value.includes('cscript.findPositionId'))
-        if (hasLocationParams) {
-            return undefined
-        }
-        if (second) {
+            const data = templates[0]
+            // 替换列表标题
+            data.attrs.display_field = this.typeName
+            // 替换按钮
+            data.buttons.function_buttons = this.dealButtom(data.buttons.function_buttons)
+            // 增加过滤信息
+            data.filter_conditions = this.dealFilter(data.filter_conditions)
+            // 处理查询条件默认值,数据模板中的查询条件默认值如果与模板归档中的配置冲突,则优先使用归档中的配置
+            data.query_columns = this.dealQueryColumns(data.query_columns)
+            return [data]
+        },
+        dealButtom (buttons) {
+            const keys = ['search', 'remove', 'consult', 'detail']
+            if (!buttons.length) {
+                return []
+            }
+            const defaultBtn = buttons.filter(i => keys.includes(i.button_type))
+            const customBtn = buttons.filter(i => i.show_on_record === 'Y')
+            return [...defaultBtn, ...customBtn]
+        },
+        dealFilter (dataList) {
+            // 1.去除原过滤条件中的编制部门在其中
+            // 2.追加数据模板归档中的过滤条件
+            // 3.增加地点过滤(若为第一层级用户,则过滤出所有一二级地点数据;若为第二级用户,则过滤当前地点数据)
+            const levelFilter = this.getLevelFilter()
+            if (!dataList.length) {
+                // 无过滤条件时默认地点过滤
+                return [
+                    {
+                        label: '默认条件',
+                        key: this.$utils.guid(),
+                        type: 'condition',
+                        rights: [{ type: 'all' }],
+                        filter: {
+                            condition: 'AND',
+                            rules: [levelFilter]
+                        }
+                    }
+                ]
+            }
+            const newDataList = dataList.map(data => {
+                const rules = data.filter.rules.filter(i => i.id !== 'find_in_set' && !i.value.includes('cscript.findPositionId'))
+                const newRules = [
+                    ...this.filterParams.map(item => ({
+                        id: item.field,
+                        type: 'string',
+                        input: 'text',
+                        ...item
+                    })),
+                    ...rules,
+                    levelFilter
+                ]
+                // 关联关系固定为AND
+                return { ...data, filter: { ...data.filter, condition: 'AND', rules: newRules.filter(i => i) }}
+            })
+            return newDataList
+        },
+        dealQueryColumns (data) {
+            if (!data || !data.length || !this.filterParams || !this.filterParams.length) {
+                return data || []
+            }
+            const allParamsKey = this.filterParams.map(i => i.field)
+            data.forEach(item => {
+                if (allParamsKey.includes(item.name)) {
+                    item.default_value = undefined
+                }
+            })
+            return data
+        },
+        // 获取当前用户地点信息 equal-等于 in-在…之内
+        getLevelFilter () {
+            const { second = '' } = this.$store.getters.level
+            const { deptList = [] } = this.$store.getters
+            // 当参数中含有地点配置时,无需再额外处理
+            const hasLocationParams = this.filterParams.some(i => i.id === 'di_dian_' && i.value.includes('cscript.findPositionId'))
+            if (hasLocationParams) {
+                return undefined
+            }
+            if (second) {
+                return {
+                    field: 'di_dian_',
+                    id: 'di_dian_',
+                    input: 'text',
+                    label: '地点',
+                    operator: 'equal',
+                    source: 'fixed',
+                    type: 'string',
+                    value: second
+                }
+            }
+
             return {
                 field: 'di_dian_',
                 id: 'di_dian_',
                 input: 'text',
                 label: '地点',
-                operator: 'equal',
+                operator: 'in',
                 source: 'fixed',
                 type: 'string',
-                value: second
+                value: deptList.filter(i => i.depth * 1 >= 2).map(i => i.id)
             }
         }
-
-        return {
-            field: 'di_dian_',
-            id: 'di_dian_',
-            input: 'text',
-            label: '地点',
-            operator: 'in',
-            source: 'fixed',
-            type: 'string',
-            value: deptList.filter(i => i.depth * 1 >= 2).map(i => i.id)
-        }
     }
-  }
 }
 </script>
-<style lang="scss" >
-  .data-template-renderer-dialog{
-    .el-dialog__header{
+<style lang="scss">
+.data-template-renderer-dialog {
+  .el-dialog__header {
       padding: 0;
-      border-bottom:0;
-    }
-    .el-dialog__body {
+      border-bottom: 0;
+  }
+  .el-dialog__body {
       padding: 0;
-    }
-    .el-dialog__headerbtn{
+  }
+  .el-dialog__headerbtn {
       z-index: 99999;
-    }
   }
+}
 </style>