jeecgBoot 开发前端组件

在这里插入图片描述
实现这种类型的组件
1 表头

  <a-row type="flex" style="margin-bottom:10px" :gutter="16">
             <a-col :span="5">客户名</a-col>
              <a-col :span="5">性别</a-col>
              <a-col :span="5">身份证号码</a-col>
             <a-col :span="5">手机号</a-col>
              <a-col :span="4">操作</a-col>
            </a-row>

2.下面的框

 <a-row type="flex" style="margin-bottom:10px" :gutter="16" v-for="(item, index) in orderMainModel.jeecgOrderCustomerList" :key="index">
               <a-col :span="5">
                 <a-form-item>
                   <a-input placeholder="客户名" v-decorator="['jeecgOrderCustomerList['+index+'].name', {'initialValue':item.name,rules: [{ required: true, message: '请输入用户名!' }]}]" />
                 </a-form-item>
               </a-col>
               <a-col :span="5">
                 <a-form-item>
                   <a-select placeholder="性别" v-decorator="['jeecgOrderCustomerList['+index+'].sex', {'initialValue':item.sex}]">
                     <a-select-option value="1">男</a-select-option>
                     <a-select-option value="2">女</a-select-option>
                   </a-select>
                 </a-form-item>
               </a-col>
               <a-col :span="5">
                 <a-form-item>
                   <a-input placeholder="身份证号" v-decorator="['jeecgOrderCustomerList['+index+'].idcard', {'initialValue':item.idcard,rules: [{ pattern: '^\\d{6}(18|19|20)?\\d{2}(0[1-9]|1[012])(0[1-9]|[12]\\d|3[01])\\d{3}(\\d|[xX])$', message: '身份证号格式不对!' }]}]"/>
                 </a-form-item>
               </a-col>
               <a-col :span="5">
                 <a-form-item>
                   <a-input placeholder="手机号" v-decorator="['jeecgOrderCustomerList['+index+'].telphone', {'initialValue':item.telphone,rules: [{ pattern: '^1(3|4|5|7|8)\\d{9}$', message: '手机号格式不对!' }]}]"/>
                 </a-form-item>
               </a-col>
               <a-col :span="4">
                 <a-form-item>
                   <a-button @click="addRowCustom" icon="plus"></a-button>&nbsp;
                   <a-button @click="delRowCustom(index)" icon="minus"></a-button>
                 </a-form-item>
               </a-col>
             </a-row>

3.一些相关的变量

 orderMainModel: {jeecgOrderCustomerList: [{}],     //数据源 可以写多个
          jeecgOrderTicketList: [{}]},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 15 },
        },

4.方法

 addRowCustom () {            //增加的方法
        this.orderMainModel.jeecgOrderCustomerList.push({});
        this.$forceUpdate();
      },
      delRowCustom (index) {        //删除的方法
        console.log(index)
        this.orderMainModel.jeecgOrderCustomerList.splice(index,1);
        this.$forceUpdate();
      },

5.进行添加到数据库的关键代码

    let orderMainData = Object.assign(this.orderMainModel, values);
            //时间格式化
            orderMainData.orderDate = orderMainData.orderDate?orderMainData.orderDate.format('YYYY-MM-DD HH:mm:ss'):null;
            let formData = {
              ...orderMainData,
              jeecgOrderCustomerList: orderMainData.jeecgOrderCustomerList,
            }
             httpAction(httpurl,formData,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            })
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值