<template> <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="commitEdit">提 交</c-button> <c-button type="primary" @click="goBack">返 回</c-button> </div> </c-page> </div> </template> <script> import Utils from "~/utils"; // import commonFuncs from "~/mixin/commonFuncs"; import Cur, { Pattern } from "../Infcur/Cur.js"; import Currency from "../Dbacur/Currency"; import { curInfo, add, edit, curDelete } from "~/service/test/cur.js"; export default { name: "StaticsDbacur", components: { "m-currency": Currency }, provide() { return { root: this, }; }, // mixins: [commonFuncs], data() { return { tabVal: "", model: new Cur().data, rules: Pattern, }; }, methods: { async goin(){ this.model = await curInfo(this.$route.params.inr); }, commitEdit() { this.model.inr = this.$route.params.inr this.$refs.modelForm.validate((validated) => { if (validated) { edit(this.model) .then((res) => { this.$message.success("保存成功!"); this.goBack() }) .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 } }); }, }, created () { this.goin(this.$route.params.inr); }, mounted() { // this.$refs.cur.rules['ptaList'] = [ // { type: 'array', required: true, min: 1, message: '地址信息栏不能为空' } // ] console.log(this.$refs.modelForm); } }; </script> <style> </style>