一级库出库接口联调

master
taozi 4 months ago
parent 592561c54f
commit 5e65cd5811
  1. 77
      src/api/firstOrder/outbound.js
  2. 9
      src/views/firstOrder/components/inDialog.vue
  3. 652
      src/views/firstOrder/components/outDialog.vue
  4. 586
      src/views/firstOrder/components/uniqueListDialog.vue
  5. 312
      src/views/firstOrder/outbound.vue

@ -0,0 +1,77 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
return request({
url: '/smartpark/oneOutStorage/list',
method: 'get',
params: {
...params,
pageSize: size,
pageNum: current,
},
cryptoToken: false,
cryptoData: false
})
}
export const getQuarterList = () => {
return request({
url: '/smartpark/demandEnd/getAllQuarter',
method: 'get',
cryptoToken: false,
cryptoData: false
})
}
export const getDepartmentList = (params) => {
return request({
url: '/smartpark/demandEnd/getDepartment',
method: 'get',
params: params,
cryptoToken: false,
cryptoData: false
})
}
export const getDetailedList = (params) => {
return request({
url: '/smartpark/demandEnd/getDemandEndData',
method: 'get',
params: params,
cryptoToken: false,
cryptoData: false
})
}
export const getDetailedItems = () => {
return request({
url: '/smartpark/department/getOnePutDepartment',
method: 'get',
cryptoToken: false,
cryptoData: false
})
}
export const submitData = (sizeForm) => {
console.log('api中的数据', sizeForm)
return request({
url: '/smartpark/oneOutStorage/submit',
method: 'post',
data: sizeForm,
cryptoToken: false,
cryptoData: false
})
}
export const getMaterialList = () => {
return request({
url: '/smartpark/oneForm/getPutOneFormList',
method: 'get',
cryptoToken: false,
cryptoData: false
})
}
export const editList = (oneOutStorageId) => {
console.log('api中的数据', oneOutStorageId)
return request({
url: '/smartpark/oneOutStorage/detail',
method: 'get',
params: { oneOutStorageId },
cryptoToken: false,
cryptoData: false
})
}

