代码提交

master
taozi 4 months ago
parent 70f63b7751
commit fc8ba057bb
  1. 18
      src/api/firstOrder/inbound.js
  2. 477
      src/views/firstOrder/components/inDialog copy.vue
  3. 385
      src/views/firstOrder/components/inDialog.vue
  4. 2
      src/views/firstOrder/components/purchaseDialog.vue
  5. 56
      src/views/firstOrder/inbound.vue

@ -51,4 +51,22 @@ export const getMaterialList = () => {
cryptoToken: false,
cryptoData: false
})
}
export const getDetailList = (id) => {
return request({
url: '/smartpark/material/detail',
method: 'get',
params: id ,
cryptoToken: false,
cryptoData: false
})
}
export const submitData = (formData) => {
return request({
url: '/smartpark/onePutStorage/submit',
method: 'post',
data: formData ,
cryptoToken: false,
cryptoData: false
})
}

@ -0,0 +1,477 @@
<template>
<div>
<el-dialog :close-on-click-modal="false" :title="inDialogTiltle" :visible.sync="inDialogVisible"
:append-to-body="true" width="70%" @close="handleCloseDetail" fullscreen>
<!-- 基本信息 -->
<el-form :model="sizeForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic">
<div class="form-title"> 基本信息</div>
<el-row>
<el-col :span="12">
<el-form-item label="仓库名称">
<el-input v-model="sizeForm.warehouseName" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="入库单号" v-if="sizeForm.option == 1">
<el-input v-model="sizeForm.orderNo" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="入库时间">
<el-date-picker v-model="sizeForm.inDate" type="date" placeholder="选择日期" style="width: 100%;" disabled>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="事由">
<el-input v-model="sizeForm.reason" :disabled="inDialogType != 'add'"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物资类型">
<el-select v-model="sizeForm.materialType" placeholder="请选择" style="width: 100%;"
:disabled="inDialogType != 'add'">
<el-option label="耐用品" value="1"></el-option>
<el-option label="易耗品" value="2"></el-option>
</el-select>
</el-form-item>
</el-col>
<!-- <el-col :span="12">
<el-form-item label="填报人">
<el-input v-model="sizeForm.submitName" :disabled="inDialogType != 'add'"></el-input>
</el-form-item>
</el-col> -->
<!-- <el-col :span="12">
<el-form-item label="审批人">
<el-input v-model="sizeForm.applyNmae" disabled></el-input>
</el-form-item>
</el-col> -->
<el-col :span="12">
<el-form-item label="选项">
<el-radio-group v-model="sizeForm.option" @change="radioChange()" :disabled="inDialogType != 'add'">
<el-radio :label="1" :disabled="sizeForm.type == 2">批量选择</el-radio>
<el-radio :label="2">单项选择</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12" v-if="sizeForm.option == 1">
<el-form-item label="采购单名称">
<el-input v-model="sizeForm.quarterName" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<div class="form-title">{{ inDate }}</div>
<el-button type="primary" size="mini" style="margin-bottom: 18px;" @click="inTableAdd()"
v-if="!allDisabled && sizeForm.option == 2">新增</el-button>
<el-table :data="sizeForm.inTableData" border style="width: 100%">
<el-table-column prop="materialId" label="物资ID">
</el-table-column>
<el-table-column prop="materialName" label="名称" v-if="sizeForm.option == 1">
</el-table-column>
<el-table-column prop="materialName" label="名称" v-if="sizeForm.option == 2">
<!-- 通过slot-scope获取当前行数据 -->
<template slot-scope="scope">
<el-select v-model="scope.row.materialId" placeholder="请选择物资名称" style="width: 100%;"
@change="handleMaterialChange(scope.row)"
>
<el-option v-for="item in materials" :key="item.materialId" :label="item.materialName"
:value="item.materialId">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="model" label="规格">
</el-table-column>
<el-table-column prop="type" label="类别">
</el-table-column>
<el-table-column prop="unit" label="单位">
</el-table-column>
<el-table-column prop="requiredQuantity" label="计划采购数量" v-if="sizeForm.option == 1" >
<template slot-scope="scope">
{{ scope.row.requiredQuantity || 0 }}
</template>
</el-table-column>
<el-table-column prop="inboundQuantity" label="已入库数量" v-if="sizeForm.option == 1">
</el-table-column>
<!-- <el-table-column prop="str7" label="本次入库数量">
<template slot-scope="scope">
<el-input-number size="mini" v-model="scope.row.str7" :min="1" style="width: 100%;"
:disabled="(scope.row.status != 1) || (allDisabled)"></el-input-number>
</template>
</el-table-column> -->
<el-table-column prop="theInboundQuantity" label="本次入库数量">
<template slot-scope="scope">
<el-input-number size="mini" v-model="scope.row.theInboundQuantity" :min="1" style="width: 100%;"
@change="syncInboundQuantity(scope.row)"></el-input-number>
</template>
</el-table-column>
<!-- <el-table-column prop="str6" label="需求数量" >
</el-table-column> -->
<el-table-column prop="unitPrice" label="单价">
</el-table-column>
<!-- <el-table-column prop="str9" label="需求部门" width="100">
</el-table-column> -->
<!-- <el-table-column prop="status" label="入库情况" v-if="!allDisabled">
<template slot-scope="scope">
<el-button type="text" @click="putIn(scope.row)" v-if="scope.row.status == 1">入库</el-button>
<span v-else>已入库</span>
</template>
</el-table-column> -->
</el-table>
<!-- 入库账目表格 -->
<div class="form-title">入库账目表格</div>
<el-table :data="sizeForm.inTableData" border style="width: 100%">
<el-table-column prop="date" label="当前库存">
<el-table-column prop="materialId" label="物资ID">
</el-table-column>
<el-table-column prop="materialName" label="名称">
</el-table-column>
<el-table-column prop="model" label="规格">
</el-table-column>
<el-table-column prop="type" label="类别">
</el-table-column>
<el-table-column prop="unit" label="单位">
</el-table-column>
<el-table-column prop="inboundQuantity" label="数量">
</el-table-column>
<el-table-column prop="unitPrice" label="单价">
</el-table-column>
</el-table-column>
<el-table-column prop="date" label="入库信息">
<el-table-column prop="theInboundQuantity" label="数量">
</el-table-column>
<el-table-column prop="unitPrice" label="单价">
</el-table-column>
</el-table-column>
<el-table-column prop="date" label="入库后库存">
<el-table-column label="数量">
<template slot-scope="scope">
{{ Number(scope.row.inboundQuantity || 0) + Number(scope.row.theInboundQuantity || 0) }}
</template>
</el-table-column>
<el-table-column prop="unitPrice" label="单价">
</el-table-column>
</el-table-column>
<el-table-column prop="date" label="入库信息">
<el-table-column label="入库人">
<template slot-scope="scope">
{{ scope.row.userInfoVO ? scope.row.userInfoVO.name : (sizeForm.submitName || '') }}
</template>
</el-table-column>
<el-table-column prop="inDate" label="入库时间" width="150">
<template slot-scope="scope">
{{ inDate }}
</template>
</el-table-column>
</el-table-column>
</el-table>
</el-form>
<span slot="footer" class="dialog-footer" v-if="!allDisabled">
<el-button @click="handleCloseDetail()"> </el-button>
<el-button type="primary" @click="save()">暂存</el-button>
<el-button type="primary" @click="sumbit()">提交</el-button>
</span>
</el-dialog>
<!-- 批量出库 选择 -->
<el-dialog :close-on-click-modal="false" title="选择数据来源" :visible.sync="inBatchDialogVisible" :append-to-body="true"
width="40%" @close="handleBatchClose" @open="getBatchOptions">
<el-select v-model="batchType" placeholder="请选择数据来源" style="width: 100%;">
<el-option v-for="item in batchOptions" :key="item.ids" :label="item.quarterName" :value="item.ids">
</el-option>
</el-select>
<span slot="footer" class="dialog-footer">
<el-button @click="handleBatchClose()"> </el-button>
<el-button type="primary" @click="batchSubmit()"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { getAllQuarter, getPurchasesByIds, getMaterialList, getDetailList } from "@/api/firstOrder/inbound";
export default {
props: {
repairVisible: {
type: Boolean,
default: false
},
inDialogTiltle: {
type: String,
default: ''
},
inDialogType: {
type: String,
default: ''
},
type: {
type: String,
default: ''
}
},
data() {
return {
inDialogVisible: false,
sizeForm: {
orderNo: '',//
applyNmae: '',//
submitName: '',//
warehouseName: '',//
reason: '',//
inAccountsTableData: [],//
inTableData: [],
},
inTableData: [],
inBatchDialogVisible: false,//
batchType: '',//
materialsType: '',
allDisabled: false,
userInfoVO: {
userId: "用户ID",
name: "用户名称"
}
}
},
computed: {
inDate() {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
return `${year}${month}${day}`;
}
},
mounted() {
this.inDialogVisible = this.repairVisible
if (this.inDialogType == 'add') {
this.addInit()
} else {
this.inInit()
}
if (this.inDialogType == 'details') {
this.allDisabled = true
}
this.getBatchOptions()
this.getMaterialList()
},
methods: {
syncInboundQuantity(row) {
row.theInboundQuantity = Number(row.theInboundQuantity);
},
async getBatchOptions() {
this.loading = true
try {
const res = await getAllQuarter();
this.batchOptions = res.data.result
} catch (error) {
this.$message.error("获取数据来源失败,请重试");
console.error("下拉选项请求失败:", error);
} finally {
this.loading = false;
}
},
async getMaterialList() {
this.loading = true
try {
const res = await getMaterialList();
this.materials = res.data.result
console.log(this.materials, '获99来源')
} catch (error) {
this.$message.error("获取数据来源失败,请重试");
console.error("下拉选项请求失败:", error);
} finally {
this.loading = false;
}
},
inInit() {
const randomNum = Math.floor(Math.random() * 100000000) + 1;
this.sizeForm.orderNo = String(randomNum).padStart(8, '0');//
this.sizeForm.applyNmae = '审批人一'
this.sizeForm.submitName = '填报人一'
this.sizeForm.option = 1
this.sizeForm.warehouseName = '仓库一'
this.sizeForm.reason = '入库'
this.sizeForm.materialType = '1'
this.sizeForm.inDate = new Date()//
// this.sizeForm.inTableData.push({
// str1: '000001',
// str2: '1',
// str3: '1',
// type: '1',
// unit: '1',
// str6: '11',
// str7: '22',
// str8: '3',
// str9: '',
// name: '',
// status: '1',//
// })
},
addInit() {
//
const randomNum = Math.floor(Math.random() * 100000000) + 1;
this.sizeForm.orderNo = String(randomNum).padStart(8, '0');//
this.sizeForm.inDate = new Date()//
if (this.type == '一级库') {
this.sizeForm.warehouseName = '仓库一'
}
},
handleCloseDetail() {
this.inDialogVisible = false
this.$emit('handleCloseDetail')
},
async inTableAdd() {
this.sizeForm.inTableData.push({
unit: '',
model: '',
str3: '',
str4: '',
str5: '',
str6: '',
str7: 0,
str8: '',
str9: '',
name: '',
status: '',//
materialId: '',
materialName: '',
})
},
//
putIn(row) {
row.status = 0
//
this.sizeForm.inAccountsTableData.push({
str1: "000001",
str2: "物品1",
str3: "规格1",
str4: "类别1",
str5: "单位1",
str6: "12",
str7: "3",
str8: row.str7,
str9: "3",
str10: row.str7 + 12,
str11: "3",
str12: "审批人1",
str13: "2025-04-05",
})
},
//
handleBatchClose() {
this.inBatchDialogVisible = false
},
//
async batchSubmit() {
if (!this.batchType) {
this.$message.warning("请选择数据来源")
return
}
const selectedOption = this.batchOptions.find(option => option.ids === this.batchType);
if (!selectedOption) {
this.$message.error("未找到对应的采购单信息");
return
}
this.sizeForm.quarterName = selectedOption.quarterName
this.loading = true
const res = await getPurchasesByIds(this.batchType);
console.log("res", res)
if (res.data.success) {
this.sizeForm.inTableData = res.data.result;
this.$message.success("数据获取成功");
this.inBatchDialogVisible = false;
} else {
this.$message.error(res.data.message || "获取数据失败");
}
this.loading = false;
},
//
async handleMaterialChange(row) {
console.log(row, "row",row.materialId)
if (!row.materialId) {
this.$message.warning("请选择物资名称");
console.log(1)
return
}
try {
const res = await getDetailList({
id: row.materialId
})
console.log("res1", res)
if (res.data.success) {
this.sizeForm.inTableData = res.data.result;
console.log("this.sizeForm.inTableData", this.sizeForm.inTableData)
} else {
this.$message.error(res.data.message || "获取物资信息失败");
}
} catch (error) {
this.$message.error("请求失败,请重试");
console.error("获取物资信息错误:", error);
}
},
changeName(index) {
console.log(9999, index)
this.sizeForm.inTableData.forEach((item, i) => {
if (i == index) {
item.str1 = '000001'
item.str2 = '物资1'
item.str3 = '规格1'
item.str4 = '类别1'
item.str5 = '单位1'
item.str6 = '11'
item.str7 = 22
item.str8 = '3'
item.str9 = '部门一'
item.name = '审批人'
item.status = '1'
this.$set(item, 'str7', 22)
}
})
console.log(888888, this.sizeForm.inTableData)
},
//
save() {
this.$message({
type: "success",
message: "保存成功"
});
this.handleCloseDetail()
},
//
sumbit() {
// status ==1
let flag = this.sizeForm.inTableData.some(item => item.status == 1)
if (flag) {
this.$message({
type: "warning",
message: ""
});
return false
}
this.$message({
type: "success",
message: "提交成功"
});
// this.handleCloseDetail()
},
//
radioChange(val) {
this.sizeForm.inTableData = []
if (this.sizeForm.option == 1) {
this.inBatchDialogVisible = true
}
}
}
}
</script>
<style lang="scss" scoped>
.form-title {
font-size: 16px;
font-weight: 600;
padding: 18px 0;
}
</style>

