|
@@ -0,0 +1,186 @@
|
|
|
+<template>
|
|
|
+ <div class="mainContentBox">
|
|
|
+<!-- <form>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="16">
|
|
|
+ <el-form-item label="物料编码">
|
|
|
+ <el-input v-model="search.materialCode" placeholder="多个用,号隔开" clearable></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-form-item label="仓库类别">
|
|
|
+ <el-select v-model="search.level">
|
|
|
+ <el-option
|
|
|
+ v-for="item in typeList"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ :key="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-search"
|
|
|
+ size="normal"
|
|
|
+ @click="queryDataList"
|
|
|
+ >搜索</el-button
|
|
|
+ >
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </form>-->
|
|
|
+
|
|
|
+ <avue-crud
|
|
|
+ ref="crudRef"
|
|
|
+ v-model:search="search"
|
|
|
+ v-model="form"
|
|
|
+ :data="data"
|
|
|
+ :option="option"
|
|
|
+ @search-change="searchChange"
|
|
|
+ @search-reset="resetChange"
|
|
|
+ @size-change="dataList"
|
|
|
+ @current-change="dataList"
|
|
|
+ @selection-change="selectionChange1"
|
|
|
+ >
|
|
|
+<!-- <template #menu="{ size, row, index }">
|
|
|
+ <el-button type="primary" link size="small" @click="outMaterial()"
|
|
|
+ ><i-ep-view />出库</el-button>
|
|
|
+ </template>-->
|
|
|
+ </avue-crud>
|
|
|
+ <div class="dialog-footer" style="align-items: center;text-align: center;margin-top: 5px;">
|
|
|
+ <el-button type="primary" @click="outMaterial"> 确定</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script setup>
|
|
|
+import { ref, getCurrentInstance } from "vue";
|
|
|
+import { useCrud } from "@/hooks/userCrud";
|
|
|
+import { useCommonStoreHook } from "@/store";
|
|
|
+import {outSingle} from "@/api/storage";
|
|
|
+const { isShowTable, tableType } = toRefs(useCommonStoreHook());
|
|
|
+const emit = defineEmits(["searchMaterials"])
|
|
|
+// 传入一个url,后面不带/
|
|
|
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
|
|
|
+ useCrud({
|
|
|
+ dataListUrl: "/api/v1/wms/stock/info",
|
|
|
+ });
|
|
|
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } = Methords; //增删改查
|
|
|
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
|
|
|
+const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
|
|
|
+const clickObjs = ref([])
|
|
|
+const selectionChange1 =(row)=>{
|
|
|
+ toDeleteIds.value = [];
|
|
|
+ row?.forEach((element) => {
|
|
|
+ toDeleteIds.value.push(element.id);
|
|
|
+ });
|
|
|
+ clickObjs.value = row
|
|
|
+}
|
|
|
+const rowClick = (row)=>{
|
|
|
+ emit("searchMaterials", clickObjs.value)
|
|
|
+}
|
|
|
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
|
|
|
+const typeList = ref([
|
|
|
+ {"label": "一类库","value": "1"},{"label": "二类库","value": "2"}
|
|
|
+])
|
|
|
+const outMaterial = () => {
|
|
|
+ if(clickObjs.value.length == 0){
|
|
|
+ ElMessage.error("请选择需要出库的物料")
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let pass = true
|
|
|
+ clickObjs.value?.forEach((value) => {
|
|
|
+ if(!value.outNum){
|
|
|
+ ElMessage.error("请输入要出库的数量")
|
|
|
+ pass = false
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(value.outNum > value.num){
|
|
|
+ ElMessage.error("出库数量不能大于库存数量")
|
|
|
+ pass = false
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ value.materialNo = value.materialCode;
|
|
|
+ value.num = value.materialCount;
|
|
|
+ value.id = null
|
|
|
+ });
|
|
|
+ if(pass){
|
|
|
+ ElMessageBox.confirm("你确定要出库当前物料吗", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ const params = {
|
|
|
+ outType: search.value.level,
|
|
|
+ type: 2,
|
|
|
+ state: 1,
|
|
|
+ hosueNo: 1,
|
|
|
+ detailsList: clickObjs.value
|
|
|
+ }
|
|
|
+ outSingle(params).then((res)=>{
|
|
|
+ emit("searchMaterials", clickObjs.value)
|
|
|
+ })
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 设置表格列或者其他自定义的option
|
|
|
+option.value = Object.assign(option.value, {
|
|
|
+ delBtn: false,
|
|
|
+ selection: true,
|
|
|
+ addBtn: false,
|
|
|
+ search: false,
|
|
|
+ searchBtn: false,
|
|
|
+ viewBtn: false,
|
|
|
+ editBtn: false,
|
|
|
+ menu: false,
|
|
|
+ cellBtn: false,
|
|
|
+ column: [
|
|
|
+ {
|
|
|
+ label: "物料编码",
|
|
|
+ overHidden: true,
|
|
|
+ prop: "materialCode",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "物料名称",
|
|
|
+ prop: "materialName",
|
|
|
+ readonly: true,
|
|
|
+ overHidden: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "库存数量",
|
|
|
+ prop: "materialCount",
|
|
|
+ type: 'number',
|
|
|
+ min: 0,
|
|
|
+ max: 99999,
|
|
|
+ width: 100,
|
|
|
+ overHidden: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "出库数量",
|
|
|
+ prop: "outNum",
|
|
|
+ type: 'number',
|
|
|
+ min: 1,
|
|
|
+ max: 99999,
|
|
|
+ width: 180,
|
|
|
+ cell: true,
|
|
|
+ overHidden: true,
|
|
|
+ }
|
|
|
+ ],
|
|
|
+});
|
|
|
+
|
|
|
+const queryDataList = async () => {
|
|
|
+ search.value.outType = "out"
|
|
|
+ await dataList();
|
|
|
+ if (data.value) {
|
|
|
+ data.value.forEach(item => {
|
|
|
+ item.$cellEdit = true
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+onMounted(() => {
|
|
|
+ search.value.level = "1"
|
|
|
+ queryDataList();
|
|
|
+
|
|
|
+});
|
|
|
+</script>
|