js实现数据关联查找更新。数据求和验证

news2024/9/23 17:13:04

在这里插入图片描述
为了实现这个功能我们和后端定义了数据结构

data:{
	id:‘’,
	formInfo:'',
	formInfo2:'',
	formInfo3:'',
	formInfo4:'', 
	......
	deailData:[ // 明细数据  // saleData 查询带出的对应明细序列号数据
		{	id:'',	ocopyId:'',	copyId:'',	odoId:'',	......,  saleData:[ {	id:'',	ocopyId:'', odoId:'',	......,} ] },
		{	id:'',	ocopyId:'',	copyId:'',	odoId:'',	......,  saleData:[ {	id:'',	ocopyId:'', odoId:'',	......,} ] },
		{	id:'',	ocopyId:'',	copyId:'',	odoId:'',	......,  saleData:[ {	id:'',	ocopyId:'', odoId:'',	......,} ] }
	]
}

代码入下

/**
 * 编辑页面
 */
import React from 'react';
import { TForm, ELImport_3, ElNotification, ElRowContainer, TCollapse } from '@/cloudt/component';
import { TEditTable } from '@/cloudt/pro-component';

import {
  getDetailColumns,
  getSerialButtons,
  getDetailButtons,
  getTopButtons,
  getBasicForm,
  getControlForm,
  getReceivingForm,
  getSerialEdittabColumns,
} from './config';
import dayjs from 'dayjs';
import { asserts } from '@/utils';
import { save, getDetailById, getFileCode } from './service';
import { FileUpload } from '@/cloudt/component/ItemComponent';
import { maths } from '@/utils';
import { Spin } from 'antd';
import { closeCurrentToPath, frameHistoryPush } from '@/cloudt/frame-history';
interface Props {
  match: any;
}

interface State {
  loading: boolean;
  pageType: string;
  id: string | number;
  bascicFormData: any;
  OrderInfoData: Array<any>;
  recvCountryCode: any;
  fileList: Array<any>;
  preSelectedRow: Record<string, any> | null; //记录上次选中的明细行
  importRequestParams: Record<string, any>;
}

class SaleOrderEdit extends React.Component<Props, State> {
  basicFormRef: any; //基础信息表单ref
  controlFormRef: any; //制单信息
  receiveFormRef: any; //客户收货信息表单ref
  deatilTableRef: any; //明细信息可编辑表格ref
  serialTableRef: any; // 序列号ref
  importModalRef: any; //导入组件ref
  constructor(props) {
    super(props);
    this.state = {
      fileList: [],
      id: this.props.match?.params?.id, //单据id
      pageType: this.props.match.path.includes('/edit/') ? 'edit' : 'view', // 编辑或详情页面
      loading: false, // 页面级loading
      bascicFormData: {}, //基本信息
      OrderInfoData: [], //明细数据
      recvCountryCode: '', // 国家
      preSelectedRow: null,
      importRequestParams: {},
    };
  }
  async componentDidMount() {
    await this.getDetail(this.state.id);
  }

  getDetail = async (id) => {
    this.setState({
      loading: true,
    });
    const res = await getDetailById(id);
    if (res && res.success) {
      const bascicFormData = await this.handleBasicFormData(res?.data);
      const newSalSoDSaveVOList = this.handleDetailEditData(res?.data?.odoDList);
      // 查询附件
      const fileCode = res.data?.fileCode;
      if (fileCode) {
        await this.handleFilesData(res.data?.fileCode.split(','));
      }
      this.setState({
        bascicFormData,
        OrderInfoData: newSalSoDSaveVOList,
      });
    } else {
      ElNotification({
        type: 'error',
        message: res.msg || '查询失败',
      });
    }
    this.setState({
      loading: false,
    });
  };

  handleBasicFormData = async (data) => {
    const basicData = {
      ...data,
      recvArea: [data?.recvProvince, data?.recvCity, data?.recvCounty],
      whId: {
        whId: data?.whId,
        whCode: data?.whCode,
        whName: data?.whName,
        // deter2: data?.deter2,
        // deter2Name: data?.deter2Name,
      },
    };
    this.setState({
      recvCountryCode: data?.recvCountry,
    });
    return basicData;
  };

