出库入库调拨3个模块的添加编辑增加辅助单位,辅助数量根多单位是否启用是否浮动获辅助数量是否编辑的逻辑
New file |
| | |
| | | export default (() => { |
| | | const getDateObj = ms => { |
| | | const now = ms ? new Date(ms) : new Date() |
| | | const y = now.getFullYear() |
| | | let m = now.getMonth() + 1 |
| | | m = m > 9 ? m : '0' + m |
| | | let d = now.getDate() |
| | | d = d > 9 ? d : '0' + d |
| | | return { y, m, d } |
| | | } |
| | | // 获取当前日期 |
| | | const getCurrentDate = ms => { |
| | | const dateObj = getDateObj(ms) |
| | | return '' + dateObj.y + '-' + dateObj.m + '-' + dateObj.d |
| | | } |
| | | //获取当前 前后N天的时间 |
| | | const getDateStr = (AddDayCount = 0) => { |
| | | let dd = new Date() |
| | | dd.setDate(dd.getDate() + AddDayCount) |
| | | let y = dd.getFullYear() |
| | | let m = (dd.getMonth() + 1) < 10 ? '0' + (dd.getMonth() + 1) : (dd.getMonth() + 1) //获取当前月份的日期,不足10补0 |
| | | let d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() //获取当前几号,不足10补0 |
| | | return y + '-' + m + '-' + d |
| | | } |
| | | //获取某个日期 前后N天的时间 |
| | | const getDateDay2 = (time, AddDayCount) => { |
| | | if (time) { |
| | | let dd = new Date(time) |
| | | dd.setDate(dd.getDate() + AddDayCount) |
| | | let y = dd.getFullYear() |
| | | let m = (dd.getMonth() + 1) < 10 ? '0' + (dd.getMonth() + 1) : (dd.getMonth() + 1) //获取当前月份的日期,不足10补0 |
| | | let d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() //获取当前几号,不足10补0 |
| | | return y + '-' + m + '-' + d |
| | | } else { |
| | | return '--' |
| | | } |
| | | } |
| | | //获取当前年份 |
| | | const getCurrentYear = ms => { |
| | | const dateObj = getDateObj(ms) |
| | | return '' + dateObj.y |
| | | } |
| | | // 获取当前月份 |
| | | const getCurrentMonth = ms => { |
| | | const dateObj = getDateObj(ms) |
| | | return '' + dateObj.y + '-' + dateObj.m |
| | | } |
| | | // 获取上月月份 |
| | | const getPreviousMonth = ms => { |
| | | const dateObj = getDateObj(ms) |
| | | const b = dateObj.m - 1 > 0 |
| | | let y = b ? dateObj.y : dateObj.y - 1 |
| | | let m = b ? dateObj.m - 1 : 12 |
| | | m = m > 9 ? m : '0' + m |
| | | return '' + y + '-' + m |
| | | } |
| | | // 获取下月月份 |
| | | const getNextMonth = ms => { |
| | | const dateObj = getDateObj(ms) |
| | | const b = dateObj.m - (-1) != 13; |
| | | let y = b ? dateObj.y : dateObj.y + 1 |
| | | let m = b ? dateObj.m - (-1) : 1 |
| | | m = m > 9 ? m : '0' + m |
| | | return '' + y + '-' + m |
| | | } |
| | | // 格式化时间 ==> yyyy-mm-dd |
| | | const formatDate = (value, str) => { |
| | | if (value) { |
| | | let date_arr = value.split(str) |
| | | let m = date_arr[1].length == 1 && date_arr[1] < 10 ? '0' + date_arr[1] : date_arr[1] |
| | | let d = date_arr[2].length == 1 && date_arr[2] < 10 ? '0' + date_arr[2] : date_arr[2] |
| | | return date_arr[0] + '-' + m + '-' + d |
| | | } else { |
| | | return '--' |
| | | } |
| | | } |
| | | const getK = value => { |
| | | if (value) { |
| | | let date = new Date(value) |
| | | return date |
| | | } else { |
| | | let v = new Date().getTime() |
| | | return v |
| | | } |
| | | } |
| | | //转为时间戳 |
| | | const formatTime = value => { |
| | | if (value) { |
| | | let date = new Date(value) |
| | | return date.getTime() |
| | | } |
| | | } |
| | | const formatDate2 = (time, format = 'YY-MM-DD hh:mm:ss') => { |
| | | if (time) { |
| | | let date = time ? new Date(time) : new Date() |
| | | let year = date.getFullYear(), |
| | | month = date.getMonth() + 1, //月份是从0开始的 |
| | | day = date.getDate(), |
| | | hour = date.getHours(), |
| | | min = date.getMinutes(), |
| | | sec = date.getSeconds() |
| | | let preArr = Array.apply(null, Array(10)).map(function (elem, index) { |
| | | return '0' + index |
| | | }) //开个长度为10的数组 格式为 00 01 02 03 |
| | | |
| | | let newTime = format |
| | | .replace(/YY/g, year) |
| | | .replace(/MM/g, preArr[month] || month) |
| | | .replace(/DD/g, preArr[day] || day) |
| | | .replace(/hh/g, preArr[hour] || hour) |
| | | .replace(/mm/g, preArr[min] || min) |
| | | .replace(/ss/g, preArr[sec] || sec) |
| | | |
| | | return newTime |
| | | } else { |
| | | return '--' |
| | | } |
| | | } |
| | | |
| | | const getLastDay = dateStr => { |
| | | dateStr = dateStr || getCurrentMonth() |
| | | let nextMonthMS = new Date(getNextMonth(new Date(dateStr).getTime())).getTime() |
| | | return getCurrentDate(new Date(nextMonthMS - 1000 * 60 * 60 * 24).getTime()) |
| | | } |
| | | |
| | | // 对比时间 |
| | | const compareTime = (date1, date2) => { |
| | | let d1_date1 = new Date(date1), |
| | | d1_date2 = new Date(date2); |
| | | let time_span1 = d1_date1.getTime(), |
| | | time_span2 = d1_date2.getTime(); |
| | | return time_span1 - time_span2; |
| | | } |
| | | //格式yy-mm month1小的 month2大的 |
| | | const intervalMonth = (month1, month2) => { |
| | | let yearMonth, number; |
| | | let year1 = Number(getCurrentYear(month1)); |
| | | let year2 = Number(getCurrentYear(month2)); |
| | | if (year1 != year2) { |
| | | yearMonth = (year2 - year1) * 12; |
| | | } else { |
| | | yearMonth = 0; |
| | | } |
| | | let min = Number(month1.split('-')[1]); |
| | | let max = Number(month2.split('-')[1]); |
| | | if (min < max) { |
| | | number = max - min + yearMonth + 1 |
| | | } else { |
| | | number = yearMonth - (min - max) + 1 |
| | | } |
| | | return Number(number); |
| | | } |
| | | //获取季度的时间 val 例如 yyyy,1 最终结果 yyyy-mm-dd,yyyy-mm-dd |
| | | const qurterDay = (val) => { |
| | | let value; |
| | | let num = val.split(',')[1] |
| | | if (num == 1) { |
| | | value = val.split(',')[0] + '-01-01,' + val.split(',')[0] + '-03-31' |
| | | } else if (num == 2) { |
| | | value = val.split(',')[0] + '-04-30,' + val.split(',')[0] + '-06-30' |
| | | } else if (num == 3) { |
| | | value = val.split(',')[0] + '-07-31,' + val.split(',')[0] + '-09-30' |
| | | } else if (num == 4) { |
| | | value = val.split(',')[0] + '-10-30,' + val.split(',')[0] + '-12-31' |
| | | } |
| | | return [value, num]; |
| | | } |
| | | //获取某月最后一天 |
| | | const getMonthLastDay = (dateStr) => { |
| | | let dateObj = getNextMonth(dateStr) |
| | | let date = getDateDay2(dateObj + '-01', -1) |
| | | return date |
| | | } |
| | | /*获取当前日期*/ |
| | | const getWeekdayTime = (value) => { |
| | | let d = new Date(value) |
| | | let week = d.getDay() |
| | | let weekday = '' |
| | | if (week == 0) |
| | | weekday = '星期日' |
| | | else if (week == 1) |
| | | weekday = '星期一' |
| | | else if (week == 2) |
| | | weekday = '星期二' |
| | | else if (week == 3) |
| | | weekday = '星期三' |
| | | else if (week == 4) |
| | | weekday = '星期四' |
| | | else if (week == 5) |
| | | weekday = '星期五' |
| | | else if (week == 6) |
| | | weekday = '星期六' |
| | | return weekday |
| | | } |
| | | //计算当前时间到今天结束时还剩多少 毫秒 |
| | | const getRestOfDayTime = () => { |
| | | let x = new Date(); |
| | | x.setHours(0, 0, 0, 0); |
| | | let y = new Date(); |
| | | return 24 * 3600 * 1000 - (y.getTime() - x.getTime()) |
| | | } |
| | | /* 用于月日这种需要加前置0的方法 |
| | | * @param num 需要加0的参数 string | number |
| | | * @return 结果 始终保证结果为字符串 string |
| | | */ |
| | | const paddingZero = (num) => { |
| | | return num < 10 ? "0" + num : String(num) |
| | | } |
| | | return { paddingZero, getDateObj, getCurrentDate, getDateStr, getDateDay2, getCurrentYear, getCurrentMonth, getPreviousMonth, getNextMonth, formatDate, formatDate2, formatTime, getK, compareTime, getLastDay, intervalMonth, getMonthLastDay, qurterDay, getWeekdayTime, getRestOfDayTime } |
| | | })() |
| | |
| | | method: "get", |
| | | data |
| | | }) |
| | | } |
| | | // 月度统计报表 |
| | | export function getmonthStats(data) { |
| | | return request({ |
| | | url: "/api-wms/v1/forms/monthStats", |
| | | method: "post", |
| | | data |
| | | }) |
| | | } |
| | |
| | | const product = (resolve) => require(["@/views/productManage/product/index"], resolve) // 产品 |
| | | const inboundOutboundDetail = (resolve) => require(["@/views/reportForm/inboundOutboundDetail/index"], resolve) // 入库明细报表 |
| | | const outboundDetail = (resolve) => require(["@/views/reportForm/outboundDetail/index"], resolve) // 入库明细报表 |
| | | const monthboundDetail= (resolve) => require(["@/views/reportForm/monthboundDetail/index"], resolve) // 月度明细报表 |
| | | const productCategory = (resolve) => require(["@/views/productManage/productCategory/index"], resolve) // 产品类别 |
| | | const productList = (resolve) => require(["@/views/productManage/productCategory/ProductList"], resolve) // 产品类别-产品 |
| | | const overviewList = (resolve) => require(["@/views/overview/OverviewListView"], resolve) // 概述-产品列表 |
| | |
| | | } |
| | | }, |
| | | { |
| | | path: "/reportForm/monthboundDetail", |
| | | name: "monthboundDetail", |
| | | component: monthboundDetail, |
| | | meta: { |
| | | title: "月度统计报表" |
| | | } |
| | | }, |
| | | { |
| | | path: "/productManage/productList", |
| | | name: "productList", |
| | | component: productList, |
| | |
| | | const inventoryReport = (resolve) => require(["@/views/reportForm/inventoryReport/index"], resolve) // 库存报表 |
| | | const locationReport = (resolve) => require(["@/views/reportForm/locationReport/index"], resolve) // 位置报表 |
| | | const inboundOutboundDetail = (resolve) => require(["@/views/reportForm/inboundOutboundDetail/index"], resolve) // 历史记录 |
| | | const monthboundDetail= (resolve) => require(["@/views/reportForm/monthboundDetail/index"], resolve) // 月度明细报表 |
| | | |
| | | const appconfig = [ |
| | | { |
| | |
| | | meta: { |
| | | title: "入库明细报表" |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | path: "/reportForm/monthboundDetail", |
| | | name: "monthboundDetail", |
| | | component: monthboundDetail, |
| | | meta: { |
| | | title: "月度统计报表" |
| | | } |
| | | }, |
| | | ] |
| | | |
| | | export default appconfig |
| | |
| | | numberLabel: "单号", |
| | | TabsIndex: "0", |
| | | productTableList: {}, |
| | | showBottomCol: ["产品编号", "产品名称", "产品规格", "产品型号", "计量单位", "调出位置", "调入位置", "数量","主管","会计","保管员",'辅助数量','辅助单位'], |
| | | showBottomCol: ["产品编号", "产品名称", "产品规格", "产品型号", "计量单位", "调出位置", "调入位置", "数量","主管","会计","保管员",'辅助数量','辅助单位','毛重','总毛重','净重','总净重'], |
| | | tableBottomColumn: [], |
| | | selectRow: {}, |
| | | productColumn: [ |
| | |
| | | { label: "数量", prop: "amount" }, |
| | | { label: "计量单位", prop: "unit" }, |
| | | { label: "辅助数量", prop: "adjunctAmount" }, |
| | | { label: "辅助单位", prop: "adjunctUnit" } |
| | | { label: "辅助单位", prop: "adjunctUnit" }, |
| | | { label: "毛重", prop: "grossWeight" }, |
| | | { label: "总毛重", prop: "totalGrossWeight" }, |
| | | { label: "净重", prop: "netWeight" }, |
| | | { label: "总净重", prop: "totalNetWeight" } |
| | | ], |
| | | allotProductColumn: [ |
| | | { label: "产品编号", prop: "id", default: true }, |
| | |
| | | { label: "调入位置", prop: "toLocation" }, |
| | | { label: "数量", prop: "amount" }, |
| | | { label: "辅助数量", prop: "adjunctAmount" }, |
| | | { label: "辅助单位", prop: "adjunctUnit" } |
| | | { label: "辅助单位", prop: "adjunctUnit" }, |
| | | { label: "毛重", prop: "grossWeight" }, |
| | | { label: "总毛重", prop: "totalGrossWeight" }, |
| | | { label: "净重", prop: "netWeight" }, |
| | | { label: "总净重", prop: "totalNetWeight" } |
| | | ] |
| | | } |
| | | }, |
| | |
| | | // bottom产品信息数据处理 |
| | | bottomProductData(arr) { |
| | | const list = arr.details.map((item) => { |
| | | let adjunctUnit='' |
| | | let adjunctAmount='' |
| | | if(item.product.moreUnit&&item.product.moreUnitList){ |
| | | let moreUnitList=item.product.moreUnitList |
| | | if(moreUnitList.length>0){ |
| | | for(let j in moreUnitList){ |
| | | if(moreUnitList[j].floating){ |
| | | adjunctUnit=moreUnitList[j].unit |
| | | adjunctAmount=moreUnitList[j].amount |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // let adjunctUnit='' |
| | | // let adjunctAmount='' |
| | | // if(item.product.moreUnit&&item.product.moreUnitList){ |
| | | // let moreUnitList=item.product.moreUnitList |
| | | // if(moreUnitList.length>0){ |
| | | // let isValue=false |
| | | // for(let j in moreUnitList){ |
| | | // if(moreUnitList[j].floating){ |
| | | // isValue=true; |
| | | // adjunctUnit=moreUnitList[j].unit |
| | | // adjunctAmount=moreUnitList[j].amount |
| | | // break; |
| | | // } |
| | | // } |
| | | // if(!isValue){ |
| | | // for(let j in moreUnitList){ |
| | | // if(moreUnitList[j].unit){ |
| | | // adjunctUnit=moreUnitList[j].unit |
| | | // adjunctAmount=moreUnitList[j].amount |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | return { |
| | | ...item, |
| | | productName: item.product.name, |
| | | unit: item.product.unit, |
| | | model:item.product.model, |
| | | specs:item.product.specs, |
| | | location: arr.location.name, |
| | | toLocation: arr.toLocation.name, |
| | | adjunctUnit:adjunctUnit, |
| | | adjunctAmount:adjunctAmount |
| | | adjunctUnit:item.auxiliaryUnit, |
| | | adjunctAmount:item.auxiliaryAmount, |
| | | grossWeight:item.product.grossWeight, |
| | | totalGrossWeight:item.totalGrossWeight, |
| | | netWeight:item.product.netWeight, |
| | | totalNetWeight:item.totalNetWeight, |
| | | } |
| | | }) |
| | | this.productTableList.tableInfomation = list |
| | |
| | | handleAdd() { |
| | | this.BomTableData=this.thatEditRow.BomTableData |
| | | this.BomTableData.push({ name: "", isDefault: false }); |
| | | debugger |
| | | this.$nextTick(()=>{ |
| | | setTimeout(() => { |
| | | this.$refs.unitTable.bodyWrapper.scrollTop=this.$refs.unitTable.bodyWrapper.scrollHeight |