Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override
New file |
| | |
| | | //鼠标滑动选中 |
| | | import {nextTick, ref,reactive} from "vue"; |
| | | import {ElMessage} from "element-plus"; |
| | | |
| | | let isSelecting = ref(false) // 是否正在进行选择操作,默认为false |
| | | let selectionStart = reactive({ rowIndex: -1, cellIndex: -1 }) // 选择操作起始单元格位置 |
| | | let selectionEnd = reactive({ rowIndex: -1, cellIndex: -1 }) // 选择操作结束单元格位置 |
| | | let gridOptions =reactive({ |
| | | rowConfig:{height:30} |
| | | }) |
| | | //获取页面ref节点 |
| | | //获取vxetable表格节点 |
| | | let xGrid = ref() |
| | | let cellarea = ref(` |
| | | <div class="vxe-table--cell-area" > |
| | | <span class="vxe-table--cell-main-area" ></span> |
| | | <span class="vxe-table--cell-active-area" ></span> |
| | | </div> |
| | | `) |
| | | let leftfixedcellarea = ref() |
| | | let rightfixedcellarea = ref() |
| | | const getTablexGrid = () => { |
| | | return xGrid.value |
| | | } |
| | | |
| | | //添加事件 |
| | | const addListener = (xGrids,gridOption) => { |
| | | xGrid.value = xGrids |
| | | gridOptions = gridOption |
| | | let newElement = document.createElement('div') |
| | | const parser = new DOMParser(); |
| | | const htmlDoc = parser.parseFromString(cellarea.value, 'text/html') |
| | | newElement.innerHTML = htmlDoc.body.innerHTML |
| | | //cellarea.value = newElement |
| | | //添加多选列 |
| | | nextTick(() => { |
| | | window.addEventListener("mousedown", tableOutDestroyAreaBox)//给window添加鼠标按下事件,判断是否在表格外,是销毁 |
| | | window.addEventListener("mouseup", tbodymouseup)//给window添加鼠标松开事件 |
| | | let tbody = getTablexGrid().$el.querySelector(".vxe-table--main-wrapper table tbody")//获取tbody区域 |
| | | |
| | | if (tbody) { |
| | | tbody.addEventListener("mousedown", tbodymousedown)//给表格中的tbody添加鼠标按下事件 |
| | | tbody.addEventListener("mousemove", tbodymousemove)//给表格中的tbody添加鼠标移动事件 |
| | | tbody.addEventListener("mouseout", throttle(tbodymouseout, 50))//给表格中的tbody添加鼠标移出事件 |
| | | tbody.addEventListener("click", tableCellClick)//添加左键单击事件 |
| | | //tbody.oncontextmenu = tableCellMenuClick//添加右键菜单事件 |
| | | } |
| | | let bodyWrapper = getTablexGrid().$el.querySelector(".vxe-table--main-wrapper .vxe-table--body-wrapper")//获取正常区域的body |
| | | if (bodyWrapper) { |
| | | //注意这里的ref名称,这里是非fixed区域的框的名称 |
| | | bodyWrapper.appendChild(newElement)//添加范围框元素 |
| | | // let geticon = document.getElementById("getIcon") |
| | | // geticon.addEventListener("click", ()=>{ |
| | | // alert(2) |
| | | // }) |
| | | |
| | | } |
| | | /*setTimeout(() => { |
| | | //#region 左侧固定列 |
| | | let leftfixedtbody = getTablexGrid().$el.querySelector(".vxe-table--fixed-wrapper .vxe-table--fixed-left-wrapper .vxe-table--body-wrapper table tbody")//获取fixedtbody区域 |
| | | |
| | | if (leftfixedtbody) { |
| | | leftfixedtbody.addEventListener("mousedown", tbodymousedown)//给表格中的leftfixedtbody添加鼠标按下事件 |
| | | leftfixedtbody.addEventListener("mousemove", tbodymousemove)//给表格中的leftfixedtbody添加鼠标移动事件 |
| | | leftfixedtbody.addEventListener("mouseout", throttle(tbodymouseout, 50))//给表格中的leftfixedtbody添加鼠标移出事件 |
| | | leftfixedtbody.addEventListener("click", tableCellClick)//添加单击事件 |
| | | leftfixedtbody.oncontextmenu = tableCellMenuClick//添加右键菜单事件 |
| | | } |
| | | |
| | | let leftFixedBodyWrapper = getTablexGrid().$el.querySelector(".vxe-table--fixed-wrapper .vxe-table--fixed-left-wrapper .vxe-table--body-wrapper") |
| | | if (leftFixedBodyWrapper) { |
| | | //注意这里的ref名称,这里是fixed区域的框的名称 |
| | | leftFixedBodyWrapper.appendChild(leftfixedcellarea.value) |
| | | } |
| | | //#endregion |
| | | |
| | | //#region 右侧固定列 |
| | | let rightfixedtbody = getTablexGrid().$el.querySelector(".vxe-table--fixed-wrapper .vxe-table--fixed-right-wrapper .vxe-table--body-wrapper table tbody")//获取fixedtbody区域 |
| | | |
| | | if (rightfixedtbody) { |
| | | rightfixedtbody.addEventListener("mousedown", tbodymousedown)//给表格中的rightfixedtbody添加鼠标按下事件 |
| | | rightfixedtbody.addEventListener("mousemove", tbodymousemove)//给表格中的rightfixedtbody添加鼠标移动事件 |
| | | rightfixedtbody.addEventListener("mouseout", throttle(tbodymouseout, 50))//给表格中的rightfixedtbody添加鼠标移出事件 |
| | | rightfixedtbody.addEventListener("click", tableCellClick)//添加单击事件 |
| | | rightfixedtbody.oncontextmenu = tableCellMenuClick//添加右键菜单事件 |
| | | } |
| | | |
| | | let rightFixedBodyWrapper = getTablexGrid().$el.querySelector(".vxe-table--fixed-wrapper .vxe-table--fixed-right-wrapper .vxe-table--body-wrapper") |
| | | if (rightFixedBodyWrapper) { |
| | | //注意这里的ref名称,这里是fixed区域的框的名称 |
| | | rightFixedBodyWrapper.appendChild(rightfixedcellarea.value) |
| | | } |
| | | //#endregion |
| | | |
| | | }, 100)*/ |
| | | |
| | | }) |
| | | } |
| | | |
| | | //鼠标按下事件 |
| | | const tbodymousedown = (event: MouseEvent) => { |
| | | event.stopPropagation()//阻止冒泡 |
| | | getTablexGrid().closeMenu()//手动关闭右键菜单 |
| | | //左键0,中键1,右键2 |
| | | if (event.button === 0) {//左键按下 |
| | | // 记录选择操作起始位置 |
| | | selectionStart = getCellPosition(event.target)//设置选择操作起始单元格位置 |
| | | |
| | | isSelecting.value = true//标记为正在选择操作 |
| | | } |
| | | } |
| | | |
| | | //鼠标移动事件 |
| | | //todo 这里要节流操作,只在结束时触发一次 |
| | | const tbodymousemove = (event: MouseEvent) => { |
| | | if (event.button === 0) {//左键移动 |
| | | if (!isSelecting.value) return//如果当前非正在选择操作,直接退出 |
| | | //记录选择操作结束位置 |
| | | selectionEnd = getCellPosition(event.target) |
| | | |
| | | //设置样式,并显示范围框 |
| | | setselectedCellArea() |
| | | |
| | | } |
| | | } |
| | | |
| | | //鼠标按键结束事件,添加在了window中 |
| | | const tbodymouseup = (event: MouseEvent) => { |
| | | if (event.button === 0) {//左键松开 |
| | | isSelecting.value = false//标记为停止选择操作 |
| | | } |
| | | } |
| | | |
| | | let outevent = ref()//移动事件,不保存,循环定时器内无法监听到新的事件 |
| | | |
| | | //鼠标移出表格事件,只在移动的时候会触发,暂停移动不触发 |
| | | const tbodymouseout = (event: MouseEvent) => { |
| | | outevent.value = event//保存移动事件 |
| | | |
| | | if (isSelecting.value) {//如果正在执行选中操作 |
| | | const timer = setInterval(() => {//开启循环定时器 |
| | | if (isSelecting.value) {//判断当前是否正在选择 |
| | | //获取表格元素 |
| | | var table = getTablexGrid().$el.querySelector(".vxe-table--body-wrapper table")//获取非固定列(和固定列)的table元素 |
| | | if (outevent.value.clientX > table.parentElement.getBoundingClientRect().right - 30) {//判断鼠标x轴是否超出表格右侧,向右滚动 |
| | | var maxScrollPosition = table.parentElement.scrollWidth - table.parentElement.clientWidth//获取滚动条最大位置 |
| | | if (table.parentElement.scrollLeft < maxScrollPosition) {//如果没到滚动条最大位置,执行滚动 |
| | | table.parentElement.scrollLeft += 10//执行水平滚动条向右滚动 |
| | | } |
| | | } else if (outevent.value.clientX < table.parentElement.getBoundingClientRect().left + 30) {//判断鼠标x轴是否超出表格左侧,向左滚动 |
| | | if (table.parentElement.scrollLeft > 0) {//如果没到滚动条最大位置,执行滚动 |
| | | //鼠标移出表格,滚动水平滚动条 |
| | | table.parentElement.scrollLeft -= 10//执行水平滚动条向右滚动 |
| | | } |
| | | } |
| | | |
| | | |
| | | } else { |
| | | clearInterval(timer)//清除循环定时器 |
| | | } |
| | | }, 200)//这里设置滑动速度 |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | //节流函数,todo//改为全局 |
| | | const throttle = (fn: Function, delay: number) => { |
| | | const canRun = ref(true) |
| | | return (...args: any[]) => { |
| | | if (!canRun.value) return |
| | | canRun.value = false |
| | | setTimeout(() => { |
| | | fn(...args) |
| | | canRun.value = true |
| | | }, delay) |
| | | } |
| | | } |
| | | |
| | | // 获取单元格位置(rowIndex, cellIndex) |
| | | const getCellPosition = (cell: any) => { |
| | | |
| | | |
| | | while (cell.tagName !== 'TD') {//将cell指向TD元素 |
| | | cell = cell.parentElement |
| | | } |
| | | |
| | | let visibleColumn = getTablexGrid().getTableColumn().visibleColumn//获取处理条件之后的全量表头列 |
| | | const cellIndex = visibleColumn.findIndex((col: { id: any; }) => {//返回colid相等的visibleColumn全量表头列的索引 |
| | | return col.id == cell.getAttribute("colid") |
| | | }) |
| | | |
| | | let visibleData = getTablexGrid().getTableData().visibleData//获取处理条件之后的全量表体数据 |
| | | |
| | | const rowIndex = visibleData.findIndex((row: { _X_ROW_KEY: any; }) => {//返回rowid相等的visibleData全量表体数据 |
| | | return row._X_ROW_KEY == cell.parentElement.getAttribute("rowid")//返回rowid相等的visibleData全量表体数据的索引 |
| | | }) |
| | | return { rowIndex, cellIndex } |
| | | |
| | | } |
| | | |
| | | //设置框打开 |
| | | const setselectedCellArea = () => { |
| | | var activeElement = getTablexGrid().$el.querySelector(".vxe-table--main-wrapper .vxe-table--body-wrapper .vxe-table--cell-active-area")//正常区域选中边框激活的元素(仅是边框) |
| | | var mainElement = getTablexGrid().$el.querySelector(".vxe-table--main-wrapper .vxe-table--body-wrapper .vxe-table--cell-main-area")//正常区域选中边框内整个范围的元素 |
| | | |
| | | var leftFixedActiveElement = getTablexGrid().$el.querySelector(".vxe-table--fixed-wrapper .vxe-table--fixed-left-wrapper .vxe-table--body-wrapper .vxe-table--cell-active-area")//左侧固定列选中边框激活的元素(仅是边框) |
| | | var leftFixedMainElement = getTablexGrid().$el.querySelector(".vxe-table--fixed-wrapper .vxe-table--fixed-left-wrapper .vxe-table--body-wrapper .vxe-table--cell-main-area")//左侧固定列选中边框内整个范围的元素 |
| | | |
| | | var rightFixedActiveElement = getTablexGrid().$el.querySelector(".vxe-table--fixed-wrapper .vxe-table--fixed-right-wrapper .vxe-table--body-wrapper .vxe-table--cell-active-area")//右侧固定列选中边框激活的元素(仅是边框) |
| | | var rightFixedMainElement = getTablexGrid().$el.querySelector(".vxe-table--fixed-wrapper .vxe-table--fixed-right-wrapper .vxe-table--body-wrapper .vxe-table--cell-main-area")//右侧固定列选中边框内整个范围的元素 |
| | | |
| | | |
| | | var elements = [activeElement, mainElement, leftFixedActiveElement, leftFixedMainElement, rightFixedActiveElement, rightFixedMainElement] |
| | | let area = getAreaBoxPosition() |
| | | if (area) { |
| | | var { width, height, left, top, right } = area |
| | | } else { |
| | | return |
| | | } |
| | | elements.forEach((element, index) => { |
| | | if (element) {//设置显示范围框的内部元素的样式 |
| | | element.style.width = `${width}px` |
| | | element.style.height = `${height}px` |
| | | element.style.top = `${top}px` |
| | | element.style.display = "block" |
| | | if (index <= elements.length - 1 - 2) {//如果不是rightFixedActiveElement或rightFixedMainElement |
| | | element.style.left = `${left}px` |
| | | } else { |
| | | element.style.right = `${right}px` |
| | | } |
| | | } |
| | | }) |
| | | |
| | | //显示范围框 |
| | | openAreaBox() |
| | | } |
| | | |
| | | //根据开始位置和结束位置的索引计算框的width,height,left,top(左侧固定列和正常区域和右侧固定列使用) |
| | | const getAreaBoxPosition = () => { |
| | | let startRowIndex = selectionStart.rowIndex//获取选中起始行索引 |
| | | let endRowIndex = selectionEnd.rowIndex//获取选中结束行索引 |
| | | let startColumnIndex = selectionStart.cellIndex//获取选中起始列索引 |
| | | let endColumnIndex = selectionEnd.cellIndex//获取选中结束列索引 |
| | | let visibleColumn = getTablexGrid().getTableColumn().visibleColumn//获取处理条件之后的全量表头列 |
| | | let visibleData = getTablexGrid().getTableData().visibleData//获取处理条件之后的全量表体数据 |
| | | if (startColumnIndex < 0 || endColumnIndex < 0 || startRowIndex < 0 || endRowIndex < 0) return |
| | | var maxColumnIndex = visibleColumn.length - 1//最大列索引 |
| | | var maxRowIndex = visibleData.length - 1//最大行索引 |
| | | if (endColumnIndex > maxColumnIndex) {//到最后一列,指向最后一列 |
| | | endColumnIndex = maxColumnIndex |
| | | } |
| | | if (endRowIndex > maxRowIndex) {//到最后一行,指向最后一行 |
| | | endRowIndex = maxRowIndex |
| | | } |
| | | let width = 0, height = 0, left = 0, top = 0, right = 0 |
| | | visibleColumn.forEach((col: { renderWidth: number; }, index: number) => { |
| | | if (startColumnIndex <= endColumnIndex) {//开始列索引小于结束列索引,即从左往右选择 |
| | | if (index < startColumnIndex) { |
| | | left += col.renderWidth//距离表格整体左侧边框距离 |
| | | } |
| | | if (index > endColumnIndex) {//数据索引大于结束列,这里获取距离后面数据的宽度 |
| | | right += col.renderWidth//距离表格整体右侧边框距离,加上当前列 |
| | | } |
| | | if (startColumnIndex <= index && index <= endColumnIndex) {//开始列索引大于数据索引 和 结束列索引小于数据索引,这里获取选中区域的宽度 |
| | | width += col.renderWidth//选中区域的宽度 |
| | | } |
| | | } else {//从右往左选择 |
| | | if (index < endColumnIndex) { |
| | | left += col.renderWidth//距离表格整体左侧边框距离 |
| | | } |
| | | if (index > startColumnIndex) {//数据索引大于开始列,这里获取距离后面数据的宽度 |
| | | right += col.renderWidth//距离表格整体右侧边框距离,加上当前列 |
| | | } |
| | | if (startColumnIndex >= index && index >= endColumnIndex) {//开始列索引大于数据索引 和 结束列索引小于数据索引,这里获取选中区域的宽度 |
| | | width += col.renderWidth//选中区域的宽度 |
| | | } |
| | | } |
| | | |
| | | }) |
| | | if (startRowIndex <= endRowIndex) {//开始行索引小于结束行索引,即从上往下选择 |
| | | height = (endRowIndex - startRowIndex + 1) * gridOptions.rowConfig!.height!//选中区域的高度 |
| | | top = startRowIndex * gridOptions.rowConfig!.height!//距离表格整体顶部边框距离 |
| | | } else { |
| | | height = (startRowIndex - endRowIndex + 1) * gridOptions.rowConfig!.height!//选中区域的高度 |
| | | top = endRowIndex * gridOptions.rowConfig!.height!//距离表格整体顶部边框距离 |
| | | } |
| | | |
| | | |
| | | |
| | | return { width, height, left, top, right } |
| | | |
| | | } |
| | | |
| | | //显示范围框 |
| | | const openAreaBox = () => { |
| | | let element = xGrid.value.$el.querySelector(".vxe-table--main-wrapper .vxe-table--body-wrapper .vxe-table--cell-area") |
| | | if (element) { |
| | | element.style.display = "block" |
| | | } |
| | | element = xGrid.value.$el.querySelector(".vxe-table--fixed-wrapper .vxe-table--fixed-left-wrapper .vxe-table--body-wrapper .vxe-table--cell-area") |
| | | if (element) { |
| | | element.style.display = "block" |
| | | } |
| | | element = xGrid.value.$el.querySelector(".vxe-table--fixed-wrapper .vxe-table--fixed-right-wrapper .vxe-table--body-wrapper .vxe-table--cell-area") |
| | | if (element) { |
| | | element.style.display = "block" |
| | | } |
| | | } |
| | | |
| | | //表格外销毁范围框 |
| | | const tableOutDestroyAreaBox = (event: MouseEvent) => { |
| | | var element = getTablexGrid().$el.querySelector(".vxe-table--render-wrapper") |
| | | if (element) { |
| | | if (event.clientX < element.getBoundingClientRect().left || event.clientX > element.getBoundingClientRect().right |
| | | || event.clientY > element.getBoundingClientRect().top || event.clientY < element.getBoundingClientRect().bottom |
| | | ) { |
| | | destroyAreaBox() |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | //销毁范围框 |
| | | const destroyAreaBox = () => { |
| | | var element = getTablexGrid().$el.querySelector(".vxe-table--main-wrapper .vxe-table--body-wrapper .vxe-table--cell-area") |
| | | if (element) { |
| | | element.style.display = "none" |
| | | } |
| | | element = getTablexGrid().$el.querySelector(".vxe-table--fixed-wrapper .vxe-table--fixed-left-wrapper .vxe-table--body-wrapper .vxe-table--cell-area") |
| | | if (element) { |
| | | element.style.display = "none" |
| | | } |
| | | element = getTablexGrid().$el.querySelector(".vxe-table--fixed-wrapper .vxe-table--fixed-right-wrapper .vxe-table--body-wrapper .vxe-table--cell-area") |
| | | if (element) { |
| | | element.style.display = "none" |
| | | } |
| | | } |
| | | |
| | | //表格单元格点击事件 |
| | | const tableCellClick = (e: MouseEvent) => { |
| | | |
| | | if (!isSelecting.value) {//非选中状态 |
| | | try { |
| | | selectionStart = getCellPosition(e.target)//获取单元格位置 |
| | | selectionEnd = selectionStart//结束位置也是自己 |
| | | //设置样式 |
| | | setselectedCellArea() |
| | | } catch (error) { |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | //表格右键点击事件 |
| | | const tableCellMenuClick = (e: MouseEvent) => { |
| | | if (!isSelecting.value) {//非选中状态 |
| | | let currentCellPosition = getCellPosition(e.target)//获取单元格位置 |
| | | var horizontalFlag//是否在范围框的水平判断标记 |
| | | var verticalFlag//是否在范围框的垂直判断标记 |
| | | if (selectionStart.cellIndex <= selectionEnd.cellIndex) {//如果是从左往右选取 |
| | | horizontalFlag = selectionStart.cellIndex <= currentCellPosition.cellIndex && currentCellPosition.cellIndex <= selectionEnd.cellIndex |
| | | } else {//从右往左选取 |
| | | horizontalFlag = selectionEnd.cellIndex <= currentCellPosition.cellIndex && currentCellPosition.cellIndex <= selectionStart.cellIndex |
| | | } |
| | | if (selectionStart.rowIndex <= selectionEnd.rowIndex) {//如果是从上往下选取 |
| | | verticalFlag = selectionStart.rowIndex <= currentCellPosition.rowIndex && currentCellPosition.rowIndex <= selectionEnd.rowIndex |
| | | } else {//从下往上选取 |
| | | verticalFlag = selectionEnd.rowIndex <= currentCellPosition.rowIndex && currentCellPosition.rowIndex <= selectionStart.rowIndex |
| | | } |
| | | |
| | | if (horizontalFlag && verticalFlag) { //判断如果不在选中区域内,触发表格左键单击事件,更新截取单元格,否则如果在正常触发右键菜单 |
| | | |
| | | } else { |
| | | selectionStart = getCellPosition(e.target)//获取单元格位置 |
| | | selectionEnd = selectionStart//结束位置也是自己 |
| | | //设置样式 |
| | | setselectedCellArea() |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | const toolbarButtonClickEvent = () => { |
| | | |
| | | // //我给大家打印处理: |
| | | // console.log("是否正在进行滑动选中操作:", isSelecting.value) |
| | | // //左上角坐标 |
| | | // console.log("单元格起始位置:索引:", selectionStart) |
| | | // //右下角坐标 |
| | | // console.log("单元格结束位置:索引:", selectionEnd) |
| | | if (selectionStart.cellIndex!==selectionEnd.cellIndex){ |
| | | ElMessage.warning("请选择相同一列") |
| | | return false |
| | | } |
| | | |
| | | |
| | | // //这里需要是visibleData |
| | | // let tableData = getTablexGrid().getTableData().visibleData//获取处理条件之后的全量表体数据 |
| | | // let rowStart = selectionStart.rowIndex//获取选中起始行索引 |
| | | // let rowEnd = selectionEnd.rowIndex//获取选中结束行索引 |
| | | // let selectRows = tableData.filter((col, index: number) => {//col参数不能改否则会获取不到数据 |
| | | // //这里修改从右下往左上拖动的数据显示 |
| | | // if (rowStart <= rowEnd) { |
| | | // return rowStart <= index && rowEnd >= index |
| | | // } else { |
| | | // return rowStart >= index && rowEnd <= index |
| | | // } |
| | | // }) |
| | | // console.log("鼠标选中行:", JSON.stringify(selectRows)) |
| | | |
| | | //这里需要是visibleColumn |
| | | let colStart = selectionStart.cellIndex//获取选中起始列索引 |
| | | let colEnd = selectionEnd.cellIndex//获取选中结束列索引 |
| | | let tableColumn = getTablexGrid().getTableColumn().visibleColumn//获取处理条件之后的全量表头列 |
| | | let selectCols = tableColumn.filter((col, index: number) => {//col参数不能改否则会获取不到数据 |
| | | //这里修改从右下往左上拖动的数据显示 |
| | | if (colStart <= colEnd) { |
| | | return colStart <= index && colEnd >= index |
| | | } else { |
| | | return colStart >= index && colEnd <= index |
| | | } |
| | | |
| | | }) |
| | | return { |
| | | start:selectionStart.rowIndex,//开始行 |
| | | end : selectionEnd.rowIndex,//结束行 |
| | | cell:selectCols[0].field//选中列 |
| | | } |
| | | //console.log("鼠标选中列:", JSON.stringify(selectCols)) |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | export { |
| | | addListener, |
| | | toolbarButtonClickEvent |
| | | } |
| | |
| | | request.post(`/FinishedGoodsInventory/getseletwarehousing/1/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageNum.value=1 |
| | |
| | | request.post(`/FinishedGoodsInventory/getseletwarehousing/1/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageNum.value=1 |
| | |
| | | request.post(`/FinishedGoodsInventory/getseletwarehousing/${pageNum.value}/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | |
| | | flowcard:selectRecords |
| | | }) |
| | | |
| | | console.log(flowData.value) |
| | | request.post("/FinishedGoodsInventory/addseletwarehousing",flowData.value).then((res) => { |
| | | if(res.code==200){ |
| | | ElMessage.success("入库成功") |
| | |
| | | <!--使用 pager 插槽--> |
| | | <vxe-pager |
| | | @page-change="handlePageChange" |
| | | :layouts="[ 'PrevJump', 'PrevPage', 'Jump','PageCount', 'NextPage', 'NextJump', 'Total']" |
| | | :layouts="[ 'PrevPage', 'Jump','PageCount', 'NextPage', 'Total']" |
| | | v-model:current-page="pageNum" |
| | | v-model:page-size="total.pageSize" |
| | | v-model:pager-count="total.pageTotal" |
| | |
| | | |
| | | <script setup> |
| | | |
| | | import {reactive, ref} from "vue"; |
| | | import {onMounted, reactive, ref} from "vue"; |
| | | import {useRouter} from 'vue-router' |
| | | import request from "@/utils/request"; |
| | | import deepClone from "@/utils/deepClone"; |
| | | import useUserInfoStore from "@/stores/userInfo"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {addListener,toolbarButtonClickEvent} from "@/hook/mouseMove"; |
| | | |
| | | const userStore = useUserInfoStore() |
| | | const username = userStore.user.userName |
| | | const userid = userStore.user.userId |
| | | let router=useRouter() |
| | | let produceList = ref([]) |
| | | let cellArea = ref() |
| | | |
| | | const getTableRow = (row,type) =>{ |
| | | switch (type) { |
| | |
| | | case 'verify': { |
| | | |
| | | const selectRecords = $grid.getCheckboxRecords() |
| | | console.log(selectRecords) |
| | | |
| | | if (selectRecords.length > 0) { |
| | | const errMap = await $grid.validate(selectRecords) |
| | | console.log(errMap) |
| | | if (errMap) { |
| | | ElMessage.warning("数据校验失败") |
| | | return |
| | |
| | | } |
| | | } |
| | | }, |
| | | menuClick ({ menu, row, column }) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (menu.code) { |
| | | |
| | | case 'copyChecked' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | let firstVal=null; |
| | | if(result.cell.indexOf('.')>-1){ |
| | | firstVal = eval("dataList["+result.start +"]."+result.cell) |
| | | }else { |
| | | firstVal=dataList[result.start][result.cell]; |
| | | } |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start && index<=result.end){ |
| | | if(result.cell.indexOf('.')>-1){ |
| | | const columnArr = result.cell.split('.') |
| | | item[columnArr[0]][columnArr[1]] = firstVal |
| | | }else{ |
| | | item[result.cell] = firstVal |
| | | } |
| | | |
| | | } |
| | | }) |
| | | } |
| | | break |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | |
| | | exportConfig: {}, |
| | | scrollY:{ enabled: true },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | menuConfig: { |
| | | body: { |
| | | options: [ |
| | | [ |
| | | { code: 'copyChecked', name: '选中相同', prefixIcon: 'vxe-icon-copy', visible: true, disabled: false }, |
| | | ] |
| | | ] |
| | | } |
| | | }, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | |
| | | }] |
| | | }) |
| | | |
| | | onMounted(()=>{ |
| | | addListener(xGrid.value,gridOptions,cellArea.value) |
| | | }) |
| | | |
| | | |
| | | |
| | |
| | | <!--使用 pager 插槽--> |
| | | <vxe-pager |
| | | @page-change="handlePageChange" |
| | | :layouts="[ 'PrevJump', 'PrevPage', 'Jump','PageCount', 'NextPage', 'NextJump', 'Total']" |
| | | :layouts="[ 'PrevPage', 'Jump','PageCount', 'NextPage', 'Total']" |
| | | v-model:current-page="pageNum" |
| | | v-model:page-size="total.pageSize" |
| | | v-model:pager-count="total.pageTotal" |
| | |
| | | </template> |
| | | </vxe-grid> |
| | | </div> |
| | | <div class="vxe-table--cell-area" ref="cellArea" > |
| | | <span class="vxe-table--cell-main-area" ></span> |
| | | |
| | | <span class="vxe-table--cell-active-area" ></span> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | |
| | | request.post(`/FinishedGoodsInventory/getseletdeliveryDetail/1/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageNum.value=1 |
| | |
| | | request.post(`/FinishedGoodsInventory/getseletdeliveryDetail/1/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageNum.value=1 |
| | |
| | | request.post(`/FinishedGoodsInventory/getseletdeliveryDetail/${pageNum.value}/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | |
| | | orderDetail:selectRecords |
| | | }) |
| | | |
| | | console.log(orderDetailData.value) |
| | | request.post("/FinishedGoodsInventory/adddeliveryDetail",orderDetailData.value).then((res) => { |
| | | if(res.code==200){ |
| | | ElMessage.success("出库成功") |
| | |
| | | <!--使用 pager 插槽--> |
| | | <vxe-pager |
| | | @page-change="handlePageChange" |
| | | :layouts="[ 'PrevJump', 'PrevPage', 'Jump','PageCount', 'NextPage', 'NextJump', 'Total']" |
| | | :layouts="[ 'PrevPage', 'Jump','PageCount', 'NextPage', 'Total']" |
| | | v-model:current-page="pageNum" |
| | | v-model:page-size="total.pageSize" |
| | | v-model:pager-count="total.pageTotal" |
| | |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | |
| | | |
| | | <script setup> |
| | | |
| | | import {reactive, ref} from "vue"; |
| | | import {onMounted, reactive, ref} from "vue"; |
| | | import {useRouter} from 'vue-router' |
| | | import request from "@/utils/request"; |
| | | import deepClone from "@/utils/deepClone"; |
| | | import useUserInfoStore from "@/stores/userInfo"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {addListener,toolbarButtonClickEvent} from "@/hook/mouseMove"; |
| | | const userStore = useUserInfoStore() |
| | | const username = userStore.user.userName |
| | | const userid = userStore.user.userId |
| | | let router=useRouter() |
| | | let produceList = ref([]) |
| | | let cellArea = ref() |
| | | |
| | | const getTableRow = (row,type) =>{ |
| | | switch (type) { |
| | |
| | | case 'ver': { |
| | | |
| | | const selectRecords = $grid.getCheckboxRecords() |
| | | console.log(selectRecords) |
| | | |
| | | if (selectRecords.length > 0) { |
| | | const errMap = await $grid.validate(selectRecords) |
| | | console.log(errMap) |
| | | if (errMap) { |
| | | ElMessage.warning("数据校验失败") |
| | | return |
| | |
| | | } |
| | | } |
| | | }, |
| | | menuClick ({ menu, row, column }) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (menu.code) { |
| | | |
| | | case 'copyChecked' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | let firstVal=null; |
| | | if(result.cell.indexOf('.')>-1){ |
| | | firstVal = eval("dataList["+result.start +"]."+result.cell) |
| | | }else { |
| | | firstVal=dataList[result.start][result.cell]; |
| | | } |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start && index<=result.end){ |
| | | if(result.cell.indexOf('.')>-1){ |
| | | const columnArr = result.cell.split('.') |
| | | item[columnArr[0]][columnArr[1]] = firstVal |
| | | }else{ |
| | | item[result.cell] = firstVal |
| | | } |
| | | |
| | | } |
| | | }) |
| | | } |
| | | break |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | const hasDecimal=(value)=>{ |
| | |
| | | request.post(`/FinishedGoodsInventory/getSelectAllocate/${pageNum.value}/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | |
| | | exportConfig: {}, |
| | | scrollY:{ enabled: true },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | menuConfig: { |
| | | body: { |
| | | options: [ |
| | | [ |
| | | { code: 'copyChecked', name: '选中相同', prefixIcon: 'vxe-icon-copy', visible: true, disabled: false }, |
| | | ] |
| | | ] |
| | | } |
| | | }, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | |
| | | }] |
| | | }) |
| | | |
| | | |
| | | onMounted(()=>{ |
| | | addListener(xGrid.value,gridOptions,cellArea.value) |
| | | }) |
| | | |
| | | </script> |
| | | |
| | |
| | | <!--使用 pager 插槽--> |
| | | <vxe-pager |
| | | @page-change="handlePageChange" |
| | | :layouts="[ 'PrevJump', 'PrevPage', 'Jump','PageCount', 'NextPage', 'NextJump', 'Total']" |
| | | :layouts="[ 'PrevPage', 'Jump','PageCount', 'NextPage', 'Total']" |
| | | v-model:current-page="pageNum" |
| | | v-model:page-size="total.pageSize" |
| | | v-model:pager-count="total.pageTotal" |
| | |
| | | |
| | | </vxe-grid> |
| | | </div> |
| | | <div class="vxe-table--cell-area" ref="cellArea" > |
| | | <span class="vxe-table--cell-main-area" ></span> |
| | | |
| | | <span class="vxe-table--cell-active-area" ></span> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | |
| | | |
| | | <script setup> |
| | | |
| | | import {reactive, ref} from "vue"; |
| | | import {onMounted, reactive, ref} from "vue"; |
| | | import {useRouter} from 'vue-router' |
| | | import request from "@/utils/request" |
| | | import deepClone from "@/utils/deepClone" |
| | | import userInfo from '@/stores/userInfo' |
| | | import useUserInfoStore from "@/stores/userInfo"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {addListener,toolbarButtonClickEvent} from "@/hook/mouseMove"; |
| | | |
| | | const userStore = useUserInfoStore() |
| | | const username = userStore.user.userName |
| | | const userid = userStore.user.userId |
| | | let router=useRouter() |
| | | let produceList = ref([]) |
| | | let cellArea = ref() |
| | | const getTableRow = (row,type) =>{ |
| | | switch (type) { |
| | | case 'edit' :{ |
| | |
| | | dataTotal : 0, |
| | | pageSize : 10 |
| | | }) |
| | | |
| | | |
| | | |
| | | //第一次调用 |
| | | request.post(`/FinishedGoodsInventory/getSelectAllocate/1/${total.pageSize}`,filterData.value).then((res) => { |
| | |
| | | request.post(`/FinishedGoodsInventory/getSelectAllocate/${pageNum.value}/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | //子组件接收参数 |
| | | |
| | | const gridOptions = reactive({ |
| | |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | |
| | | exportConfig: {}, |
| | | scrollY:{ enabled: true },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | menuConfig: { |
| | | body: { |
| | | options: [ |
| | | [ |
| | | { code: 'copyChecked', name: '选中相同', prefixIcon: 'vxe-icon-copy', visible: true, disabled: false }, |
| | | ] |
| | | ] |
| | | } |
| | | }, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | |
| | | case 'edit': { |
| | | |
| | | const selectRecords = $grid.getCheckboxRecords() |
| | | console.log(selectRecords) |
| | | |
| | | if (selectRecords.length > 0) { |
| | | const errMap = await $grid.validate(selectRecords) |
| | | console.log(errMap) |
| | | if (errMap) { |
| | | ElMessage.warning("数据校验失败") |
| | | return |
| | |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | menuClick ({ menu, row, column }) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (menu.code) { |
| | | |
| | | case 'copyChecked' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | let firstVal=null; |
| | | if(result.cell.indexOf('.')>-1){ |
| | | firstVal = eval("dataList["+result.start +"]."+result.cell) |
| | | }else { |
| | | firstVal=dataList[result.start][result.cell]; |
| | | } |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start && index<=result.end){ |
| | | if(result.cell.indexOf('.')>-1){ |
| | | const columnArr = result.cell.split('.') |
| | | item[columnArr[0]][columnArr[1]] = firstVal |
| | | }else{ |
| | | item[result.cell] = firstVal |
| | | } |
| | | |
| | | } |
| | | }) |
| | | } |
| | | break |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /*数据校验*/ |
| | | const validRules = ref({ |
| | |
| | | |
| | | }] |
| | | |
| | | }) |
| | | |
| | | onMounted(()=>{ |
| | | addListener(xGrid.value,gridOptions,cellArea.value) |
| | | }) |
| | | |
| | | |
| | |
| | | <!--使用 pager 插槽--> |
| | | <vxe-pager |
| | | @page-change="handlePageChange" |
| | | :layouts="[ 'PrevJump', 'PrevPage', 'Jump','PageCount', 'NextPage', 'NextJump', 'Total']" |
| | | :layouts="[ 'PrevPage', 'Jump','PageCount', 'NextPage', 'Total']" |
| | | v-model:current-page="pageNum" |
| | | v-model:page-size="total.pageSize" |
| | | v-model:pager-count="total.pageTotal" |
| | |
| | | |
| | | </vxe-grid> |
| | | </div> |
| | | <div class="vxe-table--cell-area" ref="cellArea" > |
| | | <span class="vxe-table--cell-main-area" ></span> |
| | | |
| | | <span class="vxe-table--cell-active-area" ></span> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | |
| | | request.post(`/FinishedGoodsInventory/getselet/1/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageNum.value=1 |
| | |
| | | request.post(`/FinishedGoodsInventory/getselet/1/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data.data) |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageNum.value=1 |
| | |
| | | request.post(`/FinishedGoodsInventory/getselet/${pageNum.value}/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | |
| | | <!--使用 pager 插槽--> |
| | | <vxe-pager |
| | | @page-change="handlePageChange" |
| | | :layouts="[ 'PrevJump', 'PrevPage', 'Jump','PageCount', 'NextPage', 'NextJump', 'Total']" |
| | | :layouts="[ 'PrevPage', 'Jump','PageCount', 'NextPage', 'Total']" |
| | | v-model:current-page="pageNum" |
| | | v-model:page-size="total.pageSize" |
| | | v-model:pager-count="total.pageTotal" |
| | |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | |
| | | //gridOptions.columns.unshift(a) |
| | | if ($table) { |
| | | const selectRecords = $table.getCheckboxRecords() |
| | | console.log(selectRecords) |
| | | |
| | | let flowData = ref({ |
| | | |
| | |
| | | <!--使用 pager 插槽--> |
| | | <vxe-pager |
| | | @page-change="handlePageChange" |
| | | :layouts="[ 'PrevJump', 'PrevPage', 'Jump','PageCount', 'NextPage', 'NextJump', 'Total']" |
| | | :layouts="[ 'PrevPage', 'Jump','PageCount', 'NextPage', 'Total']" |
| | | v-model:current-page="pageNum" |
| | | v-model:page-size="total.pageSize" |
| | | v-model:pager-count="total.pageTotal" |
| | |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | |
| | | //gridOptions.columns.unshift(a) |
| | | if ($table) { |
| | | const selectRecords = $table.getCheckboxRecords() |
| | | console.log(selectRecords) |
| | | |
| | | let flowData = ref({ |
| | | |
| | |
| | | <!--使用 pager 插槽--> |
| | | <vxe-pager |
| | | @page-change="handlePageChange" |
| | | :layouts="[ 'PrevJump', 'PrevPage', 'Jump','PageCount', 'NextPage', 'NextJump', 'Total']" |
| | | :layouts="[ 'PrevPage', 'Jump','PageCount', 'NextPage', 'Total']" |
| | | v-model:current-page="pageNum" |
| | | v-model:page-size="total.pageSize" |
| | | v-model:pager-count="total.pageTotal" |
| | |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | |
| | | //gridOptions.columns.unshift(a) |
| | | if ($table) { |
| | | const selectRecords = $table.getCheckboxRecords() |
| | | console.log(selectRecords) |
| | | |
| | | let flowData = ref({ |
| | | |
| | |
| | | <!--使用 pager 插槽--> |
| | | <vxe-pager |
| | | @page-change="handlePageChange" |
| | | :layouts="[ 'PrevJump', 'PrevPage', 'Jump','PageCount', 'NextPage', 'NextJump', 'Total']" |
| | | :layouts="[ 'PrevPage', 'Jump','PageCount', 'NextPage', 'Total']" |
| | | v-model:current-page="pageNum" |
| | | v-model:page-size="total.pageSize" |
| | | v-model:pager-count="total.pageTotal" |
| | |
| | | <script lang="ts" setup> |
| | | import { reactive, ref } from 'vue' |
| | | import type { FormInstance, FormRules } from 'element-plus' |
| | | import {onMounted, reactive, ref} from "vue"; |
| | | import {useRoute, useRouter} from "vue-router" |
| | | import request from "@/utils/request" |
| | | import {ElMessage} from "element-plus"; |
| | | import deepClone from "@/utils/deepClone" |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | let produceList = ref([]) |
| | | |
| | | const ruleFormRef = ref<FormInstance>() |
| | | |
| | | const checkAge = (rule: any, value: any, callback: any) => { |
| | | if (!value) { |
| | | return callback(new Error('Please input the age')) |
| | | } |
| | | setTimeout(() => { |
| | | if (!Number.isInteger(value)) { |
| | | callback(new Error('Please input digits')) |
| | | } else { |
| | | if (value < 18) { |
| | | callback(new Error('Age must be greater than 18')) |
| | | } else { |
| | | callback() |
| | | |
| | | |
| | | let ruleForm = ref({ |
| | | id:0, |
| | | customerName: '', |
| | | grade: '', |
| | | moneyLimit: '', |
| | | address: '', |
| | | contact: '', |
| | | phone: '' |
| | | |
| | | }) |
| | | |
| | | |
| | | |
| | | onMounted(()=>{ |
| | | |
| | | //获取传过来的数据进行判断 |
| | | const str = route.query.id |
| | | if (typeof str != 'undefined' && str != null && str !== '' && str !== '\n' && str !== '\r'){ |
| | | ruleForm.value.id = Number(str) |
| | | |
| | | request.post(`/customer/getseletCustomer/1/100`,ruleForm.value).then((res) => { |
| | | if(res.code==200){ |
| | | ruleForm.value=deepClone(res.data.data[0]) |
| | | |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | } |
| | | } |
| | | }, 1000) |
| | | } |
| | | |
| | | const validatePass = (rule: any, value: any, callback: any) => { |
| | | if (value === '') { |
| | | callback(new Error('Please input the password')) |
| | | } else { |
| | | if (ruleForm.checkPass !== '') { |
| | | if (!ruleFormRef.value) return |
| | | ruleFormRef.value.validateField('checkPass', () => null) |
| | | } |
| | | callback() |
| | | }) |
| | | } |
| | | } |
| | | const validatePass2 = (rule: any, value: any, callback: any) => { |
| | | if (value === '') { |
| | | callback(new Error('Please input the password again')) |
| | | } else if (value !== ruleForm.pass) { |
| | | callback(new Error("Two inputs don't match!")) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | |
| | | const ruleForm = reactive({ |
| | | pass: '', |
| | | checkPass: '', |
| | | age: '', |
| | | |
| | | }) |
| | | |
| | | const rules = reactive<FormRules<typeof ruleForm>>({ |
| | | pass: [{ validator: validatePass, trigger: 'blur' }], |
| | | checkPass: [{ validator: validatePass2, trigger: 'blur' }], |
| | | age: [{ validator: checkAge, trigger: 'blur' }], |
| | | }) |
| | | |
| | | const submitForm = (formEl: FormInstance | undefined) => { |
| | | if (!formEl) return |
| | | formEl.validate((valid) => { |
| | | if (valid) { |
| | | console.log('submit!') |
| | | } else { |
| | | console.log('error submit!') |
| | | return false |
| | | //保存提交 |
| | | const submitForm = () => { |
| | | //表头数据校验 |
| | | const customerName = ruleForm.value.customerName |
| | | if(customerName === null || customerName === undefined || customerName === ''){ |
| | | ElMessage.error('输入客户名称!') |
| | | return |
| | | } |
| | | const grade = ruleForm.value.grade |
| | | if(grade === null || grade === undefined || grade === ''){ |
| | | ElMessage.error('输入客户等级!') |
| | | return |
| | | } |
| | | const moneyLimit = ruleForm.value.moneyLimit |
| | | if(moneyLimit === null || moneyLimit === undefined || moneyLimit === ''){ |
| | | ElMessage.error('输入金额额度!') |
| | | return |
| | | } |
| | | const address = ruleForm.value.address |
| | | if(address === null || address === undefined || address === ''){ |
| | | ElMessage.error('输入联系地址!') |
| | | return |
| | | } |
| | | const contact = ruleForm.value.contact |
| | | if(contact === null || contact === undefined || contact === ''){ |
| | | ElMessage.error('输入联系人!') |
| | | return |
| | | } |
| | | const phone = ruleForm.value.phone |
| | | if(phone === null || phone === undefined || phone === ''){ |
| | | ElMessage.error('输入类型电话!') |
| | | return |
| | | } |
| | | |
| | | let flowData = ref({ |
| | | customer: ruleForm |
| | | }) |
| | | |
| | | request.post("/customer/insertCustomer", flowData.value).then((res) => { |
| | | if(res.code==200){ |
| | | resetForm() |
| | | ElMessage.success("提交成功") |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const resetForm = (formEl: FormInstance | undefined) => { |
| | | if (!formEl) return |
| | | formEl.resetFields() |
| | | } |
| | | //重置输入框 |
| | | const resetForm = () => { |
| | | ruleForm.value.customerName="" |
| | | ruleForm.value.grade="" |
| | | ruleForm.value.moneyLimit="" |
| | | ruleForm.value.address="" |
| | | ruleForm.value.contact="" |
| | | ruleForm.value.phone="" |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div class="main-div"> |
| | | <div class="div-form"> |
| | | <el-form |
| | | ref="ruleFormRef" |
| | | :model="ruleForm" |
| | | status-icon |
| | | :rules="rules" |
| | | label-width="120px" |
| | | class="demo-ruleForm" |
| | | > |
| | | <el-form-item label="客户名称" prop="pass"> |
| | | <el-input v-model="ruleForm.pass" type="text" autocomplete="off" /> |
| | | </el-form-item> |
| | | <el-form-item label="客户等级" prop="checkPass"> |
| | | <el-input |
| | | v-model="ruleForm.checkPass" |
| | | type="text" |
| | | autocomplete="off" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="信用额度" prop="age"> |
| | | <el-input v-model.number="ruleForm.age" /> |
| | | </el-form-item> |
| | | <el-form-item label="地址" prop="age"> |
| | | <el-input v-model.number="ruleForm.age" /> |
| | | </el-form-item> |
| | | <el-form-item label="联系人" prop="age"> |
| | | <el-input v-model.number="ruleForm.age" /> |
| | | </el-form-item> |
| | | <el-form-item label="联系电话" prop="age"> |
| | | <el-input v-model.number="ruleForm.age" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="submitForm(ruleFormRef)" |
| | | >保存</el-button |
| | | > |
| | | <el-button @click="resetForm(ruleFormRef)">重置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <div class="order-primary" > |
| | | <el-row> |
| | | <el-col :span="2"><el-text>客户名称:</el-text></el-col> |
| | | <el-col :span="5"><el-input style="font-size: large;color: #181818" v-model="ruleForm.customerName" ></el-input></el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="2"><el-text>客户等级:</el-text></el-col> |
| | | <el-col :span="5"><el-input style="font-size: large;color: #181818" v-model="ruleForm.grade" ></el-input></el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="2"><el-text>信用额度:</el-text></el-col> |
| | | <el-col :span="5"><el-input style="font-size: large;color: #181818" v-model="ruleForm.moneyLimit" ></el-input></el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="2"><el-text>地址:</el-text></el-col> |
| | | <el-col :span="5"><el-input style="font-size: large;color: #181818" v-model="ruleForm.address" ></el-input></el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="2"><el-text>联系人:</el-text></el-col> |
| | | <el-col :span="5"><el-input style="font-size: large;color: #181818" v-model="ruleForm.contact" ></el-input></el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="2"><el-text>联系电话:</el-text></el-col> |
| | | <el-col :span="5"><el-input style="font-size: large;color: #181818" v-model="ruleForm.phone" ></el-input></el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="2"><el-button type="primary" @click="submitForm()">保存</el-button></el-col> |
| | | <el-col :span="2"><el-button @click="resetForm()">重置</el-button></el-col> |
| | | </el-row> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | |
| | |
| | | height:70%; |
| | | width: 40%; |
| | | } |
| | | .el-row{ |
| | | margin-bottom: 0.5rem; |
| | | } |
| | | </style> |
| | |
| | | <script setup> |
| | | |
| | | import {reactive} from "vue"; |
| | | import {reactive, ref} from "vue"; |
| | | import {useRouter} from 'vue-router' |
| | | import request from "@/utils/request" |
| | | import deepClone from "@/utils/deepClone" |
| | | import VXETable from "vxe-table"; |
| | | import useUserInfoStore from "@/stores/userInfo"; |
| | | import {ElMessage} from "element-plus"; |
| | | |
| | | const userStore = useUserInfoStore() |
| | | const username = userStore.user.userName |
| | | const userid = userStore.user.userId |
| | | let router=useRouter() |
| | | let produceList = ref([]) |
| | | const getTableRow = (row,type) =>{ |
| | | switch (type) { |
| | | case 'edit' :{ |
| | |
| | | break |
| | | } |
| | | case 'delete':{ |
| | | alert('我接收到子组件传送的删除信息') |
| | | let ruleForm = ref({ |
| | | id:0, |
| | | customerName: '', |
| | | grade: '', |
| | | moneyLimit: '', |
| | | address: '', |
| | | contact: '', |
| | | phone: '' |
| | | |
| | | }) |
| | | ruleForm.value.id=row.id |
| | | let flowData = ref({ |
| | | customer: ruleForm.value |
| | | }) |
| | | |
| | | request.post("/customer/deleteCustomer", flowData.value).then((res) => { |
| | | if(res.code==200){ |
| | | ElMessage.success("删除成功") |
| | | location.reload(); |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | } |
| | | }) |
| | | break |
| | | } |
| | | } |
| | | } |
| | | |
| | | const hasDecimal=(value)=>{ |
| | | const regex=/\./ // 定义正则表达式,查找小数点 |
| | | return regex.test(value) //返回true/false |
| | | } |
| | | |
| | | const hasDecimalhtml=(item,row)=>{ |
| | | let aa=item.split('.').length |
| | | if (aa===2){ |
| | | return row[item.split('.')[0]][item.split('.')[1]] |
| | | }else if(aa===3){ |
| | | return row[item.split('.')[0]][item.split('.')[1]][item.split('.')[2]] |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | let filterData = ref({}) |
| | | |
| | | let pageNum=ref(1) |
| | | let total = reactive({ |
| | | pageTotal : 0, |
| | | dataTotal : 0, |
| | | pageSize : 10 |
| | | }) |
| | | |
| | | //第一次调用 |
| | | request.post(`/customer/getseletCustomer/1/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageNum.value=1 |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | } |
| | | }) |
| | | |
| | | let pageState = null |
| | | |
| | | |
| | | const changeFilterEvent = (event, option, $panel,) => { |
| | | // 手动触发筛选 |
| | | $panel.changeOption(event, !!option.data, option) |
| | | } |
| | | function filterChanged(column){ |
| | | gridOptions.loading=true |
| | | //筛选条件发生变化条件发生变化 |
| | | let value = column.datas[0]!=undefined?column.datas[0]:'' |
| | | value = value.trim() |
| | | //判断是否存在外键 |
| | | if (column.property.indexOf('.')>-1){ |
| | | const columnArr = column.property.split('.') |
| | | filterData.value[columnArr[0]] = { |
| | | [columnArr[1]]:value |
| | | } |
| | | }else{ |
| | | filterData.value[column.property] = value |
| | | } |
| | | request.post(`/customer/getseletCustomer/1/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageNum.value=1 |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | } |
| | | }) |
| | | } |
| | | //分页查询 |
| | | const selectOrderList = ()=>{ |
| | | |
| | | request.post(`/customer/getseletCustomer/${pageNum.value}/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | } |
| | | }) |
| | | } |
| | | //页脚跳转 |
| | | const handlePageChange = ({ currentPage, pageSize }) => { |
| | | total.pageTotal = pageSize |
| | | pageNum.value=currentPage |
| | | |
| | | selectOrderList() |
| | | } |
| | | |
| | | |
| | | |
| | | //子组件接收参数 |
| | | |
| | | const xGrid = ref(); |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | |
| | | showStatus: true |
| | | },//表头参数 |
| | | columns:[ |
| | | {type:'expand',fixed:"left",slots: { content:'content' },width: 50}, |
| | | {type:'expand',fixed:"left",slots: { content:'content' },width: 60}, |
| | | {type: 'seq',fixed:"left", title: '自序', width: 80 }, |
| | | {title: '操作', width: 110, slots: { default: 'button_slot' },fixed:"left"}, |
| | | {field: '0', title: '客户编码',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: '1', title: '名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: '2', title: '客户等级',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: '3', title: '信用额度',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: '4', title: '地址',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: '5', title: '联系人',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: '6', title: '联系电话',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true} |
| | | {field: 'id', title: '客户编码',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: 'customerName', title: '名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: 'grade', title: '客户等级',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: 'moneyLimit', title: '信用额度',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: 'address', title: '地址',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: 'contact', title: '联系人',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: 'phone', title: '联系电话',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true} |
| | | ],//表头按钮 |
| | | toolbarConfig: { |
| | | buttons: [], |
| | |
| | | zoom: true, |
| | | custom: true |
| | | }, |
| | | data: [ |
| | | { |
| | | '0':'1', |
| | | '1':'太仓卓高玻璃制品有限公司', |
| | | '2':'A', |
| | | '3':'100000', |
| | | '4':'江苏太仓xxxx街道', |
| | | '5':'张三', |
| | | '6':'139xxxxxxxx', |
| | | |
| | | }, |
| | | { |
| | | '0':'1', |
| | | '1':'山西某某公司', |
| | | '2':'A', |
| | | '3':'100000', |
| | | '4':'江苏太仓xxxx街道', |
| | | '5':'张三', |
| | | '6':'139xxxxxxxx', |
| | | |
| | | } |
| | | ],//table body实际数据 |
| | | footerMethod ({ columns, data }) {//页脚函数 |
| | | return[ |
| | | columns.map((column, columnIndex) => { |
| | |
| | | v-bind="gridOptions" |
| | | |
| | | > |
| | | <!-- @toolbar-button-click="toolbarButtonClickEvent"--> |
| | | <!-- 下拉显示所有信息插槽--> |
| | | <template #content="{ row }"> |
| | | <ul class="expand-wrapper"> |
| | | <li v-for="(item,index) in gridOptions.columns" v-show="item.field!=undefined "> |
| | | <span style="font-weight: bold">{{item.title+': '}}</span> |
| | | <span>{{ row[item.field] }}</span> |
| | | <span v-if="hasDecimal(item.field)">{{ hasDecimalhtml(item.field,row) }}</span> |
| | | <span v-else>{{ row[item.field] }}</span> |
| | | </li> |
| | | </ul> |
| | | </template> |
| | |
| | | </div> |
| | | </template> |
| | | |
| | | <template #pager> |
| | | <!--使用 pager 插槽--> |
| | | <vxe-pager |
| | | @page-change="handlePageChange" |
| | | :layouts="[ 'PrevPage', 'Jump','PageCount', 'NextPage', 'Total']" |
| | | v-model:current-page="pageNum" |
| | | v-model:page-size="total.pageSize" |
| | | v-model:pager-count="total.pageTotal" |
| | | :total="total.dataTotal" |
| | | > |
| | | </vxe-pager> |
| | | </template> |
| | | |
| | | |
| | | </vxe-grid> |
| | | </div> |
| | |
| | | import VXETable from "vxe-table"; |
| | | import useUserInfoStore from "@/stores/userInfo"; |
| | | import {ElMessage} from "element-plus"; |
| | | import validator from "vxe-table/lib/validator"; |
| | | import {addListener,toolbarButtonClickEvent} from "@/hook/mouseMove"; |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | const userStore = useUserInfoStore() |
| | | const username = userStore.user.userName |
| | | const userid = userStore.user.userId |
| | | let produceList = ref([]) |
| | | let cellArea = ref() |
| | | |
| | | |
| | | const hasDecimal=(value)=>{ |
| | |
| | | |
| | | if(res.code==200){ |
| | | titleSelectJson.value=deepClone(res.data) |
| | | console.log(titleSelectJson.value) |
| | | const today = new Date |
| | | today.setTime(today.getTime() + (15 * 24 * 60 * 60 * 1000)) |
| | | titleUploadData.value.deliveryDate = today.getFullYear() + |
| | |
| | | const number = ref(); |
| | | |
| | | onMounted(()=>{ |
| | | //启用表格拖动选中 |
| | | addListener(xGrid.value,gridOptions,cellArea.value) |
| | | //发货新增 |
| | | const orderId = route.query.orderId |
| | | if (typeof orderId !== 'undefined' && orderId !== null && orderId !== '' && orderId !== '\n' && orderId !== '\r'){ |
| | |
| | | request.post("/Delivery/getseletShippingOrderDetails/1/100",filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data.title) |
| | | pageTotal.value=res.data.total |
| | | |
| | | |
| | |
| | | |
| | | if (typeof str != 'undefined' && str != null && str !== '' && str !== '\n' && str !== '\r'){ |
| | | filterData.value.deliveryDetail.deliveryId=str |
| | | console.log(filterData) |
| | | //第一次调用 |
| | | request.post("/Delivery/getseletShippingOrderDetail/1/100",filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data.data) |
| | | pageTotal.value=res.data.total |
| | | titleUploadData.value=deepClone(res.data.delivery) |
| | | console.log(deepClone(res.data.delivery)) |
| | | |
| | | |
| | | //根据审核状态显示审核按钮或者是反审按钮 |
| | |
| | | request.post("/Delivery/getseletShippingOrderDetail/1/100",filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data.data) |
| | | pageTotal.value=res.data.total |
| | | pageNum=1 |
| | | produceList = deepClone(res.data.data) |
| | |
| | | request.post("/Delivery/getseletShippingOrderDetails/1/100",filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data.title) |
| | | pageTotal.value=res.data.total |
| | | |
| | | pageNum=1 |
| | |
| | | router.push("/login") |
| | | } |
| | | }) |
| | | } |
| | | console.log(route.query.orderId) |
| | | console.log(filterData.value.deliveryDetail.deliveryId) |
| | | console.log(filterData.value)*/ |
| | | }*/ |
| | | |
| | | } |
| | | |
| | |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'OrderList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | |
| | | exportConfig: {}, |
| | | scrollY:{ enabled: true },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | menuConfig: { |
| | | body: { |
| | | options: [ |
| | | [ |
| | | { code: 'copyChecked', name: '选中相同', prefixIcon: 'vxe-icon-copy', visible: true, disabled: false }, |
| | | ] |
| | | ] |
| | | } |
| | | }, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | |
| | | },//表头参数 |
| | | columns:[ |
| | | |
| | | {type:'expand',slots: { content:'content' },width: 60,fixed:"left"}, |
| | | {type:'expand',fixed:"left",slots: { content:'content' },width: 60}, |
| | | {field: 'select',type:'checkbox',title: '选择', width: 80,fixed:"left"}, |
| | | {type: 'seq', title: '自序', width: 80 ,fixed:"left"}, |
| | | {field: 'orderId',width:120, title: '销售单号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}, |
| | |
| | | switch (code) { |
| | | case 'add': { |
| | | const selectRecords = $grid.getCheckboxRecords() |
| | | console.log(selectRecords) |
| | | |
| | | if (selectRecords.length === 0) { |
| | | ElMessage.warning("未选中数据") |
| | | return |
| | | } |
| | | const errMap = await $grid.validate(selectRecords) |
| | | console.log(errMap) |
| | | if (errMap) { |
| | | ElMessage.warning("数据校验失败") |
| | | return |
| | |
| | | deliveryId: route.query.deliveryID |
| | | |
| | | }) |
| | | console.log(flowData) |
| | | request.post("/Delivery/insertDelivery", flowData.value).then((res) => { |
| | | if(res.code==200){ |
| | | ElMessage.success("发货单提交成功") |
| | |
| | | type: 2 |
| | | |
| | | }) |
| | | console.log(flowData) |
| | | request.post("/Delivery/updateDeliveryToExamine", flowData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | ElMessage.success("审核成功") |
| | |
| | | type: 0 |
| | | |
| | | }) |
| | | console.log(flowData) |
| | | request.post("/Delivery/updateDeliveryToExamine", flowData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | ElMessage.success("反审成功") |
| | |
| | | }) |
| | | break |
| | | } |
| | | |
| | | } |
| | | } |
| | | }, |
| | | menuClick ({ menu, row, column }) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (menu.code) { |
| | | |
| | | case 'copyChecked' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | let firstVal=null; |
| | | if(result.cell.indexOf('.')>-1){ |
| | | firstVal = eval("dataList["+result.start +"]."+result.cell) |
| | | }else { |
| | | firstVal=dataList[result.start][result.cell]; |
| | | } |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start && index<=result.end){ |
| | | if(result.cell.indexOf('.')>-1){ |
| | | const columnArr = result.cell.split('.') |
| | | item[columnArr[0]][columnArr[1]] = firstVal |
| | | }else{ |
| | | item[result.cell] = firstVal |
| | | } |
| | | |
| | | } |
| | | }) |
| | | } |
| | | break |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <template #content="{ row}"> |
| | | |
| | | |
| | | <template #content="{ row }"> |
| | | <ul class="expand-wrapper"> |
| | | <li v-for="(item,key,index) in row"> |
| | | <span style="font-weight: bold">{{key+': '}}</span> |
| | | <span>{{ item }}</span> |
| | | <li v-for="(item,index) in gridOptions.columns" v-show="item.field!=undefined "> |
| | | <span style="font-weight: bold">{{item.title+': '}}</span> |
| | | <span v-if="hasDecimal(item.field)">{{ hasDecimalhtml(item.field,row) }}</span> |
| | | <span v-else>{{ row[item.field] }}</span> |
| | | </li> |
| | | </ul> |
| | | </template> |
| | | |
| | | </vxe-grid> |
| | | </div> |
| | | <div class="vxe-table--cell-area" ref="cellArea" > |
| | | <span class="vxe-table--cell-main-area" ></span> |
| | | |
| | | <span class="vxe-table--cell-active-area" ></span> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | .main-div { |
| | | width: 100%; |
| | | height: 100%; |
| | | text-align: center; |
| | | } |
| | | .el-col{ |
| | | border: #181818 1px solid; |
| | |
| | | const getTableRow = (row,type) =>{ |
| | | switch (type) { |
| | | case 'edit' :{ |
| | | console.log(row) |
| | | router.push({path: '/main/delivery/createDelivery', query: { deliveryID: row.deliveryId }}) |
| | | break |
| | | } |
| | |
| | | request.post(`/Delivery/getseletShippingOrder/1/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageNum.value=1 |
| | |
| | | request.post(`/Delivery/getseletShippingOrder/${pageNum.value}/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'OrderList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | |
| | | <!--使用 pager 插槽--> |
| | | <vxe-pager |
| | | @page-change="handlePageChange" |
| | | :layouts="[ 'PrevJump', 'PrevPage', 'Jump','PageCount', 'NextPage', 'NextJump', 'Total']" |
| | | :layouts="[ 'PrevPage', 'Jump','PageCount', 'NextPage', 'Total']" |
| | | v-model:current-page="pageNum" |
| | | v-model:page-size="total.pageSize" |
| | | v-model:pager-count="total.pageTotal" |
| | |
| | | request.post(`/Delivery/getSelectOrderInventory/1/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | selectDate.value = res.data.selectDate |
| | |
| | | request.post(`/Delivery/getSelectOrderInventory/${pageNum.value}/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'OrderList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | |
| | | <!--使用 pager 插槽--> |
| | | <vxe-pager |
| | | @page-change="handlePageChange" |
| | | :layouts="[ 'PrevJump', 'PrevPage', 'Jump','PageCount', 'NextPage', 'NextJump', 'Total']" |
| | | :layouts="[ 'PrevPage', 'Jump','PageCount', 'NextPage', 'Total']" |
| | | v-model:current-page="pageNum" |
| | | v-model:page-size="total.pageSize" |
| | | v-model:pager-count="total.pageTotal" |
| | |
| | | import useUserInfoStore from '@/stores/userInfo' |
| | | import SelectProduct from "@/views/sd/product/SelectProduct.vue" |
| | | import {changeFilterEvent,filterChanged} from "@/hook" |
| | | import {addListener,toolbarButtonClickEvent} from "@/hook/mouseMove"; |
| | | import {CaretBottom} from "@element-plus/icons-vue"; |
| | | |
| | | let dialogTableVisible = ref(false) |
| | | let productVisible = ref(false) |
| | |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | const xGrid = ref() |
| | | let cellArea = ref() |
| | | |
| | | // 定义表头上传数据 |
| | | const titleUploadData = ref({ |
| | | project:'', |
| | |
| | | }) |
| | | let filterData = ref({}) |
| | | let rowIndex = ref(null) |
| | | let rowClickIndex = ref(null) |
| | | |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | |
| | | body: { |
| | | options: [ |
| | | [ |
| | | { code: 'addRow', name: '添加', prefixIcon: 'vxe-icon-square-plus', visible: true, disabled: false } |
| | | { code: 'addRow', name: '添加', prefixIcon: 'vxe-icon-square-plus', visible: true, disabled: false }, |
| | | { code: 'deleteRow', name: '删除', prefixIcon: 'vxe-icon-delete', visible: true, disabled: true }, |
| | | { code: 'copyChecked', name: '选中相同', prefixIcon: 'vxe-icon-copy', visible: true, disabled: false }, |
| | | { code: 'copyAll', name: '之后相同', prefixIcon: 'vxe-icon-feedback', visible: true, disabled: false }, |
| | | { code: 'clearChecked', name: '清除选中', prefixIcon: 'vxe-icon-indicator', visible: true, disabled: false }, |
| | | { code: 'computedMoney', name: '计算金额', prefixIcon: 'vxe-icon-chart-bar-x', visible: true, disabled: true }, |
| | | ] |
| | | ] |
| | | } |
| | |
| | | { min: 0, max: 255, message: '名称长度在 0 到 255 个字符' } |
| | | ], |
| | | productId: [ |
| | | { required: true, message: '请选择产品' } |
| | | ], |
| | | productName: [ |
| | | { required: true, message: '请选择产品' } |
| | | ], |
| | | price: [ |
| | |
| | | {'code': 'remarks', 'name': '加工要求'}, |
| | | {'code': 'Craft', 'name': '工艺',status: 'primary',disabled: true}, |
| | | {'code': 'review', 'name': '审核',status: 'primary',disabled: true}, |
| | | {'code': 'updateMoney', 'name': '金额重置',status: 'primary',disabled: true}, |
| | | {'code': 'saveOrder', 'name': '保存',status: 'primary',icon: 'vxe-icon-save',disabled: false} |
| | | ], |
| | | slots: { |
| | |
| | | dialogTableVisible.value=true |
| | | break |
| | | } |
| | | case 'updateMoney': { |
| | | updateMoney() |
| | | break |
| | | } |
| | | case 'Craft': { |
| | | await router.push({path: '/main/order/updateOrderCraft', query: {orderId: titleUploadData.value.orderId }}) |
| | | break |
| | |
| | | ElMessage.error('没有表格数据!') |
| | | return |
| | | } |
| | | if(!gridOptions.menuConfig.body.options[0][5].disabled){ |
| | | ElMessage.error('请先打开右击菜单重新计算金额后,再保存!') |
| | | return |
| | | } |
| | | |
| | | const project = titleUploadData.value.project |
| | | if(project === null || project === undefined || project === ''){ |
| | | ElMessage.error('输入项目名称!') |
| | |
| | | return |
| | | } |
| | | $grid.insert({}) |
| | | //console.log($grid.getRecordset().insertRecords) |
| | | break |
| | | } |
| | | case 'deleteRow':{ |
| | | |
| | | $grid.remove(rowClickIndex.value) |
| | | rowClickIndex.value = null |
| | | gridOptions.menuConfig.body.options[0][1].disabled=true |
| | | gridOptions.menuConfig.body.options[0][5].disabled=false |
| | | break |
| | | } |
| | | case 'copyChecked' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start][result.cell] |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start && index<=result.end){ |
| | | item[result.cell] = val |
| | | } |
| | | }) |
| | | } |
| | | gridOptions.menuConfig.body.options[0][5].disabled=false |
| | | break |
| | | } |
| | | case 'copyAll' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start][result.cell] |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start ){ |
| | | item[result.cell] = val |
| | | } |
| | | }) |
| | | } |
| | | gridOptions.menuConfig.body.options[0][5].disabled=false |
| | | break |
| | | } |
| | | case 'clearChecked' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start && index<=result.end){ |
| | | item[result.cell] = '' |
| | | } |
| | | }) |
| | | } |
| | | gridOptions.menuConfig.body.options[0][5].disabled=false |
| | | break |
| | | } |
| | | case 'computedMoney' :{ |
| | | const dataList = xGrid.value.getTableData().fullData |
| | | dataList.forEach((item,index) =>{ |
| | | item.area = area(item) |
| | | item.grossArea = countArea(item) |
| | | item.computeArea = item.area |
| | | item.computeGrossArea = item.grossArea |
| | | item.grossAmount=parseFloat((item.price * item.computeGrossArea).toFixed(2)) |
| | | }) |
| | | titleUploadData.value.money=countMoney(xGrid.value.getTableData().fullData).toString() |
| | | |
| | | gridOptions.menuConfig.body.options[0][5].disabled=true |
| | | break |
| | | } |
| | | } |
| | |
| | | const { row } = params |
| | | productVisible.value = true |
| | | rowIndex=row |
| | | //console.log(row) |
| | | //alert("我打开了产品界面") |
| | | }, |
| | | cellClick({ row }){ |
| | | rowClickIndex.value = row |
| | | //右键菜单删除启用 |
| | | gridOptions.menuConfig.body.options[0][1].disabled=false |
| | | } |
| | | } |
| | | //获取子页面产品方法 |
| | |
| | | productVisible.value = false |
| | | } |
| | | |
| | | |
| | | |
| | | //初始化判断是否有id传入 |
| | | onMounted(()=>{ |
| | | //启用表格拖动选中 |
| | | addListener(xGrid.value,gridOptions) |
| | | const str = route.query.orderId |
| | | if (typeof str === 'undefined' || str === null || str === '' || str === '\n' || str === '\r'){ |
| | | return |
| | | } |
| | | request.post(`/order/getOrderById/${str}`).then((res) => { |
| | | if(res.code==200){ |
| | | console.log(res.data.order) |
| | | titleUploadData.value = res.data.order |
| | | //取消工艺按钮禁用 |
| | | gridOptions.toolbarConfig.buttons[1].disabled = false |
| | | //工艺审核后保存按钮禁用 |
| | | if(res.data.order.processReview === 2){ |
| | | gridOptions.toolbarConfig.buttons[3].disabled = true |
| | | gridOptions.toolbarConfig.buttons[4].disabled = true |
| | | } |
| | | //取消审核按钮禁用 |
| | | if(res.data.order.processReview === 2 && res.data.order.orderReview === 0){ |
| | |
| | | gridOptions.toolbarConfig.buttons[2].disabled = false |
| | | gridOptions.toolbarConfig.buttons[2].code='reviews' |
| | | gridOptions.toolbarConfig.buttons[2].name='反审' |
| | | gridOptions.toolbarConfig.buttons[3].disabled = false |
| | | } |
| | | if(res.data.order.productionOrder !==0 ){ |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | } |
| | | |
| | | |
| | | //加载副表数据 |
| | | xGrid.value.reloadData(res.data.orderDetails) |
| | | }else{ |
| | | ElMessage.error(res.msg) |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //更新金额 |
| | | const updateMoney = () => { |
| | | const updateData = { |
| | | order: titleUploadData.value, |
| | | detail: xGrid.value.getTableData().fullData |
| | | } |
| | | request.post(`/order/updateOrderMoney`,updateData).then(res => { |
| | | if (res.code == 200){ |
| | | ElMessage.success('更新金额成功') |
| | | router.push({path:'/main/order/createOrder',query:{orderId:titleUploadData.value.orderId,random:Math.random()}}) |
| | | } |
| | | |
| | | }) |
| | | |
| | | } |
| | | |
| | | |
| | | // 审核订单 |
| | | const reviewOrder = (state) => { |
| | | request.post(`/order/reviewOrderById/${titleUploadData.value.orderId}/${state}`).then(res =>{ |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | <el-col :span="2"><el-text>计算方式:</el-text></el-col> |
| | | <el-col :span="2"> |
| | | <el-select v-model="titleUploadData.calculateType" clearable placeholder=" " > |
| | | <el-option value="1" label="面积金额(单片)"/> |
| | | <el-option :value="1" label="面积金额(单片)"/> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="2"><el-text>*业务员:</el-text></el-col> |
| | |
| | | <el-dialog v-model="productVisible" style="width: 80%;height:75% "> |
| | | <select-product :rowIndex="rowIndex" @getProductRow="getProductRow" style="width: 100%;height: 100%" /> |
| | | </el-dialog> |
| | | <!--选中表格 --> |
| | | <!-- <div class="vxe-table--cell-area" ref="cellArea" >--> |
| | | <!-- <span class="vxe-table--cell-main-area" ></span>--> |
| | | |
| | | <!-- <span class="vxe-table--cell-active-area" ></span>--> |
| | | <!-- </div>--> |
| | | |
| | | </div> |
| | | </template> |
| | |
| | | width: 100%; |
| | | height: 85%; |
| | | } |
| | | .vxe-grid { |
| | | /* 禁用浏览器默认选中 */ |
| | | -webkit-user-select: none; |
| | | -moz-user-select: none; |
| | | -ms-user-select: none; |
| | | user-select: none; |
| | | } |
| | | |
| | | </style> |
| | |
| | | break |
| | | } |
| | | case 'delete': { |
| | | if (row.processReview === 2) { |
| | | ElMessage.warning('已审核的订单不能删除') |
| | | return |
| | | } |
| | | request.post(`/order/deleteOrder/${row.orderId}`).then((res) => { |
| | | if(res.code==200){ |
| | | ElMessage.success('删除成功') |
| | |
| | | </script> |
| | | |
| | | <template> |
| | | <div style="width: 100%;height: 100%"> |
| | | <div style="width: 100%;height: 100% ;"> |
| | | <el-date-picker |
| | | v-model="selectDate" |
| | | type="daterange" |
| | |
| | | <vxe-grid |
| | | @filter-change="filterChanged" |
| | | @cell-dblclick="cellClickEvent" |
| | | max-height="97%" |
| | | style="max-height: 95%" |
| | | class="mytable-scrollbar" |
| | | ref="xGrid" |
| | | v-bind="gridOptions" |
| | |
| | | <el-breadcrumb-item @click="changeRouter(1)" :class="indexFlag===1?'indexTag':''" :to="{ path: '/main/product/selectProduct' }">产品首页</el-breadcrumb-item> |
| | | <el-breadcrumb-item @click="changeRouter(2)" :class="indexFlag===2?'indexTag':''" :to="{ path: '/main/product/createProduct' }">创建</el-breadcrumb-item> |
| | | <!-- <el-breadcrumb-item :to="{ path: '/main/product/test' }">测试</el-breadcrumb-item>--> |
| | | <!-- <el-breadcrumb-item :to="{ path: '/main/product/testSort' }">测试</el-breadcrumb-item>--> |
| | | <el-breadcrumb-item v-show="false" :to="{ path: '/main/product/test1' }">测试</el-breadcrumb-item> |
| | | <!-- <el-breadcrumb-item :to="{ path: '/main/product/testSort11' }">测试</el-breadcrumb-item>--> |
| | | <el-breadcrumb-item :to="{ path: '/main/product/test1' }">测试</el-breadcrumb-item> |
| | | </el-breadcrumb> |
| | | |
| | | </div> |
New file |
| | |
| | | package com.example.erp.controller.sd; |
| | | |
| | | |
| | | import com.example.erp.common.Constants; |
| | | import com.example.erp.common.Result; |
| | | import com.example.erp.entity.sd.Customer; |
| | | import com.example.erp.entity.sd.Delivery; |
| | | import com.example.erp.entity.sd.Order; |
| | | import com.example.erp.entity.sd.OrderDetail; |
| | | import com.example.erp.exception.ServiceException; |
| | | import com.example.erp.service.sd.CustomerService; |
| | | import com.example.erp.service.sd.DeliveryService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @Api(value="客户controller",tags={"客户操作接口"}) |
| | | @RequestMapping("/customer") |
| | | public class CustomerController { |
| | | @Autowired |
| | | CustomerService customerService; |
| | | |
| | | |
| | | /*发货订单查询*/ |
| | | @ApiOperation("客户查询接口") |
| | | @PostMapping("/getseletCustomer/{pageNum}/{pageSize}") |
| | | public Result getseletShippingOrder(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @RequestBody Customer customer){ |
| | | return Result.seccess(customerService.getseletCustomer(pageNum,pageSize,customer)); |
| | | } |
| | | |
| | | @ApiOperation("客户新增修改接口") |
| | | @PostMapping("/insertCustomer") |
| | | public Result insertCustomer( @RequestBody Map<String,Object> object){ |
| | | if(customerService.insertCustomer(object)){ |
| | | |
| | | return Result.seccess(); |
| | | |
| | | }else { |
| | | throw new ServiceException(Constants.Code_500,"客户新增/修改失败"); |
| | | |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("客户删除接口") |
| | | @PostMapping("/deleteCustomer") |
| | | public Result deleteCustomer( @RequestBody Map<String,Object> object){ |
| | | if(customerService.deleteCustomer(object)){ |
| | | |
| | | return Result.seccess(); |
| | | |
| | | }else { |
| | | throw new ServiceException(Constants.Code_500,"客户删除失败"); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.example.erp.entity.sd.OrderGlassDetail; |
| | | import com.example.erp.exception.ServiceException; |
| | | import com.example.erp.service.sd.OrderService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | |
| | | @RestController |
| | | @RequestMapping("/order") |
| | | @Api(value="订单controller",tags={"订单操作接口"}) |
| | | public class OrderController { |
| | | private final OrderService orderService; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @ApiOperation("订单保存") |
| | | @PostMapping("/saveOrder") |
| | | public Result saveOrder(@RequestBody Map<String, Object> orderMap) throws Exception { |
| | | if(orderService.saveOrder(orderMap)) { |
| | |
| | | throw new ServiceException(Constants.Code_500,Constants.Code_msg); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("订单分页筛选查询") |
| | | @PostMapping("/getOrderList/{pageNum}/{pageSize}/{orderType}/{selectDate}") |
| | | public Result getOrderList(@PathVariable Integer pageNum, @PathVariable Integer pageSize,@PathVariable Integer orderType, @PathVariable List<String> selectDate, @RequestBody Order order) { |
| | | return Result.seccess(orderService.getOrderList(pageNum, pageSize, selectDate, order,orderType)); |
| | | } |
| | | |
| | | @ApiOperation("删除订单") |
| | | @PostMapping("/deleteOrder/{id}") |
| | | public Result deleteOrder(@PathVariable String id) { |
| | | return Result.seccess(orderService.deleteOrder(id)); |
| | | } |
| | | |
| | | @ApiOperation("根据id获取订单信息") |
| | | @PostMapping("/getOrderById/{id}") |
| | | public Result getOrderById(@PathVariable String id) { |
| | | return Result.seccess(orderService.getOrderById(id)); |
| | | } |
| | | @ApiOperation("查询订单工艺") |
| | | @PostMapping("/getOrderCraftById/{id}") |
| | | public Result getOrderCraftById(@PathVariable String id) { |
| | | return Result.seccess(orderService.getOrderCraftById(id)); |
| | | } |
| | | |
| | | @ApiOperation("审核订单") |
| | | @PostMapping("/reviewOrderById/{id}/{status}") |
| | | public Result reviewOrderById(@PathVariable String id,@PathVariable Integer status) { |
| | | return Result.seccess(orderService.reviewOrderById(id,status)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("审核工艺") |
| | | @PostMapping("/reviewProcessById/{id}/{status}") |
| | | public Result reviewProcessById(@PathVariable String id,@PathVariable Integer status,@RequestBody List<OrderGlassDetail> orderGlassDetails) { |
| | | return Result.seccess(orderService.reviewProcessById(id,status,orderGlassDetails)); |
| | | } |
| | | |
| | | @ApiOperation("更新订单金额单价") |
| | | @PostMapping("/updateOrderMoney") |
| | | public Result updateOrderMoney(@RequestBody Map<String,Object> map) { |
| | | return Result.seccess(orderService.updateOrderMoney(map)); |
| | | } |
| | | } |
| | |
| | | @Api(value="产品controller",tags={"产品操作接口"}) |
| | | @RequestMapping("/product") |
| | | public class ProductController { |
| | | @Autowired |
| | | final |
| | | ProductService productService; |
| | | |
| | | public ProductController(ProductService productService) { |
| | | this.productService = productService; |
| | | } |
| | | |
| | | @ApiOperation("产品查询接口") |
| | | @PostMapping ("/{pageNum}/{pageSize}/{glassType}") |
| | | public Result defaultDateProduct(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @PathVariable List<String> glassType, @RequestBody Product product){ |
| | |
| | | package com.example.erp.mapper.sd; |
| | | |
| | | import com.example.erp.entity.sd.Customer; |
| | | import com.example.erp.entity.sd.Delivery; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.data.repository.CrudRepository; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Mapper |
| | | public interface CustomerMapper { |
| | | public interface CustomerMapper extends CrudRepository<Customer,Long> { |
| | | |
| | | List<Customer> getCustomerList(); |
| | | List<Customer> getseletCustomer(@Param("offset") Integer offset, |
| | | @Param("pageSize") Integer pageSize, |
| | | @Param("customer") Customer customer); |
| | | |
| | | |
| | | Map<String,Integer> getseletCustomerPageTotal(Integer offset, Integer pageSize, Customer customer); |
| | | |
| | | Boolean insertCustomer(@Param("customer") Customer customer); |
| | | |
| | | Boolean updateCustomer(@Param("customer") Customer customer); |
| | | |
| | | Boolean deleteCustomer(@Param("customer") Customer customer); |
| | | } |
| | |
| | | public interface OrderDetailMapper extends BaseMapper<OrderDetail> { |
| | | |
| | | boolean insertBatch(List<OrderDetail> orderDetails); |
| | | |
| | | boolean updateOrderMoney( List<OrderDetail> orderDetails); |
| | | } |
| | |
| | | boolean reviewOrderById(String id,Integer status); |
| | | |
| | | boolean reviewProcessById(String id, Integer status); |
| | | |
| | | boolean updateMoney(@Param("order") Order order); |
| | | } |
| | |
| | | // } |
| | | |
| | | public Map<String, List<Object>> getBasicDataByType(String type){ |
| | | //返回基础数据里的所有类型 |
| | | List<String> orderBasicDataType = basicDateMapper.getOrderBasicDataType(type); |
| | | //返回此类型基础数据所有数据 |
| | | List<BasicData> orderBasicData = basicDateMapper.getOrderBasicData(type); |
| | | Map<String, List<Object>> BasicDataMap = new HashMap<>(); |
| | | //创建List对象 |
New file |
| | |
| | | package com.example.erp.service.sd; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.example.erp.entity.sd.*; |
| | | import com.example.erp.entity.userInfo.SysError; |
| | | import com.example.erp.mapper.mm.FinishedGoodsInventoryMapper; |
| | | import com.example.erp.mapper.sd.*; |
| | | import com.example.erp.service.userInfo.SysErrorService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | @DS("sd") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class CustomerService { |
| | | @Autowired |
| | | CustomerMapper customerMapper; |
| | | @Autowired |
| | | SysErrorService sysErrorService; |
| | | |
| | | |
| | | public Map<String, Object> getseletCustomer(Integer pageNum, Integer pageSize, Customer customer) { |
| | | Integer offset = (pageNum - 1) * pageSize; |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", customerMapper.getseletCustomer(offset, pageSize, customer)); |
| | | map.put("total", customerMapper.getseletCustomerPageTotal(offset, pageSize, customer)); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | public Boolean insertCustomer(Map<String,Object> object) { |
| | | boolean saveState = true; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | | Customer customer = JSONObject.parseObject(JSONObject.toJSONString(object.get("customer")), Customer.class); |
| | | if(customer!=null){ |
| | | if (customer.getId()!=null && customer.getId()!=0){ |
| | | System.out.println(111); |
| | | customerMapper.updateCustomer(customer); |
| | | }else{ |
| | | System.out.println(222); |
| | | customerMapper.insertCustomer(customer); |
| | | } |
| | | |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | | //将异常传入数据库 |
| | | SysError sysError = new SysError(); |
| | | sysError.setError(e.toString()); |
| | | sysError.setFunc("saveOrder"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = false; |
| | | |
| | | } |
| | | return saveState; |
| | | |
| | | } |
| | | |
| | | public Boolean deleteCustomer(Map<String,Object> object) { |
| | | boolean saveState = true; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | | Customer customer = JSONObject.parseObject(JSONObject.toJSONString(object.get("customer")), Customer.class); |
| | | if(customer!=null){ |
| | | if (customer.getId()!=null){ |
| | | customerMapper.deleteCustomer(customer); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | | //将异常传入数据库 |
| | | SysError sysError = new SysError(); |
| | | sysError.setError(e.toString()); |
| | | sysError.setFunc("saveOrder"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = false; |
| | | |
| | | } |
| | | return saveState; |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | if (object.get("deliveryId") != null) { |
| | | deliveryId = object.get("deliveryId").toString(); |
| | | } |
| | | Delivery delivery = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), Delivery.class); |
| | | Delivery delivery = JSONObject.parseObject(JSONObject.toJSONString(object.get("customer")), Delivery.class); |
| | | List<OrderDetail> orderDetaillist = JSONArray.parseArray(JSONObject.toJSONString(object.get("delivery")), OrderDetail.class); |
| | | //查询发货单是否存在 |
| | | Integer deliveryConut = deliveryMapper.getDeliveryConut(deliveryId); |
| | |
| | | map.put("orderGlassDetails",orderGlassDetails); |
| | | return map; |
| | | } |
| | | |
| | | public boolean updateOrderMoney(Map<String, Object> map) { |
| | | JSONObject jsonObject = new JSONObject(map); |
| | | Order order = JSONObject.parseObject(JSONObject.toJSONString(jsonObject.get("order")), Order.class); |
| | | List<OrderDetail> OrderDetails = JSONArray.parseArray(JSONObject.toJSONString(jsonObject.get("detail")), OrderDetail.class); |
| | | double money = 0; |
| | | for (OrderDetail orderDetail : OrderDetails) { |
| | | orderDetail = updateOrderMoneyComputed(orderDetail,order.getCalculateType()); |
| | | money+= orderDetail.getGrossAmount(); |
| | | } |
| | | order.setMoney(money); |
| | | orderMapper.updateMoney(order); |
| | | orderDetailMapper.updateOrderMoney(OrderDetails); |
| | | return false; |
| | | } |
| | | |
| | | private OrderDetail updateOrderMoneyComputed(OrderDetail orderDetail, Integer calculateType) { |
| | | if (calculateType == 3) { |
| | | orderDetail.setGrossAmount(orderDetail.getPrice() * orderDetail.getQuantity()); |
| | | } else { |
| | | orderDetail.setGrossAmount(orderDetail.getComputeGrossArea() * orderDetail.getPrice()); |
| | | } |
| | | return orderDetail; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.example.erp.mapper.sd.CustomerMapper"> |
| | | |
| | | <select id="getCustomerList"> |
| | | select |
| | | * |
| | | from |
| | | customer |
| | | sd.customer |
| | | </select> |
| | | <select id="getseletCustomer"> |
| | | select |
| | | * |
| | | from |
| | | sd.customer c |
| | | <where> |
| | | <if test="customer.id != null and customer.id != ''"> |
| | | and c.id regexp #{customer.id} |
| | | </if> |
| | | <if test="customer.customerName != null and customer.customerName != ''"> |
| | | and c.customer_name regexp #{customer.customerName} |
| | | </if> |
| | | <if test="customer.grade != null and customer.grade != ''"> |
| | | and c.grade regexp #{customer.grade} |
| | | </if> |
| | | <if test="customer.moneyLimit != null and customer.moneyLimit != ''"> |
| | | and c.money_limit regexp REGEXP_REPLACE(#{customer.moneyLimit},'\\.0+$','') |
| | | </if> |
| | | <if test="customer.address != null and customer.address != ''"> |
| | | and c.address regexp #{customer.address} |
| | | </if> |
| | | <if test="customer.contact != null and customer.contact != ''"> |
| | | and c.contact regexp #{customer.contact} |
| | | </if> |
| | | <if test="customer.phone != null and customer.phone != ''"> |
| | | and c.phone regexp #{customer.phone} |
| | | </if> |
| | | |
| | | </where> |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="getseletCustomerPageTotal"> |
| | | select |
| | | CEILING(count(id)/#{pageSize}) as 'pageTotal', |
| | | count(id) as 'total' |
| | | from |
| | | sd.customer c |
| | | <where> |
| | | <if test="customer.id != null and customer.id != ''"> |
| | | and c.id regexp #{customer.id} |
| | | </if> |
| | | <if test="customer.customerName != null and customer.customerName != ''"> |
| | | and c.customer_name regexp #{customer.customerName} |
| | | </if> |
| | | <if test="customer.grade != null and customer.grade != ''"> |
| | | and c.grade regexp #{customer.grade} |
| | | </if> |
| | | <if test="customer.moneyLimit != null and customer.moneyLimit != ''"> |
| | | and c.money_limit regexp REGEXP_REPLACE(#{customer.moneyLimit},'\\.0+$','') |
| | | </if> |
| | | <if test="customer.address != null and customer.address != ''"> |
| | | and c.address regexp #{customer.address} |
| | | </if> |
| | | <if test="customer.contact != null and customer.contact != ''"> |
| | | and c.contact regexp #{customer.contact} |
| | | </if> |
| | | <if test="customer.phone != null and customer.phone != ''"> |
| | | and c.phone regexp #{customer.phone} |
| | | </if> |
| | | |
| | | </where> |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <insert id="insertCustomer" useGeneratedKeys="true" > |
| | | insert into sd.customer(customer_name,grade,money_limit,address,contact,phone) |
| | | values ( |
| | | #{customer.customerName},#{customer.grade},#{customer.moneyLimit}, |
| | | #{customer.address},#{customer.contact},#{customer.phone} |
| | | ) |
| | | </insert> |
| | | |
| | | <update id="updateCustomer" useGeneratedKeys="true" > |
| | | update sd.customer set customer_name=#{customer.customerName},grade=#{customer.grade}, |
| | | money_limit=#{customer.moneyLimit},address= #{customer.address}, |
| | | contact=#{customer.contact},phone=#{customer.phone} where id=#{customer.id} |
| | | </update> |
| | | |
| | | <delete id="deleteCustomer" > |
| | | delete from sd.customer where id=#{customer.id} |
| | | </delete> |
| | | </mapper> |
| | |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <update id="updateOrderMoney" parameterType="java.util.List"> |
| | | <foreach collection="orderDetails" item="item" index="index" open="" close="" separator=";"> |
| | | update order_detail as a |
| | | set |
| | | a.price = #{item.price}, |
| | | a.gross_amount = #{item.grossAmount} |
| | | where |
| | | a.order_id = #{item.orderId} and |
| | | a.order_number = #{item.orderNumber} |
| | | |
| | | </foreach> |
| | | |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | update `order` set process_review = #{status} where order_id = #{id} |
| | | </update> |
| | | |
| | | <update id="updateMoney"> |
| | | update `order` set money = #{order.money} where order_id = #{order.orderId} |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.example.erp.mapper.sd.CustomerMapper"> |
| | | |
| | | <select id="getCustomerList"> |
| | | select |
| | | * |
| | | from |
| | | customer |
| | | sd.customer |
| | | </select> |
| | | <select id="getseletCustomer"> |
| | | select |
| | | * |
| | | from |
| | | sd.customer c |
| | | <where> |
| | | <if test="customer.id != null and customer.id != ''"> |
| | | and c.id regexp #{customer.id} |
| | | </if> |
| | | <if test="customer.customerName != null and customer.customerName != ''"> |
| | | and c.customer_name regexp #{customer.customerName} |
| | | </if> |
| | | <if test="customer.grade != null and customer.grade != ''"> |
| | | and c.grade regexp #{customer.grade} |
| | | </if> |
| | | <if test="customer.moneyLimit != null and customer.moneyLimit != ''"> |
| | | and c.money_limit regexp REGEXP_REPLACE(#{customer.moneyLimit},'\\.0+$','') |
| | | </if> |
| | | <if test="customer.address != null and customer.address != ''"> |
| | | and c.address regexp #{customer.address} |
| | | </if> |
| | | <if test="customer.contact != null and customer.contact != ''"> |
| | | and c.contact regexp #{customer.contact} |
| | | </if> |
| | | <if test="customer.phone != null and customer.phone != ''"> |
| | | and c.phone regexp #{customer.phone} |
| | | </if> |
| | | |
| | | </where> |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="getseletCustomerPageTotal"> |
| | | select |
| | | CEILING(count(id)/#{pageSize}) as 'pageTotal', |
| | | count(id) as 'total' |
| | | from |
| | | sd.customer c |
| | | <where> |
| | | <if test="customer.id != null and customer.id != ''"> |
| | | and c.id regexp #{customer.id} |
| | | </if> |
| | | <if test="customer.customerName != null and customer.customerName != ''"> |
| | | and c.customer_name regexp #{customer.customerName} |
| | | </if> |
| | | <if test="customer.grade != null and customer.grade != ''"> |
| | | and c.grade regexp #{customer.grade} |
| | | </if> |
| | | <if test="customer.moneyLimit != null and customer.moneyLimit != ''"> |
| | | and c.money_limit regexp REGEXP_REPLACE(#{customer.moneyLimit},'\\.0+$','') |
| | | </if> |
| | | <if test="customer.address != null and customer.address != ''"> |
| | | and c.address regexp #{customer.address} |
| | | </if> |
| | | <if test="customer.contact != null and customer.contact != ''"> |
| | | and c.contact regexp #{customer.contact} |
| | | </if> |
| | | <if test="customer.phone != null and customer.phone != ''"> |
| | | and c.phone regexp #{customer.phone} |
| | | </if> |
| | | |
| | | </where> |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <insert id="insertCustomer" useGeneratedKeys="true" > |
| | | insert into sd.customer(customer_name,grade,money_limit,address,contact,phone) |
| | | values ( |
| | | #{customer.customerName},#{customer.grade},#{customer.moneyLimit}, |
| | | #{customer.address},#{customer.contact},#{customer.phone} |
| | | ) |
| | | </insert> |
| | | |
| | | <update id="updateCustomer" useGeneratedKeys="true" > |
| | | update sd.customer set customer_name=#{customer.customerName},grade=#{customer.grade}, |
| | | money_limit=#{customer.moneyLimit},address= #{customer.address}, |
| | | contact=#{customer.contact},phone=#{customer.phone} where id=#{customer.id} |
| | | </update> |
| | | |
| | | <delete id="deleteCustomer" > |
| | | delete from sd.customer where id=#{customer.id} |
| | | </delete> |
| | | </mapper> |
| | |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <update id="updateOrderMoney" parameterType="java.util.List"> |
| | | <foreach collection="orderDetails" item="item" index="index" open="" close="" separator=";"> |
| | | update order_detail as a |
| | | set |
| | | a.price = #{item.price}, |
| | | a.gross_amount = #{item.grossAmount} |
| | | where |
| | | a.order_id = #{item.orderId} and |
| | | a.order_number = #{item.orderNumber} |
| | | |
| | | </foreach> |
| | | |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | update `order` set process_review = #{status} where order_id = #{id} |
| | | </update> |
| | | |
| | | <update id="updateMoney"> |
| | | update `order` set money = #{order.money} where order_id = #{order.orderId} |
| | | </update> |
| | | |
| | | </mapper> |