  handleFilesData = async (fileCode) => {
    const res = await getFileCode(fileCode);
    if (res && res.success) {
      this.setState({
        fileList: res.data,
      });
    }
  };

  /**
   * 查详情明细行数据处理 -- 明细行原始数据
   */
  handleDetailEditData = (odoDSaveVOList) => {
    const newSalSoDSaveVOList =
      odoDSaveVOList &&
      Array.isArray(odoDSaveVOList) &&
      odoDSaveVOList.map((item) => {
        return {
          ...item,
          // createTime: asserts.isExist(item?.createTime) ? dayjs(item?.createTime).format('YYYY-MM-DD') : null,
          // modifyTime: asserts.isExist(item?.modifyTime) ? dayjs(item?.modifyTime).format('YYYY-MM-DD') : null,
          serialRespVOs: item.serialRespVOs ? item.serialRespVOs : [],
          lotNo: item?.lotNo,
        };
      });
    return newSalSoDSaveVOList;
  };

  // 明细信息行选择事件 更新下边的序号编辑
  handleOrderInfoSelect = async (selectedRowKeys, selectedRows) => {
    await this.deatilTableRef.quitEditState(); // 明细行退出编辑状态
    await this.serialTableRef.quitEditState(); // 序列号退出编辑状态
    const TableValues = await this.serialTableRef.getRows(); // 获取序列号数据
    const detailSelectedRow = selectedRows[0];
    if (this.state.preSelectedRow) {
      this.deatilTableRef.updateRows({ serialRespVOs: TableValues }, [this.state.preSelectedRow.id]);
    }
    const nowSerialData = detailSelectedRow.serialRespVOs;
    await this.serialTableRef?.clearRows(); //清除可编辑表格的数据
    this.serialTableRef?.addRows(nowSerialData); //重新添加查询的数据
    this.setState({
      preSelectedRow: detailSelectedRow,
    });
  };

  // 明细行复制
  handleCopy = async (selectedRowKeys, selectedRows) => {
    const selectedRow = selectedRows[0];
    const isCopyedRow = selectedRow.ocopyId;
    if (isCopyedRow) {
      return ElNotification({
        type: 'warning',
        message: '不能复制已经复制的信息,请重新选择',
      });
    }
    await this.deatilTableRef.quitEditState();
    const dataSouce = await this.deatilTableRef.getRows();
    const index = dataSouce?.findLastIndex((v) => selectedRow?.relateDocLineno === v.relateDocLineno);
    const copyRow = {
      ...selectedRow,
      odoId: this.state.id, // 单头id
      ocopyId: selectedRow.id, // 复制行时把id给ocopyId,
      id: maths.genFakeId(-1),
      demandQty: null,
      qty: 0,
      serialRespVOs: [],
    };
    dataSouce.splice(index + 1, 0, copyRow);
    await this.deatilTableRef.clearRows();
    await this.deatilTableRef.addRows(dataSouce);
  };

  // 明细信息行删除事件
  handleDelClick = async (selectedRowKeys, selectedRows) => {
    const selectedRow = selectedRows[0];
    const isCopyedRow = selectedRow.ocopyId;
    if (!isCopyedRow) {
      return ElNotification({
        type: 'warning',
        message: '只能删除复制行,请重新选择',
      });
    }
    this.deatilTableRef.removeRowsByKeys(selectedRowKeys, 'rowKey'); // 删除明细信息
    await this.serialTableRef.quitEditState(); // 序列号退出编辑状态
    await this.serialTableRef?.clearRows(); //清除可编辑表格的数据
  };