@ -6,9 +6,9 @@
<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-col :span="12" v-show="sizeForm.options == 1 && inDialogType != 'add'">
<el-form-item label="入库单号" v-if="sizeForm.option == 1"> <el-form-item label="入库单号">
<el-input v-model="sizeForm.orderNo" disabled></el-input> <el-input v-model="sizeForm.orderNo" disabled ></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -509,7 +509,6 @@ export default {
return return
} }
const res = await getDetailList({ id: row.materialId }) const res = await getDetailList({ id: row.materialId })
console.log("res1", res)
if (res.data.success) { if (res.data.success) {
if (!Array.isArray(this.sizeForm.singleData)) { if (!Array.isArray(this.sizeForm.singleData)) {
this.sizeForm.singleData = []; this.sizeForm.singleData = [];
@ -521,8 +520,6 @@ export default {
} else { } else {
this.sizeForm.singleData.push({ ...row, ...materialData }); this.sizeForm.singleData.push({ ...row, ...materialData });
} }
console.log("更新后的singleData:", this.sizeForm.singleData);
} else { } else {
this.$message.error(res.data.message || "获取物资信息失败"); this.$message.error(res.data.message || "获取物资信息失败");
} }

@ -6,108 +6,93 @@
<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-col :span="12" v-show="sizeForm.options == 1 && outDialogType != 'add'">
<el-form-item label="仓库名称"> <el-form-item label="入库单号">
<el-input v-model="sizeForm.waNmae" :disabled="outDialogType != 'add'||type =='一级库'"></el-input> <el-input v-model="sizeForm.orderNo" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="出库单号">
<el-input v-model="sizeForm.code" disabled></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-date-picker v-model="sizeForm.inDate" type="date" placeholder="选择日期" style="width: 100%;" disabled> <el-date-picker v-model="sizeForm.outDate" 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.argument" :disabled="outDialogType != 'add'"></el-input> <el-input v-model="sizeForm.reason" :disabled="outDialogType == '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.type" placeholder="请选择" style="width: 100%;" <el-select v-model="sizeForm.materialType" placeholder="请选择" style="width: 100%;"
:disabled="outDialogType != 'add'"> :disabled="outDialogType == '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="outDialogType != 'add'"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="填报人">
<el-input v-model="sizeForm.submitName" :disabled="outDialogType != 'add'"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="审批人">
<el-input v-model="sizeForm.applyNmae" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="二级入库确认">
<el-input v-model="sizeForm.applyNmae" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="选项"> <el-form-item label="选项">
<el-radio-group v-model="sizeForm.radio" @change="radioChange()" :disabled="outDialogType != 'add'"> <el-radio-group v-model="sizeForm.options" @change="radioChange()" :disabled="outDialogType == 'details'">
<el-radio :label="1" :disabled="sizeForm.type == 2">批量选择</el-radio> <el-radio :label="1" :disabled="sizeForm.type == 2">批量选择</el-radio>
<el-radio :label="2">单项选择</el-radio> <el-radio :label="2">单项选择</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="sizeForm.radio==1"> <el-col :span="12" v-if="sizeForm.options == 1">
<el-form-item label="需求单名称"> <el-form-item label="需求单名称">
<el-input v-model="sizeForm.xuqiudanmingcheng" disabled></el-input> <el-input v-model="sizeForm.demandEndInfo" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="部门" v-if="sizeForm.radio==1">
<el-input v-model="sizeForm.bumen" disabled></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<!-- <div class="form-title">2025年04月05日出库信息</div> --> <div class="form-title">{{ outDate }} 出库信息</div>
<el-button type="primary" size="mini" style="margin-bottom: 18px;" @click="inTableAdd()">新增</el-button> <el-button type="primary" size="mini" style="margin-bottom: 18px;" @click="inTableAdd()"
v-if="sizeForm.options == 2">新增</el-button>
<el-table :data="sizeForm.inTableData" border style="width: 100%"> <el-table :data="sizeForm.inTableData" border style="width: 100%">
<el-table-column prop="str1" label="编码" width="100"> <el-table-column prop="materialCode" label="物资编码">
</el-table-column> </el-table-column>
<el-table-column prop="str2" label="名称" width="140"> <el-table-column prop="materialName" label="物资名称">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.str2" placeholder="请选择" style="width: 100%;" size="mini" <el-select v-model="scope.row.materialitem" placeholder="请选择物资名称" style="width: 100%;"
@change="changeName(scope.$index)"> @change="handleMaterialChange(scope.row.materialitem, scope.$index)"
<el-option label="名称一" value="1"></el-option> v-if='inDialogType != "details" && sizeForm.options == 2' value-key="id">
<el-option label="名称二" value="2"></el-option> <el-option v-for="item in materials" :key="item.materialId" :label="item.materialName" :value="item">
</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="str3" label="规格" width="100"> <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>
<el-table-column prop="str4" label="类别" width="100"> <el-table-column prop="unit" label="单位">
</el-table-column> </el-table-column>
<el-table-column prop="str5" label="单位" width="100"> <el-table-column prop="departmentName" label="部门" v-if="sizeForm.options == 2">
<template slot-scope="scope">
<el-select v-model="scope.row.department" placeholder="请选择部门名称" style="width: 100%;"
v-if='inDialogType != "details"'>
<el-option v-for="item in list" :key="item.departmentId" :label="item.department"
:value="item.departmentId">
</el-option>
</el-select>
<span v-else> {{ scope.row.departmentName }}</span>
</template>
</el-table-column> </el-table-column>
<el-table-column prop="str6" label="申请数量" width="100"> <el-table-column prop="applicationQuantity" label="申请数量" v-if="sizeForm.options == 1">
</el-table-column> </el-table-column>
<el-table-column prop="yichuku" label="已出库" width="100"> <el-table-column prop="outboundQuantity" label="已出库数量" v-if="sizeForm.options == 1">
</el-table-column> </el-table-column>
<el-table-column prop="str7" label="出库数量" width="140"> <el-table-column prop="theInboundQuantity" label="本次入库数量">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number size="mini" v-model="scope.row.str7" :min="1" style="width: 100%;" <el-input-number size="mini" v-model="scope.row.theInboundQuantity" :min="1" style="width: 100%;"
:disabled="outDialogType != 'add'" v-if="scope.row.str7" @change="numberChange($event)"></el-input-number> @change="syncInboundQuantity(scope.row)" :disabled="outDialogType == 'details'"></el-input-number>
<!-- <span v-else>{{ scope.row.theInboundQuantity || 0 }}</span> -->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="str8" label="单价" width="100">
</el-table-column>
<!-- <el-table-column prop="status" label="出库情况"> <!-- <el-table-column prop="status" label="出库情况">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="putIn(scope.row)" v-if="scope.row.status == 1">出库</el-button> <el-button type="text" @click="putIn(scope.row)" v-if="scope.row.status == 1">出库</el-button>
@ -115,42 +100,39 @@
</template> </template>
</el-table-column> --> </el-table-column> -->
</el-table> </el-table>
<div class="form-title">出库账目表格</div> <div class="form-title" v-if="outDialogType !== 'details'">出库账目表格</div>
<el-table :data="sizeForm.inAccountsTableData" border style="width: 100%"> <el-table :data="sizeForm.inTableData" border style="width: 100%" v-if="outDialogType !== 'details'">
<el-table-column prop="date" label="当前库存" width="100"> <el-table-column prop="date" label="当前库存" width="100">
<el-table-column prop="str1" label="编码" width="100"> <el-table-column prop="materialCode" label="物资编码">
</el-table-column> </el-table-column>
<el-table-column prop="str2" label="名称" width="100"> <el-table-column prop="materialName" label="物资名称">
<template slot-scope="scope">
<el-select v-if="sizeForm.radio == 2" v-model="sizeForm.type" placeholder="请选择" style="width: 100%;"
:disabled="outDialogType != 'add'">
<el-option label="办公室物资" value="1"></el-option>
<el-option label="其他物资" value="2"></el-option>
</el-select>
<span v-else>{{ scope.row.str2 }}</span>
</template>
</el-table-column> </el-table-column>
<el-table-column prop="str3" label="规格" width="100"> <el-table-column prop="model" label="规格">
</el-table-column> </el-table-column>
<el-table-column prop="str4" label="类别" width="100"> <el-table-column prop="type" label="类别">
</el-table-column> <template slot-scope="scope">
<el-table-column prop="str5" label="单位" width="100"> {{ scope.row.type === "NY" ? "耐用品" : (scope.row.type === "YH" ? "易耗品" : "") }}
</template>
</el-table-column> </el-table-column>
<el-table-column prop="str6" label="数量" width="100"> <el-table-column prop="departmentName" label="部门" v-if="sizeForm.options == 2">
<template slot-scope="scope">
<span>
{{ getDepartmentName(scope.row.department) }}
</span>
</template>
</el-table-column> </el-table-column>
<el-table-column prop="str7" label="单价" width="100"> <!-- <el-table-column prop="str6" label="数量" v-if="sizeForm.options == 1">
</el-table-column> -->
<el-table-column prop="theInboundQuantity" label="本次出库数量">
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column prop="date" label="出库信息" width="100"> <el-table-column prop="date" label="出库信息" v-if="sizeForm.options == 1">
<el-table-column prop="str8" label="数量" width="100"> <el-table-column prop="outboundQuantity" label="数量">
</el-table-column>
<el-table-column prop="str9" label="单价" width="100">
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column prop="date" label="出库后库存"> <el-table-column prop="date" label="出库后库存" v-if="sizeForm.options == 1">
<el-table-column prop="str10" label="数量" width="100"> <el-table-column prop="str10" label="数量">
</el-table-column>
<el-table-column prop="str11" label="单价" width="100">
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
@ -158,46 +140,46 @@
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<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="sumbit()">提交</el-button> <el-button type="primary" @click="submit(2)">提交</el-button>
</span> </span>
</el-dialog> </el-dialog>
<!-- 批量出库 选择 --> <!-- 批量出库 选择弹窗 -->
<el-dialog :close-on-click-modal="false" title="选择数据来源" :visible.sync="inBatchDialogVisible" :append-to-body="true" <el-dialog :close-on-click-modal="false" title="选择数据来源" :visible.sync="inBatchDialogVisible" :append-to-body="true"
width="40%" @close="handleBatchClose"> width="40%" @close="handleBatchClose" @open="getQuarterList">
<el-form :model="inBatchForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic"> <el-form :model="inBatchForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="需求单"> <el-form-item label="需求单">
<el-select v-model="inBatchForm.batchType" placeholder="请选择" style="width: 100%;"> <template slot-scope="scope">
<el-option label="2025年1季度" value="1"></el-option> <el-select v-model="inBatchForm.batchType" placeholder="请选择需求单" style="width: 100%;">
<el-option label="2025年2季度" value="2"></el-option> <el-option v-for="item in quarterList" :key="item.ids" :label="item.quarterName" :value="item.ids">
<el-option label="2025年3季度" value="3"></el-option> </el-option>
<el-option label="2025年4季度" value="4"></el-option> </el-select>
</el-select> </template>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="部门"> <el-form-item label="部门">
<el-select v-model="inBatchForm.bumen" placeholder="请选择" style="width: 100%;"> <el-select v-model="inBatchForm.department" placeholder="请选择" style="width: 100%;">
<el-option label="部门1" value="1"></el-option> <el-option v-for="item in departmentList" :key="item.departmentId" :label="item.department"
<el-option label="部门2" value="2"></el-option> :value="item.departmentId">
<el-option label="部门3" value="3"></el-option> </el-option>
<el-option label="部门4" value="4"></el-option> </el-select>
</el-select> </el-form-item>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="handleBatchClose()"> </el-button> <el-button @click="handleBatchClose()"> </el-button>
<el-button type="primary" @click="batchSumbit()"> </el-button> <el-button type="primary" @click="batchSubmit()"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { getQuarterList, getDepartmentList, getDetailedList, getDetailedItems, submitData, getMaterialList, editList } from "@/api/firstOrder/outbound";
export default { export default {
props: { props: {
repairVisible: { repairVisible: {
@ -212,31 +194,57 @@ export default {
type: String, type: String,
default: '' default: ''
}, },
type:{ type: {
type: String, type: String,
default: '' default: ''
},
id: {
type: Number,
default: 0
} }
}, },
data() { data() {
return { return {
quarterList: [],
departmentList: [],
outDialogVisible: false, outDialogVisible: false,
sizeForm: { sizeForm: {
code: '',// orderNo: '',//
applyNmae: '',// reason: '',//
submitName: '',// // inAccountsTableData: [],//
waNmae: '',//
argument: '',//
inAccountsTableData: [],//
inTableData: [], inTableData: [],
ldOneOutStorageDetailVOList: [],
demandEndInfo: '',//
outDate: '',//
options: '',//
materialType: '1',//
status: '',//1 2
// materialld: '',//Id
userInfoVO: {
userId: "用户ID",
name: "用户名称"
},
}, },
uniqueListDialogVisible: false, //
uniqueList: [],
inTableData: [], inTableData: [],
inBatchDialogVisible: false,// inBatchDialogVisible: false,//
batchType: '',// batchType: '',//
inBatchForm:{ inBatchForm: {
batchType:'', batchType: '',
bumen:'' department: ''
}, },
quarterYearMap: {},
quarterQuarterMap: {}
}
},
computed: {
outDate() {
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() { mounted() {
@ -246,158 +254,322 @@ export default {
} else { } else {
this.inInit() this.inInit()
} }
this.getDetailedItems()
this.getMaterialList()
}, },
methods: { methods: {
//
syncInboundQuantity(row) {
row.theInboundQuantity = Number(row.theInboundQuantity);
},
//
handleCloseDetail() { handleCloseDetail() {
this.outDialogVisible = false this.outDialogVisible = false
this.$emit('handleCloseDetail') this.$emit('handleCloseDetail')
}, },
inInit() { //
const randomNum = Math.floor(Math.random() * 100000000) + 1; async getQuarterList() {
this.sizeForm.code = String(randomNum).padStart(8, '0');// try {
this.sizeForm.applyNmae = '审批人一' const res = await getQuarterList()
this.sizeForm.submitName = '填报人一' if (res.data && res.data.result) {
this.sizeForm.radio = 1 this.quarterList = res.data.result
this.sizeForm.waNmae = '仓库一' this.quarterList.forEach(item => {
this.sizeForm.argument = '入库' if (item.year && item.quarter && item.ids) {
this.sizeForm.type = '1' this.quarterYearMap[item.ids] = item.year
this.sizeForm.inDate = new Date()// this.quarterQuarterMap[item.ids] = item.quarter
this.sizeForm.inTableData.push({ this.sizeForm.inTableData.ldDemandEndId = item.ids
str1: '000001', }
str2: '物品1', })
str3: '规格1', }
str4: '类别1', } catch (error) {
str5: '单位1', console.error('获取需求单列表失败:', error)
str6: '11', this.$message.error('获取需求单列表失败')
str7: '22',
str8: '3',
str9: '33',
name: '审批人',
status: '1',//
yichuku:0,
})
},
addInit() {
//
const randomNum = Math.floor(Math.random() * 100000000) + 1;
this.sizeForm.code = String(randomNum).padStart(8, '0');//
this.sizeForm.inDate = new Date()//
if(this.type =='一级库'){
this.sizeForm.waNmae = '一级库'
} }
}, },
handleCloseDetail() {
this.inDialogVisible = false
this.$emit('handleCloseDetail')
},
//
inTableAdd() {
this.sizeForm.inTableData.push({
str1: '',
str2: '',
str3: '',
str4: '',
str5: '',
str6: '',
str7: 0,
name: '',
})
},
//
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",
}) //
async onQuarterSelectChange(ids) {
if (!ids) return
const year = this.quarterYearMap[ids]
const quarter = this.quarterQuarterMap[ids]
if (year && quarter) {
try {
const res = await getDepartmentList({
year: year,
quarter: quarter
})
if (res.data && res.data.result) {
this.departmentList = res.data.result
} else {
this.departmentList = []
}
} catch (error) {
this.$message.error('获取部门列表失败')
this.departmentList = []
}
} else {
this.departmentList = []
}
}, },
// //
handleBatchClose() { handleBatchClose() {
this.inBatchDialogVisible = false this.inBatchDialogVisible = false
}, },
//
batchSumbit() {
this.sizeForm.bumen='部门一'
this.sizeForm.xuqiudanmingcheng = '2025年一季度需求单'
this.sizeForm.inTableData.push({
str1: '000001',
str2: '物品1',
str3: '规格1',
str4: '类别1',
str5: '单位1',
str6: '11',
str7: '22',
str8: '3',
str9: '部门一',
name: '审批人',
status: '1',//
yichuku:98,
})
this.inBatchDialogVisible = false async batchSubmit() {
if (!this.inBatchForm.batchType) {
this.$message.error('请选择需求单');
return;
}
if (!this.inBatchForm.department) {
this.$message.error('请选择部门');
return;
}
const res = await getDetailedList({
ids: this.inBatchForm.batchType,
departmentId: this.inBatchForm.department
})
if (res.data && res.data.result) {
this.sizeForm.inTableData = res.data.result.duplicateList
const selectedDept = this.departmentList.find(
dept => dept.departmentId === this.inBatchForm.department
);
const deptName = selectedDept ? selectedDept.department : '';
this.sizeForm.inTableData = res.data.result.duplicateList.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
)
if (selectedQuarter) {
this.sizeForm.demandEndInfo = selectedQuarter.quarterName;
}
} else {
this.$message.warning('未获取到详细数据');
}
}, },
// //
save() { async getDetailedItems() {
this.$message({ this.loading = true
type: "success", try {
message: "保存成功" const res = await getDetailedItems();
}); this.list = res.data.result
this.handleCloseDetail() } catch (error) {
this.$message.error("获取数据来源失败,请重试");
} finally {
this.loading = false;
}
},
getDepartmentName(departmentId) {
const department = this.list.find(item => item.departmentId === departmentId);
return department ? department.department : '';
},
//
async getMaterialList() {
this.loading = true
try {
const res = await getMaterialList();
this.materials = res.data.result
} catch (error) {
this.$message.error("获取数据来源失败,请重试");
} finally {
this.loading = false;
}
},
//
handleMaterialChange(row, index) {
this.sizeForm.inTableData[index].materialId = row.materialId
this.sizeForm.inTableData[index].model = row.model
this.sizeForm.inTableData[index].materialCode = row.materialCode
this.sizeForm.inTableData[index].materialName = row.materialName
this.sizeForm.inTableData[index].type = row.type
this.sizeForm.inTableData[index].unit = row.unit
}, },
// //
sumbit() { async submit(index) {
this.$message({ if (!this.sizeForm.reason) {
type: "success", this.$message.error("事由不能为空");
message: "提交成功" return;
}
if (!this.sizeForm.materialType) {
this.$message.error("请选择物资类型");
return;
}
if (this.sizeForm.options === 1) {
if (!this.sizeForm.demandEndInfo) {
this.$message.error("请选择需求单名称");
return;
}
if (!this.sizeForm.inTableData || this.sizeForm.inTableData.length === 0) {
this.$message.error("请添加批量选择数据");
return;
}
if (this.sizeForm.options === 2) {
for (const row of this.sizeForm.inTableData) {
if (!row.departmentName) {
this.$message.error("请选择部门");
return;
}
}
}
}
// 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.handleCloseDetail() this.sizeForm.ldOneOutStorageDetailVOList.departmentName = this.sizeForm.inTableData.department
this.sizeForm.inTableData = []
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 || "提交失败");
}
}, },
//
async inInit() {
if (this.outDialogType == 'details' || this.outDialogType == 'edit') {
try {
const res = await editList(this.id);
const { ldOneOutStorage, ldOneOutStorageDetails = [] } = res.data.result || {};
if (!ldOneOutStorage) {
this.$message.error("回显数据异常");
return;
}
const handledDetailList = ldOneOutStorageDetails.map(item => ({
...item,
// theInboundQuantity: item.theInboundQuantity || 0
}))
this.sizeForm = {
...this.sizeForm,
...ldOneOutStorage,
outDate: ldOneOutStorage.outDate ? new Date(ldOneOutStorage.outDate) : '',
options: Number(ldOneOutStorage.options) || 1,
}
this.sizeForm.inTableData = handledDetailList;
} catch (error) {
console.error("回显失败:", error);
this.$message.error("获取详情数据失败");
}
}
},
addInit() {
// //
// const randomNum = Math.floor(Math.random() * 100000000) + 1;
// this.sizeForm.code = String(randomNum).padStart(8, '0');//
this.sizeForm.outDate = new Date()//
},
//
inTableAdd() {
this.sizeForm.inTableData.push({})
},
// //
// // 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
// },
// //
// batchSumbit() {
// this.sizeForm.bumen = ''
// this.sizeForm.xuqiudanmingcheng = '2025'
// this.sizeForm.inTableData.push({
// // str1: '000001',
// // str2: '1',
// // str3: '1',
// // str4: '1',
// // str5: '1',
// // str6: '11',
// // str7: '22',
// // str8: '3',
// // str9: '',
// // name: '',
// // status: '1',//
// // yichuku: 98,
// })
// this.inBatchDialogVisible = false
// },
// //
radioChange(val) { async radioChange() {
this.sizeForm.inTableData = [] this.sizeForm.inTableData = []
if (this.sizeForm.radio == 1) { if (this.sizeForm.options == 1) {
await this.getQuarterList() //
this.inBatchDialogVisible = true this.inBatchDialogVisible = true
} }
}, },
// //
// changeName(index) {
changeName(index) { // console.log(9999, index)
console.log(9999, index) // this.sizeForm.inTableData.forEach((item, i) => {
this.sizeForm.inTableData.forEach((item,i)=>{ // if (i == index) {
if(i==index){ // item.str1 = '000001'
item.str1= '000001' // item.str2 = '1'
item.str2= '物品1' // item.str3 = '1'
item.str3= '规格1' // item.str4 = '1'
item.str4= '类别1' // item.str5 = '1'
item.str5= '单位1' // item.str6 = '11'
item.str6= '11' // item.str7 = 22
item.str7= 22 // item.str8 = '3'
item.str8= '3' // item.str9 = ''
item.str9= '部门一' // item.name = ''
item.name= '审批人' // item.status = '1'
item.status= '1' // this.$set(item, 'str7', 22)
this.$set(item,'str7',22) // }
} // })
}) // console.log(888888, this.sizeForm.inTableData)
console.log(888888, this.sizeForm.inTableData) // },
},
numberChange() { numberChange() {
this.$forceUpdate();// this.$forceUpdate();//
console.log(77777, this.sizeForm.inTableData) console.log(77777, this.sizeForm.inTableData)
} }
},
watch: {
//
'inBatchForm.batchType': function (newVal) {
if (newVal) {
this.onQuarterSelectChange(newVal)
}
}
} }
} }
</script> </script>

