| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067 |
- <template>
- <div class="itemList">
- <!-- 数据表格 -->
- <item-search
- @search="reload"
- ref="refSeavch"
- :type="type"
- @handledime="handledime"
- ></item-search>
- <ele-pro-table
- ref="table"
- class="table"
- :columns="columns"
- :datasource="datasource"
- height="calc(100vh - 325px)"
- full-height="calc(100vh - 116px)"
- tool-class="ele-toolbar-form"
- :pageSize="20"
- @select="selectChange"
- @select-all="changeSelectAll"
- @columns-change="handleColumnChange"
- :cache-key="cacheKeyUrl"
- :summary-method="getSummaries"
- show-summary
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar="{ row }">
- <div class="upload">
- <el-button
- v-if="selectedDime == 3"
- size="small"
- :disabled="checkRadioData.length == 0"
- icon="el-icon-set-up"
- class="ele-btn-icon"
- @click="allPrinting()"
- >
- 打印条码
- </el-button>
- <!-- <el-upload
- v-if="!isLoading"
- :show-file-list="false"
- class="upload-demo"
- action=""
- :before-upload="beforeUpload"
- :on-success="successUpload"
- :on-error="errorUpload"
- >
- <slot>
- <el-button
- type="primary"
- size="small"
- plain
- icon="el-icon-upload2"
- >导入</el-button
- >
- </slot>
- </el-upload> -->
- <el-button
- type="primary"
- size="small"
- icon="el-icon-upload2"
- plain
- @click="uploadFile"
- >导入</el-button
- >
- <exportButton
- fileName="库存台账"
- :apiUrl="exportApiUrl"
- :params="params"
- v-if="selectedDime == 2"
- ></exportButton>
- <el-button
- v-if="selectedDime == 2"
- type="primary"
- size="small"
- @click="handleUnlock"
- >库存解锁</el-button
- >
- </div>
- <!-- <el-button
- v-if="selectedDime == 2 || selectedDime == 3"
- size="small"
- :disabled="checkRadioData.length == 0"
- icon="el-icon-set-up"
- class="ele-btn-icon"
- @click="showAllot()"
- >
- 调拨
- </el-button> -->
- </template>
- <template v-slot:result="{ row }">
- <span>{{ qualityResults[row.result] }}</span>
- </template>
- <template v-slot:status="{ row }">
- <span>{{ qualityStatus[row.status] }}</span>
- </template>
- <!-- -->
- <!-- 物品名称 -->
- <template v-slot:categoryName="{ row }">
- <el-link type="primary" @click="details(row)">
- {{ row.categoryName }}
- </el-link>
- </template>
- <!-- 批次号 -->
- <template v-slot:batchNo="{ row }">
- <el-popover placement="right-start" width="800" trigger="hover">
- <el-table :data="row.outInBatchDetailsVOList">
- <el-table-column
- width="150"
- property="bizNo"
- label="入库单号"
- ></el-table-column>
- <el-table-column
- width="100"
- property="bizType"
- label="入库场景"
- ></el-table-column>
- <el-table-column
- width="120"
- property="count"
- label="入库数量"
- ></el-table-column>
- <el-table-column
- width="80"
- property="measuringUnit"
- label="计量单位"
- ></el-table-column>
- <el-table-column
- width="100"
- property="packageCount"
- label="包装数量"
- ></el-table-column>
- <el-table-column
- width="80"
- property="packingUnit"
- label="包装单位"
- ></el-table-column>
- <el-table-column
- width="330"
- property="position"
- label="库位"
- ></el-table-column>
- <el-table-column
- width="160"
- property="createTime"
- label="入库时间"
- ></el-table-column>
- </el-table>
- <span slot="reference"> {{ row.batchNo }}</span>
- </el-popover>
- </template>
- <template v-slot:QRCode="{ row }">
- <el-link type="primary" @click="openQRCode(row, 3)"> 查看 </el-link>
- </template>
- <template v-slot:areaName="{ row }">
- <el-link type="primary" @click="openUploadDetail(row, 'list')"> 查看 </el-link>
- </template>
- <!-- 最小包装单元 -->
- <template v-slot:minPackingCount="{ row }">
- <span v-if="row.minPackingCount">
- {{ row.minPackingCount }}
- {{ row.measuringUnit }}/{{ row.minUnit }}
- </span>
- </template>
- <!-- 库存保质期 -->
- <template v-slot:expirationDate="{ row }">
- <span v-if="row.expirationDate">
- {{ row.expirationDate ? row.expirationDate : '-' }}
- {{
- row.expirationDateUnit == 'year'
- ? '年'
- : row.expirationDateUnit == 'month'
- ? '月'
- : '日'
- }}
- </span>
- </template>
- <!-- 质检状态 -->
- <template v-slot:qualityStatus="{ row }">
- <span v-if="row.qualityResult == 0 || row.qualityResult == 1"
- >已检</span
- >
- <span v-else-if="row.qualityStatus == 1">已检</span>
- <span v-else-if="row.qualityStatus == 0">未检</span>
- <span v-else>-</span>
- </template>
- <!-- 质检结果 -->
- <template v-slot:qualityResult="{ row }">
- <span v-if="row.qualityResult == 0 || row.qualityResult == ''"
- >合格</span
- >
- <span v-else-if="row.qualityResult == 1">不合格</span>
- <span v-else-if="row.qualityResult == 3">让步接收</span>
- <span v-else>-</span>
- </template>
- </ele-pro-table>
- <print :openBarCode.sync="openWindows" :config="config"></print>
- <!-- <print ref="printRef" :dimension="selectedDime"></print> -->
- <!-- <printSr ref="printSrRef" :dimension="selectedDime"></printSr>
- <printTg ref="printTgRef" :dimension="selectedDime"></printTg> -->
- <allot ref="allotRef" :dimension="selectedDime"></allot>
- <!-- 导入错误弹框 -->
- <el-dialog
- title="导入失败"
- :visible.sync="exportErrorDioalogVisible"
- width="60%"
- >
- <el-table :data="errorData" style="width: 100%">
- <el-table-column label="名称" prop="name"> </el-table-column>
- <el-table-column label="型号" prop="modeType"> </el-table-column>
- <el-table-column label="编号" prop="codeNo"> </el-table-column>
- <el-table-column label="物料组" prop="code"> </el-table-column>
- <el-table-column label="失败原因" prop="remark"> </el-table-column>
- </el-table>
- <span slot="footer" class="dialog-footer">
- <el-button @click="exportErrorDioalogVisible = false">取 消</el-button>
- <el-button type="primary" @click="exportErrorDioalogVisible = false"
- >确 定</el-button
- >
- </span>
- </el-dialog>
- <printQRCode ref="printQRCodeRef"></printQRCode>
- <ItemListed ref="itemListedRef"/>
- <importDialog
- :defModule="moudleName"
- ref="importDialogRef"
- :fileUrl="'/wms/outintwo/importTemplate'"
- fileName="库存导入模板"
- @success="reload"
- />
- <unlockModal ref="unlockModalRef"></unlockModal>
- </div>
- </template>
- <script>
- import print from '@/components/print/indexMultiple.vue';
- import allot from './allot.vue';
- import importDialog from '@/components/upload/import-dialogNew.vue';
- // import print from './print.vue';
- // import printSr from './printSr.vue';
- // import printTg from './printTg.vue';
- import ItemSearch from './item-search.vue';
- import ItemListed from '@/views/warehouseManagement/stockManagement/components/itemListed.vue';
- // import {
- // getUserPage,
- // removePersonnel,
- // unbindLoginName
- // } from '@/api/system/organization';
- import {
- pageeLedgerMain,
- removeItem,
- getWarehouseList
- } from '@/api/classifyManage/itemInformation';
- import barCode from '@/api/main/barCode';
- import storageApi from '@/api/warehouseManagement';
- import { getBatchDetails } from '@/api/classifyManage/index';
- import tabMixins from '@/mixins/tableColumnsMixin';
- import { qualityStatus, qualityResults } from '@/utils/dict/index';
- import { parameterGetByCode } from '@/api/sys/index.js';
- import exportButton from '@/components/upload/exportButton.vue';
- import printQRCode from '@/views/warehouseManagement/stockManagement/components/printQRCode.vue';
- import unlockModal from '@/views/warehouseManagement/unlockApplication/components/unlockModal.vue'
- export default {
- mixins: [tabMixins],
- components: {
- ItemSearch,
- print,
- allot,
- importDialog,
- exportButton,
- printQRCode,
- ItemListed,
- unlockModal
- },
- props: {
- // 机构id
- organizationId: [Number, String],
- // 全部机构
- organizationList: Array,
- current: {
- type: Object,
- default: () => ({})
- },
- type: {
- type: String,
- default: ''
- }
- },
- data() {
- return {
- params: {},
- moudleName: 'stock',
- totalMoney: '',
- qualityStatus,
- qualityResults,
- config: [],
- openWindows: false,
- newColumns: [],
- checkRadioData: [],
- searchForm: {
- dimension: '1'
- },
- selectedDime: '2',
- diffCacheKeyUrl:
- 'eos-439decaa-warehouseManagement-stockLedger-products',
- cacheKeyUrl: 'eos-439decaa-warehouseManagement-stockLedger-products2', //默认查询key值
- columnsVersion: 1,
- isLoading: false,
- exportErrorDioalogVisible: false,
- errorData: [],
- isPrice: 1
- };
- },
- created() {
- this.getFieldModel();
- //仓库出入库是否显示金额(0:不显示 1:显示)
- parameterGetByCode({
- code: 'wms_price'
- }).then((res) => {
- this.isPrice = res.value;
- });
- },
- computed: {
- // 表格列配置
- columns() {
- // 当columnsVersion变化时会重新计算
- const version = this.columnsVersion;
- // selectedDime 1物品维度 2批次维度 3包装维度 4物料维度
- let arr = [
- this.selectedDime == 3 || this.selectedDime == 2
- ? {
- width: 45,
- type: 'selection',
- columnKey: 'selection',
- align: 'center'
- }
- : '',
- {
- columnKey: 'index',
- type: 'index',
- width: 50,
- align: 'center',
- label: '序号',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- width: 80,
- prop: 'QRCode',
- slot: 'QRCode',
- align: 'center',
- label: '二维码',
- showOverflowTooltip: true
- },
- this.selectedDime != 1
- ? {
- prop: 'batchNo',
- label: '批次号',
- align: 'center'
- }
- : '',
- this.selectedDime != 1
- ? {
- prop: 'systemBatchNo',
- label: '系统内部批次号',
- align: 'center',
- minWidth: 180,
- showOverflowTooltip: true,
- formatter: (row) => row.systemBatchNo || '-'
- }
- : '',
- {
- prop: 'categoryCode',
- label: '物品编码',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- slot: 'categoryName',
- prop: 'categoryName',
- label: '物品名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200
- },
- this.selectedDime != 1
- ? {
- prop: 'inventoryCycle',
- label: '存货周期(天)',
- align: 'center',
- width: 150,
- sortable: true,
- showOverflowTooltip: true
- }
- : '',
- {
- prop: 'brandNum',
- label: '牌号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'categoryModel',
- label: '型号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'specification',
- label: '规格',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'modelKey',
- label: '机型',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'colorKey',
- label: '颜色',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'level',
- label: '级别',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'lockQuantity',
- label: '锁定数量',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'availableQuantity',
- label: '可用数量',
- align: 'center',
- showOverflowTooltip: true,
- formatter: (row) => {
- // 入库计量数量不会随出库变化,可用数量必须使用当前批次库存余额计算
- const inventoryBalance = Number(row.availableCountBase) || 0;
- const lock = Number(row.lockQuantity) || 0;
- const result =
- (inventoryBalance * 100 - lock * 100) / 100;
- return Math.round(result * 100) / 100;
- }
- },
- {
- prop: 'measureQuantity',
- label: '计量数量',
- sortable: 'custom',
- showOverflowTooltip: true,
- width: 130,
- align: 'center',
- formatter: (row) => row.stockCountBase
- },
- // {
- // prop: 'supplierName',
- // label: '供应商',
- // showOverflowTooltip: true,
- // width: 130,
- // align: 'center'
- // },
- {
- prop: 'measureUnit',
- label: '计量单位',
- align: 'center'
- },
- {
- prop: 'weight',
- label: '重量',
- showOverflowTooltip: true
- },
- {
- prop: 'weightUnit',
- label: '重量单位',
- showOverflowTooltip: true
- },
- {
- prop: 'reelSpecification',
- label: '盘具',
- align: 'center',
- showOverflowTooltip: true
- },
- this.selectedDime == 1
- ? {
- prop: 'secureInventory',
- label: '安全库存',
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime == 1
- ? {
- prop: 'minInventory',
- label: '最小库存',
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime == 1
- ? {
- prop: 'maxInventory',
- label: '最大库存',
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime == 3
- ? {
- prop: 'packageNo',
- label: '包装编码',
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime != 1
- ? {
- prop: 'packingQuantity',
- label: '包装数量 ',
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime != 1
- ? {
- prop: 'packingUnit',
- label: '包装单位 ',
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime != 1
- ? {
- prop: 'result',
- slot: 'result',
- label: '质检结果',
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime != 1
- ? {
- prop: 'status',
- slot: 'status',
- label: '质检状态',
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime == 3 || this.selectedDime == 2
- ? {
- prop: 'warehouseName',
- label: '仓库名称',
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime == 3 || this.selectedDime == 2
- ? {
- prop: 'areaName',
- label: '货架记录',
- showOverflowTooltip: true,
- slot: 'areaName'
- }
- : '',
- // this.selectedDime == 3
- // ? {
- // prop: 'areaName',
- // label: '库区 ',
- // showOverflowTooltip: true
- // }
- // : '',
- // this.selectedDime == 3
- // ? {
- // prop: 'goodsAllocationName',
- // label: '货架',
- // showOverflowTooltip: true
- // }
- // : '',
- // this.selectedDime == 3
- // ? {
- // prop: 'goodsShelfName',
- // label: '货位',
- // showOverflowTooltip: true
- // }
- // : '',
- this.selectedDime == 3
- ? {
- prop: 'productionDate',
- label: '生产日期',
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime == 3
- ? {
- prop: 'purchaseDate',
- label: '采购日期',
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime == 3 || this.selectedDime == 4
- ? {
- prop: 'barcodes',
- label: '发货条码 ',
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime == 3 || this.selectedDime == 4
- ? {
- prop: 'clientCode',
- label: '客户代号',
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime == 3 || this.selectedDime == 2
- ? {
- prop: 'customerNames',
- label: '客户名称',
- showOverflowTooltip: true,
- width: 120,
- formatter: (row) => {
- return row.saleOrderInfo?.customerNames || '';
- }
- }
- : '',
- this.selectedDime == 3 || this.selectedDime == 2
- ? {
- prop: 'saleOrderNos',
- label: '销售订单号',
- showOverflowTooltip: true,
- width: 120,
- formatter: (row) => {
- return row.saleOrderInfo?.saleOrderNos || '';
- }
- }
- : '',
- this.selectedDime == 3 || this.selectedDime == 4
- ? {
- prop: 'engrave',
- label: '刻码 ',
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime == 3 || this.selectedDime == 4
- ? {
- prop: 'materielDesignation',
- label: '物料代号',
- width: 120,
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime != 1 ?
- {
- prop: 'supplierName',
- label: '供应商',
- width: 120,
- showOverflowTooltip: true
- } : '',
- this.selectedDime != 1 ?
- {
- prop: 'supplierCode',
- label: '供应商代号',
- width: 120,
- showOverflowTooltip: true
- } : '',
- // this.selectedDime == 1
- // ? {
- // prop: 'provenance',
- // label: '产地',
- // showOverflowTooltip: true
- // }
- // : '',
- this.isPrice == 1
- ? {
- prop: 'unitPrice',
- label: '单价',
- showOverflowTooltip: true
- }
- : '',
- this.isPrice == 1
- ? {
- prop: 'totalMoney',
- label: '金额',
- showOverflowTooltip: true
- }
- : '',
- this.selectedDime == 2
- ? {
- prop: 'createTime',
- width: 120,
- label: '入库时间',
- showOverflowTooltip: true
- }
- : ''
- ];
- if (this.selectedDime == 1) {
- return arr.filter((item) => item != '').concat(this.newColumns);
- } else {
- return arr.filter((item) => item != '');
- }
- },
- clientEnvironmentId() {
- return this.$store.state.user.info.clientEnvironmentId;
- },
- exportApiUrl() {
- return '/wms/statement/exportStockExcel';
- }
- },
- methods: {
- handleUnlock() {
- console.log('this.checkRadioData', this.checkRadioData);
- if (this.checkRadioData?.length != 1) {
- return this.$message.warning('请选择一条数据进行解锁!');
- }
- this.$refs.unlockModalRef.open('add',this.checkRadioData[0]);
- },
- openUploadDetail(row, type) {
- this.$refs.itemListedRef.open(row, type, 'detail', this.selectedDime);
- },
- openQRCode(row, type) {
- this.$refs.printQRCodeRef.open(row, type);
- },
- getFieldModel() {
- storageApi.fieldModel({ relevance: 't_main_category' }).then((res) => {
- let newRes = res.map((m) => {
- return {
- prop: 'extField.' + m.prop,
- label: m.label,
- align: 'center',
- showOverflowTooltip: true
- };
- });
- this.newColumns = [...newRes];
- });
- },
- // 调拨
- showAllot() {
- this.$refs.allotRef.open(this.checkRadioData);
- },
- // 全选
- changeSelectAll(arr) {
- console.log(arr);
- if (arr.length != 0) {
- this.checkRadioData = arr;
- } else {
- this.checkRadioData = [];
- }
- },
- selectChange(selection, row) {
- if (selection.length != 0) {
- this.checkRadioData = selection;
- } else {
- this.checkRadioData = [];
- }
- },
- allPrinting() {
- if (this.checkRadioData?.length > 0) {
- let params = this.checkRadioData.map((m) => {
- return {
- bizId: m.id,
- qrcodeType: 6
- };
- });
- barCode.batchBarPrint(params).then((res) => {
- console.log('--------res---------------');
- console.log(res);
- this.config = [];
- res.map((item, index) => {
- let obj = {
- putType: item.putType,
- sizeWide: item.sizeWide,
- sizeLong: item.sizeLong,
- value: this.checkRadioData[index].packageNo + '/6',
- useModeList: item.useModeList
- };
- obj.useModeList = obj.useModeList.sort((a, b) => {
- return a.barAvg.substr(4) - b.barAvg.substr(4);
- });
- this.config.push(obj);
- });
- console.log('this.config--------', this.config);
- this.openWindows = true;
- });
- } else {
- return this.$message.warning('请选择要打印的数据!');
- }
- // if (this.clientEnvironmentId == 2) {
- // this.$refs.printSrRef.open(this.checkRadioData);
- // } else if (this.clientEnvironmentId == 3) {
- // this.$refs.printTgRef.open(this.checkRadioData);
- // } else {
- // this.$refs.printRef.open(this.checkRadioData);
- // }
- },
- handledime(val) {
- console.log(val, 'val');
- this.selectedDime = val;
- // this.reload();
- this.reload(this.$refs.refSeavch.params);
- //每次切换维度查询列表配置信息,固定列配置 val 1 为物品维度,2 为批次维度,3 为包装维度。如果val值发生变化。请适配之前的维度
- this.cacheKeyUrl = this.diffCacheKeyUrl + val;
- this.getTabColumns();
- },
- setCacheKeyUrl(val) {
- this.cacheKeyUrl = val;
- this.getTabColumns();
- },
- getSummaries(param) {
- let key = ['totalMoney'];
- const { columns, data } = param;
- const sums = [];
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = '合计';
- return;
- }
- if (key.includes(column.property)) {
- const values = data.map((item) => Number(item[column.property]));
- // console.log(values);
- if (!values.every((value) => isNaN(value))) {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = parseFloat(sums[index])
- .toFixed(3)
- .replace(/\.?0+$/, '');
- } else {
- sums[index] = '';
- }
- } else {
- sums[index] = '';
- }
- });
- // console.log('sums', sums);
- return sums;
- },
- /* 表格数据源 */
- datasource({ page, limit, where, order }) {
- console.log('where~~~~~~~~~~~~~~~', where);
- console.log('this.selectedDime-----------', this.selectedDime);
- const dimension = this.$refs.refSeavch.dimension;
- console.log('this.dimension-----------', dimension);
- const treeId = this.$parent.$parent.$parent.current.id;
- if (dimension == 1) {
- // 物品维度
- const data = storageApi.getProductList({
- ...where,
- ...order,
- pageNum: page,
- size: limit
- });
- return data;
- } else if (dimension == 2) {
- // 批次维度
- const params = {
- categoryLevelId: treeId,
- ...where,
- ...order
- };
- this.params = {
- ...params,
- pageNum: page,
- size: limit
- };
- console.log('this.params----~~~', this.params);
- const data = storageApi.getBatchList(this.params);
- return data;
- } else if (dimension == 4) {
- // 物料维度
- const params = {
- categoryLevelId: treeId,
- ...where,
- ...order
- };
- const data = storageApi.getMaterialList({
- ...params,
- pageNum: page,
- size: limit,
- isEnabled: 1
- });
- return data;
- } else {
- // 包装维度
- let params = {};
- if (this.type === 'products') {
- params = {
- categoryLevelId: treeId,
- ...where,
- ...order
- };
- } else {
- console.log('this.current----', this.current.data);
- params = {
- warehouseId:
- this.current.data?.level == 0 ? this.current.data.id : '',
- warehouseAreaId:
- this.current.data?.level == 1 ? this.current.data.id : '',
- warehouseAreaGoodsId:
- this.current.data?.level == 2 ? this.current.data.id : '',
- warehouseAreaGoodsShelvesId:
- this.current.data?.level == 3 ? this.current.data.id : '',
- ...where,
- ...order
- };
- }
- console.log('params~~~~~~', params);
- const data = storageApi.getPackingList({
- ...params,
- pageNum: page,
- size: limit
- });
- console.log(data, 'data');
- // this.totalMoney=data
- return data;
- }
- },
- /* 刷新表格 */
- reload(where) {
- this.$nextTick(() => {
- console.log('this.current----', this.current);
- let params = {};
- if (this.type === 'products') {
- params = {
- ...where,
- categoryLevelId: this.current.data?.id || this.current?.id
- };
- } else {
- params = {
- ...where,
- warehouseId:
- this.current.data?.level == 0 ? this.current.data.id : '',
- warehouseAreaId:
- this.current.data?.level == 1 ? this.current.data.id : '',
- warehouseAreaGoodsId:
- this.current.data?.level == 2 ? this.current.data.id : '',
- warehouseAreaGoodsShelvesId:
- this.current.data?.level == 3 ? this.current.data.id : '',
- };
- }
- this.$refs.table.reload({
- pageNum: 1,
- where: params
- });
- });
- },
- details(row) {
- const key = Date.now();
- this.$store.commit('stockManagement/CLEAR_BASEINFO');
- this.$store.commit('stockManagement/CHANGE_BASEINFO', {
- key,
- value: row
- });
- const url =
- this.$refs.refSeavch.dimension == 1
- ? '/warehouseManagement/stockLedger/allBatchDetails'
- : '/warehouseManagement/stockLedger/batchDetails';
- this.$router.push({
- path: url,
- query: {
- key,
- dimension: this.$refs.refSeavch.dimension,
- // id: this.$refs.refSeavch.dimension != 3 ? row.id : row.categoryId,
- id: row.categoryId,
- assetId: row.assetId,
- batchNo: row.batchNo,
- systemBatchNo: row.systemBatchNo,
- categoryCode: row.categoryCode
- }
- });
- },
- beforeUpload(file) {
- if (file.size / 1024 / 1024 > this.size) {
- this.$message.error(`大小不能超过 ${this.size}MB`);
- return false;
- }
- if (this.limit > 0 && this.fileList.length === this.limit) {
- this.$message.error(`最多上传 ${this.limit}个文件`);
- return false;
- }
- let formData = new FormData();
- formData.append('file', file);
- this.isLoading = true;
- return importCategorySparePart(formData).then((res) => {
- if (res.data.length > 0) {
- this.exportErrorDioalogVisible = true;
- this.errorData = res.data;
- } else {
- this.$message.success('导入成功!');
- }
- this.isLoading = false;
- return false;
- });
- },
- successUpload(response) {
- this.isLoading = false;
- },
- errorUpload(response) {
- this.isLoading = false;
- },
- uploadFile() {
- this.$refs.importDialogRef.open();
- }
- },
- watch: {
- // 监听机构id变化
- current: {
- handler() {
- console.log('this.current----', this.current);
- this.reload();
- }
- },
- type: {
- handler() {
- if (this.type === 'warehouse') {
- this.selectedDime = '3';
- } else {
- this.selectedDime = '2';
- }
- this.reload();
- }
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .upload {
- display: flex;
- width: 100%;
- margin-left: 10px;
- }
- .header_view {
- display: flex;
- flex: 1;
- justify-content: flex-end;
- }
- </style>
|