  // 序列号信息添加
  handleAddDataRow = async () => {
    const selectionData = await this.deatilTableRef?.getSelectionData();
    if (selectionData.selectedRows.length !== 1) {
      return ElNotification({
        type: 'warning',
        message: '请选中一行明细',
      });
    }
    const detailSelectedRow = selectionData.selectedRows[0];
    const newRow = {
      id: maths.genFakeId(-1),
      odoId: this.state.id, // 关联单id
      odoDid: detailSelectedRow.id, // 序列号新增时,赋值选中的明细行id
    };
    this.serialTableRef?.addRow(newRow); //重新添加查询的数据
  };

  // 序列号信息删除
  handleDistributionDelete = async (selectedRowKeys) => {
    await this.serialTableRef.quitEditState();
    this.serialTableRef.removeRowsByKeys(selectedRowKeys, 'rowKey');
  };

  // 序列号导入
  handleImport = async () => {
    const selectionData = await this.deatilTableRef?.getSelectionData();
    if (selectionData.selectedRows.length !== 1) {
      return ElNotification({
        type: 'warning',
        message: '请选中一行明细',
      });
    }
    this.setState({
      importRequestParams: { odoDid: selectionData.selectedRows[0].id, odoId: this.state.id },
    });
    this.importModalRef.openModal();
  };
  // 导入方法回调
  importCallBack = async (res) => {
    if (res && res.success) {
      const importSuccessData = res.data.map((x) => {
        return {
          ...x,
          id: maths.genFakeId(-1),
        };
      });
      this.serialTableRef?.addRows(importSuccessData);
      ElNotification({
        type: 'success',
        message: '操作成功!',
      });
    } else if (res && !res.success) {
      ElNotification({
        type: 'error',
        message: res?.msg || '操作失败',
      });
    }
  };

  /**
   * 返回
   */
  onBack = () => {
    closeCurrentToPath('/inventory/outboundDelivery/searchOrder');
  };

  // 保存
  saveParams = async () => {
    //保存之前先把序列号信息退出编辑状态,同步到明细数据中
    const selectionData = await this.deatilTableRef?.getSelectionData();
    const detailSelectedRow = selectionData?.selectedRows[0];
    await this.serialTableRef.quitEditState(); // 序列号退出编辑状态
    const serialEditTableValues = await this.serialTableRef.validateTableRows();
    if (!serialEditTableValues?.msg?.success) {
      ElNotification({
        type: 'warning',
        message: '请添加序列号必填信息!',
      });
      return;
    }

    const TableValues = await this.serialTableRef.getRows(); // 获取序列号数据
    if (this.state.preSelectedRow) {
      this.deatilTableRef.updateRows({ serialRespVOs: TableValues }, [detailSelectedRow.id]);
    }
    const data = await this.processData();
    if (data?.odoDSaveVOList?.length === 0) {
      ElNotification({
        type: 'warning',
        message: '明细信息不允许为空',
      });
      return;
    }
    if (data) {
      this.setState({ loading: true });
      const res = await save(data);
      this.setState({ loading: false });
      if (res.success) {
        ElNotification({
          type: 'success',
          message: res.msg || '操作成功',
        });
        this.onBack();
      } else {
        ElNotification({
          type: 'error',
          message: res.msg || res.data || '操作失败!',
        });
      }
    }
  };

  /*
  入参基本信息处理
  baseFormDataRes 基本信息
  custFormDataRes 客户信息
  */
  paramsBasicFormData = (baseFormDataRes, custFormDataRes) => {
    baseFormDataRes.whId = baseFormDataRes.whId?.whId;
    baseFormDataRes.whCode = baseFormDataRes.whId?.whCode;
    baseFormDataRes.whName = baseFormDataRes.whId?.whName;

    custFormDataRes.recvArea = undefined;
  };

