From 07129bdeff5608b1633e63e1d164cd575e10ab91 Mon Sep 17 00:00:00 2001 From: anthonyywj2 <353682448@qq.com> Date: Thu, 30 Jun 2022 14:46:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=89=AB=E7=A0=81=E5=8D=95?= =?UTF-8?q?=E6=8D=AE=E9=BB=98=E8=AE=A4=E9=80=89=E6=8B=A9=EF=BC=8C=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=90=8E=E6=97=A0=E6=B3=95=E9=80=89=E6=8B=A9=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/admin.js | 51 +- src/store/mutation-types.js | 2 + .../business/stockOrderNewDistribution.vue | 49 +- src/views/home/index.vue | 27 +- src/views/inout/IOAddOrder.vue | 24 +- src/views/inventory/InvProducts.vue | 767 +++++++++--------- 6 files changed, 505 insertions(+), 415 deletions(-) diff --git a/src/store/modules/admin.js b/src/store/modules/admin.js index bb292bb..e6e8778 100644 --- a/src/store/modules/admin.js +++ b/src/store/modules/admin.js @@ -1,6 +1,6 @@ -import { userInfo, loginName, logout } from "../../api/auth/login"; +import {userInfo, loginName, logout} from "../../api/auth/login"; import * as types from "../mutation-types"; -import { constantRouterMap } from "../../router"; +import {constantRouterMap} from "../../router"; import { getToken, setToken, @@ -10,20 +10,22 @@ import { removeAdminId } from "../../utils/auth"; // import { $NOT_NETWORK } from '../../utils/errorCode' -import { Message } from "element-ui"; -import {RECEIVE_ADMIN_EMPLOY_NAME, RECEIVE_LOCINVCODE, RECEIVE_LOCSUBINVCODE} from "../mutation-types"; +import {Message} from "element-ui"; +import {RECEIVE_ADMIN_EMPLOY_NAME} from "../mutation-types"; // initial state const state = { adminId: getAdminId(), // id userName: "", // 昵称 - employeeName:null, + employeeName: null, avatar: "", // 头像 token: getToken(), // 登录token authRules: [], // 权限列表 routers: constantRouterMap, // 路由列表 - locInvCode:"", - locSubInvCode:"" + locInvCode: "", + locSubInvCode: "", + locInvName: "", + locSubInvName: "" }; // getters @@ -35,21 +37,23 @@ const getters = { token: state => state.token, authRules: state => state.authRules, routers: state => state.routers, - locInvCode:state => state.locInvCode, - locSubInvCode:state => state.locSubInvCode, + locInvCode: state => state.locInvCode, + locSubInvCode: state => state.locSubInvCode, + locInvName: state => state.locInvName, + locSubInvName: state => state.locSubInvName, }; // actions const actions = { // 用户名登录 - loginName({ commit }, userInfo) { + loginName({commit}, userInfo) { const userName = userInfo.userName ? userInfo.userName.trim() : ""; const pwd = userInfo.pwd ? userInfo.pwd : ""; return new Promise((resolve, reject) => { loginName(userName, pwd) .then(response => { console.log(response); - if (response.code!=20000) { + if (response.code != 20000) { Message({ message: response.message, type: "error", @@ -68,7 +72,7 @@ const actions = { }); }); }, - userInfo({ commit }) { + userInfo({commit}) { return new Promise((resolve, reject) => { userInfo() .then(response => { @@ -77,6 +81,7 @@ const actions = { } const data = response.data || {}; commit(types.RECEIVE_ADMIN_NAME, data.userName); + commit(types.RECEIVE_ADMIN_EMPLOY_NAME, data.employeeName); commit(types.RECEIVE_ADMIN_AVATAR, data.avatar); commit(types.RECEIVE_ADMIN_AUTH_RULES, data.authRules); @@ -88,7 +93,7 @@ const actions = { }); }, // 登出 - loginOut({ commit }) { + loginOut({commit}) { return new Promise((resolve, reject) => { logout() .then(() => { @@ -97,6 +102,8 @@ const actions = { commit(types.RECEIVE_ADMIN_AUTH_RULES, []); commit(types.RECEIVE_LOCINVCODE, ""); commit(types.RECEIVE_LOCSUBINVCODE, ""); + commit(types.RECEIVE_LOCINVNAME, ""); + commit(types.RECEIVE_LOCSUBINVNAME, ""); resolve(); }) .catch(error => { @@ -106,13 +113,15 @@ const actions = { }, // 前端 登出 - fedLogout({ commit }) { + fedLogout({commit}) { return new Promise(resolve => { commit(types.RECEIVE_ADMIN_ID, ""); commit(types.RECEIVE_ADMIN_TOKEN, ""); commit(types.RECEIVE_ADMIN_AUTH_RULES, []); commit(types.RECEIVE_LOCINVCODE, ""); commit(types.RECEIVE_LOCSUBINVCODE, ""); + commit(types.RECEIVE_LOCINVNAME, ""); + commit(types.RECEIVE_LOCSUBINVNAME, ""); resolve(); }); }, @@ -122,8 +131,8 @@ const actions = { * @param data * @returns {Promise} */ - filterRouter({ commit }, data) { - const { accessedRouters } = data; + filterRouter({commit}, data) { + const {accessedRouters} = data; if (accessedRouters && accessedRouters.length > 0) { commit(types.RECEIVE_ROUTERS, accessedRouters); } @@ -151,6 +160,9 @@ const mutations = { [types.RECEIVE_ADMIN_NAME](state, userName) { state.userName = userName; }, + [types.RECEIVE_ADMIN_EMPLOY_NAME](state, employeeName) { + state.employeeName = employeeName; + }, [types.RECEIVE_ADMIN_AVATAR](state, avatar) { state.avatar = avatar; }, @@ -167,6 +179,13 @@ const mutations = { [types.RECEIVE_LOCSUBINVCODE](state, locSubInvCode) { state.locSubInvCode = locSubInvCode; }, + [types.RECEIVE_LOCINVNAME](state, locInvName) { + state.locInvName = locInvName; + }, + [types.RECEIVE_LOCSUBINVNAME](state, locSubInvName) { + state.locSubInvName = locSubInvName; + }, + }; export default { diff --git a/src/store/mutation-types.js b/src/store/mutation-types.js index 3f78e5b..905be9e 100644 --- a/src/store/mutation-types.js +++ b/src/store/mutation-types.js @@ -14,3 +14,5 @@ export const RECEIVE_ADMIN_AUTH_RULES = "RECEIVE_ADMIN_AUTH_RULES"; // 权限列 export const RECEIVE_ROUTERS = "RECEIVE_ROUTERS"; // 初始化路由表 export const RECEIVE_LOCINVCODE = "RECEIVE_LOCINVCODE"; // 当前仓库 export const RECEIVE_LOCSUBINVCODE = "RECEIVE_LOCSUBINVCODE"; // 当前分库 +export const RECEIVE_LOCINVNAME = "RECEIVE_LOCINVNAME"; // 当前仓库 +export const RECEIVE_LOCSUBINVNAME = "RECEIVE_LOCSUBINVNAME"; // 当前分库 diff --git a/src/views/business/stockOrderNewDistribution.vue b/src/views/business/stockOrderNewDistribution.vue index 0088da4..e407919 100644 --- a/src/views/business/stockOrderNewDistribution.vue +++ b/src/views/business/stockOrderNewDistribution.vue @@ -68,10 +68,9 @@ - + @change="actionChange"> { if (valid) { if (this.codeArray.length < 1) { @@ -593,7 +596,7 @@ export default { filterAllByUser() .then((response) => { this.storageList = response.data || []; - this.invChange(); + this.findSubInvs(); }) .catch(() => { }); @@ -1160,22 +1163,14 @@ export default { } }, actionChange(item) { - // console.log("item = " + item); - // if (item == '') { - // this.formData.locStorageCode == null; - // } else { this.curAction = this.getActionItem(item); - if (this.curAction.storageCode != null) - this.formData.locStorageCode = this.curAction.storageCode; + this.formData.corpName = ''; + this.locInChange(); this.findMethod(); - // } - }, - locInChange(item) { - console.log(item); - this.formData.locStorageCode = item; + locInChange() { this.$forceUpdate(); - this.getBusType(item); + this.getBusType(); this.invChange(); this.findStorageMethod(); }, @@ -1183,6 +1178,10 @@ export default { if (this.$isNotBlank(this.formData.invWarehouseCode)) this.formData.invWarehouseCode = null; + this.findSubInvs(); + }, + + findSubInvs() { this.subInvList = []; let query = { pcode: this.formData.locStorageCode @@ -1196,7 +1195,9 @@ export default { }) .catch(() => { }); - }, + } + + }, filters: {}, mounted() { @@ -1208,7 +1209,6 @@ export default { created() { this.getBusType("NOCODE"); this.getStorage(); - this.formData = {noInvOut: false, locStorageCode: null, invWarehouseCode: null}; this.codeArray = []; this.closeConfirmFunction(false); if (this.$isNotBlank(this.idQuery.id)) { @@ -1220,10 +1220,16 @@ export default { this.getStockOrderDetailList(); } else { this.formData = { + billNo: null, billdate: "", customerId: store.getters.customerId, billType: "", type: "2", + corpName: "", + corpId: "", + noInvOut: "", + locStorageCode: store.getters.locInvCode, + invWarehouseCode: store.getters.locSubInvCode, }; this.iCount = 0; this.orderEditor = false; @@ -1244,6 +1250,13 @@ export default { margin-top: 10px; } +/** +解决el-input输入框 type=number时,输入中文光标上移问题 + */ +.el-input__inner { + line-height: 1px !important; +} + diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 446d20c..43df41f 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -82,10 +82,10 @@
- {{ employName }} + - {{ username }} + {{ title }} 切换仓库 修改密码 @@ -263,7 +263,6 @@ import store from "../../store/index"; import {filterAllByUser} from "@/api/basic/invWarehouse"; import {filterSubByInv} from "@/api/basic/invSubWarehouse"; import {updateInv} from "@/api/auth/authAdmin"; -import {RECEIVE_LOCINVCODE} from "@/store/mutation-types"; import * as types from "../../store/mutation-types"; export default { @@ -333,6 +332,7 @@ export default { selInvVisible: false, locInvName: "", locSubInvName: "", + title: "udi管理系统", }; }, components: { @@ -346,9 +346,9 @@ export default { return this.$route.path; }, username() { - let username = this.$store.state.admin.userName; - let rUserName = !username ? this.name : username; - return username + "(" + this.locInvName + " " + this.locSubInvName + ")"; + + let username = this.$store.getters.employeeName; + return username + "(" + this.$store.getters.locInvName + " " + this.$store.getters.locSubInvName + ")"; }, isCollapse() { return false; @@ -426,7 +426,7 @@ export default { filterSubByInv(query) .then((response) => { this.subInvList = response.data || []; - if (this.subInvList != null && this.subInvList.length == 1) { + if (this.subInvList != null && this.subInvList.length > 1) { this.userInfo.locSubInvCode = this.subInvList[0].code; } @@ -438,6 +438,7 @@ export default { userInfo() .then((response) => { if (response.code == 20000) { + this.userInfo = response.data; this.locInvName = this.userInfo.locInvName; this.locSubInvName = this.userInfo.locSubInvName; @@ -446,7 +447,10 @@ export default { } else { this.$store.commit(types.RECEIVE_LOCINVCODE, this.userInfo.locInvCode); this.$store.commit(types.RECEIVE_LOCSUBINVCODE, this.userInfo.locSubInvCode); - + this.$store.commit(types.RECEIVE_LOCINVNAME, this.locInvName); + this.$store.commit(types.RECEIVE_LOCSUBINVNAME, this.locInvName); + let username = this.$store.getters.employeeName; + this.title = username + "(" + this.$store.getters.locInvName + " " + this.$store.getters.locSubInvName + ")"; this.getStorage(); } } @@ -539,6 +543,7 @@ export default { }, }, created() { + console.log("监听变化。,,,,,,,,,,,,,,,,,,,,,,,,,,,"); this.getBreadcrumb(); this.getCompanyData(); this.getStorage(); @@ -548,8 +553,14 @@ export default { }, watch: { $route() { + this.getBreadcrumb(); }, + '$store.state.admin.userName'() { + this.getUserInfo(); + } + + }, }; diff --git a/src/views/inout/IOAddOrder.vue b/src/views/inout/IOAddOrder.vue index 318c13b..58e0986 100644 --- a/src/views/inout/IOAddOrder.vue +++ b/src/views/inout/IOAddOrder.vue @@ -661,9 +661,10 @@ export default { this.formData.produceDate = ""; this.formData.expireDate = ""; this.formData.serialNo = ""; + if (event != null) { + event.target.select(); + } this.actionEnable = true; - if (event == null) { - } else event.target.select(); this.$refs.inputRef.select(); if (this.$isBlank(this.formData.action)) { this.$message.warning("请选择单据类型!"); @@ -683,6 +684,14 @@ export default { this.$message.error('当前往来单位不能为空'); return; } + + if(this.curAction.corpType ==1){ + if (this.$isBlank(this.formData.fromSubInvCode)) { + this.$message.error('当前往来分库不能为空'); + return; + } + } + if (this.$isBlank(this.formData.corpOrderId)) { let date = new Date(); this.formData.corpOrderId = parseTime(date, '{y}{m}{d}{h}{i}{s}') + Math.ceil(Math.random() * 89 + 10); @@ -792,7 +801,7 @@ export default { this.curRow = row; }, storageChange(row) { - console.log(row); + this.formData.fromSubInvCode = ""; this.formData.fromCorpId = row.code; this.formData.fromCorp = row.name; this.findSubStorageMethod(); @@ -967,7 +976,7 @@ export default { .then((response) => { this.subInvList = response.data || []; if (this.subInvList != null && this.subInvList.length == 1) { - this.formData.invWarehouseCode = this.subInvList[0].code; + // this.formData.invWarehouseCode = this.subInvList[0].code; } }) .catch(() => { @@ -1161,10 +1170,15 @@ export default { this.query = Object.assign(this.query, query); this.query.limit = parseInt(this.query.limit); this.query.corpOrderId = query.id; - // 加载表格数据 // this.getCodeList(); } + this.formData.invWarehouseCode = this.$store.getters.locSubInvCode; + this.formData.locStorageCode = this.$store.getters.locInvCode; + + if (this.$isNotBlank(this.formData.locStorageCode)) { + this.findStorageMethod(); + } } diff --git a/src/views/inventory/InvProducts.vue b/src/views/inventory/InvProducts.vue index f4cb843..8c0e258 100644 --- a/src/views/inventory/InvProducts.vue +++ b/src/views/inventory/InvProducts.vue @@ -1,166 +1,168 @@