代码提交

master
taozi 4 months ago
parent b1743f4619
commit 14efd9eebb
  1. 4
      src/api/firstOrder/outbound.js
  2. 4
      src/views/demandOrder/index.vue
  3. 269
      src/views/firstOrder/components/consumableDialog.vue
  4. 72
      src/views/firstOrder/components/inDialog.vue
  5. 349
      src/views/firstOrder/components/outDialog.vue
  6. 84
      src/views/firstOrder/list.vue
  7. 46
      src/views/materials/index.vue
  8. 11
      src/views/purchaseOrders/index.vue

@ -57,10 +57,12 @@ export const submitData = (sizeForm) => {
cryptoData: false
})
}
export const getMaterialList = () => {
export const getMaterialList = (optionType) => {
console.log('api中的数据', optionType)
return request({
url: '/smartpark/oneForm/getPutOneFormList',
method: 'get',
params: optionType,
cryptoToken: false,
cryptoData: false
})

@ -61,8 +61,8 @@ export default {
label: "提交时间",
prop: "optTime",
type: "date",
format: "yyyy-MM-dd",
valueFormat: "yyyy-MM-dd",
format: "yyyy-MM-dd HH:mm:ss",
valueFormat: "yyyy-MM-dd HH:mm:ss",
headerAlign: "center",
align: "center",
},

@ -0,0 +1,269 @@
<template>
<el-dialog :close-on-click-modal="false" :title="demandDialogTitle" :visible.sync="consumableVisible"
:append-to-body="true" width="70%" @close="handleCloseDetail" fullscreen>
<basic-container>
<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" @selection-change="selectionChange" @current-change="currentChange"
@size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"
@row-change="handleRowChange">
<!-- <template slot-scope="scope" slot="menu">
<el-button type="text" size="small" @click.stop="handleLog(scope.row)">记录
</el-button>
</template> -->
</avue-crud>
</basic-container>
</el-dialog>
</template>
<script>
import { getList, recordList } from "@/api/firstOrder/list";
export default {
props: {
consumableVisible: {
type: Boolean,
default: false
},
demandDialogTitle: {
type: String,
default: ''
},
},
data() {
return {
form: {},
selectionList: [],
query: {},
loading: true,
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
option: {
height: "auto",
calcHeight: 30,
tip: false,
searchShow: true,
searchMenuSpan: 12,
border: true,
index: true,
selection: true,
viewBtn: true,
dialogClickModal: false,
menu: true,
printBtn: false,
refreshBtn: false,
gridBtn: false,
gridBackgroundImage: false,
gridSpan: false,
filterBtn: false,
columnBtn: false,
menuAlign: "left",
searchMenuPosition: "right",
menuWidth: 80,
column: [
{
label: "存货编号",
prop: "materialCode",
headerAlign: "center",
align: "center",
},
{
label: "存货名称",
prop: "materialName",
search: true,
headerAlign: "center",
align: "left",
},
{
label: "规格型号",
prop: "model",
headerAlign: "center",
align: "left",
},
{
label: "类别",
prop: "type",
search: true,
type: "select",
headerAlign: "center",
align: "center",
dicData: [
{
label: "易耗品",
value: "YH",
},
{
label: "耐用品",
value: "NY",
},
],
},
{
label: "计量单位",
prop: "unit",
headerAlign: "center",
align: "center",
},
{
label: "数量",
prop: "num",
headerAlign: "center",
align: "center",
},
{
label: "单价",
prop: "unitPrice",
headerAlign: "center",
align: "center",
},
{
label: "金额",
prop: "amount",
headerAlign: "center",
align: "center",
},
{
label: "描述",
prop: "remark",
headerAlign: "center",
align: "center",
formatter: (row, column) => {
const value = row.remark;
if (value === null || value === undefined || value === "") {
return "无";
}
return value;
}
},
],
},
data: [],
dialogLogVisible: false,
transactionType: "1",
tableData: [],
ckTable: [],
rkTable: [],
currentRow: null,
};
},
computed: {
permissionList() {
return {
addBtn: false,
viewBtn: false,
delBtn: false,
editBtn: false,
};
},
ids() {
let ids = [];
this.selectionList.forEach((ele) => {
ids.push(ele.id);
});
return ids.join(",");
},
},
mounted() {
this.consumableVisible = this.consumableVisible
},
methods: {
formatTime(row, column, cellValue) {
if (!cellValue) return '';
const date = new Date(cellValue);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
async handleLog(row) {
this.dialogLogVisible = true;
this.currentRow = row;
this.loadTransactionData();
},
handleTabClick() {
this.loadTransactionData();
},
async loadTransactionData() {
if (!this.currentRow) return;
const params = {
oneFromId: this.currentRow.id,
transactionType: this.transactionType
};
const pageNum = this.page.currentPage;
const pageSize = this.page.pageSize;
this.loading = true;
try {
const res = await recordList(
pageNum,
pageSize,
Object.assign({}, this.query, params)
);
if (this.transactionType === "1") {
this.ckTable = res.data.result.list;
} else {
this.rkTable = res.data.result.list;
}
this.tableData = res.data.result.list;
} catch (error) {
this.$message.error(error.message);
} finally {
this.loading = false;
}
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
//
selectionChange(list) {
this.selectionList = list;
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
handleRowChange(row, index, data) {
console.log('Selected data:', data);
},
currentChange(currentPage) {
this.handleRowChange()
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
refreshChange() {
this.onLoad(this.page, this.query);
},
onLoad(page, params = {}) {
this.loading = true;
getList(
page.currentPage,
page.pageSize,
Object.assign(params, this.query)
).then((res) => {
// const data = res.data.data;
this.data = res.data.result.list;
this.loading = false;
this.page.total = res.data.result.total;
// this.selectionClear();
});
this.loading = false;
},
},
}
</script>

@ -1,9 +1,10 @@
<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 class="dialog-container">
<!-- 基本信息 -->
<el-form :model="sizeForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic">
<div class="dialog-content">
<el-form :model="sizeForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic" :rules="rules">
<div class="form-title"> 基本信息</div>
<el-row>
<el-col :span="12" v-show="sizeForm.options == 1 && inDialogType != 'add'">
@ -60,6 +61,8 @@
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="inboundDetailCode" label="入库明细单号">
</el-table-column>
<el-table-column prop="materialCode" label="物资编码">
</el-table-column>
<el-table-column prop="materialName" label="物资名称">
@ -109,6 +112,8 @@
</el-table>
<!-- 单项选择 -->
<el-table :data="sizeForm.singleData" border style="width: 100%" v-show="sizeForm.option == 2" align="center">
<el-table-column prop="inboundDetailCode" label="入库明细单号">
</el-table-column>
<el-table-column prop="materialCode" label="物资编码"></el-table-column>
<el-table-column prop="materialName" label="物资名称">
<template slot-scope="scope">
@ -163,6 +168,8 @@
<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="inboundDetailCode" label="入库明细单号">
</el-table-column>
<el-table-column prop="materialCode" label="物资编码">
</el-table-column>
<el-table-column prop="materialName" label="物资名称">
@ -231,6 +238,8 @@
<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="inboundDetailCode" label="入库明细单号">
</el-table-column>
<el-table-column prop="materialCode" label="物资编码">
</el-table-column>
<el-table-column prop="materialName" label="物资名称">
@ -286,6 +295,7 @@
</el-table-column>
</el-table>
</el-form>
</div>
<span slot="footer" class="dialog-footer" v-if="!allDisabled">
<el-button @click="handleCloseDetail()"> </el-button>
<el-button type="primary" @click="submit(1)">暂存</el-button>
@ -296,7 +306,7 @@
<!-- 批量出库 选择 -->
<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-select v-model="batchType" placeholder="请选择数据来源" style="width: 100%;" :clearable="true">
<el-option v-for="item in batchOptions" :key="item.ids" :label="item.quarterName" :value="item.ids">
</el-option>
</el-select>
@ -337,8 +347,6 @@ export default {
inDialogVisible: false,
sizeForm: {
orderNo: '',//
// applyNmae: 'user1',//
// submitName: '',//
reason: '',//
inDate: '',//
inAccountsTableData: [],//
@ -353,16 +361,18 @@ export default {
purchaseEndInfo: '',//
userInfoVO: {
userId: "用户ID",
name: "用户名称"
name: "用户名称",
mainErDepartment: "1",
mainErDepartmentName: "主管部门名称",
},
ldOnePutStorageDetailVOList: [],//
},
inTableData: [],
// singleData: {},
inBatchDialogVisible: false,//
batchType: '',//
materialsType: '',
allDisabled: false,
}
},
computed: {
@ -425,7 +435,6 @@ export default {
try {
const res = await editList(this.id);
const { ldOnePutStorage, ldOnePutStorageDetailList = [] } = res.data.result || {};
if (!ldOnePutStorage) {
this.$message.error("回显数据异常");
return;
@ -446,17 +455,12 @@ export default {
} else {
this.sizeForm.singleData = handledDetailList;
}
} catch (error) {
console.error("回显失败:", error);
this.$message.error("获取详情数据失败");
}
}
},
addInit() {
//
// const randomNum = Math.floor(Math.random() * 100000000) + 1;
// this.sizeForm.orderNo = String(randomNum).padStart(8, '0');//
this.sizeForm.inDate = new Date()//
this.sizeForm.inTableData.theInboundQuantity = 0
},
@ -478,7 +482,6 @@ export default {
unitPrice: 0,
})
} else {
// singleData
if (!Array.isArray(this.sizeForm.singleData)) {
this.sizeForm.singleData = [];
}
@ -486,7 +489,7 @@ export default {
unit: '',
model: '',
name: '',
status: '',//
status: '',
materialId: '',
materialName: '',
theInboundQuantity: 0,
@ -512,7 +515,6 @@ export default {
this.sizeForm.purchaseEndInfo = 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("数据获取成功");
@ -588,12 +590,14 @@ export default {
this.$message.error("物资名称不能为空");
return;
}
if (!row.theInboundQuantity || row.theInboundQuantity < 0) {
this.$message.error("本次入库数量不能为空");
if (row.type === "NY") {
if (row.unitPrice === undefined || row.unitPrice <= 0) {
this.$message.error("单价不能为空");
return;
}
if (row.unitPrice === undefined || row.unitPrice < 0) {
this.$message.error("单价不能为空");
}
if (!row.theInboundQuantity || row.theInboundQuantity < 0) {
this.$message.error("本次入库数量不能为空");
return;
}
if (!row.type) {
@ -618,14 +622,13 @@ export default {
this.$message.error("物资名称不能为空");
return;
}
if (!row.theInboundQuantity || row.theInboundQuantity < 0) {
this.$message.error("本次入库数量不能为空");
return;
}
if (row.type === "NY") {
if (row.unitPrice === undefined || row.unitPrice <= 0) {
this.$message.error("单价不能为空");
return;
}
}
if (!row.type) {
this.$message.error("请选择类别");
return;
@ -668,6 +671,7 @@ export default {
// 1 2
radioChange() {
this.batchType = '';
this.sizeForm.inTableData = []
this.sizeForm.singleData = []
if (this.sizeForm.option == 1) {
@ -700,14 +704,24 @@ export default {
}
</script>
<style lang="scss" scoped>
.form-title {
font-size: 16px;
font-weight: 600;
padding: 18px 0;
}
::v-deep .el-table td,
::v-deep .el-table th {
text-align: center !important;
}
.form-title {
margin: 20px 0;
}
::v-deep.el-dialog__footer {
position: fixed !important;
bottom: 0 !important;
right: 0 !important;
}
::v-deep.dialog-content {
max-height: calc(100vh - 200px);
overflow-y: auto;
padding-right: 10px;
}
</style>

@ -3,6 +3,7 @@
<el-dialog :close-on-click-modal="false" :title="outDialogTiltle" :visible.sync="outDialogVisible"
:append-to-body="true" width="70%" @close="handleCloseDetail" fullscreen>
<!-- 基本信息 -->
<div class="dialog-content">
<el-form :model="sizeForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic">
<div class="form-title"> 基本信息</div>
<el-row>
@ -12,7 +13,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="出库申请时间">
<el-form-item label="出库申请日期">
<el-date-picker v-model="sizeForm.outDate" type="date" placeholder="选择日期" style="width: 100%;" disabled>
</el-date-picker>
</el-form-item>
@ -33,18 +34,19 @@
</el-col>
<el-col :span="12">
<el-form-item label="选项">
<el-radio-group v-model="sizeForm.options" @change="radioChange()" :disabled="outDialogType == 'details'">
<el-radio :label="1" :disabled="sizeForm.type == 2">批量选择</el-radio>
<el-radio-group v-model="sizeForm.options" @change="radioChange()"
:disabled="outDialogType == 'details'">
<el-radio :label="1" :disabled="sizeForm.type == 2"><span @click="closeHandle">批量选择</span></el-radio>
<el-radio :label="2">单项选择</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12" v-if="sizeForm.options === 2">
<el-form-item label="选项">
<el-radio-group v-model="sizeForm.radio" :disabled="outDialogType == 'details'">
<el-radio :label="1">易耗品</el-radio>
<el-radio :label="2">耐用</el-radio>
<el-radio :label="3">全部</el-radio>
<el-radio-group v-model="sizeForm.optionType" :disabled="outDialogType == 'details'"
@change="getMaterialList">
<el-radio label="YH">易耗</el-radio>
<el-radio label="NY">耐用品</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@ -64,7 +66,8 @@
<template slot-scope="scope">
<el-select v-model="scope.row.materialitem" placeholder="请选择物资名称" style="width: 100%;"
@change="handleMaterialChange(scope.row.materialitem, scope.$index)"
v-if='inDialogType != "details" && sizeForm.options == 2' value-key="id">
v-if='inDialogType != "details" && sizeForm.options == 2 && sizeForm.optionType == "YH"'
value-key="id">
<el-option v-for="item in materials" :key="item.materialId" :label="item.materialName" :value="item">
</el-option>
</el-select>
@ -85,7 +88,8 @@
</el-table-column>
<el-table-column prop="unit" label="单位">
</el-table-column>
<el-table-column prop="departmentName" label="部门" v-if="sizeForm.options === 2">
<el-table-column label="部门" prop="departmentName" v-if="sizeForm.options === 2 && sizeForm.optionType"
:key="'account-dept-' + sizeForm.options">
<template slot-scope="scope">
<el-select v-model="scope.row.department" placeholder="请选择部门名称" style="width: 100%;"
v-if='inDialogType != "details"'>
@ -110,6 +114,16 @@
<!-- <span v-else>{{ scope.row.theOutboundQuantity || 0 }}</span> -->
</template>
</el-table-column>
<el-table-column label="操作" v-if="sizeForm.optionType === 'YH' || inBatchForm.optionType === 'YH'"
style="text-align: center;">
<template slot-scope="scope">
<div style="text-align: center;">
<el-button type="text" size="mini" @click="handleDelete(scope.$index, scope.row)">
删除
</el-button>
</div>
</template>
</el-table-column>
</el-table>
<div class="form-title" v-if="outDialogType !== 'details'">出库账目表格</div>
<el-table :data="sizeForm.inTableData" border style="width: 100%" v-if="outDialogType !== 'details'">
@ -130,7 +144,8 @@
{{ scope.row.type === "NY" ? "出库单" : (scope.row.type === "YH" ? "发放单" : "") }}
</template>
</el-table-column>
<el-table-column prop="departmentName" label="部门" v-if="sizeForm.options == 2">
<el-table-column prop="departmentName" label="部门" v-if="sizeForm.options == 2"
:key="'account-dept-' + sizeForm.options">
<template slot-scope="scope">
<span>
{{ getDepartmentName(scope.row.department) }}
@ -149,6 +164,7 @@
</el-table-column>
</el-table>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handleCloseDetail()"> </el-button>
<el-button type="primary" @click="submit(1)">暂存</el-button>
@ -163,8 +179,10 @@
<el-col :span="24">
<el-form-item label="需求单">
<template slot-scope="scope">
<el-select v-model="inBatchForm.batchType" placeholder="请选择需求单" style="width: 100%;">
<el-option v-for="item in quarterList" :key="item.ids" :label="item.quarterName" :value="item.ids">
<el-select v-model="inBatchForm.batchType" placeholder="请选择需求单" style="width: 100%;"
@change="resetHandle">
<el-option v-for="item in quarterList" :key="item.ids" :label="item.quarterName" :value="item.ids"
:clearable="true">
</el-option>
</el-select>
</template>
@ -172,7 +190,8 @@
</el-col>
<el-col :span="24">
<el-form-item label="部门">
<el-select v-model="inBatchForm.department" placeholder="请选择" style="width: 100%;">
<el-select v-model="inBatchForm.department" placeholder="请选择" style="width: 100%;" :clearable="true"
@change="depchange">
<el-option v-for="item in departmentList" :key="item.departmentId" :label="item.department"
:value="item.departmentId">
</el-option>
@ -181,10 +200,9 @@
</el-col>
<el-col :span="24">
<el-form-item label="选项">
<el-radio-group v-model="sizeForm.radio" :disabled="outDialogType == 'details'">
<el-radio :label="1">易耗品</el-radio>
<el-radio :label="2">耐用品</el-radio>
<el-radio :label="3">全部</el-radio>
<el-radio-group v-model="inBatchForm.optionType" :disabled="outDialogType == 'details'">
<el-radio label="YH">易耗品</el-radio>
<el-radio label="NY">耐用品</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@ -199,6 +217,13 @@
<!-- 选择弹窗 -->
<el-dialog :close-on-click-modal="false" title="选择耐用品" :visible.sync="goodsVisible" :append-to-body="true"
width="70%">
<!-- 搜索区域 -->
<div class="search-container" style="margin-bottom: 15px;">
<el-input v-model="searchKeyword" placeholder="请输入物资名称搜索" clearable style="width: 300px;"
@keyup.enter.native="handleSearch">
<el-button slot="append" icon="el-icon-search" @click="handleSearch"></el-button>
</el-input>
</div>
<el-table :data="goodsList" border style="width: 100%" @selection-change="goodsListSelectionChange">
<el-table-column type="selection" width="55">
</el-table-column>
@ -215,7 +240,7 @@
</el-table-column>
<el-table-column prop="unit" label="单位">
</el-table-column>
<el-table-column prop="departmentName" label="部门">
<el-table-column prop="departmentName" label="部门" v-if="sizeForm.options == 2">
</el-table-column>
<el-table-column prop="applicationQuantity" label="申请数量">
</el-table-column>
@ -224,24 +249,30 @@
{{ scope.row.outboundQuantity || 0 }}
</template>
</el-table-column>
<!-- <el-table-column prop="theOutboundQuantity" label="本次出库数量">
<template slot-scope="scope">
<el-input-number size="mini" v-model="scope.row.theOutboundQuantity" :min="1" style="width: 100%;"
@change="syncInboundQuantity(scope.row)" :disabled="outDialogType == 'details'"></el-input-number>
</template>
</el-table-column> -->
</el-table>
<!-- 分页组件 -->
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
:page-sizes="[5, 10, 20, 50]" :page-size="pageSize" :total="total"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<span slot="footer" class="dialog-footer">
<el-button @click="goodsVisible = false"> </el-button>
<el-button type="primary" @click="goodsSubmit()"> </el-button>
</span>
</el-dialog>
<consumableDialog v-if="consumableVisible" :consumableVisible='consumableVisible' :demandDialogTitle="demandDialogTitle"
@handleCloseDetail="handleCloseDetail">
</consumableDialog>
</div>
</template>
<script>
import { getQuarterList, getDepartmentList, getDetailedList, getDetailedItems, submitData, getMaterialList, editList } from "@/api/firstOrder/outbound";
import consumableDialog from './consumableDialog.vue'
export default {
components: {
consumableDialog,
},
props: {
repairVisible: {
type: Boolean,
@ -266,7 +297,9 @@ export default {
},
data() {
return {
demandDialogTitle: '耐用品出库',
goodsVisible: false,
consumableVisible: false, //
quarterList: [],
departmentList: [],
outDialogVisible: false,
@ -279,16 +312,17 @@ export default {
demandEndInfo: '',//
outDate: '',//
options: 2,//
radio: 1, // 1 2
optionType: '', // 1 2
materialType: '1',//
status: '',//1 2
// materialld: '',//Id
userInfoVO: {
userId: "用户ID",
name: "用户名称"
name: "用户名称",
mainErDepartment: "1",
mainErDepartmentName: "主管部门名称",
},
},
uniqueList: [],
goodsList: [],
goodsSelectList: [],
inTableData: [],
@ -296,10 +330,20 @@ export default {
batchType: '',//
inBatchForm: {
batchType: '',
department: ''
department: '',
optionType: '',
},
quarterYearMap: {},
quarterQuarterMap: {}
quarterQuarterMap: {},
rules: {
reason: [
{ required: true, message: '事由不能为空', trigger: 'blur' }
],
materialType: [
{ required: true, message: '请选择物资类型', trigger: 'change' }
]
//
}
}
},
computed: {
@ -308,13 +352,15 @@ export default {
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0')
const hour = String(now.getHours()).padStart(2, '0')
const minute = String(now.getMinutes()).padStart(2, '0')
const second = String(now.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
// const hour = String(now.getHours()).padStart(2, '0')
// const minute = String(now.getMinutes()).padStart(2, '0')
// const second = String(now.getSeconds()).padStart(2, '0')
// return `${year}-${month}-${day} ${hour}:${minute}:${second}`
return `${year}-${month}-${day}`
}
},
mounted() {
this.outDialogVisible = this.repairVisible
if (this.outDialogType == 'add') {
this.addInit()
@ -322,22 +368,127 @@ export default {
this.inInit()
}
this.getDetailedItems()
this.getMaterialList()
// this.getMaterialList()
},
methods: {
// //
// async getMaterialList() {
// const { data: res } = await this.$http.get('material/getMaterialList')
// if (res.code !== 200) return this.$message.error(res.msg)
// this.materialList = res.data
// },
//
async handleSearch() {
//
this.currentPage = 1;
await this.loadGoodsList();
},
//
handleSizeChange(val) {
this.pageSize = val;
this.currentPage = 1;
this.loadGoodsList();
},
//
handleCurrentChange(val) {
this.currentPage = val;
this.loadGoodsList();
},
//
// async loadGoodsList() {
// try {
// const res = await getMaterialList({
// optionType: 'NY', //
// // pageNum: this.currentPage,
// // pageSize: this.pageSize,
// // keyword: this.searchKeyword //
// });
// if (res.data && res.data.result) {
// // this.goodsList = res.data.result.list; //
// this.goodsList = res.data.result; //
// this.total = res.data.result.total; //
// }
// } catch (error) {
// this.$message.error("");
// }
// },
//
goodsListSelectionChange(val) {
this.goodsSelectList = JSON.parse(JSON.stringify(val));
},
//
goodsSubmit() {
if (this.goodsSelectList.length > 0) {
const newItems = this.goodsSelectList.map(item => ({
...item,
materialId: item.materialId,
materialCode: item.materialCode,
materialName: item.materialName,
model: item.model,
type: item.type,
unit: item.unit,
department: item.departmentId,
departmentName: item.departmentName,
theOutboundQuantity: 0
}));
this.sizeForm.inTableData.push(...newItems);
this.goodsVisible = false;
} else {
this.$message.warning('请先勾选需要添加的数据');
}
},
depchange(value) {
this.departmentList = this.departmentList
},
//
handleBatchClose() {
this.inBatchDialogVisible = false
},
//
inTableAdd() {
const requiredFields = [
{ value: this.sizeForm.reason, message: '请填写事由' },
{ value: this.sizeForm.materialType, message: '请选择物资类型' },
{ value: this.sizeForm.optionType, message: '请选择类别(易耗品/耐用品)' }
];
//
for (const field of requiredFields) {
if (!field.value) {
this.$message.warning(field.message);
return;
}
}
this.sizeForm.inTableData.push({})
},
addInit() {
this.sizeForm.outDate = new Date()//
},
//
syncInboundQuantity(row) {
row.theOutboundQuantity = Number(row.theOutboundQuantity);
row.theOutboundQuantity = Number(row.theOutboundQuantity)
if (this.sizeForm.options === 1) {
const maxAllowQuantity = (row.applicationQuantity || 0) - (row.outboundQuantity || 0);
if (row.theOutboundQuantity > maxAllowQuantity) {
this.$message.error(`本次出库数量不能大于${maxAllowQuantity}`);
row.theOutboundQuantity = maxAllowQuantity;
}
}
},
//
handleCloseDetail() {
this.outDialogVisible = false
this.consumableVisible = false
this.$emit('handleCloseDetail')
},
//
//
async getQuarterList() {
try {
const res = await getQuarterList()
@ -352,12 +503,10 @@ export default {
})
}
} catch (error) {
console.error('获取需求单列表失败:', error)
this.$message.error('获取需求单列表失败')
}
},
//
//
async onQuarterSelectChange(ids) {
if (!ids) return
const year = this.quarterYearMap[ids]
@ -370,6 +519,7 @@ export default {
})
if (res.data && res.data.result) {
this.departmentList = res.data.result
console.log(this.departmentList, 'departmentList')
} else {
this.departmentList = []
}
@ -381,11 +531,7 @@ export default {
this.departmentList = []
}
},
//
handleBatchClose() {
this.inBatchDialogVisible = false
},
//
async batchSubmit() {
if (!this.inBatchForm.batchType) {
this.$message.error('请选择需求单');
@ -395,23 +541,28 @@ export default {
this.$message.error('请选择部门');
return;
}
if (!this.inBatchForm.optionType) {
this.$message.error('请选择类别');
return;
}
const res = await getDetailedList({
ids: this.inBatchForm.batchType,
departmentId: this.inBatchForm.department
departmentId: this.inBatchForm.department,
optionType: this.inBatchForm.optionType,
})
if (res.data && res.data.result) {
this.sizeForm.inTableData = res.data.result.uniqueList
this.sizeForm.inTableData = res.data.result
const selectedDept = this.departmentList.find(
dept => dept.departmentId === this.inBatchForm.department
);
)
const deptName = selectedDept ? selectedDept.department : '';
this.sizeForm.inTableData = res.data.result.uniqueList.map(item => ({
this.sizeForm.inTableData = res.data.result.map(item => ({
...item,
IdDemandEndld: this.inBatchForm.batchType,
// department: this.inBatchForm.department,
department: deptName
}));
}))
this.inBatchDialogVisible = false;
const selectedQuarter = this.quarterList.find(
item => item.ids === this.inBatchForm.batchType
@ -419,24 +570,23 @@ export default {
if (selectedQuarter) {
this.sizeForm.demandEndInfo = selectedQuarter.quarterName;
}
//radio
if (this.sizeForm.radio === 3) {
if (res.data.result.duplicateList != null && res.data.result.duplicateList.length > 0) {
if (this.inBatchForm.optionType === 'NY') {
this.goodsVisible = true
this.goodsList = res.data.result.duplicateList
}
this.data.goodsList = res.data.result
}
this.$nextTick(() => {
this.$forceUpdate();
});
} else {
this.$message.warning('未获取到详细数据');
}
},
//
//
goodsListSelectionChange(val) {
this.goodsSelectList = val
},
//
//
goodsSubmit() {
if (this.goodsSelectList.length > 0) {
this.sizeForm.inTableData.push(...this.goodsSelectList);
@ -466,8 +616,13 @@ export default {
async getMaterialList() {
this.loading = true
try {
const res = await getMaterialList();
if (this.sizeForm.optionType === "NY") {
this.consumableVisible = true
} else {
const res = await getMaterialList({ optionType: this.sizeForm.optionType })
this.materials = res.data.result
}
} catch (error) {
this.$message.error("获取数据来源失败,请重试");
} finally {
@ -514,14 +669,22 @@ export default {
// status == 1 2
this.sizeForm.status = index
this.sizeForm.ldOneOutStorageDetailVOList = this.sizeForm.inTableData
this.sizeForm.inTableData.forEach(row => {
row.departmentName = this.getDepartmentName(row.department);
});
this.sizeForm.ldOneOutStorageDetailVOList.departmentName = this.sizeForm.inTableData.department
let arr = this.departmentList.find(item => item.departmentId === this.inBatchForm.department || {})
this.sizeForm.ldOneOutStorageDetailVOList = this.sizeForm.inTableData.map(row => {
const deptId = row.department
const dept = this.list.find(item => item.departmentId === deptId);
console.log(dept, 'dept')
return {
...row,
department: this.sizeForm.options == '1' ? arr.departmentId : deptId,
departmentName: this.sizeForm.options == '1' ? arr.department : dept.department,
}
})
console.log(this.sizeForm, '111')
this.sizeForm.inTableData = []
try {
const res = await submitData(this.sizeForm)
console.log(this.sizeForm, '222')
if (res.data.success) {
this.$message({
type: "success",
@ -566,29 +729,61 @@ export default {
}
},
//
inTableAdd() {
this.sizeForm.inTableData.push({})
},
//
async radioChange() {
// this.resetAllForms()
this.sizeForm.inTableData = []
this.sizeForm.optionType = '';
if (this.sizeForm.options === 1) {
await this.getQuarterList()
this.inBatchDialogVisible = true
this.$forceUpdate()
this.$nextTick(() => {
this.$forceUpdate();
});
}
},
closeHandle() {
this.inBatchForm.batchType = '',
this.inBatchForm.department = ''
this.inBatchForm.optionType = ''
this.sizeForm.inTableData = []
this.getQuarterList()
this.inBatchDialogVisible = true
this.$nextTick(() => {
this.$forceUpdate();
});
// this.sizeForm.inTableData = []
},
//
handleDelete(index, row) {
this.sizeForm.inTableData.splice(index, 1)
this.$message.success('已成功删除该条记录')
},
},
watch: {
//
'inBatchForm.batchType': function (newVal) {
this.inBatchForm.department = '',
this.inBatchForm.optionType = 1
if (newVal) {
this.onQuarterSelectChange(newVal)
}
},
'sizeForm.optionType': function (newVal) {
if (newVal) {
this.sizeForm.inTableData = []
// this.getMaterialList()
}
},
//
goodsVisible(newVal) {
if (newVal) {
//
this.searchKeyword = '';
this.currentPage = 1;
this.loadGoodsList();
}
}
}
}
@ -597,4 +792,16 @@ export default {
.form-title {
margin: 20px 0;
}
::v-deep.el-dialog__footer {
position: fixed !important;
bottom: 0 !important;
right: 0 !important;
}
::v-deep.dialog-content {
max-height: calc(100vh - 200px);
overflow-y: auto;
padding-right: 10px;
}
</style>

@ -15,21 +15,33 @@
<el-dialog title="记录" :visible.sync="dialogLogVisible" width="50%" :close-on-click-modal="false"
:append-to-body="true" >
<el-tabs v-model="transactionType" @tab-click="handleTabClick">
<el-tab-pane label="库" name="1"></el-tab-pane>
<el-tab-pane label="库" name="2"></el-tab-pane>
<el-tab-pane label="库" name="1"></el-tab-pane>
<el-tab-pane label="库" name="2"></el-tab-pane>
</el-tabs>
<el-table :data="tableData" style="width: 100%">
<el-table-column type="index" width="50"> </el-table-column>
<el-table-column prop="quantity" label="数量">
</el-table-column>
<el-table-column prop="money" label="单价" v-if="transactionType == '2' && currentRow.type === 'NY'">
<el-table-column prop="money" label="单价" v-if="transactionType === '1' && currentRow && currentRow.type === 'NY'">
</el-table-column>
<el-table-column prop="operatorName" label="操作人" >
</el-table-column>
<el-table-column prop="operationTime" label="时间" :formatter="formatTime" width="180">
<el-table-column prop="operationTime" label="时间" :formatter="formatTime" width="200">
</el-table-column>
<el-table-column prop="departmentName" label="部门"> </el-table-column>
</el-table>
<div style="margin-top: 10px; text-align: right;">
<el-pagination
background
@size-change="handleLogSizeChange"
@current-change="handleLogCurrentChange"
:current-page="logPage.currentPage"
:page-sizes="[5, 10, 20, 50]"
:page-size="logPage.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="logPage.total"
></el-pagination>
</div>
</el-dialog>
</div>
</template>
@ -48,6 +60,11 @@ export default {
currentPage: 1,
total: 0,
},
logPage: { //
currentPage: 1,
pageSize: 10,
total: 0
},
option: {
height: "auto",
calcHeight: 30,
@ -182,28 +199,62 @@ export default {
methods: {
formatTime(row, column, cellValue) {
if (!cellValue) return '';
return cellValue.replace('T', ' ');
const date = new Date(cellValue);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
async handleLog(row) {
this.dialogLogVisible = true;
this.currentRow = row;
this.logPage.currentPage = 1;
this.loadTransactionData();
},
handleTabClick() {
this.logPage.currentPage = 1
this.loadTransactionData();
},
// async loadTransactionData() {
// if (!this.currentRow) return;
// const params = {
// oneFromId: this.currentRow.id,
// transactionType: this.transactionType
// };
// const pageNum = this.page.currentPage;
// const pageSize = this.page.pageSize;
// this.loading = true;
// try {
// const res = await recordList(
// pageNum,
// pageSize,
// Object.assign({}, this.query, params)
// );
// if (this.transactionType === "1") {
// this.ckTable = res.data.result.list;
// } else {
// this.rkTable = res.data.result.list;
// }
// this.tableData = res.data.result.list;
// } catch (error) {
// this.$message.error(error.message);
// } finally {
// this.loading = false;
// }
// },
async loadTransactionData() {
if (!this.currentRow) return;
const params = {
oneFromId: this.currentRow.id,
transactionType: this.transactionType
};
const pageNum = this.page.currentPage;
const pageSize = this.page.pageSize;
const pageNum = this.logPage.currentPage;
const pageSize = this.logPage.pageSize;
this.loading = true;
try {
const res = await recordList(
@ -211,6 +262,7 @@ export default {
pageSize,
Object.assign({}, this.query, params)
);
this.logPage.total = res.data.result.total;
if (this.transactionType === "1") {
this.ckTable = res.data.result.list;
} else {
@ -218,11 +270,21 @@ export default {
}
this.tableData = res.data.result.list;
} catch (error) {
console.error("获取记录数据失败:", error);
this.$message.error(error.message);
} finally {
this.loading = false;
}
},
handleLogSizeChange(pageSize) {
this.logPage.pageSize = pageSize;
this.logPage.currentPage = 1; //
this.loadTransactionData();
},
//
handleLogCurrentChange(currentPage) {
this.logPage.currentPage = currentPage;
this.loadTransactionData();
},
searchReset() {
this.query = {};
this.onLoad(this.page);

@ -95,7 +95,6 @@ export default {
return value;
}
},
{
label: '图片',
prop: 'picture',
@ -104,18 +103,12 @@ export default {
align: "center",
loadText: "图片上传中,请稍等",
span: 12,
action: process.env.VUE_APP_BASE_API + '/materials/upload', //
// propsHttp: { //
// url: 'picture', //
// name: 'name', //
// res: 'data' //
// },
tip: "只能上传jpg/png文件",
rules: [{
required: true,
message: "请上传图片",
trigger: "change",
}],
// rules: [{
// required: true,
// message: "",
// trigger: "change",
// }],
formatter: (row, column) => {
const value = row.picture;
if (value === null || value === undefined || value === "") {
@ -124,9 +117,9 @@ export default {
return value;
},
onSuccess: (res, file, fileList) => {
//
this.form.picture = res.data;
}
this.form.picture = res.data
},
httpRequest: this.handleUpload
},
],
},
@ -141,29 +134,39 @@ export default {
this.fetchMaterialCode();
},
methods: {
handleUpload(params) {
const formData = new FormData()
formData.append('file', params.file)
upload(formData)
.then(res => {
params.onSuccess(res)
})
.catch(err => {
params.onError(err)
})
},
fetchMaterialCode() {
getCode()
.then((res) => {
const dicData = res.data.result.map((item) => ({
label: item.name,
value: item.code,
}));
}))
const targetColumn = this.option.column.find(
(col) => col.prop === "materialCode"
);
)
if (targetColumn) {
targetColumn.dicData = dicData;
targetColumn.dicData = dicData
}
})
.catch((error) => {
this.$message.error("加载类别数据失败,请刷新重试");
});
})
},
handleLog() {
this.dialogLogVisible = true;
},
handleTabClick(tab, event) {
console.log(tab, event);
if (this.activeName == "first") {
this.tableData = this.ckTable;
}
@ -191,7 +194,6 @@ export default {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
@ -216,7 +218,7 @@ export default {
window.console.log(error);
loading();
}
);
)
},
//
rowUpdate(row, index, done, loading) {

@ -6,7 +6,6 @@
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
@refresh-change="refreshChange" @on-load="onLoad" >
<template slot-scope="scope" slot="menu">
</template>
</avue-crud>
</basic-container>
@ -58,11 +57,17 @@ export default {
align: "center",
},
{
label: "物资Id",
prop: "materialId",
label: "物资名称",
prop: "materialName",
headerAlign: "center",
align: "center",
},
// {
// label: "Id",
// prop: "materialId",
// headerAlign: "center",
// align: "center",
// },
{
label: "规格型号",
prop: "model",

Loading…
Cancel
Save