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

深圳规划建设局网站茂名网站开发公司推荐

深圳规划建设局网站,茂名网站开发公司推荐,网站制作比较好的制作公司,微信seo什么意思antd form中数组套数组 form数组动态变化 动态赋值 需求如上#xff0c;同时添加多个产品#xff0c;同时每个产品可以增加多台设备#xff0c;根据设备增加相应编号#xff0c;所以存在数组套数组#xff0c;根据数组值动态变化 使用的知识点 form.list form中的数组…antd form中数组套数组 form数组动态变化 动态赋值 需求如上同时添加多个产品同时每个产品可以增加多台设备根据设备增加相应编号所以存在数组套数组根据数组值动态变化 使用的知识点 form.list form中的数组展示shouldUpdate 根据form值来动态变化数组是引用类型 // An highlighted block div Formform{form}namebasiclabelCol{{flex: 90px,}}initialValues{{productList:[{bianHao:,wuMiao:,number:1,tType:you,files:{},list:[{sheBei:,guZi:,ziYou:,}],}]}}labelWrap{true}labelAlignleftonFinish{onFinish}onFinishFailed{onFinishFailed}autoCompleteoff{/* Card title基本信息 bordered{false}Row gutter{16}Col sm{24} md{12} lg{8} xxl{6}Form.Itemlabel最终用户nameusernamerules{[{required: true,message: 请输入,},]}Input //Form.Item/ColCol sm{24} md{12} lg{8} xxl{6}Form.Itemlabel商务助理nameuserLianrules{[{required: true,message: 请输入,},]}Input //Form.Item/ColCol sm{24} md{12} lg{8} xxl{6}Form.Itemlabel测试用途nameuserPhonerules{[{required: true,message: 请输入,},]}Input //Form.Item/ColCol sm{24} md{12} lg{8} xxl{6}Form.Itemlabel项目预计招标/采购时间nameuserShourules{[{required: true,message: 请输入,},]}Input //Form.Item/ColCol sm{24} Form.Itemlabel备注namebeiZhurules{[{required: true,message: 请输入,},]}TextArea //Form.Item/ColCol xl{24} sm{24}Form.Item label证明文件 Upload {...fileProps}Button typeprimary icon{UploadOutlined /}点击上传/Button/Upload/Form.Item/Col/Row /Card */}Card title基本信息 bordered{false}Form.List nameproductList {(fields, {add, remove}) ({fields.map((field,index) (Row gutter{16}{/* 用得时候只需要修改下面将需要重复展示的部分替换下面部分即可 注意 -----start*/ }Col sm{24} md{12} lg{8} xxl{6}Form.Item {...field}label产品名称name{[field.name,bianHao]}rules{[{required: true,message: 请输入,},]}Input placeholder请输入 //Form.Item/ColCol sm{24} md{12} lg{8} xxl{6}Form.Item {...field}label物料编码name{[field.name,wuMiao]}rules{[{required: true,message: 请输入,},]}Input placeholder请输入 //Form.Item/ColCol sm{24} md{12} lg{8} xxl{6}Form.Item {...field}label数量name{[field.name,number]}rules{[{required: true,message: 请输入,},]}InputNumber min{1} style{{width:100%}}//Form.Item/ColCol sm{24} md{12} lg{8} xxl{6}Form.Item {...field}label单位name{[field.name,tType]}rules{[{required: true,message: 请输入,},]}SelectSelect.Option valueyou台/Select.OptionSelect.Option valuezi块/Select.Option/Select/Form.Item/ColCol sm{24}Form.Item noStyle shouldUpdate{(pre,cur) {// 如果删除一条信息cur.productList[index]是空值所以需要判断if(cur.productList[index]pre.productList[index]){return pre.productList[index].number ! cur.productList[index].number}else{return false}}}{({getFieldsValue}) {{/* 繁琐的计算1.输入的数值比原来的数值大计算差值给原数组循环push2.手动在删除输入框为空的时候根据splice置空 因为是空所以计算出03.输入的数值比之前小优先从后面删除防止前面输入的被删除掉依旧是操作原数组 splice */}let number getFieldsValue().productList[index].number;let list getFieldsValue().productList[index].list;if(numberlist.length){let cha number - list.length;for(let i0; icha ; i){list.push({ sheBei:,guZi:,ziYou:,})}}else if(number){list.splice(0,list.length)}else if(numberlist.length){let cha list.length - number;list.splice(number,cha)} return Form.List name{[field.name,list]} {(tLists) ({tLists.map(tlist(Row gutter{16}Col sm{24} md{12} lg{8} xxl{6}Form.Item {...tlist}label设备序列号name{[tlist.name,sheBei]}rules{[{required: true,message: 请选择,},]}Input//Form.Item/ColCol sm{24} md{12} lg{8} xxl{6}Form.Item {...tlist}label固资编码name{[tlist.name,guZi]}rules{[{required: true,message: 请选择,},]}Input//Form.Item/ColCol sm{24} md{12} lg{8} xxl{6}Form.Item {...tlist}label自有编码name{[tlist.name,ziYou]}rules{[{required: true,message: 请选择,},]}Input//Form.Item/Col/Row))}/)}/Form.List}}/Form.Item/ColCol sm{24} Form.Itemlabel备注{...field}name{[field.name,beiZhu]}rules{[{required: true,message: 请输入,},]}TextArea //Form.Item/ColCol xl{24} sm{24}Form.Item label证明文件 {...field}name{[field.name,files]} Upload customRequest{(option option.onSuccess())}beforeUpload{(file, fileList) fileVerification(file, fileList)}Button typeprimary icon{UploadOutlined /}点击上传/Button/Upload/Form.Item/Col{ /* 用得时候只需要修改下面将需要重复展示的部分替换下面部分即可 -----end*/ }div styleNameitem_btn_wrapPlusCircleFilled styleNameadd_item_btn onClick{() add({bianHao:,wuMiao:,number:1,tType:you,beiZhu:,files:{},list:[{sheBei:,guZi:,ziYou:,}],})} /{fields.length1CloseCircleFilled styleNameremove_item_btn onClick{() remove(field.name)} /}/div/Row))}/)}/Form.List/CardCard{/* Row gutter{16}Col */}{/* Form.Item wrapperCol{{ offset: 8, span: 16 }} */}Form.Item styleNameright_layoutLink to/HW/HwBorrowListButton typedashed取消/Button/LinkButton style{{marginLeft:20px}} loading{saving} onClick{()onFinish(stage)}暂存/ButtonButton typeprimary style{{marginLeft:20px}} onClick{()onFinish(submit)}提交/Button{/* Button typeprimary htmlTypesubmit确认/Button */}/Form.Item{/* /Col/Row */}/Card/Form/div使用注意 Form.List 使用 {…field}或者{…tlist} 需要在name的前面否则出错中间有关于业务的逻辑输入数量的计算shouldUpdate 方法使用表单中值变化可以根据index来获取是第几个进而判断form数组的嵌套 运用两个form.list 嵌套重点关注内层的 name 怎么写进而进行内部的循环在对form 的数组进行赋值的操作时 紧记 数组是引用类型 用getFieldsValue 来获取需要操作的数组运用数组中的修改原数组的方法来操作即可及时修改form值 数组是引用类型 数组是引用类型 数组是引用类型 以上为代码和理解欢迎指正
http://www.dnsts.com.cn/news/213692.html

