This commit is contained in:
sundongyu 2024-04-07 21:41:14 +08:00
commit 2ef3ac7697
23 changed files with 1335 additions and 218 deletions

View File

@ -2,7 +2,7 @@ import Mock from "mockjs";
const StockList = Mock.mock({ const StockList = Mock.mock({
"list|20-30": [ "list|20-30": [
{ {
"id|+1": "0", "id|+1": 0,
billserial: "@integer(100000000,199999999)1", billserial: "@integer(100000000,199999999)1",
billType: "@integer(0,4)", billType: "@integer(0,4)",
stockNum: "@integer(1,2)", stockNum: "@integer(1,2)",
@ -14,6 +14,43 @@ const StockList = Mock.mock({
], ],
}); });
const personName = () => {
return [
{
label: "员工名单",
children: [
{
label: "孙东宇",
},
{
label: "杨春宇",
},
{
label: "吕才卓",
},
{
label: "刘欣宇",
},
],
},
];
};
const CancelList = Mock.mock({
"list|20-30": [
{
"id|+1": 0,
billserial: "@integer(100000000,199999999)1",
billType: "@integer(0,4)",
cancelNum: "@integer(1,10)张",
appleDate: "@date",
proposer: "@cname",
approvalStatus: "@integer(0,3)",
reason: " @integer(10000000000,19999999999)",
},
],
});
export default [ export default [
{ {
url: "/api/stockList", url: "/api/stockList",
@ -25,4 +62,25 @@ export default [
}; };
}, },
}, },
{
url: "/api/cancelList",
method: "get",
response: () => {
return {
code: 200,
data: CancelList,
};
},
},
{
url: "/api/personName",
method: "get",
response: () => {
const list = personName();
return {
code: 200,
data: list,
};
},
},
]; ];

View File

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

View File

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

View File

@ -1,8 +1,8 @@
import request from "@/utils/request"; import request from "@/utils/request";
// 统一管理接口 // 统一管理接口
const API = { const API = {
LOGIN_URL: "/api/user", LOGIN_URL: "/api/login",
}; };
export const reqUser = () => request.get(API.LOGIN_URL); export const reqUser = () => request.post(API.LOGIN_URL);
export const reqUserone = (data) => request.post(API.LOGIN_URL, data); export const reqUserone = (data) => request.post(API.LOGIN_URL, data);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

BIN
src/assets/bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

BIN
src/assets/bg1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

@ -8,6 +8,12 @@
<t-menu-item value="1-1" to="/Bill/BillStock"> <t-menu-item value="1-1" to="/Bill/BillStock">
<span>票据入库管理</span> <span>票据入库管理</span>
</t-menu-item> </t-menu-item>
<t-menu-item value="1-2" to="/Bill/BillCancel">
<span>票据退库管理</span>
</t-menu-item>
<t-menu-item value="1-3" to="/Bill/BillReceipt">
<span>票据领用管理</span>
</t-menu-item>
</t-submenu> </t-submenu>
<t-submenu value="2" title="应收款管理"> <t-submenu value="2" title="应收款管理">
<template #icon> <template #icon>

View File

@ -11,4 +11,4 @@
<script setup></script> <script setup></script>
<style lang="scss" scoped></style> <style lang="less" scoped></style>

View File

@ -0,0 +1,464 @@
<template>
<div class="back-color">
<t-layout style="height: 90%; background-color: #f5f7fb">
<t-header class="scarch-box">
<t-form
ref="form"
:data="scarchData"
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="scarchData.billserial" maxlength="10"></t-input>
</t-form-item>
<t-form-item label="退库日期:" name="appleDate">
<t-date-picker v-model="scarchData.appleDate" clearable />
</t-form-item>
<t-form-item
label="票据类型:"
name="billType"
style="margin-bottom: 0.3rem"
>
<t-select
v-model="scarchData.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="approvalStatus"
style="margin-bottom: 0.3rem"
>
<t-select
v-model="scarchData.approvalStatus"
placeholder="请选择审批状态"
clearable
>
<t-option
v-for="item in approvalStatus"
: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="650"
>
<template #billType="{ row }">
<div v-for="item in billType" :key="item">
<span v-if="row.billType === item.value">{{ item.label }}</span>
</div>
</template>
<template #approvalStatus="{ row }">
<div v-for="item in approvalStatus" :key="item">
<t-tag
v-if="row.approvalStatus === item.value"
:theme="tagColor(row.approvalStatus)"
variant="light"
>
{{ item.label }}
</t-tag>
</div>
</template>
<template #status="slotProps">
<t-button
theme="default"
variant="text"
size="small"
@click="Approve(slotProps)"
>
<span v-if="slotProps.row.approvalStatus === 0">{{
"审批"
}}</span>
<span v-if="slotProps.row.approvalStatus === 3">{{
"重新审批"
}}</span>
</t-button>
</template>
</t-base-table>
</t-content>
</t-layout>
<t-space>
<t-dialog
ref="postForm"
v-model:visible="visiblePost"
header="审批"
width="40%"
:confirm-on-enter="true"
:on-close="closePost"
:confirm-btn="null"
:cancel-btn="null"
>
<t-space direction="vertical">
<div>
<t-form
ref="formDialog"
scroll-to-first-error="smooth"
label-align="left"
:rules="FORM_RULES"
:data="dialogData"
:colon="true"
@submit="cancelAdd"
label-width="calc(2em + 55px)"
@reset="onReset"
>
<t-form-item
label="审批人"
name="approver"
style="margin-bottom: 1.5rem; width: 35rem"
>
<t-input
v-model="dialogData.approver"
placeholder="请输入审批人"
></t-input>
</t-form-item>
<t-form-item
label="审批时间"
name="approvalDate"
style="margin-bottom: 1.5rem; width: 35rem"
>
<t-date-picker
v-model="dialogData.approvalDate"
placeholder="请选择审批时间"
clearable
style="width: 35rem"
/>
</t-form-item>
<t-form-item label="审批原因" name="approvalReason">
<t-textarea
v-model="dialogData.approvalReason"
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 { LoadIcon } from "tdesign-icons-vue-next";
import { useCancel } from "@/stores/billCancel";
//
const billType = ref([
{ label: "票据类型1", value: 0 },
{ label: "票据类型2", value: 1 },
{ label: "票据类型3", value: 2 },
{ label: "票据类型4", value: 3 },
{ label: "票据类型5", value: 4 },
]);
//
const approvalStatus = ref([
{ label: "待审批", value: 0 },
{ label: "审核中", value: 1 },
{ label: "审核通过", value: 2 },
{ label: "审核拒绝", value: 3 },
]);
//
const pagination = ref({
defaultCurrent: 1,
defaultPageSize: 10,
total: 50,
});
//
const scarchData = ref({
billserial: "",
billType: "",
appleDate: "",
approvalStatus: [],
});
//
const loading = ref(false);
const visiblePost = ref(false);
const cancelList = useCancel();
const tableData = ref();
const data = 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: "cancelNum",
title: "退库数量",
align: "center",
width: "100",
},
{
colKey: "appleDate",
title: "申请时间",
align: "center",
width: "100",
},
{
colKey: "proposer",
title: "申请人",
align: "center",
width: "100",
},
{
colKey: "approvalStatus",
title: "审批状态",
align: "center",
width: "100",
},
{
colKey: "reason",
title: "退库原因",
ellipsis: true,
align: "center",
width: "100",
},
{
colKey: "status",
title: "操作",
width: 120,
align: "center",
fixed: "right",
},
]);
const FORM_RULES = {
approver: [{ required: true, message: "请输入审批人", trigger: "blur" }],
approvalDate: [
{ required: true, message: "请选择入库日期", trigger: ["blur", "change"] },
],
approvalReason: [
{ required: true, message: "请输入审批原因", trigger: "blur" },
],
};
//
const dialogData = ref({
approver: "",
approvalDate: "",
approvalReason: "",
});
//
const tableList = async () => {
loading.value = true;
tableData.value = await cancelList.getCancelList();
data.value = await cancelList.getCancelList();
pagination.value.total = tableData.value.length;
const timerId = setTimeout(() => {
loading.value = false;
clearInterval(timerId);
}, 300);
};
// tag
const tagColor = (value) => {
switch (value) {
case 0:
return "default";
case 1:
return "warning";
case 2:
return "success";
case 3:
return "danger";
}
};
//
const refresh = () => {
tableList();
};
//
const headerQuery = () => {
tableData.value = data.value;
if (
scarchData.value.billserial === "" &&
(scarchData.value.billType === undefined ||
scarchData.value.billType === "") &&
(scarchData.value.approvalStatus === undefined ||
scarchData.value.approvalStatus === "") &&
scarchData.value.appleDate === ""
) {
getNewTable();
} else {
const list = tableData.value.filter((item) => {
let arrList;
if (scarchData.value.billserial === item.billserial) {
arrList = item;
}
if (scarchData.value.billType === item.billType) {
arrList = item;
}
if (scarchData.value.approvalStatus === item.approvalStatus) {
arrList = item;
}
if (scarchData.value.appleDate === item.appleDate) {
arrList = item;
}
if (
scarchData.value.billserial === "" &&
scarchData.value.billType === "" &&
scarchData.value.stockDate === ""
) {
arrList = item;
}
return arrList;
});
tableData.value = list;
pagination.value.total = list.length;
}
};
//
const resetting = () => {
scarchData.value = {
billserial: "",
billType: "",
appleDate: "",
approvalStatus,
};
getNewTable();
};
const rowItem = ref({});
const Approve = (value) => {
dialogData.value = {
approver: "",
approvalDate: "",
approvalReason: "",
};
visiblePost.value = true;
rowItem.value = value;
};
//
const onReset = () => {};
//
const cancelAdd = async ({ validateResult, firstError }) => {
if (validateResult === true) {
rowItem.value.row.approvalStatus = 1;
await cancelList.editApprovalStatus(rowItem.value);
getNewTable();
MessagePlugin.success("提交成功");
visiblePost.value = false;
} else {
console.log("Validate Errors: ", firstError, validateResult);
}
};
// menuManagement
const getNewTable = () => {
let arr = JSON.parse(localStorage.getItem("CancelList"));
if (arr) {
tableData.value = arr.cancelList;
data.value = arr.cancelList;
pagination.value.total = tableData.value.length;
} else {
tableList();
}
};
onMounted(() => {
getNewTable();
});
</script>
<style lang="less" scoped>
.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

