Files

50 lines
1.3 KiB
Vue
Raw Normal View History

2023-06-07 10:44:31 +08:00
<template>
<div class="app-container">
<el-card shadow="always" style="width: 55%; margin: 0 auto">
2023-06-13 13:40:54 +08:00
<agent-form ref="agentFormRef" v-model="form" is-add />
2023-06-07 10:44:31 +08:00
<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>
2023-06-13 13:40:54 +08:00
import AgentForm from "@/views/components/AgentForm";
import { reactive, ref, toRefs } from "vue";
2023-06-19 17:25:50 +08:00
import { ElMessage } from "element-plus";
import { insertCasBroker } from "@/api/admin/agent/account";
2023-06-07 10:44:31 +08:00
2023-06-19 17:25:50 +08:00
const router = useRouter();
2023-06-07 10:44:31 +08:00
const props = defineProps({
labelWidth: {
type: Number,
2023-06-13 13:40:54 +08:00
default: 120,
},
});
2023-06-07 10:44:31 +08:00
const data = reactive({
form: {
industrys: [],
2023-06-19 17:25:50 +08:00
idImage: [],
2023-06-13 13:40:54 +08:00
},
});
const { form } = toRefs(data);
const agentFormRef = ref();
2023-06-07 10:44:31 +08:00
const submitForm = async () => {
2023-06-13 13:40:54 +08:00
if (!agentFormRef.value) return;
const valid = await agentFormRef.value.validateForm();
2023-06-07 10:44:31 +08:00
if (valid) {
2023-06-19 17:25:50 +08:00
form.value.idCardPics = form.value.idImage.join(",");
form.value.keyword = form.value.keywords.join(",");
insertCasBroker(form.value).then(() => {
ElMessage.success("新增成功");
router.push({
path: "/identity/index",
});
});
2023-06-07 10:44:31 +08:00
}
2023-06-13 13:40:54 +08:00
};
2023-06-07 10:44:31 +08:00
</script>
2023-06-13 13:40:54 +08:00
<style lang="scss" scoped></style>