|
@@ -3,7 +3,7 @@
|
|
<transition-group name="fade" style="position: relative;width: 100%;display: flex;">
|
|
<transition-group name="fade" style="position: relative;width: 100%;display: flex;">
|
|
<div class="bill-main" v-show="isShow==='ckb'" key="item">
|
|
<div class="bill-main" v-show="isShow==='ckb'" key="item">
|
|
<module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
|
|
<module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
|
|
- @resert="getDataList" @clickHandle="clickHandle" @detail="openEdit">
|
|
|
|
|
|
+ @resert="getDataList" @clickHandle="clickHandle" @detail="openEdit" @onRefresh="onRefresh">
|
|
</module-view>
|
|
</module-view>
|
|
<!-- 新增/编辑弹窗 -->
|
|
<!-- 新增/编辑弹窗 -->
|
|
<el-dialog :title="popTitle+'仓库'" :visible.sync="dialogFormVisible" width="30%">
|
|
<el-dialog :title="popTitle+'仓库'" :visible.sync="dialogFormVisible" width="30%">
|
|
@@ -19,7 +19,14 @@
|
|
</module-view>
|
|
</module-view>
|
|
<!-- 新增/编辑弹窗 -->
|
|
<!-- 新增/编辑弹窗 -->
|
|
<el-dialog :title="popTitle+'仓位'" :visible.sync="dialogFormVisible2" width="30%">
|
|
<el-dialog :title="popTitle+'仓位'" :visible.sync="dialogFormVisible2" width="30%">
|
|
- <by-form :propConfig="addConfig2" ref="addFormId2"></by-form>
|
|
|
|
|
|
+ <by-form :propConfig="addConfig2" ref="addFormId2">
|
|
|
|
+ <template v-slot:organizationName="{value}">
|
|
|
|
+ <el-input placeholder="请选择所属机构名称" v-model="value.organizationName" class="input-organizationName"
|
|
|
|
+ :readonly="true">
|
|
|
|
+ <el-button slot="append" icon="el-icon-more" @click="handleSupplier"></el-button>
|
|
|
|
+ </el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </by-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click="dialogFormVisible2 = false">取 消</el-button>
|
|
<el-button @click="dialogFormVisible2 = false">取 消</el-button>
|
|
<el-button type="primary" @click="confirm2">确 定</el-button>
|
|
<el-button type="primary" @click="confirm2">确 定</el-button>
|
|
@@ -27,6 +34,7 @@
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
</transition-group>
|
|
</transition-group>
|
|
|
|
+ <supplier-modal ref="supplierModal" @confirm="confirmSupplier" :zIndex="9999" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
@@ -38,7 +46,7 @@
|
|
timeNum = 0;
|
|
timeNum = 0;
|
|
timer : any = null
|
|
timer : any = null
|
|
popTitle : any = ''
|
|
popTitle : any = ''
|
|
- tableData : any = ''
|
|
|
|
|
|
+ tableData : any = {}
|
|
dialogFormVisible : boolean = false
|
|
dialogFormVisible : boolean = false
|
|
dialogFormVisible2 : boolean = false
|
|
dialogFormVisible2 : boolean = false
|
|
config : any = {
|
|
config : any = {
|
|
@@ -277,7 +285,7 @@
|
|
}, {
|
|
}, {
|
|
name: '删除',
|
|
name: '删除',
|
|
event: {
|
|
event: {
|
|
- click: (item : any) => (this as any).doDelete2(item)
|
|
|
|
|
|
+ click: (item : any) => (this as any).doDelete2(item, 'maindataStorehouse')
|
|
}
|
|
}
|
|
}]
|
|
}]
|
|
}]
|
|
}]
|
|
@@ -320,42 +328,52 @@
|
|
rules: {
|
|
rules: {
|
|
name: [{
|
|
name: [{
|
|
required: true, message: '请输入名称', trigger: 'blur'
|
|
required: true, message: '请输入名称', trigger: 'blur'
|
|
|
|
+ }],
|
|
|
|
+ organizationName: [{
|
|
|
|
+ required: true, message: '请输入所属机构名称', trigger: 'blur'
|
|
}]
|
|
}]
|
|
}
|
|
}
|
|
},
|
|
},
|
|
columns: [
|
|
columns: [
|
|
[
|
|
[
|
|
{
|
|
{
|
|
|
|
+ labelWidth: '110px',
|
|
span: 23,
|
|
span: 23,
|
|
label: '名称',
|
|
label: '名称',
|
|
prop: 'name',
|
|
prop: 'name',
|
|
component: 'by-input',
|
|
component: 'by-input',
|
|
},
|
|
},
|
|
{
|
|
{
|
|
|
|
+ labelWidth: '110px',
|
|
span: 23,
|
|
span: 23,
|
|
label: '所属机构名称',
|
|
label: '所属机构名称',
|
|
prop: 'organizationName',
|
|
prop: 'organizationName',
|
|
- component: 'by-input',
|
|
|
|
|
|
+ slot: true,
|
|
|
|
+ // component: 'by-input',
|
|
},
|
|
},
|
|
{
|
|
{
|
|
|
|
+ labelWidth: '110px',
|
|
span: 23,
|
|
span: 23,
|
|
label: '库存',
|
|
label: '库存',
|
|
prop: 'stock',
|
|
prop: 'stock',
|
|
component: 'by-input',
|
|
component: 'by-input',
|
|
},
|
|
},
|
|
{
|
|
{
|
|
|
|
+ labelWidth: '110px',
|
|
span: 23,
|
|
span: 23,
|
|
label: '库存体积',
|
|
label: '库存体积',
|
|
prop: 'stockVolume',
|
|
prop: 'stockVolume',
|
|
component: 'by-input',
|
|
component: 'by-input',
|
|
},
|
|
},
|
|
{
|
|
{
|
|
|
|
+ labelWidth: '110px',
|
|
span: 23,
|
|
span: 23,
|
|
label: '库存数量上限',
|
|
label: '库存数量上限',
|
|
prop: 'maxStockNumber',
|
|
prop: 'maxStockNumber',
|
|
component: 'by-input',
|
|
component: 'by-input',
|
|
},
|
|
},
|
|
{
|
|
{
|
|
|
|
+ labelWidth: '110px',
|
|
span: 23,
|
|
span: 23,
|
|
label: '库存体积上限',
|
|
label: '库存体积上限',
|
|
prop: 'maxStockVolume',
|
|
prop: 'maxStockVolume',
|
|
@@ -369,10 +387,26 @@
|
|
this.getDataList()
|
|
this.getDataList()
|
|
}, 500)
|
|
}, 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) {
|
|
changeTab(item : any) {
|
|
- console.log(item);
|
|
|
|
this.tableData = item;
|
|
this.tableData = item;
|
|
- (this.$refs.moduleView2 as any).setTableValue(item.subList);
|
|
|
|
|
|
+ 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';
|
|
this.isShow = 'cwb';
|
|
}
|
|
}
|
|
// 仓库确认新增/编辑
|
|
// 仓库确认新增/编辑
|
|
@@ -383,22 +417,16 @@
|
|
if (this.popTitle === '新增') {
|
|
if (this.popTitle === '新增') {
|
|
api.saveList(query, 'maindataStorehouse').then((res : any) => {
|
|
api.saveList(query, 'maindataStorehouse').then((res : any) => {
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
- this.$message({
|
|
|
|
- type: 'success',
|
|
|
|
- message: this.popTitle + '成功!'
|
|
|
|
- });
|
|
|
|
|
|
+ this.$message.success(this.popTitle + '成功!');
|
|
this.getDataList();
|
|
this.getDataList();
|
|
- } else this.failHandle(res)
|
|
|
|
|
|
+ } else this.$message.error(res.msg)
|
|
})
|
|
})
|
|
} else if (this.popTitle === '编辑') {
|
|
} else if (this.popTitle === '编辑') {
|
|
api.updateList(query, 'maindataStorehouse').then((res : any) => {
|
|
api.updateList(query, 'maindataStorehouse').then((res : any) => {
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
- this.$message({
|
|
|
|
- type: 'success',
|
|
|
|
- message: this.popTitle + '成功!'
|
|
|
|
- });
|
|
|
|
|
|
+ this.$message.success(this.popTitle + '成功!');
|
|
this.getDataList();
|
|
this.getDataList();
|
|
- } else this.failHandle(res)
|
|
|
|
|
|
+ } else this.$message.error(res.msg)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -408,17 +436,42 @@
|
|
(this as any).$refs.addFormId2.validate().then(() => {
|
|
(this as any).$refs.addFormId2.validate().then(() => {
|
|
let query = (this as any).$refs.addFormId2.getValue();
|
|
let query = (this as any).$refs.addFormId2.getValue();
|
|
this.tableData.subList = [query];
|
|
this.tableData.subList = [query];
|
|
- console.log(this.tableData);
|
|
|
|
- this.dialogFormVisible2 = false;
|
|
|
|
- api.updateList(this.tableData, 'maindataStorehouse').then((res : any) => {
|
|
|
|
- if (res.code === 200) {
|
|
|
|
- this.$message({
|
|
|
|
- type: 'success',
|
|
|
|
- message: this.popTitle + '成功!'
|
|
|
|
- });
|
|
|
|
- this.getDataList();
|
|
|
|
- } else this.failHandle(res)
|
|
|
|
|
|
+ let addId = this.tableData.id;
|
|
|
|
+ this.tableData.subList.map((v : any) => {
|
|
|
|
+ v.storehouseId = this.tableData.id;
|
|
|
|
+ v.idDelete = 0;
|
|
})
|
|
})
|
|
|
|
+ this.dialogFormVisible2 = false;
|
|
|
|
+ if (this.popTitle === '新增') {
|
|
|
|
+ delete this.tableData.id;
|
|
|
|
+ console.log(this.tableData);
|
|
|
|
+ api.saveList(this.tableData, 'maindataStorehouse').then((res : any) => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ this.$message.success(this.popTitle + '成功!');
|
|
|
|
+ this.getOneself(addId);
|
|
|
|
+ } else this.$message.error(res.msg)
|
|
|
|
+ })
|
|
|
|
+ } else if (this.popTitle === '编辑') {
|
|
|
|
+ api.updateList(this.tableData, 'maindataStorehouse').then((res : any) => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ this.$message.success(this.popTitle + '成功!');
|
|
|
|
+ this.getOneself(this.tableData.id);
|
|
|
|
+ } else this.$message.error(res.msg)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ // 通过id拿到当条数据
|
|
|
|
+ getOneself(e : any) {
|
|
|
|
+ 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.$refs.moduleView2 as any).setTableValue(this.tableData.subList);
|
|
|
|
+ }
|
|
})
|
|
})
|
|
}
|
|
}
|
|
// 获取仓库列表数据
|
|
// 获取仓库列表数据
|
|
@@ -441,20 +494,17 @@
|
|
total: res.data.total //总条数
|
|
total: res.data.total //总条数
|
|
};
|
|
};
|
|
(this.$refs.moduleView as any).setPage(page)
|
|
(this.$refs.moduleView as any).setPage(page)
|
|
- } else this.failHandle(res)
|
|
|
|
|
|
+ } else this.$message.error(res.msg)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
// 工具栏方法
|
|
// 工具栏方法
|
|
clickHandle(e : any) {
|
|
clickHandle(e : any) {
|
|
- console.log(e);
|
|
|
|
- if (e === 'onRefresh') (this.$refs.moduleView as any).resert();
|
|
|
|
if (e === 'onAdd') this.onAdd();
|
|
if (e === 'onAdd') this.onAdd();
|
|
if (e === 'onDelete') this.onDelete('moduleView', 'maindataStorehouse');
|
|
if (e === 'onDelete') this.onDelete('moduleView', 'maindataStorehouse');
|
|
if (e === 'onExport') this.onExport();
|
|
if (e === 'onExport') this.onExport();
|
|
}
|
|
}
|
|
|
|
+ // 工具栏方法
|
|
clickHandle2(e : any) {
|
|
clickHandle2(e : any) {
|
|
- console.log(e);
|
|
|
|
- if (e === 'onRefresh') (this.$refs.moduleView2 as any).resert();
|
|
|
|
if (e === 'onAdd') this.onAdd2();
|
|
if (e === 'onAdd') this.onAdd2();
|
|
if (e === 'onExport') this.onExport();
|
|
if (e === 'onExport') this.onExport();
|
|
if (e === 'onReturn') this.isShow = 'ckb';
|
|
if (e === 'onReturn') this.isShow = 'ckb';
|
|
@@ -467,13 +517,6 @@
|
|
if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue({});
|
|
if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue({});
|
|
}, 0)
|
|
}, 0)
|
|
}
|
|
}
|
|
- onAdd2() {
|
|
|
|
- this.popTitle = '新增'
|
|
|
|
- this.dialogFormVisible2 = true;
|
|
|
|
- setTimeout(() => {
|
|
|
|
- if ((this as any).$refs.addFormId2) (this as any).$refs.addFormId2.setValue({});
|
|
|
|
- }, 0)
|
|
|
|
- }
|
|
|
|
// 打开编辑
|
|
// 打开编辑
|
|
openEdit(e : any) {
|
|
openEdit(e : any) {
|
|
this.popTitle = '编辑'
|
|
this.popTitle = '编辑'
|
|
@@ -482,6 +525,14 @@
|
|
if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
|
|
if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
|
|
}, 0)
|
|
}, 0)
|
|
}
|
|
}
|
|
|
|
+ // 打开新增
|
|
|
|
+ onAdd2() {
|
|
|
|
+ this.popTitle = '新增'
|
|
|
|
+ this.dialogFormVisible2 = true;
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ if ((this as any).$refs.addFormId2) (this as any).$refs.addFormId2.setValue({});
|
|
|
|
+ }, 0)
|
|
|
|
+ }
|
|
// 打开编辑
|
|
// 打开编辑
|
|
openEdit2(e : any) {
|
|
openEdit2(e : any) {
|
|
this.popTitle = '编辑'
|
|
this.popTitle = '编辑'
|
|
@@ -490,6 +541,10 @@
|
|
if ((this as any).$refs.addFormId2) (this as any).$refs.addFormId2.setValue(e);
|
|
if ((this as any).$refs.addFormId2) (this as any).$refs.addFormId2.setValue(e);
|
|
}, 0)
|
|
}, 0)
|
|
}
|
|
}
|
|
|
|
+ // 刷新
|
|
|
|
+ onRefresh(){
|
|
|
|
+ (this as any).$refs.moduleView.clearSearch();
|
|
|
|
+ }
|
|
// 工具栏删除
|
|
// 工具栏删除
|
|
onDelete(moduleView : any, url : any) {
|
|
onDelete(moduleView : any, url : any) {
|
|
let selectData = (this.$refs[moduleView] as any).getSelectData()
|
|
let selectData = (this.$refs[moduleView] as any).getSelectData()
|
|
@@ -498,7 +553,7 @@
|
|
selectData.map((v : any) => {
|
|
selectData.map((v : any) => {
|
|
ids += v.id + ','
|
|
ids += v.id + ','
|
|
})
|
|
})
|
|
- } else return this.$message({ type: 'warning', message: '请选择删除数据' })
|
|
|
|
|
|
+ } else return this.$message.warning('请选择删除数据');
|
|
ids = ids.slice(0, ids.length - 1);
|
|
ids = ids.slice(0, ids.length - 1);
|
|
this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
|
|
this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
|
|
confirmButtonText: '确定',
|
|
confirmButtonText: '确定',
|
|
@@ -509,35 +564,31 @@
|
|
api.deleteList({ ids: ids }, url).then((res : any) => {
|
|
api.deleteList({ ids: ids }, url).then((res : any) => {
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
this.getDataList();
|
|
this.getDataList();
|
|
- this.$message({
|
|
|
|
- type: 'success',
|
|
|
|
- message: '删除成功!'
|
|
|
|
- });
|
|
|
|
- } else this.failHandle(res)
|
|
|
|
|
|
+ this.$message.success('删除成功');
|
|
|
|
+ } else this.$message.error(res.msg)
|
|
})
|
|
})
|
|
- }).catch(() => {
|
|
|
|
- this.$message({
|
|
|
|
- type: 'info',
|
|
|
|
- message: '已取消删除'
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
}
|
|
}
|
|
// 操作删除
|
|
// 操作删除
|
|
- doDelete2(item : any) {
|
|
|
|
- console.log(item);
|
|
|
|
|
|
+ doDelete2(item : any, url : any) {
|
|
this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
|
|
this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
|
|
confirmButtonText: '确定',
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
cancelButtonText: '取消',
|
|
type: 'warning',
|
|
type: 'warning',
|
|
center: true
|
|
center: true
|
|
}).then(() => {
|
|
}).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 {
|
|
|
|
|
|
- }).catch(() => {
|
|
|
|
- this.$message({
|
|
|
|
- type: 'info',
|
|
|
|
- message: '已取消删除'
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
|
|
+ }
|
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
}
|
|
}
|
|
//导出
|
|
//导出
|
|
onExport() {
|
|
onExport() {
|
|
@@ -547,12 +598,6 @@
|
|
...query
|
|
...query
|
|
}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
|
|
}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
|
|
}
|
|
}
|
|
- // 运行错误
|
|
|
|
- failHandle(err : any) {
|
|
|
|
- let msg = err.msg ? err.msg : '运行错误!';
|
|
|
|
- this.$message.error(msg)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|