aaaaaaaa.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <div class="SheepDistribute">
  3. <h2 style="margin-bottom: 20px;padding-bottom:7px;border-bottom:2px solid #ddd">种羊等级分布</h2>
  4. <div class="left">
  5. <el-form ref="form" :model="form" label-width="120px">
  6. <el-form-item label="甲">
  7. <el-input v-model="form.alpha"></el-input>
  8. </el-form-item>
  9. <el-form-item label="乙">
  10. <el-input v-model="form.beta"></el-input>
  11. </el-form-item>
  12. <el-form-item label="丙">
  13. <el-input v-model="form.gamma"></el-input>
  14. </el-form-item>
  15. <el-form-item label="丁">
  16. <el-input v-model="form.delta"></el-input>
  17. </el-form-item>
  18. <el-form-item>
  19. <el-button style="margin-left:60%" type="primary" @click="onSubmit">更新信息</el-button>
  20. </el-form-item>
  21. </el-form>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import { reqSheepDistribute, reqSetSheepDistribute } from "@/api/breed.js";
  27. export default {
  28. name: "SheepDistribute",
  29. data() {
  30. return {
  31. form: {
  32. alpha: "",
  33. beta: "",
  34. gamma: "",
  35. delta: ""
  36. }
  37. };
  38. },
  39. created() {
  40. this.getSheepDistribute();
  41. },
  42. methods: {
  43. onSubmit() {
  44. this.$confirm("确定更新信息?").then(() => {
  45. reqSetSheepDistribute(this.form)
  46. .then(res => {
  47. console.log(res)
  48. if(res.errcode) {
  49. this.$message.error("更新失败!");
  50. }
  51. this.$message.success("更新成功!");
  52. })
  53. .catch(err => {
  54. console.log(err);
  55. this.$message.error("更新失败!");
  56. });
  57. });
  58. },
  59. getSheepDistribute() {
  60. reqSheepDistribute()
  61. .then(res => {
  62. this.form = res.conf
  63. })
  64. .catch(err => {
  65. console.error(err);
  66. });
  67. }
  68. }
  69. };
  70. </script>
  71. <style lang="scss" scoped>
  72. .SheepDistribute {
  73. .left {
  74. width: 400px;
  75. margin-left: 50px;
  76. }
  77. }
  78. </style>