  /*  delSameObjValue 数组对象相同值相加去重
    arr 需要处理的数组   -- editTableValues?.data
    resultNum 最终计算结果的键名 -- sumConfirmQty
    keyName  用于计算判断的键名 这里是以数组的方式传过来的可以这支持接收多个参数判断】 -- relateDocLineno
    keyValue 用于计算结果的键名 这里是以数组的方式传过来的可以这支持接收多个参数判断】 对应的键值为number类型 -- qty
    */
  delSameObjValue = (arr, resultNum, keyName, keyValue) => {
    const warp = new Map();
    arr.forEach((i) => {
      const str = keyName.map((v) => i[v]).join('_');
      i[resultNum] = keyValue.reduce((p, c) => (p += i[c]), 0);
      warp.has(str) ? (warp.get(str)[resultNum] += i[resultNum]) : warp.set(str, i);
    });
    return Array.from(warp).map(([, v]) => v);
  };

  // 校验表单信息
  processData = async () => {
    // 基本信息
    const baseFormDataRes = await this.basicFormRef?.validateFields().catch(() => {
      ElNotification({
        type: 'warning',
        message: '请检查【基本信息】必填信息',
      });
      return Promise.reject();
    });
    // 客户信息
    const custFormDataRes = await this.receiveFormRef?.getFieldsValue();
    // 制单信息
    const otherFormDataRes = await this.controlFormRef?.getFieldsValue();

    this.paramsBasicFormData(baseFormDataRes, custFormDataRes);
    // 附件信息
    const { fileList } = this.state;
    const fileCodes =
      Array.isArray(fileList) &&
      fileList?.map((x) => {
        return x.fileCode;
      });
    const fileCode = fileCodes.toString();

    // 商品明细信息
    await this.deatilTableRef.quitEditState(); //保存退出明细行编辑状态
    const editTableValues = await this.deatilTableRef.validateTableRows();
    const sum = this.delSameObjValue(editTableValues?.data, 'sumConfirmQty', ['relateDocLineno'], ['qty']);
    const flag = sum.some((val) => val.sumConfirmQty !== val.demandQty);
    if (flag) {
      return ElNotification({
        type: 'warning',
        message: '相同【来源单据行号】的数据信息【实发数量】必须等于【要求发货数量】!',
      });
    }
    if (!editTableValues?.msg?.success) {
      return ElNotification({
        type: 'warning',
        message: '请添加明细必填信息!',
      });
    }

    const ruleLotFlagAddlotNo = editTableValues?.data.some(
      (item) => item.lotFlag && (item.lotNo === null || item.lotNo === ''),
    );
    if (ruleLotFlagAddlotNo) {
      return ElNotification({
        type: 'warning',
        message: '明细商品中包含【启用批次】,请检查并完善【批次】',
      });
    }

    const itemDataSource = editTableValues?.data?.map((item) => {
      return {
        ...item,
        odoId: this.state.id,
        lotNo: item?.lotNo?.lotNo,
        olotNo: item?.orlotNo,
        odoSerialSaveVOs: item.serialRespVOs ? item.serialRespVOs : [],
        sumConfirmQty: undefined, // 提示汇总字段不要
        serialRespVOs: undefined, // 返回的数组字段不要
        orlotNo: undefined,
      };
    });

    // 根据公司查询组织
    return {
      ...this.state.bascicFormData,
      id: this.state.bascicFormData?.id, //复制按钮时,入参需要处理
      ...baseFormDataRes, //基础信息
      ...custFormDataRes, //客户信息
      ...otherFormDataRes, // 制单信息
      odoDSaveVOList: itemDataSource, // 明细
      fileCode, // 附件
      odoDList: undefined,
    };
  };

