2024-07-04 设备-备品备件出入库

yangwl
A0010407 9 months ago
parent 85e9bec4f8
commit 870e6c8da4

@ -1,446 +1,515 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="98px"> <el-form
<el-form-item label="仓库编码" prop="whCode"> :model="queryParams"
<el-input ref="queryForm"
v-model="queryParams.whCode" size="small"
placeholder="请输入仓库编码" :inline="true"
clearable v-show="showSearch"
@keyup.enter.native="handleQuery" label-width="98px"
/> >
</el-form-item> <el-form-item label="出入库类型" prop="inOutType">
<el-form-item label="库区编码" prop="waCode"> <el-select
<el-input v-model="queryParams.inOutType"
v-model="queryParams.waCode" placeholder="请选择出入库类型"
placeholder="请输入库区编码" @change="$forceUpdate()"
clearable clearable
@keyup.enter.native="handleQuery" style="width: 200px"
/> @keyup.enter.native="handleQuery"
</el-form-item> >
<el-form-item label="库位编码" prop="wlCode"> <el-option
<el-input v-for="dict in dict.type.in_out_type"
v-model="queryParams.wlCode" :key="dict.value"
placeholder="请输入库位编码" :label="dict.label"
clearable :value="dict.value"
@keyup.enter.native="handleQuery" ></el-option>
/> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="入库单号" prop="orderNo"> <el-form-item label="出入库单号" prop="orderNo">
<el-input <el-input
v-model="queryParams.orderNo" v-model="queryParams.orderNo"
placeholder="请输入入库单号" placeholder="请输入出入库单号"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="备品备件号" prop="materialCode"> <el-form-item label="备品备件号" prop="spareCode">
<el-input <el-input
v-model="queryParams.materialCode" v-model="queryParams.spareCode"
placeholder="请输入备品备件号" placeholder="请输入备品备件号"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="备品备件描述" prop="materialDesc"> <el-form-item label="备品备件名称" prop="spareName">
<el-input <el-input
v-model="queryParams.materialDesc" v-model="queryParams.spareName"
placeholder="请输入备品备件描述" placeholder="请输入备品备件名称"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> type="primary"
</el-form-item> icon="el-icon-search"
</el-form> size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['device:sparepartsInOutStorage:add']" v-hasPermi="['device:sparepartsInOutStorage:add']"
>新增</el-button> >新增</el-button
</el-col> >
<el-col :span="1.5"> </el-col>
<el-button <!-- <el-col :span="1.5">
type="success" <el-button
plain type="success"
icon="el-icon-edit" plain
size="mini" icon="el-icon-edit"
:disabled="single" size="mini"
@click="handleUpdate" :disabled="single"
v-hasPermi="['device:sparepartsInOutStorage:edit']" @click="handleUpdate"
>修改</el-button> v-hasPermi="['device:sparepartsInOutStorage:edit']"
</el-col> >修改</el-button
<el-col :span="1.5"> >
<el-button </el-col> -->
type="danger" <el-col :span="1.5">
plain <el-button
icon="el-icon-delete" type="danger"
size="mini" plain
:disabled="multiple" icon="el-icon-delete"
@click="handleDelete" size="mini"
v-hasPermi="['device:sparepartsInOutStorage:remove']" :disabled="multiple"
>删除</el-button> @click="handleDelete"
</el-col> v-hasPermi="['device:sparepartsInOutStorage:remove']"
<el-col :span="1.5"> >删除</el-button
<el-button >
type="warning" </el-col>
plain <el-col :span="1.5">
icon="el-icon-download" <el-button
size="mini" type="warning"
@click="handleExport" plain
v-hasPermi="['device:sparepartsInOutStorage:export']" icon="el-icon-download"
>导出</el-button> size="mini"
</el-col> @click="handleExport"
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> v-hasPermi="['device:sparepartsInOutStorage:export']"
</el-row> >导出</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="sparepartsInOutStorageList" @selection-change="handleSelectionChange"> <el-table
<el-table-column type="selection" width="55" align="center" /> v-loading="loading"
<!-- 序号 --> :data="sparepartsInOutStorageList"
<el-table-column type="index" width="90" align="center" :index="indexMethod" label="序号"/> @selection-change="handleSelectionChange"
<el-table-column label="仓库编码" align="center" prop="whCode" /> >
<el-table-column label="库区编码" align="center" prop="waCode" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="库位编码" align="center" prop="wlCode" width="100"/> <!-- 序号 -->
<el-table-column label="入库单号" align="center" prop="orderNo" width="100"/> <el-table-column
<el-table-column label="采购订单号" align="center" prop="poNo" width="100"/> type="index"
<el-table-column label="采购订单行项目" align="center" prop="poLine" width="120"/> width="90"
<el-table-column label="备品备件号" align="center" prop="materialCode" width="120"/> align="center"
<el-table-column label="备品备件描述" align="center" prop="materialDesc" width="180"/> :index="indexMethod"
<el-table-column label="数量" align="center" prop="amount" /> label="序号"
<el-table-column label="创建时间" align="center" prop="gmtCreate" width="180"> />
<template slot-scope="scope"> <el-table-column
<span>{{ parseTime(scope.row.gmtCreate, '{y}-{m}-{d}') }}</span> label="出入库类型"
</template> align="center"
</el-table-column> prop="inOutType"
<el-table-column label="最后更新人" align="center" prop="lastModifiedBy" width="180"/> width="100"
<el-table-column label="最后更新时间" align="center" prop="gmtModified" width="180"> >
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.gmtModified, '{y}-{m}-{d}') }}</span> <dict-tag
</template> :options="dict.type.in_out_type"
</el-table-column> :value="scope.row.inOutType"
<el-table-column label="有效标记" align="center" prop="activeFlag" /> />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> </template>
<template slot-scope="scope"> </el-table-column>
<el-button <el-table-column
size="mini" label="出入库单号"
type="text" align="center"
icon="el-icon-edit" prop="orderNo"
@click="handleUpdate(scope.row)" width="200"
v-hasPermi="['device:sparepartsInOutStorage:edit']" />
>修改</el-button> <el-table-column
<el-button label="备品备件号"
size="mini" align="center"
type="text" prop="spareCode"
icon="el-icon-delete" width="180"
@click="handleDelete(scope.row)" />
v-hasPermi="['device:sparepartsInOutStorage:remove']" <el-table-column
>删除</el-button> label="备品备件描述"
</template> align="center"
</el-table-column> prop="spareName"
</el-table> width="180"
/>
<el-table-column label="数量" align="center" prop="amount" />
<el-table-column
label="出入库时间"
align="center"
prop="createTime"
width="180"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column
label="出入库人员"
align="center"
prop="createBy"
width="180"
/>
<el-table-column
label="最后更新人"
align="center"
prop="updateBy"
width="180"
/>
<el-table-column
label="最后更新时间"
align="center"
prop="updateTime"
width="180"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<!-- <el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['device:sparepartsInOutStorage:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['device:sparepartsInOutStorage:remove']"
>删除</el-button
>
</template>
</el-table-column> -->
</el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改备品备件出入库对话框 --> <!-- 添加或修改备品备件出入库对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="仓库编码" prop="whCode"> <!-- <el-form-item label="出入库类型" prop="inOutType">
<el-input v-model="form.whCode" placeholder="请输入仓库编码" /> <el-input v-model="form.inOutType" placeholder="请输入出入库类型" style="width: 280px"/>
</el-form-item> </el-form-item> -->
<el-form-item label="库区编码" prop="waCode"> <el-form-item label="出入库类型" prop="inOutType">
<el-input v-model="form.waCode" placeholder="请输入库区编码" /> <el-select
</el-form-item> v-model="form.inOutType"
<el-form-item label="库位编码" prop="wlCode"> placeholder="请输入出入库类型"
<el-input v-model="form.wlCode" placeholder="请输入库位编码" /> @change="$forceUpdate()"
</el-form-item> clearable
<el-form-item label="入库单号" prop="orderNo"> style="width: 280px"
<el-input v-model="form.orderNo" placeholder="请输入入库单号" /> @keyup.enter.native="handleQuery"
</el-form-item> >
<el-form-item label="采购订单号" prop="poNo"> <el-option
<el-input v-model="form.poNo" placeholder="请输入采购订单号" /> v-for="dict in dict.type.in_out_type"
</el-form-item> :key="dict.value"
<el-form-item label="采购订单行项目" prop="poLine"> :label="dict.label"
<el-input v-model="form.poLine" placeholder="请输入采购订单行项目" /> :value="dict.value"
</el-form-item> ></el-option>
<el-form-item label="物料号" prop="materialCode"> </el-select>
<el-input v-model="form.materialCode" placeholder="请输入物料号" /> </el-form-item>
</el-form-item> <el-form-item label="出入库单号" prop="orderNo" v-if="form.id != null">
<el-form-item label="物料描述" prop="materialDesc"> <el-input
<el-input v-model="form.materialDesc" placeholder="请输入物料描述" /> v-model="form.orderNo"
</el-form-item> placeholder="请输入入库单号"
<el-form-item label="sn/LPN" prop="sn"> style="width: 280px"
<el-input v-model="form.sn" placeholder="请输入sn/LPN" /> disabled
</el-form-item> />
<el-form-item label="数量" prop="amount"> </el-form-item>
<el-input v-model="form.amount" placeholder="请输入数量" /> <el-form-item label="备品备件编码" prop="spareCode">
</el-form-item> <el-input
<el-form-item label="备用1" prop="userDefined1"> v-model="form.spareCode"
<el-input v-model="form.userDefined1" placeholder="请输入备用1" /> placeholder="请选择备品备件编码"
</el-form-item> style="width: 280px"
<el-form-item label="备用2" prop="userDefined2"> >
<el-input v-model="form.userDefined2" placeholder="请输入备用2" /> <el-button
</el-form-item> slot="append"
<el-form-item label="备用3" prop="userDefined3"> @click="handleSelectSparePartsLedger"
<el-input v-model="form.userDefined3" placeholder="请输入备用3" /> icon="el-icon-search"
</el-form-item> ></el-button>
<el-form-item label="备用4" prop="userDefined4"> </el-input>
<el-input v-model="form.userDefined4" placeholder="请输入备用4" /> <ItemSelectSparePartsLedger
</el-form-item> ref="itemSelectSparePartsLedger"
<el-form-item label="备用5" prop="userDefined5"> @onSelected="onItemSelectedSparePartsLedger"
<el-input v-model="form.userDefined5" placeholder="请输入备用5" /> >
</el-form-item> </ItemSelectSparePartsLedger>
<el-form-item label="备用6" prop="userDefined6"> </el-form-item>
<el-input v-model="form.userDefined6" placeholder="请输入备用6" /> <el-form-item label="备品备件名称" prop="spareName">
</el-form-item> <el-input v-model="form.spareName" style="width: 280px" disabled />
<el-form-item label="备用7" prop="userDefined7"> </el-form-item>
<el-input v-model="form.userDefined7" placeholder="请输入备用7" /> <!-- <el-form-item label="备品备件号" prop="spareCode">
</el-form-item> <el-input v-model="form.spareCode" placeholder="请输入备品备件号" />
<el-form-item label="备用8" prop="userDefined8"> </el-form-item>
<el-input v-model="form.userDefined8" placeholder="请输入备用8" /> <el-form-item label="备品备件描述" prop="spareName">
</el-form-item> <el-input v-model="form.spareName" placeholder="请输入备品备件描述" />
<el-form-item label="备用9" prop="userDefined9"> </el-form-item> -->
<el-input v-model="form.userDefined9" placeholder="请输入备用9" /> <!-- <el-form-item label="数量" prop="amount">
</el-form-item> <el-input v-model="form.amount" placeholder="请输入数量" style="width: 280px"/>
<el-form-item label="备用10" prop="userDefined10"> </el-form-item> -->
<el-input v-model="form.userDefined10" placeholder="请输入备用10" /> <el-col :span="12">
</el-form-item> <el-form-item label="数量" prop="amount">
<el-form-item label="创建时间" prop="gmtCreate"> <el-input-number
<el-date-picker clearable :min="0"
v-model="form.gmtCreate" :step="1"
type="date" v-model="form.amount"
value-format="yyyy-MM-dd" placeholder="请输入数量"
placeholder="请选择创建时间"> style="width: 280px"
</el-date-picker> />
</el-form-item> </el-form-item>
<el-form-item label="最后更新人" prop="lastModifiedBy"> </el-col>
<el-input v-model="form.lastModifiedBy" placeholder="请输入最后更新人" /> </el-form>
</el-form-item> <div slot="footer" class="dialog-footer">
<el-form-item label="最后更新时间" prop="gmtModified"> <el-button type="primary" @click="submitForm"> </el-button>
<el-date-picker clearable <el-button @click="cancel"> </el-button>
v-model="form.gmtModified" </div>
type="date" </el-dialog>
value-format="yyyy-MM-dd" </div>
placeholder="请选择最后更新时间">
</el-date-picker>
</el-form-item>
<el-form-item label="有效标记" prop="activeFlag">
<el-input v-model="form.activeFlag" placeholder="请输入有效标记" />
</el-form-item>
<el-form-item label="${comment}" prop="factoryCode">
<el-input v-model="form.factoryCode" placeholder="请输入${comment}" />
</el-form-item>
<el-form-item label="${comment}" prop="sapFactoryCode">
<el-input v-model="form.sapFactoryCode" placeholder="请输入${comment}" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template> </template>
<script> <script>
import { listSparepartsInOutStorage, getSparepartsInOutStorage, delSparepartsInOutStorage, addSparepartsInOutStorage, updateSparepartsInOutStorage } from "@/api/device/sparepartsInOutStorage"; import {
listSparepartsInOutStorage,
getSparepartsInOutStorage,
delSparepartsInOutStorage,
addSparepartsInOutStorage,
updateSparepartsInOutStorage,
} from "@/api/device/sparepartsInOutStorage";
import ItemSelectSparePartsLedger from "./selectSparePartsLedger.vue";
export default { export default {
name: "SparepartsInOutStorage", name: "SparepartsInOutStorage",
data() { components: { ItemSelectSparePartsLedger },
return { dicts: ["in_out_type"],
// data() {
loading: true, return {
// //
ids: [], loading: true,
// //
single: true, ids: [],
// //
multiple: true, single: true,
// //
showSearch: true, multiple: true,
// //
total: 0, showSearch: true,
// //
sparepartsInOutStorageList: [], total: 0,
// //
title: "", sparepartsInOutStorageList: [],
// //
open: false, title: "",
// //
queryParams: { open: false,
pageNum: 1, //
pageSize: 10, queryParams: {
whCode: null, pageNum: 1,
waCode: null, pageSize: 10,
wlCode: null, id: null,
orderNo: null, inOutType: null,
poNo: null, orderNo: null,
poLine: null, spareCode: null,
materialCode: null, spareName: null,
materialDesc: null, amount: null,
sn: null, attr1: null,
amount: null, attr2: null,
userDefined1: null, attr3: null,
userDefined2: null, createBy: null,
userDefined3: null, createTime: null,
userDefined4: null, updateBy: null,
userDefined5: null, updateTime: null,
userDefined6: null, delFlag: null,
userDefined7: null, factoryCode: null,
userDefined8: null, },
userDefined9: null, //
userDefined10: null, form: {},
gmtCreate: null, //
lastModifiedBy: null, rules: {
gmtModified: null, inOutType: [
activeFlag: null, { required: true, message: "出入库类型不能为空", trigger: "blur" },
factoryCode: null, ],
sapFactoryCode: null spareCode: [
}, { required: true, message: "备件名不能为空", trigger: "blur" },
// ],
form: {}, spareName: [
// { required: true, message: "备件名称不能为空", trigger: "blur" },
rules: { ],
} amount: [{ required: true, message: "数量不能为空", trigger: "blur" }],
}; },
}, };
created() { },
this.getList(); created() {
}, this.getList();
methods: { },
// methods: {
//
indexMethod(index) { indexMethod(index) {
return index + 1; return index + 1;
}, },
/** 查询备品备件出入库列表 */ //
getList() { handleSelectSparePartsLedger() {
this.loading = true; this.$refs.itemSelectSparePartsLedger.showFlag = true;
listSparepartsInOutStorage(this.queryParams).then(response => { },
this.sparepartsInOutStorageList = response.rows; //
this.total = response.total; onItemSelectedSparePartsLedger(obj) {
this.loading = false; this.form.storageId = obj[0].storageId;
}); this.form.spareCode = obj[0].materialCode;
}, this.form.spareName = obj[0].materialDesc;
// },
cancel() { /** 查询备品备件出入库列表 */
this.open = false; getList() {
this.reset(); this.loading = true;
}, listSparepartsInOutStorage(this.queryParams).then((response) => {
// this.sparepartsInOutStorageList = response.rows;
reset() { this.total = response.total;
this.form = { this.loading = false;
rawOrderInSnId: null, });
whCode: null, },
waCode: null, //
wlCode: null, cancel() {
orderNo: null, this.open = false;
poNo: null, this.reset();
poLine: null, },
materialCode: null, //
materialDesc: null, reset() {
sn: null, this.form = {
amount: null, id: null,
userDefined1: null, inOutType: null,
userDefined2: null, orderNo: null,
userDefined3: null, spareCode: null,
userDefined4: null, spareName: null,
userDefined5: null, amount: null,
userDefined6: null, attr1: null,
userDefined7: null, attr2: null,
userDefined8: null, attr3: null,
userDefined9: null, createBy: null,
userDefined10: null, createTime: null,
createBy: null, updateBy: null,
gmtCreate: null, updateTime: null,
lastModifiedBy: null, delFlag: null,
gmtModified: null, factoryCode: null,
activeFlag: null, storageId: null, //ID
factoryCode: null, };
sapFactoryCode: null this.resetForm("form");
}; },
this.resetForm("form"); /** 搜索按钮操作 */
}, handleQuery() {
/** 搜索按钮操作 */ this.queryParams.pageNum = 1;
handleQuery() { this.getList();
this.queryParams.pageNum = 1; },
this.getList(); /** 重置按钮操作 */
}, resetQuery() {
/** 重置按钮操作 */ this.resetForm("queryForm");
resetQuery() { this.handleQuery();
this.resetForm("queryForm"); },
this.handleQuery(); //
}, handleSelectionChange(selection) {
// this.ids = selection.map((item) => item.id);
handleSelectionChange(selection) { this.single = selection.length !== 1;
this.ids = selection.map(item => item.rawOrderInSnId) this.multiple = !selection.length;
this.single = selection.length!==1 },
this.multiple = !selection.length /** 新增按钮操作 */
}, handleAdd() {
/** 新增按钮操作 */ this.reset();
handleAdd() { this.open = true;
this.reset(); this.title = "添加备品备件出入库";
this.open = true; },
this.title = "添加备品备件出入库"; /** 修改按钮操作 */
}, handleUpdate(row) {
/** 修改按钮操作 */ this.reset();
handleUpdate(row) { const id = row.id || this.ids;
this.reset(); getSparepartsInOutStorage(id).then((response) => {
const rawOrderInSnId = row.rawOrderInSnId || this.ids this.form = response.data;
getSparepartsInOutStorage(rawOrderInSnId).then(response => { this.open = true;
this.form = response.data; this.title = "修改备品备件出入库";
this.open = true; });
this.title = "修改备品备件出入库"; },
}); /** 提交按钮 */
}, submitForm() {
/** 提交按钮 */ this.$refs["form"].validate((valid) => {
submitForm() { if (valid) {
this.$refs["form"].validate(valid => { if (this.form.id != null) {
if (valid) { updateSparepartsInOutStorage(this.form).then((response) => {
if (this.form.rawOrderInSnId != null) { this.$modal.msgSuccess("修改成功");
updateSparepartsInOutStorage(this.form).then(response => { this.open = false;
this.$modal.msgSuccess("修改成功"); this.getList();
this.open = false; });
this.getList(); } else {
}); addSparepartsInOutStorage(this.form).then((response) => {
} else { this.$modal.msgSuccess("新增成功");
addSparepartsInOutStorage(this.form).then(response => { this.open = false;
this.$modal.msgSuccess("新增成功"); this.getList();
this.open = false; });
this.getList(); }
}); }
} });
} },
}); /** 删除按钮操作 */
}, handleDelete(row) {
/** 删除按钮操作 */ const ids = row.id || this.ids;
handleDelete(row) { this.$modal
const rawOrderInSnIds = row.rawOrderInSnId || this.ids; .confirm('是否确认删除备品备件出入库编号为"' + ids + '"的数据项?')
this.$modal.confirm('是否确认删除备品备件出入库编号为"' + rawOrderInSnIds + '"的数据项?').then(function() { .then(function () {
return delSparepartsInOutStorage(rawOrderInSnIds); return delSparepartsInOutStorage(ids);
}).then(() => { })
this.getList(); .then(() => {
this.$modal.msgSuccess("删除成功"); this.getList();
}).catch(() => {}); this.$modal.msgSuccess("删除成功");
}, })
/** 导出按钮操作 */ .catch(() => {});
handleExport() { },
this.download('device/sparepartsInOutStorage/export', { /** 导出按钮操作 */
...this.queryParams handleExport() {
}, `sparepartsInOutStorage_${new Date().getTime()}.xlsx`) this.download(
} "device/sparepartsInOutStorage/export",
} {
...this.queryParams,
},
`sparepartsInOutStorage_${new Date().getTime()}.xlsx`
);
},
},
}; };
</script> </script>

@ -0,0 +1,332 @@
<template>
<el-dialog
title="备品备件选择"
v-if="showFlag"
:visible.sync="showFlag"
:modal="false"
width="1100px"
center
:before-close="cancel"
>
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="98px"
>
<el-form-item label="备品备件号" prop="materialCode">
<el-input
v-model="queryParams.materialCode"
placeholder="请输入备品备件号"
clearable
@keyup.enter.native="handleQuery"
style="width: 150px"
/>
</el-form-item>
<el-form-item label="备件类型" prop="spareType">
<el-select
v-model="queryParams.spareType"
placeholder="请选择备件类型"
@keyup.enter.native="handleQuery"
@change="$forceUpdate()"
clearable
style="width: 150px"
>
<el-option
v-for="item in options"
:key="item.spareType"
:label="item.label"
:value="item.spareType"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
<el-table
v-loading="loading"
:data="sparePartsLedgerList"
@selection-change="handleSelectionChange"
ref="multipleTable"
>
<el-table-column type="selection" width="55" align="center" />
<!-- 序号 -->
<el-table-column
type="index"
width="90"
align="center"
:index="indexMethod"
label="序号"
/>
<el-table-column
label="备品备件号"
align="center"
prop="materialCode"
width="120"
/>
<el-table-column
label="备品备件描述"
align="center"
prop="materialDesc"
width="120"
/>
<el-table-column
label="备品备件类型"
align="center"
prop="spareType"
width="120"
/>
<el-table-column label="规格型号" align="center" prop="spareMode" />
<el-table-column label="库存总数量" align="center" prop="amount" />
<el-table-column
label="库存可用数量"
align="center"
prop="availableQuantity"
>
<template slot-scope="scope">
<span>{{ scope.row.amount - scope.row.storageAmount }}</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="multiple"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</template>
<script>
import {
listSparePartsLedger,
getSparePartsLedger,
delSparePartsLedger,
addSparePartsLedger,
updateSparePartsLedger,
} from "@/api/device/sparePartsLedger";
export default {
name: "SparePartsLedger",
data() {
return {
//
showFlag: false,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
sparePartsLedgerList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
storageId: null,
whCode: null,
regionCode: null,
waCode: null,
storageType: null,
wlCode: null,
materialCode: null,
materialDesc: null,
amount: null,
storageAmount: null,
occupyAmount: null,
lpn: null,
productBatch: null,
receiveDate: null,
productDate: null,
userDefined1: null,
userDefined2: null,
userDefined3: null,
userDefined4: null,
userDefined5: null,
userDefined6: null,
userDefined7: null,
userDefined8: null,
userDefined9: null,
userDefined10: null,
gmtCreate: null,
lastModifiedBy: null,
gmtModified: null,
activeFlag: null,
factoryCode: null,
sapFactoryCode: null,
wlName: null,
spareUseLife: null,
spareName: null,
spareMode: null,
spareManufacturer: null,
spareSupplier: null,
spareReplacementCycle: null,
spareMeasurementUnit: null,
spareConversionUnit: null,
spareConversionRatio: null,
spareInventoryFloor: null,
spareInventoryUpper: null,
},
options: [
{
spareType: "专用",
label: "专用",
},
{
spareType: "通用",
label: "通用",
},
],
//
form: {},
//
rules: {
storageId: [
{ required: true, message: "唯一序列不能为空", trigger: "blur" },
],
},
};
},
created() {
this.getList();
},
methods: {
handleEdit(index, row) {
console.log("row:", index, row);
console.log("storageId:", row.storageId); //name
},
//
indexMethod(index) {
return index + 1;
},
/** 查询备品备件台账管理列表 */
getList() {
this.loading = true;
listSparePartsLedger(this.queryParams).then((response) => {
this.sparePartsLedgerList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.showFlag = false;
this.reset();
this.resetQuery();
},
//
reset() {
this.form = {
storageId: null,
whCode: null,
regionCode: null,
waCode: null,
storageType: null,
wlCode: null,
materialCode: null,
materialDesc: null,
amount: null,
storageAmount: null,
occupyAmount: null,
lpn: null,
productBatch: null,
receiveDate: null,
productDate: null,
userDefined1: null,
userDefined2: null,
userDefined3: null,
userDefined4: null,
userDefined5: null,
userDefined6: null,
userDefined7: null,
userDefined8: null,
userDefined9: null,
userDefined10: null,
createBy: null,
gmtCreate: null,
lastModifiedBy: null,
gmtModified: null,
activeFlag: null,
factoryCode: null,
sapFactoryCode: null,
wlName: null,
delFlag: null,
spareUseLife: null,
spareName: null,
spareMode: null,
spareManufacturer: null,
spareSupplier: null,
spareReplacementCycle: null,
spareMeasurementUnit: null,
spareConversionUnit: null,
spareConversionRatio: null,
spareInventoryFloor: null,
spareInventoryUpper: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.storageId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 提交按钮 */
submitForm() {
console.log("data:", this.sparePartsLedgerList);
console.log("选择的数据", this.$refs.multipleTable.selection);
if (this.$refs.multipleTable.selection.length > 1) {
this.$message({
message: "请勿选择多种备件!",
type: "warning",
});
} else {
this.$emit("onSelected", this.$refs.multipleTable.selection);
this.showFlag = false;
//
this.resetQuery();
}
},
},
};
</script>
Loading…
Cancel
Save