@ -0,0 +1,191 @@
<template>
<div class="back-color">
<t-layout style="height: 100%; background-color: #f5f7fb">
<t-aside class="asideTree">
<t-space direction="vertical">
<t-tree
:data="personName"
hover
transition
activable
expandAll
:expand-mutex="mutex"
expand-on-click-node="true"
@click="onClick"
/>
</t-space>
</t-aside>
<t-content>
<t-layout style="height: 100%; background-color: #f5f7fb">
<t-header class="scarch-box">
<t-form
ref="form"
:data="scarchData"
label-width="calc(2em + 40px)"
layout="inline"
scroll-to-first-error="smooth"
class="scarch-from"
@reset="resetting"
@submit="headerQuery"
>
<div style="margin-left: 1rem; margin-top: 1px">
<t-form-item label="票据编号:" name="billserial">
<t-input
v-model="scarchData.billserial"
maxlength="10"
></t-input>
</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="650"
>
<template #billType="{ row }">
<div v-for="item in billType" :key="item">
<span v-if="row.billType === item.value">{{
item.label
}}</span>
</div>
</template>
<template #approvalStatus="{ row }">
<div v-for="item in approvalStatus" :key="item">
<t-tag
v-if="row.approvalStatus === item.value"
:theme="tagColor(row.approvalStatus)"
variant="light"
>
{{ item.label }}
</t-tag>
</div>
</template>
<template #status="slotProps">
<t-button
theme="default"
variant="text"
size="small"
@click="Approve(slotProps)"
>
<span v-if="slotProps.row.approvalStatus === 0">{{
"审批"
}}</span>
<span v-if="slotProps.row.approvalStatus === 3">{{
"重新审批"
}}</span>
</t-button>
</template>
</t-base-table>
</t-content>
</t-layout>
</t-content>
</t-layout>
</div>
</template>
<script setup>
import { ref, onMounted } from "vue";
import { MessagePlugin } from "tdesign-vue-next";
import { LoadIcon } from "tdesign-icons-vue-next";
import { useReceiptList } from "@/stores/billReceipt";
const receiptList = useReceiptList();
const personName = ref([]);
//
const scarchData = ref({
billserial: "",
});
//
const personList = async () => {
personName.value = await receiptList.getPersonNameList();
console.log(personName.value);
};
const onClick = (context) => {
//
if (context.node.value === "t1") {
return;
}
console.info("onClick", context);
};
// menuManagement
const getNewTable = () => {
let arr = JSON.parse(localStorage.getItem("ReceiptList"));
if (arr) {
personName.value = arr.personName;
} else {
personList();
}
};
onMounted(() => {
getNewTable();
});
</script>
<style scoped lang="less">
.asideTree {
margin-right: 2rem;
display: flex;
justify-content: center;
padding: 1rem;
}
.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: 41rem;
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-tree--transition .t-tree__label) {
width: 10rem;
}
:deep(.t-form__controls-content) {
justify-content: space-between;
}
</style>

