index.vue 1.92 KB
Newer Older
1
<template>
nanrui committed
2 3 4 5 6 7 8 9 10 11 12 13 14
  <div class="eContainer">
    <c-page title="货币查询">
      <el-form :model="model" ref="modelForm" label-width="120px" label-position="right" size="small">
        <c-content>
          <m-currency :model="model" ref="currency" />
        </c-content>
      </el-form>
      <div style="text-align: center">
        <c-button type="primary" style="margin-right: 10px" @click="commitAdd">提 交</c-button>
        <c-button type="primary" @click="goBack">返 回</c-button>
      </div>
    </c-page>
  </div>
15 16 17
</template>

<script>
nanrui committed
18 19 20 21 22 23 24
import Utils from "~/utils";
import commonFuncs from "~/mixin/commonFuncs";
import Cur, { Pattern } from "../Infcur/Cur.js";

import Currency from "./Currency";

import { curInfo, add, edit, curDelete } from "~/service/test/cur.js";
25 26 27

export default {
  name: "StaticsDbacur",
nanrui committed
28 29 30 31 32 33 34 35 36
  components: {
    "m-currency": Currency
  },
  provide() {
    return {
      root: this,
    };
  },
  mixins: [commonFuncs],
37
  data() {
nanrui committed
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
    return {
      tabVal: "",
      model: new Cur().data,
      rules: Pattern,
    };
  },
  methods: {
    commitAdd() {
      this.$refs.modelForm.validate((validated) => {
        if (validated) {
          add(this.model)
            .then((res) => {
              console.log(this.model);
              this.$message.success("保存成功!");
              this.goBack(true)
            })
            .catch((err) => {
              this.$message.error("保存失败!");
            });
        } else {
          Utils.formValidateTips(this.$refs.modelForm.fields)
        }
      });
    },
    goBack(update) {
      this.$store.dispatch("TagsView/delView", this.$route);
      this.$router.push({ name: "StaticsInfcur", params: { update } });
    },
66 67 68 69 70
  },
  mounted() {
    // this.$refs.cur.rules['ptaList'] = [
    //   { type: 'array', required: true, min: 1, message: '地址信息栏不能为空' }
    // ]
nanrui committed
71
    console.log(this.$refs.modelForm);
72 73 74 75 76
  }
};
</script>

<style>
nanrui committed
77

78
</style>