|
@@ -20,15 +20,26 @@ export default {
|
|
|
DataTemplateRender
|
|
DataTemplateRender
|
|
|
},
|
|
},
|
|
|
props: {
|
|
props: {
|
|
|
- height: [String, Number],
|
|
|
|
|
- dynamicParams: {
|
|
|
|
|
- type: Object
|
|
|
|
|
- },
|
|
|
|
|
- templateId: {
|
|
|
|
|
- type: String,
|
|
|
|
|
- default: ''
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ height: [String, Number],
|
|
|
|
|
+ dynamicParams: {
|
|
|
|
|
+ type: Object
|
|
|
|
|
+ },
|
|
|
|
|
+ filterParams: {
|
|
|
|
|
+ type: Array
|
|
|
|
|
+ },
|
|
|
|
|
+ templateId: {
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ default: ''
|
|
|
|
|
+ },
|
|
|
|
|
+ typeName: {
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ default: ''
|
|
|
|
|
+ },
|
|
|
|
|
+ typeId: {
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ default: ''
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
dataTemplate: {},
|
|
dataTemplate: {},
|
|
@@ -64,19 +75,7 @@ export default {
|
|
|
deep: true,
|
|
deep: true,
|
|
|
immediate: true
|
|
immediate: true
|
|
|
},
|
|
},
|
|
|
- /* templateId: {
|
|
|
|
|
- handler(val) {
|
|
|
|
|
- if (this.$utils.isNotEmpty(val)) {
|
|
|
|
|
- this.dataTemplateId = val
|
|
|
|
|
- this.loadDataTemplate()
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- immediate: true
|
|
|
|
|
- } */
|
|
|
|
|
},
|
|
},
|
|
|
- // created(){
|
|
|
|
|
- // this.loadDataTemplate()
|
|
|
|
|
- // },
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
loadDataTemplate() {
|
|
loadDataTemplate() {
|
|
|
const loading = this.$loading({
|
|
const loading = this.$loading({
|
|
@@ -138,6 +137,111 @@ export default {
|
|
|
rtn.push(dataset)
|
|
rtn.push(dataset)
|
|
|
})
|
|
})
|
|
|
return rtn
|
|
return rtn
|
|
|
|
|
+ },
|
|
|
|
|
+ dealData ({ showType, templates }) {
|
|
|
|
|
+ if (showType !== 'list') {
|
|
|
|
|
+ return templates
|
|
|
|
|
+ }
|
|
|
|
|
+ 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
|
|
|
|
|
+ },
|
|
|
|
|
+ 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: 'in',
|
|
|
|
|
+ source: 'fixed',
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ value: deptList.filter(i => i.depth * 1 >= 2).map(i => i.id)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|