From 5ecb7958c96d3f0b6d47b79aff7eb306c2cf690f Mon Sep 17 00:00:00 2001 From: charles <981744753@qq.com> Date: 星期二, 06 八月 2024 11:16:58 +0800 Subject: [PATCH] gitlab上面的wms转移到公司git --- src/views/operate/orderPoint/index.vue | 760 +++++++++++++++++++++++++++------------------------------ 1 files changed, 362 insertions(+), 398 deletions(-) diff --git a/src/views/operate/orderPoint/index.vue b/src/views/operate/orderPoint/index.vue index 340eb0e..8ec3c21 100644 --- a/src/views/operate/orderPoint/index.vue +++ b/src/views/operate/orderPoint/index.vue @@ -1,21 +1,7 @@ <template> <div class="rightContent"> <div class="top"> - <SearchCommonView - :add-title="addTitle" - :show-discard="showDiscard" - :show-apply="false" - :placeholder="'璇疯緭鍏ヤ綅缃�/浜у搧'" - :amount-view="false" - :search-task-map="searchTaskMap" - :show-sreen="false" - :screen-array="screenArray" - @addCommonClick="addProductClick" - @searchClick="getList" - @discardBtnClick="discardBtnClick" - @delSelectClick="delSelectClick" - @switchKeywords="switchKeywords" - /> + <SearchCommonView :add-title="addTitle" :show-discard="showDiscard" :show-apply="false" :placeholder="'璇疯緭鍏ヤ綅缃�/浜у搧'" :amount-view="false" :search-task-map="searchTaskMap" :show-sreen="false" :screen-array="screenArray" @addCommonClick="addProductClick" @searchClick="getList" @discardBtnClick="discardBtnClick" @delSelectClick="delSelectClick" @switchKeywords="switchKeywords" /> </div> <div class="content_wrap"> <div class="con_left"> @@ -32,24 +18,11 @@ </div> <div class="list-view"> <div class="table"> - <CommonFormTableView - ref="tablelistRef" - :isReorder="true" - :product-table-list="tableList" - @inputContent="inputContent" - @selLocationClick="selLocationClick" - @selProductClick="selProductClick" - @tableRowClick="tableRowClick" - @selRouteClick="selRouteClick" - > + <CommonFormTableView ref="tablelistRef" :isReorder="true" :product-table-list="tableList" @inputContent="inputContent" @selLocationClick="selLocationClick" @selProductClick="selProductClick" @tableRowClick="tableRowClick" @selRouteClick="selRouteClick"> <template slot="tableButton"> <el-table-column label="鎿嶄綔" width="180" align="center"> <template slot-scope="scope"> - <span - v-if="scope.row.isEdit && scope.row.isView" - @click.stop="handleOrderOnceClick(scope.row)" - class="yes-cursor" - > + <span v-if="scope.row.isEdit && scope.row.isView" @click.stop="handleOrderOnceClick(scope.row)" class="yes-cursor"> <i class="el-icon-truck"></i> <span>璁㈣喘涓�娆�</span> </span> @@ -67,393 +40,384 @@ </template> <script> -import CommonFormTableView from "@/components/makepager/CommonFormTableView" -import pageMixin from "@/components/makepager/pager/mixin/pageMixin" -import { - getReorderRuleList, - addReorderRule, - updateReorderRule, - orderAgain, - getLocationTreeList -} from "@/api/product/reorderRules" -import { currentTime } from "@/common/config/index" -export default { - name: "ReorderRules", - props: {}, - components: { CommonFormTableView }, - mixins: [pageMixin], - computed: {}, - data() { - return { - datas: [], - defaultProps: { - children: "children", - label: "jointName" - }, - addTitle: "鏂板缓", - showDiscard: false, - tableList: {}, - tableData: [], - searchOptions: [], - countId: 0, - isNoProduct: true, // 娣诲姞鏄庣粏琛屾椂鏄惁鏈変骇鍝佹湭閫夋嫨 - isRowClick: false, - locationId: 0, - productId: 0, - amount: 0, - operationId: 0, - minInventory: 0, - maxInventory: 1, - orderNumber: 1, - unit: "", - reorderId: 0, - searchTaskMap: [], - type: "bh", - screenArray: [{ id: "0", type: "bh", title: "閲嶆柊璁㈣喘" }] - } - }, - created() { - if (this.$route.params.productId) { - this.getData({ - productId: this.$route.params.productId, - pageSize: 15, - page: 1 - }) - }else if(this.$route.params.locationId){ - this.searchTaskMap=[] - this.getData({ - id: this.$route.params.locationId, - jointName:this.$route.params.locationName, - // type:"", - pageSize: 15, - page: 1 - }) - }else { - this.getData() - } - this.setTable() - this.searchTaskMap = [{ id: "0", type: this.type, title: "閲嶆柊璁㈣喘" }] - this.getLocationList() - }, - methods: { - setTable() { - this.tableList = { - tableData: this.tableData, - selectBox: false, - selectIndex: true, - tableColumn: [ - { label: "浜у搧", prop: "productName", product: true }, - { label: "浣嶇疆", prop: "locationName", defaultLocation: true }, - { label: "鍦ㄥ簱鏁伴噺", prop: "amount" }, - { label: "棰勬祴鏁伴噺", prop: "prediction" }, - { label: "棣栭�夎矾绾�", prop: "route", route: true }, - { label: "鏈�灏忔暟閲�", prop: "minInventory", inputFloat: true }, - { label: "鏈�澶ф暟閲�", prop: "maxInventory", inputFloat: true }, - { label: "璁㈣喘鏁伴噺", prop: "orderNumber", inputFloat: true }, - { label: "璁¢噺鍗曚綅", prop: "unit" } - ] - } - }, - // 璇锋眰鏁版嵁 - async getData(data) { - await getReorderRuleList({ - locationId: data?.id, - type: this.type, - keyWord: data?.jointName, - page: this.pagerOptions.currPage, - pageSize: this.pagerOptions.pageSize, - productId: data?.productId - }).then((res) => { - if (res.code === 200) { - console.log(res) - const list = res.data?.map((item) => { - let orderNum = 0 - if (parseFloat(item.minInventory) - parseFloat(item.prediction) > 0) { - orderNum = this.caculateOrderNumber( - parseFloat(item.minInventory), - parseFloat(item.maxInventory), - parseFloat(item.prediction) - ) - } - return { - ...item, - productName: item.product.name, - locationName: item.location.name, - isSet: false, - isEdit: true, - editable: true, - isOrder: true, - isView: item?.minInventory - item?.prediction > 0 ? true : false, - orderNumber: orderNum - } - }) - this.tableList.tableData = list || [] - this.tableData = list || [] - this.pagerOptions.totalCount = res.total - } - }) - }, - // 鎶�鏈璐暟閲� - caculateOrderNumber(minInventory, maxInventory, prediction) { - return maxInventory > minInventory ? maxInventory - prediction : minInventory - prediction - }, - // 鎿嶄綔杈撳叆 - inputContent(val, prop, row) { - console.log(row) - if (prop === "minInventory") { - this.minInventory = val - if (parseFloat(this.minInventory) - parseFloat(this.prediction) > 0) { - this.orderNumber = this.caculateOrderNumber( - parseFloat(this.minInventory), - parseFloat(this.maxInventory), - parseFloat(this.prediction) - ) - } - } else if (prop === "maxInventory") { - this.maxInventory = val - if (parseFloat(this.minInventory) - parseFloat(this.prediction) > 0) { - this.orderNumber = this.caculateOrderNumber( - parseFloat(this.minInventory), - parseFloat(this.maxInventory), - parseFloat(this.prediction) - ) - } - } else if (prop === "orderNumber") { - this.orderNumber = val - } - }, - // 鏂板 - addProductClick() { - console.log(this.addTitle, "qqqqqqqqqqqq") - this.isSel() - if (this.isNoProduct && this.addTitle === "鏂板缓") { - this.$refs.tablelistRef.getProductList() - this.$refs.tablelistRef.getLocationList() - this.addTitle = "淇濆瓨" - this.showDiscard = true - this.isRowClick = false - this.operationId = 0 - this.currentRowId = 0 - this.countId++ - this.tableData.unshift({ - countId: this.countId, - amount: 0, - minInventory: 0, - productId: "", - maxInventory: 0, - orderNumber: 0, - prediction: 0, - locationId: 0, - createDate: this.currentTime(), - isSet: true, - isEdit: false, - editable: false, - isOrder: true - }) - this.tableList.tableData = this.tableData - this.locationId = 0 - this.productId = 0 - } else { - this.addTitle = "鏂板缓" - this.showDiscard = false - let requestUrl = this.currentRowId === 0 ? addReorderRule : updateReorderRule - let params = this.saveParams() - if(params.productId===0){ - this.$message.warning("璇峰~鍐欎骇鍝佷俊鎭�!") - }else{ - requestUrl(params) - .then((res) => { - console.log(res) - if (res.code === 200) { - let tipStr = this.currentRowId === 0 ? "娣诲姞鎴愬姛" : "淇敼鎴愬姛" - this.$message.success(tipStr) - this.getData() - } - }) - .catch((err) => { - console.log(err) - this.getData() - }) - } - // } - } - }, - saveParams() { + import CommonFormTableView from '@/components/makepager/CommonFormTableView' + import pageMixin from '@/components/makepager/pager/mixin/pageMixin' + import { getReorderRuleList, addReorderRule, updateReorderRule, orderAgain, getLocationTreeList } from '@/api/product/reorderRules' + import { currentTime } from '@/common/config/index' + export default { + name: 'ReorderRules', + props: {}, + components: { CommonFormTableView }, + mixins: [pageMixin], + computed: {}, + data() { return { - id: this.reorderId, - amount: this.amount, - locationId: this.locationId, - maxInventory: this.maxInventory, - minInventory: this.minInventory, - orderNumber: this.orderNumber, - prediction: this.prediction, - operationId: this.operationId, - productId: this.productId, - route: this.route, - unit: this.unit + datas: [], + defaultProps: { + children: 'children', + label: 'name', + }, + addTitle: '鏂板缓', + showDiscard: false, + tableList: {}, + tableData: [], + searchOptions: [], + countId: 0, + isNoProduct: true, // 娣诲姞鏄庣粏琛屾椂鏄惁鏈変骇鍝佹湭閫夋嫨 + isRowClick: false, + locationId: 0, + productId: 0, + amount: 0, + operationId: 0, + minInventory: 0, + maxInventory: 1, + orderNumber: 1, + unit: '', + reorderId: 0, + searchTaskMap: [], + type: 'bh', + screenArray: [{ id: '0', type: 'bh', title: '閲嶆柊璁㈣喘' }], } }, - // 鏄惁閫夋嫨浜у搧 - isSel() { - for (let i = 0; i < this.tableData.length; i++) { - if (this.tableData[i].productName?.length === 0) { - this.isNoProduct = false - break - } else { - this.isNoProduct = true - } - } - }, - // 鍙栨秷 - discardBtnClick() { - this.getData() - this.addTitle = "鏂板缓" - this.showDiscard = false - }, - // 璁㈣喘涓�娆� - handleOrderOnceClick(row) { - let params = { - ...row - } - orderAgain(params).then((res) => { - if (res.code === 200) { - this.$message.success("璁㈣喘鎴愬姛") - this.getData() - } - }) - }, - // 琛岀偣鍑� - tableRowClick(row, rowIndex) { - this.locationId = row.locationId - this.rowIndex = rowIndex - this.reorderId = row.id - this.isSel() - if (!this.isNoProduct && this.currentRowId === 0) { - this.$message.error("璇峰畬鎴愬綋鍓嶆柊寤烘垨鍙栨秷鏂板缓") + created() { + if (this.$route.params.productId) { + this.getData({ + productId: this.$route.params.productId, + pageSize: 15, + page: 1, + }) + } else if (this.$route.params.locationId) { + this.searchTaskMap = [] + this.getData({ + id: this.$route.params.locationId, + jointName: this.$route.params.locationName, + // type:"", + pageSize: 15, + page: 1, + }) } else { - this.currentRowId = row.id - this.addTitle = "淇濆瓨" - this.showDiscard = true - this.isRowClick = true - if (!this.isNoProduct) { - this.tableData.splice(this.tableData.length - 1, 1) + this.getData() + } + this.setTable() + this.searchTaskMap = [{ id: '0', type: this.type, title: '閲嶆柊璁㈣喘' }] + this.getLocationList() + }, + methods: { + setTable() { + this.tableList = { + tableData: this.tableData, + selectBox: false, + selectIndex: true, + tableColumn: [ + { label: '浜у搧', prop: 'productName', product: true }, + { label: '浣嶇疆', prop: 'locationName', defaultLocation: true }, + { label: '鍦ㄥ簱鏁伴噺', prop: 'amount' }, + { label: '棰勬祴鏁伴噺', prop: 'prediction' }, + { label: '棣栭�夎矾绾�', prop: 'route', route: true }, + { label: '鏈�灏忔暟閲�', prop: 'minInventory', inputFloat: true }, + { label: '鏈�澶ф暟閲�', prop: 'maxInventory', inputFloat: true }, + { label: '璁㈣喘鏁伴噺', prop: 'orderNumber', inputFloat: true }, + { label: '璁¢噺鍗曚綅', prop: 'unit' }, + ], } - this.tableData.map((item, index) => { - if (index === rowIndex) { - item.isEdit = false - item.editable = true - item.isOrder = true - } else { - item.isEdit = true + }, + // 璇锋眰鏁版嵁 + async getData(data) { + await getReorderRuleList({ + locationId: data?.id, + type: this.type, + keyWord: data?.jointName, + page: this.pagerOptions.currPage, + pageSize: this.pagerOptions.pageSize, + productId: data?.productId, + }).then((res) => { + if (res.code === 200) { + console.log(res) + const list = res.data?.map((item) => { + let orderNum = 0 + if (parseFloat(item.minInventory) - parseFloat(item.prediction) > 0) { + orderNum = this.caculateOrderNumber(parseFloat(item.minInventory), parseFloat(item.maxInventory), parseFloat(item.prediction)) + } + return { + ...item, + productName: item.product.name, + locationName: item.location.name, + isSet: false, + isEdit: true, + editable: true, + isOrder: true, + isView: item?.minInventory - item?.prediction > 0 ? true : false, + orderNumber: orderNum, + } + }) + this.tableList.tableData = list || [] + this.tableData = list || [] + this.pagerOptions.totalCount = res.total } }) - this.minInventory = row.minInventory - this.amount = row.amount - this.productId = row.productId - this.maxInventory = row.maxInventory - this.orderNumber = row.orderNumber - this.prediction = row.prediction + }, + // 鎶�鏈璐暟閲� + caculateOrderNumber(minInventory, maxInventory, prediction) { + return maxInventory > minInventory ? maxInventory - prediction : minInventory - prediction + }, + // 鎿嶄綔杈撳叆 + inputContent(val, prop, row) { + console.log(row) + if (prop === 'minInventory') { + this.minInventory = val + if (parseFloat(this.minInventory) - parseFloat(this.prediction) > 0) { + this.orderNumber = this.caculateOrderNumber(parseFloat(this.minInventory), parseFloat(this.maxInventory), parseFloat(this.prediction)) + } + } else if (prop === 'maxInventory') { + this.maxInventory = val + if (parseFloat(this.minInventory) - parseFloat(this.prediction) > 0) { + this.orderNumber = this.caculateOrderNumber(parseFloat(this.minInventory), parseFloat(this.maxInventory), parseFloat(this.prediction)) + } + } else if (prop === 'orderNumber') { + this.orderNumber = val + } + }, + // 鏂板 + addProductClick() { + console.log(this.addTitle, 'qqqqqqqqqqqq') + this.isSel() + if (this.isNoProduct && this.addTitle === '鏂板缓') { + this.$refs.tablelistRef.getProductList() + this.$refs.tablelistRef.getLocationList() + this.addTitle = '淇濆瓨' + this.showDiscard = true + this.isRowClick = false + this.operationId = 0 + this.currentRowId = 0 + this.countId++ + this.tableData.unshift({ + countId: this.countId, + amount: 0, + minInventory: 0, + productId: '', + maxInventory: 0, + orderNumber: 0, + prediction: 0, + locationId: 0, + createDate: this.currentTime(), + isSet: true, + isEdit: false, + editable: false, + isOrder: true, + }) + this.tableList.tableData = this.tableData + this.locationId = 0 + this.productId = 0 + } else { + this.addTitle = '鏂板缓' + this.showDiscard = false + let requestUrl = this.currentRowId === 0 ? addReorderRule : updateReorderRule + let params = this.saveParams() + if (params.productId === 0) { + this.$message.warning('璇峰~鍐欎骇鍝佷俊鎭�!') + } else { + requestUrl(params) + .then((res) => { + console.log(res) + if (res.code === 200) { + let tipStr = this.currentRowId === 0 ? '娣诲姞鎴愬姛' : '淇敼鎴愬姛' + this.$message.success(tipStr) + this.getData() + } + }) + .catch((err) => { + console.log(err) + this.getData() + }) + } + // } + } + }, + saveParams() { + return { + id: this.reorderId, + amount: this.amount, + locationId: this.locationId, + maxInventory: this.maxInventory, + minInventory: this.minInventory, + orderNumber: this.orderNumber, + prediction: this.prediction, + operationId: this.operationId, + productId: this.productId, + route: this.route, + unit: this.unit, + } + }, + // 鏄惁閫夋嫨浜у搧 + isSel() { + for (let i = 0; i < this.tableData.length; i++) { + if (this.tableData[i].productName?.length === 0) { + this.isNoProduct = false + break + } else { + this.isNoProduct = true + } + } + }, + // 鍙栨秷 + discardBtnClick() { + this.getData() + this.addTitle = '鏂板缓' + this.showDiscard = false + }, + // 璁㈣喘涓�娆� + handleOrderOnceClick(row) { + let params = { + ...row, + } + orderAgain(params).then((res) => { + if (res.code === 200) { + this.$message.success('璁㈣喘鎴愬姛') + this.getData() + } + }) + }, + // 琛岀偣鍑� + tableRowClick(row, rowIndex) { this.locationId = row.locationId - } + this.rowIndex = rowIndex + this.reorderId = row.id + this.isSel() + if (!this.isNoProduct && this.currentRowId === 0) { + this.$message.error('璇峰畬鎴愬綋鍓嶆柊寤烘垨鍙栨秷鏂板缓') + } else { + this.currentRowId = row.id + this.addTitle = '淇濆瓨' + this.showDiscard = true + this.isRowClick = true + if (!this.isNoProduct) { + this.tableData.splice(this.tableData.length - 1, 1) + } + this.tableData.map((item, index) => { + if (index === rowIndex) { + item.isEdit = false + item.editable = true + item.isOrder = true + } else { + item.isEdit = true + } + }) + this.minInventory = row.minInventory + this.amount = row.amount + this.productId = row.productId + this.maxInventory = row.maxInventory + this.orderNumber = row.orderNumber + this.prediction = row.prediction + this.locationId = row.locationId + } + }, + // 鎼滅储 + getList(val) { + this.keyword = val + this.pagerOptions.currPage = 1 + this.getData() + }, + // 閫変腑浣嶇疆鏂规硶 + selLocationClick(item, prop) { + console.log(item, prop) + this.locationId = item?.value ?? item?.id + }, + // 閫変腑浜у搧鏂规硶 + selProductClick(item) { + this.productId = item.productId + this.unit = item.unit + this.amount = item.amount + this.prediction = item.prediction + }, + // 閫変腑璺嚎鏂规硶 + selRouteClick(item, prop) { + console.log(item, prop) + this.route = item.label + }, + // 鑾峰彇褰撳墠鏃堕棿 + currentTime() { + return currentTime() + }, + //鏍戠偣鍑� + handleNodeClick(data) { + console.log(data, 'sss') + this.getData(data) + }, + async getLocationList() { + await getLocationTreeList().then((res) => { + this.datas = [ + { + id: 0, + jointName: '鍏ㄩ儴', + children: [], + }, + ...res.data, + ] + }) + }, + // 鍒犻櫎type + delSelectClick() { + this.type = '' + this.getData() + }, + switchKeywords(item) { + console.log(item, 'switchKeywords') + this.type = item?.length > 0 ? 'bh' : '' + this.getData() + }, }, - // 鎼滅储 - getList(val) { - this.keyword = val - this.pagerOptions.currPage = 1 - this.getData() - }, - // 閫変腑浣嶇疆鏂规硶 - selLocationClick(item, prop) { - console.log(item, prop) - this.locationId = item?.value ?? item?.id - }, - // 閫変腑浜у搧鏂规硶 - selProductClick(item) { - this.productId = item.productId - this.unit = item.unit - this.amount = item.amount - this.prediction = item.prediction - }, - // 閫変腑璺嚎鏂规硶 - selRouteClick(item, prop) { - console.log(item, prop) - this.route = item.label - }, - // 鑾峰彇褰撳墠鏃堕棿 - currentTime() { - return currentTime() - }, - //鏍戠偣鍑� - handleNodeClick(data) { - console.log(data, "sss") - this.getData(data) - }, - async getLocationList() { - await getLocationTreeList().then((res) => { - this.datas = [ - { - id: 0, - jointName: "鍏ㄩ儴", - children: [] - }, - ...res.data - ] - }) - }, - // 鍒犻櫎type - delSelectClick() { - this.type = "" - this.getData() - }, - switchKeywords(item) { - console.log(item, "switchKeywords") - this.type = item?.length > 0 ? "bh" : "" - this.getData() - } } -} </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> -::v-deep { - .el-table { - border-top-left-radius: 12px; - border-top-right-radius: 12px; - overflow: auto; - } - .content_wrap { - height: calc(100% - 0px); - display: flex; - justify-content: space-between; - .con_left { - max-height: calc(100% - 40px); - overflow: hidden; - width: 190px; - margin-right: 10px; - .el-checkbox-group { - width: 100%; - display: flex; - flex-direction: column; - } - .stash { - display: flex; - flex-direction: column; - .el-tree { - background-color: #e6ecf2; + ::v-deep { + .el-table { + border-top-left-radius: 12px; + border-top-right-radius: 12px; + overflow: auto; + } + .content_wrap { + height: calc(100% - 0px); + display: flex; + justify-content: space-between; + .con_left { + max-height: calc(100% - 90px); + overflow: auto; + width: 160px; + margin-right: 10px; + .el-checkbox-group { + width: 100%; + display: flex; + flex-direction: column; + } + .stash { + display: flex; + flex-direction: column; + .el-tree { + background-color: #e6ecf2; + } } } + .list-view { + flex: 1; + } } - .list-view { - flex: 1; + .span-ellipsis { + // overflow: auto; + // white-space: nowrap; + // text-overflow: ellipsis; + font-size: 13px; + padding: 0px 10px; } } - .span-ellipsis { + + ::v-deep { + .el-tree-node > .el-tree-node__children { + overflow: visible !important; + } + .el-tree-node__content:hover, .el-upload-list__item:hover { width: 100%; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - font-size: 13px; - } } + } </style> -- Gitblit v1.8.0