小数限制修改。日期默认修改

This commit is contained in:
jjLv 2026-01-30 09:41:52 +08:00
parent 03fc862fbd
commit 1d25cee51e
1 changed files with 200 additions and 188 deletions

View File

@ -4,7 +4,7 @@
<el-form :model="baseInfo" ref="baseInfo" :rules="baseRules" size="medium" :inline="true" label-width="110px"> <el-form :model="baseInfo" ref="baseInfo" :rules="baseRules" size="medium" :inline="true" label-width="110px">
<el-form-item label="入库单号" prop="intoCode"> <el-form-item label="入库单号" prop="intoCode">
<el-input v-model="baseInfo.intoCode" placeholder="入库单号自动生成" disabled maxlength="20" clearable style="width: 240px"/> <el-input v-model="baseInfo.intoCode" placeholder="入库单号自动生成" disabled maxlength="20" clearable style="width: 240px"/>
</el-form-item> </el-form-item>
<el-form-item label="所属区域" prop="areaId"> <el-form-item label="所属区域" prop="areaId">
<el-cascader v-model="baseInfo.areaId" <el-cascader v-model="baseInfo.areaId"
:options="treeAreaOptions" :filterable="true" style="width: 240px" :show-all-levels="false" :options="treeAreaOptions" :filterable="true" style="width: 240px" :show-all-levels="false"
@ -25,26 +25,26 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="入库类型" prop="intoType"> <el-form-item label="入库类型" prop="intoType">
<el-select v-model="baseInfo.intoType" placeholder="请选择入库类型" style="width: 240px;"> <el-select v-model="baseInfo.intoType" placeholder="请选择入库类型" style="width: 240px;">
<el-option label="采购入库" value="1"></el-option> <el-option label="采购入库" value="1"></el-option>
<el-option label="退料入库" value="2"></el-option> <el-option label="退料入库" value="2"></el-option>
<el-option label="即入即出" value="4"></el-option> <el-option label="即入即出" value="4"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="入库时间" prop="intoDate"> <el-form-item label="入库时间" prop="intoDate">
<el-date-picker <el-date-picker
v-model="baseInfo.intoDate" v-model="baseInfo.intoDate"
type="datetime" align="right" type="datetime" align="right"
format="yyyy-MM-dd HH:mm:ss" style="width: 240px;" format="yyyy-MM-dd HH:mm:ss" style="width: 240px;"
:picker-options="pickerOptions" @change="baseInfo.intoDate=formatDateTime(baseInfo.intoDate)"> :picker-options="pickerOptions" @change="baseInfo.intoDate=formatDateTime(baseInfo.intoDate)">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<!-- <el-form-item label="备注" prop="remark"> <!-- <el-form-item label="备注" prop="remark">
<el-input v-model="baseInfo.remark" placeholder="请输入备注" maxlength="30" clearable style="width: 240px"/> <el-input v-model="baseInfo.remark" placeholder="请输入备注" maxlength="30" clearable style="width: 240px"/>
</el-form-item> --> </el-form-item> -->
</el-form> </el-form>
</div> </div>
<div style="width: 100%;height: 450px;padding: 10px;border-radius: 10px;margin-bottom: 10px;background: #FFF;"> <div style="width: 100%;height: 450px;padding: 10px;border-radius: 10px;margin-bottom: 10px;background: #FFF;">
<div style="width: 100%;display: flex;justify-content: space-between;align-items: center;margin-bottom: 10px;"> <div style="width: 100%;display: flex;justify-content: space-between;align-items: center;margin-bottom: 10px;">
<div> <div>
@ -61,17 +61,17 @@
<el-table-column type="selection" width="50" align="center" :reserve-selection="true" /> <el-table-column type="selection" width="50" align="center" :reserve-selection="true" />
<el-table-column label="序号" align="center" width="80" type="index" /> <el-table-column label="序号" align="center" width="80" type="index" />
<!-- <el-table-column label="图片" align="center" prop="" :show-overflow-tooltip="true" /> --> <!-- <el-table-column label="图片" align="center" prop="" :show-overflow-tooltip="true" /> -->
<el-table-column label="货品编码" align="center" prop="materialCode" :show-overflow-tooltip="true" /> <el-table-column label="货品编码" align="center" prop="materialCode" :show-overflow-tooltip="true" />
<el-table-column label="货品名称" align="center" prop="materialName" :show-overflow-tooltip="true" /> <el-table-column label="货品名称" align="center" prop="materialName" :show-overflow-tooltip="true" />
<el-table-column label="货品类别" align="center" prop="materialTypeName" :show-overflow-tooltip="true" /> <el-table-column label="货品类别" align="center" prop="materialTypeName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" /> <el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
<el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true"> <el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.salesMode==1">按份</span> <span v-if="scope.row.salesMode==1">按份</span>
<span v-if="scope.row.salesMode==2">称重</span> <span v-if="scope.row.salesMode==2">称重</span>
<span v-if="!scope.row.salesMode">/</span> <span v-if="!scope.row.salesMode">/</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="供应商" align="center" prop="supplierId" :show-overflow-tooltip="true" width="150"> <el-table-column label="供应商" align="center" prop="supplierId" :show-overflow-tooltip="true" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.supplierId" placeholder="请选择供应商" style="width: 100%;"> <el-select v-model="scope.row.supplierId" placeholder="请选择供应商" style="width: 100%;">
@ -91,7 +91,7 @@
align="right" value-format="yyyy-MM-dd" align="right" value-format="yyyy-MM-dd"
format="yyyy-MM-dd" @change="scope.row.productDate=formatDate(scope.row.productDate)" format="yyyy-MM-dd" @change="scope.row.productDate=formatDate(scope.row.productDate)"
:picker-options="pickerOptions3" > :picker-options="pickerOptions3" >
</el-date-picker> </el-date-picker>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="保质期截止日期" align="center" prop="expireTime" :show-overflow-tooltip="true" width="180"> <el-table-column label="保质期截止日期" align="center" prop="expireTime" :show-overflow-tooltip="true" width="180">
@ -102,20 +102,20 @@
align="right" value-format="yyyy-MM-dd" align="right" value-format="yyyy-MM-dd"
format="yyyy-MM-dd" @change="scope.row.expireTime=formatDate(scope.row.expireTime)" format="yyyy-MM-dd" @change="scope.row.expireTime=formatDate(scope.row.expireTime)"
:picker-options="pickerOptions2" > :picker-options="pickerOptions2" >
</el-date-picker> </el-date-picker>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单价(元)" align="center" prop="unitPrice" :show-overflow-tooltip="true"> <el-table-column label="单价(元)" align="center" prop="unitPrice" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="baseInfo.relateOrderGoodsId">{{ scope.row.unitPrice }}</span> <span v-if="baseInfo.relateOrderGoodsId">{{ scope.row.unitPrice }}</span>
<el-input v-else v-model="scope.row.unitPrice" placeholder="请输入" maxlength="3" clearable @input="(v)=>(scope.row.unitPrice=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/> <el-input v-else v-model="scope.row.unitPrice" placeholder="请输入" maxlength="3" clearable @input="(v)=>(scope.row.unitPrice=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="订货数量" align="center" prop="orderNum" :show-overflow-tooltip="true" v-if="baseInfo.relateOrderGoodsId"> <el-table-column label="订货数量" align="center" prop="orderNum" :show-overflow-tooltip="true" v-if="baseInfo.relateOrderGoodsId">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{scope.row.orderNum}}</span> <span>{{scope.row.orderNum}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="已入库数量" align="center" prop="intoNum" :show-overflow-tooltip="true" v-if="baseInfo.relateOrderGoodsId"> <el-table-column label="已入库数量" align="center" prop="intoNum" :show-overflow-tooltip="true" v-if="baseInfo.relateOrderGoodsId">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{scope.row.intoNum}}</span> <span>{{scope.row.intoNum}}</span>
@ -123,9 +123,9 @@
</el-table-column> </el-table-column>
<el-table-column label="本次入库数量" align="center" prop="purNum" :show-overflow-tooltip="true"> <el-table-column label="本次入库数量" align="center" prop="purNum" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.purNum" placeholder="请输入" maxlength="3" clearable @change="patternValue(scope.row)"/> <el-input v-model="scope.row.purNum" placeholder="请输入" maxlength="6" clearable @change="patternValue(scope.row)"/>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>
@ -134,7 +134,7 @@
<el-button type="success" plain @click="confirmSubmit" :loading="loadingBtn">提交</el-button> <el-button type="success" plain @click="confirmSubmit" :loading="loadingBtn">提交</el-button>
<el-button @click="jumpList">返回</el-button> <el-button @click="jumpList">返回</el-button>
</div> </div>
<!-- 选择菜品 --> <!-- 选择菜品 -->
<el-dialog title="选择货品" :visible.sync="openDialog" width="65%" append-to-body :close-on-click-modal="false"> <el-dialog title="选择货品" :visible.sync="openDialog" width="65%" append-to-body :close-on-click-modal="false">
<div style="width: 100%;height:620px;"> <div style="width: 100%;height:620px;">
@ -142,11 +142,11 @@
<el-form-item label="货品类别" prop="materialTypeIds"> <el-form-item label="货品类别" prop="materialTypeIds">
<el-cascader v-model="queryParams.materialTypeIds" <el-cascader v-model="queryParams.materialTypeIds"
:options="materialTreeOptions" :filterable="true" style="width: 240px" :show-all-levels="false" :options="materialTreeOptions" :filterable="true" style="width: 240px" :show-all-levels="false"
:props="{ :props="{
multiple: true, multiple: true,
emitPath: false,// falseid emitPath: false,// falseid
checkStrictly: false,// checkStrictly: false,//
value:'id',label:'categoryName' value:'id',label:'categoryName'
}" collapse-tags> }" collapse-tags>
</el-cascader> </el-cascader>
</el-form-item> </el-form-item>
@ -169,22 +169,22 @@
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="图片" align="center" prop="" :show-overflow-tooltip="true" /> --> <!-- <el-table-column label="图片" align="center" prop="" :show-overflow-tooltip="true" /> -->
<el-table-column label="货品编码" align="center" prop="materialCode" :show-overflow-tooltip="true" /> <el-table-column label="货品编码" align="center" prop="materialCode" :show-overflow-tooltip="true" />
<el-table-column label="货品名称" align="center" prop="materialName" :show-overflow-tooltip="true" /> <el-table-column label="货品名称" align="center" prop="materialName" :show-overflow-tooltip="true" />
<el-table-column label="货品类别" align="center" prop="materialTypeName" :show-overflow-tooltip="true" /> <el-table-column label="货品类别" align="center" prop="materialTypeName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" /> <el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
<el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true"> <el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.salesMode==1">按份</span> <span v-if="scope.row.salesMode==1">按份</span>
<span v-if="scope.row.salesMode==2">称重</span> <span v-if="scope.row.salesMode==2">称重</span>
<span v-if="!scope.row.salesMode">/</span> <span v-if="!scope.row.salesMode">/</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单价(元)" align="center" prop="unitPrice" :show-overflow-tooltip="true"> <el-table-column label="单价(元)" align="center" prop="unitPrice" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ (scope.row.unitPrice/100).toFixed(2)||"" }}</span> <span>{{ (scope.row.unitPrice/100).toFixed(2)||"" }}</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
@ -192,20 +192,20 @@
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmChosen"> </el-button> <el-button type="primary" @click="confirmChosen"> </el-button>
<el-button @click="openDialog=false"> </el-button> <el-button @click="openDialog=false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 导入 --> <!-- 导入 -->
<el-dialog title="导入采购订单" :visible.sync="openImportDialog" width="60%" append-to-body :close-on-click-modal="false"> <el-dialog title="导入采购订单" :visible.sync="openImportDialog" width="60%" append-to-body :close-on-click-modal="false">
<div style="width: 100%;height:600px;"> <div style="width: 100%;height:600px;">
<el-form :model="queryParams2" ref="queryForm2" size="small" :inline="true" label-width="100px"> <el-form :model="queryParams2" ref="queryForm2" size="small" :inline="true" label-width="100px">
<el-form-item label="采购单号" prop="orderGoodsCode"> <el-form-item label="采购单号" prop="orderGoodsCode">
<el-input v-model="queryParams2.orderGoodsCode" placeholder="请输入采购单号" maxlength="20" clearable style="width: 240px"/> <el-input v-model="queryParams2.orderGoodsCode" placeholder="请输入采购单号" maxlength="20" clearable style="width: 240px"/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery2">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery2">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery2">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery2">重置</el-button>
@ -218,21 +218,21 @@
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{(queryParams2.pageNum - 1) * queryParams2.pageSize + scope.$index + 1}}</span> <span>{{(queryParams2.pageNum - 1) * queryParams2.pageSize + scope.$index + 1}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="采购单号" align="center" prop="orderGoodsCode" :show-overflow-tooltip="true" /> <el-table-column label="采购单号" align="center" prop="orderGoodsCode" :show-overflow-tooltip="true" />
<el-table-column label="采购订单标题" align="center" prop="orderTitle" :show-overflow-tooltip="true"/> <el-table-column label="采购订单标题" align="center" prop="orderTitle" :show-overflow-tooltip="true"/>
<el-table-column label="采购总金额(元" align="center" prop="orderAmount" :show-overflow-tooltip="true" width="120"> <el-table-column label="采购总金额(元" align="center" prop="orderAmount" :show-overflow-tooltip="true" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ (scope.row.orderAmount/100).toFixed(2) }}</span> <span>{{ (scope.row.orderAmount/100).toFixed(2) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="供应商" align="center" prop="supplierName" :show-overflow-tooltip="true" /> <el-table-column label="供应商" align="center" prop="supplierName" :show-overflow-tooltip="true" />
<el-table-column label="创建人" align="center" prop="createBy" :show-overflow-tooltip="true" /> <el-table-column label="创建人" align="center" prop="createBy" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" <el-button size="mini" type="text"
@click="confirmImport(scope.row)" v-if="scope.row.orderStatus==3" @click="confirmImport(scope.row)" v-if="scope.row.orderStatus==3"
>导入</el-button> >导入</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -242,21 +242,21 @@
:page.sync="queryParams2.pageNum" :page.sync="queryParams2.pageNum"
:limit.sync="queryParams2.pageSize" :limit.sync="queryParams2.pageSize"
@pagination="getList2" @pagination="getList2"
/> />
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="openImportDialog=false"> </el-button> <el-button type="primary" @click="openImportDialog=false"> </el-button>
<el-button @click="openImportDialog=false"> </el-button> <el-button @click="openImportDialog=false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { imgUpLoadTwo } from '@/api/system/upload' import { imgUpLoadTwo } from '@/api/system/upload'
import { systemAreaTreeApi } from "@/api/base/stall"; import { systemAreaTreeApi } from "@/api/base/stall";
import { systemMaterialTreeApi,getMaterialListApi,drpWareHousePageApi,supplierPageApi } from "@/api/foodManage/stockManage"; import { systemMaterialTreeApi,getMaterialListApi,drpWareHousePageApi,supplierPageApi } from "@/api/foodManage/stockManage";
import { getWarehouseInInfoApi,addWarehouseInApi,editWarehouseInApi } from "@/api/foodManage/stockManage"; import { getWarehouseInInfoApi,addWarehouseInApi,editWarehouseInApi } from "@/api/foodManage/stockManage";
import { purchaseOrderPageApi,getPurchaseOrderInfoApi } from "@/api/foodManage/purchaseManage"; import { purchaseOrderPageApi,getPurchaseOrderInfoApi } from "@/api/foodManage/purchaseManage";
export default { export default {
@ -267,10 +267,10 @@ export default {
inRowData:{},// inRowData:{},//
loading:false, loading:false,
loadingBtn:false, loadingBtn:false,
baseInfo: { baseInfo: {
contractType:undefined, contractType:undefined,
areaId:undefined, areaId:undefined,
canteenId:undefined, canteenId:undefined,
intoDate:new Date() intoDate:new Date()
}, },
// //
@ -292,7 +292,7 @@ export default {
], ],
warehouseId: [ warehouseId: [
{ required: true, message: "货品仓库不能为空", trigger: "change" } { required: true, message: "货品仓库不能为空", trigger: "change" }
], ],
intoType: [ intoType: [
{ required: true, message: "入库类型不能为空", trigger: "change" } { required: true, message: "入库类型不能为空", trigger: "change" }
] ]
@ -301,21 +301,21 @@ export default {
canteenOptions:[], canteenOptions:[],
stallOptions:[], stallOptions:[],
supplierOptions:[], supplierOptions:[],
wareHouseOptions:[], wareHouseOptions:[],
pickerOptions: { pickerOptions: {
disabledDate(v) { disabledDate(v) {
return v.getTime() < (new Date().getTime() - 86400000);// - 86400000 return v.getTime() < (new Date().getTime() - 86400000);// - 86400000
} }
}, },
materialList:[],//- materialList:[],//-
batchIds:[],//-- batchIds:[],//--
openDialog:false, openDialog:false,
materialTreeOptions:[], materialTreeOptions:[],
queryParams: { // -- queryParams: { // --
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}, },
pickerOptions2: { pickerOptions2: {
disabledDate(v) { disabledDate(v) {
return v.getTime() < (new Date().getTime() - 86400000) ||v.getTime() > (new Date().getTime() + 3600 * 1000 * 24 * 180);// - 86400000 return v.getTime() < (new Date().getTime() - 86400000) ||v.getTime() > (new Date().getTime() + 3600 * 1000 * 24 * 180);// - 86400000
@ -329,31 +329,31 @@ export default {
total: 0, // total: 0, //
tableListData: [],//- tableListData: [],//-
batchChosenMaterial:[],//-- batchChosenMaterial:[],//--
noMaterial:false, noMaterial:false,
// //
openImportDialog:false, openImportDialog:false,
queryParams2: { // -- queryParams2: { // --
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
orderGoodsCode:null orderGoodsCode:null
}, },
loading2:false, loading2:false,
total2: 0, // total2: 0, //
tableListData2: [],//- tableListData2: [],//-
importRow:{},//-- importRow:{},//--
materialDetailsData: [],//- materialDetailsData: [],//-
}; };
}, },
created() { created() {
if(this.$route.query.inRowData){ if(this.$route.query.inRowData){
this.inRowData = JSON.parse(this.$route.query.inRowData) this.inRowData = JSON.parse(this.$route.query.inRowData)
this.getContractInfo() this.getContractInfo()
} }
this.getAreaTreeData() this.getAreaTreeData()
this.getMaterialTree() this.getMaterialTree()
}, },
watch:{ watch:{
'$route.query.inRowData':function(newId, oldId) { '$route.query.inRowData':function(newId, oldId) {
if(newId){ if(newId){
this.inRowData = JSON.parse(newId) this.inRowData = JSON.parse(newId)
@ -364,41 +364,41 @@ export default {
} }
}, },
}, },
methods: { methods: {
// //
jumpList() { jumpList() {
const obj = { path: "/foodManage/stockManage/warehouseInEdit" }; const obj = { path: "/foodManage/stockManage/warehouseInEdit" };
this.$tab.closeOpenPage(obj); this.$tab.closeOpenPage(obj);
this.$router.replace({ path: "/foodManage/stockManage/warehouseIn" }); // this.$router.replace({ path: "/foodManage/stockManage/warehouseIn" }); //
}, },
getContractInfo(){ getContractInfo(){
console.log(this.inRowData) console.log(this.inRowData)
let param = { let param = {
intoId:this.inRowData.intoId intoId:this.inRowData.intoId
} }
// //
getWarehouseInInfoApi(param).then((response) => { getWarehouseInInfoApi(param).then((response) => {
this.baseInfo = response.data; this.baseInfo = response.data;
this.materialList = this.baseInfo.imsIntoInventoryDetailVOList; this.materialList = this.baseInfo.imsIntoInventoryDetailVOList;
// this.$set(this.baseInfo,'areaId',Number(response.data.areaId)) // this.$set(this.baseInfo,'areaId',Number(response.data.areaId))
this.materialList.forEach(item=>{ this.materialList.forEach(item=>{
this.$set(item,"unitPrice",Number(item.unitPrice)/100) this.$set(item,"unitPrice",Number(item.unitPrice)/100)
}) })
drpWareHousePageApi({ areaId:this.baseInfo.areaId }).then((response) => { drpWareHousePageApi({ areaId:this.baseInfo.areaId }).then((response) => {
this.wareHouseOptions = response.rows||[]; this.wareHouseOptions = response.rows||[];
// this.$set(this.baseInfo,'warehouseId',this.baseInfo.warehouseId) // this.$set(this.baseInfo,'warehouseId',this.baseInfo.warehouseId)
}); });
supplierPageApi({ isPaging:1,areaIdList:[] }).then((response) => { supplierPageApi({ isPaging:1,areaIdList:[] }).then((response) => {
this.supplierOptions = response.rows||[]; this.supplierOptions = response.rows||[];
}); });
}); });
}, },
// //
getAreaTreeData() { getAreaTreeData() {
systemAreaTreeApi({}).then((response) => { systemAreaTreeApi({}).then((response) => {
this.treeAreaOptions = response.data; this.treeAreaOptions = response.data;
if(this.treeAreaOptions.length>0){ if(this.treeAreaOptions.length>0){
this.$set(this.baseInfo,"areaId",this.getFirstChild(this.treeAreaOptions[0]).id) this.$set(this.baseInfo,"areaId",this.getFirstChild(this.treeAreaOptions[0]).id)
this.handleAreaChange() this.handleAreaChange()
} }
}); });
@ -411,7 +411,7 @@ export default {
} }
}, },
//- //-
handleAreaChange(e){ handleAreaChange(e){
this.getWareHouseData() this.getWareHouseData()
this.getSupplierData() this.getSupplierData()
}, },
@ -419,16 +419,16 @@ export default {
getWareHouseData() { getWareHouseData() {
drpWareHousePageApi({ areaId:this.baseInfo.areaId }).then((response) => { drpWareHousePageApi({ areaId:this.baseInfo.areaId }).then((response) => {
this.wareHouseOptions = response.rows||[]; this.wareHouseOptions = response.rows||[];
if(this.wareHouseOptions.length>0){ if(this.wareHouseOptions.length>0){
this.$set(this.baseInfo,"warehouseId",this.wareHouseOptions[0].warehouseId) this.$set(this.baseInfo,"warehouseId",this.wareHouseOptions[0].warehouseId)
} }
}); });
}, },
/** 查询供应商下拉结构 */ /** 查询供应商下拉结构 */
getSupplierData() { getSupplierData() {
supplierPageApi({ isPaging:1,areaIdList:[] }).then((response) => { supplierPageApi({ isPaging:1,areaIdList:[] }).then((response) => {
this.supplierOptions = response.rows||[]; this.supplierOptions = response.rows||[];
}); });
}, },
/** 查询货品类别下拉树结构 */ /** 查询货品类别下拉树结构 */
getMaterialTree() { getMaterialTree() {
@ -436,19 +436,19 @@ export default {
// goodsType:1 // goodsType:1
} }
systemMaterialTreeApi(param).then((response) => { systemMaterialTreeApi(param).then((response) => {
this.materialTreeOptions = response.data; this.materialTreeOptions = response.data;
}); });
}, },
// //
changeDateRange(e){ changeDateRange(e){
//this.formatDate(e[0]) //this.formatDate(e[0])
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.batchIds = selection.map(item => item.materialId) this.batchIds = selection.map(item => item.materialId)
}, },
// //
delMaterial(){ delMaterial(){
this.batchIds.forEach(ID=>{ this.batchIds.forEach(ID=>{
let index = this.materialList.findIndex(v=>v.materialId==ID) let index = this.materialList.findIndex(v=>v.materialId==ID)
if(index>-1){ if(index>-1){
@ -456,8 +456,8 @@ export default {
} }
}) })
setTimeout(()=>{ setTimeout(()=>{
this.$refs.multipleTable.clearSelection() this.$refs.multipleTable.clearSelection()
},300) },300)
}, },
// //
addMaterial(){ addMaterial(){
@ -465,19 +465,19 @@ export default {
this.openDialog=true this.openDialog=true
this.resetQuery() this.resetQuery()
setTimeout(()=>{ setTimeout(()=>{
this.$refs.multipleTable1.clearSelection() this.$refs.multipleTable1.clearSelection()
},300) },300)
}else{ }else{
this.$modal.msgError("请先选择区域、仓库"); this.$modal.msgError("请先选择区域、仓库");
} }
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams = { this.queryParams = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
@ -494,7 +494,7 @@ export default {
"areaId": this.baseInfo.areaId, "areaId": this.baseInfo.areaId,
"warehouseId": this.baseInfo.warehouseId, "warehouseId": this.baseInfo.warehouseId,
"materialName": this.queryParams.materialName, "materialName": this.queryParams.materialName,
"materialCode": this.queryParams.materialCode, "materialCode": this.queryParams.materialCode,
"materialTypeIds": this.queryParams.materialTypeIds, "materialTypeIds": this.queryParams.materialTypeIds,
} }
getMaterialListApi(param).then(response => { getMaterialListApi(param).then(response => {
@ -504,13 +504,15 @@ export default {
}); });
}, },
handleSelectionChange2(selection) { handleSelectionChange2(selection) {
this.batchChosenMaterial = []; this.batchChosenMaterial = [];
selection.forEach(item=>{ selection.forEach(item=>{
let obj = Object.assign({}, item) let obj = Object.assign({}, item)
obj.unitPrice = item.unitPrice/100; obj.unitPrice = item.unitPrice/100;
this.$set(obj,"purNum",0) this.$set(obj,"purNum",0)
this.$set(obj,"supplierId",null) this.$set(obj,"supplierId",null)
this.batchChosenMaterial.push(obj) this.$set(obj, "productDate", this.formatDate(new Date()));
this.$set(obj, "expireTime", this.formatDate(new Date()));
this.batchChosenMaterial.push(obj)
}) })
}, },
confirmChosen(){ confirmChosen(){
@ -525,9 +527,9 @@ export default {
}).catch(() => { }).catch(() => {
this.loading = false this.loading = false
this.openDialog=false this.openDialog=false
}); });
}else{ }else{
let items = [...this.materialList,...this.batchChosenMaterial] let items = [...this.materialList,...this.batchChosenMaterial]
let uniqueItems = items.filter((item, index, array) => { let uniqueItems = items.filter((item, index, array) => {
return array.findIndex((t) => (t.materialId === item.materialId)) === index; return array.findIndex((t) => (t.materialId === item.materialId)) === index;
}); });
@ -535,36 +537,36 @@ export default {
setTimeout(()=>{ setTimeout(()=>{
this.loading = false this.loading = false
this.openDialog=false this.openDialog=false
},500) },500)
} }
} }
}, },
//稿 //稿
confirmSave(){ confirmSave(){
this.$refs["baseInfo"].validate(valid => { this.$refs["baseInfo"].validate(valid => {
if (valid) { if (valid) {
let param = Object.assign({},this.baseInfo); let param = Object.assign({},this.baseInfo);
param.intoDate = this.formatDateTime(this.baseInfo.intoDate) param.intoDate = this.formatDateTime(this.baseInfo.intoDate)
param.totalAmount=0 param.totalAmount=0
param.totalNum=0 param.totalNum=0
param.status=1 param.status=1
param.imsIntoInventoryDetailAddList = [] param.imsIntoInventoryDetailAddList = []
this.noMaterial = false; this.noMaterial = false;
if(this.materialList.length>0){ if(this.materialList.length>0){
this.materialList.forEach(item=>{ this.materialList.forEach(item=>{
this.$set(item,"purNum",Number(item.purNum)) this.$set(item,"purNum",Number(item.purNum))
if(item.purNum==0 || item.supplierId==null || !item.productDate|| !item.expireTime){ if(item.purNum==0 || item.supplierId==null || !item.productDate|| !item.expireTime){
this.noMaterial = true this.noMaterial = true
}else{ }else{
let obj = Object.assign({}, item) let obj = Object.assign({}, item)
obj.unitPrice = Number(obj.unitPrice)*100 obj.unitPrice = Number(obj.unitPrice)*100
obj.totalPrice = (Number(obj.unitPrice)*Number(obj.purNum)) obj.totalPrice = (Number(obj.unitPrice)*Number(obj.purNum))
param.totalAmount = param.totalAmount+obj.totalPrice; param.totalAmount = param.totalAmount+obj.totalPrice;
param.totalNum = param.totalNum+Number(obj.purNum) param.totalNum = param.totalNum+Number(obj.purNum)
param.imsIntoInventoryDetailAddList.push(obj) param.imsIntoInventoryDetailAddList.push(obj)
} }
}) })
} }
if(this.noMaterial){ if(this.noMaterial){
if(this.baseInfo.relateOrderGoodsId&&this.baseInfo.relateOrderGoodsId!=""){ if(this.baseInfo.relateOrderGoodsId&&this.baseInfo.relateOrderGoodsId!=""){
this.$modal.msgError("当前导入的采购订单无验收无法入库!"); this.$modal.msgError("当前导入的采购订单无验收无法入库!");
@ -574,8 +576,8 @@ export default {
}else{ }else{
this.noMaterial = true; this.noMaterial = true;
if(this.materialList.length>0){ if(this.materialList.length>0){
this.noMaterial = false; this.noMaterial = false;
} }
console.log(param) console.log(param)
if(this.noMaterial){ if(this.noMaterial){
this.$modal.msgError("请添加货品!"); this.$modal.msgError("请添加货品!");
@ -585,58 +587,58 @@ export default {
editWarehouseInApi(param).then((response) => { editWarehouseInApi(param).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.loadingBtn=false this.loadingBtn=false
this.jumpList() this.jumpList()
}).catch(() => { }).catch(() => {
this.loadingBtn=false this.loadingBtn=false
}); });
} else { } else {
addWarehouseInApi(param).then((response) => { addWarehouseInApi(param).then((response) => {
this.$modal.msgSuccess("保存成功"); this.$modal.msgSuccess("保存成功");
this.loadingBtn=false this.loadingBtn=false
this.jumpList() this.jumpList()
}).catch(() => { }).catch(() => {
this.loadingBtn=false this.loadingBtn=false
}); });
} }
} }
} }
} }
}); });
}, },
// //
confirmSubmit(){ confirmSubmit(){
this.$refs["baseInfo"].validate(valid => { this.$refs["baseInfo"].validate(valid => {
if (valid) { if (valid) {
let param = Object.assign({},this.baseInfo); let param = Object.assign({},this.baseInfo);
param.intoDate = this.formatDateTime(this.baseInfo.intoDate) param.intoDate = this.formatDateTime(this.baseInfo.intoDate)
param.totalAmount=0 param.totalAmount=0
param.totalNum=0 param.totalNum=0
param.status=2 param.status=2
param.imsIntoInventoryDetailAddList = [] param.imsIntoInventoryDetailAddList = []
this.noMaterial = false; this.noMaterial = false;
if(this.materialList.length>0){ if(this.materialList.length>0){
this.materialList.forEach(item=>{ this.materialList.forEach(item=>{
this.$set(item,"purNum",Number(item.purNum)) this.$set(item,"purNum",Number(item.purNum))
if(item.purNum==0 || item.supplierId==null || !item.productDate|| !item.expireTime){ if(item.purNum==0 || item.supplierId==null || !item.productDate|| !item.expireTime){
this.noMaterial = true this.noMaterial = true
}else{ }else{
let obj = Object.assign({}, item) let obj = Object.assign({}, item)
obj.unitPrice = Number(obj.unitPrice)*100 obj.unitPrice = Number(obj.unitPrice)*100
obj.totalPrice = (Number(obj.unitPrice)*Number(obj.purNum)) obj.totalPrice = (Number(obj.unitPrice)*Number(obj.purNum))
param.totalAmount = param.totalAmount+obj.totalPrice; param.totalAmount = param.totalAmount+obj.totalPrice;
param.totalNum = param.totalNum+Number(obj.purNum) param.totalNum = param.totalNum+Number(obj.purNum)
param.imsIntoInventoryDetailAddList.push(obj) param.imsIntoInventoryDetailAddList.push(obj)
} }
}) })
} }
if(this.noMaterial){ if(this.noMaterial){
this.$modal.msgError("表格数据请填写完整!"); this.$modal.msgError("表格数据请填写完整!");
}else{ }else{
this.noMaterial = true; this.noMaterial = true;
if(this.materialList.length>0){ if(this.materialList.length>0){
this.noMaterial = false; this.noMaterial = false;
} }
console.log(param) console.log(param)
if(this.noMaterial){ if(this.noMaterial){
this.$modal.msgError("请添加货品!"); this.$modal.msgError("请添加货品!");
@ -646,36 +648,36 @@ export default {
editWarehouseInApi(param).then((response) => { editWarehouseInApi(param).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.loadingBtn=false this.loadingBtn=false
this.jumpList() this.jumpList()
}).catch(() => { }).catch(() => {
this.loadingBtn=false this.loadingBtn=false
}); });
} else { } else {
addWarehouseInApi(param).then((response) => { addWarehouseInApi(param).then((response) => {
this.$modal.msgSuccess("保存成功"); this.$modal.msgSuccess("保存成功");
this.loadingBtn=false this.loadingBtn=false
this.jumpList() this.jumpList()
}).catch(() => { }).catch(() => {
this.loadingBtn=false this.loadingBtn=false
}); });
} }
} }
} }
} }
}); });
}, },
// //
importPurchaseOrder(){ importPurchaseOrder(){
if(this.baseInfo.areaId!=undefined&&this.baseInfo.warehouseId!=undefined){ if(this.baseInfo.areaId!=undefined&&this.baseInfo.warehouseId!=undefined){
this.openImportDialog=true this.openImportDialog=true
this.resetQuery2() this.resetQuery2()
// setTimeout(()=>{ // setTimeout(()=>{
// this.$refs.multipleTable2.clearSelection() // this.$refs.multipleTable2.clearSelection()
// },300) // },300)
}else{ }else{
this.$modal.msgError("请先选择区域、仓库"); this.$modal.msgError("请先选择区域、仓库");
} }
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery2() { handleQuery2() {
@ -683,10 +685,10 @@ export default {
this.getList2(); this.getList2();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery2() { resetQuery2() {
this.queryParams2 = { this.queryParams2 = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
} }
this.resetForm("queryForm2"); this.resetForm("queryForm2");
this.handleQuery2(); this.handleQuery2();
@ -699,64 +701,74 @@ export default {
"pageNum": this.queryParams2.pageNum, "pageNum": this.queryParams2.pageNum,
"orderGoodsCode": this.queryParams2.orderGoodsCode, "orderGoodsCode": this.queryParams2.orderGoodsCode,
"orderStatus":3, "orderStatus":3,
"isInspect":0, "isInspect":0,
"ifAllInto":2, "ifAllInto":2,
"areaId": this.baseInfo.areaId, "areaId": this.baseInfo.areaId,
"warehouseId": this.baseInfo.warehouseId, "warehouseId": this.baseInfo.warehouseId,
"supplierId": this.baseInfo.deliverySupplierId, "supplierId": this.baseInfo.deliverySupplierId,
} }
purchaseOrderPageApi(param).then(response => { purchaseOrderPageApi(param).then(response => {
this.tableListData2 = response.rows; this.tableListData2 = response.rows;
this.total2 = Number(response.total); this.total2 = Number(response.total);
this.loading2 = false; this.loading2 = false;
}); });
}, },
confirmImport(row){ confirmImport(row){
console.log(row) console.log(row)
this.importRow = row; this.importRow = row;
let param = { let param = {
orderGoodsId:this.importRow.orderGoodsId orderGoodsId:this.importRow.orderGoodsId
} }
getPurchaseOrderInfoApi(param).then((response) => { getPurchaseOrderInfoApi(param).then((response) => {
this.materialDetailsData = response.data.orderGoodsDetailList||[]; this.materialDetailsData = response.data.orderGoodsDetailList||[];
this.$modal.confirm('是否确认导入采购订单?').then(()=>{ this.$modal.confirm('是否确认导入采购订单?').then(()=>{
if(this.materialDetailsData.length>0){ if(this.materialDetailsData.length>0){
this.materialList = this.materialDetailsData; this.materialList = this.materialDetailsData;
this.materialList.forEach(item=>{ this.materialList.forEach(item=>{
this.$set(item,"unitPrice",Number(item.singlePrice)/100) this.$set(item,"unitPrice",Number(item.singlePrice)/100)
this.$set(item,"supplierId",this.importRow.supplierId) this.$set(item,"supplierId",this.importRow.supplierId)
this.$set(item, "productDate", this.formatDate(new Date()));
this.$set(item, "expireTime", this.formatDate(new Date()));
if(item.intoNum&&item.intoNum>0){ if(item.intoNum&&item.intoNum>0){
this.$set(item,"purNum",Number(item.totalQualifiedNum)-Number(item.intoNum)) this.$set(item,"purNum",Number(item.totalQualifiedNum)-Number(item.intoNum))
}else{ }else{
this.$set(item,"purNum",Number(item.totalQualifiedNum)) this.$set(item,"purNum",Number(item.totalQualifiedNum))
} }
}) });
this.baseInfo.relateOrderGoodsId = this.importRow.orderGoodsCode; this.baseInfo.relateOrderGoodsId = this.importRow.orderGoodsCode;
this.$set(this.baseInfo,"remark","导入采购订单") this.$set(this.baseInfo,"remark","导入采购订单")
setTimeout(()=>{ setTimeout(()=>{
this.openImportDialog=false this.openImportDialog=false
},500) },500)
}else{ }else{
this.$modal.msgError("采购订单明细无货品!"); this.$modal.msgError("采购订单明细无货品!");
} }
}).catch(() => {}); }).catch(() => {});
}); });
}, },
patternValue(row){ patternValue(row){
row.purNum = row.purNum.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1') row.purNum = row.purNum.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1')
if (row.purNum.split(".").length > 2) {
row.purNum = 0;
return
}
if (row.purNum.split(".")[1].length > 2) {
row.purNum = row.purNum.substr(0, row.purNum.length - 1);
return
}
if(row.intoNum&&row.intoNum>0){ if(row.intoNum&&row.intoNum>0){
setTimeout(()=>{ setTimeout(()=>{
if(Number(row.purNum)>(Number(row.totalQualifiedNum)-Number(row.intoNum))){ if(Number(row.purNum)>(Number(row.totalQualifiedNum)-Number(row.intoNum))){
row.purNum = Number(row.totalQualifiedNum)-Number(row.intoNum) row.purNum = Number(row.totalQualifiedNum)-Number(row.intoNum)
} }
},500) },500)
}else{ }else{
setTimeout(()=>{ setTimeout(()=>{
if(Number(row.purNum)>Number(row.totalQualifiedNum)){ if(Number(row.purNum)>Number(row.totalQualifiedNum)){
row.purNum = Number(row.totalQualifiedNum) row.purNum = Number(row.totalQualifiedNum)
} }
},500) },500)
} }
}, },
// //
formatDate(date) { formatDate(date) {
@ -778,7 +790,7 @@ export default {
const minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes() const minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
const seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds() const seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
} }
} }
}; };
</script> </script>
@ -820,10 +832,10 @@ export default {
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
} }
.dish-name:hover{ .dish-name:hover{
background-color:rgba(0, 0, 0, 0.1); background-color:rgba(0, 0, 0, 0.1);
color: #4b80fd; color: #4b80fd;
} }
.dialog-center{ .dialog-center{
width: 10%; width: 10%;
@ -875,4 +887,4 @@ export default {
border: 1px solid #fff; border: 1px solid #fff;
cursor: pointer; cursor: pointer;
} }
</style> </style>