1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021 |
- <template>
- <div class="detail-container">
- <el-page-header @back="goBack" :content="listItem ? '编辑-发货申请' : '新增-发货申请'"></el-page-header>
- <div class="main-title">
- <div class="title">工程发货申请单信息</div>
- </div>
- <div style="font-size: 12px; color: #333; margin-bottom: 20px">
- 注:发货申请时,库存数量为实时数量,请选择完成选择后及时保存提交,否则数量可能有变,被其他商家开单而导致库存不足。
- </div>
- <el-form
- ref="mainForm"
- :model="mainForm"
- :rules="mainFormRules"
- label-width="100px"
- size="small"
- label-position="right"
- >
- <el-row :gutter="20">
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="发货申请单" prop="orderNum">
- <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" disabled></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="8" style="height: 51px">
- <el-form-item label="单据日期" prop="orderDate">
- <el-date-picker
- v-model="mainForm.orderDate"
- disabled
- type="date"
- value-format="yyyy-MM-dd"
- style="width: 100%"
- placeholder="选择日期"
- >
- </el-date-picker>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="经销商编号" prop="jxsNum">
- <el-input v-model="mainForm.jxsNum" disabled></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="16">
- <el-form-item label="经销商名称" prop="jxsName">
- <el-input v-model="mainForm.jxsName" disabled></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="工程登录编号" prop="loginNum">
- <div style="display: flex">
- <el-input v-model="mainForm.loginNum" :disabled="isDealer" placeholder="请输入工程登录编号"></el-input>
- <el-button style="margin-left: 10px" @click="openDialog">引用</el-button>
- </div>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="家用项目类别" prop="enginName">
- <el-input v-model="mainForm.enginName" placeholder="请输入家用项目类别" :disabled="isDealer"></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="商用项目名称" prop="refProjectName">
- <el-input
- v-model="mainForm.refProjectName"
- placeholder="请输入商用项目名称"
- :disabled="isDealer"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="工程登录类型" prop="loginType">
- <el-select style="width: 100%" v-model="mainForm.loginType" placeholder="请输入工程登录类型" disabled>
- <el-option
- v-for="item in [
- {label:'家用', value:'HOME'},
- {label:'商用', value:'TRADE'},
- ]"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="跨厂区编号" prop="factoryNum">
- <el-input v-model="mainForm.factoryNum" placeholder="请输入跨厂区编号" disabled></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="使用单位" prop="company">
- <el-input v-model="mainForm.company" placeholder="请输入使用单位" disabled></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="文件编号" prop="fileNo">
- <el-input v-model="mainForm.fileNo" placeholder="请输入文件编号" disabled></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="行业类别" prop="refTradeCategory">
- <el-input v-model="mainForm.refTradeCategory" placeholder="请输入文件编号" :disabled="isDealer"></el-input>
- </el-form-item>
- </el-col>
- <!-- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="项目类型" prop="refTradeCategory">
- <el-input v-model="mainForm.refTradeCategory" placeholder="请输入文件编号" disabled></el-input>
- </el-form-item>
- </el-col> -->
- </el-row>
- <el-row :gutter="20">
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="联系人" prop="contactMan">
- <el-input v-model="mainForm.contactMan" placeholder="请输入联系人" disabled></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="固定电话" prop="tel">
- <el-input v-model="mainForm.tel" placeholder="请输入固定电话" disabled></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="移动电话" prop="phone">
- <el-input v-model="mainForm.phone" placeholder="请输入移动电话" disabled></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :lg="24">
- <el-form-item label="安装地址" prop="address">
- <el-input v-model="mainForm.address" placeholder="请输入安装地址" disabled></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :lg="24">
- <el-form-item label="备注" prop="remark">
- <el-input v-model="mainForm.remark" placeholder="请输入备注"></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :xs="24" :sm="8" :lg="8">
- <el-form-item label="附件" prop="fileUrl">
- <fileUpload :fileList="fileList" multiple />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="制单人" prop="createMan">
- <el-input v-model="mainForm.createMan" disabled></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="8" style="height: 51px">
- <el-form-item label="制单日期" prop="createDate">
- <el-date-picker
- v-model="mainForm.createDate"
- disabled
- type="datetime"
- value-format="yyyy-MM-dd hh:mm:ss"
- style="width: 100%"
- placeholder="选择日期"
- >
- </el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="24" :lg="24" v-if="mainForm.examineRemark">
- <el-form-item label="审批说明" prop="examineRemark">
- <el-input v-model="mainForm.examineRemark" placeholder="请输入审批说明" disabled></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div class="main-title">
- <div class="title">货品信息</div>
- </div>
- <div class="table" style="margin-top: 20px">
- <el-table
- :data="goodsList"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- max-height="400"
- >
- <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
- <el-table-column
- align="center"
- label="引用单号"
- prop="enginOrderNo"
- min-width="180"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="单号类型"
- prop="saleTypeName"
- min-width="100"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="销售类型"
- prop="saleTypeName"
- min-width="100"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="物料编码"
- prop="materialCode"
- min-width="120"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="产品编码"
- prop="materialOldNumber"
- min-width="120"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="产品名称"
- prop="materialName"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="规格型号"
- prop="specification"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="单位"
- prop="unit"
- min-width="100"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column align="center" label="数量" prop="invoiceNum" min-width="110" show-overflow-tooltip>
- <template slot-scope="scope">
- <el-input v-model="scope.row.invoiceNum" size="small"></el-input>
- </template>
- </el-table-column>
- <el-table-column align="center" label="表头备注" prop="headerRemark" min-width="160" show-overflow-tooltip>
- <template slot-scope="scope">
- <el-input v-model="scope.row.headerRemark" size="small"></el-input>
- </template>
- </el-table-column>
- <el-table-column align="center" label="表体备注" prop="invoiceRemark" min-width="160" show-overflow-tooltip>
- <template slot-scope="scope">
- <el-input v-model="scope.row.invoiceRemark" size="small"></el-input>
- </template>
- </el-table-column>
- <el-table-column align="center" label="操作" width="100" fixed="right">
- <template slot-scope="scope">
- <el-button type="text" @click="deleteItem(scope.$index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="page-footer">
- <div class="footer" :class="classObj">
- <!-- <el-button type="primary" @click="clickSubmitForm('SAVE')">保 存</el-button> -->
- <el-button type="primary" @click="clickSubmitForm('WAIT')">提交审核</el-button>
- <el-popconfirm title="确定关闭吗?" @confirm="goBack" style="margin-left: 10px">
- <el-button slot="reference">返回列表</el-button>
- </el-popconfirm>
- </div>
- </div>
- <el-dialog title="添加引用" append-to-body :visible.sync="isShowDialog" width="80%">
- <el-form ref="screenForm" :model="screenForm" size="small" label-position="left" label-width="100px">
- <el-row :gutter="20">
- <el-col :xs="12" :sm="12" :lg="6">
- <el-form-item prop="loginNum" label="工程登录编号">
- <el-input v-model="screenForm.loginNum" placeholder="请输入工程登录编号"></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="12" :sm="12" :lg="6">
- <el-form-item prop="enginName" label="家用项目类别">
- <el-input v-model="screenForm.enginName" placeholder="请输入家用项目类别"></el-input>
- </el-form-item>
- </el-col>
- <!-- <el-col :xs="24" :sm="12" :lg="8">
- <el-form-item label="商用项项目名称" prop="refProjectName">
- <el-input v-model="screenForm.refProjectName" placeholder="请输入家用项目类别" :disabled="isDealer"></el-input>
- </el-form-item>
- </el-col> -->
- <el-col :xs="12" :sm="12" :lg="6">
- <el-form-item prop="model" label="规格型号">
- <el-input v-model="screenForm.model" placeholder="请输入规格型号"></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="12" :sm="12" :lg="6">
- <el-form-item label="发货申请日期" prop="date">
- <el-date-picker
- v-model="screenForm.date"
- type="datetimerange"
- :default-time="['00:00:00', '23:59:59']"
- range-separator="至"
- style="width: 100%; height: 33px"
- value-format="yyyy-MM-dd HH:mm:ss"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- >
- </el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :xs="12" :sm="12" :lg="6">
- <el-form-item prop="warehouse" label="选择仓库">
- <el-select
- v-model="screenForm.warehouse"
- placeholder="请选择仓库"
- size="small"
- filterable
- clearable
- :disabled="listItem ? isDealer ? goodsList.length > 0 || tableSelection.length > 0 : false: false"
- style="width: 100%"
- >
- <el-option
- :label="item.name"
- :value="item.id"
- v-for="(item, index) in warehouseList"
- :key="index"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :xs="12" :sm="6" :lg="6">
- <el-form-item prop="type" label="存货类别">
- <el-select
- v-model="screenForm.type"
- placeholder="选择存货类别"
- style="width: 100%"
- :disabled="goodsList.length > 0"
- >
- <el-option
- v-for="item in categoryList"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :xs="12" :sm="12" :lg="12" class="tr">
- <el-form-item label="">
- <el-button size="small" @click="resetScreenForm">清空</el-button>
- <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div class="table">
- <el-table
- :data="tableGoodsList"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- height="400"
- @selection-change="tableSelectionChange"
- >
- <el-table-column align="center" type="selection" width="55" :selectable="checkboxSelect"></el-table-column>
- <el-table-column align="center" label="新旧单标识" prop="mainOrderId" min-width="140" show-overflow-tooltip>
- <template slot-scope="scope">
- {{ scope.row.orderBase == 1 ? '新单' : '旧单' }}
- </template>
- </el-table-column>
- <el-table-column align="center" label="订单类型" prop="orderType" min-width="180" show-overflow-tooltip>
- <template slot-scope="scope">
- {{ scope.row.orderType | orderTypeFilter }}
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="工程登录编号"
- prop="refEnginRecordNo"
- min-width="200"
- show-overflow-tooltip
- ></el-table-column>
- <!-- <el-table-column align="center" label="表头登录类型" prop="refPromiseStatus" min-width="200" show-overflow-tooltip></el-table-column>
- <el-table-column align="center" label="项目类别" prop="refProjectCategory" min-width="200" show-overflow-tooltip></el-table-column>
- <el-table-column align="center" label="行业类别" prop="refTradeCategory" min-width="200" show-overflow-tooltip></el-table-column> -->
- <el-table-column
- align="center"
- label="销售类型"
- prop="saleTypeName"
- min-width="100"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="物料编码"
- prop="materialCode"
- min-width="120"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="产品编码"
- prop="materialOldNumber"
- min-width="120"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="产品名称"
- prop="materialName"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="规格型号"
- prop="specification"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="单位"
- prop="unit"
- min-width="80"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="订单数量"
- prop="qty"
- min-width="80"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="已申请数量"
- prop="alreadyInvoiceNum"
- min-width="100"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="已申请未出货数量"
- prop="sendQty"
- min-width="100"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="未申请数量"
- prop="refundableQty"
- min-width="100"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column align="center" label="本次申请数量" prop="invoiceNum" min-width="110" show-overflow-tooltip>
- <template slot-scope="scope">
- <el-input v-model="scope.row.invoiceNum" size="small"></el-input>
- </template>
- </el-table-column>
- <!-- <el-table-column align="center" label="总库存数量" prop="stockAdequate" min-width="100" show-overflow-tooltip>
- <template slot-scope="scope">
- {{stockFilter(scope.row, 1)}}
- </template>
- </el-table-column> -->
- <el-table-column
- align="center"
- label="对应库存数量"
- prop="stockCorrespond"
- min-width="110"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{ stockFilter(scope.row, 2) }}
- </template>
- </el-table-column>
- </el-table>
- <div class="pagination clearfix" style="margin-top: 10px">
- <div class="fr">
- <el-pagination
- @current-change="handleTableCurrentChange"
- :current-page="currentPage"
- :page-size="10"
- background
- layout="prev, pager, next"
- :total="listTotal"
- >
- </el-pagination>
- </div>
- </div>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="closeDialog">取 消</el-button>
- <el-button type="primary" @click="submitAddGoods">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- getEnginDetail,
- addEngin,
- editEngin,
- getEnginGoodsList,
- getWarehouseList,
- getDealerList,
- getEnginGoodsDetail
- } from '@/api/supply/apply'
- import { getDictList, getCategoryList } from '@/api/common'
- import { findElem } from '@/utils/util'
- import fileUpload from '@/components/Common/file-upload.vue'
- export default {
- components: {
- fileUpload
- },
- name: 'EnginForm',
- componentName: 'EnginForm',
- props: ['listItem'],
- filters: {
- orderTypeFilter(val) {
- const MAP = {
- HOME: '家用单',
- TRADE: '商用单',
- RETAIL: '零售单',
- RETAIL_POLICY: '销售政策单',
- PERMU_HOME: '置换家用单',
- PERMU_TRADE: '置换商用单',
- PERMU_RETAIL: '置换零售单',
- PERMU_RETAIL_POLICY: '置换销售政策单',
- REQUISITION_HOME: '调拨家用单',
- REQUISITION_TRADE: '调拨商用单',
- REQUISITION_RETAIL: '调拨零售单',
- REQUISITION_RETAIL_POLICY: '调拨销售政策单'
- }
- return MAP[val]
- }
- },
- data() {
- return {
- mainForm: {
- orderNum: '',
- orderDate: '',
- jxsNum: '',
- jxsName: '',
- loginNum: '',
- enginName: '',
- loginType: '',
- factoryNum: '',
- company: '',
- fileNo: '',
- contactMan: '',
- tel: '',
- phone: '',
- address: '',
- remark: '',
- createMan: '',
- createDate: '',
- examineRemark: '',
- refProjectName: '',
- refTradeCategory: ''
- },
- mainFormRules: {
- // orderDate: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
- },
- dealerList: [],
- fileList: [],
- goodsList: [],
- warehouseList: [],
- isShowDialog: false,
- screenForm: {
- loginNum: '',
- enginName: '',
- model: '',
- date: [],
- warehouse: '',
- type: '',
- refProjectName: ''
- },
- currentPage: 1,
- listTotal: 0,
- typeList: [],
- stockList: [],
- categoryList: [],
- tableGoodsList: [],
- tableSelection: []
- }
- },
- computed: {
- sidebar() {
- return this.$store.state.app.sidebar
- },
- classObj() {
- return {
- hideSidebar: !this.sidebar.opened,
- openSidebar: this.sidebar.opened
- }
- },
- isDealer() {
- return JSON.parse(localStorage.getItem('supply_user')).isCustomer
- }
- },
- created() {
- this.getDictList()
- this.getWarehouseList()
- this.getDealerList()
- this.getCategoryList()
- if (this.listItem) {
- this.getDetail()
- } else {
- this.mainForm.jxsNum = JSON.parse(localStorage.getItem('supply_user')).customerNumber
- this.mainForm.jxsName = JSON.parse(localStorage.getItem('supply_user')).customerName
- this.mainForm.createMan = JSON.parse(localStorage.getItem('supply_user')).nickName
- this.mainForm.createDate = this.getDate()
- }
- },
- methods: {
- // 返回列表
- goBack() {
- this.$emit('backListFormDetail')
- },
- getDate() {
- var date = new Date()
- var seperator1 = '-'
- var year = date.getFullYear()
- var month = date.getMonth() + 1
- var strDate = date.getDate()
- if (month >= 1 && month <= 9) {
- month = '0' + month
- }
- if (strDate >= 0 && strDate <= 9) {
- strDate = '0' + strDate
- }
- var currentdate = year + seperator1 + month + seperator1 + strDate
- return currentdate
- },
- // 获取详情
- getDetail() {
- getEnginDetail({ id: this.listItem.id }).then(res => {
- let data = res.data
- this.mainForm.orderNum = data.id
- this.mainForm.orderDate = data.orderTime.slice(0, 10)
- this.mainForm.jxsNum = data.customerNumber
- this.mainForm.jxsName = data.customerName
- this.mainForm.loginNum = data.refEnginRecordNo
- this.mainForm.loginType = data.enginOrderType
- this.mainForm.factoryNum = data.refFactoryNo
- this.mainForm.company = data.refUseUnit
- this.mainForm.saleType = data.saleTypeId
- this.mainForm.contactMan = data.refLinkman
- this.mainForm.tel = data.refTel
- this.mainForm.phone = data.refPhone
- this.mainForm.address = data.refInstallAddress
- this.mainForm.createMan = data.createBy
- this.mainForm.createDate = data.createTime
- this.mainForm.remark = data.remark
- this.mainForm.examineRemark = data.approvalRemark
- this.mainForm.fileNo = data.fileNo
- this.mainForm.refProjectName = data.refProjectName
- this.mainForm.enginName = data.refProjectCategory
- this.mainForm.refTradeCategory = data.refTradeCategory
- this.screenForm.warehouse = data.correspondId
- // this.screenForm.refProjectName = data.refProjectName
- data.salesOrderPictures.forEach(k => {
- k.name = k.fileName
- k.url = k.fileUrl
- })
- this.fileList = data.salesOrderPictures
- // data.orders.forEach(item => {
- // item.orderId = item.id;
- // })
- if (data.orders.length) {
- this.screenForm.type = data.orders[0].k3CategoryId
- }
- this.goodsList = data.orders
- })
- },
- // 获取仓库列表
- getWarehouseList() {
- getWarehouseList({
- pageNum: 1,
- pageSize: -1
- }).then(res => {
- this.warehouseList = res.data.records
- })
- },
- getDictList() {
- getDictList({ sysDictEnum: 'PRODUCT_TYPE' }).then(res => {
- this.typeList = res.data
- })
- getDictList({ sysDictEnum: 'STOCK_ORDER' }).then(res => {
- this.stockList = res.data
- })
- },
- // 获取经销商列表
- getDealerList() {
- getDealerList({
- pageNum: 1,
- pageSize: -1,
- bindUser: false
- }).then(res => {
- this.dealerList = res.data.records
- })
- },
- // 获取存货类别列表
- getCategoryList() {
- getCategoryList({
- pageNum: 1,
- pageSize: -1
- }).then(res => {
- this.categoryList = res.data.records
- })
- },
- // 库存字段
- stockFilter(item, type) {
- let STOCK_ORDER_INVOICE = this.stockList.find(o => o.dictCode == 'STOCK_ORDER_INVOICE').dictValue
- if (type === 1) {
- return item.stockAdequate > STOCK_ORDER_INVOICE ? '充足' : item.stockAdequate
- }
- if (type === 2) {
- if (item.stockCorrespond <= 0) {
- return '无货'
- } else if (item.stockCorrespond >= 1 && item.stockCorrespond <= 30) {
- return item.stockCorrespond
- } else if (item.stockCorrespond >= 31 && item.stockCorrespond <= 1000) {
- return '有货'
- } else {
- return '充足'
- }
- // return item.stockCorrespond > STOCK_ORDER_INVOICE ? '充足' : item.stockCorrespond;
- }
- },
- // 获取商品列表
- getGoodsList() {
- const categoryName = this.categoryList.find(k=>k.id == this.screenForm.type )?.name || ''
- getEnginGoodsList({
- pageNum: this.currentPage,
- pageSize: 10,
- refEnginRecordNo: this.screenForm.loginNum,
- refProjectName: this.screenForm.enginName,
- // refProjectCategory:this.screenForm.enginName,
- specification: this.screenForm.model,
- startTime: this.screenForm.date ? this.screenForm.date[0] : '',
- endTime: this.screenForm.date ? this.screenForm.date[1] : '',
- correspondId: this.screenForm.warehouse,
- categoryName
- }).then(res => {
- let oldGoodsList = this.goodsList
- let newGoodsList = res.data.records
- for (let i = 0; i < oldGoodsList.length; i++) {
- let oldItem = oldGoodsList[i]
- for (let j = 0; j < newGoodsList.length; j++) {
- let newItem = newGoodsList[j]
- if (newItem.orderId === oldItem.orderId) {
- newGoodsList[j].selected = true
- break
- }
- }
- }
- newGoodsList.forEach(item => {
- item.invoiceNum = item.refundableQty
- })
- this.tableGoodsList = newGoodsList
- this.listTotal = res.data.total
- })
- },
- // 查询重复值并禁选
- checkboxSelect(row, rowIndex) {
- if (row.selected) {
- return false // 禁用
- } else {
- return true // 不禁用
- }
- },
- // 点击 选择商品
- openDialog() {
- this.isShowDialog = true
- if (this.screenForm.warehouse) {
- this.getGoodsList()
- }
- },
- // 提交筛选表单
- submitScreenForm() {
- if (!this.screenForm.warehouse) {
- return this.$errorMsg('请选择仓库')
- }
- this.currentPage = 1
- this.getGoodsList()
- },
- // 重置筛选表单
- resetScreenForm() {
- this.$refs.screenForm.resetFields()
- this.currentPage = 1
- this.tableGoodsList = []
- // this.getGoodsList();
- },
- // 更改列表当前页
- handleTableCurrentChange(val) {
- if (this.tableSelection.length > 0) {
- return this.$errorMsg('已选择产品不可切换')
- }
- this.currentPage = val
- this.getGoodsList()
- },
- // 关闭 弹窗
- closeDialog() {
- this.isShowDialog = false
- },
- // 列表选择
- tableSelectionChange(val) {
- this.tableSelection = val
- },
- // 检查是否一致
- isAllEqual(array) {
- if (array.length > 0) {
- return !array.some(function (item, index) {
- return item.enginOrderNo !== array[0].enginOrderNo
- })
- } else {
- return true
- }
- },
- // 确定 添加产品
- submitAddGoods() {
- let list = this.goodsList.concat(this.tableSelection)
- if (!this.isAllEqual(list)) {
- return this.$errorMsg('只能选择同一个工程编号的订单')
- }
- for (let i = 0; i < this.tableSelection.length; i++) {
- for (let j = i + 1; j < this.tableSelection.length; j++) {
- if (this.tableSelection[i].orderBase !== this.tableSelection[j].orderBase) {
- return this.$errorMsg('只能选择新单或旧单')
- }
- }
- if (this.tableSelection[i].invoiceNum === '') {
- this.$errorMsg('请输入申请数量')
- return
- }
- // if(this.tableSelection[i].invoiceNum > this.tableSelection[i].refundableQty) {
- // this.$errorMsg('申请数量不能大于未申请数量');
- // return;
- // }
- }
- this.isShowDialog = false
- this.tableGoodsList = []
- this.goodsList = this.goodsList.concat(this.tableSelection)
- this.getEnginGoodsDetail(this.tableSelection[0].enginOrderNo)
- },
- getEnginGoodsDetail(enginOrderNo) {
- getEnginGoodsDetail({ enginOrderNo }).then(res => {
- let data = res.data
- this.mainForm.loginNum = data.refEnginRecordNo
- this.mainForm.enginName = data.refProjectCategory
- this.mainForm.refProjectName = data.refProjectName
- this.mainForm.loginType = data.enginOrderType
- this.mainForm.factoryNum = data.refFactoryNo
- this.mainForm.company = data.refUseUnit
- this.mainForm.saleType = data.saleTypeId
- this.mainForm.contactMan = data.refLinkman
- this.mainForm.tel = data.refTel
- this.mainForm.phone = data.refPhone
- this.mainForm.address = data.refInstallAddress
- this.mainForm.remark = data.remark
- this.mainForm.fileNo = data.fileNo
- this.mainForm.refTradeCategory = data.refTradeCategory
- })
- },
- // 删除产品
- deleteItem(index) {
- this.goodsList.splice(index, 1)
- },
- // 保存
- clickSubmitForm(status) {
- this.$refs.mainForm.validate(valid => {
- if (valid) {
- if (this.goodsList.length < 1) {
- return this.$errorMsg('请添加引用')
- }
- for (let i = 0; i < this.goodsList.length; i++) {
- if (!Number(this.goodsList[i].invoiceNum)) {
- this.$errorMsg('请输入申请数量')
- return
- }
- // if(this.goodsList[i].invoiceNum > this.goodsList[i].refundableQty) {
- // this.$errorMsg('申请数量不能大于未申请数量');
- // return;
- // }
- }
- if (!this.screenForm.warehouse) {
- return this.$errorMsg('请选择仓库')
- }
- const salesOrderPictures = []
- if (this.fileList.length) {
- this.fileList.forEach(k => {
- salesOrderPictures.push({
- fileName: k.name,
- fileUrl: k.url,
- salesId: this.goodsList[0].id
- })
- })
- }
- let correspondName = this.warehouseList[findElem(this.warehouseList, 'id', this.screenForm.warehouse)].name
- this.goodsList.forEach(k=>{
- k.k3CategoryId = this.goodsList[0].k3CategoryId
- k.k3ServiceName = this.goodsList[0].k3ServiceName
- })
- let params = {
- // orderTime: this.mainForm.orderDate + ' 00:00:00',
- refEnginRecordNo: this.mainForm.loginNum,
- refProjectName: this.mainForm.refProjectName,
- refTradeCategory: this.mainForm.refTradeCategory,
- refProjectCategory: this.mainForm.enginName,
- enginOrderType: this.mainForm.loginType,
- refFactoryNo: this.mainForm.factoryNum,
- refUseUnit: this.mainForm.company,
- refLinkman: this.mainForm.contactMan,
- refTel: this.mainForm.tel,
- refPhone: this.mainForm.phone,
- refInstallAddress: this.mainForm.address,
- remark: this.mainForm.remark,
- fileNo: this.mainForm.fileNo,
- fileUrl: this.fileList && this.fileList.length > 0 ? this.fileList[0].url : '',
- fileName: this.fileList && this.fileList.length > 0 ? this.fileList[0].name : '',
- correspondId: this.screenForm.warehouse,
- correspondName,
- orders: this.goodsList,
- examineStatus: status,
- salesOrderPictures
- }
- if (this.listItem) {
- params.id = this.listItem.id
- editEngin(params).then(res => {
- this.$emit('shuaxinlb')
- this.$successMsg('编辑成功')
- this.goBack()
- // this.$parent?.getList();
- })
- } else {
- addEngin(params).then(res => {
- this.$emit('shuaxinlb')
- this.$successMsg('添加成功')
- this.goBack()
- // this.$parent?.getList();
- })
- }
- }
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .detail-container {
- width: 100%;
- height: 100%;
- }
- .main-title {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-top: 20px;
- height: 60px;
- border-bottom: 1px solid #dcdfe6;
- margin-bottom: 20px;
- .title {
- font-size: 16px;
- font-weight: 600;
- padding-left: 10px;
- }
- }
- </style>
|