浏览代码

单据管理

hurixing 10 月之前
父节点
当前提交
6544d6e36d

+ 62 - 0
inventory-ui/src/api/inventory/bills.js

@@ -0,0 +1,62 @@
+import request from '@/utils/request'
+
+// 查询单据列表
+export function listBills(query) {
+  return request({
+    url: '/inventory/bills/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询单据详细
+export function getBills(id) {
+  return request({
+    url: '/inventory/bills/' + id,
+    method: 'get'
+  })
+}
+
+// 新增单据
+export function addBills(data) {
+  return request({
+    url: '/inventory/bills',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改单据
+export function updateBills(data) {
+  return request({
+    url: '/inventory/bills',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除单据
+export function delBills(id) {
+  return request({
+    url: '/inventory/bills/' + id,
+    method: 'delete'
+  })
+}
+
+// 新增单据
+export function detailsAdd(data){
+  return request({
+    url: '/inventory/bills/details',
+    method: 'post',
+    data: data
+  })
+}
+
+// 查询单据列表
+export function listBillsDetails(query) {
+  return request({
+    url: '/inventory/bills/details/list',
+    method: 'get',
+    params: query
+  })
+}

+ 45 - 0
inventory-ui/src/api/inventory/goods.js

@@ -0,0 +1,45 @@
+import request from '@/utils/request'
+
+// 查询物品列表
+export function listGoods(query) {
+  return request({
+    url: '/inventory/goods/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 新增物品
+export function addGoods(data) {
+    return request({
+      url: '/inventory/goods',
+      method: 'post',
+      data: data
+    })
+}
+
+//查询物品详细
+export function getGoods(id) {
+    return request({
+      url: '/inventory/goods/' + id,
+      method: 'get'
+    })
+  }
+
+// 修改物品
+export function updateGoods(data) {
+    return request({
+        url: '/inventory/goods',
+        method: 'put',
+        data: data
+    })
+}
+
+// 删除物品
+export function delGoods(ids) {
+  return request({
+    url: 'inventory/goods/'+ids,
+    method: 'delete'
+  })
+}
+

+ 481 - 0
inventory-ui/src/views/inventory/bills/index.vue

@@ -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>

+ 312 - 0
inventory-ui/src/views/inventory/goods/index.vue

@@ -0,0 +1,312 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+        <el-form-item label="物品编码" prop="goodsCode">
+          <el-input
+            v-model="queryParams.goodsCode"
+            placeholder="请输入物品编码"
+            clearable
+            @keyup.enter.native="handleQuery"
+          />
+      </el-form-item>
+      <el-form-item label="物品名称" prop="goodsName">
+        <el-input v-model="queryParams.goodsName"
+        placeholder="请输入物品名称"
+        clearable
+        @keyup.enter.native="handleQuery"/>
+      </el-form-item>
+      <el-form-item label="物品类型" prop="goodsType">
+        <el-select
+          v-model="queryParams.goodsType"
+          placeholder="物品类型"
+          clearable
+          style="width: 150px"
+        >
+          <el-option
+            v-for="dict in dict.type.inventory_goods_type"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="物品状态" prop="goodsStatus">
+        <el-select
+          v-model="queryParams.goodsStatus"
+          placeholder="物品状态"
+          clearable
+          style="width: 150px"
+        >
+          <el-option
+            v-for="dict in dict.type.inventory_goods_status"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="备注" prop="remark">
+        <el-input v-model="queryParams.remark" placeholder="请输入备注" clearable @keyup.enter.native="handleQuery" />
+      </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="goodsList" >
+      <!-- <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="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" />
+      <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-column label="备注" align="center" prop="remark" />
+      <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="['inventory:goods:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['inventory:goods: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="80px">
+        <el-form-item label="物品编码" prop="goodsCode">
+          <el-input v-model="form.goodsCode" placeholder="请输入物品编码" />
+        </el-form-item>
+        <el-form-item label="物品名称" prop="goodsName">
+          <el-input v-model="form.goodsName" placeholder="请输入物品名称" />
+        </el-form-item>
+        <el-form-item label="物品类型" prop="goodsType">
+          <el-select v-model="form.goodsType" placeholder="请选择物品类型">
+            <el-option
+                v-for="dict in dict.type.inventory_goods_type"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="库存数量" prop="quantityStock">
+          <el-input-number v-model="form.quantityStock" placeholder="请输入库存数量" />
+        </el-form-item>
+        <el-form-item label="物品状态" prop="goodsStatus">
+          <el-select v-model="form.goodsStatus" placeholder="请选择物品状态">
+            <el-option
+                v-for="dict in dict.type.inventory_goods_status"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="form.remark" placeholder="请输入备注" />
+        </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>
+
+<script>
+import {listGoods, addGoods, getGoods,updateGoods,delGoods} from "@/api/inventory/goods"
+
+export default {
+  name: "Goods",
+  dicts: ['inventory_goods_status', 'inventory_goods_type'],
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 物品表格数据
+      goodsList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        goodsCode: null,
+        goodsName: null,
+        goodsType: null,
+        quantityStock: null,
+        goodsStatus: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      },
+      lastKeyPressTime: 0,  
+      manualInputThreshold: 300, // 毫秒,手动输入的时间间隔阈值  
+      expectedCharacters: '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ', // 预期的字符集  
+    };
+  },
+  created() {
+    this.getList();
+  },
+   methods: {
+    /** 查询物品列表 */
+    getList() {
+      this.loading = true;
+      listGoods(this.queryParams).then(response => {
+        this.goodsList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    /** 新增 */
+    handleAdd() {
+      this.reset();
+      this.default();
+      this.open = true;
+      this.title = "添加物品";
+    },
+    /** 删除 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('是否确认删除物品编号为"' + ids + '"的数据项?').then(function() {
+        return delGoods(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    // 默认
+    default(){
+      this.form = {
+        id: null,
+        goodsCode: null,
+        goodsName: "定制平板",
+        goodsType: '0',
+        quantityStock: 1,
+        goodsStatus: '0',
+      };
+      this.resetForm("form");
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        goodsCode: null,
+        goodsName: null,
+        goodsType: null,
+        quantityStock: null,
+        goodsStatus: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null,
+        remark: null
+      };
+      this.resetForm("form");
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 修改按钮
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getGoods(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改物品";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateGoods(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addGoods(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+   }
+    
+}
+</script>