| | |
| | | <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" |
| | | <CommonFormTableView ref="tableRef" |
| | | :islistingrules="true" |
| | | :product-table-list="tableList" |
| | | :isOperateAdd="false" |
| | | @inputContent="inputContent" |
| | | @tableRowClick="tableRowClick" |
| | | @selLocationClick="selLocationClick" |
| | | @selSonLocationClick="selSonLocationClick" |
| | | @querySearchData="querySearchData" |
| | | @selProductClick="selProductClick" |
| | | > |
| | | @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> |
| | |
| | | </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" |
| | | 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", |
| | | name: 'listingRules', |
| | | props: {}, |
| | | components: { CommonFormTableView }, |
| | | mixins: [pageMixin], |
| | | computed: {}, |
| | | data() { |
| | | return { |
| | | addTitle: "新建", |
| | | addTitle: '新建', |
| | | showDiscard: false, |
| | | tableList: {}, |
| | | searchOptions: [], |
| | |
| | | categoryId: null, |
| | | searchTaskMap: [], |
| | | isCreate: false, |
| | | thatRow: {} |
| | | thatRow: {}, |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | 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 }] |
| | | : [] |
| | | 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() |
| | |
| | | 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: '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 |
| | | rowClickIndex: -1, |
| | | } |
| | | }, |
| | | // 请求数据 |
| | |
| | | productId: this.queryProductId ? this.queryProductId : null, |
| | | productCategoryId: this.categoryId ? this.categoryId : null, |
| | | page: this.pagerOptions.currPage, |
| | | pageSize: this.pagerOptions.pageSize |
| | | pageSize: this.pagerOptions.pageSize, |
| | | }).then((res) => { |
| | | if (res.code === 200) { |
| | | const list = res.data.map((item) => { |
| | |
| | | productName: item.product.name, |
| | | productCategory: item.productCategory.name, |
| | | isSet: false, |
| | | isEdit: true |
| | | isEdit: true, |
| | | } |
| | | }) |
| | | this.tableList.tableData = list || [] |
| | |
| | | this.tableList.tableColumn[2].productType = true |
| | | console.log(this.tableData) |
| | | this.isSel() |
| | | if (this.isNoProduct && this.addTitle === "新建") { |
| | | this.addTitle = "保存" |
| | | if (this.isNoProduct && this.addTitle === '新建') { |
| | | this.addTitle = '保存' |
| | | this.showDiscard = true |
| | | this.isRowClick = false |
| | | this.currentRowId = 0 |
| | |
| | | this.tableData.unshift({ |
| | | countId: this.countId, |
| | | areaId: 0, |
| | | areaName: "", |
| | | areaName: '', |
| | | locationId: 0, |
| | | productId: "", |
| | | subLocation: "", |
| | | productName: "", |
| | | companyName: "", |
| | | productCategory: "", |
| | | productId: '', |
| | | subLocation: '', |
| | | productName: '', |
| | | companyName: '', |
| | | productCategory: '', |
| | | isSet: true, |
| | | isEdit: false, |
| | | isOrder: true |
| | | isOrder: true, |
| | | }) |
| | | this.areaId = 0 |
| | | this.subLocationId = 0 |
| | |
| | | this.productId = 0 |
| | | } else { |
| | | if (this.areaId === 0) { |
| | | this.$message.error("请选择当前产品到达位置") |
| | | this.$message.error('请选择当前产品到达位置') |
| | | } else if (this.productId === 0 && this.productCategoryId === 0) { |
| | | this.$message.error("请选择产品或产品类别") |
| | | this.$message.error('请选择产品或产品类别') |
| | | } else if (this.subLocationId === 0) { |
| | | this.$message.error("请选择存储到子位置") |
| | | this.$message.error('请选择存储到子位置') |
| | | } else { |
| | | this.addTitle = "新建" |
| | | this.addTitle = '新建' |
| | | this.showDiscard = false |
| | | this.tableData.map((item) => { |
| | | item.isEdit = true |
| | | console.log(item) |
| | | if (typeof item.location === "object") { |
| | | if (typeof item.location === 'object') { |
| | | item.location = item.location.name |
| | | } |
| | | if (typeof item.subLocation === "object") { |
| | | if (typeof item.subLocation === 'object') { |
| | | item.location = item.subLocation.name |
| | | } |
| | | }) |
| | |
| | | areaId: this.areaId, |
| | | locationId: this.subLocationId, |
| | | productCategoryId: this.productCategoryId, |
| | | productId: this.productId |
| | | productId: this.productId, |
| | | }).then((res) => { |
| | | console.log(res) |
| | | if (res.code === 200) { |
| | | this.getData() |
| | | let tipStr = this.currentRowId === 0 ? "添加成功" : "修改成功" |
| | | let tipStr = this.currentRowId === 0 ? '添加成功' : '修改成功' |
| | | this.$message.success(tipStr) |
| | | this.isCreate = false |
| | | } |
| | |
| | | this.isCreate = false |
| | | this.tableList.tableColumn[1].product = true |
| | | this.tableList.tableColumn[2].productType = true |
| | | this.addTitle = "新建" |
| | | this.addTitle = '新建' |
| | | this.showDiscard = false |
| | | }, |
| | | // 应用全部 |
| | | applyBtnClick() { |
| | | console.log("应用全部") |
| | | console.log('应用全部') |
| | | }, |
| | | // 历史 |
| | | handleHistoryClick(row) { |
| | | this.isSel() |
| | | console.log(row) |
| | | if (this.isNoProduct) { |
| | | console.log("历史") |
| | | console.log('历史') |
| | | this.$router.push({ |
| | | name: "inventoryAdjustmentHistory", |
| | | params: { id: row.id } |
| | | name: 'inventoryAdjustmentHistory', |
| | | params: { id: row.id }, |
| | | }) |
| | | } |
| | | }, |
| | |
| | | this.rowIndex = rowIndex |
| | | this.isSel() |
| | | if (!this.isNoProduct && this.currentRowId === 0) { |
| | | this.$message.error("请完成当前新建或取消新建") |
| | | this.$message.error('请完成当前新建或取消新建') |
| | | } else { |
| | | this.currentRowId = row.id || 0 |
| | | this.addTitle = "保存" |
| | | this.addTitle = '保存' |
| | | this.showDiscard = true |
| | | this.isRowClick = true |
| | | if (this.isNoProduct) { |
| | |
| | | }, |
| | | querySearchData(queryString, results, value) { |
| | | if (this.isCreate) { |
| | | if (queryString === "") { |
| | | if (queryString === '') { |
| | | this.tableList.tableColumn[1].product = true |
| | | this.tableList.tableColumn[2].productType = true |
| | | } else { |
| | | if (value === "product") { |
| | | 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") { |
| | | } else if (value === 'productType') { |
| | | this.tableList.tableColumn[1].product = false |
| | | if (results.length !== 0) { |
| | | this.productCategoryId = results[0].id |
| | |
| | | // 新建 |
| | | addBtnClick() { |
| | | this.editConfig.infomation = { |
| | | name: "", |
| | | name: '', |
| | | parentId: null, |
| | | type: 3, |
| | | isScrapLocation: null, |
| | | isReturnLocation: null, |
| | | replenishLocation: null, |
| | | countFrequency: 0, |
| | | recentlyCount: "", |
| | | nextCount: "", |
| | | notes: "" |
| | | recentlyCount: '', |
| | | nextCount: '', |
| | | notes: '', |
| | | } |
| | | this.editConfig.visible = true |
| | | this.editConfig.title = "新建" |
| | | this.editConfig.title = '新建' |
| | | }, |
| | | // 选择起始位置方法 |
| | | selLocationClick(item, prop) { |
| | | if (prop === "areaName") { |
| | | if (prop === 'areaName') { |
| | | this.areaId = item.value |
| | | } else if (prop === "subLocation") { |
| | | } else if (prop === 'subLocation') { |
| | | this.subLocationId = item.value |
| | | } |
| | | }, |
| | |
| | | // 选中产品方法 |
| | | selProductClick(value, item) { |
| | | console.log(value, item) |
| | | if (value === "product") { |
| | | if (value === 'product') { |
| | | this.RuleType = 1 |
| | | this.tableList.tableColumn[2].productType = false |
| | | this.productId = item.productId |
| | | this.productCategoryId = item.categoryId |
| | | } else if (value === "productType") { |
| | | } 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) => { |
| | | delClick(scope) { |
| | | this.$confirm('此操作将永久删除该规则, 是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | deleteListingRules(scope.row.id).then((res) => { |
| | | if (res.code === 200) { |
| | | this.$message.success("删除成功") |
| | | this.$message.success('删除成功') |
| | | this.getData() |
| | | }else{ |
| | | this.$message.error('删除时出错,请稍后重试或联系管理员...'); |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => {}) |
| | | }, |
| | | // 删除产品类型 |
| | | delSelectClick() { |
| | | this.categoryId = 0 |
| | | this.queryProductId = "" |
| | | this.queryProductId = '' |
| | | this.getData() |
| | | } |
| | | }, |
| | | }, |
| | | watch: { |
| | | rowIndex(newVal) { |
| | |
| | | this.tableList.tableColumn[1].product = true |
| | | this.tableList.tableColumn[2].productType = true |
| | | } else { |
| | | this.$message.error("请完成当前新建或取消新建") |
| | | this.$message.error('请完成当前新建或取消新建') |
| | | this.tableList.tableColumn[1].product = false |
| | | this.tableList.tableColumn[2].productType = false |
| | | } |
| | | } else { |
| | | if (this.tableList.tableData[newVal].productName === "") { |
| | | if (this.tableList.tableData[newVal].productName === '') { |
| | | this.tableList.tableColumn[1].product = false |
| | | this.tableList.tableColumn[2].productType = true |
| | | } else { |
| | |
| | | } |
| | | } |
| | | this.$refs.tableRef.getProductCategoryList() |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
| | | |