一级库入库接口联调

master
taozi 4 months ago
parent b9273f44ac
commit 592561c54f
  1. 15
      src/api/firstOrder/inbound.js
  2. 8
      src/api/materials/list.js
  3. 709
      src/views/firstOrder/components/inDialog copy 2.vue
  4. 22
      src/views/firstOrder/components/inDialog copy.vue
  5. 523
      src/views/firstOrder/components/inDialog.vue
  6. 9
      src/views/firstOrder/components/purchaseDialog.vue
  7. 76
      src/views/firstOrder/inbound.vue
  8. 99
      src/views/firstOrder/list.vue
  9. 53
      src/views/materials/index.vue

@ -61,11 +61,22 @@ export const getDetailList = (id) => {
cryptoData: false cryptoData: false
}) })
} }
export const submitData = (formData) => { export const submitData = (sizeForm) => {
console.log('api中的数据',sizeForm)
return request({ return request({
url: '/smartpark/onePutStorage/submit', url: '/smartpark/onePutStorage/submit',
method: 'post', method: 'post',
data: formData , data: sizeForm ,
cryptoToken: false,
cryptoData: false
})
}
export const editList = (onePutStorageId) => {
console.log('api中的数据',onePutStorageId)
return request({
url: '/smartpark/onePutStorage/detail',
method: 'get',
params: { onePutStorageId } ,
cryptoToken: false, cryptoToken: false,
cryptoData: false cryptoData: false
}) })

@ -40,3 +40,11 @@ export const remove = (ids) => {
cryptoData: false cryptoData: false
}) })
} }
export const getCode = () => {
return request({
url: '/smartpark/material/getMaterialEnumList',
method: 'get',
cryptoToken: false,
cryptoData: false
})
}

@ -0,0 +1,709 @@
<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" format="yyyy-MM-dd" value-format="yyyy-MM-dd" 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 prop="source" label="来源">
<el-select v-model="sizeForm.source" placeholder="请选择" style="width: 100%;"
:disabled="inDialogType != 'add'">
<el-option label="采购申请" value="cg"></el-option>
<el-option label="其他来源" value="qt"></el-option>
</el-select>
</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">批量选择</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%" v-show="sizeForm.option == 1">
<el-table-column prop="materialCode" label="物资编码">
</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="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">
<template slot-scope="scope">
{{ scope.row.inboundQuantity || 0 }}
</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="单价">
</el-table-column>
</el-table>
<!-- 单项选择 -->
<el-table :data="sizeForm.singleData" border style="width: 100%" v-show="sizeForm.option == 2">
<el-table-column prop="materialCode" label="物资编码"></el-table-column>
<el-table-column prop="materialName" label="物资名称">
<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="单位"></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="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-table>
<!-- 入库账目表格 -->
<div class="form-title" v-if="inDialogType !== 'details'">入库账目表格</div>
<!-- 批量选择 -->
<el-table :data="sizeForm.inTableData" border style="width: 100%" v-show="sizeForm.option == 1 && inDialogType !== 'details'">
<el-table-column prop="date" label="当前库存">
<el-table-column prop="materialCode" label="物资编码">
</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="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.userInfoVO.name }}
</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 && inDialogType !== 'details'">
<el-table-column prop="date" label="当前库存">
<el-table-column prop="materialCode" label="物资编码">
</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 === "NY" ? "耐用品" : (scope.row.type === "YH" ? "易耗品" : "") }}
</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 }}
</template>
</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="单价">
<template slot-scope="scope">
{{ scope.row.unitPrice || 0 }}
</template>
</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.userInfoVO.name }}
</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="submit(1)">暂存</el-button>
<el-button type="primary" @click="submit(2)">提交</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, submitData, editList } from "@/api/firstOrder/inbound";
export default {
props: {
repairVisible: {
type: Boolean,
default: false
},
inDialogTiltle: {
type: String,
default: ''
},
inDialogType: {
type: String,
default: ''
},
type: {
type: String,
default: ''
},
id: {
type: Number,
default: 0
}
},
data() {
return {
inDialogVisible: false,
sizeForm: {
orderNo: '',//
// applyNmae: 'user1',//
// submitName: '',//
warehouseName: '',//
reason: '',//
inDate: '',//
inAccountsTableData: [],//
inTableData: [], //
singleData: [], //
option: 2,//
materialType: '1',//
source: 'cg', //
status: '',//
purchaseEneInfo: '',//
userInfoVO: {
userId: "用户ID",
name: "用户名称"
},
ldOnePutStorageDetailVOList: [],//
},
inTableData: [],
// singleData: {},
inBatchDialogVisible: false,//
batchType: '',//
materialsType: '',
allDisabled: false,
}
},
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);
},
//
syncUnitPrice(row) {
row.unitPrice = Number(row.unitPrice);
},
//
async getBatchOptions() {
this.loading = true
try {
const res = await getAllQuarter();
this.batchOptions = res.data.result
} catch (error) {
this.$message.error("获取数据来源失败,请重试");
} finally {
this.loading = false;
}
},
//
async getMaterialList() {
this.loading = true
try {
const res = await getMaterialList();
this.materials = res.data.result
} catch (error) {
this.$message.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()//
// // // singleData
// // if (!Array.isArray(this.sizeForm.singleData)) {
// // this.sizeForm.singleData = [];
// // }
// },
async inInit () {
if(this.inDialogType == 'details' || this.inDialogType == 'edit') {
const res = await editList(this.id)
console.log(res,'res修改和详情回显的数据')
this.sizeForm.inTableData = res.data.result.ldOnePutStorageDetailList
console.log(this.sizeForm.inTableData,'this.sizeForm.inTableData')
// this.sizeForm.option = res.data.result.ldOnePutStorage.options
// console.log(this.sizeForm.option,'this.sizeForm.option')
// if(this.sizeForm.option == 1) {
// this.sizeForm.inTableData = res.data.result.ldOnePutStorageDetailList
// } else if(this.sizeForm.option == 2) {
// this.sizeForm.singleData = res.data.result.ldOnePutStorageDetailList
// }
// console.log(this.sizeForm.inTableData,'inTableData1')
// console.log(this.sizeForm.singleData,'singleData2')
this.sizeForm.purchaseEneInfo =res.data.result.ldOnePutStorage.purchaseEneInfo
this.sizeForm.orderNo = res.data.result.ldOnePutStorage.orderNo
this.sizeForm.inDate =res.data.result.ldOnePutStorage.inDate
this.sizeForm.source =res.data.result.ldOnePutStorage.source
this.sizeForm.reason = res.data.result.ldOnePutStorage.reason
this.sizeForm.materialType = res.data.result.ldOnePutStorage.materialType
this.sizeForm.status = res.data.result.ldOnePutStorage.status
this.sizeForm.inOperatorId= res.data.result.ldOnePutStorage.status
this.sizeForm.status = res.data.result.ldOnePutStorage.status
this.sizeForm.option = res.data.result.ldOnePutStorage.options
this.sizeForm.warehouseName = res.data.result.ldOnePutStorage.warehouseName
}
},
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() {
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);
}
},
//
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.sizeForm.purchaseEneInfo = selectedOption
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;
},
//
handleBatchClose() {
this.inBatchDialogVisible = false
},
//
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 = [];
}
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 || "获取物资信息失败");
}
},
//
async submit(index) {
if (!this.sizeForm.warehouseName) {
this.$message.error("仓库名称不能为空");
return;
}
if (!this.sizeForm.inDate) {
this.$message.error("入库时间不能为空");
return;
}
if (!this.sizeForm.reason) {
this.$message.error("事由不能为空");
return;
}
if (!this.sizeForm.materialType) {
this.$message.error("请选择物资类型");
return;
}
if (!this.sizeForm.source) {
this.$message.error("请选择来源");
return;
}
if (this.sizeForm.option === 1) {
if (!this.sizeForm.quarterName) {
this.$message.error("请选择采购单名称");
return;
}
if (!this.sizeForm.inTableData || this.sizeForm.inTableData.length === 0) {
this.$message.error("请添加批量选择数据");
return;
}
//
for (const row of this.sizeForm.inTableData) {
if (!row.materialId) {
this.$message.error("物资ID不能为空");
return;
}
if (!row.materialName) {
this.$message.error("物资名称不能为空");
return;
}
if (!row.theInboundQuantity || row.theInboundQuantity <= 0) {
this.$message.error("本次入库数量必须大于0");
return;
}
if (row.unitPrice === undefined || row.unitPrice < 0) {
this.$message.error("单价不能为负数");
return;
}
if (!row.type) {
this.$message.error("请选择类别");
return;
}
}
}
//
else if (this.sizeForm.option === 2) {
if (!this.sizeForm.singleData || this.sizeForm.singleData.length === 0) {
this.$message.error("请添加单项选择数据");
return;
}
//
for (const row of this.sizeForm.singleData) {
if (!row.materialId) {
this.$message.error("请选择物资名称");
return;
}
if (!row.materialName) {
this.$message.error("物资名称不能为空");
return;
}
if (!row.theInboundQuantity || row.theInboundQuantity <= 0) {
this.$message.error("本次入库数量必须大于0");
return;
}
if (row.unitPrice === undefined || row.unitPrice <= 0) {
this.$message.error("单价不能为负数");
return;
}
if (!row.type) {
this.$message.error("请选择类别");
return;
}
}
}
// status == 1 2
this.sizeForm.status = index
if (this.sizeForm.option == 1) {
this.sizeForm.singleData = []
this.sizeForm.ldOnePutStorageDetailVOList = this.sizeForm.inTableData
} else if (this.sizeForm.option == 2) {
this.sizeForm.inTableData = []
this.sizeForm.ldOnePutStorageDetailVOList = this.sizeForm.singleData
}
console.log('1', this.sizeForm.inAccountsTableData)
console.log("提交数据前", this.sizeForm)
const res = await submitData(this.sizeForm)
console.log("提交数据后", res)
if (res.data.success) {
this.$message({
type: "success",
message: "提交成功"
});
//
this.$emit('submitSuccess');
this.handleCloseDetail();
} else {
this.$message.error(res.data.message || "提交失败");
}
},
// 1 2
radioChange() {
this.sizeForm.inTableData = []
this.sizeForm.singleData = []
if (this.sizeForm.option == 1) {
this.inBatchDialogVisible = true
}
},
// type
handleTypeChange(row) {
if (row.type === 'YH') {
// 600
if (Number(row.unitPrice) > 600) {
this.$confirm('单价大于600元,确定要选择为易耗品吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
return;
}).catch(() => {
row.type = 'NY'
this.$message({
type: 'info',
message: '请重新选择类型'
});
});
}
}
},
}
}
</script>
<style lang="scss" scoped>
.form-title {
font-size: 16px;
font-weight: 600;
padding: 18px 0;
}
</style>

