Files

57 lines
1.5 KiB
Vue

<template>
<div class="app-container">
<el-card shadow="always" style="width: 55%; margin: 0 auto">
<agent-form ref="agentFormRef" v-model="form" is-add />
<div :style="{ marginLeft: labelWidth + 'px' }">
<el-button @click="$router.go(-1)"
>{{ t("admin.common.cancel") }}
</el-button>
<el-button type="primary" @click="submitForm"
>{{ t("admin.common.submit") }}
</el-button>
</div>
</el-card>
</div>
</template>
<script setup>
import AgentForm from "@/views/components/AgentForm";
import { reactive, ref, toRefs } from "vue";
import { ElMessage } from "element-plus";
import { insertCasBroker } from "@/api/admin/agent/account";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
const { t } = useI18n();
const router = useRouter();
const props = defineProps({
labelWidth: {
type: Number,
default: 120,
},
});
const data = reactive({
form: {
industrys: [],
idImage: [],
},
});
const { form } = toRefs(data);
const agentFormRef = ref();
const submitForm = async () => {
if (!agentFormRef.value) return;
const valid = await agentFormRef.value.validateForm();
if (valid) {
form.value.idCardPics = form.value.idImage.join(",");
form.value.keyword = form.value.keywords.join(",");
insertCasBroker(form.value).then(() => {
ElMessage.success(t("admin.common.addSuccess"));
router.push({
path: "/identity/index",
});
});
}
};
</script>
<style lang="scss" scoped></style>