feat(clientInfo, accidentMessageSetting): 为筛选器添加清空功能并支持按事故类型筛选
- 在 clientInfo 页面的 clientType 和 creatorId 筛选器中添加 allowClear 属性
- 在 CrudViewBase 中修复 handleListBodyChange 方法,当值为空时设置为空字符串
- 在 accidentMessageSetting 页面添加事故类型筛选下拉框,并加载分类选项
- 优化代码格式,移除不必要的空行和注释
| | |
| | | width: 250, |
| | | }} |
| | | defaultValue={''} |
| | | allowClear |
| | | onChange={ |
| | | (value) => { |
| | | this.handleListBodyChange('clientType', value) |
| | |
| | | width: 250, |
| | | }} |
| | | defaultValue={''} |
| | | allowClear |
| | | onChange={ |
| | | (value) => { |
| | | this.handleListBodyChange('creatorId', value) |
| | |
| | | this.setState(prevState => ({ |
| | | listBody: { |
| | | ...prevState.listBody, |
| | | [key]: value |
| | | [key]: value ? value : '' |
| | | } |
| | | }), () => { |
| | | this.reloadEntities() |
| | |
| | | |
| | | // 处理启用禁用实体 |
| | | handleEnableDisableEntity = (row) => { |
| | | |
| | | |
| | | }; |
| | | |
| | | // 处理参数设置实体 |
| | |
| | | |
| | | // 处理删除实体 |
| | | handleDeleteEntity = (rows) => { |
| | | |
| | | |
| | | // 如果传入的是单个对象,将其放入数组中 |
| | | if (!Array.isArray(rows)) { |
| | | rows = [rows]; |
| | |
| | | |
| | | const ids = rows.map(row => row.id); |
| | | console.log(ids); |
| | | |
| | | |
| | | this.deleteEntities({ |
| | | ids: ids |
| | | }).then(res => { |
| | |
| | | let formState = this.editFormRef.state |
| | | let action = formState.isEdit ? '编辑' : '添加'; |
| | | this.editEntity(formState.editableData, formState.isEdit).then((response) => { |
| | | |
| | | |
| | | if (response.data.status === 'OK') { |
| | | form.resetFields(); |
| | | message.success(action + "成功!") |
| | |
| | | ); |
| | | } |
| | | |
| | | // 渲染参数设置按钮 |
| | | // 渲染参数设置按钮 |
| | | renderParameterSettingButton(row, permission = null, disable = false) { |
| | | return ( |
| | | <Button title="参数设置" onClick={this.handleParameterSettingEntity.bind(null, row)} |
| | |
| | | addAccidentBrief, |
| | | editAccidentBrief, |
| | | deleteAccidentBrief, |
| | | enableAccidentBrief |
| | | enableAccidentBrief, |
| | | getAccidentClassificationList |
| | | } from "@/api/screenSetting"; |
| | | import EditAccidentMessageForm from "./forms/edit-accidentMessage-form"; |
| | | import "./style/index.less"; |
| | |
| | | import moment from "moment"; |
| | | |
| | | const { Column } = Table; |
| | | const { Option } = Select; |
| | | const inputLongStyle = { |
| | | padding: "1px 10px", |
| | | width: "250px", |
| | | }; |
| | | |
| | | class AccidentMessageSetting extends CrudViewBase { |
| | | constructor(props) { |
| | | super(props); |
| | | this.state = { |
| | | ...this.state, |
| | | classificationOptions: [] |
| | | }; |
| | | } |
| | | |
| | | initView() { |
| | | this.loadClassificationOptions(); |
| | | } |
| | | |
| | | loadClassificationOptions = () => { |
| | | getAccidentClassificationList({ page: 0, size: 9999 }, {}).then(res => { |
| | | if (res && res.data && res.data.data && res.data.data.records) { |
| | | this.setState({ classificationOptions: res.data.data.records }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | initListBody() { |
| | | return { |
| | | title: "", |
| | | classifyId: undefined |
| | | }; |
| | | } |
| | | |
| | | getEntityList(pageInfo, listBody) { |
| | | const params = { |
| | | title: listBody.title |
| | | title: listBody.title, |
| | | classifyId: listBody.classifyId |
| | | }; |
| | | return getAccidentBriefList(pageInfo, params); |
| | | } |
| | |
| | | prefix={<Icon style={{ marginLeft: "4px" }} type="search" />} |
| | | allowClear |
| | | /> |
| | | |
| | | <Select |
| | | style={inputLongStyle} |
| | | placeholder="请选择事故类型" |
| | | value={this.state.listBody ? this.state.listBody.classifyId : undefined} |
| | | onChange={(value) => { |
| | | this.handleListBodyChange("classifyId", value); |
| | | }} |
| | | allowClear |
| | | > |
| | | {this.state.classificationOptions.map(option => ( |
| | | <Option key={option.id} value={option.id}> |
| | | {option.name} |
| | | </Option> |
| | | ))} |
| | | </Select> |
| | | </div> |
| | | |
| | | <div className="right">{this.renderAddButton("device:add")}</div> |