|
|
@@ -748,13 +748,37 @@ export default {
|
|
|
},
|
|
|
// 获取格式化参数
|
|
|
getSearcFormData() {
|
|
|
- const temp = this.$refs['crud']
|
|
|
- ? this.$refs['crud'].getSearcFormData()
|
|
|
- : {}
|
|
|
+ const temp = this.$refs['crud']?.getSearcFormData() || {}
|
|
|
const parameters = this.getParams(temp) || []
|
|
|
- // console.log(parameters)
|
|
|
- const creator = parameters.filter((i) => i.key.includes('create_by_'))
|
|
|
- const others = parameters.filter((i) => !i.key.includes('create_by_'))
|
|
|
+ const creator = parameters.filter(i => i.key.includes('create_by_'))
|
|
|
+ let others = parameters.filter(i => !i.key.includes('create_by_'))
|
|
|
+
|
|
|
+ // 提取部门条件(key为'Q^subject_^SL')并合并为 OR 组
|
|
|
+ const deptConditions = others.filter(i => i.key === 'Q^subject_^SL')
|
|
|
+ const nonDeptConditions = others.filter(i => i.key !== 'Q^subject_^SL')
|
|
|
+
|
|
|
+ let deptGroup = null
|
|
|
+ if (deptConditions.length > 1) {
|
|
|
+ deptGroup = {
|
|
|
+ relation: 'OR',
|
|
|
+ parameters: deptConditions
|
|
|
+ }
|
|
|
+ } else if (deptConditions.length === 1) {
|
|
|
+ // 单个部门直接作为普通条件,避免额外嵌套
|
|
|
+ deptGroup = deptConditions[0]
|
|
|
+ }
|
|
|
+
|
|
|
+ // 重新构建 others:非部门条件 + 部门组(如果有)
|
|
|
+ const finalOthers = [...nonDeptConditions]
|
|
|
+ if (deptGroup) {
|
|
|
+ // 如果deptGroup是对象且具有relation,则作为子组;否则作为单个条件
|
|
|
+ if (deptGroup.relation) {
|
|
|
+ finalOthers.push(deptGroup)
|
|
|
+ } else {
|
|
|
+ finalOthers.push(deptGroup) // 单个条件直接加入
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const params = {
|
|
|
parameters: [
|
|
|
{
|
|
|
@@ -763,11 +787,8 @@ export default {
|
|
|
{
|
|
|
relation: 'AND',
|
|
|
parameters: [
|
|
|
- {
|
|
|
- key: 'Q^status_^S',
|
|
|
- value: 'end'
|
|
|
- },
|
|
|
- ...others
|
|
|
+ { key: 'Q^status_^S', value: 'end' },
|
|
|
+ ...finalOthers // 这里部门组已是OR或单个
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
@@ -777,12 +798,11 @@ export default {
|
|
|
]
|
|
|
}
|
|
|
],
|
|
|
- requestPage: {
|
|
|
- pageNo: this.pagination.page || 1,
|
|
|
- limit: this.pagination.limit || 100
|
|
|
- },
|
|
|
+ requestPage: { pageNo: this.pagination.page || 1, limit: this.pagination.limit || 100 },
|
|
|
...ActionUtils.formatParams(null, null, this.sorts)
|
|
|
}
|
|
|
+
|
|
|
+ // 后续 typeId 和 creator 默认值逻辑保持不变...
|
|
|
if (this.$utils.isNotEmpty(this.typeId)) {
|
|
|
params.parameters[0].parameters[0].parameters.push({
|
|
|
key: 'Q^TYPE_ID_^S',
|
|
|
@@ -790,17 +810,16 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
if (!creator.length) {
|
|
|
- params.parameters[0].parameters[1].parameters = this.userList.map(
|
|
|
- (i) => ({
|
|
|
- key: 'Q^create_by_^S',
|
|
|
- value: i.userId,
|
|
|
- param: this.$utils.guid()
|
|
|
- })
|
|
|
- )
|
|
|
+ params.parameters[0].parameters[1].parameters = this.userList.map(i => ({
|
|
|
+ key: 'Q^create_by_^S',
|
|
|
+ value: i.userId,
|
|
|
+ param: this.$utils.guid()
|
|
|
+ }))
|
|
|
}
|
|
|
return params
|
|
|
},
|
|
|
getParams(data) {
|
|
|
+
|
|
|
const result = []
|
|
|
const special = ['dept', 'tableName', 'desc', 'createBy']
|
|
|
Object.keys(data).forEach((key) => {
|