This commit is contained in:
吕才卓 2024-04-08 18:14:01 +08:00
commit 837e570061
16 changed files with 1270 additions and 113 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": [
@ -68,6 +72,63 @@ const ReceiptList = Mock.mock([
}, },
]); ]);
// 退领列表
const quitneckList = Mock.mock([
{
list: [
{
"id|+1": 0,
billserial: "@integer(100000000,199999999)1",
proposer: "孙东宇",
billType: "@integer(0,4)",
receiptNum: "@integer(1,10)",
receiptDate: "@date",
useInfo: "@csentence",
},
],
},
{
list: [
{
"id|+1": 0,
billserial: "@integer(100000000,199999999)1",
proposer: "杨春宇",
billType: "@integer(0,4)",
receiptNum: "@integer(1,10)",
receiptDate: "@date",
useInfo: "@csentence",
},
],
},
{
list: [
{
"id|+1": 0,
billserial: "@integer(100000000,199999999)1",
proposer: "吕才卓",
billType: "@integer(0,4)",
receiptNum: "@integer(1,10)",
receiptDate: "@date",
useInfo: "@csentence",
},
],
},
{
list: [
{
"id|+1": 0,
billserial: "@integer(100000000,199999999)1",
proposer: "刘欣宇",
billType: "@integer(0,4)",
receiptNum: "@integer(1,10)",
receiptDate: "@date",
useInfo: "@csentence",
},
],
},
]);
// 人员名单
const personName = () => { const personName = () => {
return [ return [
{ {
@ -90,6 +151,7 @@ const personName = () => {
]; ];
}; };
// 退库列表
const CancelList = Mock.mock({ const CancelList = Mock.mock({
"list|20-30": [ "list|20-30": [
{ {
@ -105,6 +167,22 @@ 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)",
breakInfo: "@csentence",
},
],
});
export default [ export default [
{ {
url: "/api/stockList", url: "/api/stockList",
@ -164,4 +242,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

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

View File

@ -0,0 +1,559 @@
<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
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">
<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: "breakInfo",
title: "报损原因",
ellipsis: true,
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: "",
breakInfo: "",
});
//
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: "",
breakInfo: "",
};
};
//
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" }],
breakInfo: [{ 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

@ -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

@ -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"
@ -36,8 +39,8 @@
></t-input> ></t-input>
</t-form-item> </t-form-item>
<t-form-item label="退领时间:" name="receiptDate"> <t-form-item label="退领时间:" name="quitneckDate">
<t-date-picker v-model="scarchData.receiptDate" clearable /> <t-date-picker v-model="scarchData.quitneckDate" clearable />
</t-form-item> </t-form-item>
<t-form-item <t-form-item
label="票据类型:" label="票据类型:"
@ -97,12 +100,15 @@
}}</span> }}</span>
</div> </div>
</template> </template>
<template #receiptNum="{ row }"> <template #quitneckNum="{ row }">
{{ `${row.receiptNum}` }} {{ `${row.quitneckNum}` }}
</template> </template>
</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>
@ -112,14 +118,17 @@
import { ref, onMounted, nextTick } from "vue"; import { ref, onMounted, nextTick } from "vue";
import { MessagePlugin } from "tdesign-vue-next"; import { MessagePlugin } from "tdesign-vue-next";
import { LoadIcon } from "tdesign-icons-vue-next"; import { LoadIcon } from "tdesign-icons-vue-next";
import { useQuitneckList } from "@/stores/billQuitneck";
import { useReceiptList } from "@/stores/billReceipt"; import { useReceiptList } from "@/stores/billReceipt";
const quitneckList = useQuitneckList();
const receiptList = useReceiptList(); const receiptList = useReceiptList();
const personName = ref([]); const personName = ref([]);
const tableData = ref([]); const tableData = ref([]);
const data = ref([]); const data = ref([]);
const rowItem = ref({});
const loading = ref(false); const loading = ref(false);
const visiblePost = ref(false); const pageJudge = ref(false);
const columns = ref([ const columns = ref([
{ {
colKey: "serial-number", colKey: "serial-number",
@ -157,8 +166,8 @@ const columns = ref([
width: 100, width: 100,
}, },
{ {
colKey: "quitneckInfo", colKey: "quitneckReason",
title: "退领原", title: "退领原",
ellipsis: true, ellipsis: true,
align: "center", align: "center",
width: 200, width: 200,
@ -172,16 +181,9 @@ const billType = ref([
{ label: "票据类型4", value: 3 }, { label: "票据类型4", value: 3 },
{ label: "票据类型5", value: 4 }, { label: "票据类型5", value: 4 },
]); ]);
const dialogData = ref({
quitneckDate: "",
quitneckReason: "",
quitneckNum: "",
});
// //
const scarchData = ref({ const scarchData = ref({});
billserial: "",
});
// //
const pagination = ref({ const pagination = ref({
@ -195,33 +197,23 @@ const personList = async () => {
personName.value = await receiptList.getPersonNameList(); personName.value = await receiptList.getPersonNameList();
}; };
//
const FORM_RULES = {
quitneckNum: [{ required: true, message: "请输入退领张数", trigger: "blur" }],
quitneckDate: [
{ required: true, message: "请选择退领日期", trigger: "change" },
],
quitneckReason: [
{ required: true, message: "请输入退领原因", trigger: "blur" },
],
};
// //
const headerQuery = () => { const headerQuery = () => {
tableData.value = data.value; tableData.value = data.value;
console.log( console.log(
scarchData.value.billserial, scarchData.value.billserial,
scarchData.value.billType, scarchData.value.billType,
scarchData.value.receiptDate scarchData.value.quitneckDate
); );
if ( if (
scarchData.value.billserial === "" && scarchData.value.billserial === "" &&
(scarchData.value.billType === undefined || (scarchData.value.billType === undefined ||
scarchData.value.billType === "") && scarchData.value.billType === "") &&
(scarchData.value.receiptDate === undefined || (scarchData.value.quitneckDate === undefined ||
scarchData.value.receiptDate === "") scarchData.value.quitneckDate === "")
) { ) {
getNewTable(); tableData.value = data.value;
pagination.value.total = tableData.value.length;
} else { } else {
const list = tableData.value.filter((item) => { const list = tableData.value.filter((item) => {
let arrList; let arrList;
@ -231,16 +223,17 @@ const headerQuery = () => {
if (scarchData.value.billType === item.billType) { if (scarchData.value.billType === item.billType) {
arrList = item; arrList = item;
} }
if (scarchData.value.receiptDate === item.receiptDate) { if (scarchData.value.quitneckDate === item.quitneckDate) {
arrList = item; arrList = item;
} }
if ( if (
scarchData.value.billserial === "" && scarchData.value.billserial === "" &&
scarchData.value.billType === "" && scarchData.value.billType === "" &&
scarchData.value.receiptDate === "" scarchData.value.quitneckDate === ""
) { ) {
arrList = item; arrList = item;
} }
console.log(arrList);
return arrList; return arrList;
}); });
tableData.value = list; tableData.value = list;
@ -252,11 +245,13 @@ const resetting = () => {
scarchData.value = { scarchData.value = {
billserial: "", billserial: "",
billType: "", billType: "",
receiptDate: "", quitneckDate: "",
}; };
getNewTable(); tableData.value = data.value;
pagination.value.total = tableData.value.length;
}; };
const rowItem = ref({});
//
const Quitneck = (value) => { const Quitneck = (value) => {
dialogData.value = { dialogData.value = {
quitneckDate: "", quitneckDate: "",
@ -266,36 +261,16 @@ const Quitneck = (value) => {
visiblePost.value = true; visiblePost.value = true;
rowItem.value = value; rowItem.value = value;
}; };
//
const quitneckAdd = async ({ validateResult, firstError }) => {
if (validateResult === true) {
if (rowItem.value.row.receiptNum - dialogData.value.quitneckNum < 0) {
return MessagePlugin.error("退领数量不能大于领用数量");
}
dialogData.value.quitneckNum =
rowItem.value.row.receiptNum - dialogData.value.quitneckNum;
dialogData.value.id = rowItem.value.row.id;
await receiptList.getquitneckNum(dialogData.value);
getTableData();
MessagePlugin.success("提交成功");
visiblePost.value = false;
} else {
console.log("Validate Errors: ", firstError, validateResult);
}
};
const onClick = async (context) => { const onClick = async (context) => {
pageJudge.value = true;
// //
if (context.node.value === "t1") { if (context.node.value === "t1") {
return; return;
} }
loading.value = true; loading.value = true;
// //
tableData.value = await receiptList.getReceiptList({ tableData.value = await quitneckList.getQuitneckList(context.node.label);
name: context.node.label, data.value = await quitneckList.getQuitneckList(context.node.label);
});
data.value = await receiptList.getReceiptList({
name: context.node.label,
});
pagination.value.total = tableData.value.length; pagination.value.total = tableData.value.length;
const timerId = setTimeout(() => { const timerId = setTimeout(() => {
loading.value = false; loading.value = false;
@ -305,8 +280,9 @@ const onClick = async (context) => {
// //
const refresh = () => { const refresh = () => {
getTableData(); getTableData();
pagination.value.total = tableData.value.length;
}; };
// menuManagement // ReceiptList
const getPersonName = () => { const getPersonName = () => {
let arr = JSON.parse(localStorage.getItem("ReceiptList")); let arr = JSON.parse(localStorage.getItem("ReceiptList"));
if (arr) { if (arr) {
@ -315,38 +291,8 @@ const getPersonName = () => {
personList(); personList();
} }
}; };
// menuManagement
const getTableData = async () => {
let arr = JSON.parse(localStorage.getItem("ReceiptList"));
if (arr.receiptList.length > 0) {
loading.value = true;
tableData.value = arr.receiptList;
pagination.value.total = tableData.value.length;
const timerId = setTimeout(() => {
loading.value = false;
clearInterval(timerId);
}, 300);
} else {
await nextTick();
//
const firstNodeWithChildren = personName.value.find(
(node) => Array.isArray(node.children) && node.children.length > 0
);
if (firstNodeWithChildren) {
const simulatedContext = {
node: {
label: "孙东宇",
},
};
onClick(simulatedContext);
}
}
};
onMounted(async () => { onMounted(async () => {
getPersonName(); getPersonName();
getTableData();
// personName
}); });
</script> </script>
@ -380,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

@ -196,6 +196,8 @@ const tableData = ref([]);
const data = ref([]); const data = ref([]);
const loading = ref(false); const loading = ref(false);
const visiblePost = ref(false); const visiblePost = ref(false);
const rowItem = ref({});
const columns = ref([ const columns = ref([
{ {
colKey: "serial-number", colKey: "serial-number",
@ -339,7 +341,6 @@ const resetting = () => {
}; };
getNewTable(); getNewTable();
}; };
const rowItem = ref({});
const Quitneck = (value) => { const Quitneck = (value) => {
dialogData.value = { dialogData.value = {
quitneckDate: "", quitneckDate: "",
@ -355,9 +356,10 @@ const quitneckAdd = async ({ validateResult, firstError }) => {
if (rowItem.value.row.receiptNum - dialogData.value.quitneckNum < 0) { if (rowItem.value.row.receiptNum - dialogData.value.quitneckNum < 0) {
return MessagePlugin.error("退领数量不能大于领用数量"); return MessagePlugin.error("退领数量不能大于领用数量");
} }
dialogData.value.quitneckNum =
rowItem.value.row.receiptNum - dialogData.value.quitneckNum;
dialogData.value.id = rowItem.value.row.id; dialogData.value.id = rowItem.value.row.id;
dialogData.value.billserial = rowItem.value.row.billserial;
dialogData.value.billType = rowItem.value.row.billType;
dialogData.value.proposer = rowItem.value.row.proposer;
await receiptList.getquitneckNum(dialogData.value); await receiptList.getquitneckNum(dialogData.value);
getTableData(); getTableData();
MessagePlugin.success("提交成功"); MessagePlugin.success("提交成功");
@ -429,7 +431,6 @@ const getTableData = async () => {
onMounted(async () => { onMounted(async () => {
getPersonName(); getPersonName();
getTableData(); getTableData();
// personName
}); });
</script> </script>

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

@ -1,6 +1,6 @@
import { createRouter, createWebHistory } from "vue-router"; import { createRouter, createWebHistory } from "vue-router";
import FinanceBillManage from "./modules/financeBillManage"; import FinanceBillManage from "./modules/financeBillManage";
import ReceivablesManagement from "./modules/receivables-management"; import ReceivablesManagement from "./modules/receivablesManagement";
import StudentManage from "./modules/studentManage"; import StudentManage from "./modules/studentManage";
import Login from "@/pages/login/index.vue"; import Login from "@/pages/login/index.vue";
import Password from "@/pages/password/index.vue"; import Password from "@/pages/password/index.vue";

View File

@ -3,6 +3,8 @@ 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";
import BillDestroyURL from "@/pages/finance-bill-manage/billDestroy.vue";
const financeBillManage = [ const financeBillManage = [
{ {
@ -43,6 +45,22 @@ const financeBillManage = [
title: "票据退领", title: "票据退领",
}, },
}, },
{
path: "BillBreakagek",
name: "billBreakagek",
component: BillBreakagekURL,
meta: {
title: "票据报损",
},
},
{
path: "BillDestroy",
name: "billDestroy",
component: BillDestroyURL,
meta: {
title: "票据核销",
},
},
], ],
}, },
]; ];

View File

@ -0,0 +1,36 @@
import { defineStore } from "pinia";
import { reqBreakageList } from "@/api/finance-bill-manage/breakageList";
export const useBreakage = defineStore("breakageList", {
state: () => {
return {
breakageList: [],
destroyList: [],
};
},
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));
}
this.destroyList.push(arr);
localStorage.setItem("destroyList", JSON.stringify(this.breakageList));
return this.breakageList;
},
deleteBreakageList(item) {
let arr = this.breakageList.filter((i) => i.id !== item.id);
this.breakageList = arr;
},
},
persist: true,
});

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,
});

View File

@ -0,0 +1,56 @@
import { defineStore } from "pinia";
export const useQuitneckList = defineStore("QuitneckList", {
state: () => {
return {
sdyList: [],
ycyList: [],
lczList: [],
lxyList: [],
};
},
actions: {
getQuitneckList(name) {
this.sdyList = [];
this.ycyList = [];
this.lczList = [];
this.lxyList = [];
const allArr = JSON.parse(
localStorage.getItem("ReceiptList")
).quitneckList;
if (name === "孙东宇") {
allArr.forEach((item) => {
if (item.proposer === "孙东宇") {
this.sdyList.push(item);
}
});
return this.sdyList;
}
if (name === "杨春宇") {
allArr.forEach((item) => {
if (item.proposer === "杨春宇") {
this.ycyList.push(item);
}
});
return this.ycyList;
}
if (name === "吕才卓") {
allArr.forEach((item) => {
if (item.proposer === "吕才卓") {
this.lczList.push(item);
}
});
return this.lczList;
}
if (name === "刘欣宇") {
allArr.forEach((item) => {
if (item.proposer === "刘欣宇") {
this.lxyList.push(item);
}
});
return this.lxyList;
}
},
},
persist: true,
});

View File

@ -9,6 +9,7 @@ export const useReceiptList = defineStore("ReceiptList", {
return { return {
personName: [], personName: [],
receiptList: [], receiptList: [],
quitneckList: [],
}; };
}, },
actions: { actions: {
@ -25,12 +26,12 @@ export const useReceiptList = defineStore("ReceiptList", {
return this.receiptList; return this.receiptList;
}, },
async getquitneckNum(obj) { async getquitneckNum(obj) {
console.log(obj);
const index = this.receiptList.findIndex((item) => item.id === obj.id); const index = this.receiptList.findIndex((item) => item.id === obj.id);
if (index !== -1) { if (index !== -1) {
this.receiptList[index].receiptNum = obj.quitneckNum; this.receiptList[index].receiptNum =
this.receiptList[index].receiptNum - obj.quitneckNum;
} }
console.log(this.receiptList); this.quitneckList.push(obj);
}, },
}, },
persist: true, persist: true,