diff --git a/src/api/views/AmsIndex.js b/src/api/views/AmsIndex.js index 4b4f1ad..232e4bd 100644 --- a/src/api/views/AmsIndex.js +++ b/src/api/views/AmsIndex.js @@ -11,22 +11,46 @@ const GetToken = (data) => { }); }; // 查询 -const Load = (params) => { +const PageData = (params) => { return request({ data: { - url: "/api/Ams/Load", + url: "/api/Afr/PageData", method: "get", params, headers: { Authorization: localStorage.getItem("token") }, }, }); }; +// 获取历史记录 +const GetHistory = (params) => { + return request({ + data: { + url: "/api/Afr/GetHistory", + method: "get", + params, + headers: { Authorization: localStorage.getItem("token") }, + }, + }); +}; + +// 查询 +const Detail = (params) => { + return request({ + data: { + url: "/api/Afr/Detail", + method: "get", + params, + headers: { Authorization: localStorage.getItem("token") }, + }, + }); +}; + // 删除 const Del = (params) => { return request({ data: { - url: "/api/Ams/Del", - method: "get", + url: "/api/Afr/Del", + method: "post", params, headers: { Authorization: localStorage.getItem("token") }, }, @@ -36,7 +60,7 @@ const Del = (params) => { const AddOrUpdate = (data) => { return request({ data: { - url: "/api/Ams/AddOrUpdate", + url: "/api/Afr/AddOrUpdate", method: "post", data, headers: { Authorization: localStorage.getItem("token") }, @@ -47,7 +71,7 @@ const AddOrUpdate = (data) => { const Send = (params) => { return request({ data: { - url: "/api/Ams/Send", + url: "/api/Afr/Send", method: "get", params, headers: { Authorization: localStorage.getItem("token") }, @@ -58,7 +82,7 @@ const Send = (params) => { const GetCARRIER = () => { return request({ data: { - url: "/GetCARRIER", + url: "/api/Common/GetCARRIER", method: "get", headers: { Authorization: localStorage.getItem("token") }, }, @@ -68,7 +92,7 @@ const GetCARRIER = () => { const GetCTNALL = () => { return request({ data: { - url: "/GetCTNALL", + url: "/api/Common/GetCTNALL", method: "get", headers: { Authorization: localStorage.getItem("token") }, }, @@ -78,7 +102,7 @@ const GetCTNALL = () => { const GetKINDPKGS = () => { return request({ data: { - url: "/GetPackage", + url: "/api/Common/GetPackage", method: "get", headers: { Authorization: localStorage.getItem("token") }, }, @@ -99,7 +123,7 @@ const GetDangerousGoods = (params) => { const GetCountry = () => { return request({ data: { - url: "/GetCountry", + url: "/api/Common/GetCountry", method: "get", headers: { Authorization: localStorage.getItem("token") }, }, @@ -109,7 +133,7 @@ const GetCountry = () => { const GetCodePortLoad = (params) => { return request({ data: { - url: "/GetCodePortLoad", + url: "/api/Common/GetPort", method: "get", headers: { Authorization: localStorage.getItem("token") }, params, @@ -120,7 +144,7 @@ const GetCodePortLoad = (params) => { const GetPort = (params) => { return request({ data: { - url: "/GetPort", + url: "/api/Common/GetPort", method: "get", headers: { Authorization: localStorage.getItem("token") }, params, @@ -131,7 +155,7 @@ const GetPort = (params) => { const GetVessel = (params) => { return request({ data: { - url: "/GetVessel", + url: "/api/Common/GetVessel", method: "get", headers: { Authorization: localStorage.getItem("token") }, params, @@ -195,7 +219,9 @@ const GetSASCCODE = (params) => { }); }; export { - Load, + PageData, + GetHistory, + Detail, Del, Send, AddOrUpdate, diff --git a/src/api/views/DAmsIndex.js b/src/api/views/DAmsIndex.js index db7924c..77e13d9 100644 --- a/src/api/views/DAmsIndex.js +++ b/src/api/views/DAmsIndex.js @@ -58,7 +58,7 @@ const Send = (params) => { const GetCARRIER = () => { return request({ data: { - url: "/AMS/GetCARRIER", + url: "/AFR/GetCARRIER", method: "get", headers: { Authorization: localStorage.getItem("token") }, }, @@ -68,7 +68,7 @@ const GetCARRIER = () => { const GetCTNALL = () => { return request({ data: { - url: "/AMS/GetCTNALL", + url: "/AFR/GetCTNALL", method: "get", headers: { Authorization: localStorage.getItem("token") }, }, @@ -78,7 +78,7 @@ const GetCTNALL = () => { const GetKINDPKGS = () => { return request({ data: { - url: "/AMS/GetPackage", + url: "/AFR/GetPackage", method: "get", headers: { Authorization: localStorage.getItem("token") }, }, @@ -88,7 +88,7 @@ const GetKINDPKGS = () => { const GetDangerousGoods = (params) => { return request({ data: { - url: "/AMS/GetDangerousGoods", + url: "/AFR/GetDangerousGoods", method: "get", params, headers: { Authorization: localStorage.getItem("token") }, @@ -99,7 +99,7 @@ const GetDangerousGoods = (params) => { const GetCountry = () => { return request({ data: { - url: "/AMS/GetCountry", + url: "/AFR/GetCountry", method: "get", headers: { Authorization: localStorage.getItem("token") }, }, @@ -109,7 +109,7 @@ const GetCountry = () => { const GetCodePortLoad = (params) => { return request({ data: { - url: "/AMS/GetCodePortLoad", + url: "/AFR/GetCodePortLoad", method: "get", headers: { Authorization: localStorage.getItem("token") }, params, @@ -120,7 +120,7 @@ const GetCodePortLoad = (params) => { const GetPort = (params) => { return request({ data: { - url: "/AMS/GetPort", + url: "/AFR/GetPort", method: "get", headers: { Authorization: localStorage.getItem("token") }, params, @@ -131,7 +131,7 @@ const GetPort = (params) => { const GetVessel = (params) => { return request({ data: { - url: "/AMS/GetVessel", + url: "/AFR/GetVessel", method: "get", headers: { Authorization: localStorage.getItem("token") }, params, diff --git a/src/main.js b/src/main.js index a2c6ce0..892a1c9 100644 --- a/src/main.js +++ b/src/main.js @@ -12,6 +12,7 @@ Vue.use(VueEasytable); Vue.use(VueRouter); Vue.use(ElementUI); Vue.config.productionTip = false; +// axios.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8"; Vue.prototype.$axios = axios; const router = new VueRouter({ routes: routes, diff --git a/src/utils/axios.js b/src/utils/axios.js index 748bd4e..aad81a8 100644 --- a/src/utils/axios.js +++ b/src/utils/axios.js @@ -16,7 +16,7 @@ export default ({ data }) => { function (config) { // if (data.url !== "/user/login") { // config.headers["Authorization"] = - // "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkQ1RTkxMDI5OUU0RURFNUZEM0EwNTJBMEFDRDUzMUQzIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2NjkxMDE5NTMsImV4cCI6MTY2OTE0NTE1MywiaXNzIjoiaHR0cDovLzYwLjIwOS4xMjUuMjM4OjM1MTAxIiwiY2xpZW50X2lkIjoiZGp5dXNlciIsInN1YiI6ImQ4NWZkNTkwLWQ5ZjYtNDQxMC05M2ExLWY2ZmFjNzdiNjA2ZSIsImF1dGhfdGltZSI6MTY2OTEwMTk1MywiaWRwIjoibG9jYWwiLCJsb2dpbnR5cGUiOiIyIiwibG9naW5pZCI6ImQ4NWZkNTkwLWQ5ZjYtNDQxMC05M2ExLWY2ZmFjNzdiNjA2ZSIsImp0aSI6IkYxQ0IwMjJCOEM3MTA1QjMxRjcxMUM4QzBGN0FDMEUyIiwiaWF0IjoxNjY5MTAxOTUzLCJzY29wZSI6WyJvcGVuaWQiLCJwcm9maWxlIiwib2ZmbGluZV9hY2Nlc3MiXSwiYW1yIjpbIjIiXX0.RvXAXPPoVob5Lb0-SHYuQ4o6HjCtHBGYNyhEoKKovxLk4151LFSAsqylyY0zggh-TzZ1w5FkiCCclLNDFYmpf_Uniw57InpPKzRwIBF4bvuRz2923eU6QU0MV2Y_vJ_Y9LZ9S5nHrejo7NAEURCHvEnjeqTRFr_CwL4g0cmS2uFmMou2ycdngXbWpkJnkJ-7usmvxXhUhDFFAqlEOEFH51vx80WqbLI7KD2qgAR0xgeo-A-HRdKeho1bg1ZjheF-07bxWRhm7NCxkNlwt5hQdpeEyXWbq5WV-WMwyjFB-i2zuDV_2UP8DTML9ew2uJ4rAgsxMbLdUcXSelq6BBgXfQ"; + // "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkQ1RTkxMDI5OUU0RURFNUZEM0EwNTJBMEFDRDUzMUQzIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE3MDQzNTQ1NTMsImV4cCI6MTcwNDM5Nzc1MywiaXNzIjoiaHR0cDovLzYwLjIwOS4xMjUuMjM4OjQwNTAxIiwiY2xpZW50X2lkIjoiZGp5dXNlciIsInN1YiI6ImQ4NWZkNTkwLWQ5ZjYtNDQxMC05M2ExLWY2ZmFjNzdiNjA2ZSIsImF1dGhfdGltZSI6MTcwNDM1NDU1MywiaWRwIjoibG9jYWwiLCJsb2dpbnR5cGUiOiIyIiwibG9naW5pZCI6ImQ4NWZkNTkwLWQ5ZjYtNDQxMC05M2ExLWY2ZmFjNzdiNjA2ZSIsImp0aSI6IjRENDgwNDg2NjIyNTUwNkRDQzUyNzc3NkY0QTkyNzZDIiwiaWF0IjoxNzA0MzU0NTUzLCJzY29wZSI6WyJvcGVuaWQiLCJwcm9maWxlIiwib2ZmbGluZV9hY2Nlc3MiXSwiYW1yIjpbIjIiXX0.qcr2OGT-g0rx9gl4cz21lZyn5Ry26S9BCoUa5KKqWK7WMUkZRLx-XBd3QadapsauUZ7_hHKcC2ijPX1YDC248S8TUrSdgIJ-ClLS8hHME-lr3GkHb5aEXwR2jQJq3trFEoEv-TD1mKCN9bqurqERLLC_a1wUKDIMX1aCH-sq0CjkwEUMoELddVpuwST7QtpGLpHgI3SwLmSdCAcXvKBlPRlOlXa-zpJCNBHeeUyyD70BPkdFWML0QTQ1Gwgqj34fAsmOgaziaRAjs8ofGXZw0bnTzC3TpVYTmJDd_1rnqaGyW7H9hPcPASDyWL6pxK4z8PxsVsj-hfbsJDy0F7yyXw"; // } return config; }, diff --git a/src/utils/store.js b/src/utils/store.js index 05382ae..589b41c 100644 --- a/src/utils/store.js +++ b/src/utils/store.js @@ -1,6 +1,6 @@ import Vue from "vue"; import Vuex from "vuex"; - +import { Detail, GetHistory } from "@/api/views/AmsIndex"; //1、注册 Vue.use(Vuex); @@ -11,7 +11,7 @@ const store = new Vuex.Store({ editableTabsValue: "0", editableTabs: [ { - title: "AMS列表", + title: "AFR列表", name: "0", }, ], @@ -28,15 +28,49 @@ const store = new Vuex.Store({ getters: {}, mutations: { AddTabs(state, payload) { - let newTabName = ++state.tabIndex + ""; - state.editableTabs.push({ - title: payload && payload.mblno ? payload.mblno : "New Tab", - name: newTabName, - data: payload ? payload : {}, - }); - state.editableTabsValue = newTabName; + console.log(payload); + if (payload && payload.mblno) { + Detail({ gid: payload.gid }).then((res) => { + let newTabName = ++state.tabIndex + ""; + state.editableTabs.push({ + title: payload.mblno, + name: newTabName, + data: res.data.result, + }); + state.editableTabsValue = newTabName; + }); + } else { + let newTabName = ++state.tabIndex + ""; + state.editableTabs.push({ + title: "New Tab", + name: newTabName, + data: {}, + }); + state.editableTabsValue = newTabName; + } }, AddSendTabs(state, payload) { + // let title = ""; + // if (payload) { + // if (payload.EditType == "历史记录") { + // title = "历史记录"; + // } else if (payload.EditType == "查看") { + // title = `查看${payload.mblno}`; + // } else if (payload.EditType == "复制") { + // title = `复制`; + // } else { + // title = payload.mblno; + // } + // } else { + // title = "New Tab"; + // } + // let newTabName = ++state.SendtabIndex + ""; + // state.SendeditableTabs.push({ + // title, + // name: newTabName, + // data: payload ? payload : {}, + // }); + // state.SendeditableTabsValue = newTabName; let title = ""; if (payload) { if (payload.EditType == "历史记录") { @@ -51,13 +85,51 @@ const store = new Vuex.Store({ } else { title = "New Tab"; } - let newTabName = ++state.SendtabIndex + ""; - state.SendeditableTabs.push({ - title, - name: newTabName, - data: payload ? payload : {}, - }); - state.SendeditableTabsValue = newTabName; + console.log(title, payload); + if (payload) { + Detail({ gid: payload.gid }).then((res) => { + if (payload.EditType == "复制") { + payload.gid = "CopyData"; + } + let newTabName = ++state.SendtabIndex + ""; + let data; + payload.houseList.forEach((item) => { + res.data.result.houseList.forEach((item2) => { + if (item2.gid == item.gid) { + data = { ...payload, houseList: [item2] }; + } + }); + }); + + if (payload.EditType == "历史记录") { + GetHistory({ gid: payload.gid }).then((res) => { + console.log(res); + data = { ...payload, history: res.data.result }; + state.SendeditableTabs.push({ + title, + name: newTabName, + data, + }); + state.SendeditableTabsValue = newTabName; + }); + } else { + state.SendeditableTabs.push({ + title, + name: newTabName, + data, + }); + state.SendeditableTabsValue = newTabName; + } + }); + } else { + let newTabName = ++state.SendtabIndex + ""; + state.SendeditableTabs.push({ + title, + name: newTabName, + data: {}, + }); + state.SendeditableTabsValue = newTabName; + } }, }, diff --git a/src/views/Ams/Edit.vue b/src/views/Ams/Edit.vue index 81508d2..1ad5b5a 100644 --- a/src/views/Ams/Edit.vue +++ b/src/views/Ams/Edit.vue @@ -2,285 +2,585 @@
发送 + 保存草稿
- 基本信息
- + style=" + text-align: center; + color: white; + font-size: 20px; + background-color: rgb(143, 186, 223); + padding: 10px 0; + font-weight: bold; + " + > + 基本信息 +
+ - - - + + + - + - - - + + + - + - - - - + - - + - - + + - + - - + + - + - + - - + - + - + - + - + - - - - + - - - + + -
+
-
- 新增 - 分单数量:0 +
+ + 新增 + 分单数量:{{ form.houseList.length }}
-
-

