|
@@ -13,6 +13,8 @@
|
|
|
@Component
|
|
|
export default class Store extends Vue {
|
|
|
timeNum = 0;
|
|
|
+ skuInfo : any = ''
|
|
|
+ storeHouseInfo : any = ''
|
|
|
timer : any = null
|
|
|
config : any = {
|
|
|
attr: {
|
|
@@ -70,75 +72,15 @@
|
|
|
title: '物料编码',
|
|
|
field: 'skuCode',
|
|
|
},
|
|
|
- {
|
|
|
- width: '140px',
|
|
|
- title: '',
|
|
|
- field: 'financialCode2',
|
|
|
- },
|
|
|
- {
|
|
|
- width: '140px',
|
|
|
- title: '',
|
|
|
- field: 'financialCode3',
|
|
|
- },
|
|
|
- {
|
|
|
- width: '140px',
|
|
|
- title: '',
|
|
|
- field: 'financialCode4',
|
|
|
- },
|
|
|
- {
|
|
|
- width: '140px',
|
|
|
- title: '',
|
|
|
- field: 'financialCode5',
|
|
|
- },
|
|
|
- {
|
|
|
- width: '140px',
|
|
|
- title: '',
|
|
|
- field: 'financialCode6',
|
|
|
- },
|
|
|
- {
|
|
|
- width: '140px',
|
|
|
- title: '',
|
|
|
- field: 'financialCode7',
|
|
|
- },
|
|
|
- {
|
|
|
- width: 120,
|
|
|
- title: '操作',
|
|
|
- action: true,
|
|
|
- plugins: [{
|
|
|
- name: '短驳',
|
|
|
- event: {
|
|
|
- click: (item : any) => {
|
|
|
- (this as any).shortBarge(item)
|
|
|
- }
|
|
|
- }
|
|
|
- }, {
|
|
|
- name: '调拨',
|
|
|
- event: {
|
|
|
- click: (item : any) => (this as any).allocate(item)
|
|
|
- }
|
|
|
- }]
|
|
|
- }]
|
|
|
+
|
|
|
+ ]
|
|
|
},
|
|
|
}
|
|
|
mounted() {
|
|
|
this.timer = setInterval(() => {
|
|
|
- this.getMaindataStorehouse()
|
|
|
this.getDataList()
|
|
|
}, 300)
|
|
|
}
|
|
|
- // 获取仓库信息
|
|
|
- getMaindataStorehouse(){
|
|
|
- let moduleConfig = (this as any).$lodash.cloneDeep(this.config.table);
|
|
|
- moduleConfig.columns.push({
|
|
|
- width: '140px',
|
|
|
- title: '财务编号2',
|
|
|
- field: 'financialCode2',
|
|
|
- })
|
|
|
- console.log(moduleConfig);
|
|
|
- api.pageList({}, 'maindataStorehouse').then(res => {
|
|
|
- console.log(res);
|
|
|
- })
|
|
|
- }
|
|
|
// 获取列表数据
|
|
|
getDataList() {
|
|
|
if (!this.$refs.moduleView) {
|
|
@@ -149,23 +91,78 @@
|
|
|
return
|
|
|
}
|
|
|
clearInterval(this.timer)
|
|
|
- let query = (this.$refs.moduleView as any).getQuery();
|
|
|
- this.getPageList(query);
|
|
|
+ this.getPageList();
|
|
|
}
|
|
|
- getPageList(query : any) {
|
|
|
+ getPageList() {
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
|
- api.pageList(query, 'maindataMaterialSku').then((res : any) => {
|
|
|
- loading.close();
|
|
|
+ api.getMaterialInventory().then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
- (this.$refs.moduleView as any).setTableValue(res.data.records);
|
|
|
- let page = {
|
|
|
- pageNo: res.data.current, //当前页
|
|
|
- pageSize: res.data.size, //每页条数
|
|
|
- total: res.data.total //总条数
|
|
|
- };
|
|
|
- (this.$refs.moduleView as any).setPage(page);
|
|
|
- } else this.$message.error(res.msg);
|
|
|
+ this.skuInfo = res.data;
|
|
|
+ }else loading.close();
|
|
|
+ }).then(() => {
|
|
|
+ api.pageList({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 9999,
|
|
|
+ }, 'maindataStorehouse').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.storeHouseInfo = res.data.records;
|
|
|
+ }else loading.close();
|
|
|
+ if (res.code === 200) {
|
|
|
+ let moduleConfig = (this as any).$lodash.cloneDeep(this.config.table);
|
|
|
+ this.storeHouseInfo = res.data.records;
|
|
|
+ res.data.records.map((v : any, i : any) => {
|
|
|
+ moduleConfig.columns.push({
|
|
|
+ width: '140px',
|
|
|
+ title: v.name,
|
|
|
+ field: 'custom' + i,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ moduleConfig.columns.push({
|
|
|
+ width: 120,
|
|
|
+ title: '操作',
|
|
|
+ action: true,
|
|
|
+ plugins: [{
|
|
|
+ name: '短驳',
|
|
|
+ event: {
|
|
|
+ click: (item : any) => {
|
|
|
+ (this as any).shortBarge(item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ name: '调拨',
|
|
|
+ event: {
|
|
|
+ click: (item : any) => (this as any).allocate(item)
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ });
|
|
|
+ (this as any).$refs.moduleView.setTableConfig(moduleConfig);
|
|
|
+ }
|
|
|
+ }).then(() => {
|
|
|
+ api.pageList({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 9999
|
|
|
+ }, 'maindataMaterialSku').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ for (let i = 0; i < res.data.records.length; i++) {
|
|
|
+ for (let j = 0; j < this.storeHouseInfo.length; j++) {
|
|
|
+ let nowData = this.skuInfo.filter((v : any) => v.skuId == res.data.records[i].id && v.storeHouseId == this.storeHouseInfo[j].id);
|
|
|
+ if (nowData[0]) res.data.records[i]['custom' + j] = nowData[0].inventory;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ (this.$refs.moduleView as any).setTableValue(res.data.records);
|
|
|
+ loading.close();
|
|
|
+ // let page = {
|
|
|
+ // pageNo: res.data.current, //当前页
|
|
|
+ // pageSize: res.data.size, //每页条数
|
|
|
+ // total: res.data.total //总条数
|
|
|
+ // };
|
|
|
+ // (this.$refs.moduleView as any).setPage(page);
|
|
|
+ } else loading.close();
|
|
|
+ }).catch(() => loading.close());
|
|
|
+ }).catch(() => loading.close());
|
|
|
}).catch(() => loading.close());
|
|
|
+
|
|
|
}
|
|
|
// 短驳
|
|
|
shortBarge(e : any) {
|