|
@@ -23,7 +23,7 @@
|
|
|
:selectConfig="selectConfig"
|
|
|
:table-events="{
|
|
|
//element talbe事件都能传
|
|
|
- select: select,
|
|
|
+ 'sort-change': sortChange,
|
|
|
}"
|
|
|
:action-list="[]"
|
|
|
@get-list="getList"
|
|
@@ -39,7 +39,7 @@
|
|
|
:selectConfig="selectConfig"
|
|
|
:table-events="{
|
|
|
//element talbe事件都能传
|
|
|
- select: select,
|
|
|
+ 'sort-change': sortChange,
|
|
|
}"
|
|
|
:action-list="[]"
|
|
|
@get-list="getList"
|
|
@@ -93,6 +93,10 @@ const sourceList = ref({
|
|
|
total: 3,
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
+ quantitySort: "",
|
|
|
+ frozenQuantitySort: "",
|
|
|
+ defectiveQuantitySort: "",
|
|
|
+ updateTimeSort: "",
|
|
|
},
|
|
|
});
|
|
|
let dialogVisible = ref(false);
|
|
@@ -213,30 +217,21 @@ const configData = [
|
|
|
attrs: {
|
|
|
label: "可用库存",
|
|
|
prop: "quantity",
|
|
|
- sortable: true,
|
|
|
- "sort-method": (a, b) => {
|
|
|
- return Number(a.quantity) - Number(b.quantity);
|
|
|
- },
|
|
|
+ sortable: "custom",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "冻结库存",
|
|
|
prop: "frozenQuantity",
|
|
|
- sortable: true,
|
|
|
- "sort-method": (a, b) => {
|
|
|
- return Number(a.frozenQuantity) - Number(b.frozenQuantity);
|
|
|
- },
|
|
|
+ sortable: "custom",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "次品库存",
|
|
|
prop: "defectiveQuantity",
|
|
|
- sortable: true,
|
|
|
- "sort-method": (a, b) => {
|
|
|
- return Number(a.defectiveQuantity) - Number(b.defectiveQuantity);
|
|
|
- },
|
|
|
+ sortable: "custom",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -244,12 +239,7 @@ const configData = [
|
|
|
label: "最近入库时间",
|
|
|
prop: "updateTime",
|
|
|
width: 155,
|
|
|
- sortable: true,
|
|
|
- "sort-method": (a, b) => {
|
|
|
- return (
|
|
|
- new Date(a.updateTime).getTime() - new Date(b.updateTime).getTime()
|
|
|
- );
|
|
|
- },
|
|
|
+ sortable: "custom",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -325,30 +315,21 @@ const configData = [
|
|
|
attrs: {
|
|
|
label: "可用库存",
|
|
|
prop: "quantity",
|
|
|
- sortable: true,
|
|
|
- "sort-method": (a, b) => {
|
|
|
- return Number(a.quantity) - Number(b.quantity);
|
|
|
- },
|
|
|
+ sortable: "custom",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "冻结库存",
|
|
|
prop: "frozenQuantity",
|
|
|
- sortable: true,
|
|
|
- "sort-method": (a, b) => {
|
|
|
- return Number(a.frozenQuantity) - Number(b.frozenQuantity);
|
|
|
- },
|
|
|
+ sortable: "custom",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "次品库存",
|
|
|
prop: "defectiveQuantity",
|
|
|
- sortable: true,
|
|
|
- "sort-method": (a, b) => {
|
|
|
- return Number(a.defectiveQuantity) - Number(b.defectiveQuantity);
|
|
|
- },
|
|
|
+ sortable: "custom",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -356,12 +337,7 @@ const configData = [
|
|
|
label: "最近入库时间",
|
|
|
prop: "updateTime",
|
|
|
width: 155,
|
|
|
- sortable: true,
|
|
|
- "sort-method": (a, b) => {
|
|
|
- return (
|
|
|
- new Date(a.updateTime).getTime() - new Date(b.updateTime).getTime()
|
|
|
- );
|
|
|
- },
|
|
|
+ sortable: "custom",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -422,10 +398,7 @@ const configData = [
|
|
|
attrs: {
|
|
|
label: "库存数量",
|
|
|
prop: "quantity",
|
|
|
- sortable: true,
|
|
|
- "sort-method": (a, b) => {
|
|
|
- return Number(a.quantity) - Number(b.quantity);
|
|
|
- },
|
|
|
+ sortable: "custom",
|
|
|
},
|
|
|
},
|
|
|
],
|
|
@@ -519,6 +492,10 @@ config.value = configData[0];
|
|
|
getList();
|
|
|
|
|
|
const handleChange = () => {
|
|
|
+ sourceList.value.pagination.quantitySort = "";
|
|
|
+ sourceList.value.pagination.frozenQuantitySort = "";
|
|
|
+ sourceList.value.pagination.defectiveQuantitySort = "";
|
|
|
+ sourceList.value.pagination.updateTimeSort = "";
|
|
|
sourceList.value.pagination.pageNum = 1;
|
|
|
sourceList.value.data = [];
|
|
|
if (activeName.value === "first") {
|
|
@@ -540,7 +517,37 @@ const handleChange = () => {
|
|
|
}
|
|
|
getList();
|
|
|
};
|
|
|
-
|
|
|
+const sortChange = ({ column, prop, order }) => {
|
|
|
+ sourceList.value.pagination.quantitySort = "";
|
|
|
+ sourceList.value.pagination.frozenQuantitySort = "";
|
|
|
+ sourceList.value.pagination.defectiveQuantitySort = "";
|
|
|
+ sourceList.value.pagination.updateTimeSort = "";
|
|
|
+ let type = "";
|
|
|
+ if (order === "ascending") {
|
|
|
+ // 升序
|
|
|
+ type = "1";
|
|
|
+ } else if (order === "descending") {
|
|
|
+ // 降序
|
|
|
+ type = "0";
|
|
|
+ } else {
|
|
|
+ // 默认
|
|
|
+ }
|
|
|
+ if (column.label === "可用库存" || column.label === "库存数量") {
|
|
|
+ sourceList.value.pagination.quantitySort = type;
|
|
|
+ } else if (column.label === "冻结库存") {
|
|
|
+ sourceList.value.pagination.frozenQuantitySort = type;
|
|
|
+ } else if (column.label === "次品库存") {
|
|
|
+ sourceList.value.pagination.defectiveQuantitySort = type;
|
|
|
+ } else if (column.label === "最近入库时间") {
|
|
|
+ sourceList.value.pagination.updateTimeSort = type;
|
|
|
+ } else {
|
|
|
+ sourceList.value.pagination.quantitySort = "";
|
|
|
+ sourceList.value.pagination.frozenQuantitySort = "";
|
|
|
+ sourceList.value.pagination.defectiveQuantitySort = "";
|
|
|
+ sourceList.value.pagination.updateTimeSort = "";
|
|
|
+ }
|
|
|
+ getList();
|
|
|
+};
|
|
|
const warehouseList = ref([]);
|
|
|
const productUnit = ref([]);
|
|
|
const getDict = () => {
|