| | |
| | | <div class="rightContent"> |
| | | <div class="top"> |
| | | <SearchCommonView |
| | | :add-title="'新建'" |
| | | :placeholder="'请输入单号'" |
| | | :add-title="addTitle" |
| | | :show-discard="showDiscard" |
| | | :show-apply="true" |
| | | :placeholder="'请输入位置/产品'" |
| | | :amount-view="false" |
| | | @addCommonClick="addBtnClick" |
| | | @addCommonClick="addProductClick" |
| | | @searchClick="getList" |
| | | @discardBtnClick="discardBtnClick" |
| | | @applyBtnClick="applyBtnClick" |
| | | /> |
| | | </div> |
| | | <div class="list-view"> |
| | | <div class="table"> |
| | | <TableCommonView |
| | | ref="tableListRef" |
| | | :table-list="tableList" |
| | | :show-checkcol="false" |
| | | <CommonFormTableView |
| | | :isinventory="true" |
| | | :product-table-list="tableList" |
| | | @inputContent="inputContent" |
| | | @tableRowClick="tableRowClick" |
| | | ></TableCommonView> |
| | | > |
| | | <template slot="tableButton"> |
| | | <el-table-column label="操作" width="180" fixed="right" align="center"> |
| | | <template slot-scope="scope"> |
| | | <span @click="handleHistoryClick(scope.row)"> |
| | | <i class="el-icon-refresh-left"></i> |
| | | <span>历史</span> |
| | | </span> |
| | | <span v-if="scope.row.isSet" @click="handleSetClick(scope)" class="margin_left_5px"> |
| | | <i class="el-icon-setting"></i> |
| | | <span>设置</span> |
| | | </span> |
| | | <template v-else> |
| | | <span @click="handleUseClick(scope)" class="margin_left_5px"> |
| | | <i class="el-icon-document"></i> |
| | | <span>应用</span> |
| | | </span> |
| | | <span @click="handleCleanupClick(scope)" class="margin_left_5px"> |
| | | <i class="el-icon-delete"></i> |
| | | <span>清除</span> |
| | | </span> |
| | | </template> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | </CommonFormTableView> |
| | | </div> |
| | | <div class="btn-pager"> |
| | | <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> |
| | | </div> |
| | | </div> |
| | | <!-- 新建/编辑 --> |
| | | <AddDialog |
| | | v-if="editConfig.visible" |
| | | @refresh="refresh" |
| | | :positionList="tableList.tableInfomation" |
| | | :edit-common-config="editConfig" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import CommonFormTableView from "@/components/makepager/CommonFormTableView" |
| | | import pageMixin from "@/components/makepager/pager/mixin/pageMixin" |
| | | import { getLocationList } from "@/api/warehouseManage/warehouse" |
| | | import AddDialog from "@/views/warehouseManage/position/AddDialog" |
| | | import { getDataByType } from "@/api/data" |
| | | export default { |
| | | name: "InventoryAdjustment", |
| | | props: {}, |
| | | components: { AddDialog }, |
| | | components: { CommonFormTableView }, |
| | | mixins: [pageMixin], |
| | | computed: {}, |
| | | data() { |
| | | return { |
| | | addTitle: "新建", |
| | | showDiscard: false, |
| | | tableList: {}, |
| | | tableData: [ |
| | | { |
| | | location: "HC/销售区", |
| | | productName: "夏季真丝吊带裙", |
| | | amount: "0.00", |
| | | unit: "件", |
| | | count: "0.00", |
| | | date: "2023-12-31", |
| | | user: "管理员", |
| | | isSet: true, |
| | | isEdit: true |
| | | } |
| | | ], |
| | | searchOptions: [], |
| | | editConfig: { |
| | | visible: false, |
| | | title: "新建", |
| | | infomation: {} |
| | | }, |
| | | positionTypeList: getDataByType("positionType") |
| | | countId: 0, |
| | | isNoProduct: true, // 添加明细行时是否有产品未选择 |
| | | isRowClick: false |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | methods: { |
| | | setTable() { |
| | | this.tableList = { |
| | | tableInfomation: [], |
| | | tableData: this.tableData, |
| | | selectBox: true, |
| | | showcol: this.showcol, |
| | | allcol: [], |
| | | tableColumn: this.setTableColumn(this.showcol) |
| | | tableColumn: [ |
| | | { label: "位置", prop: "location", 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: "user", user: true } |
| | | ] |
| | | } |
| | | let allcol = [] |
| | | for (let i = 0; i < this.tableList.tableColumn.length; i++) { |
| | | if (!this.tableList.tableColumn[i].default) { |
| | | const label = this.tableList.tableColumn[i].label |
| | | allcol.push(label) |
| | | }, |
| | | // 操作输入 |
| | | inputContent(val, prop, row) { |
| | | this.countId = row.countId |
| | | this.tableData.map((item) => { |
| | | if (item.countId === row.countId) { |
| | | item[prop] = val |
| | | } |
| | | }) |
| | | }, |
| | | // 新增 |
| | | addProductClick() { |
| | | console.log(this.tableData) |
| | | this.isSel() |
| | | if (this.isNoProduct && this.addTitle === "新建") { |
| | | this.addTitle = "保存" |
| | | this.showDiscard = true |
| | | this.isRowClick = false |
| | | this.countId++ |
| | | this.tableData.push({ |
| | | countId: this.countId, |
| | | productId: "", |
| | | amount: 0, |
| | | unit: "", |
| | | productName: "", |
| | | count: "0.00", |
| | | isSet: true, |
| | | isEdit: false |
| | | }) |
| | | } else if (this.isNoProduct && this.addTitle === "保存") { |
| | | this.addTitle = "新建" |
| | | this.showDiscard = false |
| | | } |
| | | }, |
| | | // 是否选择产品 |
| | | 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 |
| | | } |
| | | } |
| | | this.tableList.allcol = allcol |
| | | }, |
| | | setTableColumn(showcol) { |
| | | console.log(showcol) |
| | | let tableColumn = [ |
| | | { |
| | | label: "位置", |
| | | prop: "jointName", |
| | | isShowColumn: true, |
| | | default: true |
| | | }, |
| | | { |
| | | label: "位置类型", |
| | | prop: "type", |
| | | isShowColumn: true, |
| | | default: true, |
| | | conversion: true, |
| | | getStatus: this.getTypesList |
| | | } |
| | | ] |
| | | return tableColumn |
| | | }, |
| | | getTypesList(val) { |
| | | let string = "--" |
| | | if (val) { |
| | | for (let i in this.positionTypeList) { |
| | | if (this.positionTypeList[i].id == val) { |
| | | return this.positionTypeList[i].name |
| | | } |
| | | } |
| | | // 取消 |
| | | discardBtnClick() { |
| | | if (this.isRowClick) { |
| | | this.tableData.map((item) => { |
| | | item.isEdit = true |
| | | }) |
| | | } else { |
| | | this.tableData.splice(this.tableData.length - 1, 1) |
| | | } |
| | | return string |
| | | this.addTitle = "新建" |
| | | this.showDiscard = false |
| | | }, |
| | | selTableCol(val) { |
| | | this.showcol = val |
| | | this.tableList.tableColumn = this.setTableColumn(val) |
| | | // 应用全部 |
| | | 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) { |
| | | console.log(row, rowIndex) |
| | | this.addTitle = "保存" |
| | | this.showDiscard = true |
| | | this.isRowClick = true |
| | | this.isSel() |
| | | 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 |
| | | } |
| | | }) |
| | | }, |
| | | // 请求数据 |
| | | async getData() { |
| | |
| | | } |
| | | }) |
| | | }, |
| | | refresh() { |
| | | this.pagerOptions.currPage = 1 |
| | | this.getData() |
| | | }, |
| | | // 搜索 |
| | | getList(val) { |
| | | this.keyword = val |
| | | this.pagerOptions.currPage = 1 |
| | | this.getData() |
| | | }, |
| | | // 行点击 |
| | | tableRowClick(row) { |
| | | console.log(row) |
| | | this.editConfig.title = "编辑" |
| | | this.editConfig.infomation = { ...row } |
| | | this.editConfig.infomation.parentId = Number(this.editConfig.infomation.parentId) |
| | | this.editConfig.visible = true |
| | | }, |
| | | // 新建 |
| | | addBtnClick() { |