相关文章:

  • asp源代码网站南阳做网站公司哪家好
  • 北京网站建设公司排行企业所得税只对企业征收吗
  • 曼斯特(北京)网站建设公司在线表白网页制作
  • 网站版面设计说明wordpress 禁止注册
  • 国外免费建站好看的学校网站首页
  • 望牛墩东莞网站建设域名访问升级紧急中拿笔记好
  • 做服务的网站吗百度的首页
  • 宝安有效的网站制作专做hip hop音乐的网站
  • 网站优化方案教程呼和浩特网站优化公司
  • 怎样做网站的子网南通手机建站模板
  • 网络游戏制作上海网站seo牛巨微
  • 六安网约车收入怎么样seo如何优化的
  • 站长工具是做什么的798艺术区
  • 商务网站推广技巧包括什么wordpress主动提交
  • ae模板下载网站wordpress分配管理员
  • 网站建设政务新媒体php 网站开发架构
  • 甘肃住房和城乡建设部网站网络公关公司危机公关
  • 网站优化成功案例上海百度关键词推广
  • 任丘网站优化WordPress指定IP访问
  • wordpress多站点是什么意思域名是什么样子
  • 邮箱网站架构域名注册方法
  • 带搜索网站建设视频教程封面上的网站怎么做的
  • 做电脑网站电商平台有哪些?
  • 公司电子商务平台和企业网站建设和维护工作管理办法怎样做网站卖自己的产品教程
  • 企业网站联系我们wordpress手机版侧栏导航栏
  • 网站网页主页的区别网站建设教程pdf下载
  • 海阳手机网站开发做生意必定红火的公司名字
  • 网站建设费用价格明细表设计开发建设网站平台
  • 网站开发语言为 php汉中网站建设公司
  • 关于网站备案前置审批的相关说明 吉林北京建设管理有限公司官网