|
@@ -0,0 +1,481 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" >
|
|
|
+ <el-form-item label="单据类型" prop="billsType">
|
|
|
+ <el-select
|
|
|
+ v-model="queryParams.billsType"
|
|
|
+ placeholder="单据类型"
|
|
|
+ clearable
|
|
|
+ style="width: 240px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.inventory_bills_type"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="出入库/负责人" prop="principal">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.principal"
|
|
|
+ placeholder="请输入出入库/负责人"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="出入库地点" prop="givePlace">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.givePlace"
|
|
|
+ placeholder="请输入出"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="单据时间">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="dateRange"
|
|
|
+ style="width: 240px"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ type="daterange"
|
|
|
+ range-separator="-"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ ></el-date-picker>
|
|
|
+ </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="primary"
|
|
|
+ plain
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ @click="handleAdd"
|
|
|
+ v-hasPermi="['inventory:goods:add']"
|
|
|
+ >新增</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table v-loading="loading" :data="billsList">
|
|
|
+ <!-- <el-table-column type="selection" width="55" align="center" /> -->
|
|
|
+ <el-table-column label="单据id" align="center" prop="id" />
|
|
|
+ <el-table-column label="单据类型" align="center" prop="billsType" >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <dict-tag :options="dict.type.inventory_bills_type" :value="scope.row.billsType"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="出入库/负责人" align="center" prop="principal" />
|
|
|
+ <el-table-column label="单据时间" align="center" prop="billsTime" width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ parseTime(scope.row.billsTime, '{y}-{m}-{d}') }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="出入库/地点" align="center" prop="givePlace" />
|
|
|
+ <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" prop="remark" />
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-plus" @click="addBillsDetails(scope.row)">新增单据详情</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="handleUpdate(scope.row)"
|
|
|
+ v-hasPermi="['system:bills:edit']"
|
|
|
+ >修改</el-button>
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-share" @click="selectBillsDetails(scope.row)">查看单据详情</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
+ v-hasPermi="['system:bills:remove']"
|
|
|
+ >删除</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="open" width="500px" append-to-body>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="120px" >
|
|
|
+ <el-form-item label="单据类型:" prop="billsType">
|
|
|
+ <el-select v-model="form.billsType" placeholder="请选择单据类型">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.inventory_bills_type"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="出/入库负责人:" prop="principal">
|
|
|
+ <el-input v-model="form.principal" placeholder="请输入出/入库负责人" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="单据时间:" prop="billsTime">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="form.billsTime"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="请选择单据时间"
|
|
|
+ size="small"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="出/入库地点" prop="givePlace">
|
|
|
+ <el-input v-model="form.givePlace" placeholder="请输入出/入库地点" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="备注" prop="remark">
|
|
|
+ <el-input v-model="form.remark" placeholder="请输入备注" />
|
|
|
+ </el-form-item>
|
|
|
+ <!-- <el-form-item label="请选择"> -->
|
|
|
+ <!-- <el-form :model="goodsList" ref="data" label-width="auto">
|
|
|
+ <el-table border
|
|
|
+ :header-cell-style="{ 'text-align': 'center' }"
|
|
|
+ :cell-style="{ 'text-align': 'center' }"
|
|
|
+ :data="goodsList" ref="table" style="100%">
|
|
|
+ <el-table-column align="center" label="物品编码" width="200px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item :prop="scope.$index + '.goodsCode'" :rules="{required: true, message: '物品编码不能为空', trigger: 'blur'}">
|
|
|
+ <el-input v-model="goodsList[scope.$index].goodsCode" auto-complete="off" size="small" placeholder="物品编号"/>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="物品名称" width="200px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item :prop="scope.$index + '.goodsName'" :rules="{required: true, message: '物品名称不能为空', trigger: 'blur'}">
|
|
|
+ <el-input v-model="goodsList[scope.$index].goodsName" auto-complete="off" size="small" placeholder="物品名称"/>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form> -->
|
|
|
+ <!-- </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>
|
|
|
+
|
|
|
+ <el-dialog :title="detailsTitle" :visible.sync="detailsOpen" width="950px" append-to-body>
|
|
|
+ <el-form :model="goodsParams" size="small" :inline="true" label-width="120px">
|
|
|
+ <el-form-item label="物品编码:" prop="goodsCode">
|
|
|
+ <el-input
|
|
|
+ v-model="goodsParams.goodsCode"
|
|
|
+ placeholder="请输入物品编码"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="goodsHandleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="物品名称:" prop="goodsName">
|
|
|
+ <el-input v-model="goodsParams.goodsName"
|
|
|
+ placeholder="请输入物品名称"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="goodsHandleQuery"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="备注:" prop="remark">
|
|
|
+ <el-input v-model="goodsParams.remark" placeholder="请输入备注" clearable @keyup.enter.native="goodsHandleQuery" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="goodsHandleQuery">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="goodsResetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ @click="detalisHandleAdd"
|
|
|
+ >新增</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table v-loading="detalisLoading" :data="goodsList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column label="物品编码" align="center" prop="goodsCode" />
|
|
|
+ <el-table-column label="物品名称" align="center" prop="goodsName" />
|
|
|
+ <el-table-column label="物品类型" align="center" prop="goodsType" >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <dict-tag :options="dict.type.inventory_goods_type" :value="scope.row.goodsType"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="库存数量" align="center" prop="quantityStock" >
|
|
|
+ <!-- <template slot-scope="scope">
|
|
|
+ <el-input-number v-model="scope.row.quantityStock" placeholder="请输入库存数量" style="width: 150px" />
|
|
|
+ </template> -->
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="备注" align="center" prop="remark" />
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="GoodsTotal>0"
|
|
|
+ :total="GoodsTotal"
|
|
|
+ :page.sync="goodsParams.pageNum"
|
|
|
+ :limit.sync="goodsParams.pageSize"
|
|
|
+ @pagination="getGoodsList"
|
|
|
+ />
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog :title="examineTitle" :visible.sync="examineOpen" width="800px" append-to-body>
|
|
|
+ <el-table :data="detailsList">
|
|
|
+ <el-table-column label="物品编码" align="center" prop="goodsCode" />
|
|
|
+ <el-table-column label="物品名称" align="center" prop="goodsName" />
|
|
|
+ <el-table-column label="库存数量" align="center" prop="goodsNum" />
|
|
|
+ <el-table-column label="物品状态" align="center" prop="goodsStatus" >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <dict-tag :options="dict.type.inventory_goods_status" :value="scope.row.goodsStatus"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import {listBills,addBills,updateBills,getBills,delBills,detailsAdd,listBillsDetails} from "@/api/inventory/bills"
|
|
|
+import {listGoods} from "@/api/inventory/goods"
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "Bills",
|
|
|
+ dicts: ['inventory_bills_type','inventory_goods_type','inventory_goods_status'],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 单据表格数据
|
|
|
+ billsList: [],
|
|
|
+ // 日期范围
|
|
|
+ dateRange: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ billsType: null,
|
|
|
+ principal: null,
|
|
|
+ billsTime: null,
|
|
|
+ givePlace: null,
|
|
|
+ updateTime: null,
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ },
|
|
|
+ goodsList:[],
|
|
|
+ detailsTitle: "", //标题
|
|
|
+ detailsOpen: false, // 是否显示弹出层
|
|
|
+ goodsParams:{
|
|
|
+ goodsStatus: "0",
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ },
|
|
|
+ GoodsTotal: 0,
|
|
|
+ detalisLoading: false,
|
|
|
+ detailsAddList: [],
|
|
|
+ billsId: "",
|
|
|
+ examineOpen: false,
|
|
|
+ examineTitle: "",
|
|
|
+ // 查询参数
|
|
|
+ billsDetailsParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10
|
|
|
+ },
|
|
|
+ detailsList:[],
|
|
|
+ detailsTotal: 0,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /** 查询单据列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ listBills(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
|
|
+ this.billsList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.dateRange = [];
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ /** 新增单据 */
|
|
|
+ handleAdd(){
|
|
|
+ this.reset();
|
|
|
+ this.open = true;
|
|
|
+ this.title = "创建单据";
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ id: null,
|
|
|
+ billsType: null,
|
|
|
+ principal: null,
|
|
|
+ billsTime: null,
|
|
|
+ givePlace: null,
|
|
|
+ createBy: null,
|
|
|
+ createTime: null,
|
|
|
+ updateBy: null,
|
|
|
+ updateTime: null,
|
|
|
+ remark: null
|
|
|
+ };
|
|
|
+ this.resetForm("form");
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.form.id != null) {
|
|
|
+ updateBills(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addBills(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ const id = row.id || this.ids
|
|
|
+ getBills(id).then(response => {
|
|
|
+ this.form = response.data;
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改单据";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row) {
|
|
|
+ const ids = row.id || this.ids;
|
|
|
+ this.$modal.confirm('是否确认删除单据编号为"' + ids + '"的数据项?').then(function() {
|
|
|
+ return delBills(ids);
|
|
|
+ }).then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
+ // 获取物品信息
|
|
|
+ getGoodsList(){
|
|
|
+ this.detalisLoading = true
|
|
|
+ listGoods(this.goodsParams).then(response =>{
|
|
|
+ this.goodsList = response.rows;
|
|
|
+ this.GoodsTotal = response.total;
|
|
|
+ this.detalisLoading = false;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 新增单据详情
|
|
|
+ addBillsDetails(row){
|
|
|
+ this.billsId = row.id
|
|
|
+ if(row.billsType === "0"){
|
|
|
+ this.goodsParams.goodsStatus = "1"
|
|
|
+ }else {
|
|
|
+ this.goodsParams.goodsStatus = "0"
|
|
|
+ }
|
|
|
+ this.getGoodsList()
|
|
|
+ this.detailsOpen = true;
|
|
|
+ this.detailsTitle = "新增单据详情";
|
|
|
+ },
|
|
|
+ // 多选框选中数据
|
|
|
+ handleSelectionChange(selection){
|
|
|
+ this.detailsAddList= selection.map(item => item.id)
|
|
|
+ this.single = selection.length!==1
|
|
|
+ this.multiple = !selection.length
|
|
|
+ },
|
|
|
+ // 物品条件查询
|
|
|
+ goodsHandleQuery(){
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getGoodsList();
|
|
|
+ },
|
|
|
+ // 物品查询重置
|
|
|
+ goodsResetQuery(){
|
|
|
+ this.goodsParams.goodsCode = null;
|
|
|
+ this.goodsParams.goodsName = null;
|
|
|
+ this.goodsParams.remark = null;
|
|
|
+ this.goodsHandleQuery()
|
|
|
+ },
|
|
|
+ // 新增详情
|
|
|
+ detalisHandleAdd() {
|
|
|
+ const queryParams = {
|
|
|
+ ids: this.detailsAddList,
|
|
|
+ billsId: this.billsId
|
|
|
+ }
|
|
|
+ detailsAdd(queryParams).then(resp=>{
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.getGoodsList()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getBillsDetailsList(){
|
|
|
+ this.billsDetailsParams.billsId = this.billsId
|
|
|
+ listBillsDetails(this.billsDetailsParams).then(resp=>{
|
|
|
+ this.detailsList = resp.rows
|
|
|
+ this.detailsTotal = resp.total
|
|
|
+ })
|
|
|
+ },
|
|
|
+ selectBillsDetails(row){
|
|
|
+ this.billsId = row.id
|
|
|
+ this.examineTitle = "单据详情"
|
|
|
+ this.examineOpen = true
|
|
|
+ this.getBillsDetailsList()
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+
|
|
|
+</style>
|