|
@@ -15,13 +15,14 @@
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
<div class="bill-main" v-show="isShow==='cwb'" key="item2">
|
|
|
- <module-view :propConfig="config2" ref="moduleView2" @clickHandle="clickHandle2" @detail="openEdit2">
|
|
|
+ <module-view :propConfig="config2" ref="moduleView2" @clickHandle="clickHandle2" @detail="openEdit2"
|
|
|
+ @pagination="getDataList2" @search="getDataList2" @resert="getDataList2" @onRefresh="onRefresh2">
|
|
|
</module-view>
|
|
|
<!-- 新增/编辑弹窗 -->
|
|
|
<el-dialog :title="popTitle+'仓位'" :visible.sync="dialogFormVisible2" width="30%">
|
|
|
<by-form :propConfig="addConfig2" ref="addFormId2">
|
|
|
<template v-slot:organizationName="{value}">
|
|
|
- <el-input placeholder="请选择所属机构名称" v-model="value.organizationName" class="input-organizationName"
|
|
|
+ <el-input placeholder="请选择所属机构名称" size="small" v-model="value.organizationName" class="input-organizationName"
|
|
|
:readonly="true">
|
|
|
<el-button slot="append" icon="el-icon-more" @click="handleSupplier"></el-button>
|
|
|
</el-input>
|
|
@@ -45,6 +46,8 @@
|
|
|
isShow : any = 'ckb'
|
|
|
timeNum = 0;
|
|
|
timer : any = null
|
|
|
+ timeNum2 = 0;
|
|
|
+ timer2 : any = null
|
|
|
popTitle : any = ''
|
|
|
tableData : any = {}
|
|
|
dialogFormVisible : boolean = false
|
|
@@ -57,7 +60,7 @@
|
|
|
columns: [
|
|
|
[{
|
|
|
span: 6,
|
|
|
- label: '名称',
|
|
|
+ label: '仓库名称',
|
|
|
prop: 'name',
|
|
|
component: 'by-input',
|
|
|
labelWidth: '70px',
|
|
@@ -86,8 +89,6 @@
|
|
|
tool: {
|
|
|
tools: {
|
|
|
add: true,
|
|
|
- // export: true,
|
|
|
- delete: true,
|
|
|
search: true,
|
|
|
refresh: true
|
|
|
}
|
|
@@ -231,7 +232,6 @@
|
|
|
tools: {
|
|
|
return: true,
|
|
|
add: true,
|
|
|
- // export: true,
|
|
|
delete: true,
|
|
|
search: true,
|
|
|
refresh: true
|
|
@@ -247,26 +247,37 @@
|
|
|
},
|
|
|
columns: [{
|
|
|
width: 300,
|
|
|
- title: '名称',
|
|
|
+ title: '仓位名称',
|
|
|
field: 'name',
|
|
|
isDetail: true,
|
|
|
- }, {
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 250,
|
|
|
+ title: '仓库名称',
|
|
|
+ field: 'ckName',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 200,
|
|
|
title: '所属机构名称',
|
|
|
field: 'organizationName',
|
|
|
},
|
|
|
{
|
|
|
+ width: 150,
|
|
|
title: '库存',
|
|
|
field: 'stock'
|
|
|
},
|
|
|
{
|
|
|
+ width: 150,
|
|
|
title: '库存体积',
|
|
|
field: 'stockVolume'
|
|
|
},
|
|
|
{
|
|
|
+ width: 150,
|
|
|
title: '库存数量上限',
|
|
|
field: 'maxStockNumber'
|
|
|
},
|
|
|
{
|
|
|
+ width: 150,
|
|
|
title: '库存体积上限',
|
|
|
field: 'maxStockVolume'
|
|
|
}, {
|
|
@@ -285,7 +296,7 @@
|
|
|
}, {
|
|
|
name: '删除',
|
|
|
event: {
|
|
|
- click: (item : any) => (this as any).doDelete2(item, 'maindataStorehouse')
|
|
|
+ click: (item : any) => (this as any).doDelete3(item, 'maindataStoringLocation')
|
|
|
}
|
|
|
}]
|
|
|
}]
|
|
@@ -387,32 +398,11 @@
|
|
|
this.getDataList()
|
|
|
}, 500)
|
|
|
}
|
|
|
- // 打开机构选择
|
|
|
- handleSupplier() {
|
|
|
- (this.$refs.supplierModal as any).setShow(true);
|
|
|
- }
|
|
|
- // 确定机构选择
|
|
|
- confirmSupplier(e : any) {
|
|
|
- if (e.length == 0) return this.$message.warning('请选择供应商!');
|
|
|
- let value : any = (this.$refs.addFormId2 as any).getValue();
|
|
|
- value.organizationName = e[0].name;
|
|
|
- value.organizationId = e[0].id;
|
|
|
- (this.$refs.addFormId2 as any).setValue(value);
|
|
|
- }
|
|
|
- // 查看仓位
|
|
|
- changeTab(item : any) {
|
|
|
- this.tableData = item;
|
|
|
- this.tableData.subList.map((v : any, i : any) => {
|
|
|
- v.dataIndex = i;
|
|
|
- });
|
|
|
- console.log('仓位表数据 ==> ', this.tableData);
|
|
|
- (this.$refs.moduleView2 as any).setTableValue(this.tableData.subList);
|
|
|
- this.isShow = 'cwb';
|
|
|
- }
|
|
|
// 仓库确认新增/编辑
|
|
|
confirm() {
|
|
|
(this as any).$refs.addFormId.validate().then(() => {
|
|
|
let query = (this as any).$refs.addFormId.getValue();
|
|
|
+ console.log(query);
|
|
|
this.dialogFormVisible = false;
|
|
|
if (this.popTitle === '新增') {
|
|
|
api.saveList(query, 'maindataStorehouse').then((res : any) => {
|
|
@@ -435,31 +425,25 @@
|
|
|
confirm2() {
|
|
|
(this as any).$refs.addFormId2.validate().then(() => {
|
|
|
let query = (this as any).$refs.addFormId2.getValue();
|
|
|
- this.tableData.subList = [query];
|
|
|
- let addId = this.tableData.id;
|
|
|
- this.tableData.subList.map((v : any) => {
|
|
|
- v.storehouseId = this.tableData.id;
|
|
|
- v.idDelete = 0;
|
|
|
- })
|
|
|
+ console.log('表单参数 ==> ', query);
|
|
|
+ query.storehouseId = this.tableData.id;
|
|
|
+ query.idDelete = 0;
|
|
|
this.dialogFormVisible2 = false;
|
|
|
if (this.popTitle === '新增') {
|
|
|
- delete this.tableData.id;
|
|
|
- console.log(this.tableData);
|
|
|
- api.saveList(this.tableData, 'maindataStorehouse').then((res : any) => {
|
|
|
+ api.saveList(query, 'maindataStoringLocation').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success(this.popTitle + '成功!');
|
|
|
- this.getOneself(addId);
|
|
|
+ this.getOneself(query.storehouseId);
|
|
|
} else this.$message.error(res.msg)
|
|
|
})
|
|
|
} else if (this.popTitle === '编辑') {
|
|
|
- api.updateList(this.tableData, 'maindataStorehouse').then((res : any) => {
|
|
|
+ api.updateList(query, 'maindataStoringLocation').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success(this.popTitle + '成功!');
|
|
|
- this.getOneself(this.tableData.id);
|
|
|
+ this.getOneself(query.storehouseId);
|
|
|
} else this.$message.error(res.msg)
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
})
|
|
|
}
|
|
|
// 通过id拿到当条数据
|
|
@@ -467,8 +451,8 @@
|
|
|
api.single({ id: e }, 'maindataStorehouse').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
this.tableData = res.data;
|
|
|
- this.tableData.subList.map((v : any, i : any) => {
|
|
|
- v.dataIndex = i
|
|
|
+ this.tableData.subList.map((v:any) => {
|
|
|
+ v.ckName = this.tableData.name;
|
|
|
});
|
|
|
(this.$refs.moduleView2 as any).setTableValue(this.tableData.subList);
|
|
|
}
|
|
@@ -497,16 +481,42 @@
|
|
|
} else this.$message.error(res.msg)
|
|
|
})
|
|
|
}
|
|
|
+ // 获取仓位列表数据
|
|
|
+ getDataList2() {
|
|
|
+ if (!this.$refs.moduleView2) {
|
|
|
+ if (this.timeNum2 > 5) {
|
|
|
+ clearInterval(this.timer2)
|
|
|
+ }
|
|
|
+ this.timeNum2++;
|
|
|
+ return
|
|
|
+ }
|
|
|
+ clearInterval(this.timer2)
|
|
|
+ let query = (this.$refs.moduleView2 as any).getQuery();
|
|
|
+ console.log(query);
|
|
|
+ query.storehouseId = this.tableData.id;
|
|
|
+ api.pageList(query, 'maindataStoringLocation').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ res.data.records.map((v:any) => {
|
|
|
+ v.ckName = this.tableData.name;
|
|
|
+ });
|
|
|
+ (this.$refs.moduleView2 as any).setTableValue(res.data.records);
|
|
|
+ let page = {
|
|
|
+ pageNo: res.data.current, //当前页
|
|
|
+ pageSize: res.data.size, //每页条数
|
|
|
+ total: res.data.total //总条数
|
|
|
+ };
|
|
|
+ (this.$refs.moduleView2 as any).setPage(page)
|
|
|
+ } else this.$message.error(res.msg)
|
|
|
+ })
|
|
|
+ }
|
|
|
// 工具栏方法
|
|
|
clickHandle(e : any) {
|
|
|
if (e === 'onAdd') this.onAdd();
|
|
|
- if (e === 'onDelete') this.onDelete('moduleView', 'maindataStorehouse');
|
|
|
- if (e === 'onExport') this.onExport();
|
|
|
}
|
|
|
// 工具栏方法
|
|
|
clickHandle2(e : any) {
|
|
|
if (e === 'onAdd') this.onAdd2();
|
|
|
- if (e === 'onExport') this.onExport();
|
|
|
+ if (e === 'onDelete') this.onDelete('moduleView2', 'maindataStoringLocation');
|
|
|
if (e === 'onReturn') this.isShow = 'ckb';
|
|
|
}
|
|
|
// 打开新增
|
|
@@ -541,11 +551,59 @@
|
|
|
if ((this as any).$refs.addFormId2) (this as any).$refs.addFormId2.setValue(e);
|
|
|
}, 0)
|
|
|
}
|
|
|
- // 刷新
|
|
|
- onRefresh(){
|
|
|
+ // 打开机构选择
|
|
|
+ handleSupplier() {
|
|
|
+ (this.$refs.supplierModal as any).setShow(true);
|
|
|
+ }
|
|
|
+ // 确定机构选择
|
|
|
+ confirmSupplier(e : any) {
|
|
|
+ if (e.length == 0) return this.$message.warning('请选择供应商!');
|
|
|
+ let value : any = (this.$refs.addFormId2 as any).getValue();
|
|
|
+ value.organizationName = e[0].name;
|
|
|
+ value.organizationId = e[0].id;
|
|
|
+ (this.$refs.addFormId2 as any).setValue(value);
|
|
|
+ }
|
|
|
+ // 查看仓位
|
|
|
+ changeTab(item : any) {
|
|
|
+ this.tableData = item;
|
|
|
+ this.tableData.subList.map((v:any) => {
|
|
|
+ v.ckName = this.tableData.name;
|
|
|
+ })
|
|
|
+ console.log('仓库表数据 ==> ', this.tableData);
|
|
|
+ (this.$refs.moduleView2 as any).setTableValue(this.tableData.subList);
|
|
|
+ this.isShow = 'cwb';
|
|
|
+ }
|
|
|
+ // 刷新仓库
|
|
|
+ onRefresh() {
|
|
|
(this as any).$refs.moduleView.clearSearch();
|
|
|
+ this.getDataList();
|
|
|
+ }
|
|
|
+ // 刷新仓位
|
|
|
+ onRefresh2() {
|
|
|
+ (this as any).$refs.moduleView2.clearSearch();
|
|
|
+ this.getDataList2();
|
|
|
+ }
|
|
|
+ // 仓库操作删除
|
|
|
+ doDelete2(item : any, url : any) {
|
|
|
+ this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true
|
|
|
+ }).then(() => {
|
|
|
+ if (item.subList.length > 0) {
|
|
|
+ this.$message.warning('此仓库下有仓位,不可删除!');
|
|
|
+ } else {
|
|
|
+ api.deleteList({ ids: item.id }, url).then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.getDataList();
|
|
|
+ this.$message.success('删除成功');
|
|
|
+ } else this.$message.error(res.msg)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
- // 工具栏删除
|
|
|
+ // 仓位工具栏删除
|
|
|
onDelete(moduleView : any, url : any) {
|
|
|
let selectData = (this.$refs[moduleView] as any).getSelectData()
|
|
|
let ids = '';
|
|
@@ -563,31 +621,27 @@
|
|
|
}).then(() => {
|
|
|
api.deleteList({ ids: ids }, url).then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
- this.getDataList();
|
|
|
+ this.getDataList2();
|
|
|
this.$message.success('删除成功');
|
|
|
} else this.$message.error(res.msg)
|
|
|
})
|
|
|
}).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
- // 操作删除
|
|
|
- doDelete2(item : any, url : any) {
|
|
|
+ // 仓位操作删除
|
|
|
+ doDelete3(item : any, url : any) {
|
|
|
+ console.log('仓位操作删除:',item,url);
|
|
|
this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning',
|
|
|
center: true
|
|
|
}).then(() => {
|
|
|
- console.log(item);
|
|
|
- if (item.subList) {
|
|
|
- api.deleteList({ ids: item.id }, url).then((res : any) => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.getDataList();
|
|
|
- this.$message.success('删除成功');
|
|
|
- } else this.$message.error(res.msg)
|
|
|
- })
|
|
|
- } else {
|
|
|
-
|
|
|
- }
|
|
|
+ api.deleteList({ ids: item.id }, url).then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.getDataList2();
|
|
|
+ this.$message.success('删除成功');
|
|
|
+ } else this.$message.error(res.msg)
|
|
|
+ })
|
|
|
}).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
//导出
|