@ -1,14 +1,14 @@
<template>
<div>
<el-dialog :close-on-click-modal="false" :title="inDialogTiltle" :visible.sync="inDialogVisible"
:append-to-body="true" width="70%" @close="handleCloseDetail" fullscreen>
:append-to-body="true" width="70%" @close="handleCloseDetail" fullscreen >
<!-- 基本信息 -->
<el-form :model="sizeForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic">
<div class="form-title"> 基本信息</div>
<el-row>
<el-col :span="12">
<el-form-item label="仓库名称">
<el-input v-model="sizeForm.waNmae" :disabled="true"></el-input>
<el-input v-model="sizeForm.warehouseName" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
@ -29,10 +29,10 @@
</el-col>
<el-col :span="12">
<el-form-item label="物资类型">
<el-select v-model="sizeForm.materialType" placeholder="请选择" style="width: 100%;"
<el-select v-model="sizeForm.material_type" placeholder="请选择" style="width: 100%;"
:disabled="inDialogType != 'add'">
<el-option label="耐用品" value="1"></el-option>
<el-option label="易耗品" value="2"></el-option>
<el-option label="办公物资" value="1"></el-option>
<el-option label="其他物资" value="2"></el-option>
</el-select>
</el-form-item>
</el-col>
@ -46,10 +46,28 @@
<el-input v-model="sizeForm.applyNmae" disabled></el-input>
</el-form-item>
</el-col> -->
<!-- <el-col :span="12">
<el-table-column prop="type" label="物资类别">
<el-select v-model="scope.row.type" placeholder="请选择" style="width: 100%;"
:disabled="inDialogType != 'add'" @change="handleTypeChange(scope.row)">
<el-option label="耐用品" value="ny"></el-option>
<el-option label="易耗品" value="yh"></el-option>
</el-select>
</el-table-column>
</el-col> -->
<el-col :span="12">
<el-table-column prop="source" label="来源">
<el-select v-model="scope.row.source" placeholder="请选择" style="width: 100%;"
:disabled="inDialogType != 'add'" @change="handleTypeChange(scope.row)">
<el-option label="采购申请" value="cg"></el-option>
<el-option label="其他来源" value="qt"></el-option>
</el-select>
</el-table-column>
</el-col>
<el-col :span="12">
<el-form-item label="选项">
<el-radio-group v-model="sizeForm.option" @change="radioChange()" :disabled="inDialogType != 'add'">
<el-radio :label="1" :disabled="sizeForm.type == 2">批量选择</el-radio>
<el-radio :label="1">批量选择</el-radio>
<el-radio :label="2">单项选择</el-radio>
</el-radio-group>
</el-form-item>
@ -63,24 +81,39 @@
<div class="form-title">{{ inDate }}</div>
<el-button type="primary" size="mini" style="margin-bottom: 18px;" @click="inTableAdd()"
v-if="!allDisabled && sizeForm.option == 2">新增</el-button>
<el-table :data="sizeForm.inTableData" border style="width: 100%">
<!-- 批量选择 -->
<el-table :data="sizeForm.inTableData" border style="width: 100%" v-show="sizeForm.option == 1">
<el-table-column prop="materialId" label="物资ID">
</el-table-column>
<el-table-column prop="materialName" label="名称" v-if="sizeForm.option == 1">
</el-table-column>
<el-table-column prop="materialName" label="名称" v-if="sizeForm.option == 2">
<el-select v-model="batchType" placeholder="请选择物资名称" style="width: 100%;">
<el-option v-for="item in materials" :key="item.materialId" :label="item.materialName" :value="item.materialId">
</el-option>
</el-select>
<template slot-scope="scope">
<el-select v-model="scope.row.materialId" placeholder="请选择物资名称" style="width: 100%;"
@change="handleMaterialChange(scope.row)">
<el-option v-for="item in materials" :key="item.materialId" :label="item.materialName"
:value="item.materialId">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="model" label="规格">
</el-table-column>
<el-table-column prop="type" label="类别">
</el-table-column>
<el-table-column prop="unit" label="单位">
</el-table-column>
<el-table-column prop="type" label="类别">
<template slot-scope="scope">
<el-select v-model="scope.row.type" placeholder="请选择" style="width: 100%;"
:disabled="inDialogType != 'add'" @change="handleTypeChange(scope.row)">
<el-option label="耐用品" value="ny"></el-option>
<el-option label="易耗品" value="yh"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="requiredQuantity" label="计划采购数量" v-if="sizeForm.option == 1">
<template slot-scope="scope">
{{ scope.row.requiredQuantity || 0 }}
</template>
</el-table-column>
<el-table-column prop="inboundQuantity" label="已入库数量" v-if="sizeForm.option == 1">
</el-table-column>
@ -89,7 +122,7 @@
<el-input-number size="mini" v-model="scope.row.str7" :min="1" style="width: 100%;"
:disabled="(scope.row.status != 1) || (allDisabled)"></el-input-number>
</template>
</el-table-column> -->
</el-table-column> -->
<el-table-column prop="theInboundQuantity" label="本次入库数量">
<template slot-scope="scope">
<el-input-number size="mini" v-model="scope.row.theInboundQuantity" :min="1" style="width: 100%;"
@ -109,29 +142,155 @@
</template>
</el-table-column> -->
</el-table>
<!-- 单项选择 -->
<el-table :data="sizeForm.singleData" border style="width: 100%" v-show="sizeForm.option == 2">
<el-table-column prop="materialId" label="物资ID">
</el-table-column>
<el-table-column prop="materialName" label="名称" v-if="sizeForm.option == 2">
<template slot-scope="scope">
<el-select v-model="scope.row.materialId" placeholder="请选择物资名称" style="width: 100%;"
@change="handleMaterialChange(scope.row)">
<el-option v-for="item in materials" :key="item.materialId" :label="item.materialName"
:value="item.materialId">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="model" label="规格">
</el-table-column>
<el-table-column prop="type" label="物资类型">
<template slot-scope="scope">
<el-select v-model="scope.row.type" placeholder="请选择" style="width: 100%;"
:disabled="inDialogType != 'add'" @change="handleTypeChange(scope.row)">
<el-option label="耐用品" value="ny"></el-option>
<el-option label="易耗品" value="yh"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="unit" label="单位">
<template slot-scope="scope">
{{ scope.row.unit || '' }}
</template>
</el-table-column>
<el-table-column prop="requiredQuantity" label="计划采购数量" v-if="sizeForm.option == 1">
<template slot-scope="scope">
{{ scope.row.requiredQuantity || 0 }}
</template>
</el-table-column>
<el-table-column prop="inboundQuantity" label="已入库数量" v-if="sizeForm.option == 1">
</el-table-column>
<!-- <el-table-column prop="str7" label="本次入库数量">
<template slot-scope="scope">
<el-input-number size="mini" v-model="scope.row.str7" :min="1" style="width: 100%;"
:disabled="(scope.row.status != 1) || (allDisabled)"></el-input-number>
</template>
</el-table-column> -->
<el-table-column prop="theInboundQuantity" label="本次入库数量">
<template slot-scope="scope">
<el-input-number size="mini" v-model="scope.row.theInboundQuantity" :min="1" style="width: 100%;"
@change="syncInboundQuantity(scope.row)"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="unitPrice" label="单价">
<template slot-scope="scope">
<el-input-number size="mini" v-model="scope.row.unitPrice" :min="0" style="width: 100%;"
@change="syncUnitPrice(scope.row)"></el-input-number>
</template>
</el-table-column>
<el-form-item label="物资类型">
<el-select v-model="sizeForm.material_type" placeholder="请选择" style="width: 100%;"
:disabled="inDialogType != 'add'">
<el-option label="耐用品" value="1"></el-option>
<el-option label="易耗品" value="2"></el-option>
</el-select>
</el-form-item>
</el-table>
<!-- 入库账目表格 -->
<div class="form-title">入库账目表格</div>
<el-table :data="sizeForm.inTableData" border style="width: 100%">
<!-- 批量选择 -->
<el-table :data="sizeForm.inTableData" border style="width: 100%" v-show="sizeForm.option == 1">
<el-table-column prop="date" label="当前库存">
<el-table-column prop="materialId" label="物资ID">
</el-table-column>
<el-table-column prop="materialName" label="名称" v-if=>
<el-table-column prop="materialName" label="名称">
</el-table-column>
<el-table-column prop="model" label="规格">
</el-table-column>
<!-- <el-table-column prop="type" label="类别">
</el-table-column> -->
<el-table-column prop="unit" label="单位">
</el-table-column>
<el-table-column prop="type" label="类别">
<template slot-scope="scope">
{{ scope.row.type === "ny" ? "耐用品" : (scope.row.type === "yh" ? "易耗品" : "") }}
</template>
</el-table-column>
<el-table-column prop="inboundQuantity" label="数量">
</el-table-column>
<el-table-column prop="unitPrice" label="单价">
</el-table-column>
</el-table-column>
<el-table-column prop="date" label="入库信息">
<el-table-column prop="theInboundQuantity" label="数量">
</el-table-column>
<el-table-column prop="unitPrice" label="单价">
</el-table-column>
</el-table-column>
<el-table-column prop="date" label="入库后库存">
<el-table-column label="数量">
<template slot-scope="scope">
{{ Number(scope.row.inboundQuantity || 0) + Number(scope.row.theInboundQuantity || 0) }}
</template>
</el-table-column>
<el-table-column prop="unitPrice" label="单价">
</el-table-column>
</el-table-column>
<el-table-column prop="date" label="入库信息">
<el-table-column label="入库人">
<template slot-scope="scope">
{{ scope.row.userInfoVO ? scope.row.userInfoVO.name : (sizeForm.submitName || '') }}
</template>
</el-table-column>
<el-table-column prop="inDate" label="入库时间" width="150">
<template slot-scope="scope">
{{ inDate }}
</template>
</el-table-column>
</el-table-column>
</el-table>
<!-- 单项选择 -->
<el-table :data="sizeForm.singleData" border style="width: 100%" v-show="sizeForm.option == 2">
<el-table-column prop="date" label="当前库存">
<el-table-column prop="materialId" label="物资ID">
</el-table-column>
<el-table-column prop="materialName" label="名称">
</el-table-column>
<el-table-column prop="model" label="规格">
</el-table-column>
<el-table-column prop="type" label="物资类别">
<template slot-scope="scope">
{{ scope.row.type === "1" ? "耐用品" : (scope.row.type === "2" ? "易耗品" : "") }}
</template>
</el-table-column>
<el-table-column prop="unit" label="单位">
</el-table-column>
<el-table-column prop="inboundQuantity" label="数量">
</el-table-column>
<el-table-column prop="unitPrice" label="单价">
<template slot-scope="scope">
{{ scope.row.unitPrice || 0 }}
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="date" label="入库信息">
<el-table-column prop="theInboundQuantity" label="数量">
</el-table-column>
<el-table-column prop="unitPrice" label="单价">
<template slot-scope="scope">
{{ scope.row.unitPrice || 0 }}
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="date" label="入库后库存">
@ -141,6 +300,9 @@
</template>
</el-table-column>
<el-table-column prop="unitPrice" label="单价">
<template slot-scope="scope">
{{ scope.row.unitPrice || 0 }}
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="date" label="入库信息">
@ -153,7 +315,7 @@
<template slot-scope="scope">
{{ inDate }}
</template>
</el-table-column>
</el-table-column>
</el-table-column>
@ -162,7 +324,7 @@
<span slot="footer" class="dialog-footer" v-if="!allDisabled">
<el-button @click="handleCloseDetail()"> </el-button>
<el-button type="primary" @click="save()">暂存</el-button>
<el-button type="primary" @click="sumbit()">提交</el-button>
<el-button type="primary" @click="submit()">提交</el-button>
</span>
</el-dialog>
@ -181,7 +343,7 @@
</div>
</template>
<script>
import { getAllQuarter, getPurchasesByIds, getMaterialList } from "@/api/firstOrder/inbound";
import { getAllQuarter, getPurchasesByIds, getMaterialList, getDetailList, submitData } from "@/api/firstOrder/inbound";
export default {
props: {
repairVisible: {
@ -206,16 +368,20 @@ export default {
inDialogVisible: false,
sizeForm: {
orderNo: '',//
applyNmae: '',//
applyNmae: 'user1',//
submitName: '',//
waNmae: '',//
warehouseName: '',//
reason: '',//
inAccountsTableData: [],//
inTableData: [],
singleData: [], //
option: 1,//
},
inTableData: [],
// singleData: {},
inBatchDialogVisible: false,//
batchType: '',//
materialsType: '',
allDisabled: false,
userInfoVO: {
userId: "用户ID",
@ -234,6 +400,7 @@ export default {
},
mounted() {
this.inDialogVisible = this.repairVisible
if (this.inDialogType == 'add') {
this.addInit()
} else {
@ -246,11 +413,19 @@ export default {
this.getMaterialList()
},
methods: {
//
handleTypeChange(row) {
console.log("类别已更改:", row.type);
},
syncInboundQuantity(row) {
//
row.theInboundQuantity = Number(row.theInboundQuantity);
},
syncUnitPrice(row) {
row.unitPrice = Number(row.unitPrice);
},
async getBatchOptions() {
console.log(1234)
this.loading = true
try {
const res = await getAllQuarter();
@ -266,7 +441,7 @@ export default {
async getMaterialList() {
this.loading = true
try {
const res = await getAllQuarter();
const res = await getMaterialList();
this.materials = res.data.result
console.log(this.materials, '获99来源')
@ -283,10 +458,14 @@ export default {
this.sizeForm.applyNmae = '审批人一'
this.sizeForm.submitName = '填报人一'
this.sizeForm.option = 1
this.sizeForm.waNmae = '仓库一'
this.sizeForm.warehouseName = '仓库一'
this.sizeForm.reason = '入库'
this.sizeForm.materialType = '1'
this.sizeForm.inDate = new Date()//
// singleData
if (!Array.isArray(this.sizeForm.singleData)) {
this.sizeForm.singleData = [];
}
// this.sizeForm.inTableData.push({
// str1: '000001',
@ -308,7 +487,7 @@ export default {
this.sizeForm.orderNo = String(randomNum).padStart(8, '0');//
this.sizeForm.inDate = new Date()//
if (this.type == '一级库') {
this.sizeForm.waNmae = '仓库一'
this.sizeForm.warehouseName = '仓库一'
}
},
handleCloseDetail() {
@ -316,19 +495,51 @@ export default {
this.$emit('handleCloseDetail')
},
async inTableAdd() {
this.sizeForm.inTableData.push({
str1: '',
str2: '',
str3: '',
str4: '',
str5: '',
str6: '',
str7: 0,
str8: '',
str9: '',
name: '',
status: '',//
})
if (this.sizeForm.option == 1) {
this.sizeForm.inTableData.push({
unit: '',
model: '',
str3: '',
str4: '',
str5: '',
str6: '',
str7: 0,
str8: '',
str9: '',
name: '',
status: '',//
materialId: '',
materialName: '',
theInboundQuantity: 1,
unitPrice: 0,
})
} else {
// singleData
if (!Array.isArray(this.sizeForm.singleData)) {
this.sizeForm.singleData = [];
}
const newRow = {
unit: '',
model: '',
str3: '',
str4: '',
str5: '',
str6: '',
str7: 0,
str8: '',
str9: '',
name: '',
status: '',//
materialId: '',
materialName: '',
theInboundQuantity: 1,
unitPrice: 0,
};
this.sizeForm.singleData.push(newRow);
console.log("添加新行后:", this.sizeForm.singleData);
}
},
//
putIn(row) {
@ -378,26 +589,52 @@ export default {
}
this.loading = false;
},
changeName(index) {
console.log(9999, index)
this.sizeForm.inTableData.forEach((item, i) => {
if (i == index) {
item.str1 = '000001'
item.str2 = '物资1'
item.str3 = '规格1'
item.str4 = '类别1'
item.str5 = '单位1'
item.str6 = '11'
item.str7 = 22
item.str8 = '3'
item.str9 = '部门一'
item.name = '审批人'
item.status = '1'
this.$set(item, 'str7', 22)
//
async handleMaterialChange(row) {
if (!row.materialId) {
this.$message.warning("请选择物资名称");
return
}
const res = await getDetailList({ id: row.materialId })
console.log("res1", res)
if (res.data.success) {
if (!Array.isArray(this.sizeForm.singleData)) {
this.sizeForm.singleData = [];
}
})
console.log(888888, this.sizeForm.inTableData)
const materialData = res.data.result;
const index = this.sizeForm.singleData.findIndex(item => item === row);
if (index !== -1) {
this.$set(this.sizeForm.singleData, index, { ...row, ...materialData });
} else {
this.sizeForm.singleData.push({ ...row, ...materialData });
}
console.log("更新后的singleData:", this.sizeForm.singleData);
} else {
this.$message.error(res.data.message || "获取物资信息失败");
}
},
// changeName(index) {
// console.log(9999, index)
// this.sizeForm.inTableData.forEach((item, i) => {
// if (i == index) {
// item.str1 = '000001'
// item.str2 = '1'
// item.str3 = '1'
// item.str4 = '1'
// item.str5 = '1'
// item.str6 = '11'
// item.str7 = 22
// item.str8 = '3'
// item.str9 = ''
// item.name = ''
// item.status = '1'
// this.$set(item, 'str7', 22)
// }
// })
// console.log(888888, this.sizeForm.inTableData)
// },
//
save() {
this.$message({
@ -407,25 +644,27 @@ export default {
this.handleCloseDetail()
},
//
sumbit() {
// status ==1
let flag = this.sizeForm.inTableData.some(item => item.status == 1)
if (flag) {
this.$message({
type: "warning",
message: ""
});
return false
}
this.$message({
type: "success",
message: "提交成功"
});
// this.handleCloseDetail()
},
// sumbit() {
// // status ==1
// let flag = this.sizeForm.inTableData.some(item => item.status == 1)
// if (flag) {
// this.$message({
// type: "warning",
// message: ""
// });
// return false
// }
// this.$message({
// type: "success",
// message: ""
// });
// // this.handleCloseDetail()
// },
//
radioChange(val) {
this.sizeForm.inTableData = []
this.sizeForm.singleData = []
if (this.sizeForm.option == 1) {
this.inBatchDialogVisible = true
}

@ -40,7 +40,7 @@ export default {
data: [],
query: {},
loading: false,
page: {
page: {
pageSize: 10,
currentPage: 1,
total: 0

@ -11,9 +11,9 @@
@on-load="onLoad">
<!-- @row-click="rowSelect" -->
<template slot-scope="scope" slot="menuLeft">
<el-button size="small" plain @click.stop="handleDesign()">新增入库单
<el-button size="small" plain @click="handleDesign()">新增入库单
</el-button>
<el-button size="small" plain @click.stop="handleExport()">入库单导出
<el-button size="small" plain @click="handleExport()">入库单导出
</el-button>
</template>
<template slot-scope="scope" slot="purchaseEndInfo">
@ -28,7 +28,7 @@
</avue-crud>
<!-- 新增 -->
<inDialog v-if="inDialogVisible" :repairVisible='inDialogVisible' :inDialogTiltle="inDialogTiltle"
:inDialogType="inDialogType" @handleCloseDetail="handleCloseDetail" type="一级库">
:inDialogType="inDialogType" @handleCloseDetail="handleCloseDetail" type="一级库" :id='id'>
</inDialog>
<!-- 采购单详情 -->
@ -154,11 +154,11 @@ export default {
},
{
label: '待审批',
value: 1
value: 2
},
{
label: '已审批',
value: 2
value: 3
},
]
},
@ -213,28 +213,14 @@ export default {
};
},
computed: {
...mapGetters(["userInfo", "permission"]),
permissionList() {
return {
addBtn: false,
viewBtn: false,
delBtn: false,
editBtn: false
};
},
ids() {
let ids = [];
this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids.join(",");
}
},
methods: {
handleDesign() {
this.inDialogVisible = true
debugger
this.inDialogType = 'add'
this.inDialogTiltle = '新增入库'
this.inDialogVisible = true
},
//
handleDetails(row) {
@ -243,10 +229,11 @@ export default {
this.inDialogTiltle = '详情'
},
//
handleEdit() {
handleEdit(row) {
this.inDialogVisible = true
this.inDialogType = 'edit'
this.inDialogTiltle = '编辑'
this.id = row.id
},
//
purchaseFn(row) {
@ -299,28 +286,7 @@ export default {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
return;
}
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return remove(this.ids);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
this.$refs.crud.toggleSelection();
});
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},

Loading…
Cancel
Save