  render() {
    const {
      pageType: type,
      bascicFormData: bascicFormDate,
      loading,
      OrderInfoData,
      fileList,
      importRequestParams,
    } = this.state;

    return (
      <Spin spinning={loading}>
        <div className="inner-content">
          <ElRowContainer
            onBack={this.onBack}
            blocks={getTopButtons(this.saveParams, this.state.pageType)}
            position="top"
          />
          <TCollapse className="formAlignment" title="基本信息" levelOne>
            <TForm
              data={bascicFormDate}
              onRef={(ref) => {
                this.basicFormRef = ref;
              }}
              formProps={getBasicForm(type)}
            />
            <TCollapse title="收货信息" defaultOpen={false} className="formAlignment">
              <TForm
                data={bascicFormDate}
                onRef={(ref) => {
                  this.receiveFormRef = ref;
                }}
                formProps={getReceivingForm(this.state.recvCountryCode)}
              />
            </TCollapse>
            <TCollapse title="制单信息" defaultOpen={false} className="formAlignment">
              <TForm
                data={bascicFormDate}
                onRef={(ref) => {
                  this.controlFormRef = ref;
                }}
                formProps={getControlForm('create')}
              />
            </TCollapse>
          </TCollapse>
          <TCollapse title="明细信息">
            <TEditTable
              tableId="middleGround_inventoryCenter_supply_saleorder_orderDetail"
              bordered
              rowKey="id"
              scroll={{ y: 20000 }}
              onRef={(ref) => (this.deatilTableRef = ref)}
              dataSource={OrderInfoData} //
              actionButtons={getDetailButtons({
                type,
                handleCopy: this.handleCopy,
                handleDelete: this.handleDelClick,
              })}
              needToolBar={true}
              columns={getDetailColumns(this)}
              rowSelectionConfig={{
                type: 'radio',
                fixed: true,
                disabledRowIds: [],
                onChange: ({ selectedRowKeys, selectedRows }) => {
                  this.handleOrderInfoSelect(selectedRowKeys, selectedRows);
                },
              }}
              defaultTableConfig={{
                onBottomPressEnter: 'trigger',
                onTableIntoEdit: 'dbclick',
              }}
            />
          </TCollapse>
          <TCollapse title="序列号信息">
            <TEditTable
              tableId="middleGround_inventoryCenter_supply_saleorder_distributionInformation"
              rowKey="id"
              bordered
              scroll={{ y: 'calc(100vh - 430px)' }}
              dataSource={[]}
              actionButtons={getSerialButtons(
                type,
                this.handleAddDataRow,
                this.handleDistributionDelete,
                this.handleImport,
              )}
              onRef={(ref) => (this.serialTableRef = ref)}
              columns={getSerialEdittabColumns()}
            />
          </TCollapse>

          <TCollapse title="相关附件" levelOne={true}>
            <FileUpload
              useType="outTable"
              fileListLen={999}
              uploadInfo="支持所有类型文件,文件不能超过10M"
              value={fileList}
              onUploadErr={(err) => {
                ElNotification({
                  type: 'error',
                  message: err?.msg || '上传失败',
                });
              }}
              onRemoveErr={(err) => {
                ElNotification({
                  type: 'error',
                  message: err?.msg || '删除失败',
                });
              }}
              onChange={(value) => {
                this.setState({
                  fileList: value,
                });
              }}
              multiple={true}
              fileList={fileList}
              prefix="/cloudt/system"
            />
          </TCollapse>

          <ELImport_3
            push={frameHistoryPush}
            prefix="/yst/inv"
            templateCode="INV_ODO_SERIAL_IMPORT"
            downTemplateConfig={{
              mode: 'templateCode',
              fileName: '序列号导入模版',
            }}
            importConfig={{
              mode: 'request',
              url: '/yst/inv/inv/odod/serial/importOdoSerial',
              maxSize: 1,
              sizeUnit: 'MB',
              note: '仅支持xlsx文件,不能大于20mb',
              accept: 'xlsx|xls|xlsx',
              onSuccess: this.importCallBack,
            }}
            requestParams={importRequestParams}
            onRef={(ref) => (this.importModalRef = ref)}
          />
        </div>
      </Spin>
    );
  }
}

export default SaleOrderEdit;

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/931192.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

unity-AI自动导航

unity-AI自动导航 给人物导航 一.地形创建 1.首先我们在Hierarchy面板中创建一个地形对象terrian&#xff0c;自行设定地形外貌&#xff0c;此时我们设置一个如下的地形外观。 二.创建导航系统 1.在主人公的Inspector、面板中添加Nav Mesh Agent &#xff08;导航网格代理&…

