首页 > 其他分享 >5.23

5.23

时间:2024-06-06 22:37:14浏览次数:12  
标签:undefined form rules routeOptions 5.23 data response

北京地铁作业2 复制代码

<template>
  <view class="container">
    <view class="example">
      <uni-forms ref="form" :model="form" labelWidth="80px">
    <uni-forms-item label="起始站" name="startStation" required >
      <uni-easyinput v-model="form.startStation" placeholder="请输入起始站" />
    </uni-forms-item>
    <uni-forms-item label="终点站" name="endStation" required >
      <uni-easyinput v-model="form.endStation" placeholder="请输入终点站" />
    </uni-forms-item>
  <uni-forms-item label="途径站" name="intermediateStations"  >
  <uni-easyinput type="textarea" v-model="form.intermediateStations" placeholder="请输入途径站" />
  </uni-forms-item>

  <uni-forms-item label="起始站的线" name="startStationLine"  >
    <uni-data-select v-model="form.startStationLine" :localdata="routeOptions"></uni-data-select>
  </uni-forms-item>
  <uni-forms-item label="终点站的线" name="endStationLine"  >
    <uni-data-select v-model="form.endStationLine" :localdata="routeOptions"></uni-data-select>
  </uni-forms-item>
    <uni-forms-item label="途径站点" name="distNumber"  >
      <uni-easyinput v-model="form.distNumber" placeholder="请输入途径站点" />
    </uni-forms-item>
    <uni-forms-item label="票价" name="price"  >
      <uni-easyinput v-model="form.price" placeholder="请输入票价" />
    </uni-forms-item>
      </uni-forms>
      <view class="button-group">
        <button type="default" style="padding:0 3em;font-size:14px"  class="button" @click="reset">重置</button>
        <button type="primary" style="padding:0 3em;font-size:14px"  class="button" @click="submit">提交</button>
      </view>
    </view>
  </view>
</template>


<script>
    import { addBeijingsubway,getBeijingsubway,listBeijingsubway } from "@/api/system/beijingsubway";

export default {
components: {
},
data() {
  return {
    //字典类型筛选options
      routeOptions:[],
      routeOptions:[],
    form: {},
    rules: {
            startStation: {
                rules: [{ required: true, errorMessage: "起始站不能为空" }]
            },
            endStation: {
                rules: [{ required: true, errorMessage: "终点站不能为空" }]
            },
    }
  }
},
onLoad(option) {
  //字典类型查询
      this.$dataDicts.getDicts("route").then(response => {
        this.routeOptions = this.$myUtils.getDictOption(response.data,'dictValue','dictLabel');
      });
      this.$dataDicts.getDicts("route").then(response => {
        this.routeOptions = this.$myUtils.getDictOption(response.data,'dictValue','dictLabel');
      });
},
onReady() {
  this.$refs.form.setRules(this.rules)
},
methods: {
  /* 提交*/
  submit() {
    console.log(this.form)
    this.$refs.form.validate().then(res => {
      addBeijingsubway(this.form).then(response => {
        this.$modal.msgSuccess("新增成功")
        setTimeout(() => {
          // 返回到上一级父页面
          this.$tab.navigateBack();
        },500)
      })
    })
  },
  /* 表单重置*/
  reset(){
    this.form = {
       id: undefined,
       startStation: undefined,
       endStation: undefined,
       intermediateStations: undefined,
       startStationLine: undefined,
       endStationLine: undefined,
       distNumber: undefined,
       price: undefined
    };
  }
}
}
</script>

<style lang="scss">
  page {
    background-color: #ffffff;
  }

  .example {
    padding: 15px;
    background-color: #fff;
  }
  .button-group {
    margin-top: 15px;
    display: flex;
    justify-content: space-around;
  }
</style>
复制代码 复制代码
<template>
  <view class="container">
    <view class="example">
      <uni-forms ref="form" :model="form" labelWidth="80px">
            <uni-forms-item label="起始站" name="startStation" required >
              <uni-easyinput v-model="form.startStation" placeholder="请输入起始站" />
            </uni-forms-item>
            <uni-forms-item label="终点站" name="endStation" required >
              <uni-easyinput v-model="form.endStation" placeholder="请输入终点站" />
            </uni-forms-item>
            <uni-forms-item label="途径站" name="intermediateStations"  >
              <uni-easyinput type="textarea" v-model="form.intermediateStations" placeholder="请输入途径站" />
            </uni-forms-item>

            <uni-forms-item label="起始站的线" name="startStationLine"  >
              <uni-data-select
                  v-model="form.startStationLine"
                  :localdata="routeOptions"
              ></uni-data-select>
            </uni-forms-item>
            <uni-forms-item label="终点站的线" name="endStationLine"  >
              <uni-data-select
                  v-model="form.endStationLine"
                  :localdata="routeOptions"
              ></uni-data-select>
            </uni-forms-item>
            <uni-forms-item label="途径站点" name="distNumber"  >
              <uni-easyinput v-model="form.distNumber" placeholder="请输入途径站点" />
            </uni-forms-item>
            <uni-forms-item label="票价" name="price"  >
              <uni-easyinput v-model="form.price" placeholder="请输入票价" />
            </uni-forms-item>
      </uni-forms>
      <view class="button-group">
        <button type="default" style="padding:0 3em;font-size:14px"  class="button" @click="cancel">取消</button>
        <button type="primary" style="padding:0 3em;font-size:14px"  class="button" @click="submit">提交</button>
      </view>
    </view>
  </view>
</template>


