feat: 票据核销页面未完成

This commit is contained in:
ycy 2024-04-08 18:03:48 +08:00
parent 61e34db972
commit 7407d6afa2
7 changed files with 466 additions and 6 deletions

View File

@ -178,6 +178,7 @@ const breakageList = Mock.mock({
breakDate: "@date",
operator: "@cname",
breakStatus: "@integer(0,2)",
breakInfo: "@csentence",
},
],
});

View File

@ -14,19 +14,22 @@
<t-icon name="application" />
</template>
<t-menu-item value="2-1" to="/Bill/BillStock">
<span>票据入库管理</span>
<span>票据入库</span>
</t-menu-item>
<t-menu-item value="2-2" to="/Bill/BillCancel">
<span>票据退库管理</span>
<span>票据退库</span>
</t-menu-item>
<t-menu-item value="2-3" to="/Bill/BillReceipt">
<span>票据领用管理</span>
<span>票据领用</span>
</t-menu-item>
<t-menu-item value="2-4" to="/Bill/BillQuitneck">
<span>票据退领管理</span>
<span>票据退领</span>
</t-menu-item>
<t-menu-item value="2-5" to="/Bill/BillBreakagek">
<span>票据报损管理</span>
<span>票据报损</span>
</t-menu-item>
<t-menu-item value="2-6" to="/Bill/BillDestroy">
<span>票据核销</span>
</t-menu-item>
</t-submenu>
<t-submenu value="3" title="应收款管理">

View File

@ -231,7 +231,16 @@
clearable
/>
</t-form-item>
<t-form-item
label="报损原因"
name="breakInfo"
style="width: 33.6rem"
>
<t-textarea
v-model="dialogData.breakInfo"
placeholder="请输入备注"
></t-textarea>
</t-form-item>
<t-form-item />
<t-form-item>
<t-space size="small">
@ -305,6 +314,13 @@ const columns = ref([
align: "center",
width: "100",
},
{
colKey: "breakInfo",
title: "报损原因",
ellipsis: true,
align: "center",
width: "100",
},
{
colKey: "status",
title: "操作",
@ -365,6 +381,7 @@ const dialogData = ref({
billType: "",
breakNum: Number,
breakDate: "",
breakInfo: "",
});
//
@ -444,6 +461,7 @@ const breakageAdd = () => {
billType: "",
breakNum: Number,
breakDate: "",
breakInfo: "",
};
};
@ -458,6 +476,7 @@ const FORM_RULES = {
breakNum: [{ required: true, message: "请输入报损数量", trigger: "blur" }],
breakDate: [{ required: true, message: "请选择报损日期", trigger: "change" }],
operator: [{ required: true, message: "请输入操作员", trigger: "blur" }],
breakInfo: [{ required: true, message: "请输入报损原因", trigger: "blur" }],
};
//

View File

@ -0,0 +1,406 @@
<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>
</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
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 #status="slotProps">
<t-button
theme="default"
variant="text"
size="small"
@click="breakEdit(slotProps)"
>审核</t-button
>
</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="Status"
style="margin-bottom: 0.5rem"
>
<t-radio-group v-model="dialogData.Status">
<t-radio value="1" @change="refuse === false"
>审核通过</t-radio
>
<t-radio value="2" @change="refuse === true"
>审核拒绝</t-radio
>
</t-radio-group>
</t-form-item>
<t-form-item />
<t-form-item
label="拒绝原因"
name="refuseInfo"
v-if="refuse"
style="width: 33.6rem; margin-bottom: 0.5rem"
>
<t-textarea
v-model="dialogData.refuseInfo"
placeholder="请输入备注"
></t-textarea>
</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 { useDestroy } from "@/stores/billDestroy";
//
const loading = ref(false);
const visiblePost = ref(false);
const refuse = ref(false);
const destroyList = useDestroy();
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: "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 destroyList.getDestroyList();
data.value = await destroyList.getDestroyList();
pagination.value.total = tableData.value.length;
const timerId = setTimeout(() => {
loading.value = false;
clearInterval(timerId);
}, 300);
};
//
const refresh = () => {
tableList();
};
//
const dialogData = ref({
refuseInfo: "",
status: "",
});
//
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.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.breakDate === item.breakDate) {
arrList = item;
}
if (
formData.value.billserial === "" &&
formData.value.billType === "" &&
formData.value.breakDate === ""
) {
arrList = item;
}
return arrList;
});
tableData.value = list;
pagination.value.total = list.length;
}
};
//
const breakageAdd = () => {
visiblePost.value = true;
dialogData.value = {
refuseInfo: "",
status: "",
};
};
//
const closePost = () => {
visiblePost.value = false;
};
//
const FORM_RULES = {
Status: [{ required: true, message: "请选择审批状态", trigger: "change" }],
refuseInfo: [{ 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) => {
visiblePost.value = true;
};
//
const onReset = () => {};
// breakageList
const getNewTable = () => {
let arr = JSON.parse(localStorage.getItem("breakageList"));
if (arr) {
tableData.value = arr.destroyList;
data.value = arr.destroyList;
pagination.value.total = tableData.value.length;
}
if (arr === null) {
tableData.value = [];
pagination.value.total = tableData.value.length;
}
};
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

@ -4,6 +4,7 @@ import BillCancelURL from "@/pages/finance-bill-manage/billCancel.vue";
import BillReceiptURL from "@/pages/finance-bill-manage/billReceipt.vue";
import BillQuitneckURL from "@/pages/finance-bill-manage/billQuitneck.vue";
import BillBreakagekURL from "@/pages/finance-bill-manage/billBreakage.vue";
import BillDestroyURL from "@/pages/finance-bill-manage/billDestroy.vue";
const financeBillManage = [
{
@ -52,6 +53,14 @@ const financeBillManage = [
title: "票据报损",
},
},
{
path: "BillDestroy",
name: "billDestroy",
component: BillDestroyURL,
meta: {
title: "票据核销",
},
},
],
},
];

View File

@ -5,6 +5,7 @@ export const useBreakage = defineStore("breakageList", {
state: () => {
return {
breakageList: [],
destroyList: [],
};
},
actions: {
@ -22,6 +23,8 @@ export const useBreakage = defineStore("breakageList", {
this.breakageList.unshift(arr);
localStorage.setItem("breakageList", JSON.stringify(this.breakageList));
}
this.destroyList.push(arr);
localStorage.setItem("destroyList", JSON.stringify(this.breakageList));
return this.breakageList;
},
deleteBreakageList(item) {

19
src/stores/billDestroy.js Normal file
View File

@ -0,0 +1,19 @@
import { defineStore } from "pinia";
export const useDestroy = defineStore("destroyList", {
state: () => {
return {
destroyList: [],
};
},
actions: {
async getDestroyList() {
this.destroyList = JSON.parse(
localStorage.getItem("breakageList")
).destroyList;
console.log(this.destroyList);
return this.destroyList;
},
},
persist: true,
});