New file |
| | |
| | | import request from "@/common/untils/request.js" |
| | | // import axios from "axios" |
| | | |
| | | // 库存调整列表 |
| | | export function getInventoryAdjustmentList(data) { |
| | | return request({ |
| | | url: "/api-wms/v1/locationProductAmount/list", |
| | | method: "post", |
| | | data |
| | | }) |
| | | } |
| | | // 添加库存调整 |
| | | export function addInventoryAdjustment(data) { |
| | | return request({ |
| | | url: "/api-wms/v1/locationProductAmount/add", |
| | | method: "post", |
| | | data |
| | | }) |
| | | } |
| | | // 库存调整/历史 |
| | | export function historyInventoryAdjustment(data) { |
| | | return request({ |
| | | url: "/api-wms/v1/product/listHistory", |
| | | method: "post", |
| | | data |
| | | }) |
| | | } |
New file |
| | |
| | | import request from "@/common/untils/request.js" |
| | | // import axios from "axios" |
| | | |
| | | // 上架规则列表 |
| | | export const getListingRulesList = async (data) => { |
| | | return request({ |
| | | url: "/api-wms/v1/locationProduct/list", |
| | | method: "post", |
| | | data |
| | | }) |
| | | } |
| | | // 添加上架规则 |
| | | export function addListingRules(data) { |
| | | return request({ |
| | | url: "/api-wms/v1/locationProduct/add", |
| | | method: "post", |
| | | data |
| | | }) |
| | | } |
| | | // 删除上架规则 |
| | | export function deleteListingRules(id) { |
| | | return request({ |
| | | url: `/api-wms/v1/locationProduct/delete/${id}`, |
| | | method: "delete", |
| | | id |
| | | }) |
| | | } |
| | | // 修改上架规则 |
| | | export function updateListingRules(data) { |
| | | return request({ |
| | | url: "/api-wms/v1/locationProduct/update", |
| | | method: "post", |
| | | data |
| | | }) |
| | | } |
| | |
| | | .cursor_pointer { |
| | | cursor: pointer; |
| | | } |
| | | .no-cursor { |
| | | cursor: no-drop; |
| | | } |
| | | .yes-cursor { |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .Badge { |
| | | background: #d3d3d3; |
| | |
| | | } |
| | | return result |
| | | } |
| | | |
| | | /** |
| | | * 获取当前时间 |
| | | */ |
| | | export function currentTime() { |
| | | var date = new Date() |
| | | var year = date.getFullYear() //月份从0~11,所以加一 |
| | | let month = date.getMonth() |
| | | console.log("month", month) |
| | | var dateArr = [date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()] |
| | | //如果格式是MM则需要此步骤,如果是M格式则此循环注释掉 |
| | | for (var i = 0; i < dateArr.length; i++) { |
| | | if (dateArr[i] >= 1 && dateArr[i] <= 9) { |
| | | dateArr[i] = "0" + dateArr[i] |
| | | } |
| | | } |
| | | var strDate = year + "-" + dateArr[0] + "-" + dateArr[1] + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4] |
| | | //此处可以拿外部的变量接收 strDate:2022-05-01 13:25:30 |
| | | //this.date = strDate; |
| | | console.log("strDate", strDate) |
| | | return strDate |
| | | } |
| | |
| | | style="width: 80%" |
| | | @change=" |
| | | (val) => { |
| | | selProductClick(val) |
| | | selProductNameClick(val) |
| | | } |
| | | " |
| | | > |
| | |
| | | :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]" |
| | | > |
| | | <span v-if="scope.row.isEdit">{{ scope.row[item.prop] }}</span> |
| | | <el-date-picker v-else v-model="scope.row[item.prop]" type="date" size="mini" style="width: 110px"> |
| | | <el-date-picker v-else v-model="scope.row[item.prop]" type="date" size="mini" style="width: 100%"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item |
| | |
| | | <!-- 位置 --> |
| | | <el-form-item v-else-if="item.location" label=" " :prop="'tableData.' + scope.$index + '.' + item.prop"> |
| | | <div class="custom-name"> |
| | | <span v-if="scope.row.isEdit">{{ scope.row[item.prop] }}</span> |
| | | <span v-if="scope.row.isEdit || scope.row.editable">{{ scope.row[item.prop] }}</span> |
| | | <el-select |
| | | v-else |
| | | v-model="scope.row[item.prop]" |
| | | placeholder="请选择" |
| | | size="mini" |
| | | style="width: 80%" |
| | | @change="selLocationClick" |
| | | @change=" |
| | | (val) => { |
| | | selLocationClick(val, item.prop) |
| | | } |
| | | " |
| | | > |
| | | <el-option v-for="item in selLocationOptions" :key="item.id" :label="item.name" :value="item.name"> |
| | | <el-option |
| | | v-for="item in selLocationOptions" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="{ value: item.id, label: item.name }" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | |
| | | <!-- 产品 --> |
| | | <el-form-item v-else-if="item.product" label=" " :prop="'tableData.' + scope.$index + '.' + item.prop"> |
| | | <div class="custom-name"> |
| | | <span v-if="scope.row.isEdit">{{ scope.row[item.prop] }}</span> |
| | | <span v-if="scope.row.isEdit || scope.row.editable">{{ scope.row[item.prop] }}</span> |
| | | <el-select |
| | | v-else |
| | | v-model="scope.row[item.prop]" |
| | |
| | | v-for="item in productNameOptions" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="{ value: item.id, label: item.name, amount: item.amount, unit: item.unit }" |
| | | :value="{ |
| | | value: item.id, |
| | | label: item.name, |
| | | amount: item.amount, |
| | | unit: item.unit, |
| | | categoryId: item.categoryId, |
| | | categoryName: item.categoryName |
| | | }" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | |
| | | } |
| | | if (this.islistingrules) { |
| | | this.getLocationList() |
| | | this.getCompanyList() |
| | | // this.getCompanyList() |
| | | } |
| | | this.tableList = this.productTableList |
| | | }, |
| | |
| | | } |
| | | }) |
| | | }, |
| | | // 选择产品 |
| | | selProductClick(item) { |
| | | selProductNameClick(item) { |
| | | this.tableList.tableData.map((ite) => { |
| | | if (ite.productName.label === item.label) { |
| | | ite.productId = item.value |
| | |
| | | }) |
| | | console.log(this.tableList.tableData) |
| | | }, |
| | | // 选择产品 |
| | | selProductClick(item) { |
| | | console.log(item) |
| | | this.tableList.tableData.map((ite) => { |
| | | if (ite.productName.label === item.label) { |
| | | ite.productId = item.value |
| | | ite.productName = item.label |
| | | ite.categoryId = item.categoryId |
| | | ite.productCategory = item.categoryName |
| | | ite.amount = item.amount |
| | | ite.unit = item.unit |
| | | } |
| | | }) |
| | | console.log(this.tableList.tableData) |
| | | this.$emit("selProductClick", item) |
| | | }, |
| | | // 选择位置 |
| | | selLocationClick(item) { |
| | | selLocationClick(item, prop) { |
| | | console.log(item) |
| | | console.log(this.tableList.tableData) |
| | | // this.tableList.tableData.map((ite) => { |
| | | // if (ite.location.label === item.label) { |
| | | // ite.location = item.label |
| | | // } |
| | | // if (ite.subLocation.label === item.label) { |
| | | // ite.subLocation = item.label |
| | | // } |
| | | // }) |
| | | this.$emit("selLocationClick", item, prop) |
| | | }, |
| | | // 选择单位/用户 |
| | | selCommonClick(item) { |
| | |
| | | <SearchCommonView |
| | | :add-title="addTitle" |
| | | :show-discard="showDiscard" |
| | | :show-apply="true" |
| | | :show-apply="false" |
| | | :placeholder="'请输入位置/产品'" |
| | | :amount-view="false" |
| | | @addCommonClick="addProductClick" |
| | |
| | | :isinventory="true" |
| | | :product-table-list="tableList" |
| | | @inputContent="inputContent" |
| | | @tableRowClick="tableRowClick" |
| | | @selLocationClick="selLocationClick" |
| | | @selProductClick="selProductClick" |
| | | > |
| | | <template slot="tableButton"> |
| | | <el-table-column label="操作" width="180" fixed="right" align="center"> |
| | | <template slot-scope="scope"> |
| | | <span @click="handleHistoryClick(scope.row)"> |
| | | <span @click="handleHistoryClick(scope.row)" class="yes-cursor"> |
| | | <i class="el-icon-refresh-left"></i> |
| | | <span>历史</span> |
| | | </span> |
| | | <span v-if="scope.row.isSet" @click="handleSetClick(scope)" class="margin_left_5px"> |
| | | <!-- <span v-if="scope.row.isSet" @click="handleSetClick(scope)" class="margin_left_5px"> |
| | | <i class="el-icon-setting"></i> |
| | | <span>设置</span> |
| | | </span> |
| | |
| | | <i class="el-icon-delete"></i> |
| | | <span>清除</span> |
| | | </span> |
| | | </template> |
| | | </template> --> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | |
| | | <script> |
| | | import CommonFormTableView from "@/components/makepager/CommonFormTableView" |
| | | import pageMixin from "@/components/makepager/pager/mixin/pageMixin" |
| | | import { getLocationList } from "@/api/warehouseManage/warehouse" |
| | | import { getInventoryAdjustmentList, addInventoryAdjustment } from "@/api/operate/inventoryAdjustment" |
| | | import { currentTime } from "@/common/config/index" |
| | | export default { |
| | | name: "InventoryAdjustment", |
| | | props: {}, |
| | |
| | | addTitle: "新建", |
| | | showDiscard: false, |
| | | tableList: {}, |
| | | tableData: [ |
| | | { |
| | | location: "HC/销售区", |
| | | productName: "夏季真丝吊带裙", |
| | | amount: "0.00", |
| | | unit: "件", |
| | | count: "0.00", |
| | | date: "2023-12-31", |
| | | user: "管理员", |
| | | isSet: true, |
| | | isEdit: true |
| | | } |
| | | ], |
| | | tableData: [], |
| | | searchOptions: [], |
| | | countId: 0, |
| | | isNoProduct: true, // 添加明细行时是否有产品未选择 |
| | | isRowClick: false |
| | | isRowClick: false, |
| | | locationId: 0, |
| | | productId: 0, |
| | | differenceAmount: 0, |
| | | Amount: 0 |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | tableData: this.tableData, |
| | | selectBox: true, |
| | | tableColumn: [ |
| | | { label: "位置", prop: "location", location: true }, |
| | | { label: "位置", prop: "locationName", location: true }, |
| | | { label: "产品", prop: "productName", product: true }, |
| | | { label: "在库数量", prop: "amount" }, |
| | | { label: "计量单位", prop: "unit" }, |
| | | { label: "计数的数量", prop: "count", inputFloat: true }, |
| | | { label: "差异", prop: "difference" }, |
| | | { label: "日期", prop: "date", date: true }, |
| | | { label: "计数的数量", prop: "differenceAmount", inputFloat: true }, |
| | | { label: "差异", prop: "adjustAmount" }, |
| | | { label: "日期", prop: "createDate" }, |
| | | { label: "用户", prop: "user", user: true } |
| | | ] |
| | | } |
| | | }, |
| | | // 操作输入 |
| | | inputContent(val, prop, row) { |
| | | this.countId = row.countId |
| | | this.tableData.map((item) => { |
| | | if (item.countId === row.countId) { |
| | | item[prop] = val |
| | | // 请求数据 |
| | | async getData() { |
| | | await getInventoryAdjustmentList({ |
| | | page: this.pagerOptions.currPage, |
| | | pageSize: this.pagerOptions.pageSize |
| | | }).then((res) => { |
| | | if (res.code === 200) { |
| | | console.log(res) |
| | | const list = res.data.map((item) => { |
| | | return { |
| | | ...item, |
| | | isSet: false, |
| | | isEdit: true, |
| | | editable: true |
| | | } |
| | | }) |
| | | this.tableList.tableData = list || [] |
| | | this.tableData = list || [] |
| | | this.pagerOptions.totalCount = res.total |
| | | } |
| | | }) |
| | | }, |
| | | // 操作输入 |
| | | inputContent(val, prop, row) { |
| | | console.log("22222222222222") |
| | | console.log(val, prop, row) |
| | | // this.countId = row.countId |
| | | // this.tableData.map((item) => { |
| | | // if (item.countId === row.countId) { |
| | | // item[prop] = val |
| | | // } |
| | | // }) |
| | | this.differenceAmount = val |
| | | }, |
| | | // 新增 |
| | | addProductClick() { |
| | | console.log(this.tableData) |
| | | this.isSel() |
| | | this.isSel() |
| | | if (this.isNoProduct && this.addTitle === "新建") { |
| | | this.addTitle = "保存" |
| | | this.showDiscard = true |
| | | this.isRowClick = false |
| | | this.currentRowId = 0 |
| | | this.countId++ |
| | | this.tableData.push({ |
| | | countId: this.countId, |
| | | Amount: 0, |
| | | areaName: "", |
| | | adjustAmount: 0, |
| | | productId: "", |
| | | amount: 0, |
| | | unit: "", |
| | | productName: "", |
| | | count: "0.00", |
| | | differenceAmount: 0, |
| | | locationId: 0, |
| | | createDate: this.currentTime(), |
| | | isSet: true, |
| | | isEdit: false |
| | | isEdit: false, |
| | | editable: false |
| | | }) |
| | | } else if (this.isNoProduct && this.addTitle === "保存") { |
| | | this.addTitle = "新建" |
| | | this.showDiscard = false |
| | | this.locationId = 0 |
| | | this.subLocationId = 0 |
| | | this.productCategoryId = 0 |
| | | this.productId = 0 |
| | | } else { |
| | | if (this.locationId === 0) { |
| | | this.$message.error("请选择位置") |
| | | } else if (this.productId === 0) { |
| | | this.$message.error("请选择产品") |
| | | } else { |
| | | this.addTitle = "新建" |
| | | this.showDiscard = false |
| | | // let requestUrl = this.currentRowId === 0 ? addInventoryAdjustment : updateListingRules |
| | | addInventoryAdjustment({ |
| | | // id: this.currentRowId, |
| | | locationId: this.locationId, |
| | | Amount: this.Amount, |
| | | differenceAmount: this.differenceAmount, |
| | | productId: this.productId |
| | | }) |
| | | .then((res) => { |
| | | console.log(res) |
| | | if (res.code === 200) { |
| | | // let tipStr = this.currentRowId === 0 ? "添加成功" : "修改成功" |
| | | this.$message.success("添加成功") |
| | | this.getData() |
| | | } |
| | | }) |
| | | .catch((err) => { |
| | | console.log(err) |
| | | this.getData() |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | // 是否选择产品 |
| | |
| | | console.log("历史") |
| | | this.$router.push({ |
| | | name: "inventoryAdjustmentHistory", |
| | | params: { id: row.id } |
| | | params: { locationId: row.locationId, productId: row.productId } |
| | | }) |
| | | } |
| | | }, |
| | |
| | | this.tableData.map((item, index) => { |
| | | if (index === rowIndex) { |
| | | item.isEdit = false |
| | | item.editable = true |
| | | } else { |
| | | item.isEdit = true |
| | | } |
| | | }) |
| | | }, |
| | | // 请求数据 |
| | | async getData() { |
| | | await getLocationList({ |
| | | keyword: this.keyword, |
| | | page: this.pagerOptions.currPage, |
| | | pageSize: this.pagerOptions.pageSize |
| | | }).then((res) => { |
| | | if (res.code === 200) { |
| | | const list = res.data ? res.data : [] |
| | | this.tableList.tableInfomation = list |
| | | this.pagerOptions.totalCount = res.total |
| | | } |
| | | }) |
| | | }, |
| | |
| | | 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) { |
| | | console.log(item, prop) |
| | | this.locationId = item.value |
| | | }, |
| | | // 选中产品方法 |
| | | selProductClick(item) { |
| | | console.log(item) |
| | | this.productId = item.value |
| | | }, |
| | | // 获取当前时间 |
| | | currentTime() { |
| | | return currentTime() |
| | | } |
| | | } |
| | | } |
| | |
| | | <template> |
| | | <div class="rightContent"> |
| | | <div class="top"> |
| | | <SearchCommonView |
| | | :show-add="false" |
| | | :placeholder="'请输入单号/产品'" |
| | | :amount-view="false" |
| | | @searchClick="getList" |
| | | /> |
| | | <SearchCommonView :show-add="false" :placeholder="'请输入单号'" :amount-view="false" @searchClick="getList" /> |
| | | </div> |
| | | <div class="list-view"> |
| | | <div class="table"> |
| | |
| | | |
| | | <script> |
| | | import pageMixin from "@/components/makepager/pager/mixin/pageMixin" |
| | | import { getAllList } from "@/api/overview/overview" |
| | | import { historyInventoryAdjustment } from "@/api/operate/inventoryAdjustment" |
| | | |
| | | export default { |
| | | name: "InventoryAdjustmentHistory", |
| | |
| | | tableList: {}, |
| | | showcol: ["状态"], |
| | | searchOptions: [], |
| | | keyword: "" |
| | | keyword: "", |
| | | locationId: 0, |
| | | productId: "" |
| | | } |
| | | }, |
| | | created() { |
| | | this.setTable() |
| | | this.locationId = this.$route.params.locationId |
| | | this.productId = this.$route.params.productId |
| | | this.getData() |
| | | }, |
| | | methods: { |
| | |
| | | label: "日期", |
| | | prop: "operationDate", |
| | | isShowColumn: true, |
| | | default: true, |
| | | date: true |
| | | default: true |
| | | }, |
| | | { |
| | | label: "单号", |
| | |
| | | }, |
| | | // 请求数据 |
| | | async getData() { |
| | | await getAllList({ |
| | | number: this.keyword, |
| | | await historyInventoryAdjustment({ |
| | | locationId: this.locationId, |
| | | page: this.pagerOptions.currPage, |
| | | pageSize: this.pagerOptions.pageSize, |
| | | sourceNumber: this.keyword |
| | | productId: this.productId |
| | | }).then((res) => { |
| | | if (res.code === 200) { |
| | | const list = res.data.map((item) => { |
| | | let product = item.details[0].product |
| | | return { |
| | | ...item, |
| | | from: item.fromLocation.name, |
| | | to: item.toLocation.name |
| | | to: item.toLocation.name, |
| | | productName: product.name, |
| | | amount: product.amount, |
| | | unit: product.unit |
| | | } |
| | | }) |
| | | this.tableList.tableInfomation = list || [] |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="入库类型"> |
| | | <el-form-item label="入库类型" prop="operationTypeId"> |
| | | <el-select |
| | | v-if="showOperationType" |
| | | v-model="editConfig.infomation.operationTypeId" |
| | |
| | | sourceNumber: [{ required: true, message: "请输入来源单据", trigger: "blur" }], |
| | | operationDate: [{ required: true, message: "请选择日期", trigger: "change" }], |
| | | toLocationId: [{ required: true, message: "请选择仓库位置", trigger: "change" }], |
| | | fromLocationId: [{ required: true, message: "请选择源位置", trigger: "change" }] |
| | | fromLocationId: [{ required: true, message: "请选择源位置", trigger: "change" }], |
| | | operationTypeId: [{ required: true, message: "请选择入库类型", trigger: "change" }] |
| | | }, |
| | | companyOptions: [], // 公司 |
| | | memberOptions: [{ id: 1, name: "管理员" }], |
| | |
| | | :product-table-list="tableList" |
| | | @inputContent="inputContent" |
| | | @tableRowClick="tableRowClick" |
| | | @selLocationClick="selLocationClick" |
| | | @selProductClick="selProductClick" |
| | | > |
| | | <template slot="tableButton"> |
| | | <el-table-column label="操作" width="90" fixed="right" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-button v-if="scope.row.isEdit" @click.stop="delClick(scope)" type="text" size="small" |
| | | >删除</el-button |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | </CommonFormTableView> |
| | | </div> |
| | | <div class="btn-pager"> |
| | |
| | | <script> |
| | | import CommonFormTableView from "@/components/makepager/CommonFormTableView" |
| | | import pageMixin from "@/components/makepager/pager/mixin/pageMixin" |
| | | import { getLocationList } from "@/api/warehouseManage/warehouse" |
| | | import { |
| | | getListingRulesList, |
| | | addListingRules, |
| | | updateListingRules, |
| | | deleteListingRules |
| | | } from "@/api/warehouseManage/listingRules" |
| | | export default { |
| | | name: "listingRules", |
| | | props: {}, |
| | |
| | | searchOptions: [], |
| | | countId: 0, |
| | | isNoProduct: true, // 添加明细行时是否有产品未选择 |
| | | isRowClick: false |
| | | isRowClick: false, |
| | | areaId: 0, |
| | | productId: 0, |
| | | subLocationId: 0, |
| | | currentRowId: 0 |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | methods: { |
| | | setTable() { |
| | | this.tableList = { |
| | | tableData: this.tableData, |
| | | tableData: [], |
| | | selectBox: true, |
| | | tableColumn: [ |
| | | { label: "当产品到达", prop: "location", location: true }, |
| | | { label: "当产品到达", prop: "areaName", location: true }, |
| | | { label: "产品", prop: "productName", product: true }, |
| | | // { label: "产品类别", prop: "productCategory", productCategory: true }, |
| | | { label: "存储到子位置", prop: "subLocation", location: true }, |
| | | { label: "公司", prop: "companyName", company: true } |
| | | { label: "产品类别", prop: "productCategory" }, |
| | | { label: "存储到子位置", prop: "subLocation", location: true } |
| | | // { label: "公司", prop: "companyName", company: true } |
| | | ] |
| | | } |
| | | }, |
| | | // 请求数据 |
| | | async getData() { |
| | | await getListingRulesList({ |
| | | // keyword: this.keyword, |
| | | page: this.pagerOptions.currPage, |
| | | pageSize: this.pagerOptions.pageSize |
| | | }).then((res) => { |
| | | if (res.code === 200) { |
| | | const list = res.data.map((item) => { |
| | | return { |
| | | ...item, |
| | | areaName: item.area.jointName, |
| | | subLocation: item.location.jointName, |
| | | 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.addTitle = "保存" |
| | | this.showDiscard = true |
| | | this.isRowClick = false |
| | | this.currentRowId = 0 |
| | | this.countId++ |
| | | this.tableData.push({ |
| | | countId: this.countId, |
| | | areaId: 0, |
| | | areaName: "", |
| | | locationId: 0, |
| | | productId: "", |
| | | location: 0, |
| | | subLocation: "", |
| | | productName: "", |
| | | companyName: "", |
| | | isSet: true, |
| | | isEdit: false |
| | | }) |
| | | } else if (this.isNoProduct && this.addTitle === "保存") { |
| | | 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 |
| | | } |
| | | }) |
| | | 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.$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({ |
| | | id: this.currentRowId, |
| | | areaId: this.areaId, |
| | | locationId: this.subLocationId, |
| | | productCategoryId: this.productCategoryId, |
| | | productId: this.productId |
| | | }).then((res) => { |
| | | console.log(res) |
| | | if (res.code === 200) { |
| | | let tipStr = this.currentRowId === 0 ? "添加成功" : "修改成功" |
| | | this.$message.success(tipStr) |
| | | this.getData() |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | // 是否选择产品 |
| | |
| | | }, |
| | | // 行点击 |
| | | tableRowClick(row, rowIndex) { |
| | | console.log(row, rowIndex) |
| | | this.addTitle = "保存" |
| | | this.showDiscard = true |
| | | this.isRowClick = true |
| | | console.log("11111") |
| | | this.isSel() |
| | | if (!this.isNoProduct) { |
| | | this.tableData.splice(this.tableData.length - 1, 1) |
| | | 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 |
| | | } else { |
| | | item.isEdit = true |
| | | } |
| | | }) |
| | | this.areaId = row.areaId |
| | | this.subLocationId = row.locationId |
| | | this.productCategoryId = row.productCategoryId |
| | | this.productId = row.productId |
| | | } |
| | | this.tableData.map((item, index) => { |
| | | if (index === rowIndex) { |
| | | item.isEdit = false |
| | | } else { |
| | | item.isEdit = true |
| | | } |
| | | }) |
| | | }, |
| | | // 请求数据 |
| | | async getData() { |
| | | await getLocationList({ |
| | | keyword: this.keyword, |
| | | page: this.pagerOptions.currPage, |
| | | pageSize: this.pagerOptions.pageSize |
| | | }).then((res) => { |
| | | if (res.code === 200) { |
| | | const list = res.data ? res.data : [] |
| | | this.tableList.tableInfomation = list |
| | | this.pagerOptions.totalCount = res.total |
| | | } |
| | | }) |
| | | }, |
| | | // 搜索 |
| | | getList(val) { |
| | |
| | | } |
| | | this.editConfig.visible = true |
| | | this.editConfig.title = "新建" |
| | | }, |
| | | // 选择位置方法 |
| | | selLocationClick(item, prop) { |
| | | console.log(item, prop) |
| | | if (prop === "areaName") { |
| | | this.areaId = item.value |
| | | } else if (prop === "subLocation") { |
| | | this.subLocationId = item.value |
| | | } |
| | | }, |
| | | // 选中产品方法 |
| | | selProductClick(item) { |
| | | console.log(item) |
| | | this.productId = item.value |
| | | this.productCategoryId = item.categoryId |
| | | }, |
| | | // 删除 |
| | | async delClick(scope) { |
| | | console.log(scope) |
| | | await deleteListingRules(scope.row.id).then((res) => { |
| | | if (res.code === 200) { |
| | | this.$message.success("删除成功") |
| | | this.getData() |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |