|
|
@@ -47,6 +47,9 @@
|
|
|
class="dict-table"
|
|
|
@cell-click="cellClick"
|
|
|
:selection.sync="selection"
|
|
|
+ @columns-change="handleColumnChange"
|
|
|
+ @header-dragend="handleHeaderDragend"
|
|
|
+ :cache-key="cacheKeyUrl"
|
|
|
>
|
|
|
<template v-slot:action="{ row }">
|
|
|
<el-radio class="radio" v-model="radio" :label="row.categoryCode"
|
|
|
@@ -69,9 +72,11 @@
|
|
|
import { getOutindetailtwoList, getTreeByGroup } from '@/api/wms';
|
|
|
import ItemSearch from './item-search.vue';
|
|
|
import { contactQueryByCategoryIdsAPI } from '@/api/saleManage/contact';
|
|
|
+ import tabMixins from '@/mixins/tableColumnsMixin';
|
|
|
|
|
|
export default {
|
|
|
components: { ItemSearch },
|
|
|
+ mixins: [tabMixins],
|
|
|
props: {
|
|
|
/*已选择的产品*/
|
|
|
data: {
|
|
|
@@ -99,12 +104,24 @@
|
|
|
label: 'name'
|
|
|
},
|
|
|
treeList: [],
|
|
|
- treeLoading: false
|
|
|
+ treeLoading: false,
|
|
|
+ cacheKeyUrl: 'select-stock-ledger-dialog-table',
|
|
|
+ widthsVersion: 0
|
|
|
};
|
|
|
},
|
|
|
watch: {},
|
|
|
computed: {
|
|
|
columns() {
|
|
|
+ // 强制重新计算(打开弹窗时重新读取缓存宽度)
|
|
|
+ this.widthsVersion;
|
|
|
+ const cacheWidths = this.getStorage(this.cacheKeyUrl + 'Widths') || {};
|
|
|
+ const applyWidth = (col) => {
|
|
|
+ if (col.prop && cacheWidths[col.prop]) {
|
|
|
+ return { ...col, width: cacheWidths[col.prop], minWidth: undefined };
|
|
|
+ }
|
|
|
+ return col;
|
|
|
+ };
|
|
|
+
|
|
|
let data = null;
|
|
|
if (this.currentIndex != -1) {
|
|
|
data = {
|
|
|
@@ -126,82 +143,82 @@
|
|
|
};
|
|
|
}
|
|
|
return [
|
|
|
- data,
|
|
|
+ applyWidth(data),
|
|
|
|
|
|
- {
|
|
|
+ applyWidth({
|
|
|
columnKey: 'index',
|
|
|
type: 'index',
|
|
|
width: 50,
|
|
|
align: 'center',
|
|
|
showOverflowTooltip: true,
|
|
|
label: '序号'
|
|
|
- },
|
|
|
- {
|
|
|
+ }),
|
|
|
+ applyWidth({
|
|
|
prop: 'categoryCode',
|
|
|
label: '编码',
|
|
|
align: 'center',
|
|
|
showOverflowTooltip: true,
|
|
|
minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
+ }),
|
|
|
+ applyWidth({
|
|
|
prop: 'categoryName',
|
|
|
label: '名称',
|
|
|
align: 'center',
|
|
|
showOverflowTooltip: true,
|
|
|
minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
+ }),
|
|
|
+ applyWidth({
|
|
|
prop: 'brandNum',
|
|
|
align: 'center',
|
|
|
label: '牌号',
|
|
|
showOverflowTooltip: true
|
|
|
- },
|
|
|
- {
|
|
|
+ }),
|
|
|
+ applyWidth({
|
|
|
prop: 'categoryModel',
|
|
|
label: '型号',
|
|
|
align: 'center',
|
|
|
showOverflowTooltip: true
|
|
|
- },
|
|
|
- {
|
|
|
+ }),
|
|
|
+ applyWidth({
|
|
|
prop: 'specification',
|
|
|
label: '规格',
|
|
|
align: 'center',
|
|
|
showOverflowTooltip: true
|
|
|
- },
|
|
|
- {
|
|
|
+ }),
|
|
|
+ applyWidth({
|
|
|
prop: 'measureQuantity',
|
|
|
label: '库存',
|
|
|
showOverflowTooltip: true,
|
|
|
align: 'center',
|
|
|
minWidth: 90
|
|
|
- },
|
|
|
- {
|
|
|
+ }),
|
|
|
+ applyWidth({
|
|
|
prop: 'measureUnit',
|
|
|
label: '单位',
|
|
|
showOverflowTooltip: true,
|
|
|
align: 'center',
|
|
|
minWidth: 90
|
|
|
- },
|
|
|
- {
|
|
|
+ }),
|
|
|
+ applyWidth({
|
|
|
prop: 'weight',
|
|
|
label: '重量',
|
|
|
showOverflowTooltip: true,
|
|
|
align: 'center',
|
|
|
minWidth: 90
|
|
|
- },
|
|
|
- {
|
|
|
+ }),
|
|
|
+ applyWidth({
|
|
|
prop: 'weightUnit',
|
|
|
label: '重量单位',
|
|
|
showOverflowTooltip: true,
|
|
|
align: 'center',
|
|
|
minWidth: 90
|
|
|
- },
|
|
|
- {
|
|
|
+ }),
|
|
|
+ applyWidth({
|
|
|
prop: 'packingUnit',
|
|
|
align: 'center',
|
|
|
label: '包装单位',
|
|
|
showOverflowTooltip: true
|
|
|
- }
|
|
|
+ })
|
|
|
];
|
|
|
}
|
|
|
},
|
|
|
@@ -211,6 +228,7 @@
|
|
|
return this.dictList[code].find((item) => item.value == val)?.label;
|
|
|
},
|
|
|
open(item, currentIndex) {
|
|
|
+ this.widthsVersion++;
|
|
|
this.currentIndex = currentIndex;
|
|
|
this.visible = true;
|
|
|
this.getTreeData();
|
|
|
@@ -277,6 +295,13 @@
|
|
|
this.current = row;
|
|
|
this.radio = row.id;
|
|
|
},
|
|
|
+ // 列头拖拽结束 - 保存列宽到本地缓存
|
|
|
+ handleHeaderDragend(newWidth, oldWidth, column) {
|
|
|
+ if (!column.property) return;
|
|
|
+ const widths = this.getStorage(this.cacheKeyUrl + 'Widths') || {};
|
|
|
+ widths[column.property] = newWidth;
|
|
|
+ this.setStorage(this.cacheKeyUrl + 'Widths', widths);
|
|
|
+ },
|
|
|
handleClose() {
|
|
|
this.visible = false;
|
|
|
this.current = null;
|