feat: 耗材补充修改

This commit is contained in:
wwz 2025-04-07 18:13:52 +08:00
parent 11b297baa5
commit 95f22ede1d
12 changed files with 847 additions and 164 deletions

View File

@ -0,0 +1,51 @@
import request from "@/utils/request";
import { Product_BaseUrl } from "@/api/config";
const baseURL = Product_BaseUrl + "/admin/product";
// 供应商
const Api = {
/** 耗材库存变动记录*/
getList(params: any) {
return request<any>({
url: `${baseURL}/stock/flow`,
method: "get",
params,
});
},
/** 全部*/
getAllList(params: any) {
return request<any>({
url: `${baseURL}/list`,
method: "get",
params,
});
},
get(id: string | number) {
return request<any>({
url: `${baseURL}/` + id,
method: "get",
});
},
add(data: any) {
return request<any>({
url: `${baseURL}`,
method: "post",
data,
});
},
edit(data: any) {
return request<any>({
url: `${baseURL}`,
method: "put",
data,
});
},
delete(id: string | number) {
return request<any>({
url: `${baseURL}/` + id,
method: "delete",
});
},
};
export default Api;

View File

@ -8,37 +8,58 @@
<template v-if="typeof item === 'string'">
<!-- 新增 -->
<template v-if="item === 'add'">
<el-button v-hasPerm="[`${contentConfig.pageName}:${item}`]" type="primary" icon="plus"
@click="handleToolbar(item)">
<el-button
v-hasPerm="[`${contentConfig.pageName}:${item}`]"
type="primary"
icon="plus"
@click="handleToolbar(item)"
>
新增
</el-button>
</template>
<!-- 删除 -->
<template v-else-if="item === 'delete'">
<el-button v-hasPerm="[`${contentConfig.pageName}:${item}`]" type="danger" icon="delete"
:disabled="removeIds.length === 0" @click="handleToolbar(item)">
<el-button
v-hasPerm="[`${contentConfig.pageName}:${item}`]"
type="danger"
icon="delete"
:disabled="removeIds.length === 0"
@click="handleToolbar(item)"
>
删除
</el-button>
</template>
<!-- 导入 -->
<template v-else-if="item === 'import'">
<el-button v-hasPerm="[`${contentConfig.pageName}:${item}`]" type="default" icon="upload"
@click="handleToolbar(item)">
<el-button
v-hasPerm="[`${contentConfig.pageName}:${item}`]"
type="default"
icon="upload"
@click="handleToolbar(item)"
>
导入
</el-button>
</template>
<!-- 导出 -->
<template v-else-if="item === 'export'">
<el-button v-hasPerm="[`${contentConfig.pageName}:${item}`]" type="default" icon="download"
@click="handleToolbar(item)">
<el-button
v-hasPerm="[`${contentConfig.pageName}:${item}`]"
type="default"
icon="download"
@click="handleToolbar(item)"
>
导出
</el-button>
</template>
</template>
<!-- 其他 -->
<template v-else-if="typeof item === 'object'">
<el-button v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]" :icon="item.icon"
:type="item.type ?? 'default'" @click="handleToolbar(item.name)">
<el-button
v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]"
:icon="item.icon"
:type="item.type ?? 'default'"
@click="handleToolbar(item.name)"
>
{{ item.text }}
</el-button>
</template>
@ -67,36 +88,68 @@
</template>
<!-- 导出 -->
<template v-else-if="item === 'exports'">
<el-button v-hasPerm="[`${contentConfig.pageName}:export`]" icon="download" circle title="导出"
@click="handleToolbar(item)" />
<el-button
v-hasPerm="[`${contentConfig.pageName}:export`]"
icon="download"
circle
title="导出"
@click="handleToolbar(item)"
/>
</template>
<!-- 导入 -->
<template v-else-if="item === 'imports'">
<el-button v-hasPerm="[`${contentConfig.pageName}:import`]" icon="upload" circle title="导入"
@click="handleToolbar(item)" />
<el-button
v-hasPerm="[`${contentConfig.pageName}:import`]"
icon="upload"
circle
title="导入"
@click="handleToolbar(item)"
/>
</template>
<!-- 搜索 -->
<template v-else-if="item === 'search'">
<el-button v-hasPerm="[`${contentConfig.pageName}:query`]" icon="search" circle title="搜索"
@click="handleToolbar(item)" />
<el-button
v-hasPerm="[`${contentConfig.pageName}:query`]"
icon="search"
circle
title="搜索"
@click="handleToolbar(item)"
/>
</template>
</template>
<!-- 其他 -->
<template v-else-if="typeof item === 'object'">
<template v-if="item.auth">
<el-button v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]" :icon="item.icon" circle
:title="item.title" @click="handleToolbar(item.name)" />
<el-button
v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]"
:icon="item.icon"
circle
:title="item.title"
@click="handleToolbar(item.name)"
/>
</template>
<template v-else>
<el-button :icon="item.icon" circle :title="item.title" @click="handleToolbar(item.name)" />
<el-button
:icon="item.icon"
circle
:title="item.title"
@click="handleToolbar(item.name)"
/>
</template>
</template>
</template>
</div>
</div>
<!-- 列表 -->
<el-table ref="tableRef" v-loading="loading" v-bind="contentConfig.table" :data="pageData" :row-key="pk"
@selection-change="handleSelectionChange" @filter-change="handleFilterChange">
<el-table
ref="tableRef"
v-loading="loading"
v-bind="contentConfig.table"
:data="pageData"
:row-key="pk"
@selection-change="handleSelectionChange"
@filter-change="handleFilterChange"
>
<template v-for="col in cols" :key="col">
<el-table-column v-if="col.show" v-bind="col">
<template #default="scope">
@ -105,15 +158,24 @@
<template v-if="col.prop">
<template v-if="Array.isArray(scope.row[col.prop])">
<template v-for="(item, index) in scope.row[col.prop]" :key="item">
<el-image :src="item" :preview-src-list="scope.row[col.prop]" :initial-index="index"
:preview-teleported="true" :style="`width: ${col.imageWidth ?? 40}px; height: ${col.imageHeight ?? 40
}px`" />
<el-image
:src="item"
:preview-src-list="scope.row[col.prop]"
:initial-index="index"
:preview-teleported="true"
:style="`width: ${col.imageWidth ?? 40}px; height: ${
col.imageHeight ?? 40
}px`"
/>
</template>
</template>
<template v-else>
<el-image :src="scope.row[col.prop]" :preview-src-list="[scope.row[col.prop]]"
<el-image
:src="scope.row[col.prop]"
:preview-src-list="[scope.row[col.prop]]"
:preview-teleported="true"
:style="`width: ${col.imageWidth ?? 40}px; height: ${col.imageHeight ?? 40}px`" />
:style="`width: ${col.imageWidth ?? 40}px; height: ${col.imageHeight ?? 40}px`"
/>
</template>
</template>
</template>
@ -135,20 +197,30 @@
<template v-else-if="col.templet === 'switch'">
<template v-if="col.prop">
<!-- pageData.length>0: 解决el-switch组件会在表格初始化的时候触发一次change事件 -->
<el-switch v-model="scope.row[col.prop]" :active-value="col.activeValue ?? 1"
:inactive-value="col.inactiveValue ?? 0" :inline-prompt="true" :active-text="col.activeText ?? ''"
:inactive-text="col.inactiveText ?? ''" :validate-event="false"
:disabled="!hasAuth(`${contentConfig.pageName}:modify`)" @change="
<el-switch
v-model="scope.row[col.prop]"
:active-value="col.activeValue ?? 1"
:inactive-value="col.inactiveValue ?? 0"
:inline-prompt="true"
:active-text="col.activeText ?? ''"
:inactive-text="col.inactiveText ?? ''"
:validate-event="false"
:disabled="!hasAuth(`${contentConfig.pageName}:modify`)"
@change="
pageData.length > 0 && handleModify(col.prop, scope.row[col.prop], scope.row)
" />
"
/>
</template>
</template>
<!-- 生成输入框组件 -->
<template v-else-if="col.templet === 'input'">
<template v-if="col.prop">
<el-input v-model="scope.row[col.prop]" :type="col.inputType ?? 'text'"
<el-input
v-model="scope.row[col.prop]"
:type="col.inputType ?? 'text'"
:disabled="!hasAuth(`${contentConfig.pageName}:modify`)"
@blur="handleModify(col.prop, scope.row[col.prop], scope.row)" />
@blur="handleModify(col.prop, scope.row[col.prop], scope.row)"
/>
</template>
</template>
<!-- 格式化为价格 -->
@ -180,7 +252,7 @@
{{
scope.row[col.prop]
? useDateFormat(scope.row[col.prop], col.dateFormat ?? "YYYY-MM-DD HH:mm:ss")
.value
.value
: ""
}}
</template>
@ -191,56 +263,82 @@
<template v-if="typeof item === 'string'">
<!-- 编辑/删除 -->
<template v-if="item === 'edit' || item === 'delete'">
<el-button v-hasPerm="[`${contentConfig.pageName}:${item}`]"
:type="item === 'edit' ? 'primary' : 'danger'" :icon="item" size="small" link @click="
<el-button
v-hasPerm="[`${contentConfig.pageName}:${item}`]"
:type="item === 'edit' ? 'primary' : 'danger'"
:icon="item"
size="small"
link
@click="
handleOperat({
name: item,
row: scope.row,
column: scope.column,
$index: scope.$index,
})
">
"
>
{{ item === "edit" ? "编辑" : "删除" }}
</el-button>
</template>
</template>
<!-- 其他 -->
<template v-else-if="typeof item === 'object'">
<el-button v-if="item.isBtn" v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]" :icon="item.icon"
:type="item.type ?? 'primary'" size="small" link @click="
<el-button
v-if="item.isBtn"
v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]"
:icon="item.icon"
:type="item.type ?? 'primary'"
size="small"
link
@click="
handleOperat({
name: item.name,
row: scope.row,
column: scope.column,
$index: scope.$index,
})
">
"
>
{{ item.text }}
</el-button>
<el-dropdown style="margin-top: 4px" v-else>
<el-button v-if="item.render === undefined || item.render(scope.row)" v-bind="item.auth ? { 'v-hasPerm': [`${contentConfig.pageName}:${item.auth}`] } : {}
" :icon="item.icon" :type="item.type ?? 'primary'" size="small" link @click="
<el-dropdown v-else style="margin-top: 4px">
<el-button
v-if="item.render === undefined || item.render(scope.row)"
v-bind="
item.auth ? { 'v-hasPerm': [`${contentConfig.pageName}:${item.auth}`] } : {}
"
:icon="item.icon"
:type="item.type ?? 'primary'"
size="small"
link
@click="
handleOperat({
name: item.name,
row: scope.row,
column: scope.column,
$index: scope.$index,
})
">
"
>
{{ item.text }}
</el-button>
<template #dropdown v-if="item.options && item.options.length > 0">
<template v-if="item.options && item.options.length > 0" #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="
handleOperat({
name: item.name,
row: scope.row,
column: scope.column,
$index: scope.$index,
command: opt.command ? opt.command : '',
})
" v-for="opt in item.options" :key="opt.value">
<el-dropdown-item
v-for="opt in item.options"
:key="opt.value"
@click="
handleOperat({
name: item.name,
row: scope.row,
column: scope.column,
$index: scope.$index,
command: opt.command ? opt.command : '',
})
"
>
{{ opt.label }}
</el-dropdown-item>
</el-dropdown-menu>
@ -261,18 +359,33 @@
<template v-if="showPagination">
<el-scrollbar>
<div class="mt-[12px]">
<el-pagination v-bind="pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
<el-pagination
v-bind="pagination"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</el-scrollbar>
</template>
<!-- 导出弹窗 -->
<el-dialog v-model="exportsModalVisible" :align-center="true" title="导出数据" width="600px" style="padding-right: 0"
@close="handleCloseExportsModal">
<el-dialog
v-model="exportsModalVisible"
:align-center="true"
title="导出数据"
width="600px"
style="padding-right: 0"
@close="handleCloseExportsModal"
>
<!-- 滚动 -->
<el-scrollbar max-height="60vh">
<!-- 表单 -->
<el-form ref="exportsFormRef" label-width="auto" style="padding-right: var(--el-dialog-padding-primary)"
:model="exportsFormData" :rules="exportsFormRules">
<el-form
ref="exportsFormRef"
label-width="auto"
style="padding-right: var(--el-dialog-padding-primary)"
:model="exportsFormData"
:rules="exportsFormRules"
>
<el-form-item label="文件名" prop="filename">
<el-input v-model="exportsFormData.filename" clearable />
</el-form-item>
@ -282,10 +395,16 @@
<el-form-item label="数据源" prop="origin">
<el-select v-model="exportsFormData.origin">
<el-option label="当前数据 (当前页的数据)" :value="ExportsOriginEnum.CURRENT" />
<el-option label="选中数据 (所有选中的数据)" :value="ExportsOriginEnum.SELECTED"
:disabled="selectionData.length <= 0" />
<el-option label="全量数据 (所有分页的数据)" :value="ExportsOriginEnum.REMOTE"
:disabled="contentConfig.exportsAction === undefined" />
<el-option
label="选中数据 (所有选中的数据)"
:value="ExportsOriginEnum.SELECTED"
:disabled="selectionData.length <= 0"
/>
<el-option
label="全量数据 (所有分页的数据)"
:value="ExportsOriginEnum.REMOTE"
:disabled="contentConfig.exportsAction === undefined"
/>
</el-select>
</el-form-item>
<el-form-item label="字段" prop="fields">
@ -306,17 +425,35 @@
</template>
</el-dialog>
<!-- 导入弹窗 -->
<el-dialog v-model="importModalVisible" :align-center="true" title="导入数据" width="600px" style="padding-right: 0"
@close="handleCloseImportModal">
<el-dialog
v-model="importModalVisible"
:align-center="true"
title="导入数据"
width="600px"
style="padding-right: 0"
@close="handleCloseImportModal"
>
<!-- 滚动 -->
<el-scrollbar max-height="60vh">
<!-- 表单 -->
<el-form ref="importFormRef" label-width="auto" style="padding-right: var(--el-dialog-padding-primary)"
:model="importFormData" :rules="importFormRules">
<el-form
ref="importFormRef"
label-width="auto"
style="padding-right: var(--el-dialog-padding-primary)"
:model="importFormData"
:rules="importFormRules"
>
<el-form-item label="文件名" prop="files">
<el-upload ref="uploadRef" v-model:file-list="importFormData.files" class="w-full"
<el-upload
ref="uploadRef"
v-model:file-list="importFormData.files"
class="w-full"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
:drag="true" :limit="1" :auto-upload="false" :on-exceed="handleFileExceed">
:drag="true"
:limit="1"
:auto-upload="false"
:on-exceed="handleFileExceed"
>
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text">
<span>将文件拖到此处</span>
@ -325,8 +462,13 @@
<template #tip>
<div class="el-upload__tip">
*.xlsx / *.xls
<el-link v-if="contentConfig.importTemplate" type="primary" icon="download" :underline="false"
@click="handleDownloadTemplate">
<el-link
v-if="contentConfig.importTemplate"
type="primary"
icon="download"
:underline="false"
@click="handleDownloadTemplate"
>
下载模板
</el-link>
</div>
@ -338,7 +480,11 @@
<!-- 弹窗底部操作按钮 -->
<template #footer>
<div style="padding-right: var(--el-dialog-padding-primary)">
<el-button type="primary" :disabled="importFormData.files.length === 0" @click="handleImportSubmit">
<el-button
type="primary"
:disabled="importFormData.files.length === 0"
@click="handleImportSubmit"
>
</el-button>
<el-button @click="handleCloseImportModal"> </el-button>
@ -814,10 +960,10 @@ function fetchPageData(formData: IObject = {}, isRestart = false) {
.indexAction(
showPagination
? {
[request.pageName]: pagination.currentPage,
[request.limitName]: pagination.pageSize,
...formData,
}
[request.pageName]: pagination.currentPage,
[request.limitName]: pagination.pageSize,
...formData,
}
: formData
)
.then((data) => {
@ -880,7 +1026,7 @@ function saveXlsx(fileData: BlobPart, fileName: string) {
window.URL.revokeObjectURL(downloadUrl);
}
function test(rows: any[]) {
console.log(tableRef, 'tioshi222222222222222222222')
console.log(tableRef, "tioshi222222222222222222222");
// rows.forEach((row) => {
// tableRef.value!.toggleRowSelection(row, undefined)
// })

View File

@ -78,7 +78,7 @@
</div>
</div>
<stockHistory ref="refStockHistory"></stockHistory>
<stockHistory ref="refStockHistory" />
</div>
</template>
<script setup>
@ -97,7 +97,6 @@ function refStockHistoryShow(key) {
}
</script>
<style scoped lang="scss">
.DataStatistics {
border: 1px solid #e4e7ed;
@ -137,4 +136,4 @@ function refStockHistoryShow(key) {
}
}
}
</style>
</style>

View File

@ -13,11 +13,11 @@ const contentConfig: IContentConfig = {
pageSizes: [10, 20, 30, 50],
},
indexAction: function (params) {
let obj = { ...params }
let obj = { ...params };
if (obj.createAt) {
obj.beginTime = obj.createAt[0]
obj.endTime = obj.createAt[1]
delete obj.createAt
obj.beginTime = obj.createAt[0];
obj.endTime = obj.createAt[1];
delete obj.createAt;
}
return Api.getList(obj);
},
@ -30,23 +30,43 @@ const contentConfig: IContentConfig = {
"add",
{
text: "入库",
name: 'ruku',
auth: 'ruku'
name: "ruku",
auth: "ruku",
},
{
text: "出库",
name: 'chuku',
auth: ''
name: "chuku",
auth: "",
},
{
text: "报损",
name: "reportinglosses",
auth: "",
},
{
text: "分类管理",
name: 'category',
auth: ''
name: "category",
auth: "",
},
{
text: "供应商管理",
name: 'gongyinsahng',
auth: ''
name: "gongyinsahng",
auth: "",
},
{
text: "入库记录",
name: "manual-in",
auth: "",
},
{
text: "出库记录",
name: "manual-out",
auth: "",
},
{
text: "报损记录",
name: "damage-out",
auth: "",
},
],
defaultToolbar: ["refresh", "filter", "search"],
@ -68,8 +88,8 @@ const contentConfig: IContentConfig = {
{
label: "所属商品",
align: "center",
templet: 'custom',
slotName: 'goods'
templet: "custom",
slotName: "goods",
},
{
label: "库存数量",
@ -94,7 +114,7 @@ const contentConfig: IContentConfig = {
fixed: "right",
width: 150,
templet: "custom",
slotName: 'operate'
slotName: "operate",
},
],
};

View File

@ -9,7 +9,7 @@
@reset-click="handleResetClick"
/>
<!-- 统计 -->
<data-tongji :data="gongjiData"></data-tongji>
<data-tongji :data="gongjiData" />
<!-- 列表 -->
<page-content
ref="contentRef"
@ -35,24 +35,24 @@
<div class="goods-list">
<el-button
v-for="item in scope.row.productList"
@click="toGoods(item.id)"
:key="item.productId"
type="text"
@click="toGoods(item.id)"
>
{{ item.name }}
</el-button>
<span v-if="scope.row.productList.length > 1">,</span>
</div>
<el-dropdown trigger="click" v-if="scope.row.productList.length > 1" @command="toGoods">
<el-dropdown v-if="scope.row.productList.length > 1" trigger="click" @command="toGoods">
<span class="el-dropdown-link" style="color: blue">
<el-icon><CaretBottom /></el-icon>
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item
class="clearfix"
v-for="item in scope.row.productList"
:key="item.id"
class="clearfix"
:command="item.id"
>
{{ item.name }}
@ -80,18 +80,31 @@
/>
</template>
<template #operate="scope">
<div>
<el-button @click="refAddHaocaiOpen(scope.row)" type="primary" link>编辑</el-button>
<el-button @click="refAddHaocaiTakinShow(scope.row)" link type="primary">
<div
style="
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
"
>
<el-button type="primary" link @click="refAddHaocaiOpen(scope.row)">编辑</el-button>
<el-button link type="primary" @click="refAddHaocaiTakinShow(scope.row, 'consumables')">
耗材盘点
</el-button>
<el-button link type="primary" @click="refAddHaocaiTakinShow(scope.row, 'manual-in')">
入库记录
</el-button>
<!-- <el-button link type="primary" @click="refAddHaocaiTakinShow(scope.row, 'delete')">
删除
</el-button> -->
</div>
</template>
</page-content>
<!-- 耗材添加编辑 -->
<add-haocai ref="refAddHaocai" @refresh="refresh"></add-haocai>
<add-haocai ref="refAddHaocai" @refresh="refresh" />
<!-- 耗材盘点 -->
<addConsTakin ref="refAddHaocaiTakin" @success="refresh"></addConsTakin>
<addConsTakin ref="refAddHaocaiTakin" @success="refresh" />
</div>
</template>
@ -152,7 +165,20 @@ watch(
//
const refAddHaocaiTakin = ref();
function refAddHaocaiTakinShow(item: any) {
function refAddHaocaiTakinShow(item: any, type: string) {
console.log(item);
if (type === "manual-in") {
router.push({ path: "/inventory/libraryrecords", query: { type: type, conId: item.id } });
return;
}
if (type === "delete") {
refAddHaocaiTakin.value.show(item, type);
return;
}
if (type === "consumables") {
refAddHaocaiTakin.value.show(item, type);
return;
}
refAddHaocaiTakin.value.show(item);
}
@ -195,6 +221,10 @@ function handleToolbarClick(name: string) {
router.push({ path: "/inventory/operation_in", query: { type: "out" } });
return;
}
if (name == "damage-out" || name == "manual-out" || name == "manual-in") {
router.push({ path: "/inventory/libraryrecords", query: { type: name } });
return;
}
}
//
async function handleOperatClick(data: IOperatData) {

View File

@ -0,0 +1,77 @@
import Api from "@/api/product/vendor";
import { returnOptions, switchAttr } from "./config";
import type { IModalConfig } from "@/components/CURD/types";
const modalConfig: IModalConfig = {
pageName: "sys:user",
dialog: {
title: "添加供应商",
width: 800,
draggable: true,
},
form: {
labelWidth: 140,
},
formAction: function (data) {
return Api.add({ ...data });
},
beforeSubmit(data) {
console.log("提交之前处理", data);
},
formItems: [
{
label: "名称",
prop: "name",
rules: [{ required: true, message: "请输入名称", trigger: "blur" }],
attrs: {
placeholder: "请输入名称",
},
},
{
label: "联系人名字",
prop: "contactName",
rules: [{ required: false, message: "请输入联系人名字", trigger: "blur" }],
attrs: {
placeholder: "请输入联系人名字",
},
},
{
label: "联系人电话",
prop: "telephone",
rules: [{ required: false, message: "请输入联系人名字", trigger: "blur" }],
attrs: {
placeholder: "请输入联系人名字",
},
},
{
label: "供应商地址",
prop: "address",
rules: [{ required: false, message: "请输入供应商地址", trigger: "blur" }],
attrs: {
placeholder: "请输入供应商地址",
},
},
{
label: "备注",
prop: "remark",
rules: [{ required: false, message: "请输入备注", trigger: "blur" }],
attrs: {
placeholder: "请输入备注",
},
},
{
label: "排序",
prop: "sort",
rules: [{ required: true, message: "请输入排序", trigger: "blur" }],
type: "input-number",
attrs: {
placeholder: "请输入排序",
},
},
],
};
// 如果有异步数据会修改配置的推荐用reactive包裹而纯静态配置的可以直接导出
export default reactive(modalConfig);

View File

@ -0,0 +1,46 @@
export interface options {
label: string;
value: string | number;
[property: string]: any;
}
export interface optionObject {
[property: string]: options[];
}
const options: optionObject = {
payType: [
{ label: "现金", value: "cash" },
{ label: "微信", value: "weixin" },
{ label: "银行卡", value: "bank" },
{ label: "会员支付", value: "member-account" },
{ label: "支付宝", value: "alipay" },
{ label: "刷卡", value: "deposit" },
{ label: "挂账", value: "arrears" },
{ label: "刷卡", value: "deposit" },
{ label: "储值", value: "member-account" },
{ label: "自定义", value: "virtual" },
],
isIdeal: [
{ label: "否", value: 0 },
{ label: "是", value: 1 },
],
};
export const switchAttr = {
"active-value": 1,
"inactive-value": 0,
};
export type optionsType = string;
export function returnOptions(type: optionsType) {
return options[type];
}
export function returnOptionsLabel(optionsType: optionsType, value: string | number) {
const options = returnOptions(optionsType);
if (!options) {
return "";
}
const option = options.find((item) => item.value === value);
return option ? option.label : "";
}

View File

@ -0,0 +1,90 @@
import Api from "@/api/product/libraryrecords";
import type { IContentConfig } from "@/components/CURD/types";
import { log } from "console";
const contentConfig: IContentConfig = {
pageName: "sys:user",
table: {
border: true,
highlightCurrentRow: true,
},
pagination: {
background: true,
layout: "prev,pager,next,jumper,total,sizes",
pageSize: 20,
pageSizes: [10, 20, 30, 50],
},
indexAction: function (params) {
console.log("params", params);
return Api.getList(params);
},
deleteAction: function (id) {
return Api.delete(id);
},
modifyAction: function (data) {
return Api.edit(data);
},
indexActionData: {},
pk: "id",
toolbar: [
// {
// text: "入库记录",
// name: "manual-in",
// auth: "",
// },
// {
// text: "出库记录",
// name: "manual-out",
// auth: "",
// },
// {
// text: "报损记录",
// name: "damage-out",
// auth: "",
// },
],
defaultToolbar: ["refresh", "filter", "search"],
cols: [
// { type: "selection", width: 50, align: "center" },
{
label: "耗材名称",
align: "center",
prop: "conName",
},
{
label: "单位",
align: "center",
prop: "unitName",
},
{
label: "变动前的库存",
align: "center",
prop: "beforeNumber",
},
{
label: "出入库数量",
align: "center",
prop: "inOutNumber",
},
{
label: "变动后的库存",
align: "center",
prop: "afterNumber",
},
{
label: "创建时间",
align: "center",
prop: "createTime",
},
// {
// label: "操作",
// align: "center",
// fixed: "right",
// width: 280,
// templet: "tool",
// operat: ["edit", "delete"],
// },
],
};
export default contentConfig;

View File

@ -0,0 +1,75 @@
import Api from "@/api/product/vendor";
import { returnOptions, switchAttr } from "./config";
import type { IModalConfig } from "@/components/CURD/types";
const modalConfig: IModalConfig = {
pageName: "sys:user",
dialog: {
title: "编辑供应商",
width: 800,
draggable: true,
},
form: {
labelWidth: 140,
},
formAction: function (data) {
return Api.edit({ ...data });
},
beforeSubmit(data) {
console.log("提交之前处理", data);
},
formItems: [
{
label: "名称",
prop: "name",
rules: [{ required: true, message: "请输入名称", trigger: "blur" }],
attrs: {
placeholder: "请输入名称",
},
},
{
label: "联系人名字",
prop: "contactName",
rules: [{ required: false, message: "请输入联系人名字", trigger: "blur" }],
attrs: {
placeholder: "请输入联系人名字",
},
},
{
label: "联系人电话",
prop: "telephone",
rules: [{ required: false, message: "请输入联系人名字", trigger: "blur" }],
attrs: {
placeholder: "请输入联系人名字",
},
},
{
label: "供应商地址",
prop: "address",
rules: [{ required: false, message: "请输入供应商地址", trigger: "blur" }],
attrs: {
placeholder: "请输入供应商地址",
},
},
{
label: "备注",
prop: "remark",
rules: [{ required: false, message: "请输入备注", trigger: "blur" }],
attrs: {
placeholder: "请输入备注",
},
},
{
label: "排序",
prop: "sort",
rules: [{ required: true, message: "请输入排序", trigger: "blur" }],
type: "input-number",
attrs: {
placeholder: "请输入排序",
},
},
],
};
// 如果有异步数据会修改配置的推荐用reactive包裹而纯静态配置的可以直接导出
export default reactive(modalConfig);

View File

@ -0,0 +1,58 @@
import type { ISearchConfig } from "@/components/CURD/types";
const searchConfig: ISearchConfig = {
pageName: "sys:user",
isExpandable: false,
formItems: [
{
type: "select",
label: "类型",
prop: "inOutItem",
attrs: {
placeholder: "请选择",
clearable: true,
style: {
width: "200px",
},
},
options: [
{
label: "增加",
value: "in",
},
{
label: "减少",
value: "out",
},
],
},
{
type: "select",
label: "名目",
prop: "inOutType",
attrs: {
placeholder: "请选择",
clearable: true,
style: {
width: "200px",
},
},
initialValue: "",
options: [
{
label: "入库记录",
value: "manual-in",
},
{
label: "出库记录",
value: "manual-out",
},
{
label: "报损记录",
value: "damage-out",
},
],
},
],
};
export default searchConfig;

View File

@ -0,0 +1,117 @@
<template>
<div class="app-container">
<!-- 搜索 -->
<page-search
ref="searchRef"
:search-config="searchConfig"
@query-click="handleQueryClick"
@reset-click="handleResetClick"
/>
<!-- 列表 -->
<page-content
ref="contentRef"
:content-config="contentConfig"
@add-click="handleAddClick"
@edit-click="handleEditClick"
@export-click="handleExportClick"
@search-click="handleSearchClick"
@toolbar-click="handleToolbarClick"
@operat-click="handleOperatClick"
@filter-change="handleFilterChange"
>
<template #status="scope">
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
</el-tag>
</template>
<template #switch="scope">
<el-switch v-model="scope.row[scope.prop]" disabled :active-value="1" :inactive-value="0" />
</template>
<template #mobile="scope">
<el-text>{{ scope.row[scope.prop] }}</el-text>
<copy-button
v-if="scope.row[scope.prop]"
:text="scope.row[scope.prop]"
style="margin-left: 2px"
/>
</template>
</page-content>
<!-- 新增 -->
<page-modal
ref="addModalRef"
:modal-config="addModalConfig"
@submit-click="handleSubmitClick"
/>
<!-- 编辑 -->
<page-modal
ref="editModalRef"
:modal-config="editModalConfig"
@submit-click="handleSubmitClick"
/>
</div>
</template>
<script setup lang="ts">
import VersionApi from "@/api/system/version";
import type { IObject, IOperatData } from "@/components/CURD/types";
import usePage from "@/components/CURD/usePage";
import addModalConfig from "./config/add";
import contentConfig from "./config/content";
import editModalConfig from "./config/edit";
import searchConfig from "./config/search";
const {
searchRef,
contentRef,
addModalRef,
editModalRef,
handleQueryClick,
handleResetClick,
// handleAddClick,
// handleEditClick,
handleSubmitClick,
handleExportClick,
handleSearchClick,
handleFilterChange,
} = usePage();
const route = useRoute();
const Query = route.query || "";
onMounted(() => {
if (Query.type) {
searchRef.value?.setQueryValue("inOutType", Query.type);
}
if (Query.conId) {
searchRef.value?.setQueryValue("conId", Query.conId);
}
});
//
async function handleAddClick() {
addModalRef.value?.setModalVisible();
// addModalConfig.formItems[2]!.attrs!.data =
}
//
async function handleEditClick(row: IObject) {
editModalRef.value?.handleDisabled(false);
editModalRef.value?.setModalVisible();
// id
console.log(row);
editModalRef.value?.setFormData({ ...row });
}
1;
//
function handleToolbarClick(name: string) {
console.log(name);
if (name === "custom1") {
ElMessage.success("点击了自定义1按钮");
}
}
//
async function handleOperatClick(data: IOperatData) {
console.log(data);
}
</script>

View File

@ -10,7 +10,7 @@
>
<el-row>
<el-form-item label="类型">
<el-radio-group :model-value="type">
<el-radio-group :model-value="type" @change="tabChange">
<el-radio-button value="in">入库</el-radio-button>
<el-radio-button value="out">出库</el-radio-button>
</el-radio-group>
@ -27,11 +27,11 @@
@change="changeTypeEnum"
>
<el-option
:label="item.name"
:value="item.id"
v-for="item in purveyorList"
:key="item.id"
></el-option>
:label="item.name"
:value="item.id"
/>
</el-select>
{{ queryForm.waitAmount }}
</el-form-item>
@ -45,7 +45,7 @@
value-format="YYYY-MM-DD"
placeholder="选择日期"
style="width: 220px"
></el-date-picker>
/>
</el-form-item>
</el-col>
</el-row>
@ -56,7 +56,7 @@
v-model="queryForm.amountPayable"
placeholder="请输入应收金额"
style="width: 220px"
></el-input>
/>
</el-form-item>
</el-col>
<el-col :span="8">
@ -65,7 +65,7 @@
v-model="queryForm.actualPaymentAmount"
placeholder="请输入实收金额"
style="width: 220px"
></el-input>
/>
</el-form-item>
</el-col>
</el-row>
@ -79,32 +79,24 @@
value-format="YYYY-MM-DD"
placeholder="选择日期"
style="width: 220px"
></el-date-picker>
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="批号">
<el-input
v-model="queryForm.batchNo"
placeholder="请输入批号"
style="width: 220px"
></el-input>
<el-input v-model="queryForm.batchNo" placeholder="请输入批号" style="width: 220px" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="备注">
<el-input
v-model="queryForm.remark"
placeholder="请输入备注"
style="width: 220px"
></el-input>
<el-input v-model="queryForm.remark" placeholder="请输入备注" style="width: 220px" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="选择耗材">
<div></div>
<div />
<el-button type="primary" @click="showHaocai">选择耗材</el-button>
<el-autocomplete
@ -112,9 +104,9 @@
:fetch-suggestions="querySearchAsync"
value-key="conName"
placeholder="耗材搜索"
@select="handleSelect"
style="width: 200px; margin-left: 20px"
></el-autocomplete>
@select="handleSelect"
/>
</el-form-item>
</el-form>
</div>
@ -133,11 +125,7 @@
</el-table-column>
<el-table-column label="进价">
<template v-slot="scope">
<el-input-number
v-model="scope.row.price"
:min="0"
controls-position="right"
></el-input-number>
<el-input-number v-model="scope.row.price" :min="0" controls-position="right" />
<div class="tips" style="font-size: 16px">
原价
@ -154,12 +142,12 @@
:placeholder="scope.row.unit"
@change="changeUnit(scope.row)"
>
<el-option :label="scope.row.conUnit" :value="scope.row.conUnit"></el-option>
<el-option :label="scope.row.conUnit" :value="scope.row.conUnit" />
<el-option
v-if="scope.row.conUnitTwo"
:label="scope.row.conUnitTwo"
:value="scope.row.conUnitTwo"
v-if="scope.row.conUnitTwo"
></el-option>
/>
</el-select>
<div class="tips">&nbsp;</div>
</template>
@ -172,7 +160,7 @@
:step="1"
step-strictly
controls-position="right"
></el-input-number>
/>
<div class="tips" style="font-size: 16px">
{{ type == "in" ? "入库" : "出库" }}
{{ returnStockNumber(scope.row, scope.row.number) }}
@ -195,7 +183,7 @@
</el-table>
</div>
<div>
<el-button type="primary" @click="submitHandle" :loading="queryFormLoading">确定</el-button>
<el-button type="primary" :loading="queryFormLoading" @click="submitHandle">确定</el-button>
</div>
<!-- 选择耗材 -->
<ConsumableList ref="ConsumableList" @success="selectConsumable" />
@ -248,7 +236,7 @@ export default {
{
label: "商品入库",
value: "goods",
type: "purveyor",
type: "out",
},
{
label: "耗材入库",
@ -257,22 +245,6 @@ export default {
},
],
shopTypesActive: 0,
shopTypes: [
{
label: "供应商入库",
value: "purveyor",
},
{
label: "其他入库",
value: "purchase",
},
],
shopTypes2: [
{
label: "供应商入库",
value: "purveyor",
},
],
resetForm: "",
queryFormLoading: false,
queryForm: {
@ -314,11 +286,6 @@ export default {
timeout: null,
};
},
mounted() {
this.type = this.$route.query.type || "in";
this.resetForm = { ...this.queryForm };
this.tbShopPurveyorGet();
},
computed: {
amountPayable() {
if (!this.tableData.list.length) return 0;
@ -333,6 +300,11 @@ export default {
this.queryForm.amountPayable = newval;
},
},
mounted() {
this.type = this.$route.query.type || "in";
this.resetForm = { ...this.queryForm };
this.tbShopPurveyorGet();
},
methods: {
changeUnit(row) {
row.price = this.returnPrice(row, row.originPrice);
@ -398,12 +370,13 @@ export default {
},
//
tabChange(value, type) {
this.shopTypesActive = type == "in" ? 0 : 1;
tabChange(value) {
this.shopTypesActive = value == "in" ? 0 : 1;
this.inTabValue = value;
this.type = value;
this.resetHandle();
this.$refs.shopList.reset(); //
this.$refs.ConsumableList.reset(); //
// this.$refs.shopList.reset(); //
// this.$refs.ConsumableList.reset(); //
},
//
changeTypeEnum(index) {
@ -494,7 +467,8 @@ export default {
resetHandle() {
this.showResult = false;
this.queryForm = { ...this.resetForm };
this.queryForm.type = this.inTabs.find((item) => item.value == this.inTabValue).type;
console.log(this.inTabs, this.inTabValue);
this.queryForm.type = this.inTabs.find((item) => item.type == this.inTabValue).type;
this.tableData.list = [];
this.$refs.queryForm.resetFields();
},
@ -524,4 +498,4 @@ export default {
.app-container {
}
</style>
</style>