【Linux】手把手教你实现udp服务器

网络套接字~ 文章目录 前言一、udp服务器的实现总结 前言 上一篇文章中我们讲到了很多的网络名词以及相关知识&#xff0c;下面我们就直接进入udp服务器的实现。 一、udp服务器的实现 首先我们需要创建五个文件(文件名可以自己命名也可以和我一样)&#xff0c;分别是makefile…

Unity3d C#实现调取网络时间限制程序的体验时长的功能

前言 如题的需求应该经常在开发被提到&#xff0c;例如给客户体验3–5天的程序&#xff0c;到期后使其不可使用&#xff0c;或者几年的使用期限。这个功能常常需要使用到usb加密狗来限制&#xff0c;当然这也的话就需要一定的硬件投入。很多临时提供的版本基本是要求软件来实现…

Java如何将jar包上传到Maven中央仓库(超详细2023最新版)

文章目录 Java如何将jar包上传到Maven中央仓库引言Step1&#xff1a;注册 JIRA 账号Step2&#xff1a;发布申请Step3&#xff1a;下载并安装GPGStep4&#xff1a;配置maven的setting.xmlStep5&#xff1a;配置pom.xmlStep6&#xff1a;上传 jar 包Step7&#xff1a;引入 jar 包…

SwiftUI 中限制任意视图为指定的屏幕旋转方向

功能需求 在 SwiftUI 开发中,我们有时需要限制 App 中某些视图为特定的屏幕旋转方向,而另一些视图不做限制(或做其它限制),这可以做到吗? 如上图所示:我们成功的限制了 SwiftUI 中不同视图对应于不同的屏幕旋转方向(Interface Orientations)。 在本篇博文中,您将学到…

OpenCV - C++实战(01) — OpenCV简介

目录 第1章 OpenCV简介 1.1 简介 1.1.1 OpencV 库简介 1.1.2 命名空间 1.2 OpenCV模块 1.3 装载、显示和存储图像 1.3.1 创建图像 1.3.2 读取图像 1.3.3 定义窗口与显示图像 1.3.4 图像翻转 1.3.5 保存图像 1.3.6 图像的复制 1.3.7 创建数组和向量 1.…

01、前端使用 thymeleaf 后,视图页面找不到---Cannot resolve MVC View ‘xxxxx前端页面‘

Cannot resolve MVC View ‘xxxxx前端页面’ 没有找到对应的mvc的前端页面。 代码&#xff1a;前端这里引入了 thymeleaf 模板 解决&#xff1a; 需要添加 thymeleaf 的依赖 <dependency><groupId>org.springframework.boot</groupId><artifactId>s…

APP调用bindService的跨进程调用过程

app执行bindService时会经过如下8次跨系统进程调用过程&#xff1a; 第1步&#xff1a;通过AMS.getService跨进程调用 第2步&#xff1a;AMS返回它的IBinder 第3步&#xff1a;通过AMS的IBinder调用AMS的bindService方法 第4步&#xff1a;而AMS存放有Server端的IBinder&…

华为数通方向HCIP-DataCom H12-821题库(单选题:101-120)

第101题 可用于多种路由协议,由 ​​if-match​​​和 ​​apply​​子句组成的路由选择工具是 A、​​route-policy​​ B、​​IP-Prefix​​ C、​​commnityfilter​​ D、​​as-path-filter​​ 答案&#xff1a;A 解析&#xff1a; Route-policy&#xff08;路由策…

扫雷小游戏

目录 一.扫雷小游戏 二.游戏主体一览 ​编辑 三.模块化设计扫雷游戏 3.1打印欢迎菜单 3.2创建两个二维数组 3.3棋盘稍加修改 3.4布置雷 3.5排查雷 四.游戏总体代码 4.1game.h头文件 4.2game.c函数实现源文件 4.3游戏main函数主体 五.游戏效果图 一.扫雷小游戏 这是…

EB Tresos第一个项目报13026