@ -0,0 +1,586 @@
<template>
<div>
<el-dialog :close-on-click-modal="false" :title="outDialogTiltle" :visible.sync="outDialogVisible"
: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" v-show="sizeForm.options == 1 && outDialogType != 'add'">
<el-form-item label="入库单号">
<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.outDate" 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="outDialogType == 'details'"></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="outDialogType == 'details'">
<el-option label="办公室物资" value="1"></el-option>
<el-option label="其他物资" value="2"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="选项">
<el-radio-group v-model="sizeForm.options" @change="radioChange()"
:disabled="outDialogType == 'details'">
<el-radio :label="1" :disabled="sizeForm.type == 2">批量选择</el-radio>
<el-radio :label="2">单项选择</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12" v-if="sizeForm.options == 1">
<el-form-item label="需求单名称">
<el-input v-model="sizeForm.demandEndInfo" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<div class="form-title">{{ outDate }} 出库信息</div>
<el-button type="primary" size="mini" style="margin-bottom: 18px;" @click="inTableAdd()"
v-if="sizeForm.options == 2">新增</el-button>
<el-table :data="sizeForm.inTableData" border style="width: 100%">
<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.materialitem" placeholder="请选择物资名称" style="width: 100%;"
@change="handleMaterialChange(scope.row.materialitem, scope.$index)"
v-if='inDialogType != "details" && sizeForm.options == 2' value-key="id">
<el-option v-for="item in materials" :key="item.materialId" :label="item.materialName"
:value="item">
</el-option>
</el-select>
<span v-else> {{ scope.row.materialName }}</span>
</template>
</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="departmentName" label="部门" v-if="sizeForm.options == 2">
<template slot-scope="scope">
<el-select v-model="scope.row.department" placeholder="请选择部门名称" style="width: 100%;"
v-if='inDialogType != "details"'>
<el-option v-for="item in list" :key="item.departmentId" :label="item.department"
:value="item.departmentId">
</el-option>
</el-select>
<span v-else> {{ scope.row.departmentName }}</span>
</template>
</el-table-column>
<el-table-column prop="applicationQuantity" label="申请数量" v-if="sizeForm.options == 1">
</el-table-column>
<el-table-column prop="outboundQuantity" label="已出库数量" v-if="sizeForm.options == 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)"
:disabled="outDialogType == 'details'"></el-input-number>
<!-- <span v-else>{{ scope.row.theInboundQuantity || 0 }}</span> -->
</template>
</el-table-column>
<!-- <el-table-column prop="status" label="出库情况">
<template slot-scope="scope">
<el-button type="text" @click="putIn(scope.row)" v-if="scope.row.status == 1">出库</el-button>
<span v-if="scope.row.status == 0">已出库</span>
</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'">
<el-table-column prop="date" label="当前库存" width="100">
<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="departmentName" label="部门" v-if="sizeForm.options == 2">
<template slot-scope="scope">
<span>
{{ getDepartmentName(scope.row.department) }}
</span>
</template>
</el-table-column>
<!-- <el-table-column prop="str6" label="数量" v-if="sizeForm.options == 1">
</el-table-column> -->
<el-table-column prop="theInboundQuantity" label="本次出库数量">
</el-table-column>
</el-table-column>
<el-table-column prop="date" label="出库信息" v-if="sizeForm.options == 1">
<el-table-column prop="outboundQuantity" label="数量">
</el-table-column>
</el-table-column>
<el-table-column prop="date" label="出库后库存" v-if="sizeForm.options == 1">
<el-table-column prop="str10" label="数量">
</el-table-column>
</el-table-column>
</el-table>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handleCloseDetail()"> </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="getQuarterList">
<el-form :model="inBatchForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic">
<el-row>
<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-option>
</el-select>
</template>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="部门">
<el-select v-model="inBatchForm.department" placeholder="请选择" style="width: 100%;">
<el-option v-for="item in departmentList" :key="item.departmentId"
:label="item.department" :value="item.departmentId">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<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 { getQuarterList, getDepartmentList, getDetailedList, getDetailedItems, submitData, getMaterialList, editList } from "@/api/firstOrder/outbound";
export default {
props: {
repairVisible: {
type: Boolean,
default: false
},
outDialogTiltle: {
type: String,
default: ''
},
outDialogType: {
type: String,
default: ''
},
type: {
type: String,
default: ''
},
id: {
type: Number,
default: 0
}
},
data() {
return {
quarterList: [],
departmentList: [],
outDialogVisible: false,
sizeForm: {
orderNo: '',//
reason: '',//
// inAccountsTableData: [],//
inTableData: [],
ldOneOutStorageDetailVOList: [],
demandEndInfo: '',//
outDate: '',//
options: '',//
materialType: '1',//
status: '',//1 2
// materialld: '',//Id
userInfoVO: {
userId: "用户ID",
name: "用户名称"
},
},
inTableData: [],
inBatchDialogVisible: false,//
batchType: '',//
inBatchForm: {
batchType: '',
department: ''
},
quarterYearMap: {},
quarterQuarterMap: {}
}
},
computed: {
outDate() {
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.outDialogVisible = this.repairVisible
if (this.outDialogType == 'add') {
this.addInit()
} else {
this.inInit()
}
this.getDetailedItems()
this.getMaterialList()
},
methods: {
//
syncInboundQuantity(row) {
row.theInboundQuantity = Number(row.theInboundQuantity);
},
//
handleCloseDetail() {
this.outDialogVisible = false
this.$emit('handleCloseDetail')
},
//
async getQuarterList() {
try {
const res = await getQuarterList()
if (res.data && res.data.result) {
this.quarterList = res.data.result
this.quarterList.forEach(item => {
if (item.year && item.quarter && item.ids) {
this.quarterYearMap[item.ids] = item.year
this.quarterQuarterMap[item.ids] = item.quarter
this.sizeForm.inTableData.ldDemandEndId = item.ids
}
})
}
} catch (error) {
console.error('获取需求单列表失败:', error)
this.$message.error('获取需求单列表失败')
}
},
//
async onQuarterSelectChange(ids) {
if (!ids) return
const year = this.quarterYearMap[ids]
const quarter = this.quarterQuarterMap[ids]
if (year && quarter) {
try {
const res = await getDepartmentList({
year: year,
quarter: quarter
})
if (res.data && res.data.result) {
this.departmentList = res.data.result
} else {
this.departmentList = []
}
} catch (error) {
this.$message.error('获取部门列表失败')
this.departmentList = []
}
} else {
this.departmentList = []
}
},
//
handleBatchClose() {
this.inBatchDialogVisible = false
},
async batchSubmit() {
if (!this.inBatchForm.batchType) {
this.$message.error('请选择需求单');
return;
}
if (!this.inBatchForm.department) {
this.$message.error('请选择部门');
return;
}
const res = await getDetailedList({
ids: this.inBatchForm.batchType,
departmentId: this.inBatchForm.department
})
if (res.data.result.uniqueList) {
}
if (res.data && res.data.result) {
this.sizeForm.inTableData = res.data.result.duplicateList
const selectedDept = this.departmentList.find(
dept => dept.departmentId === this.inBatchForm.department
);
const deptName = selectedDept ? selectedDept.department : '';
this.sizeForm.inTableData = res.data.result.duplicateList.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
)
if (selectedQuarter) {
this.sizeForm.demandEndInfo = selectedQuarter.quarterName;
}
} else {
this.$message.warning('未获取到详细数据');
}
},
//
async getDetailedItems() {
this.loading = true
try {
const res = await getDetailedItems();
this.list = res.data.result
} catch (error) {
this.$message.error("获取数据来源失败,请重试");
} finally {
this.loading = false;
}
},
getDepartmentName(departmentId) {
const department = this.list.find(item => item.departmentId === departmentId);
return department ? department.department : '';
},
//
async getMaterialList() {
this.loading = true
try {
const res = await getMaterialList();
this.materials = res.data.result
} catch (error) {
this.$message.error("获取数据来源失败,请重试");
} finally {
this.loading = false;
}
},
//
handleMaterialChange(row, index) {
this.sizeForm.inTableData[index].materialId = row.materialId
this.sizeForm.inTableData[index].model = row.model
this.sizeForm.inTableData[index].materialCode = row.materialCode
this.sizeForm.inTableData[index].materialName = row.materialName
this.sizeForm.inTableData[index].type = row.type
this.sizeForm.inTableData[index].unit = row.unit
},
//
async submit(index) {
if (!this.sizeForm.reason) {
this.$message.error("事由不能为空");
return;
}
if (!this.sizeForm.materialType) {
this.$message.error("请选择物资类型");
return;
}
if (this.sizeForm.options === 1) {
if (!this.sizeForm.demandEndInfo) {
this.$message.error("请选择需求单名称");
return;
}
if (!this.sizeForm.inTableData || this.sizeForm.inTableData.length === 0) {
this.$message.error("请添加批量选择数据");
return;
}
if (this.sizeForm.options === 2) {
for (const row of this.sizeForm.inTableData) {
if (!row.departmentName) {
this.$message.error("请选择部门");
return;
}
}
}
}
// 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
this.sizeForm.inTableData = []
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 || "提交失败");
}
},
//
async inInit() {
if (this.outDialogType == 'details' || this.outDialogType == 'edit') {
try {
const res = await editList(this.id);
const { ldOneOutStorage, ldOneOutStorageDetails = [] } = res.data.result || {};
if (!ldOneOutStorage) {
this.$message.error("回显数据异常");
return;
}
const handledDetailList = ldOneOutStorageDetails.map(item => ({
...item,
// theInboundQuantity: item.theInboundQuantity || 0
}))
this.sizeForm = {
...this.sizeForm,
...ldOneOutStorage,
outDate: ldOneOutStorage.outDate ? new Date(ldOneOutStorage.outDate) : '',
options: Number(ldOneOutStorage.options) || 1,
}
this.sizeForm.inTableData = handledDetailList;
} catch (error) {
console.error("回显失败:", error);
this.$message.error("获取详情数据失败");
}
}
},
addInit() {
// //
// const randomNum = Math.floor(Math.random() * 100000000) + 1;
// this.sizeForm.code = String(randomNum).padStart(8, '0');//
this.sizeForm.outDate = new Date()//
},
//
inTableAdd() {
this.sizeForm.inTableData.push({})
},
// //
// // 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
// },
// //
// batchSumbit() {
// this.sizeForm.bumen = ''
// this.sizeForm.xuqiudanmingcheng = '2025'
// this.sizeForm.inTableData.push({
// // str1: '000001',
// // str2: '1',
// // str3: '1',
// // str4: '1',
// // str5: '1',
// // str6: '11',
// // str7: '22',
// // str8: '3',
// // str9: '',
// // name: '',
// // status: '1',//
// // yichuku: 98,
// })
// this.inBatchDialogVisible = false
// },
//
async radioChange() {
this.sizeForm.inTableData = []
if (this.sizeForm.options == 1) {
await this.getQuarterList() //
this.inBatchDialogVisible = true
}
},
//
// changeName(index) {
// console.log(9999, index)
// this.sizeForm.inTableData.forEach((item, i) => {
// if (i == index) {
// item.str1 = '000001'
// item.str2 = '1'
// item.str3 = '1'
// item.str4 = '1'
// item.str5 = '1'
// item.str6 = '11'
// item.str7 = 22
// item.str8 = '3'
// item.str9 = ''
// item.name = ''
// item.status = '1'
// this.$set(item, 'str7', 22)
// }
// })
// console.log(888888, this.sizeForm.inTableData)
// },
numberChange() {
this.$forceUpdate();//
console.log(77777, this.sizeForm.inTableData)
}
},
watch: {
//
'inBatchForm.batchType': function (newVal) {
if (newVal) {
this.onQuarterSelectChange(newVal)
}
}
}
}
</script>
<style lang="scss" scoped>
.form-title {
margin: 20px 0;
}
</style>

