当前位置: 首页 > news >正文

“react“: “^16.14.0“,打开弹窗数据发生变化

“react”: “^16.14.0”,

弹窗

打开弹窗数据发生变化

// 这里对比changeHistoryVisible是否发生改变调用后端方法改变数据componentDidUpdate(prevProps) {if (prevProps.changeHistoryVisible !== this.props.changeHistoryVisible && this.props.changeHistoryVisible) {this.getStockLogList()}}componentDidMount() {this.getStockLogList()}
<Modaltitle={'变更记录'}visible={changeHistoryVisible}onCancel={() => this.changeHistoryCancel()}footer={false}width={800}><ModelCom changeHistoryVisible={changeHistoryVisible} ref={this.ModelCom} id={id} type={type}></ModelCom></Modal>
import React, { Component, useEffect } from 'react';
import { connect } from 'dva';
import PropTypes from 'prop-types';
import { Button, Card, Form, Table, message, Modal } from 'antd';
import moment from 'moment';
import { enterStockTypeStatus, orderTypeNewRetail } from '@/utils/enumType'@connect((RetailGoodsInBound) => ({...RetailGoodsInBound,
}))
// 变更记录弹窗
export default class ModelCom extends Component {static propTypes = {dispatch: PropTypes.func,match: PropTypes.shape,}static defaultProps = {dispatch: PropTypes.dispatch,match: PropTypes.match,}state = {// changeHistoryVisible: false,loadingLog: false,currentObj: {},params: {currentPage: 1,pageSize: 10,id: ''}}columns = [{title: '变更用户',dataIndex: 'operatorName',key: 'operatorName',},{title: '变更时间',dataIndex: 'gmtCreate',key: 'gmtCreate',render: (text) => <>{text ? moment(text).format('YYYY-MM-DD') : ''}</>},{title: '条码',dataIndex: 'oldData',key: 'oldData',},{title: '操作',dataIndex: 'orderType',key: 'orderType',render: (text, record) => <><span>{`${orderTypeNewRetail(record.orderType)}${enterStockTypeStatus(record.type)}`}</span></>},]componentDidUpdate(prevProps) {if (prevProps.changeHistoryVisible !== this.props.changeHistoryVisible && this.props.changeHistoryVisible) {this.getStockLogList()}}componentDidMount() {this.getStockLogList()}columnsFilter() { }getStockLogList = () => {const { dispatch } = this.propsthis.state.params.id = this.props.idconst currentObj = {type: this.props.type,id: this.props.id,}this.setState({currentObj})this.setState({loadingLog: true})dispatch({type: 'RetailGoodsInBound/getGoodsUpdateLog',payload: { ...this.state.params },}).then(res => {if (res.code === 20000) {this.setState({loadingLog: false})}})}// 改变每页条数&下一页 上一页pageChange = (current, pageSize) => {this.state.params.currentPage = current;this.state.params.pageSize = pageSize;this.getStockLogList();};render() {const { RetailGoodsInBound: { stockLogList } } = this.props;const { changeHistoryVisible, loadingLog } = this.statereturn (// <Modal//   title={'变更记录'}//   visible={changeHistoryVisible}//   onCancel={() => this.changeHistoryCancel()}//   footer={false}//   width={800}// ><div className="contentModel"><TablerowKey="barCode"columns={this.columns}dataSource={stockLogList.rows ? stockLogList.rows : []}borderedloading={loadingLog}scroll={{ y: 400 }}pagination={{showSizeChanger: true,showQuickJumper: true,current: stockLogList.currentPage, // 当前页pageSize: stockLogList.pageSize, // 每页几条total: stockLogList.totalCount, // 总共条数onShowSizeChange: (current, pageSize) => {this.pageChange(current, pageSize);},onChange: (current, pageSize) => {this.pageChange(current, pageSize);},showTotal: (total) => `共 ${total} 条记录    第${stockLogList.currentPage ? stockLogList.currentPage : 1}/${stockLogList.totalPage ? stockLogList.totalPage : 1}页`}}/></div>// </Modal>)}
}
http://www.lryc.cn/news/197195.html

相关文章:

  • MySQL数据库varchar字段求和出现精度丢失
  • C++入门 第二篇( 引用、内联函数、auto关键字、指针空值nullptr)
  • 2023年煤气证模拟考试题库及煤气理论考试试题
  • 嵌入式面试经典30问
  • C++ 八股文: 构造函数
  • 自动切割短视频的软件推荐,一键生成1000条短视频,支持六大主流平台矩阵分发,快来免费试用
  • 从零开始学习秒杀项目
  • 儿童珠宝首饰上亚马逊美国站合规标准是什么?如何办理?
  • ORACLE 19C PDB FOR MYSQL 5.7 部署ogg
  • 前端 html 中的 meta 标签有哪些用处?
  • 罗技鼠标接收器丢失或损坏后用另一个接收器配对的方法
  • Python语法
  • 电脑经营商城小程序的作用是什么
  • 森海塞尔EW-DP SKP直插式发射机:真正的无失真录制
  • 通过小程序实现会议Oa的会议展示以及个人中心
  • STM32驱动GY-39监测环境温度,湿度,大气压强,光强度
  • 在华为和比亚迪干了5年测试,月薪25K,熬夜总结出来的划水经验.....
  • Mac 使用 scp 上传或下载文件/文件夹
  • Restful 风格
  • LLM 系列 | 21 : Code Llama实战(上篇) : 模型简介与评测
  • 积分球荧光光谱测试光电检测方式有哪些优点?
  • 软考考试时间已出!采用连考形式!
  • 深入理解强化学习——学习(Learning)、规划(Planning)、探索(Exploration)和利用(Exploitation)
  • 大模型LLM相关面试题整理-训练集-训练经验-微调
  • qt 实现pdf阅读器
  • 从培训班出来之后找工作的经历,教会了我五件事.....
  • idea中还原dont ask again
  • Unity之ShaderGraph如何实现光边溶解
  • Go语言和Python语言哪个比较好?
  • MAYA教程之模型的UV拆分与材质介绍