View File

@ -1,6 +1,7 @@
<template> <template>
<div class="back-color"> <div class="back-color">
<div class="scarch-box"> <t-layout style="height: 90%; background-color: #f5f7fb">
<t-header class="scarch-box">
<t-form <t-form
ref="form" ref="form"
:data="formData" :data="formData"
@ -13,13 +14,17 @@
> >
<div style="margin-left: 1rem"> <div style="margin-left: 1rem">
<t-form-item label="票据编号:" name="billserial"> <t-form-item label="票据编号:" name="billserial">
<t-input v-model="formData.billserial"></t-input> <t-input v-model="formData.billserial" maxlength="10"></t-input>
</t-form-item> </t-form-item>
<t-form-item label="入库日期:" name="stockDate"> <t-form-item label="入库日期:" name="stockDate">
<t-date-picker v-model="formData.stockDate" clearable /> <t-date-picker v-model="formData.stockDate" clearable />
</t-form-item> </t-form-item>
<t-form-item label="票据类型:" name="billType"> <t-form-item
label="票据类型:"
name="billType"
style="margin-bottom: 0.3rem"
>
<t-select <t-select
v-model="formData.billType" v-model="formData.billType"
placeholder="请选择票据类型" placeholder="请选择票据类型"
@ -39,8 +44,8 @@
<t-button theme="primary" type="reset">重置</t-button> <t-button theme="primary" type="reset">重置</t-button>
</t-form-item> </t-form-item>
</t-form> </t-form>
</div> </t-header>
<div class="table-box"> <t-content class="table-box">
<div class="table-header"> <div class="table-header">
<div> <div>
<h4 style="font-size: 110%">票据列表</h4> <h4 style="font-size: 110%">票据列表</h4>
@ -80,24 +85,25 @@
theme="default" theme="default"
variant="text" variant="text"
size="small" size="small"
@click="look(slotProps)" @click="stockEdit(slotProps)"
>查看</t-button >修改</t-button
> >
<t-button <t-button
theme="default" theme="default"
variant="text" variant="text"
size="small" size="small"
@click="deleteBtn(slotProps)" @click="stockDelete(slotProps)"
>删除</t-button >删除</t-button
> >
</template> </template>
</t-base-table> </t-base-table>
</div> </t-content>
</t-layout>
<t-space> <t-space>
<t-dialog <t-dialog
ref="postForm" ref="postForm"
v-model:visible="visiblePost" v-model:visible="visiblePost"
header="新增职位" header="新增票据"
width="40%" width="40%"
:confirm-on-enter="true" :confirm-on-enter="true"
:on-close="closePost" :on-close="closePost"
@ -217,175 +223,247 @@
</template> </template>
<script setup> <script setup>
import { reactive, ref, onMounted } from 'vue' import { ref, onMounted } from "vue";
import { MessagePlugin } from 'tdesign-vue-next' import { MessagePlugin } from "tdesign-vue-next";
import { AddIcon, LoadIcon } from 'tdesign-icons-vue-next' import { AddIcon, LoadIcon } from "tdesign-icons-vue-next";
import { reqStockList } from '@/api/stockList' import { useStock } from "@/stores/billStock";
import { useStock } from '@/stores/billStock'
// import { number } from "echarts";
const loading = ref(false) //
const visiblePost = ref(false) const loading = ref(false);
const stockList = useStock() const visiblePost = ref(false);
const tableData = ref() const stockList = useStock();
const data = ref() const tableData = ref();
const data = ref();
//
const columns = ref([ const columns = ref([
{ {
colKey: 'serial-number', colKey: "serial-number",
title: '序号', title: "序号",
width: 50 width: 50,
}, },
{ {
colKey: 'billserial', colKey: "billserial",
title: '票据编号', title: "票据编号",
align: 'center', align: "center",
width: '100' width: "100",
}, },
{ {
colKey: 'billType', colKey: "billType",
title: '票据类型', title: "票据类型",
align: 'center', align: "center",
width: '100' width: "100",
}, },
{ {
colKey: 'stockNum', colKey: "stockNum",
title: '入库数量', title: "入库数量",
align: 'center', align: "center",
width: '100' width: "100",
}, },
{ {
colKey: 'unit', colKey: "unit",
title: '单位(如:本、张)', title: "单位(如:本、张)",
align: 'center', align: "center",
width: '100' width: "100",
}, },
{ {
colKey: 'stockDate', colKey: "stockDate",
title: '入库日期', title: "入库日期",
align: 'center', align: "center",
width: '100' width: "100",
}, },
{ {
colKey: 'operator', colKey: "operator",
title: '操作员', title: "操作员",
align: 'center', align: "center",
width: '100' width: "100",
}, },
{ {
colKey: 'remark', colKey: "remark",
title: '备注', title: "备注",
align: 'center', align: "center",
width: '100' width: "100",
}, },
{ {
colKey: 'status', colKey: "status",
title: '操作', title: "操作",
width: 120, width: 120,
align: 'center', align: "center",
fixed: 'right' fixed: "right",
} },
]) ]);
//
const billType = ref([ const billType = ref([
{ label: '票据类型1', value: 0 }, { label: "票据类型1", value: 0 },
{ label: '票据类型2', value: 1 }, { label: "票据类型2", value: 1 },
{ label: '票据类型3', value: 2 }, { label: "票据类型3", value: 2 },
{ label: '票据类型4', value: 3 }, { label: "票据类型4", value: 3 },
{ label: '票据类型5', value: 4 } { label: "票据类型5", value: 4 },
]) ]);
//
const tableList = async () => { const tableList = async () => {
tableData.value = await stockList.getStockList() loading.value = true;
data.value = await stockList.getStockList() tableData.value = await stockList.getStockList();
pagination.value.total = tableData.value.length data.value = await stockList.getStockList();
} pagination.value.total = tableData.value.length;
const timerId = setTimeout(() => {
loading.value = false;
clearInterval(timerId);
}, 300);
};
//
const refresh = () => {
tableList();
};
//
const dialogData = ref({ const dialogData = ref({
billserial: '', billserial: "",
stockNum: number, stockNum: Number,
unit: '', unit: "",
operator: '', operator: "",
remark: '', remark: "",
stockDate: '' stockDate: "",
}) });
//
const formData = ref({ const formData = ref({
billserial: '', billserial: "",
billType: '', billType: "",
stockDate: '' stockDate: "",
}) });
//
const pagination = ref({ const pagination = ref({
defaultCurrent: 1, defaultCurrent: 1,
defaultPageSize: 10, defaultPageSize: 10,
total: 50 total: 50,
}) });
//
const resetting = () => { const resetting = () => {
formData.value = { formData.value = {
billserial: '', billserial: "",
billType: '', billType: "",
stockDate: '' stockDate: "",
} };
tableList() getNewTable();
} };
const headerQuery = ({ validateResult, firstError }) => { //
tableData.value = data.value const headerQuery = () => {
tableData.value = data.value;
if ( if (
formData.value.billserial === '' && formData.value.billserial === "" &&
(formData.value.billType === undefined || formData.value.billType === '') && (formData.value.billType === undefined || formData.value.billType === "") &&
formData.value.stockDate === '' formData.value.stockDate === ""
) { ) {
tableList() getNewTable();
} else { } else {
const list = tableData.value.filter(item => { const list = tableData.value.filter((item) => {
console.log(item) let arrList;
let arrList
if (formData.value.billserial === item.billserial) { if (formData.value.billserial === item.billserial) {
arrList = item arrList = item;
} }
if (formData.value.billType === item.billType) { if (formData.value.billType === item.billType) {
arrList = item arrList = item;
} }
if (formData.value.stockDate === item.stockDate) { if (formData.value.stockDate === item.stockDate) {
arrList = item arrList = item;
} }
if ( if (
formData.value.billserial === '' && formData.value.billserial === "" &&
formData.value.billType === '' && formData.value.billType === "" &&
formData.value.stockDate === '' formData.value.stockDate === ""
) { ) {
arrList = item arrList = item;
} }
return arrList return arrList;
}) });
console.log(list) tableData.value = list;
tableData.value = list
// @ts-expect-error // @ts-expect-error
pagination.value.total = list.length pagination.value.total = list.length;
} }
} };
//
const addStock = () => { const addStock = () => {
visiblePost.value = true visiblePost.value = true;
} dialogData.value = {
billserial: "",
stockNum: "",
unit: "",
operator: "",
remark: "",
stockDate: "",
};
};
//
const closePost = () => {
visiblePost.value = false;
};
// //
const FORM_RULES = { const FORM_RULES = {
billserial: [{ required: true, message: '请输入票据编号', trigger: 'blur' }], billserial: [{ required: true, message: "请输入票据编号", trigger: "blur" }],
billType: [ billType: [
{ required: true, message: '请选择票据类型', trigger: ['blur', 'change'] } { required: true, message: "请选择票据类型", trigger: ["blur", "change"] },
], ],
stockNum: [{ required: true, message: '请输入库存数量', trigger: 'blur' }], stockNum: [{ required: true, message: "请输入库存数量", trigger: "blur" }],
unit: [{ required: true, message: '请输入单位', trigger: 'blur' }], unit: [{ required: true, message: "请输入单位", trigger: "blur" }],
stockDate: [ stockDate: [
{ required: true, message: '请选择入库日期', trigger: ['blur', 'change'] } { required: true, message: "请选择入库日期", trigger: ["blur", "change"] },
], ],
operator: [{ required: true, message: '请输入操作员', trigger: 'blur' }] operator: [{ required: true, message: "请输入操作员", trigger: "blur" }],
} };
const stockAdd = () => {}
//
const stockAdd = async ({ validateResult, firstError }) => {
if (validateResult === true) {
await stockList.addStockList(dialogData.value);
getNewTable();
MessagePlugin.success("提交成功");
visiblePost.value = false;
} else {
console.log("Validate Errors: ", firstError, validateResult);
}
};
//
const stockEdit = (item) => {
visiblePost.value = true;
tableData.value.forEach((itemTable) => {
if (itemTable.id === item.row.id) {
dialogData.value = itemTable;
}
});
};
//
const stockDelete = async (itme) => {
await stockList.deleteStockList(itme.row);
getNewTable();
};
//
const onReset = () => {};
// menuManagement
const getNewTable = () => {
let arr = JSON.parse(localStorage.getItem("menuManagement"));
if (arr) {
tableData.value = arr.stockList;
data.value = arr.stockList;
pagination.value.total = tableData.value.length;
} else {
tableList();
}
};
onMounted(() => { onMounted(() => {
tableList() getNewTable();
}) });
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
@ -401,7 +479,7 @@ onMounted(() => {
} }
} }
.table-box { .table-box {
height: 41rem; height: 42rem;
background-color: @base-white-color; background-color: @base-white-color;
padding: 1rem; padding: 1rem;
padding-top: 0; padding-top: 0;

View File

@ -33,10 +33,15 @@
<lock-on-icon slot:string="prefix-icon"></lock-on-icon> <lock-on-icon slot:string="prefix-icon"></lock-on-icon>
</t-input> </t-input>
</t-form-item> </t-form-item>
<t-form-item> <t-form-item class="form-actions">
<t-button theme="primary" type="submit" block>登录</t-button> <t-button theme="primary" type="submit" block>登录</t-button>
<div class="forgot-password-spacer"></div>
<button @click.prevent="showForgotPasswordModal">忘记密码</button> <t-button
type="text"
@click="handleForgotPasswordClick"
class="text"
>修改密码</t-button
>
</t-form-item> </t-form-item>
</t-form> </t-form>
</div> </div>
@ -137,6 +142,11 @@ const onSubmit = async () => {
onMounted(() => { onMounted(() => {
reqUser(); reqUser();
}); });
function handleForgotPasswordClick() {
router.push("/password-reset")
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@ -145,7 +155,7 @@ onMounted(() => {
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: url(../../assets/bg.jpeg); background: url(../../assets/bg.jpg);
background-size: cover; background-size: cover;
overflow: hidden; overflow: hidden;
} }
@ -174,4 +184,18 @@ onMounted(() => {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.form-actions {
display: flex;
justify-content: space-between;
}
.forgot-password-spacer {
flex-grow: 1;
width: 0;
height: 0;
margin-left: 3rem;
}
.text {
padding-left: 1.8rem;
padding-right: 1.8rem;
}
</style> </style>

View File

@ -0,0 +1,197 @@
<template>
<div class="password-container">
<div class="password-form">
<t-form
:data="formData"
:rules="rules"
ref="form"
@reset="onReset"
@submit="onSubmit"
@validate="onValidate"
>
<t-form-item label="学号" name="account">
<t-input
v-model="formData.account"
placeholder="请输入学号"
></t-input>
</t-form-item>
<t-form-item label="密码" name="password">
<t-input
type="password"
v-model="formData.password"
placeholder="请输入密码"
></t-input>
</t-form-item>
<t-form-item label="确认密码" name="rePassword">
<t-input
type="password"
v-model="formData.rePassword"
placeholder="请再次输入密码"
></t-input>
</t-form-item>
<t-form-item style="margin-left: 6rem">
<t-space size="10px">
<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>
</div>
</template>
<script setup>
import { MessagePlugin } from "tdesign-vue-next";
import { reactive } from "vue";
import router from "@/router";
const INITIAL_DATA = {
account: "",
password: "",
rePassword: "",
};
const formData = reactive({
...INITIAL_DATA,
});
const rules = reactive({
account: [
{
required: true,
message: "学号必填",
type: "error",
},
{
min: 10,
message: "输入不正确",
},
{
max: 10,
message: "输入不正确",
},
],
password: [
{
required: true,
message: "密码必填",
type: "error",
},
{
len: 8,
message: "请输入 8 位密码",
},
{
pattern: /[A-Z]+/,
message: "密码必须包含大写字母",
},
],
rePassword: [
{
required: true,
message: "密码必填",
type: "error",
},
{
len: 8,
message: "请输入 8 位密码",
},
{
pattern: /[A-Z]+/,
message: "密码必须包含大写字母",
},
],
});
const onReset = () => {
MessagePlugin.success("重置成功");
};
const onSubmit = ({ validateResult, firstError }) => {
if (validateResult === true) {
MessagePlugin.success("提交成功");
} else {
console.log("Errors: ", validateResult);
MessagePlugin.warning(firstError);
}
};
const onValidate = ({ validateResult, firstError }) => {
if (validateResult === true) {
console.log("Validate Success");
} else {
console.log("Validate Errors: ", firstError, validateResult);
}
};
// 使 resolve
const userNameValidator = (val) =>
new Promise((resolve) => {
const timer = setTimeout(() => {
if (["Zhang", "Li", "Wang"].includes(val)) {
resolve({
result: true,
});
} else {
resolve({
result: false,
message: "用户名不存在",
type: "error",
});
}
clearTimeout(timer);
}, 10);
});
//
const passwordValidator = (val) => {
if (val.length > 0 && val.length <= 2) {
return {
result: false,
message: "太简单了!再开动一下你的小脑筋吧!",
type: "error",
};
}
if (val.length > 2 && val.length < 4) {
return {
result: false,
message: "还差一点点,就是一个完美的密码了!",
type: "warning",
};
}
return {
result: true,
message: "太强了,你确定自己记得住吗!",
type: "success",
};
};
//
const rePassword = (val) =>
new Promise((resolve) => {
const timer = setTimeout(() => {
resolve(formData.password === val);
clearTimeout(timer);
});
});
</script>
<style lang="less" scoped>
.password-container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-image: url(../../assets/bg1.jpg);
background-size: cover;
padding: 2rem;
}
.password-form {
width: 26%;
height: 35%;
background-color: rgba(255, 255, 255, 0.8);
border-radius: 1.25rem;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
</style>

View File

@ -39,7 +39,8 @@
</template> </template>
<script setup> <script setup>
import { MessagePlugin } from "tdesign-vue-next";
import { ref } from "vue";
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped></style>
</style>

View File

@ -2,6 +2,7 @@ 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/receivables-management";
import Login from "@/pages/login/index.vue"; import Login from "@/pages/login/index.vue";
import Password from "@/pages/password/index.vue";
import Student from "@/pages/students/student.vue"; import Student from "@/pages/students/student.vue";
import Layout from "@/layout/index.vue"; import Layout from "@/layout/index.vue";
@ -14,6 +15,11 @@ const router = createRouter({
name: "login", name: "login",
component: Login, component: Login,
}, },
{
path: "/password-reset",
name: "password",
component: Password,
},
{ {
path: "/student", path: "/student",
name: "student", name: "student",

View File

@ -1,5 +1,7 @@
import Layout from "@/layout/index.vue"; import Layout from "@/layout/index.vue";
import BillManage from "@/pages/finance-bill-manage/billStock.vue"; import BillStockURL from "@/pages/finance-bill-manage/billStock.vue";
import BillCancelURL from "@/pages/finance-bill-manage/billCancel.vue";
import BillReceiptURL from "@/pages/finance-bill-manage/billReceipt.vue";
const financeBillManage = [ const financeBillManage = [
{ {
@ -11,11 +13,27 @@ const financeBillManage = [
{ {
path: "BillStock", path: "BillStock",
name: "billStock", name: "billStock",
component: BillManage, component: BillStockURL,
meta: { meta: {
title: "票据上传", title: "票据上传",
}, },
}, },
{
path: "BillCancel",
name: "billCancel",
component: BillCancelURL,
meta: {
title: "票据退库",
},
},
{
path: "BillReceipt",
name: "billReceipt",
component: BillReceiptURL,
meta: {
title: "票据领用",
},
},
], ],
}, },
]; ];

30
src/stores/billCancel.js Normal file
View File

@ -0,0 +1,30 @@
import { defineStore } from "pinia";
import { reqCancelList } from "@/api/finance-bill-manage/cancelList";
export const useCancel = defineStore("CancelList", {
state: () => {
return {
cancelList: [],
};
},
actions: {
async getCancelList() {
let { data } = await reqCancelList();
this.cancelList = data.list;
return this.cancelList;
},
editApprovalStatus(arr) {
console.log(arr);
const index = this.cancelList.findIndex((item) => item.id === arr.row.id);
if (index !== -1) {
console.log("index", index);
this.cancelList[index] = arr.row;
}
},
deleteCancelList(item) {
let arr = this.cancelList.filter((i) => i.id !== item.id);
this.cancelList = arr;
},
},
persist: true,
});

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

@ -0,0 +1,19 @@
import { defineStore } from "pinia";
import { reqPersonName } from "@/api/finance-bill-manage/receiptList";
export const useReceiptList = defineStore("ReceiptList", {
state: () => {
return {
personName: [],
};
},
actions: {
async getPersonNameList() {
const { data } = await reqPersonName();
this.personName = data;
console.log(this.personName);
return this.personName;
},
},
persist: true,
});

View File

@ -1,5 +1,5 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { reqStockList } from "@/api/stockList"; import { reqStockList } from "@/api/finance-bill-manage/stockList";
export const useStock = defineStore("menuManagement", { export const useStock = defineStore("menuManagement", {
state: () => { state: () => {
@ -15,12 +15,16 @@ export const useStock = defineStore("menuManagement", {
}, },
addStockList(arr) { addStockList(arr) {
const index = this.stockList.findIndex((item) => item.id === arr.id); const index = this.stockList.findIndex((item) => item.id === arr.id);
console.log(arr);
if (index !== -1) { if (index !== -1) {
this.stockList[index] = arr; this.stockList[index] = arr;
console.log(this.stockList, "222");
} else { } else {
arr.id = new Date().getTime(); arr.id = new Date().getTime();
this.stockList.unshift(arr); this.stockList.unshift(arr);
localStorage.setItem("stockList", JSON.stringify(this.stockList));
} }
return this.stockList;
}, },
deleteStockList(item) { deleteStockList(item) {
let arr = this.stockList.filter((i) => i.id !== item.id); let arr = this.stockList.filter((i) => i.id !== item.id);

View File

@ -203,3 +203,6 @@ a:active {
.t-button--variant-text .t-button__text:hover { .t-button--variant-text .t-button__text:hover {
color: #8799a3; color: #8799a3;
} }
.t-is-disabled .t-button__text {
color: #d3d3d3 !important;
}

View File

@ -49,3 +49,7 @@ a:active {
.t-button--variant-text .t-button__text:hover { .t-button--variant-text .t-button__text:hover {
color: #8799a3; color: #8799a3;
} }
// 禁用的颜色
.t-is-disabled .t-button__text{
color: #d3d3d3 !important;
}