| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596 |
- <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="8">
- <el-form-item label="入库单号" prop="bizNum">
- <el-input :value="formData.bizNum" disabled /></el-form-item
- ></el-col> -->
- <!-- <el-col :span="8">
- <el-form-item label="仓库" prop="warehouseId">
- <el-select
- filterable
- v-model="formData.warehouseId"
- clearable
- :disabled="
- !!(warehousingMaterialList && warehousingMaterialList.length)
- "
- >
- <el-option
- v-for="(item, index) in warehouseList"
- :key="index"
- :label="item.name"
- :value="item.id"
- @click.native="warehouse = item"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col> -->
- <el-col :span="8">
- <el-form-item label="物品类型" prop="extInfo.assetType">
- <!-- <DictSelection
- dictName="类型用途"
- :disabled="
- !!(warehousingMaterialList && warehousingMaterialList.length)
- "
- clearable
- v-model="formData.extInfo.assetType"
- @itemChange="handleChange"
- /> -->
- <!-- <el-select
- :disabled="
- !!(warehousingMaterialList && warehousingMaterialList.length)
- "
- clearable
- v-model="formData.extInfo.assetType"
- @change="handleChanges"
- >
- <el-option
- v-for="(item, index) in codeList"
- :key="index"
- :label="item.dictValue"
- :value="item.dictCode"
- ></el-option>
- </el-select> -->
- <selectTree
- ref="tree"
- class="form-ipt"
- size="medium"
- style="width: 100%"
- clearable
- :options="codeList"
- :props="{
- value: 'id',
- label: 'name',
- children: 'children'
- }"
- @getValue="codeListValue"
- :isAll="false"
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- =={{ formData.bizType }}
- <el-form-item label="入库类型" prop="bizType">
- <el-select
- filterable
- placeholder="请选择"
- v-model="formData.bizType"
- clearable
- :disabled="
- !!(warehousingMaterialList && warehousingMaterialList.length)
- "
- >
- <el-option
- v-for="item in sceneState"
- :key="item.code"
- :value="item.code + ''"
- :label="item.label"
- ></el-option>
- </el-select> </el-form-item
- ></el-col>
- <el-col :span="8">
- <el-form-item label="销售订单" prop="documentSource">
- <el-input
- placeholder="请输入"
- clearable
- v-model="formData.extInfo.documentSource" /></el-form-item
- ></el-col>
- <el-col :span="8">
- <el-form-item label="权属部门" prop="deptName">
- <el-input
- placeholder="权属部门"
- disabled
- v-model="formData.extInfo.deptName"
- clearable
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="入库登记人">
- <el-input
- placeholder="登记人"
- disabled
- v-model="formData.extInfo.createUserName"
- clearable /></el-form-item
- ></el-col>
- <!-- <el-col :span="8">
- <el-form-item label="入库时间" prop="outInTime">
- <el-date-picker
- v-model="formData.outInTime"
- clearable
- type="datetime"
- value-format="yyyy-MM-dd HH:mm:ss"
- placeholder="选择日期"
- >
- </el-date-picker></el-form-item
- ></el-col> -->
- <el-col :span="8">
- <el-form-item label="供应商" prop="supplierId">
- <DictSelection
- dictName="经销商列表"
- clearable
- v-model="formData.extInfo.supplierId"
- @itemChange="ChangeSupplier"
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="送货人" prop="fromUser">
- <el-input
- placeholder="请输入"
- v-model="formData.fromUser"
- clearable /></el-form-item
- ></el-col>
- <el-col :span="8">
- <el-form-item label="送货人联系方式" prop="deliveryPhone">
- <el-input
- placeholder="请输入"
- v-model="formData.extInfo.deliveryPhone"
- clearable /></el-form-item
- ></el-col>
- <el-col :span="8">
- <el-form-item label="紧急状态" prop="urgent">
- <el-select
- filterable
- placeholder="请选择"
- v-model="formData.extInfo.urgent"
- clearable
- >
- <el-option
- v-for="item in emergencyState"
- :key="item.code"
- :value="item.code"
- :label="item.label"
- ></el-option>
- </el-select> </el-form-item
- ></el-col>
- <el-col :span="8">
- <el-form-item label="审核人部门" prop="verifyDeptName">
- <selectTree
- ref="tree"
- class="form-ipt"
- size="medium"
- style="width: 100%"
- clearable
- :options="treeList"
- :props="{
- value: 'code',
- label: 'name',
- children: 'children'
- }"
- @getValue="auditorDeptClick"
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="审核人" prop="verifyId">
- <el-select
- filterable
- class="form-ipt"
- style="width: 100%"
- v-model="formData.verifyId"
- placeholder="请选择"
- >
- <el-option
- v-for="item in staffList"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- @click.native="changeVerfy(item)"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <!-- <el-col :span="24">
- <el-form-item label="附件" prop="contentImage">
- <selectUpload @getImgs="upload" :initData="uploadList" />
- </el-form-item>
- </el-col> -->
- <el-col :span="24">
- <el-form-item label="备注" prop="remark">
- <el-input
- v-model="formData.remark"
- clearable
- type="textarea"
- placeholder="请详细说明"
- :rows="4"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div class="material">
- <header-title title="入库信息">
- <el-button type="primary" @click="addStock">添加</el-button>
- </header-title>
- <div class="mt10 form-table">
- <el-form
- ref="warehousingMaterialListRef"
- :model="{ warehousingMaterialList: warehousingMaterialList }"
- :show-message="false"
- >
- <el-table
- :header-cell-style="rowClass"
- ref="multipleTable"
- :key="formData.extInfo.assetType"
- :data="warehousingMaterialList"
- tooltip-effect="dark"
- style="width: 100%"
- stripe
- >
- <el-table-column
- label="序号"
- type="index"
- width="50"
- align="center"
- >
- </el-table-column>
- <el-table-column
- label="物品编码"
- prop="assetCode"
- align="center"
- width="150"
- ></el-table-column>
- <el-table-column
- label="名称"
- align="center"
- width="150"
- prop="assetName"
- ></el-table-column>
- <el-table-column
- label="客户编码"
- align="center"
- width="150"
- prop="customCode"
- v-if="formData.bizType == 1"
- >
- <template slot-scope="{ row, $index }">
- <el-form-item
- :prop="`warehousingMaterialList.${$index}.customCode`"
- required
- >
- <el-input v-model="row.customCode"> </el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column
- label="供应商编码"
- align="center"
- width="150"
- prop="customCode"
- v-if="formData.bizType == 2"
- >
- <template slot-scope="{ row, $index }">
- <el-form-item
- :prop="`warehousingMaterialList.${$index}.supplierCode`"
- required
- >
- <el-input v-model="row.supplierCode"> </el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column
- v-for="(item, index) in tableHeader"
- :key="index"
- align="center"
- :label="item.label"
- width="150"
- :prop="item.prop"
- >
- <template slot-scope="{ row }">
- <template v-if="item.formatter">{{
- item.formatter(row)
- }}</template>
- <template v-else>{{ row[item.prop] }}</template>
- </template>
- </el-table-column>
- <el-table-column
- label="批次号"
- prop="batchNo"
- width="150"
- align="center"
- >
- <template slot-scope="{ row, $index }">
- <template v-if="row.isSave">
- {{ row.batchNo }}
- </template>
- <el-form-item
- v-else
- :prop="`warehousingMaterialList.${$index}.batchNo`"
- required
- >
- <!-- <el-input v-model="row.batchNo"></el-input> -->
- {{ row.batchNo }}
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column
- label="最小包装单元"
- align="center"
- prop="minPackingCount"
- width="100"
- >
- <el-table-column label="" prop="minPackingCount" width="100">
- <template slot-scope="{ row, $index }">
- <template v-if="row.isSave">
- {{ row.minPackingCount }}
- </template>
- <el-form-item
- v-else
- :prop="`warehousingMaterialList.${$index}.minPackingCount`"
- required
- >
- <el-input
- v-model="row.minPackingCount"
- @input="
- (value) =>
- (row.minPackingCount = value.replace(
- /^(0+)|[^\d]+/g,
- ''
- ))
- "
- >
- </el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="" prop="minPackingCount">
- <template slot-scope="{ row, $index }">
- {{ handleRowUnit(row) }} /{{ row.minPackUnit }}
- </template>
- </el-table-column>
- </el-table-column>
- <el-table-column
- label="包装数量"
- prop="outInNum"
- width="150"
- align="center"
- >
- <template slot-scope="{ row, $index }">
- <template v-if="row.isSave || formData.bizType == 5">
- {{ row.outInNum }} {{ row.minPackUnit }}
- </template>
- <el-form-item
- v-else
- :prop="`warehousingMaterialList.${$index}.outInNum`"
- required
- >
- <el-input
- v-model="row.outInNum"
- @input="
- (value) =>
- (row.outInNum = value.replace(/^(0+)|[^\d]+/g, ''))
- "
- >
- <template slot="append">
- {{ row.minPackUnit ? row.minPackUnit : '/' }}
- </template>
- </el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column
- label="单价"
- prop="univalence"
- width="150"
- align="center"
- >
- <template slot-scope="{ row, $index }">
- <!-- <template v-if="row.isSave || formData.bizType == 5">
- <template v-if="row.univalence || row.univalence === 0">
- {{ row.univalence
- }}{{
- { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
- }}
- </template>
- </template> -->
- <!-- v-else -->
- <el-form-item
- :prop="`warehousingMaterialList.${$index}.univalence`"
- >
- <el-input
- v-model="row.univalence"
- placeholder="非必填"
- @input="
- (value) =>
- (row.univalence = value.replace(/^(0+)|[^\d]+/g, ''))
- "
- >
- <template slot="append">
- 元/{{ handleRowUnit(row) }}
- <!-- {{
- { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
- }} -->
- </template>
- </el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column
- label="金额"
- align="center"
- prop="contentImage"
- :show-overflow-tooltip="true"
- >
- <template slot-scope="{ row, $index }">
- {{
- calcSumTotal(
- row.outInNum,
- row.minPackingCount,
- row.univalence,
- row
- )
- }}
- </template>
- </el-table-column>
- <el-table-column
- label="数量"
- prop="batchNo"
- width="150"
- align="center"
- v-if="formData.extInfo.assetType == 1"
- >
- <template slot-scope="{ row, $index }">
- <template> {{ row.outInNum }} </template>
- </template>
- </el-table-column>
- <el-table-column
- label="数量"
- prop="batchNo"
- width="150"
- align="center"
- v-if="formData.extInfo.assetType == 4"
- >
- <template slot-scope="{ row, $index }">
- <template>
- {{ row.minPackingCount * row.outInNum }}
- </template>
- </template>
- </el-table-column>
- <el-table-column
- label="计量单位"
- prop="batchNo"
- width="150"
- align="center"
- v-if="formData.extInfo.assetType == 1"
- >
- <template slot-scope="{ row, $index }">
- <template>
- {{ row.minPackUnit }}
- </template>
- </template>
- </el-table-column>
- <el-table-column
- label="计量单位"
- prop="batchNo"
- width="150"
- align="center"
- v-if="formData.extInfo.assetType == 4"
- >
- <template slot-scope="{ row, $index }">
- <template>
- {{ row.measuringUnit }}
- </template>
- </template>
- </el-table-column>
- <el-table-column
- label="重量"
- align="center"
- prop="contentImage"
- :show-overflow-tooltip="true"
- v-if="formData.extInfo.assetType == 1"
- >
- <template slot-scope="{ row, $index }">
- {{ weightTotal(row.outInNum, row.minPackingCount) }}
- <template slot="append">
- {{ handleRowUnit(row) }}
- <!-- {{
- { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
- }} -->
- </template>
- </template>
- </el-table-column>
- <el-table-column
- label="重量"
- align="center"
- prop="contentImage"
- :show-overflow-tooltip="true"
- v-if="formData.extInfo.assetType == 4"
- >
- <template slot-scope="{ row, $index }">
- {{
- deviceWeight(
- row.roughWeight,
- row.minPackingCount * row.outInNum
- )
- }}
- <template slot="append">
- {{ handleRowUnit(row) }}
- <!-- {{
- { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
- }} -->
- </template>
- </template>
- </el-table-column>
- <el-table-column
- label="重量单位"
- align="center"
- prop="contentImage"
- :show-overflow-tooltip="true"
- >
- <template slot-scope="{ row, $index }">
- {{ row.weightUnit }}
- <template slot="append"> </template>
- </template>
- </el-table-column>
- <el-table-column
- label="货位"
- prop="warehouseName"
- :show-overflow-tooltip="true"
- width="250"
- required
- >
- <template slot-scope="{ row, $index }">
- <el-form-item
- :prop="`warehousingMaterialList.${$index}.houseList`"
- :required="true"
- >
- <div @click="handleWareHouse(row, $index)">
- <div
- style="color: #ff4949"
- v-if="row.houseList.length == 0"
- >
- ---(必填)
- </div>
- <div v-else>
- <div
- v-for="(item, index) in row.houseList"
- :key="index"
- >
- {{ item.warehouseName }}- {{ item.areaName }}-
- {{ item.shelfCode }}- {{ item.cargoSpaceCode
- }}<span style="color: #ff4949" v-if="item.num">
- - {{ item.num }}(数)</span
- >
- <br />
- </div>
- </div>
- </div>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column
- label="质检单"
- v-if="formData.extInfo.assetType === 3"
- prop="contentImage"
- :show-overflow-tooltip="true"
- >
- <template slot-scope="{ row, $index }">
- <upload @on-success="(data) => (row.contentImage = [data])"
- ><template slot="placeholder">上传</template></upload
- >
- </template>
- </el-table-column>
- <el-table-column
- label="操作"
- width="200"
- fixed="right"
- align="center"
- >
- <template slot-scope="{ row, $index }">
- <el-button
- type="text"
- v-show="!row.isSave"
- @click="listSave(row, $index)"
- >保存</el-button
- >
- <el-button
- type="text"
- v-show="row.isSave"
- @click="listEdit(row, $index)"
- >编辑</el-button
- >
- <el-button
- type="text"
- v-if="formData.bizType == 5"
- v-show="!row.isSave"
- @click="chooseAssets(row, $index)"
- >选择资产编号</el-button
- >
- <el-button type="text" @click="listDel(row, $index)"
- >删除</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- </el-form>
- </div>
- <div class="mt20">
- <header-title :title="`${title}明细`">
- <div class="switch_right">
- <el-button
- type="text"
- @click="dateSetting"
- v-if="formData.bizType != 5"
- >批量设置{{
- curDateType === 'manufactureTime' ? '生产日期' : '采购日期'
- }}</el-button
- >
- </div>
- </header-title>
- <el-table
- ref="multipleTable"
- :data="materialCodeReqList"
- tooltip-effect="dark"
- :key="formData.bizType"
- :header-cell-style="rowClass"
- style="width: 100%"
- stripe
- height="300px"
- @selection-change="handleSelectionChange"
- >
- <el-table-column
- label=""
- type="selection"
- align="center"
- width="50"
- v-if="formData.bizType != 5"
- >
- </el-table-column>
- <el-table-column label="序号" type="index" width="50">
- </el-table-column>
- <el-table-column
- :label="`${title}编码`"
- prop="onlyCode"
- ></el-table-column>
- <el-table-column label="包装编码" prop="num"></el-table-column>
- <el-table-column label="批次号" prop="batchNo"></el-table-column>
- <el-table-column
- label="物品编码"
- prop="assetCode"
- ></el-table-column>
- <el-table-column label="名称" prop="assetName"></el-table-column>
- <el-table-column label="最小包装单元" prop="modelType">
- <el-table-column label="" prop="minPackingCount" width="100">
- <template slot-scope="{ row, $index }">
- {{ row.minPackingCount }}
- </template>
- </el-table-column>
- <el-table-column label="" prop="minPackingCount">
- <template slot-scope="{ row, $index }">
- {{ handleRowUnit(row) }} /{{ row.minPackUnit }}
- </template>
- </el-table-column>
- </el-table-column>
- <el-table-column
- v-if="formData.bizType != 5"
- label="生产日期"
- prop=""
- width="220"
- >
- <template slot="header" slot-scope="scope">
- <el-select filterable v-model="curDateType">
- <el-option
- value="manufactureTime"
- label="生产日期"
- ></el-option>
- <el-option
- value="procurementTime"
- label="采购日期"
- ></el-option>
- </el-select>
- </template>
- <template slot-scope="{ row }">
- <template v-if="formData.bizType == 5">
- {{ row[curDateType] }}
- </template>
- <el-date-picker
- v-else
- size="small"
- v-model="row[curDateType]"
- type="datetime"
- value-format="yyyy-MM-dd HH:mm:ss"
- placeholder="选择日期"
- >
- </el-date-picker>
- </template>
- </el-table-column>
- <template v-else>
- <el-table-column
- label="生产日期"
- prop="manufactureTime"
- width="200"
- ></el-table-column>
- <el-table-column
- label="采购日期"
- prop="procurementTime"
- width="200"
- ></el-table-column>
- </template>
- </el-table>
- <!-- </el-tab-pane>
- </el-tabs> -->
- </div>
- </div>
- <div class="center mt20">
- <el-button type="primary" @click="handleSave" :loading="saveLoading"
- >保存</el-button
- >
- <el-button @click="$router.go(-1)">返回</el-button>
- </div>
- </el-card>
- <selectType
- :visibleDialog.sync="visibleDialog"
- :title="title"
- :tableHeader="tableHeader"
- :bizScene="formData.bizType"
- :type="[selectEquiType]"
- :loadTree.sync="loadTree"
- @selectTableData="onSelectTableData"
- />
- <WareHouseDailog
- ref="wareHouseDailogRef"
- @houseData="houseData"
- ></WareHouseDailog>
- <ReturnSelect
- ref="returnSelectRef"
- :tableHeader="tableHeader"
- :curDateType="curDateType"
- ></ReturnSelect>
- <el-dialog :visible.sync="dateVisible" title="选择日期" width="400px">
- <el-date-picker
- size="small"
- v-model="batchTime"
- type="datetime"
- style="width: 320px"
- value-format="yyyy-MM-dd HH:mm:ss"
- placeholder="选择日期"
- >
- </el-date-picker>
- <div style="text-align: right; margin-top: 20px">
- <el-button @click="dateVisible = false">取消</el-button>
- <el-button type="primary" @click="dateConfirm" :disabled="!batchTime"
- >确认</el-button
- >
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import outin from '@/api/warehouseManagement/outin';
- import { getTreeByPid } from '@/api/classifyManage';
- import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
- import selectUpload from '@/components/selectUpload';
- import upload from '@/components/uploadImg';
- import {
- warehousingType,
- sceneState,
- emergencyState,
- materialType
- } from '@/utils/dict/index';
- // import { getInfo, warehousingAdd, getAssetNum } from '@/api/stockManagement';
- import selectTree from '@/components/selectTree';
- import selectType from '../components/selectType.vue';
- import WareHouseDailog from '../components/WareHouseDailog.vue';
- import ReturnSelect from './components/ReturnSelect.vue';
- // import supplier from '@/api/main/supplier';
- // import org from '@/api/main/org';
- // import user from '@/api/main/user';
- import { tableHeader } from '../common';
- import { getCode } from '@/api/codeManagement/index.js';
- import { number } from 'echarts/core';
- export default {
- components: {
- selectUpload,
- selectTree,
- selectType,
- WareHouseDailog,
- upload,
- ReturnSelect
- },
- data() {
- return {
- codeList: [],
- materialType,
- warehousingType,
- sceneState,
- emergencyState,
- saveLoading: false,
- visibleDialog: false,
- curDateType: 'manufactureTime',
- materialCodeReqListSelected: [],
- // warehouseList: [], //仓库数组
- // warehouse: {},
- title: '',
- tableData2: [],
- uploadList: [],
- supplierList: [],
- warehousingMaterialList: [],
- activeName: 'a',
- loadTree: true,
- selectEquiType: '',
- batchTime: '',
- dateVisible: false,
- treeList: [],
- staffList: [],
- formData: {
- extInfo: {
- assetType: '', //物品类型
- deptCode: '', //部门code
- deptName: '', //部门名称
- verifyDeptCode: '', //审核部门编码
- verifyDeptName: '', //审核部门名称
- deliveryName: '', //送货人名称
- deliveryPhone: '', //送货人电话
- documentSource: '', //销售订单
- urgent: '', //紧急状态
- supplierId: '', //供应商ID
- supplierName: '', //供应商名称
- createUserName: '', //创建人名字
- contentImage: [] //图片数组
- },
- fromUser: '', //送货人
- bizType: '', //物品类型
- verifyId: '', //审核人Id
- verifyName: '', //审核人名称
- createUserId: '',
- remark: ''
- },
- rules: {
- 'extInfo.assetType': {
- required: true,
- message: '请选择物品类型',
- trigger: 'change'
- },
- bizType: {
- required: true,
- message: '请选择入库场景',
- trigger: 'change'
- }
- }
- };
- },
- computed: {
- // 条码信息
- materialCodeReqList() {
- return this.warehousingMaterialList
- .map((i) => i.warehouseLedgerDetails || [])
- .flat();
- },
- tableHeader() {
- return tableHeader(this.selectEquiType);
- }
- },
- created() {
- if (this.$route.query.id) {
- // this._getInfo()
- } else {
- let obj = localStorage.getItem('orgInfo')
- ? JSON.parse(localStorage.getItem('orgInfo'))
- : {};
- this.formData.createUserName = obj.name;
- this.formData.extInfo.deptName = obj.dept?.name;
- this.formData.deptCode = obj.dept?.code;
- }
- this.initData();
- },
- methods: {
- codeListValue(val) {
- console.log(val);
- this.formData.extInfo.assetType = val.id;
- this.$forceUpdate();
- this.title = val?.name;
- this.selectEquiType = val?.id;
- console.log(this.title);
- },
- //计算生产设备重量
- deviceWeight(row, num) {
- if (row) {
- return Number(row * num);
- } else {
- return row;
- }
- },
- //计算重量
- weightTotal(PackingCount, outInNum) {
- const total = {
- PackingCount: Number(PackingCount),
- outInNum: Number(outInNum)
- };
- return total.PackingCount * total.outInNum;
- },
- //计算金额
- calcSumTotal(PackingCount, outInNum, univalence) {
- //最小包装单元,包装数量,单价
- const total = {
- PackingCount: Number(PackingCount),
- outInNum: Number(outInNum),
- univalence: Number(univalence)
- };
- return total.PackingCount * total.outInNum * total.univalence;
- },
- handleRowUnit(row) {
- console.log('===sss', this.formData);
- if (this.formData.extInfo.assetType == 1) {
- console.log(row);
- return row.weightUnit;
- } else if (this.formData.extInfo.assetType == 4) {
- return row.measuringUnit;
- }
- },
- changeVerfy(it) {
- this.formData.verifyName = it.name;
- console.log(this.formData.verifyName);
- },
- //选择供应啥的操作
- ChangeSupplier(data) {
- this.formData.extInfo.supplierName = data.dictValue;
- },
- rowClass({ row, column, rowIndex, columnIndex }) {
- if (rowIndex === 1) {
- return {
- display: 'none',
- background: '#EEEEEE',
- border: 'none'
- };
- }
- return { background: '#EEEEEE', border: 'none' };
- },
- calcSum(a, b, c, row) {
- console.log(a, b, c);
- if (
- (Number.isNaN(+a) && a !== '') ||
- (Number.isNaN(+b) && b !== '') ||
- (Number.isNaN(+c) && c !== '')
- ) {
- return '';
- }
- console.log(row);
- return a * b * c + { yuan: '元', wanyuan: '万元' }[row.univalenceUnit];
- // return a * b * c;
- },
- // 部门 点击事件
- 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);
- }
- },
- async getStaffList(data) {
- let res = await warehouseDefinition.getUserPage({
- groupId: data.id,
- size: 9999,
- page: 1
- });
- this.staffList = res.list;
- },
- // 详情接口
- // async _getInfo () {
- // const res = await getInfo({ id: this.$route.query.id })
- // if (res?.success) {
- // this.warehousingMaterialList = res.data.warehouseLedgerInfos.map(i => {
- // i.isSave = true
- // return i
- // })
- // this.formData = res.data.outInWarehouse
- // this.uploadList = this.formData.contentImage
- // }
- // },
- chooseAssets(row, index) {
- this.$refs.returnSelectRef.open(row, (res) => {
- row.outInNum = res.length;
- this.$set(
- row,
- 'selfWarehouseLedgerDetails',
- res.map((i) => {
- delete i.updateTime;
- delete i.createTime;
- return i;
- })
- );
- });
- },
- // 仓库编辑
- handleWareHouse(row, idx) {
- this.$refs.wareHouseDailogRef.open(row, idx);
- },
- // 入库操作
- listEdit(row) {
- this.$set(row, 'isSave', false);
- row.selfWarehouseLedgerDetails = row.warehouseLedgerDetails;
- row.warehouseLedgerDetails = [];
- },
- listSave(row, index) {
- console.log(this.formData);
- const fileds = [
- // `warehousingMaterialList.${index}.cargoSpaceCode`,
- `warehousingMaterialList.${index}.batchNo`,
- `warehousingMaterialList.${index}.houseList`
- ];
- if (this.formData.bizType != 5) {
- fileds.push(
- ...[
- `warehousingMaterialList.${index}.outInNum`,
- `warehousingMaterialList.${index}.minPackingCount`,
- `warehousingMaterialList.${index}.customCode`,
- `warehousingMaterialList.${index}.supplierCode`
- ]
- );
- } else if (
- this.warehousingMaterialList.some(
- (i) => !i.selfWarehouseLedgerDetails?.length
- )
- ) {
- this.$message.error('请选择资产编号!');
- return;
- }
- console.log(fileds);
- Promise.all(
- fileds.map(
- (item) =>
- new Promise(async (resolve, rej) => {
- console.log('item', item);
- this.$refs.warehousingMaterialListRef.validateField(
- item,
- (err) => {
- if (err) {
- rej(err);
- } else {
- resolve();
- }
- }
- );
- })
- )
- )
- .then((res) => {
- console.log(11111111);
- this.$set(row, 'isSave', true);
- if (this.formData.bizScene != 5) {
- this.createMaterialCode(row);
- } else {
- // 退还
- this.createMaterialCodeReturn(row);
- }
- })
- .catch((err) => {
- this.$message.error('请填入必填项!');
- });
- console.log(2);
- },
- // 批量设置生产日期
- handleSelectionChange(val) {
- this.materialCodeReqListSelected = val;
- },
- dateSetting() {
- if (!this.materialCodeReqListSelected.length) {
- return this.$message.error(`请选择${this.title}明细!`);
- }
- this.dateVisible = true;
- },
- dateConfirm() {
- this.materialCodeReqListSelected.forEach((item) => {
- this.$set(item, this.curDateType, this.batchTime);
- });
- this.dateVisible = false;
- },
- //入库明细删除
- listDel(row, index) {
- this.warehousingMaterialList.splice(index, 1);
- },
- // 入库明细生成条码信息
- async createMaterialCode(row) {
- // 添加相同物品、批次号重新更新明细 原料编码
- const list = this.warehousingMaterialList.filter(
- (i) =>
- i.assetCode === row.assetCode &&
- i.batchNo === row.batchNo &&
- i.isSave
- );
- const num = list.reduce((num, pre) => {
- num += row.isUnpack
- ? pre.outInNum * pre.minPackingCount
- : pre.outInNum - 0;
- return num;
- }, 0);
- const res = await outin.getAssetNum({
- assetCode: row.assetCode,
- batchNum: row.batchNo,
- num
- });
- list.forEach((item) => {
- if (item.warehouseLedgerDetails?.length) {
- item.warehouseLedgerDetails.forEach((i) => {
- i.onlyCode = res.shift().onlyCode;
- });
- } else {
- this.$set(
- item,
- 'warehouseLedgerDetails',
- Array.from(
- new Array(
- item.isUnpack
- ? item.outInNum * item.minPackingCount
- : +item.outInNum
- ),
- (val, idx) => {
- return {
- ...item,
- onlyCode: res.shift().onlyCode,
- bizStatus: 1,
- contentImage: []
- };
- }
- )
- );
- }
- });
- // 添加相同物品,重复批次号 重新更新明细 包装编码
- const batchList = this.warehousingMaterialList.filter(
- (i) => i.batchNo === row.batchNo && i.isSave
- );
- if (batchList.length) {
- const num = batchList.reduce((num, pre) => {
- num += +pre.outInNum;
- return num;
- }, 0);
- const res1 = await outin.getAssetNum({
- batchNum: row.batchNo,
- num
- });
- if (res1) {
- batchList.forEach((item) => {
- let num = res1.shift()?.num;
- let minPackingCount = item.minPackingCount;
- if (item.warehouseLedgerDetails?.length) {
- item.warehouseLedgerDetails.forEach((i, index) => {
- this.$set(i, 'num', num);
- if (!item.isUnpack) {
- if (index < item.warehouseLedgerDetails.length - 1) {
- num = res1.shift()?.num;
- }
- } else {
- // 拆包的包装编码一致
- minPackingCount--;
- if (
- minPackingCount === 0 &&
- index < item.warehouseLedgerDetails.length - 1
- ) {
- minPackingCount = item.minPackingCount;
- num = res1.shift()?.num;
- }
- }
- });
- }
- });
- }
- }
- },
- // 入库明细生成条码信息 退还
- async createMaterialCodeReturn(row) {
- // 添加相同物品重新更新明细 原料编码
- const list = this.warehousingMaterialList.filter(
- (i) => i.batchNo === row.batchNo && i.isSave
- );
- // 退还
- const res = await getAssetNum({
- batchNo: row.batchNo,
- num: list.reduce((num, pre) => {
- num += pre.selfWarehouseLedgerDetails.length;
- return num;
- }, 0)
- });
- if (res?.success) {
- list.forEach((item) => {
- let num = res.data.shift().num;
- let minPackingCount = item.minPackingCount;
- if (item.warehouseLedgerDetails?.length) {
- item.warehouseLedgerDetails.forEach((i, index) => {
- Object.assign(i, {
- num,
- batchNo: item.batchNo,
- cargoSpaceCode: item.cargoSpaceCode, //货位编码
- cargoSpaceId: item.cargoSpaceId, //货位id
- shelfId: item.shelfId, //货架id
- shelfCode: item.shelfCode, //货架名称
- areaId: item.areaId, //库区id
- areaName: item.areaName, //库区名称
- warehouseId: item.warehouseId, //仓库id
- warehouseName: item.warehouseName //仓库名称
- });
- if (!item.isUnpack) {
- // 拆包的包装编码一致
- if (index < item.warehouseLedgerDetails.length - 1) {
- num = res.data.shift()?.num;
- }
- } else {
- minPackingCount--;
- if (
- minPackingCount === 0 &&
- index < item.warehouseLedgerDetails.length - 1
- ) {
- minPackingCount = item.minPackingCount;
- num = res1.data.shift()?.num;
- }
- }
- });
- } else {
- this.$set(
- item,
- 'warehouseLedgerDetails',
- item.selfWarehouseLedgerDetails.map((val, idx) => {
- let obj = {
- ...val,
- bizStatus: 1,
- minPackingCount: item.minPackingCount,
- batchNo: item.batchNo,
- cargoSpaceCode: item.cargoSpaceCode, //货位编码
- cargoSpaceId: item.cargoSpaceId, //货位id
- shelfId: item.shelfId, //货架id
- shelfCode: item.shelfCode, //货架名称
- areaId: item.areaId, //库区id
- areaName: item.areaName, //库区名称
- warehouseId: item.warehouseId, //仓库id
- warehouseName: item.warehouseName, //仓库名称
- materialId: item.materialId,
- num
- };
- if (!item.isUnpack) {
- // 拆包的包装编码一致
- if (idx < item.warehouseLedgerDetails.length - 1) {
- num = res.data.shift()?.num;
- }
- } else {
- minPackingCount--;
- if (
- minPackingCount === 0 &&
- idx < item.warehouseLedgerDetails.length - 1
- ) {
- minPackingCount = item.minPackingCount;
- num = res1.data.shift()?.num;
- }
- }
- return obj;
- })
- );
- }
- });
- }
- },
- handleSave() {
- this.$refs.formName.validate(async (valid) => {
- if (valid) {
- if (!this.warehousingMaterialList?.length) {
- return this.$message.error('请添加入库明细!');
- } else if (
- this.warehousingMaterialList.some((item) => !item.isSave)
- ) {
- return this.$message.error('请保存入库明细!');
- }
- const params = {
- outInWarehouse: { ...this.formData, type: 1 },
- warehouseLedgerInfos: this.warehousingMaterialList
- };
- console.log('第一层', this.warehousingMaterialList);
- for (let key in this.warehousingMaterialList) {
- for (let k in this.warehousingMaterialList[key].houseList) {
- this.warehousingMaterialList[key].warehouseName =
- this.warehousingMaterialList[key].houseList[k].warehouseName;
- this.warehousingMaterialList[key].areaName =
- this.warehousingMaterialList[key].houseList[k].areaName;
- this.warehousingMaterialList[key].shelfCode =
- this.warehousingMaterialList[key].houseList[k].shelfCode;
- this.warehousingMaterialList[key].cargoSpaceCode =
- this.warehousingMaterialList[key].houseList[k].cargoSpaceCode;
- this.warehousingMaterialList[key].warehouseId =
- this.warehousingMaterialList[key].houseList[k].warehouseId;
- this.warehousingMaterialList[key].areaId =
- this.warehousingMaterialList[key].houseList[k].areaId;
- this.warehousingMaterialList[key].shelfId =
- this.warehousingMaterialList[key].houseList[k].shelfId;
- this.warehousingMaterialList[key].cargoSpaceId =
- this.warehousingMaterialList[key].houseList[k].cargoSpaceId;
- }
- }
- let arr = this.warehousingMaterialList.map((item) => {
- return {
- batchNo: item.batchNo,
- categoryId: item.id,
- count: item.outInNum,
- minPackingCount: item.minPackingCount,
- packingCount: item.outInNum,
- price: item.univalence,
- outInDetailRecordAddPOList: item.warehouseLedgerDetails,
- position: `${item.warehouseName}-${item.areaName}-${item.shelfCode}-${item.cargoSpaceCode}`,
- // pathIds: item.categoryLevelPathId.toString(),
- remark: '',
- pathIds: `${item.warehouseId},${item.areaId},${item.shelfId},${item.cargoSpaceId}`,
- pathName: `${item.warehouseName},${item.areaName},${item.shelfCode},${item.cargoSpaceCode}`,
- totalMoney:
- item.outInNum * item.minPackingCount * item.univalence,
- weightUnit: item.weightUnit,
- customCode: item.customCode,
- supplierCode: item.supplierCode
- };
- });
- arr.forEach((item) => {
- if (item.outInDetailRecordAddPOList.length > 0) {
- let list = item.outInDetailRecordAddPOList.map((it) => {
- return {
- code: it.onlyCode,
- dateType: this.curDateType === 'manufactureTime' ? 2 : 1,
- dateValue: it[this.curDateType],
- minUnit: it.minPackingCount,
- minPositionId: it.cargoSpaceId,
- name: it.assetName,
- pathIds: item.pathIds,
- unit: it.unit,
- packageNo: it.num
- };
- });
- item.outInDetailRecordAddPOList = list;
- }
- });
- let obj = { ...this.formData, type: 1 };
- obj.outInDetailAddPOList = arr;
- console.log('====>>', obj);
- // this.saveLoading = true;
- // try {
- // const res = await outin.save(obj);
- // if (res.code == 0) {
- // this.$message.success('保存成功!');
- // }
- // } catch (error) {}
- // this.saveLoading = false;
- // this.$router.push('/warehouseManagement/stockManagement');
- }
- });
- },
- async getOrderCode() {
- const data = await getCode('in_warehouse');
- return data;
- },
- //添加明细
- async onSelectTableData(val) {
- const res = await getCode('lot_number_code');
- this.warehousingMaterialList.push(
- ...val.map((next) => {
- next.batchNo = res;
- let cur = {};
- next.realInventoryAmount = next.realInventoryAmount || 0;
- cur = {
- ...next,
- cargoSpaceCode: '', //货位编码
- cargoSpaceId: '', //货位id
- shelfId: '', //货架id
- shelfCode: '', //货架名称
- areaId: '', //库区id
- areaName: '', //库区名称
- warehouseId: '', //仓库id
- warehouseName: '', //仓库名称
- assetType: this.formData.extInfo.assetType,
- expirationDate: '',
- outInNum: '',
- minPackingCount: '',
- bizStatus: 1,
- contentImage: [],
- warehouseLedgerDetails: [],
- houseList: []
- };
- return cur;
- })
- );
- console.log('sasasa===', this.warehousingMaterialList);
- },
- async initData() {
- const { data } = await getTreeByPid(0);
- this.codeList = data;
- // .map((item) => {
- // return { dictCode: item.id, dictValue: item.name };
- // });
- const res = await warehouseDefinition.tree();
- this.treeList = this.$util.toTreeData({
- data: res,
- idField: 'id',
- parentIdField: 'parentId'
- });
- // const res111 = await warehouseDefinition.list();
- // this.warehouseList = res111.list;
- const info = JSON.parse(localStorage.getItem('info'));
- let obj = res.find((item) => item.id === info.deptId);
- this.formData.extInfo.deptName = obj.name;
- this.formData.extInfo.createUserName = info.name;
- this.formData.createUserId = info.id;
- // this.treeList = res;
- // this.formData.extInfo.deptCode =
- // this.getTreeList().then((res) => {
- // if (res?.success) {
- // this.treeList = res.data;
- // }
- // });
- // this.getSupplier().then((res) => {
- // if (res?.success) {
- // this.supplierList = res.data.items;
- // }
- // });
- // this.getStaffList();
- },
- addStock() {
- // this.$refs.wareHouseDailogRef.open({});
- // return;
- if (!this.title) return this.$message.error('请选择入库产品类型');
- if (!this.formData.bizType)
- return this.$message.error('请选择入库场景');
- this.visibleDialog = true;
- },
- handleChange(data) {
- this.title = data?.dictValue;
- this.selectEquiType = data?.dictCode;
- },
- handleChanges(code) {
- const data = this.codeList.find((item) => item.dictCode == code);
- this.title = data?.dictValue;
- this.selectEquiType = data?.dictCode;
- },
- getSupplier() {
- return new Promise((resolve, reject) => {
- supplier.list({ page: 1, size: 999 }).then((res) => {
- if (res.success) {
- resolve(res);
- }
- });
- });
- },
- getTreeList() {
- return new Promise((resolve, reject) => {
- org.tree().then((res) => {
- if (res.success) {
- resolve(res);
- }
- });
- });
- },
- upload(data) {
- this.formData.contentImage = data;
- this.$refs.formName.validateField('contentImage');
- },
- houseData(argum, idx) {
- this.$set(this.warehousingMaterialList[idx], 'houseList', argum);
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep.form-table {
- .el-form-item {
- margin-bottom: 0;
- }
- .el-input__inner {
- padding: 0 10px;
- }
- ::-webkit-scrollbar {
- width: 8px;
- height: 8px;
- background-color: transparent;
- }
- }
- .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;
- }
- .switch_left li {
- border-right: 1px solid rgba(222, 222, 222, 1);
- border-left: 1px solid rgba(222, 222, 222, 1);
- }
- </style>
|