<script>
import { updateBeijingsubway,getBeijingsubway,listBeijingsubway } from "@/api/system/beijingsubway";

export default {
  components: {
  },
  data() {
    return {
    //字典类型筛选options
                routeOptions:[],
                routeOptions:[],
    form: {},
    rules: {
                  startStation: {
              rules: [{ required: true, errorMessage: "起始站不能为空" }]
            },
                                endStation: {
              rules: [{ required: true, errorMessage: "终点站不能为空" }]
            },
                    }
    }
  },
onLoad(option) {
  //字典类型查询
  this.$dataDicts.getDicts("route").then(response => {
    this.routeOptions = this.$myUtils.getDictOption(response.data,'dictValue','dictLabel');
});
  this.$dataDicts.getDicts("route").then(response => {
    this.routeOptions = this.$myUtils.getDictOption(response.data,'dictValue','dictLabel');
});
  //起点—终点查询详细
  this.getBeijingsubwayInfo(option.id);
},
  onReady() {
    this.$refs.form.setRules(this.rules)
  },
  methods: {
    /* 获取起点—终点查询详情*/
    getBeijingsubwayInfo(id) {
      getBeijingsubway(id).then(response => {
        this.form = response.data;
      })
    },
/* 提交*/
submit() {
  this.$refs.form.validate().then(res => {
    updateBeijingsubway(this.form).then(response => {
      this.$modal.msgSuccess("编辑成功")
      setTimeout(() => {
        // 返回到上一级父页面
        this.$tab.navigateBack();
      },500)
    })
  })
},
/* 表单重置*/
/* 取消*/
cancel(){
  this.$tab.navigateBack();
}
}
}
</script>

<style lang="scss">
  page {
    background-color: #ffffff;
  }

  .example {
    padding: 15px;
    background-color: #fff;
  }
  .button-group {
    margin-top: 15px;
    display: flex;
    justify-content: space-around;
  }
</style>
 

标签:undefined,form,rules,routeOptions,5.23,data,response
From: https://www.cnblogs.com/Christmas77/p/18236187

相关文章

  • 2024.5.23(周四)
    function[s,phis,k,G,E]=golds(phi,a,b,delta,epsilon)%输入:phi是目标函数,a,b是搜索区间的两个端点delta,epsilon分别是自变量和函数值的容许误差9%输出:s,phis分别是近似极小点和极小值,G是nx4矩阵。其第k行分别是a,p,q,b的第k次迭代值[ak,pk,qk,bk],E=[ds,dphi],分别是s和phis的误......
  • 5.23
    importandroid.content.ContentValues;importandroid.content.Context;importandroid.database.sqlite.SQLiteDatabase;importandroid.database.sqlite.SQLiteOpenHelper;importandroidx.annotation.Nullable;publicclassMySQLiteHelperextendsSQLiteOpenHelper{......
  • KubeSphere 社区双周报|2024.05.09-05.23
    KubeSphere社区双周报主要整理展示新增的贡献者名单和证书、新增的讲师证书以及两周内提交过commit的贡献者,并对近期重要的PR进行解析,同时还包含了线上/线下活动和布道推广等一系列社区动态。本次双周报涵盖时间为:2024.05.09-05.23。贡献者名单新晋KubeSpherecontribu......
  • 5.23每日总结
    计网学习要传输一个8192字节的数据字段,必须通过IP分片来分割数据,因为以太网的最大传输单元(MTU)为1500字节。这意味着一个IP数据报的总长度(包括IP头部)不能超过1500字节。我们首先假设IP头部长度为20字节(不含选项部分的标准IPv4头部长度)。这意味着每个IP数据报可以携带的数据部分最......
  • 5.23链表相交
    链接如下:https://leetcode.cn/problems/intersection-of-two-linked-lists-lcci/solutions/1395092/lian-biao-xiang-jiao-by-leetcode-solutio-2kne/这道题比较简单,暴力循环就可以结束,但是看官方题解还是有些技巧在的,索性也就记录一下。先说下我自己的思路,我自己的思路就是类似......
  • 【闲话】08.05.23
    08.05闲话众所周知,一个鲜花需要一张头图推歌:flower&CASI《藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁藁......
  • 5.23每日总结
    今天完善了软件开发的开发文档的内容。项目开发计划如下:5.1项目概述人脸识别软件是一款基于人工智能技术的应用软件,旨在通过对人脸图像进行处理和分析,实现快速准确的人脸识别功能。本项目将开发一款适用于安防领域、金融领域等多个行业的人脸识别软件,支持批量检测和识别,同时提......
  • 5.23学习总结
    使用SELECT...INTOOUTFILE语句导出数据以下实例中我们将数据表runoob_tbl数据导出到/tmp/runoob.txt文件中:mysql>SELECT*FROMrunoob_tbl->INTOOUTFILE'/tmp/runoob.txt';你可以通过命令选项来设置数据输出的指定格式,以下实例为导出CSV格式:mysql>SEL......
  • 5.23 面向对象案例分析五
    用static,引入计数器案例classUser{privateStringuid;privateStringpassword;privatestaticintcount=0;publicUser(){this("NOID","mldn");}publicUser(Stringuid){this(uid,"mldnjava&q......
  • 5.23每日总结
    JSP技术原理JSP的工作方式是请求/应答模式,客户端发出HTTP请求,JSP收到请求后进行处理,并返回处理结果。在一个JSP文件首次被请求时,JSP引擎首先把这个JSP文件转换成一个servlet,而该引擎本身也是一个servlet。运行过程如下:JSP引擎首先把该JSP文件转换成一个Java源文件(servlet),在转换......