update 流转日志, 选择全部

This commit is contained in:
2021-07-08 10:55:59 +08:00
parent 37aa61855d
commit 598de7c026
6 changed files with 84 additions and 16 deletions

View File

@@ -14,3 +14,5 @@ export { default as QueryList } from './query-list'
export { default as QueryTable } from './query-table'
export { default as QueryTableActions } from './query-table-actions'
export { default as QueryTreeLayout } from './query-tree-layout'
export { default as HouseLog } from './business/house-log'

View File

@@ -1,5 +1,5 @@
import React, { Component } from 'react'
import { Card, Form, Input, message as Message, Radio, Select, Tag } from 'antd'
import { Card, Checkbox, Form, Input, message as Message, Radio, Select, Tag } from 'antd'
import { Auth, Container, QueryTable, QueryTableActions } from 'components'
import { api } from 'common/api'
import auth from 'components/authorized/handler'
@@ -7,6 +7,7 @@ import { isEqual } from 'lodash'
import getDictData from 'util/dic'
import { toCamelCase } from 'util/format'
import { getSearchInfo } from 'util/query'
import { checkboxCheckedNone } from 'util/tool'
/**
* 注释段[\/**\/]为必须要改
@@ -245,12 +246,22 @@ export default class index extends Component {
columns={this.columns}
queryInitialValues={{
type: '',
state: 0,
state: [-1, 0, 1, 2],
}}
onQueryChange={values => {
if (values.hasOwnProperty('type')) {
this.setState({ type: values.type })
}
if (values.hasOwnProperty('state')) {
const value = checkboxCheckedNone({
value: values.state,
length: codes.houseStatus.length,
required: true,
})
return {
state: value,
}
}
}}
query={
<Auth auth={{ [authName]: 'page' }}>
@@ -286,14 +297,14 @@ export default class index extends Component {
<Input autoComplete="off" placeholder="请输入房屋唯一编码" />
</Form.Item>
<Form.Item label="建档状态" name="state">
<Select allowClear className="w-150" placeholder="建档状态">
<Select.Option value="">全部</Select.Option>
<Checkbox.Group>
<Checkbox value="">全部</Checkbox>
{codes.houseStatus.map(item => (
<Select.Option key={item.code} value={+item.code}>
<Checkbox key={item.code} value={+item.code}>
{item.value}
</Select.Option>
</Checkbox>
))}
</Select>
</Checkbox.Group>
</Form.Item>
</Auth>
}

View File

@@ -0,0 +1,23 @@
import { first, last } from "lodash"
export const checkboxCheckedNone = (arg) => {
let { value, length, noneValue, required } = arg
if (length === undefined) length = 2
if (noneValue === undefined) noneValue = ''
if (required === undefined) required = false
if (first(value) === noneValue && value.length > 1) {
// 在'无'之后选中其他值
value.shift()
} else if (
value.length >= length
||
(last(value) === noneValue && value.length > 1)
||
(!value.length && required)
) {
// 在其他值之后选中'无'
value = [noneValue]
}
return value
}