feat(clientInfo, accidentMessageSetting): 为筛选器添加清空功能并支持按事故类型筛选

- 在 clientInfo 页面的 clientType 和 creatorId 筛选器中添加 allowClear 属性
- 在 CrudViewBase 中修复 handleListBodyChange 方法,当值为空时设置为空字符串
- 在 accidentMessageSetting 页面添加事故类型筛选下拉框,并加载分类选项
- 优化代码格式,移除不必要的空行和注释
3个文件已修改
58 ■■■■■ 已修改文件
estate-frontend-v2024/src/views/business/clientInfo.jsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
estate-frontend-v2024/src/views/common/crud-view-base.jsx 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
estate-frontend-v2024/src/views/screenSetting/accidentMessageSetting.jsx 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
estate-frontend-v2024/src/views/business/clientInfo.jsx
@@ -98,6 +98,7 @@
                            width: 250,
                        }}
                        defaultValue={''}
                        allowClear
                        onChange={
                            (value) => {
                                this.handleListBodyChange('clientType', value)
@@ -115,6 +116,7 @@
                            width: 250,
                        }}
                        defaultValue={''}
                        allowClear
                        onChange={
                            (value) => {
                                this.handleListBodyChange('creatorId', value)
estate-frontend-v2024/src/views/common/crud-view-base.jsx
@@ -139,7 +139,7 @@
        this.setState(prevState => ({
            listBody: {
                ...prevState.listBody,
                [key]: value
                [key]: value ? value : ''
            }
        }), () => {
            this.reloadEntities()
@@ -161,7 +161,7 @@
    // 处理启用禁用实体
    handleEnableDisableEntity = (row) => {
    };
    // 处理参数设置实体
@@ -288,7 +288,7 @@
    // 处理删除实体
    handleDeleteEntity = (rows) => {
        // 如果传入的是单个对象,将其放入数组中
        if (!Array.isArray(rows)) {
            rows = [rows];
@@ -296,7 +296,7 @@
        const ids = rows.map(row => row.id);
        console.log(ids);
        this.deleteEntities({
            ids: ids
        }).then(res => {
@@ -325,7 +325,7 @@
            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 + "成功!")
@@ -388,7 +388,7 @@
        );
    }
      // 渲染参数设置按钮
    // 渲染参数设置按钮
    renderParameterSettingButton(row, permission = null, disable = false) {
        return (
            <Button title="参数设置" onClick={this.handleParameterSettingEntity.bind(null, row)}
estate-frontend-v2024/src/views/screenSetting/accidentMessageSetting.jsx
@@ -5,7 +5,8 @@
  addAccidentBrief,
  editAccidentBrief,
  deleteAccidentBrief,
  enableAccidentBrief
  enableAccidentBrief,
  getAccidentClassificationList
} from "@/api/screenSetting";
import EditAccidentMessageForm from "./forms/edit-accidentMessage-form";
import "./style/index.less";
@@ -13,21 +14,44 @@
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);
  }
@@ -114,6 +138,22 @@
            prefix={<Icon style={{ marginLeft: "4px" }} type="search" />}
            allowClear
          />
          &nbsp; &nbsp;
          <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>
        &nbsp; &nbsp;
        <div className="right">{this.renderAddButton("device:add")}</div>