1.第三方数据增加仓库信息页面

2.基础数据-仓库信息绑定第三方仓库
master
MrZhai 3 years ago
parent 001a569607
commit 0c7116e4d3

@ -120,3 +120,30 @@ export function deleteWarehouseBussinessType(params) {
params: params params: params
}); });
} }
//绑定第三方仓库
export function bindThrWarehouse(params) {
return axios({
url: "/spms/inv/warehouse/bindThrWarehouse",
method: "post",
params: params
});
}
//解绑第三方仓库
export function unbindThrWarehouse(params) {
return axios({
url: "/spms/inv/warehouse/unbindThrWarehouse",
method: "post",
params: params
});
}
//查询第三方系统和仓库数据关联信息
export function getThrsysDetail(params) {
return axios({
url: "/spms/inv/warehouse/thridSys/detail",
method: "get",
params: params
});
}

@ -0,0 +1,43 @@
import axios from "../../utils/axios";
// 权限管理
// 获取列表
export function filterThrList(query) {
return axios({
url: "/spms/thrsys/warehouse/filter",
method: "get",
params: query
});
}
export function filterThrAll(query) {
return axios({
url: "/spms/thrsys/warehouse/filterAll",
method: "get",
params: query
});
}
// 保存
export function saveThrWarehouse(data, formName, method = "post") {
let url =
formName !== "edit"
? "/spms/thrsys/warehouse/save"
: "/spms/thrsys/warehouse/edit";
return axios({
url: url,
method: method,
data: data
});
}
// 删除
export function deleteThrWarehouse(data) {
return axios({
url: "/spms/thrsys/warehouse/delete",
method: "post",
data: data
});
}

