忘了写到哪了
This commit is contained in:
42
src/views/identity/enterprise.vue
Normal file
42
src/views/identity/enterprise.vue
Normal file
@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card shadow="always" style="width: 55%; margin: 0 auto">
|
||||
<EnterpriseForm
|
||||
v-model="form"
|
||||
:isAdd="false"
|
||||
:labelWidth="labelWidth"
|
||||
ref="enterpriseFormRef"
|
||||
/>
|
||||
<div :style="{ marginLeft: labelWidth + 'px' }">
|
||||
<el-button @click="$router.go(-1)">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { insertEnterprise } from "@/api/identity/index";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { reactive, toRefs } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import EnterpriseForm from "../components/EnterpriseForm/index.vue";
|
||||
|
||||
const router = useRouter();
|
||||
const labelWidth = 140;
|
||||
|
||||
const data = reactive({ form: {} });
|
||||
const { form } = toRefs(data);
|
||||
const enterpriseFormRef = ref();
|
||||
|
||||
const submitForm = async (status) => {
|
||||
const valid = await enterpriseFormRef.value.validateForm();
|
||||
if (valid) {
|
||||
insertEnterprise(form.value).then(() => {
|
||||
ElMessage.success("新增成功");
|
||||
router.go(-1);
|
||||
});
|
||||
} else {
|
||||
console.log("校验未通过");
|
||||
}
|
||||
};
|
||||
</script>
|
Reference in New Issue
Block a user