EB项目创建 前期的准备工作见以上这篇文章&#xff0c;不做过多叙述&#xff1b;但是点击Generate Project会报错&#xff0c;报错如下&#xff1a; Code generator finished. Errors “1” Warnings “0” 然后点击 Problems View 查看提示&#xff0c;提示如下&#xff1a; …

大数据:AI大模型对数据分析领域的颠覆(文末送书)

随着数字化时代的到来&#xff0c;大数据已经成为了各行各业中不可或缺的资源。然而&#xff0c;有效地分析和利用大数据仍然是一个挑战。在这个背景下&#xff0c;OpenAI推出的Code Interpreter正在对数据分析领域进行颠覆性的影响。 如何颠覆数据分析领域&#xff1f;带着这…

为什么Python列表和字典前面会加星号(**)?

目录标题 前言一、列表&#xff08;list&#xff09;、元组&#xff08;tuple&#xff09;前面加星号*二、字典&#xff08;dict&#xff09;前面加两星号**尾语 前言 嗨喽~大家好呀&#xff0c;这里是魔王呐 ❤ ~! Python 中&#xff0c;单星号*和双星号**除了作为“乘”和“…

视频汇聚/云存储/安防监控AI视频智能分析平台——明厨亮灶解决方案

人工智能技术已经越来越多地融入到视频监控领域中&#xff0c;近期我们也发布了基于AI智能视频云存储/安防监控视频AI智能分析平台的众多新功能&#xff0c;该平台内置多种AI算法&#xff0c;可对实时视频中的人脸、人体、物体等进行检测、跟踪与抓拍&#xff0c;支持人脸检测、…

算法 for GAMES

栈 #include <iostream> #include <stack>int main() {std::stack<int> intStack;// 压入元素到堆栈intStack.push(5);intStack.push(10);intStack.push(15);// 查看堆栈顶部元素std::cout << "Top element: " << intStack.top() <…

虚虚实实,让敌人难以琢磨

与敌作战&#xff0c;虚虚实实&#xff0c;难以琢磨 【安志强趣讲《孙子兵法》第20讲】 第六篇&#xff1a;虚实篇 【全篇趣讲白话】 打仗就是要虚虚实实&#xff0c;让敌人难以琢磨。 【原文】 孙子曰&#xff1a;凡先处战地而待敌者佚&#xff0c;后处战地而趋战者劳。故善…

Locked勒索病毒:最新变种locked袭击了您的计算机?

导言&#xff1a; 在数字时代&#xff0c;一场隐秘的威胁正悄然而至&#xff0c;它的名字是.locked勒索病毒。这个黑暗的存在以其狡猾的攻击方式和致命的数据封锁能力&#xff0c;威胁着我们的数字生活。本文91数据恢复将带您深入了解.locked勒索病毒的本质&#xff0c;探索恢…

【Day-20慢就是快】代码随想录-栈与队列-有效的括号

给定一个只包括 ‘(’&#xff0c;‘)’&#xff0c;‘{’&#xff0c;‘}’&#xff0c;‘[’&#xff0c;‘]’ 的字符串&#xff0c;判断字符串是否有效。 有效字符串需满足&#xff1a; 左括号必须用相同类型的右括号闭合。 左括号必须以正确的顺序闭合。 注意空字符串可被…

Redis7安装

1. 使用什么系统安装redis 由于企业里面做Redis开发&#xff0c;99%都是Linux版的运用和安装&#xff0c;几乎不会涉及到Windows版&#xff0c;上一步的讲解只是为了知识的完整性&#xff0c;Windows版不作为重点&#xff0c;同学可以下去自己玩&#xff0c;企业实战就认一个版…

会声会影2023全新中文专业版下载安装教程

熟练使用会声会影视频编辑工具&#xff0c;对视频创作过程的帮助是极大的。大家可以放心大胆地去研究会声会影的视频编辑技巧&#xff0c;会声会影2023与以往版本会声会影版本最大的区别是&#xff1a;账户制管理。可以通过账户添加或移除设备&#xff0c;非常便捷。该软件一直…