devicesmgt/sgzb-ui/src/views/claimAndRefund/secondStore/secondStore.vue

527 lines
18 KiB
Vue

<template>
<div class="app-container" id="secondStore">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
<el-form-item label="关键字" prop="keyword">
<el-input
v-model="queryParams.keyword"
placeholder="请输入关键字"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="单位名称" prop="unitId">
<el-select v-model="queryParams.unitId" placeholder="请选择单位名称" clearable>
<el-option
v-for="item in unitList" filterable
:key="item.id" :label="item.name" :value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="工程名称" prop="proId">
<el-select v-model="queryParams.proId" placeholder="请选择工程名称" clearable>
<el-option
v-for="item in proList" filterable
:key="item.id" :label="item.name" :value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="类型名称" prop="typeId">
<el-select
v-model="queryParams.typeId"
placeholder="请选择类型名称"
clearable filterable
style="width: 240px"
>
<el-option
v-for="typeItem in typeList"
:key="typeItem.typeId"
:label="typeItem.typeName"
:value="typeItem.typeId"
/>
</el-select>
</el-form-item>
<el-form-item label="规格型号" prop="modelId">
<treeselect
v-model="queryParams.modelId"
default-expand-all :options="equipmentTypeList"
placeholder="请选择规格型号"
:disable-branch-nodes="true"
style="width: 240px;"
noChildrenText="没有数据了"
noOptionsText="没有数据"
noResultsText="没有搜索结果"/>
</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-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="序号" align="center" type="index" />
<el-table-column label="单位名称" align="center" prop="unitName" :show-overflow-tooltip="true" />
<el-table-column label="工程名称" align="center" prop="proName" :show-overflow-tooltip="true" />
<el-table-column label="类型名称" align="center" prop="typeName" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" align="center" prop="modelName" :show-overflow-tooltip="true" />
<el-table-column label="进场数量" align="center" prop="jcNum" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span class="clickText" @click="openRecords(scope.row,1)">{{scope.row.jcNum}}</span>
</template>
</el-table-column>
<el-table-column label="退场数量" align="center" prop="tcNUm" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span class="clickText" @click="openRecords(scope.row,2)">{{scope.row.tcNUm}}</span>
</template>
</el-table-column>
<el-table-column label="场内库存量" align="center" prop="kcNum" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span class="clickText" @click="openRecords(scope.row,3)">{{scope.row.kcNum}}</span>
</template>
</el-table-column>
<el-table-column label="已出库数量" align="center" prop="ckNum" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span class="clickText" @click="openRecords(scope.row,4)">{{scope.row.ckNum}}</span>
</template>
</el-table-column>
<el-table-column label="在库数量" align="center" prop="zkNum" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="nuitName" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
@click="handleOut(scope.row)"
>出库</el-button>
<el-button
size="mini"
type="warning"
@click="handleIn(scope.row)"
>退库</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 出库弹窗 -->
<el-dialog :title="title" :visible.sync="openOut" width="600px" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="类型名称:" prop="typeName">
<el-input v-model="form.typeName" placeholder="请输入类型名称" disabled/>
</el-form-item>
<el-form-item label="规格型号" prop="modelName">
<el-input v-model="form.modelName" placeholder="请输入规格型号" disabled/>
</el-form-item>
<el-form-item label="在库数量" prop="zkNum">
<el-input v-model="form.zkNum" placeholder="请输入在库数量" disabled/>
</el-form-item>
<el-form-item label="出库数量" prop="num">
<el-input v-model="form.num" placeholder="请输入出库数量" />
</el-form-item>
<el-form-item label="班组名称" prop="teamName">
<el-input v-model="form.teamName" placeholder="请输入班组名称" maxlength="50" />
</el-form-item>
<el-form-item label="领用人员" prop="leaseMan">
<el-input v-model="form.leaseMan" placeholder="请输入领用人员" maxlength="50" />
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button type="primary" @click="submitForm(1)">确 定</el-button>
<el-button @click="openOut=false">取 消</el-button>
</div>
</el-dialog>
<!-- 进库弹窗 -->
<el-dialog :title="title" :visible.sync="openIn" width="600px" append-to-body :close-on-click-modal="false">
<el-form ref="nform" :model="nform" :rules="nrules" label-width="120px">
<el-form-item label="类型名称:" prop="typeName">
<el-input v-model="nform.typeName" placeholder="请输入类型名称" disabled/>
</el-form-item>
<el-form-item label="规格型号" prop="modelName">
<el-input v-model="nform.modelName" placeholder="请输入规格型号" disabled/>
</el-form-item>
<el-form-item label="退库数量" prop="num">
<el-input v-model="nform.num" placeholder="请输入退库数量"/>
</el-form-item>
<el-form-item label="班组名称" prop="teamName">
<el-input v-model="nform.teamName" placeholder="请输入班组名称" maxlength="50" />
</el-form-item>
<el-form-item label="退库人员" prop="leaseMan">
<el-input v-model="nform.leaseMan" placeholder="请输入退库人员" maxlength="50" />
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input v-model="nform.phone" placeholder="请输入联系电话" maxlength="11" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button type="primary" @click="submitForm(2)">确 定</el-button>
<el-button @click="openIn=false">取 消</el-button>
</div>
</el-dialog>
<!-- 记录弹窗 -->
<el-dialog :title="title" :visible.sync="openRecord" width="1200px" append-to-body>
<el-form :model="dialogQuery" ref="dialogQuery" size="small" :inline="true" label-width="80px">
<el-form-item label="记录时间" prop="startTime">
<el-date-picker
v-model="dialogQuery.startTime"
style="width: 240px"
value-format="yyyy-MM-dd"
type="date"
placeholder="记录时间"
></el-date-picker>
</el-form-item>
<el-form-item label="类型名称" prop="typeName">
<el-input
v-model="dialogQuery.typeName"
disabled
/>
</el-form-item>
<el-form-item label="规格型号" prop="modelName">
<el-input v-model="dialogQuery.modelName" disabled />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleDialogQuery">查询</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetDialogQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="dialogList">
<el-table-column label="序号" align="center" type="index" />
<el-table-column label="类型名称" align="center" prop="typeName" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" align="center" prop="modelName" :show-overflow-tooltip="true" />
<el-table-column label="数量" align="center" prop="num" :show-overflow-tooltip="true" />
<el-table-column label="记录时间" align="center" prop="startTime" :show-overflow-tooltip="true" />
<el-table-column label="操作类型" align="center" prop="" :show-overflow-tooltip="true" />
</el-table>
<pagination
v-show="dialogTotal>0"
:total="dialogTotal"
:page.sync="dialogQuery.pageNum"
:limit.sync="dialogQuery.pageSize"
@pagination="getDialogList"
/>
</el-dialog>
</div>
</template>
<script>
import { secondaryWarehouseList,operate,getRecords } from "@/api/claimAndRefund/secondStore";
import { getUnitData,getProData } from "@/api/claimAndRefund/receive.js"
import { getTypeList } from "@/api/store/warehousing";
import { equipmentTypeTree } from "@/api/store/tools";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "SecondStore",
dicts: ['sys_normal_disable'],
components: { Treeselect },
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
deviceList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
openOut: false,
openIn: false,
// 日期范围
dateRange: [],
// 单位数据
unitList: [],
proList: [],
//搜索下拉数据
typeList: [],
equipmentTypeList: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
unitId: undefined,
modelId: undefined,
typeId: undefined
},
// 表单参数 出库
form: {},
// 表单校验
rules: {
num: [
{ required: true, message: "出库数量不能为空", trigger: "blur" }
],
teamName: [
{ required: true, message: "班组名称不能为空", trigger: "blur" }
]
},
// 表单参数 退库
nform:{},
nrules: {
num: [
{ required: true, message: "退库数量不能为空", trigger: "blur" }
],
teamName: [
{ required: true, message: "班组名称不能为空", trigger: "blur" }
]
},
//记录弹窗
openRecord:false,
dialogQuery: {
pageNum: 1,
pageSize: 10,
startTime: undefined,
unitId: undefined,
modelId: undefined,
typeId: undefined
},
dialogList:[],
queryType:1,
dialogTotal: 0,
};
},
created() {
this.getTypeList();
this.getUnitList();
this.getProList();
this.equipmentType();
this.getList();
},
methods: {
//获取单位
getUnitList(){
getUnitData().then(response => {
this.unitList = response.data;
})
},
//获取工程
getProList(){
getProData().then(response => {
this.proList = response.data;
})
},
getTypeList() {
getTypeList({level:'3'}).then(response => {
this.typeList = response.data;
}
)
},
//规格型号
equipmentType() {
equipmentTypeTree().then(response => {
this.equipmentTypeList = response.data;
this.equipmentTypeList.forEach((item,index)=>{
if(item.children.length>0){
item.children.forEach((item2,index2)=>{
if(item2.children.length>0){
item2.children.forEach(item3=>{
if(item3.children.length>0){
item3.children.forEach(item4=>{
item4.machineTypeName = item3.typeName
item4.specificationType = item4.typeName
// item4.purchasePrice = 1
// item4.purchaseNum = 1
this.$set(item4, 'purchasePrice', 0);
this.$set(item4, 'purchaseNum', 1);
})
}
})
}
})
}
})
});
},
/** 查询列表 */
getList() {
this.loading = true;
secondaryWarehouseList(this.queryParams).then(response => {
this.deviceList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
// 取消按钮
cancel() {
this.openOut = false;
this.openIn = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
};
this.resetForm("form");
this.nform = {
};
this.resetForm("nform");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
handleDialogQuery() {
this.dialogQuery.pageNum = 1;
this.getDialogList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
resetDialogQuery() {
this.resetForm("dialogQuery");
this.handleDialogQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.dictId)
this.single = selection.length!=1
this.multiple = !selection.length
},
/** 按钮操作 */
handleOut(row) {//1
this.reset();
// this.form = row;
console.log(row)
this.$set(this.form,'unitId',row.unitId)
this.$set(this.form,'typeId',row.typeId)
this.$set(this.form,'unitName',row.unitName)
this.$set(this.form,'typeName',row.typeName)
this.$set(this.form,'modelName',row.modelName)
this.$set(this.form,'zkNum',row.zkNum)
console.log(this.form)
this.openOut = true;
this.title = "出库";
},
handleIn(row) {//2
this.reset();
// this.nform = row;
this.$set(this.nform,'unitId',row.unitId)
this.$set(this.nform,'typeId',row.typeId)
this.$set(this.nform,'unitName',row.unitName)
this.$set(this.nform,'typeName',row.typeName)
this.$set(this.nform,'modelName',row.modelName)
this.openIn = true;
this.title = "退库";
},
/** 提交按钮 */
submitForm: function(type) {
if(type==1){
this.$refs["form"].validate(valid => {
if (valid) {
let param = {}
param = this.form
param.type=1
operate(param).then(response => {
this.$modal.msgSuccess("操作成功");
this.openOut = false;
this.getList();
});
}
});
}
if(type==2){
this.$refs["nform"].validate(valid => {
if (valid) {
let param = {}
param = this.nform
param.type=2
operate(param).then(response => {
this.$modal.msgSuccess("操作成功");
this.openIn = false;
this.getList();
});
}
});
}
},
//查看记录
openRecords(row,type){
this.openRecord = true;
this.queryType = type
this.dialogQuery.typeName = row.typeName;
this.dialogQuery.modelName = row.modelName;
this.dialogQuery.unitId = row.unitId;
this.dialogQuery.typeId = row.typeId;
this.getDialogList();
},
/** 查询列表 */
getDialogList() {
this.dialogQuery.queryType = this.queryType;
getRecords(this.dialogQuery).then(response => {
this.dialogList = response.rows;
this.dialogTotal = response.total;
}
);
},
/** 导出按钮操作 */
handleExport() {
this.downloadJson('material/secondaryWarehouse/exportList',JSON.stringify(this.queryParams), `二级库_${new Date().getTime()}.xlsx`)
},
}
};
</script>
<style lang="scss" scoped>
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
.clickText{
color: #02A7F0;
cursor: pointer;
}
</style>