feat: 票据报损管理页面完成

This commit is contained in:
ycy 2024-04-08 16:29:46 +08:00
parent 8b58ff2c70
commit 61e34db972
9 changed files with 659 additions and 12 deletions

View File

@ -1,4 +1,6 @@
import Mock from "mockjs"; import Mock from "mockjs";
// 入库列表
const StockList = Mock.mock({ const StockList = Mock.mock({
"list|20-30": [ "list|20-30": [
{ {
@ -13,6 +15,8 @@ const StockList = Mock.mock({
}, },
], ],
}); });
// 领用列表
const ReceiptList = Mock.mock([ const ReceiptList = Mock.mock([
{ {
"list|20-30": [ "list|20-30": [
@ -67,6 +71,8 @@ const ReceiptList = Mock.mock([
], ],
}, },
]); ]);
// 退领列表
const quitneckList = Mock.mock([ const quitneckList = Mock.mock([
{ {
list: [ list: [
@ -122,6 +128,7 @@ const quitneckList = Mock.mock([
}, },
]); ]);
// 人员名单
const personName = () => { const personName = () => {
return [ return [
{ {
@ -144,6 +151,7 @@ const personName = () => {
]; ];
}; };
// 退库列表
const CancelList = Mock.mock({ const CancelList = Mock.mock({
"list|20-30": [ "list|20-30": [
{ {
@ -159,6 +167,21 @@ const CancelList = Mock.mock({
], ],
}); });
// 报损列表
const breakageList = Mock.mock({
"list|20-30": [
{
"id|+1": 0,
billserial: "@integer(100000000,199999999)1",
billType: "@integer(0,4)",
breakNum: "@integer(1,2)",
breakDate: "@date",
operator: "@cname",
breakStatus: "@integer(0,2)",
},
],
});
export default [ export default [
{ {
url: "/api/stockList", url: "/api/stockList",
@ -218,4 +241,14 @@ export default [
} }
}, },
}, },
{
url: "/api/breakageList",
method: "get",
response: () => {
return {
code: 200,
data: breakageList,
};
},
},
]; ];

View File

@ -0,0 +1,7 @@
import request from "@/utils/requestMock";
const API = {
BACKAGE_LIST: "/breakageList",
};
export const reqBreakageList = () => request.get(API.BACKAGE_LIST);

View File

@ -25,6 +25,9 @@
<t-menu-item value="2-4" to="/Bill/BillQuitneck"> <t-menu-item value="2-4" to="/Bill/BillQuitneck">
<span>票据退领管理</span> <span>票据退领管理</span>
</t-menu-item> </t-menu-item>
<t-menu-item value="2-5" to="/Bill/BillBreakagek">
<span>票据报损管理</span>
</t-menu-item>
</t-submenu> </t-submenu>
<t-submenu value="3" title="应收款管理"> <t-submenu value="3" title="应收款管理">
<template #icon> <template #icon>

View File

@ -0,0 +1,540 @@
<template>
<div class="back-color">
<t-layout style="height: 90%; background-color: #f5f7fb">
<t-header class="scarch-box">
<t-form
ref="form"
:data="formData"
label-width="calc(2em + 40px)"
layout="inline"
scroll-to-first-error="smooth"
class="scarch-from"
@reset="resetting"
@submit="headerQuery"
>
<div style="margin-left: 1rem">
<t-form-item label="票据编号:" name="billserial">
<t-input v-model="formData.billserial" maxlength="10"></t-input>
</t-form-item>
<t-form-item label="报损日期:" name="breakDate">
<t-date-picker v-model="formData.breakDate" clearable />
</t-form-item>
<t-form-item
label="票据类型:"
name="billType"
style="margin-bottom: 0.3rem"
>
<t-select
v-model="formData.billType"
placeholder="请选择票据类型"
clearable
>
<t-option
v-for="item in billType"
:key="item.value"
:value="item.value"
:label="item.label"
></t-option>
</t-select>
</t-form-item>
<t-form-item
label="报损状态:"
name="breakStatus"
style="margin-bottom: 0.3rem"
>
<t-select
v-model="formData.breakStatus"
placeholder="请选择报损状态"
clearable
>
<t-option
v-for="item in breakStatus"
:key="item.value"
:value="item.value"
:label="item.label"
></t-option>
</t-select>
</t-form-item>
</div>
<t-form-item style="margin-right: 1rem">
<t-button theme="primary" type="submit">查询</t-button>
<t-button theme="primary" type="reset">重置</t-button>
</t-form-item>
</t-form>
</t-header>
<t-content class="table-box">
<div class="table-header">
<div>
<h4 style="font-size: 110%">票据报损列表</h4>
</div>
<div>
<t-button theme="primary" size="small" @click="breakageAdd">
<template #icon><add-icon /></template>
新增报损票据
</t-button>
<t-button
shape="circle"
theme="primary"
@click="refresh"
style="margin-left: 0.8rem"
>
<template #icon><load-icon /></template>
</t-button>
</div>
</div>
<t-base-table
hover
row-key="index"
:loading="loading"
:data="tableData"
:columns="columns"
:pagination="pagination"
class="table"
:max-height="550"
>
<template #breakNum="{ row }">
{{ `${row.breakNum}` }}
</template>
<template #billType="{ row }">
<div v-for="item in billType" :key="item">
<span v-if="row.billType === item.value">{{ item.label }}</span>
</div>
</template>
<template #breakStatus="{ row }">
<div v-for="item in breakStatus" :key="item">
<t-tag
v-if="row.breakStatus === item.value"
:theme="tagColor(row.breakStatus)"
variant="light"
>
{{ item.label }}
</t-tag>
</div>
</template>
<template #status="slotProps">
<t-button
theme="default"
variant="text"
size="small"
@click="breakEdit(slotProps)"
:disabled="
slotProps.row.breakStatus === 0 ||
slotProps.row.breakStatus === 1
"
>修改</t-button
>
<t-popconfirm
content="确认删除吗"
@confirm="breakDelete(slotProps)"
>
<t-button
theme="default"
variant="text"
size="small"
:disabled="slotProps.row.breakStatus === 0"
>删除</t-button
>
</t-popconfirm>
</template>
</t-base-table>
</t-content>
</t-layout>
<t-space>
<t-dialog
ref="postForm"
v-model:visible="visiblePost"
:header="headerTitle"
width="40%"
:confirm-on-enter="true"
:on-close="closePost"
:confirm-btn="null"
:cancel-btn="null"
>
<t-space direction="vertical" style="width: 100%">
<div>
<t-form
ref="formDialog"
scroll-to-first-error="smooth"
label-align="left"
:rules="FORM_RULES"
:data="dialogData"
:colon="true"
@submit="breakSub"
label-width="calc(2em + 55px)"
layout="inline"
@reset="onReset"
>
<t-form-item
label="票据编号"
name="billserial"
:span="10"
style="margin-bottom: 0.5rem"
>
<t-input
v-model="dialogData.billserial"
placeholder="请输入票据编号"
></t-input>
</t-form-item>
<t-form-item
label="操作员"
name="operator"
:span="10"
style="margin-bottom: 0.5rem"
>
<t-input
v-model="dialogData.operator"
placeholder="请输入操作员"
></t-input>
</t-form-item>
<t-form-item
label="票据类型"
name="billType"
:span="12"
style="width: 16rem; margin-bottom: 0.5rem"
>
<t-select
v-model="dialogData.billType"
clearable
placeholder="请选择票据类型"
>
<t-option
v-for="item in billType"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</t-select>
</t-form-item>
<t-form-item
label="报损数量"
name="breakNum"
:span="12"
style="margin-bottom: 0.5rem"
>
<t-input
type="number"
v-model="dialogData.breakNum"
placeholder="请输入报损数量"
></t-input>
</t-form-item>
<t-form-item
label="报损时间"
name="breakDate"
:span="10"
style="width: 16rem; margin-bottom: 0.5rem"
>
<t-date-picker
v-model="dialogData.breakDate"
placeholder="请选择报损时间"
clearable
/>
</t-form-item>
<t-form-item />
<t-form-item>
<t-space size="small">
<t-button theme="primary" type="submit">提交</t-button>
<t-button theme="default" variant="base" type="reset"
>重置</t-button
>
</t-space>
</t-form-item>
</t-form>
</div>
</t-space>
</t-dialog>
</t-space>
</div>
</template>
<script setup>
import { ref, onMounted } from "vue";
import { MessagePlugin } from "tdesign-vue-next";
import { AddIcon, LoadIcon } from "tdesign-icons-vue-next";
import { useBreakage } from "@/stores/billBreakage";
//
const loading = ref(false);
const visiblePost = ref(false);
const breakageList = useBreakage();
const tableData = ref([]);
const data = ref([]);
const headerTitle = ref("");
//
const columns = ref([
{
colKey: "serial-number",
title: "序号",
width: 50,
},
{
colKey: "billserial",
title: "票据编号",
align: "center",
width: "100",
},
{
colKey: "billType",
title: "票据类型",
align: "center",
width: "100",
},
{
colKey: "breakNum",
title: "报损数量",
align: "center",
width: "100",
},
{
colKey: "breakDate",
title: "报损日期",
align: "center",
width: "100",
},
{
colKey: "operator",
title: "操作员",
align: "center",
width: "100",
},
{
colKey: "breakStatus",
title: "报损状态",
align: "center",
width: "100",
},
{
colKey: "status",
title: "操作",
width: 120,
align: "center",
fixed: "right",
},
]);
//
const billType = ref([
{ label: "票据类型1", value: 0 },
{ label: "票据类型2", value: 1 },
{ label: "票据类型3", value: 2 },
{ label: "票据类型4", value: 3 },
{ label: "票据类型5", value: 4 },
]);
//
const breakStatus = ref([
{ label: "审核中", value: 0 },
{ label: "审核通过", value: 1 },
{ label: "审核拒绝", value: 2 },
]);
//
const tableList = async () => {
loading.value = true;
tableData.value = await breakageList.getBreakageList();
data.value = await breakageList.getBreakageList();
pagination.value.total = tableData.value.length;
const timerId = setTimeout(() => {
loading.value = false;
clearInterval(timerId);
}, 300);
};
// tag
const tagColor = (value) => {
switch (value) {
case 0:
return "warning";
case 1:
return "success";
case 2:
return "danger";
}
};
//
const refresh = () => {
tableList();
};
//
const dialogData = ref({
billserial: "",
operator: "",
billType: "",
breakNum: Number,
breakDate: "",
});
//
const formData = ref({
billserial: "",
billType: "",
breakStatus: "",
breakDate: "",
});
//
const pagination = ref({
defaultCurrent: 1,
defaultPageSize: 10,
total: 50,
});
//
const resetting = () => {
formData.value = {
billserial: "",
billType: "",
breakStatus: "",
breakDate: "",
};
getNewTable();
};
//
const headerQuery = () => {
tableData.value = data.value;
if (
formData.value.billserial === "" &&
(formData.value.billType === undefined || formData.value.billType === "") &&
(formData.value.breakStatus === undefined ||
formData.value.breakStatus === "") &&
formData.value.breakDate === ""
) {
getNewTable();
} else {
const list = tableData.value.filter((item) => {
let arrList;
if (formData.value.billserial === item.billserial) {
arrList = item;
}
if (formData.value.billType === item.billType) {
arrList = item;
}
if (formData.value.breakStatus === item.breakStatus) {
arrList = item;
}
if (formData.value.breakDate === item.breakDate) {
arrList = item;
}
if (
formData.value.billserial === "" &&
formData.value.billType === "" &&
formData.value.breakStatus === "" &&
formData.value.breakDate === ""
) {
arrList = item;
}
return arrList;
});
tableData.value = list;
// @ts-expect-error
pagination.value.total = list.length;
}
};
//
const breakageAdd = () => {
visiblePost.value = true;
headerTitle.value = "新增报损票据";
dialogData.value = {
billserial: "",
operator: "",
billType: "",
breakNum: Number,
breakDate: "",
};
};
//
const closePost = () => {
visiblePost.value = false;
};
//
const FORM_RULES = {
billserial: [{ required: true, message: "请输入票据编号", trigger: "blur" }],
billType: [{ required: true, message: "请选择票据类型", trigger: "change" }],
breakNum: [{ required: true, message: "请输入报损数量", trigger: "blur" }],
breakDate: [{ required: true, message: "请选择报损日期", trigger: "change" }],
operator: [{ required: true, message: "请输入操作员", trigger: "blur" }],
};
//
const breakSub = async ({ validateResult, firstError }) => {
if (validateResult === true) {
dialogData.value.breakStatus = 0;
await breakageList.addBreakageList(dialogData.value);
getNewTable();
MessagePlugin.success("提交成功");
visiblePost.value = false;
} else {
console.log("Validate Errors: ", firstError, validateResult);
}
};
//
const breakEdit = (item) => {
headerTitle.value = "修改报损票据";
visiblePost.value = true;
tableData.value.forEach((itemTable) => {
if (itemTable.id === item.row.id) {
dialogData.value = itemTable;
}
});
};
//
const breakDelete = async (itme) => {
await breakageList.deleteBreakageList(itme.row);
getNewTable();
};
//
const onReset = () => {};
// menuManagement
const getNewTable = () => {
let arr = JSON.parse(localStorage.getItem("breakageList"));
if (arr) {
tableData.value = arr.breakageList;
data.value = arr.breakageList;
pagination.value.total = tableData.value.length;
} else {
tableList();
}
};
onMounted(() => {
getNewTable();
});
</script>
<style scoped lang="less">
.scarch-box {
width: 100%;
background-color: @base-white-color;
margin-bottom: 2rem;
.scarch-from {
height: 60px;
display: flex;
justify-content: space-between;
align-items: center;
}
}
.table-box {
height: 42rem;
background-color: @base-white-color;
padding: 1rem;
padding-top: 0;
.table-header {
height: 3rem;
display: flex;
justify-content: space-between;
align-items: center;
}
}
:deep(.t-form__controls-content) {
justify-content: space-between;
}
</style>

View File

@ -234,8 +234,9 @@ const scarchData = ref({
const loading = ref(false); const loading = ref(false);
const visiblePost = ref(false); const visiblePost = ref(false);
const cancelList = useCancel(); const cancelList = useCancel();
const tableData = ref(); const tableData = ref([]);
const data = ref(); const data = ref([]);
const headerTiTle = ref("");
// //
const columns = ref([ const columns = ref([
{ {

View File

@ -16,7 +16,10 @@
</t-space> </t-space>
</t-aside> </t-aside>
<t-content> <t-content>
<t-layout style="height: 100%; background-color: #f5f7fb"> <t-layout
style="height: 100%; background-color: #f5f7fb"
v-if="pageJudge"
>
<t-header class="scarch-box"> <t-header class="scarch-box">
<t-form <t-form
ref="form" ref="form"
@ -103,6 +106,9 @@
</t-base-table> </t-base-table>
</t-content> </t-content>
</t-layout> </t-layout>
<t-layout class="layoutPage" v-else>
<span> 请点击左侧员工名单 </span>
</t-layout>
</t-content> </t-content>
</t-layout> </t-layout>
</div> </div>
@ -122,6 +128,7 @@ const tableData = ref([]);
const data = ref([]); const data = ref([]);
const rowItem = ref({}); const rowItem = ref({});
const loading = ref(false); const loading = ref(false);
const pageJudge = ref(false);
const columns = ref([ const columns = ref([
{ {
colKey: "serial-number", colKey: "serial-number",
@ -255,6 +262,7 @@ const Quitneck = (value) => {
rowItem.value = value; rowItem.value = value;
}; };
const onClick = async (context) => { const onClick = async (context) => {
pageJudge.value = true;
// //
if (context.node.value === "t1") { if (context.node.value === "t1") {
return; return;
@ -318,6 +326,18 @@ onMounted(async () => {
align-items: center; align-items: center;
} }
} }
.layoutPage {
height: 100%;
background-color: #fff;
display: flex;
justify-content: center;
align-items: center;
span {
font-size: 20px;
font-weight: 800;
color: #191919;
}
}
:deep(.t-tree--transition .t-tree__label) { :deep(.t-tree--transition .t-tree__label) {
width: 10rem; width: 10rem;
} }

View File

@ -88,13 +88,14 @@
@click="stockEdit(slotProps)" @click="stockEdit(slotProps)"
>修改</t-button >修改</t-button
> >
<t-button <t-popconfirm
theme="default" content="确认删除吗"
variant="text" @confirm="stockDelete(slotProps)"
size="small"
@click="stockDelete(slotProps)"
>删除</t-button
> >
<t-button theme="default" variant="text" size="small"
>删除</t-button
>
</t-popconfirm>
</template> </template>
</t-base-table> </t-base-table>
</t-content> </t-content>
@ -163,7 +164,7 @@
<t-input <t-input
type="number" type="number"
v-model="dialogData.stockNum" v-model="dialogData.stockNum"
placeholder="请输入内容" placeholder="请输入入库数量"
></t-input> ></t-input>
</t-form-item> </t-form-item>
<t-form-item <t-form-item
@ -179,7 +180,7 @@
</t-form-item> </t-form-item>
<t-form-item <t-form-item
label="入库时间" label="入库时间"
name="unit" name="stockDate"
:span="10" :span="10"
style="width: 16rem; margin-bottom: 0.5rem" style="width: 16rem; margin-bottom: 0.5rem"
> >
@ -191,7 +192,7 @@
</t-form-item> </t-form-item>
<t-form-item <t-form-item
label="操作员" label="操作员"
name="unit" name="operator"
:span="10" :span="10"
style="margin-bottom: 0.5rem" style="margin-bottom: 0.5rem"
> >

View File

@ -3,6 +3,7 @@ import BillStockURL from "@/pages/finance-bill-manage/billStock.vue";
import BillCancelURL from "@/pages/finance-bill-manage/billCancel.vue"; import BillCancelURL from "@/pages/finance-bill-manage/billCancel.vue";
import BillReceiptURL from "@/pages/finance-bill-manage/billReceipt.vue"; import BillReceiptURL from "@/pages/finance-bill-manage/billReceipt.vue";
import BillQuitneckURL from "@/pages/finance-bill-manage/billQuitneck.vue"; import BillQuitneckURL from "@/pages/finance-bill-manage/billQuitneck.vue";
import BillBreakagekURL from "@/pages/finance-bill-manage/billBreakage.vue";
const financeBillManage = [ const financeBillManage = [
{ {
@ -43,6 +44,14 @@ const financeBillManage = [
title: "票据退领", title: "票据退领",
}, },
}, },
{
path: "BillBreakagek",
name: "billBreakagek",
component: BillBreakagekURL,
meta: {
title: "票据报损",
},
},
], ],
}, },
]; ];

View File

@ -0,0 +1,33 @@
import { defineStore } from "pinia";
import { reqBreakageList } from "@/api/finance-bill-manage/breakageList";
export const useBreakage = defineStore("breakageList", {
state: () => {
return {
breakageList: [],
};
},
actions: {
async getBreakageList() {
let { data } = await reqBreakageList();
this.breakageList = data.list;
return this.breakageList;
},
addBreakageList(arr) {
const index = this.breakageList.findIndex((item) => item.id === arr.id);
if (index !== -1) {
this.breakageList[index] = arr;
} else {
arr.id = new Date().getTime();
this.breakageList.unshift(arr);
localStorage.setItem("breakageList", JSON.stringify(this.breakageList));
}
return this.breakageList;
},
deleteBreakageList(item) {
let arr = this.breakageList.filter((i) => i.id !== item.id);
this.breakageList = arr;
},
},
persist: true,
});