feat: 代码合并

This commit is contained in:
YeMingfei666 2025-04-07 18:27:14 +08:00
commit 62076b4472
12 changed files with 625 additions and 88 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

@ -324,7 +324,7 @@
>
{{ 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="

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>