|
|
@@ -244,7 +244,11 @@
|
|
|
label="创建时间"
|
|
|
min-width="100"
|
|
|
align="center"
|
|
|
- ></el-table-column>
|
|
|
+ >
|
|
|
+ <template v-slot="scope">
|
|
|
+ {{ subTimeStr(scope.row.createTime) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column
|
|
|
prop="remark"
|
|
|
label="备注"
|
|
|
@@ -278,7 +282,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
-<script>
|
|
|
+<script setup>
|
|
|
import { ref, h, reactive, toRefs, onMounted } from "vue";
|
|
|
import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
|
|
|
import store from "../../store";
|
|
|
@@ -286,364 +290,324 @@ import router from "../../router";
|
|
|
import md5 from "md5";
|
|
|
import api from "../../apis/fetch";
|
|
|
import _ from "lodash";
|
|
|
-
|
|
|
-export default {
|
|
|
- setup() {
|
|
|
- let currentPage = ref(1);
|
|
|
- let term = ref("");
|
|
|
- let tableData = ref([]);
|
|
|
- let total = ref(0);
|
|
|
- let status = ref(0);
|
|
|
- async function getVoyageList() {
|
|
|
- tableData.value = [];
|
|
|
-
|
|
|
- let res = await api.getVoyageList({
|
|
|
- loginAccountId: localStorage.loginAccountId,
|
|
|
- cargoOwnerId: localStorage.userId,
|
|
|
- shipId: 0,
|
|
|
- status: status.value,
|
|
|
- term: term.value,
|
|
|
- currentPage: currentPage.value,
|
|
|
- size: 10,
|
|
|
- });
|
|
|
- term.value = "";
|
|
|
- if (res.data.status == 0) {
|
|
|
- tableData.value = res.data.result;
|
|
|
- total.value = res.data.total;
|
|
|
- } else {
|
|
|
- ElNotification({
|
|
|
- type: "error",
|
|
|
- title: res.data.msg,
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- function changeVoyageType(s) {
|
|
|
- term.value = "";
|
|
|
- currentPage.value = 1;
|
|
|
- status.value = s;
|
|
|
- getVoyageList();
|
|
|
- }
|
|
|
- async function voyageDetail(id) {
|
|
|
- router.push({
|
|
|
- path: "/voyage/voyageDetail",
|
|
|
- query: {
|
|
|
- id,
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- function pageChange(e) {
|
|
|
- currentPage.value = e;
|
|
|
- getVoyageList();
|
|
|
- }
|
|
|
-
|
|
|
- function goToVoyageAdd() {
|
|
|
- router.push({
|
|
|
- path: "/voyage/voyageAdd",
|
|
|
- });
|
|
|
- }
|
|
|
- let voyageAddDialogVisible = ref(false);
|
|
|
- const rules = reactive({
|
|
|
- rules: {
|
|
|
- voyageName: [
|
|
|
- { required: false, message: "请填写航次名称", trigger: "blur" },
|
|
|
- ],
|
|
|
- shipName: [{ required: true, message: "请选择船舶", trigger: "blur" }],
|
|
|
- cargoOwnerName: [
|
|
|
- { required: true, message: "请选择货主", trigger: "blur" },
|
|
|
- ],
|
|
|
- startTime: [
|
|
|
- { required: true, message: "请填写开始时间", trigger: "blur" },
|
|
|
- ],
|
|
|
- loadPort: [
|
|
|
- { required: true, message: "请填写装货港", trigger: "blur" },
|
|
|
- ],
|
|
|
- dischargeProt: [
|
|
|
- { required: true, message: "请填写卸货港", trigger: "blur" },
|
|
|
- ],
|
|
|
- cargo: [{ required: true, message: "请填写货种", trigger: "blur" }],
|
|
|
- tons: [{ required: true, message: "请填写吨位", trigger: "blur" }],
|
|
|
- },
|
|
|
- });
|
|
|
- let voyageForm = reactive({
|
|
|
- voyageForm: {
|
|
|
- voyageName: "",
|
|
|
- cargoOwnerId: "",
|
|
|
- cargoOwnerName: "",
|
|
|
- startTime: "",
|
|
|
- endTime: "",
|
|
|
- loadPort: "",
|
|
|
- dischargeProt: "",
|
|
|
- cargo: "",
|
|
|
- tons: "",
|
|
|
- loadPortId: "",
|
|
|
- dischargeProtId: "",
|
|
|
- shipId: "",
|
|
|
- shipName: "",
|
|
|
- },
|
|
|
+import { subTimeStr } from "../../utils/utils";
|
|
|
+
|
|
|
+let currentPage = ref(1);
|
|
|
+let term = ref("");
|
|
|
+let tableData = ref([]);
|
|
|
+let total = ref(0);
|
|
|
+let status = ref(0);
|
|
|
+async function getVoyageList() {
|
|
|
+ tableData.value = [];
|
|
|
+
|
|
|
+ let res = await api.getVoyageList({
|
|
|
+ loginAccountId: localStorage.loginAccountId,
|
|
|
+ cargoOwnerId: localStorage.userId,
|
|
|
+ shipId: 0,
|
|
|
+ status: status.value,
|
|
|
+ term: term.value,
|
|
|
+ currentPage: currentPage.value,
|
|
|
+ size: 10,
|
|
|
+ });
|
|
|
+ term.value = "";
|
|
|
+ if (res.data.status == 0) {
|
|
|
+ tableData.value = res.data.result;
|
|
|
+ total.value = res.data.total;
|
|
|
+ } else {
|
|
|
+ ElNotification({
|
|
|
+ type: "error",
|
|
|
+ title: res.data.msg,
|
|
|
});
|
|
|
+ }
|
|
|
+}
|
|
|
+function changeVoyageType(s) {
|
|
|
+ term.value = "";
|
|
|
+ currentPage.value = 1;
|
|
|
+ status.value = s;
|
|
|
+ getVoyageList();
|
|
|
+}
|
|
|
+async function voyageDetail(id) {
|
|
|
+ router.push({
|
|
|
+ path: "/voyage/voyageDetail",
|
|
|
+ query: {
|
|
|
+ id,
|
|
|
+ },
|
|
|
+ });
|
|
|
+}
|
|
|
+function pageChange(e) {
|
|
|
+ currentPage.value = e;
|
|
|
+ getVoyageList();
|
|
|
+}
|
|
|
|
|
|
- function clear(type) {
|
|
|
- setTimeout(() => {
|
|
|
- switch (type) {
|
|
|
- case "shipId": {
|
|
|
- let index = ref(-1);
|
|
|
- for (let i in shipsCache.value) {
|
|
|
- if (
|
|
|
- voyageForm.voyageForm.shipName == shipsCache.value[i].shipName
|
|
|
- ) {
|
|
|
- index.value = i;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (index.value != -1) {
|
|
|
- voyageForm.voyageForm.shipId =
|
|
|
- shipsCache.value[index.value].shipId;
|
|
|
- } else {
|
|
|
- let b = shipsCache.value.some((item) => {
|
|
|
- return (
|
|
|
- item.shipId == voyageForm.voyageForm.shipId &&
|
|
|
- item.shipName == voyageForm.voyageForm.shipName
|
|
|
- );
|
|
|
- });
|
|
|
- voyageForm.voyageForm["shipId"] = "";
|
|
|
- voyageForm.voyageForm["shipName"] = "";
|
|
|
- }
|
|
|
+function goToVoyageAdd() {
|
|
|
+ router.push({
|
|
|
+ path: "/voyage/voyageAdd",
|
|
|
+ });
|
|
|
+}
|
|
|
+let voyageAddDialogVisible = ref(false);
|
|
|
+const rules = reactive({
|
|
|
+ rules: {
|
|
|
+ voyageName: [
|
|
|
+ { required: false, message: "请填写航次名称", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ shipName: [{ required: true, message: "请选择船舶", trigger: "blur" }],
|
|
|
+ cargoOwnerName: [
|
|
|
+ { required: true, message: "请选择货主", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ startTime: [{ required: true, message: "请填写开始时间", trigger: "blur" }],
|
|
|
+ loadPort: [{ required: true, message: "请填写装货港", trigger: "blur" }],
|
|
|
+ dischargeProt: [
|
|
|
+ { required: true, message: "请填写卸货港", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ cargo: [{ required: true, message: "请填写货种", trigger: "blur" }],
|
|
|
+ tons: [{ required: true, message: "请填写吨位", trigger: "blur" }],
|
|
|
+ },
|
|
|
+});
|
|
|
+let voyageForm = reactive({
|
|
|
+ voyageForm: {
|
|
|
+ voyageName: "",
|
|
|
+ cargoOwnerId: "",
|
|
|
+ cargoOwnerName: "",
|
|
|
+ startTime: "",
|
|
|
+ endTime: "",
|
|
|
+ loadPort: "",
|
|
|
+ dischargeProt: "",
|
|
|
+ cargo: "",
|
|
|
+ tons: "",
|
|
|
+ loadPortId: "",
|
|
|
+ dischargeProtId: "",
|
|
|
+ shipId: "",
|
|
|
+ shipName: "",
|
|
|
+ },
|
|
|
+});
|
|
|
+
|
|
|
+function clear(type) {
|
|
|
+ setTimeout(() => {
|
|
|
+ switch (type) {
|
|
|
+ case "shipId": {
|
|
|
+ let index = ref(-1);
|
|
|
+ for (let i in shipsCache.value) {
|
|
|
+ if (voyageForm.voyageForm.shipName == shipsCache.value[i].shipName) {
|
|
|
+ index.value = i;
|
|
|
break;
|
|
|
}
|
|
|
- case "cargoOwnerId": {
|
|
|
- let index = ref(-1);
|
|
|
- for (let i in cargoOwnersCache.value) {
|
|
|
- if (
|
|
|
- voyageForm.voyageForm.cargoOwnerName ==
|
|
|
- cargoOwnersCache.value[i].userName
|
|
|
- ) {
|
|
|
- index.value = i;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (index.value != -1) {
|
|
|
- voyageForm.voyageForm.cargoOwnerId =
|
|
|
- cargoOwnersCache.value[index.value].userId;
|
|
|
- } else {
|
|
|
- let b = cargoOwnersCache.value.some((item) => {
|
|
|
- return (
|
|
|
- item.userId == voyageForm.voyageForm.cargoOwnerId &&
|
|
|
- item.userName == voyageForm.voyageForm.cargoOwnerName
|
|
|
- );
|
|
|
- });
|
|
|
- if (!b) {
|
|
|
- voyageForm.voyageForm["cargoOwnerId"] = "";
|
|
|
- voyageForm.voyageForm["cargoOwnerName"] = "";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+ if (index.value != -1) {
|
|
|
+ voyageForm.voyageForm.shipId = shipsCache.value[index.value].shipId;
|
|
|
+ } else {
|
|
|
+ let b = shipsCache.value.some((item) => {
|
|
|
+ return (
|
|
|
+ item.shipId == voyageForm.voyageForm.shipId &&
|
|
|
+ item.shipName == voyageForm.voyageForm.shipName
|
|
|
+ );
|
|
|
+ });
|
|
|
+ voyageForm.voyageForm["shipId"] = "";
|
|
|
+ voyageForm.voyageForm["shipName"] = "";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case "cargoOwnerId": {
|
|
|
+ let index = ref(-1);
|
|
|
+ for (let i in cargoOwnersCache.value) {
|
|
|
+ if (
|
|
|
+ voyageForm.voyageForm.cargoOwnerName ==
|
|
|
+ cargoOwnersCache.value[i].userName
|
|
|
+ ) {
|
|
|
+ index.value = i;
|
|
|
break;
|
|
|
}
|
|
|
- case "loadPort": {
|
|
|
- let index = ref(-1);
|
|
|
- for (let i in colCache.value) {
|
|
|
- if (voyageForm.voyageForm.loadPort == colCache.value[i].value) {
|
|
|
- index.value = i;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (index.value != -1) {
|
|
|
- voyageForm.voyageForm.loadPortId =
|
|
|
- colCache.value[index.value].key;
|
|
|
- } else {
|
|
|
- let b = colCache.value.some((item) => {
|
|
|
- return (
|
|
|
- item.value == voyageForm.voyageForm.loadPort &&
|
|
|
- item.key == voyageForm.voyageForm.loadPortId
|
|
|
- );
|
|
|
- });
|
|
|
- if (!b) {
|
|
|
- voyageForm.voyageForm["loadPort"] = "";
|
|
|
- voyageForm.voyageForm["loadPortId"] = "";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
+ }
|
|
|
+ if (index.value != -1) {
|
|
|
+ voyageForm.voyageForm.cargoOwnerId =
|
|
|
+ cargoOwnersCache.value[index.value].userId;
|
|
|
+ } else {
|
|
|
+ let b = cargoOwnersCache.value.some((item) => {
|
|
|
+ return (
|
|
|
+ item.userId == voyageForm.voyageForm.cargoOwnerId &&
|
|
|
+ item.userName == voyageForm.voyageForm.cargoOwnerName
|
|
|
+ );
|
|
|
+ });
|
|
|
+ if (!b) {
|
|
|
+ voyageForm.voyageForm["cargoOwnerId"] = "";
|
|
|
+ voyageForm.voyageForm["cargoOwnerName"] = "";
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- case "dischargeProt": {
|
|
|
- let index = ref(-1);
|
|
|
- for (let i in colCache.value) {
|
|
|
- if (
|
|
|
- voyageForm.voyageForm.dischargeProt == colCache.value[i].value
|
|
|
- ) {
|
|
|
- index.value = i;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (index.value != -1) {
|
|
|
- voyageForm.voyageForm.dischargeProtId =
|
|
|
- colCache.value[index.value].key;
|
|
|
- } else {
|
|
|
- let b = colCache.value.some((item) => {
|
|
|
- return (
|
|
|
- item.value == voyageForm.voyageForm.dischargeProt &&
|
|
|
- item.key == voyageForm.voyageForm.dischargeProtId
|
|
|
- );
|
|
|
- });
|
|
|
- if (!b) {
|
|
|
- voyageForm.voyageForm["dischargeProt"] = "";
|
|
|
- voyageForm.voyageForm["dischargeProtId"] = "";
|
|
|
- }
|
|
|
- }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case "loadPort": {
|
|
|
+ let index = ref(-1);
|
|
|
+ for (let i in colCache.value) {
|
|
|
+ if (voyageForm.voyageForm.loadPort == colCache.value[i].value) {
|
|
|
+ index.value = i;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- }, 200);
|
|
|
- }
|
|
|
- let addVoyageForm = ref(null);
|
|
|
-
|
|
|
- async function addVoyage() {
|
|
|
- addVoyageForm.value.validate(async (valid) => {
|
|
|
- if (valid) {
|
|
|
- console.log("提交", voyageForm.voyageForm);
|
|
|
- let res = await api.addVoyage({
|
|
|
- ...voyageForm.voyageForm,
|
|
|
+ if (index.value != -1) {
|
|
|
+ voyageForm.voyageForm.loadPortId = colCache.value[index.value].key;
|
|
|
+ } else {
|
|
|
+ let b = colCache.value.some((item) => {
|
|
|
+ return (
|
|
|
+ item.value == voyageForm.voyageForm.loadPort &&
|
|
|
+ item.key == voyageForm.voyageForm.loadPortId
|
|
|
+ );
|
|
|
});
|
|
|
- if (res.data.status == 0) {
|
|
|
- ElNotification({
|
|
|
- title: res.data.msg,
|
|
|
- type: "success",
|
|
|
- });
|
|
|
- resetAddVoyageForm();
|
|
|
- getVoyageList();
|
|
|
- } else {
|
|
|
- console.log(res);
|
|
|
- ElNotification({
|
|
|
- title: res.data.msg,
|
|
|
- type: "error",
|
|
|
- });
|
|
|
+ if (!b) {
|
|
|
+ voyageForm.voyageForm["loadPort"] = "";
|
|
|
+ voyageForm.voyageForm["loadPortId"] = "";
|
|
|
}
|
|
|
- } else {
|
|
|
- console.log("未提交", voyageForm.voyageForm);
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
- let shipsCache = ref([]);
|
|
|
- let colCache = ref([]);
|
|
|
- let cargoOwnersCache = ref([]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- const searchShip = _.debounce(
|
|
|
- async (queryString, cb) => {
|
|
|
- if (!queryString) return;
|
|
|
- let res = await api.searchShip({
|
|
|
- term: queryString,
|
|
|
- });
|
|
|
- let ships = [];
|
|
|
- if (res.data.status == 0) {
|
|
|
- ships = res.data.result;
|
|
|
- for (let i of ships) {
|
|
|
- i.value = `${i.shipName}`;
|
|
|
+ case "dischargeProt": {
|
|
|
+ let index = ref(-1);
|
|
|
+ for (let i in colCache.value) {
|
|
|
+ if (voyageForm.voyageForm.dischargeProt == colCache.value[i].value) {
|
|
|
+ index.value = i;
|
|
|
+ break;
|
|
|
}
|
|
|
- shipsCache.value = ships;
|
|
|
- cb(ships);
|
|
|
}
|
|
|
- },
|
|
|
- 1000,
|
|
|
- { leading: true }
|
|
|
- );
|
|
|
-
|
|
|
- const selectShip = (item) => {
|
|
|
- voyageForm.voyageForm.shipId = item.shipId;
|
|
|
- };
|
|
|
-
|
|
|
- const searchCargoOwner = _.debounce(
|
|
|
- async (queryString, cb) => {
|
|
|
- if (!queryString) return;
|
|
|
- let res = await api.searchUser({
|
|
|
- term: queryString,
|
|
|
- identity: 2,
|
|
|
- });
|
|
|
- let cargoOwners = [];
|
|
|
- if (res.data.status == 0) {
|
|
|
- cargoOwners = res.data.result;
|
|
|
- for (let i of cargoOwners) {
|
|
|
- i.value = `${i.userName}`;
|
|
|
+ if (index.value != -1) {
|
|
|
+ voyageForm.voyageForm.dischargeProtId =
|
|
|
+ colCache.value[index.value].key;
|
|
|
+ } else {
|
|
|
+ let b = colCache.value.some((item) => {
|
|
|
+ return (
|
|
|
+ item.value == voyageForm.voyageForm.dischargeProt &&
|
|
|
+ item.key == voyageForm.voyageForm.dischargeProtId
|
|
|
+ );
|
|
|
+ });
|
|
|
+ if (!b) {
|
|
|
+ voyageForm.voyageForm["dischargeProt"] = "";
|
|
|
+ voyageForm.voyageForm["dischargeProtId"] = "";
|
|
|
}
|
|
|
- cargoOwnersCache.value = cargoOwners;
|
|
|
- cb(cargoOwners);
|
|
|
}
|
|
|
- },
|
|
|
- 1000,
|
|
|
- { leading: true }
|
|
|
- );
|
|
|
-
|
|
|
- const selectCargoOwner = (item) => {
|
|
|
- voyageForm.voyageForm.cargoOwnerId = item.userId;
|
|
|
- };
|
|
|
-
|
|
|
- const getCol = _.debounce(
|
|
|
- async (queryString, cb) => {
|
|
|
- if (!queryString) return;
|
|
|
- let res = await api.getCol({
|
|
|
- term: queryString,
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 200);
|
|
|
+}
|
|
|
+let addVoyageForm = ref(null);
|
|
|
+
|
|
|
+async function addVoyage() {
|
|
|
+ addVoyageForm.value.validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ console.log("提交", voyageForm.voyageForm);
|
|
|
+ let res = await api.addVoyage({
|
|
|
+ ...voyageForm.voyageForm,
|
|
|
+ });
|
|
|
+ if (res.data.status == 0) {
|
|
|
+ ElNotification({
|
|
|
+ title: res.data.msg,
|
|
|
+ type: "success",
|
|
|
});
|
|
|
- if (res.data.status == 0) {
|
|
|
- colCache.value = [...colCache.value, ...res.data.result];
|
|
|
- colCache.value = _.uniqBy(colCache.value, "key");
|
|
|
+ resetAddVoyageForm();
|
|
|
+ getVoyageList();
|
|
|
+ } else {
|
|
|
+ console.log(res);
|
|
|
+ ElNotification({
|
|
|
+ title: res.data.msg,
|
|
|
+ type: "error",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log("未提交", voyageForm.voyageForm);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
- cb(res.data.result);
|
|
|
- }
|
|
|
- },
|
|
|
- 1000,
|
|
|
- { leading: true }
|
|
|
- );
|
|
|
-
|
|
|
- const selectLoadPort = (item) => {
|
|
|
- voyageForm.voyageForm.loadPortId = item.key;
|
|
|
- voyageForm.voyageForm.loadPort = item.value;
|
|
|
- };
|
|
|
-
|
|
|
- const selectDischargeProt = (item) => {
|
|
|
- voyageForm.voyageForm.dischargeProtId = item.key;
|
|
|
- voyageForm.voyageForm.dischargeProt = item.value;
|
|
|
- };
|
|
|
-
|
|
|
- function resetAddVoyageForm() {
|
|
|
- voyageAddDialogVisible.value = false;
|
|
|
- addVoyageForm.value.resetFields();
|
|
|
+let shipsCache = ref([]);
|
|
|
+let colCache = ref([]);
|
|
|
+let cargoOwnersCache = ref([]);
|
|
|
+
|
|
|
+const searchShip = _.debounce(
|
|
|
+ async (queryString, cb) => {
|
|
|
+ if (!queryString) return;
|
|
|
+ let res = await api.searchShip({
|
|
|
+ term: queryString,
|
|
|
+ });
|
|
|
+ let ships = [];
|
|
|
+ if (res.data.status == 0) {
|
|
|
+ ships = res.data.result;
|
|
|
+ for (let i of ships) {
|
|
|
+ i.value = `${i.shipName}`;
|
|
|
+ }
|
|
|
+ shipsCache.value = ships;
|
|
|
+ cb(ships);
|
|
|
}
|
|
|
+ },
|
|
|
+ 1000,
|
|
|
+ { leading: true }
|
|
|
+);
|
|
|
+
|
|
|
+const selectShip = (item) => {
|
|
|
+ voyageForm.voyageForm.shipId = item.shipId;
|
|
|
+};
|
|
|
|
|
|
- let sortradio = ref(0);
|
|
|
-
|
|
|
- getVoyageList();
|
|
|
- onMounted(() => {});
|
|
|
-
|
|
|
- return {
|
|
|
- currentPage,
|
|
|
- term,
|
|
|
- tableData,
|
|
|
- total,
|
|
|
- status,
|
|
|
- changeVoyageType,
|
|
|
- getVoyageList,
|
|
|
- voyageDetail,
|
|
|
- pageChange,
|
|
|
- goToVoyageAdd,
|
|
|
- addVoyage,
|
|
|
- voyageAddDialogVisible,
|
|
|
- addVoyageForm,
|
|
|
- ...toRefs(rules),
|
|
|
- ...toRefs(voyageForm),
|
|
|
- searchShip,
|
|
|
- selectShip,
|
|
|
- searchCargoOwner,
|
|
|
- selectCargoOwner,
|
|
|
- resetAddVoyageForm,
|
|
|
- getCol,
|
|
|
- selectLoadPort,
|
|
|
- selectDischargeProt,
|
|
|
- clear,
|
|
|
- sortradio,
|
|
|
- };
|
|
|
+const searchCargoOwner = _.debounce(
|
|
|
+ async (queryString, cb) => {
|
|
|
+ if (!queryString) return;
|
|
|
+ let res = await api.searchUser({
|
|
|
+ term: queryString,
|
|
|
+ identity: 2,
|
|
|
+ });
|
|
|
+ let cargoOwners = [];
|
|
|
+ if (res.data.status == 0) {
|
|
|
+ cargoOwners = res.data.result;
|
|
|
+ for (let i of cargoOwners) {
|
|
|
+ i.value = `${i.userName}`;
|
|
|
+ }
|
|
|
+ cargoOwnersCache.value = cargoOwners;
|
|
|
+ cb(cargoOwners);
|
|
|
+ }
|
|
|
},
|
|
|
+ 1000,
|
|
|
+ { leading: true }
|
|
|
+);
|
|
|
+
|
|
|
+const selectCargoOwner = (item) => {
|
|
|
+ voyageForm.voyageForm.cargoOwnerId = item.userId;
|
|
|
};
|
|
|
+
|
|
|
+const getCol = _.debounce(
|
|
|
+ async (queryString, cb) => {
|
|
|
+ if (!queryString) return;
|
|
|
+ let res = await api.getCol({
|
|
|
+ term: queryString,
|
|
|
+ });
|
|
|
+ if (res.data.status == 0) {
|
|
|
+ colCache.value = [...colCache.value, ...res.data.result];
|
|
|
+ colCache.value = _.uniqBy(colCache.value, "key");
|
|
|
+
|
|
|
+ cb(res.data.result);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 1000,
|
|
|
+ { leading: true }
|
|
|
+);
|
|
|
+
|
|
|
+const selectLoadPort = (item) => {
|
|
|
+ voyageForm.voyageForm.loadPortId = item.key;
|
|
|
+ voyageForm.voyageForm.loadPort = item.value;
|
|
|
+};
|
|
|
+
|
|
|
+const selectDischargeProt = (item) => {
|
|
|
+ voyageForm.voyageForm.dischargeProtId = item.key;
|
|
|
+ voyageForm.voyageForm.dischargeProt = item.value;
|
|
|
+};
|
|
|
+
|
|
|
+function resetAddVoyageForm() {
|
|
|
+ voyageAddDialogVisible.value = false;
|
|
|
+ addVoyageForm.value.resetFields();
|
|
|
+}
|
|
|
+
|
|
|
+let sortradio = ref(0);
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ getVoyageList();
|
|
|
+});
|
|
|
</script>
|
|
|
<style scoped>
|
|
|
.search-btn {
|