feat: 添加物料管理模块及相关功能
新增物料管理模块,包括产品、配料、采购、入库、出库等功能 添加物料看板页面和BOM管理组件 更新环境配置和依赖项
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# 页面标题
|
||||
VITE_APP_TITLE = 首达特及巨峰外贸中心
|
||||
# VITE_APP_TITLE = 创高综合办公系统
|
||||
# VITE_APP_TITLE = 首达特及巨峰外贸中心
|
||||
VITE_APP_TITLE = 创高综合办公系统
|
||||
|
||||
# 开发环境配置
|
||||
VITE_APP_ENV = 'development'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 页面标题
|
||||
VITE_APP_TITLE = 首达特及巨峰外贸中心
|
||||
# VITE_APP_TITLE = 创高综合办公系统
|
||||
# VITE_APP_TITLE = 首达特及巨峰外贸中心
|
||||
VITE_APP_TITLE = 创高综合办公系统
|
||||
|
||||
# 生产环境配置
|
||||
VITE_APP_ENV = 'production'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 页面标题
|
||||
VITE_APP_TITLE = 首达特及巨峰外贸中心
|
||||
# VITE_APP_TITLE = 创高综合办公系统
|
||||
# VITE_APP_TITLE = 首达特及巨峰外贸中心
|
||||
VITE_APP_TITLE = 创高综合办公系统
|
||||
|
||||
# 生产环境配置
|
||||
VITE_APP_ENV = 'staging'
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel="icon" href="/favicon1.png">
|
||||
<title>首达特及巨峰钢铁外贸中心</title>
|
||||
<!-- <link rel="icon" href="/favicon.png">
|
||||
<title>创高综合办公系统</title>-->
|
||||
<!-- <link rel="icon" href="/favicon1.png">
|
||||
<title>首达特及巨峰钢铁外贸中心</title> -->
|
||||
<link rel="icon" href="/favicon.png">
|
||||
<title>创高综合办公系统</title>
|
||||
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
|
||||
<style>
|
||||
html,
|
||||
|
||||
@@ -51,5 +51,8 @@
|
||||
},
|
||||
"overrides": {
|
||||
"quill": "2.0.2"
|
||||
},
|
||||
"volta": {
|
||||
"node": "20.20.0"
|
||||
}
|
||||
}
|
||||
|
||||
44
gear-ui3/src/api/mat/matPriceHistory.js
Normal file
44
gear-ui3/src/api/mat/matPriceHistory.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询配料价格/均价变动历史列表
|
||||
export function listMatPriceHistory(query) {
|
||||
return request({
|
||||
url: '/mat/matPriceHistory/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询配料价格/均价变动历史详细
|
||||
export function getMatPriceHistory(historyId) {
|
||||
return request({
|
||||
url: '/mat/matPriceHistory/' + historyId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增配料价格/均价变动历史
|
||||
export function addMatPriceHistory(data) {
|
||||
return request({
|
||||
url: '/mat/matPriceHistory',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改配料价格/均价变动历史
|
||||
export function updateMatPriceHistory(data) {
|
||||
return request({
|
||||
url: '/mat/matPriceHistory',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除配料价格/均价变动历史
|
||||
export function delMatPriceHistory(historyId) {
|
||||
return request({
|
||||
url: '/mat/matPriceHistory/' + historyId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
gear-ui3/src/api/mat/material.js
Normal file
44
gear-ui3/src/api/mat/material.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询配料配件基础信息列表
|
||||
export function listMaterial(query) {
|
||||
return request({
|
||||
url: '/mat/material/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询配料配件基础信息详细
|
||||
export function getMaterial(materialId) {
|
||||
return request({
|
||||
url: '/mat/material/' + materialId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增配料配件基础信息
|
||||
export function addMaterial(data) {
|
||||
return request({
|
||||
url: '/mat/material',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改配料配件基础信息
|
||||
export function updateMaterial(data) {
|
||||
return request({
|
||||
url: '/mat/material',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除配料配件基础信息
|
||||
export function delMaterial(materialId) {
|
||||
return request({
|
||||
url: '/mat/material/' + materialId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
gear-ui3/src/api/mat/materialOut.js
Normal file
44
gear-ui3/src/api/mat/materialOut.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询配料出库列表
|
||||
export function listMaterialOut(query) {
|
||||
return request({
|
||||
url: '/mat/materialOut/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询配料出库详细
|
||||
export function getMaterialOut(outId) {
|
||||
return request({
|
||||
url: '/mat/materialOut/' + outId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增配料出库
|
||||
export function addMaterialOut(data) {
|
||||
return request({
|
||||
url: '/mat/materialOut',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改配料出库
|
||||
export function updateMaterialOut(data) {
|
||||
return request({
|
||||
url: '/mat/materialOut',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除配料出库
|
||||
export function delMaterialOut(outId) {
|
||||
return request({
|
||||
url: '/mat/materialOut/' + outId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
gear-ui3/src/api/mat/product.js
Normal file
44
gear-ui3/src/api/mat/product.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询产品基础信息列表
|
||||
export function listProduct(query) {
|
||||
return request({
|
||||
url: '/mat/product/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询产品基础信息详细
|
||||
export function getProduct(productId) {
|
||||
return request({
|
||||
url: '/mat/product/' + productId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增产品基础信息
|
||||
export function addProduct(data) {
|
||||
return request({
|
||||
url: '/mat/product',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改产品基础信息
|
||||
export function updateProduct(data) {
|
||||
return request({
|
||||
url: '/mat/product',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除产品基础信息
|
||||
export function delProduct(productId) {
|
||||
return request({
|
||||
url: '/mat/product/' + productId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
gear-ui3/src/api/mat/productMaterialRelation.js
Normal file
44
gear-ui3/src/api/mat/productMaterialRelation.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询产品-配料关联中间列表
|
||||
export function listProductMaterialRelation(query) {
|
||||
return request({
|
||||
url: '/mat/productMaterialRelation/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询产品-配料关联中间详细
|
||||
export function getProductMaterialRelation(relationId) {
|
||||
return request({
|
||||
url: '/mat/productMaterialRelation/' + relationId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增产品-配料关联中间
|
||||
export function addProductMaterialRelation(data) {
|
||||
return request({
|
||||
url: '/mat/productMaterialRelation',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改产品-配料关联中间
|
||||
export function updateProductMaterialRelation(data) {
|
||||
return request({
|
||||
url: '/mat/productMaterialRelation',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除产品-配料关联中间
|
||||
export function delProductMaterialRelation(relationId) {
|
||||
return request({
|
||||
url: '/mat/productMaterialRelation/' + relationId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
gear-ui3/src/api/mat/purchase.js
Normal file
44
gear-ui3/src/api/mat/purchase.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询采购单主(管理在途库存)列表
|
||||
export function listPurchase(query) {
|
||||
return request({
|
||||
url: '/mat/purchase/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询采购单主(管理在途库存)详细
|
||||
export function getPurchase(purchaseId) {
|
||||
return request({
|
||||
url: '/mat/purchase/' + purchaseId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增采购单主(管理在途库存)
|
||||
export function addPurchase(data) {
|
||||
return request({
|
||||
url: '/mat/purchase',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改采购单主(管理在途库存)
|
||||
export function updatePurchase(data) {
|
||||
return request({
|
||||
url: '/mat/purchase',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除采购单主(管理在途库存)
|
||||
export function delPurchase(purchaseId) {
|
||||
return request({
|
||||
url: '/mat/purchase/' + purchaseId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
gear-ui3/src/api/mat/purchaseInDetail.js
Normal file
44
gear-ui3/src/api/mat/purchaseInDetail.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询入库记录列表
|
||||
export function listPurchaseInDetail(query) {
|
||||
return request({
|
||||
url: '/mat/purchaseInDetail/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询入库记录详细
|
||||
export function getPurchaseInDetail(detailId) {
|
||||
return request({
|
||||
url: '/mat/purchaseInDetail/' + detailId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增入库记录
|
||||
export function addPurchaseInDetail(data) {
|
||||
return request({
|
||||
url: '/mat/purchaseInDetail',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改入库记录
|
||||
export function updatePurchaseInDetail(data) {
|
||||
return request({
|
||||
url: '/mat/purchaseInDetail',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除入库记录
|
||||
export function delPurchaseInDetail(detailId) {
|
||||
return request({
|
||||
url: '/mat/purchaseInDetail/' + detailId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -449,8 +449,8 @@ body {
|
||||
left: 0;
|
||||
position: relative;
|
||||
margin: 10vh auto 0;
|
||||
padding: 0;
|
||||
border-radius: 8px;
|
||||
width: 60% !important; // 自适应宽度
|
||||
|
||||
// 对话框头部尺寸
|
||||
.el-dialog__header {
|
||||
|
||||
0
gear-ui3/src/components/RawSelector/index.vue
Normal file
0
gear-ui3/src/components/RawSelector/index.vue
Normal file
25
gear-ui3/src/components/Renderer/Raw.vue
Normal file
25
gear-ui3/src/components/Renderer/Raw.vue
Normal file
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<el-popover width="400">
|
||||
<template #reference>
|
||||
<el-button type="primary" size="mini" link>{{data.materialName}}</el-button>
|
||||
</template>
|
||||
<el-descriptions :column="2">
|
||||
<el-descriptions-item label="配料名称">{{ data.materialName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="配料规格">{{ data.spec }}</el-descriptions-item>
|
||||
<el-descriptions-item label="配料型号">{{ data.model }}</el-descriptions-item>
|
||||
<el-descriptions-item label="厂家">{{ data.factory }}</el-descriptions-item>
|
||||
<el-descriptions-item label="现存库存">{{ data.currentStock }}</el-descriptions-item>
|
||||
<el-descriptions-item label="计量单位">{{ data.unit }}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注" :span="2">{{ data.remark }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-popover>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -38,9 +38,9 @@
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<div class="right-menu-item hover-effect setting" @click="setLayout" v-if="settingsStore.showSettings">
|
||||
<!-- <div class="right-menu-item hover-effect setting" @click="setLayout" v-if="settingsStore.showSettings">
|
||||
<svg-icon icon-class="more-up" />
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
237
gear-ui3/src/views/mat/components/bom.vue
Normal file
237
gear-ui3/src/views/mat/components/bom.vue
Normal file
@@ -0,0 +1,237 @@
|
||||
<template>
|
||||
<div v-if="productId">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="productMaterialRelationList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="关联ID 主键" align="center" prop="relationId" v-if="true"/> -->
|
||||
<!-- <el-table-column label="产品ID 关联t_product.id" align="center" prop="productId" /> -->
|
||||
<el-table-column label="配料" align="center" prop="materialId" />
|
||||
<el-table-column label="所需数量" align="center" prop="materialNum" />
|
||||
<!-- <el-table-column label="配料排序 用于前端展示顺序" align="center" prop="sort" /> -->
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 添加或修改配方对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="productMaterialRelationRef" :model="form" :rules="rules" label-width="80px">
|
||||
<!-- <el-form-item label="产品ID 关联t_product.id" prop="productId">
|
||||
<el-input v-model="form.productId" placeholder="请输入产品ID 关联t_product.id" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="配料" prop="materialId">
|
||||
<el-input v-model="form.materialId" placeholder="请输入配料" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所需数量" prop="materialNum">
|
||||
<el-input v-model="form.materialNum" placeholder="请输入所需数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input v-model="form.sort" placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<el-empty v-else description="请先选择产品查看配方"></el-empty>
|
||||
</template>
|
||||
|
||||
<script setup name="ProductMaterialRelation">
|
||||
import { listProductMaterialRelation, getProductMaterialRelation, delProductMaterialRelation, addProductMaterialRelation, updateProductMaterialRelation } from "@/api/mat/productMaterialRelation";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const productMaterialRelationList = ref([]);
|
||||
const open = ref(false);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const formatterTime = (time) => {
|
||||
return proxy.parseTime(time, '{y}-{m}-{d}')
|
||||
}
|
||||
|
||||
const props = defineProps({
|
||||
productId: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
productId: props.productId,
|
||||
materialId: undefined,
|
||||
materialNum: undefined,
|
||||
sort: undefined,
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
watch(() => props.productId, (newVal, oldVal) => {
|
||||
queryParams.value.productId = newVal;
|
||||
getList();
|
||||
}, { immediate: true })
|
||||
|
||||
/** 查询配方列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listProductMaterialRelation(queryParams.value).then(response => {
|
||||
productMaterialRelationList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
relationId: null,
|
||||
productId: props.productId,
|
||||
materialId: null,
|
||||
materialNum: null,
|
||||
sort: null,
|
||||
delFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
};
|
||||
proxy.resetForm("productMaterialRelationRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.relationId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加配方";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
loading.value = true
|
||||
reset();
|
||||
const _relationId = row.relationId || ids.value
|
||||
getProductMaterialRelation(_relationId).then(response => {
|
||||
loading.value = false;
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改配方";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["productMaterialRelationRef"].validate(valid => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.relationId != null) {
|
||||
updateProductMaterialRelation(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
} else {
|
||||
addProductMaterialRelation(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _relationIds = row.relationId || ids.value;
|
||||
proxy.$modal.confirm('是否确认删除配方编号为"' + _relationIds + '"的数据项?').then(function () {
|
||||
loading.value = true;
|
||||
return delProductMaterialRelation(_relationIds);
|
||||
}).then(() => {
|
||||
loading.value = true;
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('mat/productMaterialRelation/export', {
|
||||
...queryParams.value
|
||||
}, `productMaterialRelation_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
</script>
|
||||
286
gear-ui3/src/views/mat/components/in.vue
Normal file
286
gear-ui3/src/views/mat/components/in.vue
Normal file
@@ -0,0 +1,286 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="配料" prop="materialId">
|
||||
<el-input v-model="queryParams.materialId" placeholder="请输入配料" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="操作人" prop="operator">
|
||||
<el-input v-model="queryParams.operator" placeholder="请输入入库操作人" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @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="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row> -->
|
||||
|
||||
<el-table v-loading="loading" :data="purchaseInDetailList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="入库明细ID 主键" align="center" prop="detailId" v-if="false" />
|
||||
<!-- <el-table-column label="采购单ID" align="center" prop="purchaseId" /> -->
|
||||
<el-table-column label="配料" align="center" prop="materialId">
|
||||
<template #default="scope">
|
||||
<raw :data="scope.row" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="入库数量" align="center" prop="inNum" />
|
||||
<el-table-column label="入库单价" align="center" prop="inPrice" />
|
||||
<el-table-column label="入库金额" align="center" prop="inAmount" />
|
||||
<el-table-column label="入库时间" align="center" prop="inTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ formatterTime(scope.row.inTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作人" align="center" prop="operator" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<!-- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button> -->
|
||||
<!-- <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button> -->
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">撤回</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 添加或修改入库记录对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="purchaseInDetailRef" :model="form" :rules="rules" label-width="80px">
|
||||
<!-- <el-form-item label="采购单ID 关联t_purchase.id" prop="purchaseId">
|
||||
<el-input v-model="form.purchaseId" placeholder="请输入采购单ID 关联t_purchase.id" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="配料" prop="materialId">
|
||||
<el-input v-model="form.materialId" placeholder="请输入配料" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库数量" prop="inNum">
|
||||
<el-input v-model="form.inNum" placeholder="请输入入库数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库单价" prop="inPrice">
|
||||
<el-input v-model="form.inPrice" placeholder="请输入入库单价" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="入库金额" prop="inAmount">
|
||||
<el-input v-model="form.inAmount" placeholder="请输入入库金额" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="入库时间" prop="inTime">
|
||||
<el-date-picker clearable v-model="form.inTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择实际入库时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作人" prop="operator">
|
||||
<el-input v-model="form.operator" placeholder="请输入入库操作人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="PurchaseInDetail">
|
||||
import { listPurchaseInDetail, getPurchaseInDetail, delPurchaseInDetail, addPurchaseInDetail, updatePurchaseInDetail } from "@/api/mat/purchaseInDetail";
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import Raw from '@/components/Renderer/Raw.vue'
|
||||
|
||||
const props = defineProps({
|
||||
purchaseId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
})
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const purchaseInDetailList = ref([]);
|
||||
const open = ref(false);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const formatterTime = (time) => {
|
||||
return proxy.parseTime(time, '{y}-{m}-{d}')
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
purchaseId: undefined,
|
||||
materialId: undefined,
|
||||
inNum: undefined,
|
||||
inPrice: undefined,
|
||||
inAmount: undefined,
|
||||
inTime: undefined,
|
||||
operator: undefined,
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询入库记录列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listPurchaseInDetail(queryParams.value).then(response => {
|
||||
purchaseInDetailList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
const nickName = computed(() => userStore.nickName)
|
||||
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
const inTime = proxy.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
||||
form.value = {
|
||||
detailId: null,
|
||||
purchaseId: null,
|
||||
materialId: null,
|
||||
inNum: null,
|
||||
inPrice: null,
|
||||
inAmount: null,
|
||||
inTime: inTime,
|
||||
operator: nickName,
|
||||
delFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
};
|
||||
proxy.resetForm("purchaseInDetailRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.detailId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加入库记录";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
loading.value = true
|
||||
reset();
|
||||
const _detailId = row.detailId || ids.value
|
||||
getPurchaseInDetail(_detailId).then(response => {
|
||||
loading.value = false;
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改入库记录";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["purchaseInDetailRef"].validate(valid => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.detailId != null) {
|
||||
updatePurchaseInDetail(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
} else {
|
||||
addPurchaseInDetail(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _detailIds = row.detailId || ids.value;
|
||||
proxy.$modal.confirm('是否确认撤回入库记录编号为"' + _detailIds + '"的数据项?').then(function () {
|
||||
loading.value = true;
|
||||
return delPurchaseInDetail(_detailIds);
|
||||
}).then(() => {
|
||||
loading.value = true;
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("撤回成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('mat/purchaseInDetail/export', {
|
||||
...queryParams.value
|
||||
}, `purchaseInDetail_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
|
||||
watch(() => props.purchaseId, (newVal, oldVal) => {
|
||||
if (newVal) {
|
||||
queryParams.value.purchaseId = newVal;
|
||||
getList();
|
||||
}
|
||||
}, { immediate: true })
|
||||
</script>
|
||||
17
gear-ui3/src/views/mat/dashboard/index.vue
Normal file
17
gear-ui3/src/views/mat/dashboard/index.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 库存看板
|
||||
import * as echarts from 'echarts';
|
||||
import { listPurchaseInDetail } from "@/api/mat/purchaseInDetail";
|
||||
import { listMaterialOut } from "@/api/mat/materialOut";
|
||||
import { listPurchase } from "@/api/mat/purchase";
|
||||
import { listMaterial } from "@/api/mat/material";
|
||||
|
||||
const purchaseList = ref([]);
|
||||
const materialList = ref([]);
|
||||
const purchaseInDetailList = ref([]);
|
||||
const materialOutList = ref([]);
|
||||
</script>
|
||||
282
gear-ui3/src/views/mat/in/index.vue
Normal file
282
gear-ui3/src/views/mat/in/index.vue
Normal file
@@ -0,0 +1,282 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="配料" prop="materialId">
|
||||
<el-input v-model="queryParams.materialId" placeholder="请输入配料" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="操作人" prop="operator">
|
||||
<el-input v-model="queryParams.operator" placeholder="请输入入库操作人" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @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="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="purchaseInDetailList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="入库明细ID 主键" align="center" prop="detailId" v-if="false" />
|
||||
<!-- <el-table-column label="采购单ID" align="center" prop="purchaseId" /> -->
|
||||
<el-table-column label="配料" align="center" prop="materialId">
|
||||
<template #default="scope">
|
||||
<raw :data="scope.row" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="入库数量" align="center" prop="inNum" />
|
||||
<el-table-column label="入库单价" align="center" prop="inPrice" />
|
||||
<el-table-column label="入库金额" align="center" prop="inAmount" />
|
||||
<el-table-column label="入库时间" align="center" prop="inTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ formatterTime(scope.row.inTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作人" align="center" prop="operator" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<!-- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button> -->
|
||||
<!-- <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button> -->
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">撤回</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 添加或修改入库记录对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="purchaseInDetailRef" :model="form" :rules="rules" label-width="80px">
|
||||
<!-- <el-form-item label="采购单ID 关联t_purchase.id" prop="purchaseId">
|
||||
<el-input v-model="form.purchaseId" placeholder="请输入采购单ID 关联t_purchase.id" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="配料" prop="materialId">
|
||||
<el-input v-model="form.materialId" placeholder="请输入配料" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库数量" prop="inNum">
|
||||
<el-input v-model="form.inNum" placeholder="请输入入库数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库单价" prop="inPrice">
|
||||
<el-input v-model="form.inPrice" placeholder="请输入入库单价" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="入库金额" prop="inAmount">
|
||||
<el-input v-model="form.inAmount" placeholder="请输入入库金额" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="入库时间" prop="inTime">
|
||||
<el-date-picker clearable v-model="form.inTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择实际入库时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作人" prop="operator">
|
||||
<el-input v-model="form.operator" placeholder="请输入入库操作人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="PurchaseInDetail">
|
||||
import { listPurchaseInDetail, getPurchaseInDetail, delPurchaseInDetail, addPurchaseInDetail, updatePurchaseInDetail } from "@/api/mat/purchaseInDetail";
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import Raw from '@/components/Renderer/Raw.vue'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const purchaseInDetailList = ref([]);
|
||||
const open = ref(false);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const formatterTime = (time) => {
|
||||
return proxy.parseTime(time, '{y}-{m}-{d}')
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
purchaseId: undefined,
|
||||
materialId: undefined,
|
||||
inNum: undefined,
|
||||
inPrice: undefined,
|
||||
inAmount: undefined,
|
||||
inTime: undefined,
|
||||
operator: undefined,
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询入库记录列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listPurchaseInDetail(queryParams.value).then(response => {
|
||||
purchaseInDetailList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
const nickName = computed(() => userStore.nickName)
|
||||
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
const inTime = proxy.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
||||
form.value = {
|
||||
detailId: null,
|
||||
purchaseId: null,
|
||||
materialId: null,
|
||||
inNum: null,
|
||||
inPrice: null,
|
||||
inAmount: null,
|
||||
inTime: inTime,
|
||||
operator: nickName,
|
||||
delFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
};
|
||||
proxy.resetForm("purchaseInDetailRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.detailId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加入库记录";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
loading.value = true
|
||||
reset();
|
||||
const _detailId = row.detailId || ids.value
|
||||
getPurchaseInDetail(_detailId).then(response => {
|
||||
loading.value = false;
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改入库记录";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["purchaseInDetailRef"].validate(valid => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.detailId != null) {
|
||||
updatePurchaseInDetail(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
} else {
|
||||
addPurchaseInDetail(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _detailIds = row.detailId || ids.value;
|
||||
proxy.$modal.confirm('是否确认撤回入库记录编号为"' + _detailIds + '"的数据项?').then(function () {
|
||||
loading.value = true;
|
||||
return delPurchaseInDetail(_detailIds);
|
||||
}).then(() => {
|
||||
loading.value = true;
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("撤回成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('mat/purchaseInDetail/export', {
|
||||
...queryParams.value
|
||||
}, `purchaseInDetail_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
278
gear-ui3/src/views/mat/out/index.vue
Normal file
278
gear-ui3/src/views/mat/out/index.vue
Normal file
@@ -0,0 +1,278 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="出库单号" prop="outNo">
|
||||
<el-input v-model="queryParams.outNo" placeholder="请输入出库单号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配料" prop="materialId">
|
||||
<el-input v-model="queryParams.materialId" placeholder="请输入配料" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="操作人" prop="operator">
|
||||
<el-input v-model="queryParams.operator" placeholder="请输入出库操作人" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @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="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="materialOutList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="出库明细ID 主键" align="center" prop="outId" v-if="false" />
|
||||
<el-table-column label="出库单号" align="center" prop="outNo" />
|
||||
<el-table-column label="配料" align="center" prop="materialId">
|
||||
<template #default="scope">
|
||||
<raw :data="scope.row" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="出库数量" align="center" prop="outNum" />
|
||||
<el-table-column label="出库原因" align="center" prop="outReason" />
|
||||
<el-table-column label="操作人" align="center" prop="operator" />
|
||||
<el-table-column label="出库时间" align="center" prop="outTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ formatterTime(scope.row.outTime) }}</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">
|
||||
<template #default="scope">
|
||||
<!-- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button> -->
|
||||
<!-- <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button> -->
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">撤回</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 添加或修改配料出库对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="materialOutRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="出库单号" prop="outNo">
|
||||
<el-input v-model="form.outNo" placeholder="请输入出库单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配料" prop="materialId">
|
||||
<el-input v-model="form.materialId" placeholder="请输入配料" />
|
||||
</el-form-item>
|
||||
<el-form-item label="出库数量" prop="outNum">
|
||||
<el-input v-model="form.outNum" placeholder="请输入出库数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="出库原因" prop="outReason">
|
||||
<el-input v-model="form.outReason" placeholder="请输入出库原因" />
|
||||
</el-form-item>
|
||||
<el-form-item label="操作人" prop="operator">
|
||||
<el-input v-model="form.operator" placeholder="请输入操作人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="出库时间" prop="outTime">
|
||||
<el-date-picker clearable v-model="form.outTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择实际出库时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="MaterialOut">
|
||||
import { listMaterialOut, getMaterialOut, delMaterialOut, addMaterialOut, updateMaterialOut } from "@/api/mat/materialOut";
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { computed } from "vue";
|
||||
import Raw from '@/components/Renderer/Raw.vue'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const materialOutList = ref([]);
|
||||
const open = ref(false);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const formatterTime = (time) => {
|
||||
return proxy.parseTime(time, '{y}-{m}-{d}')
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
outNo: undefined,
|
||||
materialId: undefined,
|
||||
operator: undefined,
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询配料出库列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listMaterialOut(queryParams.value).then(response => {
|
||||
materialOutList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
const nickName = computed(() => userStore.nickName)
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
const outNo = proxy.parseTime(new Date(), '{y}{m}{d}{hh}{i}{s}')
|
||||
const outTime = proxy.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
||||
|
||||
form.value = {
|
||||
outId: null,
|
||||
outNo: outNo,
|
||||
materialId: null,
|
||||
outNum: null,
|
||||
outReason: null,
|
||||
operator: nickName,
|
||||
outTime: outTime,
|
||||
delFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
};
|
||||
proxy.resetForm("materialOutRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.outId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加配料出库";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
loading.value = true
|
||||
reset();
|
||||
const _outId = row.outId || ids.value
|
||||
getMaterialOut(_outId).then(response => {
|
||||
loading.value = false;
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改配料出库";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["materialOutRef"].validate(valid => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.outId != null) {
|
||||
updateMaterialOut(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
} else {
|
||||
addMaterialOut(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _outIds = row.outId || ids.value;
|
||||
proxy.$modal.confirm('是否确认撤回配料出库编号为"' + _outIds + '"的数据项?').then(function () {
|
||||
loading.value = true;
|
||||
return delMaterialOut(_outIds);
|
||||
}).then(() => {
|
||||
loading.value = true;
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("撤回成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('mat/materialOut/export', {
|
||||
...queryParams.value
|
||||
}, `materialOut_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
297
gear-ui3/src/views/mat/product/index.vue
Normal file
297
gear-ui3/src/views/mat/product/index.vue
Normal file
@@ -0,0 +1,297 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="产品名称" prop="productName">
|
||||
<el-input
|
||||
v-model="queryParams.productName"
|
||||
placeholder="请输入产品名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品规格" prop="spec">
|
||||
<el-input
|
||||
v-model="queryParams.spec"
|
||||
placeholder="请输入产品规格"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品型号" prop="model">
|
||||
<el-input
|
||||
v-model="queryParams.model"
|
||||
placeholder="请输入产品型号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @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="Plus"
|
||||
@click="handleAdd"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="productList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="产品ID 主键" align="center" prop="productId" v-if="false"/>
|
||||
<el-table-column label="产品名称" align="center" prop="productName" />
|
||||
<el-table-column label="产品规格" align="center" prop="spec" />
|
||||
<el-table-column label="产品型号" align="center" prop="model" />
|
||||
<el-table-column label="产品单价" align="center" prop="unitPrice" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Plus" @click="handleBom(scope.row)">配方</el-button>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改产品基础信息对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="productRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="产品名称" prop="productName">
|
||||
<el-input v-model="form.productName" placeholder="请输入产品名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品规格" prop="spec">
|
||||
<el-input v-model="form.spec" placeholder="请输入产品规格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品型号" prop="model">
|
||||
<el-input v-model="form.model" placeholder="请输入产品型号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品单价" prop="unitPrice">
|
||||
<el-input v-model="form.unitPrice" placeholder="请输入产品单价" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="产品配方" v-model="bomOpen" width="500px" append-to-body>
|
||||
<bom :productId="currentProductId" @close="bomOpen = false" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Product">
|
||||
import { listProduct, getProduct, delProduct, addProduct, updateProduct } from "@/api/mat/product";
|
||||
import bom from "@/views/mat/components/bom.vue";
|
||||
|
||||
const bomOpen = ref(false);
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const productList = ref([]);
|
||||
const open = ref(false);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const currentProductId = ref(null);
|
||||
|
||||
const formatterTime = (time) => {
|
||||
return proxy.parseTime(time, '{y}-{m}-{d}')
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
productName: undefined,
|
||||
spec: undefined,
|
||||
model: undefined,
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询产品基础信息列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listProduct(queryParams.value).then(response => {
|
||||
productList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
productId: null,
|
||||
productName: null,
|
||||
spec: null,
|
||||
model: null,
|
||||
unitPrice: null,
|
||||
delFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
};
|
||||
proxy.resetForm("productRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.productId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加产品基础信息";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
loading.value = true
|
||||
reset();
|
||||
const _productId = row.productId || ids.value
|
||||
getProduct(_productId).then(response => {
|
||||
loading.value = false;
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改产品基础信息";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["productRef"].validate(valid => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.productId != null) {
|
||||
updateProduct(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
} else {
|
||||
addProduct(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _productIds = row.productId || ids.value;
|
||||
proxy.$modal.confirm('是否确认删除产品基础信息编号为"' + _productIds + '"的数据项?').then(function() {
|
||||
loading.value = true;
|
||||
return delProduct(_productIds);
|
||||
}).then(() => {
|
||||
loading.value = true;
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
function handleBom(row) {
|
||||
bomOpen.value = true;
|
||||
currentProductId.value = row.productId;
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('mat/product/export', {
|
||||
...queryParams.value
|
||||
}, `product_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
404
gear-ui3/src/views/mat/purchase/index.vue
Normal file
404
gear-ui3/src/views/mat/purchase/index.vue
Normal file
@@ -0,0 +1,404 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="采购单号" prop="purchaseNo">
|
||||
<el-input v-model="queryParams.purchaseNo" placeholder="请输入采购单号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="供应商" prop="factory">
|
||||
<el-input v-model="queryParams.factory" placeholder="请输入供应商" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配料" prop="materialId">
|
||||
<el-input v-model="queryParams.materialId" placeholder="请输入配料" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="采购状态" prop="status">
|
||||
<el-select style="width: 120px" v-model="queryParams.status" placeholder="请选择采购状态" clearable>
|
||||
<el-option v-for="dict in purchase_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="采购人" prop="operator">
|
||||
<el-input v-model="queryParams.operator" placeholder="请输入采购人" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @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="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="purchaseList" @row-click="handleRowClick"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="采购单ID 主键" align="center" prop="purchaseId" v-if="false" />
|
||||
<el-table-column label="采购单号" align="center" prop="purchaseNo" />
|
||||
<el-table-column label="供应商" align="center" prop="factory" />
|
||||
<el-table-column label="配料" align="center" prop="materialId">
|
||||
<template #default="scope">
|
||||
<raw :data="scope.row" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="采购数量" align="center" prop="planNum" />
|
||||
<el-table-column label="采购单价" align="center" prop="purchasePrice" />
|
||||
<el-table-column label="截止日期" align="center" prop="deadline" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ formatterTime(scope.row.deadline) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="采购状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="purchase_status" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="采购人" align="center" prop="operator" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Plus" v-if="scope.row.status == 1 || scope.row.status == 3"
|
||||
@click="handleIn(scope.row)">收货</el-button>
|
||||
<el-button link type="primary" icon="Edit" v-if="scope.row.status == 1 || scope.row.status == 3"
|
||||
@click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" v-if="scope.row.status == 1 || scope.row.status == 3"
|
||||
@click="handleDelete(scope.row)">删除</el-button>
|
||||
<el-button link type="primary" icon="Delete" v-if="scope.row.status == 1 || scope.row.status == 3"
|
||||
@click="handleZero(scope.row)">归零</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改采购单对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="purchaseRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="采购单号" prop="purchaseNo">
|
||||
<el-input v-model="form.purchaseNo" placeholder="请输入采购单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="供应商" prop="factory">
|
||||
<el-input v-model="form.factory" placeholder="请输入供应商" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配料" prop="materialId">
|
||||
<el-input v-model="form.materialId" placeholder="请输入配料ID 关联material.id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="采购数量" prop="planNum" v-if="!form.purchaseId">
|
||||
<el-input v-model="form.planNum" placeholder="请输入采购数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="采购单价" prop="purchasePrice">
|
||||
<el-input v-model="form.purchasePrice" placeholder="请输入采购单价" />
|
||||
</el-form-item>
|
||||
<el-form-item label="截止日期" prop="deadline">
|
||||
<el-date-picker clearable v-model="form.deadline" type="date" value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择截止日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="采购状态" prop="status">
|
||||
<el-select v-model="form.status" placeholder="请选择采购状态">
|
||||
<el-option v-for="dict in purchase_status" :key="dict.value" :label="dict.label"
|
||||
:value="parseInt(dict.value)"></el-option>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="采购人" prop="operator">
|
||||
<el-input v-model="form.operator" placeholder="请输入采购人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="收货" v-model="inOpen" width="500px" append-to-body>
|
||||
<el-form ref="purchaseInDetailRef" :model="inForm" :rules="rules" label-width="80px">
|
||||
<!-- <el-form-item label="采购单ID 关联t_purchase.id" prop="purchaseId">
|
||||
<el-input v-model="form.purchaseId" placeholder="请输入采购单ID 关联t_purchase.id" />
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="配料" prop="materialId">
|
||||
<el-input v-model="inForm.materialId" placeholder="请输入配料" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="入库数量" prop="inNum">
|
||||
<el-input v-model="inForm.inNum" placeholder="请输入入库数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库单价" prop="inPrice">
|
||||
<el-input v-model="inForm.inPrice" placeholder="请输入入库单价" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库时间" prop="inTime">
|
||||
<el-date-picker clearable v-model="inForm.inTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择实际入库时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作人" prop="operator">
|
||||
<el-input v-model="inForm.operator" placeholder="请输入入库操作人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="inForm.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitFormIn">确 定</el-button>
|
||||
<el-button @click="cancelIn">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<div style="border: 1px solid #aaa; margin-top: 10px;">
|
||||
<PurchaseInDetail v-if="currentPurchaseId" :purchaseId="currentPurchaseId" />
|
||||
<el-empty v-else description="选择采购单查看入库记录详情" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Purchase">
|
||||
import { listPurchase, getPurchase, delPurchase, addPurchase, updatePurchase } from "@/api/mat/purchase";
|
||||
import { listPurchaseInDetail, addPurchaseInDetail } from "@/api/mat/purchaseInDetail";
|
||||
import PurchaseInDetail from "@/views/mat/components/in.vue"
|
||||
import Raw from "@/components/Renderer/Raw.vue"
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { computed } from "vue";
|
||||
|
||||
// 采购的四个状态
|
||||
// 1. 在途(刚创建的)
|
||||
// 2. 已完成(在途数量与已入库数量相等)
|
||||
// 3. 已取消(还未收货就直接取消的计划)
|
||||
// 4. 部分入库(计划数量与已入库数量不同,相当于部分入库时直接清零,取消了剩余的计划)
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { purchase_status } = proxy.useDict('purchase_status');
|
||||
|
||||
const purchaseList = ref([]);
|
||||
const open = ref(false);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const currentPurchaseId = ref('');
|
||||
|
||||
const formatterTime = (time) => {
|
||||
return proxy.parseTime(time, '{y}-{m}-{d}')
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
purchaseNo: undefined,
|
||||
factory: undefined,
|
||||
materialId: undefined,
|
||||
planNum: undefined,
|
||||
purchasePrice: undefined,
|
||||
deadline: undefined,
|
||||
status: undefined,
|
||||
operator: undefined,
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询采购单列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listPurchase(queryParams.value).then(response => {
|
||||
purchaseList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
const userStore = useUserStore()
|
||||
const nickName = computed(() => userStore.nickName)
|
||||
console.log(nickName)
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
// 生成采购单号
|
||||
// 年月日时分秒拼接,YYYYMMDDHHmmss
|
||||
const purchaseNo = proxy.parseTime(new Date(), '{y}{m}{d}{hh}{i}{s}')
|
||||
|
||||
form.value = {
|
||||
purchaseId: null,
|
||||
purchaseNo: purchaseNo,
|
||||
factory: null,
|
||||
materialId: null,
|
||||
planNum: null,
|
||||
purchasePrice: null,
|
||||
deadline: null,
|
||||
status: 1,
|
||||
cancelTime: null,
|
||||
operator: nickName,
|
||||
delFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
};
|
||||
proxy.resetForm("purchaseRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
function handleRowClick(row) {
|
||||
currentPurchaseId.value = row.purchaseId;
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.purchaseId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加采购单";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
loading.value = true
|
||||
reset();
|
||||
const _purchaseId = row.purchaseId || ids.value
|
||||
getPurchase(_purchaseId).then(response => {
|
||||
loading.value = false;
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改采购单";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["purchaseRef"].validate(valid => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.purchaseId != null) {
|
||||
updatePurchase(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
} else {
|
||||
addPurchase(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _purchaseIds = row.purchaseId || ids.value;
|
||||
proxy.$modal.confirm('是否确认删除采购单编号为"' + _purchaseIds + '"的数据项?').then(function () {
|
||||
loading.value = true;
|
||||
return delPurchase(_purchaseIds);
|
||||
}).then(() => {
|
||||
loading.value = true;
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('mat/purchase/export', {
|
||||
...queryParams.value
|
||||
}, `purchase_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
const inOpen = ref(false);
|
||||
const inForm = ref({});
|
||||
|
||||
function handleIn(row) {
|
||||
inOpen.value = true;
|
||||
const inTime = proxy.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
||||
|
||||
inForm.value = {
|
||||
detailId: null,
|
||||
purchaseId: row.purchaseId,
|
||||
materialId: row.materialId,
|
||||
inNum: null,
|
||||
inPrice: row.purchasePrice,
|
||||
inTime: inTime,
|
||||
operator: nickName,
|
||||
remark: null
|
||||
}
|
||||
}
|
||||
|
||||
function submitFormIn() {
|
||||
proxy.$refs["purchaseInDetailRef"].validate(valid => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
loading.value = true;
|
||||
addPurchaseInDetail(inForm.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
inOpen.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cancelIn() {
|
||||
inOpen.value = false;
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
424
gear-ui3/src/views/mat/raw/index.vue
Normal file
424
gear-ui3/src/views/mat/raw/index.vue
Normal file
@@ -0,0 +1,424 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="配料名称" prop="materialName">
|
||||
<el-input v-model="queryParams.materialName" placeholder="请输入配料名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配料规格" prop="spec">
|
||||
<el-input v-model="queryParams.spec" placeholder="请输入配料规格" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配料型号" prop="model">
|
||||
<el-input v-model="queryParams.model" placeholder="请输入配料型号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="厂家" prop="factory">
|
||||
<el-input v-model="queryParams.factory" placeholder="请输入厂家" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="计量单位 个/公斤/米等" prop="unit">
|
||||
<el-input v-model="queryParams.unit" placeholder="请输入计量单位 个/公斤/米等" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="现存库存" prop="currentStock">
|
||||
<el-input v-model="queryParams.currentStock" placeholder="请输入现存库存" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @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="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="materialList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="配料ID 主键" align="center" prop="materialId" v-if="true" /> -->
|
||||
<el-table-column label="配料名称" align="center" prop="materialName" />
|
||||
<el-table-column label="配料规格" align="center" prop="spec" />
|
||||
<el-table-column label="配料型号" align="center" prop="model" />
|
||||
<el-table-column label="厂家" align="center" prop="factory" />
|
||||
<el-table-column label="计量单位" align="center" prop="unit" />
|
||||
<el-table-column label="现存库存" align="center" prop="currentStock" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Plus" @click="handleIn(scope.row)">入库</el-button>
|
||||
<el-button link type="primary" icon="Minus" @click="handleOut(scope.row)">出库</el-button>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改配料配件基础信息对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="materialRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="配料名称" prop="materialName">
|
||||
<el-input v-model="form.materialName" placeholder="请输入配料名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配料规格" prop="spec">
|
||||
<el-input v-model="form.spec" placeholder="请输入配料规格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配料型号" prop="model">
|
||||
<el-input v-model="form.model" placeholder="请输入配料型号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="厂家" prop="factory">
|
||||
<el-input v-model="form.factory" placeholder="请输入厂家" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计量单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入计量单位" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="现存库存" prop="currentStock">
|
||||
<el-input v-model="form.currentStock" placeholder="请输入现存库存" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="入库" v-model="inOpen" width="500px" append-to-body>
|
||||
<el-form ref="materialInRef" :model="inForm" label-width="80px">
|
||||
<el-form-item label="配料" prop="materialId">
|
||||
<el-input v-model="inForm.materialId" placeholder="请输入配料" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库数量" prop="inNum">
|
||||
<el-input v-model="inForm.inNum" placeholder="请输入入库数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库单价" prop="inPrice">
|
||||
<el-input v-model="inForm.inPrice" placeholder="请输入入库单价" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库时间" prop="inTime">
|
||||
<el-date-picker clearable v-model="inForm.inTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择实际入库时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作人" prop="operator">
|
||||
<el-input v-model="inForm.operator" placeholder="请输入入库操作人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="inForm.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitFormIn">确 定</el-button>
|
||||
<el-button @click="cancelIn">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="出库" v-model="outOpen" width="500px" append-to-body>
|
||||
<el-form ref="materialOutRef" :model="outForm" label-width="80px">
|
||||
<el-form-item label="出库单号" prop="outNo">
|
||||
<el-input v-model="outForm.outNo" placeholder="请输入出库单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配料" prop="materialId">
|
||||
<el-input v-model="outForm.materialId" placeholder="请输入配料" />
|
||||
</el-form-item>
|
||||
<el-form-item label="出库数量" prop="outNum">
|
||||
<el-input v-model="outForm.outNum" placeholder="请输入出库数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="出库原因" prop="outReason">
|
||||
<el-input v-model="outForm.outReason" placeholder="请输入出库原因" />
|
||||
</el-form-item>
|
||||
<el-form-item label="操作人" prop="operator">
|
||||
<el-input v-model="outForm.operator" placeholder="请输入操作人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="出库时间" prop="outTime">
|
||||
<el-date-picker clearable v-model="outForm.outTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择实际出库时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="outForm.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitFormOut">确 定</el-button>
|
||||
<el-button @click="cancelOut">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Material">
|
||||
import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial } from "@/api/mat/material";
|
||||
import { addPurchaseInDetail } from "@/api/mat/purchaseInDetail";
|
||||
import { addMaterialOut } from "@/api/mat/materialOut";
|
||||
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const materialList = ref([]);
|
||||
const open = ref(false);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const inForm = ref({});
|
||||
const outForm = ref({});
|
||||
const inOpen = ref(false);
|
||||
const outOpen = ref(false);
|
||||
|
||||
const nickName = computed(() => userStore.nickName)
|
||||
|
||||
|
||||
const formatterTime = (time) => {
|
||||
return proxy.parseTime(time, '{y}-{m}-{d}')
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
materialName: undefined,
|
||||
spec: undefined,
|
||||
model: undefined,
|
||||
factory: undefined,
|
||||
unit: undefined,
|
||||
currentStock: undefined,
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询配料配件基础信息列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listMaterial(queryParams.value).then(response => {
|
||||
materialList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
spec: null,
|
||||
model: null,
|
||||
factory: null,
|
||||
unit: null,
|
||||
currentStock: null,
|
||||
delFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
};
|
||||
proxy.resetForm("materialRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.materialId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加配料配件基础信息";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
loading.value = true
|
||||
reset();
|
||||
const _materialId = row.materialId || ids.value
|
||||
getMaterial(_materialId).then(response => {
|
||||
loading.value = false;
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改配料配件基础信息";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["materialRef"].validate(valid => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.materialId != null) {
|
||||
updateMaterial(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
} else {
|
||||
addMaterial(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _materialIds = row.materialId || ids.value;
|
||||
proxy.$modal.confirm('是否确认删除配料配件基础信息编号为"' + _materialIds + '"的数据项?').then(function () {
|
||||
loading.value = true;
|
||||
return delMaterial(_materialIds);
|
||||
}).then(() => {
|
||||
loading.value = true;
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('mat/material/export', {
|
||||
...queryParams.value
|
||||
}, `material_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
function handleIn(row) {
|
||||
const inTime = proxy.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
||||
inOpen.value = true;
|
||||
|
||||
inForm.value = {
|
||||
detailId: null,
|
||||
purchaseId: null,
|
||||
materialId: row.materialId,
|
||||
inNum: null,
|
||||
inPrice: null,
|
||||
inAmount: null,
|
||||
inTime: inTime,
|
||||
operator: nickName,
|
||||
delFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
};
|
||||
proxy.resetForm("materialInRef");
|
||||
}
|
||||
|
||||
function cancelIn() {
|
||||
inOpen.value = false;
|
||||
}
|
||||
|
||||
function submitFormIn() {
|
||||
loading.value = true;
|
||||
buttonLoading.value = true;
|
||||
addPurchaseInDetail(inForm.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
inOpen.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
function handleOut(row) {
|
||||
const outNo = proxy.parseTime(new Date(), '{y}{m}{d}{hh}{i}{s}')
|
||||
const outTime = proxy.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
||||
outOpen.value = true;
|
||||
|
||||
outForm.value = {
|
||||
outId: null,
|
||||
outNo: outNo,
|
||||
materialId: row.materialId,
|
||||
outNum: null,
|
||||
outReason: null,
|
||||
operator: nickName,
|
||||
outTime: outTime,
|
||||
delFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
};
|
||||
proxy.resetForm("materialOutRef");
|
||||
}
|
||||
|
||||
function cancelOut() {
|
||||
outOpen.value = false;
|
||||
}
|
||||
|
||||
function submitFormOut() {
|
||||
loading.value = true;
|
||||
buttonLoading.value = true;
|
||||
addMaterialOut(outForm.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
outOpen.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
Reference in New Issue
Block a user