{{ item.hblNo }}

+
+

{{ item.houseBillNo }}

新的分单号

- + 删除
- + - + - +
发货人信息
地址
- +
名称
- +
城市
- +
国家
- + + +
联系人
- +
电话
- +
-
收货人信息 复制通知人
+
+ 收货人信息 + 复制通知人 +
地址
- +
名称
- +
城市
- +
国家
- + + +
联系人
- +
电话
- +
-
通知人信息 - 复制收货人 +
+ 通知人信息 + 复制收货人
地址
- +
名称
- +
城市
- +
国家
- + + +
联系人
- +
电话
- +
-
+
货物明细
-
+
- 新增 - 复制 - 删除 - 清空 + 新增 + 复制 + 删除 + 清空 +
+
+ 行数: {{ form.houseList[ActiveID].cntrList.length }} 件数: + {{ AllPkgs }} 毛重:{{ AllKGS }} 体积:{{ AllCBM }}
-
行数: {{ form.houseDto[ActiveID].ctnInfo.length }} 件数: {{ AllPkgs }} 毛重:{{ AllKGS }} 体积:{{ AllCBM }}
- +
@@ -312,36 +612,40 @@ export default { }, pickerOptions2: { disabledDate: (time) => { - return time.getTime() <= new Date(this.form.eta).getTime(); + return time.getTime() <= new Date(this.form.loadDate).getTime(); }, }, radioOption: { // 行选择改变事件 selectedRowChange: ({ row }) => { - this.selectRows = row + this.selectRows = row; }, }, - selectRows: '', + selectRows: "", dialogFormVisible: false, activeNames: ["1", "2"], - ActiveMapCode: '', + ActiveMapCode: "", form: { consignmentType: "FCL", - carrierid: "", //船公司 + shipCompanyCode: "", //船公司 mblno: "", /// 提单号 vessel: "", /// 船名 voyno: "", /// 航次 - shippingType: "I", /// 运输方式 + loadHarbour: "", /// 装货港 + loadHarbourCode: "", /// 装货港五字码 + dischargeHarbour: "", /// 卸货港 + dischargeHarbourCode: "", /// 卸货港五字码 + lastForeignHarbour: "", ///交货地 + lastForeignHarbourCode: "", ///交货地五字码 + clause: "I", /// 运输方式 shipperaddr: "", /// 发货地 - loadingPortCode: "", /// 装货港 lastNoUsPortCode: "", /// 最后一个非美港/中转港(选填) - portdischargeCode: "", /// 卸货港 - eta: null, /// 预计出发 - etd: null, /// 预计到达 + loadDate: null, /// 预计出发 + estimatedArrivalTime: null, /// 预计到达 sasccode: "NIAV", - houseDto: [ + houseList: [ { - hblNo: "", // /// 货代提单号 + houseBillNo: "", // /// 货代提单号 sendAddress: "", sendName: "", sendCity: "", @@ -364,11 +668,11 @@ export default { notifyContact: "", notifyTel: "", WebHouseDtoId: 0, - ctnInfo: [ + cntrList: [ { enProductName: "", containerNo: "", - containerType: "", + containerTypeCode: "", containerMark: "", sealNo: "", hscode: "", @@ -382,37 +686,39 @@ export default { originCountryCode: "", unCode: "", dangerGrade: "", - rowKey: 0 + rowKey: 0, }, ], }, ], }, rules1: { - carrierid: [{ required: true, message: "请选择船公司" }], + shipCompanyCode: [{ required: true, message: "请选择船公司" }], + consignmentType: [{ required: true, message: "请选择整箱/拼箱" }], + loadHarbour: [{ required: true, message: "请输入装货港" }], + loadHarbourCode: [{ required: true, message: "请输入装货港五字码" }], mblno: [{ required: true, message: "请输入船东提单号(MBL)" }], - vessel: [{ required: true, message: "请输入船名" }], - voyno: [{ required: true, message: "入境美国那班船的航次" }], - shippingType: [{ required: true, message: "请输入运输方式" }], - shipperaddr: [{ required: true, message: "请输入发货地" }], - loadingPortCode: [{ required: true, message: "请输入装货港" }], - dischargeHarbourCode: [{ required: true, message: "请输入卸货港五字码" }], + filingType: [{ required: true, message: "请选择申报运输类型" }], dischargeHarbour: [{ required: true, message: "请输入卸货港" }], - eta: [ + dischargeHarbourCode: [ + { required: true, message: "请输入卸货港五字码" }, + ], + vessel: [{ required: true, message: "请输入船名" }], + loadDate: [ { required: true, message: "请选择预计出发时间", trigger: "blur", }, ], - etd: [ + estimatedArrivalTime: [ { required: true, message: "请选择预计到达时间", trigger: "blur", }, ], - sasccode: [{ required: true, message: "请选择SASC CODE" }], + voyno: [{ required: true, message: "入境美国那班船的航次" }], }, rules: { sendAddress: [{ required: true, message: "请输入地址" }], @@ -447,6 +753,7 @@ export default { DunnoData: [], PortData: [], PortData2: [], + PortData3: [], CountryData: [], CountryData_original: [], VesselData: [], @@ -470,11 +777,14 @@ export default { title: "品名", edit: true, width: 200, - renderHeaderCell: ({ column }, h) => { - return ( - {*} {column.title} - ) - } + // renderHeaderCell: ({ column }, h) => { + // return ( + // + // {" "} + // {*} {column.title} + // + // ); + // }, }, { field: "containerNo", @@ -491,8 +801,8 @@ export default { width: 150, }, { - field: "containerType", - key: "containerType", + field: "containerTypeCode", + key: "containerTypeCode", title: "箱型", edit: true, width: 130, @@ -500,14 +810,25 @@ export default { return ( { - row["containerType"] = val; + row["containerTypeCode"] = val; + }} + on-change={(val) => { + this.CtnallData.forEach((item) => { + if (item.code == val) { + row["containerTypeMapCode"] = item.mapCode; + row["containerTypeName"] = item.value; + } + }); }} placeholder="请选择" > - - + {this.CtnallData.map((item) => { + return ( + + ); + })} ); }, @@ -533,12 +854,46 @@ export default { edit: true, width: 130, }, + // { + // field: "packing", + // key: "packing", + // title: "包装", + // edit: true, + // width: 130, + // }, { - field: "packing", - key: "packing", + field: "packingCode", + key: "packingCode", title: "包装", edit: true, width: 130, + renderBodyCell: ({ row, column, rowIndex }, h) => { + return ( + { + row["packingCode"] = val; + }} + on-change={(val) => { + this.KindpkgsData.forEach((item) => { + if (item.code == val) { + row["packingMapCode"] = item.mapCode; + row["packingMapName"] = item.mapName; + row["packingName"] = item.value; + } + }); + }} + placeholder="请选择" + > + {this.KindpkgsData.map((item) => { + return ( + + ); + })} + + ); + }, }, { field: "grossWeight", @@ -584,15 +939,9 @@ export default { }, ], editOption: { - beforeStartCellEditing: ({ row, column, cellValue }) => { - - }, - beforeCellValueChange: ({ row, column, changeValue }) => { - - }, - afterCellValueChange: ({ row, column, changeValue }) => { - - }, + beforeStartCellEditing: ({ row, column, cellValue }) => {}, + beforeCellValueChange: ({ row, column, changeValue }) => {}, + afterCellValueChange: ({ row, column, changeValue }) => {}, }, }; }, @@ -600,7 +949,7 @@ export default { // 总件数 AllPkgs() { let num = 0; - this.form.houseDto[this.ActiveID].ctnInfo.forEach((item) => { + this.form.houseList[this.ActiveID].cntrList.forEach((item) => { if (item.digit) { num = Number(num) + Number(item.digit); } @@ -610,7 +959,7 @@ export default { // 总毛重 AllKGS() { let num = 0; - this.form.houseDto[this.ActiveID].ctnInfo.forEach((item) => { + this.form.houseList[this.ActiveID].cntrList.forEach((item) => { if (item.grossWeight) { num = Number(num) + Number(item.grossWeight); } @@ -620,49 +969,128 @@ export default { // 总体积 AllCBM() { let num = 0; - this.form.houseDto[this.ActiveID].ctnInfo.forEach((item) => { + this.form.houseList[this.ActiveID].cntrList.forEach((item) => { if (item.volume) { num = Number(num) + Number(item.volume); } }); return num.toFixed(2); }, - + ListData() { + console.log(this.$store.state.ListData); + return this.$store.state.ListData; + }, }, watch: { + ListData: { + immediate: true, + handler(newData) { + if (this.$store.state.editableTabsValue != 0) { + if (!newData.gid) { + Object.assign(this.$data.form, this.$options.data().form); + } else { + let form = { ...newData }; + form.houseList.forEach((item, index) => { + item.cntrList.forEach((item2, index2) => { + item2.rowKey = index2; + item2.name = `${index}-${index2 + 1}`; + }); + }); + GetCARRIER().then((res) => { + res.data.result.forEach((item) => { + if (form.shipCompanyCode == item.code) { + this.ActiveMapCode = item.mapCode; + } + }); + }); + if (!form.houseList.length) { + form.houseList = this.$options.data().form.houseList; + } + this.form = form; + } + if (newData.sasccode) { + this.form.sasccode = newData.sasccode; + } + } + this.$refs.form1 ? this.$refs.form1.clearValidate() : ""; + this.$refs.form ? this.$refs.form.clearValidate() : ""; + this.$refs.form3 ? this.$refs.form3.clearValidate() : ""; + // this.$refs.form2 + // ? this.$refs.form2.forEach((item) => { + // item.clearValidate(); + // }) + // : ""; + }, + }, }, created() { - // GetCARRIER().then((res) => { - // this.CarrierData = res.data.result; - // }); - // GetCTNALL().then((res) => { - // this.CtnallData = res.data.result; - // }); - // GetKINDPKGS().then((res) => { - // this.KindpkgsData = res.data.result; - // }); - // GetCountry().then((res) => { - // this.CountryData_original = res.data.result; - // this.CountryData_original.forEach((item) => { - // item.value = `${item.cnName}-${item.code}`; - // }); - // this.CountryData = this.CountryData_original; - // }); - // GetCodePortLoad().then((res) => { - // this.PortData2 = res.data.result; - // }); + GetCARRIER().then((res) => { + this.CarrierData = res.data.result; + }); + GetCTNALL().then((res) => { + this.CtnallData = res.data.result; + }); + GetKINDPKGS().then((res) => { + this.KindpkgsData = res.data.result; + }); + GetCountry().then((res) => { + // this.CountryData_original = res.data.result; + // this.CountryData_original.forEach((item) => { + // item.value = `${item.cnName}-${item.code}`; + // }); + // this.CountryData = this.CountryData_original; + this.CountryData = res.data.result; + }); + GetCodePortLoad().then((res) => { + this.PortData2 = res.data.result; + res.data.result.forEach((item) => { + this.PortData3.push({ + code: item.value, + value: item.code, + }); + }); + }); + console.log(this.form.houseList[this.ActiveID]); }, mounted() { // this.GetModuleList(); }, methods: { + querySearchCode(queryString, cb) { + var PortData3 = this.PortData3; + var results = queryString + ? PortData3.filter(this.createFilter(queryString)) + : PortData3; + // 调用 callback 返回建议列表的数据 + cb(results); + }, + querySearch(queryString, cb) { + var PortData2 = this.PortData2; + var results = queryString + ? PortData2.filter(this.createFilter(queryString)) + : PortData2; + // 调用 callback 返回建议列表的数据 + cb(results); + }, + createFilter(queryString) { + return (restaurant) => { + return ( + restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === + 0 + ); + }; + }, + SelectHarbour(e, str) { + this.form[str] = e.code; + }, handlerAddTable() { - let index = this.form.houseDto[this.ActiveID].ctnInfo.length - this.form.houseDto[this.ActiveID].ctnInfo.push({ + let index = this.form.houseList[this.ActiveID].cntrList.length; + console.log(index); + this.form.houseList[this.ActiveID].cntrList.push({ enProductName: "", containerNo: "", - containerType: "", + containerTypeCode: "", containerMark: "", sealNo: "", hscode: "", @@ -677,43 +1105,294 @@ export default { unCode: "", dangerGrade: "", rowKey: index, - }) + }); }, handlerDelALL() { - this.form.houseDto[this.ActiveID].ctnInfo = [] - this.selectRows = '' + this.form.houseList[this.ActiveID].cntrList = []; + this.selectRows = ""; }, handlerCopyTable() { - let row = JSON.parse(JSON.stringify(this.selectRows)) - row.rowKey = this.form.houseDto[this.ActiveID].ctnInfo.length - this.form.houseDto[this.ActiveID].ctnInfo.push(row) + let row = JSON.parse(JSON.stringify(this.selectRows)); + row.rowKey = this.form.houseList[this.ActiveID].cntrList.length; + this.form.houseList[this.ActiveID].cntrList.push(row); }, handlerDelTable() { - this.form.houseDto[this.ActiveID].ctnInfo.splice(this.selectRows.rowKey, 1) - this.form.houseDto[this.ActiveID].ctnInfo.forEach((item, index) => { - item.rowKey = index - }) - this.$forceUpdate() + this.form.houseList[this.ActiveID].cntrList.splice( + this.selectRows.rowKey, + 1 + ); + this.form.houseList[this.ActiveID].cntrList.forEach((item, index) => { + console.log(index); + item.rowKey = index; + }); + this.$forceUpdate(); }, handleCopyTZR() { - let form = JSON.parse(JSON.stringify(this.form.houseDto[this.ActiveID])) - this.form.houseDto[this.ActiveID].receiveAddress = form.notifyAddress - this.form.houseDto[this.ActiveID].receiveCountry = form.notifyCountry - this.form.houseDto[this.ActiveID].receiveCity = form.notifyCity - this.form.houseDto[this.ActiveID].receiveName = form.notifyName - this.form.houseDto[this.ActiveID].receiveTel = form.notifyTel - this.form.houseDto[this.ActiveID].receiveContact = form.notifyContact - this.$forceUpdate() + let form = JSON.parse(JSON.stringify(this.form.houseList[this.ActiveID])); + this.form.houseList[this.ActiveID].receiveAddress = form.notifyAddress; + this.form.houseList[this.ActiveID].receiveCountry = form.notifyCountry; + this.form.houseList[this.ActiveID].receiveCity = form.notifyCity; + this.form.houseList[this.ActiveID].receiveName = form.notifyName; + this.form.houseList[this.ActiveID].receiveTel = form.notifyTel; + this.form.houseList[this.ActiveID].receiveContact = form.notifyContact; + this.$forceUpdate(); }, handleCopySHR() { - let form = JSON.parse(JSON.stringify(this.form.houseDto[this.ActiveID])) - this.form.houseDto[this.ActiveID].notifyAddress = form.receiveAddress - this.form.houseDto[this.ActiveID].notifyCountry = form.receiveCountry - this.form.houseDto[this.ActiveID].notifyCity = form.receiveCity - this.form.houseDto[this.ActiveID].notifyName = form.receiveName - this.form.houseDto[this.ActiveID].notifyTel = form.receiveTel - this.form.houseDto[this.ActiveID].notifyContact = form.receiveContact - this.$forceUpdate() + let form = JSON.parse(JSON.stringify(this.form.houseList[this.ActiveID])); + this.form.houseList[this.ActiveID].notifyAddress = form.receiveAddress; + this.form.houseList[this.ActiveID].notifyCountry = form.receiveCountry; + this.form.houseList[this.ActiveID].notifyCity = form.receiveCity; + this.form.houseList[this.ActiveID].notifyName = form.receiveName; + this.form.houseList[this.ActiveID].notifyTel = form.receiveTel; + this.form.houseList[this.ActiveID].notifyContact = form.receiveContact; + this.$forceUpdate(); + }, + FunSave(FunType) { + let type = true; + if (FunType == "Send") { + console.log(this.form.houseList); + this.$refs.form.validate((valid) => {}); + this.$refs.form3.validate((valid) => {}); + // this.$refs.form2.forEach((item, index) => { + // item.validate((valid) => {}); + // }); + this.$refs.form1.validate((valid) => { + if (valid) { + this.$refs.form.validate((valid) => { + if (valid) { + this.$refs.form3.validate((valid) => { + if (valid) { + let Arr = [ + "hblNo", + "shippername", + "shipperaddr", + "consigneeName", + "consigneedaddr", + "notifypartyname", + "notifypartyaddr", + ]; + let target = ""; + this.form.houseList.forEach((item, index) => { + Object.keys(item).forEach((key) => { + Arr.forEach((arr) => { + if (arr == key && !this.form.houseList[index][key]) { + if (target === "") { + target = item.WebHouseDtoId; + } + } + }); + }); + }); + if (target === "") { + console.log("target", target); + // this.$refs.form2.forEach((item, index) => { + // item.validate((valid) => { + // if (valid) { + // let Arr = [ + // "cntrno", + // "sealno", + // "ctnall", + // "productName", + // "marks", + // "pkgs", + // "kindpkgsCode", + // "kgs", + // "cbm", + // ]; + // // "hsCode", + // let target = ""; + // this.form.houseList.forEach((item, index) => { + // item.cntrList.forEach((item2, index2) => { + // Object.keys(item2).forEach((key) => { + // Arr.forEach((arr) => { + // if ( + // arr == key && + // (this.form.houseList[index].cntrList[ + // index2 + // ][key] === "" || + // this.form.houseList[index].cntrList[ + // index2 + // ][key] === null) + // ) { + // if (target === "") { + // console.log(item2, key); + // target = item2.name; + // } + // } + // }); + // }); + // }); + // }); + // if (target !== "") { + // type = false; + // this.ActiveID = + // this.form.houseList[index].WebHouseDtoId; + // this.ActiveTabsID = 0; + // this.editableTabsValue = target; + // } + // } else { + // type = false; + // } + // }); + // }); + } else { + type = false; + this.ActiveID = target; + this.ActiveTabsID = 0; + this.editableTabsValue = `${this.form.houseList[target].WebHouseDtoId}-1`; + } + } else { + type = false; + } + }); + } else { + type = false; + } + }); + } else { + type = false; + } + }); + } else { + let arr = []; + this.form.houseList.forEach((item) => { + arr.push(item.hblNo); + }); + // 保存只验证船东提单号 + if (!this.form.mblno) { + this.$message({ + message: "请填写,船东提单号!", + type: "warning", + showClose: true, + duration: 0, + }); + type = false; + } + // else if (Array.from(new Set(arr)).length < arr.length) { + // this.$message({ + // message: "HBL NO重复,请检查!", + // type: "warning", + // showClose: true, + // duration: 0, + // }); + // type = false; + // } + } + console.log("这里OK!", false); + if (type) { + if (this.form.houseList.length) { + this.form.houseList.forEach((item) => { + if (!item.reportState) { + item.reportState = ""; + } + if (!item.mateState) { + item.mateState = ""; + } + if (!item.newNotice) { + item.newNotice = ""; + } + }); + } + if (this.form.gid == "CopyData") { + delete this.form.gid; + } + let data = { ...this.form }; + if (this.form.loadDate) { + data.loadDate = new Date( + +new Date(data.loadDate) + 8 * 3600 * 1000 + ).toISOString(); + } + + if (this.form.estimatedArrivalTime) { + data.estimatedArrivalTime = new Date( + +new Date(data.estimatedArrivalTime) + 8 * 3600 * 1000 + ).toISOString(); + } + // 盲改的 不知道 对不对 + if (data.gid == "CopyData") { + data.gid = ""; + delete data.gid; + } + data.houseList.forEach((item) => { + item.cntrList.forEach((item2) => { + if (item2.pkgs) { + item2.pkgs = parseFloat(item2.pkgs); + } + if (item2.kgs) { + item2.kgs = parseFloat(item2.kgs); + } + if (item2.cbm) { + item2.cbm = parseFloat(item2.cbm); + } + }); + }); + AddOrUpdate(data).then((res) => { + if (res.data.code == 200) { + this.$refs.form1 ? this.$refs.form1.clearValidate() : ""; + this.$refs.form ? this.$refs.form.clearValidate() : ""; + this.$refs.form3 ? this.$refs.form3.clearValidate() : ""; + // this.$refs.form2 + // ? this.$refs.form2.forEach((item) => { + // item.clearValidate(); + // }) + // : ""; + this.$store.state.editableTabs.forEach((item) => { + if ( + item.name == this.$store.state.editableTabsValue && + !item.data.gid + ) { + item.data = this.form; + } + }); + this.form.gid = res.data.data; + if (FunType != "Send") { + this.$message({ + message: "保存成功", + type: "success", + }); + } + + if (FunType == "Send") { + console.log(this.form); + let ids = res.data.result.gid; + let hids; + + res.data.result.houseList.forEach((item) => { + if (hids) { + hids = `${hids},${item.gid}`; + } else { + hids = item.gid; + } + }); + let ApiData = { ids, sendType: "1", hids }; + Send(ApiData).then((res) => { + if (res.data.code == 200) { + this.$message({ + message: "发送成功", + type: "success", + }); + } else { + this.$message({ + message: res.data.Message + ? res.data.Message + : res.data.message, + type: "warning", + showClose: true, + duration: 0, + }); + } + }); + } + } else { + this.$message({ + message: res.data.Message ? res.data.Message : res.data.message, + type: "warning", + showClose: true, + duration: 0, + }); + } + }); + } }, vesselSelect(item) { this.form.vessel = item.code; @@ -721,6 +1400,9 @@ export default { ChangeCarrier(e) { this.CarrierData.forEach((item) => { if (e == item.code) { + this.form.shipCompanyMapCode = item.mapCode; + this.form.shipCompanyName = item.value; + console.log(item); this.ActiveMapCode = item.mapCode; } }); @@ -730,12 +1412,12 @@ export default { this.ModuleListValue1 = ""; this.ModuleListValue2 = ""; this.ModuleListValue3 = ""; - this.editableTabsValue = `${this.form.houseDto.length}-1`; - this.ActiveID = this.form.houseDto.length; + this.editableTabsValue = `${this.form.houseList.length}-1`; + this.ActiveID = this.form.houseList.length; this.ActiveTabsID = 0; - this.form.houseDto.push({ - WebHouseDtoId: this.form.houseDto.length, - hblNo: "", /// 货代提单号 + this.form.houseList.push({ + WebHouseDtoId: this.form.houseList.length, + houseBillNo: "", /// 货代提单号 shippername: "", /// 发货人名称 shipperaddr: "", /// 发货人地址 shippertel: "", /// 发货人电话 @@ -745,11 +1427,11 @@ export default { notifypartyname: "", /// 通知人名称 (选填) notifypartyaddr: "", ///通知人地址 (选填) notifypartytel: "", /// 通知人电话 (选填) - ctnInfo: [ + cntrList: [ { cntrno: "", /// 箱号 sealno: "", /// 封号 - ctnall: "", /// 箱型 + containerTypeCode: "", /// 箱型 hsCode: "", /// HSCode productName: "", /// 品名 marks: "", /// 唛头 @@ -765,33 +1447,34 @@ export default { linkmanTel: "", /// 危品联系人电话(选填) dangerGrade: "", /// 危品等级(条件必填) WebCntrnoDtoId: 1, - name: `${this.form.houseDto.length}-1`, + name: `${this.form.houseList.length}-1`, }, ], }); }, // 复制提单号 ClickCopyHblNo(index) { - this.ActiveID = this.form.houseDto.length; + this.ActiveID = this.form.houseList.length; this.ActiveTabsID = 0; let data = { - cntrnoDto: [], + cntrList: [], }; - let DelArr = ["gid", "isDel", "pid", "hid", "hblNo"]; - Object.keys(this.form.houseDto[index]).forEach((item) => { - if (item == "cntrnoDto") { - this.form.houseDto[index][item].forEach((item2, index2) => { + let DelArr = ["gid", "isDel", "pid", "hid", "houseBillNo"]; + Object.keys(this.form.houseList[index]).forEach((item) => { + if (item == "cntrList") { + this.form.houseList[index][item].forEach((item2, index2) => { data[item][index2] = { ...item2, - name: `${this.form.houseDto.length}-${index2 + 1}`, + name: `${this.form.houseList.length}-${index2 + 1}`, }; if (index2 == 0) { - this.editableTabsValue = `${this.form.houseDto.length}-${index2 + 1 - }`; + this.editableTabsValue = `${this.form.houseList.length}-${ + index2 + 1 + }`; } }); } else { - data[item] = this.form.houseDto[index][item]; + data[item] = this.form.houseList[index][item]; } DelArr.forEach((Del) => { if (Del == item) { @@ -799,9 +1482,9 @@ export default { } }); }); - this.form.houseDto.push({ ...data }); + this.form.houseList.push({ ...data }); - // this.form.houseDto = [...this.form.houseDto, data]; + // this.form.houseList = [...this.form.houseList, data]; }, // 切换提单号 ClickLeft(index) { @@ -820,7 +1503,7 @@ export default { ActiveNum = index - 1; } this.ClickLeft(ActiveNum); - this.form.houseDto.splice(index, 1); + this.form.houseList.splice(index, 1); }, remoteMethodLoadingVessel(strlink, cb) { let data = strlink == "" ? null : { strlink }; @@ -833,6 +1516,13 @@ export default { cb(results); }); }, + createStateFilter(queryString) { + return (state) => { + return ( + state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0 + ); + }; + }, }, }; diff --git a/src/views/Ams/Index.vue b/src/views/Ams/Index.vue index c1818c0..9db919f 100644 --- a/src/views/Ams/Index.vue +++ b/src/views/Ams/Index.vue @@ -22,7 +22,7 @@ --> + @@ -82,28 +82,37 @@ height="calc(100vh - 230px)" style="width: 100%" @row-dblclick="RowDblclick" - :span-method="objectSpanMethod" :header-cell-style="{ background: 'rgb(160, 207, 255)', color: '#fff' }" + :span-method="objectSpanMethod" > - + + + - - + + + + + - - - - - - + - + + @@ -119,9 +157,9 @@ @@ -130,12 +168,13 @@ + diff --git a/src/views/send/Edit.vue b/src/views/send/Edit.vue index 7aa18aa..a9ceac2 100644 --- a/src/views/send/Edit.vue +++ b/src/views/send/Edit.vue @@ -1,12 +1,36 @@