Elements-SY

modify

import request from "@/utils/request";
// HScode黑名单/英文品名删除
export function delBlackList(data) {
return request({
url: "/etes/delBlackList",
method: "post",
data: data,
});
}
......@@ -393,6 +393,13 @@ export function isNumberStr(str) {
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str);
}
// Array JsonValue 排序
export function sortList(arr, key) {
return arr.sort((a, b) => {
return a[key].localeCompare(b[key]);
});
}
// 获取计算元素的属性的margin + padding + clientHeight
function getPropertyValue(el) {
let style, marginTop, marginBottom, paddingTop, paddingBottom;
......@@ -417,12 +424,21 @@ export function restTableHeight($refs) {
if (key == "ylTable") {
$refs[key].$children.map((item) => {
if (item.$el.id == "group-btn") {
console.log("group-btn:", getPropertyValue(item.$el));
// table表格组合按钮
heigth += getPropertyValue(item.$el);
heigth += item.$el.clientHeight;
} else if (item.$el.className == "el-pagination is-background") {
// table表格组合分页
if (item.$el.offsetParent.className == "pagination-container") {
console.log(
"pagination:",
getPropertyValue(item.$el.offsetParent)
);
console.log(
"paginationClientHeight:",
getPropertyValue(item.$el.offsetParent.clientHeight)
);
heigth += getPropertyValue(item.$el.offsetParent);
heigth += item.$el.offsetParent.clientHeight;
}
......@@ -431,13 +447,23 @@ export function restTableHeight($refs) {
} else {
if ($refs[key].hasOwnProperty("$el")) {
heigth += $refs[key].$el.clientHeight;
heigth += getPropertyValue($refs[key].$el);
console.log(
"ruleForm:",
$refs[key].$el.clientHeight,
getPropertyValue($refs[key].$el)
);
} else {
console.log("ruleForm:", $refs[key]);
heigth += $refs[key].$el.clientHeight;
heigth += getPropertyValue($refs[key]);
}
}
} else if (key == "formHeaderRef") {
console.log("formHeaderRef:", getPropertyValue($refs[key]));
heigth += getPropertyValue($refs[key]);
}
});
console.log("heigth:", heigth);
return heigth;
}
......
export const formConfig = [
{
label: "商品名",
label: "HSCODE",
type: "Input",
name: "searchValue",
prop: "searchValue",
......
......@@ -13,6 +13,7 @@
</el-col>
</el-row>
<yl-table
ref="ylTable"
:attrs="tableAttr"
:loadingTable="tableAttr.loadingTable"
:columns="columns"
......@@ -89,10 +90,10 @@ import { formConfig } from "./formConfig";
import { tableAttr, columnHeader } from "./tableConfig";
import { restTableHeight } from "@/utils";
import {
findHsCodeList, // HScode黑名单查询
delBlackList, // HScode黑名单删除
downLoadTemplate, // HScode黑名单下载模板
uploadHsCode, // HScode黑名单导入
findHsCodeList, // ShipmentDesc查询
delBlackList, // ShipmentDesc删除
downLoadTemplate, // ShipmentDesc下载模板
uploadHsCode, // ShipmentDesc导入
} from "@/api/et86HsCodeBlack";
import { downLoadXlsx } from "@/utils/zipdownload";
export default {
......@@ -140,15 +141,8 @@ export default {
},
mounted() {
this.$nextTick(() => {
let app = document.querySelector(".app-main");
if (this.$store.getters.appMainBlockClientHeight) {
this.tableAttr.maxHeight =
this.$store.getters.appMainBlockClientHeight -
restTableHeight(this.$refs);
} else {
this.tableAttr.maxHeight =
app.clientHeight - restTableHeight(this.$refs);
}
console.log(this.$refs)
this.tableAttr.maxHeight = window.innerHeight - restTableHeight(this.$refs);
});
},
methods: {
......
......@@ -10,7 +10,13 @@
<el-col :span="18">
<el-row style="margin-bottom: 15px" v-if="getRouter">
<el-col>
<el-button type="primary" icon="el-icon-plus" size="mini" @click="addBtn">添加</el-button>
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="addBtn"
>添加</el-button
>
</el-col>
</el-row>
<yl-table
......@@ -235,7 +241,10 @@
<el-col :span="24">
<el-col :span="3">
<el-form-item label="单品名">
<el-checkbox v-model="queryForm.multiHs" :disabled="!getRouter"></el-checkbox>
<el-checkbox
v-model="queryForm.multiHs"
:disabled="!getRouter"
></el-checkbox>
</el-form-item>
</el-col>
<el-col :span="8">
......@@ -440,7 +449,8 @@ export default {
this.getAllDictData(); // 获取全部字典
if (this.$route.query.name == "view" || this.$route.query.name == "edit") {
this.queryFindEtesRuleById(this.$route.query); // ET86详情
} else { // 新增时默认一条数据
} else {
// 新增时默认一条数据
this.tableData = [
{
id: this.id,
......@@ -461,7 +471,8 @@ export default {
"input-filter": {
bind: function (el, binding) {
el.handler = function (event) {
if (event.data == "E" || event.data == "e") { // 无理数时
if (event.data == "E" || event.data == "e") {
// 无理数时
event.target.value = "";
}
if (event.target.value) {
......@@ -469,7 +480,8 @@ export default {
event.target.value = "";
} else if (Number(event.target.value) > 7) {
event.target.value = "";
} else if (/[\.]/.test(Number(event.target.value))) { // 浮点数时
} else if (/[\.]/.test(Number(event.target.value))) {
// 浮点数时
event.target.value = "";
} else {
}
......@@ -487,7 +499,8 @@ export default {
methods: {
// ET86新增
postAdd(params) {
add(params).then((res) => {
add(params)
.then((res) => {
const { code, msg } = res;
if (code == 200) {
this.msgSuccess(msg || "创建成功!");
......@@ -495,18 +508,20 @@ export default {
} else {
this.msgError(msg || "创建失败!");
}
}).catch(() => {});
})
.catch(() => {});
},
// ET86详情
queryFindEtesRuleById({ id, status, name }) {
findEtesRuleById({ id: id, status: status }).then((res) => {
findEtesRuleById({ id: id, status: status })
.then((res) => {
const { code, data, msg } = res;
if (code == 200) {
data.list.flightRankDtoList.map((item) => {
if(name == "view"){
item.edit = true
}else{
item.edit = false
if (name == "view") {
item.edit = true;
} else {
item.edit = false;
}
// 爆仓是否继续配舱
if (item.permitOverweight == "N") {
......@@ -515,7 +530,11 @@ export default {
item.permitOverweight = true;
}
});
this.tableData = data.list.flightRankDtoList; // ET86配舱航班顺位
data.list.flightRankDtoList.map((item) => {
item.calculateDay = Number(item.calculateDay);
});
// ET86配舱航班顺位
this.tableData = data.list.flightRankDtoList;
Object.keys(data.list.fltRuleDto).map((key) => {
if (key == "multiHs") {
if (data.list.fltRuleDto[key] == "N") {
......@@ -533,11 +552,13 @@ export default {
} else {
this.msgError(msg || "获取查看失败");
}
}).catch(() => {});
})
.catch(() => {});
},
// ET86编辑
postUpdate(parmas) {
update(parmas).then((res) => {
update(parmas)
.then((res) => {
const { code, msg } = res;
if (code == 200) {
this.msgSuccess(msg || "修改成功!");
......@@ -545,11 +566,13 @@ export default {
} else {
this.msgError(msg || "修改失败!");
}
}).catch(() => {});
})
.catch(() => {});
},
// 获取所有数据字典
getAllDictData() {
allDictData().then((res) => {
allDictData()
.then((res) => {
if (res.code != 200) {
this.msgError(res.msg);
return;
......@@ -558,13 +581,15 @@ export default {
if (res.data.serviceCode.length) {
this.getObj(res.data);
}
}).catch(() => {});
})
.catch(() => {});
},
// 航线查询
getQueryRouteByFltNo(item) {
this.tableAttr.loadingTable = true;
this.tableData[this.currentIndex].flightRoute;
queryRouteByFltNo(item).then((res) => {
queryRouteByFltNo(item)
.then((res) => {
this.tableAttr.loadingTable = false;
if (res.code == 200) {
const list = res.data.list;
......@@ -585,7 +610,8 @@ export default {
this.tableData[this.currentIndex].flightRoute = "";
}
}
}).catch(() => {});
})
.catch(() => {});
},
// 航班号input 聚焦事件
inputFocus({ $index }) {
......@@ -593,11 +619,18 @@ export default {
},
// 失焦查询
blurSearch() {
this.tableData[this.currentIndex].flightNo = this.upCase(this.tableData[this.currentIndex].flightNo); // 转大写字母
this.tableData[this.currentIndex].flightNo = this.upCase(
this.tableData[this.currentIndex].flightNo
); // 转大写字母
let params = {
fltNo: this.tableData[this.currentIndex].flightNo,
};
let repeat = this.tableData.filter((item) => item.flightNo == this.tableData[this.currentIndex].flightNo); // 筛选重复的航班
let repeat = this.tableData.filter(
(item) =>
item.flightNo == this.tableData[this.currentIndex].flightNo &&
item.calculateDay == this.tableData[this.currentIndex].calculateDay &&
item.flightRoute == this.tableData[this.currentIndex].flightRoute
); // 筛选重复的航班
if (repeat.length > 1) {
this.msgError("航班顺位已重复");
return;
......@@ -638,13 +671,17 @@ export default {
},
// 类别
changeCheckboxCargoType(arr) {
let include = this.cargoType.filter((item) =>arr.some((val) => val == item.chineseName)); // 查询已被勾选的类别
let include = this.cargoType.filter((item) =>
arr.some((val) => val == item.chineseName)
); // 查询已被勾选的类别
this.checkboxCargoType = include; //已勾选申报类别的数据
this.queryForm.declarationCategory = arr.join(";");
},
// 失焦事件
blurEvent() {
this.queryForm.originOfFlightNo = this.upCase(this.queryForm.originOfFlightNo);
this.queryForm.originOfFlightNo = this.upCase(
this.queryForm.originOfFlightNo
);
},
// 表单提交
submitForm(formName) {
......@@ -661,11 +698,17 @@ export default {
}
});
// 校验ET86配舱航班顺位维度
if (this.minCNYCustomVal.length != "" || this.maxCNYCustomVal.length != "") {
if (
this.minCNYCustomVal.length != "" ||
this.maxCNYCustomVal.length != ""
) {
this.queryForm.currencyCd = "CNY";
this.queryForm.minCustomVal = this.minCNYCustomVal;
this.queryForm.maxCustomVal = this.maxCNYCustomVal;
} else if (this.minSUDCustomVal.length != "" || this.maxSUDCustomVal.length != "") {
} else if (
this.minSUDCustomVal.length != "" ||
this.maxSUDCustomVal.length != ""
) {
this.queryForm.currencyCd = "USD";
this.queryForm.minCustomVal = this.minSUDCustomVal;
this.queryForm.maxCustomVal = this.maxSUDCustomVal;
......@@ -673,7 +716,9 @@ export default {
this.queryForm.currencyCd = "CNY";
}
let fltNo = this.tableData.some((item) => item.flightNo == ""); // 通过遍历判断航班顺位列表有没有填写的航班号
let fltNoRoute = this.tableData.some((item) => item.flightRoute == ""); // 通过遍历判断航班顺位列表有没有填写的航线
let fltNoRoute = this.tableData.some(
(item) => item.flightRoute == ""
); // 通过遍历判断航班顺位列表有没有填写的航线
if (fltNo) {
this.msgError("航班号不可为空");
return;
......@@ -686,8 +731,14 @@ export default {
this.msgError("原航班号不可为空");
return;
}
this.queryForm.includeServiceType = this.isServiceCode == "1" && this.serviceCode.length > 0 ? this.serviceCode : ""; // 包含服务种类
this.queryForm.notIncludeServiceType = this.isServiceCode == "2" && this.serviceCode.length > 0 ? this.serviceCode : ""; // 不包含服务种类
this.queryForm.includeServiceType =
this.isServiceCode == "1" && this.serviceCode.length > 0
? this.serviceCode
: ""; // 包含服务种类
this.queryForm.notIncludeServiceType =
this.isServiceCode == "2" && this.serviceCode.length > 0
? this.serviceCode
: ""; // 不包含服务种类
let parmas = {
flightRankDtoList: tableData, // ET86配舱航班顺位
fltRuleDto: this.queryForm,
......
......@@ -32,7 +32,7 @@ import YlForm from "@/components/YlForm";
import YlTable from "@/components/YlTable";
import { formConfig } from "./formConfig";
import { tableAttr, columnHeader } from "./tableConfig";
import { restTableHeight } from "@/utils";
import { restTableHeight, sortList } from "@/utils";
import {
findAllEtesRules, // ET86查询
deleteEtesRuleById, // 删除
......@@ -71,16 +71,9 @@ export default {
},
mounted() {
this.$nextTick(() => {
let app = document.querySelector(".app-main");
if (this.$store.getters.appMainBlockClientHeight) {
this.tableAttr.maxHeight =
this.$store.getters.appMainBlockClientHeight -
restTableHeight(this.$refs);
} else {
this.tableAttr.maxHeight =
app.clientHeight - restTableHeight(this.$refs);
}
console.log(this.tableAttr.maxHeight);
console.log(window.innerHeight);
console.log(restTableHeight(this.$refs));
// this.tableAttr.maxHeight = window.innerHeight - restTableHeight(this.$refs);
});
},
methods: {
......@@ -92,7 +85,13 @@ export default {
this.tableAttr.loadingTable = false;
const { code, data } = res;
if (code == 200) {
this.tableData = data.list;
const valid = data.list.filter((item) => item.status == "1"); // 有效
const invalid = data.list.filter((item) => item.status == "0"); // 无效
valid.reverse(); // 有效航班修改时间排序
invalid.reverse(); //
const newValid = sortList(valid, "originOfFlightNo"); // 有效原航班按字母排序
const newInvalid = sortList(invalid, "originOfFlightNo");
this.tableData = newValid.concat(newInvalid);
this.pageConfig.total = data.total;
}
})
......
......@@ -7,6 +7,7 @@ export const tableAttr = {
loadingTable: false,
isDragSort: false, // 拖拽tableData数据一定要加id字段
maxHeight: 0,
// defaultSort: { prop: "updateTime", order: "descending" },
btnCofig: {
isBtn: true,
btnGroup: [
......@@ -72,7 +73,8 @@ export const columnHeader = (viewRow, editRow, deleteRow) => [
prop: "updateTime",
align: "center",
minWidth: 120,
// "sort-method": (a, b) => b.createTime - a.createTime,
// sortable: true,
// "sort-method": (a, b) => a.createTime - b.createTime,
},
{
label: "修改人",
......@@ -87,7 +89,9 @@ export const columnHeader = (viewRow, editRow, deleteRow) => [
minWidth: 125,
fixed: "right",
render: (h, params) => {
return h("div", [
let operateData = []
if (params.row.status == "1") {
operateData = [
h(
"el-button",
{
......@@ -139,7 +143,28 @@ export const columnHeader = (viewRow, editRow, deleteRow) => [
},
"删除"
),
]);
];
}else{
operateData = [
h(
"el-button",
{
props: {
type: "text",
size: "mini",
icon: "el-icon-view",
},
on: {
click() {
viewRow(params);
},
},
},
"查看"
),
];
}
return h("div", operateData);
},
},
];
......
......@@ -13,6 +13,7 @@
</el-col>
</el-row>
<yl-table
ref="ylTable"
:attrs="tableAttr"
:loadingTable="tableAttr.loadingTable"
:columns="columns"
......