@ -92,6 +92,7 @@ import invUdiTrace from "@/views/inventory/invUdiTrace";
import invUdiTraceOrder from "@/views/inventory/invUdiTraceOrder"; import invUdiTraceOrder from "@/views/inventory/invUdiTraceOrder";
import additionalOrder from "@/views/warehouse/AdditionalOrder"; import additionalOrder from "@/views/warehouse/AdditionalOrder";
import invStatistics from "@/views/inventory/InvStatistics"; import invStatistics from "@/views/inventory/InvStatistics";
import thrInvWarehouse from "@/views/thrsys/ThrInvWarehouse";
const err401 = r => const err401 = r =>
@ -477,6 +478,15 @@ export const asyncRouterMap = [
authRule: ["thrsys/manage"] authRule: ["thrsys/manage"]
}, },
children: [ children: [
{
path: "thrInvWarehouse",
component: thrInvWarehouse,
name: "仓库信息",
icon: "",
meta: {
authRule: ["thrsys/thrInvWarehouse"]
}
},
{ {
path: "/corps", path: "/corps",
redirect: "/corps/ThrCorps", redirect: "/corps/ThrCorps",

@ -447,6 +447,157 @@
> >
</div> </div>
</el-dialog> </el-dialog>
<el-dialog
:title="formMap[formName]"
:close-on-click-modal="false"
:close-on-press-escape="false"
:visible.sync="formVisible"
:before-close="hideForm"
width="60%"
top="5vh"
>
<el-table :data="sysList" style="width: 100%; margin-bottom: 30px;" border>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column
label="第三方系统名称"
prop="sysName"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="第三方仓库ID"
prop="thirdId"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="第三方仓库名称"
prop="thirdName"
show-overflow-tooltip
></el-table-column>
<el-table-column label="操作" fixed="right">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click="intentSelect(scope.row)"
>关联
</el-button
>
<el-button type="text" size="small" @click.native.stop="unbindThrWarehouse(scope.row)"
:disabled="scope.row.thirdId=='' ||scope.row.thirdId==null"
>解绑
</el-button>
</template>
</el-table-column>
</el-table>
<el-form :model="formData" :rules="formRules" ref="dataForm">
<el-form-item label="仓库编码" prop="title" class="query-form-item">
<el-input
v-model="formData.code" style="width: 80%"
auto-complete="off"
></el-input>
</el-form-item>
<el-form-item label="仓库名称" prop="name" class="query-form-item">
<el-input
v-model="formData.name" style="width: 80%"
auto-complete="off"
></el-input>
</el-form-item>
<el-form-item class="query-form-item" label="仓库类型:">
<el-select v-model="formData.advanceType" placeholder="仓库类型" clearable>
<el-option label="寄售" :value='true'></el-option>
<el-option label="仓库" :value='false'></el-option>
</el-select>
</el-form-item>
<el-form-item label="状态:" prop="status" class="query-form-item">
<el-radio-group v-model="formData.status">
<el-radio :label="0">禁用</el-radio>
<el-radio :label="1">正常</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item v-if="formData.pid == 0">-->
<!-- <el-row :gutter="20" class="el-row" type="flex">-->
<!-- <el-col :span="4" class="el-col">-->
<!-- <div class="text item">-->
<!-- <el-checkbox v-model="formData.advanceType"></el-checkbox>-->
<!-- </div>-->
<!-- </el-col>-->
<!-- <el-col :span="4" class="el-col">-->
<!-- <div class="text item">-->
<!-- <el-checkbox v-model="formData.isDefault"></el-checkbox>-->
<!-- </div>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- </el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click.native="hideForm">取消</el-button>
<el-button
type="primary"
@click.native="formSubmit()"
:loading="formLoading"
>提交
</el-button
>
</div>
</el-dialog>
<el-dialog title="关联仓库" :visible.sync="thrWareHouseVisible">
<el-table
:data="thrWarehouseData"
style="width: 100%;margin-top: 10px;"
row-key="id"
border
highlight-current-row
@current-change="changeThrWarehouse"
default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table-column
type="index"
label="序号"
>
</el-table-column>
<el-table-column
prop="code"
label="仓库编码"
>
</el-table-column>
<el-table-column
prop="name"
label="仓库名称"
>
</el-table-column>
<el-table-column
prop="advanceType"
label="仓库类型">
<template slot-scope="scope">
<span>{{ enableMap[scope.row.advanceType] }}</span>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click.native="hideThrWarehouseTable()">取消</el-button>
<el-button
type="primary"
@click.native="bindThrWarehouse()"
:loading="formLoading"
>提交
</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
@ -457,8 +608,10 @@ import {
deleteWarehouse, warehouseBussinessTypeList, deleteWarehouse, warehouseBussinessTypeList,
warehouseUserList, saveWarehouseBussinessType, warehouseUserList, saveWarehouseBussinessType,
saveWarehouseUser, updateDirector, saveWarehouseUser, updateDirector,
deleteWarehouseUser, deleteWarehouseBussinessType deleteWarehouseUser, deleteWarehouseBussinessType,
bindThrWarehouse, unbindThrWarehouse, getThrsysDetail
} from "../../api/basic/invWarehouse"; } from "../../api/basic/invWarehouse";
import {filterThrList} from "@/api/thrsys/thrInvWarehouse";
import {getHospitalUserList} from "../../api/auth/authUser"; import {getHospitalUserList} from "../../api/auth/authUser";
import {getJoinBussinessType} from "../../api/basic/bussinessType"; import {getJoinBussinessType} from "../../api/basic/bussinessType";
import {formatDate} from "@/utils/date"; import {formatDate} from "@/utils/date";
@ -538,6 +691,12 @@ export default {
selectUserList: [], selectUserList: [],
selectBussinessTypeList: [], selectBussinessTypeList: [],
bussinessTypeFormVisible: false, bussinessTypeFormVisible: false,
thrWarehouseData : null,
currentId: null,
thrWareHouseVisible: false,
sysList: [],
checkThrWarehouseRow: null,
currentSysId: null
}; };
}, },
methods: { methods: {
@ -624,6 +783,7 @@ export default {
handleForm(node, data, formName) { handleForm(node, data, formName) {
// let no = this.getProjectNum() + Math.floor(Math.random() * 10000) // let no = this.getProjectNum() + Math.floor(Math.random() * 10000)
this.currentId = data.id;
this.pidData = data || null; this.pidData = data || null;
formJson.pid = (data && parseInt(data.id)) || ""; formJson.pid = (data && parseInt(data.id)) || "";
this.formData = JSON.parse(JSON.stringify(formJson)); this.formData = JSON.parse(JSON.stringify(formJson));
@ -646,7 +806,20 @@ export default {
// } // }
this.getParentInv(this.formData.level); this.getParentInv(this.formData.level);
}, },
getThrsysDetail() {
let params = {
id: this.currentId
};
getThrsysDetail(params)
.then((response) => {
this.loading = false;
this.sysList = response.data.list || [];
})
.catch(() => {
this.loading = false;
this.sysList = [];
});
},
handleSubForm(node, data, formName) { handleSubForm(node, data, formName) {
this.subFormVisible = true; this.subFormVisible = true;
this.pidData = data || null; this.pidData = data || null;
@ -661,6 +834,8 @@ export default {
// if (data && data.id) { // if (data && data.id) {
// this.index = this.mergeList.findIndex((d) => d.id === data.id); // this.index = this.mergeList.findIndex((d) => d.id === data.id);
// } // }
this.getThrsysDetail();
}, },
formSubmit() { formSubmit() {
this.$refs["dataForm"].validate((valid) => { this.$refs["dataForm"].validate((valid) => {
@ -690,10 +865,10 @@ export default {
} }
} }
} else { } else {
const parent = this.node.parent; // const parent = this.node.parent;
const children = parent.data.children || parent.data; // const children = parent.data.children || parent.data;
const index = children.findIndex((d) => d.id === data.id); // const index = children.findIndex((d) => d.id === data.id);
children.splice(index, 1, data); // children.splice(index, 1, data);
} }
// //
this.resetForm(); this.resetForm();
@ -999,7 +1174,53 @@ export default {
}).catch((error) => { }).catch((error) => {
this.$message.error("移除失败"); this.$message.error("移除失败");
}) })
} },
//
bindThrWarehouse() {
this.thrWareHouseVisible = false;
let params = {
id: this.currentId,
thridWarehouseId: this.checkThrWarehouseRow.code,
sysId: this.currentSysId
}
bindThrWarehouse(params).then((res) => {
this.$message.success("绑定成功")
this.getThrsysDetail();
}).catch((error) => {
this.$message.error("绑定失败")
})
},
//
unbindThrWarehouse(row) {
let params = {
id: this.currentId,
sysId: row.sysId
};
unbindThrWarehouse(params).then((res) => {
this.$message.success("解绑成功");
this.getThrsysDetail();
}).catch((error) => {
this.$message.error("解绑失败");
})
},
intentSelect(row) {
this.currentSysId = row.sysId;
//
filterThrList().then((res) => {
this.thrWarehouseData = res.data.list;
this.thrWareHouseVisible = true;
}).catch((error) => {
this.thrWarehouseData = [];
this.thrWareHouseVisible = true;
this.$message.error("第三方仓库数据加载失败");
});
},
changeThrWarehouse(row){
this.checkThrWarehouseRow = row;
},
hideThrWarehouseTable() {
this.thrWareHouseVisible = false;
},
}, },
filters: { filters: {
statusFilterType(status) { statusFilterType(status) {

@ -0,0 +1,546 @@
<template>
<div>
<el-card>
<el-form :inline="true" :model="query" class="query-form" size="mini">
<el-form-item class="query-form-item">
<el-input
v-model="query.name"
clearable
placeholder="仓库名称"
style="width: 400px"
></el-input>
</el-form-item>
<el-form-item class="query-form-item">
<el-select v-model="query.advanceType" placeholder="请选择仓库类型" clearable>
<el-option label="全部" value=""></el-option>
<el-option label="寄售" value=true></el-option>
<el-option label="仓库" value=false></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button-group>
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="search" @click="getList"></el-button>
<el-button type="primary" @click.native="handleForm(null, null,'addTop')"
>添加仓库
</el-button
>
</el-button-group>
</el-form-item>
</el-form>
<el-table
:data="mergeList"
style="width: 100%;margin-bottom: 20px;"
row-key="id"
border
default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table-column
prop="code"
label="仓库编码"
>
</el-table-column>
<el-table-column
prop="name"
label="仓库名称"
>
</el-table-column>
<el-table-column
prop="advanceType"
label="仓库类型">
<template slot-scope="scope">
<span>{{ enableMap[scope.row.advanceType] }}</span>
</template>
</el-table-column>
<!-- <el-table-column-->
<!-- prop="isDefault"-->
<!-- label="是否默认库存">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ enableMap[scope.row.isDefault] }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="操作" fixed="right">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native.stop="handleForm(node, scope.row, 'edit')"
>编辑
</el-button
>
<el-button
type="text"
size="small"
:disabled="scope.row.code==1000 ||scope.row.code==1001"
@click.native.stop="handleDel(node,scope.row)"
>删除
</el-button
>
</template>
</el-table-column>
</el-table>
<!-- <el-tree-->
<!-- :data="mergeList"-->
<!-- :props="defaultProps"-->
<!-- node-key="id"-->
<!-- style="width: 50%"-->
<!-- default-expand-all-->
<!-- :expand-on-click-node="false"-->
<!-- :render-content="renderContent"-->
<!-- >-->
<!-- </el-tree>-->
</el-card>
<!--表单界面-->
<el-dialog
:title="formMap[formName]"
:close-on-click-modal="false"
:close-on-press-escape="false"
:visible.sync="subFormVisible"
:before-close="hideForm"
width="60%"
top="5vh"
>
<el-form :model="formData" :rules="formRules" ref="dataForm">
<el-form-item label="本企业仓库" prop="pid">
<el-select v-model="formData.pid" placeholder="顶级" disabled>
<el-option
v-for="item in mergeList"
:key="item.id"
:label="item.name"
:value="item.id"
>
<span style="float: left"
><span v-html="item.html"></span>{{ item.name }}</span
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="仓库编码" prop="title" class="query-form-item">
<el-input
v-model="formData.code" style="width: 80%"
auto-complete="off"
></el-input>
</el-form-item>
<el-form-item label="仓库名称" prop="name" class="query-form-item">
<el-input
v-model="formData.name" style="width: 80%"
auto-complete="off"
></el-input>
</el-form-item>
<el-form-item class="query-form-item" label="仓库类型:">
<el-select v-model="formData.advanceType" placeholder="仓库类型" clearable>
<el-option label="寄售" :value=true></el-option>
<el-option label="仓库" :value=false></el-option>
</el-select>
</el-form-item>
<el-form-item label="状态:" prop="status" class="query-form-item">
<el-radio-group v-model="formData.status">
<el-radio :label="0">禁用</el-radio>
<el-radio :label="1">正常</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click.native="hideForm">取消</el-button>
<el-button
type="primary"
@click.native="formSubmit()"
:loading="formLoading"
>提交
</el-button
>
</div>
</el-dialog>
<el-dialog
:title="formMap[formName]"
:close-on-click-modal="false"
:close-on-press-escape="false"
:visible.sync="formVisible"
:before-close="hideForm"
width="60%"
top="5vh"
>
<el-form :model="formData" :rules="formRules" ref="dataForm">
<el-form-item label="仓库编码" prop="title" class="query-form-item">
<el-input
v-model="formData.code" style="width: 80%"
auto-complete="off"
></el-input>
</el-form-item>
<el-form-item label="仓库名称" prop="name" class="query-form-item">
<el-input
v-model="formData.name" style="width: 80%"
auto-complete="off"
></el-input>
</el-form-item>
<el-form-item class="query-form-item" label="仓库类型:">
<el-select v-model="formData.advanceType" placeholder="仓库类型" clearable>
<el-option label="寄售" :value='true'></el-option>
<el-option label="仓库" :value='false'></el-option>
</el-select>
</el-form-item>
<el-form-item label="状态:" prop="status" class="query-form-item">
<el-radio-group v-model="formData.status">
<el-radio :label="0">禁用</el-radio>
<el-radio :label="1">正常</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item v-if="formData.pid == 0">-->
<!-- <el-row :gutter="20" class="el-row" type="flex">-->
<!-- <el-col :span="4" class="el-col">-->
<!-- <div class="text item">-->
<!-- <el-checkbox v-model="formData.advanceType"></el-checkbox>-->
<!-- </div>-->
<!-- </el-col>-->
<!-- <el-col :span="4" class="el-col">-->
<!-- <div class="text item">-->
<!-- <el-checkbox v-model="formData.isDefault"></el-checkbox>-->
<!-- </div>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- </el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click.native="hideForm">取消</el-button>
<el-button
type="primary"
@click.native="formSubmit()"
:loading="formLoading"
>提交
</el-button
>
</div>
</el-dialog>
</div>
</template>
<script>
import {
filterThrList,
saveThrWarehouse,
deleteThrWarehouse
} from "../../api/thrsys/thrInvWarehouse";
const formJson = {
id: null,
pid: null,
name: null,
code: null,
status: 1,
advanceType: false,
isDefault: false
};
export default {
data() {
return {
query: {
id: null,
pid: null,
name: null,
code: null,
status: null,
advanceType: null,
isDefault: null
},
mergeList: [],
node: null,
defaultProps: {
children: "children",
label: "name"
},
treeList: [],
loading: true,
index: null,
formName: null,
formMap: {
addTop: "添加仓库",
add: "添加货位",
edit: "编辑"
},
enableMap: {
true: "寄售",
false: "仓库",
},
formLoading: false,
subFormVisible: false,
formVisible: false,
formData: formJson,
formRules: {
name: [
{required: true, message: "请输入仓库货位名", trigger: "blur"}
],
code: [
{required: true, message: "请输入仓库货位代码", trigger: "blur"}
]
},
pidData: {}
,
deleteLoading: false
}
;
},
methods: {
/*eslint-disable */
renderContent(h, {node, data, store}) {
return (
<span
style="flex: 1; display: flex; align-items: center; justify-content: space-between; font-size: 14px; padding-right: 8px;">
<span>
<span title={data.name} style="margin-left:8px">{node.label}</span>
<span style="margin-left:18px">(编码{data.code})</span>
</span>
<span>
<el-button
style="font-size: 12px;"
type="text"
on-click={() => this.handleSubForm(node, data, "add")}
>
添加货位
</el-button>
<el-button
style="font-size: 12px;"
type="text"
on-click={() => this.handleForm(node, data, "edit")}
>
编辑
</el-button>
<el-button
style="font-size: 12px;"
type="text"
on-click={() => this.handleDel(node, data)}
>
删除
</el-button>
</span>
</span>
);
},
onReset() {
this.$router.push({
path: "",
});
this.query = {
name: "",
status: "",
};
this.getList();
},
onSubmit() {
this.getList();
},
getList() {
this.loading = true;
filterThrList(this.query)
.then((response) => {
this.loading = false;
this.mergeList = response.data.list || [];
this.treeList = response.data.tree_list || [];
})
.catch(() => {
this.loading = false;
this.mergeList = [];
this.treeList = [];
});
},
//
resetForm() {
if (this.$refs["dataForm"]) {
//
this.$refs["dataForm"].clearValidate();
//
this.$refs["dataForm"].resetFields();
this.getList();
}
},
//
hideForm() {
//
this.formVisible = false;
this.subFormVisible = false;
return true;
},
//
handleForm(node, data, formName) {
this.formVisible = true;
let no = this.getProjectNum() + Math.floor(Math.random() * 10000)
this.pidData = data || null;
formJson.pid = (data && parseInt(data.id)) || "";
this.formData = JSON.parse(JSON.stringify(formJson));
if (formName === "edit") {
this.formData = Object.assign({}, data);
this.node = node;
} else {
this.formData.code = no;
}
this.formData.pid = !this.formData.pid ? "" : this.formData.pid;
this.formName = formName;
if (data && data.id) {
this.index = this.mergeList.findIndex((d) => d.id === data.id);
}
},
handleSubForm(node, data, formName) {
this.subFormVisible = true;
this.pidData = data || null;
formJson.pid = (data && parseInt(data.id)) || "";
this.formData = JSON.parse(JSON.stringify(formJson));
if (formName === "edit") {
this.formData = Object.assign({}, data);
this.node = node;
} else {
let no = this.getProjectNum() + Math.floor(Math.random() * 10000);
this.formData.code = no;
}
this.formData.pid = !this.formData.pid ? "" : this.formData.pid;
this.formName = formName;
if (data && data.id) {
this.index = this.mergeList.findIndex((d) => d.id === data.id);
}
},
formSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (valid) {
this.formLoading = true;
let data = Object.assign({}, this.formData);
saveThrWarehouse(data, this.formName)
.then((response) => {
this.formLoading = false;
if (response.code !== 20000) {
this.$message.error(response.message);
return false;
}
this.$message.success("操作成功");
this.formVisible = false;
if (this.formName !== "edit") {
if (response.data && response.data.id) {
data.id = response.data.id;
if (this.pidData) {
if (!this.pidData.children) {
this.$set(this.pidData, "children", []);
}
this.pidData.children.push(data);
} else {
this.mergeList.push(data);
}
}
} else {
// const parent = this.node.parent;
// const children = parent.data.children || parent.data;
// const index = children.findIndex((d) => d.id === data.id);
// children.splice(index, 1, data);
}
//
this.resetForm();
this.getList();
})
.catch(() => {
this.formLoading = false;
});
}
});
},
//
handleDel(node, data) {
if (data.children && data.children.length > 0) {
this.$alert("请先删除子节点", "提示", {
confirmButtonText: "确定",
});
return false;
}
if (data.id) {
this.$confirm("确认删除该记录吗?", "提示", {
type: "warning",
})
.then(() => {
this.deleteLoading = true;
let para = {id: data.id};
deleteThrWarehouse(para)
.then((response) => {
this.deleteLoading = false;
if (response.code !== 20000) {
this.$message.error(response.message);
return false;
}
this.$message.success("删除成功");
this.getList();
const parent = node.parent;
const children = parent.data.children || parent.data;
const index = children.findIndex((d) => d.id === data.id);
children.splice(index, 1);
})
.catch(() => {
this.deleteLoading = false;
});
})
.catch(() => {
this.$message.info("取消删除");
});
}
},
getProjectNum() {
const projectTime = new Date() //
const Year = projectTime.getFullYear() // IE.
const Month = projectTime.getMonth() + 1 //
const Day = projectTime.getDate() //
var CurrentDate = Year
if (Month >= 10) { // 1010
CurrentDate += Month
} else {
CurrentDate += '0' + Month
}
if (Day >= 10) {
CurrentDate += Day
} else {
CurrentDate += '0' + Day
}
return CurrentDate
}
},
filters: {
statusFilterType(status) {
const statusMap = {
0: "gray",
1: "success",
};
return statusMap[status];
},
statusFilterName(status) {
const statusMap = {
0: "禁用",
1: "正常",
};
return statusMap[status];
},
},
mounted() {
},
created() {
//
this.getList();
},
};
</script>
<style type="text/scss" lang="scss">
</style>
Loading…
Cancel
Save