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: {
......
......@@ -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,59 +89,82 @@ export const columnHeader = (viewRow, editRow, deleteRow) => [
minWidth: 125,
fixed: "right",
render: (h, params) => {
return h("div", [
h(
"el-button",
{
props: {
type: "text",
size: "mini",
icon: "el-icon-view",
},
on: {
click() {
viewRow(params);
let operateData = []
if (params.row.status == "1") {
operateData = [
h(
"el-button",
{
props: {
type: "text",
size: "mini",
icon: "el-icon-view",
},
},
},
"查看"
),
h(
"el-button",
{
props: {
type: "text",
size: "mini",
icon: "el-icon-edit",
},
on: {
click() {
editRow(params);
on: {
click() {
viewRow(params);
},
},
},
},
"修改"
),
h(
"el-button",
{
style: {
color: "#ff4949",
"查看"
),
h(
"el-button",
{
props: {
type: "text",
size: "mini",
icon: "el-icon-edit",
},
on: {
click() {
editRow(params);
},
},
},
props: {
type: "text",
size: "mini",
icon: "el-icon-delete",
"修改"
),
h(
"el-button",
{
style: {
color: "#ff4949",
},
props: {
type: "text",
size: "mini",
icon: "el-icon-delete",
},
on: {
click() {
deleteRow(params);
},
},
},
on: {
click() {
deleteRow(params);
"删除"
),
];
}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"
......