|
@@ -14,7 +14,11 @@
|
|
|
<div class="cargo-owner-add" @click="dialogFormVisible = true">
|
|
<div class="cargo-owner-add" @click="dialogFormVisible = true">
|
|
|
添加船东
|
|
添加船东
|
|
|
</div>
|
|
</div>
|
|
|
- <el-dialog title="添加船东" v-model="dialogFormVisible">
|
|
|
|
|
|
|
+ <el-dialog
|
|
|
|
|
+ title="添加船东"
|
|
|
|
|
+ v-model="dialogFormVisible"
|
|
|
|
|
+ @close="resetForm"
|
|
|
|
|
+ >
|
|
|
<template v-slot:default>
|
|
<template v-slot:default>
|
|
|
<el-form
|
|
<el-form
|
|
|
:model="ruleForm"
|
|
:model="ruleForm"
|
|
@@ -23,35 +27,40 @@
|
|
|
label-width="110px"
|
|
label-width="110px"
|
|
|
label-position="left"
|
|
label-position="left"
|
|
|
>
|
|
>
|
|
|
- <el-form-item prop="userName" label="船东姓名">
|
|
|
|
|
|
|
+ <el-form-item prop="userPhone" label="手机号">
|
|
|
<el-input
|
|
<el-input
|
|
|
style="width: 280px"
|
|
style="width: 280px"
|
|
|
- v-model="ruleForm.userName"
|
|
|
|
|
|
|
+ v-model="ruleForm.userPhone"
|
|
|
|
|
+ @blur="checkShipOwnerPhone"
|
|
|
|
|
+ :disabled="isUserExist"
|
|
|
></el-input>
|
|
></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item prop="userPhone" label="手机号">
|
|
|
|
|
|
|
+ <el-form-item prop="userName" label="船东姓名">
|
|
|
<el-input
|
|
<el-input
|
|
|
style="width: 280px"
|
|
style="width: 280px"
|
|
|
- v-model="ruleForm.userPhone"
|
|
|
|
|
|
|
+ v-model="ruleForm.userName"
|
|
|
|
|
+ :disabled="isUserExist"
|
|
|
></el-input>
|
|
></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item prop="shipName" label="船名">
|
|
<el-form-item prop="shipName" label="船名">
|
|
|
<el-input
|
|
<el-input
|
|
|
style="width: 280px"
|
|
style="width: 280px"
|
|
|
v-model="ruleForm.shipName"
|
|
v-model="ruleForm.shipName"
|
|
|
|
|
+ :disabled="isUserExist && ruleForm.shipName"
|
|
|
></el-input>
|
|
></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item prop="shipMmsi" label="MMSI">
|
|
<el-form-item prop="shipMmsi" label="MMSI">
|
|
|
<el-input
|
|
<el-input
|
|
|
style="width: 280px"
|
|
style="width: 280px"
|
|
|
v-model="ruleForm.shipMmsi"
|
|
v-model="ruleForm.shipMmsi"
|
|
|
|
|
+ :disabled="isUserExist && ruleForm.shipMmsi"
|
|
|
></el-input>
|
|
></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</template>
|
|
</template>
|
|
|
<template v-slot:footer>
|
|
<template v-slot:footer>
|
|
|
<div class="dialog-footer">
|
|
<div class="dialog-footer">
|
|
|
- <el-button @click="resetForm">取 消</el-button>
|
|
|
|
|
|
|
+ <el-button @click="resetFormBtn">重 置</el-button>
|
|
|
<el-button type="primary" @click="addShipOwner(ruleForm)">
|
|
<el-button type="primary" @click="addShipOwner(ruleForm)">
|
|
|
确 定
|
|
确 定
|
|
|
</el-button>
|
|
</el-button>
|
|
@@ -128,6 +137,8 @@ import store from "../../store";
|
|
|
import router from "../../router";
|
|
import router from "../../router";
|
|
|
import md5 from "md5";
|
|
import md5 from "md5";
|
|
|
import api from "../../apis/fetch";
|
|
import api from "../../apis/fetch";
|
|
|
|
|
+let isChecked = ref(false);
|
|
|
|
|
+let isUserExist = ref(false);
|
|
|
let dialogFormVisible = ref(false);
|
|
let dialogFormVisible = ref(false);
|
|
|
let form = ref(null);
|
|
let form = ref(null);
|
|
|
let ruleForm = ref({
|
|
let ruleForm = ref({
|
|
@@ -138,7 +149,14 @@ let ruleForm = ref({
|
|
|
});
|
|
});
|
|
|
async function resetForm() {
|
|
async function resetForm() {
|
|
|
dialogFormVisible.value = false;
|
|
dialogFormVisible.value = false;
|
|
|
|
|
+ isUserExist.value = false;
|
|
|
|
|
+ isChecked.value = false;
|
|
|
form.value.resetFields();
|
|
form.value.resetFields();
|
|
|
|
|
+ resetForm.value = {};
|
|
|
|
|
+}
|
|
|
|
|
+function resetFormBtn() {
|
|
|
|
|
+ form.value.resetFields();
|
|
|
|
|
+ resetForm.value = {};
|
|
|
}
|
|
}
|
|
|
const rules = ref({
|
|
const rules = ref({
|
|
|
userName: [{ required: true, message: "请填写船东名称", trigger: "blur" }],
|
|
userName: [{ required: true, message: "请填写船东名称", trigger: "blur" }],
|
|
@@ -153,13 +171,7 @@ async function addShipOwner() {
|
|
|
form.value.validate(async (valid) => {
|
|
form.value.validate(async (valid) => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
let { userName, shipName, shipMmsi, userPhone } = ruleForm.value;
|
|
let { userName, shipName, shipMmsi, userPhone } = ruleForm.value;
|
|
|
- let res = await api.addShipOwner({
|
|
|
|
|
- userName,
|
|
|
|
|
- shipName,
|
|
|
|
|
- shipMmsi,
|
|
|
|
|
- userPhone,
|
|
|
|
|
- });
|
|
|
|
|
- console.log(res);
|
|
|
|
|
|
|
+ let res = await api.addShipOwner(ruleForm.value);
|
|
|
if (res.data.status == 0) {
|
|
if (res.data.status == 0) {
|
|
|
ElNotification.success({
|
|
ElNotification.success({
|
|
|
title: "添加成功",
|
|
title: "添加成功",
|
|
@@ -213,6 +225,18 @@ function pageChange(e) {
|
|
|
currentPage.value = e;
|
|
currentPage.value = e;
|
|
|
getShipOwnerList();
|
|
getShipOwnerList();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+async function checkShipOwnerPhone(e) {
|
|
|
|
|
+ let res = await api.checkShipOwnerPhone({
|
|
|
|
|
+ userPhone: e.target.value,
|
|
|
|
|
+ });
|
|
|
|
|
+ isChecked.value = true;
|
|
|
|
|
+ if (res.data.status == 0) {
|
|
|
|
|
+ isUserExist.value = true;
|
|
|
|
|
+ ruleForm.value = res.data.result;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
getShipOwnerList();
|
|
getShipOwnerList();
|
|
|
});
|
|
});
|