|
@@ -3,47 +3,143 @@
|
|
|
<el-page-header @back="goBack" :content="listItem ? '编辑':'新增'"></el-page-header>
|
|
|
|
|
|
<div class="main-title">
|
|
|
- <div class="title">发货申请单信息</div>
|
|
|
+ <div class="title">基本信息</div>
|
|
|
</div>
|
|
|
|
|
|
- <el-form ref="mainForm" :model="mainForm" :rules="mainFormRules" label-width="90px" size="small" label-position="right">
|
|
|
+ <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="id">
|
|
|
- <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" readonly></el-input>
|
|
|
+ <el-form-item label="单据编号" prop="id">
|
|
|
+ <el-input v-model="mainForm.id" 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="date">
|
|
|
+ <el-form-item label="申请日期" prop="orderTime">
|
|
|
<el-date-picker
|
|
|
- v-model="mainForm.date"
|
|
|
- type="date"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
+ v-model="mainForm.orderTime"
|
|
|
+ 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="12" :lg="8">
|
|
|
- <el-form-item label="制单人" prop="createMan">
|
|
|
- <el-input v-model="mainForm.createMan" readonly></el-input>
|
|
|
+ <el-form-item label="状态" prop="examineStatus">
|
|
|
+ <el-select v-model="mainForm.examineStatus" style="width: 100%;" disabled>
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in statusList"
|
|
|
+ :key="index"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :xs="24" :sm="24" :lg="16">
|
|
|
- <el-form-item label="备注" prop="remark">
|
|
|
- <el-input v-model="mainForm.remark" placeholder="请输入备注"></el-input>
|
|
|
+ <el-col :xs="24" :sm="12" :lg="8">
|
|
|
+ <el-form-item label="经销商编码" prop="customerNumber">
|
|
|
+ <el-input v-model="mainForm.customerNumber" disabled></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="24" :sm="12" :lg="16">
|
|
|
+ <el-form-item label="经销商名称" prop="customerName">
|
|
|
+ <el-input v-model="mainForm.customerName" disabled></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="24" :sm="12" :lg="8">
|
|
|
+ <el-form-item label="销售单号" prop="orderNo">
|
|
|
+ <el-input v-model="mainForm.orderNo" disabled></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="24" :sm="12" :lg="8">
|
|
|
+ <el-form-item label="销售单类型" prop="orderType">
|
|
|
+ <el-select v-model="mainForm.orderType" style="width: 100%;" disabled>
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in orderTypeList"
|
|
|
+ :key="index"
|
|
|
+ :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="jxsNum">
|
|
|
- <el-select v-model="mainForm.jxsNum" placeholder="请选择经销商" style="width: 100%;" disabled>
|
|
|
- <el-option :label="item.name" :value="item.id" v-for="(item, index) in dealerList" :key="index"></el-option>
|
|
|
+ <el-form-item label="调拨类型" prop="type">
|
|
|
+ <el-select v-model="mainForm.type" style="width: 100%;" disabled>
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in typeList"
|
|
|
+ :key="index"
|
|
|
+ :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="requsitionOut">
|
|
|
+ <el-input v-model="mainForm.requsitionOut" disabled></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="24" :sm="12" :lg="8">
|
|
|
+ <el-form-item label="调入库存组织" prop="requsitionIn">
|
|
|
+ <el-input v-model="mainForm.requsitionIn" disabled></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="24" :sm="12" :lg="8">
|
|
|
+ <el-form-item label="调拨方向" prop="direction">
|
|
|
+ <el-input v-model="mainForm.direction" disabled></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="24" :sm="12" :lg="8">
|
|
|
+ <el-form-item label="制单人" prop="createBy">
|
|
|
+ <el-input v-model="mainForm.createBy" disabled></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="24" :sm="12" :lg="8">
|
|
|
+ <el-form-item label="制单日期" prop="createTime">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="mainForm.createTime"
|
|
|
+ type="datetime"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ style="width: 100%;"
|
|
|
+ disabled
|
|
|
+ placeholder="选择日期">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :xs="12" :sm="6" :lg="6">
|
|
|
+ <el-form-item label="调出仓库" prop="correspondId">
|
|
|
+ <el-select v-model="mainForm.correspondId" placeholder="请选择调出仓库" style="width: 100%" filterable @change="changeWarehouse1">
|
|
|
+ <el-option v-for="item in warehouseList1" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="12" :sm="6" :lg="6">
|
|
|
+ <el-form-item label="调出仓位" prop="stockId">
|
|
|
+ <el-select v-model="mainForm.stockId" placeholder="请调出仓位" style="width: 100%" filterable>
|
|
|
+ <el-option v-for="item in positionList1" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="12" :sm="6" :lg="6">
|
|
|
+ <el-form-item label="调入仓库" prop="inCorrespondId">
|
|
|
+ <el-select v-model="mainForm.inCorrespondId" placeholder="请选择调入仓库" style="width: 100%" filterable @change="changeWarehouse2">
|
|
|
+ <el-option v-for="item in warehouseList2" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :xs="24" :sm="8" :lg="8">
|
|
|
- <el-form-item label="附件" prop="fileUrl">
|
|
|
- <fileUpload :fileList="fileList" />
|
|
|
+ <el-col :xs="12" :sm="6" :lg="6">
|
|
|
+ <el-form-item label="调入仓位" prop="inStockId">
|
|
|
+ <el-select v-model="mainForm.inStockId" placeholder="请调入仓位" style="width: 100%" filterable>
|
|
|
+ <el-option v-for="item in positionList2" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </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>
|
|
@@ -51,42 +147,44 @@
|
|
|
|
|
|
<div class="main-title">
|
|
|
<div class="title">货品信息</div>
|
|
|
- <div>
|
|
|
- <span style="font-size: 14px; margin-right: 10px">仓库</span>
|
|
|
- <el-select v-model="screenForm.warehouse" placeholder="请选择发货仓库" size="small" filterable clearable :disabled="goodsList.length > 0">
|
|
|
- <el-option :label="item.name" :value="item.id" v-for="(item, index) in warehouseList" :key="index"></el-option>
|
|
|
- </el-select>
|
|
|
- <el-divider direction="vertical"></el-divider>
|
|
|
- <el-button type="primary" size="small" icon="el-icon-plus" @click="openDialog">添加引用</el-button>
|
|
|
- </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 :data="mainForm.results" 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="orderId" 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="materialCode" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column align="center" label="物料代码" prop="materialOldNumber" min-width="160" 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="qty" min-width="80" 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 align="center" label="调拨数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column align="center" label="总成本" prop="totalAmount" min-width="100" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column align="center" label="调出仓库" min-width="100" show-overflow-tooltip>
|
|
|
+ <template slot-scope="">{{ mainForm.correspondName}}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="调出仓位" min-width="100" show-overflow-tooltip>
|
|
|
+ <template slot-scope="">{{ mainForm.stockName}}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="调入仓库" min-width="100" show-overflow-tooltip>
|
|
|
+ <template slot-scope="">{{ mainForm.inCorrespondName}}</template>
|
|
|
</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="refundableQty" min-width="100" show-overflow-tooltip> </el-table-column>
|
|
|
- <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip>
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.remark" size="small"></el-input>
|
|
|
- </template>
|
|
|
+ <el-table-column align="center" label="调入仓位" min-width="100" show-overflow-tooltip>
|
|
|
+ <template slot-scope="">{{ mainForm.inStockName}}</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 align="center" label="调出库存状态" min-width="110" show-overflow-tooltip>
|
|
|
+ <template slot-scope="">{{ mainForm.stockStatusType}}</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column align="center" label="调入库存状态" min-width="110" show-overflow-tooltip>
|
|
|
+ <template slot-scope="">{{ mainForm.inStockStatusType}}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="调出货主" min-width="100" show-overflow-tooltip>
|
|
|
+ <template slot-scope="">{{mainForm.requsitionOut}}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="调入货主" min-width="100" show-overflow-tooltip>
|
|
|
+ <template slot-="scope">{{mainForm.requsitionIn}}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
|
|
@@ -100,139 +198,96 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <el-dialog title="添加产品" :visible.sync="isShowDialog" width="80%">
|
|
|
- <el-form ref="screenForm" :model="screenForm" size="small" label-position="left" label-width="70px">
|
|
|
- <el-row :gutter="20">
|
|
|
- <el-col :xs="12" :sm="6" :lg="6">
|
|
|
- <el-form-item prop="warehouse" label="选择仓库">
|
|
|
- <el-select v-model="screenForm.warehouse" placeholder="请选择仓库" size="small" filterable clearable :disabled="goodsList.length > 0 || tableSelection.length > 0">
|
|
|
- <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 || tableSelection.length > 0">
|
|
|
- <el-option v-for="item in typeList" :key="item.dictCode" :label="item.dictValue" :value="item.dictCode"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :xs="12" :sm="6" :lg="6">
|
|
|
- <el-form-item prop="orderNum" label="订单号">
|
|
|
- <el-input v-model="screenForm.orderNum" placeholder="请输入订单号"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :xs="12" :sm="6" :lg="6" 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="orderId" 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="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="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="alreadyInvoiceNum" 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="stockAdequate" min-width="100" show-overflow-tooltip>
|
|
|
- <template slot-scope="scope">
|
|
|
- {{scope.row.stockAdequate | stockFilter}}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column align="center" label="对应库存数量" prop="stockCorrespond" min-width="110" show-overflow-tooltip></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 { getDetail, addApply, editApply, getGoodsList, getWarehouseList, getDealerList } from "@/api/supply/direct";
|
|
|
-import { getDictList } from '@/api/common'
|
|
|
-import { findElem } from '@/utils/util'
|
|
|
-import fileUpload from '@/components/Common/file-upload.vue'
|
|
|
+import { getDetail, editData, getWarehouseList } from "@/api/supply/direct";
|
|
|
|
|
|
export default {
|
|
|
- components: {
|
|
|
- fileUpload
|
|
|
- },
|
|
|
name: 'DirectForm',
|
|
|
componentName: 'DirectForm',
|
|
|
props: ['listItem'],
|
|
|
- filters: {
|
|
|
- stockFilter(val) {
|
|
|
- const MAP = {
|
|
|
- 0: '不充足',
|
|
|
- 1: '充足'
|
|
|
- }
|
|
|
- return MAP[val]
|
|
|
- }
|
|
|
- },
|
|
|
data() {
|
|
|
return {
|
|
|
- mainForm: {
|
|
|
- orderNum: '',
|
|
|
- date: '',
|
|
|
- jxsNum: '',
|
|
|
- remark: '',
|
|
|
- createMan: '',
|
|
|
- },
|
|
|
+ statusList: [
|
|
|
+ { label: '已保存', value: 'SAVE' },
|
|
|
+ { label: '待审核', value: 'WAIT' },
|
|
|
+ { label: '审核通过', value: 'OK' },
|
|
|
+ { label: '审核驳回', value: 'FAIL' },
|
|
|
+ { label: '已关闭', value: 'CLOSE' },
|
|
|
+ ],
|
|
|
+ orderTypeList: [
|
|
|
+ { label: '商用工程订单', value: 'TRADE' },
|
|
|
+ { label: '家用工程订单', value: 'HOME' },
|
|
|
+ { label: '零售单', value: 'RETAIL' },
|
|
|
+ { label: '销售政策单', value: 'RETAIL_POLICY' },
|
|
|
+ ],
|
|
|
+ typeList: [
|
|
|
+ { label: '组织内调拨', value: 1 },
|
|
|
+ ],
|
|
|
+ mainForm: {},
|
|
|
mainFormRules: {
|
|
|
- date: [
|
|
|
- { required: true, message: '请选择单据日期', trigger: 'change' }
|
|
|
- ],
|
|
|
+ orderTime: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
|
|
|
+ remark: [{ required: true, message: '请输入备注', trigger: 'blur' }],
|
|
|
+ correspondId: [{ required: true, message: '请选择调出仓库', trigger: 'change' }],
|
|
|
+ stockId: [{ required: true, message: '请选择调出仓位', trigger: 'change' }],
|
|
|
+ inCorrespondId: [{ required: true, message: '请选择调入仓库', trigger: 'change' }],
|
|
|
+ inStockId: [{ required: true, message: '请选择调入仓位', trigger: 'change' }],
|
|
|
},
|
|
|
- dealerList: [],
|
|
|
- fileList: [],
|
|
|
goodsList: [],
|
|
|
|
|
|
- warehouseList: [],
|
|
|
- isShowDialog: false,
|
|
|
- screenForm: {
|
|
|
- warehouse: '',
|
|
|
- type: '',
|
|
|
- orderNum: '',
|
|
|
- },
|
|
|
- currentPage: 1,
|
|
|
- listTotal: 0,
|
|
|
- typeList: [],
|
|
|
+ warehouseList1: [],
|
|
|
+ warehouseList2: [],
|
|
|
+ positionList1: [],
|
|
|
+ positionList2: [],
|
|
|
|
|
|
- tableGoodsList: [],
|
|
|
- tableSelection: [],
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ watch: {
|
|
|
+ 'mainForm.correspondId': {
|
|
|
+ handler(newValue, oldValue) {
|
|
|
+ if (newValue) {
|
|
|
+ let obj = this.warehouseList1.find(o => o.id == newValue);
|
|
|
+ this.mainForm.correspondName = obj.name;
|
|
|
+ this.positionList1 = obj.kingDeeStocks;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+ 'mainForm.inCorrespondId': {
|
|
|
+ handler(newValue, oldValue) {
|
|
|
+ if (newValue) {
|
|
|
+ let obj = this.warehouseList2.find(o => o.id == newValue);
|
|
|
+ this.mainForm.inCorrespondName = obj.name;
|
|
|
+ this.positionList2 = obj.kingDeeStocks;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+ 'mainForm.stockId': {
|
|
|
+ handler(newValue, oldValue) {
|
|
|
+ if (newValue) {
|
|
|
+ let obj = this.positionList1.find(o => o.id == newValue);
|
|
|
+ this.mainForm.stockName = obj.name;
|
|
|
+ this.mainForm.stockStatusType = obj.defStockStatusName;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+ 'mainForm.inStockId': {
|
|
|
+ handler(newValue, oldValue) {
|
|
|
+ if (newValue) {
|
|
|
+ let obj = this.positionList2.find(o => o.id == newValue);
|
|
|
+ this.mainForm.inStockName = obj.name;
|
|
|
+ this.mainForm.inStockStatusType = obj.defStockStatusName;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
computed: {
|
|
|
sidebar() {
|
|
|
return this.$store.state.app.sidebar
|
|
@@ -245,15 +300,10 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
|
|
|
- created() {
|
|
|
- this.getDictList();
|
|
|
- this.getWarehouseList();
|
|
|
- this.getDealerList();
|
|
|
+ async created() {
|
|
|
+ await this.getWarehouseList();
|
|
|
if(this.listItem) {
|
|
|
this.getDetail();
|
|
|
- }else {
|
|
|
- this.mainForm.jxsNum = JSON.parse(localStorage.getItem("supply_user")).customerId;
|
|
|
- this.mainForm.createMan = JSON.parse(localStorage.getItem("supply_user")).nickName;
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -266,245 +316,47 @@ export default {
|
|
|
// 获取详情
|
|
|
getDetail() {
|
|
|
getDetail({id: this.listItem.id}).then(res => {
|
|
|
- let data = res.data;
|
|
|
- this.mainForm.orderNum = data.id;
|
|
|
- this.mainForm.date = data.orderTime;
|
|
|
- this.mainForm.jxsNum = data.customerNumber;
|
|
|
- this.mainForm.createMan = data.createBy;
|
|
|
- this.mainForm.remark = data.remark;
|
|
|
- this.screenForm.warehouse = data.correspondId;
|
|
|
- this.fileList = data.fileUrl ? [{
|
|
|
- url: data.fileUrl,
|
|
|
- name: data.fileName
|
|
|
- }] : [];
|
|
|
- data.orders.forEach(item => {
|
|
|
- item.orderId = item.id;
|
|
|
- })
|
|
|
- this.goodsList = data.orders;
|
|
|
+ this.mainForm = res.data;
|
|
|
})
|
|
|
},
|
|
|
|
|
|
// 获取仓库列表
|
|
|
- getWarehouseList() {
|
|
|
- getWarehouseList({
|
|
|
- pageNum: 1,
|
|
|
- pageSize: -1
|
|
|
- }).then((res) => {
|
|
|
- this.warehouseList = res.data.records;
|
|
|
+ async getWarehouseList() {
|
|
|
+ const result = new Promise((resolve, reject) => {
|
|
|
+ getWarehouseList({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: -1
|
|
|
+ }).then((res) => {
|
|
|
+ this.warehouseList1 = res.data.records;
|
|
|
+ this.warehouseList2 = res.data.records;
|
|
|
+ resolve(res.data.records);
|
|
|
+ })
|
|
|
})
|
|
|
+ return result;
|
|
|
},
|
|
|
|
|
|
- getDictList() {
|
|
|
- getDictList({sysDictEnum: 'PRODUCT_TYPE'}).then(res => {
|
|
|
- this.typeList = res.data;
|
|
|
- })
|
|
|
+ // 更改调出仓库
|
|
|
+ changeWarehouse1() {
|
|
|
+ this.mainForm.stockId = '';
|
|
|
},
|
|
|
|
|
|
- // 获取经销商列表
|
|
|
- getDealerList() {
|
|
|
- getDealerList({
|
|
|
- pageNum: 1,
|
|
|
- pageSize: -1,
|
|
|
- bindUser: false
|
|
|
- }).then(res => {
|
|
|
- this.dealerList = res.data.records;
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- // 获取商品列表
|
|
|
- getGoodsList() {
|
|
|
- getGoodsList({
|
|
|
- pageNum: this.currentPage,
|
|
|
- pageSize: 10,
|
|
|
- stockId: this.screenForm.warehouse,
|
|
|
- mainId: this.screenForm.type,
|
|
|
- id: this.screenForm.orderNum,
|
|
|
- examineStatus: 'OK',
|
|
|
- type: 1,
|
|
|
- }).then(res => {
|
|
|
- let goodsList = [];
|
|
|
- res.data.records.forEach(item => {
|
|
|
- goodsList.push({
|
|
|
- orderId: item.id,
|
|
|
- retailId: item.retailId,
|
|
|
- saleTypeName: item.saleTypeName,
|
|
|
- materialId: item.materialId,
|
|
|
- materialCode: item.materialCode,
|
|
|
- materialName: item.materialName,
|
|
|
- specification: item.specification,
|
|
|
- unit: item.unit,
|
|
|
- qty: item.qty,
|
|
|
- invoiceNum: item.invoiceNum,
|
|
|
- alreadyInvoiceNum: item.alreadyInvoiceNum,
|
|
|
- refundableQty: item.refundableQty,
|
|
|
- stockAdequate: item.stockAdequate,
|
|
|
- stockCorrespond: item.stockCorrespond,
|
|
|
- })
|
|
|
- });
|
|
|
-
|
|
|
- let oldGoodsList = this.goodsList;
|
|
|
- let newGoodsList = goodsList;
|
|
|
- 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.materialId === oldItem.materialId){
|
|
|
- newGoodsList[j].selected = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.tableGoodsList = newGoodsList;
|
|
|
- this.listTotal = res.data.total;
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- // 查询重复值并禁选
|
|
|
- checkboxSelect(row, rowIndex) {
|
|
|
- if (row.selected) {
|
|
|
- return false // 禁用
|
|
|
- }else{
|
|
|
- return true // 不禁用
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- // 点击 选择商品
|
|
|
- openDialog() {
|
|
|
- if(!this.screenForm.warehouse) {
|
|
|
- return this.$errorMsg('请选择仓库');
|
|
|
- }
|
|
|
- this.isShowDialog = true;
|
|
|
- if(this.screenForm.warehouse && this.screenForm.type) {
|
|
|
- this.getGoodsList();
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- // 提交筛选表单
|
|
|
- submitScreenForm() {
|
|
|
- if(!this.screenForm.warehouse || !this.screenForm.type) {
|
|
|
- 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;
|
|
|
- },
|
|
|
-
|
|
|
- // 数组去重
|
|
|
- delRepeat(arr1, arr2) {
|
|
|
- let allArr = arr1.concat(arr2); // 两个数组对象合并
|
|
|
- let newArr = []; // 存放去重后数据的新数组
|
|
|
- for(let i=0; i<allArr.length; i++){ // 循环allArr数组对象的内容
|
|
|
- let flag = true; // 建立标记,判断数据是否重复,true为不重复
|
|
|
- for(let j=0; j<newArr.length; j++){ // 循环新数组的内容
|
|
|
- if(allArr[i].materialId == newArr[j].materialId){ // 让allArr数组对象的内容与新数组的内容作比较,相同的话,改变标记为false
|
|
|
- flag = false;
|
|
|
- }
|
|
|
- }
|
|
|
- if(flag){ // 判断是否重复
|
|
|
- newArr.push(allArr[i]); // 不重复的放入新数组。 新数组的内容会继续进行上边的循环。
|
|
|
- }
|
|
|
- }
|
|
|
- return newArr;
|
|
|
- },
|
|
|
-
|
|
|
- // 确定 添加产品
|
|
|
- submitAddGoods() {
|
|
|
- let allList = this.tableGoodsList;
|
|
|
- let selectList = this.tableSelection;
|
|
|
- let submitList = [];
|
|
|
-
|
|
|
- for(let i = 0; i < allList.length; i++) {
|
|
|
- for(let j = 0; j < selectList.length; j++) {
|
|
|
- if(selectList[j].orderId == allList[i].orderId){
|
|
|
- submitList.push(allList[i]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // this.goodsList = this.goodsList.concat(submitList);
|
|
|
-
|
|
|
- this.goodsList = this.delRepeat(submitList, this.goodsList);
|
|
|
- this.isShowDialog = false;
|
|
|
- this.tableGoodsList = [];
|
|
|
- },
|
|
|
-
|
|
|
- // 删除产品
|
|
|
- deleteItem(index) {
|
|
|
- this.goodsList.splice(index, 1);
|
|
|
- // this.goodsList = this.goodsList.filter((item) => {
|
|
|
- // return item.orderId != id
|
|
|
- // })
|
|
|
+ // 更改调入仓库
|
|
|
+ changeWarehouse2() {
|
|
|
+ this.mainForm.inStockId = '';
|
|
|
},
|
|
|
|
|
|
// 保存
|
|
|
clickSubmitForm(status) {
|
|
|
this.$refs.mainForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
- for(let i=0; i<this.goodsList.length; i++) {
|
|
|
- if(!this.goodsList[i].invoiceNum) {
|
|
|
- this.$errorMsg('请输入申请数量');
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- for(let i=0; i<this.goodsList.length; i++) {
|
|
|
- if(this.goodsList[i].invoiceNum > this.goodsList[i].qty) {
|
|
|
- this.$errorMsg('申请数量不能大于总数量');
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- let correspondName = this.warehouseList[findElem(this.warehouseList, 'id', this.screenForm.warehouse)].name;
|
|
|
- let params = {
|
|
|
- id: this.listItem ? this.listItem.id : '',
|
|
|
- orderTime: this.mainForm.date + ' 00:00:00',
|
|
|
- remark: this.mainForm.remark,
|
|
|
- fileUrl: this.fileList && this.fileList.length > 0 ? this.fileList[0].url : '',
|
|
|
- fileName: this.fileList && this.fileList.length > 0 ? this.fileList[0].name : '',
|
|
|
- orderType: 1, // 1零售单 2家用工程 3商用工程
|
|
|
- correspondId: this.screenForm.warehouse,
|
|
|
- correspondName,
|
|
|
- orders: this.goodsList,
|
|
|
- examineStatus: status,
|
|
|
- }
|
|
|
- if(this.listItem) {
|
|
|
- editApply(params).then(res => {
|
|
|
- this.$successMsg('编辑成功');
|
|
|
- this.goBack();
|
|
|
- this.$parent.getList();
|
|
|
- })
|
|
|
- }else {
|
|
|
- addApply(params).then(res => {
|
|
|
- this.$successMsg('添加成功');
|
|
|
- this.goBack();
|
|
|
- this.$parent.getList();
|
|
|
- })
|
|
|
- }
|
|
|
+ let { id, orderTime, correspondId, correspondName, stockId, stockName, inCorrespondId, inCorrespondName, inStockId, inStockName, remark } = this.mainForm;
|
|
|
+ let params = { id, orderTime, correspondId, correspondName, stockId, stockName, inCorrespondId, inCorrespondName, inStockId, inStockName, remark };
|
|
|
+ params.examineStatus = status;
|
|
|
+ editData(params).then(res => {
|
|
|
+ this.$successMsg('编辑成功');
|
|
|
+ this.goBack();
|
|
|
+ this.$parent.getList();
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|