|
@@ -197,7 +197,7 @@
|
|
|
<el-form
|
|
<el-form
|
|
|
:rules="rules"
|
|
:rules="rules"
|
|
|
label-position="right"
|
|
label-position="right"
|
|
|
- label-width="100px"
|
|
|
|
|
|
|
+ label-width="120px"
|
|
|
ref="voyageFormRef"
|
|
ref="voyageFormRef"
|
|
|
:model="voyageForm"
|
|
:model="voyageForm"
|
|
|
>
|
|
>
|
|
@@ -249,14 +249,14 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item></el-form-item>
|
|
<el-form-item></el-form-item>
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
- v-for="(item, index) in discPorts"
|
|
|
|
|
|
|
+ v-for="(item, index) in dischargePorts"
|
|
|
:key="item"
|
|
:key="item"
|
|
|
- prop="dischargeProt"
|
|
|
|
|
|
|
+ prop="dischargePorts"
|
|
|
:label="'第 ' + (index + 1) + ' 卸货港'"
|
|
:label="'第 ' + (index + 1) + ' 卸货港'"
|
|
|
>
|
|
>
|
|
|
<RemoteSelect
|
|
<RemoteSelect
|
|
|
api="getCol"
|
|
api="getCol"
|
|
|
- v-model="discPorts[index].discPort"
|
|
|
|
|
|
|
+ v-model="dischargePorts[index].id"
|
|
|
placeholder="选择卸货港"
|
|
placeholder="选择卸货港"
|
|
|
@selectItem="selectDischargeProt($event, index)"
|
|
@selectItem="selectDischargeProt($event, index)"
|
|
|
class="mb10"
|
|
class="mb10"
|
|
@@ -267,17 +267,30 @@
|
|
|
添加卸货港
|
|
添加卸货港
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item v-if="discPorts.length % 2 == 0"></el-form-item>
|
|
|
|
|
|
|
+ <el-form-item v-if="dischargePorts.length % 2 == 0"></el-form-item>
|
|
|
|
|
|
|
|
- <el-form-item prop="cargo" label="货种">
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ prop="cargo"
|
|
|
|
|
+ label="货种"
|
|
|
|
|
+ v-if="voyageForm.cargoOwnerId"
|
|
|
|
|
+ >
|
|
|
<RemoteSelect
|
|
<RemoteSelect
|
|
|
api="getCargoSelect"
|
|
api="getCargoSelect"
|
|
|
v-model="voyageForm.cargo"
|
|
v-model="voyageForm.cargo"
|
|
|
|
|
+ :params="{
|
|
|
|
|
+ cargoOwnerId: voyageForm.cargoOwnerId,
|
|
|
|
|
+ }"
|
|
|
placeholder="选择货种"
|
|
placeholder="选择货种"
|
|
|
@selectItem="selectCargo"
|
|
@selectItem="selectCargo"
|
|
|
class="mb10"
|
|
class="mb10"
|
|
|
></RemoteSelect>
|
|
></RemoteSelect>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item prop="reasonableUnloadingDays" label="合理卸货天数">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ style="width: 200px"
|
|
|
|
|
+ v-model="voyageForm.reasonableUnloadingDays"
|
|
|
|
|
+ ></el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
<el-form-item prop="tons" label="吨位">
|
|
<el-form-item prop="tons" label="吨位">
|
|
|
<el-input style="width: 200px" v-model="voyageForm.tons"></el-input>
|
|
<el-input style="width: 200px" v-model="voyageForm.tons"></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -291,7 +304,7 @@
|
|
|
</el-form>
|
|
</el-form>
|
|
|
<template #footer>
|
|
<template #footer>
|
|
|
<span class="dialog-footer">
|
|
<span class="dialog-footer">
|
|
|
- <el-button @click="resetAddVoyageForm">取消</el-button>
|
|
|
|
|
|
|
+ <el-button class="mr20" @click="resetAddVoyageForm">取消</el-button>
|
|
|
<el-button type="primary" @click="addVoyage">确定</el-button>
|
|
<el-button type="primary" @click="addVoyage">确定</el-button>
|
|
|
</span>
|
|
</span>
|
|
|
</template>
|
|
</template>
|
|
@@ -524,10 +537,12 @@ const rules = ref({
|
|
|
cargoOwnerName: [{ required: true, message: "请选择货主", trigger: "blur" }],
|
|
cargoOwnerName: [{ required: true, message: "请选择货主", trigger: "blur" }],
|
|
|
startTime: [{ required: true, message: "请填写开始时间", trigger: "blur" }],
|
|
startTime: [{ required: true, message: "请填写开始时间", trigger: "blur" }],
|
|
|
loadPort: [{ required: true, message: "请填写装货港", trigger: "blur" }],
|
|
loadPort: [{ required: true, message: "请填写装货港", trigger: "blur" }],
|
|
|
- // dischargeProt: [{ required: true, message: "请填写卸货港", trigger: "blur" }],
|
|
|
|
|
cargo: [{ required: true, message: "请填写货种", trigger: "blur" }],
|
|
cargo: [{ required: true, message: "请填写货种", trigger: "blur" }],
|
|
|
tons: [{ required: false, message: "请填写吨位", trigger: "blur" }],
|
|
tons: [{ required: false, message: "请填写吨位", trigger: "blur" }],
|
|
|
pieces: [{ required: false, message: "请填写件数", trigger: "blur" }],
|
|
pieces: [{ required: false, message: "请填写件数", trigger: "blur" }],
|
|
|
|
|
+ reasonableUnloadingDays: [
|
|
|
|
|
+ { required: true, message: "请填写合理卸货天数", trigger: "blur" },
|
|
|
|
|
+ ],
|
|
|
});
|
|
});
|
|
|
let voyageForm = ref({
|
|
let voyageForm = ref({
|
|
|
cargoOwnerId: "",
|
|
cargoOwnerId: "",
|
|
@@ -535,7 +550,6 @@ let voyageForm = ref({
|
|
|
startTime: "",
|
|
startTime: "",
|
|
|
endTime: "",
|
|
endTime: "",
|
|
|
loadPort: "",
|
|
loadPort: "",
|
|
|
- dischargeProt: "",
|
|
|
|
|
cargo: "",
|
|
cargo: "",
|
|
|
tons: 0,
|
|
tons: 0,
|
|
|
loadPortId: "",
|
|
loadPortId: "",
|
|
@@ -543,145 +557,26 @@ let voyageForm = ref({
|
|
|
shipId: "",
|
|
shipId: "",
|
|
|
shipName: "",
|
|
shipName: "",
|
|
|
pieces: 0,
|
|
pieces: 0,
|
|
|
|
|
+ reasonableUnloadingDays: 0,
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-function clear(type) {
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- switch (type) {
|
|
|
|
|
- case "shipId": {
|
|
|
|
|
- let index = ref(-1);
|
|
|
|
|
- for (let i in shipsCache.value) {
|
|
|
|
|
- if (voyageForm.value.shipName == shipsCache.value[i].shipName) {
|
|
|
|
|
- index.value = i;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (index.value != -1) {
|
|
|
|
|
- voyageForm.value.shipId = shipsCache.value[index.value].shipId;
|
|
|
|
|
- } else {
|
|
|
|
|
- let b = shipsCache.value.some((item) => {
|
|
|
|
|
- return (
|
|
|
|
|
- item.shipId == voyageForm.value.shipId &&
|
|
|
|
|
- item.shipName == voyageForm.value.shipName
|
|
|
|
|
- );
|
|
|
|
|
- });
|
|
|
|
|
- voyageForm.value["shipId"] = "";
|
|
|
|
|
- voyageForm.value["shipName"] = "";
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- case "cargoOwnerId": {
|
|
|
|
|
- let index = ref(-1);
|
|
|
|
|
- for (let i in cargoOwnersCache.value) {
|
|
|
|
|
- if (
|
|
|
|
|
- voyageForm.value.cargoOwnerName ==
|
|
|
|
|
- cargoOwnersCache.value[i].userName
|
|
|
|
|
- ) {
|
|
|
|
|
- index.value = i;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (index.value != -1) {
|
|
|
|
|
- voyageForm.value.cargoOwnerId =
|
|
|
|
|
- cargoOwnersCache.value[index.value].userId;
|
|
|
|
|
- } else {
|
|
|
|
|
- let b = cargoOwnersCache.value.some((item) => {
|
|
|
|
|
- return (
|
|
|
|
|
- item.userId == voyageForm.value.cargoOwnerId &&
|
|
|
|
|
- item.userName == voyageForm.value.cargoOwnerName
|
|
|
|
|
- );
|
|
|
|
|
- });
|
|
|
|
|
- if (!b) {
|
|
|
|
|
- voyageForm.value["cargoOwnerId"] = "";
|
|
|
|
|
- voyageForm.value["cargoOwnerName"] = "";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- case "loadPort": {
|
|
|
|
|
- let index = ref(-1);
|
|
|
|
|
- for (let i in colCache.value) {
|
|
|
|
|
- if (voyageForm.value.loadPort == colCache.value[i].value) {
|
|
|
|
|
- index.value = i;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (index.value != -1) {
|
|
|
|
|
- voyageForm.value.loadPortId = colCache.value[index.value].key;
|
|
|
|
|
- } else {
|
|
|
|
|
- let b = colCache.value.some((item) => {
|
|
|
|
|
- return (
|
|
|
|
|
- item.value == voyageForm.value.loadPort &&
|
|
|
|
|
- item.key == voyageForm.value.loadPortId
|
|
|
|
|
- );
|
|
|
|
|
- });
|
|
|
|
|
- if (!b) {
|
|
|
|
|
- voyageForm.value["loadPort"] = "";
|
|
|
|
|
- voyageForm.value["loadPortId"] = "";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- case "dischargeProt": {
|
|
|
|
|
- let index = ref(-1);
|
|
|
|
|
- for (let i in colCache.value) {
|
|
|
|
|
- if (voyageForm.value.dischargeProt == colCache.value[i].value) {
|
|
|
|
|
- index.value = i;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (index.value != -1) {
|
|
|
|
|
- voyageForm.value.dischargeProtId = colCache.value[index.value].key;
|
|
|
|
|
- } else {
|
|
|
|
|
- let b = colCache.value.some((item) => {
|
|
|
|
|
- return (
|
|
|
|
|
- item.value == voyageForm.value.dischargeProt &&
|
|
|
|
|
- item.key == voyageForm.value.dischargeProtId
|
|
|
|
|
- );
|
|
|
|
|
- });
|
|
|
|
|
- if (!b) {
|
|
|
|
|
- voyageForm.value["dischargeProt"] = "";
|
|
|
|
|
- voyageForm.value["dischargeProtId"] = "";
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }, 200);
|
|
|
|
|
-}
|
|
|
|
|
let voyageFormRef = ref(null);
|
|
let voyageFormRef = ref(null);
|
|
|
|
|
|
|
|
async function addVoyage() {
|
|
async function addVoyage() {
|
|
|
voyageFormRef.value.validate(async (valid) => {
|
|
voyageFormRef.value.validate(async (valid) => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
console.log("提交", voyageForm.value);
|
|
console.log("提交", voyageForm.value);
|
|
|
- discPorts.value = discPorts.value.filter((item) => {
|
|
|
|
|
- return item.discPortId && item.discPort;
|
|
|
|
|
- });
|
|
|
|
|
|
|
|
|
|
- if (!discPorts.value.length) {
|
|
|
|
|
|
|
+ if (!dischargePorts.value.length) {
|
|
|
ElNotification({
|
|
ElNotification({
|
|
|
title: "请选择至少一个装货港",
|
|
title: "请选择至少一个装货港",
|
|
|
type: "error",
|
|
type: "error",
|
|
|
});
|
|
});
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- let discId = [];
|
|
|
|
|
- let discStr = [];
|
|
|
|
|
- console.log(discPorts.value);
|
|
|
|
|
- for (let i of discPorts.value) {
|
|
|
|
|
- discId.push(i.discPortId);
|
|
|
|
|
- discStr.push(i.discPort);
|
|
|
|
|
- }
|
|
|
|
|
- let dischargePortIds = discId.join(",");
|
|
|
|
|
- let dischargePorts = discStr.join(",");
|
|
|
|
|
- voyageForm.value.dischargePortIds = dischargePortIds;
|
|
|
|
|
- voyageForm.value.dischargePorts = dischargePorts;
|
|
|
|
|
let res = await api.addVoyage({
|
|
let res = await api.addVoyage({
|
|
|
...voyageForm.value,
|
|
...voyageForm.value,
|
|
|
|
|
+ dischargePorts: dischargePorts.value,
|
|
|
});
|
|
});
|
|
|
if (res.data.status == 0) {
|
|
if (res.data.status == 0) {
|
|
|
ElNotification({
|
|
ElNotification({
|
|
@@ -738,6 +633,8 @@ let selectShip = (item) => {
|
|
|
let selectCargoOwner = (item) => {
|
|
let selectCargoOwner = (item) => {
|
|
|
voyageForm.value.cargoOwnerName = item.key;
|
|
voyageForm.value.cargoOwnerName = item.key;
|
|
|
voyageForm.value.cargoOwnerId = item.value;
|
|
voyageForm.value.cargoOwnerId = item.value;
|
|
|
|
|
+ voyageForm.value.cargo = "";
|
|
|
|
|
+ voyageForm.value.cargoId = "";
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
let getCol = _.debounce(
|
|
let getCol = _.debounce(
|
|
@@ -763,11 +660,16 @@ let selectLoadPort = (item) => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
let selectDischargeProt = (item, index) => {
|
|
let selectDischargeProt = (item, index) => {
|
|
|
- discPorts.value[index] = { discPortId: item.value, discPort: item.key };
|
|
|
|
|
|
|
+ dischargePorts.value[index] = {
|
|
|
|
|
+ dischargePort: item.key,
|
|
|
|
|
+ id: item.value,
|
|
|
|
|
+ reasonableUnloadingDays: 0,
|
|
|
|
|
+ };
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
let selectCargo = (item) => {
|
|
let selectCargo = (item) => {
|
|
|
voyageForm.value.cargo = item.key;
|
|
voyageForm.value.cargo = item.key;
|
|
|
|
|
+ voyageForm.value.cargoId = item.value;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
function resetAddVoyageForm() {
|
|
function resetAddVoyageForm() {
|
|
@@ -777,7 +679,7 @@ function resetAddVoyageForm() {
|
|
|
tons: 0,
|
|
tons: 0,
|
|
|
pieces: 0,
|
|
pieces: 0,
|
|
|
};
|
|
};
|
|
|
- discPorts.value = [{}];
|
|
|
|
|
|
|
+ dischargePorts.value = [{}];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
let sortradio = ref(0);
|
|
let sortradio = ref(0);
|
|
@@ -830,10 +732,10 @@ function rowStyle({ row }) {
|
|
|
return rowStyle;
|
|
return rowStyle;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-let discPorts = ref([{}]);
|
|
|
|
|
|
|
+let dischargePorts = ref([{}]);
|
|
|
|
|
|
|
|
function addDiscPort() {
|
|
function addDiscPort() {
|
|
|
- discPorts.value.push({});
|
|
|
|
|
|
|
+ dischargePorts.value.push({});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
let exportModalVisable = ref(false);
|
|
let exportModalVisable = ref(false);
|