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/warehouseManage/listingRules/index.vue | 759 ++++++++++++++++++++++++++++----------------------------- 1 files changed, 373 insertions(+), 386 deletions(-) diff --git a/src/views/warehouseManage/listingRules/index.vue b/src/views/warehouseManage/listingRules/index.vue index 32b3b4c..5403cc1 100644 --- a/src/views/warehouseManage/listingRules/index.vue +++ b/src/views/warehouseManage/listingRules/index.vue @@ -1,37 +1,25 @@ <template> <div class="rightContent"> <div class="top"> - <SearchCommonView - :add-title="addTitle" - :show-discard="showDiscard" - :placeholder="'璇疯緭鍏ヤ骇鍝�/浜у搧绫诲埆'" - :amount-view="false" - :search-task-map="searchTaskMap" - @addCommonClick="addProductClick" - @searchClick="getList" - @discardBtnClick="discardBtnClick" - @applyBtnClick="applyBtnClick" - @delSelectClick="delSelectClick" - /> + <SearchCommonView :add-title="addTitle" :show-discard="showDiscard" :placeholder="'璇疯緭鍏ヤ骇鍝�/浜у搧绫诲埆'" :amount-view="false" :search-task-map="searchTaskMap" @addCommonClick="addProductClick" @searchClick="getList" @discardBtnClick="discardBtnClick" @applyBtnClick="applyBtnClick" @delSelectClick="delSelectClick" /> </div> <div class="list-view"> <div class="table"> - <CommonFormTableView - ref="tableRef" - :islistingrules="true" - :product-table-list="tableList" - @inputContent="inputContent" - @tableRowClick="tableRowClick" - @selLocationClick="selLocationClick" - @selSonLocationClick="selSonLocationClick" - @querySearchData="querySearchData" - @selProductClick="selProductClick" - > + <CommonFormTableView ref="tableRef" + :islistingrules="true" + :product-table-list="tableList" + :isOperateAdd="false" + @inputContent="inputContent" + @tableRowClick="tableRowClick" + @selLocationClick="selLocationClick" + @selSonLocationClick="selSonLocationClick" + @querySearchData="querySearchData" + @selProductClick="selProductClick"> <!-- @selProductTypeClick="selProductTypeClick" --> <template slot="tableButton"> - <el-table-column label="鎿嶄綔" width="90" align="center"> + <el-table-column label="鎿嶄綔" width="120" align="center"> <template slot-scope="scope"> <span v-if="scope.row.isEdit" @click.stop="delClick(scope)" class="yes-cursor"> <span style="color: #2a78fb">鍒犻櫎</span> @@ -49,386 +37,385 @@ </template> <script> -import CommonFormTableView from "@/components/makepager/CommonFormTableView" -import pageMixin from "@/components/makepager/pager/mixin/pageMixin" -import { - getListingRulesList, - addListingRules, - updateListingRules, - deleteListingRules -} from "@/api/warehouseManage/listingRules" -export default { - name: "listingRules", - props: {}, - components: { CommonFormTableView }, - mixins: [pageMixin], - computed: {}, - data() { - return { - addTitle: "鏂板缓", - showDiscard: false, - tableList: {}, - searchOptions: [], - countId: 0, - isNoProduct: true, // 娣诲姞鏄庣粏琛屾椂鏄惁鏈変骇鍝佹湭閫夋嫨 - isRowClick: false, - areaId: 0, - productId: 0, - productCategoryId: 0, - subLocationId: 0, - currentRowId: 0, - rowIndex: -1, - RuleType: 0, - queryProductId: null, - categoryId: null, - searchTaskMap: [], - isCreate: false, - thatRow: {} - } - }, - created() { - this.setTable() - let query = this.$route.query - if (query) { - this.queryProductId = query.productId?.length ? query.productId : null - this.categoryId = query.id ? Number(query.id) : null - this.pagerOptions.currPage = 1 - this.searchTaskMap = - query?.id > 0 - ? [{ categoryId: this.categoryId, title: query.categoryName }] - : query.productId?.length > 0 - ? [{ productId: this.queryProductId, title: query.productName }] - : [] - console.log(this.searchTaskMap) - } - this.getData() - }, - methods: { - setTable() { - this.tableList = { - tableData: [], - selectBox: false, - selectIndex: true, - tableColumn: [ - { label: "褰撲骇鍝佸埌杈�", prop: "areaName", toLocation: true }, - { label: "浜у搧", prop: "productName", product: true }, - { label: "浜у搧绫诲埆", prop: "productCategory", productType: true }, - { label: "瀛樺偍鍒板瓙浣嶇疆", prop: "subLocation", sonLocation: true } - // { label: "鍏徃", prop: "companyName", company: true } - ], - rowClickIndex: -1 + import CommonFormTableView from '@/components/makepager/CommonFormTableView' + import pageMixin from '@/components/makepager/pager/mixin/pageMixin' + import { getListingRulesList, addListingRules, updateListingRules, deleteListingRules } from '@/api/warehouseManage/listingRules' + export default { + name: 'listingRules', + props: {}, + components: { CommonFormTableView }, + mixins: [pageMixin], + computed: {}, + data() { + return { + addTitle: '鏂板缓', + showDiscard: false, + tableList: {}, + searchOptions: [], + countId: 0, + isNoProduct: true, // 娣诲姞鏄庣粏琛屾椂鏄惁鏈変骇鍝佹湭閫夋嫨 + isRowClick: false, + areaId: 0, + productId: 0, + productCategoryId: 0, + subLocationId: 0, + currentRowId: 0, + rowIndex: -1, + RuleType: 0, + queryProductId: null, + categoryId: null, + searchTaskMap: [], + isCreate: false, + thatRow: {}, } }, - // 璇锋眰鏁版嵁 - async getData() { - await getListingRulesList({ - productId: this.queryProductId ? this.queryProductId : null, - productCategoryId: this.categoryId ? this.categoryId : null, - page: this.pagerOptions.currPage, - pageSize: this.pagerOptions.pageSize - }).then((res) => { - if (res.code === 200) { - const list = res.data.map((item) => { - return { - ...item, - areaName: { label: item.area.jointName, value: item.area.id }, - subLocation: { label: item.location.jointName, value: item.location.id }, - productName: item.product.name, - productCategory: item.productCategory.name, - isSet: false, - isEdit: true - } - }) - this.tableList.tableData = list || [] - this.tableData = list || [] - this.pagerOptions.totalCount = res.total - } - }) - }, - // 鎿嶄綔杈撳叆 - inputContent(val, prop, row) { - this.countId = row.countId - this.tableData.map((item) => { - if (item.countId === row.countId) { - item[prop] = val - } - }) - }, - // 鏂板 - addProductClick() { - this.isCreate = true - this.tableList.tableColumn[1].product = true - this.tableList.tableColumn[2].productType = true - console.log(this.tableData) - this.isSel() - if (this.isNoProduct && this.addTitle === "鏂板缓") { - this.addTitle = "淇濆瓨" - this.showDiscard = true - this.isRowClick = false - this.currentRowId = 0 - this.countId++ - this.tableData.unshift({ - countId: this.countId, - areaId: 0, - areaName: "", - locationId: 0, - productId: "", - subLocation: "", - productName: "", - companyName: "", - productCategory: "", - isSet: true, - isEdit: false, - isOrder: true - }) - this.areaId = 0 - this.subLocationId = 0 - this.productCategoryId = 0 - this.productId = 0 - } else { - if (this.areaId === 0) { - this.$message.error("璇烽�夋嫨褰撳墠浜у搧鍒拌揪浣嶇疆") - } else if (this.productId === 0 && this.productCategoryId === 0) { - this.$message.error("璇烽�夋嫨浜у搧鎴栦骇鍝佺被鍒�") - } else if (this.subLocationId === 0) { - this.$message.error("璇烽�夋嫨瀛樺偍鍒板瓙浣嶇疆") - } else { - this.addTitle = "鏂板缓" - this.showDiscard = false - this.tableData.map((item) => { - item.isEdit = true - console.log(item) - if (typeof item.location === "object") { - item.location = item.location.name - } - if (typeof item.subLocation === "object") { - item.location = item.subLocation.name - } - }) - let requestUrl = this.currentRowId === 0 ? addListingRules : updateListingRules - requestUrl({ - RuleType: this.RuleType, - id: this.currentRowId, - areaId: this.areaId, - locationId: this.subLocationId, - productCategoryId: this.productCategoryId, - productId: this.productId - }).then((res) => { - console.log(res) - if (res.code === 200) { - this.getData() - let tipStr = this.currentRowId === 0 ? "娣诲姞鎴愬姛" : "淇敼鎴愬姛" - this.$message.success(tipStr) - this.isCreate = false - } - }) - } + created() { + this.setTable() + let query = this.$route.query + if (query) { + this.queryProductId = query.productId?.length ? query.productId : null + this.categoryId = query.id ? Number(query.id) : null + this.pagerOptions.currPage = 1 + this.searchTaskMap = query?.id > 0 ? [{ categoryId: this.categoryId, title: query.categoryName }] : query.productId?.length > 0 ? [{ productId: this.queryProductId, title: query.productName }] : [] + console.log(this.searchTaskMap) } - }, - // 鏄惁閫夋嫨浜у搧 - isSel() { - for (let i = 0; i < this.tableData.length; i++) { - if (this.tableData[i].productName.length === 0) { - this.isNoProduct = true // 鏆傛椂淇敼涓簍rue锛屽鏋滀骇鍝佷互鍚庢槸蹇呭~锛屾敼涓篺alse灏辫 - break - } else { - this.isNoProduct = true - } - } - }, - // 鍙栨秷 - discardBtnClick() { this.getData() - this.isCreate = false - this.tableList.tableColumn[1].product = true - this.tableList.tableColumn[2].productType = true - this.addTitle = "鏂板缓" - this.showDiscard = false }, - // 搴旂敤鍏ㄩ儴 - applyBtnClick() { - console.log("搴旂敤鍏ㄩ儴") - }, - // 鍘嗗彶 - handleHistoryClick(row) { - this.isSel() - console.log(row) - if (this.isNoProduct) { - console.log("鍘嗗彶") - this.$router.push({ - name: "inventoryAdjustmentHistory", - params: { id: row.id } - }) - } - }, - // 璁剧疆 - handleSetClick(scope) { - this.isSel() - if (this.isNoProduct) { - scope.row.isSet = !scope.row.isSet - } - }, - // 搴旂敤 - handleUseClick(scope) { - scope.row.isSet = !scope.row.isSet - }, - // 娓呴櫎 - handleCleanupClick(scope) { - scope.row.isSet = !scope.row.isSet - }, - // 琛岀偣鍑� - tableRowClick(row, rowIndex) { - this.thatRow = row - this.tableList.rowClickIndex = rowIndex - this.rowIndex = rowIndex - this.isSel() - if (!this.isNoProduct && this.currentRowId === 0) { - this.$message.error("璇峰畬鎴愬綋鍓嶆柊寤烘垨鍙栨秷鏂板缓") - } else { - this.currentRowId = row.id || 0 - 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.isOrder = true - } else { - item.isEdit = true - } - }) - this.areaId = row.areaId - this.subLocationId = row.locationId - this.productCategoryId = row.productCategoryId - this.productId = row.productId + methods: { + setTable() { + this.tableList = { + tableData: [], + selectBox: false, + selectIndex: true, + tableColumn: [ + { label: '褰撲骇鍝佸埌杈�', prop: 'areaName', toLocation: true }, + { label: '浜у搧', prop: 'productName', product: true }, + { label: '浜у搧绫诲埆', prop: 'productCategory', productType: true }, + { label: '瀛樺偍鍒板瓙浣嶇疆', prop: 'subLocation', sonLocation: true }, + // { label: "鍏徃", prop: "companyName", company: true } + ], + rowClickIndex: -1, } - } - }, - querySearchData(queryString, results, value) { - if (this.isCreate) { - if (queryString === "") { - this.tableList.tableColumn[1].product = true - this.tableList.tableColumn[2].productType = true + }, + // 璇锋眰鏁版嵁 + async getData() { + await getListingRulesList({ + productId: this.queryProductId ? this.queryProductId : null, + productCategoryId: this.categoryId ? this.categoryId : null, + page: this.pagerOptions.currPage, + pageSize: this.pagerOptions.pageSize, + }).then((res) => { + if (res.code === 200) { + const list = res.data.map((item) => { + return { + ...item, + areaName: { label: item.area.jointName, value: item.area.id }, + subLocation: { label: item.location.jointName, value: item.location.id }, + productName: item.product.name, + productCategory: item.productCategory.name, + isSet: false, + isEdit: true, + } + }) + this.tableList.tableData = list || [] + this.tableData = list || [] + this.pagerOptions.totalCount = res.total + } + }) + }, + // 鎿嶄綔杈撳叆 + inputContent(val, prop, row) { + this.countId = row.countId + this.tableData.map((item) => { + if (item.countId === row.countId) { + item[prop] = val + } + }) + }, + // 鏂板 + addProductClick() { + this.isCreate = true + this.tableList.tableColumn[1].product = true + this.tableList.tableColumn[2].productType = true + console.log(this.tableData) + this.isSel() + if (this.isNoProduct && this.addTitle === '鏂板缓') { + this.addTitle = '淇濆瓨' + this.showDiscard = true + this.isRowClick = false + this.currentRowId = 0 + this.countId++ + this.tableData.unshift({ + countId: this.countId, + areaId: 0, + areaName: '', + locationId: 0, + productId: '', + subLocation: '', + productName: '', + companyName: '', + productCategory: '', + isSet: true, + isEdit: false, + isOrder: true, + }) + this.areaId = 0 + this.subLocationId = 0 + this.productCategoryId = 0 + this.productId = 0 } else { - if (value === "product") { - this.tableList.tableColumn[2].productType = false - if (results.length !== 0) { - this.productId = results[0].id - } else { - this.productId = 0 - } - } else if (value === "productType") { - this.tableList.tableColumn[1].product = false - if (results.length !== 0) { - this.productCategoryId = results[0].id - } else { - this.productCategoryId = 0 + if (this.areaId === 0) { + this.$message.error('璇烽�夋嫨褰撳墠浜у搧鍒拌揪浣嶇疆') + } else if (this.productId === 0 && this.productCategoryId === 0) { + this.$message.error('璇烽�夋嫨浜у搧鎴栦骇鍝佺被鍒�') + } else if (this.subLocationId === 0) { + this.$message.error('璇烽�夋嫨瀛樺偍鍒板瓙浣嶇疆') + } else { + this.addTitle = '鏂板缓' + this.showDiscard = false + this.tableData.map((item) => { + item.isEdit = true + console.log(item) + if (typeof item.location === 'object') { + item.location = item.location.name + } + if (typeof item.subLocation === 'object') { + item.location = item.subLocation.name + } + }) + let requestUrl = this.currentRowId === 0 ? addListingRules : updateListingRules + requestUrl({ + RuleType: this.RuleType, + id: this.currentRowId, + areaId: this.areaId, + locationId: this.subLocationId, + productCategoryId: this.productCategoryId, + productId: this.productId, + }).then((res) => { + console.log(res) + if (res.code === 200) { + this.getData() + let tipStr = this.currentRowId === 0 ? '娣诲姞鎴愬姛' : '淇敼鎴愬姛' + this.$message.success(tipStr) + this.isCreate = false + } + }) + } + } + }, + // 鏄惁閫夋嫨浜у搧 + isSel() { + for (let i = 0; i < this.tableData.length; i++) { + if (this.tableData[i].productName.length === 0) { + this.isNoProduct = true // 鏆傛椂淇敼涓簍rue锛屽鏋滀骇鍝佷互鍚庢槸蹇呭~锛屾敼涓篺alse灏辫 + break + } else { + this.isNoProduct = true + } + } + }, + // 鍙栨秷 + discardBtnClick() { + this.getData() + this.isCreate = false + this.tableList.tableColumn[1].product = true + this.tableList.tableColumn[2].productType = true + this.addTitle = '鏂板缓' + this.showDiscard = false + }, + // 搴旂敤鍏ㄩ儴 + applyBtnClick() { + console.log('搴旂敤鍏ㄩ儴') + }, + // 鍘嗗彶 + handleHistoryClick(row) { + this.isSel() + console.log(row) + if (this.isNoProduct) { + console.log('鍘嗗彶') + this.$router.push({ + name: 'inventoryAdjustmentHistory', + params: { id: row.id }, + }) + } + }, + // 璁剧疆 + handleSetClick(scope) { + this.isSel() + if (this.isNoProduct) { + scope.row.isSet = !scope.row.isSet + } + }, + // 搴旂敤 + handleUseClick(scope) { + scope.row.isSet = !scope.row.isSet + }, + // 娓呴櫎 + handleCleanupClick(scope) { + scope.row.isSet = !scope.row.isSet + }, + // 琛岀偣鍑� + tableRowClick(row, rowIndex) { + this.thatRow = row + this.tableList.rowClickIndex = rowIndex + this.rowIndex = rowIndex + this.isSel() + if (!this.isNoProduct && this.currentRowId === 0) { + this.$message.error('璇峰畬鎴愬綋鍓嶆柊寤烘垨鍙栨秷鏂板缓') + } else { + this.currentRowId = row.id || 0 + 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.isOrder = true + } else { + item.isEdit = true + } + }) + this.areaId = row.areaId + this.subLocationId = row.locationId + this.productCategoryId = row.productCategoryId + this.productId = row.productId + } + } + }, + querySearchData(queryString, results, value) { + if (this.isCreate) { + if (queryString === '') { + this.tableList.tableColumn[1].product = true + this.tableList.tableColumn[2].productType = true + } else { + if (value === 'product') { + this.tableList.tableColumn[2].productType = false + if (results.length !== 0) { + this.productId = results[0].id + } else { + this.productId = 0 + } + } else if (value === 'productType') { + this.tableList.tableColumn[1].product = false + if (results.length !== 0) { + this.productCategoryId = results[0].id + } else { + this.productCategoryId = 0 + } } } } - } - }, - // 鎼滅储 - getList(val) { - this.keyword = val - this.pagerOptions.currPage = 1 - this.getData() - }, - // 鏂板缓 - addBtnClick() { - this.editConfig.infomation = { - name: "", - parentId: null, - type: 3, - isScrapLocation: null, - isReturnLocation: null, - replenishLocation: null, - countFrequency: 0, - recentlyCount: "", - nextCount: "", - notes: "" - } - this.editConfig.visible = true - this.editConfig.title = "鏂板缓" - }, - // 閫夋嫨璧峰浣嶇疆鏂规硶 - selLocationClick(item, prop) { - if (prop === "areaName") { - this.areaId = item.value - } else if (prop === "subLocation") { + }, + // 鎼滅储 + getList(val) { + this.keyword = val + this.pagerOptions.currPage = 1 + this.getData() + }, + // 鏂板缓 + addBtnClick() { + this.editConfig.infomation = { + name: '', + parentId: null, + type: 3, + isScrapLocation: null, + isReturnLocation: null, + replenishLocation: null, + countFrequency: 0, + recentlyCount: '', + nextCount: '', + notes: '', + } + this.editConfig.visible = true + this.editConfig.title = '鏂板缓' + }, + // 閫夋嫨璧峰浣嶇疆鏂规硶 + selLocationClick(item, prop) { + if (prop === 'areaName') { + this.areaId = item.value + } else if (prop === 'subLocation') { + this.subLocationId = item.value + } + }, + // 閫夋嫨瀛愪綅缃柟娉� + selSonLocationClick(item) { this.subLocationId = item.value - } - }, - // 閫夋嫨瀛愪綅缃柟娉� - selSonLocationClick(item) { - this.subLocationId = item.value - }, - // 閫変腑浜у搧鏂规硶 - selProductClick(value, item) { - console.log(value, item) - if (value === "product") { - this.RuleType = 1 - this.tableList.tableColumn[2].productType = false - this.productId = item.productId - this.productCategoryId = item.categoryId - } else if (value === "productType") { - this.productCategoryId = item.id - this.RuleType = 2 - this.tableList.tableColumn[1].product = false - } - }, - // 鍒犻櫎 - async delClick(scope) { - console.log(scope) - await deleteListingRules(scope.row.id).then((res) => { - if (res.code === 200) { - this.$message.success("鍒犻櫎鎴愬姛") - this.getData() - } - }) - }, - // 鍒犻櫎浜у搧绫诲瀷 - delSelectClick() { - this.categoryId = 0 - this.queryProductId = "" - this.getData() - } - }, - watch: { - rowIndex(newVal) { - if (this.isCreate) { - if (newVal === 0) { - this.tableList.tableColumn[1].product = true - this.tableList.tableColumn[2].productType = true - } else { - this.$message.error("璇峰畬鎴愬綋鍓嶆柊寤烘垨鍙栨秷鏂板缓") - this.tableList.tableColumn[1].product = false + }, + // 閫変腑浜у搧鏂规硶 + selProductClick(value, item) { + console.log(value, item) + if (value === 'product') { + this.RuleType = 1 this.tableList.tableColumn[2].productType = false - } - } else { - if (this.tableList.tableData[newVal].productName === "") { + this.productId = item.productId + this.productCategoryId = item.categoryId + } else if (value === 'productType') { + this.productCategoryId = item.id + this.RuleType = 2 this.tableList.tableColumn[1].product = false - this.tableList.tableColumn[2].productType = true - } else { - this.tableList.tableColumn[1].product = true - this.tableList.tableColumn[2].productType = false } - } - this.$refs.tableRef.getProductCategoryList() - } + }, + // 鍒犻櫎 + delClick(scope) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ヨ鍒�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + }) + .then(() => { + deleteListingRules(scope.row.id).then((res) => { + if (res.code === 200) { + this.$message.success('鍒犻櫎鎴愬姛') + this.getData() + }else{ + this.$message.error('鍒犻櫎鏃跺嚭閿欙紝璇风◢鍚庨噸璇曟垨鑱旂郴绠$悊鍛�...'); + } + }) + }) + .catch(() => {}) + }, + // 鍒犻櫎浜у搧绫诲瀷 + delSelectClick() { + this.categoryId = 0 + this.queryProductId = '' + this.getData() + }, + }, + watch: { + rowIndex(newVal) { + if (this.isCreate) { + if (newVal === 0) { + this.tableList.tableColumn[1].product = true + this.tableList.tableColumn[2].productType = true + } else { + this.$message.error('璇峰畬鎴愬綋鍓嶆柊寤烘垨鍙栨秷鏂板缓') + this.tableList.tableColumn[1].product = false + this.tableList.tableColumn[2].productType = false + } + } else { + if (this.tableList.tableData[newVal].productName === '') { + this.tableList.tableColumn[1].product = false + this.tableList.tableColumn[2].productType = true + } else { + this.tableList.tableColumn[1].product = true + this.tableList.tableColumn[2].productType = false + } + } + this.$refs.tableRef.getProductCategoryList() + }, + }, } -} </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; + ::v-deep { + .el-table { + border-top-left-radius: 12px; + border-top-right-radius: 12px; + overflow: auto; + } } -} </style> -- Gitblit v1.8.0