| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161 |
- <template>
- <div class="ele-body">
- <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"
- >
- <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="">
- <el-input
- placeholder="请选择"
- v-model="formData.clientName"
- style="width: calc(100% - 80px);"
-
- >
-
- </el-input>
- <openContactDialog style="margin-left: 3px;" @changeParent="contactDialogSuccess"></openContactDialog>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="单据来源" prop="sourceBizNo">
- <el-input
- placeholder="请选择"
- v-model="formData.sourceBizNo"
- @click.native="openDocumentSourceDialog"
- >
- <el-button
- @click.stop="clearDocumentSource"
- slot="append"
- icon="el-icon-circle-close"
- ></el-button>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="出库物品类型" prop="extInfo.assetType">
- <el-select
- style="width: 100%"
- multiple
- 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-input
- placeholder="登记人"
- disabled
- v-model="formData.extInfo.createUserName"
- clearable /></el-form-item
- ></el-col>
- <el-col :span="6">
- <el-form-item label="领料人部门" prop="extInfo.verifyDeptCode">
- <selectTree
- ref="tree"
- class="form-ipt"
- size="medium"
- style="width: 100%"
- :value="formData.extInfo.verifyDeptCode"
- clearable
- :options="treeList"
- :props="{
- value: 'id',
- label: 'name',
- children: 'children'
- }"
- @getValue="auditorDeptClick"
- />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="领料人" 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="领料人联系方式" prop="fromUserPhone">
- <el-input
- placeholder="请输入"
- disabled
- v-model="formData.extInfo.fromUserPhone"
- clearable /></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"
- >添加</el-button
- >
- </div>
- <div class="material">
- <div>
- <header-title title="物品清单"></header-title>
- <div class="mt10 form-table">
- <el-table
- ref="productListTable"
- :data="productList"
- border
- tooltip-effect="dark"
- :max-height="300"
- :header-cell-style="rowClass"
- >
- <el-table-column label="序号" type="index" width="50">
- </el-table-column>
- <el-table-column
- label="编码"
- prop="categoryCode"
- align="center"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- label="名称"
- align="center"
- prop="categoryName"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- v-if="clientEnvironmentId == 4"
- label="级别"
- prop="level"
- align="center"
- >
- </el-table-column>
- <el-table-column
- label="型号"
- align="center"
- prop="categoryModel"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- label="规格"
- align="center"
- prop="specification"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- label="牌号"
- align="center"
- prop="brandNum"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- v-for="(item, index) in newColumns"
- :label="item.label"
- :align="item.align"
- :prop="item.prop"
- :show-overflow-tooltip="item.showOverflowTooltip"
- ></el-table-column>
- <el-table-column
- label="批次号"
- prop="batchNo"
- width="150"
- align="center"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- label="包装数量"
- v-if="clientEnvironmentId == 3"
- prop="packingQuantity"
- align="center"
- >
- <template slot-scope="{ row, $index }">
- {{ row.packingQuantity }} {{ row.packingUnit }}
- </template>
- </el-table-column>
- <el-table-column
- v-else
- label="包装数量"
- prop="packingQuantity"
- width="80"
- ></el-table-column>
- <el-table-column
- v-if="clientEnvironmentId == 3"
- label="最小包装单元"
- align="center"
- width="120"
- prop="minPackingQuantity"
- >
- <template slot-scope="{ row, $index }">
- {{ row.minPackingQuantity }} {{ row.measureUnit }} /{{
- row.packingUnit
- }}
- </template>
- </el-table-column>
- <el-table-column
- v-else
- label="包装单位"
- prop="packingUnit"
- ></el-table-column>
- <el-table-column
- label="计量数量"
- prop="measureQuantity"
- width="100"
- align="center"
- >
- </el-table-column>
- <el-table-column
- label="计量单位"
- prop="measureUnit"
- align="center"
- >
- <template slot-scope="{ row, $index }">
- <template>
- {{ row.measureUnit }}
- </template>
- </template>
- </el-table-column>
- <el-table-column
- label="重量"
- prop="weight"
- align="center"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- label="重量单位"
- prop="weightUnit"
- align="center"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- label="库存"
- prop="stockNum"
- align="center"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
-
- <el-table-column label="单价" prop="price" align="center">
- <template slot-scope="{ row }">
- <template>
- {{ row.price ? row.price : '-' + '元' }}/{{
- row.measureUnit
- }}
- </template>
- </template>
- </el-table-column>
- <el-table-column
- label="金额"
- align="center"
- prop="totalMoney"
- :show-overflow-tooltip="true"
- >
- <template slot-scope="{ row, $index }">
- {{ row.totalMoney ? row.totalMoney : 0 }}
- </template>
- </el-table-column>
- <el-table-column
- v-if="clientEnvironmentId == 4"
- label="采购原因"
- align="center"
- prop="purpose"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- label="仓库"
- prop="warehouseName"
- :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>
- <header-title class="mt20" title="包装清单"></header-title>
- <div class="mt10 form-table">
- <el-table
- ref="showPackingListTable"
- :data="showPackingList"
- tooltip-effect="dark"
- :max-height="300"
- border
- :row-class-name="tableRowClassName"
- :header-cell-style="rowClass"
- 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"
- width="150"
- :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="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="minPackingCount"></el-table-column>
- <el-table-column label="计量单位" prop="measuringUnit"></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>
- <div class="center mt20">
- <el-button
- type="primary"
- @click="handleSave('save')"
- :loading="saveLoading"
- >保存</el-button
- >
- <el-button type="primary" @click="handleSave" :loading="saveLoading"
- >出库</el-button
- >
- <el-button @click="$router.go(-1)">返回</el-button>
- </div>
- </el-card>
- <AssetsDialog
- ref="assetsDialogRef"
- :treeIds="formData.extInfo.assetType"
- @detailData="detailData"
- />
- <outboundRequisitionDialog
- ref="outboundRequisitionDialogRef"
- @detailData="outboundRequisitionSelection"
- type="2"
- />
- </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 openContactDialog from '@/components/contactDialog/openContactDialog.vue';
- import {
- outputSceneState,
- qualityStatus,
- qualityResults
- } from '@/utils/dict/index';
- import outboundRequisitionDialog from '../components/outboundRequisitionDialog.vue';
- import selectTree from '@/components/selectTree';
- import AssetsDialog from '../components/AssetsDialog.vue';
- import { deepClone } from '@/utils';
- export default {
- name: 'outgoingManagementAdd',
- components: {
- selectTree,
- AssetsDialog,
- outboundRequisitionDialog,openContactDialog
- },
- directives: {
- 'el-table-infinite-scroll': elTableInfiniteScroll
- },
- data() {
- return {
- newColumns: [], // 动态表头
- goodsLists: [], // 商品列表
- qualityStatus, // 质检状态 0未检 1待检 2已检
- qualityResults, // 质检结果 0无 1合格 2不合格
- productList: [], // 产品列表
- showPackingList: [], // 展示的包装列表
- packingList: [], // 包装列表
- showMaterialList: [], // 展示物料列表
- materialList: [], // 物料列表
- extInfo: {}, // 扩展信息
- pageSize: 20,
- pickingPageNum: 1,
- materielPageNum: 1,
- dimension: '3',
- outputSceneState: outputSceneState.filter(
- (item) => item.code != '4' && item.code != '11'
- ), // 出库场景状态
- saveLoading: false,
- treeList: [],
- formData: {
- extInfo: {
- assetType: [], //物品类型id
- assetTypeName: '', //物品类型名称
- deptCode: '', //部门code
- deptName: '', //部门名称
- verifyDeptCode: '', //审核部门编码
- verifyDeptName: '', //审核部门名称
- deliveryName: '', //送货人名称
- fromUserPhone: '', //送货人电话
- sourceBizNo: '', //销售订单
- urgent: '', //紧急状态
- supplierId: '', //供应商ID
- supplierName: '', //供应商名称
- createUserName: '', //创建人名字
- contentImage: [] //图片数组
- },
- fromUser: '', //送货人
- bizType: '', //物品类型
- verifyId: '', //审核人Id
- verifyName: '', //审核人名称
- createUserId: '',
- remark: ''
- },
- rules: {
- bizType: {
- required: true,
- message: '请选择出库场景',
- trigger: 'change'
- },
- 'extInfo.assetType': {
- required: true,
- message: '请选择物品类型',
- trigger: ['change', 'blur']
- },
- fromId: {
- required: true,
- message: '请选择领料人',
- trigger: 'change'
- },
- 'extInfo.verifyDeptCode': {
- required: true,
- message: '请选择领料人部门',
- trigger: ['change', 'blur']
- }
- },
- llrLsit: []
- };
- },
- computed: {
- clientEnvironmentId() {
- return this.$store.state.user.info.clientEnvironmentId;
- }
- },
- async created() {
- this.getFieldModel();
- this.getListItems();
- this.initUserInfo();
- this.initDeptData();
- let queryObj = this.$route.query;
- console.log('queryObj------', queryObj);
- if (queryObj.ids) {
- this.formData.bizType = queryObj.bizType;
- this.formData.extInfo.assetType = queryObj.assetType.split(',');
- let data = await storageApi.getHierarchyList({
- ids: this.$route.query.ids,
- type: 3
- });
- this.detailData(data, 3);
- }
- if (queryObj.type) {
- this.formData.sourceBizNo = queryObj.code;
- this.$nextTick(() => {
- this.$refs.outboundRequisitionDialogRef.handleMine([queryObj]);
- });
- }
- console.log(queryObj, 'queryObj.detailId');
- if (queryObj.detailId) {
- this._getInfo(queryObj.detailId);
- }
- },
- methods: {
- outboundRequisitionSelection(data, dimension, query) {
- console.log(data, dimension, query);
- this.formData.sourceBizNo = query.sourceBizNo;
- this.formData.bizType = query.bizType;
- this.formData.extInfo.assetType = query.assetType.split(',');
- this.detailData(data, dimension);
- },
- // 获取动态表头
- 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.newColumns = [...newRes];
- });
- },
- userSlected(data) {
- console.log(data);
- this.formData.fromId = data.id;
- this.formData.fromUser = data.name;
- this.formData.fromUserPhone = data.phone;
- },
- 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({ type: 2 });
- this.goodsLists = data;
- },
- // 打开单据来源弹窗
- openDocumentSourceDialog() {
- this.$refs.outboundRequisitionDialogRef.open();
- },
- tableRowClassName({ row, rowIndex }) {
- console.log(row);
- if (row.result == 1) {
- return 'warning-row';
- } else {
- return '';
- }
- },
- // getDeptName() {
- // if (this.formData?.extInfo?.createUserId) {
- // storageApi.getGroupById(this.formData.extInfo.createUserId).then((res) => {
- // this.formData.extInfo.deptName = res?.groupName
- // });
- // }
- // },
- async _getInfo(detailId) {
- let res = await storageApi.getInboundDetailsById(detailId);
- this.formData = res;
- this.formData.extInfo.assetType = res.extInfo?.assetType?.split(',');
- this.formData.bizType = res.bizType + '';
- console.log(this.formData.extInfo, '');
- this.auditorDeptClick({
- id: this.formData.extInfo?.verifyDeptCode,
- name: this.formData.extInfo?.verifyDeptName
- });
- // this.getDeptName()
- this.productList = res.outInDetailList.map(
- (productItem, productIndex) => {
- return {
- ...productItem,
- outInDetailRecordRequestList:
- productItem.outInDetailRecordRequestList.map((packingItem) => {
- return {
- ...packingItem,
- categoryName: productItem.categoryName,
- categoryCode: productItem.categoryCode,
- materialDetailList: packingItem.materialDetailList.map(
- (materialItem) => {
- return {
- ...materialItem,
- categoryName: productItem.categoryName,
- categoryCode: productItem.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;
- // 获取物料维度数据
- let iArr = [];
- arr.forEach((item) => {
- item.materialDetailList.forEach((ele) => {
- iArr.push({ ...ele });
- });
- });
- this.materialList = iArr;
- console.log(this.packingList);
- console.log(this.materialList);
- this.pickingFetchData();
- this.materielFetchData();
- },
- detailData(data, dimension) {
- this.dimension = dimension;
- const mergedData = [...(this.formData.outInDetailList || []), ...data];
- this.formData.outInDetailList = mergedData;
- this.productList = mergedData.map((productItem) => {
- console.log(productItem, 'productItem');
- return {
- ...productItem,
- outInDetailRecordRequestList:
- productItem.outInDetailRecordRequestList.map((packingItem) => {
- return {
- ...packingItem,
- 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
- };
- }
- )
- };
- })
- };
- });
- const newProducts = mergedData.map((productItem) => ({
- ...productItem,
- outInDetailRecordRequestList:
- productItem.outInDetailRecordRequestList.map((packingItem) => ({
- ...packingItem,
- categoryName: productItem.categoryName,
- categoryCode: productItem.categoryCode,
- supplierCode: productItem.supplierCode,
- supplierName: productItem.supplierName,
- materialDetailList: packingItem.materialDetailList.map(
- (materialItem) => ({
- ...materialItem,
- categoryName: productItem.categoryName,
- categoryCode: productItem.categoryCode,
- supplierCode: productItem.supplierCode,
- supplierName: productItem.supplierName
- })
- )
- }))
- }));
- // 去重合并产品列表和新产品列表
- const uniqueProducts = [
- ...new Map(
- [...this.productList, ...newProducts].map((item) => [item.id, item])
- ).values()
- ];
- this.productList = uniqueProducts;
- //排序
- this.productList.sort((a, b) => a.categoryCode - b.categoryCode);
- console.log(this.productList, '物品清单');
- // 获取包装维度数据
- 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);
- console.log(this.packingList, '包装');
- // 获取物料维度数据
- 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();
- },
- handleSave(type) {
- this.$refs.formName.validate(async (valid) => {
- if (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;
- this.saveLoading = true;
- // 处理物品类型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;
- try {
- let api = obj.id ? storageApi.outUpdate : storageApi.outStorage;
- const res = await api(obj);
- if (res.code == 0) {
- if (type != 'save') {
- await storageApi.submitInsideTwo({ outInIds: res.data });
- this.$message.success('出库成功!');
- } else {
- this.$message.success('保存成功!');
- }
- this.$router.push('/warehouseManagement/outgoingManagement');
- }
- this.saveLoading = false;
- } catch (error) {
- this.saveLoading = false;
- this.$router.push('/warehouseManagement/outgoingManagement');
- this.$message.error('保存失败!');
- }
- } else {
- this.$message.error('请选择领料人!');
- }
- });
- },
- contactDialogSuccess(data){
- this.$set(this.formData,'clientName',data.name)
- this.$set(this.formData,'clientCode',data.code)
- },
- 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.$set(this.formData.extInfo, 'verifyDeptCode', data?.id);
- this.$set(this.formData.extInfo, 'verifyDeptName', data?.name);
- this.formData.verifyId = '';
- this.formData.verifyName = '';
- this.$refs.formName.validateField('verifyDeptName');
- if (data) {
- this.getStaffList(data);
- }
- },
- async getStaffList(data) {
- let res = await warehouseDefinition.getUserPage({
- groupId: data.id,
- size: 9999,
- page: 1
- });
- this.llrLsit = res.list;
- },
- // 初始化用户信息
- async initUserInfo() {
- const res = await warehouseDefinition.tree();
- let info = JSON.parse(localStorage.getItem('info'));
- let obj = res.find(
- (item) => item.id === info.deptIds[info.deptIds.length - 1]
- );
- // if (!obj) return;
- if (obj) {
- this.formData.extInfo.deptCode = obj.id;
- this.formData.extInfo.deptName = obj.name;
- } else {
- this.formData.extInfo.deptName = info.deptName
- ? info.deptName
- : info.groupName
- ? info.groupName
- : '';
- }
- this.formData.extInfo.createUserName = info.name;
- this.formData.createUserId = info.userId;
- },
- // 初始化部门数据
- async initDeptData() {
- const res = await warehouseDefinition.tree();
- this.treeList = this.$util.toTreeData({
- data: res,
- idField: 'id',
- parentIdField: 'parentId'
- });
- },
- addStock() {
- 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 = '';
- }
- },
- watch: {
- packingList: {
- handler(newVal) {
- console.log('包装列表', newVal);
- console.log('当前包装列表加载页数', 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
- },
- '$route.query': {
- handler(newQuery, oldQuery) {
- if (newQuery?.detailId) {
- this._getInfo(newQuery.detailId);
- }
- },
- 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>
|