问题修改
This commit is contained in:
parent
c1272fede2
commit
9a27419fb3
@ -17,6 +17,7 @@ import com.chanko.yunxi.mes.module.heli.dal.mysql.storagemat.StorageMatMapper;
|
||||
import com.chanko.yunxi.mes.module.heli.service.storagelog.StorageLogService;
|
||||
import com.chanko.yunxi.mes.module.heli.service.storagemat.StorageMatService;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -118,6 +119,7 @@ public class StorageController {
|
||||
}
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "更新入/出库")
|
||||
@Transactional
|
||||
@PreAuthorize("@ss.hasPermission('heli:storage:update')")
|
||||
public CommonResult<Boolean> updateStorageStatus(@Valid @RequestBody StorageSaveReqVO updateReqVO) {
|
||||
|
||||
@ -195,6 +197,7 @@ public class StorageController {
|
||||
wrapper.eq(StorageInventoryDO::getDeleted,0);
|
||||
StorageInventoryDO storageInventoryDO = storageInventoryMapper.selectOne(wrapper);
|
||||
if (ObjectUtil.isNotEmpty(storageInventoryDO)){
|
||||
if (storageInventoryDO.getYardAmount().compareTo(storageMatDO.getStorageOkQty()) < 0) CommonResult.error(400,"库存数量不足,请确认");
|
||||
storageInventoryDO.setYardAmount(storageInventoryDO.getYardAmount().subtract(storageMatDO.getStorageOkQty()));
|
||||
}
|
||||
storageInventoryMapper.insertOrUpdate(storageInventoryDO);
|
||||
|
@ -111,6 +111,7 @@ public interface StorageMatMapper extends BaseMapperX<StorageMatDO> {
|
||||
query.selectAll(StorageMatDO.class)
|
||||
.select("o.project_name as projectName ,l.name as matName ,l.material_type as matType,l.spec as matSpec,d.label as matUnit")
|
||||
.select("w.price as unitPrice,ROUND(COALESCE(t.storage_ok_qty * w.price, 0), 1) AS totalPrice")
|
||||
.select("l.code as matCode")
|
||||
.leftJoin(MaterialDO.class,"l",MaterialDO::getId,StorageMatDO::getMatId)
|
||||
.leftJoin(DictDataDO.class,"d",DictDataDO::getValue, MaterialDO::getUnit)
|
||||
.leftJoin("wms_storage_inventory w on t.wh_id=w.wh_id and t.rg_id=w.rg_id and t.pn_id=w.pn_id and t.mat_id=w.material_id and w.tenant_id=2 and w.deleted=0")
|
||||
|
@ -1561,6 +1561,8 @@ type="textarea" v-model="formData.activeOpinion" placeholder="请输入打回原
|
||||
}
|
||||
}
|
||||
getUserList(formData.value.businessDeptId);
|
||||
saveDisabled.value = false
|
||||
submitDisabled.value = false
|
||||
// }
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
@ -1695,8 +1697,6 @@ type="textarea" v-model="formData.activeOpinion" placeholder="请输入打回原
|
||||
if (sumbefore.value == 0) {
|
||||
await reload()
|
||||
}
|
||||
saveDisabled.value = false
|
||||
submitDisabled.value = false
|
||||
}
|
||||
} catch (e) {
|
||||
saveDisabled.value = false
|
||||
|
@ -280,7 +280,6 @@ const openReport = () => {
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
debugger
|
||||
const route = useRoute();
|
||||
|
||||
if(route){
|
||||
|
@ -384,9 +384,10 @@ link type="primary" size="small" :disabled="ctrView || ctrDelete"
|
||||
<table class="print-table">
|
||||
<colgroup>
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 15%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 15%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
@ -398,6 +399,7 @@ link type="primary" size="small" :disabled="ctrView || ctrDelete"
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th>物料号</th>
|
||||
<th>零件名称</th>
|
||||
<th>规格</th>
|
||||
<th>单位</th>
|
||||
@ -411,6 +413,7 @@ link type="primary" size="small" :disabled="ctrView || ctrDelete"
|
||||
<tbody>
|
||||
<tr v-for="(item, index) in 17" :key="index">
|
||||
<td>{{ index + 1 }}</td>
|
||||
<td>{{ printData.storageMatDOList[index]?.matCode || '' }}</td>
|
||||
<td>{{ printData.storageMatDOList[index]?.matName ? limitTo20Chars(printData.storageMatDOList[index].matName) : '' }}</td>
|
||||
<td>{{ printData.storageMatDOList[index]?.mtSpec || '' }}</td>
|
||||
<td>{{ printData.storageMatDOList[index]?.matUnit || '' }}</td>
|
||||
@ -481,6 +484,7 @@ import projects from './subproject.vue'
|
||||
import {Search} from "@element-plus/icons-vue";
|
||||
import purchaseorderDialog from '@/views/heli/outsourcestock/purchaseorderDialog.vue'
|
||||
import * as StorageinApi from "@/api/heli/storagein";
|
||||
import * as storageInventoryApi from "@/api/heli/storageinventory";
|
||||
|
||||
const reload: any = inject('reload')
|
||||
|
||||
@ -532,7 +536,10 @@ const subFormRules = reactive({
|
||||
price: [{ required: true, message: '入库价格不能为空', trigger: 'blur' }]
|
||||
|
||||
})
|
||||
|
||||
const queryParams = reactive({
|
||||
materialId: undefined,
|
||||
whId: undefined,
|
||||
})
|
||||
const matOpenFormRef = ref()
|
||||
const proOpenFormRef = ref()
|
||||
|
||||
@ -702,10 +709,11 @@ const getList = async (arrMat) => {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (formData.value.headerId){
|
||||
if (formData.value.headerId!=null &&formData.value.headerId!=undefined){
|
||||
noList.value = await PurchaseordernodetailApi.getPurchaseOrderNoDetailById(formData.value.headerId);
|
||||
}
|
||||
arrMat.forEach((row) => {
|
||||
queryParams.whId=formData.value.whId;
|
||||
for (const row of arrMat) {
|
||||
if (
|
||||
formData.value.matItemDOList.filter(
|
||||
(item) =>
|
||||
@ -717,28 +725,34 @@ const getList = async (arrMat) => {
|
||||
) {
|
||||
row.matId = row.id
|
||||
// if (rgList.value.length==1){
|
||||
row.rgId =rgList.value[0].id
|
||||
// row.rgId =rgList.value[0].id
|
||||
// }else {
|
||||
// row.rgId =''
|
||||
// }
|
||||
queryParams.materialId=row.matId;
|
||||
var newVar = await storageInventoryApi.getById(queryParams);
|
||||
if (newVar){
|
||||
row.rgId = newVar.rgId;
|
||||
row.pnId = newVar.pnId;
|
||||
}else {
|
||||
formData.value.rgId = '';
|
||||
formData.value.pnId = '';
|
||||
}
|
||||
row.pnlist = ref([])
|
||||
row.pnlist = pnList.value.filter((pn) => pn.rg_id == row.rgId)
|
||||
|
||||
// if (row.pnlist.length == 1) {
|
||||
row.pnId = row.pnlist[0].id
|
||||
// row.pnId = row.pnlist[0].id
|
||||
// }else
|
||||
if (pnList.value.length == 0) {
|
||||
flag=false
|
||||
}
|
||||
if (noList.value){
|
||||
console.log(noList.value)
|
||||
if (noList.value.length!=0){
|
||||
var filter = noList.value.filter((no)=>no.materialId==row.matId);
|
||||
console.log(filter)
|
||||
console.log(filter.unitPrice)
|
||||
console.log(filter.purchaseAmount)
|
||||
row.price=filter[0].unitPrice
|
||||
row.storageOkQty=filter[0].purchaseAmount
|
||||
console.log(row)
|
||||
if (filter){
|
||||
row.price=filter[0].unitPrice
|
||||
row.storageOkQty=filter[0].purchaseAmount
|
||||
}
|
||||
}else {
|
||||
row.price=''
|
||||
}
|
||||
@ -746,7 +760,7 @@ const getList = async (arrMat) => {
|
||||
formData.value.matItemDOList.push(row)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
if (!flag){
|
||||
message.error("该"+whName+"没有配置入库库位,请确认!")
|
||||
}
|
||||
|
@ -448,7 +448,7 @@ const formData = ref({
|
||||
stockInType: 1,
|
||||
projectSubName:undefined,
|
||||
materialReceiver:undefined,
|
||||
pickmode:undefined,
|
||||
pickmode:2,
|
||||
pickcar:undefined,
|
||||
projectNo:undefined,
|
||||
stockOutType: undefined,
|
||||
@ -585,7 +585,7 @@ const handleStockType = async (typeid) => {
|
||||
show.value=false
|
||||
// 当 typeid 不等于 5 时,移除验证规则
|
||||
formData.value.projectSubName=null
|
||||
formData.value.pickmode=null
|
||||
// formData.value.pickmode=null
|
||||
formData.value.pickcar=null
|
||||
delete formRules.projectSubName
|
||||
delete formRules.pickmode
|
||||
@ -655,7 +655,7 @@ const handleStatus = async (num) => {
|
||||
} catch (e) {
|
||||
return
|
||||
}
|
||||
var isZero = false;;
|
||||
var isZero = false;
|
||||
var repeatItem = []
|
||||
formData.value.matItemDOList.forEach(item => {
|
||||
if(item.storageOkQty<=0){
|
||||
@ -684,18 +684,22 @@ const handleStatus = async (num) => {
|
||||
return
|
||||
}
|
||||
//获取最新库存信息
|
||||
const matCurrentData = await StorageMatApi.getStorageMatList(0)
|
||||
// const matCurrentData = await StorageMatApi.getStorageMatList(0)
|
||||
var hasRestNum = true
|
||||
formData.value.matItemDOList.forEach((rest) => {
|
||||
if (
|
||||
matCurrentData.find(
|
||||
(mat) =>
|
||||
mat.matId == rest.matId &&
|
||||
mat.pnId == rest.pnId &&
|
||||
mat.matRest < Number(rest.storageOkQty)
|
||||
) !== undefined ||
|
||||
rest.storageOkQty.length == 0
|
||||
) {
|
||||
// if (
|
||||
// matCurrentData.find(
|
||||
// (mat) =>
|
||||
// mat.matId == rest.matId &&
|
||||
// mat.pnId == rest.pnId &&
|
||||
// mat.matRest < Number(rest.storageOkQty)
|
||||
// ) !== undefined ||
|
||||
// rest.storageOkQty.length == 0
|
||||
// )
|
||||
console.log(rest.storageOkQty)
|
||||
console.log(rest.matRest)
|
||||
if (Number(rest.storageOkQty)>Number(rest.matRest))
|
||||
{
|
||||
hasRestNum = false
|
||||
}
|
||||
})
|
||||
@ -1220,6 +1224,7 @@ onMounted(async () => {
|
||||
//获取状态为启用的物料信息
|
||||
await getMatList('')
|
||||
|
||||
|
||||
// 获取当前最新库存信息
|
||||
// matLastData.value = await StorageMatApi.getStorageMatList(0)
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
<!-- 分页 -->
|
||||
<Pagination :total="total" v-model:page="queryReqVo.pageNo" v-model:limit="queryReqVo.pageSize" @pagination="getList()" />
|
||||
</el-card>
|
||||
<template #footer>
|
||||
<template class="dialog-footer-center">
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
@ -153,3 +153,12 @@ const submitForm = async () => {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.dialog-footer-center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 10px;
|
||||
gap: 10px;
|
||||
|
||||
}
|
||||
</style>
|
||||
|
@ -97,9 +97,10 @@
|
||||
<table class="print-table">
|
||||
<colgroup>
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 15%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 15%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
<col style="width: 10%;" />
|
||||
@ -111,6 +112,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th>物料号</th>
|
||||
<th>零件名称</th>
|
||||
<th>规格</th>
|
||||
<th>单位</th>
|
||||
@ -124,6 +126,7 @@
|
||||
<tbody>
|
||||
<tr v-for="(item, index) in 17" :key="index">
|
||||
<td>{{ index + 1 }}</td>
|
||||
<td>{{ printData.storageInDetailDOList[index]?.materialCode || '' }}</td>
|
||||
<td>{{ printData.storageInDetailDOList[index]?.boomName ? limitTo20Chars(printData.storageInDetailDOList[index].boomName) : '' }}</td>
|
||||
<td>{{ printData.storageInDetailDOList[index]?.boomSpec || '' }}</td>
|
||||
<td>{{ printData.storageInDetailDOList[index]?.unit || '' }}</td>
|
||||
|
@ -0,0 +1,263 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="150px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="物料图片" prop="logo">
|
||||
<UploadImg v-model="formData.logo" :showBtnText="false" :showDelete="false"/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="物料编码" prop="code">-->
|
||||
<!-- <el-input disabled v-model="formData.code" placeholder="系统自动生成" class="!w-250px" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="物料名称" prop="name">-->
|
||||
<!-- <el-input v-model="formData.name" placeholder="请输入物料名称" class="!w-250px" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="物料类型" prop="materialType">-->
|
||||
<!-- <el-select v-model="formData.materialType" clearable placeholder="请选择物料类型" class="!w-250px">-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="dict in getStrDictOptions(DICT_TYPE.HELI_MATERIAL_TYPE)"-->
|
||||
<!-- :key="dict.value"-->
|
||||
<!-- :label="dict.label"-->
|
||||
<!-- :value="dict.value"-->
|
||||
<!-- />-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="系统单位" prop="unit">-->
|
||||
<!-- <el-select v-model="formData.unit" clearable placeholder="请选择系统单位" class="!w-250px">-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="dict in getStrDictOptions(DICT_TYPE.HELI_MATERIAL_UNIT)"-->
|
||||
<!-- :key="dict.value"-->
|
||||
<!-- :label="dict.label"-->
|
||||
<!-- :value="dict.value"-->
|
||||
<!-- />-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="物料简称" prop="shortName">-->
|
||||
<!-- <el-input v-model="formData.shortName" placeholder="请输入物料简称" class="!w-250px" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="规格/型号" prop="spec">-->
|
||||
<!-- <el-input v-model="formData.spec" placeholder="请输入规格/型号" class="!w-250px" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="品牌" prop="brand">-->
|
||||
<!-- <el-input v-model="formData.brand" placeholder="请输入品牌" class="!w-250px" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="物料主要来源" prop="mainFrom">-->
|
||||
<!-- <el-select v-model="formData.mainFrom" clearable placeholder="请选择物料主要来源" class="!w-250px">-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="dict in getIntDictOptions(DICT_TYPE.HELI_MATERIAL_ORIGINAL)"-->
|
||||
<!-- :key="dict.value"-->
|
||||
<!-- :label="dict.label"-->
|
||||
<!-- :value="dict.value"-->
|
||||
<!-- />-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="首选供应商" prop="mainSupplierId">-->
|
||||
<!-- <el-select v-model="formData.mainSupplierId"
|
||||
placeholder="请输入首选供应商"
|
||||
:remote-method="remoteSupplierSearch"
|
||||
remote-show-suffix
|
||||
remote
|
||||
clearable
|
||||
reserve-keyword
|
||||
filterable
|
||||
:loading="supplierSelectLoading"
|
||||
class="!w-250px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in supplierSelectList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select> -->
|
||||
<!-- <SupplierSelect v-model="formData.mainSupplierId" @update:newValue="handleSelectedSupplier" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="销项/进项税率" prop="outputInputTaxRate">-->
|
||||
<!-- <el-input v-model="formData.outputInputTaxRate" placeholder="请输入销项税率/进项税率" class="!w-250px" >-->
|
||||
<!-- <template #append>%</template>-->
|
||||
<!-- </el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="备注" prop="description">-->
|
||||
<!-- <el-input type="textarea" v-model="formData.description" height="150px" class="!w-500px" show-word-limit maxlength="200"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
<!-- <el-form-item label="安全库存" prop="invSafe">-->
|
||||
<!-- <el-input v-model="formData.invSafe" placeholder="请输入安全库存" class="!w-250px" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="物料条码" prop="barcode">-->
|
||||
<!-- <el-input v-model="formData.barcode" placeholder="请输入物料条码" class="!w-250px" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="启用状态" prop="status">-->
|
||||
<!-- <el-radio-group v-model="formData.status">-->
|
||||
<!-- <el-radio-->
|
||||
<!-- v-for="dict in getIntDictOptions(DICT_TYPE.HELI_COMMON_STATUS)"-->
|
||||
<!-- :key="dict.value"-->
|
||||
<!-- :label="dict.value"-->
|
||||
<!-- >-->
|
||||
<!-- {{ dict.label }}-->
|
||||
<!-- </el-radio>-->
|
||||
<!-- </el-radio-group>-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<!-- <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>-->
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as MaterialApi from '@/api/heli/material'
|
||||
import {getSupplierPage} from "@/api/heli/supplier";
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('预览') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
brand: undefined,
|
||||
spec: undefined,
|
||||
sizeInfo: undefined,
|
||||
traceType: undefined,
|
||||
dftStoreWh: undefined,
|
||||
dftStoreRg: undefined,
|
||||
dftStorePn: undefined,
|
||||
dftRoute: undefined,
|
||||
description: undefined,
|
||||
status: 1,
|
||||
shortName: undefined,
|
||||
materialType: undefined,
|
||||
compositionId: undefined,
|
||||
outputInputTaxRate: undefined,
|
||||
mainSupplierId: undefined,
|
||||
mainFrom: undefined,
|
||||
unit: undefined,
|
||||
invSafe: undefined,
|
||||
invUpperLimit: undefined,
|
||||
invLowerLimit: undefined,
|
||||
barcode: undefined,
|
||||
virtualPart: undefined,
|
||||
logo: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
name: [{ required: true, message: '物料名称不能为空', trigger: 'blur' }],
|
||||
status: [{ required: true, message: '启用状态不能为空', trigger: 'blur' }],
|
||||
materialType: [{ required: true, message: '物料类型不能为空', trigger: 'change' }],
|
||||
unit: [{ required: true, message: '系统单位不能为空', trigger: 'change' }],
|
||||
})
|
||||
|
||||
const formRef = ref() // 表单 Ref
|
||||
const supplierList = ref<any[]>([]) //
|
||||
const supplierSelectList = ref<any[]>([])
|
||||
const supplierSelectLoading = ref(false);
|
||||
|
||||
const remoteSupplierSearch = (query: string) => {
|
||||
if (query) {
|
||||
supplierSelectLoading.value = true
|
||||
setTimeout(() => {
|
||||
supplierSelectLoading.value = false
|
||||
supplierSelectList.value = supplierList.value.filter((item) => {
|
||||
return item.name.toLowerCase().includes(query.toLowerCase())
|
||||
})
|
||||
}, 200)
|
||||
} else {
|
||||
supplierSelectList.value = supplierList.value;
|
||||
}
|
||||
}
|
||||
/** 打开弹窗 */
|
||||
const open = async ( id?: number) => {
|
||||
dialogVisible.value = true
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
formLoading.value = true
|
||||
try {
|
||||
if (id) {
|
||||
formData.value = await MaterialApi.getMaterial(id)
|
||||
}
|
||||
let params = {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
status: "1"
|
||||
};
|
||||
const supplierData = await getSupplierPage(params);
|
||||
supplierList.value = supplierData.list;
|
||||
supplierSelectList.value = supplierData.list;
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as MaterialApi.MaterialVO
|
||||
if (formType.value === 'create') {
|
||||
await MaterialApi.createMaterial(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await MaterialApi.updateMaterial(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
brand: undefined,
|
||||
spec: undefined,
|
||||
sizeInfo: undefined,
|
||||
traceType: undefined,
|
||||
dftStoreWh: undefined,
|
||||
dftStoreRg: undefined,
|
||||
dftStorePn: undefined,
|
||||
dftRoute: undefined,
|
||||
description: undefined,
|
||||
status: 1,
|
||||
shortName: undefined,
|
||||
materialType: undefined,
|
||||
compositionId: undefined,
|
||||
outputInputTaxRate: undefined,
|
||||
mainSupplierId: undefined,
|
||||
mainFrom: undefined,
|
||||
unit: undefined,
|
||||
invSafe: undefined,
|
||||
invUpperLimit: undefined,
|
||||
invLowerLimit: undefined,
|
||||
barcode: undefined,
|
||||
virtualPart: undefined,
|
||||
logo: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
//接收供应商传递的数据
|
||||
const handleSelectedSupplier = (newValue: any) => {
|
||||
formData.value.mainSupplierId = newValue?.id
|
||||
}
|
||||
|
||||
</script>
|
@ -82,6 +82,16 @@ v-for="dict in pnCurrentList" :key="dict.id" :label="dict.pn_name"
|
||||
<el-table-column label="库存数量" align="center" prop="storageOkQty" min-width="120"/>
|
||||
<el-table-column label="金额(元)" align="center" prop="sumKcMoney" min-width="120"/>
|
||||
<el-table-column label="库存单位" align="center" prop="matUnit" min-width="120"/>
|
||||
<el-table-column label="操作" align="center" fixed="right" min-width="100">
|
||||
<template #header>
|
||||
<span style="margin-right: 30%">操作</span>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="openForm( scope.row.materialId)">
|
||||
预览
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
@ -89,12 +99,13 @@ v-for="dict in pnCurrentList" :key="dict.id" :label="dict.pn_name"
|
||||
@pagination="getList" />
|
||||
</ContentWrap>
|
||||
</el-card>
|
||||
<printDialog ref="printref" :minAmount="minAmount" :formData="formData" />
|
||||
<MaterialForm ref="formRef" />
|
||||
|
||||
<printDialog ref="printref" :minAmount="minAmount" :formData="formData" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import download from '@/utils/download'
|
||||
import * as StorageLogApi from '@/api/heli/storagelog'
|
||||
|
||||
import * as StorageInventoryApi from '@/api/heli/storageinventory'
|
||||
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
@ -103,6 +114,7 @@ import * as WarehouseApi from '@/api/heli/warehouse'
|
||||
import * as RgApi from '@/api/heli/rg'
|
||||
import * as PnApi from '@/api/heli/pn'
|
||||
import printDialog from './printDialog.vue'
|
||||
import MaterialForm from "./MaterialForm.vue";
|
||||
defineOptions({ name: 'StorageLog' })
|
||||
const printref = ref()
|
||||
const whList = ref([])
|
||||
@ -131,6 +143,11 @@ const queryParams = reactive({
|
||||
headerNo: undefined,
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = ( id?: number) => {
|
||||
formRef.value.open( id)
|
||||
}
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user