@ -1,24 +1,29 @@
<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" @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset" :permission="permissionList" @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" @row-click="rowSelect"> @refresh-change="refreshChange" @on-load="onLoad" >
<!-- @row-click="rowSelect" -->
<template slot-scope="scope" slot="menuLeft"> <template slot-scope="scope" slot="menuLeft">
<el-button size="small" plain @click.stop="handleDesign()">新增出库单 <el-button size="small" plain @click="handleDesign()">新增出库单
</el-button> </el-button>
<el-button size="small" plain @click.stop="handleExport()">出库单导出 <el-button size="small" plain @click="handleExport()">出库单导出
</el-button> </el-button>
</template> </template>
<template slot-scope="scope" slot="xuqiudanmingcheng"> <template slot-scope="scope" slot="purchaseEndInfo">
<el-button type="text" @click.stop="purchaseFn(scope.row)" <el-button type="text" @click.stop="purchaseFn(scope.row)" v-if="scope.row.purchaseEndInfo != ''">{{
v-if="scope.row.xuqiudanmingcheng != ''">{{ scope.row.xuqiudanmingcheng }}</el-button> scope.row.purchaseEndInfo }}</el-button>
<span v-else></span> <span v-else></span>
</template> </template>
<template #menu="scope">
<el-button type="text" @click.stop="handleDetails(scope.row)">详情</el-button>
<el-button type="text" v-if="scope.row.status == 1" @click.stop="handleEdit(scope.row)">编辑</el-button>
</template>
</avue-crud> </avue-crud>
<outDialog v-if="outDialogVisible" :repairVisible='outDialogVisible' :outDialogTiltle="outDialogTiltle" <outDialog v-if="outDialogVisible" :repairVisible='outDialogVisible' :outDialogTiltle="outDialogTiltle"
:outDialogType="outDialogType" @handleCloseDetail="handleCloseDetail" type="一级库"> :outDialogType="outDialogType" @handleCloseDetail="handleCloseDetail" type="一级库" @submitSuccess="handleSubmitSuccess"
:id="id">
</outDialog> </outDialog>
<!-- 需求单明细 --> <!-- 需求单明细 -->
@ -29,11 +34,10 @@
</template> </template>
<script> <script>
import { getList, remove } from "@/api/report/report"; import { getList } from "@/api/firstOrder/outbound";
import { mapGetters } from "vuex"; // import { mapGetters } from "vuex";
import outDialog from './components/outDialog.vue'; import outDialog from './components/outDialog.vue';
import needDialog from './components/needDialog.vue'; import needDialog from './components/needDialog.vue';
export default { export default {
components: { components: {
outDialog, outDialog,
@ -41,7 +45,8 @@ export default {
}, },
data() { data() {
return { return {
form: {}, // form: {},
form: { outDate: [] },
selectionList: [], selectionList: [],
query: {}, query: {},
loading: true, loading: true,
@ -59,7 +64,10 @@ export default {
border: true, border: true,
index: true, index: true,
selection: true, selection: true,
viewBtn: true, viewBtn: false,
editBtn: false,
delBtn: false,
addBtn: false,
dialogClickModal: false, dialogClickModal: false,
selection: false, selection: false,
printBtn: false, printBtn: false,
@ -69,144 +77,156 @@ export default {
gridSpan: false, gridSpan: false,
filterBtn: false, filterBtn: false,
columnBtn: false, columnBtn: false,
menu: false, menuWidth: 120,
menu: true,
column: [ column: [
{ {
label: "需求单名称", label: "需求单名称",
prop: "xuqiudanmingcheng", prop: "demandEndInfo",
width: 180, width: 180,
}, },
{
label: "部门",
prop: "bumen",
},
{
label: "仓库类型",
prop: "str1",
},
{ {
label: "出库单号", label: "出库单号",
prop: "str2", prop: "orderNo",
width: 110
}, },
{ {
label: "出库时间", label: "出库日期",
prop: "str3", prop: "outDate",
search: true, search: true,
type: "datetime", type: "datetime",
searchRange: true,
startPlaceholder: '开始时间',
endPlaceholder: "结束时间",
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
width: 140,
// searchParam: 'startTime',
// searchEndParam: 'endTime'
}, },
{ {
label: "出库人", label: "事由",
prop: "str4", prop: "reason",
search: true, search: false,
}, },
{ {
label: "审批人", label: "物资类型",
prop: "str5", prop: "materialType",
search: false,
type: 'select',
dicData: [{
label: '办公物资',
value: '1'
},
{
label: '其他物资',
value: '2'
}]
}, },
{ {
label: "来源", label: "部门",
prop: "str6", prop: "department",
search: true,
}, },
{ {
label: "状态", label: "出库人",
prop: "str7", prop: "shipperName",
type: 'select', search: true,
dicData: [ searchParam: 'inOperator'
{
label: '暂存',
value: 1
},
{
label: '待确认',
value: 2
}, {
label: '确认',
value: 3
}
]
}, },
// {
// label: "",
// prop: "status",
// type: 'select',
// dicData: [
// {
// label: '',
// value: 1
// },
// {
// label: '',
// value: 2
// },
// {
// label: '',
// value: 3
// },
// ]
// },
] ]
}, },
data: [], data: [],
outDialogVisible: false, outDialogVisible: false,
outDialogTiltle: '出库', outDialogTiltle: '出库',
outDialogType: '', outDialogType: '',//
purchaseOpen: false purchaseOpen: false,
purchaseTitle: '',
inTitle: '',
}; };
}, },
computed: { computed: {
...mapGetters(["userInfo", "permission"]),
permissionList() {
return {
addBtn: false,
viewBtn: false,
delBtn: false,
editBtn: false
};
},
ids() {
let ids = [];
this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids.join(",");
}
}, },
methods: { methods: {
purchaseFn(row) {
this.purchaseOpen = true
this.purchaseTitle = row.xuqiudanmingcheng + '详情'
},
closeDialog() {
this.purchaseOpen = false
},
handlePreview() {
// this.$router.push({ path: `/myiframe/urlPath?name=preview-${name}&src=${this.website.design.reportUrl}/preview?_u=blade-${name}` });
},
handleDesign() { handleDesign() {
this.outDialogVisible = true this.outDialogVisible = true
this.outDialogType = 'add' this.outDialogType = 'add'
this.outDialogTiltle = '新增出库' this.outDialogTiltle = '新增出库'
}, },
// //
rowSelect(row) { handleDetails(row) {
this.outDialogVisible = true this.outDialogVisible = true
this.outDialogType = 'outbound' this.outDialogType = 'details'
this.outDialogTiltle = '出库' this.outDialogTiltle = '详情'
this.id = row.id
console.log(this.id,'id')
},
//
handleEdit(row) {
this.outDialogVisible = true
this.outDialogType = 'edit'
this.outDialogTiltle = '编辑'
this.id = row.id
},
//
purchaseFn(row) {
this.purchaseOpen = true
this.purchaseTitle = row.purchaseEndInfo + '需求单详情'
this.id = row.id
},
closeDialog() {
this.purchaseOpen = false
}, },
handleCloseDetail() { handleCloseDetail() {
this.outDialogVisible = false this.outDialogVisible = false
}, },
handleExport(name) { handleExport() {
this.$message({ this.$message({
type: "success", type: "success",
message: "出库单导出成功!" message: "出库单导出成功!"
});
},
rowDel(row) {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}) })
.then(() => { },
return remove(row.id); //
}) rowSelect() {
.then(() => { this.outDialogVisible = true
this.onLoad(this.page); this.outDialogType = 'outbound'
this.$message({ this.outDialogTiltle = '出库'
type: "success",
message: "操作成功!"
});
});
}, },
searchReset() { searchReset() {
this.query = {}; this.query = {};
this.form.outDate = []
this.form.inOperatorName = ''
this.form.inOperator = ''
this.onLoad(this.page); this.onLoad(this.page);
}, },
searchChange(params, done) { searchChange(params, done) {
if (params && params.inOperatorName && !params.inOperator) {
params.inOperator = params.inOperatorName;
delete params.inOperatorName;
}
this.query = params; this.query = params;
this.page.currentPage = 1; this.page.currentPage = 1;
this.onLoad(this.page, params); this.onLoad(this.page, params);
@ -219,28 +239,7 @@ export default {
this.selectionList = []; this.selectionList = [];
this.$refs.crud.toggleSelection(); this.$refs.crud.toggleSelection();
}, },
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
return;
}
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return remove(this.ids);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
this.$refs.crud.toggleSelection();
});
},
currentChange(currentPage) { currentChange(currentPage) {
this.page.currentPage = currentPage; this.page.currentPage = currentPage;
}, },
@ -250,50 +249,33 @@ export default {
refreshChange() { refreshChange() {
this.onLoad(this.page, this.query); this.onLoad(this.page, this.query);
}, },
//
handleSubmitSuccess() {
console.log(2)
console.log('父组件更新')
this.onLoad(this.page)
console.log('父组件更新完成')
},
//
onLoad(page, params = {}) { onLoad(page, params = {}) {
this.loading = true; this.loading = true;
this.data.push({ const queryParams = {
xuqiudanmingcheng: '20225年一季度需求单', ...params,
bumen: '部门1', ...this.query,
str1: '类型一', pageSize: page.pageSize,
str2: '00000001', pageNum: page.currentPage
str3: '2025-03-01', };
str4: '员工一', if (queryParams.outDate && Array.isArray(queryParams.outDate)) {
str5: '员工二', queryParams.startTime = queryParams.outDate[0];
str6: '采购', queryParams.endTime = queryParams.outDate[1];
str7: '1', delete queryParams.outDate;
}, { }
xuqiudanmingcheng: '20225年二季度需求单', getList(page.currentPage, page.pageSize, queryParams).then(res => {
bumen: '部门2', console.log('列表', res.data.result)
str1: '类型二', this.data = res.data.result.list;
str2: '00000002', this.loading = false;
str3: '2025-03-02', this.page.total = res.data.result.total;
str4: '员工一', });
str5: '员工二',
str6: '单项',
str7: '2',
}, {
xuqiudanmingcheng: '',
bumen: '部门3',
str1: '类型二',
str2: '00000002',
str3: '2025-03-02',
str4: '员工3',
str5: '员工3',
str6: '单项',
str7: '3',
}, {
xuqiudanmingcheng: '',
bumen: '部门3',
str1: '类型二',
str2: '00000002',
str3: '2025-03-02',
str4: '员工3',
str5: '员工3',
str6: '单项',
str7: '1',
})
this.loading = false
} }
} }
}; };

Loading…
Cancel
Save