From f48cc072144e03d16962c1ea2c7fa62b57fe716d Mon Sep 17 00:00:00 2001 From: anthonywj Date: Thu, 21 Jul 2022 11:26:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E5=88=86=E5=BA=93=E7=AD=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/basic/invSubWarehouse.js | 29 ++ src/api/basic/invWarehouse.js | 11 + src/api/thrsys/thrdSubInvWarehouse.js | 43 +++ src/views/basic/invWarehouse.vue | 256 ++++++++++++++--- src/views/thrsys/ThrInvWarehouse.vue | 381 ++++++++++++++++++-------- 5 files changed, 578 insertions(+), 142 deletions(-) create mode 100644 src/api/thrsys/thrdSubInvWarehouse.js diff --git a/src/api/basic/invSubWarehouse.js b/src/api/basic/invSubWarehouse.js index ba47c79..8126712 100644 --- a/src/api/basic/invSubWarehouse.js +++ b/src/api/basic/invSubWarehouse.js @@ -40,3 +40,32 @@ export function deleteSubWarehouse(data) { data: data }); } + +//查询第三方系统和仓库数据关联信息 +export function getSubThrsysDetail(params) { + return axios({ + url: "/spms/sub/inv/warehouse/thridSys/detail", + method: "get", + params: params + }); +} + + +//绑定第三方仓库 +export function bindThrSubWarehouse(params) { + return axios({ + url: "/spms/sub/inv/warehouse/bindThrWarehouse", + method: "post", + params: params + }); +} + +//解绑第三方仓库 +export function unbindSubThrWarehouse(params) { + return axios({ + url: "/spms/sub/inv/warehouse/unbindThrWarehouse", + method: "post", + params: params + }); +} + diff --git a/src/api/basic/invWarehouse.js b/src/api/basic/invWarehouse.js index 056625c..5def803 100644 --- a/src/api/basic/invWarehouse.js +++ b/src/api/basic/invWarehouse.js @@ -199,3 +199,14 @@ export function replaceCodes(data) { data: data }) } + +export function filterThridSubByInv(params) { + return axios({ + url: "/spms/sub/inv/warehouse/filterThridInv", + method: "get", + params: params + }); +} + + + diff --git a/src/api/thrsys/thrdSubInvWarehouse.js b/src/api/thrsys/thrdSubInvWarehouse.js new file mode 100644 index 0000000..72c0dba --- /dev/null +++ b/src/api/thrsys/thrdSubInvWarehouse.js @@ -0,0 +1,43 @@ +import axios from "../../utils/axios"; + +export function filterThridSubAll(query) { + return axios({ + url: "/thirdSys/sub/inv/warehouse/filter", + method: "get", + params: query + }); +} + +export function filterSubByInv(query) { + return axios({ + url: "/thirdSys/sub/inv/warehouse/findByInv", + method: "get", + params: query + }); +} + + +// 保存 +export function saveSubWarehouse(data, formName, method = "post") { + let url = + formName !== "edit" + ? "/thirdSys/sub/inv/warehouse/save" + : "/thirdSys/sub/inv/warehouse/edit"; + return axios({ + url: url, + method: method, + data: data + }); +} + +// 删除 +export function deleteSubWarehouse(data) { + return axios({ + url: "/thirdSys/sub/inv/warehouse/delete", + method: "post", + data: data + }); +} + + + diff --git a/src/views/basic/invWarehouse.vue b/src/views/basic/invWarehouse.vue index 6e0f36c..59185a3 100644 --- a/src/views/basic/invWarehouse.vue +++ b/src/views/basic/invWarehouse.vue @@ -367,20 +367,60 @@ - - - - - - + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + 查询 + + + + + + + + + + + + + + + + @@ -609,13 +706,12 @@ import { warehouseUserList, saveWarehouseBussinessType, saveWarehouseUser, updateDirector, disableWarehouse, deleteWarehouseUser, deleteWarehouseBussinessType, - bindThrWarehouse, unbindThrWarehouse, getThrsysDetail + bindThrWarehouse, unbindThrWarehouse, filterThridSubByInv, getThrsysDetail } from "../../api/basic/invWarehouse"; - import { - filterSubAll, saveSubWarehouse, deleteSubWarehouse + filterSubAll, saveSubWarehouse, deleteSubWarehouse, + getSubThrsysDetail, bindThrSubWarehouse, unbindSubThrWarehouse } from "../../api/basic/invSubWarehouse"; - import {filterThrList} from "@/api/thrsys/thrInvWarehouse"; import {getHospitalUserList} from "../../api/auth/authUser"; import {getJoinBussinessType} from "../../api/basic/bussinessType"; @@ -683,10 +779,10 @@ export default { formData: formJson, formRules: { name: [ - {required: true, message: "请输入仓库名称", trigger: "blur"} + {required: true, message: "请输入仓库货位名", trigger: "blur"} ], code: [ - {required: true, message: "请输入仓库编码", trigger: "blur"} + {required: true, message: "请输入仓库货位代码", trigger: "blur"} ] }, pidData: {}, @@ -698,28 +794,41 @@ export default { bussinessTypeList: null, userFormVisible: false, currentCode: null, + superRow: null, currentRow: {status: 1}, selectUserList: [], selectBussinessTypeList: [], bussinessTypeFormVisible: false, - thrWarehouseData: null, + thrWarehouseData: [], + thrSubWarehouseData: [], currentId: null, + currentSubId: null, thrWareHouseVisible: false, + thrSubWareHouseVisible: false, sysList: [], + sysSubList: [], checkThrWarehouseRow: null, + checkSubThrWarehouseRow: null, currentSysId: null, thirdSysVisible: false, total: 0, + subTotal: 0, thirdQuery: { key: null, page: 1, - limit: 10 - , thirdSysFk: "thirdId", + limit: 10, + thirdSysFk: "thirdId", + }, + thirdSubQuery: { + parentId: null, + key: null, + page: 1, + limit: 10, + thirdSysFk: "thirdId", }, configParms: {}, subData: {}, subFromName: "add", - currentCode: null }; }, methods: { @@ -763,7 +872,7 @@ export default { // 更改值 this.formVisible = false; this.subFormVisible = false; - this.loadSubData(this.currentCode); + // this.loadSubData(this.currentCode); return true; }, // 显示表单 @@ -812,8 +921,24 @@ export default { this.sysList = []; }); }, + getSubThrsysDetailData() { + let params = { + id: this.subData.code, + }; + getSubThrsysDetail(params) + .then((response) => { + this.loading = false; + this.sysSubList = response.data.list || []; + }) + .catch(() => { + this.loading = false; + this.sysSubList = []; + }); + }, + handleSubForm(data, formName) { this.subFromName = formName; + if (formName === "edit") { this.subData = data; } else if (formName === "add") { @@ -822,7 +947,7 @@ export default { } ; this.subFormVisible = true; - + this.getSubThrsysDetailData(); }, //添加仓库 formSubmit() { @@ -878,7 +1003,7 @@ export default { //添加分库 forSubSubmit() { - if (isBlank(this.subData.name)) { + if (this.$isBlank(this.subData.name)) { this.$message.error("分库名称不能为空!"); return; } @@ -1066,7 +1191,7 @@ export default { this.subList = []; this.userList = null; this.bussinessTypeList = null; - this.currentCode = row.code; + this.superRow = row; this.loadSubData(row.code); }, @@ -1308,8 +1433,11 @@ export default { sysId: this.currentSysId } bindThrWarehouse(params).then((res) => { - this.$message.success("绑定成功") - this.getThrsysDetailData(); + if (res.code == 20000) { + this.$message.success("绑定成功") + this.getThrsysDetailData(); + } + }).catch((error) => { this.$message.error("绑定失败") }) @@ -1327,11 +1455,46 @@ export default { this.$message.error("解绑失败"); }) }, + + //绑定第三方分库 + bindSubThrWarehouse() { + + let params = { + id: this.subData.id, + thridWarehouseId: this.checkSubThrWarehouseRow.code, + sysId: this.checkSubThrWarehouseRow.thirdSysFk + } + bindThrSubWarehouse(params).then((res) => { + if (res.code == 20000) { + this.$message.success("绑定成功") + this.getSubThrsysDetailData(); + } + this.thrSubWareHouseVisible = false; + }).catch((error) => { + this.$message.error("绑定失败"); + this.thrSubWareHouseVisible = false; + }) + }, + //解绑第三方分库 + unbindSubThrWarehouse(row) { + let params = { + id: this.subData.id, + sysId: row.sysId + }; + unbindSubThrWarehouse(params).then((res) => { + this.$message.success("解绑成功"); + this.getSubThrsysDetailData(); + }).catch((error) => { + this.$message.error("解绑失败"); + }) + }, + intentSelect(row) { if (row != null) this.currentSysId = row.sysId; //加载第三方仓库数据 this.thirdQuery.thirdSysFk = this.currentSysId; + this.thrWarehouseData = []; filterThrList(this.thirdQuery).then((res) => { this.thrWarehouseData = res.data.list; this.total = res.data.total || 0; @@ -1344,16 +1507,47 @@ export default { }); }, + intentSubSelect(row) { + + if (row != null) { + this.thirdSubQuery.parentId = this.superRow.code; + this.thirdSubQuery.thirdSysFk = row.sysId; + } + this.thrSubWarehouseData = []; + this.thrSubWareHouseVisible = true; + filterThridSubByInv(this.thirdSubQuery).then((res) => { + if (res.code == 20000) { + this.thrSubWarehouseData = res.data.list; + this.subTotal = res.data.total || 0; + } else { + this.$message.error(res.message); + } + + }).catch((error) => { + this.thrWarehouseData = []; + this.subTotal = 0; + this.$message.error("第三方分库库数据加载失败"); + }); + }, + handleCurrentChange(val) { this.thirdQuery.page = val; this.intentSelect(); }, + handleSubCurrentChange(val) { + this.thirdSubQuery.page = val; + this.intentSubSelect(); + }, changeThrWarehouse(row) { this.checkThrWarehouseRow = row; }, + changeSubThrWarehouse(row) { + this.checkSubThrWarehouseRow = row; + }, hideThrWarehouseTable() { this.thrWareHouseVisible = false; + this.thrSubWareHouseVisible = false; }, getSyncConfig() { findConfig() diff --git a/src/views/thrsys/ThrInvWarehouse.vue b/src/views/thrsys/ThrInvWarehouse.vue index 8ecbae7..cface72 100644 --- a/src/views/thrsys/ThrInvWarehouse.vue +++ b/src/views/thrsys/ThrInvWarehouse.vue @@ -19,7 +19,7 @@ + @change="thirdSysFkChange()"> 添加仓库 + + + + @@ -44,8 +48,8 @@ style="width: 100%;margin-bottom: 20px;" row-key="id" border - default-expand-all - :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> + highlight-current-row + @current-change="handInvCurrentChange"> @@ -235,8 +286,16 @@ import { saveThrWarehouse, deleteThrWarehouse, } from "../../api/thrsys/thrInvWarehouse"; -import {getBasicThirdSys} from "../../api/basic/basicThirdSys"; +import {filterDetailByKey, getBasicThirdSys} from "../../api/basic/basicThirdSys"; import {findConfig} from "@/api/thrsys/spsSyncStatus"; +import {isBlank} from "@/utils/strUtil"; +import { + filterThridSubAll, + filterSubByInv, + deleteSubWarehouse, + saveSubWarehouse +} from "@/api/thrsys/thrdSubInvWarehouse"; + const formJson = { id: null, @@ -262,13 +321,22 @@ export default { isDefault: null, page: 1, limit: 20, + thirdSysFk: null, }, mergeList: [], + subList: [], + subData: {}, + currentCode: null, node: null, defaultProps: { children: "children", label: "name" }, + thirdSysDetail: { + enabled: false, + fromType: 0, + }, + total: 0, treeList: [], loading: true, @@ -296,6 +364,9 @@ export default { ], thirdSysFk: [ {required: true, message: "请选择第三方系统", trigger: "blur"} + ], + advanceType: [ + {required: true, message: "请选择仓库类型", trigger: "blur"} ] }, pidData: {}, @@ -311,33 +382,25 @@ export default { this.query.page = val; this.getList(); }, - renderContent(h, {node, data, store}) { - return ( - - - {node.label} - (编码:{data.code}) - - - this.handleForm(node, data, "edit")} - > - 编辑 - - this.handleDel(node, data)} - > - 删除 - - - - ); + handInvCurrentChange(row) { + this.subList = []; + this.currentCode = row.code; + this.loadSubData(row); + }, + + loadSubData(row) { + let subQuery = { + parentId: row.code, + thirdSysFk: row.thirdSysFk, + } + filterThridSubAll(subQuery).then((res) => { + if (res.code == 20000) { + this.subList = res.data.list; + + } + }).catch((error) => { + }); }, onReset() { this.$router.push({ @@ -439,27 +502,76 @@ export default { } }, - handleSubForm(node, data, formName) { + handleSubForm(data, formName) { + this.subFromName = formName; + if (formName === "edit") { + this.subData = data; + } else if (formName === "add") { + this.subData = {}; + this.subData.parentId = data.code; + this.subData.thirdSysFk = data.thirdSysFk; + } 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; + handleSubDel(row) { + if (row.id) { + this.$confirm("确认删除该分库吗?", "提示", { + type: "warning", + }) + .then(() => { + this.deleteLoading = true; + let para = {id: row.id}; + deleteSubWarehouse(para) + .then((response) => { + this.deleteLoading = false; + if (response.code !== 20000) { + this.$message.error(response.message); + return false; + } + this.$message.success("删除成功"); + this.loadSubData(row.parentId); + }) + .catch(() => { + this.deleteLoading = false; + }); + }) + .catch(() => { + this.$message.info("取消删除"); + }); } - 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); + //添加分库 + forSubSubmit() { + + if (this.$isBlank(this.subData.name)) { + this.$message.error("分库名称不能为空!"); + return; } + saveSubWarehouse(this.subData, this.subFromName).then((response) => { + if (response.code == 20000) { + this.loadSubData(this.subData.parentId); + this.subFormVisible = false; + } else { + this.$message.error(response.message); + this.subFormVisible = false; + } + }).catch(() => { + this.subFormVisible = false; + }); + }, + + formSubmit() { + if (!isBlank(this.formData.code)) { + if (Number(this.formData.code) + '' === NaN + '') { + this.$message.error("仓库编码格式错误!") + return; + } + } + this.$refs["dataForm"].validate((valid) => { if (valid) { this.formLoading = true; @@ -491,11 +603,6 @@ export default { 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(); @@ -570,14 +677,59 @@ export default { getBasicThirdSys(query) .then((response) => { this.thirdSys = response.data.list || []; + this.query.thirdSysFk = this.thirdSys[0].thirdId; + this.getThirdSysDetail(); }) .catch(() => { this.loading = false; this.list = []; }); }, - thirdSysFkChange(thirdSysFk) { - console.log(thirdSysFk); + downloadWarehouse() { + if (null == this.query.thirdSysFk) { + this.$message.warning("请选择需要下载的第三方系统"); + return; + } + this.getQueryThirdSysFk(); + let params = { + thirdSysFk: this.query.thirdSysFk + } + this.getQueryThirdSysFkName(); + download(params).then((res) => { + if (res.code == 20000) { + this.$message.success("下载完成"); + this.getList(); + } else { + this.$message.error(res.message); + } + }).catch((error) => { + this.$message.error("下载失败"); + }) + }, + thirdSysFkChange() { + this.getThirdSysDetail(); + }, + + getThirdSysDetail() { + let query = { + thirdSysFk: this.query.thirdSysFk, + key: "warehouseQueryUrl", + }; + filterDetailByKey(query) + .then((response) => { + if (response.code == 20000) { + if (response.data != null) { + this.thirdSysDetail = response.data; + } else { + + } + } + + }) + .catch(() => { + this.loading = false; + this.list = []; + }); }, getSyncConfig() { findConfig() @@ -589,7 +741,8 @@ export default { .catch(() => { }); }, - }, + } + , filters: { statusFilterType(status) { const statusMap = { @@ -597,24 +750,30 @@ export default { 1: "success", }; return statusMap[status]; - }, + } + , statusFilterName(status) { const statusMap = { 0: "禁用", 1: "正常", }; return statusMap[status]; - }, - }, + } + , + } + , mounted() { - }, + } + , created() { // 加载表格数据 this.getBasicThirdSys(); this.getSyncConfig(); this.getList(); - }, -}; + } + , +} +;