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

深圳做h5网站制作互联网平台

深圳做h5网站制作,互联网平台,凡科做的网站推效果,视觉设计招聘期望目标&#xff1a;实现一个能通过按钮来动态增加表格栏&#xff0c;每次能添加一行&#xff0c;每行末尾有一个删减按钮。 <el-button type"text" class"primary"click"addMember()">添加</el-button> <el-table:data"m…

期望目标:实现一个能通过按钮来动态增加表格栏,每次能添加一行,每行末尾有一个删减按钮。

<el-button type="text" class="primary"@click="addMember()">+添加</el-button>
<el-table:data="memberList"style="width: 100%":header-cell-style="{background: '#fafafa',color: '#aaa',fontSize: '15px',}"><el-table-column prop="index" label="序号" width="60"><template slot-scope="scope"><span>{{ getMemberIndex(scope.$index) }}</span></template></el-table-column><el-table-column prop="facilityName" label="设施名称"><template slot-scope="scope"><el-select v-model="scope.row.facilityName" placeholder="请选择名称" clearable><el-option v-for="dict in dict.type.data_facilities_name" :label="dict.label" :value="dict.value"  /></el-select></template></el-table-column><el-table-column prop="facilitySpecificType" label="具体类型"><template slot-scope="scope"><el-select v-model="scope.row.facilitySpecificType" placeholder="请选择类型" clearable><el-option v-for="dict in dict.type.data_facilities_type" :label="dict.label" :value="dict.value"/></el-select></template></el-table-column><el-table-column prop="facilityLocation" label="设施位置"><template slot-scope="scope"><el-select v-model="scope.row.facilityLocation" placeholder="请选择位置" clearable><el-option v-for="dict in dict.type.data_equipment_location" :label="dict.label" :value="dict.value"/></el-select></template></el-table-column><el-table-column prop="facilityTp" label="规格"><template slot-scope="scope"><el-input v-model="scope.row.facilityTp"></el-input></template></el-table-column><el-table-column prop="accountabilityUnit" label="责任单位"><template slot-scope="scope"><el-input v-model="scope.row.accountabilityUnit"></el-input></template></el-table-column><el-table-column label="操作"><template slot-scope="scope"><el-buttonsize="mini"type="text"icon="el-icon-delete"@click="handleDelete(scope.$index,'memberList')">删除</el-button></template></el-table-column></el-table>// 添加杆件数据按钮addMember() {var member = {index: this.dataId++,facilityNo: '',facilityName: '',facilitySpecificType: '',facilityLocation: '',facilityTp: '',accountabilityUnit: '',};this.memberList.push(member);},

效果:

遇到的问题一:在删减时,当前所有行的序号需要自动删减,重新计算变更序号


// 删除行数据后序号自动连贯更新getMemberIndex(index) {return this.memberList.slice(0, index + 1).length ;},
/** 删除按钮操作 */handleDelete(index, listName) {if (index !== -1 && listName =="memberList") {this.memberList.splice(index, 1)}},

给序号那一栏字段单独重设,动态变更index,<span>{{ getMemberIndex(scope.$index) }}</span>,每次删除一行,调用handleDelete函数,再用getMember重新计算一遍所有序号

如果有数据验证的需求,就需要在table外面再嵌套一层form,因为只有el-form表单猜有数据验证的功能。

      <el-form :model="memberForm" :rules="rules" ref="memberForm"></el-form>

 问题二:

多个表单同时用一个接口提交,在提交数据表单时,后端要求有特殊的数据结构,需要将获取到的多个表单数据重新按要求整合。新设立一个json字段存储

/** 提交按钮 */async submitForms() {// 构建数据结构const facilitiesData = {pointId: this.pointForm.pointId,pointName: this.pointForm.pointName,memberList: this.memberList.map(member => ({facilityName: member.facilityName,facilitySpecificType: member.facilitySpecificType,facilityLocation: member.facilityLocation,facilityTp: member.facilityTp,accountabilityUnit: member.accountabilityUnit,})),}// 发送请求添加设施await addFacilities(facilitiesData).then(response => {this.$modal.msgSuccess("新增成功");this.goBack();})},

http://www.fp688.cn/news/154578.html

相关文章:

  • 网站建设后台管理流程企业网站设计
  • 苏州知名网站建设建站公司杭州网络优化公司排名
  • 龙岗网站-建设深圳信科软文营销经典案例200字
  • 企业网站开发市场北京seo外包
  • 做淘宝客的的网站有什么要求吗网站关键词优化案例
  • 安徽建设工程信息网文件seo网站排名优化培训教程
  • 学php到做网站要多久发布软文网站
  • 深圳微信网站建设报价竞价外包
  • 大丰有做网站的关键词分类
  • 福州专业制作网站网站推广 方法
  • 成都网站建设公司 四川冠辰科技国际新闻最新消息战争
  • 网站设计会计分录怎么做属性词 关键词 核心词
  • jsp做网站好不好百度竞价优缺点
  • 建站公司 源码申请沈阳关键字优化公司
  • 建立一个网站需要哪些步骤seo教学
  • 做网站干什么用百度做网站推广电话
  • 书店网站建设人员分配软件培训机构排行榜
  • 力杨网站建设百度收录时间
  • 珠宝网站形象设计武汉关键词包年推广
  • 手机版网站设计案例网络营销的模式有哪些
  • 网站是不是用cms做的网站推广seo招聘
  • 武汉光谷做网站费用百度用户服务中心人工24小时电话
  • 综合办公oa系统南昌seo优化公司
  • 张店区创业孵化中心有做网站的吗优秀营销软文范例500字
  • 知名网站建设哪家好搜索引擎seo推广
  • 分类信息网站建设百度推广代理
  • 重庆渝中区企业网站建设联系电话百度热搜榜
  • 做机械的网站深圳最好的外贸seo培训
  • 杭州网站开发培训站长工具国产
  • 西部数码网站备份优化网站的步骤