| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519 |
- <template>
- <div>
- <el-card shadow="never">
- <header-title title="出库信息"></header-title>
- <el-form
- :model="formData"
- ref="formName"
- label-width="110px"
- :rules="rules"
- >
- <el-row :gutter="20">
- <el-col :span="6">
- <el-form-item label="出库场景" prop="bizType">
- <!-- <el-select
- filterable
- placeholder="请选择"
- v-model="formData.bizType"
- clearable
- @change="handleBizSceneChange"
- :disabled="!!(productList && productList.length)"
- >
- <el-option
- v-for="item in outputSceneState"
- :key="item.code"
- :value="item.code"
- :label="item.label"
- ></el-option>
- </el-select> -->
- <el-select
- filterable
- disabled
- placeholder="请选择"
- v-model="formData.bizType"
- clearable
- @change="handleBizSceneChange"
- >
- <el-option
- v-for="item in outputSceneState"
- :key="item.code"
- :value="item.code"
- :label="item.label"
- ></el-option>
- </el-select> </el-form-item
- ></el-col>
- <el-col :span="6">
- <el-form-item label="单据来源" prop="documentSource">
- <el-input
- placeholder="请选择"
- disabled
- v-model="formData.sourceBizNo"
- @click.native="openDocumentSourceDialog"
- >
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="出库物品类型" prop="extInfo.assetType">
- <el-select
- style="width: 100%"
- multiple
- disabled
- v-model="formData.extInfo.assetType"
- placeholder="请选择"
- >
- <el-option
- v-for="item in goodsLists"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- <!-- <el-select
- style="width: 100%"
- multiple
- :disabled="!!(productList && productList.length)"
- v-model="formData.extInfo.assetType"
- placeholder="请选择"
- >
- <el-option
- v-for="item in goodsLists"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select> -->
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="出库时间">
- <el-date-picker
- v-model="formData.storageTime"
- type="datetime"
- value-format="yyyy-MM-dd HH:mm:ss"
- placeholder="选择日期时间"
- >
- </el-date-picker></el-form-item
- ></el-col>
- <el-col :span="6">
- <el-form-item label="出库登记人">
- <el-input
- placeholder="登记人"
- disabled
- v-model="formData.extInfo.createUserName"
- clearable /></el-form-item
- ></el-col>
- <el-col :span="6">
- <el-form-item
- :label="this.bizType == 10 ? '申请人部门' : '领料人部门'"
- prop="extInfo.verifyDeptCode"
- >
- <selectTree
- ref="tree"
- class="form-ipt"
- size="medium"
- style="width: 100%"
- clearable
- :value="formData.extInfo.verifyDeptCode"
- :options="treeList"
- :props="{
- value: 'id',
- label: 'name',
- children: 'children'
- }"
- @getValue="auditorDeptClick"
- />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item
- :label="this.bizType == 10 ? '申请人' : '领料人'"
- prop="fromId"
- >
- <el-select
- v-model="formData.fromId"
- filterable
- placeholder="请选择"
- >
- <el-option
- v-for="item in llrLsit"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- @click.native="userSlected(item)"
- >
- </el-option>
- </el-select> </el-form-item
- ></el-col>
- <el-col :span="6">
- <el-form-item label="客户名称">
- <span>{{ formData.clientName }}</span>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="备注" prop="remark">
- <el-input
- v-model="formData.remark"
- placeholder="请详细说明"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div>
- <el-button
- style="margin-bottom: 20px; float: right; margin-right: 20px"
- type="primary"
- @click="addStock"
- v-if="isEdit && !stockError"
- >添加</el-button
- >
- <el-popconfirm
- v-if="showLocked"
- style="margin-bottom: 20px; float: right; margin-right: 20px"
- class="ele-action"
- title="该单已锁库存,释放后无法还原?"
- @confirm="lockRelease"
- >
- <template v-slot:reference>
- <el-button type="primary" plain>释放锁库</el-button>
- </template>
- </el-popconfirm>
- </div>
- <div class="material">
- <div>
- <header-title title="出库物品清单"></header-title>
- <div class="mt10 form-table">
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="productList"
- height="300"
- full-height="calc(100vh - 116px)"
- tool-class="ele-toolbar-form"
- @columns-change="handleColumnChange"
- :cache-key="cacheKeyUrl"
- :needPage="false"
- >
- <!-- 单价列 -->
- <template v-if="isPrice == 1" v-slot:price="{ row }">
- {{ row.price ? row.price : ' ' + '元' }}/{{ row.measureUnit }}
- </template>
- <!-- 金额列 -->
- <template v-if="isPrice == 1" v-slot:totalMoney="{ row }">
- {{ row.totalMoney ? row.totalMoney : 0 }}
- </template>
- <!-- 操作列 -->
- <template v-if="isEdit" v-slot:action="{ row, $index }">
- <el-link type="danger" @click="deleteProductList(row, $index)"
- >删除</el-link
- >
- </template>
- </ele-pro-table>
- </div>
- <header-title class="mt20" title="包装清单"></header-title>
- <div class="mt10 form-table">
- <el-table
- ref="showPackingListTable"
- :data="showPackingList"
- tooltip-effect="dark"
- :max-height="300"
- :row-class-name="tableRowClassName"
- :header-cell-style="rowClass"
- border
- v-el-table-infinite-scroll="pickingHandleScroll"
- >
- <el-table-column label="序号" type="index" width="50">
- </el-table-column>
- <el-table-column
- label="编码"
- prop="categoryCode"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- label="名称"
- prop="categoryName"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- label="批次号"
- prop="batchNo"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- label="发货条码"
- prop="barcodes"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- label="包装编码"
- prop="packageNo"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- label="包装数量"
- prop="packingQuantity"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- label="单位"
- prop="packingUnit"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- label="计量数量"
- prop="measureQuantity"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- label="计量单位"
- prop="measureUnit"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- label="物料代号"
- prop="materielDesignation"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- label="客户代号"
- prop="clientCode"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- label="刻码"
- prop="engrave"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- label="重量"
- prop="weight"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- label="重量单位"
- prop="weightUnit"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column label="机型" prop="modelKey" width="200">
- </el-table-column>
- <el-table-column label="颜色" prop="colorKey" width="200">
- </el-table-column>
- <el-table-column
- label="质检结果"
- prop="result"
- :show-overflow-tooltip="true"
- >
- <template slot-scope="{ row }">
- <span>{{ qualityResults[row.result] }}</span>
- </template>
- </el-table-column>
- <el-table-column
- label="质检状态"
- prop="status"
- :show-overflow-tooltip="true"
- >
- <template slot-scope="{ row }">
- <span>{{ qualityStatus[row.status] }}</span>
- </template>
- </el-table-column>
- <el-table-column
- label="生产日期"
- prop="productionDate"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- label="采购日期"
- prop="purchaseDate"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- prop="supplierName"
- label="供应商"
- min-width="200"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- prop="supplierCode"
- label="供应商代号"
- min-width="200"
- :show-overflow-tooltip="true"
- ></el-table-column>
- </el-table>
- </div>
- </div>
- <!-- <div class="mt20">
- <header-title class="mt20" title="物料明细"></header-title>
- <el-table ref="multipleTable" :data="showMaterialList" tooltip-effect="dark" :max-height="300"
- :row-class-name="tableRowClassName" :header-cell-style="rowClass" border style="width: 100%" stripe
- height="300px" v-el-table-infinite-scroll="materielHandleScroll">
- <el-table-column label="序号" type="index" width="50">
- </el-table-column>
- <el-table-column label="编码" prop="categoryCode" :show-overflow-tooltip="true"></el-table-column>
- <el-table-column label="名称" prop="categoryName" :show-overflow-tooltip="true"></el-table-column>
- <el-table-column label="批次号" prop="batchNo"></el-table-column>
- <el-table-column label="物料编码" prop="materialCode" :show-overflow-tooltip="true"></el-table-column>
- <el-table-column label="发货条码" prop="barcodes" :show-overflow-tooltip="true"></el-table-column>
- <el-table-column label="计量数量" prop="minPackingQuantity"></el-table-column>
- <el-table-column label="计量单位" prop="measureUnit"></el-table-column>
- <el-table-column label="物料代号" prop="materielDesignation">
- </el-table-column>
- <el-table-column label="客户代号" prop="clientCode">
- </el-table-column>
- <el-table-column label="刻码" prop="engrave"> </el-table-column>
- <el-table-column width="100" label="重量" prop="weight">
- </el-table-column>
- <el-table-column label="重量单位" prop="weightUnit">
- </el-table-column>
- <el-table-column label="质检结果" prop="result" width="120">
- <template slot-scope="{ row }">
- <span>{{ qualityResults[row.result] }}</span>
- </template>
- </el-table-column>
- <el-table-column label="质检状态" prop="status" width="120">
- <template slot-scope="{ row }">
- <span>{{ qualityStatus[row.status] }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div> -->
- </div>
- </el-card>
- <AssetsDialog
- ref="assetsDialogRef"
- :treeIds="formData.extInfo?.assetType"
- @detailData="detailData"
- :productLists="this.productList"
- />
- </div>
- </template>
- <script>
- import storageApi from '@/api/warehouseManagement/index.js';
- import elTableInfiniteScroll from 'el-table-infinite-scroll';
- import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
- import { getTreeByGroup } from '@/api/classifyManage';
- import {
- outputSceneState,
- qualityResults,
- qualityStatus
- } from '@/utils/dict/index';
- import selectTree from '@/components/selectTree';
- import AssetsDialog from './components/AssetsDialog.vue';
- import { deepClone } from '@/components/FormGenerator/utils/index';
- import { mapGetters } from 'vuex';
- import { parameterGetByCode } from '@/api/main/index.js';
- import tableColumnsMixin from '@/mixins/tableColumnsMixin';
- export default {
- mixins: [tableColumnsMixin],
- components: {
- selectTree,
- AssetsDialog
- },
- props: {
- form: { type: Object, default: {} },
- bizType: { type: Number, default: 1 },
- sourceBizNo: { type: String, default: '' },
- type: { type: String, default: '正常出库' },
- detailList: { type: Array, default: () => [] },
- saleProductList: { type: Array, default: () => [] },
- extractedList: { type: Array, default: () => [] },
- wwType: { type: Number, default: null },
- isEdit: { type: Boolean, default: true } //是否可编辑
- },
- directives: {
- 'el-table-infinite-scroll': elTableInfiniteScroll
- },
- data() {
- return {
- stockError: false,
- stockErrorMsg: '',
- cacheKeyUrl: '202605181721-wt-outbound-table',
- dColumns: [], // 动态表头
- goodsLists: [], // 商品列表
- productList: [], // 产品列表
- showPackingList: [], // 展示的包装列表
- packingList: [], // 包装列表
- showMaterialList: [], // 展示物料列表
- materialList: [], // 物料列表
- extInfo: {}, // 扩展信息
- pageSize: 20,
- pickingPageNum: 1,
- materielPageNum: 1,
- dimension: '3',
- outputSceneState,
- qualityStatus, // 质检状态
- qualityResults, // 质检结果
- treeList: [],
- formData: {
- storageTime: '',
- extInfo: {
- assetType: [], //物品类型id
- assetTypeName: '', //物品类型名称
- deptCode: '', //部门code
- deptName: '', //部门名称
- verifyDeptCode: '', //审核部门编码
- verifyDeptName: '', //审核部门名称
- deliveryName: '', //送货人名称
- fromUserPhone: '', //送货人电话
- sourceBizNo: '', //销售订单
- urgent: '', //紧急状态
- supplierId: '', //供应商ID
- supplierName: '', //供应商名称
- createUserName: '', //创建人名字
- contentImage: [] //图片数组
- },
- fromId: '', //领料人
- fromUser: '', //送货人
- bizType: '', //物品类型
- verifyId: '', //审核人Id
- verifyName: '', //审核人名称
- createUserId: '',
- remark: ''
- },
- rules: {
- bizType: {
- required: true,
- message: '请选择出库场景',
- trigger: 'change'
- },
- 'extInfo[verifyDeptCode]': {
- required: true,
- message: '请选择领料人部门',
- trigger: ['change', 'blur']
- },
- fromId: {
- required: true,
- message: '请选择',
- trigger: 'change'
- }
- },
- llrLsit: [],
- isPrice: 1,
- showLocked: false,
- tabMixinsInit: false
- };
- },
- computed: {
- ...mapGetters(['user']),
- clientEnvironmentId() {
- return this.$store.state.user.info.clientEnvironmentId;
- },
- // 出库物品清单表格列配置
- columns() {
- const columns = [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- label: '编码',
- prop: 'categoryCode',
- align: 'center',
- width: 150,
- showOverflowTooltip: true
- },
- {
- label: '名称',
- prop: 'categoryName',
- align: 'center',
- width: 150,
- showOverflowTooltip: true
- }
- ];
- // 级别 - 仅 clientEnvironmentId == 4 时显示
- if (this.clientEnvironmentId == 4) {
- columns.push({
- label: '级别',
- prop: 'level',
- align: 'center'
- });
- }
- // 型号、规格、牌号
- columns.push(
- {
- label: '型号',
- prop: 'categoryModel',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '规格',
- prop: 'specification',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '牌号',
- prop: 'brandNum',
- align: 'center',
- showOverflowTooltip: true
- }
- );
- // 动态列
- this.dColumns.forEach((item) => {
- columns.push({
- label: item.label,
- prop: item.prop,
- width: 120,
- align: item.align,
- showOverflowTooltip: item.showOverflowTooltip
- });
- });
- // 批次号
- columns.push({
- label: '批次号',
- prop: 'batchNo',
- align: 'center',
- showOverflowTooltip: true
- });
- // 包装数量、单位
- columns.push(
- {
- label: '包装数量',
- prop: 'packingQuantity',
- width: 80
- },
- {
- label: '单位',
- prop: 'packingUnit'
- }
- );
- // 计量数量、计量单位
- columns.push(
- {
- label: '计量数量',
- prop: 'measureQuantity',
- showOverflowTooltip: true
- },
- {
- label: '计量单位',
- prop: 'measureUnit'
- }
- );
- // 重量、重量单位
- columns.push(
- {
- label: '重量',
- prop: 'weight',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '重量单位',
- prop: 'weightUnit',
- align: 'center',
- showOverflowTooltip: true
- }
- );
- // 机型、颜色、锁定数量、库存
- columns.push(
- {
- label: '机型',
- prop: 'modelKey',
- width: 150
- },
- {
- label: '颜色',
- prop: 'colorKey',
- width: 150
- },
- {
- label: '锁定数量',
- prop: 'lockQuantity',
- width: 100
- },
- {
- label: '库存',
- prop: 'stockNum',
- align: 'center',
- showOverflowTooltip: true
- }
- );
- // 单价 - 条件显示
- if (this.isPrice == 1) {
- columns.push({
- label: '单价',
- prop: 'price',
- align: 'center',
- slot: 'price'
- });
- }
- // 金额 - 条件显示
- if (this.isPrice == 1) {
- columns.push({
- label: '金额',
- prop: 'totalMoney',
- align: 'center',
- showOverflowTooltip: true,
- slot: 'totalMoney'
- });
- }
- // 采购原因 - 仅 clientEnvironmentId == 4 时显示
- if (this.clientEnvironmentId == 4) {
- columns.push({
- label: '采购原因',
- prop: 'purpose',
- align: 'center',
- showOverflowTooltip: true
- });
- }
- // 仓库、供应商、供应商代号
- columns.push(
- {
- label: '仓库',
- prop: 'warehouseName',
- width: 150,
- showOverflowTooltip: true
- },
- {
- label: '供应商',
- prop: 'supplierName',
- minWidth: 150,
- showOverflowTooltip: true
- },
- {
- label: '供应商代号',
- prop: 'supplierCode',
- minWidth: 150,
- showOverflowTooltip: true
- }
- );
- // 操作列 - 仅在可编辑时显示
- if (this.isEdit) {
- columns.push({
- label: '操作',
- width: 120,
- align: 'center',
- slot: 'action',
- fixed: 'right'
- });
- }
- return columns;
- }
- },
- async created() {
- //仓库出入库是否显示金额(0:不显示 1:显示)
- parameterGetByCode({
- code: 'wms_price'
- }).then((res) => {
- this.isPrice = res.value;
- });
- this.getFieldModel();
- this.getListItems();
- this.initDeptData().then(() => {
- this.initFormData();
- this.getNowFormatDate();
- });
- },
- methods: {
- checkLock() {
- storageApi.isLocked(this.formData.sourceBizNo).then((res) => {
- console.log(res, 'isLocked-res');
- this.showLocked = res;
- });
- },
- lockRelease() {
- storageApi
- .lockOrderRelease(this.formData.sourceBizNo)
- .then((res) => {
- console.log(res, 'lockOrderRelease-res');
- this.$message({
- message: '释放成功',
- type: 'success'
- });
- })
- .catch(() => {});
- },
- // 获取当前时间函数
- getNowDate() {
- let date = new Date(),
- obj = {
- year: date.getFullYear(), //获取当前月份(0-11,0代表1月)
- month: date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
- strDate: date.getDate(), // 获取当前日(1-31)
- hour: date.getHours(), //获取当前小时(0 ~ 23)
- minute: date.getMinutes(), //获取当前分钟(0 ~ 59)
- second: date.getSeconds() //获取当前秒数(0 ~ 59)
- };
- Object.keys(obj).forEach((key) => {
- if (obj[key] < 10) obj[key] = `0${obj[key]}`;
- });
- return obj;
- },
- // 赋值入库时间
- getNowFormatDate() {
- const obj = this.getNowDate();
- const defaultTime = '00:00:00';
- const currentTime = `${obj.hour}:${obj.minute}:${obj.second}`;
- this.formData.storageTime = `${obj.year}-${obj.month}-${obj.strDate} ${currentTime}`;
- },
- // 获取动态表头
- getFieldModel() {
- storageApi.fieldModel({ fieldModel: 't_main_category' }).then((res) => {
- let newRes = res.map((m) => {
- return {
- prop: 'extField.' + m.prop,
- label: m.label,
- align: 'center',
- showOverflowTooltip: true
- };
- });
- this.dColumns = [...newRes];
- this.getColumns();
- });
- },
- userSlected(data) {
- this.formData.fromId = data.id;
- this.formData.fromUser = data.name;
- this.formData.fromUserPhone = data.phone;
- },
- openDocumentSourceDialog() {
- console.log('打开单据来源弹窗');
- },
- clearDocumentSource() {
- console.log('清空');
- },
- pickingHandleScroll() {
- console.log('---------pickingHandleScroll------------');
- if (this.showPackingList.length < this.packingList.length) {
- if (this.packingList.length > this.pageSize) {
- this.pickingPageNum += 1;
- }
- this.pickingFetchData();
- }
- },
- pickingFetchData() {
- const start = (this.pickingPageNum - 1) * this.pageSize;
- const end = start + this.pageSize;
- this.showPackingList = this.showPackingList.concat(
- this.packingList.slice(start, end)
- );
- },
- materielHandleScroll() {
- console.log('---------materielHandleScroll------------');
- if (this.showMaterialList.length < this.materialList.length) {
- if (this.materialList.length > this.pageSize) {
- this.materielPageNum += 1;
- }
- this.materielFetchData();
- }
- },
- materielFetchData() {
- const start = (this.materielPageNum - 1) * this.pageSize;
- const end = start + this.pageSize;
- this.showMaterialList = this.showMaterialList.concat(
- this.materialList.slice(start, end)
- );
- console.log(this.showMaterialList);
- },
- // 获取物品列表
- async getListItems() {
- const { data } = await getTreeByGroup({});
- this.goodsLists = data;
- },
- // 打开单据来源弹窗
- openDocumentSourceDialog() {
- console.log('打开单据来源弹窗');
- },
- tableRowClassName({ row, rowIndex }) {
- console.log(row);
- // 结果 0=默认,1=合格,2=不合格
- if (row.result == 1) {
- return 'warning-row';
- } else {
- return '';
- }
- },
- detailData(data, dimension) {
- this.dimension = dimension;
- const mergedData = [...(this.formData.outInDetailList || []), ...data];
- this.formData.outInDetailList = mergedData;
- this.productList = data.map((productItem) => {
- return {
- ...productItem,
- suspendBatchNo: productItem.batchNo || '',
- outInDetailRecordRequestList:
- productItem.outInDetailRecordRequestList.map((packingItem) => {
- return {
- ...packingItem,
- workOrderId:
- this.type === '自选领用出库'
- ? this.form.detailList[0].workOrderId
- : '',
- pickOrderId:
- this.type === '自选领用出库'
- ? this.form.detailList[0].pickOrderId
- : '',
- taskId:
- this.type === '自选领用出库'
- ? this.form.detailList[0].taskId
- : '',
- categoryName: productItem.categoryName,
- categoryCode: productItem.categoryCode,
- supplierCode: productItem.supplierCode,
- supplierName: productItem.supplierName,
- materialDetailList: packingItem.materialDetailList.map(
- (materialItem) => {
- return {
- ...materialItem,
- categoryName: productItem.categoryName,
- categoryCode: productItem.categoryCode,
- supplierCode: productItem.supplierCode,
- supplierName: productItem.supplierName
- };
- }
- )
- };
- })
- };
- });
- const newProducts = mergedData.map((productItem) => ({
- ...productItem,
- suspendBatchNo: productItem.batchNo || '',
- outInDetailRecordRequestList:
- productItem.outInDetailRecordRequestList.map((packingItem) => ({
- ...packingItem,
- categoryName: productItem.categoryName,
- categoryCode: productItem.categoryCode,
- supplierCode: productItem.supplierCode,
- supplierName: productItem.supplierName,
- workOrderId:
- this.type === '自选领用出库'
- ? this.form.detailList[0].workOrderId
- : '',
- pickOrderId:
- this.type === '自选领用出库'
- ? this.form.detailList[0].pickOrderId
- : '',
- taskId:
- this.type === '自选领用出库'
- ? this.form.detailList[0].taskId
- : '',
- materialDetailList: packingItem.materialDetailList.map(
- (materialItem) => ({
- ...materialItem,
- categoryName: productItem.categoryName,
- categoryCode: productItem.categoryCode,
- supplierCode: productItem.supplierCode,
- supplierName: productItem.supplierName
- })
- )
- }))
- }));
- // 去重合并产品列表和新产品列表
- const uniqueProducts =newProducts
- this.productList = newProducts;
- console.log('111111111111111');
- console.log(this.productList);
- // 排序
- this.productList.sort((a, b) => a.categoryCode - b.categoryCode);
- // 获取包装维度数据
- const arr = [];
- for (const key in this.productList) {
- for (const k in this.productList[key].outInDetailRecordRequestList) {
- arr.push({
- ...this.productList[key].outInDetailRecordRequestList[k]
- });
- }
- }
- this.packingList = arr;
- const newPacking = [];
- newProducts.forEach((item) => {
- newPacking.push(...item.outInDetailRecordRequestList);
- });
- //去重
- const newPackingList = [
- ...new Map(
- [...this.packingList, ...newPacking].map((item) => [item.id, item])
- ).values()
- ];
- this.packingList = newPackingList;
- this.packingList.sort((a, b) => a.categoryCode - b.categoryCode);
- // 获取物料维度数据
- let iArr = [];
- arr.forEach((item) => {
- item.materialDetailList.forEach((ele) => {
- iArr.push({ ...ele });
- });
- });
- this.materialList = iArr;
- const newMaterial = [];
- newPacking.forEach((item) => {
- newMaterial.push(...item.materialDetailList);
- });
- this.materialList = [...this.materialList, ...newMaterial];
- // 触发分页更新
- this.pickingPageNum = 1;
- this.materielPageNum = 1;
- this.pickingFetchData();
- this.materielFetchData();
- this.formData.outInDetailList = this.productList;
- console.log(this.productList, 'this.productList');
- console.log(this.packingList, 'this.packingList');
- },
- async getReturnStorage() {
- return new Promise((resolve) => {
- console.log(this.formData);
- if (this.stockError) {
- return this.$message.error(this.stockErrorMsg);
- }
- this.$refs.formName.validate(async (valid) => {
- if (!this.productList?.length) {
- return this.$message.error('请添加出库明细!');
- }
- let obj = deepClone({ ...this.formData, type: 2 });
- obj.extInfo.sourceBizNo = obj.sourceBizNo;
- obj.fromType = obj.type;
- // 处理物品类型assetType
- obj.extInfo.assetType = obj.extInfo?.assetType.join(',');
- // 处理仓库id
- let warehouseId = [];
- let warehouseName = [];
- let warehouseIds = this.productList
- .map((item) => item.warehouseId)
- .flat();
- let warehouseNames = this.productList
- .map((item) => item.warehouseName)
- .flat();
- warehouseIds.forEach((item, index) => {
- if (!warehouseId.includes(item)) {
- warehouseId.push(item);
- warehouseName.push(warehouseNames[index]);
- }
- });
- obj.warehouseIds = warehouseId;
- obj.warehouseNames = warehouseName;
- console.log('2222', obj);
- let isPass = false;
- // 1按数量计费 2按重量计费
- if (this.form.pricingWay == 2) {
- if (this.materialList.length > 0) {
- // 判断物料
- isPass = this.materialCodeReqList.every(
- (item) => item.weight > 0
- );
- } else {
- // 判断包装重量是否全部大于0
- isPass = this.packingList.every((item) => item.weight > 0);
- }
- } else {
- isPass = true;
- }
- if (isPass) {
- resolve(obj);
- } else {
- this.$message.error('委外发货重量不能为空');
- }
- });
- });
- },
- onClear() {
- this.formData.sourceBizNo = '';
- this.warehousingMaterialList = [];
- this.$refs.trees.valueTitle = '';
- this.formData.clientName = '';
- this.formData.clientUser = '';
- this.formData.clientPhone = '';
- this.$forceUpdate();
- },
- rowClass({ row, column, rowIndex, columnIndex }) {
- if (rowIndex === 1) {
- return {
- display: 'none',
- background: '#EEEEEE'
- };
- }
- return { background: '#0000' };
- },
- // 部门点击事件
- async auditorDeptClick(data) {
- console.log(data);
- this.formData.extInfo.verifyDeptCode = data?.id;
- this.formData.extInfo.verifyDeptName = data?.name;
- this.formData.verifyId = '';
- this.formData.verifyName = '';
- this.$refs.formName.validateField('verifyDeptName');
- if (data) {
- this.getStaffList(data);
- }
- },
- getStaffList(data) {
- return new Promise(async (resolve) => {
- let res = await warehouseDefinition.getUserPage({
- groupId: data.id,
- size: 9999,
- page: 1
- });
- this.llrLsit = res.list;
- resolve();
- });
- },
- // 初始化用户信息
- async initFormData() {
- console.log(this.form, 'ddddddddddddddddddddddddddddd123form');
- // const res = await warehouseDefinition.tree();
- // let obj = res.find(
- // (item) =>
- // item.id ===
- // this.user.info.deptIds[this.user.info.deptIds.length - 1]
- // );
- // if (!obj) return;
- // this.formData.extInfo.deptCode = obj.id;
- // this.formData.extInfo.deptName = obj.name;
- // this.formData.extInfo.createUserName = this.user.info.name;
- // this.formData.createUserId = this.user.info.userId;
- this.formData.extInfo.assetType = Array.from(
- new Set(this.form.categoryLevelTopId?.split(','))
- );
- //委外出库
- if (this.bizType == 7 && this.form.productList) {
- const categoryids = this.form.productList.map(
- (p) => p.categoryLevelTopId
- );
- console.log(categoryids, '委外出库的物品id');
- this.formData.extInfo.assetType = categoryids;
- }
- // 出库类型
- this.formData.bizType = this.bizType;
- // 添加单据来源
- this.formData.sourceBizNo = this.sourceBizNo || this.form?.code;
- this.checkLock();
- // 将出库状态改成出库状态 2出库 1入库
- this.formData.type = 2;
- // 入库登记人
- this.formData.extInfo.createUserId = this.$store.state.user.info.userId;
- this.formData.extInfo.createUserName = this.$store.state.user.info.name;
- this.formData.createUserId = this.$store.state.user.info.userId;
- await this.initDeptData(); // 确保部门树加载
- if (this.form.makerId) {
- warehouseDefinition.getGroupById(this.form.makerId).then((res) => {
- console.log(res, 'makerId');
- this.$set(this.formData.extInfo, 'verifyDeptCode', res.groupId);
- this.$set(this.formData.extInfo, 'verifyDeptName', res.groupName);
- });
- }
- // 生产相关逻辑
- console.log(this.detailList, 'this.detailList');
- console.log(this.saleProductList, 'this.saleProductList');
- console.log(this.productList, 'this.productList');
- console.log('11111111111111111111');
- if (this.detailList?.length > 0) {
- // 获取领料人列表
- if (this.form.executorDeptId) {
- this.getStaffList({ id: this.form.executorDeptId }).then(() => {
- // 获取领料人和领料部门
- this.formData.fromId = this.form.executorId;
- this.formData.fromUser = this.form.executorName;
- this.formData.extInfo.verifyDeptCode = this.form.executorDeptId;
- this.formData.extInfo.verifyDeptName = this.form.executorDeptName;
- });
- } else {
- this.formData.fromId = this.form.createUserId;
- warehouseDefinition
- .getGroupById(this.form.createUserId)
- .then((res) => {
- console.log(res, 'form没有executorDeptId有createUserId');
- this.$set(this.formData, 'fromUser', res.name);
- this.$set(this.formData.extInfo, 'verifyDeptCode', res.groupId);
- if (res.groupId) {
- this.getStaffList({ id: res.groupId });
- }
- this.$set(
- this.formData.extInfo,
- 'verifyDeptName',
- res.groupName
- );
- });
- }
- console.log(this.saleProductList, 'this.saleProductList33333');
- let pData = {
- type: '1',
- deliveryNo: this.formData.sourceBizNo,
- builders: this.detailList.map((item) => {
- return {
- categoryId:
- item.categoryId || item.instanceId || item.productId,
- num: item.demandQuantity || item.measurementCount,
- warehouseId: this.bizType == 11 ? item.warehouseId : '',
- batchNo: item.batchNo || ''
- };
- })
- };
- let pData2 = {
- type: this.wwType,
- deliveryNo: this.formData.sourceBizNo,
- taskIds: this.extractedList.map((item) => item.taskId),
- workOrderIds: this.extractedList.map((item) => item.workOrderId)
- };
- let pData3 = {
- //销售退货处理 外协出库
- type: 3,
- deliveryNo: this.formData.sourceBizNo,
- outInIds: this.form?.returnInReceiptId?.split(','),
- packageNos: this.detailList.map((item) => item.packageNo)
- };
- let pData4 = {
- //受托退货
- type: 3,
- deliveryNo: this.formData.sourceBizNo,
- ids: this.detailList.map((item) => item.packageId)?.toString()
- };
- let api = this.bizType == 8 ? 'getHierarchyList' : 'getHierarchyFifo';
- storageApi[api](
- this.wwType == 3
- ? pData2
- : this.bizType == 6
- ? pData3
- : this.bizType == 8
- ? pData4
- : pData
- )
- .then((data) => {
- this.detailData(data, this.dimension);
- })
- .catch((err) => {
- console.log(err);
- });
- return;
- }
- // 销售相关逻辑
- if (this.saleProductList?.length > 0) {
- this.formData.clientName = this.form.contactName;
- this.formData.clientCode = this.form.contactCode;
- // 获取领料人列表
- this.getStaffList({ id: this.form.deptId }).then(() => {
- // 获取领料人和领料部门
- this.formData.fromId = this.form.makerId;
- this.formData.fromUser = this.form.makerName;
- this.formData.extInfo.verifyDeptCode = this.form.deptId;
- this.formData.extInfo.verifyDeptName = this.form.deptName;
- });
- console.log(this.saleProductList, 'this.saleProductList11111');
- let pData = {
- type: '1',
- deliveryNo: this.formData.sourceBizNo,
- builders: this.saleProductList.map((item) => {
- return {
- categoryId: item.productId || item.categoryId,
- num: item.totalCount,
- // 处理销售发货时物品清单和出库清单仓库不一致的问题
- warehouseId: this.bizType == 3 ? item.warehouseId : '',
- colorKey: item.colorKey || '',
- batchNo: item.batchNo || '',
- categoryModel: item.modelType || '',
- deliveryDetailId: item.id || ''
- };
- })
- };
- let pData2 = {
- type: this.wwType,
- deliveryNo: this.formData.sourceBizNo,
- taskIds: this.extractedList.map((item) => item.taskId),
- workOrderIds: this.extractedList.map((item) => item.workOrderId)
- };
- console.log('111~~~~~~~~', pData);
- storageApi
- .getHierarchyFifo(this.wwType == 3 ? pData2 : pData)
- .then((data) => {
- this.detailData(data, this.dimension);
- })
- .catch((err) => {
- console.log('err~~~', err);
- this.stockError = true;
- this.stockErrorMsg = err;
- });
- return;
- }
- //采购委外
- if (this.form.productList?.length > 0) {
- this.getStaffList({ id: this.form.deptId }).then(() => {
- this.formData.fromId = this.form.makerId;
- this.formData.fromUser = this.form.makerName;
- this.formData.extInfo.verifyDeptCode = this.form.deptId;
- this.formData.extInfo.verifyDeptName = this.form.deptName;
- });
- console.log(this.saleProductList, 'this.saleProductList22222');
- let pData = {
- type: '1',
- builders: this.form.productList.map((item) => {
- return {
- categoryId: item.productId,
- num: item.totalCount,
- price: item.totalPrice,
- unitPrice: item.singlePrice,
- weight: item.singleWeight * item.totalCount || 0,
- batchNo: item.batchNo || '',
- taskId: item.taskId || '',
- deliveryDetailId: item.id || ''
- };
- })
- };
- let pData2 = {
- type: 3,
- taskIds: this.form.productList.map((item) => item.taskId),
- workOrderIds: [this.form.sourceId]
- };
- storageApi
- .getHierarchyFifo(this.form.sourceId ? pData2 : pData)
- .then((data) => {
- this.detailData(data, this.dimension);
- })
- .catch((err) => {
- console.log(err);
- });
- }
- // if (this.form.productList?.length > 0) {
- // this.getStaffList({ id: this.form.deptId }).then(() => {
- // this.formData.fromId = this.form.makerId;
- // this.formData.fromUser = this.form.makerName;
- // this.formData.extInfo.verifyDeptCode = this.form.deptId;
- // this.formData.extInfo.verifyDeptName = this.form.deptName;
- // });
- // let pData = {
- // type: '1',
- // builders: this.form.productList.map((item) => {
- // return {
- // categoryId: item.productId,
- // num: item.totalCount,
- // price: item.totalPrice,
- // unitPrice: item.singlePrice,
- // weight: item.singleWeight * item.totalCount || 0,
- // batchNo: item.batchNo || '',
- // taskId: item.taskId || ''
- // };
- // })
- // };
- // let pData2 = {
- // type: 3,
- // taskIds: this.form.productList.map((item) => item.taskId),
- // workOrderIds: [this.form.sourceId]
- // };
- // storageApi
- // .getHierarchyFifo(this.form.sourceId ? pData2 : pData)
- // .then((data) => {
- // this.detailData(data, this.dimension);
- // })
- // .catch((err) => {
- // console.log(err);
- // });
- // }
- },
- // 初始化部门数据
- initDeptData() {
- return new Promise(async (resolve) => {
- const res = await warehouseDefinition.tree();
- this.treeList = this.$util.toTreeData({
- data: res,
- idField: 'id',
- parentIdField: 'parentId'
- });
- this.$nextTick(() => {
- resolve();
- });
- });
- },
- addStock() {
- console.log(this.formData.extInfo.assetType);
- if (
- !(
- this.formData.extInfo.assetType &&
- this.formData.extInfo.assetType.length > 0
- )
- )
- return this.$message.error('请选择出库产品类型');
- if (!this.formData.bizType && this.formData.bizType !== 0)
- return this.$message.error('请选择出库场景');
- this.$refs.assetsDialogRef.open(this.productList);
- },
- handleBizSceneChange() {
- if (this.formData.extInfo.assetType == 7) {
- this.formData.extInfo.sourceBizNo = '';
- }
- this.formData.sourceBizNo = '';
- },
- deleteProductList(row, index) {
- // 1. 获取当前物料的所有包装列表
- const targetPackages = row.outInDetailRecordRequestList || [];
- const packageIds = new Set(targetPackages.map((p) => p.id));
- console.log('targetPackages', targetPackages);
- console.log('packageIds包装的id', packageIds);
- // 从packingList中移除相关包装
- this.packingList = this.packingList.filter(
- (p) => !packageIds.has(p.id) && p.categoryCode !== row.categoryCode
- );
- console.log('包装列表', this.packingList);
- // 从materialList中移除关联物料
- const materialIds = new Set();
- targetPackages.forEach((packageItem) => {
- packageItem.materialDetailList.forEach((material) => {
- materialIds.add(material.id);
- });
- });
- this.materialList = this.materialList.filter(
- (m) => !materialIds.has(m.id) && m.categoryCode !== row.categoryCode
- );
- this.productList.splice(index, 1);
- // this.$nextTick(() => {
- // this.$refs.productListTable?.doLayout()
- // this.$refs.showPackingListTable?.doLayout()
- // this.$refs.multipleTable?.doLayout()
- // })
- }
- },
- watch: {
- packingList: {
- handler(newVal) {
- console.log('包装列表', newVal);
- console.log('当前包装列表加载页数2', this.pickingPageNum);
- this.showPackingList = newVal.slice(
- 0,
- this.pageSize * (this.pickingPageNum > 0 ? this.pickingPageNum : 1)
- );
- },
- deep: true
- },
- materialList: {
- handler(newVal) {
- console.log('物料列表', newVal);
- console.log('当前物料列表加载页数', this.materielPageNum);
- this.showMaterialList = newVal.slice(
- 0,
- this.pageSize *
- (this.materielPageNum > 0 ? this.materielPageNum : 1)
- );
- },
- deep: true
- }
- // detailList: {
- // handler(newVal) {
- // if (newVal.length) {
- // this.initFormData();
- // }
- // },
- // deep: true
- // }
- }
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep .el-row {
- display: flex;
- flex-wrap: wrap;
- }
- ::v-deep.form-table {
- .el-form-item {
- margin-bottom: 0;
- }
- .el-input__inner {
- padding: 0 10px;
- }
- }
- .p20 {
- padding: 20px;
- }
- .el-select,
- .el-date-editor {
- width: 100%;
- }
- .el-form-item {
- margin-bottom: 22px;
- }
- .material {
- margin-top: 20px;
- .flex {
- display: flex;
- justify-content: space-between;
- font-size: 14px;
- align-items: center;
- .red {
- color: #ff4949;
- }
- }
- }
- .mt10 {
- margin-top: 10px;
- }
- .mt20 {
- margin-top: 20px;
- }
- .center {
- text-align: center;
- }
- </style>
|