@ -69,7 +69,6 @@
<el-table-column prop="materialName" label="名称" v-if="sizeForm.option == 1"> <el-table-column prop="materialName" label="名称" v-if="sizeForm.option == 1">
</el-table-column> </el-table-column>
<el-table-column prop="materialName" label="名称" v-if="sizeForm.option == 2"> <el-table-column prop="materialName" label="名称" v-if="sizeForm.option == 2">
<!-- 通过slot-scope获取当前行数据 -->
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.materialId" placeholder="请选择物资名称" style="width: 100%;" <el-select v-model="scope.row.materialId" placeholder="请选择物资名称" style="width: 100%;"
@change="handleMaterialChange(scope.row)" @change="handleMaterialChange(scope.row)"
@ -93,30 +92,14 @@
</el-table-column> </el-table-column>
<el-table-column prop="inboundQuantity" label="已入库数量" v-if="sizeForm.option == 1"> <el-table-column prop="inboundQuantity" label="已入库数量" v-if="sizeForm.option == 1">
</el-table-column> </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="本次入库数量"> <el-table-column prop="theInboundQuantity" label="本次入库数量">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number size="mini" v-model="scope.row.theInboundQuantity" :min="1" style="width: 100%;" <el-input-number size="mini" v-model="scope.row.theInboundQuantity" :min="1" style="width: 100%;"
@change="syncInboundQuantity(scope.row)"></el-input-number> @change="syncInboundQuantity(scope.row)"></el-input-number>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column prop="str6" label="需求数量" >
</el-table-column> -->
<el-table-column prop="unitPrice" label="单价"> <el-table-column prop="unitPrice" label="单价">
</el-table-column> </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> </el-table>
<!-- 入库账目表格 --> <!-- 入库账目表格 -->
<div class="form-title">入库账目表格</div> <div class="form-title">入库账目表格</div>
@ -171,7 +154,7 @@
<span slot="footer" class="dialog-footer" v-if="!allDisabled"> <span slot="footer" class="dialog-footer" v-if="!allDisabled">
<el-button @click="handleCloseDetail()"> </el-button> <el-button @click="handleCloseDetail()"> </el-button>
<el-button type="primary" @click="save()">暂存</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> </span>
</el-dialog> </el-dialog>
@ -394,7 +377,6 @@ export default {
console.log(row, "row",row.materialId) console.log(row, "row",row.materialId)
if (!row.materialId) { if (!row.materialId) {
this.$message.warning("请选择物资名称"); this.$message.warning("请选择物资名称");
console.log(1)
return return
} }
try { try {
@ -442,7 +424,7 @@ export default {
this.handleCloseDetail() this.handleCloseDetail()
}, },
// //
sumbit() { submit() {
// status ==1 // status ==1
let flag = this.sizeForm.inTableData.some(item => item.status == 1) let flag = this.sizeForm.inTableData.some(item => item.status == 1)
if (flag) { if (flag) {

@ -1,16 +1,11 @@
<template> <template>
<div> <div>
<el-dialog :close-on-click-modal="false" :title="inDialogTiltle" :visible.sync="inDialogVisible" <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"> <el-form :model="sizeForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic">
<div class="form-title"> 基本信息</div> <div class="form-title"> 基本信息</div>
<el-row> <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-col :span="12">
<el-form-item label="入库单号" v-if="sizeForm.option == 1"> <el-form-item label="入库单号" v-if="sizeForm.option == 1">
<el-input v-model="sizeForm.orderNo" disabled></el-input> <el-input v-model="sizeForm.orderNo" disabled></el-input>
@ -18,55 +13,37 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="入库时间"> <el-form-item label="入库时间">
<el-date-picker v-model="sizeForm.inDate" type="date" placeholder="选择日期" style="width: 100%;" disabled> <el-date-picker v-model="sizeForm.inDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd" type="date"
placeholder="选择日期" style="width: 100%;" disabled>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="事由"> <el-form-item label="事由">
<el-input v-model="sizeForm.reason" :disabled="inDialogType != 'add'"></el-input> <el-input v-model="sizeForm.reason" :disabled="inDialogType == 'details'"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="物资类型"> <el-form-item label="物资类型">
<el-select v-model="sizeForm.material_type" placeholder="请选择" style="width: 100%;" <el-select v-model="sizeForm.materialType" placeholder="请选择" style="width: 100%;"
:disabled="inDialogType != 'add'"> :disabled="inDialogType == 'details'">
<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-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </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-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-col :span="12">
<el-table-column prop="source" label="来源"> <el-form-item prop="source" label="来源">
<el-select v-model="scope.row.source" placeholder="请选择" style="width: 100%;" <el-select v-model="sizeForm.source" placeholder="请选择" style="width: 100%;"
:disabled="inDialogType != 'add'" @change="handleTypeChange(scope.row)"> :disabled="inDialogType == 'details'">
<el-option label="采购申请" value="cg"></el-option> <el-option label="采购申请" value="cg"></el-option>
<el-option label="其他来源" value="qt"></el-option> <el-option label="其他来源" value="qt"></el-option>
</el-select> </el-select>
</el-table-column> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="选项"> <el-form-item label="选项">
<el-radio-group v-model="sizeForm.option" @change="radioChange()" :disabled="inDialogType != 'add'"> <el-radio-group v-model="sizeForm.option" @change="radioChange()" :disabled="inDialogType == 'details'">
<el-radio :label="1">批量选择</el-radio> <el-radio :label="1">批量选择</el-radio>
<el-radio :label="2">单项选择</el-radio> <el-radio :label="2">单项选择</el-radio>
</el-radio-group> </el-radio-group>
@ -83,19 +60,9 @@
v-if="!allDisabled && sizeForm.option == 2">新增</el-button> v-if="!allDisabled && sizeForm.option == 2">新增</el-button>
<!-- 批量选择 --> <!-- 批量选择 -->
<el-table :data="sizeForm.inTableData" border style="width: 100%" v-show="sizeForm.option == 1"> <el-table :data="sizeForm.inTableData" border style="width: 100%" v-show="sizeForm.option == 1">
<el-table-column prop="materialId" label="物资ID"> <el-table-column prop="materialCode" label="物资编码">
</el-table-column>
<el-table-column prop="materialName" label="名称" v-if="sizeForm.option == 1">
</el-table-column> </el-table-column>
<el-table-column prop="materialName" label="名称" v-if="sizeForm.option == 2"> <el-table-column prop="materialName" label="物资名称">
<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>
<el-table-column prop="model" label="规格"> <el-table-column prop="model" label="规格">
</el-table-column> </el-table-column>
@ -104,10 +71,12 @@
<el-table-column prop="type" label="类别"> <el-table-column prop="type" label="类别">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.type" placeholder="请选择" style="width: 100%;" <el-select v-model="scope.row.type" placeholder="请选择" style="width: 100%;"
:disabled="inDialogType != 'add'" @change="handleTypeChange(scope.row)"> :disabled="inDialogType == 'details'" @change="handleTypeChange(scope.row)"
<el-option label="耐用品" value="ny"></el-option> v-if='inDialogType != "details"'>
<el-option label="易耗品" value="yh"></el-option> <el-option label="耐用品" value="NY"></el-option>
<el-option label="易耗品" value="YH"></el-option>
</el-select> </el-select>
<span v-else>{{ scope.row.type == 'NY' ? '耐用品' : '易耗品' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="requiredQuantity" label="计划采购数量" v-if="sizeForm.option == 1"> <el-table-column prop="requiredQuantity" label="计划采购数量" v-if="sizeForm.option == 1">
@ -115,63 +84,48 @@
{{ scope.row.requiredQuantity || 0 }} {{ scope.row.requiredQuantity || 0 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="inboundQuantity" label="已入库数量" v-if="sizeForm.option == 1"> <el-table-column prop="inboundQuantity" label="已入库数量" v-if="sizeForm.option == 1" >
</el-table-column>
<!-- <el-table-column prop="str7" label="本次入库数量">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number size="mini" v-model="scope.row.str7" :min="1" style="width: 100%;" {{ scope.row.inboundQuantity || 0 }}
:disabled="(scope.row.status != 1) || (allDisabled)"></el-input-number>
</template> </template>
</el-table-column> --> </el-table-column>
<el-table-column prop="theInboundQuantity" label="本次入库数量"> <el-table-column prop="theInboundQuantity" label="本次入库数量">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number size="mini" v-model="scope.row.theInboundQuantity" :min="1" style="width: 100%;" <el-input-number size="mini" v-model="scope.row.theInboundQuantity" :min="1" style="width: 100%;"
@change="syncInboundQuantity(scope.row)"></el-input-number> @change="syncInboundQuantity(scope.row)" v-if='inDialogType != "details"'></el-input-number>
<span v-else>{{ scope.row.theInboundQuantity || 0}}</span>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column prop="str6" label="需求数量" >
</el-table-column> -->
<el-table-column prop="unitPrice" label="单价"> <el-table-column prop="unitPrice" label="单价">
</el-table-column> </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> </el-table>
<!-- 单项选择 --> <!-- 单项选择 -->
<el-table :data="sizeForm.singleData" border style="width: 100%" v-show="sizeForm.option == 2"> <el-table :data="sizeForm.singleData" border style="width: 100%" v-show="sizeForm.option == 2">
<el-table-column prop="materialId" label="物资ID"> <el-table-column prop="materialCode" label="物资编码"></el-table-column>
</el-table-column> <el-table-column prop="materialName" label="物资名称">
<el-table-column prop="materialName" label="名称" v-if="sizeForm.option == 2">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.materialId" placeholder="请选择物资名称" style="width: 100%;" <el-select v-model="scope.row.materialId" placeholder="请选择物资名称" style="width: 100%;"
@change="handleMaterialChange(scope.row)"> @change="handleMaterialChange(scope.row)" v-if='inDialogType != "details"'>
<el-option v-for="item in materials" :key="item.materialId" :label="item.materialName" <el-option v-for="item in materials" :key="item.materialId" :label="item.materialName"
:value="item.materialId"> :value="item.materialId">
</el-option> </el-option>
</el-select> </el-select>
<span v-else> {{ scope.row.materialName }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="model" label="规格"> <el-table-column prop="model" label="物资规格"></el-table-column>
</el-table-column> <el-table-column prop="type" label="类别 ">
<el-table-column prop="type" label="物资类型">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.type" placeholder="请选择" style="width: 100%;" <el-select v-model="scope.row.type" placeholder="请选择" style="width: 100%;"
:disabled="inDialogType != 'add'" @change="handleTypeChange(scope.row)"> @change="handleTypeChange(scope.row)"
<el-option label="耐用品" value="ny"></el-option> v-if='inDialogType !== "details"'>
<el-option label="易耗品" value="yh"></el-option> <el-option label="耐用品" value="NY"></el-option>
<el-option label="易耗品" value="YH"></el-option>
</el-select> </el-select>
<span v-else>{{ scope.row.type == 'NY' ? '耐用品' : '易耗品' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="unit" label="单位"> <el-table-column prop="unit" label="单位"></el-table-column>
<template slot-scope="scope">
{{ scope.row.unit || '' }}
</template>
</el-table-column>
<el-table-column prop="requiredQuantity" label="计划采购数量" v-if="sizeForm.option == 1"> <el-table-column prop="requiredQuantity" label="计划采购数量" v-if="sizeForm.option == 1">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.requiredQuantity || 0 }} {{ scope.row.requiredQuantity || 0 }}
@ -179,40 +133,30 @@
</el-table-column> </el-table-column>
<el-table-column prop="inboundQuantity" label="已入库数量" v-if="sizeForm.option == 1"> <el-table-column prop="inboundQuantity" label="已入库数量" v-if="sizeForm.option == 1">
</el-table-column> </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="本次入库数量"> <el-table-column prop="theInboundQuantity" label="本次入库数量">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number size="mini" v-model="scope.row.theInboundQuantity" :min="1" style="width: 100%;" <el-input-number size="mini" v-model="scope.row.theInboundQuantity" :min="1" style="width: 100%;"
@change="syncInboundQuantity(scope.row)"></el-input-number> @change="syncInboundQuantity(scope.row)" v-if='inDialogType != "details"'></el-input-number>
<span v-else>{{ scope.row.theInboundQuantity || 0 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="unitPrice" label="单价"> <el-table-column prop="unitPrice" label="单价">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number size="mini" v-model="scope.row.unitPrice" :min="0" style="width: 100%;" <el-input-number size="mini" v-model="scope.row.unitPrice" :min="0" style="width: 100%;"
@change="syncUnitPrice(scope.row)"></el-input-number> @change="syncUnitPrice(scope.row)" v-if='inDialogType != "details"'></el-input-number>
<span v-else>{{ scope.row.unitPrice || 0 }}</span>
</template> </template>
</el-table-column> </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> </el-table>
<!-- 入库账目表格 --> <!-- 入库账目表格 -->
<div class="form-title">入库账目表格</div> <div class="form-title" v-if="inDialogType !== 'details'">入库账目表格</div>
<!-- 批量选择 --> <!-- 批量选择 -->
<el-table :data="sizeForm.inTableData" border style="width: 100%" v-show="sizeForm.option == 1"> <el-table :data="sizeForm.inTableData" border style="width: 100%"
v-show="sizeForm.option == 1 && inDialogType !== 'details'">
<el-table-column prop="date" label="当前库存"> <el-table-column prop="date" label="当前库存">
<el-table-column prop="materialId" label="物资ID"> <el-table-column prop="materialCode" label="物资编码">
</el-table-column> </el-table-column>
<el-table-column prop="materialName" label="名称"> <el-table-column prop="materialName" label="物资名称">
</el-table-column> </el-table-column>
<el-table-column prop="model" label="规格"> <el-table-column prop="model" label="规格">
</el-table-column> </el-table-column>
@ -222,10 +166,13 @@
</el-table-column> </el-table-column>
<el-table-column prop="type" label="类别"> <el-table-column prop="type" label="类别">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.type === "ny" ? "耐用品" : (scope.row.type === "yh" ? "易耗品" : "") }} {{ scope.row.type === "NY" ? "耐用品" : (scope.row.type === "YH" ? "易耗品" : "") }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="inboundQuantity" label="数量"> <el-table-column prop="inboundQuantity" label="数量">
<template slot-scope="scope">
{{ scope.row.inboundQuantity || 0 }}
</template>
</el-table-column> </el-table-column>
<el-table-column prop="unitPrice" label="单价"> <el-table-column prop="unitPrice" label="单价">
</el-table-column> </el-table-column>
@ -248,7 +195,7 @@
<el-table-column prop="date" label="入库信息"> <el-table-column prop="date" label="入库信息">
<el-table-column label="入库人"> <el-table-column label="入库人">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.userInfoVO ? scope.row.userInfoVO.name : (sizeForm.submitName || '') }} {{ scope.row.userInfoVO ? scope.row.userInfoVO.name : sizeForm.userInfoVO.name }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="inDate" label="入库时间" width="150"> <el-table-column prop="inDate" label="入库时间" width="150">
@ -258,24 +205,22 @@
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 单项选择 --> <!-- 单项选择 -->
<el-table :data="sizeForm.singleData" border style="width: 100%" v-show="sizeForm.option == 2"> <el-table :data="sizeForm.singleData" border style="width: 100%"
v-show="sizeForm.option == 2 && inDialogType !== 'details'">
<el-table-column prop="date" label="当前库存"> <el-table-column prop="date" label="当前库存">
<el-table-column prop="materialId" label="物资ID"> <el-table-column prop="materialCode" label="物资编码">
</el-table-column>
<el-table-column prop="materialName" label="名称">
</el-table-column> </el-table-column>
<el-table-column prop="model" label="规格"> <el-table-column prop="materialName" label="物资名称">
</el-table-column> </el-table-column>
<el-table-column prop="type" label="物资类别"> <el-table-column prop="model" label="规格"></el-table-column>
<el-table-column prop="type" label="类别">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.type === "1" ? "耐用品" : (scope.row.type === "2" ? "易耗品" : "") }} {{ scope.row.type === "NY" ? "耐用品" : (scope.row.type === "YH" ? "易耗品" : "") }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="unit" label="单位"> <el-table-column prop="unit" label="单位"></el-table-column>
</el-table-column>
<el-table-column prop="inboundQuantity" label="数量"> <el-table-column prop="inboundQuantity" label="数量">
</el-table-column> </el-table-column>
<el-table-column prop="unitPrice" label="单价"> <el-table-column prop="unitPrice" label="单价">
@ -289,7 +234,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="unitPrice" label="单价"> <el-table-column prop="unitPrice" label="单价">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.unitPrice || 0 }} {{ scope.row.unitPrice }}
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
@ -308,7 +253,7 @@
<el-table-column prop="date" label="入库信息"> <el-table-column prop="date" label="入库信息">
<el-table-column label="入库人"> <el-table-column label="入库人">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.userInfoVO ? scope.row.userInfoVO.name : (sizeForm.submitName || '') }} {{ scope.row.userInfoVO ? scope.row.userInfoVO.name : sizeForm.userInfoVO.name }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="inDate" label="入库时间" width="150"> <el-table-column prop="inDate" label="入库时间" width="150">
@ -317,14 +262,12 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-form> </el-form>
<span slot="footer" class="dialog-footer" v-if="!allDisabled"> <span slot="footer" class="dialog-footer" v-if="!allDisabled">
<el-button @click="handleCloseDetail()"> </el-button> <el-button @click="handleCloseDetail()"> </el-button>
<el-button type="primary" @click="save()">暂存</el-button> <el-button type="primary" @click="submit(1)">暂存</el-button>
<el-button type="primary" @click="submit()">提交</el-button> <el-button type="primary" @click="submit(2)">提交</el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -343,7 +286,7 @@
</div> </div>
</template> </template>
<script> <script>
import { getAllQuarter, getPurchasesByIds, getMaterialList, getDetailList, submitData } from "@/api/firstOrder/inbound"; import { getAllQuarter, getPurchasesByIds, getMaterialList, getDetailList, submitData, editList } from "@/api/firstOrder/inbound";
export default { export default {
props: { props: {
repairVisible: { repairVisible: {
@ -361,6 +304,10 @@ export default {
type: { type: {
type: String, type: String,
default: '' default: ''
},
id: {
type: Number,
default: 0
} }
}, },
data() { data() {
@ -368,14 +315,25 @@ export default {
inDialogVisible: false, inDialogVisible: false,
sizeForm: { sizeForm: {
orderNo: '',// orderNo: '',//
applyNmae: 'user1',// // applyNmae: 'user1',//
submitName: '',// // submitName: '',//
warehouseName: '',//
reason: '',// reason: '',//
inDate: '',//
inAccountsTableData: [],// inAccountsTableData: [],//
inTableData: [], inTableData: [], //
singleData: [], // singleData: [], //
option: 1,// option: 2,//
options: '',
materialType: '1',//
source: 'cg', //
status: '',//
quarterName: '',
purchaseEndInfo: '',//
userInfoVO: {
userId: "用户ID",
name: "用户名称"
},
ldOnePutStorageDetailVOList: [],//
}, },
inTableData: [], inTableData: [],
// singleData: {}, // singleData: {},
@ -383,15 +341,11 @@ export default {
batchType: '',// batchType: '',//
materialsType: '', materialsType: '',
allDisabled: false, allDisabled: false,
userInfoVO: {
userId: "用户ID",
name: "用户名称"
}
} }
}, },
computed: { computed: {
inDate() { inDate() {
const now = new Date(); const now = new Date()
const year = now.getFullYear(); const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0'); const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0'); const day = String(now.getDate()).padStart(2, '0');
@ -400,7 +354,6 @@ export default {
}, },
mounted() { mounted() {
this.inDialogVisible = this.repairVisible this.inDialogVisible = this.repairVisible
if (this.inDialogType == 'add') { if (this.inDialogType == 'add') {
this.addInit() this.addInit()
} else { } else {
@ -413,83 +366,78 @@ export default {
this.getMaterialList() this.getMaterialList()
}, },
methods: { methods: {
// //
handleTypeChange(row) {
console.log("类别已更改:", row.type);
},
syncInboundQuantity(row) { syncInboundQuantity(row) {
row.theInboundQuantity = Number(row.theInboundQuantity); row.theInboundQuantity = Number(row.theInboundQuantity);
}, },
//
syncUnitPrice(row) { syncUnitPrice(row) {
row.unitPrice = Number(row.unitPrice); row.unitPrice = Number(row.unitPrice);
}, },
//
async getBatchOptions() { async getBatchOptions() {
console.log(1234)
this.loading = true this.loading = true
try { try {
const res = await getAllQuarter(); const res = await getAllQuarter();
this.batchOptions = res.data.result this.batchOptions = res.data.result
} catch (error) { } catch (error) {
this.$message.error("获取数据来源失败,请重试"); this.$message.error("获取数据来源失败,请重试");
console.error("下拉选项请求失败:", error);
} finally { } finally {
this.loading = false; this.loading = false;
} }
}, },
//
async getMaterialList() { async getMaterialList() {
this.loading = true this.loading = true
try { try {
const res = await getMaterialList(); const res = await getMaterialList();
this.materials = res.data.result this.materials = res.data.result
console.log(this.materials, '获99来源')
} catch (error) { } catch (error) {
this.$message.error("获取数据来源失败,请重试"); this.$message.error("获取数据来源失败,请重试");
console.error("下拉选项请求失败:", error);
} finally { } finally {
this.loading = false; this.loading = false;
} }
}, },
inInit() { async inInit() {
const randomNum = Math.floor(Math.random() * 100000000) + 1; if (this.inDialogType == 'details' || this.inDialogType == 'edit') {
this.sizeForm.orderNo = String(randomNum).padStart(8, '0');// try {
this.sizeForm.applyNmae = '审批人一' const res = await editList(this.id);
this.sizeForm.submitName = '填报人一' const { ldOnePutStorage, ldOnePutStorageDetailList = [] } = res.data.result || {};
this.sizeForm.option = 1
this.sizeForm.warehouseName = '仓库一' if (!ldOnePutStorage) {
this.sizeForm.reason = '入库' this.$message.error("回显数据异常");
this.sizeForm.materialType = '1' return;
this.sizeForm.inDate = new Date()// }
// singleData const handledDetailList = ldOnePutStorageDetailList.map(item => ({
if (!Array.isArray(this.sizeForm.singleData)) { ...item,
this.sizeForm.singleData = []; theInboundQuantity: item.inboundQuantity || 0
}))
this.sizeForm = {
...this.sizeForm,
...ldOnePutStorage,
inDate: ldOnePutStorage.inDate ? new Date(ldOnePutStorage.inDate) : '',
option: Number(ldOnePutStorage.options) || 1,
quarterName: ldOnePutStorage.purchaseEndInfo,
}
if (this.sizeForm.option === 1) {
this.sizeForm.inTableData = handledDetailList;
} else {
this.sizeForm.singleData = handledDetailList;
} }
// this.sizeForm.inTableData.push({ } catch (error) {
// str1: '000001', console.error("回显失败:", error);
// str2: '1', this.$message.error("获取详情数据失败");
// str3: '1', }
// type: '1', }
// unit: '1', },
// str6: '11',
// str7: '22',
// str8: '3',
// str9: '',
// name: '',
// status: '1',//
// })
},
addInit() { addInit() {
// //
const randomNum = Math.floor(Math.random() * 100000000) + 1; // const randomNum = Math.floor(Math.random() * 100000000) + 1;
this.sizeForm.orderNo = String(randomNum).padStart(8, '0');// // this.sizeForm.orderNo = String(randomNum).padStart(8, '0');//
this.sizeForm.inDate = new Date()// this.sizeForm.inDate = new Date()//
if (this.type == '一级库') {
this.sizeForm.warehouseName = '仓库一'
}
}, },
//
handleCloseDetail() { handleCloseDetail() {
this.inDialogVisible = false this.inDialogVisible = false
this.$emit('handleCloseDetail') this.$emit('handleCloseDetail')
@ -499,13 +447,6 @@ export default {
this.sizeForm.inTableData.push({ this.sizeForm.inTableData.push({
unit: '', unit: '',
model: '', model: '',
str3: '',
str4: '',
str5: '',
str6: '',
str7: 0,
str8: '',
str9: '',
name: '', name: '',
status: '',// status: '',//
materialId: '', materialId: '',
@ -518,17 +459,9 @@ export default {
if (!Array.isArray(this.sizeForm.singleData)) { if (!Array.isArray(this.sizeForm.singleData)) {
this.sizeForm.singleData = []; this.sizeForm.singleData = [];
} }
const newRow = { const newRow = {
unit: '', unit: '',
model: '', model: '',
str3: '',
str4: '',
str5: '',
str6: '',
str7: 0,
str8: '',
str9: '',
name: '', name: '',
status: '',// status: '',//
materialId: '', materialId: '',
@ -536,35 +469,10 @@ export default {
theInboundQuantity: 1, theInboundQuantity: 1,
unitPrice: 0, unitPrice: 0,
}; };
this.sizeForm.singleData.push(newRow); this.sizeForm.singleData.push(newRow);
console.log("添加新行后:", this.sizeForm.singleData);
} }
}, },
//
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() { async batchSubmit() {
if (!this.batchType) { if (!this.batchType) {
@ -577,6 +485,7 @@ export default {
return return
} }
this.sizeForm.quarterName = selectedOption.quarterName this.sizeForm.quarterName = selectedOption.quarterName
this.sizeForm.purchaseEndInfo = selectedOption
this.loading = true this.loading = true
const res = await getPurchasesByIds(this.batchType); const res = await getPurchasesByIds(this.batchType);
console.log("res", res) console.log("res", res)
@ -589,6 +498,10 @@ export default {
} }
this.loading = false; this.loading = false;
}, },
//
handleBatchClose() {
this.inBatchDialogVisible = false
},
// //
async handleMaterialChange(row) { async handleMaterialChange(row) {
if (!row.materialId) { if (!row.materialId) {
@ -614,62 +527,150 @@ export default {
this.$message.error(res.data.message || "获取物资信息失败"); this.$message.error(res.data.message || "获取物资信息失败");
} }
}, },
//
async submit(index) {
if (!this.sizeForm.inDate) {
this.$message.error("入库时间不能为空");
return;
}
// changeName(index) { if (!this.sizeForm.reason) {
// console.log(9999, index) this.$message.error("事由不能为空");
// this.sizeForm.inTableData.forEach((item, i) => { return;
// if (i == index) { }
// item.str1 = '000001'
// item.str2 = '1' if (!this.sizeForm.materialType) {
// item.str3 = '1' this.$message.error("请选择物资类型");
// item.str4 = '1' return;
// item.str5 = '1' }
// item.str6 = '11'
// item.str7 = 22 if (!this.sizeForm.source) {
// item.str8 = '3' this.$message.error("请选择来源");
// item.str9 = '' return;
// item.name = '' }
// item.status = '1' if (this.sizeForm.option === 1) {
// this.$set(item, 'str7', 22) if (!this.sizeForm.quarterName) {
// } this.$message.error("请选择采购单名称");
// }) return;
// console.log(888888, this.sizeForm.inTableData) }
// }, if (!this.sizeForm.inTableData || this.sizeForm.inTableData.length === 0) {
// this.$message.error("请添加批量选择数据");
save() { return;
this.$message({ }
type: "success", //
message: "保存成功" for (const row of this.sizeForm.inTableData) {
}); if (!row.materialId) {
this.handleCloseDetail() this.$message.error("物资ID不能为空");
return;
}
if (!row.materialName) {
this.$message.error("物资名称不能为空");
return;
}
if (!row.theInboundQuantity || row.theInboundQuantity <= 0) {
this.$message.error("本次入库数量必须大于0");
return;
}
if (row.unitPrice === undefined || row.unitPrice < 0) {
this.$message.error("单价不能为空");
return;
}
if (!row.type) {
this.$message.error("请选择类别");
return;
}
}
}
//
else if (this.sizeForm.option === 2) {
if (!this.sizeForm.singleData || this.sizeForm.singleData.length === 0) {
this.$message.error("请添加单项选择数据");
return;
}
//
for (const row of this.sizeForm.singleData) {
if (!row.materialId) {
this.$message.error("请选择物资名称");
return;
}
if (!row.materialName) {
this.$message.error("物资名称不能为空");
return;
}
if (!row.theInboundQuantity || row.theInboundQuantity <= 0) {
this.$message.error("本次入库数量必须大于0");
return;
}
if (row.unitPrice === undefined || row.unitPrice <= 0) {
this.$message.error("单价不能为空");
return;
}
if (!row.type) {
this.$message.error("请选择类别");
return;
}
}
}
// status == 1 2
this.sizeForm.status = index
if (this.sizeForm.option == 1) {
this.sizeForm.singleData = []
this.sizeForm.ldOnePutStorageDetailVOList = this.sizeForm.inTableData
this.sizeForm.options = this.sizeForm.option
this.sizeForm.purchaseEndInfo = this.sizeForm.quarterName
this.sizeForm.option = ''
} else if (this.sizeForm.option == 2) {
this.sizeForm.inTableData = []
this.sizeForm.ldOnePutStorageDetailVOList = this.sizeForm.singleData
this.sizeForm.options = this.sizeForm.option
this.sizeForm.option = ''
}
const res = await submitData(this.sizeForm)
if (res.data.success) {
this.$message({
type: "success",
message: "提交成功"
});
//
this.$emit('submitSuccess');
this.handleCloseDetail();
} else {
this.$message.error(res.data.message || "提交失败");
}
}, },
//
// 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()
// },
// // 1 2
radioChange(val) { radioChange() {
this.sizeForm.inTableData = [] this.sizeForm.inTableData = []
this.sizeForm.singleData = [] this.sizeForm.singleData = []
if (this.sizeForm.option == 1) { if (this.sizeForm.option == 1) {
this.inBatchDialogVisible = true this.inBatchDialogVisible = true
} }
} },
// type
handleTypeChange(row) {
if (row.type === 'YH') {
// 600
if (Number(row.unitPrice) > 600) {
this.$confirm('单价大于600元,确定要选择为易耗品吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
return;
}).catch(() => {
row.type = 'NY'
this.$message({
type: 'info',
message: '请重新选择类型'
});
});
}
}
},
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

@ -1,5 +1,5 @@
<template> <template>
<el-dialog :title="purchaseTitle" append-to-body :visible.sync="openShow" width="70%" @close="closeDialog"> <el-dialog :title="purchaseTitle" append-to-body :visible.sync="openShow" width="70%" @close="closeDialog" >
<avue-crud <avue-crud
:data="data" :data="data"
@ -8,13 +8,14 @@
@size-change="sizeChange" @size-change="sizeChange"
@refresh-change="refreshChange" @refresh-change="refreshChange"
:page.sync="page" :page.sync="page"
@on-load="onLoad"></avue-crud> @on-load="onLoad"
></avue-crud>
<!-- <template #footer> <!-- <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="closeDialog"> </el-button> <el-button @click="closeDialog"> </el-button>
<el-button type="primary" @click="submit"> </el-button> <el-button type="primary" @click="submit"> </el-button>
</span> </span>
</template> --> </template> -->
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
@ -31,7 +32,7 @@ export default {
}, },
id: { id: {
type: Number, type: Number,
default: null default: 0
} }
}, },
data() { data() {

@ -1,14 +1,9 @@
<template> <template>
<basic-container> <basic-container>
<avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form" :page.sync="page" <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form" :page.sync="page"
:permission="permissionList" :permission="permissionList" @search-change="searchChange" @search-reset="searchReset"
@search-change="searchChange" @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
@search-reset="searchReset" @refresh-change="refreshChange" @on-load="onLoad">
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad">
<!-- @row-click="rowSelect" --> <!-- @row-click="rowSelect" -->
<template slot-scope="scope" slot="menuLeft"> <template slot-scope="scope" slot="menuLeft">
<el-button size="small" plain @click="handleDesign()">新增入库单 <el-button size="small" plain @click="handleDesign()">新增入库单
@ -23,12 +18,13 @@
</template> </template>
<template #menu="scope"> <template #menu="scope">
<el-button type="text" @click.stop="handleDetails(scope.row)">详情</el-button> <el-button type="text" @click.stop="handleDetails(scope.row)">详情</el-button>
<el-button type="text" v-if="scope.row.str7 == 1" @click.stop="handleEdit(scope.row)">编辑</el-button> <el-button type="text" v-if="scope.row.status == 1" @click.stop="handleEdit(scope.row)">编辑</el-button>
</template> </template>
</avue-crud> </avue-crud>
<!-- 新增 --> <!-- 新增 -->
<inDialog v-if="inDialogVisible" :repairVisible='inDialogVisible' :inDialogTiltle="inDialogTiltle" <inDialog v-if="inDialogVisible" :repairVisible='inDialogVisible' :inDialogTiltle="inDialogTiltle"
:inDialogType="inDialogType" @handleCloseDetail="handleCloseDetail" type="一级库" :id='id'> :inDialogType="inDialogType" @handleCloseDetail="handleCloseDetail" type="一级库" :id='id'
@submitSuccess="handleSubmitSuccess">
</inDialog> </inDialog>
<!-- 采购单详情 --> <!-- 采购单详情 -->
@ -39,7 +35,7 @@
<script> <script>
import { getList } from "@/api/firstOrder/inbound"; import { getList } from "@/api/firstOrder/inbound";
import { mapGetters } from "vuex"; // import { mapGetters } from "vuex";
import inDialog from './components/inDialog.vue'; import inDialog from './components/inDialog.vue';
import purchaseDialog from './components/purchaseDialog.vue'; import purchaseDialog from './components/purchaseDialog.vue';
export default { export default {
@ -89,10 +85,6 @@ export default {
prop: "purchaseEndInfo", prop: "purchaseEndInfo",
width: 180, width: 180,
}, },
{
label: "仓库名称",
prop: "warehouseName",
},
{ {
label: "入库单号", label: "入库单号",
prop: "orderNo", prop: "orderNo",
@ -108,7 +100,7 @@ export default {
endPlaceholder: "结束时间", endPlaceholder: "结束时间",
format: 'yyyy-MM-dd HH:mm:ss', format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss',
width: 120, width: 140,
// searchParam: 'startTime', // searchParam: 'startTime',
// searchEndParam: 'endTime' // searchEndParam: 'endTime'
}, },
@ -168,45 +160,7 @@ export default {
] ]
}, },
data: [ data: [],
// {
// caigoudanmingcheng: "2025",
// str1: '',
// str2: '00000001',
// str3: '2025-03-01',
// str4: '',
// str5: '',
// str6: '',
// str7: '1',
// }, {
// caigoudanmingcheng: "2025",
// str1: '',
// str2: '00000002',
// str3: '2025-03-02',
// str4: '',
// str5: '',
// str6: '',
// str7: '2',
// }, {
// caigoudanmingcheng: "",
// str1: '',
// str2: '00000002',
// str3: '2025-03-02',
// str4: '',
// str5: '',
// str6: '',
// str7: '3',
// }, {
// caigoudanmingcheng: "",
// str1: '',
// str2: '00000002',
// str3: '2025-03-02',
// str4: '',
// str5: '',
// str6: '',
// str7: '1',
// }
],
inDialogVisible: false, inDialogVisible: false,
inDialogTiltle: '入库', inDialogTiltle: '入库',
inDialogType: '',// inDialogType: '',//
@ -229,6 +183,8 @@ export default {
this.inDialogVisible = true this.inDialogVisible = true
this.inDialogType = 'details' this.inDialogType = 'details'
this.inDialogTiltle = '详情' this.inDialogTiltle = '详情'
this.id = row.id
console.log(this.id,'id')
}, },
// //
handleEdit(row) { handleEdit(row) {
@ -242,7 +198,6 @@ export default {
this.purchaseOpen = true this.purchaseOpen = true
this.purchaseTitle = row.purchaseEndInfo + '采购单详情' this.purchaseTitle = row.purchaseEndInfo + '采购单详情'
this.id = row.id this.id = row.id
console.log(row, this.id,1)
}, },
closeDialog() { closeDialog() {
this.purchaseOpen = false this.purchaseOpen = false
@ -251,14 +206,14 @@ export default {
handleCloseDetail() { handleCloseDetail() {
this.inDialogVisible = false this.inDialogVisible = false
}, },
handleExport(name) { handleExport() {
this.$message({ this.$message({
type: "success", type: "success",
message: "出库单导出成功!" message: "出库单导出成功!"
}); });
}, },
// //
rowSelect(row) { rowSelect() {
this.inDialogVisible = true this.inDialogVisible = true
this.inDialogType = 'inbound' this.inDialogType = 'inbound'
this.inDialogTiltle = '入库' this.inDialogTiltle = '入库'
@ -298,6 +253,11 @@ export default {
refreshChange() { refreshChange() {
this.onLoad(this.page, this.query); this.onLoad(this.page, this.query);
}, },
//
handleSubmitSuccess() {
this.onLoad(this.page)
},
//
onLoad(page, params = {}) { onLoad(page, params = {}) {
this.loading = true; this.loading = true;
const queryParams = { const queryParams = {

@ -4,7 +4,7 @@
<avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form" :page.sync="page" <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form" :page.sync="page"
:permission="permissionList" @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset" :permission="permissionList" @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset"
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
@refresh-change="refreshChange" @on-load="onLoad" > @refresh-change="refreshChange" @on-load="onLoad">
<template slot-scope="scope" slot="menu"> <template slot-scope="scope" slot="menu">
<el-button type="text" size="small" @click.stop="handleLog(scope.row)">记录 <el-button type="text" size="small" @click.stop="handleLog(scope.row)">记录
</el-button> </el-button>
@ -14,21 +14,21 @@
</basic-container> </basic-container>
<el-dialog title="记录" :visible.sync="dialogLogVisible" width="60%" :close-on-click-modal="false" <el-dialog title="记录" :visible.sync="dialogLogVisible" width="60%" :close-on-click-modal="false"
:append-to-body="true"> :append-to-body="true">
<el-tabs v-model="activeName" @tab-click="handleTabClick"> <el-tabs v-model="transactionType" @tab-click="handleTabClick">
<el-tab-pane label="入库" name="first"></el-tab-pane> <el-tab-pane label="入库" name="2"></el-tab-pane>
<el-tab-pane label="出库" name="second"></el-tab-pane> <el-tab-pane label="出库" name="1"></el-tab-pane>
<!-- <el-tab-pane label="报废" name="third"></el-tab-pane> --> <!-- <el-tab-pane label="报废" name="third"></el-tab-pane> -->
</el-tabs> </el-tabs>
<el-table :data="tableData" style="width: 100%"> <el-table :data="tableData" style="width: 100%">
<el-table-column type="index" width="50"> <el-table-column type="index" width="50">
</el-table-column> </el-table-column>
<el-table-column prop="str1" label="数量" width="180"> <el-table-column prop="quantity" label="数量" width="180">
</el-table-column> </el-table-column>
<el-table-column prop="str4" label="操作人" width="180"> <el-table-column prop="operatorName" label="操作人" width="180">
</el-table-column> </el-table-column>
<el-table-column prop="str2" label="时间" width="180"> <el-table-column prop="operationTime" label="时间" width="180">
</el-table-column> </el-table-column>
<el-table-column prop="str3" label="部门"> <el-table-column prop="departmentName" label="部门">
</el-table-column> </el-table-column>
</el-table> </el-table>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -41,7 +41,7 @@
<script> <script>
// import { getList, remove } from "@/api/report/report"; // import { getList, remove } from "@/api/report/report";
import { getList } from "@/api/firstOrder/list"; import { getList, recordList } from "@/api/firstOrder/list";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
export default { export default {
@ -79,11 +79,11 @@ export default {
column: [ column: [
{ {
label: "存货编号", label: "存货编号",
prop: "stockCode", prop: "materialCode",
}, },
{ {
label: "存货名称", label: "存货名称",
prop: "stockName", prop: "materialName",
search: true, search: true,
}, },
{ {
@ -92,15 +92,15 @@ export default {
}, },
{ {
label: "类别", label: "类别",
prop: "materialType", prop: "type",
search: true, search: true,
type: 'select', type: 'select',
dicData: [{ dicData: [{
label: '易耗品', label: '易耗品',
value: 1 value: "YH"
}, { }, {
label: '耐用品', label: '耐用品',
value: 2 value: "NY"
}] }]
}, },
{ {
@ -118,26 +118,20 @@ export default {
{ {
label: "金额", label: "金额",
prop: "amount", prop: "amount",
},
{
label: "描述",
prop: "remark",
} }
] ]
}, },
data: [], data: [],
dialogLogVisible: false, dialogLogVisible: false,
activeName: 'first', transactionType: '1',
tableData: [], tableData: [],
ckTable: [],
ckTable: [ rkTable: [],
{ str1: '3', str2: '2025-04-09', str3: '部门一', str4: '操作人二' }, currentRow: null,
{ str1: '37', str2: '2025-04-03', str3: '部门一', str4: '操作人二' }
],
rkTable: [
{ str1: '5', str2: '2025-03-19', str3: '部门二', str4: '操作人二' },
{ str1: '12', str2: '2025-03-19', str3: '部门二', str4: '操作人二' },
],
bfTable: [
{ str1: '9', str2: '2025-03-19', str3: '部门三', str4: '操作人二' },
{ str1: '19', str2: '2025-03-19', str3: '部门三', str4: '操作人二' },
],
}; };
}, },
computed: { computed: {
@ -160,22 +154,31 @@ export default {
}, },
mounted() { mounted() {
this.tableData = this.ckTable this.tableData = this.ckTable
this.tableData = this.rkTable
}, },
methods: { methods: {
handleLog() { async handleLog(row) {
this.dialogLogVisible = true this.dialogLogVisible = true
this.currentRow = row
const params = {
oneFromId: row.id,
transactionType: this.transactionType,
}
const pageNum = this.page.currentPage;
const pageSize = this.page.pageSize;
const res = await recordList(pageNum, pageSize, Object.assign({}, this.query, params));
this.tableData = res.data.result.list;
}, },
handleTabClick(tab, event) {
console.log(tab, event); handleTabClick() {
if (this.activeName == 'first') { //
if (this.transactionType == '1') {
this.tableData = this.ckTable this.tableData = this.ckTable
} }
if (this.activeName == 'second') { //
if (this.transactionType == '2') {
this.tableData = this.rkTable this.tableData = this.rkTable
} }
if (this.activeName == 'third') {
this.tableData = this.bfTable
}
}, },
searchReset() { searchReset() {
@ -206,35 +209,15 @@ export default {
this.onLoad(this.page, this.query); this.onLoad(this.page, this.query);
}, },
onLoad(page, params = {}) { onLoad(page, params = {}) {
this.loading = true; this.loading = true
// this.data.push({
// no: '00100001',
// name: '1',
// xh: '1',
// lb: '',
// unit: '11',
// number: '1',
// dj: '11',
// pice: '11'
// }, {
// no: '00100002',
// name: '2',
// xh: '2',
// lb: '',
// unit: '22',
// number: '2',
// dj: '11',
// pice: '22'
// })
this.loading = false
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
console.log(898989,res.data.result)
// const data = res.data.data; // const data = res.data.data;
this.data = res.data.result.list; this.data = res.data.result.list;
this.loading = false; this.loading = false;
this.page.total = res.data.result.total; this.page.total = res.data.result.total;
// this.selectionClear(); // this.selectionClear();
}); });
this.loading = false
} }
} }
}; };

@ -29,7 +29,7 @@
</template> </template>
<script> <script>
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { getList, add, remove, update } from "@/api/materials/list"; import { getList, add, remove, update, getCode } from "@/api/materials/list";
export default { export default {
data() { data() {
return { return {
@ -75,28 +75,22 @@ export default {
}, },
{ {
label: "类别", label: "类别",
prop: "materialType", prop: "materialCode",
type: 'select', type: 'select',
dicData: [{ dicData: [],
label: '易耗品',
value: 1
}, {
label: '耐用品',
value: 2
}],
props: { props: {
label: 'label', label: 'label',
value: 'value' value: 'value'
}, },
formatter: (row, value, label, column) => { // formatter: (row, value, label, column) => {
// valuelabel // // valuelabel
const typeMap = { // const typeMap = {
1: '易耗品', // 1: '',
2: '耐用品' // 2: ''
}; // };
return typeMap[value] || value; // return typeMap[value] || value;
}, // },
dataType: 'number' dataType: 'string'
}, },
{ {
label: "单位", label: "单位",
@ -143,8 +137,25 @@ export default {
}, },
mounted() { mounted() {
this.tableData = this.ckTable this.tableData = this.ckTable
this.fetchMaterialCode()
}, },
methods: { methods: {
fetchMaterialCode() {
getCode().then(res => {
const dicData = res.data.result.map(item => ({
label: item.name,
value: item.code
}));
console.log('materialCode字典数据:', dicData);
const targetColumn = this.option.column.find(col => col.prop === 'materialCode');
if (targetColumn) {
targetColumn.dicData = dicData;
}
}).catch(error => {
console.error('获取materialCode字典数据失败:', error);
this.$message.error('加载类别数据失败,请刷新重试');
});
},
handleLog() { handleLog() {
this.dialogLogVisible = true this.dialogLogVisible = true
}, },
@ -269,13 +280,11 @@ export default {
// pice: '22' // pice: '22'
// }) // })
this.loading = false this.loading = false
//
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
// const data = res.data.data; // const data = res.data.data;
// this.data = res.data.result.list;
this.data = res.data.result.list; //
this.loading = false this.loading = false
this.page.total = res.data.result.total; // this.page.total = res.data.result.total;
// this.selectionClear(); // this.selectionClear();
}); });
this.loading = false this.loading = false

Loading…
Cancel
Save